Revision 244
changed macros a bit to only compile what i want
proj/src/proj.c | ||
---|---|---|
163 | 163 |
unsigned long rate = 9600; |
164 | 164 |
unsigned char tx = 0; |
165 | 165 |
int stringc = 2; |
166 |
char *strings[] = {"Hello.", "world."};
|
|
166 |
char *strings[] = {"Hello", "world"};
|
|
167 | 167 |
if((r = ser_test_conf(COM1_ADDR))) return r; |
168 | 168 |
if((r = ser_test_set(COM1_ADDR, bits, stop, parity, rate))) return r; |
169 | 169 |
if((r = ser_test_poll(COM1_ADDR, tx, bits, stop, parity, rate, stringc, strings))) return r; |
proj/src/test7.c | ||
---|---|---|
33 | 33 |
int ser_test_poll(unsigned short base_addr, unsigned char tx, unsigned long bits, |
34 | 34 |
unsigned long stop, long parity, unsigned long rate, |
35 | 35 |
int stringc, char *strings[]) { |
36 |
/* To be completed */ |
|
37 |
return 1; |
|
36 |
int ret = SUCCESS; |
|
37 |
if((ret = ser_test_set(base_addr, bits, stop, parity, rate))) return ret; |
|
38 |
if(tx == 0){ |
|
39 |
char c; |
|
40 |
if((ret = uart_get_char(base_addr, &c))) return ret; |
|
41 |
while(c != '.'){ |
|
42 |
printf("%c", c); |
|
43 |
if((ret = uart_get_char(base_addr, &c))) return ret; |
|
44 |
} |
|
45 |
}else{ |
|
46 |
for(int i = 0; i < stringc; ++i){ |
|
47 |
int j = 0; |
|
48 |
while(stringc[i][j] != 0) |
|
49 |
if((ret = uart_send_char(base_addr, stringc[i][j]))) return ret; |
|
50 |
if(i+1 != stringc) if((ret = uart_send_char(base_addr, ' '))) return ret; |
|
51 |
} |
|
52 |
if((ret = uart_send_char(base_addr, '.'))) return ret; |
|
53 |
} |
|
54 |
return SUCCESS; |
|
38 | 55 |
} |
39 | 56 |
|
40 | 57 |
int ser_test_int(/* details to be provided */) { |
Also available in: Unified diff