]> begriffs open source - cmsis/blob - CMSIS/Driver/DriverTemplates/Driver_I2C.c
RTX5: added function for thread enumeration
[cmsis] / CMSIS / Driver / DriverTemplates / Driver_I2C.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  * http://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_I2C.h"
20
21 #define ARM_I2C_DRV_VERSION    ARM_DRIVER_VERSION_MAJOR_MINOR(2, 0) /* driver version */
22
23 /* Driver Version */
24 static const ARM_DRIVER_VERSION DriverVersion = {
25     ARM_I2C_API_VERSION,
26     ARM_I2C_DRV_VERSION
27 };
28
29 /* Driver Capabilities */
30 static const ARM_I2C_CAPABILITIES DriverCapabilities = {
31     0  /* supports 10-bit addressing */
32 };
33
34 //
35 //  Functions
36 //
37
38 ARM_DRIVER_VERSION ARM_I2C_GetVersion(void)
39 {
40 }
41
42 ARM_I2C_CAPABILITIES ARM_I2C_GetCapabilities(void)
43 {
44 }
45
46 int32_t ARM_I2C_Initialize(ARM_I2C_SignalEvent_t cb_event)
47 {
48 }
49
50 int32_t ARM_I2C_Uninitialize(void)
51 {
52 }
53
54 int32_t ARM_I2C_PowerControl(ARM_POWER_STATE state)
55 {
56     switch (state)
57     {
58     case ARM_POWER_OFF:
59         break;
60
61     case ARM_POWER_LOW:
62         break;
63
64     case ARM_POWER_FULL:
65         break;
66
67     default:
68         return ARM_DRIVER_ERROR_UNSUPPORTED;
69     }
70 }
71
72 int32_t ARM_I2C_MasterTransmit(uint32_t addr, const uint8_t *data, uint32_t num, bool xfer_pending)
73 {
74 }
75
76 int32_t ARM_I2C_MasterReceive(uint32_t addr, uint8_t *data, uint32_t num, bool xfer_pending)
77 {
78 }
79
80 int32_t ARM_I2C_SlaveTransmit(const uint8_t *data, uint32_t num)
81 {
82 }
83
84 int32_t ARM_I2C_SlaveReceive(uint8_t *data, uint32_t num)
85 {
86 }
87
88 int32_t ARM_I2C_GetDataCount(void)
89 {
90 }
91
92 int32_t ARM_I2C_Control(uint32_t control, uint32_t arg)
93 {
94     switch (control)
95     {
96     case ARM_I2C_OWN_ADDRESS:
97         break;
98
99     case ARM_I2C_BUS_SPEED:
100         switch (arg)
101         {
102         case ARM_I2C_BUS_SPEED_STANDARD:
103             break;
104         case ARM_I2C_BUS_SPEED_FAST:
105             break;
106         case ARM_I2C_BUS_SPEED_FAST_PLUS:
107             break;
108         default:
109             return ARM_DRIVER_ERROR_UNSUPPORTED;
110         }
111         break;
112
113     case ARM_I2C_BUS_CLEAR:
114         break;
115
116     case ARM_I2C_ABORT_TRANSFER:
117         break;
118
119     default:
120         return ARM_DRIVER_ERROR_UNSUPPORTED;
121     }
122 }
123
124 ARM_I2C_STATUS ARM_I2C_GetStatus(void)
125 {
126 }
127
128 void ARM_I2C_SignalEvent(uint32_t event)
129 {
130     // function body
131 }
132
133 // End I2C Interface
134
135 ARM_DRIVER_I2C Driver_I2C = {
136     ARM_I2C_GetVersion,
137     ARM_I2C_GetCapabilities,
138     ARM_I2C_Initialize,
139     ARM_I2C_Uninitialize,
140     ARM_I2C_PowerControl,
141     ARM_I2C_MasterTransmit,
142     ARM_I2C_MasterReceive,
143     ARM_I2C_SlaveTransmit,
144     ARM_I2C_SlaveReceive,
145     ARM_I2C_GetDataCount,
146     ARM_I2C_Control,
147     ARM_I2C_GetStatus
148 };