]> begriffs open source - cmsis/blob - CMSIS/Driver/DriverTemplates/Driver_SAI.c
CMSIS-Core(A): Core Register documentation.
[cmsis] / CMSIS / Driver / DriverTemplates / Driver_SAI.c
1 /*
2  * Copyright (c) 2013-2016 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 };
43
44 //
45 //  Functions
46 //
47
48 ARM_DRIVER_VERSION ARM_SAI_GetVersion (void)
49 {
50 }
51
52 ARM_SAI_CAPABILITIES ARM_SAI_GetCapabilities (void)
53 {
54 }
55
56 int32_t ARM_SAI_Initialize (ARM_SAI_SignalEvent_t cb_event)
57 {
58 }
59
60 int32_t ARM_SAI_Uninitialize (void)
61 {
62 }
63
64 int32_t ARM_SAI_PowerControl (ARM_POWER_STATE state)
65 {
66     switch (state)
67     {
68     case ARM_POWER_OFF:
69         break;
70
71     case ARM_POWER_LOW:
72         break;
73
74     case ARM_POWER_FULL:
75         break;
76
77     default:
78         return ARM_DRIVER_ERROR_UNSUPPORTED;
79     }
80 }
81
82 int32_t ARM_SAI_Send (const void *data, uint32_t num)
83 {
84 }
85
86 int32_t ARM_SAI_Receive (void *data, uint32_t num)
87 {
88 }
89
90 uint32_t ARM_SAI_GetTxCount (void)
91 {
92 }
93
94 uint32_t ARM_SAI_GetRxCount (void)
95 {
96 }
97
98 int32_t ARM_SAI_Control (uint32_t control, uint32_t arg1, uint32_t arg2)
99 {
100 }
101
102 ARM_SAI_STATUS ARM_SAI_GetStatus (void)
103 {
104 }
105
106 void ARM_SAI_SignalEvent(uint32_t event)
107 {
108     // function body
109 }
110
111 // End SAI Interface
112
113 ARM_DRIVER_SAI Driver_SAI = {
114     ARM_SAI_GetVersion,
115     ARM_SAI_GetCapabilities,
116     ARM_SAI_Initialize,
117     ARM_SAI_Uninitialize,
118     ARM_SAI_PowerControl,
119     ARM_SAI_Send,
120     ARM_SAI_Receive,
121     ARM_SAI_GetTxCount,
122     ARM_SAI_GetRxCount,
123     ARM_SAI_Control,
124     ARM_SAI_GetStatus
125 };