📄 flash.h
字号:
/*****************************************************************//* Copyright (c) Texas Instruments, Incorporated 2000 *//*****************************************************************//*****************************************************************************/
/*****************************************************************************/
/* flash.h - */
/* */
/* This module is the device library for the on-board FLASH memory */
/* */
/* MACRO FUNCTIONS: */
/* */
/* FUNCTIONS: */
/* */
/* flash_write() */
/* flash_erase() */
/* flash_checksum() */
/*****************************************************************************/
#ifndef _FLASH_H_
#define _FLASH_H_
/*****************************************************************************/
/* INCLUDES */
/*****************************************************************************/
/*****************************************************************************/
/* DEFINES */
/*****************************************************************************/
#undef OK
#define OK 0
#undef ERROR
#define ERROR -1
#define ALL -1 //for sector selector in erase
#define MAXSECTOR 16 //will have two values here for
//the two flash types
#ifndef u16
#define u16 unsigned int
#endif
/****************************************************************************/
/* typedefs & enums */
/****************************************************************************/
/****************************************************************************/
/* PUBLIC FUNCTION PROTOTYPES */
/****************************************************************************/
/****************************************************************************/
/* int flash_erase(int sector) */
/* */
/* This function erases one or more sectors of the flash. */
/* */
/* Parameters: */
/* int sector; //values from -1 for ALL, 0-16 for valid */
/* //sector numbers */
/* */
/* Return: */
/* - OK success */
/* - ERROR failure */
/* */
/* Notes: */
/* */
/****************************************************************************/
int flash_erase(int sector);
/****************************************************************************/
/* int flash_write(u16 *source, u16 *dest, u16 page, u16 length) */
/* */
/* This function writes a block of data into flash memory. The flash is */
/* addressed with a linear address scheme that addresses the words of the */
/* flash memory as an offset from the start of the flash chip. In other */
/* words, a dest of 0 will result in a write to sector 0, page 0, address */
/* as viewed by the CPU, will be 0xC000. */
/* */
/* Parameters: */
/* unsigned int *source; */
/* unsigned long dest */
/* unsigned int length */
/* */
/* Return: */
/* - OK success */
/* - ERROR failure */
/* */
/* Notes: */
/* */
/****************************************************************************/
int flash_write(u16 *source, u16 *dest, u16 page, u16 length);
/****************************************************************************/
/* int flash_read(u16 *source, u16 page, u16 *dest, u16 length) */
/* */
/* This function reads a block of data from flash memory. The addressing */
/* is the same as in the functions above. */
/* */
/* Parameters: */
/* unsigned long source */
/* unsigned int length */
/* */
/* Return: */
/* - data is read from the flash and written into the memory addressed by */
/* dest */
/* - always returns the length of the block read. */
/* there are no documented errors; however, it is possible to overrun */
/* the border of the flash page window. No checking is done at this */
/* time. */
/* */
/* Notes: */
/* */
/****************************************************************************/
int flash_read(u16 *source, u16 page, u16 *dest, u16 length);
/****************************************************************************/
/* int flash_checksum(u16 *source, u16 page, u16 length) */
/* */
/* This function returns a checksum for the specified memory range */
/* */
/* Parameters: */
/* unsigned int *source; //linear memory address within the flash*/
/* unsigned int page; */
/* unsigned int length; */
/* */
/* Return: */
/* - checksum value */
/* - no errors documented */
/* */
/* Notes: */
/* */
/****************************************************************************/
int flash_checksum(u16 *source, u16 page, u16 length);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -