Choco OS  V.0.16.9.0
Join to the chocolate world
oc_uart.h
Go to the documentation of this file.
1 
28 #ifndef INC_DRIVERS_UART_OC_UART_H_
29 #define INC_DRIVERS_UART_OC_UART_H_
30 
31 #define DRIVER_HEADER
32 #define DRIVER_NAME UART
33 
34 #include <oc_driver.h>
35 #include <oc_gpio.h>
36 #include <oc_stdlib.h>
37 #include <oc_ioctl.h>
38 #include <oc_uart_lld.h>
39 
45 #define _________________________________________TYPES_SECTION______________________________________________________________________________
46 
47 typedef enum
48 {
49  oC_UART_WordLength_5Bits = oC_UART_LLD_WordLength_5Bits ,
50  oC_UART_WordLength_6Bits = oC_UART_LLD_WordLength_6Bits ,
51  oC_UART_WordLength_7Bits = oC_UART_LLD_WordLength_7Bits ,
52  oC_UART_WordLength_8Bits = oC_UART_LLD_WordLength_8Bits
54 
55 typedef enum
56 {
57  oC_UART_Parity_None = oC_UART_LLD_Parity_None ,
58  oC_UART_Parity_Odd = oC_UART_LLD_Parity_Odd ,
59  oC_UART_Parity_Even = oC_UART_LLD_Parity_Even
61 
62 typedef enum
63 {
64  oC_UART_StopBit_1Bit = oC_UART_LLD_StopBit_1Bit ,
65  oC_UART_StopBit_1p5Bits = oC_UART_LLD_StopBit_1p5Bits ,
66  oC_UART_StopBit_2Bits = oC_UART_LLD_StopBit_2Bits
68 
69 typedef enum
70 {
71  oC_UART_BitOrder_LSBFirst = oC_UART_LLD_BitOrder_LSBFirst ,
72  oC_UART_BitOrder_MSBFirst = oC_UART_LLD_BitOrder_MSBFirst
74 
75 typedef enum
76 {
77  oC_UART_Invert_NotInverted = oC_UART_LLD_Invert_NotInverted ,
78  oC_UART_Invert_Inverted = oC_UART_LLD_Invert_Inverted
80 
81 typedef enum
82 {
83  oC_UART_Dma_UseIfPossible ,
84  oC_UART_Dma_AlwaysUse ,
85  oC_UART_Dma_DontUse
86 } oC_UART_Dma_t;
87 
88 typedef enum
89 {
90  oC_UART_Mode_Both ,
91  oC_UART_Mode_Output ,
92  oC_UART_Mode_Input
93 } oC_UART_Mode_t;
94 
95 typedef struct
96 {
97  oC_Pins_t Rx;
98  oC_Pins_t Tx;
99  oC_UART_WordLength_t WordLength;
100  uint32_t BitRate;
101  oC_UART_Parity_t Parity;
102  oC_UART_StopBit_t StopBit;
103  oC_UART_BitOrder_t BitOrder;
104  oC_UART_Invert_t Invert;
105  oC_UART_Dma_t Dma;
106  bool Loopback;
108 
109 typedef struct Context_t * oC_UART_Context_t;
110 
111 #undef _________________________________________TYPES_SECTION______________________________________________________________________________
112 
118 #define _________________________________________INTERFACE_FUNCTIONS_SECTION________________________________________________________________
119 
120 extern oC_ErrorCode_t oC_UART_TurnOn ( void );
121 extern oC_ErrorCode_t oC_UART_TurnOff ( void );
122 extern bool oC_UART_IsTurnedOn ( void );
123 extern oC_ErrorCode_t oC_UART_Configure ( const oC_UART_Config_t * Config , oC_UART_Context_t * outContext );
124 extern oC_ErrorCode_t oC_UART_Unconfigure ( const oC_UART_Config_t * Config , oC_UART_Context_t * outContext );
125 extern oC_ErrorCode_t oC_UART_Read ( oC_UART_Context_t Context , char * outBuffer , uint32_t * Size , oC_Time_t Timeout );
126 extern oC_ErrorCode_t oC_UART_Write ( oC_UART_Context_t Context , const char * Buffer , uint32_t * Size , oC_Time_t Timeout );
127 extern oC_ErrorCode_t oC_UART_Ioctl ( oC_UART_Context_t Context , oC_Ioctl_Command_t Command , void * Data );
128 extern oC_ErrorCode_t oC_UART_Disable ( oC_UART_Context_t Context );
129 extern oC_ErrorCode_t oC_UART_Enable ( oC_UART_Context_t Context );
130 
131 #undef _________________________________________INTERFACE_FUNCTIONS_SECTION________________________________________________________________
132 
133 
134 
135 #endif /* INC_DRIVERS_UART_OC_UART_H_ */
transmission length is 8 bits
Definition: oc_uart.h:52
stop bit length set to 2 bits
Definition: oc_uart.h:66
The file with interface for the GPIO driver.
oC_UART_BitOrder_t
Definition: oc_uart.h:69
not inverted signals
Definition: oc_uart.h:77
stop bit length set to 1 bit
Definition: oc_uart.h:64
transmission length is 7 bits
Definition: oc_uart.h:51
low significant bit first
Definition: oc_uart.h:71
most significant bit first
Definition: oc_uart.h:72
stop bit length set to 1.5 bit
Definition: oc_uart.h:65
The file with interface for driver creating.
oC_UART_StopBit_t
Definition: oc_uart.h:62
even parity checking
Definition: oc_uart.h:59
oC_UART_Invert_t
Definition: oc_uart.h:75
The file with interface for IOCTL.
oC_UART_WordLength_t
Definition: oc_uart.h:47
oC_UART_Parity_t
Definition: oc_uart.h:55
stores ETH context
Definition: oc_eth.c:97
transmission length is 6 bits
Definition: oc_uart.h:50
signals will be inverted
Definition: oc_uart.h:78
transmission length is 5 bits
Definition: oc_uart.h:49
odd parity checking
Definition: oc_uart.h:58
none parity checking
Definition: oc_uart.h:57