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_SAI.h"
20
21 #define ARM_SAI_DRV_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(1, 0) /* driver version */
22
23 /* Driver Version */
24 static const ARM_DRIVER_VERSION DriverVersion = {
25 ARM_SAI_API_VERSION,
26 ARM_SAI_DRV_VERSION
27 };
28
29 /* Driver Capabilities */
30 static const ARM_SAI_CAPABILITIES DriverCapabilities = {
31 1, /* supports asynchronous Transmit/Receive */
32 0, /* supports synchronous Transmit/Receive */
33 0, /* supports user defined Protocol */
34 1, /* supports I2S Protocol */
35 0, /* supports MSB/LSB justified Protocol */
36 0, /* supports PCM short/long frame Protocol */
37 0, /* supports AC'97 Protocol */
38 0, /* supports Mono mode */
39 0, /* supports Companding */
40 0, /* supports MCLK (Master Clock) pin */
41 0, /* supports Frame error event: \ref ARM_SAI_EVENT_FRAME_ERROR */
42 0 /* reserved (must be zero) */
43 };
44
45 //
46 // Functions
47 //
48
ARM_SAI_GetVersion(void)49 static ARM_DRIVER_VERSION ARM_SAI_GetVersion (void)
50 {
51 return DriverVersion;
52 }
53
ARM_SAI_GetCapabilities(void)54 static ARM_SAI_CAPABILITIES ARM_SAI_GetCapabilities (void)
55 {
56 return DriverCapabilities;
57 }
58
ARM_SAI_Initialize(ARM_SAI_SignalEvent_t cb_event)59 static int32_t ARM_SAI_Initialize (ARM_SAI_SignalEvent_t cb_event)
60 {
61 }
62
ARM_SAI_Uninitialize(void)63 static int32_t ARM_SAI_Uninitialize (void)
64 {
65 }
66
ARM_SAI_PowerControl(ARM_POWER_STATE state)67 static int32_t ARM_SAI_PowerControl (ARM_POWER_STATE state)
68 {
69 switch (state)
70 {
71 case ARM_POWER_OFF:
72 break;
73
74 case ARM_POWER_LOW:
75 break;
76
77 case ARM_POWER_FULL:
78 break;
79 }
80 return ARM_DRIVER_OK;
81 }
82
ARM_SAI_Send(const void * data,uint32_t num)83 static int32_t ARM_SAI_Send (const void *data, uint32_t num)
84 {
85 }
86
ARM_SAI_Receive(void * data,uint32_t num)87 static int32_t ARM_SAI_Receive (void *data, uint32_t num)
88 {
89 }
90
ARM_SAI_GetTxCount(void)91 static uint32_t ARM_SAI_GetTxCount (void)
92 {
93 }
94
ARM_SAI_GetRxCount(void)95 static uint32_t ARM_SAI_GetRxCount (void)
96 {
97 }
98
ARM_SAI_Control(uint32_t control,uint32_t arg1,uint32_t arg2)99 static int32_t ARM_SAI_Control (uint32_t control, uint32_t arg1, uint32_t arg2)
100 {
101 }
102
ARM_SAI_GetStatus(void)103 static ARM_SAI_STATUS ARM_SAI_GetStatus (void)
104 {
105 }
106
ARM_SAI_SignalEvent(uint32_t event)107 static void ARM_SAI_SignalEvent(uint32_t event)
108 {
109 // function body
110 }
111
112 // End SAI Interface
113
114 extern \
115 ARM_DRIVER_SAI Driver_SAI0;
116 ARM_DRIVER_SAI Driver_SAI0 = {
117 ARM_SAI_GetVersion,
118 ARM_SAI_GetCapabilities,
119 ARM_SAI_Initialize,
120 ARM_SAI_Uninitialize,
121 ARM_SAI_PowerControl,
122 ARM_SAI_Send,
123 ARM_SAI_Receive,
124 ARM_SAI_GetTxCount,
125 ARM_SAI_GetRxCount,
126 ARM_SAI_Control,
127 ARM_SAI_GetStatus
128 };
129