1 /******************************************************************************
2  *
3  * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
4  * Analog Devices, Inc.),
5  * Copyright (C) 2023-2024 Analog Devices, Inc.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ******************************************************************************/
20 
21 #include <stddef.h>
22 #include <stdint.h>
23 #include <stdio.h>
24 #include "mxc_errors.h"
25 #include "mxc_assert.h"
26 #include "mxc_lock.h"
27 #include "mxc_sys.h"
28 #include "i2c.h"
29 #include "i2c_reva.h"
30 #include "mxc_delay.h"
31 
32 /* **** Definitions **** */
33 #define I2C_ERROR                                                                                \
34     (MXC_F_I2C_INT_FL0_ARB_ER | MXC_F_I2C_INT_FL0_TO_ER | MXC_F_I2C_INT_FL0_ADDR_NACK_ER |       \
35      MXC_F_I2C_INT_FL0_DATA_ER | MXC_F_I2C_INT_FL0_DO_NOT_RESP_ER | MXC_F_I2C_INT_FL0_START_ER | \
36      MXC_F_I2C_INT_FL0_STOP_ER)
37 #define MASTER 1
38 #define SLAVE 0
39 
40 #define MXC_I2C_MAX_ADDR_WIDTH 0x7F
41 #define MXC_I2C_STD_MODE 100000
42 #define MXC_I2C_FAST_SPEED 400000
43 #define MXC_I2C_FASTPLUS_SPEED 1000000
44 
45 /* **** Variable Declaration **** */
46 
47 /* **** Function Prototypes **** */
48 
49 /* ************************************************************************** */
MXC_I2C_Init(mxc_i2c_regs_t * i2c,int masterMode,unsigned int slaveAddr)50 int MXC_I2C_Init(mxc_i2c_regs_t *i2c, int masterMode, unsigned int slaveAddr)
51 {
52     int err;
53 
54 #ifndef MSDK_NO_GPIO_CLK_INIT
55     switch (MXC_I2C_GET_IDX(i2c)) {
56     case 0:
57         MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_I2C0);
58         MXC_GPIO_Config(&gpio_cfg_i2c0);
59         break;
60     case 1:
61         MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_I2C1);
62         MXC_GPIO_Config(&gpio_cfg_i2c1);
63         break;
64     default:
65         return E_BAD_PARAM;
66     }
67 #endif // MSDK_NO_GPIO_CLK_INIT
68 
69     if ((err = MXC_I2C_RevA_Init((mxc_i2c_reva_regs_t *)i2c, masterMode, slaveAddr)) !=
70         E_NO_ERROR) {
71         return err;
72     }
73 
74     return E_NO_ERROR;
75 }
76 
77 /* ************************************************************************** */
MXC_I2C_SetSlaveAddr(mxc_i2c_regs_t * i2c,unsigned int slaveAddr,int idx)78 int MXC_I2C_SetSlaveAddr(mxc_i2c_regs_t *i2c, unsigned int slaveAddr, int idx)
79 {
80     if (i2c == NULL || slaveAddr > MXC_F_I2C_SLV_ADDR_SLA || idx != 0) {
81         return E_BAD_PARAM;
82     }
83 
84     i2c->slv_addr = 0;
85 
86     if (slaveAddr > MXC_I2C_MAX_ADDR_WIDTH) {
87         i2c->slv_addr |= MXC_S_I2C_SLV_ADDR_EA_10BIT_ADDR;
88     }
89 
90     i2c->slv_addr |= slaveAddr & MXC_F_I2C_SLV_ADDR_SLA;
91 
92     return E_NO_ERROR;
93 }
94 
95 /* ************************************************************************** */
MXC_I2C_Shutdown(mxc_i2c_regs_t * i2c)96 int MXC_I2C_Shutdown(mxc_i2c_regs_t *i2c)
97 {
98     switch (MXC_I2C_GET_IDX(i2c)) {
99     case 0:
100         MXC_SYS_Reset_Periph(MXC_SYS_RESET_I2C0);
101         MXC_SYS_ClockDisable(MXC_SYS_PERIPH_CLOCK_I2C0);
102         break;
103     case 1:
104         MXC_SYS_Reset_Periph(MXC_SYS_RESET_I2C1);
105         MXC_SYS_ClockDisable(MXC_SYS_PERIPH_CLOCK_I2C1);
106         break;
107     default:
108         return E_BAD_PARAM;
109     }
110 
111     return MXC_I2C_RevA_Shutdown((mxc_i2c_reva_regs_t *)i2c);
112 }
113 
114 /* ************************************************************************** */
MXC_I2C_SetFrequency(mxc_i2c_regs_t * i2c,unsigned int hz)115 int MXC_I2C_SetFrequency(mxc_i2c_regs_t *i2c, unsigned int hz)
116 {
117     if (hz > MXC_I2C_FASTPLUS_SPEED) {
118         return E_NOT_SUPPORTED;
119     }
120 
121     return MXC_I2C_RevA_SetFrequency((mxc_i2c_reva_regs_t *)i2c, hz);
122 }
123 
124 /* ************************************************************************** */
MXC_I2C_GetFrequency(mxc_i2c_regs_t * i2c)125 unsigned int MXC_I2C_GetFrequency(mxc_i2c_regs_t *i2c)
126 {
127     return MXC_I2C_RevA_GetFrequency((mxc_i2c_reva_regs_t *)i2c);
128 }
129 
130 /* ************************************************************************** */
MXC_I2C_ReadyForSleep(mxc_i2c_regs_t * i2c)131 int MXC_I2C_ReadyForSleep(mxc_i2c_regs_t *i2c)
132 {
133     if (i2c->stat & MXC_F_I2C_REVA_STATUS_BUSY) {
134         return E_BUSY;
135     }
136     return MXC_I2C_RevA_ReadyForSleep((mxc_i2c_reva_regs_t *)i2c);
137 }
138 
139 /* ************************************************************************** */
MXC_I2C_SetClockStretching(mxc_i2c_regs_t * i2c,int enable)140 int MXC_I2C_SetClockStretching(mxc_i2c_regs_t *i2c, int enable)
141 {
142     return MXC_I2C_RevA_SetClockStretching((mxc_i2c_reva_regs_t *)i2c, enable);
143 }
144 
145 /* ************************************************************************** */
MXC_I2C_GetClockStretching(mxc_i2c_regs_t * i2c)146 int MXC_I2C_GetClockStretching(mxc_i2c_regs_t *i2c)
147 {
148     return MXC_I2C_RevA_GetClockStretching((mxc_i2c_reva_regs_t *)i2c);
149 }
150 
151 /* ************************************************************************* */
MXC_I2C_DMA_Init(mxc_i2c_regs_t * i2c,mxc_dma_regs_t * dma,bool use_dma_tx,bool use_dma_rx)152 int MXC_I2C_DMA_Init(mxc_i2c_regs_t *i2c, mxc_dma_regs_t *dma, bool use_dma_tx, bool use_dma_rx)
153 {
154     return MXC_I2C_RevA_DMA_Init((mxc_i2c_reva_regs_t *)i2c, (mxc_dma_reva_regs_t *)dma, use_dma_tx,
155                                  use_dma_rx);
156 }
157 
158 /* ************************************************************************* */
MXC_I2C_DMA_GetTXChannel(mxc_i2c_regs_t * i2c)159 int MXC_I2C_DMA_GetTXChannel(mxc_i2c_regs_t *i2c)
160 {
161     return MXC_I2C_RevA_DMA_GetTXChannel((mxc_i2c_reva_regs_t *)i2c);
162 }
163 
164 /* ************************************************************************* */
MXC_I2C_DMA_GetRXChannel(mxc_i2c_regs_t * i2c)165 int MXC_I2C_DMA_GetRXChannel(mxc_i2c_regs_t *i2c)
166 {
167     return MXC_I2C_RevA_DMA_GetRXChannel((mxc_i2c_reva_regs_t *)i2c);
168 }
169 
170 /* ************************************************************************* */
MXC_I2C_DMA_SetRequestSelect(mxc_i2c_regs_t * i2c,uint8_t * txData,uint8_t * rxData)171 int MXC_I2C_DMA_SetRequestSelect(mxc_i2c_regs_t *i2c, uint8_t *txData, uint8_t *rxData)
172 {
173     int i2cNum;
174     int txReqSel = -1;
175     int rxReqSel = -1;
176 
177     if (i2c == NULL) {
178         return E_NULL_PTR;
179     }
180 
181     i2cNum = MXC_I2C_GET_IDX((mxc_i2c_regs_t *)i2c);
182 
183     if (txData != NULL) {
184         switch (i2cNum) {
185         case 0:
186             txReqSel = MXC_DMA_REQUEST_I2C0TX;
187             break;
188 
189         case 1:
190             txReqSel = MXC_DMA_REQUEST_I2C1TX;
191             break;
192 
193         default:
194             return E_BAD_PARAM;
195         }
196     }
197 
198     if (rxData != NULL) {
199         switch (i2cNum) {
200         case 0:
201             rxReqSel = MXC_DMA_REQUEST_I2C0RX;
202             break;
203 
204         case 1:
205             rxReqSel = MXC_DMA_REQUEST_I2C1RX;
206             break;
207 
208         default:
209             return E_BAD_PARAM;
210         }
211     }
212 
213     return MXC_I2C_RevA_DMA_SetRequestSelect((mxc_i2c_reva_regs_t *)i2c,
214                                              (mxc_dma_reva_regs_t *)MXC_DMA, txReqSel, rxReqSel);
215 }
216 
217 /* ************************************************************************** */
MXC_I2C_Start(mxc_i2c_regs_t * i2c)218 int MXC_I2C_Start(mxc_i2c_regs_t *i2c)
219 {
220     return MXC_I2C_RevA_Start((mxc_i2c_reva_regs_t *)i2c);
221 }
222 
223 /* ************************************************************************** */
MXC_I2C_Stop(mxc_i2c_regs_t * i2c)224 int MXC_I2C_Stop(mxc_i2c_regs_t *i2c)
225 {
226     return MXC_I2C_RevA_Stop((mxc_i2c_reva_regs_t *)i2c);
227 }
228 
229 /* ************************************************************************** */
MXC_I2C_WriteByte(mxc_i2c_regs_t * i2c,unsigned char byte)230 int MXC_I2C_WriteByte(mxc_i2c_regs_t *i2c, unsigned char byte)
231 {
232     return MXC_I2C_RevA_WriteByte((mxc_i2c_reva_regs_t *)i2c, byte);
233 }
234 
235 /* ************************************************************************** */
MXC_I2C_ReadByte(mxc_i2c_regs_t * i2c,unsigned char * byte,int ack)236 int MXC_I2C_ReadByte(mxc_i2c_regs_t *i2c, unsigned char *byte, int ack)
237 {
238     return MXC_I2C_RevA_ReadByte((mxc_i2c_reva_regs_t *)i2c, byte, ack);
239 }
240 
241 /* ************************************************************************** */
MXC_I2C_ReadByteInteractive(mxc_i2c_regs_t * i2c,unsigned char * byte,mxc_i2c_getAck_t getAck)242 int MXC_I2C_ReadByteInteractive(mxc_i2c_regs_t *i2c, unsigned char *byte, mxc_i2c_getAck_t getAck)
243 {
244     return MXC_I2C_RevA_ReadByteInteractive((mxc_i2c_reva_regs_t *)i2c, byte,
245                                             (mxc_i2c_reva_getAck_t)getAck);
246 }
247 
248 /* ************************************************************************** */
MXC_I2C_Write(mxc_i2c_regs_t * i2c,unsigned char * bytes,unsigned int * len)249 int MXC_I2C_Write(mxc_i2c_regs_t *i2c, unsigned char *bytes, unsigned int *len)
250 {
251     return MXC_I2C_RevA_Write((mxc_i2c_reva_regs_t *)i2c, bytes, len);
252 }
253 
254 /* ************************************************************************** */
MXC_I2C_Read(mxc_i2c_regs_t * i2c,unsigned char * bytes,unsigned int * len,int ack)255 int MXC_I2C_Read(mxc_i2c_regs_t *i2c, unsigned char *bytes, unsigned int *len, int ack)
256 {
257     return MXC_I2C_RevA_Read((mxc_i2c_reva_regs_t *)i2c, bytes, len, ack);
258 }
259 
260 /* ************************************************************************** */
MXC_I2C_ReadRXFIFO(mxc_i2c_regs_t * i2c,volatile unsigned char * bytes,unsigned int len)261 int MXC_I2C_ReadRXFIFO(mxc_i2c_regs_t *i2c, volatile unsigned char *bytes, unsigned int len)
262 {
263     return MXC_I2C_RevA_ReadRXFIFO((mxc_i2c_reva_regs_t *)i2c, bytes, len);
264 }
265 
266 /* ************************************************************************** */
MXC_I2C_ReadRXFIFODMA(mxc_i2c_regs_t * i2c,unsigned char * bytes,unsigned int len,mxc_i2c_dma_complete_cb_t callback)267 int MXC_I2C_ReadRXFIFODMA(mxc_i2c_regs_t *i2c, unsigned char *bytes, unsigned int len,
268                           mxc_i2c_dma_complete_cb_t callback)
269 {
270     // The callback parameter was previously unused but keeping it for backwards-compatibility.
271     return MXC_I2C_RevA_ReadRXFIFODMA((mxc_i2c_reva_regs_t *)i2c, bytes, len, MXC_DMA);
272 }
273 
274 /* ************************************************************************** */
MXC_I2C_GetRXFIFOAvailable(mxc_i2c_regs_t * i2c)275 int MXC_I2C_GetRXFIFOAvailable(mxc_i2c_regs_t *i2c)
276 {
277     return MXC_I2C_RevA_GetRXFIFOAvailable((mxc_i2c_reva_regs_t *)i2c);
278 }
279 
280 /* ************************************************************************** */
MXC_I2C_WriteTXFIFO(mxc_i2c_regs_t * i2c,volatile unsigned char * bytes,unsigned int len)281 int MXC_I2C_WriteTXFIFO(mxc_i2c_regs_t *i2c, volatile unsigned char *bytes, unsigned int len)
282 {
283     return MXC_I2C_RevA_WriteTXFIFO((mxc_i2c_reva_regs_t *)i2c, bytes, len);
284 }
285 
286 /* ************************************************************************** */
MXC_I2C_WriteTXFIFODMA(mxc_i2c_regs_t * i2c,unsigned char * bytes,unsigned int len,mxc_i2c_dma_complete_cb_t callback)287 int MXC_I2C_WriteTXFIFODMA(mxc_i2c_regs_t *i2c, unsigned char *bytes, unsigned int len,
288                            mxc_i2c_dma_complete_cb_t callback)
289 {
290     // The callback parameter was previously unused but keeping it for backwards-compatibility.
291     return MXC_I2C_RevA_WriteTXFIFODMA((mxc_i2c_reva_regs_t *)i2c, bytes, len, MXC_DMA);
292 }
293 
294 /* ************************************************************************** */
MXC_I2C_GetTXFIFOAvailable(mxc_i2c_regs_t * i2c)295 int MXC_I2C_GetTXFIFOAvailable(mxc_i2c_regs_t *i2c)
296 {
297     return MXC_I2C_RevA_GetTXFIFOAvailable((mxc_i2c_reva_regs_t *)i2c);
298 }
299 
300 /* ************************************************************************** */
MXC_I2C_ClearRXFIFO(mxc_i2c_regs_t * i2c)301 void MXC_I2C_ClearRXFIFO(mxc_i2c_regs_t *i2c)
302 {
303     MXC_I2C_RevA_ClearRXFIFO((mxc_i2c_reva_regs_t *)i2c);
304 }
305 
306 /* ************************************************************************** */
MXC_I2C_ClearTXFIFO(mxc_i2c_regs_t * i2c)307 void MXC_I2C_ClearTXFIFO(mxc_i2c_regs_t *i2c)
308 {
309     MXC_I2C_RevA_ClearTXFIFO((mxc_i2c_reva_regs_t *)i2c);
310 }
311 
312 /* ************************************************************************** */
MXC_I2C_GetFlags(mxc_i2c_regs_t * i2c,unsigned int * flags0,unsigned int * flags1)313 int MXC_I2C_GetFlags(mxc_i2c_regs_t *i2c, unsigned int *flags0, unsigned int *flags1)
314 {
315     return MXC_I2C_RevA_GetFlags((mxc_i2c_reva_regs_t *)i2c, flags0, flags1);
316 }
317 
318 /* ************************************************************************** */
MXC_I2C_ClearFlags(mxc_i2c_regs_t * i2c,unsigned int flags0,unsigned int flags1)319 void MXC_I2C_ClearFlags(mxc_i2c_regs_t *i2c, unsigned int flags0, unsigned int flags1)
320 {
321     MXC_I2C_RevA_ClearFlags((mxc_i2c_reva_regs_t *)i2c, flags0, flags1);
322 }
323 
324 /* ************************************************************************** */
MXC_I2C_EnableInt(mxc_i2c_regs_t * i2c,unsigned int flags0,unsigned int flags1)325 void MXC_I2C_EnableInt(mxc_i2c_regs_t *i2c, unsigned int flags0, unsigned int flags1)
326 {
327     MXC_I2C_RevA_EnableInt((mxc_i2c_reva_regs_t *)i2c, flags0, flags1);
328 }
329 
330 /* ************************************************************************** */
MXC_I2C_DisableInt(mxc_i2c_regs_t * i2c,unsigned int flags0,unsigned int flags1)331 void MXC_I2C_DisableInt(mxc_i2c_regs_t *i2c, unsigned int flags0, unsigned int flags1)
332 {
333     MXC_I2C_RevA_DisableInt((mxc_i2c_reva_regs_t *)i2c, flags0, flags1);
334 }
335 
336 /* ************************************************************************** */
MXC_I2C_EnablePreload(mxc_i2c_regs_t * i2c)337 void MXC_I2C_EnablePreload(mxc_i2c_regs_t *i2c)
338 {
339     MXC_I2C_RevA_EnablePreload((mxc_i2c_reva_regs_t *)i2c);
340 }
341 
342 /* ************************************************************************** */
MXC_I2C_DisablePreload(mxc_i2c_regs_t * i2c)343 void MXC_I2C_DisablePreload(mxc_i2c_regs_t *i2c)
344 {
345     MXC_I2C_RevA_DisablePreload((mxc_i2c_reva_regs_t *)i2c);
346 }
347 
348 /* ************************************************************************** */
MXC_I2C_EnableGeneralCall(mxc_i2c_regs_t * i2c)349 void MXC_I2C_EnableGeneralCall(mxc_i2c_regs_t *i2c)
350 {
351     MXC_I2C_RevA_EnableGeneralCall((mxc_i2c_reva_regs_t *)i2c);
352 }
353 
354 /* ************************************************************************** */
MXC_I2C_DisableGeneralCall(mxc_i2c_regs_t * i2c)355 void MXC_I2C_DisableGeneralCall(mxc_i2c_regs_t *i2c)
356 {
357     MXC_I2C_RevA_DisableGeneralCall((mxc_i2c_reva_regs_t *)i2c);
358 }
359 
360 /* ************************************************************************** */
MXC_I2C_SetTimeout(mxc_i2c_regs_t * i2c,unsigned int timeout)361 void MXC_I2C_SetTimeout(mxc_i2c_regs_t *i2c, unsigned int timeout)
362 {
363     MXC_I2C_RevA_SetTimeout((mxc_i2c_reva_regs_t *)i2c, timeout);
364 }
365 
366 /* ************************************************************************** */
MXC_I2C_GetTimeout(mxc_i2c_regs_t * i2c)367 unsigned int MXC_I2C_GetTimeout(mxc_i2c_regs_t *i2c)
368 {
369     return MXC_I2C_RevA_GetTimeout((mxc_i2c_reva_regs_t *)i2c);
370 }
371 
372 /* ************************************************************************** */
MXC_I2C_Recover(mxc_i2c_regs_t * i2c,unsigned int retries)373 int MXC_I2C_Recover(mxc_i2c_regs_t *i2c, unsigned int retries)
374 {
375     return MXC_I2C_RevA_Recover((mxc_i2c_reva_regs_t *)i2c, retries);
376 }
377 
378 /* ************************************************************************* */
MXC_I2C_MasterTransaction(mxc_i2c_req_t * req)379 int MXC_I2C_MasterTransaction(mxc_i2c_req_t *req)
380 {
381     return MXC_I2C_RevA_MasterTransaction((mxc_i2c_reva_req_t *)req);
382 }
383 
384 /* ************************************************************************* */
MXC_I2C_MasterTransactionAsync(mxc_i2c_req_t * req)385 int MXC_I2C_MasterTransactionAsync(mxc_i2c_req_t *req)
386 {
387     return MXC_I2C_RevA_MasterTransactionAsync((mxc_i2c_reva_req_t *)req);
388 }
389 
390 /* ************************************************************************* */
MXC_I2C_MasterTransactionDMA(mxc_i2c_req_t * req)391 int MXC_I2C_MasterTransactionDMA(mxc_i2c_req_t *req)
392 {
393     return MXC_I2C_RevA_MasterTransactionDMA((mxc_i2c_reva_req_t *)req, MXC_DMA);
394 }
395 
396 /* ************************************************************************* */
MXC_I2C_SlaveTransaction(mxc_i2c_regs_t * i2c,mxc_i2c_slave_handler_t callback)397 int MXC_I2C_SlaveTransaction(mxc_i2c_regs_t *i2c, mxc_i2c_slave_handler_t callback)
398 {
399     return MXC_I2C_RevA_SlaveTransaction(
400         (mxc_i2c_reva_regs_t *)i2c, (mxc_i2c_reva_slave_handler_t)callback, MXC_F_I2C_INT_FL0_AMI);
401 }
402 
403 /* ************************************************************************* */
MXC_I2C_SlaveTransactionAsync(mxc_i2c_regs_t * i2c,mxc_i2c_slave_handler_t callback)404 int MXC_I2C_SlaveTransactionAsync(mxc_i2c_regs_t *i2c, mxc_i2c_slave_handler_t callback)
405 {
406     return MXC_I2C_RevA_SlaveTransactionAsync(
407         (mxc_i2c_reva_regs_t *)i2c, (mxc_i2c_reva_slave_handler_t)callback, MXC_F_I2C_INT_FL0_AMI);
408 }
409 
410 /* ************************************************************************* */
MXC_I2C_SetRXThreshold(mxc_i2c_regs_t * i2c,unsigned int numBytes)411 int MXC_I2C_SetRXThreshold(mxc_i2c_regs_t *i2c, unsigned int numBytes)
412 {
413     return MXC_I2C_RevA_SetRXThreshold((mxc_i2c_reva_regs_t *)i2c, numBytes);
414 }
415 
416 /* ************************************************************************* */
MXC_I2C_GetRXThreshold(mxc_i2c_regs_t * i2c)417 unsigned int MXC_I2C_GetRXThreshold(mxc_i2c_regs_t *i2c)
418 {
419     return MXC_I2C_RevA_GetRXThreshold((mxc_i2c_reva_regs_t *)i2c);
420 }
421 
422 /* ************************************************************************* */
MXC_I2C_SetTXThreshold(mxc_i2c_regs_t * i2c,unsigned int numBytes)423 int MXC_I2C_SetTXThreshold(mxc_i2c_regs_t *i2c, unsigned int numBytes)
424 {
425     return MXC_I2C_RevA_SetTXThreshold((mxc_i2c_reva_regs_t *)i2c, numBytes);
426 }
427 
428 /* ************************************************************************* */
MXC_I2C_GetTXThreshold(mxc_i2c_regs_t * i2c)429 unsigned int MXC_I2C_GetTXThreshold(mxc_i2c_regs_t *i2c)
430 {
431     return MXC_I2C_RevA_GetTXThreshold((mxc_i2c_reva_regs_t *)i2c);
432 }
433 
434 /* ************************************************************************* */
MXC_I2C_AsyncCallback(mxc_i2c_regs_t * i2c,int retVal)435 void MXC_I2C_AsyncCallback(mxc_i2c_regs_t *i2c, int retVal)
436 {
437     MXC_I2C_RevA_AsyncCallback((mxc_i2c_reva_regs_t *)i2c, retVal);
438 }
439 
440 /* ************************************************************************* */
MXC_I2C_AsyncStop(mxc_i2c_regs_t * i2c)441 void MXC_I2C_AsyncStop(mxc_i2c_regs_t *i2c)
442 {
443     MXC_I2C_RevA_AsyncStop((mxc_i2c_reva_regs_t *)i2c);
444 }
445 
446 /* ************************************************************************* */
MXC_I2C_AbortAsync(mxc_i2c_regs_t * i2c)447 void MXC_I2C_AbortAsync(mxc_i2c_regs_t *i2c)
448 {
449     MXC_I2C_RevA_AbortAsync((mxc_i2c_reva_regs_t *)i2c);
450 }
451 
452 /* ************************************************************************* */
MXC_I2C_MasterAsyncHandler(int i2cNum)453 void MXC_I2C_MasterAsyncHandler(int i2cNum)
454 {
455     MXC_I2C_RevA_MasterAsyncHandler(i2cNum);
456 }
457 
458 /* ************************************************************************* */
MXC_I2C_AsyncHandler(mxc_i2c_regs_t * i2c)459 void MXC_I2C_AsyncHandler(mxc_i2c_regs_t *i2c)
460 {
461     MXC_I2C_RevA_AsyncHandler((mxc_i2c_reva_regs_t *)i2c, MXC_F_I2C_INT_FL0_AMI);
462 }
463 
464 /* ************************************************************************* */
MXC_I2C_DMACallback(int ch,int error)465 void MXC_I2C_DMACallback(int ch, int error)
466 {
467     MXC_I2C_RevA_DMACallback(ch, error);
468 }
469