1 /******************************************************************************
2 *  Filename:       rom.h
3 *  Revised:        2015-11-11 14:08:23 +0100 (Wed, 11 Nov 2015)
4 *  Revision:       45027
5 *
6 *  Description:    Prototypes for the ROM utility functions.
7 *
8 *  Copyright (c) 2015, Texas Instruments Incorporated
9 *  All rights reserved.
10 *
11 *  Redistribution and use in source and binary forms, with or without
12 *  modification, are permitted provided that the following conditions are met:
13 *
14 *  1) Redistributions of source code must retain the above copyright notice,
15 *     this list of conditions and the following disclaimer.
16 *
17 *  2) Redistributions in binary form must reproduce the above copyright notice,
18 *     this list of conditions and the following disclaimer in the documentation
19 *     and/or other materials provided with the distribution.
20 *
21 *  3) Neither the name of the ORGANIZATION nor the names of its contributors may
22 *     be used to endorse or promote products derived from this software without
23 *     specific prior written permission.
24 *
25 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
29 *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 *  POSSIBILITY OF SUCH DAMAGE.
36 *
37 ******************************************************************************/
38 
39 #ifndef __ROM_H__
40 #define __ROM_H__
41 
42 //*****************************************************************************
43 //
44 // If building with a C++ compiler, make all of the definitions in this header
45 // have a C binding.
46 //
47 //*****************************************************************************
48 #ifdef __cplusplus
49 extern "C"
50 {
51 #endif
52 
53 #include <inc/hw_types.h>
54 
55 #ifndef __HAPI_H__
56 #define __HAPI_H__
57 
58 //
59 // Start address of the ROM hard API access table (located after the ROM FW rev field)
60 //
61 #define ROM_HAPI_TABLE_ADDR 0x10000048
62 
63 //
64 // ROM Hard-API function interface types
65 //
66 typedef uint32_t     (* FPTR_CRC32_T)              ( uint8_t*     /* pui8Data        */,\
67                                                      uint32_t     /* ui32ByteCount   */,\
68                                                      uint32_t     /* ui32RepeatCount */);
69 
70 typedef uint32_t     (* FPTR_GETFLSIZE_T)          ( void );
71 
72 typedef uint32_t     (* FPTR_GETCHIPID_T)          ( void );
73 
74 typedef uint32_t     (* FPTR_RESERVED1_T)          ( uint32_t );
75 
76 typedef uint32_t     (* FPTR_RESERVED2_T)          ( void );
77 
78 typedef uint32_t     (* FPTR_RESERVED3_T)          ( uint8_t*                          ,\
79                                                      uint32_t                          ,\
80                                                      uint32_t                          );
81 typedef void         (* FPTR_RESETDEV_T)           ( void );
82 
83 typedef uint32_t     (* FPTR_FLETCHER32_T)         ( uint16_t*    /* pui16Data       */,\
84                                                      uint16_t     /* ui16WordCount   */,\
85                                                      uint16_t     /* ui16RepeatCount */);
86 
87 typedef uint32_t     (* FPTR_MINVAL_T)             ( uint32_t*    /* ulpDataBuffer   */,\
88                                                      uint32_t     /* ui32DataCount   */);
89 
90 typedef uint32_t     (* FPTR_MAXVAL_T)             ( uint32_t*    /* pui32DataBuffer */,\
91                                                      uint32_t     /* ui32DataCount   */);
92 
93 typedef uint32_t     (* FPTR_MEANVAL_T)            ( uint32_t*    /* pui32DataBuffer */,\
94                                                      uint32_t     /* ui32DataCount   */);
95 
96 typedef uint32_t     (* FPTR_STDDVAL_T)            ( uint32_t*    /* pui32DataBuffer */,\
97                                                      uint32_t     /* ui32DataCount   */);
98 
99 typedef void         (* FPTR_HFSOURCESAFESWITCH_T) ( void );
100 
101 typedef void         (* FPTR_RESERVED4_T)          ( uint32_t                          );
102 
103 typedef void         (* FPTR_RESERVED5_T)          ( uint32_t                          );
104 
105 typedef void         (* FPTR_COMPAIN_T)            ( uint8_t      /* ut8Signal       */);
106 
107 typedef void         (* FPTR_COMPAREF_T)           ( uint8_t      /* ut8Signal       */);
108 
109 typedef void         (* FPTR_ADCCOMPBIN_T)         ( uint8_t      /* ut8Signal       */);
110 
111 typedef void         (* FPTR_COMPBREF_T)           ( uint8_t      /* ut8Signal       */);
112 
113 extern uint32_t MemBusWrkAroundHapiProgramFlash(uint8_t *pui8DataBuffer,
114                                                 uint32_t ui32Address,
115                                                 uint32_t ui32Count);
116 
117 extern uint32_t MemBusWrkAroundHapiEraseSector(uint32_t ui32Address);
118 
119 //
120 // ROM Hard-API access table type
121 //
122 typedef struct
123 {
124     FPTR_CRC32_T                    Crc32;
125     FPTR_GETFLSIZE_T                FlashGetSize;
126     FPTR_GETCHIPID_T                GetChipId;
127     FPTR_RESERVED1_T                ReservedLocation1;
128     FPTR_RESERVED2_T                ReservedLocation2;
129     FPTR_RESERVED3_T                ReservedLocation3;
130     FPTR_RESETDEV_T                 ResetDevice;
131     FPTR_FLETCHER32_T               Fletcher32;
132     FPTR_MINVAL_T                   MinValue;
133     FPTR_MAXVAL_T                   MaxValue;
134     FPTR_MEANVAL_T                  MeanValue;
135     FPTR_STDDVAL_T                  StandDeviationValue;
136     FPTR_RESERVED4_T                ReservedLocation4;
137     FPTR_RESERVED5_T                ReservedLocation5;
138     FPTR_HFSOURCESAFESWITCH_T       HFSourceSafeSwitch;
139     FPTR_COMPAIN_T                  SelectCompAInput;
140     FPTR_COMPAREF_T                 SelectCompARef;
141     FPTR_ADCCOMPBIN_T               SelectADCCompBInput;
142     FPTR_COMPBREF_T                 SelectCompBRef;
143 } HARD_API_T;
144 
145 //
146 // Pointer to the ROM HAPI table
147 //
148 #define P_HARD_API                   ((HARD_API_T*) ROM_HAPI_TABLE_ADDR)
149 
150 //
151 // Add wrapper around the Hapi functions needing the "bus arbitration issue" workaround
152 //
153 extern void SafeHapiAuxAdiSelect( FPTR_VOID_UINT8_T fPtr, uint8_t ut8Signal );
154 
155 #define HapiCrc32(a,b,c)             P_HARD_API->Crc32(a,b,c)
156 #define HapiGetFlashSize()           P_HARD_API->FlashGetSize()
157 #define HapiGetChipId()              P_HARD_API->GetChipId()
158 #define HapiSectorErase(a)           MemBusWrkAroundHapiEraseSector(a)
159 #define HapiProgramFlash(a,b,c)      MemBusWrkAroundHapiProgramFlash(a,b,c)
160 #define HapiResetDevice()            P_HARD_API->ResetDevice()
161 #define HapiFletcher32(a,b,c)        P_HARD_API->Fletcher32(a,b,c)
162 #define HapiMinValue(a,b)            P_HARD_API->MinValue(a,b)
163 #define HapiMaxValue(a,b)            P_HARD_API->MaxValue(a,b)
164 #define HapiMeanValue(a,b)           P_HARD_API->MeanValue(a,b)
165 #define HapiStandDeviationValue(a,b) P_HARD_API->StandDeviationValue(a,b)
166 #define HapiHFSourceSafeSwitch()     P_HARD_API->HFSourceSafeSwitch()
167 #define HapiSelectCompAInput(a)      SafeHapiAuxAdiSelect( P_HARD_API->SelectCompAInput   , a )
168 #define HapiSelectCompARef(a)        SafeHapiAuxAdiSelect( P_HARD_API->SelectCompARef     , a )
169 #define HapiSelectADCCompBInput(a)   SafeHapiAuxAdiSelect( P_HARD_API->SelectADCCompBInput, a )
170 #define HapiSelectCompBRef(a)        SafeHapiAuxAdiSelect( P_HARD_API->SelectCompBRef     , a )
171 
172 //
173 // Defines for input parameter to the HapiSelectCompAInput function.
174 // The define values can not be changed!
175 //
176 #define COMPA_IN_NC            0x00
177 #define COMPA_IN_AUXIO7        0x09
178 #define COMPA_IN_AUXIO6        0x0A
179 #define COMPA_IN_AUXIO5        0x0B
180 #define COMPA_IN_AUXIO4        0x0C
181 #define COMPA_IN_AUXIO3        0x0D
182 #define COMPA_IN_AUXIO2        0x0E
183 #define COMPA_IN_AUXIO1        0x0F
184 #define COMPA_IN_AUXIO0        0x10
185 
186 //
187 // Defines for input parameter to the HapiSelectCompARef function.
188 // The define values can not be changed!
189 //
190 #define COMPA_REF_NC           0x00
191 #define COMPA_REF_DCOUPL       0x01
192 #define COMPA_REF_VSS          0x02
193 #define COMPA_REF_VDDS         0x03
194 #define COMPA_REF_ADCVREFP     0x04
195 #define COMPA_REF_AUXIO7       0x09
196 #define COMPA_REF_AUXIO6       0x0A
197 #define COMPA_REF_AUXIO5       0x0B
198 #define COMPA_REF_AUXIO4       0x0C
199 #define COMPA_REF_AUXIO3       0x0D
200 #define COMPA_REF_AUXIO2       0x0E
201 #define COMPA_REF_AUXIO1       0x0F
202 #define COMPA_REF_AUXIO0       0x10
203 
204 //
205 // Defines for input parameter to the HapiSelectADCCompBInput function.
206 // The define values can not be changed!
207 //
208 #define ADC_COMPB_IN_NC        0x00
209 #define ADC_COMPB_IN_DCOUPL    0x03
210 #define ADC_COMPB_IN_VSS       0x04
211 #define ADC_COMPB_IN_VDDS      0x05
212 #define ADC_COMPB_IN_AUXIO7    0x09
213 #define ADC_COMPB_IN_AUXIO6    0x0A
214 #define ADC_COMPB_IN_AUXIO5    0x0B
215 #define ADC_COMPB_IN_AUXIO4    0x0C
216 #define ADC_COMPB_IN_AUXIO3    0x0D
217 #define ADC_COMPB_IN_AUXIO2    0x0E
218 #define ADC_COMPB_IN_AUXIO1    0x0F
219 #define ADC_COMPB_IN_AUXIO0    0x10
220 
221 //
222 // Defines for input parameter to the HapiSelectCompBRef function.
223 // The define values can not be changed!
224 //
225 #define COMPB_REF_NC           0x00
226 #define COMPB_REF_DCOUPL       0x01
227 #define COMPB_REF_VSS          0x02
228 #define COMPB_REF_VDDS         0x03
229 
230 #endif // __HAPI_H__
231 
232 //*****************************************************************************
233 //
234 // Pointers to the main API tables.
235 //
236 //*****************************************************************************
237 #define ROM_API_TABLE           ((uint32_t *) 0x10000180)
238 #define ROM_VERSION             (ROM_API_TABLE[0])
239 
240 
241 #define ROM_API_AON_EVENT_TABLE ((uint32_t*) (ROM_API_TABLE[1]))
242 #define ROM_API_AON_IOC_TABLE   ((uint32_t*) (ROM_API_TABLE[2]))
243 #define ROM_API_AON_RTC_TABLE   ((uint32_t*) (ROM_API_TABLE[3]))
244 #define ROM_API_AON_WUC_TABLE   ((uint32_t*) (ROM_API_TABLE[4]))
245 #define ROM_API_AUX_CTRL_TABLE  ((uint32_t*) (ROM_API_TABLE[5]))
246 #define ROM_API_AUX_TDC_TABLE   ((uint32_t*) (ROM_API_TABLE[6]))
247 #define ROM_API_AUX_TIMER_TABLE ((uint32_t*) (ROM_API_TABLE[7]))
248 #define ROM_API_AUX_WUC_TABLE   ((uint32_t*) (ROM_API_TABLE[8]))
249 #define ROM_API_DDI_TABLE       ((uint32_t*) (ROM_API_TABLE[9]))
250 #define ROM_API_FLASH_TABLE     ((uint32_t*) (ROM_API_TABLE[10]))
251 #define ROM_API_I2C_TABLE       ((uint32_t*) (ROM_API_TABLE[11]))
252 #define ROM_API_INTERRUPT_TABLE ((uint32_t*) (ROM_API_TABLE[12]))
253 #define ROM_API_IOC_TABLE       ((uint32_t*) (ROM_API_TABLE[13]))
254 #define ROM_API_PRCM_TABLE      ((uint32_t*) (ROM_API_TABLE[14]))
255 #define ROM_API_SMPH_TABLE      ((uint32_t*) (ROM_API_TABLE[15]))
256 #define ROM_API_SPIS_TABLE      ((uint32_t*) (ROM_API_TABLE[16]))
257 #define ROM_API_SSI_TABLE       ((uint32_t*) (ROM_API_TABLE[17]))
258 #define ROM_API_TIMER_TABLE     ((uint32_t*) (ROM_API_TABLE[18]))
259 #define ROM_API_TRNG_TABLE      ((uint32_t*) (ROM_API_TABLE[19]))
260 #define ROM_API_UART_TABLE      ((uint32_t*) (ROM_API_TABLE[20]))
261 #define ROM_API_UDMA_TABLE      ((uint32_t*) (ROM_API_TABLE[21]))
262 #define ROM_API_VIMS_TABLE      ((uint32_t*) (ROM_API_TABLE[22]))
263 
264 // AON_EVENT FUNCTIONS
265 #define ROM_AONEventMcuWakeUpSet \
266     ((void (*)(uint32_t ui32MCUWUEvent, uint32_t ui32EventSrc)) \
267     ROM_API_AON_EVENT_TABLE[0])
268 
269 #define ROM_AONEventMcuWakeUpGet \
270     ((uint32_t (*)(uint32_t ui32MCUWUEvent)) \
271     ROM_API_AON_EVENT_TABLE[1])
272 
273 #define ROM_AONEventAuxWakeUpSet \
274     ((void (*)(uint32_t ui32AUXWUEvent, uint32_t ui32EventSrc)) \
275     ROM_API_AON_EVENT_TABLE[2])
276 
277 #define ROM_AONEventAuxWakeUpGet \
278     ((uint32_t (*)(uint32_t ui32AUXWUEvent)) \
279     ROM_API_AON_EVENT_TABLE[3])
280 
281 #define ROM_AONEventMcuSet \
282     ((void (*)(uint32_t ui32MCUEvent, uint32_t ui32EventSrc)) \
283     ROM_API_AON_EVENT_TABLE[4])
284 
285 #define ROM_AONEventMcuGet \
286     ((uint32_t (*)(uint32_t ui32MCUEvent)) \
287     ROM_API_AON_EVENT_TABLE[5])
288 
289 
290 // AON_WUC FUNCTIONS
291 #define ROM_AONWUCAuxReset \
292     ((void (*)(void)) \
293     ROM_API_AON_WUC_TABLE[3])
294 
295 #define ROM_AONWUCRechargeCtrlConfigSet \
296     ((void (*)(bool bAdaptEnable, uint32_t ui32AdaptRate, uint32_t ui32Period, uint32_t ui32MaxPeriod)) \
297     ROM_API_AON_WUC_TABLE[4])
298 
299 #define ROM_AONWUCOscConfig \
300     ((void (*)(uint32_t ui32Period)) \
301     ROM_API_AON_WUC_TABLE[5])
302 
303 
304 // AUX_TDC FUNCTIONS
305 #define ROM_AUXTDCConfigSet \
306     ((void (*)(uint32_t ui32Base, uint32_t ui32StartCondition, uint32_t ui32StopCondition)) \
307     ROM_API_AUX_TDC_TABLE[0])
308 
309 #define ROM_AUXTDCMeasurementDone \
310     ((uint32_t (*)(uint32_t ui32Base)) \
311     ROM_API_AUX_TDC_TABLE[1])
312 
313 
314 // AUX_TIMER FUNCTIONS
315 #define ROM_AUXTimerConfigure \
316     ((void (*)(uint32_t ui32Timer, uint32_t ui32Config)) \
317     ROM_API_AUX_TIMER_TABLE[0])
318 
319 #define ROM_AUXTimerStart \
320     ((void (*)(uint32_t ui32Timer)) \
321     ROM_API_AUX_TIMER_TABLE[1])
322 
323 #define ROM_AUXTimerStop \
324     ((void (*)(uint32_t ui32Timer)) \
325     ROM_API_AUX_TIMER_TABLE[2])
326 
327 #define ROM_AUXTimerPrescaleSet \
328     ((void (*)(uint32_t ui32Timer, uint32_t ui32PrescaleDiv)) \
329     ROM_API_AUX_TIMER_TABLE[3])
330 
331 #define ROM_AUXTimerPrescaleGet \
332     ((uint32_t (*)(uint32_t ui32Timer)) \
333     ROM_API_AUX_TIMER_TABLE[4])
334 
335 
336 // AUX_WUC FUNCTIONS
337 #define ROM_AUXWUCClockEnable \
338     ((void (*)(uint32_t ui32Clocks)) \
339     ROM_API_AUX_WUC_TABLE[0])
340 
341 #define ROM_AUXWUCClockDisable \
342     ((void (*)(uint32_t ui32Clocks)) \
343     ROM_API_AUX_WUC_TABLE[1])
344 
345 #define ROM_AUXWUCClockStatus \
346     ((uint32_t (*)(uint32_t ui32Clocks)) \
347     ROM_API_AUX_WUC_TABLE[2])
348 
349 #define ROM_AUXWUCPowerCtrl \
350     ((void (*)(uint32_t ui32PowerMode)) \
351     ROM_API_AUX_WUC_TABLE[3])
352 
353 
354 // DDI FUNCTIONS
355 #define ROM_DDI16BitWrite \
356     ((void (*)(uint32_t ui32Base, uint32_t ui32Reg, uint32_t ui32Mask, uint32_t ui32WrData)) \
357     ROM_API_DDI_TABLE[0])
358 
359 #define ROM_DDI16BitfieldWrite \
360     ((void (*)(uint32_t ui32Base, uint32_t ui32Reg, uint32_t ui32Mask, uint32_t ui32Shift, uint16_t ui32Data)) \
361     ROM_API_DDI_TABLE[1])
362 
363 #define ROM_DDI16BitRead \
364     ((uint16_t (*)(uint32_t ui32Base, uint32_t ui32Reg, uint32_t ui32Mask)) \
365     ROM_API_DDI_TABLE[2])
366 
367 #define ROM_DDI16BitfieldRead \
368     ((uint16_t (*)(uint32_t ui32Base, uint32_t ui32Reg, uint32_t ui32Mask, uint32_t ui32Shift)) \
369     ROM_API_DDI_TABLE[3])
370 
371 
372 // FLASH FUNCTIONS
373 #define ROM_FlashPowerModeGet \
374     ((uint32_t (*)(void)) \
375     ROM_API_FLASH_TABLE[1])
376 
377 #define ROM_FlashProtectionSet \
378     ((void (*)(uint32_t ui32SectorAddress, uint32_t ui32ProtectMode)) \
379     ROM_API_FLASH_TABLE[2])
380 
381 #define ROM_FlashProtectionGet \
382     ((uint32_t (*)(uint32_t ui32SectorAddress)) \
383     ROM_API_FLASH_TABLE[3])
384 
385 #define ROM_FlashProtectionSave \
386     ((uint32_t (*)(uint32_t ui32SectorAddress)) \
387     ROM_API_FLASH_TABLE[4])
388 
389 #define ROM_FlashEfuseReadRow \
390     ((bool (*)(uint32_t *pui32EfuseData, uint32_t ui32RowAddress)) \
391     ROM_API_FLASH_TABLE[8])
392 
393 #define ROM_FlashDisableSectorsForWrite \
394     ((void (*)(void)) \
395     ROM_API_FLASH_TABLE[9])
396 
397 
398 // I2C FUNCTIONS
399 #define ROM_I2CMasterInitExpClk \
400     ((void (*)(uint32_t ui32Base, uint32_t ui32I2CClk, bool bFast)) \
401     ROM_API_I2C_TABLE[0])
402 
403 #define ROM_I2CMasterErr \
404     ((uint32_t (*)(uint32_t ui32Base)) \
405     ROM_API_I2C_TABLE[1])
406 
407 
408 // INTERRUPT FUNCTIONS
409 #define ROM_IntPriorityGroupingSet \
410     ((void (*)(uint32_t ui32Bits)) \
411     ROM_API_INTERRUPT_TABLE[0])
412 
413 #define ROM_IntPriorityGroupingGet \
414     ((uint32_t (*)(void)) \
415     ROM_API_INTERRUPT_TABLE[1])
416 
417 #define ROM_IntPrioritySet \
418     ((void (*)(uint32_t ui32Interrupt, uint8_t ui8Priority)) \
419     ROM_API_INTERRUPT_TABLE[2])
420 
421 #define ROM_IntPriorityGet \
422     ((int32_t (*)(uint32_t ui32Interrupt)) \
423     ROM_API_INTERRUPT_TABLE[3])
424 
425 #define ROM_IntEnable \
426     ((void (*)(uint32_t ui32Interrupt)) \
427     ROM_API_INTERRUPT_TABLE[4])
428 
429 #define ROM_IntDisable \
430     ((void (*)(uint32_t ui32Interrupt)) \
431     ROM_API_INTERRUPT_TABLE[5])
432 
433 #define ROM_IntPendSet \
434     ((void (*)(uint32_t ui32Interrupt)) \
435     ROM_API_INTERRUPT_TABLE[6])
436 
437 #define ROM_IntPendGet \
438     ((bool (*)(uint32_t ui32Interrupt)) \
439     ROM_API_INTERRUPT_TABLE[7])
440 
441 #define ROM_IntPendClear \
442     ((void (*)(uint32_t ui32Interrupt)) \
443     ROM_API_INTERRUPT_TABLE[8])
444 
445 
446 // IOC FUNCTIONS
447 #define ROM_IOCPortConfigureSet \
448     ((void (*)(uint32_t ui32IOId, uint32_t ui32PortId, uint32_t ui32IOConfig)) \
449     ROM_API_IOC_TABLE[0])
450 
451 #define ROM_IOCPortConfigureGet \
452     ((uint32_t (*)(uint32_t ui32IOId)) \
453     ROM_API_IOC_TABLE[1])
454 
455 #define ROM_IOCIOShutdownSet \
456     ((void (*)(uint32_t ui32IOId, uint32_t ui32IOShutdown)) \
457     ROM_API_IOC_TABLE[2])
458 
459 #define ROM_IOCIOModeSet \
460     ((void (*)(uint32_t ui32IOId, uint32_t ui32IOMode)) \
461     ROM_API_IOC_TABLE[4])
462 
463 #define ROM_IOCIOIntSet \
464     ((void (*)(uint32_t ui32IOId, uint32_t ui32Int, uint32_t ui32EdgeDet)) \
465     ROM_API_IOC_TABLE[5])
466 
467 #define ROM_IOCIOPortPullSet \
468     ((void (*)(uint32_t ui32IOId, uint32_t ui32Pull)) \
469     ROM_API_IOC_TABLE[6])
470 
471 #define ROM_IOCIOHystSet \
472     ((void (*)(uint32_t ui32IOId, uint32_t ui32Hysteresis)) \
473     ROM_API_IOC_TABLE[7])
474 
475 #define ROM_IOCIOInputSet \
476     ((void (*)(uint32_t ui32IOId, uint32_t ui32Input)) \
477     ROM_API_IOC_TABLE[8])
478 
479 #define ROM_IOCIOSlewCtrlSet \
480     ((void (*)(uint32_t ui32IOId, uint32_t ui32SlewEnable)) \
481     ROM_API_IOC_TABLE[9])
482 
483 #define ROM_IOCIODrvStrengthSet \
484     ((void (*)(uint32_t ui32IOId, uint32_t ui32IOCurrent, uint32_t ui32DrvStrength)) \
485     ROM_API_IOC_TABLE[10])
486 
487 #define ROM_IOCIOPortIdSet \
488     ((void (*)(uint32_t ui32IOId, uint32_t ui32PortId)) \
489     ROM_API_IOC_TABLE[11])
490 
491 #define ROM_IOCIntEnable \
492     ((void (*)(uint32_t ui32IOId)) \
493     ROM_API_IOC_TABLE[12])
494 
495 #define ROM_IOCIntDisable \
496     ((void (*)(uint32_t ui32IOId)) \
497     ROM_API_IOC_TABLE[13])
498 
499 #define ROM_IOCPinTypeGpioInput \
500     ((void (*)(uint32_t ui32IOId)) \
501     ROM_API_IOC_TABLE[14])
502 
503 #define ROM_IOCPinTypeGpioOutput \
504     ((void (*)(uint32_t ui32IOId)) \
505     ROM_API_IOC_TABLE[15])
506 
507 #define ROM_IOCPinTypeUart \
508     ((void (*)(uint32_t ui32Base, uint32_t ui32Rx, uint32_t ui32Tx, uint32_t ui32Cts, uint32_t ui32Rts)) \
509     ROM_API_IOC_TABLE[16])
510 
511 #define ROM_IOCPinTypeSsiMaster \
512     ((void (*)(uint32_t ui32Base, uint32_t ui32Rx, uint32_t ui32Tx, uint32_t ui32Fss, uint32_t ui32Clk)) \
513     ROM_API_IOC_TABLE[17])
514 
515 #define ROM_IOCPinTypeSsiSlave \
516     ((void (*)(uint32_t ui32Base, uint32_t ui32Rx, uint32_t ui32Tx, uint32_t ui32Fss, uint32_t ui32Clk)) \
517     ROM_API_IOC_TABLE[18])
518 
519 #define ROM_IOCPinTypeI2c \
520     ((void (*)(uint32_t ui32Base, uint32_t ui32Data, uint32_t ui32Clk)) \
521     ROM_API_IOC_TABLE[19])
522 
523 #define ROM_IOCPinTypeAux \
524     ((void (*)(uint32_t ui32IOId)) \
525     ROM_API_IOC_TABLE[21])
526 
527 
528 // PRCM FUNCTIONS
529 #define ROM_PRCMInfClockConfigureSet \
530     ((void (*)(uint32_t ui32ClkDiv, uint32_t ui32PowerMode)) \
531     ROM_API_PRCM_TABLE[0])
532 
533 #define ROM_PRCMInfClockConfigureGet \
534     ((uint32_t (*)(uint32_t ui32PowerMode)) \
535     ROM_API_PRCM_TABLE[1])
536 
537 #define ROM_PRCMAudioClockConfigSet \
538     ((void (*)(uint32_t ui32ClkConfig, uint32_t ui32SampleRate)) \
539     ROM_API_PRCM_TABLE[4])
540 
541 #define ROM_PRCMPowerDomainOn \
542     ((void (*)(uint32_t ui32Domains)) \
543     ROM_API_PRCM_TABLE[5])
544 
545 #define ROM_PRCMPowerDomainOff \
546     ((void (*)(uint32_t ui32Domains)) \
547     ROM_API_PRCM_TABLE[6])
548 
549 #define ROM_PRCMPeripheralRunEnable \
550     ((void (*)(uint32_t ui32Peripheral)) \
551     ROM_API_PRCM_TABLE[7])
552 
553 #define ROM_PRCMPeripheralRunDisable \
554     ((void (*)(uint32_t ui32Peripheral)) \
555     ROM_API_PRCM_TABLE[8])
556 
557 #define ROM_PRCMPeripheralSleepEnable \
558     ((void (*)(uint32_t ui32Peripheral)) \
559     ROM_API_PRCM_TABLE[9])
560 
561 #define ROM_PRCMPeripheralSleepDisable \
562     ((void (*)(uint32_t ui32Peripheral)) \
563     ROM_API_PRCM_TABLE[10])
564 
565 #define ROM_PRCMPeripheralDeepSleepEnable \
566     ((void (*)(uint32_t ui32Peripheral)) \
567     ROM_API_PRCM_TABLE[11])
568 
569 #define ROM_PRCMPeripheralDeepSleepDisable \
570     ((void (*)(uint32_t ui32Peripheral)) \
571     ROM_API_PRCM_TABLE[12])
572 
573 #define ROM_PRCMPowerDomainStatus \
574     ((uint32_t (*)(uint32_t ui32Domains)) \
575     ROM_API_PRCM_TABLE[13])
576 
577 #define ROM_PRCMDeepSleep \
578     ((void (*)(void)) \
579     ROM_API_PRCM_TABLE[14])
580 
581 
582 // SMPH FUNCTIONS
583 #define ROM_SMPHAcquire \
584     ((void (*)(uint32_t ui32Semaphore)) \
585     ROM_API_SMPH_TABLE[0])
586 
587 
588 // SSI FUNCTIONS
589 #define ROM_SSIConfigSetExpClk \
590     ((void (*)(uint32_t ui32Base, uint32_t ui32SSIClk, uint32_t ui32Protocol, uint32_t ui32Mode, uint32_t ui32BitRate, uint32_t ui32DataWidth)) \
591     ROM_API_SSI_TABLE[0])
592 
593 #define ROM_SSIDataPut \
594     ((void (*)(uint32_t ui32Base, uint32_t ui32Data)) \
595     ROM_API_SSI_TABLE[1])
596 
597 #define ROM_SSIDataPutNonBlocking \
598     ((int32_t (*)(uint32_t ui32Base, uint32_t ui32Data)) \
599     ROM_API_SSI_TABLE[2])
600 
601 #define ROM_SSIDataGet \
602     ((void (*)(uint32_t ui32Base, uint32_t *pui32Data)) \
603     ROM_API_SSI_TABLE[3])
604 
605 #define ROM_SSIDataGetNonBlocking \
606     ((int32_t (*)(uint32_t ui32Base, uint32_t *pui32Data)) \
607     ROM_API_SSI_TABLE[4])
608 
609 
610 // TIMER FUNCTIONS
611 #define ROM_TimerConfigure \
612     ((void (*)(uint32_t ui32Base, uint32_t ui32Config)) \
613     ROM_API_TIMER_TABLE[0])
614 
615 #define ROM_TimerLevelControl \
616     ((void (*)(uint32_t ui32Base, uint32_t ui32Timer, bool bInvert)) \
617     ROM_API_TIMER_TABLE[1])
618 
619 #define ROM_TimerStallControl \
620     ((void (*)(uint32_t ui32Base, uint32_t ui32Timer, bool bStall)) \
621     ROM_API_TIMER_TABLE[3])
622 
623 #define ROM_TimerWaitOnTriggerControl \
624     ((void (*)(uint32_t ui32Base, uint32_t ui32Timer, bool bWait)) \
625     ROM_API_TIMER_TABLE[4])
626 
627 
628 // TRNG FUNCTIONS
629 #define ROM_TRNGNumberGet \
630     ((uint32_t (*)(uint32_t ui32Word)) \
631     ROM_API_TRNG_TABLE[1])
632 
633 
634 // UART FUNCTIONS
635 #define ROM_UARTFIFOLevelGet \
636     ((void (*)(uint32_t ui32Base, uint32_t *pui32TxLevel, uint32_t *pui32RxLevel)) \
637     ROM_API_UART_TABLE[0])
638 
639 #define ROM_UARTConfigSetExpClk \
640     ((void (*)(uint32_t ui32Base, uint32_t ui32UARTClk, uint32_t ui32Baud, uint32_t ui32Config)) \
641     ROM_API_UART_TABLE[1])
642 
643 #define ROM_UARTConfigGetExpClk \
644     ((void (*)(uint32_t ui32Base, uint32_t ui32UARTClk, uint32_t *pui32Baud, uint32_t *pui32Config)) \
645     ROM_API_UART_TABLE[2])
646 
647 #define ROM_UARTDisable \
648     ((void (*)(uint32_t ui32Base)) \
649     ROM_API_UART_TABLE[3])
650 
651 #define ROM_UARTCharGetNonBlocking \
652     ((int32_t (*)(uint32_t ui32Base)) \
653     ROM_API_UART_TABLE[4])
654 
655 #define ROM_UARTCharGet \
656     ((int32_t (*)(uint32_t ui32Base)) \
657     ROM_API_UART_TABLE[5])
658 
659 #define ROM_UARTCharPutNonBlocking \
660     ((bool (*)(uint32_t ui32Base, uint8_t ui8Data)) \
661     ROM_API_UART_TABLE[6])
662 
663 #define ROM_UARTCharPut \
664     ((void (*)(uint32_t ui32Base, uint8_t ui8Data)) \
665     ROM_API_UART_TABLE[7])
666 
667 
668 // UDMA FUNCTIONS
669 #define ROM_uDMAChannelAttributeEnable \
670     ((void (*)(uint32_t ui32Base, uint32_t ui32ChannelNum, uint32_t ui32Attr)) \
671     ROM_API_UDMA_TABLE[0])
672 
673 #define ROM_uDMAChannelAttributeDisable \
674     ((void (*)(uint32_t ui32Base, uint32_t ui32ChannelNum, uint32_t ui32Attr)) \
675     ROM_API_UDMA_TABLE[1])
676 
677 #define ROM_uDMAChannelAttributeGet \
678     ((uint32_t (*)(uint32_t ui32Base, uint32_t ui32ChannelNum)) \
679     ROM_API_UDMA_TABLE[2])
680 
681 #define ROM_uDMAChannelControlSet \
682     ((void (*)(uint32_t ui32Base, uint32_t ui32ChannelStructIndex, uint32_t ui32Control)) \
683     ROM_API_UDMA_TABLE[3])
684 
685 #define ROM_uDMAChannelScatterGatherSet \
686     ((void (*)(uint32_t ui32Base, uint32_t ui32ChannelNum, uint32_t ui32TaskCount, void *pvTaskList, uint32_t ui32IsPeriphSG)) \
687     ROM_API_UDMA_TABLE[5])
688 
689 #define ROM_uDMAChannelSizeGet \
690     ((uint32_t (*)(uint32_t ui32Base, uint32_t ui32ChannelStructIndex)) \
691     ROM_API_UDMA_TABLE[6])
692 
693 #define ROM_uDMAChannelModeGet \
694     ((uint32_t (*)(uint32_t ui32Base, uint32_t ui32ChannelStructIndex)) \
695     ROM_API_UDMA_TABLE[7])
696 
697 
698 // VIMS FUNCTIONS
699 #define ROM_VIMSConfigure \
700     ((void (*)(uint32_t ui32Base, bool bRoundRobin, bool bPrefetch)) \
701     ROM_API_VIMS_TABLE[0])
702 
703 #define ROM_VIMSModeSet \
704     ((void (*)(uint32_t ui32Base, uint32_t ui32Mode)) \
705     ROM_API_VIMS_TABLE[1])
706 
707 
708 
709 //*****************************************************************************
710 //
711 // Mark the end of the C bindings section for C++ compilers.
712 //
713 //*****************************************************************************
714 #ifdef __cplusplus
715 }
716 #endif
717 
718 #endif // __ROM_H__
719