2 * Copyright (c) 2013-2020 Arm Limited. All rights reserved.
4 * SPDX-License-Identifier: Apache-2.0
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
10 * www.apache.org/licenses/LICENSE-2.0
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.
19 #include "Driver_SAI.h"
21 #define ARM_SAI_DRV_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(1, 0) /* driver version */
24 static const ARM_DRIVER_VERSION DriverVersion = {
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) */
49 static ARM_DRIVER_VERSION ARM_SAI_GetVersion (void)
54 static ARM_SAI_CAPABILITIES ARM_SAI_GetCapabilities (void)
56 return DriverCapabilities;
59 static int32_t ARM_SAI_Initialize (ARM_SAI_SignalEvent_t cb_event)
63 static int32_t ARM_SAI_Uninitialize (void)
67 static int32_t ARM_SAI_PowerControl (ARM_POWER_STATE state)
83 static int32_t ARM_SAI_Send (const void *data, uint32_t num)
87 static int32_t ARM_SAI_Receive (void *data, uint32_t num)
91 static uint32_t ARM_SAI_GetTxCount (void)
95 static uint32_t ARM_SAI_GetRxCount (void)
99 static int32_t ARM_SAI_Control (uint32_t control, uint32_t arg1, uint32_t arg2)
103 static ARM_SAI_STATUS ARM_SAI_GetStatus (void)
107 static void ARM_SAI_SignalEvent(uint32_t event)
115 ARM_DRIVER_SAI Driver_SAI0;
116 ARM_DRIVER_SAI Driver_SAI0 = {
118 ARM_SAI_GetCapabilities,
120 ARM_SAI_Uninitialize,
121 ARM_SAI_PowerControl,