JS28F128 Nor Flash的驱动

js28f128.h
---------------------------------------------------------
#ifndef _JS_28_F_128
#define _JS_28_F_128

#include "tffs/flflash.h"
#include "tffs/backgrnd.h"

#define CONFIRM_WRITE       0xd0

/*  ***********************
 *  Command Bus Operations 
 *  ***********************/
/* Register */
#define Register_EnConfig   0x0060
#define Register_EnConfirm  0x0004
#define Register_OTP        0x00C0
#define Register_ClrStatus  0x0050
#define Register_StsConfig  0x00B8

/* Read Mode */
#define Read_Array          0x00ff
#define Read_StatusReg      0x0070
#define Read_IdCode         0x0090      //Read Device Info
#define Read_CfiQuery       0x0098

/* Write and Erase */
#define Proc_WordProgram    0x0040      //Should input device address and array data next time
#define Proc_BufProgram     0x00E8      //Should input device address and data - 0x00D0 next time
#define Proc_BlockErase     0x0020      //Should input block address and data - 0x00D0 next time
#define Proc_Suspend        0x00B0
#define Proc_Resume         0x00D0

/* Security */
#define Secu_LockBlock      0x0060
#define Secu_LockConfirm    0x0001
#define Secu_UnBlock        0x0060
#define Secu_UnLockConfirm  0x00D0


/*  ***********************
 *  Device ID Code 
 *  ***********************/
#define DevCode_Flash32M    16
#define DevCode_Flash64M    17
#define DevCode_Flash128M   18


typedef unsigned char  uint8;
typedef unsigned short uint16;
typedef unsigned int   uint32;

/* Instance specific CFI data so that a system may have more than one CFI
 * device. */
typedef struct{
   
    unsigned    commandSetId;           /* id of a specific command set. */
    unsigned    altCommandSetId;        /* id of alternate command set.  */
    FLBoolean   wordMode;               /* TRUE  - word mode.            */
                                        /* FALSE - byte mode.            */
    int         multiplier;             /* the number of bytes in        */
                                        /* addressing scheme         */
    int         interleaveFactor;       /* Number of bytes interleaved   */ 
    long        maxBytesWrite;          /* maximum number of bytes       */
                                        /* in multi-byte write.          */
    FLBoolean   vpp;                    /* if = TRUE, need vpp.          */
    long        optionalCommands;       /* optional commands supported   */
                                        /* (1 = yes, 0 = no):            */
                                        /* bit 0 - chip erase.           */
                                        /* bit 1 - suspend erase.        */
                                        /* bit 2 - suspend write         */
                                        /* bit 3 - lock/unlock.          */
                                        /* bit 4 - queued erase.         */
    unsigned    afterSuspend;           /* functions supported after     */
                                        /* suspend (1 = yes, 0 = no):    */
                                        /* bit 0 - write after erase     */
                                        /*         suspend.              */
} CFI;

#define thisCFI   ((CFI *)vol.mtdVars)

#define _DEBUG_JS128_TFFS   1

/* command set IDs */
#define INTEL_COMMAND_SET       0x0001
#define AMDFUJ_COMMAND_SET      0x0002
#define INTEL_ALT_COMMAND_SET   0x0001
#define AMDFUJ_ALT_COMMAND_SET  0x0004
#define ALT_NOT_SUPPORTED       0x0000

#define FLASH_BANK_SIZE_DATA    0x01000000

#define ID_STR_LENGTH      3
#define QUERY_ID_STR       "QRY"
#define PRIMARY_ID_STR     "PRI"
#define ALTERNATE_ID_STR   "ALT"

/* status register bits */
#define WSM_ERROR               0x3a
#define SR_BLOCK_LOCK           0x02
#define SR_WRITE_SUSPEND        0x04
#define SR_VPP_ERROR            0x08
#define SR_WRITE_ERROR          0x10
#define SR_LOCK_SET_ERROR       0x10
#define SR_ERASE_ERROR          0x20
#define SR_LOCK_
RESET_ERROR     0x20
#define SR_ERASE_SUSPEND        0x40
#define SR_READY                0x80

#define CONFIRM_ERASE           0xd0

#endif
js28f128.c
-----------------------------------------------------
  
  
  
#include <vxWorks.h>
#include <taskLib.h>
#include <logLib.h>
#
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值