Project

General

Profile

Revision 261

stuff

View differences:

test7.c
1 1
#include <lcom/lcf.h>
2 2

  
3 3
#include "errors.h"
4
#include "uart.h"
4
#include "nctp.h"
5 5

  
6 6
int ser_test_conf(unsigned short base_addr) {
7 7
	int ret = SUCCESS;
......
37 37
	if((ret = uart_disable_int_rx(base_addr))) return ret;
38 38
	if((ret = uart_disable_int_tx(base_addr))) return ret;
39 39
	if(tx == 0){
40
		uint8_t c;
41
		if((ret = uart_get_char_poll(base_addr, &c))) return ret;
42
		while((char)c != '.'){
43
			printf("%c", (char)c);
44
			if((ret = uart_get_char_poll(base_addr, &c))) return ret;
40
		uint8_t c = ' ';
41
		int r;
42
		while(c != '.'){
43
			r = nctp_get_char_poll(base_addr, &c);
44
			if(r == TIMEOUT_ERROR) continue;
45
			else if(r != SUCCESS ) return r;
46
			printf("%c", c);
45 47
		}
46
		printf("%c\n", (char)c);
47 48
	}else{
48 49
		for(int i = 0; i < stringc; ++i){
49 50
			for(int j = 0; strings[i][j] != 0; ++j)
50
				if((ret = uart_send_char_poll(base_addr, strings[i][j])))
51
				if((ret = nctp_send_char_poll(base_addr, strings[i][j])))
51 52
					return ret;
52 53
			if(i+1 != stringc)
53
				if((ret = uart_send_char_poll(base_addr, ' '))) return ret;
54
				if((ret = nctp_send_char_poll(base_addr, ' '))) return ret;
54 55
		}
55
		if((ret = uart_send_char_poll(base_addr, '.'))) return ret;
56
		if((ret = nctp_send_char_poll(base_addr, '.'))) return ret;
56 57
	}
57 58
	return SUCCESS;
58 59
}

Also available in: Unified diff