Project

General

Profile

Statistics
| Revision:

root / proj / src / test7.c @ 241

History | View | Annotate | Download (1.46 KB)

1
#include <lcom/lcf.h>
2

    
3
#include "errors.h"
4
#include "uart_macros.h"
5
#include "uart.h"
6

    
7
int ser_test_conf(unsigned short base_addr) {
8
        int ret = SUCCESS;
9
        uart_config conf;
10
        if((ret = uart_get_config(base_addr, &conf))) return ret;
11
        uart_print_config(conf);
12
        return SUCCESS;
13
}
14

    
15
int ser_test_set(unsigned short base_addr, unsigned long bits, unsigned long stop,
16
                   long parity, unsigned long rate) {
17
    int par;
18
           switch(parity){
19
                case -1: par = uart_parity_none; break;
20
                case  0: par = uart_parity_even; break;
21
                case +1: par = uart_parity_odd ; break;
22
                default: return INVALID_ARG;
23
           }
24
        int ret = SUCCESS;
25
        if((ret = uart_set_bits_per_character(base_addr, bits))) return ret; tickdelay(micros_to_ticks(100000));
26
        if((ret = uart_set_stop_bits         (base_addr, stop))) return ret; tickdelay(micros_to_ticks(100000));
27
        if((ret = uart_set_parity            (base_addr, par ))) return ret; tickdelay(micros_to_ticks(100000));
28
        if((ret = uart_set_bit_rate          (base_addr, rate))) return ret; tickdelay(micros_to_ticks(100000));
29

    
30
        return SUCCESS;
31
}
32

    
33
int ser_test_poll(unsigned short base_addr, unsigned char tx, unsigned long bits,
34
                    unsigned long stop, long parity, unsigned long rate,
35
                    int stringc, char *strings[]) {
36
    /* To be completed */
37
        return 1;
38
}
39

    
40
int ser_test_int(/* details to be provided */) {
41
    /* To be completed */
42
        return 1;
43
}
44

    
45
int ser_test_fifo(/* details to be provided */) {
46
    /* To be completed */
47
        return 1;
48
}