1 /*
2 * Copyright (c) 2013-2020 Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 #include "Driver_USART.h"
20
21 #define ARM_USART_DRV_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(1, 0) /* driver version */
22
23 /* Driver Version */
24 static const ARM_DRIVER_VERSION DriverVersion = {
25 ARM_USART_API_VERSION,
26 ARM_USART_DRV_VERSION
27 };
28
29 /* Driver Capabilities */
30 static const ARM_USART_CAPABILITIES DriverCapabilities = {
31 1, /* supports UART (Asynchronous) mode */
32 0, /* supports Synchronous Master mode */
33 0, /* supports Synchronous Slave mode */
34 0, /* supports UART Single-wire mode */
35 0, /* supports UART IrDA mode */
36 0, /* supports UART Smart Card mode */
37 0, /* Smart Card Clock generator available */
38 0, /* RTS Flow Control available */
39 0, /* CTS Flow Control available */
40 0, /* Transmit completed event: \ref ARM_USART_EVENT_TX_COMPLETE */
41 0, /* Signal receive character timeout event: \ref ARM_USART_EVENT_RX_TIMEOUT */
42 0, /* RTS Line: 0=not available, 1=available */
43 0, /* CTS Line: 0=not available, 1=available */
44 0, /* DTR Line: 0=not available, 1=available */
45 0, /* DSR Line: 0=not available, 1=available */
46 0, /* DCD Line: 0=not available, 1=available */
47 0, /* RI Line: 0=not available, 1=available */
48 0, /* Signal CTS change event: \ref ARM_USART_EVENT_CTS */
49 0, /* Signal DSR change event: \ref ARM_USART_EVENT_DSR */
50 0, /* Signal DCD change event: \ref ARM_USART_EVENT_DCD */
51 0, /* Signal RI change event: \ref ARM_USART_EVENT_RI */
52 0 /* Reserved (must be zero) */
53 };
54
55 //
56 // Functions
57 //
58
ARM_USART_GetVersion(void)59 static ARM_DRIVER_VERSION ARM_USART_GetVersion(void)
60 {
61 return DriverVersion;
62 }
63
ARM_USART_GetCapabilities(void)64 static ARM_USART_CAPABILITIES ARM_USART_GetCapabilities(void)
65 {
66 return DriverCapabilities;
67 }
68
ARM_USART_Initialize(ARM_USART_SignalEvent_t cb_event)69 static int32_t ARM_USART_Initialize(ARM_USART_SignalEvent_t cb_event)
70 {
71 }
72
ARM_USART_Uninitialize(void)73 static int32_t ARM_USART_Uninitialize(void)
74 {
75 }
76
ARM_USART_PowerControl(ARM_POWER_STATE state)77 static int32_t ARM_USART_PowerControl(ARM_POWER_STATE state)
78 {
79 switch (state)
80 {
81 case ARM_POWER_OFF:
82 break;
83
84 case ARM_POWER_LOW:
85 break;
86
87 case ARM_POWER_FULL:
88 break;
89 }
90 return ARM_DRIVER_OK;
91 }
92
ARM_USART_Send(const void * data,uint32_t num)93 static int32_t ARM_USART_Send(const void *data, uint32_t num)
94 {
95 }
96
ARM_USART_Receive(void * data,uint32_t num)97 static int32_t ARM_USART_Receive(void *data, uint32_t num)
98 {
99 }
100
ARM_USART_Transfer(const void * data_out,void * data_in,uint32_t num)101 static int32_t ARM_USART_Transfer(const void *data_out, void *data_in, uint32_t num)
102 {
103 }
104
ARM_USART_GetTxCount(void)105 static uint32_t ARM_USART_GetTxCount(void)
106 {
107 }
108
ARM_USART_GetRxCount(void)109 static uint32_t ARM_USART_GetRxCount(void)
110 {
111 }
112
ARM_USART_Control(uint32_t control,uint32_t arg)113 static int32_t ARM_USART_Control(uint32_t control, uint32_t arg)
114 {
115 }
116
ARM_USART_GetStatus(void)117 static ARM_USART_STATUS ARM_USART_GetStatus(void)
118 {
119 }
120
ARM_USART_SetModemControl(ARM_USART_MODEM_CONTROL control)121 static int32_t ARM_USART_SetModemControl(ARM_USART_MODEM_CONTROL control)
122 {
123 }
124
ARM_USART_GetModemStatus(void)125 static ARM_USART_MODEM_STATUS ARM_USART_GetModemStatus(void)
126 {
127 }
128
ARM_USART_SignalEvent(uint32_t event)129 static void ARM_USART_SignalEvent(uint32_t event)
130 {
131 // function body
132 }
133
134 // End USART Interface
135
136 extern \
137 ARM_DRIVER_USART Driver_USART0;
138 ARM_DRIVER_USART Driver_USART0 = {
139 ARM_USART_GetVersion,
140 ARM_USART_GetCapabilities,
141 ARM_USART_Initialize,
142 ARM_USART_Uninitialize,
143 ARM_USART_PowerControl,
144 ARM_USART_Send,
145 ARM_USART_Receive,
146 ARM_USART_Transfer,
147 ARM_USART_GetTxCount,
148 ARM_USART_GetRxCount,
149 ARM_USART_Control,
150 ARM_USART_GetStatus,
151 ARM_USART_SetModemControl,
152 ARM_USART_GetModemStatus
153 };
154