/*H**************************************************************************
* $RCSfile: smc.h,v $
*----------------------------------------------------------------------------
* Copyright (c) 2002 Atmel.
*----------------------------------------------------------------------------
* RELEASE: $Name: DEMO_FAT_1_9_9 $
* REVISION: $Revision: 1.1 $
* FILE_CVSID: $Id: smc.h,v 1.1 2002/07/16 09:54:56 njourdan Exp $
*----------------------------------------------------------------------------
* PURPOSE: This file contains the high level SMC definitions
*
*****************************************************************************/
#ifndef _SMC_H_
#define _SMC_H_
/*_____ I N C L U D E S ____________________________________________________*/
#include "..\..\lib_mem\smc\smc_drv.h" /* SMC driver definition */
/*_____ M A C R O S ________________________________________________________*/
/*_____ D E F I N I T I O N ________________________________________________*/
/* Number of page */
#define Smc_nb_page() ((Uint32)(smc_zone_max * 1024) * (Uint16)(SMC_PAGE_PER_BLOCK))
/* Disk size : number of block - 1 */
#define Smc_disk_size() ((Uint32)(SMC_DISK_SIZE))
#define Smc_disk_size_0() ((Byte)(SMC_DISK_SIZE >> 24))
#define Smc_disk_size_1() ((Byte)(SMC_DISK_SIZE >> 16))
#define Smc_disk_size_2() ((Byte)(SMC_DISK_SIZE >> 8))
#define Smc_disk_size_3() ((Byte)(SMC_DISK_SIZE))
/* Block size : size of a block in byte */
#define Smc_block_size() ((Uint32)(SMC_BLOCK_SIZE))
#define Smc_block_size_0() ((Byte)((SMC_BLOCK_SIZE) >> 24))
#define Smc_block_size_1() ((Byte)((SMC_BLOCK_SIZE) >> 16))
#define Smc_block_size_2() ((Byte)((SMC_BLOCK_SIZE) >> 8))
#define Smc_block_size_3() ((Byte)(SMC_BLOCK_SIZE))
/*_____ D E C L A R A T I O N ______________________________________________*/
/* System */
bit smc_init (void); /* Init SMC card */
bit smc_read_open (Uint32); /* Set read mode */
void smc_read_close (void); /* Close read mode */
Byte smc_read_byte (void); /* Read 1 byte */
bit smc_write_open (Uint32); /* Set write mode */
bit smc_write_close (void); /* Close write mode */
bit smc_write_byte (Byte); /* Write 1 byte */
bit smc_write_n (Byte); /* Write n bytes from USB */
bit smc_block_erase(Uint32); /* Erase one block (32 pages) */
bit smc_erase_all_block(void); /* Erase all blocks of the card */
bit smc_check_status(void); /* Check the status after program */
/* or erase block command */
bit smc_write_sector(void); /* Write a sector of 512b from USB*/
bit smc_read_sector(void); /* Read a sector of 512b to USB */
void smc_calculate_ecc(void); /* Calculate ECC */
s_format code * smc_format (void); /* Prepare format of SmartMedia */
bit smc_check_presence(void);
#endif /* _SMC_H_ */