想自己制作MP3的朋友下来看一下

源代码在线查看: smc_drv.h

软件大小: 18132 K
上传用户: hqbbsw
关键词: MP3
下载地址: 免注册下载 普通下载 VIP

相关代码

				/*H**************************************************************************
				* $RCSfile: smc_drv.h,v $         
				*----------------------------------------------------------------------------
				* Copyright (c) 2002 Atmel.
				*----------------------------------------------------------------------------
				* RELEASE:      $Name: DEMO_FAT_1_9_9 $      
				* REVISION:     $Revision: 1.2 $     
				* FILE_CVSID:   $Id: smc_drv.h,v 1.2 2002/08/28 09:45:09 njourdan Exp $       
				*----------------------------------------------------------------------------
				* PURPOSE:        This file contains the SMC driver definitions
				*
				*****************************************************************************/
				
				#ifndef _SMC_DRV_H_
				#define _SMC_DRV_H_
				
				/*_____ I N C L U D E S ____________________________________________________*/
				
				
				/*_____ M A C R O S ________________________________________________________*/
				
				/************************** Read Command ************************************/
				#define SMC_READ_A_AREA_CMD           0x00
				#define SMC_READ_B_AREA_CMD           0x01
				#define SMC_READ_C_AREA_CMD           0x50
				/************************** Read ID Command *********************************/
				#define SMC_READ_ID_CMD               0x90
				#define SMC_RESET_CMD                 0xff
				/************************** Program command *********************************/
				#define SMC_SEQUENTIAL_DATA_INPUT_CMD 0x80
				#define SMC_PAGE_PROGRAM_CMD          0x10
				/************************** Erase command ***********************************/
				#define SMC_BLOCK_ERASE_CMD           0x60
				#define SMC_BLOCK_ERASE_CONFIRM_CMD   0xD0
				/************************** Read Status command *****************************/
				#define SMC_READ_STATUS_CMD           0x70
				
				/* Pin out definition */
				#define SMC_RD_BUSY          P2_4
				#define Smc_CS_ON()          (P2_3 = 0)
				#define Smc_CS_OFF()         (P2_3 = 1)
				#define SMC_PRESENT          (/* Define a Pin here */ 1 )
				
				#define Smc_card_detect()     (SMC_PRESENT)
				
				#define SMC_BUFFER_SIZE              (Byte)(32)
				
				
				#define Smc_wait_busy()  { while ( !SMC_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;
				
				
				
				
				/* ECC DEFINITION */
				#define BIT7 0x80
				#define BIT6 0x40
				#define BIT5 0x20
				#define BIT4 0x10
				#define BIT3 0x08
				#define BIT2 0x04
				#define BIT1 0x02
				#define BIT0 0x01
				#define BIT1BIT0 0x03
				#define BIT23 0x00800000L
				#define MASK_CPS 0x3f
				#define CORRECTABLE 0x00555554L
				
				//#define SMC_ECC
				
				
				/* SMARTMEDIAD CARD DEFINITION */
				/* This value are only for 16Mbytes and upper SMARTMEDIA Card capacities   */
				#define SMC_PAGE_PER_BLOCK (32)    /* pages_block value: pages in a block   */ 
				#define SMC_DATA_SIZE      (512)   /* data_size   value: data_size in bytes */
				#define SMC_SPARE_SIZE     (16)    /* spare_size  value: spare_size in bytes*/
				#define SMC_ZONE_MAX       (8)     /* 8 zones                               */
				#define SMC_BLOCK_PER_ZONE (1024)  /* 1024 block per size                   */
				
				#define SMC_SIZE_16MB          (Byte)(16)
				#define SMC_SIZE_32MB          (Byte)(32)
				#define SMC_SIZE_64MB          (Byte)(64)
				#define SMC_SIZE_128MB         (Byte)(128)
				
				#define SMC_16MB               (0)
				#define SMC_32MB               (1)
				#define SMC_64MB               (2)
				#define SMC_128MB              (3)
				
				#define SMC_SECTOR_SIZE_16MB   (Uint32)(31999)
				#define SMC_SECTOR_SIZE_32MB   (Uint32)(63999)
				#define SMC_SECTOR_SIZE_64MB   (Uint32)(127999)
				#define SMC_SECTOR_SIZE_128MB  (Uint32)(255999)
				
				/* SCSI DEFINITION FOR SMARTMEDIA */
				#define SMC_BLOCK_SIZE     ((Uint32)(SMC_DATA_SIZE))
				#define SMC_DISK_SIZE      ((Uint32)(smc_disk_size))
				
				/* Low Level routine */
				#define Smc_rd_byte()                 (smc_data)
				#define Smc_wr_byte(b)                (smc_data = b)
				#define Smc_send_command(command)     (smc_send_cmd = command)
				#define Smc_send_address(address)     (smc_send_add = address)
				
				
				/*_____ D E C L A R A T I O N ______________________________________________*/
				
				extern xdata Uint32 smc_disk_size;
				
				void smc_init_buffer(void);          /* Initialize the buffer gl_buffer with 0xFF          */
				void smc_copy_block_head(void);      /* Copy the first sectors of a block                  */
				void smc_copy_block_tail(void);      /* Copy the last sectors of a block                   */
				void smc_reassign_block(void);       /* reassign the physical block on the look up table   */
				bit smc_block_erase (Uint32);        /* Erase one block                                    */
				bit smc_erase_all_block(void);       /* Erase all block                                    */
				void smc_init_spare(void);           /* Init the first redundant data of a block           */
				void smc_calc_logical_block();       /* Calulate the value of logical block in spare area  */
				void smc_update_spare_data(void);    /* Write only the redundant information               */
				void smc_calculate_ecc(void);
				void read_spare_byte(void);
				
				
				extern void smc_download_buffer(void);   /* Copy the content of gl_buffer on the card      */
				extern void smc_upload_buffer(void);     /* Load the content of the card on gl_buffer      */
				extern void smc_usb_to_buff_64(Byte);    /* Transfer 64 bytes from USB to gl_buffer        */      
				extern void smc_download_buff_64(Byte);  /* Transfer 64 bytes from gl_buffer to media      */
				#endif /* _SMC_DRV_H_ */
							

相关资源