📄 flashdrv.h
字号:
/*******************************************************************************
*
* Motorola Inc.
* (c) Copyright 2002 Motorola, Inc.
* ALL RIGHTS RESERVED.
*
* $Element: $
* $Author: $
* $Revision: $
* $VOB: $
* $OS: $
*
* Description: Header file for Flash driver for DSP5683x
*
* Notes:
*
******************************************************************************/
#ifndef __FLASHDRV_H
#define __FLASHDRV_H
#include "port.h"
#include "arch.h"
#include "flash.h"
#ifdef __cplusplus
extern "C" {
#endif
/* blocksize in words */
enum e_flashconstants
{
PAGE_SIZE_LOG = 8, /* 256 */
PAGE_SIZE_P_LOG = 9, /* 512 */
PAGE_SIZE_IN_WORDS = ( 1 << PAGE_SIZE_LOG ),
PAGE_SIZE_P_IN_WORDS = ( 1 << PAGE_SIZE_P_LOG ),
PAGE_SIZE_IN_BYTES = ( 1 << (PAGE_SIZE_LOG + 1) ),
PAGE_SIZE_P_IN_BYTES = ( 1 << (PAGE_SIZE_P_LOG + 1) ),
#if defined(DSP56838EVM)
PMEM_FLASH_SIZE = 0x20000,
PMEM_FLASH_OFF = 0,
XMEM_FLASH_SIZE = 0x2000,
XMEM_FLASH_OFF = 0x2000,
BOOT_FLASH_SIZE = 0x2000, /* 8k DAKAR */
BOOT_FLASH_OFF = 0x20000,
#elif defined (DSP56836EVM)
PMEM_FLASH_SIZE = 0x10000,
PMEM_FLASH_OFF = 0,
XMEM_FLASH_SIZE = 0x1000, /* 4k size */
XMEM_FLASH_OFF = 0x1000, /* data flash start addr */
BOOT_FLASH_SIZE = 0x1000, /* 4k size */
BOOT_FLASH_OFF = 0x20000, /* boot flash start addr */
#elif defined (DSP56832XEVM)
PMEM_FLASH_SIZE = 0x4000, /* 16k size */
PMEM_FLASH_OFF = 0, /* prog flash start addr */
XMEM_FLASH_SIZE = 0x1000, /* 4k size */
XMEM_FLASH_OFF = 0x1000, /* data flash start addr */
BOOT_FLASH_SIZE = 0x1000, /* 4k size */
BOOT_FLASH_OFF = 0x20000, /* boot flash start addr */
#else /* EVM */
#error "platform is not implemented"
#endif /* EVM */
flashconstants = 0
};
typedef const struct
{
ssize_t (*pRead)(handle_t hndl, void *buf, size_t);
ssize_t (*pWrite)(handle_t hndl, const void *buf, size_t len);
int (*pClose)(handle_t hndl);
UWord16 (*pIoctl[6])(handle_t hndl, unsigned long params );
} io_sFlashInterface;
/* Define the specific LED supported by this driver */
struct sflashDesc
{
const io_sFlashInterface * pInterface;
void (*rawErase)(unsigned int page );
void (*rawRead)(unsigned int page );
void (*rawWrite)(unsigned int page );
unsigned int lastpage;
unsigned int pagesizelog;
unsigned long seek;
unsigned int tpage; /* temporary page */
unsigned int toffs; /* temporary offset */
unsigned int flags;
#if 0
unsigned int tdifoff; /* difference offset */
unsigned int tdiflen; /* difference len */
#endif
};
enum FlashDeviceEnum
{
sFlash_size = sizeof(struct sflashDesc),
sFlash_offset_lastpage = (int)&((struct sflashDesc*)0)->lastpage,
sFlash_offset_pagesizelog = (int)&((struct sflashDesc*)0)->pagesizelog,
sFlash_offset_seek = (int)&((struct sflashDesc*)0)->seek,
sFlash_offset_tpage = (int)&((struct sflashDesc*)0)->tpage,
sFlash_offset_toffs = (int)&((struct sflashDesc*)0)->toffs,
sFlash_offset_flags = (int)&((struct sflashDesc*)0)->flags,
#if 0
sFlash_offset_tdifoff = (int)&((struct sflashDesc*)0)->tdifoff,
sFlash_offset_tdiflen = (int)&((struct sflashDesc*)0)->tdiflen,
#endif
};
#define O_ERASE_FLAG 0x1000
/* flash devices context */
extern struct sflashDesc PmemFlash;
extern struct sflashDesc XmemFlash;
extern struct sflashDesc BootFlash;
handle_t flashPmemOpen(const char * pName, int OFlags, ...);
handle_t flashXmemOpen(const char * pName, int OFlags, ...);
handle_t flashBootOpen(const char * pName, int OFlags, ...);
int flashClose(handle_t hndl);
ssize_t flashRead(handle_t hndl, void * pBuffer, size_t nbytes);
ssize_t flashWrite(handle_t hndl, const void * pBuffer, size_t NBytes);
UWord16 flashDevCreate(const char * pName, UWord16 OFlags);
ssize_t flashFastWrite(handle_t hndl, const void * pBuffer, size_t n_bytes);
ssize_t flashPCompare( handle_t hndl, const void * pBuffer, size_t n_bytes );
/* common */
UWord16 ioctlFLASH_RESET(handle_t hndl, unsigned long params );
UWord16 ioctlFLASH_MODE_VERIFY(handle_t hndl, unsigned long params );
UWord16 ioctlFLASH_CMD_SEEK(handle_t hndl, unsigned long params );
UWord16 ioctlFLASH_ERASE_PMEM(handle_t hndl, unsigned long params );
UWord16 ioctlFLASH_ERASE_XMEM(handle_t hndl, unsigned long params );
UWord16 ioctlFLASH_ERASE_BOOT(handle_t hndl, unsigned long params );
UWord16 ioctlFLASH_READ_PMEM(handle_t hndl, unsigned long params );
UWord16 ioctlFLASH_READ_XMEM(handle_t hndl, unsigned long params );
UWord16 ioctlFLASH_READ_BOOT(handle_t hndl, unsigned long params );
UWord16 ioctlFLASH_WRITE_PMEM(handle_t hndl, unsigned long params );
UWord16 ioctlFLASH_WRITE_XMEM(handle_t hndl, unsigned long params );
UWord16 ioctlFLASH_WRITE_BOOT(handle_t hndl, unsigned long params );
void ioctlFLASH_RAW_MASSERASE_PMEM(handle_t hndl, unsigned long params );
void ioctlFLASH_RAW_ERASE_PMEM(unsigned int page);
void ioctlFLASH_RAW_ERASE_XMEM(unsigned int page);
void ioctlFLASH_RAW_ERASE_BOOT(unsigned int page);
void ioctlFLASH_RAW_READ_PMEM(unsigned int page);
void ioctlFLASH_RAW_READ_XMEM(unsigned int page);
void ioctlFLASH_RAW_READ_BOOT(unsigned int page);
void ioctlFLASH_RAW_WRITE_PMEM(unsigned int page);
void ioctlFLASH_RAW_WRITE_XMEM(unsigned int page);
void ioctlFLASH_RAW_WRITE_BOOT(unsigned int page);
#ifdef __cplusplus
}
#endif
#endif /* __FLASHDRV_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -