app_uart.h
1.47 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef _APP_UART_H_
#define _APP_UART_H_
#if 1
#define UART_TX_MAX_LEN 128
#define UART_RX_MAX_LEN 256
#else
#define UART_TX_MAX_LEN 512
#define UART_RX_MAX_LEN 1024
#endif
enum
{
HCI_UART_STATE_RX_TYPE,
HCI_UART_STATE_RX_HEADER,
//HCI_UART_STATE_RX_COMM_HEADER,
//HCI_UART_STATE_RX_ACL_HEADER,
//HCI_UART_STATE_RX_SCO_HEADER,
//HCI_UART_STATE_RX_EVENT_HEADER,
HCI_UART_CHECK_DATA,
HCI_UART_BCSP_C0_START,
HCI_UART_BCSP_C0_END,
HCI_UART_H4_SYNC_ERR
};
/*
We use the structure defined below to realize UART interrupt transfer
the buffer in this structure is split to two parts, the two parts interface with
MCF5249_uart_write() function and interrupt service routine respectively and alternately
they can not both interface with MCF5249_uart_write() and ISR at the same time.
*/
/*
typedef struct _UART_DATA {
U8 Buf [UART_TX_MAX_LEN];
U16 ReadLen;
U16 WriteLen;
U8 *pWrite; //use this pointer to write data in
U8 *pRead; //use this pointer to send data out
} UART_DATA;
extern volatile UART_DATA uart_data;*/
//extern FIFO UartRxFifo;
void app_uart_init(void);
void app_uart_open(void);
void app_uart_close(void);
void app_uart_fini(void);
void app_uart_write(const char *pBuf);
void app_uart_baudrate(U16 baudrate);
void app_uart0_init(void);
void app_uart1_init(void);
void app_uart2_init(void);
void Uart0_IsrHandler(void);
void Uart1_IsrHandler(void);
void Uart2_IsrHandler(void);
#endif //_APP_UART_H_