1 /*
2  * @brief LPC15xx ROM API declarations and functions
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2013
6  * All rights reserved.
7  *
8  * @par
9  * Software that is described herein is for illustrative purposes only
10  * which provides customers with programming information regarding the
11  * LPC products.  This software is supplied "AS IS" without any warranties of
12  * any kind, and NXP Semiconductors and its licensor disclaim any and
13  * all warranties, express or implied, including all implied warranties of
14  * merchantability, fitness for a particular purpose and non-infringement of
15  * intellectual property rights.  NXP Semiconductors assumes no responsibility
16  * or liability for the use of the software, conveys no license or rights under any
17  * patent, copyright, mask work right, or any other intellectual property rights in
18  * or to any products. NXP Semiconductors reserves the right to make changes
19  * in the software without notification. NXP Semiconductors also makes no
20  * representation or warranty that such application will be suitable for the
21  * specified use without further testing or modification.
22  *
23  * @par
24  * Permission to use, copy, modify, and distribute this software and its
25  * documentation is hereby granted, under NXP Semiconductors' and its
26  * licensor's relevant copyrights in the software, without fee, provided that it
27  * is used in conjunction with NXP Semiconductors microcontrollers.  This
28  * copyright, permission, and disclaimer notice must appear in all copies of
29  * this code.
30  */
31 
32 #ifndef __ROMAPI_15XX_H_
33 #define __ROMAPI_15XX_H_
34 
35 #include "iap.h"
36 #include "eeprom.h"
37 #include "error.h"
38 #include "rom_i2c_15xx.h"
39 #include "rom_pwr_15xx.h"
40 #include "rom_uart_15xx.h"
41 #include "rom_can_15xx.h"
42 #include "rom_dma_15xx.h"
43 #include "rom_spi_15xx.h"
44 #include "rom_adc_15xx.h"
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 /** @defgroup ROMAPI_15XX CHIP: LPC15xx ROM API declarations and functions
51  * @ingroup CHIP_15XX_Drivers
52  * @{
53  */
54 
55 /**
56  * @brief LPC15XX High level ROM API structure
57  */
58 typedef struct {
59 	const uint32_t pUSBD;					/*!< USBD API function table base address */
60 	const uint32_t reserved0;				/*!< Reserved */
61 	const CAND_API_T *pCAND;				/*!< C_CAN API function table base address */
62 	const PWRD_API_T *pPWRD;				/*!< Power API function table base address */
63 	const uint32_t reserved1;				/*!< Reserved */
64 	const I2CD_API_T *pI2CD;				/*!< I2C driver API function table base address */
65 	const DMAD_API_T *pDMAD;				/*!< DMA driver API function table base address */
66 	const SPID_API_T *pSPID;				/*!< I2C driver API function table base address */
67 	const ADCD_API_T *pADCD;				/*!< ADC driver API function table base address */
68 	const UARTD_API_T *pUARTD;				/*!< UART driver API function table base address */
69 } LPC_ROM_API_T;
70 
71 /* Pointer to ROM API function address */
72 #define LPC_ROM_API_BASE_LOC    0x03000200UL
73 #define LPC_ROM_API     (*(LPC_ROM_API_T * *) LPC_ROM_API_BASE_LOC)
74 
75 /* Pointer to @ref CAND_API_T functions in ROM */
76 #define LPC_CAND_API    ((LPC_ROM_API)->pCAND)
77 
78 /* Pointer to @ref PWRD_API_T functions in ROM */
79 #define LPC_PWRD_API    ((LPC_ROM_API)->pPWRD)
80 
81 /* Pointer to @ref I2CD_API_T functions in ROM */
82 #define LPC_I2CD_API    ((LPC_ROM_API)->pI2CD)
83 
84 /* Pointer to @ref DMAD_API_T functions in ROM for DMA */
85 #define LPC_DMAD_API    ((LPC_ROM_API)->pDMAD)
86 
87 /* Pointer to @ref SPID_API_T functions in ROM for DMA */
88 #define LPC_SPID_API    ((LPC_ROM_API)->pSPID)
89 
90 /* Pointer to @ref ADCD_API_T functions in ROM for pADCD */
91 #define LPC_ADCD_API    ((LPC_ROM_API)->pADCD)
92 
93 /* Pointer to @ref UARTD_API_T functions in ROM for UARTs */
94 #define LPC_UARTD_API   ((LPC_ROM_API)->pUARTD)
95 
96 /* Pointer to ROM IAP entry functions */
97 #define IAP_ENTRY_LOCATION        0x03000205UL
98 
99 /**
100  * @brief LPC15XX IAP_ENTRY API function type
101  */
iap_entry(unsigned int cmd_param[5],unsigned int status_result[4])102 static INLINE void iap_entry(unsigned int cmd_param[5], unsigned int status_result[4])
103 {
104 	((IAP_ENTRY_T) IAP_ENTRY_LOCATION)(cmd_param, status_result);
105 }
106 
107 /**
108  * @}
109  */
110 
111 #ifdef __cplusplus
112 }
113 #endif
114 
115 #endif /* __ROMAPI_11U6X_H_ */
116