1 /* 2 * @brief LPC15xx basic chip inclusion file 3 * 4 * Copyright(C) NXP Semiconductors, 2013 5 * All rights reserved. 6 * 7 * Software that is described herein is for illustrative purposes only 8 * which provides customers with programming information regarding the 9 * LPC products. This software is supplied "AS IS" without any warranties of 10 * any kind, and NXP Semiconductors and its licensor disclaim any and 11 * all warranties, express or implied, including all implied warranties of 12 * merchantability, fitness for a particular purpose and non-infringement of 13 * intellectual property rights. NXP Semiconductors assumes no responsibility 14 * or liability for the use of the software, conveys no license or rights under any 15 * patent, copyright, mask work right, or any other intellectual property rights in 16 * or to any products. NXP Semiconductors reserves the right to make changes 17 * in the software without notification. NXP Semiconductors also makes no 18 * representation or warranty that such application will be suitable for the 19 * specified use without further testing or modification. 20 * 21 * Permission to use, copy, modify, and distribute this software and its 22 * documentation is hereby granted, under NXP Semiconductors' and its 23 * licensor's relevant copyrights in the software, without fee, provided that it 24 * is used in conjunction with NXP Semiconductors microcontrollers. This 25 * copyright, permission, and disclaimer notice must appear in all copies of 26 * this code. 27 */ 28 29 #ifndef __CHIP_H_ 30 #define __CHIP_H_ 31 32 #include "lpc_types.h" 33 #include "sys_config.h" 34 #include "cmsis.h" 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 #ifndef CORE_M3 41 #error CORE_M3 is not defined for the LPC15xx architecture 42 #error CORE_M3 should be defined as part of your compiler define list 43 #endif 44 45 #if !defined(CHIP_LPC15XX) 46 #error CHIP_LPC15XX is not defined! 47 #endif 48 49 /** @defgroup PERIPH_15XX_BASE CHIP: LPC15xx Peripheral addresses and register set declarations 50 * @ingroup CHIP_15XX_Drivers 51 * @{ 52 */ 53 54 #define LPC_ADC0_BASE 0x40000000 55 #define LPC_DAC_BASE 0x40004000 56 #define LPC_CMP_BASE 0x40008000 57 #define LPC_INMUX_BASE 0x40014000 58 #define LPC_RTC_BASE 0x40028000 59 #define LPC_WWDT_BASE 0x4002C000 60 #define LPC_SWM_BASE 0x40038000 61 #define LPC_PMU_BASE 0x4003C000 62 #define LPC_USART0_BASE 0x40040000 63 #define LPC_USART1_BASE 0x40044000 64 #define LPC_SPI0_BASE 0x40048000 65 #define LPC_SPI1_BASE 0x4004C000 66 #define LPC_I2C_BASE 0x40050000 67 #define LPC_QEI_BASE 0x40058000 68 #define LPC_SYSCTL_BASE 0x40074000 69 #define LPC_ADC1_BASE 0x40080000 70 #define LPC_MRT_BASE 0x400A0000 71 #define LPC_PIN_INT_BASE 0x400A4000 72 #define LPC_GPIO_GROUP_INT0_BASE 0x400A8000 73 #define LPC_GPIO_GROUP_INT1_BASE 0x400AC000 74 #define LPC_RITIMER_BASE 0x400B4000 75 #define LPC_SCTIPU_BASE 0x400B8000 76 #define LPC_FLASH_BASE 0x400BC000 77 #define LPC_USART2_BASE 0x400C0000 78 #define TBD_BASE 0x400E8000 79 #define LPC_C_CAN0_BASE 0x400F0000 80 #define LPC_IOCON_BASE 0x400F8000 81 #define LPC_EEPROM_BASE 0x400FC000 82 #define LPC_GPIO_PIN_INT_BASE 0x1C000000 83 #define LPC_DMA_BASE 0x1C004000 84 #define LPC_USB0_BASE 0x1C00C000 85 #define LPC_CRC_BASE 0x1C010000 86 #define LPC_SCTLARGE_0_BASE 0x1C018000 87 #define LPC_SCTLARGE_1_BASE 0x1C01C000 88 #define LPC_SCTSMALL_0_BASE 0x1C020000 89 #define LPC_SCTSMALL_1_BASE 0x1C024000 90 91 #define LPC_PMU ((LPC_PMU_T *) LPC_PMU_BASE) 92 #define LPC_IOCON ((LPC_IOCON_T *) LPC_IOCON_BASE) 93 #define LPC_SYSCTL ((LPC_SYSCTL_T *) LPC_SYSCTL_BASE) 94 #define LPC_SYSCON ((LPC_SYSCTL_T *) LPC_SYSCTL_BASE) /* Alias for LPC_SYSCTL */ 95 #define LPC_GPIO ((LPC_GPIO_T *) LPC_GPIO_PIN_INT_BASE) 96 #define LPC_GPIOGROUP ((LPC_GPIOGROUPINT_T *) LPC_GPIO_GROUP_INT0_BASE) 97 #define LPC_GPIO_PIN_INT ((LPC_PIN_INT_T *) LPC_PIN_INT_BASE) 98 #define LPC_USART0 ((LPC_USART_T *) LPC_USART0_BASE) 99 #define LPC_USART1 ((LPC_USART_T *) LPC_USART1_BASE) 100 #define LPC_USART2 ((LPC_USART_T *) LPC_USART2_BASE) 101 #define LPC_I2C0 ((LPC_I2C_T *) LPC_I2C_BASE) 102 // #define LPC_I2C1 ((LPC_I2C_T *) LPC_I2C1_BASE) 103 // #define LPC_SSP0 ((LPC_SSP_T *) LPC_SSP0_BASE) 104 // #define LPC_SSP1 ((LPC_SSP_T *) LPC_SSP1_BASE) 105 #define LPC_USB ((LPC_USB_T *) LPC_USB0_BASE) 106 #define LPC_ADC0 ((LPC_ADC_T *) LPC_ADC0_BASE) 107 #define LPC_ADC1 ((LPC_ADC_T *) LPC_ADC1_BASE) 108 // #define LPC_SCT0 ((LPC_SCT_T *) LPC_SCT0_BASE) 109 // #define LPC_SCT1 ((LPC_SCT_T *) LPC_SCT1_BASE) 110 // #define LPC_TIMER16_0 ((LPC_TIMER_T *) LPC_TIMER16_0_BASE) 111 // #define LPC_TIMER16_1 ((LPC_TIMER_T *) LPC_TIMER16_1_BASE) 112 // #define LPC_TIMER32_0 ((LPC_TIMER_T *) LPC_TIMER32_0_BASE) 113 // #define LPC_TIMER32_1 ((LPC_TIMER_T *) LPC_TIMER32_1_BASE) 114 #define LPC_RTC ((LPC_RTC_T *) LPC_RTC_BASE) 115 #define LPC_WWDT ((LPC_WWDT_T *) LPC_WWDT_BASE) 116 #define LPC_DMA ((LPC_DMA_T *) LPC_DMA_BASE) 117 #define LPC_CRC ((LPC_CRC_T *) LPC_CRC_BASE) 118 #define LPC_FMC ((LPC_FMC_T *) LPC_FLASH_BASE) 119 #define LPC_MRT ((LPC_MRT_T *) LPC_MRT_BASE) 120 #define LPC_SWM ((LPC_SWM_T *) LPC_SWM_BASE) 121 #define LPC_RITIMER ((LPC_RITIMER_T *) LPC_RITIMER_BASE) 122 #define LPC_INMUX ((LPC_INMUX_T *) LPC_INMUX_BASE) 123 #define LPC_SCTIPU ((LPC_SCTIPU_T *) LPC_SCTIPU_BASE) 124 #define LPC_CMP ((LPC_CMP_T *) LPC_CMP_BASE) 125 #define LPC_DAC ((LPC_DAC_T *) LPC_DAC_BASE) 126 #define LPC_SPI0 ((LPC_SPI_T *) LPC_SPI0_BASE) 127 #define LPC_SPI1 ((LPC_SPI_T *) LPC_SPI1_BASE) 128 129 /** 130 * @} 131 */ 132 133 /** @ingroup CHIP_15XX_DRIVER_OPTIONS 134 * @{ 135 */ 136 137 /** 138 * @brief System oscillator rate 139 * This value is defined externally to the chip layer and contains 140 * the value in Hz for the external oscillator for the board. If using the 141 * internal oscillator, this rate can be 0. 142 */ 143 extern const uint32_t OscRateIn; 144 145 /** 146 * @brief RTC oscillator rate 147 * This value is defined externally to the chip layer and contains 148 * the value in Hz for the RTC oscillator for the board. This is 149 * usually 32KHz (32768). If not using the RTC, this rate can be 0. 150 */ 151 extern const uint32_t RTCOscRateIn; 152 153 154 /** 155 * @} 156 */ 157 158 /* Include order is important! */ 159 #include "romapi_15xx.h" 160 #include "sysctl_15xx.h" 161 #include "clock_15xx.h" 162 #include "iocon_15xx.h" 163 #include "swm_15xx.h" 164 #include "pmu_15xx.h" 165 #include "crc_15xx.h" 166 #include "gpio_15xx.h" 167 #include "pinint_15xx.h" 168 #include "gpiogroup_15xx.h" 169 // #include "timer_11u6x.h" 170 #include "uart_15xx.h" 171 // #include "ssp_11u6x.h" 172 #include "adc_15xx.h" 173 #include "mrt_15xx.h" 174 #include "ritimer_15xx.h" 175 #include "dma_15xx.h" 176 // #include "i2c_11u6x.h" 177 #include "usbd_15xx.h" 178 #include "sctipu_15xx.h" 179 // #include "sct_11u6x.h" 180 #include "rtc_15xx.h" 181 #include "wwdt_15xx.h" 182 #include "fmc_15xx.h" 183 #include "inmux_15xx.h" 184 #include "acmp_15xx.h" 185 #include "dac_15xx.h" 186 #include "spi_15xx.h" 187 #include "i2cm_15xx.h" 188 #include "i2cs_15xx.h" 189 190 /** @defgroup SUPPORT_15XX_FUNC CHIP: LPC15xx support functions 191 * @ingroup CHIP_15XX_Drivers 192 * @{ 193 */ 194 195 /** 196 * @brief Current system clock rate, mainly used for sysTick 197 */ 198 extern uint32_t SystemCoreClock; 199 200 /** 201 * @brief Update system core clock rate, should be called if the 202 * system has a clock rate change 203 * @return None 204 */ 205 void SystemCoreClockUpdate(void); 206 207 /** 208 * @brief Set up and initialize hardware prior to call to main() 209 * @return None 210 * @note Chip_SystemInit() is called prior to the application and sets up 211 * system clocking prior to the application starting. 212 */ 213 void Chip_SystemInit(void); 214 215 /** 216 * @brief USB clock initialization 217 * Calling this function will initialize the USB PLL and clock divider 218 * @return None 219 * @note This function will assume that the chip is clocked by an 220 * external crystal oscillator of frequency 12MHz and the Oscillator 221 * is running. 222 */ 223 void Chip_USB_Init(void); 224 225 /** 226 * @brief Clock and PLL initialization based on the external oscillator 227 * @return None 228 * @note This function assumes an external crystal oscillator 229 * frequency of 12MHz. 230 */ 231 void Chip_SetupXtalClocking(void); 232 233 /** 234 * @brief Clock and PLL initialization based on the internal oscillator 235 * @return None 236 */ 237 void Chip_SetupIrcClocking(void); 238 239 /** 240 * @} 241 */ 242 243 #ifdef __cplusplus 244 } 245 #endif 246 247 #endif /* __CHIP_H_ */ 248