flashid.c
来自「CHP 2 - Real-Time Digital Signal Process」· C语言 代码 · 共 38 行
C
38 行
//
// Project: Experiment 2.10.5 Flash Programming - Chapter 2
// File name: flashID.c
// Function: flashID()
//
// Description: This function reads the C5510 DSK flash memory manufacture ID
// This funciton is for AMD: AM29LV400B
//
// For the book "Real Time Digital Signal Processing:
// Implementation and Application, 2nd Ed"
// By Sen M. Kuo, Bob H. Lee, and Wenshun Tian
// Publisher: John Wiley and Sons, Ltd
//
// Tools used: CCS v.2.12.07
// TMS320VC5510 DSK Rev-C
//
#include "flash.h"
#pragma CODE_SECTION(flashID, ".text:example:flashID");
void flashID(unsigned short *ManuID, unsigned short *DevID)
{
volatile unsigned short i;
*((unsigned short *)FLASH_MEM_BASE) = FLASH_MEM_RESET;
// Issue read product Manufacturer and device ID sequence
*((volatile unsigned short *)FLASH_MEM_ADDR555) = FLASH_MEM_AA;
*((volatile unsigned short *)FLASH_MEM_ADDR2AA) = FLASH_MEM_55;
*((volatile unsigned short *)FLASH_MEM_ADDR555) = FLASH_MEM_ID;
for (i=0; i<50; i++) ; // Must be at least more than device write cycles
// Read manufacture and device ID
*ManuID = *((unsigned short *)FLASH_MEM_BASE+0x0);
*DevID = *((unsigned short *)FLASH_MEM_BASE+0x1);
flashReset();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?