📄 fbcmd.h
字号:
/*********************************************************************
* (C) COPYRIGHT TEXAS INSTRUMENTS, INC. 2000 *
* FBCmd.h -- Process FlashBurn Target Component commands
* for 54x DSK
*/
/* Change Log:
*/
/*
* $Log: FBCmd.h,v $
* Revision 1.8 2001/04/19 18:56:33 heeschen
* v00.30 Alpha - Updated comments
*
* Revision 1.7 2001/04/19 16:29:00 heeschen
* v00.30 Snapshot
* Saving this stuff after massive redesign to remove RTDX dependency.
* Next step is to clean up, fix comments, and do unit testing.
*
*/
/* Implements FlashBurn communications protocol
*/
#include <type.h>
#include "fbtc54.h"
#define FLASHE_BIT 0x020
/* -----------------------------
* FLASH ADDRESSING ?
* A memory map was supplied with the DNA training packet.
* (via Harry Thompson)
* (Word Addresses)
0x8000-0xffff Block 0
0x10000-0x17fff Block 1
0x18000-0x1ffff Block 2
0x20000-0x27fff Block 3
0x28000-0x2ffff Block 4
0x30000-0x37fff Block 5
0x38000-0x3ffff Block 6
0x40000-0x47fff Block 7
*/
#define FLBASE 0x00008000UL
#define FLEND 0x00048000UL
#define FLPAGELEN 0x00008000UL
#define FLSIZEBYTES 0x00080000UL
#define ShortsToLong(vHighHalf, vLowHalf) \
((long)(((unsigned long)((u16)(vHighHalf)) << 16) | ((unsigned long)((u16)(vLowHalf)))))
#define ShortsToULong(vHighHalf, vLowHalf) \
((unsigned long)(((unsigned long)((u16)(vHighHalf)) << 16) | ((unsigned long)((u16)(vLowHalf)))))
/* Given a message from the Host,
* Carry out the command and prepare the
* response, if one is required.
*/
void doCommand(u16 *msg);
/* --------------------------
* Prototypes from FBURNCMD.C
*/
/* Set/Get Flash Memory base address.
* The Host may want me to change where
* I think the flash memory is, rather
* than have me use my hard-coded flash
* base address (FLASHBASE in this header
* file). It is set in response to a
* Set FLASHBASE Address command from Host.
*/
void SetFlashBase(unsigned long val);
unsigned long GetFlashBase(void);
/* Set/Get Flash Memory size.
* The Host may want me to change how big
* I think the flash memory is, rather
* than have me use my hard-coded flash
* size (FLASHSIZE in this header
* file)
*/
void SetFlashSize(unsigned long val);
unsigned long GetFlashSize(void);
/* Initialize flash memory pointers
* to a known flash memory address
*/
void InitFlash(void);
/* Initialize flash memory pointers
* to a given address
*/
void SetFlashAddr(unsigned long addr);
/* Burn data into flash memory starting
* at current flash memory pointer.
* Note that bytecount is #of 8-bit bytes.
* Thus on 5402 (2 bytes per address unit)
* indexing is by 16-bit units.
*/
void BurnFlash(u16 *data, u16 nBytes);
/* Get pointer to next available flash memory
* location.
*/
volatile u16 *GetNextFlashAddr(void);
/* Erase all of flash memory.
*/
void EraseFlash(void);
/* Erase a flash memory sector (64K 8-bitbytes).
* This only works for sectors 0-7 of the
* STMicro M29W400BT flash & compatibles.
* Actually, it's not used yet, but it's a
* example.
* Sector is 0-7. The 1st 7 are 64K bytes, the
* 8th is 32K bytes. There are 3 sectors beyond
* the 1st 8, but those are left to the interested
* student.
*/
void EraseFlashSector(u16 sector);
/* Called periodically to maintain
* the Status Busy Bit when flash
* is erasing.
*/
void CheckFlashErase(void);
/* Checksum Processing.
* A simple modulo-16 additive cksum
* which adds the carry bit back into
* the accumulator.
*/
/* Initialize to a value */
void CKSSet(u16 val);
/* Returns the current value */
u16 CKSGet(void);
/* Accumulate a buffer */
u16 CKSAccumBuf(unsigned long buf, unsigned long len);
/* Return flash contents */
u16 GetFlashVal(unsigned long addr);
/* Sends a block of flash bytes to host
*/
void SendFlashBufToHost(u16 cmd, unsigned long addr, u16 count);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -