Revision 249
implementing uart. done with basic functions, still planning protocol
test7.c | ||
---|---|---|
1 | 1 |
#include <lcom/lcf.h> |
2 | 2 |
|
3 | 3 |
#include "errors.h" |
4 |
#include "uart_macros.h" |
|
5 | 4 |
#include "uart.h" |
6 | 5 |
|
7 | 6 |
int ser_test_conf(unsigned short base_addr) { |
... | ... | |
36 | 35 |
int ret = SUCCESS; |
37 | 36 |
if((ret = ser_test_set(base_addr, bits, stop, parity, rate))) return ret; |
38 | 37 |
if(tx == 0){ |
39 |
/* |
|
40 |
char c; |
|
41 |
if((ret = uart_get_char(base_addr, &c))) return ret; |
|
42 |
while(c != '.'){ |
|
43 |
printf("%c", c); |
|
44 |
if((ret = uart_get_char(base_addr, &c))) return ret; |
|
38 |
uint8_t c; |
|
39 |
if((ret = uart_get_char_poll(base_addr, &c))) return ret; |
|
40 |
while((char)c != '.'){ |
|
41 |
printf("%c", (char)c); |
|
42 |
if((ret = uart_get_char_poll(base_addr, &c))) return ret; |
|
45 | 43 |
} |
46 |
*/
|
|
44 |
printf("%c\n", (char)c);
|
|
47 | 45 |
}else{ |
48 |
/* |
|
49 | 46 |
for(int i = 0; i < stringc; ++i){ |
50 |
int j = 0; |
|
51 |
while(stringc[i][j] != 0) |
|
52 |
if((ret = uart_send_char(base_addr, stringc[i][j]))) return ret; |
|
53 |
if(i+1 != stringc) if((ret = uart_send_char(base_addr, ' '))) return ret; |
|
47 |
size_t sz = strlen(strings[i]); |
|
48 |
if((ret = uart_send_memory_poll(base_addr, strings[i], sz))) return ret; |
|
49 |
if(i+1 != stringc) if((ret = uart_send_memory_poll(base_addr, " ", 1))) return ret; |
|
54 | 50 |
} |
55 |
if((ret = uart_send_char(base_addr, '.'))) return ret; |
|
56 |
*/ |
|
51 |
if((ret = uart_send_memory_poll(base_addr, ".", 1))) return ret; |
|
57 | 52 |
} |
58 | 53 |
return SUCCESS; |
59 | 54 |
} |
Also available in: Unified diff