Flash基础入门之Snow TI DSP --- FLASH API
小标 2019-03-12 来源 : 阅读 7270 评论 0

摘要:本文主要向大家介绍了Flash基础入门之Snow TI DSP --- FLASH API,通过具体的内容向大家展现,希望对大家学习Flash基础入门有所帮助。

本文主要向大家介绍了Flash基础入门之Snow TI DSP --- FLASH API,通过具体的内容向大家展现,希望对大家学习Flash基础入门有所帮助。

Flash基础入门之Snow TI DSP --- FLASH API

This example demonstrates F021 Flash API usage to program Flash Bank 0 on F2807x.

TMS320F2837xD Flash API Version 1.54

1. Introduction

This reference guide provides a detailed description of Texas Instruments' TMS320F2837xD Flash API Library (F021_API_F2837xD_C28x_FPU32.lib) functions that can be used to erase, program, and verify Flash on TMS320F2837xD devices.

1.1 Function Listing Format

This is the general format of an entry for a function, compiler intrinsic, or macro.

A short description of what function_name() does.

Synopsis

Provides a prototype for function_name().

<return_type> function_name (<type_1> parameter_1, <type_2> parameter_2, ..., <type_n> parameter_n)

Parameters

parameter_1 [in]    Type details of parameter_1

parameter_2 [out]     Type details of parameter_2

parameter_n [in/out]     Type details of parameter_3

Parameter passing is categorized as follows:

(1) In -- Indicates the function uses one or more values in the parameter that you give it without storing any changes.

(2) Out -- Indicates the function saves one or more of the values in the parameter that you give it. You can examine the saved values to find out useful information about your application.

(3) In/Out -- Indicates the function changes one or more of the values in the parameter that you give it and saves the result. You can examine the saved values to find out useful information about your application.

Description

Describes the function. This section also describes any special characteristics or restrictions that might apply:

(1) Function blocks or might block the requested operation under certain conditions;

(2) Function has pre-conditions that might not be obvious;

(3) Function has restrictions or special behavior.

Restrictions

Specifies any restrictions in using this function.

Return Value

Specifies any value or values returned by the function.

2. Flash API Overview

2.1 Introduction

The Flash API is a library of routines, that when called with the proper parameters in the proper sequence, erases, programs, or verifies Flash memory. Flash API can be used to program and verify the OTP memory as well.

2.2 API Overview

2.2.1 Summary of Initialization Functions

(1) Fapi_initializeAPI(),  Initializes the API for first use or frequency change.

2.2.2 Summary of Flash State Machine (FSM) Functions

(1) Fapi_setActiveFlashBank(),  Initializes the Flash memory controller (FMC) and bank for an erase, program, or other command.

(2) Fapi_issueAsyncCommandWithAddress(),  Issues an erase sector command to FSM for the given sector address.

(3) Fapi_issueProgrammingCommand(),  Sets up the required registers for programming and issues the program command to the FSM.

(4) Fapi_issueFsmSuspendCommand(),  Suspends FSM commands program data and erase sector.

(5) Fapi_issueAsyncCommand(),  Issues a command (Clear Status, Program Resume, Erase Resume, Cleear_More) to FSM for operations that do not require an address.

(6) Fapi_checkFsmForReady(),  Returns whether or not the Flash state machine is ready or busy.

(7) Fapi_getFsmStatus(),  Returns the FMSTAT status register value from the Flash memory controller (FMC).

2.2.3 Summary of Read Functions

(1) Fapi_doBlankCheck(),  Verifies specified Flash memory range for the erased state.

(2) Fapi_doVerify(),  Verifies specified Flash memory range against supplied values.

(3) Fapi_doMarginRead(),  Returns the data from the specified Flash memory range.

(4) Fapi_caculatePsa(),  Calculates a PSA value for the specified Flash memory range.

(5) Fapi_doPsaVerify(),  Verifies a specified Flash memory range against the supplied Parallel Signature Analysis (PSA) value.

2.2.4 Summary of Information Functions

(1)  Fapi_getLibraryInfo(),  Returns the information specific to the compiled version of the API library.

(2) Fapi_getDeviceInfo(),  Returns the information specific to the device on which the API library is being executed.

(3) Fapi_getBankSectors(),  Returns the sector information for a bank.

2.2.5 Summary of Utility Functions

(1) Fapi_flushPipeline(),  Flushes the data cache in FMC.

(2) Fapi_calculateEcc(),  Calculates the Error Correction Code (ECC) for the supplied address and 64-bit word.

(3) Fapi_isAddressEcc(),  Determines if address falls within the ECC memory ranges.

(4) Fapi_remapEccAddress(),  Remaps an ECC address to the corresponding main address.

(5) Fapi_calculateFletcherChecksum(),  Function calculates a Fletcher checksum for the memory range specified.

2.2.6 Summary of User-Defined Functions

(1) Fapi_serviceWatchdogTimer(),  User-modifiable function to service watchdog timer.

(2) Fapi_setupEepromSectorEnable(),  Users should not modify this function. This function should be used as provided by TI.

(3) Fapi_setupBankSectorEnable(),  User should not modify this function. This function should be used as provided by TI.

2.3 Using API

This section describes the flow for using various API functions.

2.3.1 Initialization Flow

(1) After Device Power Up

After the device is first powered up, the Fapi_initializeAPI() function must be called before any other API function can be used. This procedure initializes the API internal structures.

(2) Bank Setup

Before performing a Flash operation for the first time, the Fapi_setActiveFlashBank() function must be called.

(3) On System Frequency Change

If the system operating frequency is changed after the initial call to Fapi_initializeAPI(), this function must be called again before any other API function can be used. This procedure will update the API internal state variables.

2.3.2 Building With the API

(1) Object Library Files

The Flash API object file is distributed in the standard Common Object File format (COFF).

(2) Distribution Files

Library Files. Source Files. Include Files. 

2.3.3 Key Facts for Flash API Usage

Here are some important facts about API usage:

(1) Names of the Flash API functions start with a prefix "Fapi_".

(2) EALLOW and EDIS should be executed before and after calling Flash API functions, respectively, to allow and disallow writes to protected registers.

(3) Pump semaphore should be gained by a CPU before performing Flash operations (erase, program, verify) on its bank. Flash API does not configure the pump semaphore.

(4) Flash API does not configure the PLL. The user application should configure the PLL as needed and pass the configured CPUCLK value to Fapi_initializeAPI() function.

(5) The Main Array flash programming must be aligned to 64-bit address boundaries and each 64-bit ECC word may only be programmed once per write/erase cycle.

(6) It is permissible to program the data and ECC separately. However, each 64-bit data word and 16-bit ECC word may only be programmed once per write/erase cycle.

(7) The DCSM OTP programming must be aligned to 128-bit address boundaries and each 128-bit word may only be programmed once.

(8) ECC should not be programmed for LINKPOINTER locations. Use Fapi_DataOnly mode for programming these locations.

(9) Flash API execution is interruptible; however, there should not be any read or fetch access from the Flash bank/OTP when an erase or program operation is in progress. Therefore, the Flash API functions, the user application functions that call the Flash API functions, and any ISRs (Interrupt service routines,) must be executed from RAM. For example, the entire code snippet shown below should be executed from RAM and not just the Flash API functions. The reason for this is because the Fapi_issueAsyncCommandWithAddress() function issues the erase command to the FSM, but it does not wait until the erase operation is over. As long as the FSM is busy with the current operation, there should not be a Flash access.


以上就介绍了Flash的相关知识,希望对Flash有兴趣的朋友有所帮助。了解更多内容,请关注职坐标常用软件Flash频道!

本文由 @小标 发布于职坐标。未经许可,禁止转载。
喜欢 | 0 不喜欢 | 1
看完这篇文章有何感觉?已经有1人表态,0%的人喜欢 快给朋友分享吧~
评论(0)
后参与评论

您输入的评论内容中包含违禁敏感词

我知道了

助您圆梦职场 匹配合适岗位
验证码手机号,获得海同独家IT培训资料
选择就业方向:
人工智能物联网
大数据开发/分析
人工智能Python
Java全栈开发
WEB前端+H5

请输入正确的手机号码

请输入正确的验证码

获取验证码

您今天的短信下发次数太多了,明天再试试吧!

提交

我们会在第一时间安排职业规划师联系您!

您也可以联系我们的职业规划师咨询:

小职老师的微信号:z_zhizuobiao
小职老师的微信号:z_zhizuobiao

版权所有 职坐标-一站式AI+学习就业服务平台 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
 沪公网安备 31011502005948号    

©2015 www.zhizuobiao.com All Rights Reserved