aboutsummaryrefslogtreecommitdiff
path: root/VexRiscvSocSoftware/projects/briey/uart/src/main.c
blob: d1fbe17e4eab400055c8d78d5e75443351e23b34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <briey.h>

void print(char *str){
	while(*str){
		uart_write(UART,*(str++));
	}
}

int main() {
	Uart_Config uartConfig;
	uartConfig.dataLength = 8;
	uartConfig.parity = NONE;
	uartConfig.stop = ONE;
	uartConfig.clockDivider = 50000000/8/115200-1;
	uart_applyConfig(UART,&uartConfig);

	print("Hello !\n");

	while(1){
		for(uint32_t idx = '0';idx <= '9';idx++){
			uart_write(UART, idx);
		}
		for(uint32_t idx = 'a';idx <= 'z';idx++){
			uart_write(UART, idx);
		}
		for(uint32_t idx = 'A';idx <= 'Z';idx++){
			uart_write(UART, idx);
		}
	}
}


void irqCallback(){

}