📄 example_flash281x_api.h
字号:
// TI File $Revision:: 4 $
//###########################################################################
//
// FILE: Example_Flash281x_API.h
//
// TITLE: F281x Flash API example include file
//
// DESCRIPTION:
//
//###########################################################################
//
// Ver | dd mmm yyyy | Who | Description of changes
// =====|=============|======|===============================================
// 1.00| 10 Dec 2003 | TI | TMS Release
//###########################################################################
#ifndef EXAMPLE_FLASH2812_API_H
#define EXAMPLE_FLASH2812_API_H
/*---- flash program files -------------------------------------------------*/
#include "Flash281x_API_Library.h"
/*---------------------------------------------------------------------------
Functions used by this example
*---------------------------------------------------------------------------*/
void Example_ToggleTest(Uint16 Pin); // Run the ToggleTest
Uint16 Example_CsmUnlock(void); // Unlock the Code Security Module
void Example_CallFlashAPI(void); // Kernel function that interfaces to the API
void Example_Error(Uint16 Status); // If an error, stop here
void Example_Done(void); // If done, stop here
void Example_MemCopy(Uint16 *SourceAddr, Uint16* SourceEndAddr, Uint16* DestAddr);
/*---------------------------------------------------------------------------
Data/Program Buffer used for testing the flash API functions
---------------------------------------------------------------------------*/
#define WORDS_IN_FLASH_BUFFER 0x800 // Programming data buffer, Words
volatile Uint16 Buffer[WORDS_IN_FLASH_BUFFER];
/*---------------------------------------------------------------------------
Symbols used to copy support functions from Flash to RAM
These symbols are assigned by the linker. Refer to the .cmd file
---------------------------------------------------------------------------*/
extern Uint16 RamfuncsLoadStart;
extern Uint16 RamfuncsLoadEnd;
extern Uint16 RamfuncsRunStart;
/*-----------------------------------------------------------------------------
Specify the PLLCR (PLL Control Register) value.
Uncomment the appropriate line by removing the leading double slash: //
Only one statement should be uncommented.
The user's application must set the PLLCR Register before calling any
of the Flash API functions.
Example: CLKIN is a 30MHz crystal.
The user wants to have a 150Mhz CPU clock (SYSCLKOUT = 150MHz).
In this case, PLLCR must be set to 10 (0x000A)
Uncomment the line: #define PLLCR_VALUE 10
Comment out the remaining lines with a double slash: //
-----------------------------------------------------------------------------*/
#define PLLCR_VALUE 0x000A // SYSCLKOUT = (OSCLK*10)/2
// #define PLLCR_VALUE 0x0009 // SYSCLKOUT = (OSCLK*9)/2
// #define PLLCR_VALUE 0x0008 // SYSCLKOUT = (OSCLK*8)/2
// #define PLLCR_VALUE 0x0007 // SYSCLKOUT = (OSCLK*7)/2
// #define PLLCR_VALUE 0x0006 // SYSCLKOUT = (OSCLK*6)/2
// #define PLLCR_VALUE 0x0005 // SYSCLKOUT = (OSCLK*5)/2
// #define PLLCR_VALUE 0x0004 // SYSCLKOUT = (OSCLK*4)/2
// #define PLLCR_VALUE 0x0003 // SYSCLKOUT = (OSCLK*3)/2
// #define PLLCR_VALUE 0x0002 // SYSCLKOUT = (OSCLK*2)/2
// #define PLLCR_VALUE 0x0001 // SYSCLKOUT = (OSCLK*1)/2
// #define PLLCR_VALUE 0x0000 // SYSCLKOUT = (OSCLK)/2 (PLL Bypassed)
/*---------------------------------------------------------------------------
These key values are used to unlock the CSM by this example
They are defined in Example_Flash2812_CsmKeys.asm
--------------------------------------------------------------------------*/
extern Uint16 PRG_key0; // CSM Key values
extern Uint16 PRG_key1;
extern Uint16 PRG_key2;
extern Uint16 PRG_key3;
extern Uint16 PRG_key4;
extern Uint16 PRG_key5;
extern Uint16 PRG_key6;
extern Uint16 PRG_key7;
/*---------------------------------------------------------------------------
These definitions are used to call the toggle test function
--------------------------------------------------------------------------*/
#define TOGGLE_XF 0x0001
#define TOGGLE_PWM1 0x0002
#define TOGGLE_SCITXDA 0x0003
#define TOGGLE_SCITXDB 0x0004
#define TOGGLE_MDXA 0x0005
#define GPAMUX_ABS (volatile Uint16*)0x000070C0 /* GPIO A mux control register */
#define GPATOGGLE_ABS (volatile Uint16*)0x000070E3 /* GPIO A toggle register */
#define GPFMUX_ABS (volatile Uint16*)0x000070D4 /* GPIO F mux control register */
#define GPFTOGGLE_ABS (volatile Uint16*)0x000070F7 /* GPIO F toggle register */
#define GPGMUX_ABS (volatile Uint16*)0x000070D8 /* GPIO G mux control register */
#define GPGTOGGLE_ABS (volatile Uint16*)0x000070FB /* GPIO G toggle register */
#define GPIOA0_PWM1_MASK 0x0001
#define GPIOF12_MDXA_MASK 0x1000
#define GPIOF4_SCITXDA_MASK 0x0010
#define GPIOF14_XF_MASK 0x4000
#define GPIOG4_SCITXDB_MASK 0x0010
/*---------------------------------------------------------------------------
These register definitions are used in this example. This is done
to allow for a stand alone example that is not dependant on the
DSP28 Header files for now.
This may be changed in the future to use the headerfiles.
--------------------------------------------------------------------------*/
// ***** 以下由于兼容性所有的都加上后辍 _ABS
#define FBANKWAIT_ABS (volatile Uint16*)0x00000A86 /* Flash Waitstate control */
#define FOTPWAIT_ABS (volatile Uint16*)0x00000A87 /* OTP Waitstate control */
#define WDCR_ABS (volatile Uint16*)0x00007029 /* Watchdog control register */
#define PLLCR_ABS (volatile Uint16*)0x00007021 /* PLL Control Register */
#define WDKEY_ABS (volatile Uint16*)0x00007025 /* Watchdog key register */
#define CSMSCR_ABS (volatile Uint16*)0x00000AEF // CSM status and control register
#define KEY0_ABS (volatile Uint16*)0x00000AE0 /* low word of the 128-bit key */
#define KEY1_ABS (volatile Uint16*)0x00000AE1 /* next word in 128-bit key */
#define KEY2_ABS (volatile Uint16*)0x00000AE2 /* next word in 128-bit key */
#define KEY3_ABS (volatile Uint16*)0x00000AE3 /* next word in 128-bit key */
#define KEY4_ABS (volatile Uint16*)0x00000AE4 /* next word in 128-bit key */
#define KEY5_ABS (volatile Uint16*)0x00000AE5 /* next word in 128-bit key */
#define KEY6_ABS (volatile Uint16*)0x00000AE6 /* next word in 128-bit key */
#define KEY7_ABS (volatile Uint16*)0x00000AE7 /* high word of the 128-bit key */
#define PWL0_ABS (volatile Uint16*)0x003F7FF8 /* Password 0 */
#define PWL1_ABS (volatile Uint16*)0x003F7FF9 /* Password 1 */
#define PWL2_ABS (volatile Uint16*)0x003F7FFA /* Password 2 */
#define PWL3_ABS (volatile Uint16*)0x003F7FFB /* Password 3 */
#define PWL4_ABS (volatile Uint16*)0x003F7FFC /* Password 4 */
#define PWL5_ABS (volatile Uint16*)0x003F7FFD /* Password 5 */
#define PWL6_ABS (volatile Uint16*)0x003F7FFE /* Password 6 */
#define PWL7_ABS (volatile Uint16*)0x003F7FFF /* Password 7 */
//---------------------------------------------------------------------------
// Common CPU Definitions used by this example:
//
//#define EALLOW asm(" EALLOW")
//#define EDIS asm(" EDIS")
//#define DINT asm(" setc INTM")
#endif // ---- End of EXAMPLE_FLASH2812_API_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -