├── .UDS_S32K144_FlashDriver.g_c ├── .UDS_S32K144_FlashDriver.g_x ├── .cproject ├── .gitattributes ├── .github └── FUNDING.yml ├── .gitignore ├── .project ├── Documentation ├── UDS_S32K144_FlashDriver.txt ├── UDS_S32K144_FlashDriver_Settings.previous.xml └── UDS_S32K144_FlashDriver_Settings.xml ├── Generated_Code ├── Cpu.c ├── Cpu.h ├── Flash1.c ├── Flash1.h ├── clockMan1.c ├── clockMan1.h ├── pin_mux.c └── pin_mux.h ├── Note_00.png ├── Note_01.png ├── Note_02.png ├── Pic_ZCANPRO_ECU_Refresh.png ├── ProcessorExpert.pe ├── Project_Settings ├── Linker_Files │ ├── S32K144_64_flash.ld │ └── S32K144_64_ram.ld └── Startup_Code │ └── startup_S32K144.S ├── README.md ├── SDK └── platform │ ├── devices │ ├── S32K144 │ │ ├── include │ │ │ ├── S32K144.h │ │ │ └── S32K144_features.h │ │ └── startup │ │ │ ├── system_S32K144.c │ │ │ └── system_S32K144.h │ ├── callbacks.h │ ├── common │ │ └── s32_core_cm4.h │ ├── devassert.h │ ├── device_registers.h │ ├── startup.c │ ├── startup.h │ └── status.h │ └── drivers │ ├── inc │ ├── clock.h │ ├── clock_manager.h │ ├── flash_driver.h │ ├── interrupt_manager.h │ └── pins_driver.h │ └── src │ ├── clock │ └── S32K1xx │ │ ├── clock_S32K1xx.c │ │ ├── clock_S32K1xx.h │ │ ├── pcc_hw_access.h │ │ ├── pmc_hw_access.h │ │ ├── scg_hw_access.h │ │ ├── sim_hw_access.h │ │ └── smc_hw_access.h │ ├── flash │ └── flash_driver.c │ ├── interrupt │ └── interrupt_manager.c │ └── pins │ ├── pins_driver.c │ ├── pins_gpio_hw_access.h │ ├── pins_port_hw_access.c │ └── pins_port_hw_access.h ├── Sources ├── NVM_Flash.c ├── NVM_Flash.h ├── main.c └── 一键格式化所有代码(包括子目录)_精简版.bat └── UDS_S32K144_FlashDriverExtracted.hex /.UDS_S32K144_FlashDriver.g_x: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 8 66 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerFalls/UDS_S32K144_FlashDriver/cd5289c1df01f55d19ab565eebd82d6800d8b9bd/.gitattributes -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: paypal.me/37LINN 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /Debug/ 2 | .settings/ 3 | 4 | # Locally stored "Eclipse launch configurations" 5 | *.launch 6 | 7 | # Prerequisites 8 | *.d 9 | 10 | # Object files 11 | *.o 12 | *.ko 13 | *.obj 14 | *.elf 15 | 16 | # Linker output 17 | *.ilk 18 | *.map 19 | *.exp 20 | *.list 21 | 22 | # Precompiled Headers 23 | *.gch 24 | *.pch 25 | 26 | # Libraries 27 | # *.lib 28 | # *.a 29 | # *.la 30 | # *.lo 31 | 32 | # Shared objects (inc. Windows DLLs) 33 | *.dll 34 | *.so 35 | *.so.* 36 | *.dylib 37 | 38 | # Executables 39 | # *.exe 40 | *.out 41 | *.app 42 | *.i*86 43 | *.x86_64 44 | # *.hex 45 | 46 | # Debug files 47 | *.dSYM/ 48 | *.su 49 | *.idb 50 | *.pdb 51 | 52 | # Kernel Module Compile Results 53 | *.mod* 54 | # *.cmd 55 | .tmp_versions/ 56 | modules.order 57 | Module.symvers 58 | Mkfile.old 59 | dkms.conf 60 | /Debug_FLASH/ 61 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | UDS_S32K144_FlashDriver 4 | 5 | 6 | 7 | 8 | 9 | com.freescale.processorexpert.core.expertprojectbuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 15 | clean,full,incremental, 16 | 17 | 18 | 19 | 20 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 21 | full,incremental, 22 | 23 | 24 | 25 | 26 | 27 | com.freescale.processorexpert.core.expertprojectnature 28 | org.eclipse.cdt.core.cnature 29 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 30 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 31 | 32 | 33 | -------------------------------------------------------------------------------- /Documentation/UDS_S32K144_FlashDriver.txt: -------------------------------------------------------------------------------- 1 | ============================================================================= 2 | List of generated methods in project: UDS_S32K144_FlashDriver 3 | 4 | This text description is generated by Processor Expert. Do not modify it. 5 | ============================================================================= 6 | 7 | Module "pin_mux" (component PinSettings) 8 | - pin_mux_PINS_DRV_Init -This function configures the pins with the options provided in the provided structure 9 | - pin_mux_PINS_DRV_SetPullSel -This function configures the internal resistor 10 | - pin_mux_PINS_DRV_SetMuxModeSel -This function configures the pin muxing 11 | - pin_mux_PINS_DRV_SetPinIntSel -This function configures the port pin interrupt/DMA request 12 | - pin_mux_PINS_DRV_GetPinIntSel -This function gets the current port pin interrupt/DMA request configuration 13 | - pin_mux_PINS_DRV_ClearPinIntFlagCmd -This function clears the individual pin-interrupt status flag 14 | - pin_mux_PINS_DRV_EnableDigitalFilter -This function enables digital filter feature for digital pin muxing 15 | - pin_mux_PINS_DRV_DisableDigitalFilter -This function disables digital filter feature for digital pin muxing 16 | - pin_mux_PINS_DRV_ConfigDigitalFilter -This function configures digital filter for port with given configuration 17 | - pin_mux_PINS_DRV_GetPortIntFlag -This function reads the entire port interrupt status flag 18 | - pin_mux_PINS_DRV_ClearPortIntFlagCmd -This function clears the entire port interrupt status flag 19 | - pin_mux_PINS_DRV_SetGlobalPinControl -This function quickly configures multiple pins within the one port for the same 20 | peripheral function with the same pin configuration 21 | - pin_mux_PINS_DRV_SetGlobalIntControl -This function quickly configures multiple pins within the one port for the same 22 | peripheral function with the same interrupt configuration 23 | - pin_mux_PINS_DRV_GetPinsDirection -This function returns the current pins directions for a port. Pins corresponding to 24 | bits with value of '1' are configured as output and pins corresponding to bits with value of '0' are configured 25 | as input. 26 | - pin_mux_PINS_DRV_SetPinDirection -This function configures the direction for the given pin, with the given value('1' for 27 | pin to be configured as output and '0' for pin to be configured as input) 28 | - pin_mux_PINS_DRV_SetPinsDirection -This function sets the direction configuration for all pins in a port. Pins 29 | corresponding to bits with value of '1' will be configured as output and pins corresponding to bits with value 30 | of '0' will be configured as input. 31 | - pin_mux_PINS_DRV_SetPortInputDisable -This function sets the pins input state for a port. Pins corresponding to bits with 32 | value of '1' will not be configured as input and pins corresponding to bits with value of '0' will be 33 | configured as input 34 | - pin_mux_PINS_DRV_GetPortInputDisable -This function returns the current pins input state for a port. Pins corresponding to 35 | bits with value of '1' are not configured as input and pins corresponding to bits with value of '0' are 36 | configured as input 37 | - pin_mux_PINS_DRV_WritePin -This function writes the given pin from a port, with the given value ('0' represents LOW, '1' 38 | represents HIGH) 39 | - pin_mux_PINS_DRV_WritePins -This function writes all pins configured as output with the values given in the parameter pins. 40 | '0' represents LOW, '1' represents HIGH 41 | - pin_mux_PINS_DRV_GetPinsOutput -This function returns the current output that is written to a port. Only pins that are 42 | configured as output will have meaningful values 43 | - pin_mux_PINS_DRV_SetPins -This function configures output pins listed in parameter pins (bits that are '1') to have a 44 | value of 'set' (HIGH). Pins corresponding to '0' will be unaffected 45 | - pin_mux_PINS_DRV_ClearPins -This function configures output pins listed in parameter pins (bits that are '1') to have a 46 | 'cleared' value (LOW). Pins corresponding to '0' will be unaffected 47 | - pin_mux_PINS_DRV_TogglePins -This function toggles output pins listed in parameter pins (bits that are '1'). Pins 48 | corresponding to '0' will be unaffected 49 | - pin_mux_PINS_DRV_ReadPins -This function returns the current input values from a port. Only pins configured as input will 50 | have meaningful values 51 | 52 | Module "clockMan1" (component clock_manager) 53 | - clockMan1_CLOCK_DRV_Init -Initialize clocking modules 54 | - clockMan1_CLOCK_DRV_GetFreq -Return frequency. 55 | - clockMan1_CLOCK_DRV_SetModuleClock -Configures the system clocks. 56 | - clockMan1_CLOCK_DRV_SetSystemClock -Configures the system clocks. 57 | - clockMan1_CLOCK_DRV_GetSystemClockSource -Gets the system clock source. 58 | - clockMan1_CLOCK_DRV_SetClockSource -This function configures a clock source. 59 | 60 | Module "intMan1" (component interrupt_manager) 61 | - intMan1_INT_SYS_InstallHandler -Installs an interrupt handler routine for a given IRQ number. 62 | - intMan1_INT_SYS_EnableIRQ -Enables an interrupt for a given IRQ number. 63 | - intMan1_INT_SYS_DisableIRQ -Disables an interrupt for a given IRQ number. 64 | - intMan1_INT_SYS_EnableIRQGlobal -Enables system interrupt. 65 | - intMan1_INT_SYS_DisableIRQGlobal -Disable system interrupt. 66 | - intMan1_INT_SYS_SetPriority -Set Interrupt Priority. 67 | - intMan1_INT_SYS_GetPriority -Get Interrupt Priority. 68 | - intMan1_INT_SYS_ClearPending -Clear Pending Interrupt. 69 | - intMan1_INT_SYS_SetPending -Set Pending Interrupt. 70 | - intMan1_INT_SYS_GetPending -Get Pending Interrupt. 71 | - intMan1_INT_SYS_GetActive -Get Active Interrupt. 72 | 73 | Module "Flash1" (component flash) 74 | - Flash1_FLASH_DRV_Init -Flash initialization. 75 | - Flash1_FLASH_DRV_GetPFlashProtection -P-Flash get protection. 76 | - Flash1_FLASH_DRV_SetPFlashProtection -P-Flash set protection. 77 | - Flash1_FLASH_DRV_GetSecurityState -Flash get security state. 78 | - Flash1_FLASH_DRV_SecurityBypass -Flash security bypass. 79 | - Flash1_FLASH_DRV_EraseAllBlock -Flash erase all Blocks. 80 | - Flash1_FLASH_DRV_VerifyAllBlock -Flash verify all Blocks. 81 | - Flash1_FLASH_DRV_EraseSector -Flash erase sector. 82 | - Flash1_FLASH_DRV_VerifySection -Flash verify sector. 83 | - Flash1_FLASH_DRV_EraseSuspend -Flash erase suspend. 84 | - Flash1_FLASH_DRV_EraseResume -Flash erase resume. 85 | - Flash1_FLASH_DRV_ReadOnce -Flash read once. 86 | - Flash1_FLASH_DRV_ProgramOnce -Flash program once. 87 | - Flash1_FLASH_DRV_Program -Flash program. 88 | - Flash1_FLASH_DRV_ProgramCheck -Flash program check. 89 | - Flash1_FLASH_DRV_CheckSum -Calculate check sum. 90 | - Flash1_FLASH_DRV_ProgramSection -Flash program section. 91 | - Flash1_FLASH_DRV_EraseBlock -Flash erase block. 92 | - Flash1_FLASH_DRV_VerifyBlock -Flash verify block. 93 | - Flash1_FLASH_DRV_GetEERAMProtection -EERAM get protection. 94 | - Flash1_FLASH_DRV_SetEERAMProtection -EERAM set protection. 95 | - Flash1_FLASH_DRV_SetFlexRamFunction -Flash Set FlexRam function command. 96 | - Flash1_FLASH_DRV_EEEWrite -EEPROM Emulator Write. 97 | - Flash1_FLASH_DRV_DEFlashPartition -Flash D/E-Flash Partition. 98 | - Flash1_FLASH_DRV_GetDFlashProtection -D-Flash get protection. 99 | - Flash1_FLASH_DRV_SetDFlashProtection -D-Flash set protection. 100 | - Flash1_FLASH_DRV_PFlashSwap -swap between the two half of total logical P-Flash memory blocks within the memory map 101 | - Flash1_FLASH_DRV_PFlashSwapCtl -implements swap control command corresponding with swap control code provided via swapcmd 102 | parameter 103 | - Flash1_FLASH_DRV_EraseAllBlockUnsecure -Flash erase all Blocks. 104 | - Flash1_FLASH_DRV_EnableCmdCompleteInterupt -Enable the command complete interrupt. 105 | - Flash1_FLASH_DRV_DisableCmdCompleteInterupt -Disable the command complete interrupt. 106 | - Flash1_FLASH_DRV_GetCmdCompleteFlag -Check the command complete flag has completed or not. 107 | - Flash1_FLASH_DRV_EnableReadColisionInterupt -Enable the read collision error interrupt. 108 | - Flash1_FLASH_DRV_DisableReadColisionInterupt -Disable the read collision error interrupt. 109 | - Flash1_FLASH_DRV_GetReadColisionFlag -Check the read collision error flag is detected or not. 110 | - Flash1_FLASH_DRV_ClearReadColisionFlag -Clear the read collision error flag. 111 | - Flash1_FLASH_DRV_EnableDoubleBitFaultInterupt -Enable the double bit fault detect interrupt. 112 | - Flash1_FLASH_DRV_DisableDoubleBitFaultInterupt -Disable the double bit fault detect interrupt. 113 | - Flash1_FLASH_DRV_GetDoubleBitFaultFlag -Check the double bit fault flag is detected or not. 114 | - Flash1_FLASH_DRV_ClearDoubleBitFaultFlag -Clear the double bit fault detect flag. 115 | - Flash1_FLASH_DRV_ForceDoubleBitFaultDetectCmd -Force Double Bit Fault Detect. 116 | - Flash1_FLASH_DRV_GetDefaultConfig -Get default flash user configuration. 117 | 118 | Module "Cpu" (component S32K144_100) 119 | - Cpu_SystemInit -This function disables the watchdog, enables FPU and the power mode protection. SystemInit is called from 120 | startup_device file. 121 | - Cpu_SystemCoreClockUpdate -SystemCoreClockUpdate evaluates the clock register settings and calculates the current core 122 | clock. It must be called whenever the core clock is changed during program execution 123 | - Cpu_SystemSoftwareReset -This method initiates initiate a system reset. 124 | 125 | =================================================================================== 126 | -------------------------------------------------------------------------------- /Documentation/UDS_S32K144_FlashDriver_Settings.previous.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /Documentation/UDS_S32K144_FlashDriver_Settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /Generated_Code/Cpu.c: -------------------------------------------------------------------------------- 1 | /** ################################################################### 2 | ** This component module is generated by Processor Expert. Do not modify it. 3 | ** Filename : Cpu.c 4 | ** Project : UDS_S32K144_FlashDriver 5 | ** Processor : S32K144_100 6 | ** Component : S32K144_100 7 | ** Version : Component 01.197, Driver 01.00, CPU db: 3.00.000 8 | ** Datasheet : S32K14XRM Rev. 2, 02/2017 9 | ** Compiler : GNU C Compiler 10 | ** Date/Time : 2021-01-25, 11:50, # CodeGen: 0 11 | ** Abstract : 12 | ** 13 | ** Settings : 14 | ** 15 | ** Contents : 16 | ** SystemInit - void SystemInit(void); 17 | ** SystemCoreClockUpdate - void SystemCoreClockUpdate(void); 18 | ** SystemSoftwareReset - void SystemSoftwareReset(void); 19 | ** 20 | ** (c) Freescale Semiconductor, Inc. 21 | ** 2004 All Rights Reserved 22 | ** 23 | ** Copyright 1997 - 2015 Freescale Semiconductor, Inc. 24 | ** Copyright 2016-2017 NXP 25 | ** All Rights Reserved. 26 | ** 27 | ** THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 28 | ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 29 | ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 30 | ** IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 31 | ** INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 32 | ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 33 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 | ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 35 | ** STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 36 | ** IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 37 | ** THE POSSIBILITY OF SUCH DAMAGE. 38 | ** ###################################################################*/ 39 | /*! 40 | ** @file Cpu.c 41 | ** @version 01.00 42 | ** @brief 43 | ** 44 | */ 45 | /*! 46 | ** @addtogroup Cpu_module Cpu module documentation 47 | ** @{ 48 | */ 49 | 50 | /* MODULE Cpu. */ 51 | 52 | /* {Default RTOS Adapter} No RTOS includes */ 53 | #include "Cpu.h" 54 | 55 | #ifdef __cplusplus 56 | extern "C" { 57 | #endif 58 | 59 | /* TBD Cpu configuration will be generated here. */ 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | /* END Cpu. */ 66 | 67 | /*! 68 | ** @} 69 | */ 70 | /* 71 | ** ################################################################### 72 | ** 73 | ** This file was created by Processor Expert 10.1 [05.21] 74 | ** for the Freescale S32K series of microcontrollers. 75 | ** 76 | ** ################################################################### 77 | */ 78 | -------------------------------------------------------------------------------- /Generated_Code/Cpu.h: -------------------------------------------------------------------------------- 1 | /* ################################################################### 2 | ** This component module is generated by Processor Expert. Do not modify it. 3 | ** Filename : Cpu.h 4 | ** Project : UDS_S32K144_FlashDriver 5 | ** Processor : S32K144_100 6 | ** Component : S32K144_100 7 | ** Version : Component 01.197, Driver 01.00, CPU db: 3.00.000 8 | ** Datasheet : S32K14XRM Rev. 2, 02/2017 9 | ** Compiler : GNU C Compiler 10 | ** Date/Time : 2021-01-25, 12:13, # CodeGen: 1 11 | ** Abstract : 12 | ** 13 | ** Settings : 14 | ** 15 | ** Contents : 16 | ** SystemInit - void SystemInit(void); 17 | ** SystemCoreClockUpdate - void SystemCoreClockUpdate(void); 18 | ** SystemSoftwareReset - void SystemSoftwareReset(void); 19 | ** 20 | ** (c) Freescale Semiconductor, Inc. 21 | ** 2004 All Rights Reserved 22 | ** 23 | ** Copyright 1997 - 2015 Freescale Semiconductor, Inc. 24 | ** Copyright 2016-2017 NXP 25 | ** All Rights Reserved. 26 | ** 27 | ** THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 28 | ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 29 | ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 30 | ** IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 31 | ** INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 32 | ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 33 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 | ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 35 | ** STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 36 | ** IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 37 | ** THE POSSIBILITY OF SUCH DAMAGE. 38 | ** ###################################################################*/ 39 | /*! 40 | ** @file Cpu.h 41 | ** @version 01.00 42 | ** @brief 43 | ** 44 | */ 45 | /*! 46 | ** @addtogroup Cpu_module Cpu module documentation 47 | ** @{ 48 | */ 49 | 50 | #ifndef Cpu_H 51 | #define Cpu_H 52 | 53 | 54 | /* MODULE Cpu. */ 55 | 56 | 57 | /*Include shared modules, which are used for whole project*/ 58 | #include "device_registers.h" 59 | 60 | #include "interrupt_manager.h" 61 | #include "clock.h" 62 | #include "flash_driver.h" 63 | #include "system_S32K144.h" 64 | 65 | /* Including needed modules to compile this module/procedure */ 66 | #include "pin_mux.h" 67 | #include "clockMan1.h" 68 | #include "Flash1.h" 69 | 70 | #ifdef __cplusplus 71 | extern "C" { 72 | #endif 73 | 74 | /* TBD Cpu configuration will be declared here. */ 75 | 76 | 77 | 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | 83 | /* END Cpu. */ 84 | 85 | #endif 86 | /* Cpu_H */ 87 | 88 | /*! 89 | ** @} 90 | */ 91 | /* 92 | ** ################################################################### 93 | ** 94 | ** This file was created by Processor Expert 10.1 [05.21] 95 | ** for the Freescale S32K series of microcontrollers. 96 | ** 97 | ** ################################################################### 98 | */ 99 | -------------------------------------------------------------------------------- /Generated_Code/Flash1.c: -------------------------------------------------------------------------------- 1 | /* ################################################################### 2 | ** This component module is generated by Processor Expert. Do not modify it. 3 | ** Filename : Flash1.c 4 | ** Project : UDS_S32K144_FlashDriver 5 | ** Processor : S32K144_100 6 | ** Component : flash 7 | ** Version : Component 1.0.0, Driver 01.00, CPU db: 3.00.000 8 | ** Repository : SDK_S32K1xx_15 9 | ** Compiler : GNU C Compiler 10 | ** Date/Time : 2021-01-25, 12:13, # CodeGen: 1 11 | ** 12 | ** Copyright 1997 - 2015 Freescale Semiconductor, Inc. 13 | ** Copyright 2016-2017 NXP 14 | ** All Rights Reserved. 15 | ** 16 | ** THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 17 | ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | ** IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 20 | ** INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 | ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24 | ** STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 25 | ** IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 | ** THE POSSIBILITY OF SUCH DAMAGE. 27 | ** ###################################################################*/ 28 | /*! 29 | ** @file Flash1.c 30 | ** @version 01.00 31 | */ 32 | /*! 33 | ** @addtogroup Flash1_module Flash1 module documentation 34 | ** @{ 35 | */ 36 | /* Module Flash1. 37 | * 38 | * @page misra_violations MISRA-C:2012 violations 39 | * 40 | * @section [global] 41 | * Violates MISRA 2012 Advisory Rule 8.7, External variable could be made static. 42 | * The external variable will be used in other source files in application code. 43 | * 44 | * @section [global] 45 | * Violates MISRA 2012 Required Rule 11.1, Conversion between a pointer 46 | * to function and another type. 47 | * The cast is required to define a callback function. 48 | * 49 | * @section [global] 50 | * Violates MISRA 2012 Required Rule 11.6, A cast shall not be performed 51 | * between pointer to void and an arithmetic type. 52 | * The cast is required to initialize a pointer with an unsigned int define, 53 | * representing an address. 54 | */ 55 | 56 | #include "Flash1.h" 57 | /*! @brief Configuration structure flashCfg_0 */ 58 | const flash_user_config_t Flash1_InitConfig0 = { 59 | .PFlashBase = 0x00000000U, /* Base address of Program Flash block */ 60 | .PFlashSize = 0x00080000U, /* Size of Program Flash block */ 61 | .DFlashBase = 0x10000000U, /* Base address of Data Flash block */ 62 | .EERAMBase = 0x14000000U, /* Base address of FlexRAM block */ 63 | /* If using callback, any code reachable from this function must not be placed in a Flash block targeted for a program/erase operation.*/ 64 | .CallBack = NULL_CALLBACK 65 | }; 66 | 67 | /* END Flash1. */ 68 | /*! 69 | ** @} 70 | */ 71 | /* 72 | ** ################################################################### 73 | ** 74 | ** This file was created by Processor Expert 10.1 [05.21] 75 | ** for the Freescale S32K series of microcontrollers. 76 | ** 77 | ** ################################################################### 78 | */ 79 | -------------------------------------------------------------------------------- /Generated_Code/Flash1.h: -------------------------------------------------------------------------------- 1 | /* ################################################################### 2 | ** This component module is generated by Processor Expert. Do not modify it. 3 | ** Filename : Flash1.h 4 | ** Project : UDS_S32K144_FlashDriver 5 | ** Processor : S32K144_100 6 | ** Component : flash 7 | ** Version : Component 1.0.0, Driver 01.00, CPU db: 3.00.000 8 | ** Repository : SDK_S32K1xx_15 9 | ** Compiler : GNU C Compiler 10 | ** Date/Time : 2021-01-25, 12:13, # CodeGen: 1 11 | ** Contents : 12 | ** FLASH_DRV_Init - status_t FLASH_DRV_Init(const flash_user_config_t * const pUserConf,... 13 | ** FLASH_DRV_GetPFlashProtection - void FLASH_DRV_GetPFlashProtection(uint32_t * protectStatus); 14 | ** FLASH_DRV_SetPFlashProtection - status_t FLASH_DRV_SetPFlashProtection(uint32_t protectStatus); 15 | ** FLASH_DRV_GetSecurityState - void FLASH_DRV_GetSecurityState(uint8_t * securityState); 16 | ** FLASH_DRV_SecurityBypass - status_t FLASH_DRV_SecurityBypass(const flash_ssd_config_t * pSSDConfig,const... 17 | ** FLASH_DRV_EraseAllBlock - status_t FLASH_DRV_EraseAllBlock(const flash_ssd_config_t * pSSDConfig); 18 | ** FLASH_DRV_VerifyAllBlock - status_t FLASH_DRV_VerifyAllBlock(const flash_ssd_config_t *... 19 | ** FLASH_DRV_EraseSector - status_t FLASH_DRV_EraseSector(const flash_ssd_config_t * pSSDConfig,uint32_t... 20 | ** FLASH_DRV_VerifySection - status_t FLASH_DRV_VerifySection(cont flash_ssd_config_t *... 21 | ** FLASH_DRV_EraseSuspend - void FLASH_DRV_EraseSuspend(void); 22 | ** FLASH_DRV_EraseResume - void FLASH_DRV_EraseResume(void); 23 | ** FLASH_DRV_ReadOnce - status_t FLASH_DRV_ReadOnce(const flash_ssd_config_t * pSSDConfig,uint8_t... 24 | ** FLASH_DRV_ProgramOnce - status_t FLASH_DRV_ProgramOnce(const flash_ssd_config_t * pSSDConfig,uint8_t... 25 | ** FLASH_DRV_Program - status_t FLASH_DRV_Program(const flash_ssd_config_t * pSSDConfig,uint32_t... 26 | ** FLASH_DRV_ProgramCheck - status_t FLASH_DRV_ProgramCheck(const flash_ssd_config_t *... 27 | ** FLASH_DRV_CheckSum - status_t FLASH_DRV_CheckSum(const flash_ssd_config_t * pSSDConfig,uint32_t... 28 | ** FLASH_DRV_ProgramSection - status_t FLASH_DRV_ProgramSection(const flash_ssd_config_t *... 29 | ** FLASH_DRV_EraseBlock - status_t FLASH_DRV_EraseBlock(const flash_ssd_config_t * pSSDConfig,uint32_t... 30 | ** FLASH_DRV_VerifyBlock - status_t FLASH_DRV_VerifyBlock(const flash_ssd_config_t * pSSDConfig,uint32_t... 31 | ** FLASH_DRV_GetEERAMProtection - status_t FLASH_DRV_GetEERAMProtection(uint8_t * protectStatus); 32 | ** FLASH_DRV_SetEERAMProtection - status_t FLASH_DRV_SetEERAMProtection(uint8_t protectStatus); 33 | ** FLASH_DRV_SetFlexRamFunction - status_t FLASH_DRV_SetFlexRamFunction(const flash_ssd_config_t * pSSDConfig,... 34 | ** FLASH_DRV_EEEWrite - status_t FLASH_DRV_EEEWrite(const flash_ssd_config_t * pSSDConfig,uint32_t... 35 | ** FLASH_DRV_DEFlashPartition - status_t FLASH_DRV_DEFlashPartition(const flash_ssd_config_t * pSSDConfig,... 36 | ** FLASH_DRV_GetDFlashProtection - status_t FLASH_DRV_GetDFlashProtection(const flash_ssd_config_t *... 37 | ** FLASH_DRV_SetDFlashProtection - status_t FLASH_DRV_SetDFlashProtection(const flash_ssd_config_t *... 38 | ** FLASH_DRV_PFlashSwap - status_t FLASH_DRV_PFlashSwap(const flash_ssd_config_t * pSSDConfig,uint32_t... 39 | ** FLASH_DRV_PFlashSwapCtl - status_t FLASH_DRV_PFlashSwapCtl(const flash_ssd_config_t *... 40 | ** FLASH_DRV_EraseAllBlockUnsecure - status_t FLASH_DRV_EraseAllBlockUnsecure(const flash_ssd_config_t * pSSDConfig); 41 | ** FLASH_DRV_EnableCmdCompleteInterupt - status_t FLASH_DRV_EnableCmdCompleteInterupt(void); 42 | ** FLASH_DRV_DisableCmdCompleteInterupt - void FLASH_DRV_DisableCmdCompleteInterupt(void); 43 | ** FLASH_DRV_GetCmdCompleteFlag - static inline bool FLASH_DRV_GetCmdCompleteFlag(void); 44 | ** FLASH_DRV_EnableReadColisionInterupt - status_t FLASH_DRV_EnableReadColisionInterupt(void); 45 | ** FLASH_DRV_DisableReadColisionInterupt - void FLASH_DRV_DisableReadColisionInterupt(void); 46 | ** FLASH_DRV_GetReadColisionFlag - static inline bool FLASH_DRV_GetReadColisionFlag(void); 47 | ** FLASH_DRV_ClearReadColisionFlag - static inline void FLASH_DRV_ClearReadColisionFlag(void); 48 | ** FLASH_DRV_EnableDoubleBitFaultInterupt - status_t FLASH_DRV_EnableDoubleBitFaultInterupt(void); 49 | ** FLASH_DRV_DisableDoubleBitFaultInterupt - void FLASH_DRV_DisableDoubleBitFaultInterupt(void); 50 | ** FLASH_DRV_GetDoubleBitFaultFlag - static inline bool FLASH_DRV_GetDoubleBitFaultFlag(void); 51 | ** FLASH_DRV_ClearDoubleBitFaultFlag - static inline void FLASH_DRV_ClearDoubleBitFaultFlag(void); 52 | ** FLASH_DRV_ForceDoubleBitFaultDetectCmd - static inline void FLASH_DRV_ForceDoubleBitFaultDetectCmd(bool isEnable); 53 | ** FLASH_DRV_GetDefaultConfig - void FLASH_DRV_GetDefaultConfig(flash_user_config_t * const config); 54 | ** 55 | ** Copyright 1997 - 2015 Freescale Semiconductor, Inc. 56 | ** Copyright 2016-2017 NXP 57 | ** All Rights Reserved. 58 | ** 59 | ** THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 60 | ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 61 | ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 62 | ** IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 63 | ** INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 64 | ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 65 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 66 | ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 67 | ** STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 68 | ** IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 69 | ** THE POSSIBILITY OF SUCH DAMAGE. 70 | ** ###################################################################*/ 71 | /*! 72 | ** @file Flash1.h 73 | ** @version 01.00 74 | */ 75 | /*! 76 | ** @addtogroup Flash1_module Flash1 module documentation 77 | ** @{ 78 | */ 79 | #ifndef Flash1_H 80 | #define Flash1_H 81 | 82 | /* MODULE Flash1. 83 | * 84 | * @page misra_violations MISRA-C:2012 violations 85 | * 86 | * @section [global] 87 | * Violates MISRA 2012 Advisory Rule 2.5, Global macro not referenced. 88 | * The global macro will be used in function call of the module. 89 | */ 90 | 91 | /* Include inherited beans */ 92 | #include "clockMan1.h" 93 | #include "flash_driver.h" 94 | 95 | /*! @brief User configuration structure 0 */ 96 | extern const flash_user_config_t Flash1_InitConfig0; 97 | 98 | 99 | #endif 100 | /* ifndef Flash1_H */ 101 | /*! 102 | ** @} 103 | */ 104 | /* 105 | ** ################################################################### 106 | ** 107 | ** This file was created by Processor Expert 10.1 [05.21] 108 | ** for the Freescale S32K series of microcontrollers. 109 | ** 110 | ** ################################################################### 111 | */ 112 | -------------------------------------------------------------------------------- /Generated_Code/clockMan1.c: -------------------------------------------------------------------------------- 1 | /* ################################################################### 2 | ** This component module is generated by Processor Expert. Do not modify it. 3 | ** Filename : clockMan1.c 4 | ** Project : UDS_S32K144_FlashDriver 5 | ** Processor : S32K144_100 6 | ** Component : clock_manager 7 | ** Version : Component SDK_S32K1xx_15, Driver 01.00, CPU db: 3.00.000 8 | ** Repository : SDK_S32K1xx_15 9 | ** Compiler : GNU C Compiler 10 | ** Date/Time : 2021-01-25, 12:13, # CodeGen: 1 11 | ** 12 | ** Copyright 1997 - 2015 Freescale Semiconductor, Inc. 13 | ** Copyright 2016-2017 NXP 14 | ** All Rights Reserved. 15 | ** 16 | ** THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 17 | ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | ** IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 20 | ** INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 | ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24 | ** STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 25 | ** IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 | ** THE POSSIBILITY OF SUCH DAMAGE. 27 | ** ###################################################################*/ 28 | /*! 29 | ** @file clockMan1.c 30 | ** @version 01.00 31 | */ 32 | /*! 33 | ** @addtogroup clockMan1_module clockMan1 module documentation 34 | ** @{ 35 | */ 36 | 37 | /* clockMan1. */ 38 | 39 | #include "clockMan1.h" 40 | 41 | /** 42 | * @page misra_violations MISRA-C:2012 violations 43 | * 44 | * @section [global] 45 | * Violates MISRA 2012 Required Rule 9.4, Duplicate initialization of object element. 46 | * It's the only way to initialize an array that is member of struct. 47 | * 48 | * @section [global] 49 | * Violates MISRA 2012 Advisory Rule 8.7, External variable could be made static. 50 | * The external variables will be used in other source files in application code. 51 | */ 52 | 53 | /* ************************************************************************* 54 | * Configuration structure for peripheral clock configuration 0 55 | * ************************************************************************* */ 56 | /*! @brief peripheral clock configuration 0 */ 57 | peripheral_clock_config_t peripheralClockConfig0[NUM_OF_PERIPHERAL_CLOCKS_0] = { 58 | { 59 | .clockName = PORTA_CLK, 60 | .clkGate = true, 61 | .clkSrc = CLK_SRC_OFF, 62 | .frac = MULTIPLY_BY_ONE, 63 | .divider = DIVIDE_BY_ONE, 64 | }, 65 | { 66 | .clockName = PORTB_CLK, 67 | .clkGate = true, 68 | .clkSrc = CLK_SRC_OFF, 69 | .frac = MULTIPLY_BY_ONE, 70 | .divider = DIVIDE_BY_ONE, 71 | }, 72 | { 73 | .clockName = PORTC_CLK, 74 | .clkGate = true, 75 | .clkSrc = CLK_SRC_OFF, 76 | .frac = MULTIPLY_BY_ONE, 77 | .divider = DIVIDE_BY_ONE, 78 | }, 79 | { 80 | .clockName = PORTD_CLK, 81 | .clkGate = true, 82 | .clkSrc = CLK_SRC_OFF, 83 | .frac = MULTIPLY_BY_ONE, 84 | .divider = DIVIDE_BY_ONE, 85 | }, 86 | { 87 | .clockName = PORTE_CLK, 88 | .clkGate = true, 89 | .clkSrc = CLK_SRC_OFF, 90 | .frac = MULTIPLY_BY_ONE, 91 | .divider = DIVIDE_BY_ONE, 92 | }, 93 | }; 94 | 95 | /* ************************************************************************* 96 | * Configuration structure for Clock Configuration 0 97 | * ************************************************************************* */ 98 | /*! @brief User Configuration structure clockMan1_InitConfig0 */ 99 | clock_manager_user_config_t clockMan1_InitConfig0 = { 100 | /*! @brief Configuration of SIRC */ 101 | .scgConfig = 102 | { 103 | .sircConfig = 104 | { 105 | .initialize = true, /*!< Initialize */ 106 | /* SIRCCSR */ 107 | .enableInStop = false, /*!< SIRCSTEN */ 108 | .enableInLowPower = true, /*!< SIRCLPEN */ 109 | .locked = false, /*!< LK */ 110 | /* SIRCCFG */ 111 | .range = SCG_SIRC_RANGE_HIGH, /*!< RANGE - High range (8 MHz) */ 112 | /* SIRCDIV */ 113 | .div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /*!< SIRCDIV1 */ 114 | .div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /*!< SIRCDIV2 */ 115 | }, 116 | .fircConfig = 117 | { 118 | .initialize = true, /*!< Initialize */ 119 | /* FIRCCSR */ 120 | .regulator = true, /*!< FIRCREGOFF */ 121 | .locked = false, /*!< LK */ 122 | /* FIRCCFG */ 123 | .range = SCG_FIRC_RANGE_48M, /*!< RANGE */ 124 | /* FIRCDIV */ 125 | .div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /*!< FIRCDIV1 */ 126 | .div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /*!< FIRCDIV2 */ 127 | }, 128 | .rtcConfig = 129 | { 130 | .initialize = true, /*!< Initialize */ 131 | .rtcClkInFreq = 0U, /*!< RTC_CLKIN */ 132 | }, 133 | .soscConfig = 134 | { 135 | .initialize = true, /*!< Initialize */ 136 | .freq = 8000000U, /*!< Frequency */ 137 | /* SOSCCSR */ 138 | .monitorMode = SCG_SOSC_MONITOR_DISABLE, /*!< SOSCCM */ 139 | .locked = false, /*!< LK */ 140 | /* SOSCCFG */ 141 | .extRef = SCG_SOSC_REF_OSC, /*!< EREFS */ 142 | .gain = SCG_SOSC_GAIN_LOW, /*!< HGO */ 143 | .range = SCG_SOSC_RANGE_HIGH, /*!< RANGE */ 144 | /* SOSCDIV */ 145 | .div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /*!< SOSCDIV1 */ 146 | .div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /*!< SOSCDIV2 */ 147 | }, 148 | .spllConfig = 149 | { 150 | .initialize = true, /*!< Initialize */ 151 | /* SPLLCSR */ 152 | .monitorMode = SCG_SPLL_MONITOR_DISABLE, /*!< SPLLCM */ 153 | .locked = false, /*!< LK */ 154 | /* SPLLCFG */ 155 | .prediv = (uint8_t)SCG_SPLL_CLOCK_PREDIV_BY_1, /*!< PREDIV */ 156 | .mult = (uint8_t)SCG_SPLL_CLOCK_MULTIPLY_BY_28, /*!< MULT */ 157 | .src = 0U, /*!< SOURCE */ 158 | /* SPLLDIV */ 159 | .div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /*!< SPLLDIV1 */ 160 | .div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /*!< SPLLDIV2 */ 161 | }, 162 | .clockOutConfig = 163 | { 164 | .initialize = true, /*!< Initialize */ 165 | .source = SCG_CLOCKOUT_SRC_FIRC, /*!< SCG CLKOUTSEL */ 166 | }, 167 | .clockModeConfig = 168 | { 169 | .initialize = true, /*!< Initialize */ 170 | .rccrConfig = /*!< RCCR - Run Clock Control Register */ 171 | { 172 | .src = SCG_SYSTEM_CLOCK_SRC_FIRC, /*!< SCS */ 173 | .divCore = SCG_SYSTEM_CLOCK_DIV_BY_1, /*!< DIVCORE */ 174 | .divBus = SCG_SYSTEM_CLOCK_DIV_BY_2, /*!< DIVBUS */ 175 | .divSlow = SCG_SYSTEM_CLOCK_DIV_BY_2, /*!< DIVSLOW */ 176 | }, 177 | .vccrConfig = /*!< VCCR - VLPR Clock Control Register */ 178 | { 179 | .src = SCG_SYSTEM_CLOCK_SRC_SIRC, /*!< SCS */ 180 | .divCore = SCG_SYSTEM_CLOCK_DIV_BY_2, /*!< DIVCORE */ 181 | .divBus = SCG_SYSTEM_CLOCK_DIV_BY_1, /*!< DIVBUS */ 182 | .divSlow = SCG_SYSTEM_CLOCK_DIV_BY_4, /*!< DIVSLOW */ 183 | }, 184 | .hccrConfig = /*!< HCCR - HSRUN Clock Control Register */ 185 | { 186 | .src = SCG_SYSTEM_CLOCK_SRC_SYS_PLL, /*!< SCS */ 187 | .divCore = SCG_SYSTEM_CLOCK_DIV_BY_1, /*!< DIVCORE */ 188 | .divBus = SCG_SYSTEM_CLOCK_DIV_BY_2, /*!< DIVBUS */ 189 | .divSlow = SCG_SYSTEM_CLOCK_DIV_BY_4, /*!< DIVSLOW */ 190 | }, 191 | }, 192 | }, 193 | .pccConfig = 194 | { 195 | .peripheralClocks = peripheralClockConfig0, /*!< Peripheral clock control configurations */ 196 | .count = NUM_OF_PERIPHERAL_CLOCKS_0, /*!< Number of the peripheral clock control configurations */ 197 | }, 198 | .simConfig = 199 | { 200 | .clockOutConfig = /*!< Clock Out configuration. */ 201 | { 202 | .initialize = true, /*!< Initialize */ 203 | .enable = false, /*!< CLKOUTEN */ 204 | .source = SIM_CLKOUT_SEL_SYSTEM_SCG_CLKOUT, /*!< CLKOUTSEL */ 205 | .divider = SIM_CLKOUT_DIV_BY_1, /*!< CLKOUTDIV */ 206 | }, 207 | .lpoClockConfig = /*!< Low Power Clock configuration. */ 208 | { 209 | .initialize = true, /*!< Initialize */ 210 | .enableLpo1k = true, /*!< LPO1KCLKEN */ 211 | .enableLpo32k = true, /*!< LPO32KCLKEN */ 212 | .sourceLpoClk = SIM_LPO_CLK_SEL_LPO_128K, /*!< LPOCLKSEL */ 213 | .sourceRtcClk = SIM_RTCCLK_SEL_SOSCDIV1_CLK, /*!< RTCCLKSEL */ 214 | }, 215 | .platGateConfig = /*!< Platform Gate Clock configuration. */ 216 | { 217 | .initialize = true, /*!< Initialize */ 218 | .enableMscm = true, /*!< CGCMSCM */ 219 | .enableMpu = true, /*!< CGCMPU */ 220 | .enableDma = true, /*!< CGCDMA */ 221 | .enableErm = true, /*!< CGCERM */ 222 | .enableEim = true, /*!< CGCEIM */ 223 | }, 224 | 225 | .qspiRefClkGating = /*!< Quad Spi Internal Reference Clock Gating. */ 226 | { 227 | .enableQspiRefClk = false, /*!< Qspi reference clock gating */ 228 | }, 229 | .tclkConfig = /*!< TCLK CLOCK configuration. */ 230 | { 231 | .initialize = true, /*!< Initialize */ 232 | .tclkFreq[0] = 0U, /*!< TCLK0 */ 233 | .tclkFreq[1] = 0U, /*!< TCLK1 */ 234 | .tclkFreq[2] = 0U, /*!< TCLK2 */ 235 | }, 236 | .traceClockConfig = /*!< Debug trace Clock Configuration. */ 237 | { 238 | .initialize = true, /*!< Initialize */ 239 | .divEnable = true, /*!< TRACEDIVEN */ 240 | .source = CLOCK_TRACE_SRC_CORE_CLK, /*!< TRACECLK_SEL */ 241 | .divider = 0U, /*!< TRACEDIV */ 242 | .divFraction = false, /*!< TRACEFRAC */ 243 | }, 244 | }, 245 | .pmcConfig = 246 | { 247 | .lpoClockConfig = /*!< Low Power Clock configuration. */ 248 | { 249 | .initialize = true, /*!< Initialize */ 250 | .enable = true, /*!< Enable/disable LPO */ 251 | .trimValue = 0, /*!< Trimming value for LPO */ 252 | }, 253 | }, 254 | }; 255 | 256 | /*! @brief Array of pointers to User configuration structures */ 257 | clock_manager_user_config_t const * g_clockManConfigsArr[] = { 258 | &clockMan1_InitConfig0 259 | }; 260 | /*! @brief Array of pointers to User defined Callbacks configuration structures */ 261 | clock_manager_callback_user_config_t * g_clockManCallbacksArr[] = {(void*)0}; 262 | /* END clockMan1. */ 263 | 264 | /*! 265 | ** @} 266 | */ 267 | /* 268 | ** ################################################################### 269 | ** 270 | ** This file was created by Processor Expert 10.1 [05.21] 271 | ** for the Freescale S32K series of microcontrollers. 272 | ** 273 | ** ################################################################### 274 | */ 275 | -------------------------------------------------------------------------------- /Generated_Code/clockMan1.h: -------------------------------------------------------------------------------- 1 | /* ################################################################### 2 | ** This component module is generated by Processor Expert. Do not modify it. 3 | ** Filename : clockMan1.h 4 | ** Project : UDS_S32K144_FlashDriver 5 | ** Processor : S32K144_100 6 | ** Component : clock_manager 7 | ** Version : Component SDK_S32K1xx_15, Driver 01.00, CPU db: 3.00.000 8 | ** Repository : SDK_S32K1xx_15 9 | ** Compiler : GNU C Compiler 10 | ** Date/Time : 2021-01-25, 11:50, # CodeGen: 0 11 | ** Contents : 12 | ** CLOCK_DRV_Init - status_t CLOCK_DRV_Init(clock_manager_user_config_t const * config); 13 | ** CLOCK_DRV_GetFreq - status_t CLOCK_DRV_GetFreq(clock_names_t clockName, uint32_t * frequency); 14 | ** CLOCK_DRV_SetModuleClock - void CLOCK_DRV_SetModuleClock(clock_names_t peripheralClock, const... 15 | ** CLOCK_DRV_SetSystemClock - status_t CLOCK_DRV_SetSystemClock(const pwr_modes_t * mode, const... 16 | ** CLOCK_DRV_GetSystemClockSource - void CLOCK_DRV_GetSystemClockSource(sys_clk_config_t *sysClkConfig); 17 | ** CLOCK_DRV_SetClockSource - status_t CLOCK_DRV_SetClockSource(clock_names_t clockSource, const... 18 | ** 19 | ** Copyright 1997 - 2015 Freescale Semiconductor, Inc. 20 | ** Copyright 2016-2017 NXP 21 | ** All Rights Reserved. 22 | ** 23 | ** THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 24 | ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 | ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | ** IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | ** INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 29 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 | ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 31 | ** STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 32 | ** IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 33 | ** THE POSSIBILITY OF SUCH DAMAGE. 34 | ** ###################################################################*/ 35 | /*! 36 | ** @file clockMan1.h 37 | ** @version 01.00 38 | */ 39 | /*! 40 | ** @addtogroup clockMan1_module clockMan1 module documentation 41 | ** @{ 42 | */ 43 | #ifndef clockMan1_H 44 | #define clockMan1_H 45 | /* MODULE clockMan1. */ 46 | 47 | #include 48 | #include 49 | 50 | /* Include inherited beans */ 51 | #include "Cpu.h" 52 | 53 | /** 54 | * @page misra_violations MISRA-C:2012 violations 55 | * 56 | * @section [global] 57 | * Violates MISRA 2012 Advisory Rule 2.5, Global macro not referenced. 58 | * Application or driver example may not use all symbols that are 59 | * generated by configurations generator. 60 | * 61 | * @section [global] 62 | * Violates MISRA 2012 Advisory Rule 8.11, When an array with external linkage 63 | * is declared, its size should be explicitly specified. 64 | * The number of configurations/callbacks can be zero. 65 | * On the other side C language forbids declaring array of size zero. 66 | * 67 | * @section [global] 68 | * Violates MISRA 2012 Advisory Rule 8.7, External variable could be made static. 69 | * The external variables will be used in other source files in application code. 70 | * 71 | */ 72 | 73 | /*! @brief User configuration structure 0 */ 74 | extern clock_manager_user_config_t clockMan1_InitConfig0; 75 | 76 | /*! @brief Count of user configuration structures */ 77 | #define CLOCK_MANAGER_CONFIG_CNT 1U 78 | 79 | /*! @brief Array of pointers to User configuration structures */ 80 | extern clock_manager_user_config_t const *g_clockManConfigsArr[]; 81 | 82 | /*! @brief User peripheral configuration structure 0 */ 83 | extern peripheral_clock_config_t peripheralClockConfig0[]; 84 | 85 | /*! @brief Count of peripheral clock user configurations */ 86 | #define NUM_OF_PERIPHERAL_CLOCKS_0 5U 87 | 88 | 89 | /*! @brief Count of user Callbacks */ 90 | #define CLOCK_MANAGER_CALLBACK_CNT 0U 91 | 92 | /*! @brief Array of User callbacks */ 93 | extern clock_manager_callback_user_config_t *g_clockManCallbacksArr[]; 94 | #endif 95 | /* ifndef clockMan1_H */ 96 | /*! 97 | ** @} 98 | */ 99 | /* 100 | ** ################################################################### 101 | ** 102 | ** This file was created by Processor Expert 10.1 [05.21] 103 | ** for the Freescale S32K series of microcontrollers. 104 | ** 105 | ** ################################################################### 106 | */ 107 | 108 | -------------------------------------------------------------------------------- /Generated_Code/pin_mux.c: -------------------------------------------------------------------------------- 1 | /* ################################################################### 2 | ** This component module is generated by Processor Expert. Do not modify it. 3 | ** Filename : pin_mux.c 4 | ** Project : UDS_S32K144_FlashDriver 5 | ** Processor : S32K144_100 6 | ** Component : PinSettings 7 | ** Version : Component 1.2.0, Driver 1.4, CPU db: 3.00.000 8 | ** Repository : SDK_S32K1xx_15 9 | ** Compiler : GNU C Compiler 10 | ** Date/Time : 2021-01-25, 11:50, # CodeGen: 0 11 | ** Abstract : 12 | ** 13 | ** 14 | ** Copyright 1997 - 2015 Freescale Semiconductor, Inc. 15 | ** Copyright 2016-2017 NXP 16 | ** All Rights Reserved. 17 | ** 18 | ** THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 19 | ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | ** IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 22 | ** INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | ** STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 27 | ** IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 | ** THE POSSIBILITY OF SUCH DAMAGE. 29 | ** ###################################################################*/ 30 | /*! 31 | ** @file pin_mux.c 32 | ** @version 1.4 33 | ** @brief 34 | ** 35 | */ 36 | /*! 37 | ** @addtogroup pin_mux_module pin_mux module documentation 38 | ** @{ 39 | */ 40 | 41 | /* MODULE pin_mux. */ 42 | #include "device_registers.h" 43 | #include "pin_mux.h" 44 | 45 | /** 46 | * @page misra_violations MISRA-C:2012 violations 47 | * 48 | * 49 | * @section [global] 50 | * Violates MISRA 2012 Advisory Rule 11.4, A conversion should not be performed 51 | * between a pointer to object and an integer type. 52 | * The cast is required to initialize a pointer with an unsigned int define, 53 | * representing an address. 54 | * 55 | * @section [global] 56 | * Violates MISRA 2012 Required Rule 11.6, A cast shall not be performed 57 | * between pointer to void and an arithmetic type. 58 | * The cast is required to initialize a pointer with an unsigned int define, 59 | * representing an address. 60 | * 61 | * @section [global] 62 | * Violates MISRA 2012 Advisory Rule 8.7, External variable could be made static. 63 | * The external variables will be used in other source files in application code. 64 | * 65 | * @section [global] 66 | * Violates MISRA 2012 Required Rule 9.3, partial array initialization. 67 | * The object array is initialized sequentially. 68 | * 69 | * @section [global] 70 | * Violates MISRA 2012 Required Rule 9.4, Duplicate initialization of object element. 71 | * The object array is initialized sequentially. 72 | * 73 | */ 74 | 75 | /*! @brief No pin was configured different with reset value */ 76 | 77 | /* END pin_mux. */ 78 | /*! 79 | ** @} 80 | */ 81 | /* 82 | ** ################################################################### 83 | ** 84 | ** This file was created by Processor Expert 10.1 [05.21] 85 | ** for the Freescale S32K series of microcontrollers. 86 | ** 87 | ** ################################################################### 88 | */ 89 | -------------------------------------------------------------------------------- /Note_00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerFalls/UDS_S32K144_FlashDriver/cd5289c1df01f55d19ab565eebd82d6800d8b9bd/Note_00.png -------------------------------------------------------------------------------- /Note_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerFalls/UDS_S32K144_FlashDriver/cd5289c1df01f55d19ab565eebd82d6800d8b9bd/Note_01.png -------------------------------------------------------------------------------- /Note_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerFalls/UDS_S32K144_FlashDriver/cd5289c1df01f55d19ab565eebd82d6800d8b9bd/Note_02.png -------------------------------------------------------------------------------- /Pic_ZCANPRO_ECU_Refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerFalls/UDS_S32K144_FlashDriver/cd5289c1df01f55d19ab565eebd82d6800d8b9bd/Pic_ZCANPRO_ECU_Refresh.png -------------------------------------------------------------------------------- /Project_Settings/Linker_Files/S32K144_64_flash.ld: -------------------------------------------------------------------------------- 1 | /* 2 | ** ################################################################### 3 | ** Processor: S32K144 with 64 KB SRAM 4 | ** Compiler: GNU C Compiler 5 | ** 6 | ** Abstract: 7 | ** Linker file for the GNU C Compiler 8 | ** 9 | ** Copyright (c) 2015-2016 Freescale Semiconductor, Inc. 10 | ** Copyright 2017-2018 NXP 11 | ** All rights reserved. 12 | ** 13 | ** THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 14 | ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15 | ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 | ** IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 17 | ** INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 | ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 | ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 21 | ** STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 22 | ** IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | ** THE POSSIBILITY OF SUCH DAMAGE. 24 | ** 25 | ** http: www.freescale.com 26 | ** mail: support@freescale.com 27 | ** 28 | ** ################################################################### 29 | */ 30 | 31 | /* Entry Point */ 32 | ENTRY(Reset_Handler) 33 | 34 | HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x00000400; 35 | STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x00000400; 36 | 37 | /* If symbol __flash_vector_table__=1 is defined at link time 38 | * the interrupt vector will not be copied to RAM. 39 | * Warning: Using the interrupt vector from Flash will not allow 40 | * INT_SYS_InstallHandler because the section is Read Only. 41 | */ 42 | M_VECTOR_RAM_SIZE = DEFINED(__flash_vector_table__) ? 0x0 : 0x0400; 43 | 44 | /* Specify the memory areas */ 45 | MEMORY 46 | { 47 | /* Flash */ 48 | m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400 49 | m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010 50 | m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0000FBF0 /* 0x0007FBF0 */ 51 | 52 | m_NVM_Driver (RX) : ORIGIN = 0x00010000, LENGTH = 0x00070000 53 | 54 | /* SRAM_L */ 55 | m_data (RW) : ORIGIN = 0x1FFF8000, LENGTH = 0x00008000 56 | 57 | /* SRAM_U */ 58 | m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00007000 59 | } 60 | 61 | /* Define output sections */ 62 | SECTIONS 63 | { 64 | .NVM_Driver : 65 | { 66 | . = ALIGN(4); 67 | __flashDriverSectionStart = .; 68 | __flashDriverSection_start__ = .; 69 | KEEP(*(.NVM_Driver_Section)) /* Flash driver code */ 70 | __flashDriverSection_end__ = .; 71 | . = ALIGN(4); 72 | } > m_NVM_Driver 73 | 74 | /* The startup code goes first into internal flash */ 75 | .interrupts : 76 | { 77 | __VECTOR_TABLE = .; 78 | __interrupts_start__ = .; 79 | . = ALIGN(4); 80 | KEEP(*(.isr_vector)) /* Startup code */ 81 | __interrupts_end__ = .; 82 | . = ALIGN(4); 83 | } > m_interrupts 84 | 85 | .flash_config : 86 | { 87 | . = ALIGN(4); 88 | KEEP(*(.FlashConfig)) /* Flash Configuration Field (FCF) */ 89 | . = ALIGN(4); 90 | } > m_flash_config 91 | 92 | /* The program code and other data goes into internal flash */ 93 | .text : 94 | { 95 | . = ALIGN(4); 96 | *(.text) /* .text sections (code) */ 97 | *(.text*) /* .text* sections (code) */ 98 | *(.rodata) /* .rodata sections (constants, strings, etc.) */ 99 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 100 | *(.init) /* section used in crti.o files */ 101 | *(.fini) /* section used in crti.o files */ 102 | *(.eh_frame) /* section used in crtbegin.o files */ 103 | . = ALIGN(4); 104 | } > m_text 105 | 106 | /* Section used by the libgcc.a library for fvp4 */ 107 | .ARM : 108 | { 109 | __exidx_start = .; 110 | *(.ARM.exidx*) 111 | __exidx_end = .; 112 | } > m_text 113 | 114 | __etext = .; /* Define a global symbol at end of code. */ 115 | __DATA_ROM = .; /* Symbol is used by startup for data initialization. */ 116 | 117 | .interrupts_ram : 118 | { 119 | . = ALIGN(4); 120 | __VECTOR_RAM__ = .; 121 | __RAM_START = .; 122 | __interrupts_ram_start__ = .; /* Create a global symbol at data start. */ 123 | *(.m_interrupts_ram) /* This is a user defined section. */ 124 | . += M_VECTOR_RAM_SIZE; 125 | . = ALIGN(4); 126 | __interrupts_ram_end__ = .; /* Define a global symbol at data end. */ 127 | } > m_data 128 | 129 | __VECTOR_RAM = DEFINED(__flash_vector_table__) ? ORIGIN(m_interrupts) : __VECTOR_RAM__ ; 130 | __RAM_VECTOR_TABLE_SIZE = DEFINED(__flash_vector_table__) ? 0x0 : (__interrupts_ram_end__ - __interrupts_ram_start__) ; 131 | 132 | .data : AT(__DATA_ROM) 133 | { 134 | . = ALIGN(4); 135 | __DATA_RAM = .; 136 | __data_start__ = .; /* Create a global symbol at data start. */ 137 | *(.data) /* .data sections */ 138 | *(.data*) /* .data* sections */ 139 | . = ALIGN(4); 140 | __data_end__ = .; /* Define a global symbol at data end. */ 141 | } > m_data 142 | 143 | __DATA_END = __DATA_ROM + (__data_end__ - __data_start__); 144 | __CODE_ROM = __DATA_END; /* Symbol is used by code initialization. */ 145 | 146 | .code : AT(__CODE_ROM) 147 | { 148 | . = ALIGN(4); 149 | __CODE_RAM = .; 150 | __code_start__ = .; /* Create a global symbol at code start. */ 151 | __code_ram_start__ = .; 152 | *(.code_ram) /* Custom section for storing code in RAM */ 153 | . = ALIGN(4); 154 | __code_end__ = .; /* Define a global symbol at code end. */ 155 | __code_ram_end__ = .; 156 | } > m_data 157 | 158 | __CODE_END = __CODE_ROM + (__code_end__ - __code_start__); 159 | __CUSTOM_ROM = __CODE_END; 160 | 161 | /* Custom Section Block that can be used to place data at absolute address. */ 162 | /* Use __attribute__((section (".customSection"))) to place data here. */ 163 | .customSectionBlock ORIGIN(m_data_2) : AT(__CUSTOM_ROM) 164 | { 165 | __customSection_start__ = .; 166 | KEEP(*(.customSection)) /* Keep section even if not referenced. */ 167 | __customSection_end__ = .; 168 | } > m_data_2 169 | __CUSTOM_END = __CUSTOM_ROM + (__customSection_end__ - __customSection_start__); 170 | __rom_end = __CUSTOM_END; 171 | 172 | /* Uninitialized data section. */ 173 | .bss : 174 | { 175 | /* This is used by the startup in order to initialize the .bss section. */ 176 | . = ALIGN(4); 177 | __BSS_START = .; 178 | __bss_start__ = .; 179 | *(.bss) 180 | *(.bss*) 181 | *(COMMON) 182 | . = ALIGN(4); 183 | __bss_end__ = .; 184 | __BSS_END = .; 185 | } > m_data_2 186 | 187 | /* Put heap section after the program data */ 188 | .heap : 189 | { 190 | . = ALIGN(8); 191 | __end__ = .; 192 | __heap_start__ = .; 193 | PROVIDE(end = .); 194 | PROVIDE(_end = .); 195 | PROVIDE(__end = .); 196 | __HeapBase = .; 197 | . += HEAP_SIZE; 198 | __HeapLimit = .; 199 | __heap_limit = .; 200 | __heap_end__ = .; 201 | } > m_data_2 202 | 203 | /* Initializes stack on the end of block */ 204 | __StackTop = ORIGIN(m_data_2) + LENGTH(m_data_2); 205 | __StackLimit = __StackTop - STACK_SIZE; 206 | PROVIDE(__stack = __StackTop); 207 | __RAM_END = __StackTop; 208 | 209 | .stack __StackLimit : 210 | { 211 | . = ALIGN(8); 212 | __stack_start__ = .; 213 | . += STACK_SIZE; 214 | __stack_end__ = .; 215 | } > m_data_2 216 | 217 | .ARM.attributes 0 : { *(.ARM.attributes) } 218 | 219 | /* Memory validation */ 220 | ASSERT(__rom_end <= (ORIGIN(m_text) + LENGTH(m_text)), "Region m_text overflowed!") 221 | 222 | ASSERT(__StackLimit >= __HeapLimit, "region m_data_2 overflowed with stack and heap") 223 | } 224 | 225 | -------------------------------------------------------------------------------- /Project_Settings/Linker_Files/S32K144_64_ram.ld: -------------------------------------------------------------------------------- 1 | /* 2 | ** ################################################################### 3 | ** Processor: S32K144 with 64 KB SRAM 4 | ** Compiler: GNU C Compiler 5 | ** 6 | ** Abstract: 7 | ** Linker file for the GNU C Compiler 8 | ** 9 | ** Copyright (c) 2015-2016 Freescale Semiconductor, Inc. 10 | ** Copyright 2017-2018 NXP 11 | ** All rights reserved. 12 | ** 13 | ** THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 14 | ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15 | ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 | ** IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 17 | ** INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 | ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 | ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 21 | ** STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 22 | ** IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | ** THE POSSIBILITY OF SUCH DAMAGE. 24 | ** 25 | ** http: www.freescale.com 26 | ** mail: support@freescale.com 27 | ** 28 | ** ################################################################### 29 | */ 30 | 31 | /* Entry Point */ 32 | ENTRY(Reset_Handler) 33 | 34 | HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x00000400; 35 | STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x00000400; 36 | 37 | /* Specify the memory areas */ 38 | MEMORY 39 | { 40 | /* SRAM_L */ 41 | m_interrupts (RX) : ORIGIN = 0x1FFF8000, LENGTH = 0x00000400 42 | m_text (RX) : ORIGIN = 0x1FFF8400, LENGTH = 0x00007C00 43 | 44 | /* SRAM_U */ 45 | m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00007000 46 | } 47 | 48 | /* Define output sections */ 49 | SECTIONS 50 | { 51 | /* The startup code goes first into internal RAM */ 52 | .interrupts : 53 | { 54 | __VECTOR_TABLE = .; 55 | __interrupts_start__ = .; 56 | . = ALIGN(4); 57 | KEEP(*(.isr_vector)) /* Startup code */ 58 | __interrupts_end__ = .; 59 | . = ALIGN(4); 60 | } > m_interrupts 61 | 62 | __VECTOR_RAM = __VECTOR_TABLE; 63 | __RAM_VECTOR_TABLE_SIZE = 0x0; 64 | 65 | /* The program code and other data goes into internal RAM */ 66 | .text : 67 | { 68 | . = ALIGN(4); 69 | *(.text) /* .text sections (code) */ 70 | *(.text*) /* .text* sections (code) */ 71 | *(.rodata) /* .rodata sections (constants, strings, etc.) */ 72 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 73 | *(.init) /* section used in crti.o files */ 74 | *(.fini) /* section used in crti.o files */ 75 | *(.eh_frame) /* section used in crtbegin.o files */ 76 | . = ALIGN(4); 77 | } > m_text 78 | 79 | /* Section used by the libgcc.a library for fvp4 */ 80 | .ARM : 81 | { 82 | __exidx_start = .; 83 | *(.ARM.exidx*) 84 | __exidx_end = .; 85 | } > m_text 86 | 87 | /* Section for storing functions that needs to execute from RAM */ 88 | .code_ram : 89 | { 90 | . = ALIGN(4); 91 | __CODE_RAM = .; 92 | __code_ram_start__ = .; 93 | *(.code_ram) /* Custom section for storing code in RAM */ 94 | __CODE_ROM = .; /* Symbol is used by start-up for data initialization. */ 95 | __CODE_END = .; /* No copy */ 96 | __code_ram_end__ = .; 97 | . = ALIGN(4); 98 | } > m_text 99 | 100 | __etext = .; /* Define a global symbol at end of code. */ 101 | __DATA_ROM = .; /* Symbol is used by startup for data initialization. */ 102 | __DATA_END = __DATA_ROM; /* No copy */ 103 | 104 | /* Custom Section Block that can be used to place data at absolute address. */ 105 | /* Use __attribute__((section (".customSection"))) to place data here. */ 106 | .customSectionBlock ORIGIN(m_data) : 107 | { 108 | __customSection_start__ = .; 109 | KEEP(*(.customSection)) /* Keep section even if not referenced. */ 110 | __customSection_end__ = .; 111 | __CUSTOM_ROM = .; 112 | __CUSTOM_END = .; 113 | } > m_data 114 | 115 | .data : 116 | { 117 | . = ALIGN(4); 118 | __DATA_RAM = .; 119 | __data_start__ = .; /* Create a global symbol at data start. */ 120 | *(.data) /* .data sections */ 121 | *(.data*) /* .data* sections */ 122 | . = ALIGN(4); 123 | __data_end__ = .; /* Define a global symbol at data end. */ 124 | } > m_data 125 | 126 | /* Uninitialized data section. */ 127 | .bss : 128 | { 129 | /* This is used by the startup in order to initialize the .bss section. */ 130 | . = ALIGN(4); 131 | __BSS_START = .; 132 | __bss_start__ = .; 133 | *(.bss) 134 | *(.bss*) 135 | *(COMMON) 136 | . = ALIGN(4); 137 | __bss_end__ = .; 138 | __BSS_END = .; 139 | } > m_data 140 | 141 | /* Put heap section after the program data */ 142 | .heap : 143 | { 144 | . = ALIGN(8); 145 | __end__ = .; 146 | __heap_start__ = .; 147 | PROVIDE(end = .); 148 | PROVIDE(_end = .); 149 | PROVIDE(__end = .); 150 | __HeapBase = .; 151 | . += HEAP_SIZE; 152 | __HeapLimit = .; 153 | __heap_limit = .; 154 | __heap_end__ = .; 155 | } > m_data 156 | 157 | /* Initializes stack on the end of block */ 158 | __StackTop = ORIGIN(m_data) + LENGTH(m_data); 159 | __StackLimit = __StackTop - STACK_SIZE; 160 | PROVIDE(__stack = __StackTop); 161 | 162 | .stack __StackLimit : 163 | { 164 | . = ALIGN(8); 165 | __stack_start__ = .; 166 | . += STACK_SIZE; 167 | __stack_end__ = .; 168 | } > m_data 169 | 170 | .ARM.attributes 0 : { *(.ARM.attributes) } 171 | 172 | ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap") 173 | 174 | /DISCARD/ : { 175 | *(.FlashConfig) 176 | } 177 | } 178 | 179 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # :beers: UDS_S32K144_FlashDriver 2 | 3 | ```c 4 | /* 5 | * ___ ___ _____ ___ 6 | * /__/\ ___ /__/\ / /::\ / /\ ___ 7 | * \ \:\ /__/\ | |::\ / /:/\:\ / /::\ /__/\ 8 | * \ \:\ \ \:\ | |:|:\ / /:/ \:\ / /:/\:\ \ \:\ 9 | * _____\__\:\ \ \:\ __|__|:|\:\ /__/:/ \__\:| / /:/~/:/ \ \:\ 10 | * /__/::::::::\ ___ \__\:\ /__/::::| \:\ \ \:\ / /:/ /__/:/ /:/___ ___ \__\:\ 11 | * \ \:\~~\~~\/ /__/\ | |:| \ \:\~~\__\/ \ \:\ /:/ \ \:\/:::::/ /__/\ | |:| 12 | * \ \:\ ~~~ \ \:\| |:| \ \:\ \ \:\/:/ \ \::/~~~~ \ \:\| |:| 13 | * \ \:\ \ \:\__|:| \ \:\ \ \::/ \ \:\ \ \:\__|:| 14 | * \ \:\ \__\::::/ \ \:\ \__\/ \ \:\ \__\::::/ 15 | * \__\/ ~~~~ \__\/ \__\/ ~~~~ 16 | */ 17 | ``` 18 | 19 | ## :book: 简介 20 | 21 | S32K1xx 的 CAN 接 `周立功 USBCANFD-100U-mini`,使用 `ZCANPRO` 软件的 `ECU刷新` 功能进行测试。在加载相应的安全访问算法 DLL 文件 :package: [UDS_SecurityAccess][UDS_SecurityAccess] 之后,通过相应的 UDS 服务将 :package: [UDS_S32K144_FlashDriver][UDS_S32K144_FlashDriver] 的 hex 文件下载至 :package: [UDS_S32K144_Bootloader][UDS_S32K144_Bootloader] 在链接文件中为其预先指定起始地址的 RAM 空间中,并通过 `Flash Driver` 内实际包含的相应的 Flash 驱动函数的相对偏移量以及驱动函数本身来计算相应驱动函数的入口点在 RAM 内的偏移地址后,再通过函数指针的方式调用相应的编程、擦写、校验等 `Flash API` 以实现将 :package: [UDS_S32K144_APP][UDS_S32K144_APP] 烧写至 Flash 的 APP 片区,最终实现 `ECU刷新` 的整个 APP 更新流程。 22 | 23 | ![Pic_ZCANPRO_ECU_Refresh][Pic_ZCANPRO_ECU_Refresh] 24 | 25 | ## :link: 关联工程 26 | 27 | - :package: [UDS_SecurityAccess][UDS_SecurityAccess] 28 | - :package: [UDS_S32K144_Bootloader][UDS_S32K144_Bootloader] 29 | - :package: [UDS_S32K144_FlashDriver][UDS_S32K144_FlashDriver] 30 | - :package: [UDS_S32K144_APP][UDS_S32K144_APP] 31 | 32 | ## :gear: 硬件 & 软件 需求 33 | 34 | ### 硬件需求 35 | 36 | - S32K144-EVB 37 | - J-Link 38 | - USBCANFD-100U-mini 39 | - 12V External Power Supply 40 | 41 | ### 软件需求 42 | 43 | - S32 Design Studio for ARM Version 2.2 44 | - ZCANPRO 45 | - J-Flash 46 | 47 |
48 | 49 | --- 50 | 51 |
52 | 53 | ### :warning: 注意 54 | 55 | ![Note_00][Note_00] 56 | ![Note_01][Note_01] 57 | ![Note_02][Note_02] 58 | 59 | [Pic_ZCANPRO_ECU_Refresh]: ./Pic_ZCANPRO_ECU_Refresh.png 60 | [Note_00]: ./Note_00.png 61 | [Note_01]: ./Note_01.png 62 | [Note_02]: ./Note_02.png 63 | 64 | [UDS_SecurityAccess]: https://github.com/SummerFalls/UDS_SecurityAccess 65 | [UDS_S32K144_Bootloader]: https://github.com/SummerFalls/UDS_S32K144_Bootloader 66 | [UDS_S32K144_FlashDriver]: https://github.com/SummerFalls/UDS_S32K144_FlashDriver 67 | [UDS_S32K144_APP]: https://github.com/SummerFalls/UDS_S32K144_APP 68 | -------------------------------------------------------------------------------- /SDK/platform/devices/S32K144/startup/system_S32K144.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Freescale Semiconductor, Inc. 3 | * Copyright 2016-2017 NXP 4 | * All rights reserved. 5 | * 6 | * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 7 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 8 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 9 | * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 10 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 11 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 12 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 13 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 14 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 15 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 16 | * THE POSSIBILITY OF SUCH DAMAGE. 17 | */ 18 | 19 | /** 20 | * @page misra_violations MISRA-C:2012 violations 21 | * 22 | * @section [global] 23 | * Violates MISRA 2012 Advisory Rule 8.9, An object should be defined at block 24 | * scope if its identifier only appears in a single function. 25 | * An object with static storage duration declared at block scope cannot be 26 | * accessed directly from outside the block. 27 | * 28 | * @section [global] 29 | * Violates MISRA 2012 Advisory Rule 11.4, A conversion should not be performed 30 | * between a pointer to object and an integer type. 31 | * The cast is required to initialize a pointer with an unsigned int define, 32 | * representing an address. 33 | * 34 | * @section [global] 35 | * Violates MISRA 2012 Required Rule 11.6, A cast shall not be performed 36 | * between pointer to void and an arithmetic type. 37 | * The cast is required to initialize a pointer with an unsigned int define, 38 | * representing an address. 39 | * 40 | * @section [global] 41 | * Violates MISRA 2012 Advisory Rule 8.7, External could be made static. 42 | * Function is defined for usage by application code. 43 | * 44 | */ 45 | 46 | #include "device_registers.h" 47 | #include "system_S32K144.h" 48 | #include "stdbool.h" 49 | 50 | /* ---------------------------------------------------------------------------- 51 | -- Core clock 52 | ---------------------------------------------------------------------------- */ 53 | 54 | uint32_t SystemCoreClock = DEFAULT_SYSTEM_CLOCK; 55 | 56 | /*FUNCTION********************************************************************** 57 | * 58 | * Function Name : SystemInit 59 | * Description : This function disables the watchdog, enables FPU 60 | * and the power mode protection if the corresponding feature macro 61 | * is enabled. SystemInit is called from startup_device file. 62 | * 63 | * Implements : SystemInit_Activity 64 | *END**************************************************************************/ 65 | void SystemInit(void) 66 | { 67 | /**************************************************************************/ 68 | /* FPU ENABLE*/ 69 | /**************************************************************************/ 70 | #ifdef ENABLE_FPU 71 | /* Enable CP10 and CP11 coprocessors */ 72 | S32_SCB->CPACR |= (S32_SCB_CPACR_CP10_MASK | S32_SCB_CPACR_CP11_MASK); 73 | #ifdef ERRATA_E6940 74 | /* Disable lazy context save of floating point state by clearing LSPEN bit 75 | * Workaround for errata e6940 */ 76 | S32_SCB->FPCCR &= ~(S32_SCB_FPCCR_LSPEN_MASK); 77 | #endif 78 | #endif /* ENABLE_FPU */ 79 | 80 | /**************************************************************************/ 81 | /* WDOG DISABLE*/ 82 | /**************************************************************************/ 83 | 84 | #if (DISABLE_WDOG) 85 | /* Write of the WDOG unlock key to CNT register, must be done in order to allow any modifications*/ 86 | WDOG->CNT = (uint32_t ) FEATURE_WDOG_UNLOCK_VALUE; 87 | /* The dummy read is used in order to make sure that the WDOG registers will be configured only 88 | * after the write of the unlock value was completed. */ 89 | (void)WDOG->CNT; 90 | 91 | /* Initial write of WDOG configuration register: 92 | * enables support for 32-bit refresh/unlock command write words, 93 | * clock select from LPO, update enable, watchdog disabled */ 94 | WDOG->CS = (uint32_t ) ( (1UL << WDOG_CS_CMD32EN_SHIFT) | 95 | (FEATURE_WDOG_CLK_FROM_LPO << WDOG_CS_CLK_SHIFT) | 96 | (0U << WDOG_CS_EN_SHIFT) | 97 | (1U << WDOG_CS_UPDATE_SHIFT) ); 98 | 99 | /* Configure timeout */ 100 | WDOG->TOVAL = (uint32_t )0xFFFF; 101 | #endif /* (DISABLE_WDOG) */ 102 | 103 | /**************************************************************************/ 104 | /* ENABLE CACHE */ 105 | /**************************************************************************/ 106 | #if defined(I_CACHE) && (ICACHE_ENABLE == 1) 107 | /* Invalidate and enable code cache */ 108 | LMEM->PCCCR = LMEM_PCCCR_INVW0(1) | LMEM_PCCCR_INVW1(1) | LMEM_PCCCR_GO(1) | LMEM_PCCCR_ENCACHE(1); 109 | #endif /* defined(I_CACHE) && (ICACHE_ENABLE == 1) */ 110 | } 111 | 112 | /*FUNCTION********************************************************************** 113 | * 114 | * Function Name : SystemCoreClockUpdate 115 | * Description : This function must be called whenever the core clock is changed 116 | * during program execution. It evaluates the clock register settings and calculates 117 | * the current core clock. 118 | * 119 | * Implements : SystemCoreClockUpdate_Activity 120 | *END**************************************************************************/ 121 | void SystemCoreClockUpdate(void) 122 | { 123 | uint32_t SCGOUTClock = 0U; /* Variable to store output clock frequency of the SCG module */ 124 | uint32_t regValue; /* Temporary variable */ 125 | uint32_t divider, prediv, multi; 126 | bool validSystemClockSource = true; 127 | static const uint32_t fircFreq[] = { 128 | FEATURE_SCG_FIRC_FREQ0, 129 | }; 130 | 131 | divider = ((SCG->CSR & SCG_CSR_DIVCORE_MASK) >> SCG_CSR_DIVCORE_SHIFT) + 1U; 132 | 133 | switch ((SCG->CSR & SCG_CSR_SCS_MASK) >> SCG_CSR_SCS_SHIFT) { 134 | case 0x1: 135 | /* System OSC */ 136 | SCGOUTClock = CPU_XTAL_CLK_HZ; 137 | break; 138 | case 0x2: 139 | /* Slow IRC */ 140 | regValue = (SCG->SIRCCFG & SCG_SIRCCFG_RANGE_MASK) >> SCG_SIRCCFG_RANGE_SHIFT; 141 | 142 | if (regValue != 0U) 143 | { 144 | SCGOUTClock = FEATURE_SCG_SIRC_HIGH_RANGE_FREQ; 145 | } 146 | 147 | break; 148 | case 0x3: 149 | /* Fast IRC */ 150 | regValue = (SCG->FIRCCFG & SCG_FIRCCFG_RANGE_MASK) >> SCG_FIRCCFG_RANGE_SHIFT; 151 | SCGOUTClock= fircFreq[regValue]; 152 | break; 153 | case 0x6: 154 | /* System PLL */ 155 | SCGOUTClock = CPU_XTAL_CLK_HZ; 156 | prediv = ((SCG->SPLLCFG & SCG_SPLLCFG_PREDIV_MASK) >> SCG_SPLLCFG_PREDIV_SHIFT) + 1U; 157 | multi = ((SCG->SPLLCFG & SCG_SPLLCFG_MULT_MASK) >> SCG_SPLLCFG_MULT_SHIFT) + 16U; 158 | SCGOUTClock = SCGOUTClock * multi / (prediv * 2U); 159 | break; 160 | default: 161 | validSystemClockSource = false; 162 | break; 163 | } 164 | 165 | if (validSystemClockSource == true) { 166 | SystemCoreClock = (SCGOUTClock / divider); 167 | } 168 | } 169 | 170 | /*FUNCTION********************************************************************** 171 | * 172 | * Function Name : SystemSoftwareReset 173 | * Description : This function is used to initiate a system reset 174 | * 175 | * Implements : SystemSoftwareReset_Activity 176 | *END**************************************************************************/ 177 | void SystemSoftwareReset(void) 178 | { 179 | uint32_t regValue; 180 | 181 | /* Read Application Interrupt and Reset Control Register */ 182 | regValue = S32_SCB->AIRCR; 183 | 184 | /* Clear register key */ 185 | regValue &= ~( S32_SCB_AIRCR_VECTKEY_MASK); 186 | 187 | /* Configure System reset request bit and Register Key */ 188 | regValue |= S32_SCB_AIRCR_VECTKEY(FEATURE_SCB_VECTKEY); 189 | regValue |= S32_SCB_AIRCR_SYSRESETREQ(0x1u); 190 | 191 | /* Write computed register value */ 192 | S32_SCB->AIRCR = regValue; 193 | } 194 | 195 | /******************************************************************************* 196 | * EOF 197 | ******************************************************************************/ 198 | -------------------------------------------------------------------------------- /SDK/platform/devices/S32K144/startup/system_S32K144.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Freescale Semiconductor, Inc. 3 | * Copyright 2016-2017 NXP 4 | * All rights reserved. 5 | * 6 | * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 7 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 8 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 9 | * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 10 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 11 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 12 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 13 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 14 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 15 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 16 | * THE POSSIBILITY OF SUCH DAMAGE. 17 | */ 18 | 19 | 20 | /*! @addtogroup soc_support_S32K144*/ 21 | /*! @{*/ 22 | 23 | /*! 24 | * @file system_S32K144.h 25 | * @brief Device specific configuration file for S32K144 26 | */ 27 | 28 | #ifndef SYSTEM_S32K144_H_ 29 | #define SYSTEM_S32K144_H_ /**< Symbol preventing repeated inclusion */ 30 | 31 | #include 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /****************************************************************************** 38 | * CPU Settings. 39 | *****************************************************************************/ 40 | 41 | /* Watchdog disable */ 42 | #ifndef DISABLE_WDOG 43 | #define DISABLE_WDOG 1 44 | #endif 45 | 46 | /* Cache enablement */ 47 | #ifndef ICACHE_ENABLE 48 | #define ICACHE_ENABLE 0 49 | #endif 50 | 51 | /* Value of the external crystal or oscillator clock frequency in Hz */ 52 | #ifndef CPU_XTAL_CLK_HZ 53 | #define CPU_XTAL_CLK_HZ 8000000u 54 | #endif 55 | 56 | /* Value of the fast internal oscillator clock frequency in Hz */ 57 | #ifndef CPU_INT_FAST_CLK_HZ 58 | #define CPU_INT_FAST_CLK_HZ 48000000u 59 | #endif 60 | 61 | /* Default System clock value */ 62 | #ifndef DEFAULT_SYSTEM_CLOCK 63 | #define DEFAULT_SYSTEM_CLOCK 48000000u 64 | #endif 65 | 66 | /** 67 | * @brief System clock frequency (core clock) 68 | * 69 | * The system clock frequency supplied to the SysTick timer and the processor 70 | * core clock. This variable can be used by the user application to setup the 71 | * SysTick timer or configure other parameters. It may also be used by debugger to 72 | * query the frequency of the debug timer or configure the trace clock speed 73 | * SystemCoreClock is initialized with a correct predefined value. 74 | */ 75 | extern uint32_t SystemCoreClock; 76 | 77 | /** 78 | * @brief Setup the SoC. 79 | * 80 | * This function disables the watchdog, enables FPU. 81 | * if the corresponding feature macro is enabled. 82 | * SystemInit is called from startup_device file. 83 | */ 84 | void SystemInit(void); 85 | 86 | /** 87 | * @brief Updates the SystemCoreClock variable. 88 | * 89 | * It must be called whenever the core clock is changed during program 90 | * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates 91 | * the current core clock. 92 | * This function must be called when user does not want to use clock manager component. 93 | * If clock manager is used, the CLOCK_SYS_GetFreq function must be used with CORE_CLOCK 94 | * parameter. 95 | * 96 | */ 97 | void SystemCoreClockUpdate(void); 98 | 99 | /** 100 | * @brief Initiates a system reset. 101 | * 102 | * This function is used to initiate a system reset 103 | */ 104 | void SystemSoftwareReset(void); 105 | 106 | #ifdef __cplusplus 107 | } 108 | #endif 109 | 110 | /*! @}*/ 111 | #endif /* #if !defined(SYSTEM_S32K144_H_) */ 112 | -------------------------------------------------------------------------------- /SDK/platform/devices/callbacks.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 NXP 3 | * All rights reserved. 4 | * 5 | * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 6 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 7 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 8 | * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 9 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 10 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 11 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 12 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 13 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 14 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 15 | * THE POSSIBILITY OF SUCH DAMAGE. 16 | */ 17 | 18 | #ifndef CALLBACKS_H 19 | #define CALLBACKS_H 20 | #include 21 | /** 22 | * @page misra_violations MISRA-C:2012 violations 23 | * 24 | * 25 | * @section [global] 26 | * Violates MISRA 2012 Advisory Rule 2.3, A project should not contain 27 | * unused type declarations. 28 | * The header defines callback types for all PAL modules. 29 | */ 30 | 31 | #include 32 | 33 | /******************************************************************************* 34 | * Definitions 35 | ******************************************************************************/ 36 | 37 | /*! 38 | * @brief Define the enum of the events which can trigger I2C slave callback 39 | * 40 | * This enum should include the events for all platforms 41 | */ 42 | typedef enum 43 | { 44 | I2C_SLAVE_EVENT_RX_FULL = 0x00U, 45 | I2C_SLAVE_EVENT_TX_EMPTY = 0x01U, 46 | I2C_SLAVE_EVENT_TX_REQ = 0x02U, 47 | I2C_SLAVE_EVENT_RX_REQ = 0x03U, 48 | I2C_SLAVE_EVENT_STOP = 0X04U, 49 | }i2c_slave_event_t; 50 | 51 | /*! 52 | * @brief Define the enum of the events which can trigger I2C master callback 53 | * 54 | * This enum should include the events for all platforms 55 | * 56 | */ 57 | typedef enum 58 | { 59 | I2C_MASTER_EVENT_END_TRANSFER = 0x4U, 60 | }i2c_master_event_t; 61 | 62 | 63 | /* Callback for all peripherals which supports I2C features for slave mode */ 64 | typedef void (*i2c_slave_callback_t)(i2c_slave_event_t event, void *userData); 65 | 66 | /* Callback for all peripherals which supports I2C features for master mode */ 67 | typedef void (*i2c_master_callback_t)(i2c_master_event_t event, void *userData); 68 | 69 | /* Define the enum of the events which can trigger SPI callback 70 | * This enum should include the events for all platforms 71 | */ 72 | typedef enum 73 | { 74 | SPI_EVENT_END_TRANSFER = 0 75 | } spi_event_t; 76 | 77 | /* Callback for all peripherals which supports SPI features */ 78 | typedef void (*spi_callback_t)(void *driverState, spi_event_t event, void *userData); 79 | 80 | /*! 81 | * @brief Define the enum of the events which can trigger UART callback 82 | * 83 | * This enum should include the events for all platforms 84 | * 85 | * Implements : uart_event_t_Class 86 | */ 87 | typedef enum 88 | { 89 | UART_EVENT_RX_FULL = 0x00U, /*!< Rx buffer is full */ 90 | UART_EVENT_TX_EMPTY = 0x01U, /*!< Tx buffer is empty */ 91 | UART_EVENT_END_TRANSFER = 0x02U, /*!< The current transfer is ending */ 92 | UART_EVENT_ERROR = 0x03U, /*!< An error occured during transfer */ 93 | } uart_event_t; 94 | 95 | /*! 96 | * @brief Callback for all peripherals which support UART features 97 | * 98 | * Implements : uart_callback_t_Class 99 | */ 100 | typedef void (*uart_callback_t)(void *driverState, uart_event_t event, void *userData); 101 | 102 | 103 | /* Callback for all peripherals which support TIMING features */ 104 | typedef void (*timer_callback_t)(void *userData); 105 | 106 | 107 | /*! @brief Defines a structure used to pass information to the ADC PAL callback 108 | * 109 | * Implements : adc_callback_info_t_Class 110 | */ 111 | typedef struct 112 | { 113 | uint32_t groupIndex; /*!< Index of the group executing the callback. */ 114 | uint16_t resultBufferTail; /*!< Offset of the most recent conversion result in the result buffer. */ 115 | } adc_callback_info_t; 116 | 117 | /*! @brief Defines the callback used to be called by ADC PAL after the last conversion result in a group 118 | * has been copied to the result buffer. 119 | */ 120 | typedef void (* const adc_callback_t)(const adc_callback_info_t * const callbackInfo, void * userData); 121 | 122 | /* I2S */ 123 | /* Define the enum of the events which can trigger i2s callback */ 124 | /* Events for all peripherals which support i2s 125 | * 126 | * Implements : i2s_event_t_Class 127 | */ 128 | typedef enum 129 | { 130 | I2S_EVENT_RX_FULL = 0x00U, /*!< Rx buffer is full */ 131 | I2S_EVENT_TX_EMPTY = 0x01U, /*!< Tx buffer is empty */ 132 | I2S_EVENT_END_TRANSFER = 0x02U, /*!< The current transfer is ending. Only FLEXIO instance uses this event. The difference between this and event TX_EMPTY is: 133 | TX_EMPTY is generated when all data has been pushed to hardware fifo, users should not call DeInit here or some last data will be lost; 134 | END_TRANSFER is generated when all data has been pushed to line, the transmission will be stopped before users can start transmit again, user can call DeInit here. 135 | For receiving case, this event is the same as RX_FULL. 136 | */ 137 | I2S_EVENT_ERROR = 0x03U, /*!< An error occurred during transfer */ 138 | } i2s_event_t; 139 | 140 | /* Callback for all peripherals which support i2s 141 | * 142 | * Implements : i2s_callback_t_Class 143 | */ 144 | typedef void (*i2s_callback_t)(i2s_event_t event, void *userData); 145 | 146 | /*! @brief Define the enum of the events which can trigger CAN callback 147 | * This enum should include the events for all platforms 148 | * Implements : can_event_t_Class 149 | */ 150 | typedef enum { 151 | CAN_EVENT_RX_COMPLETE, /*!< A frame was received in the configured Rx buffer. */ 152 | CAN_EVENT_TX_COMPLETE, /*!< A frame was sent from the configured Tx buffer. */ 153 | } can_event_t; 154 | 155 | /*! @brief Callback for all peripherals which support CAN features 156 | * Implements : can_callback_t_Class 157 | */ 158 | typedef void (*can_callback_t)(uint32_t instance, 159 | can_event_t eventType, 160 | uint32_t objIdx, 161 | void *driverState); 162 | 163 | /*! 164 | * @brief Callback for security modules 165 | * Implements : security_callback_t_Class 166 | */ 167 | typedef void (*security_callback_t)(uint32_t completedCmd, void *callbackParam); 168 | 169 | /* Define the enum of the events which can trigger the output compare callback */ 170 | typedef enum 171 | { 172 | OC_EVENT_GENERATION_OUTPUT_COMPLETE = 0x00U /*!< Generation output signal is completed */ 173 | } oc_event_t; 174 | 175 | /* Callback for all peripherals which support OC feature */ 176 | typedef void (*oc_callback_t)(oc_event_t event, void *userData); 177 | /* Define the enum of the events which can trigger the input capture callback */ 178 | typedef enum 179 | { 180 | IC_EVENT_MEASUREMENT_COMPLETE = 0x00U /*!< Capture input signal is completed */ 181 | } ic_event_t; 182 | 183 | /* Callback for all peripherals which support IC feature */ 184 | typedef void (*ic_callback_t)(ic_event_t event, void *userData); 185 | 186 | #endif /* CALLBACKS_H */ 187 | 188 | /******************************************************************************* 189 | * EOF 190 | ******************************************************************************/ 191 | -------------------------------------------------------------------------------- /SDK/platform/devices/common/s32_core_cm4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Freescale Semiconductor, Inc. 3 | * Copyright 2016-2017 NXP 4 | * All rights reserved. 5 | * 6 | * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 7 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 8 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 9 | * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 10 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 11 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 12 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 13 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 14 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 15 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 16 | * THE POSSIBILITY OF SUCH DAMAGE. 17 | * 18 | */ 19 | /*! 20 | * @file s32_core_cm4.h 21 | * 22 | * @page misra_violations MISRA-C:2012 violations 23 | * 24 | * @section [global] 25 | * Violates MISRA 2012 Advisory Directive 4.9, Function-like macro 26 | * Function-like macros are used instead of inline functions in order to ensure 27 | * that the performance will not be decreased if the functions will not be 28 | * inlined by the compiler. 29 | * 30 | * @section [global] 31 | * Violates MISRA 2012 Advisory Rule 2.5, Global macro not referenced. 32 | * The macros defined are used only on some of the drivers, so this might be reported 33 | * when the analysis is made only on one driver. 34 | */ 35 | 36 | /* 37 | * Tool Chains: 38 | * GNUC flag is defined also by ARM compiler - it shows the current major version of the compatible GCC version 39 | * __GNUC__ : GNU Compiler Collection 40 | * __ghs__ : Green Hills ARM Compiler 41 | * __ICCARM__ : IAR ARM Compiler 42 | * __DCC__ : Wind River Diab Compiler 43 | * __ARMCC_VERSION: ARM Compiler 44 | */ 45 | 46 | #if !defined (CORE_CM4_H) 47 | #define CORE_CM4_H 48 | 49 | 50 | #ifdef __cplusplus 51 | extern "C" { 52 | #endif 53 | 54 | /** \brief BKPT_ASM 55 | * 56 | * Macro to be used to trigger an debug interrupt 57 | */ 58 | #define BKPT_ASM __asm("BKPT #0\n\t") 59 | 60 | 61 | /** \brief Enable FPU 62 | * 63 | * ENABLE_FPU indicates whether SystemInit will enable the Floating point unit (FPU) 64 | */ 65 | #if defined (__GNUC__) || defined (__ARMCC_VERSION) 66 | #if defined (__VFP_FP__) && !defined (__SOFTFP__) 67 | #define ENABLE_FPU 68 | #endif 69 | 70 | #elif defined (__ICCARM__) 71 | #if defined __ARMVFP__ 72 | #define ENABLE_FPU 73 | #endif 74 | 75 | #elif defined (__ghs__) || defined (__DCC__) 76 | #if defined (__VFP__) 77 | #define ENABLE_FPU 78 | #endif 79 | #endif /* if defined (__GNUC__) */ 80 | 81 | /** \brief Enable interrupts 82 | */ 83 | #if defined (__GNUC__) 84 | #define ENABLE_INTERRUPTS() __asm volatile ("cpsie i" : : : "memory"); 85 | #else 86 | #define ENABLE_INTERRUPTS() __asm("cpsie i") 87 | #endif 88 | 89 | 90 | /** \brief Disable interrupts 91 | */ 92 | #if defined (__GNUC__) 93 | #define DISABLE_INTERRUPTS() __asm volatile ("cpsid i" : : : "memory"); 94 | #else 95 | #define DISABLE_INTERRUPTS() __asm("cpsid i") 96 | #endif 97 | 98 | 99 | /** \brief Enter low-power standby state 100 | * WFI (Wait For Interrupt) makes the processor suspend execution (Clock is stopped) until an IRQ interrupts. 101 | */ 102 | #if defined (__GNUC__) 103 | #define STANDBY() __asm volatile ("wfi") 104 | #else 105 | #define STANDBY() __asm("wfi") 106 | #endif 107 | 108 | /** \brief No-op 109 | */ 110 | #define NOP() __asm volatile ("nop") 111 | 112 | /** \brief Reverse byte order in a word. 113 | */ 114 | #if defined (__GNUC__) || defined (__ICCARM__) || defined (__ghs__) || defined (__ARMCC_VERSION) 115 | #define REV_BYTES_32(a, b) __asm volatile ("rev %0, %1" : "=r" (b) : "r" (a)) 116 | #else 117 | #define REV_BYTES_32(a, b) (b = ((a & 0xFF000000U) >> 24U) | ((a & 0xFF0000U) >> 8U) \ 118 | | ((a & 0xFF00U) << 8U) | ((a & 0xFFU) << 24U)) 119 | #endif 120 | 121 | /** \brief Reverse byte order in each halfword independently. 122 | */ 123 | #if defined (__GNUC__) || defined (__ICCARM__) || defined (__ghs__) || defined (__ARMCC_VERSION) 124 | #define REV_BYTES_16(a, b) __asm volatile ("rev16 %0, %1" : "=r" (b) : "r" (a)) 125 | #else 126 | #define REV_BYTES_16(a, b) (b = ((a & 0xFF000000U) >> 8U) | ((a & 0xFF0000U) << 8U) \ 127 | | ((a & 0xFF00U) >> 8U) | ((a & 0xFFU) << 8U)) 128 | #endif 129 | 130 | /** \brief Places a function in RAM. 131 | */ 132 | #if defined ( __GNUC__ ) || defined (__ARMCC_VERSION) 133 | #define START_FUNCTION_DECLARATION_RAMSECTION 134 | #define END_FUNCTION_DECLARATION_RAMSECTION __attribute__((section (".code_ram"))); 135 | #elif defined ( __ghs__ ) 136 | #define START_FUNCTION_DECLARATION_RAMSECTION _Pragma("ghs callmode=far") 137 | #define END_FUNCTION_DECLARATION_RAMSECTION __attribute__((section (".code_ram")));\ 138 | _Pragma("ghs callmode=default") 139 | #elif defined ( __ICCARM__ ) 140 | #define START_FUNCTION_DECLARATION_RAMSECTION __ramfunc 141 | #define END_FUNCTION_DECLARATION_RAMSECTION ; 142 | #elif defined ( __DCC__ ) 143 | #define START_FUNCTION_DECLARATION_RAMSECTION _Pragma("section CODE \".code_ram\"") \ 144 | _Pragma("use_section CODE") 145 | #define END_FUNCTION_DECLARATION_RAMSECTION ; \ 146 | _Pragma("section CODE \".text\"") 147 | #else 148 | /* Keep compatibility with software analysis tools */ 149 | #define START_FUNCTION_DECLARATION_RAMSECTION 150 | #define END_FUNCTION_DECLARATION_RAMSECTION ; 151 | #endif 152 | 153 | /* For GCC, IAR, GHS, Diab and ARMC there is no need to specify the section when 154 | defining a function, it is enough to specify it at the declaration. This 155 | also enables compatibility with software analysis tools. */ 156 | #define START_FUNCTION_DEFINITION_RAMSECTION 157 | #define END_FUNCTION_DEFINITION_RAMSECTION 158 | 159 | #if defined (__ICCARM__) 160 | #define DISABLE_CHECK_RAMSECTION_FUNCTION_CALL _Pragma("diag_suppress=Ta022") 161 | #define ENABLE_CHECK_RAMSECTION_FUNCTION_CALL _Pragma("diag_default=Ta022") 162 | #else 163 | #define DISABLE_CHECK_RAMSECTION_FUNCTION_CALL 164 | #define ENABLE_CHECK_RAMSECTION_FUNCTION_CALL 165 | #endif 166 | 167 | /** \brief Get Core ID 168 | * 169 | * GET_CORE_ID returns the processor identification number for cm4 170 | */ 171 | #define GET_CORE_ID() 0U 172 | 173 | /** \brief Data alignment. 174 | */ 175 | #if defined ( __GNUC__ ) || defined ( __ghs__ ) || defined ( __DCC__ ) || defined (__ARMCC_VERSION) 176 | #define ALIGNED(x) __attribute__((aligned(x))) 177 | #elif defined ( __ICCARM__ ) 178 | #define stringify(s) tostring(s) 179 | #define tostring(s) #s 180 | #define ALIGNED(x) _Pragma(stringify(data_alignment=x)) 181 | #else 182 | /* Keep compatibility with software analysis tools */ 183 | #define ALIGNED(x) 184 | #endif 185 | 186 | /** \brief Endianness. 187 | */ 188 | #define CORE_LITTLE_ENDIAN 189 | 190 | #ifdef __cplusplus 191 | } 192 | #endif 193 | 194 | #endif /* CORE_CM4_H */ 195 | 196 | /******************************************************************************* 197 | * EOF 198 | ******************************************************************************/ 199 | -------------------------------------------------------------------------------- /SDK/platform/devices/devassert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. 3 | * Copyright 2016-2017 NXP 4 | * All rights reserved. 5 | * 6 | * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 7 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 8 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 9 | * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 10 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 11 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 12 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 13 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 14 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 15 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 16 | * THE POSSIBILITY OF SUCH DAMAGE. 17 | */ 18 | 19 | #ifndef DEVASSERT_H 20 | #define DEVASSERT_H 21 | 22 | #include 23 | 24 | /** 25 | * @page misra_violations MISRA-C:2012 violations 26 | * 27 | * @section [global] 28 | * Violates MISRA 2012 Advisory Rule 2.5, global macro not referenced. 29 | * The macro is defined to be used by drivers to validate input parameters and can be disabled. 30 | * 31 | * @section [global] 32 | * Violates MISRA 2012 Advisory Directive 4.9, Function-like macro defined. 33 | * The macros are used to validate input parameters to driver functions. 34 | * 35 | */ 36 | 37 | /** 38 | \page Error_detection_and_reporting Error detection and reporting 39 | 40 | S32 SDK drivers can use a mechanism to validate data coming from upper software layers (application code) by performing 41 | a number of checks on input parameters' range or other invariants that can be statically checked (not dependent on 42 | runtime conditions). A failed validation is indicative of a software bug in application code, therefore it is important 43 | to use this mechanism during development. 44 | 45 | The validation is performed by using DEV_ASSERT macro. 46 | A default implementation of this macro is provided in this file. However, application developers can provide their own 47 | implementation in a custom file. This requires defining the CUSTOM_DEVASSERT symbol with the specific file name in the 48 | project configuration (for example: -DCUSTOM_DEVASSERT="custom_devassert.h") 49 | 50 | The default implementation accommodates two behaviors, based on DEV_ERROR_DETECT symbol: 51 | - When DEV_ERROR_DETECT symbol is defined in the project configuration (for example: -DDEV_ERROR_DETECT), the validation 52 | performed by the DEV_ASSERT macro is enabled, and a failed validation triggers a software breakpoint and further execution is 53 | prevented (application spins in an infinite loop) 54 | This configuration is recommended for development environments, as it prevents further execution and allows investigating 55 | potential problems from the point of error detection. 56 | - When DEV_ERROR_DETECT symbol is not defined, the DEV_ASSERT macro is implemented as no-op, therefore disabling all validations. 57 | This configuration can be used to eliminate the overhead of development-time checks. 58 | 59 | It is the application developer's responsibility to decide the error detection strategy for production code: one can opt to 60 | disable development-time checking altogether (by not defining DEV_ERROR_DETECT symbol), or one can opt to keep the checks 61 | in place and implement a recovery mechanism in case of a failed validation, by defining CUSTOM_DEVASSERT to point 62 | to the file containing the custom implementation. 63 | */ 64 | 65 | #if defined (CUSTOM_DEVASSERT) 66 | /* If the CUSTOM_DEVASSERT symbol is defined, then add the custom implementation */ 67 | #include CUSTOM_DEVASSERT 68 | #elif defined (DEV_ERROR_DETECT) 69 | /* Implement default assert macro */ 70 | static inline void DevAssert(volatile bool x) 71 | { 72 | if(x) { } else { BKPT_ASM; for(;;) {} } 73 | } 74 | #define DEV_ASSERT(x) DevAssert(x) 75 | #else 76 | /* Assert macro does nothing */ 77 | #define DEV_ASSERT(x) ((void)0) 78 | #endif 79 | 80 | #endif /* DEVASSERT_H */ 81 | 82 | /******************************************************************************* 83 | * EOF 84 | ******************************************************************************/ 85 | -------------------------------------------------------------------------------- /SDK/platform/devices/device_registers.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** ################################################################### 3 | ** Abstract: 4 | ** Common include file for CMSIS register access layer headers. 5 | ** 6 | ** Copyright (c) 2015 Freescale Semiconductor, Inc. 7 | ** Copyright 2016-2017 NXP 8 | ** All rights reserved. 9 | ** 10 | ** THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 11 | ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 12 | ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 13 | ** IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 14 | ** INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 15 | ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 16 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 17 | ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 18 | ** STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 19 | ** IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 20 | ** THE POSSIBILITY OF SUCH DAMAGE. 21 | ** 22 | ** http: www.nxp.com 23 | ** mail: support@nxp.com 24 | ** ################################################################### 25 | */ 26 | 27 | #ifndef DEVICE_REGISTERS_H 28 | #define DEVICE_REGISTERS_H 29 | 30 | /** 31 | * @page misra_violations MISRA-C:2012 violations 32 | * 33 | * @section [global] 34 | * Violates MISRA 2012 Advisory Rule 2.5, global macro not referenced. 35 | * The macro defines the device currently in use and may be used by components for specific checks. 36 | * 37 | */ 38 | 39 | 40 | /* 41 | * Include the cpu specific register header files. 42 | * 43 | * The CPU macro should be declared in the project or makefile. 44 | */ 45 | 46 | #if (defined(CPU_S32K148) || defined(CPU_S32K146) || defined(CPU_S32K144HFT0VLLT) || defined(CPU_S32K144LFT0MLLT) || defined(CPU_S32K142)) 47 | 48 | #define S32K14x_SERIES 49 | 50 | /* Specific core definitions */ 51 | #include "common/s32_core_cm4.h" 52 | 53 | #if defined(CPU_S32K148) 54 | 55 | #define S32K148_SERIES 56 | 57 | /* Register definitions */ 58 | #include "S32K148/include/S32K148.h" 59 | /* CPU specific feature definitions */ 60 | #include "S32K148/include/S32K148_features.h" 61 | 62 | #elif defined(CPU_S32K146) 63 | 64 | #define S32K146_SERIES 65 | 66 | /* Register definitions */ 67 | #include "S32K146/include/S32K146.h" 68 | /* CPU specific feature definitions */ 69 | #include "S32K146/include/S32K146_features.h" 70 | 71 | #elif (defined(CPU_S32K144HFT0VLLT) || defined(CPU_S32K144LFT0MLLT)) 72 | 73 | #define S32K144_SERIES 74 | 75 | /* Register definitions */ 76 | #include "S32K144/include/S32K144.h" 77 | /* CPU specific feature definitions */ 78 | #include "S32K144/include/S32K144_features.h" 79 | 80 | #elif defined(CPU_S32K142) 81 | 82 | #define S32K142_SERIES 83 | 84 | /* Register definitions */ 85 | #include "S32K142/include/S32K142.h" 86 | /* CPU specific feature definitions */ 87 | #include "S32K142/include/S32K142_features.h" 88 | 89 | #endif 90 | 91 | #elif defined(CPU_S32V234) 92 | 93 | #define S32V234_SERIES 94 | 95 | /* Specific core definitions */ 96 | #include "common/s32_core_cm4.h" 97 | /* Register definitions */ 98 | #include "S32V234/include/S32V234.h" 99 | /* CPU specific feature definitions */ 100 | #include "S32V234/include/S32V234_features.h" 101 | 102 | #elif (defined(CPU_S32K116) || defined(CPU_S32K118)) 103 | 104 | #define S32K11x_SERIES 105 | 106 | /* Specific core definitions */ 107 | #include "common/s32_core_cm0.h" 108 | 109 | #if defined(CPU_S32K116) 110 | 111 | #define S32K116_SERIES 112 | /* Register definitions */ 113 | #include "S32K116/include/S32K116.h" 114 | /* CPU specific feature definitions */ 115 | #include "S32K116/include/S32K116_features.h" 116 | #elif defined(CPU_S32K118) 117 | 118 | #define S32K118_SERIES 119 | /* Register definitions */ 120 | #include "S32K118/include/S32K118.h" 121 | /* CPU specific feature definitions */ 122 | #include "S32K118/include/S32K118_features.h" 123 | 124 | #endif 125 | 126 | #elif defined(CPU_MPC5777C) 127 | 128 | #define MPC5777C_SERIES 129 | 130 | /* Specific core definitions */ 131 | #include "common/s32_core_e200.h" 132 | /* Register definitions */ 133 | #include "MPC5777C/include/MPC5777C.h" 134 | /* CPU specific feature definitions */ 135 | #include "MPC5777C/include/MPC5777C_features.h" 136 | 137 | #elif (defined(CPU_MPC5746R) || defined(CPU_MPC5748G) || defined(CPU_MPC5746C) || defined(CPU_MPC5741P)|| defined(CPU_MPC5742P)|| defined(CPU_MPC5743P)|| defined(CPU_MPC5744P) || defined(CPU_MPC5744B) || defined(CPU_MPC5745B) || defined(CPU_MPC5746B) || defined(CPU_MPC5744C) || defined(CPU_MPC5745C) || defined(CPU_MPC5747C) || defined(CPU_MPC5748C) || defined(CPU_MPC5746G) || defined(CPU_MPC5747G)) 138 | 139 | #define MPC574x_SERIES 140 | 141 | /* Specific core definitions */ 142 | #include "common/s32_core_e200.h" 143 | 144 | #if (defined(CPU_MPC5746R)) 145 | 146 | #define MPC5746R_SERIES 147 | 148 | /* Register definitions */ 149 | #include "MPC5746R/include/MPC5746R.h" 150 | /* CPU specific feature definitions */ 151 | #include "MPC5746R/include/MPC5746R_features.h" 152 | 153 | #elif (defined(CPU_MPC5748G)) 154 | 155 | #define MPC5748G_SERIES 156 | 157 | /* Register definitions */ 158 | #include "MPC5748G/include/MPC5748G.h" 159 | /* CPU specific feature definitions */ 160 | #include "MPC5748G/include/MPC5748G_features.h" 161 | 162 | #elif (defined(CPU_MPC5747C)) 163 | 164 | #define MPC5747C_SERIES 165 | 166 | /* Register definitions */ 167 | #include "MPC5747C/include/MPC5747C.h" 168 | /* CPU specific feature definitions */ 169 | #include "MPC5747C/include/MPC5747C_features.h" 170 | 171 | #elif (defined(CPU_MPC5748C)) 172 | 173 | #define MPC5748C_SERIES 174 | 175 | /* Register definitions */ 176 | #include "MPC5748C/include/MPC5748C.h" 177 | /* CPU specific feature definitions */ 178 | #include "MPC5748C/include/MPC5748C_features.h" 179 | 180 | #elif (defined(CPU_MPC5746G)) 181 | 182 | #define MPC5746G_SERIES 183 | 184 | /* Register definitions */ 185 | #include "MPC5746G/include/MPC5746G.h" 186 | /* CPU specific feature definitions */ 187 | #include "MPC5746G/include/MPC5746G_features.h" 188 | 189 | #elif (defined(CPU_MPC5747G)) 190 | 191 | #define MPC5747G_SERIES 192 | 193 | /* Register definitions */ 194 | #include "MPC5747G/include/MPC5747G.h" 195 | /* CPU specific feature definitions */ 196 | #include "MPC5747G/include/MPC5747G_features.h" 197 | 198 | #elif defined(CPU_MPC5746C) 199 | 200 | #define MPC5746C_SERIES 201 | 202 | /* Register definitions */ 203 | #include "MPC5746C/include/MPC5746C.h" 204 | /* CPU specific feature definitions */ 205 | #include "MPC5746C/include/MPC5746C_features.h" 206 | 207 | #elif defined(CPU_MPC5744B) 208 | 209 | #define MPC5744B_SERIES 210 | 211 | /* Register definitions */ 212 | #include "MPC5744B/include/MPC5744B.h" 213 | /* CPU specific feature definitions */ 214 | #include "MPC5744B/include/MPC5744B_features.h" 215 | 216 | #elif defined(CPU_MPC5745B) 217 | 218 | #define MPC5745B_SERIES 219 | 220 | /* Register definitions */ 221 | #include "MPC5745B/include/MPC5745B.h" 222 | /* CPU specific feature definitions */ 223 | #include "MPC5745B/include/MPC5745B_features.h" 224 | 225 | #elif defined(CPU_MPC5746B) 226 | 227 | #define MPC5746B_SERIES 228 | 229 | /* Register definitions */ 230 | #include "MPC5746B/include/MPC5746B.h" 231 | /* CPU specific feature definitions */ 232 | #include "MPC5746B/include/MPC5746B_features.h" 233 | 234 | #elif defined(CPU_MPC5744C) 235 | 236 | #define MPC5744C_SERIES 237 | 238 | /* Register definitions */ 239 | #include "MPC5744C/include/MPC5744C.h" 240 | /* CPU specific feature definitions */ 241 | #include "MPC5744C/include/MPC5744C_features.h" 242 | 243 | #elif defined(CPU_MPC5745C) 244 | 245 | #define MPC5745C_SERIES 246 | 247 | /* Register definitions */ 248 | #include "MPC5745C/include/MPC5745C.h" 249 | /* CPU specific feature definitions */ 250 | #include "MPC5745C/include/MPC5745C_features.h" 251 | 252 | #elif defined(CPU_MPC5741P) 253 | 254 | #define MPC5741P_SERIES 255 | 256 | /* Register definitions */ 257 | #include "MPC5741P/include/MPC5741P.h" 258 | /* CPU specific feature definitions */ 259 | #include "MPC5741P/include/MPC5741P_features.h" 260 | 261 | #elif defined(CPU_MPC5742P) 262 | 263 | #define MPC5742P_SERIES 264 | 265 | /* Register definitions */ 266 | #include "MPC5742P/include/MPC5742P.h" 267 | /* CPU specific feature definitions */ 268 | #include "MPC5742P/include/MPC5742P_features.h" 269 | 270 | #elif defined(CPU_MPC5743P) 271 | 272 | #define MPC5743P_SERIES 273 | 274 | /* Register definitions */ 275 | #include "MPC5743P/include/MPC5743P.h" 276 | /* CPU specific feature definitions */ 277 | #include "MPC5743P/include/MPC5743P_features.h" 278 | 279 | #elif defined(CPU_MPC5744P) 280 | 281 | #define MPC5744P_SERIES 282 | 283 | /* Register definitions */ 284 | #include "MPC5744P/include/MPC5744P.h" 285 | /* CPU specific feature definitions */ 286 | #include "MPC5744P/include/MPC5744P_features.h" 287 | 288 | #endif 289 | #elif (defined(CPU_S32R274) || defined(CPU_S32R372)) 290 | 291 | #define S32R_SERIES 292 | 293 | /* Specific core definitions */ 294 | #include "common/s32_core_e200.h" 295 | 296 | #if (defined(CPU_S32R274)) 297 | 298 | #define S32R274_SERIES 299 | 300 | /* Register definitions */ 301 | #include "S32R274/include/S32R274.h" 302 | /* CPU specific feature definitions */ 303 | #include "S32R274/include/S32R274_features.h" 304 | 305 | #elif (defined(CPU_S32R372)) 306 | 307 | #define S32R372_SERIES 308 | 309 | /* Register definitions */ 310 | #include "S32R372/include/S32R372.h" 311 | /* CPU specific feature definitions */ 312 | #include "S32R372/include/S32R372_features.h" 313 | #endif 314 | #elif (defined(CPU_S32MTV)) 315 | 316 | #define S32MTV_SERIES 317 | 318 | /* Specific core definitions */ 319 | #include "common/s32_core_cm4.h" 320 | 321 | /* Register definitions */ 322 | #include "S32MTV/include/S32MTV.h" 323 | /* CPU specific feature definitions */ 324 | #include "S32MTV/include/S32MTV_features.h" 325 | 326 | #elif defined(CPU_SJA1110) 327 | 328 | #define SJA1110_SERIES 329 | 330 | /* Specific core definitions */ 331 | #include "common/s32_core_cm7.h" 332 | 333 | /* Register definitions */ 334 | #include "SJA1110/include/SJA1110.h" 335 | /* CPU specific feature definitions */ 336 | #include "SJA1110/include/SJA1110_features.h" 337 | /* float32_t, float64_t definitions */ 338 | #include "SJA1110/include/SJA1110_floats.h" 339 | 340 | #elif defined(CPU_S32S247) 341 | 342 | #define S32S247_SERIES 343 | 344 | /* Specific core definitions */ 345 | #include "common/s32_core_cm7.h" 346 | 347 | /* Register definitions */ 348 | #include "S32S247/include/S32S247.h" 349 | /* CPU specific feature definitions */ 350 | #include "S32S247/include/S32S247_features.h" 351 | 352 | #else 353 | #error "No valid CPU defined!" 354 | #endif 355 | 356 | #include "devassert.h" 357 | 358 | #endif /* DEVICE_REGISTERS_H */ 359 | 360 | /******************************************************************************* 361 | * EOF 362 | ******************************************************************************/ 363 | -------------------------------------------------------------------------------- /SDK/platform/devices/startup.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc. 3 | * Copyright 2016-2018 NXP 4 | * All rights reserved. 5 | * 6 | * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 7 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 8 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 9 | * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 10 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 11 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 12 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 13 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 14 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 15 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 16 | * THE POSSIBILITY OF SUCH DAMAGE. 17 | */ 18 | 19 | /** 20 | * @page misra_violations MISRA-C:2012 violations 21 | * 22 | * @section [global] 23 | * Violates MISRA 2012 Advisory Rule 8.9, An object should be defined at block 24 | * scope if its identifier only appears in a single function. 25 | * All variables with this problem are defined in the linker files. 26 | * 27 | * @section [global] 28 | * Violates MISRA 2012 Advisory Rule 8.11, When an array with external linkage 29 | * is declared, its size should be explicitly specified. 30 | * The size of the arrays can not be explicitly determined. 31 | * 32 | * @section [global] 33 | * Violates MISRA 2012 Advisory Rule 11.4, A conversion should not be performed 34 | * between a pointer to object and an integer type. 35 | * The cast is required to initialize a pointer with an unsigned int define, 36 | * representing an address. 37 | * 38 | * @section [global] 39 | * Violates MISRA 2012 Required Rule 11.6, A cast shall not be performed 40 | * between pointer to void and an arithmetic type. 41 | * The cast is required to initialize a pointer with an unsigned int define, 42 | * representing an address. 43 | * 44 | * @section [global] 45 | * Violates MISRA 2012 Required Rule 2.1, A project shall not contain unreachable 46 | * code. 47 | * The condition compares two address defined in linker files that can be different. 48 | * 49 | * @section [global] 50 | * Violates MISRA 2012 Advisory Rule 8.7, External could be made static. 51 | * Function is defined for usage by application code. 52 | * 53 | * @section [global] 54 | * Violates MISRA 2012 Mandatory Rule 17.3, Symbol 'MFSPR' undeclared, assumed 55 | * to return int. 56 | * This is an e200 Power Architecture Assembly instruction used to retrieve 57 | * the core number. 58 | * 59 | */ 60 | 61 | #include "startup.h" 62 | #include 63 | 64 | 65 | /******************************************************************************* 66 | * Static Variables 67 | ******************************************************************************/ 68 | static volatile uint32_t * const s_vectors[NUMBER_OF_CORES] = FEATURE_INTERRUPT_INT_VECTORS; 69 | 70 | /******************************************************************************* 71 | * Code 72 | ******************************************************************************/ 73 | 74 | /*FUNCTION********************************************************************** 75 | * 76 | * Function Name : init_data_bss 77 | * Description : Make necessary initializations for RAM. 78 | * - Copy the vector table from ROM to RAM. 79 | * - Copy initialized data from ROM to RAM. 80 | * - Copy code that should reside in RAM from ROM 81 | * - Clear the zero-initialized data section. 82 | * 83 | * Tool Chains: 84 | * __GNUC__ : GNU Compiler Collection 85 | * __ghs__ : Green Hills ARM Compiler 86 | * __ICCARM__ : IAR ARM Compiler 87 | * __DCC__ : Wind River Diab Compiler 88 | * __ARMCC_VERSION : ARMC Compiler 89 | * 90 | * Implements : init_data_bss_Activity 91 | *END**************************************************************************/ 92 | void init_data_bss(void) 93 | { 94 | uint32_t n; 95 | uint8_t coreId; 96 | /* For ARMC we are using the library method of initializing DATA, Custom Section and 97 | * Code RAM sections so the below variables are not needed */ 98 | #if !defined(__ARMCC_VERSION) 99 | /* Declare pointers for various data sections. These pointers 100 | * are initialized using values pulled in from the linker file */ 101 | uint8_t * data_ram; 102 | uint8_t * code_ram; 103 | uint8_t * bss_start; 104 | uint8_t * custom_ram; 105 | const uint8_t * data_rom, * data_rom_end; 106 | const uint8_t * code_rom, * code_rom_end; 107 | const uint8_t * bss_end; 108 | const uint8_t * custom_rom, * custom_rom_end; 109 | #endif 110 | /* Addresses for VECTOR_TABLE and VECTOR_RAM come from the linker file */ 111 | 112 | #if defined(__ARMCC_VERSION) 113 | extern uint32_t __RAM_VECTOR_TABLE_SIZE; 114 | extern uint32_t __VECTOR_ROM; 115 | extern uint32_t __VECTOR_RAM; 116 | #else 117 | extern uint32_t __RAM_VECTOR_TABLE_SIZE[]; 118 | extern uint32_t __VECTOR_TABLE[]; 119 | extern uint32_t __VECTOR_RAM[]; 120 | #endif 121 | /* Get section information from linker files */ 122 | #if defined(__ICCARM__) 123 | /* Data */ 124 | data_ram = __section_begin(".data"); 125 | data_rom = __section_begin(".data_init"); 126 | data_rom_end = __section_end(".data_init"); 127 | 128 | /* CODE RAM */ 129 | #pragma section = "__CODE_ROM" 130 | #pragma section = "__CODE_RAM" 131 | code_ram = __section_begin("__CODE_RAM"); 132 | code_rom = __section_begin("__CODE_ROM"); 133 | code_rom_end = __section_end("__CODE_ROM"); 134 | 135 | /* BSS */ 136 | bss_start = __section_begin(".bss"); 137 | bss_end = __section_end(".bss"); 138 | 139 | custom_ram = __section_begin(".customSection"); 140 | custom_rom = __section_begin(".customSection_init"); 141 | custom_rom_end = __section_end(".customSection_init"); 142 | 143 | #elif defined (__ARMCC_VERSION) 144 | /* VECTOR TABLE*/ 145 | uint8_t * vector_table_size = (uint8_t *)__RAM_VECTOR_TABLE_SIZE; 146 | uint32_t * vector_rom = (uint32_t *)__VECTOR_ROM; 147 | uint32_t * vector_ram = (uint32_t *)__VECTOR_RAM; 148 | #else 149 | extern uint32_t __DATA_ROM[]; 150 | extern uint32_t __DATA_RAM[]; 151 | extern uint32_t __DATA_END[]; 152 | 153 | extern uint32_t __CODE_RAM[]; 154 | extern uint32_t __CODE_ROM[]; 155 | extern uint32_t __CODE_END[]; 156 | 157 | extern uint32_t __BSS_START[]; 158 | extern uint32_t __BSS_END[]; 159 | 160 | extern uint32_t __CUSTOM_ROM[]; 161 | extern uint32_t __CUSTOM_END[]; 162 | 163 | /* Data */ 164 | data_ram = (uint8_t *)__DATA_RAM; 165 | data_rom = (uint8_t *)__DATA_ROM; 166 | data_rom_end = (uint8_t *)__DATA_END; 167 | /* CODE RAM */ 168 | code_ram = (uint8_t *)__CODE_RAM; 169 | code_rom = (uint8_t *)__CODE_ROM; 170 | code_rom_end = (uint8_t *)__CODE_END; 171 | /* BSS */ 172 | bss_start = (uint8_t *)__BSS_START; 173 | bss_end = (uint8_t *)__BSS_END; 174 | 175 | /* Custom section */ 176 | custom_ram = CUSTOMSECTION_SECTION_START; 177 | custom_rom = (uint8_t *)__CUSTOM_ROM; 178 | custom_rom_end = (uint8_t *)__CUSTOM_END; 179 | 180 | #endif 181 | 182 | #if !defined(__ARMCC_VERSION) 183 | /* Copy initialized data from ROM to RAM */ 184 | while (data_rom_end != data_rom) 185 | { 186 | *data_ram = *data_rom; 187 | data_ram++; 188 | data_rom++; 189 | } 190 | 191 | /* Copy functions from ROM to RAM */ 192 | while (code_rom_end != code_rom) 193 | { 194 | *code_ram = *code_rom; 195 | code_ram++; 196 | code_rom++; 197 | } 198 | 199 | /* Clear the zero-initialized data section */ 200 | while(bss_end != bss_start) 201 | { 202 | *bss_start = 0; 203 | bss_start++; 204 | } 205 | 206 | /* Copy customsection rom to ram */ 207 | while(custom_rom_end != custom_rom) 208 | { 209 | *custom_ram = *custom_rom; 210 | custom_rom++; 211 | custom_ram++; 212 | } 213 | #endif 214 | coreId = (uint8_t)GET_CORE_ID(); 215 | #if defined (__ARMCC_VERSION) 216 | /* Copy the vector table from ROM to RAM */ 217 | /* Workaround */ 218 | for (n = 0; n < (((uint32_t)(vector_table_size))/sizeof(uint32_t)); n++) 219 | { 220 | vector_ram[n] = vector_rom[n]; 221 | } 222 | /* Point the VTOR to the position of vector table */ 223 | *s_vectors[coreId] = (uint32_t) __VECTOR_RAM; 224 | #else 225 | /* Check if VECTOR_TABLE copy is needed */ 226 | if (__VECTOR_RAM != __VECTOR_TABLE) 227 | { 228 | /* Copy the vector table from ROM to RAM */ 229 | for (n = 0; n < (((uint32_t)__RAM_VECTOR_TABLE_SIZE)/sizeof(uint32_t)); n++) 230 | { 231 | __VECTOR_RAM[n] = __VECTOR_TABLE[n]; 232 | } 233 | /* Point the VTOR to the position of vector table */ 234 | *s_vectors[coreId] = (uint32_t)__VECTOR_RAM; 235 | } 236 | else 237 | { 238 | /* Point the VTOR to the position of vector table */ 239 | *s_vectors[coreId] = (uint32_t)__VECTOR_TABLE; 240 | } 241 | #endif 242 | 243 | } 244 | 245 | /******************************************************************************* 246 | * EOF 247 | ******************************************************************************/ 248 | 249 | -------------------------------------------------------------------------------- /SDK/platform/devices/startup.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc. 3 | * Copyright 2016-2017 NXP 4 | * All rights reserved. 5 | * 6 | * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 7 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 8 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 9 | * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 10 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 11 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 12 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 13 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 14 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 15 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 16 | * THE POSSIBILITY OF SUCH DAMAGE. 17 | */ 18 | 19 | #ifndef STARTUP_H 20 | #define STARTUP_H 21 | 22 | #include 23 | #include "device_registers.h" 24 | /** 25 | * @page misra_violations MISRA-C:2012 violations 26 | * 27 | * @section [global] 28 | * Violates MISRA 2012 Advisory Rule 2.5, Local macro not referenced. 29 | * The defined macro is used as include guard. 30 | * 31 | * @section [global] 32 | * Violates MISRA 2012 Advisory Rule 8.9, An object should be defined at block 33 | * scope if its identifier only appears in a single function. 34 | * All variables with this problem are defined in the linker files. 35 | * 36 | */ 37 | 38 | /******************************************************************************* 39 | * API 40 | ******************************************************************************/ 41 | 42 | /*! 43 | * @brief define symbols that specific start and end addres of some basic sections. 44 | */ 45 | #if (defined(S32K14x_SERIES) || defined(S32K11x_SERIES) || defined(S32V234_SERIES) || defined(MPC574x_SERIES) || defined(S32R_SERIES) || defined(S32MTV_SERIES) || defined(SJA1110_SERIES)) 46 | #if (defined(__ICCARM__)) 47 | #define INTERRUPTS_SECTION_START __section_begin(".intvec") 48 | #define INTERRUPTS_SECTION_END __section_end(".intvec") 49 | #define BSS_SECTION_START __section_begin(".bss") 50 | #define BSS_SECTION_END __section_end(".bss") 51 | #define DATA_SECTION_START __section_begin(".data") 52 | #define DATA_SECTION_END __section_end(".data") 53 | #define CUSTOMSECTION_SECTION_START __section_begin(".customSection") 54 | #define CUSTOMSECTION_SECTION_END __section_end(".customSection") 55 | #define CODE_RAM_SECTION_START __section_begin("__CODE_RAM") 56 | #define CODE_RAM_SECTION_END __section_end("__CODE_RAM") 57 | #define DATA_INIT_SECTION_START __section_begin(".data_init") 58 | #define DATA_INIT_SECTION_END __section_end(".data_init") 59 | #define CODE_ROM_SECTION_START __section_begin("__CODE_ROM") 60 | #define CODE_ROM_SECTION_END __section_end("__CODE_ROM") 61 | 62 | #elif (defined(__ARMCC_VERSION)) 63 | #define INTERRUPTS_SECTION_START (uint8_t *)__VECTOR_ROM_START 64 | #define INTERRUPTS_SECTION_END (uint8_t *)__VECTOR_ROM_END 65 | #define BSS_SECTION_START (uint8_t *)__BSS_START 66 | #define BSS_SECTION_END (uint8_t *)__BSS_END 67 | #define DATA_SECTION_START (uint8_t *)__DATA_RAM_START 68 | #define DATA_SECTION_END (uint8_t *)__DATA_RAM_END 69 | #define CUSTOMSECTION_SECTION_START (uint8_t *)__CUSTOM_SECTION_START 70 | #define CUSTOMSECTION_SECTION_END (uint8_t *)__CUSTOM_SECTION_END 71 | #define CODE_RAM_SECTION_START (uint8_t *)__CODE_RAM_START 72 | #define CODE_RAM_SECTION_END (uint8_t *)__CODE_RAM_END 73 | 74 | extern uint32_t __VECTOR_ROM_START; 75 | extern uint32_t __VECTOR_ROM_END; 76 | extern uint32_t __BSS_START; 77 | extern uint32_t __BSS_END; 78 | extern uint32_t __DATA_RAM_START; 79 | extern uint32_t __DATA_RAM_END; 80 | extern uint32_t __CUSTOM_SECTION_START; 81 | extern uint32_t __CUSTOM_SECTION_END; 82 | extern uint32_t __CODE_RAM_START; 83 | extern uint32_t __CODE_RAM_END; 84 | #else 85 | #define INTERRUPTS_SECTION_START (uint8_t *)&__interrupts_start__ 86 | #define INTERRUPTS_SECTION_END (uint8_t *)&__interrupts_end__ 87 | #define BSS_SECTION_START (uint8_t *)&__bss_start__ 88 | #define BSS_SECTION_END (uint8_t *)&__bss_end__ 89 | #define DATA_SECTION_START (uint8_t *)&__data_start__ 90 | #define DATA_SECTION_END (uint8_t *)&__data_end__ 91 | #define CUSTOMSECTION_SECTION_START (uint8_t *)&__customSection_start__ 92 | #define CUSTOMSECTION_SECTION_END (uint8_t *)&__customSection_end__ 93 | #define CODE_RAM_SECTION_START (uint8_t *)&__code_ram_start__ 94 | #define CODE_RAM_SECTION_END (uint8_t *)&__code_ram_end__ 95 | 96 | extern uint32_t __interrupts_start__; 97 | extern uint32_t __interrupts_end__; 98 | extern uint32_t __bss_start__; 99 | extern uint32_t __bss_end__; 100 | extern uint32_t __data_start__; 101 | extern uint32_t __data_end__; 102 | extern uint32_t __customSection_start__; 103 | extern uint32_t __customSection_end__; 104 | extern uint32_t __code_ram_start__; 105 | extern uint32_t __code_ram_end__; 106 | #endif 107 | #endif 108 | 109 | #if (defined(__ICCARM__)) 110 | #pragma section = ".data" 111 | #pragma section = ".data_init" 112 | #pragma section = ".bss" 113 | #pragma section = ".intvec" 114 | #pragma section = ".customSection" 115 | #pragma section = ".customSection_init" 116 | #pragma section = "__CODE_RAM" 117 | #pragma section = "__CODE_ROM" 118 | #endif 119 | 120 | /*! 121 | * @brief Make necessary initializations for RAM. 122 | * 123 | * - Copy initialized data from ROM to RAM. 124 | * - Clear the zero-initialized data section. 125 | * - Copy the vector table from ROM to RAM. This could be an option. 126 | */ 127 | void init_data_bss(void); 128 | 129 | #endif /* STARTUP_H*/ 130 | /******************************************************************************* 131 | * EOF 132 | ******************************************************************************/ 133 | 134 | -------------------------------------------------------------------------------- /SDK/platform/devices/status.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. 3 | * Copyright 2016-2017 NXP 4 | * All rights reserved. 5 | * 6 | * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 7 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 8 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 9 | * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 10 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 11 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 12 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 13 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 14 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 15 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 16 | * THE POSSIBILITY OF SUCH DAMAGE. 17 | */ 18 | 19 | #ifndef STATUS_H 20 | #define STATUS_H 21 | 22 | /** 23 | * @page misra_violations MISRA-C:2012 violations 24 | * 25 | * @section [global] 26 | * Violates MISRA 2012 Advisory Rule 2.3, Global typedef not referenced. 27 | * status_t is referenced from all drivers. 28 | * 29 | * @section [global] 30 | * Violates MISRA 2012 Advisory Rule 2.5, Local macro not referenced. 31 | * The defined macro is used as include guard. 32 | * 33 | */ 34 | 35 | /******************************************************************************* 36 | * Definitions 37 | ******************************************************************************/ 38 | 39 | /*! @brief Status return codes. 40 | * Common error codes will be a unified enumeration (C enum) that will contain all error codes 41 | * (common and specific). There will be separate "error values spaces" (or slots), each of 256 42 | * positions, allocated per functionality. 43 | */ 44 | typedef enum 45 | { 46 | /* Generic error codes */ 47 | STATUS_SUCCESS = 0x000U, /*!< Generic operation success status */ 48 | STATUS_ERROR = 0x001U, /*!< Generic operation failure status */ 49 | STATUS_BUSY = 0x002U, /*!< Generic operation busy status */ 50 | STATUS_TIMEOUT = 0x003U, /*!< Generic operation timeout status */ 51 | STATUS_UNSUPPORTED = 0x004U, /*!< Generic operation unsupported status */ 52 | /* MCU specific error codes */ 53 | STATUS_MCU_GATED_OFF = 0x100U, /*!< Module is gated off */ 54 | STATUS_MCU_TRANSITION_FAILED = 0x101U, /*!< Error occurs during transition. */ 55 | STATUS_MCU_INVALID_STATE = 0x102U, /*!< Unsupported in current state. */ 56 | STATUS_MCU_NOTIFY_BEFORE_ERROR = 0x103U, /*!< Error occurs during send "BEFORE" notification. */ 57 | STATUS_MCU_NOTIFY_AFTER_ERROR = 0x104U, /*!< Error occurs during send "AFTER" notification. */ 58 | /* I2C specific error codes */ 59 | STATUS_I2C_RECEIVED_NACK = 0x200U, /*!< NACK signal received */ 60 | STATUS_I2C_TX_UNDERRUN = 0x201U, /*!< TX underrun error */ 61 | STATUS_I2C_RX_OVERRUN = 0x202U, /*!< RX overrun error */ 62 | STATUS_I2C_ARBITRATION_LOST = 0x203U, /*!< Arbitration lost */ 63 | STATUS_I2C_ABORTED = 0x204U, /*!< A transfer was aborted */ 64 | STATUS_I2C_BUS_BUSY = 0x205U, /*!< I2C bus is busy, cannot start transfer */ 65 | /* CAN specific error codes */ 66 | STATUS_CAN_BUFF_OUT_OF_RANGE = 0x300U, /*!< The specified MB index is out of the configurable range */ 67 | STATUS_CAN_NO_TRANSFER_IN_PROGRESS = 0x301U, /*!< There is no transmission or reception in progress */ 68 | /* Security specific error codes */ 69 | STATUS_SEC_SEQUENCE_ERROR = 0x402U, /*!< The sequence of commands or subcommands is out of 70 | sequence */ 71 | STATUS_SEC_KEY_NOT_AVAILABLE = 0x403U, /*!< A key is locked due to failed boot measurement or 72 | an active debugger */ 73 | STATUS_SEC_KEY_INVALID = 0x404U, /*!< A function is called to perform an operation with 74 | a key that is not allowed for the given operation */ 75 | STATUS_SEC_KEY_EMPTY = 0x405U, /*!< Attempt to use a key that has not been initialized yet */ 76 | STATUS_SEC_NO_SECURE_BOOT = 0x406U, /*!< The conditions for a secure boot process are not met */ 77 | STATUS_SEC_KEY_WRITE_PROTECTED = 0x407U, /*!< Request for updating a write protected key slot, 78 | or activating debugger with write protected key(s) */ 79 | STATUS_SEC_KEY_UPDATE_ERROR = 0x408U, /*!< Key update did not succeed due to errors in 80 | verification of the messages */ 81 | STATUS_SEC_RNG_SEED = 0x409U, /*!< Returned by CMD_RND and CMD_DEBUG if the seed has not 82 | been initialized before */ 83 | STATUS_SEC_NO_DEBUGGING = 0x40AU, /*!< DEBUG command authentication failed */ 84 | STATUS_SEC_MEMORY_FAILURE = 0x40CU, /*!< General memory technology failure 85 | (multibit ECC error, common fault detected) */ 86 | STATUS_SEC_HSM_INTERNAL_MEMORY_ERROR = 0x410U, /*!< An internal memory error encountered while 87 | executing the command */ 88 | STATUS_SEC_INVALID_COMMAND = 0x411U, /*!< Command value out of range */ 89 | STATUS_SEC_TRNG_ERROR = 0x412U, /*!< One or more statistical tests run on the TRNG output failed */ 90 | STATUS_SEC_HSM_FLASH_BLOCK_ERROR = 0x413U, /*!< Error reading, programming or erasing one of the HSM flash blocks */ 91 | STATUS_SEC_INTERNAL_CMD_ERROR = 0x414U, /*!< An internal command processor error while executing a command */ 92 | STATUS_SEC_MAC_LENGTH_ERROR = 0x415U, /*!< MAC/Message length out of range */ 93 | STATUS_SEC_INVALID_ARG = 0x421U, /*!< Invalid command argument */ 94 | STATUS_SEC_TRNG_CLOCK_ERROR = 0x423U, /*!< TRNG not provided with a stable clock */ 95 | /* SPI specific error codes */ 96 | STATUS_SPI_TX_UNDERRUN = 0x500U, /*!< TX underrun error */ 97 | STATUS_SPI_RX_OVERRUN = 0x501U, /*!< RX overrun error */ 98 | STATUS_SPI_ABORTED = 0x502U, /*!< A transfer was aborted */ 99 | /* UART specific error codes */ 100 | STATUS_UART_TX_UNDERRUN = 0x600U, /*!< TX underrun error */ 101 | STATUS_UART_RX_OVERRUN = 0x601U, /*!< RX overrun error */ 102 | STATUS_UART_ABORTED = 0x602U, /*!< A transfer was aborted */ 103 | STATUS_UART_FRAMING_ERROR = 0x603U, /*!< Framing error */ 104 | STATUS_UART_PARITY_ERROR = 0x604U, /*!< Parity error */ 105 | STATUS_UART_NOISE_ERROR = 0x605U, /*!< Noise error */ 106 | /* I2S specific error codes */ 107 | STATUS_I2S_TX_UNDERRUN = 0x700U, /*!< TX underrun error */ 108 | STATUS_I2S_RX_OVERRUN = 0x701U, /*!< RX overrun error */ 109 | STATUS_I2S_ABORTED = 0x702U, /*!< A transfer was aborted */ 110 | /* SBC specific error codes */ 111 | SBC_NVN_ERROR = 0x801U, /*!< Unsuccessful attempt writing to non volatile memory 112 | (0x73 and 0x74). Set device to factory settings. */ 113 | SBC_COMM_ERROR = 0x802U, /*!< Data transfer was aborted */ 114 | SBC_CMD_ERROR = 0x804U, /*!< Wrong command. */ 115 | SBC_ERR_NA = 0x808U, /*!< Feature/device not available */ 116 | SBC_MTPNV_LOCKED = 0x810U, /*!< Unable to write MTPNV cells, NVMPS = 0 */ 117 | 118 | /* FLASH specific error codes */ 119 | STATUS_FLASH_ERROR_ENABLE = 0x901U, /*!< It's impossible to enable an operation */ 120 | STATUS_FLASH_ERROR_NO_BLOCK = 0x902U, /*!< No blocks have been enabled for Array Integrity check */ 121 | STATUS_FLASH_INPROGRESS = 0x903U, /*!< InProgress status */ 122 | 123 | /* SAI specific error codes */ 124 | STATUS_SAI_ABORTED = 0xA00U, /*!< SAI aborted status */ 125 | 126 | /* ENET specific error codes */ 127 | STATUS_ENET_RX_QUEUE_EMPTY = 0xA01U, /*!< There is no available frame in the receive queue */ 128 | STATUS_ENET_TX_QUEUE_FULL = 0xA02U, /*!< There is no available space for the frame in the transmit queue */ 129 | STATUS_ENET_BUFF_NOT_FOUND = 0xA03U, /*!< The specified buffer was not found in the queue */ 130 | 131 | /* FCCU specific error codes */ 132 | STATUS_FCCU_ERROR_CONFIG_TIMEOUT = 0xB01U, /*!< FCCU triggers TimeOut when try to enter in Config State */ 133 | STATUS_FCCU_ERROR_INIT_FCCU = 0xB02U, /*!< FCCU Initializing FCCU Module */ 134 | STATUS_FCCU_ERROR_SET_CONFIG = 0xB03U, /*!< FCCU Fail to Enter in Config Mode */ 135 | STATUS_FCCU_ERROR_SET_NORMAL = 0xB04U, /*!< FCCU Fail to Enter in Normal Mode */ 136 | STATUS_FCCU_ERROR_APPLY_NCF_CONFIG = 0xB05U, /*!< FCCU Fail to set NoCritical Faults */ 137 | STATUS_FCCU_ERROR_UPDATE_FREEZE = 0xB06U, /*!< FCCU Fail to update Freez Status registers */ 138 | STATUS_FCCU_ERROR_CLEAR_FREEZE = 0xB07U, /*!< FCCU Fail to Clear Freez Status registers */ 139 | STATUS_FCCU_ERROR_SET_EOUT = 0xB08U, /*!< FCCU Fail to Set Eout Configuration */ 140 | STATUS_FCCU_ERROR_FAULT_DETECTED = 0xB09U, /*!< FCCU Faults Detected */ 141 | STATUS_FCCU_ERROR_OTHER = 0xB0AU, /*!< FCCU other Error */ 142 | 143 | /* EMIOS specific error codes */ 144 | STATUS_EMIOS_WRONG_MODE = 0xC00U, /*!< EMIOS unsuccessful attempt selecting wrong mode. */ 145 | STATUS_EMIOS_CNT_BUS_OVERFLOW = 0xC01U, /*!< EMIOS counter bus overflow. */ 146 | STATUS_EMIOS_WRONG_CNT_BUS = 0xC02U, /*!< EMIOS unsuccessful attempt selecting wrong counter bus. */ 147 | STATUS_EMIOS_ENABLE_GLOBAL_FRZ = 0xC03U, /*!< EMIOS must set global allow enter debug mode first. */ 148 | 149 | /* EEE specific error codes */ 150 | STATUS_EEE_ERROR_NO_ENOUGH_SPACE = 0xD00U, /*!< The data is too big to fit in any of the block */ 151 | STATUS_EEE_ERROR_NO_ENOUGH_BLOCK = 0xD01U, /*!< The block numbers is not enough for round robin */ 152 | STATUS_EEE_ERROR_DATA_NOT_FOUND = 0xD02U, /*!< The required data is not found in the EEPROM emulation */ 153 | STATUS_EEE_ERROR_NOT_IN_CACHE = 0xD03U, /*!< The required data is not in the cache table */ 154 | STATUS_EEE_ERROR_PROGRAM_INDICATOR = 0xD04U, /*!< Failed to make block indicator to non-blank for several times */ 155 | STATUS_EEE_HVOP_INPROGRESS = 0xD05U, /*!< The high voltage operation is in progress */ 156 | 157 | /* uSDHC specific error codes */ 158 | STATUS_USDHC_OUT_OF_RANGE = 0xE00U, /*!< The size of data to be sent is larger than maximum size of ADMA table */ 159 | STATUS_USDHC_PREPARE_ADMA_FAILED = 0xE01U, /*!< Failed to prepare the ADMA table */ 160 | 161 | /* TDM specific error codes */ 162 | STATUS_TDM_DIARY_FULL = 0xF01U, /*!< No empty flash left in diary region */ 163 | 164 | /* PHY specific error codes */ 165 | STATUS_PHY_ACCESS_FAILED = 0x1001U, /*!< Could not access PHY registers */ 166 | STATUS_PHY_INCOMPATIBLE_DEVICE = 0x1002U /*!< The selected PHY driver is not compatible with the device */ 167 | } status_t; 168 | 169 | #endif /* STATUS_H */ 170 | 171 | /******************************************************************************* 172 | * EOF 173 | ******************************************************************************/ 174 | -------------------------------------------------------------------------------- /SDK/platform/drivers/inc/clock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 - 2015, Freescale Semiconductor, Inc. 3 | * Copyright 2016-2017 NXP 4 | * All rights reserved. 5 | * 6 | * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 7 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 8 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 9 | * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 10 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 11 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 12 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 13 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 14 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 15 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 16 | * THE POSSIBILITY OF SUCH DAMAGE. 17 | */ 18 | 19 | #if !defined(CLOCK_H) 20 | #define CLOCK_H 21 | 22 | #include "device_registers.h" 23 | #include "status.h" 24 | 25 | /* 26 | * Include the cpu specific clock API header files. 27 | */ 28 | 29 | #if (defined(S32K14x_SERIES) || defined(S32K11x_SERIES)) 30 | /* S32K144 Clock System Level API header file */ 31 | #include "../src/clock/S32K1xx/clock_S32K1xx.h" 32 | #elif (defined(S32MTV_SERIES)) 33 | /* S32MTV Clock System Level API header file */ 34 | #include "../src/clock/S32Mxx/clock_S32Mxx.h" 35 | #elif (defined(MPC5777C_SERIES)) 36 | /* MPC5777C Clock System Level API header file */ 37 | #include "../src/clock/MPC5777C/clock_MPC5777C.c" 38 | #elif (defined(MPC574x_SERIES) || defined(S32R_SERIES)) 39 | /* MPC574x Clock System Level API header file */ 40 | #include "../src/clock/MPC57xx/clock_MPC57xx.h" 41 | #elif (defined(S32S247_SERIES)) 42 | /* S32S247 Clock System Level API header file */ 43 | #include "../src/clock/S32Sxx/clock_S32Sxx.h" 44 | #elif (defined(SJA1110_SERIES)) 45 | /* SJA1110 Clock System Level API header file */ 46 | #include "../src/clock/SJA1110x/clock_SJA1110x.h" 47 | #elif (defined(S32V234_SERIES)) 48 | /* S32Vxx Clock System Level API header file */ 49 | #include "../src/clock/S32Vxx/clock_S32Vxx.h" 50 | #else 51 | #error "No valid CPU defined!" 52 | #endif 53 | 54 | /*! 55 | * @file clock.h 56 | */ 57 | 58 | /*! @addtogroup clock*/ 59 | /*! @{*/ 60 | 61 | /******************************************************************************* 62 | * Definitions 63 | ******************************************************************************/ 64 | 65 | 66 | #if defined(__cplusplus) 67 | extern "C" { 68 | #endif /* __cplusplus*/ 69 | 70 | /******************************************************************************* 71 | * API 72 | ******************************************************************************/ 73 | 74 | /*! 75 | * @name Dynamic clock setting 76 | * @{ 77 | */ 78 | 79 | /******************************************************************************* 80 | * API 81 | ******************************************************************************/ 82 | 83 | /*! 84 | * @brief Gets the clock frequency for a specific clock name. 85 | * 86 | * This function checks the current clock configurations and then calculates 87 | * the clock frequency for a specific clock name defined in clock_names_t. 88 | * Clock modules must be properly configured before using this function. 89 | * See features.h for supported clock names for different chip families. 90 | * The returned value is in Hertz. If it cannot find the clock name 91 | * or the name is not supported for a specific chip family, it returns an 92 | * STATUS_UNSUPPORTED. If frequency is required for a peripheral and the 93 | * module is not clocked, then STATUS_MCU_GATED_OFF status is returned. 94 | * Frequency is returned if a valid address is provided. If frequency is 95 | * required for a peripheral that doesn't support protocol clock, the zero 96 | * value is provided. 97 | * 98 | * @param[in] clockName Clock names defined in clock_names_t 99 | * @param[out] frequency Returned clock frequency value in Hertz 100 | * @return status Error code defined in status_t 101 | */ 102 | status_t CLOCK_DRV_GetFreq(clock_names_t clockName, 103 | uint32_t *frequency); 104 | 105 | 106 | /*! 107 | * @brief Set clock configuration according to pre-defined structure. 108 | * 109 | * This function sets system to target clock configuration; It sets the 110 | * clock modules registers for clock mode change. 111 | * 112 | * @param[in] config Pointer to configuration structure. 113 | * 114 | * @return Error code. 115 | * 116 | * @note If external clock is used in the target mode, please make sure it is 117 | * enabled, for example, if the external oscillator is used, please setup correctly. 118 | * 119 | * @note If the configuration structure is NULL, the function will set a default 120 | * configuration for clock. 121 | */ 122 | status_t CLOCK_DRV_Init(clock_user_config_t const * config); 123 | 124 | /*! @} */ 125 | 126 | 127 | #if defined(__cplusplus) 128 | } 129 | #endif /* __cplusplus*/ 130 | 131 | /*! @}*/ 132 | 133 | #endif /* CLOCK_H */ 134 | /******************************************************************************* 135 | * EOF 136 | ******************************************************************************/ 137 | 138 | -------------------------------------------------------------------------------- /SDK/platform/drivers/inc/clock_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 - 2015, Freescale Semiconductor, Inc. 3 | * Copyright 2016-2018 NXP 4 | * All rights reserved. 5 | * 6 | * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 7 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 8 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 9 | * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 10 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 11 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 12 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 13 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 14 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 15 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 16 | * THE POSSIBILITY OF SUCH DAMAGE. 17 | */ 18 | #if !defined(CLOCK_MANAGER_H) 19 | #define CLOCK_MANAGER_H 20 | #include "clock.h" 21 | /*! 22 | * @file clock_manager.h 23 | * 24 | * @page misra_violations MISRA-C:2012 violations 25 | * 26 | * @section [global] 27 | * Violates MISRA 2012 Advisory Rule 2.5, Global macro not referenced. 28 | * This header file is included by application only. It was created 29 | * for backward compatibility reasons. 30 | */ 31 | #endif /* CLOCK_MANAGER_H */ 32 | /******************************************************************************* 33 | * EOF 34 | ******************************************************************************/ 35 | -------------------------------------------------------------------------------- /SDK/platform/drivers/inc/flash_driver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerFalls/UDS_S32K144_FlashDriver/cd5289c1df01f55d19ab565eebd82d6800d8b9bd/SDK/platform/drivers/inc/flash_driver.h -------------------------------------------------------------------------------- /SDK/platform/drivers/inc/interrupt_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 - 2016, Freescale Semiconductor, Inc. 3 | * Copyright 2016-2017 NXP 4 | * All rights reserved. 5 | * 6 | * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 7 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 8 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 9 | * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 10 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 11 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 12 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 13 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 14 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 15 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 16 | * THE POSSIBILITY OF SUCH DAMAGE. 17 | */ 18 | #if !defined(INTERRUPT_MANAGER_H) 19 | #define INTERRUPT_MANAGER_H 20 | 21 | #include "device_registers.h" 22 | 23 | 24 | /** 25 | * @page misra_violations MISRA-C:2012 violations 26 | * 27 | * 28 | * @section [global] 29 | * Violates MISRA 2012 Required Rule 11.6, A cast shall not be performed 30 | * between pointer to void and an arithmetic type. 31 | * The address of hardware modules is provided as integer so 32 | * it needs to be cast to pointer. 33 | * 34 | * @section [global] 35 | * Violates MISRA 2012 Advisory Rule 11.4, A conversion should not be performed 36 | * between a pointer to object and an integer type. 37 | * The address of hardware modules is provided as integer so 38 | * a conversion between a pointer and an integer has to be performed. 39 | */ 40 | 41 | /*! @file interrupt_manager.h */ 42 | 43 | /*! @addtogroup interrupt_manager*/ 44 | /*! @{*/ 45 | 46 | /******************************************************************************* 47 | * Definitions 48 | ******************************************************************************/ 49 | 50 | #if FEATURE_MSCM_HAS_CPU_INTERRUPT_ROUTER 51 | 52 | /*! @brief The target for directed CPU interrupts */ 53 | typedef enum 54 | { 55 | INTERRUPT_MANAGER_TARGET_SELF = -2, 56 | INTERRUPT_MANAGER_TARGET_OTHERS = -1, 57 | INTERRUPT_MANAGER_TARGET_NONE = 0, 58 | INTERRUPT_MANAGER_TARGET_CP0 = 1, 59 | INTERRUPT_MANAGER_TARGET_CP1 = 2, 60 | INTERRUPT_MANAGER_TARGET_CP0_CP1 = 3 61 | } interrupt_manager_cpu_targets_t; 62 | 63 | #endif /* FEATURE_MSCM_HAS_CPU_INTERRUPT_ROUTER */ 64 | 65 | #if FEATURE_INTERRUPT_MULTICORE_SUPPORT 66 | 67 | /*! @brief Interrupt enabled on core 68 | * Implements : interrupt_core_enable_t_Class 69 | */ 70 | typedef enum 71 | { 72 | INTERRUPT_CORE_DISABLED = 0U, 73 | INTERRUPT_CORE_ENABLED = 1U 74 | } interrupt_core_enable_t; 75 | 76 | #endif /* FEATURE_INTERRUPT_MULTICORE_SUPPORT */ 77 | 78 | /*! @brief Interrupt handler type */ 79 | typedef void (* isr_t)(void); 80 | 81 | /******************************************************************************* 82 | * Default interrupt handler - implemented in startup.s 83 | ******************************************************************************/ 84 | /*! @brief Default ISR. */ 85 | void DefaultISR(void); 86 | 87 | /******************************************************************************* 88 | * API 89 | ******************************************************************************/ 90 | 91 | #if defined(__cplusplus) 92 | extern "C" { 93 | #endif /* __cplusplus*/ 94 | 95 | /*! @name Interrupt manager APIs*/ 96 | /*@{*/ 97 | 98 | /*! 99 | * @brief Installs an interrupt handler routine for a given IRQ number. 100 | * 101 | * This function lets the application register/replace the interrupt 102 | * handler for a specified IRQ number. See a chip-specific reference 103 | * manual for details and the startup_.s file for each chip 104 | * family to find out the default interrupt handler for each device. 105 | * 106 | * @note This method is applicable only if interrupt vector is copied in RAM. 107 | * 108 | * @param irqNumber IRQ number 109 | * @param newHandler New interrupt handler routine address pointer 110 | * @param oldHandler Pointer to a location to store current interrupt handler 111 | */ 112 | void INT_SYS_InstallHandler(IRQn_Type irqNumber, 113 | const isr_t newHandler, 114 | isr_t* const oldHandler); 115 | 116 | /*! 117 | * @brief Enables an interrupt for a given IRQ number. 118 | * 119 | * This function enables the individual interrupt for a specified IRQ number. 120 | * 121 | * @param irqNumber IRQ number 122 | */ 123 | void INT_SYS_EnableIRQ(IRQn_Type irqNumber); 124 | 125 | /*! 126 | * @brief Disables an interrupt for a given IRQ number. 127 | * 128 | * This function disables the individual interrupt for a specified IRQ number. 129 | * 130 | * @param irqNumber IRQ number 131 | */ 132 | void INT_SYS_DisableIRQ(IRQn_Type irqNumber); 133 | 134 | /*! 135 | * @brief Enables system interrupt. 136 | * 137 | * This function enables the global interrupt by calling the core API. 138 | * 139 | */ 140 | void INT_SYS_EnableIRQGlobal(void); 141 | 142 | /*! 143 | * @brief Disable system interrupt. 144 | * 145 | * This function disables the global interrupt by calling the core API. 146 | * 147 | */ 148 | void INT_SYS_DisableIRQGlobal(void); 149 | 150 | /*! @brief Set Interrupt Priority 151 | * 152 | * The function sets the priority of an interrupt. 153 | * 154 | * @param irqNumber Interrupt number. 155 | * @param priority Priority to set. 156 | */ 157 | void INT_SYS_SetPriority(IRQn_Type irqNumber, uint8_t priority); 158 | 159 | /*! @brief Get Interrupt Priority 160 | * 161 | * The function gets the priority of an interrupt. 162 | * 163 | * @param irqNumber Interrupt number. 164 | * @return priority Priority of the interrupt. 165 | */ 166 | uint8_t INT_SYS_GetPriority(IRQn_Type irqNumber); 167 | 168 | #if FEATURE_INTERRUPT_HAS_PENDING_STATE 169 | /*! 170 | * @brief Clear Pending Interrupt 171 | * 172 | * The function clears the pending bit of a peripheral interrupt 173 | * or a directed interrupt to this CPU (if available). 174 | * 175 | * @param irqNumber IRQ number 176 | */ 177 | void INT_SYS_ClearPending(IRQn_Type irqNumber); 178 | 179 | /*! 180 | * @brief Set Pending Interrupt 181 | * 182 | * The function configures the pending bit of a peripheral interrupt. 183 | * 184 | * @param irqNumber IRQ number 185 | */ 186 | void INT_SYS_SetPending(IRQn_Type irqNumber); 187 | 188 | /*! 189 | * @brief Get Pending Interrupt 190 | * 191 | * The function gets the pending bit of a peripheral interrupt 192 | * or a directed interrupt to this CPU (if available). 193 | * 194 | * @param irqNumber IRQ number 195 | * @return pending Pending status 0/1 196 | */ 197 | uint32_t INT_SYS_GetPending(IRQn_Type irqNumber); 198 | 199 | #endif /* FEATURE_INTERRUPT_HAS_PENDING_STATE */ 200 | 201 | #if FEATURE_INTERRUPT_HAS_ACTIVE_STATE 202 | /*! 203 | * @brief Get Active Interrupt 204 | * 205 | * The function gets the active state of a peripheral interrupt. 206 | * 207 | * @param irqNumber IRQ number 208 | * @return active Active status 0/1 209 | */ 210 | uint32_t INT_SYS_GetActive(IRQn_Type irqNumber); 211 | 212 | #endif /* FEATURE_INTERRUPT_HAS_ACTIVE_STATE */ 213 | 214 | #if FEATURE_INTERRUPT_HAS_SOFTWARE_IRQ 215 | 216 | /*! 217 | * @brief Set software interrupt request 218 | * 219 | * The function sets a software settable interrupt request. 220 | * 221 | * @param irqNumber IRQ number 222 | */ 223 | void INT_SYS_SetSoftwareIRQRequest(IRQn_Type irqNumber); 224 | 225 | /*! 226 | * @brief Clear software interrupt request 227 | * 228 | * The function clears a software settable interrupt request. 229 | * 230 | * @param irqNumber IRQ number 231 | */ 232 | void INT_SYS_ClearSoftwareIRQRequest(IRQn_Type irqNumber); 233 | 234 | #endif /* FEATURE_INTERRUPT_HAS_SOFTWARE_IRQ */ 235 | 236 | 237 | #if FEATURE_INTERRUPT_MULTICORE_SUPPORT 238 | 239 | /*! 240 | * @brief Enables an interrupt for a given IRQ number, on the given cores. 241 | * 242 | * This function enables the individual interrupt for a specified IRQ number, 243 | * and on the specified cores. 244 | * 245 | * @param irqNumber IRQ number 246 | * @param coresIds array with the cores ids for which to enable the interrupt 247 | * @param coresCnt the number of cores in the coresIds array 248 | */ 249 | void INT_SYS_EnableIRQ_MC(IRQn_Type irqNumber, const uint8_t *coresIds, uint8_t coresCnt); 250 | 251 | /*! 252 | * @brief Gets the cores on which an interrupt for the specified IRQ 253 | * number is enabled. 254 | * 255 | * This function will populate an array with all the supported cores, 256 | * for which the value will be INTERRUPT_CORE_ENABLED if interrupt is enabled 257 | * on that core, and INTERRUPT_CORE_DISABLED if interrupt is not enabled on 258 | * that core. The array has to be previously allocated using the 259 | * NUMBER_OF_CORES define value. 260 | * 261 | * @param irqNumber IRQ number 262 | * @param cores array with array index as core number; it has to be previously 263 | * allocated using the NUMBER_OF_CORES define value. it will be populated with the 264 | * following value: 265 | * - INTERRUPT_CORE_DISABLED interrupt disabled for that core 266 | * - INTERRUPT_CORE_ENABLED enabled for that core 267 | */ 268 | void INT_SYS_GetCoresForIRQ(IRQn_Type irqNumber, interrupt_core_enable_t *cores); 269 | 270 | /*! 271 | * @brief Disables an interrupt for a given IRQ number, on the given cores. 272 | * 273 | * This function disables the individual interrupt for a specified IRQ number, 274 | * and on the specified cores. 275 | * 276 | * @param irqNumber IRQ number 277 | * @param coresIds array with the cores ids for which to enable the interrupt 278 | * @param coresCnt the number of cores in the coresIds array 279 | */ 280 | void INT_SYS_DisableIRQ_MC(IRQn_Type irqNumber, const uint8_t *coresIds, uint8_t coresCnt); 281 | 282 | /*! 283 | * @brief Disables an interrupt for a given IRQ number, on all cores. 284 | * 285 | * This function disables the individual interrupt for a specified IRQ number, 286 | * on all cores. It also clears priority for that IRQ number 287 | * 288 | * @param irqNumber IRQ number 289 | */ 290 | void INT_SYS_DisableIRQ_MC_All(IRQn_Type irqNumber); 291 | 292 | #endif /* FEATURE_INTERRUPT_MULTICORE_SUPPORT */ 293 | 294 | 295 | #if FEATURE_MSCM_HAS_CPU_INTERRUPT_ROUTER 296 | 297 | /*! 298 | * @brief Generate Directed CPU Interrupt 299 | * 300 | * The function generates a directed interrupt to (one or more) CPUs defined by target. 301 | * 302 | * @param irqNumber IRQ number 303 | * @param cpu_target Target CPUs for the directed interrupt 304 | */ 305 | void INT_SYS_GenerateDirectedCpuInterrupt(IRQn_Type irqNumber, interrupt_manager_cpu_targets_t cpu_target); 306 | 307 | #endif /* FEATURE_MSCM_HAS_CPU_INTERRUPT_ROUTER */ 308 | 309 | /*@}*/ 310 | 311 | #if defined(__cplusplus) 312 | } 313 | #endif /* __cplusplus*/ 314 | 315 | /*! @}*/ 316 | 317 | #endif /* INTERRUPT_MANAGER_H */ 318 | /******************************************************************************* 319 | * EOF 320 | ******************************************************************************/ 321 | -------------------------------------------------------------------------------- /SDK/platform/drivers/src/clock/S32K1xx/pcc_hw_access.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc. 3 | * Copyright 2016 NXP 4 | * All rights reserved. 5 | * 6 | * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 7 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 8 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 9 | * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 10 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 11 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 12 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 13 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 14 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 15 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 16 | * THE POSSIBILITY OF SUCH DAMAGE. 17 | */ 18 | 19 | #if !defined(PCC_HW_ACCESS_H) 20 | #define PCC_HW_ACCESS_H 21 | 22 | #include "device_registers.h" 23 | #include 24 | #include 25 | 26 | /*! 27 | * @file pcc_hw_access.h 28 | * 29 | * @page misra_violations MISRA-C:2012 violations 30 | * 31 | */ 32 | 33 | /*! 34 | * @ingroup pcc_hw_access 35 | * @defgroup pcc_hw_access 36 | * @{ 37 | */ 38 | 39 | 40 | /*! @brief Clock name mappings 41 | * Constant array storing the mappings between clock names and peripheral clock control indexes. 42 | * If there is no peripheral clock control index for a clock name, then the corresponding value is 43 | * PCC_INVALID_INDEX. 44 | */ 45 | extern const uint16_t clockNameMappings[CLOCK_NAME_COUNT]; 46 | 47 | #if defined(__cplusplus) 48 | extern "C" { 49 | #endif /* __cplusplus*/ 50 | 51 | 52 | /*! 53 | * @brief Sets SOSC control register 54 | * 55 | * @param[in] base pcc base pointer 56 | * @param[in] monitorMode clock monitor enablement 57 | * @param[in] clockGate control register can be written or not 58 | */ 59 | static inline void PCC_SetPeripheralClockControl(PCC_Type* base, clock_names_t clockName, bool clockGate, uint32_t clockSource, uint32_t divider, uint32_t multiplier) 60 | { 61 | /* Configure the peripheral clock source, the fractional clock divider and the clock gate */ 62 | uint32_t value = PCC_PCCn_PCS(clockSource) | 63 | PCC_PCCn_FRAC(multiplier) | 64 | PCC_PCCn_PCD(divider) | 65 | PCC_PCCn_CGC(clockGate ? 1UL : 0UL ); 66 | 67 | base->PCCn[clockNameMappings[clockName]] = value; 68 | } 69 | 70 | /*! 71 | * @brief Enables/disables the clock for a given peripheral. 72 | * For example, to enable the ADC0 clock, use like this: 73 | * @code 74 | * PCC_SetClockMode(PCC, PCC_ADC0_CLOCK, true); 75 | * @endcode 76 | * 77 | * @param[in] base pcc base pointer 78 | * @param[in] clockName is the name of the peripheral clock 79 | * must be one of the following values (see the clock_names_t type from S32K144_clock_names.h) 80 | * PCC_DMA0_CLOCK 81 | * PCC_MPU0_CLOCK 82 | * ... 83 | * PCC_LPUART3_CLOCK 84 | * @param[in] isClockEnabled is the value of the command that enables/disables the clock 85 | */ 86 | static inline void PCC_SetClockMode(PCC_Type* const base, 87 | const clock_names_t clockName, 88 | const bool isClockEnabled) 89 | { 90 | if (isClockEnabled) 91 | { 92 | base->PCCn[clockNameMappings[clockName]] |= PCC_PCCn_CGC(1UL); 93 | } 94 | else 95 | { 96 | base->PCCn[clockNameMappings[clockName]] &= (uint32_t)(~(PCC_PCCn_CGC_MASK)); 97 | } 98 | } 99 | 100 | 101 | 102 | /*! 103 | * @brief Gets the clock gate control mode. 104 | * 105 | * @param[in] base pcc base pointer 106 | * @param[in] clockName is the name of the peripheral clock 107 | * must be one of the following values (see the clock_names_t type from S32K144_clock_names.h) 108 | * PCC_DMA0_CLOCK 109 | * PCC_MPU0_CLOCK 110 | * ... 111 | * PCC_LPUART3_CLOCK 112 | * @return the clock gate control mode 113 | * - false : Clock is disabled 114 | * - true : Clock is enabled 115 | */ 116 | static inline bool PCC_GetClockMode(const PCC_Type* const base, 117 | const clock_names_t clockName) 118 | { 119 | uint32_t regValue = (uint32_t)base->PCCn[clockNameMappings[clockName]]; 120 | regValue = (regValue & PCC_PCCn_CGC_MASK) >> PCC_PCCn_CGC_SHIFT; 121 | return (regValue == 0U) ? false : true; 122 | } 123 | 124 | /*! 125 | * @brief Gets the selection of a clock source for a specific peripheral 126 | * 127 | * @param[in] base pcc base pointer 128 | * @param[in] clockName is the name of the peripheral clock 129 | * must be one of the following values (see the clock_names_t type from S32K144_clock_names.h) 130 | * PCC_DMA0_CLOCK 131 | * PCC_MPU0_CLOCK 132 | * ... 133 | * PCC_LPUART3_CLOCK 134 | * @return the clock source 135 | */ 136 | static inline uint32_t PCC_GetClockSourceSel(const PCC_Type* const base, 137 | const clock_names_t clockName) 138 | { 139 | return ((base->PCCn[clockNameMappings[clockName]] & PCC_PCCn_PCS_MASK) >> PCC_PCCn_PCS_SHIFT); 140 | } 141 | 142 | /*! 143 | * @brief Gets the selection of the fractional value for a specific peripheral 144 | * 145 | * @param[in] base pcc base pointer 146 | * @param[in] clockName is the name of the peripheral clock 147 | * must be one of the following values (see the clock_names_t type from S32K144_clock_names.h) 148 | * PCC_DMA0_CLOCK 149 | * PCC_MPU0_CLOCK 150 | * ... 151 | * PCC_LPUART3_CLOCK 152 | * @return the fractional value 153 | * - PCC_MULTPCCnLY_BY_ONE : Fractional value is zero 154 | * - PCC_MULTPCCnLY_BY_TWO : Fractional value is one 155 | */ 156 | static inline uint32_t PCC_GetFracValueSel(const PCC_Type* const base, 157 | const clock_names_t clockName) 158 | { 159 | return ((base->PCCn[clockNameMappings[clockName]] & PCC_PCCn_FRAC_MASK) >> PCC_PCCn_FRAC_SHIFT); 160 | } 161 | 162 | /*! 163 | * @brief Gets the selection of the divider value for a specific peripheral 164 | * 165 | * @param[in] base pcc base pointer 166 | * @param[in] clockName is the name of the peripheral clock 167 | * must be one of the following values (see the clock_names_t type from S32K144_clock_names.h) 168 | * PCC_DMA0_CLOCK 169 | * PCC_MPU0_CLOCK 170 | * ... 171 | * PCC_LPUART3_CLOCK 172 | * @return the divider value 173 | * - PCC_DIVIDE_BY_ONE : Divide by 1 174 | * - PCC_DIVIDE_BY_TWO : Divide by 2 175 | * - PCC_DIVIDE_BY_THREE : Divide by 3 176 | * - PCC_DIVIDE_BY_FOUR : Divide by 4 177 | * - PCC_DIVIDE_BY_FIVE : Divide by 5 178 | * - PCC_DIVIDE_BY_SIX : Divide by 6 179 | * - PCC_DIVIDE_BY_SEVEN : Divide by 7 180 | * - PCC_DIVIDE_BY_EIGTH : Divide by 8 181 | */ 182 | static inline uint32_t PCC_GetDividerSel(const PCC_Type* const base, 183 | const clock_names_t clockName) 184 | { 185 | return ((base->PCCn[clockNameMappings[clockName]] & PCC_PCCn_PCD_MASK) >> PCC_PCCn_PCD_SHIFT); 186 | } 187 | 188 | 189 | 190 | 191 | 192 | #if defined(__cplusplus) 193 | } 194 | #endif /* __cplusplus*/ 195 | 196 | 197 | /*! @}*/ 198 | 199 | #endif /* PCC_HW_ACCESS_H */ 200 | /******************************************************************************* 201 | * EOF 202 | ******************************************************************************/ 203 | 204 | -------------------------------------------------------------------------------- /SDK/platform/drivers/src/clock/S32K1xx/pmc_hw_access.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc. 3 | * Copyright 2016 NXP 4 | * All rights reserved. 5 | * 6 | * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 7 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 8 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 9 | * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 10 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 11 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 12 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 13 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 14 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 15 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 16 | * THE POSSIBILITY OF SUCH DAMAGE. 17 | */ 18 | 19 | #if !defined(PMC_HW_ACCESS_H) 20 | #define PMC_HW_ACCESS_H 21 | 22 | #include "device_registers.h" 23 | #include 24 | #include 25 | 26 | /*! 27 | * @file pmc_hw_access.h 28 | * 29 | * @page misra_violations MISRA-C:2012 violations 30 | * 31 | */ 32 | 33 | /*! 34 | * @ingroup pmc_hw_access 35 | * @defgroup pmc_hw_access 36 | * @{ 37 | */ 38 | 39 | 40 | #if defined(__cplusplus) 41 | extern "C" { 42 | #endif /* __cplusplus*/ 43 | 44 | 45 | /*! 46 | * @brief Enables/Disables the Low Power Oscillator. 47 | * 48 | * This function enables/disables the Low Power Oscillator. 49 | * 50 | * @param[in] baseAddr Base address for current PMC instance. 51 | * @param[in] enable enable/disable the Low Power Oscillator. 52 | */ 53 | static inline void PMC_SetLpoMode(PMC_Type* const baseAddr, const bool enable) 54 | { 55 | uint8_t regValue = baseAddr->REGSC; 56 | regValue &= (uint8_t)(~(PMC_REGSC_LPODIS_MASK)); 57 | regValue |= (uint8_t)PMC_REGSC_LPODIS(enable?0U:1U); 58 | baseAddr->REGSC = regValue; 59 | } 60 | 61 | /*! 62 | * @brief Gets the Low Power Oscillator status. 63 | * 64 | * This function gets the Low Power Oscillator status. 65 | * 66 | * @param[in] baseAddr Base address for current PMC instance. 67 | * @return value LPO status 68 | * false - LPO is disabled 69 | * true - LPO is enabled 70 | */ 71 | static inline bool PMC_GetLpoMode(const PMC_Type * const baseAddr) 72 | { 73 | uint8_t regValue = baseAddr->REGSC; 74 | regValue = (uint8_t)((regValue & PMC_REGSC_LPODIS_MASK) >> PMC_REGSC_LPODIS_SHIFT); 75 | return (regValue == 0U) ? true : false; 76 | } 77 | 78 | 79 | /*! 80 | * @brief Low Power Oscillator Trimming Value 81 | * 82 | * This function sets the trimming value for the low power oscillator 83 | * 84 | * @param[in] baseAddr Base address for current PMC instance. 85 | * @param[in] value Trimming value 86 | */ 87 | static inline void PMC_SetLpoTrimValue(PMC_Type* const baseAddr, const int8_t decimalValue) 88 | { 89 | int8_t decValue = decimalValue; 90 | uint8_t lpotrim, trimval, regValue; 91 | 92 | if (decValue < 0) 93 | { 94 | lpotrim = ((uint8_t)1U) << (PMC_LPOTRIM_LPOTRIM_WIDTH); 95 | decValue = (int8_t)(decValue + (int8_t)(lpotrim)); 96 | } 97 | trimval = (uint8_t)decValue; 98 | 99 | DEV_ASSERT(trimval <= (1U << PMC_LPOTRIM_LPOTRIM_WIDTH)); 100 | 101 | regValue = baseAddr->LPOTRIM; 102 | regValue &= (uint8_t)(~(PMC_LPOTRIM_LPOTRIM_MASK)); 103 | regValue |= (uint8_t)PMC_LPOTRIM_LPOTRIM(trimval); 104 | baseAddr->LPOTRIM = regValue; 105 | } 106 | 107 | 108 | #if defined(__cplusplus) 109 | } 110 | #endif /* __cplusplus*/ 111 | 112 | 113 | /*! @}*/ 114 | 115 | #endif /* PMC_HW_ACCESS_H */ 116 | /******************************************************************************* 117 | * EOF 118 | ******************************************************************************/ 119 | 120 | -------------------------------------------------------------------------------- /SDK/platform/drivers/src/clock/S32K1xx/smc_hw_access.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc. 3 | * Copyright 2016 NXP 4 | * All rights reserved. 5 | * 6 | * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 7 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 8 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 9 | * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 10 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 11 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 12 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 13 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 14 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 15 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 16 | * THE POSSIBILITY OF SUCH DAMAGE. 17 | */ 18 | 19 | #if !defined(SMC_HW_ACCESS_H) 20 | #define SMC_HW_ACCESS_H 21 | 22 | #include "device_registers.h" 23 | #include 24 | #include 25 | 26 | /*! 27 | * @file smc_hw_access.h 28 | * 29 | * @page misra_violations MISRA-C:2012 violations 30 | * 31 | */ 32 | 33 | /*! 34 | * @ingroup smc_hw_access 35 | * @defgroup smc_hw_access 36 | * @{ 37 | */ 38 | 39 | 40 | #if defined(__cplusplus) 41 | extern "C" { 42 | #endif /* __cplusplus*/ 43 | 44 | 45 | /*! 46 | * @brief Gets the current running power mode. 47 | * 48 | * This function returns the current running power mode. 49 | * 50 | * @param[in] baseAddr Base address for current SMC instance. 51 | * @return stat Current power mode stat 52 | */ 53 | static inline uint32_t SMC_GetCurrentRunningMode(const SMC_Type* const baseAddr) 54 | { 55 | return (baseAddr->PMSTAT & SMC_PMSTAT_PMSTAT_MASK) >> SMC_PMSTAT_PMSTAT_SHIFT; 56 | } 57 | 58 | 59 | #if defined(__cplusplus) 60 | } 61 | #endif /* __cplusplus*/ 62 | 63 | 64 | /*! @}*/ 65 | 66 | #endif /* SMC_HW_ACCESS_H */ 67 | /******************************************************************************* 68 | * EOF 69 | ******************************************************************************/ 70 | 71 | -------------------------------------------------------------------------------- /SDK/platform/drivers/src/pins/pins_gpio_hw_access.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 - 2015, Freescale Semiconductor, Inc. 3 | * Copyright 2016-2017 NXP 4 | * All rights reserved. 5 | * 6 | * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 7 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 8 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 9 | * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 10 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 11 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 12 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 13 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 14 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 15 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 16 | * THE POSSIBILITY OF SUCH DAMAGE. 17 | */ 18 | 19 | #ifndef PINS_GPIO_HW_ACCESS_H 20 | #define PINS_GPIO_HW_ACCESS_H 21 | 22 | #include "pins_driver.h" 23 | 24 | /*! @file */ 25 | 26 | /** 27 | * @page misra_violations MISRA-C:2012 violations 28 | * 29 | * @section [global] 30 | * Violates MISRA 2012 Advisory Rule 2.5, Local macro not referenced. 31 | * The defined macro is used as include guard. 32 | * 33 | */ 34 | 35 | /*! 36 | * pins_gpio_hw_access 37 | * @{ 38 | */ 39 | 40 | /******************************************************************************* 41 | * API 42 | ******************************************************************************/ 43 | 44 | #if defined(__cplusplus) 45 | extern "C" { 46 | #endif 47 | 48 | /*! 49 | * @name GPIO 50 | * General GPIO functions. 51 | */ 52 | /*! @{*/ 53 | 54 | #if defined(FEATURE_PINS_DRIVER_USING_PORT) 55 | /*! 56 | * @brief Get the pins directions configuration for a port 57 | * 58 | * This function returns the current pins directions for a port. Pins 59 | * corresponding to bits with value of '1' are configured as output and 60 | * pins corresponding to bits with value of '0' are configured as input. 61 | * 62 | * @param base GPIO base pointer (PTA, PTB, PTC, etc.) 63 | * @return GPIO directions. Each bit represents one pin (LSB is pin 0, MSB is 64 | * pin 31). For each bit: 65 | * - 0: corresponding pin is set to input 66 | * - 1: corresponding pin is set to output 67 | */ 68 | static inline pins_channel_type_t PINS_GPIO_GetPinsDirection(const GPIO_Type * const base) 69 | { 70 | return (pins_channel_type_t)base->PDDR; 71 | } 72 | 73 | /*! 74 | * @brief Configure the direction for a certain pin from a port 75 | * 76 | * This function configures the direction for the given pin, with the 77 | * given value('1' for pin to be configured as output and '0' for pin to 78 | * be configured as input) 79 | * 80 | * @param base GPIO base pointer (PTA, PTB, PTC, etc.) 81 | * @param pin the pin number for which to configure the direction 82 | * @param direction the pin direction: 83 | * - 0: corresponding pin is set to input 84 | * - 1: corresponding pin is set to output 85 | */ 86 | static inline void PINS_GPIO_SetPinDirection(GPIO_Type * const base, 87 | pins_channel_type_t pin, 88 | pins_level_type_t direction) 89 | { 90 | pins_channel_type_t pinsDirections = (pins_channel_type_t)base->PDDR; 91 | pinsDirections &= (pins_channel_type_t)(~((pins_channel_type_t)1U << pin)); 92 | pinsDirections |= (pins_channel_type_t)((pins_channel_type_t)direction << pin); 93 | base->PDDR = GPIO_PDDR_PDD(pinsDirections); 94 | } 95 | 96 | /*! 97 | * @brief Set the pins directions configuration for a port 98 | * 99 | * This function sets the direction configuration for all pins 100 | * in a port. Pins corresponding to bits with value of '1' will be configured as 101 | * output and pins corresponding to bits with value of '0' will be configured as 102 | * input. 103 | * 104 | * @param base GPIO base pointer (PTA, PTB, PTC, etc.) 105 | * @param pins pin mask where each bit represents one pin (LSB 106 | * is pin 0, MSB is pin 31). For each bit: 107 | * - 0: corresponding pin is set to input 108 | * - 1: corresponding pin is set to output 109 | */ 110 | static inline void PINS_GPIO_SetPinsDirection(GPIO_Type * const base, 111 | pins_channel_type_t pins) 112 | { 113 | base->PDDR = GPIO_PDDR_PDD(pins); 114 | } 115 | 116 | #if FEATURE_PORT_HAS_INPUT_DISABLE 117 | /*! 118 | * @brief Set the pins input disable state for a port 119 | * 120 | * This function sets the pins input state for a port. 121 | * Pins corresponding to bits with value of '1' will not be configured 122 | * as input and pins corresponding to bits with value of '0' will be configured 123 | * as input. 124 | * 125 | * @param base GPIO base pointer (PTA, PTB, PTC, etc.) 126 | * @param pins pin mask where each bit represents one pin (LSB is pin 0, MSB is 127 | * pin 31). For each bit: 128 | * - 0: corresponding pin is set to input 129 | * - 1: corresponding pin is not set to input 130 | */ 131 | static inline void PINS_GPIO_SetPortInputDisable(GPIO_Type * const base, 132 | pins_channel_type_t pins) 133 | { 134 | base->PIDR = GPIO_PIDR_PID(pins); 135 | } 136 | 137 | /*! 138 | * @brief Get the pins input disable state for a port 139 | * 140 | * This function returns the current pins input state for a port. Pins 141 | * corresponding to bits with value of '1' are not configured as input and 142 | * pins corresponding to bits with value of '0' are configured as input. 143 | * 144 | * @param base GPIO base pointer (PTA, PTB, PTC, etc.) 145 | * @return GPIO input state. Each bit represents one pin (LSB is pin 0, MSB is 146 | * pin 31). For each bit: 147 | * - 0: corresponding pin is set to input 148 | * - 1: corresponding pin is not set to input 149 | */ 150 | static inline pins_channel_type_t PINS_GPIO_GetPortInputDisable(const GPIO_Type * const base) 151 | { 152 | return (pins_channel_type_t)base->PIDR; 153 | } 154 | #endif /* FEATURE_PORT_HAS_INPUT_DISABLE */ 155 | 156 | #elif defined(FEATURE_PINS_DRIVER_USING_SIUL2) 157 | /* Reverse bit order in each halfword independently */ 158 | static inline uint16_t REV_BIT_16(uint16_t value) 159 | { 160 | uint8_t i; 161 | uint16_t ret = 0U; 162 | 163 | for (i = 0U; i < 8U; i++) 164 | { 165 | ret |= (uint16_t)((((value >> i) & 1U) << (15U - i)) | (((value << i) & 0x8000U) >> (15U - i))); 166 | } 167 | 168 | return ret; 169 | } 170 | 171 | #endif /* if defined(FEATURE_PINS_DRIVER_USING_PORT) */ 172 | 173 | /*! 174 | * @brief Write a pin of a port with a given value 175 | * 176 | * This function writes the given pin from a port, with the given value 177 | * ('0' represents LOW, '1' represents HIGH). 178 | * 179 | * @param base GPIO base pointer (PTA, PTB, PTC, etc.) 180 | * @param pin pin number to be written 181 | * @param value pin value to be written 182 | * - 0: corresponding pin is set to LOW 183 | * - 1: corresponding pin is set to HIGH 184 | */ 185 | static inline void PINS_GPIO_WritePin(GPIO_Type * const base, 186 | pins_channel_type_t pin, 187 | pins_level_type_t value) 188 | { 189 | #if defined(FEATURE_PINS_DRIVER_USING_PORT) 190 | pins_channel_type_t pinsValues = (pins_channel_type_t)base->PDOR; 191 | pinsValues &= (pins_channel_type_t)(~((pins_channel_type_t)1U << pin)); 192 | pinsValues |= (pins_channel_type_t)((pins_channel_type_t)value << pin); 193 | base->PDOR = GPIO_PDOR_PDO(pinsValues); 194 | #elif defined(FEATURE_PINS_DRIVER_USING_SIUL2) 195 | pins_channel_type_t pinsValues = (pins_channel_type_t)base->PGPDO; 196 | pinsValues &= (pins_channel_type_t)(~((pins_channel_type_t)1U << (15U - pin))); 197 | pinsValues |= (pins_channel_type_t)((pins_channel_type_t)value << (15U - pin)); 198 | base->PGPDO = pinsValues; 199 | #endif /* if defined(FEATURE_PINS_DRIVER_USING_PORT) */ 200 | } 201 | 202 | /*! 203 | * @brief Write all pins of a port 204 | * 205 | * This function writes all pins configured as output with the values given in 206 | * the parameter pins. '0' represents LOW, '1' represents HIGH. 207 | * 208 | * @param base GPIO base pointer (PTA, PTB, PTC, etc.) 209 | * @param pins pin mask to be written 210 | * - 0: corresponding pin is set to LOW 211 | * - 1: corresponding pin is set to HIGH 212 | */ 213 | static inline void PINS_GPIO_WritePins(GPIO_Type * const base, 214 | pins_channel_type_t pins) 215 | { 216 | #if defined(FEATURE_PINS_DRIVER_USING_PORT) 217 | base->PDOR = GPIO_PDOR_PDO(pins); 218 | #elif defined(FEATURE_PINS_DRIVER_USING_SIUL2) 219 | base->PGPDO = REV_BIT_16(pins); 220 | #endif /* if defined(FEATURE_PINS_DRIVER_USING_PORT) */ 221 | } 222 | 223 | /*! 224 | * @brief Get the current output from a port 225 | * 226 | * This function returns the current output that is written to a port. Only pins 227 | * that are configured as output will have meaningful values. 228 | * 229 | * @param base GPIO base pointer (PTA, PTB, PTC, etc.) 230 | * @return GPIO outputs. Each bit represents one pin (LSB is pin 0, MSB is pin 231 | * 31). For each bit: 232 | * - 0: corresponding pin is set to LOW 233 | * - 1: corresponding pin is set to HIGH 234 | */ 235 | static inline pins_channel_type_t PINS_GPIO_GetPinsOutput(const GPIO_Type * const base) 236 | { 237 | pins_channel_type_t returnValue = 0U; 238 | 239 | #if defined(FEATURE_PINS_DRIVER_USING_PORT) 240 | returnValue = (pins_channel_type_t)(base->PDOR); 241 | #elif defined(FEATURE_PINS_DRIVER_USING_SIUL2) 242 | returnValue = (pins_channel_type_t)REV_BIT_16(base->PGPDO); 243 | #endif /* if defined(FEATURE_PINS_DRIVER_USING_PORT) */ 244 | 245 | return returnValue; 246 | } 247 | 248 | /*! 249 | * @brief Write pins with 'Set' value 250 | * 251 | * This function configures output pins listed in parameter pins (bits that are 252 | * '1') to have a value of 'set' (HIGH). Pins corresponding to '0' will be 253 | * unaffected. 254 | * 255 | * @param base GPIO base pointer (PTA, PTB, PTC, etc.) 256 | * @param pins pin mask of bits to be set. Each bit represents one pin (LSB is 257 | * pin 0, MSB is pin 31). For each bit: 258 | * - 0: corresponding pin is unaffected 259 | * - 1: corresponding pin is set to HIGH 260 | */ 261 | static inline void PINS_GPIO_SetPins(GPIO_Type * const base, 262 | pins_channel_type_t pins) 263 | { 264 | #if defined(FEATURE_PINS_DRIVER_USING_PORT) 265 | base->PSOR = GPIO_PSOR_PTSO(pins); 266 | #elif defined(FEATURE_PINS_DRIVER_USING_SIUL2) 267 | base->PGPDO |= REV_BIT_16(pins); 268 | #endif /* if defined(FEATURE_PINS_DRIVER_USING_PORT) */ 269 | } 270 | 271 | /*! 272 | * @brief Write pins to 'Clear' value 273 | * 274 | * This function configures output pins listed in parameter pins (bits that are 275 | * '1') to have a 'cleared' value (LOW). Pins corresponding to '0' will be 276 | * unaffected. 277 | * 278 | * @param base GPIO base pointer (PTA, PTB, PTC, etc.) 279 | * @param pins pin mask of bits to be cleared. Each bit represents one pin (LSB 280 | * is pin 0, MSB is pin 31). For each bit: 281 | * - 0: corresponding pin is unaffected 282 | * - 1: corresponding pin is cleared(set to LOW) 283 | */ 284 | static inline void PINS_GPIO_ClearPins(GPIO_Type * const base, 285 | pins_channel_type_t pins) 286 | { 287 | #if defined(FEATURE_PINS_DRIVER_USING_PORT) 288 | base->PCOR = GPIO_PCOR_PTCO(pins); 289 | #elif defined(FEATURE_PINS_DRIVER_USING_SIUL2) 290 | base->PGPDO &= (pins_channel_type_t)(~REV_BIT_16(pins)); 291 | #endif /* if defined(FEATURE_PINS_DRIVER_USING_PORT) */ 292 | } 293 | 294 | /*! 295 | * @brief Toggle pins value 296 | * 297 | * This function toggles output pins listed in parameter pins (bits that are 298 | * '1'). Pins corresponding to '0' will be unaffected. 299 | * 300 | * @param base GPIO base pointer (PTA, PTB, PTC, etc.) 301 | * @param pins pin mask of bits to be toggled. Each bit represents one pin (LSB 302 | * is pin 0, MSB is pin 31). For each bit: 303 | * - 0: corresponding pin is unaffected 304 | * - 1: corresponding pin is toggled 305 | */ 306 | static inline void PINS_GPIO_TogglePins(GPIO_Type * const base, 307 | pins_channel_type_t pins) 308 | { 309 | #if defined(FEATURE_PINS_DRIVER_USING_PORT) 310 | base->PTOR = GPIO_PTOR_PTTO(pins); 311 | #elif defined(FEATURE_PINS_DRIVER_USING_SIUL2) 312 | base->PGPDO ^= REV_BIT_16(pins); 313 | #endif /* if defined(FEATURE_PINS_DRIVER_USING_PORT) */ 314 | } 315 | 316 | /*! 317 | * @brief Read input pins 318 | * 319 | * This function returns the current input values from a port. Only pins 320 | * configured as input will have meaningful values. 321 | * 322 | * @param base GPIO base pointer (PTA, PTB, PTC, etc.) 323 | * @return GPIO inputs. Each bit represents one pin (LSB is pin 0, MSB is pin 324 | * 31). For each bit: 325 | * - 0: corresponding pin is read as LOW 326 | * - 1: corresponding pin is read as HIGH 327 | */ 328 | static inline pins_channel_type_t PINS_GPIO_ReadPins(const GPIO_Type * const base) 329 | { 330 | pins_channel_type_t returnValue = 0U; 331 | 332 | #if defined(FEATURE_PINS_DRIVER_USING_PORT) 333 | returnValue = (pins_channel_type_t)(base->PDIR); 334 | #elif defined(FEATURE_PINS_DRIVER_USING_SIUL2) 335 | returnValue = (pins_channel_type_t)REV_BIT_16(base->PGPDI); 336 | #endif /* if defined(FEATURE_PINS_DRIVER_USING_PORT) */ 337 | 338 | return returnValue; 339 | } 340 | 341 | /*! @} */ 342 | 343 | #if defined(__cplusplus) 344 | } 345 | #endif 346 | 347 | /*! @} */ 348 | 349 | #endif /* PINS_GPIO_HW_ACCESS_H*/ 350 | /******************************************************************************* 351 | * EOF 352 | ******************************************************************************/ 353 | -------------------------------------------------------------------------------- /SDK/platform/drivers/src/pins/pins_port_hw_access.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 NXP 3 | * All rights reserved. 4 | * 5 | * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 6 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 7 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 8 | * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 9 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 10 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 11 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 12 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 13 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 14 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 15 | * THE POSSIBILITY OF SUCH DAMAGE. 16 | */ 17 | 18 | #ifndef PINS_PORT_HW_ACCESS_H 19 | #define PINS_PORT_HW_ACCESS_H 20 | 21 | #include "pins_driver.h" 22 | 23 | /** 24 | * @page misra_violations MISRA-C:2012 violations 25 | * 26 | * @section [global] 27 | * Violates MISRA 2012 Required Rule 10.3, The value of an expression 28 | * shall not be assigned to an object with a narrower essential type or of a 29 | * different essential type category. 30 | * The cast is required to perform a conversion between an unsigned integer 31 | * and an enum type with many values. 32 | * 33 | * @section [global] 34 | * Violates MISRA 2012 Advisory Rule 10.5, Impermissible cast; cannot cast from 35 | * 'essentially unsigned' type to 'essentially enum'. 36 | * This is required by the conversion of a bit-field of a register into a enum type. 37 | * 38 | * @section [global] 39 | * Violates MISRA 2012 Advisory Rule 10.5, Impermissible cast; cannot cast from 40 | * 'essentially unsigned' type to 'essentially Boolean'. 41 | * This is required by the conversion of a bit into a bool type. 42 | * 43 | */ 44 | 45 | /*! 46 | * @defgroup port_hal Port Control and Interrupts (PORT) 47 | * @ingroup pins_driver 48 | * @brief This module covers the functionality of the PORT peripheral. 49 | *

50 | * PORT HAL provides the API for reading and writing register bit-fields belonging to the PORT module. 51 | *

52 | * @{ 53 | */ 54 | 55 | /******************************************************************************* 56 | * Definitions 57 | ******************************************************************************/ 58 | /******************************************************************************* 59 | * API 60 | ******************************************************************************/ 61 | 62 | #if defined(__cplusplus) 63 | extern "C" { 64 | #endif 65 | 66 | /*! 67 | * @name Configuration 68 | * @{ 69 | */ 70 | 71 | /*! 72 | * @brief Initializes the pins with the given configuration structure 73 | * 74 | * This function configures the pins with the options provided in the 75 | * given structure. 76 | * 77 | * @param[in] config the configuration structure 78 | */ 79 | void PINS_Init(const pin_settings_config_t * config); 80 | 81 | #if FEATURE_PINS_HAS_PULL_SELECTION 82 | /*! 83 | * @brief Configures the internal resistor. 84 | * 85 | * Pull configuration is valid in all digital pin muxing modes. 86 | * 87 | * @param[in] base port base pointer. 88 | * @param[in] pin port pin number 89 | * @param[in] pullConfig internal resistor pull feature selection 90 | * - PORT_PULL_NOT_ENABLED: internal pull-down or pull-up resistor is not enabled. 91 | * - PORT_PULL_DOWN_ENABLED: internal pull-down resistor is enabled. 92 | * - PORT_PULL_UP_ENABLED: internal pull-up resistor is enabled. 93 | */ 94 | static inline void PINS_SetPullSel(PORT_Type * const base, 95 | uint32_t pin, 96 | port_pull_config_t pullConfig) 97 | { 98 | DEV_ASSERT(pin < PORT_PCR_COUNT); 99 | switch (pullConfig) 100 | { 101 | case PORT_INTERNAL_PULL_NOT_ENABLED: 102 | { 103 | base->PCR[pin] &= ~(PORT_PCR_PE_MASK); 104 | } 105 | break; 106 | case PORT_INTERNAL_PULL_DOWN_ENABLED: 107 | { 108 | uint32_t regValue = base->PCR[pin]; 109 | regValue &= ~(PORT_PCR_PS_MASK); 110 | regValue |= PORT_PCR_PE(1U); 111 | base->PCR[pin] = regValue; 112 | } 113 | break; 114 | case PORT_INTERNAL_PULL_UP_ENABLED: 115 | { 116 | uint32_t regValue = base->PCR[pin]; 117 | regValue |= PORT_PCR_PE(1U); 118 | regValue |= PORT_PCR_PS(1U); 119 | base->PCR[pin] = regValue; 120 | } 121 | break; 122 | default: 123 | /* invalid command */ 124 | DEV_ASSERT(false); 125 | break; 126 | } 127 | } 128 | 129 | #endif /* if FEATURE_PINS_HAS_PULL_SELECTION */ 130 | 131 | /*! 132 | * @brief Configures the pin muxing. 133 | * 134 | * @param[in] base port base pointer 135 | * @param[in] pin port pin number 136 | * @param[in] mux pin muxing slot selection 137 | * - PORT_PIN_DISABLED: Pin disabled. 138 | * - PORT_MUX_AS_GPIO : Set as GPIO. 139 | * - PORT_MUX_ADC_INTERLEAVE : For ADC interleaved 140 | * - others : chip-specific. 141 | */ 142 | void PINS_SetMuxModeSel(PORT_Type * const base, 143 | uint32_t pin, 144 | port_mux_t mux); 145 | 146 | /*! 147 | * @brief Configures the port pin interrupt/DMA request. 148 | * 149 | * @param[in] base port base pointer. 150 | * @param[in] pin port pin number 151 | * @param[in] intConfig interrupt configuration 152 | * - PORT_INT_DISABLED : Interrupt/DMA request disabled. 153 | * - PORT_DMA_RISING_EDGE : DMA request on rising edge. 154 | * - PORT_DMA_FALLING_EDGE : DMA request on falling edge. 155 | * - PORT_DMA_EITHER_EDGE : DMA request on either edge. 156 | * - PORT_FLAG_RISING_EDGE : Flag sets on rising edge only. 157 | * - PORT_FLAG_FALLING_EDGE: Flag sets on falling edge only. 158 | * - PORT_FLAG_EITHER_EDGE : Flag sets on either edge only. 159 | * - PORT_INT_LOGIC_ZERO : Interrupt when logic zero. 160 | * - PORT_INT_RISING_EDGE : Interrupt on rising edge. 161 | * - PORT_INT_FALLING_EDGE : Interrupt on falling edge. 162 | * - PORT_INT_EITHER_EDGE : Interrupt on either edge. 163 | * - PORT_INT_LOGIC_ONE : Interrupt when logic one. 164 | * - PORT_HIGH_TRIGGER_OUT : Enable active high trigger output, flag is disabled. 165 | * - PORT_LOW_TRIGGER_OUT : Enable active low trigger output, flag is disabled. 166 | */ 167 | static inline void PINS_SetPinIntSel(PORT_Type * const base, 168 | uint32_t pin, 169 | port_interrupt_config_t intConfig) 170 | { 171 | DEV_ASSERT(pin < PORT_PCR_COUNT); 172 | uint32_t regValue = base->PCR[pin]; 173 | regValue &= ~(PORT_PCR_IRQC_MASK); 174 | regValue |= PORT_PCR_IRQC(intConfig); 175 | base->PCR[pin] = regValue; 176 | } 177 | 178 | /*! 179 | * @brief Gets the current port pin interrupt/DMA request configuration. 180 | * 181 | * @param[in] base port base pointer 182 | * @param[in] pin port pin number 183 | * @return interrupt configuration 184 | * - PORT_INT_DISABLED : Interrupt/DMA request disabled. 185 | * - PORT_DMA_RISING_EDGE : DMA request on rising edge. 186 | * - PORT_DMA_FALLING_EDGE : DMA request on falling edge. 187 | * - PORT_DMA_EITHER_EDGE : DMA request on either edge. 188 | * - PORT_FLAG_RISING_EDGE : Flag sets on rising edge only. 189 | * - PORT_FLAG_FALLING_EDGE: Flag sets on falling edge only. 190 | * - PORT_FLAG_EITHER_EDGE : Flag sets on either edge only. 191 | * - PORT_INT_LOGIC_ZERO : Interrupt when logic zero. 192 | * - PORT_INT_RISING_EDGE : Interrupt on rising edge. 193 | * - PORT_INT_FALLING_EDGE : Interrupt on falling edge. 194 | * - PORT_INT_EITHER_EDGE : Interrupt on either edge. 195 | * - PORT_INT_LOGIC_ONE : Interrupt when logic one. 196 | * - PORT_HIGH_TRIGGER_OUT : Enable active high trigger output, flag is disabled. 197 | * - PORT_LOW_TRIGGER_OUT : Enable active low trigger output, flag is disabled. 198 | */ 199 | static inline port_interrupt_config_t PINS_GetPinIntSel(const PORT_Type * const base, 200 | uint32_t pin) 201 | { 202 | DEV_ASSERT(pin < PORT_PCR_COUNT); 203 | uint32_t regValue = base->PCR[pin]; 204 | regValue = (regValue & PORT_PCR_IRQC_MASK) >> PORT_PCR_IRQC_SHIFT; 205 | 206 | return (port_interrupt_config_t)regValue; 207 | } 208 | 209 | /*! 210 | * @brief Clears the individual pin-interrupt status flag. 211 | * 212 | * @param[in] base port base pointer 213 | * @param[in] pin port pin number 214 | */ 215 | static inline void PINS_ClearPinIntFlagCmd(PORT_Type * const base, 216 | uint32_t pin) 217 | { 218 | DEV_ASSERT(pin < PORT_PCR_COUNT); 219 | uint32_t regValue = base->PCR[pin]; 220 | regValue &= ~(PORT_PCR_ISF_MASK); 221 | regValue |= PORT_PCR_ISF(1U); 222 | base->PCR[pin] = regValue; 223 | } 224 | 225 | /*! 226 | * @brief Enables digital filter for digital pin muxing 227 | * 228 | * @param[in] base port base pointer 229 | * @param[in] pin port pin number 230 | */ 231 | static inline void PINS_EnableDigitalFilter(PORT_Type * const base, 232 | uint32_t pin) 233 | { 234 | DEV_ASSERT(pin < PORT_PCR_COUNT); 235 | base->DFER |= (uint32_t)1U << pin; 236 | } 237 | 238 | /*! 239 | * @brief Disables digital filter for digital pin muxing 240 | * 241 | * @param[in] base port base pointer 242 | * @param[in] pin port pin number 243 | */ 244 | static inline void PINS_DisableDigitalFilter(PORT_Type * const base, 245 | uint32_t pin) 246 | { 247 | DEV_ASSERT(pin < PORT_PCR_COUNT); 248 | base->DFER &= ~((uint32_t)1U << pin); 249 | } 250 | 251 | /*! 252 | * @brief Configures digital filter clock for port with given configuration 253 | * 254 | * @param[in] base port base pointer 255 | * @param[in] config configuration struct 256 | */ 257 | static inline void PINS_ConfigDigitalFilter(PORT_Type * const base, 258 | const port_digital_filter_config_t * const config) 259 | { 260 | DEV_ASSERT(config->width <= PORT_DFWR_FILT_MASK); 261 | base->DFCR = PORT_DFCR_CS(config->clock); 262 | base->DFWR = PORT_DFWR_FILT(config->width); 263 | } 264 | 265 | /*! 266 | * @brief Reads the entire port interrupt status flag. 267 | * 268 | * @param[in] base port base pointer 269 | * @return all 32 pin interrupt status flags. For specific bit: 270 | * - 0: interrupt is not detected. 271 | * - 1: interrupt is detected. 272 | */ 273 | static inline uint32_t PINS_GetPortIntFlag(const PORT_Type * const base) 274 | { 275 | uint32_t regValue = base->ISFR; 276 | 277 | return regValue; 278 | } 279 | 280 | /*! 281 | * @brief Clears the entire port interrupt status flag. 282 | * 283 | * @param[in] base port base pointer 284 | */ 285 | static inline void PINS_ClearPortIntFlagCmd(PORT_Type * const base) 286 | { 287 | base->ISFR = PORT_ISFR_ISF_MASK; 288 | } 289 | 290 | /*! 291 | * @brief Quickly configures multiple pins with the same pin configuration. 292 | * 293 | * @param[in] base port base pointer 294 | * @param[in] pins pin mask where each bit represents one pin 295 | * @param[in] value the config value will be updated for the pins are set to '1' 296 | * @param[in] halfPort the lower or upper half of pin registers at the same port 297 | */ 298 | void PINS_SetGlobalPinControl(PORT_Type * const base, 299 | uint16_t pins, 300 | uint16_t value, 301 | port_global_control_pins_t halfPort); 302 | 303 | /*! 304 | * @brief Quickly configures multiple pins with the same interrupt configuration. 305 | * 306 | * @param[in] base port base pointer 307 | * @param[in] pins pin mask where each bit represents one pin 308 | * @param[in] value the config value will be updated for the pins are set to '1' 309 | * @param[in] halfPort the lower or upper half of pin registers at the same port 310 | */ 311 | void PINS_SetGlobalIntControl(PORT_Type * const base, 312 | uint16_t pins, 313 | uint16_t value, 314 | port_global_control_pins_t halfPort); 315 | 316 | 317 | #if FEATURE_PINS_HAS_OVER_CURRENT 318 | /*! 319 | * @brief Reads the entire over current port interrupt status flag. 320 | * 321 | * @param[in] base port base pointer 322 | * @return all 32 pin interrupt status flags. For specific bit: 323 | * - 0: interrupt is not detected. 324 | * - 1: interrupt is detected. 325 | */ 326 | static inline uint32_t PINS_GetOverCurPortIntFlag(const PORT_Type * const base) 327 | { 328 | return ((uint32_t)(base->OCFR)); 329 | } 330 | 331 | /*! 332 | * @brief Clears the entire over current port interrupt status flag. 333 | * 334 | * @param[in] base port base pointer 335 | */ 336 | static inline void PINS_ClearOverCurPortIntFlag(PORT_Type * const base) 337 | { 338 | base->ISFR = PORT_OCFR_OCF_MASK; 339 | } 340 | #endif /* FEATURE_PINS_HAS_OVER_CURRENT */ 341 | 342 | /*! @} */ 343 | 344 | /*! @} */ 345 | 346 | #if defined(__cplusplus) 347 | } 348 | #endif 349 | 350 | /*! @} */ 351 | 352 | #endif /* PINS_PORT_HW_ACCESS_H */ 353 | /******************************************************************************* 354 | * EOF 355 | ******************************************************************************/ 356 | -------------------------------------------------------------------------------- /Sources/NVM_Flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerFalls/UDS_S32K144_FlashDriver/cd5289c1df01f55d19ab565eebd82d6800d8b9bd/Sources/NVM_Flash.c -------------------------------------------------------------------------------- /Sources/NVM_Flash.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerFalls/UDS_S32K144_FlashDriver/cd5289c1df01f55d19ab565eebd82d6800d8b9bd/Sources/NVM_Flash.h -------------------------------------------------------------------------------- /Sources/main.c: -------------------------------------------------------------------------------- 1 | /* ################################################################### 2 | ** Filename : main.c 3 | ** Processor : S32K1xx 4 | ** Abstract : 5 | ** Main module. 6 | ** This module contains user's application code. 7 | ** Settings : 8 | ** Contents : 9 | ** No public methods 10 | ** 11 | ** ###################################################################*/ 12 | /*! 13 | ** @file main.c 14 | ** @version 01.00 15 | ** @brief 16 | ** Main module. 17 | ** This module contains user's application code. 18 | */ 19 | /*! 20 | ** @addtogroup main_module main module documentation 21 | ** @{ 22 | */ 23 | /* MODULE main */ 24 | 25 | /* Including necessary module. Cpu.h contains other modules needed for compiling.*/ 26 | #include "Cpu.h" 27 | #include "NVM_Flash.h" 28 | 29 | volatile int exit_code = 0; 30 | 31 | /* User includes (#include below this line is not maintained by Processor Expert) */ 32 | 33 | /*! 34 | \brief The main function for the project. 35 | \details The startup initialization sequence is the following: 36 | * - startup asm routine 37 | * - main() 38 | */ 39 | int main(void) 40 | { 41 | /* Write your local variable definition here */ 42 | /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ 43 | #ifdef PEX_RTOS_INIT 44 | PEX_RTOS_INIT(); /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */ 45 | #endif 46 | /*** End of Processor Expert internal initialization. ***/ 47 | /* Write your code here */ 48 | NVM_TestFlashDriver(); 49 | /* For example: for(;;) { } */ 50 | /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ 51 | /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/ 52 | #ifdef PEX_RTOS_START 53 | PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */ 54 | #endif 55 | /*** End of RTOS startup code. ***/ 56 | /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ 57 | for(;;) { 58 | if(exit_code != 0) { 59 | break; 60 | } 61 | } 62 | return exit_code; 63 | /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ 64 | } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/ 65 | 66 | /* END main */ 67 | /*! 68 | ** @} 69 | */ 70 | /* 71 | ** ################################################################### 72 | ** 73 | ** This file was created by Processor Expert 10.1 [05.21] 74 | ** for the NXP S32K series of microcontrollers. 75 | ** 76 | ** ################################################################### 77 | */ 78 | -------------------------------------------------------------------------------- /Sources/一键格式化所有代码(包括子目录)_精简版.bat: -------------------------------------------------------------------------------- 1 | for /R %%f in (*.c;*.h) do AStyle.exe -A1 -s4 -xV -S -w -Y -M60 -f -p -xg -H -xe -k3 -W3 -xb -j -xf -xh -c -xC200 -n -v %%f 2 | pause -------------------------------------------------------------------------------- /UDS_S32K144_FlashDriverExtracted.hex: -------------------------------------------------------------------------------- 1 | :020000041FFFDC 2 | :10800000110000004901000065020000B1030000FA 3 | :1080100080B588B000AFF860B9607A6000237B82D9 4 | :108020007B68BB61FB689B687B61BA687B699A422D 5 | :1080300010D3FB68DA687B691A44BB689A4209D995 6 | :10804000BA687B69D31A03F50003BB604FF4006381 7 | :10805000FB611BE0FB681B687B61BA687B699A4225 8 | :108060000ED3FB685A687B691A44BB689A4207D9E9 9 | :10807000BA687B69D31ABB604FF48053FB6105E09B 10 | :1080800001237B820023BB610023FB61FB695A1E35 11 | :10809000BB691340002B49D001237B8246E0294B6A 12 | :1080A0001B78DBB25BB2002B02DB02237B823DE05C 13 | :1080B000244B70221A70234B0922DA71214ABB68C3 14 | :1080C0001B0CDBB293711F4ABB681B0ADBB25371F6 15 | :1080D0001C4BBA68D2B21A7100237B82194A194B21 16 | :1080E0001B78DBB263F07F03DBB2137007E0FB6841 17 | :1080F0009B69B3F1FF3F02D0FB689B699847114B26 18 | :108100001B78DBB25BB2002BF1DA0E4B1B78DBB2D3 19 | :1081100003F07103002B01D001237B82BA69FB6954 20 | :10812000D31ABB61BA68FB691344BB60BB69002BFF 21 | :1081300002D07B8A002BB2D07B8A18462037BD46FE 22 | :1081400080BD00BF0000024080B586B000AFF8607F 23 | :10815000B96011461A460B46FB8013467B7100231B 24 | :108160007B82FB689B687B61BA687B699A420DD30E 25 | :10817000FB68DA687B691A44BB689A4206D9BA6818 26 | :108180007B69D31A03F50003BB6014E0FB681B682E 27 | :108190007B61BA687B699A420BD3FB685A687B693A 28 | :1081A0001A44BB689A4204D9BA687B69D31ABB6087 29 | :1081B00001E001237B827B8A002B4BD1284B1B786B 30 | :1081C000DBB25BB2002B02DB02237B8242E0244B5A 31 | :1081D00070221A70224B0122DA71214ABB681B0CF3 32 | :1081E000DBB293711E4ABB681B0ADBB253711C4B96 33 | :1081F000BA68D2B21A711A4AFB881B0A9BB2DBB268 34 | :10820000D372174BFA88D2B29A72154A7B7953729D 35 | :1082100000237B82124A124B1B78DBB263F07F0390 36 | :10822000DBB2137007E0FB689B69B3F1FF3F02D03C 37 | :10823000FB689B6998470A4B1B78DBB25BB2002B4B 38 | :10824000F1DA074B1B78DBB203F07103002B01D08E 39 | :1082500001237B827B8A18461837BD4680BD00BF4C 40 | :108260000000024080B588B000AFF860B9607A6065 41 | :108270003B600023FB827B6803F00703002B02D0E6 42 | :108280000123FB828BE0FB689B68BB61BA68BB691A 43 | :108290009A420DD3FB68DA68BB691A44BB689A42FC 44 | :1082A00006D9BA68BB69D31A03F50003BB6014E0B2 45 | :1082B000FB681B68BB61BA68BB699A420BD3FB6859 46 | :1082C0005A68BB691A44BB689A4204D9BA68BB6948 47 | :1082D000D31ABB6001E00123FB825AE0324B1B78CA 48 | :1082E000DBB25BB2002B02DB0223FB8251E02E4BA0 49 | :1082F00070221A702C4B0722DA712B4ABB681B0CB8 50 | :10830000DBB29371284ABB681B0ADBB25371264B60 51 | :10831000BA68D2B21A710023FB770CE0FA7F234BC4 52 | :108320001344BB61BB69FA7F39680A4412781A703A 53 | :10833000FB7F0133FB77FB7F072BEFD90023FB8209 54 | :10834000194A194B1B78DBB263F07F03DBB2137061 55 | :1083500007E0FB689B69B3F1FF3F02D0FB689B69B4 56 | :108360009847114B1B78DBB25BB2002BF1DA0E4B56 57 | :108370001B78DBB203F07103002B01D00123FB82D9 58 | :10838000BB680833BB607B68083B7B603B68083395 59 | :108390003B607B68002B02D0FB8A002B9ED0FB8ABF 60 | :1083A00018462037BD4680BD00000240080002404C 61 | :1083B00080B58AB000AFF860B9607A603B60002396 62 | :1083C000FB827B6803F00303002B02D00123FB82B6 63 | :1083D000A8E07B683B62FB689B687B62BA687B6A4B 64 | :1083E0009A420DD3FB68DA687B6A1A44BB689A42EA 65 | :1083F00006D9BA687B6AD31A03F50003BB6016E09E 66 | :10840000FB681B687B62BA687B6A9A420BD3FB6885 67 | :108410005A687B6A1A44BB689A4204D9BA687B6A74 68 | :10842000D31ABB6003E00123FB8200233B6273E0AD 69 | :108430003F4B1B78DBB25BB2002B02DB0223FB82DB 70 | :108440006AE03B4B70221A70394B0222DA71384ACB 71 | :10845000BB681B0CDBB29371354ABB681B0ADBB2ED 72 | :108460005371334BBA68D2B21A71314A97F834302B 73 | :10847000D3720023FB770CE0FA7F2E4B1344BB61D1 74 | :10848000BB69FA7F39680A4412781A70FB7F01339E 75 | :10849000FB77FB7F032BEFD90023FB82244A244B7D 76 | :1084A0001B78DBB263F07F03DBB2137007E0FB687D 77 | :1084B0009B69B3F1FF3F02D0FB689B6998471C4B57 78 | :1084C0001B78DBB25BB2002BF1DA194B1B78DBB205 79 | :1084D00003F07103002B01D00123FB82FB8A002BE8 80 | :1084E00011D0BB68B3F5000F07D3BA687B6A134499 81 | :1084F000A3F500023B6B1A600EE0BA687B6A1A446F 82 | :108500003B6B1A6008E03B6A043B3B623B68043308 83 | :108510003B60BB680433BB603B6A002B02D0FB8A24 84 | :10852000002B85D0FB8A18462837BD4680BD00BF8A 85 | :08853000000002400C000240B3 86 | :0400000300000411E4 87 | :00000001FF 88 | --------------------------------------------------------------------------------