-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hw/mcu: Add LPC55xx family MCU from NXP
This adds basic support for NXP LPC55xx family. Currently watchdog, flash, uart, gpio is suported. No I2C, SPI, timers.
- Loading branch information
Showing
21 changed files
with
3,093 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
/* | ||
* Copyright 2017-2019 NXP | ||
* All rights reserved. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
/*********************************************************************************************************************** | ||
* This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file | ||
* will be overwritten if the respective MCUXpresso Config Tools is used to update this file. | ||
**********************************************************************************************************************/ | ||
|
||
#ifndef _CLOCK_CONFIG_H_ | ||
#define _CLOCK_CONFIG_H_ | ||
|
||
#include "fsl_common.h" | ||
|
||
/******************************************************************************* | ||
* Definitions | ||
******************************************************************************/ | ||
#define BOARD_XTAL0_CLK_HZ 16000000U /*!< Board xtal frequency in Hz */ | ||
#define BOARD_XTAL32K_CLK_HZ 32768U /*!< Board xtal32K frequency in Hz */ | ||
|
||
/******************************************************************************* | ||
************************ BOARD_InitBootClocks function ************************ | ||
******************************************************************************/ | ||
|
||
#if defined(__cplusplus) | ||
extern "C" { | ||
#endif /* __cplusplus*/ | ||
|
||
/*! | ||
* @brief This function executes default configuration of clocks. | ||
* | ||
*/ | ||
void BOARD_InitBootClocks(void); | ||
|
||
#if defined(__cplusplus) | ||
} | ||
#endif /* __cplusplus*/ | ||
|
||
/******************************************************************************* | ||
******************** Configuration BOARD_BootClockFRO12M ********************** | ||
******************************************************************************/ | ||
/******************************************************************************* | ||
* Definitions for BOARD_BootClockFRO12M configuration | ||
******************************************************************************/ | ||
#define BOARD_BOOTCLOCKFRO12M_CORE_CLOCK 12000000U /*!< Core clock frequency: 12000000Hz */ | ||
|
||
/******************************************************************************* | ||
* API for BOARD_BootClockFRO12M configuration | ||
******************************************************************************/ | ||
#if defined(__cplusplus) | ||
extern "C" { | ||
#endif /* __cplusplus*/ | ||
|
||
/*! | ||
* @brief This function executes configuration of clocks. | ||
* | ||
*/ | ||
void BOARD_BootClockFRO12M(void); | ||
|
||
#if defined(__cplusplus) | ||
} | ||
#endif /* __cplusplus*/ | ||
|
||
/******************************************************************************* | ||
******************* Configuration BOARD_BootClockFROHF96M ********************* | ||
******************************************************************************/ | ||
/******************************************************************************* | ||
* Definitions for BOARD_BootClockFROHF96M configuration | ||
******************************************************************************/ | ||
#define BOARD_BOOTCLOCKFROHF96M_CORE_CLOCK 96000000U /*!< Core clock frequency: 96000000Hz */ | ||
|
||
/******************************************************************************* | ||
* API for BOARD_BootClockFROHF96M configuration | ||
******************************************************************************/ | ||
#if defined(__cplusplus) | ||
extern "C" { | ||
#endif /* __cplusplus*/ | ||
|
||
/*! | ||
* @brief This function executes configuration of clocks. | ||
* | ||
*/ | ||
void BOARD_BootClockFROHF96M(void); | ||
|
||
#if defined(__cplusplus) | ||
} | ||
#endif /* __cplusplus*/ | ||
|
||
/******************************************************************************* | ||
******************** Configuration BOARD_BootClockPLL100M ********************* | ||
******************************************************************************/ | ||
/******************************************************************************* | ||
* Definitions for BOARD_BootClockPLL100M configuration | ||
******************************************************************************/ | ||
#define BOARD_BOOTCLOCKPLL100M_CORE_CLOCK 100000000U /*!< Core clock frequency: 100000000Hz */ | ||
|
||
/******************************************************************************* | ||
* API for BOARD_BootClockPLL100M configuration | ||
******************************************************************************/ | ||
#if defined(__cplusplus) | ||
extern "C" { | ||
#endif /* __cplusplus*/ | ||
|
||
/*! | ||
* @brief This function executes configuration of clocks. | ||
* | ||
*/ | ||
void BOARD_BootClockPLL100M(void); | ||
|
||
#if defined(__cplusplus) | ||
} | ||
#endif /* __cplusplus*/ | ||
|
||
/******************************************************************************* | ||
******************** Configuration BOARD_BootClockPLL150M ********************* | ||
******************************************************************************/ | ||
/******************************************************************************* | ||
* Definitions for BOARD_BootClockPLL150M configuration | ||
******************************************************************************/ | ||
#define BOARD_BOOTCLOCKPLL150M_CORE_CLOCK 150000000U /*!< Core clock frequency: 150000000Hz */ | ||
|
||
/******************************************************************************* | ||
* API for BOARD_BootClockPLL150M configuration | ||
******************************************************************************/ | ||
#if defined(__cplusplus) | ||
extern "C" { | ||
#endif /* __cplusplus*/ | ||
|
||
/*! | ||
* @brief This function executes configuration of clocks. | ||
* | ||
*/ | ||
void BOARD_BootClockPLL150M(void); | ||
|
||
#if defined(__cplusplus) | ||
} | ||
#endif /* __cplusplus*/ | ||
|
||
/******************************************************************************* | ||
******************* Configuration BOARD_BootClockPLL1_150M ******************** | ||
******************************************************************************/ | ||
/******************************************************************************* | ||
* Definitions for BOARD_BootClockPLL1_150M configuration | ||
******************************************************************************/ | ||
#define BOARD_BOOTCLOCKPLL1_150M_CORE_CLOCK 150000000U /*!< Core clock frequency: 150000000Hz */ | ||
|
||
|
||
/******************************************************************************* | ||
* API for BOARD_BootClockPLL1_150M configuration | ||
******************************************************************************/ | ||
#if defined(__cplusplus) | ||
extern "C" { | ||
#endif /* __cplusplus*/ | ||
|
||
/*! | ||
* @brief This function executes configuration of clocks. | ||
* | ||
*/ | ||
void BOARD_BootClockPLL1_150M(void); | ||
|
||
#if defined(__cplusplus) | ||
} | ||
#endif /* __cplusplus*/ | ||
|
||
#endif /* _CLOCK_CONFIG_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* mbed Microcontroller Library - cmsis_nvic | ||
* Copyright (c) 2009-2011 ARM Limited. All rights reserved. | ||
* | ||
* CMSIS-style functionality to support dynamic vectors | ||
*/ | ||
|
||
#ifndef MBED_CMSIS_NVIC_H | ||
#define MBED_CMSIS_NVIC_H | ||
|
||
#include <stdint.h> | ||
|
||
#define NVIC_NUM_VECTORS (16 + 59) // CORE + MCU Peripherals | ||
#define NVIC_USER_IRQ_OFFSET 16 | ||
|
||
#include <fsl_device_registers.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
void NVIC_Relocate(void); | ||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); | ||
uint32_t NVIC_GetVector(IRQn_Type IRQn); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
#ifndef __MCU_CORTEX_M33_H__ | ||
#define __MCU_CORTEX_M33_H__ | ||
|
||
#include <mcu/mcu.h> | ||
#include <cmsis_gcc.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
static inline void | ||
hal_debug_break(void) | ||
{ | ||
__BKPT(1); | ||
} | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* __MCU_CORTEX_M33_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
#ifndef __MCU_MCU_H_ | ||
#define __MCU_MCU_H_ | ||
|
||
#include <fsl_device_registers.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#define SVC_IRQ_NUMBER SVC_IRQn | ||
|
||
/* | ||
* Defines for naming GPIOs. | ||
*/ | ||
#define MCU_GPIO_PORT0(pin) ((0 * 32) + (pin)) | ||
#define MCU_GPIO_PORT1(pin) ((1 * 32) + (pin)) | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* __MCU_MCU_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
#if (defined(CPU_LPC55S28JBD100) || defined(CPU_LPC55S28JBD64) || defined(CPU_LPC55S28JEV98)) | ||
#include "vectors/lpc55s28_vectors.h" | ||
#else | ||
#error "Please select first the target LPC55 device used in your application" | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
#ifndef __MCUX_HAL_H_ | ||
#define __MCUX_HAL_H_ | ||
|
||
#include <stdint.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/* Helper functions to enable/disable interrupts. */ | ||
#define __HAL_DISABLE_INTERRUPTS(x) \ | ||
do { \ | ||
x = __get_PRIMASK(); \ | ||
__disable_irq(); \ | ||
} while(0); | ||
|
||
#define __HAL_ENABLE_INTERRUPTS(x) \ | ||
do { \ | ||
if (!x) { \ | ||
__enable_irq(); \ | ||
} \ | ||
} while(0); | ||
|
||
struct nxp_hal_i2c_cfg { | ||
int8_t pin_scl; | ||
int8_t pin_sda; | ||
uint32_t frequency; | ||
}; | ||
|
||
struct nxp_hal_spi_cfg { | ||
uint32_t clk_pin; | ||
uint32_t pcs_pin; | ||
uint32_t sout_pin; | ||
uint32_t sin_pin; | ||
}; | ||
|
||
struct hal_flash; | ||
extern const struct hal_flash mcux_flash_dev; | ||
extern const struct hal_flash mcux_qspi_dev; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* __MCUX_HAL_H_ */ |
Oops, something went wrong.