⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nf_drv.h

📁 MP3播放器详细设计方案
💻 H
字号:
/*H**************************************************************************
* $RCSfile: nf_drv.h,v $         
*----------------------------------------------------------------------------
* Copyright (c) 2002 Atmel.
*----------------------------------------------------------------------------
* RELEASE:      $Name: DEMO_FAT_1_9_9 $      
* REVISION:     $Revision: 1.7 $     
* FILE_CVSID:   $Id: nf_drv.h,v 1.7 2002/09/06 13:17:20 njourdan Exp $       
*----------------------------------------------------------------------------
* PURPOSE:        This file contains the NF driver definitions
*
*****************************************************************************/

#ifndef _NF_DRV_H_
#define _NF_DRV_H_

/*_____ I N C L U D E S ____________________________________________________*/


/*_____ M A C R O S ________________________________________________________*/

/************************** Read Command ************************************/
#define NF_READ_A_AREA_CMD           0x00
#define NF_READ_B_AREA_CMD           0x01
#define NF_READ_C_AREA_CMD           0x50
/************************** Read ID Command *********************************/
#define NF_READ_ID_CMD               0x90
#define NF_RESET_CMD                 0xff
/************************** Program command *********************************/
#define NF_SEQUENTIAL_DATA_INPUT_CMD 0x80
#define NF_PAGE_PROGRAM_CMD          0x10
/************************** Erase command ***********************************/
#define NF_BLOCK_ERASE_CMD           0x60
#define NF_BLOCK_ERASE_CONFIRM_CMD   0xD0
/************************** Read Status command *****************************/
#define NF_READ_STATUS_CMD           0x70


#define NF_BUFFER_SIZE              (Byte)(133)


#define Nf_wait_busy()  { while ( !NF_RD_BUSY); }


/*_____ D E F I N I T I O N ________________________________________________*/

/* Structure to store the correspondance between logical and physical block */
typedef struct 
{
  Byte   zone;
  Uint16 logical_block;
  Uint16 physical_block;
} t_reassign_block;





/* SMARTMEDIA CARD DEFINITION */
/* This value are only for 16Mbytes and upper SMARTMEDIA Card capacities   */
#define NF_PAGE_PER_BLOCK (32)    /* pages_block value: pages in a block   */ 
#define NF_DATA_SIZE      (512)   /* data_size   value: data_size in bytes */
#define NF_SPARE_SIZE     (16)    /* spare_size  value: spare_size in bytes*/
#define NF_BLOCK_PER_ZONE (1024)  /* 1024 block per size                   */

#define NF_32

#ifdef NF_16
#define NF_TYPE               (Byte)(0)
#define NF_SIZE               (Byte)(16)
#define NF_ZONE_MAX           (Byte)(1)
#define NF_SECTOR_SIZE        (Uint32)(31999)
#define NF_4_CYCLE_ADDRESS    (0)
#endif

#ifdef NF_32
#define NF_TYPE               (Byte)(1)
#define NF_SIZE               (Byte)(32)
#define NF_ZONE_MAX           (Byte)(2)
#define NF_SECTOR_SIZE        (Uint32)(63999)
#define NF_4_CYCLE_ADDRESS    (0)
#endif

#ifdef NF_64
#define NF_TYPE               (Byte)(2)
#define NF_SIZE               (Byte)(64)
#define NF_ZONE_MAX           (Byte)(4)
#define NF_SECTOR_SIZE        (Uint32)(127999)
#define NF_4_CYCLE_ADDRESS    (1)
#endif

#ifdef NF_128
#define NF_TYPE               (Byte)(3)
#define NF_SIZE               (Byte)(128)
#define NF_ZONE_MAX           (Byte)(8)
#define NF_SECTOR_SIZE        (Uint32)(255999)
#define NF_4_CYCLE_ADDRESS    (1)
#endif

/* SCSI DEFINITION FOR SMARTMEDIA */
#define NF_BLOCK_SIZE     ((Uint32)(NF_DATA_SIZE))
#define NF_DISK_SIZE      ((Uint32)(NF_SECTOR_SIZE))

/* Low Level routine */
#define Nf_rd_byte()                (nf_data)
#define Nf_wr_byte(b)               (nf_data = b)
#define Nf_send_command(command)		(nf_send_cmd = command)
#define Nf_send_address(address)		(nf_send_add = address)


/*_____ D E C L A R A T I O N ______________________________________________*/

extern xdata Uint32 nf_disk_size;

void nf_init_buffer(void);          /* Initialize the buffer gl_buffer with 0xFF          */
extern void nf_download_buffer(void);      /* Copy the content of gl_buffer on the card          */
extern void nf_upload_buffer(void);        /* Load the content of the card on gl_buffer          */
void nf_copy_block_head(void);      /* Copy the first sectors of a block                  */
void nf_copy_block_tail(void);      /* Copy the last sectors of a block                   */
void nf_reassign_block(void);       /* reassign the physical block on the look up table   */
bit nf_block_erase (Uint32);        /* Erase one block                                    */
bit nf_erase_all_block(void);       /* Erase all block                                    */
void nf_init_spare(void);           /* Init the first redundant data of a block           */
void nf_calc_logical_block();       /* Calulate the value of logical block in spare area  */
void nf_update_spare_data(void);    /* Write only the redundant information               */
void nf_calculate_ecc(void);
void read_spare_byte(void);
#endif /* _NF_DRV_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -