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

📄 oem.h

📁 cayman提供的PXA270 wince下的bsp源码包
💻 H
字号:
/*****************************************************************************
*Filename: OEM.H - Defines, structures and prototypes for platform specific
*                     
* SanDisk Host Developer's Toolkit
*
* Copyright (c) 1997-2000 SanDisk Corporation
* All rights reserved.
* This code may not be redistributed in source or linkable object form
* without the consent of its author.
*
* Description: 
*       OEM function implementation.
*
****************************************************************************/

#ifndef __SDOEM__


#ifdef __cplusplus
extern "C" {
#endif


#include "sdtypes.h"
#include "sdconfig.h"


/* Function Prototype implementation for PLATFORM specific. */

/* These routines are system specific and implemented by the developers.
**
** The macros below allow the run-time driver to invoke the system
** specific codes.
**/

/****************************************************************************/
/*************************** DEPENDENT CODE *********************************/
/****************************************************************************/
/* These routines are system specific.  Mostly OEM dependent codes */


/****************************************************************************/
/****************************** I/O Access **********************************/
/****************************************************************************/

#if (USE_MEMMODE)
#else
UINT16 inpbyte(UINT32 addr);
SDVOID outpbyte(UINT32 addr, UINT16 dat);

#if (WORD_ACCESS_ONLY)
UINT16 inpword(UINT32 addr);
SDVOID outpword(UINT32 addr, UINT16 dat);
#endif
#endif /* (USE_MEMMODE) */



/*****************************************************************************
** These routines:
**      platform_critical_handler,
**      platform_report_error
** are in criterr.c and report.c and needed to be ported to the specific platform.
*****************************************************************************/


/**************************** Critical Error ********************************/
/* Critical error handler routine is in criterr.c */
/* Interaction between users and the HDTK. */
INT16 platform_critical_handler(INT16 drv, INT16 errno, ULONG sector);
#define CRITICAL_HANDLER(drv, errno, sector)  (platform_critical_handler(drv, errno, sector))


/***************************** Error Report *********************************/
/* platform_report_error routine is in report.c */
/* Report the error to user */
SDVOID platform_report_error(INT16 err);
#define REPORT_ERROR(err)       (platform_report_error(err))



/*****************************************************************************
/********************************* Timer ************************************/
/*****************************************************************************
** These routines:
**      platform_delayms
**      platform_get_ticks,
**      platform_ticks_per_second,
**      oem_getsysdate
** are in timer.c and needed to be ported for to the specific platform.
*****************************************************************************/
SDVOID platform_delayms(COUNT tdelay);    /* Time to delay in milisecond */
ULONG platform_get_ticks(SDVOID);         /* Get the current tick */
ULONG platform_ticks_p_second(SDVOID);    /* Ticks per second */


/* These macros are to run the system specific code at run-time.
** The macros are used by the FILE SYSTEM and the INTERFACE drivers.
*/
#define OS_WAIT(tdelay)         (platform_delayms(tdelay))
#define OS_GET_TICKS()          (platform_get_ticks())
#define OS_TICKS_P_SECOND()     (platform_ticks_p_second())


#if (USE_FILE_SYSTEM)
#if (RTFS_WRITE)
/* oem_getsysdate() in timer.c */
SDVOID oem_getsysdate(UINT16 *tdate, UINT16 *ttime);
#endif
#endif  /* USE_FILE_SYSTEM */



#if (USE_INTERRUPTS)

/*****************************************************************************
** These routines:
**      platform_controller_init,
**      platform_controller_close,
**      platform_clear_signal,
**      platform_set_signal,
**      platform_wait_for_action
** are in interupt.c and needed to be ported to the specific platform.
** These routines are for the interrupt implementation.
**
** The OS_XX_XX macros are for the FILE SYSTEM and INTERFACE drivers.
*****************************************************************************/


/*********************** IDE & PCMCIA interrupts ***************************/
SDVOID platform_controller_init(INT16 controller_no);
SDVOID platform_controller_close(INT16 controller_no);
SDVOID platform_clear_signal(INT16 controller_no);
SDVOID platform_set_signal(INT16 controller_no);
SDBOOL platform_wait_for_action(INT16 controller_no, COUNT time_out);

#define OS_CONTROLLER_INIT(controller_no)  (platform_controller_init(controller_no))
#define OS_CONTROLLER_CLOSE(controller_no) (platform_controller_close(controller_no))
#define OS_CLEAR_SIGNAL(controller_no)     (platform_clear_signal(controller_no))
#define OS_SET_SIGNAL(controller_no)       (platform_set_signal(controller_no))
#define OS_WAIT_FOR_ACTION(controller_no, time_out)  (platform_wait_for_action(controller_no, time_out))

#else   

#define OS_CONTROLLER_INIT(controller_no)
#define OS_CONTROLLER_CLOSE(controller_no)
#define OS_CLEAR_SIGNAL(controller_no)
#define OS_SET_SIGNAL(controller_no)
#define OS_WAIT_FOR_ACTION(controller_no, time_out) YES

#endif  /* USE_INTERRUPTS */

/*****************************************************************************
**************************** OEM related topics ******************************
******************************************************************************/


/**************************** SPI DRIVER SECTION *****************************/

#if (USE_SPI || USE_SPI_EMULATION)

SDVOID MMCSelectController(INT16 ctrlNo, INT16 cardno);

/* Intialize SPI hardware */
SDVOID spi_hw_init(INT16 controllerno);

/* Enable Chip Select */
SDVOID spi_cs_enable(INT16 driveno);

/* Disable Chip Select */
SDVOID spi_cs_disable(INT16 driveno);

#if (USE_SET_FEATURES)
UINT16 calculateDataCRC16 ( UCHAR *pdata, UINT16 data_length );
UINT16 checkResponseCRC ( UCHAR *response, UINT16 offset, UINT16 response_length );
UINT16 appendCmdCRC ( UCHAR *cmd_bytes, UINT16 cmd_length );
#else

#endif /* (!USE_SET_FEATURES) */

MMC_CC MMCStartTransfer(SDVOID);
MMC_CC MMCStopTransfer(SDVOID);

UINT16 calculateCmdCRC(UINT32 Args, UINT16 cmdIndex);
SDVOID startMMC80Clocks(INT16 ctrlno);
SDVOID mmcSendCommand(UINT32 cmd_arg, UINT16 cmd_index, UINT16 crcCMD);
MMC_CC getMMCResponseInfo(UINT16 *respBuff, UINT16 respType);
MMC_CC MMCPrepareAndSetup(UINT32 Arg, UINT16 Cmd, UINT16 noBlocks, UINT16 Resp);
/* MMC_CC checkCardBusy(INT16 ctrlno); */
SDBOOL checkCardBusy(UINT16 inData);
MMC_CC MMCTransmit(UCHAR *buffer, UINT16 dataLength, UINT16 noBLocks, UINT16 xferMode);
MMC_CC MMCReceive(UCHAR *buffer, UINT16 dataLength, UINT16 noBLocks, UINT16 xferMode);
SDVOID resetMMCController(UINT16 ctrlno);
SDBOOL setMMCClockRate(UINT16 ClockRate);

#if (USE_SPI && !USE_MEMMODE)
extern SDVOID setupMMcHostDataRegister(UINT16 cmdIndex, UINT16 *cmdDatContReg, UINT16 *noBlocks, UINT16 *blkLength);
#endif

#endif  /* (USE_SPI || USE_SPI_EMULATION) */


/**************************** MMC DRIVER SECTION ******************************/

#if (USE_MMC || USE_MMC_EMULATION)

UINT16 calculateDataCRC16 ( UCHAR *pdata, UINT16 data_length );
UINT16 checkResponseCRC ( UCHAR *response, UINT16 offset, UINT16 response_length );
UINT16 appendCmdCRC ( UCHAR *cmd_bytes, UINT16 cmd_length );
UINT16 calculateCmdCRC(UINT32 Args, UINT16 cmdIndex);

SDVOID MMCSelectController(INT16 ctrlNo, INT16 cardno);
SDVOID mmc_hw_init(INT16 ctrlno);
SDVOID startMMC80Clocks(INT16 ctrlno);
MMC_CC MMCPrepareAndSetup(UINT32 Arg, UINT16 Cmd, UINT16 noBlocks, UINT16 Resp);
MMC_CC getMMCResponseInfo(UCHAR *respBuff, UINT16 respLength, UINT16 respType);
MMC_CC MMCTransmit(UCHAR *buffer, UINT16 dataLength, UINT16 noBLocks, UINT16 xferMode);
MMC_CC MMCReceive(UCHAR *buffer, UINT16 dataLength, UINT16 noBLocks, UINT16 xferMode);
UINT16 getMMCStatus(SDVOID);
/* MMC_CC checkCardBusy( INT16 controller_no ); */
SDBOOL checkCardBusy(UINT16 inData);
SDVOID resetMMCController(UINT16 ctrlno);
SDVOID startMMCClock(SDVOID);
SDBOOL stopMMCClock(SDVOID);
SDBOOL setMMCClockRate(UINT16 ClockRate);

#endif /* (USE_MMC || USE_MMC_EMULATION) */

/* Static checking for device present */
SDBOOL is_device_changed (INT16 driveno);
INT16  get_extended_error(INT16 driveno);


/************************* END of DEPENDENT CODE ****************************/


#ifdef __cplusplus
}
#endif


#define __SDOEM__

#endif /* __SDOEM__ */



⌨️ 快捷键说明

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