/*
* Copyright (c) 2016 Freescale Semiconductor, Inc.
* Copyright 2016-2017 NXP
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
/*!
* @file flash_driver.c
*
* @page misra_violations MISRA-C:2012 violations
*
* @section [global]
* Violates MISRA 2012 Required Rule 1.3, Taking address of near auto variable.
* The code is not dynamically linked. An absolute stack address is obtained
* when taking the address of the near auto variable. A source of error in
* writing dynamic code is that the stack segment may be different from the data
* segment.
*
* @section [global]
* Violates MISRA 2012 Advisory Rule 8.7, External could be made static.
* The function is defined for use by application code.
*
* @section [global]
* Violates MISRA 2012 Required Rule 10.3, Expression assigned to a narrower or
* different essential type.
* This is required by the conversion of a bit-field of a register into a enum type.
*
* @section [global]
* Violates MISRA 2012 Advisory Rule 10.5, Impermissible cast; cannot cast from
* 'essentially unsigned' type to 'essentially enum<i>'.
* This is required by the conversion of a bit-field of a register into a enum type.
*
* @section [global]
* Violates MISRA 2012 Required Rule 10.8, Impermissible cast of composite
* expression (different essential type categories).
* This is required by the conversion of a bit-field of a register into enum type.
*
* @section [global]
* Violates MISRA 2012 Required Rule 11.1, Conversion between a pointer
* to function and another type.
* The cast is required to define a callback function.
*
* @section [global]
* Violates MISRA 2012 Advisory Rule 11.4, Conversion between a pointer and
* integer type.
* The cast is required to initialize a pointer with an unsigned long define,
* representing an address.
*
* @section [global]
* Violates MISRA 2012 Required Rule 11.6, Cast from unsigned int to pointer.
* The cast is required to initialize a pointer with an unsigned long define,
* representing an address.
*
* @section [global]
* Violates MISRA 2012 Advisory Rule 18.4, Pointer arithmetic other than array
* indexing used.
* This is required to increment the source address.
*/
#include "flash_driver.h"
START_FUNCTION_DECLARATION_RAMSECTION
static status_t FLASH_DRV_CommandSequence(const flash_ssd_config_t * pSSDConfig)
END_FUNCTION_DECLARATION_RAMSECTION
/*******************************************************************************
* Code
******************************************************************************/
/*FUNCTION**********************************************************************
*
* Function Name : FLASH_DRV_GetDEPartitionCode
* Description : Gets DFlash size from FlexNVM Partition Code.
*
*END**************************************************************************/
static void FLASH_DRV_GetDEPartitionCode(flash_ssd_config_t * const pSSDConfig,
uint8_t DEPartitionCode)
{
/* Select D-Flash size */
if (0x00U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32_t)FEATURE_FLS_DF_SIZE_0000;}
else if (0x01U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32_t)FEATURE_FLS_DF_SIZE_0001;}
else if (0x02U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32_t)FEATURE_FLS_DF_SIZE_0010;}
else if (0x03U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32_t)FEATURE_FLS_DF_SIZE_0011;}
else if (0x04U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32_t)FEATURE_FLS_DF_SIZE_0100;}
else if (0x05U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32_t)FEATURE_FLS_DF_SIZE_0101;}
else if (0x06U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32_t)FEATURE_FLS_DF_SIZE_0110;}
else if (0x07U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32_t)FEATURE_FLS_DF_SIZE_0111;}
else if (0x08U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32_t)FEATURE_FLS_DF_SIZE_1000;}
else if (0x09U == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32_t)FEATURE_FLS_DF_SIZE_1001;}
else if (0x0AU == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32_t)FEATURE_FLS_DF_SIZE_1010;}
else if (0x0BU == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32_t)FEATURE_FLS_DF_SIZE_1011;}
else if (0x0CU == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32_t)FEATURE_FLS_DF_SIZE_1100;}
else if (0x0DU == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32_t)FEATURE_FLS_DF_SIZE_1101;}
else if (0x0EU == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32_t)FEATURE_FLS_DF_SIZE_1110;}
else if (0x0FU == DEPartitionCode) {pSSDConfig->DFlashSize = (uint32_t)FEATURE_FLS_DF_SIZE_1111;}
else {/* Undefined value */}
}
#if (FEATURE_FLS_IS_FTFC == 0U)
/*FUNCTION**********************************************************************
*
* Function Name : FLASH_DRV_GetEEEDataSetSize
* Description : Gets EEPROM size from EEPROM Data Set Size.
*
*END**************************************************************************/
static void FLASH_DRV_GetEEEDataSetSize(flash_ssd_config_t * const pSSDConfig,
uint8_t EEEDataSetSize)
{
/* Select EEPROM size */
if (0x00U == EEEDataSetSize) {pSSDConfig->EEESize = (uint32_t)FEATURE_FLS_EE_SIZE_0000;}
else if (0x01U == EEEDataSetSize) {pSSDConfig->EEESize = (uint32_t)FEATURE_FLS_EE_SIZE_0001;}
else if (0x02U == EEEDataSetSize) {pSSDConfig->EEESize = (uint32_t)FEATURE_FLS_EE_SIZE_0010;}
else if (0x03U == EEEDataSetSize) {pSSDConfig->EEESize = (uint32_t)FEATURE_FLS_EE_SIZE_0011;}
else if (0x04U == EEEDataSetSize) {pSSDConfig->EEESize = (uint32_t)FEATURE_FLS_EE_SIZE_0100;}
else if (0x05U == EEEDataSetSize) {pSSDConfig->EEESize = (uint32_t)FEATURE_FLS_EE_SIZE_0101;}
else if (0x06U == EEEDataSetSize) {pSSDConfig->EEESize = (uint32_t)FEATURE_FLS_EE_SIZE_0110;}
else if (0x07U == EEEDataSetSize) {pSSDConfig->EEESize = (uint32_t)FEATURE_FLS_EE_SIZE_0111;}
else if (0x08U == EEEDataSetSize) {pSSDConfig->EEESize = (uint32_t)FEATURE_FLS_EE_SIZE_1000;}
else if (0x09U == EEEDataSetSize) {pSSDConfig->EEESize = (uint32_t)FEATURE_FLS_EE_SIZE_1001;}
else if (0x0AU == EEEDataSetSize) {pSSDConfig->EEESize = (uint32_t)FEATURE_FLS_EE_SIZE_1010;}
else if (0x0BU == EEEDataSetSize) {pSSDConfig->EEESize = (uint32_t)FEATURE_FLS_EE_SIZE_1011;}
else if (0x0CU == EEEDataSetSize) {pSSDConfig->EEESize = (uint32_t)FEATURE_FLS_EE_SIZE_1100;}
else if (0x0DU == EEEDataSetSize) {pSSDConfig->EEESize = (uint32_t)FEATURE_FLS_EE_SIZE_1101;}
else if (0x0EU == EEEDataSetSize) {pSSDConfig->EEESize = (uint32_t)FEATURE_FLS_EE_SIZE_1110;}
else if (0x0FU == EEEDataSetSize) {pSSDConfig->EEESize = (uint32_t)FEATURE_FLS_EE_SIZE_1111;}
else {/* Undefined value */}
}
#endif /* if (FEATURE_FLS_IS_FTFC == 0U) */
/*FUNCTION**********************************************************************
*
* Function Name : FLASH_DRV_Init
* Description : Initializes Flash module by clearing status error bit
* and reporting the memory configuration via SSD configuration structure.
*
* Implements : FLASH_DRV_Init_Activity
没有合适的资源?快使用搜索试试~ 我知道了~
NXP S32K系列单片机BootLoader源代码.rar
共297个文件
h:94个
c:80个
xcl:35个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 6 下载量 185 浏览量
2022-01-12
16:51:12
上传
评论 3
收藏 8.11MB RAR 举报
温馨提示
NXP S32K系列单片机BootLoader源代码,已经过批量验证,CAN通信刷写,支持OTA。
资源推荐
资源详情
资源评论
收起资源包目录
NXP S32K系列单片机BootLoader源代码.rar (297个子文件)
bootloader.Debug.cspy.bat 2KB
bootloader.pbd.browse 23B
flash_driver.c 67KB
drv_mcu_port.c 32KB
srv_diag.c 19KB
drv_tle7230.c 19KB
drv_mcu_port.c 19KB
drv_mcu_can0.c 13KB
drv_lin_.c 11KB
srv_diag_download.c 11KB
srv_diag_dlmess.c 10KB
drv_mcu_port.c 10KB
cstartup_M.c 10KB
drv_mcu_can.c 9KB
srv_diag_ReadData.c 9KB
drv_mcu_can1.c 8KB
drv_mcu_can2.c 8KB
drv_mcu_isr.c 8KB
drv_mcu_can.c 8KB
drv_mcu_port.c 7KB
drv_mcu_isr.c 7KB
drv_mcu_isr.c 7KB
drv_mcu_port.c 7KB
srv_diag_security.c 7KB
drv_e520.c 7KB
drv_mcu_tmr.c 5KB
srv_diag_routinecontrol.c 5KB
srv_diag_communicationcontrol.c 5KB
flash.c 4KB
drv_mcu_cpu.c 4KB
drv_mcu_spi.c 4KB
bld_jump.c 4KB
drv_mcu_cpu.c 4KB
cstartup_M.c 4KB
drv_eep.c 4KB
drv_mcu_spi.c 4KB
drv_mcu_lin.c 3KB
drv_mcu_cpu.c 3KB
drv_mcu_tmr.c 3KB
drv_mcu_cpu.c 3KB
srv_diag_controlDTC.c 3KB
drv_can.c 3KB
drv_mcu_cpu.c 3KB
drv_mcu_spi.c 3KB
drv_mcu_spi.c 3KB
drv_mcu_spi.c 3KB
srv_tmr.c 3KB
drv_adc_port.c 2KB
drv_mcu_ad.c 2KB
drv_mcu_ad.c 2KB
bld_main.c 2KB
drv_mcu_uart.c 2KB
drv_mcu_ad.c 2KB
srv_diag_var.c 2KB
srv_pwr.c 2KB
drv_mcu_ad.c 2KB
drv_can0.c 2KB
drv_mcu_ccp.c 2KB
drv_mcu_ccp.c 2KB
drv_mcu_tmr.c 2KB
drv.c 2KB
drv_can1.c 2KB
drv_can2.c 2KB
drv_can0.c 2KB
drv_mcu_wdt.c 2KB
drv_mcu_adc.c 2KB
drv_mcu_lpi2c.c 2KB
drv_mcu_ad.c 2KB
drv_mcu_tmr.c 1KB
srv_canbus_communicationcontrol.c 1KB
drv_mcu_isr.c 1KB
drv_mcu_ccp.c 1KB
drv_mcu_ccp.c 1KB
drv_mcu_ccp.c 1KB
drv_mcu_isr.c 1KB
drv_mcu_tmr.c 1KB
drv_mcu_eep.c 1KB
drv_mcu_eep.c 1KB
drv_mcu_eep.c 1KB
drv_mcu_wdt.c 1KB
srv_eep.c 690B
bld_core.c 567B
bootloader.crun 384B
bootloader.dbgdt 69KB
bootloader.dep 46KB
bootloader.dnx 8KB
bootloader.ewd 99KB
bootloader.ewp 76KB
bootloader.ewt 171KB
bootloader.eww 164B
drv_mcu_port.h 118KB
flash_driver.h 66KB
S32K142_features.h 65KB
S32K144_features.h 55KB
drv_mcu_port.h 49KB
drv_mcu_port.h 30KB
drv_mcu_port.h 29KB
drv_mcu_port.h 23KB
drv_lin.h 18KB
drv_can.h 17KB
共 297 条
- 1
- 2
- 3
资源评论
- superprayer2022-04-25用户下载后在一定时间内未进行评价,系统默认好评。
- 瑞雪兆丰年—2023-02-09内容与描述一致,超赞的资源,值得借鉴的内容很多,支持!
- suyua122022-09-23资源值得借鉴的内容很多,那就浅学一下吧,值得下载!
- 唐唐初见2022-05-07用户下载后在一定时间内未进行评价,系统默认好评。
- 地理末学2022-12-14感谢资源主的分享,很值得参考学习,资源价值较高,支持!
天上人间555
- 粉丝: 71
- 资源: 13
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功