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

📄 flash_x_hw.c

📁 本资料包括建立在SD卡和NANDFLASH上的文件系统
💻 C
字号:
/*
**********************************************************************
*                          Micrium, Inc.
*                      949 Crestview Circle
*                     Weston,  FL 33327-1848
*
*                            uC/FS
*
*             (c) Copyright 2001 - 2003, Micrium, Inc.
*                      All rights reserved.
*
***********************************************************************
*/
/*********************************************************************
*
*             #include Section
*
**********************************************************************
*/

#include "fs_port.h"
#include "fs_conf.h"

#if FS_USE_FLASH_DRIVER

#include "ide_x_hw.h"
#include "includes.h"
#include "emi.h"
/* 
  The following header file is part of the IAR compiler for M16C/80. 
  If you use a different compiler, you may have to include a different 
  file or you may even have to replace the SFR access within this 
  file.
*/



/*********************************************************************
*
*             #define Macros
*
**********************************************************************
*/

/*
   To meet timing specification, you may have to add delays here
   when porting to a different CPU. For MC80 at 16MHz, there is no
   delay required.
*/

#define FS__FLASH_DELAY_WRITE   
#define FS__FLASH_DELAY_READ
#define FS__FLASH_DELAY_RESET


/*********************************************************************
*
*             Global functions section
*
**********************************************************************
*/

/*********************************************************************
*
*             FS_FLASH_HW_X_BusyLedOn
*
  Description:
  FS driver hardware layer function. Turn on busy led.

  Parameters:
  Unit        - Unit number.
 
  Return value:
  None.
*/

 void  FS_FLASH_HW_X_BusyLedOn(FS_u32 Unit) {
         ;
}



/*********************************************************************
*
*             FS_FLASH_HW_X_BusyLedOff
*
  Description:
  FS driver hardware layer function. Turn off busy led.

  Parameters:
  Unit        - Unit number.
 
  Return value:
  None.
*/

 void FS_FLASH_HW_X_BusyLedOff(FS_u32 Unit) { 
 ;      
}


/*********************************************************************
*
*             FS_FLASH_HW_X_HWReset
*
  Description:
  FS driver hardware layer function. This function is called, when 
  the driver detects a new media is present. For ATA HD drives, there 
  is no action required and this function can be empty.
  When using a CF card, please be aware, that the card needs to be
  power cycled while ~OE is grounded. If the card is inserted, VCC & 
  GND will provide the card before ~OE is connected and the card will 
  be in PC Card ATA mode.

  Parameters:
  Unit        - Unit number.
 
  Return value:
  None.
*/

  void FS_FLASH_HW_X_HWReset(FS_u32 Unit) {
  ;
}


/*********************************************************************
*
*             FS_FLASH_HW_X_GetAltStatus
*
  Description:
  FS driver hardware layer function. Read the ALTERNATE STATUS register.

  Parameters:
  Unit        - Unit number.
 
  Return value:
  Value of the ALTERNATE STATUS register.
*/

  unsigned char FS_FLASH_HW_X_GetAltStatus(FS_u32 Unit) {
  return 0;
}


/*********************************************************************
*
*             FS_FLASH_HW_X_GetCylHigh
*
  Description:
  FS driver hardware layer function. Read the CYLINDER HIGH register.

  Parameters:
  Unit        - Unit number.
 
  Return value:
  Value of the CYLINDER HIGH register.
*/

  unsigned char FS_FLASH_HW_X_GetCylHigh(FS_u32 Unit) {
  return 0;
}

/*********************************************************************
*
*             FS_FLASH_HW_X_GetCylLow
*
  Description:
  FS driver hardware layer function. Read the CYLINDER LOW register.

  Parameters:
  Unit        - Unit number.
 
  Return value:
  Value of the CYLINDER LOW register.
*/

   unsigned char FS_FLASH_HW_X_GetCylLow(FS_u32 Unit) {
   return 0;
}


/*********************************************************************
*
*             FS_FLASH_HW_X_GetData
*
  Description:
  FS driver hardware layer function. Read the RD DATA register.

  Parameters:
  Unit        - Unit number.
 
  Return value:
  Value of the RD DATA register.
*/

   FS_u16 FS_FLASH_HW_X_GetData(FS_u32 Unit) {
   return 0;
}


/*********************************************************************
*
*             FS_FLASH_HW_X_GetDevice
*
  Description:
  FS driver hardware layer function. Read the DEVICE/HEAD register.

  Parameters:
  Unit        - Unit number.
 
  Return value:
  Value of the DEVICE/HEAD register.
*/

   unsigned char FS_FLASH_HW_X_GetDevice(FS_u32 Unit) {
   return 0;
}



/*********************************************************************
*
*             FS_FLASH_HW_X_GetError
*
  Description:
  FS driver hardware layer function. Read the ERROR register.

  Parameters:
  Unit        - Unit number.
 
  Return value:
  Value of the ERROR register.
*/

   unsigned char FS_FLASH_HW_X_GetError(FS_u32 Unit) {
   return 0;
}




/*********************************************************************
*
*             FS_FLASH_HW_X_GetSectorCount
*
  Description:
  FS driver hardware layer function. Read the SECTOR COUNT register.

  Parameters:
  Unit        - Unit number.
 
  Return value:
  Value of the SECTOR COUNT register.
*/

  unsigned char FS_FLASH_HW_X_GetSectorCount(FS_u32 Unit) {
  return 0;
}



/*********************************************************************
*
*             FS_FLASH_HW_X_GetSectorNo
*
  Description:
  FS driver hardware layer function. Read the SECTOR NUMBER register.

  Parameters:
  Unit        - Unit number.
 
  Return value:
  Value of the SECTOR NUMBER register.
*/

  unsigned char FS_FLASH_HW_X_GetSectorNo(FS_u32 Unit) {
  return 0;
}



/*********************************************************************
*
*             FS_FLASH_HW_X_GetStatus
*
  Description:
  FS driver hardware layer function. Read the STATUS register.

  Parameters:
  Unit        - Unit number.
 
  Return value:
  Value of the STATUS register.
*/

   unsigned char FS_FLASH_HW_X_GetStatus(FS_u32 Unit) {
   return 0;
}



/*********************************************************************
*
*             FS_FLASH_HW_X_SetCommand
*
  Description:
  FS driver hardware layer function. Set the COMMAND register.

  Parameters:
  Unit        - Unit number.
  Data        - Value to write to the COMMAND register.
 
  Return value:
  None.
*/

   void FS_FLASH_HW_X_SetCommand(FS_u32 Unit, unsigned char Data) {
   ;
}


/*********************************************************************
*
*             FS_FLASH_HW_X_SetCylLow
*
  Description:
  FS driver hardware layer function. Set the CYLINDER LOW register.

  Parameters:
  Unit        - Unit number.
  Data        - Value to write to the CYLINDER LOW register.
 
  Return value:
  None.
*/

   void FS_FLASH_HW_X_SetCylLow(FS_u32 Unit, unsigned char Data) {
   ;
}





/*********************************************************************
*
*             FS_FLASH_HW_X_SetCylHigh
*
  Description:
  FS driver hardware layer function. Set the CYLINDER HIGH register.

  Parameters:
  Unit        - Unit number.
  Data        - Value to write to the CYLINDER HIGH register.
 
  Return value:
  None.
*/

   void FS_FLASH_HW_X_SetCylHigh(FS_u32 Unit, unsigned char Data) { 
   ;
}


/*********************************************************************
*
*             FS_FLASH_HW_X_SetData
*
  Description:
  FS driver hardware layer function. Set the WR DATA register.

  Parameters:
  Unit        - Unit number.
  Data        - Data to be set.
 
  Return value:
  None.
*/

   void FS_FLASH_HW_X_SetData(FS_u32 Unit, FS_u16 Data) {
   ;
}


/*********************************************************************
*
*             FS_FLASH_HW_X_SetDevice
*
  Description:
  FS driver hardware layer function. Set the DEVICE/HEAD register.

  Parameters:
  Unit        - Unit number.
  Data        - Value to write to the DEVICE/HEAD register.
 
  Return value:
  None.
*/

   void FS_FLASH_HW_X_SetDevice(FS_u32 Unit, unsigned char Data) {
   ;
} 


/*********************************************************************
*
*             FS_FLASH_HW_X_SetFeatures
*
  Description:
  FS driver hardware layer function. Set the FEATURES register.

  Parameters:
  Unit        - Unit number.
  Data        - Value to write to the FEATURES register.
 
  Return value:
  None.
*/

   void FS_FLASH_HW_X_SetFeatures(FS_u32 Unit, unsigned char Data) { 
   ;
}


/*********************************************************************
*
*             FS_FLASH_HW_X_SetSectorCount
*
  Description:
  FS driver hardware layer function. Set the SECTOR COUNT register.

  Parameters:
  Unit        - Unit number.
  Data        - Value to write to the SECTOR COUNT register.
 
  Return value:
  None.
*/

   void FS_FLASH_HW_X_SetSectorCount(FS_u32 Unit, unsigned char Data) {
   ;
}




/*********************************************************************
*
*             FS_FLASH_HW_X_SetSectorNo
*
  Description:
  FS driver hardware layer function. Set the SECTOR NUMBER register.

  Parameters:
  Unit        - Unit number.
  Data        - Value to write to the SECTOR NUMBER register.
 
  Return value:
  None.
*/


   void FS_FLASH_HW_X_SetSectorNo(FS_u32 Unit, unsigned char Data) { 
   ;
}
/*********************************************************************
*
*             FS_FLASH_HW_X_SetDevControl
*
  Description:
  FS driver hardware layer function. Set the DEVICE CONTROL register.

  Parameters:
  Unit        - Unit number.
  Data        - Value to write to the DEVICE CONTROL register.
 
  Return value:
  None.
*/

  void FS_FLASH_HW_X_SetDevControl(FS_u32 Unit, unsigned char Data) {
  ;
        
}


char FS_FLASH_HW_X_DetectStatus(FS_u32 Unit) {
	return NandReadStatus();
}



int FS__FLASH_Init(FS_u32 Unit){
    return Nand_init();
}


int FS__FLASH_ReadSector(FS_u32 Unit,unsigned long Sector,unsigned char *pBuffer){
	return  Nand_io(Sector,(U32*)pBuffer,1);
}



int FS__FLASH_WriteSector(FS_u32 Unit,unsigned long Sector,unsigned char *pBuffer){	   
	return  Nand_io(Sector,(U32*)pBuffer,0);
}














#endif /* FS_USE_FLASH_DRIVER */


⌨️ 快捷键说明

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