romapi_5410x.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. * @brief LPC5410X ROM API declarations and functions
  3. *
  4. * @note
  5. * Copyright(C) NXP Semiconductors, 2014
  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. #ifndef __ROMAPI_5410X_H_
  32. #define __ROMAPI_5410X_H_
  33. #include <stdint.h>
  34. #include "iap.h"
  35. #include "error.h"
  36. #include "cmsis.h"
  37. /* v1 ROM driver APIs */
  38. #include "rom_pwr_5410x.h"
  39. /* v2 ROM driver APIs */
  40. #include "romapi_adc.h"
  41. #include "romapi_dma.h"
  42. #include "romapi_i2cm.h"
  43. #include "romapi_i2cmon.h"
  44. #include "romapi_i2cs.h"
  45. #include "romapi_spim.h"
  46. #include "romapi_spis.h"
  47. #include "romapi_uart.h"
  48. #ifdef __cplusplus
  49. extern "C" {
  50. #endif
  51. /** @defgroup ROMAPI_5410X CHIP: LPC5410X ROM API declarations and functions
  52. * @ingroup CHIP_5410X_DRIVERS
  53. * @{
  54. */
  55. /**
  56. * @brief High level ROM API structure
  57. */
  58. typedef struct {
  59. const uint32_t reserved_usb; /*!< Reserved */
  60. const uint32_t reserved_clib; /*!< Reserved */
  61. const uint32_t reserved_can; /*!< Reserved */
  62. const PWRD_API_T *pPWRD; /*!< Power API function table base address */
  63. const uint32_t reserved_div; /*!< Reserved */
  64. const uint32_t reserved_i2cd; /*!< Reserved */
  65. const uint32_t reserved_dmad; /*!< Reserved */
  66. const uint32_t reserved_spid; /*!< Reserved */
  67. const uint32_t reserved_adcd; /*!< Reserved */
  68. const uint32_t reserved_uartd; /*!< Reserved */
  69. const uint32_t reserved_vfifo; /*!< Reserved */
  70. const uint32_t reserved_usart; /*!< Reserved */
  71. /* v2 drivers - only present in some LPC5410x devices */
  72. const ROM_I2CMD_API_T *pI2CMD; /*!< v2 I2C master only driver API function table base address */
  73. const ROM_I2CSD_API_T *pI2CSD; /*!< v2 I2C slave only driver API function table base address */
  74. const ROM_I2CMOND_API_T *pI2CMOND; /*!< v2 I2C bus monitor driver API function table base address */
  75. const ROM_SPIMD_API_T *pSPIMD; /*!< v2 SPI master only driver API function table base address */
  76. const ROM_SPISD_API_T *pSPISD; /*!< v2 SPI slave only driver API function table base address */
  77. const ROM_DMAALTD_API_T *pDMAALT; /*!< v2 abstract DMA driver API function table base address */
  78. const ROM_ADC_API_T *pADCALT; /*!< v2 ADC driver API function table base address */
  79. const ROM_UART_API_T *pUARTALT; /*!< v2 UART driver API function table base address */
  80. } LPC_ROM_API_T;
  81. /* Pointer to ROM API function address */
  82. #define LPC_ROM_API_BASE_LOC 0x03000200UL
  83. #define LPC_ROM_API (*(LPC_ROM_API_T * *) LPC_ROM_API_BASE_LOC)
  84. /* Pointer to @ref PWRD_API_T functions in ROM */
  85. #define LPC_PWRD_API ((LPC_ROM_API)->pPWRD)
  86. /* Pointer to v2 I2C master peripheral driver functions in ROM */
  87. #define ROMAPI_I2CM_API ((LPC_ROM_API)->pI2CMD)
  88. /* Pointer to v2 I2C master peripheral driver functions in ROM */
  89. #define ROMAPI_I2CMON_API ((LPC_ROM_API)->pI2CMOND)
  90. /* Pointer to v2 I2C slave peripheral driver functions in ROM */
  91. #define ROMAPI_I2CS_API ((LPC_ROM_API)->pI2CSD)
  92. /* Pointer to v2 SPI master peripheral driver functions in ROM */
  93. #define ROMAPI_SPIM_API ((LPC_ROM_API)->pSPIMD)
  94. /* Pointer to v2 SPI slave peripheral driver functions in ROM */
  95. #define ROMAPI_SPIS_API ((LPC_ROM_API)->pSPISD)
  96. /* Pointer to v2 DMA controller driver functions in ROM */
  97. #define ROMAPI_DMAALT_API ((LPC_ROM_API)->pDMAALT)
  98. /* Pointer to v2 ADC driver functions in ROM */
  99. #define ROMAPI_ADC_API ((LPC_ROM_API)->pADCALT)
  100. /* Pointer to v2 UART controller driver functions in ROM */
  101. #define ROMAPI_UART_API ((LPC_ROM_API)->pUARTALT)
  102. /* Pointer to ROM IAP entry functions */
  103. #define IAP_ENTRY_LOCATION 0x03000205
  104. /**
  105. * @brief LPC5410x IAP_ENTRY API function type
  106. */
  107. static INLINE void iap_entry(unsigned int cmd_param[5], unsigned int status_result[4])
  108. {
  109. ((IAP_ENTRY_T) IAP_ENTRY_LOCATION)(cmd_param, status_result);
  110. }
  111. /**
  112. * @}
  113. */
  114. #ifdef __cplusplus
  115. }
  116. #endif
  117. #endif /* __ROMAPI_5410X_H_ */