📄 sdapi.h
字号:
*
* Processing: Close a file
*
* Entries:
* PCFD fd File Handle
*
* Returns:
*
*****************************************************************************/
INT16 po_close(PCFD fd);
/*****************************************************************************
* Name: po_flush
*
* Processing: Flush a file
*
* Entries:
* PCFD fd File Handle
*
* Returns:
* Sucessful if YES
* Failure if NO
*****************************************************************************/
SDBOOL po_flush(PCFD fd);
/*****************************************************************************
* Name: po_lseek
*
* Processing: Move the file pointer to a specific location
*
* Entries:
* PCFD fd File Handle
* ULONG offset
* INT16 origin
*
* Returns:
* New location of the file handle
*****************************************************************************/
ULONG po_lseek(PCFD fd, INT32 offset, INT32 origin, INT16 *err_flag);
/*****************************************************************************
* Name: po_open
*
* Processing: Open a file
*
* Entries:
* TEXT name File Name
* UINT16 flag
* UINT16 mode
*
* Returns:
* File Handle
*****************************************************************************/
PCFD po_open(TEXT *name, UINT16 flag, UINT16 mode);
/*****************************************************************************
* Name: po_read
*
* Processing: Read data from a file
*
* Entries:
* PCFD fd File Handle
* UCHAR buf Buffer Pointer
* UCOUNT count Number of bytes to write
*
* Returns:
* Number of bytes sucessful to read from file
*****************************************************************************/
UCOUNT po_read(PCFD fd, UCHAR *buf, UCOUNT count);
/*****************************************************************************
* Name: po_write
*
* Processing: Write data to a file
*
* Entries:
* PCFD fd File Handle
* UCHAR *buf Buffer Pointer
* UCOUNT count Number of bytes to write
*
* Returns:
* Number of bytes sucessful writing to file
*****************************************************************************/
UCOUNT po_write(PCFD fd, UCHAR *buf, UCOUNT count);
/*****************************************************************************
* Name: po_truncate
*
* Processing: Truncate a file to a specific location
*
* Entries:
* PCFD fd File Handle
* ULONG offset Specific location
*
* Returns:
* Sucessful if YES
* Failure if NO
*****************************************************************************/
SDBOOL po_truncate(PCFD fd, INT32 offset);
/******************************************************************************
* Name: PO_EXTEND_FILE - Extend a file by N contiguous clusters.
*
* Description:
* Given a file descriptor, n_clusters clusters and method, extend
* the file and update the file size.
*
* Method may be one of the following:
* PC_FIRST_FIT - The first free chain >= n_clusters is alloced
* PC_BEST_FIT - The smallest chain >= n_clusters is alloced
* PC_WORST_FIT - The largest chain >= n_clusters is alloced
*
* Note: PC_FIRST_FIT is significantly faster than the others
*
* Entries:
* PCFD fd
* UINT32 n_clusters
* INT16 method
* SDBOOL preerase_region
*
* Returns
* 0xFFFF if an error occured.
* Returns n_clusters if the file was extended. Otherwise it returns
* the largest free chain available. If it n_clusters is not returned
* the files was not extended.
*
* If the return value is not n_clusters, fs_user->p_errno will
* be set with one of the following:
* PENBADF - File descriptor invalid or open read only
* PENOSPC - IO failure
*
******************************************************************************/
UINT16 po_extend_file(PCFD fd, UINT32 n_clusters, INT16 method, SDBOOL preerase_region);
/****************************************************************************/
/************************* END OF FILE SYSTEM API ***************************/
/****************************************************************************/
#endif /* (USE_FILE_SYSTEM) */
/*****************************************************************************/
/****************************** INTERFACE API ********************************/
/*****************************************************************************/
/****************************** SPI SECTION ********************************/
/********************** This is for SPI Controller ONLY ********************/
#if (USE_SPI || USE_SPI_EMULATION)
/*****************************************************************************
* Name: spi_init
*
* Processing:
* Initialize data structure for SPI controller.
*
* Entries:
* INT16 driveno Driver number
*
* Returns:
* YES if successful
* NO if failure
*
*****************************************************************************/
SDBOOL spi_init(SDVOID);
/*****************************************************************************
* Name: spi_drive_open
*
* Processing:
* Set up internal data structure and configure the system.
*
* Entries:
* INT16 driveno Driver number
*
* Returns:
* YES if successful
* NO if failure
*
*****************************************************************************/
SDBOOL spi_drive_open(INT16 driveno);
/*****************************************************************************
* Name: spi_drive_close
*
* Processing:
* Release internal data structure and restore memory configuration
*
* Entries:
* INT16 driveno Driver number
*
* Returns:
* YES if successful
* NO if failure
*
*****************************************************************************/
SDBOOL spi_drive_close(INT16 driveno);
/*****************************************************************************
* Name: spi_read_serial
*
* Processing:
* Get the drive geometry information.
*
* Entries:
* INT16 driveno Driver number
* PDRV_GEOMETRY_DESC idDrvPtr Device Geometry buffer
*
* Returns:
* YES if successful
* NO if failure
*
*****************************************************************************/
SDBOOL spi_read_serial(INT16 driveno, PDRV_GEOMETRY_DESC idDrvPtr);
/*****************************************************************************
* Name: spi_read
*
* Processing:
* Get data from the drive at the requested logical block addresses.
*
* Entries:
* INT16 driveno Driver number
* ULONG sector Starting logical block address
* UCHAR *buffer Data buffer
* UCOUNT count Number of sector to transfer
*
* Returns:
* YES if successful
* NO if failure
*
*****************************************************************************/
SDBOOL spi_read(INT16 driveno, ULONG sector, UCHAR *buffer, UCOUNT count);
/*****************************************************************************
* Name: spi_write
*
* Processing:
* Send information to the specific location on the drive.
*
* Entries:
* INT16 driveno Driver number
* ULONG sector Starting logical block address
* UCHAR *buffer Data buffer
* UCOUNT count Number of sector to transfer
*
* Returns:
* YES if successful
* NO if failure
*
*****************************************************************************/
SDBOOL spi_write(INT16 driveno, ULONG sector, UCHAR *buffer, UCOUNT count);
/*****************************************************************************
* Name: spi_erase
*
* Processing:
* Clear the LBA to make it ready for the next write access. This
* will improve the write data access.
*
* Entries:
* INT16 driveno Driver number
*
* Returns:
* YES if successful
* NO if failure
*
*****************************************************************************/
SDBOOL spi_erase(INT16 driveno, ULONG sector, UCOUNT count);
/* Configure the block size */
SDBOOL setBlockSize( INT16 driveno, UINT16 blockSize );
SDBOOL IsCardBusy(INT16 driveno);
#endif /* (USE_SPI || USE_SPI_EMULATION) */
/****************************** MMC SECTION ********************************/
/********************** This is for MMC Controller ONLY ********************/
#if (USE_MMC || USE_MMC_EMULATION)
/*****************************************************************************
* Name: mmc_init
*
* Processing:
* Initialize data structure for MMC controller.
*
* Entries:
* INT16 driveno Driver number
*
* Returns:
* YES if successful
* NO if failure
*
*****************************************************************************/
SDBOOL mmc_init(SDVOID);
/*****************************************************************************
* Name: mmc_drive_open
*
* Processing:
* Set up internal data structure and configure the system.
*
* Entries:
* INT16 driveno Driver number
*
* Returns:
* YES if successful
* NO if failure
*
*****************************************************************************/
SDBOOL mmc_drive_open(INT16 driveno);
/*****************************************************************************
* Name: mmc_drive_close
*
* Processing:
* Release internal data structure and restore memory configuration
*
* Entries:
* INT16 driveno Driver number
*
* Returns:
* YES if successful
* NO if failure
*
*****************************************************************************/
SDBOOL mmc_drive_close(INT16 driveno);
/*****************************************************************************
* Name: mmc_read_serial
*
* Processing:
* Get the drive geometry information.
*
* Entries:
* INT16 driveno Driver number
* PDRV_GEOMETRY_DESC idDrvPtr Device geometry buffer
*
* Returns:
* YES if successful
* NO if failure
*
*****************************************************************************/
SDBOOL mmc_read_serial(INT16 driveno, PDRV_GEOMETRY_DESC idDrvPtr);
/*****************************************************************************
* Name: mmc_read
*
* Processing:
* Get data from the drive at the requested logical block addresses.
*
* Entries:
* INT16 driveno Driver number
* ULONG sector Starting logical block address
* UCHAR *buffer Data buffer
* UCOUNT count Number of sector to transfer
*
* Returns:
* YES if successful
* NO if failure
*
*****************************************************************************/
SDBOOL mmc_read(INT16 driveno, ULONG sector, UCHAR *buffer, UCOUNT count);
/*****************************************************************************
* Name: mmc_write
*
* Processing:
* Send information to the specific location on the drive.
*
* Entries:
* INT16 driveno Driver number
* ULONG sector Starting logical block address
* UCHAR *buffer Data buffer
* UCOUNT count Number of sector to transfer
*
* Returns:
* YES if successful
* NO if failure
*
*****************************************************************************/
SDBOOL mmc_write(INT16 driveno, ULONG sector, UCHAR *buffer, UCOUNT count);
/*****************************************************************************
* Name: mmc_erase
*
* Processing:
* Clear the LBA to make it ready for the next write access. This
* will improve the write data access.
*
* Entries:
* INT16 driveno Driver number
* ULONG sector Starting logical block address
* UCOUNT count Number of sectors
*
* Returns:
* YES if successful
* NO if failure
*
*****************************************************************************/
SDBOOL mmc_erase(INT16 driveno, ULONG sector, UCOUNT count);
/* Configure the block size */
SDBOOL setBlockSize( INT16 driveno, UINT16 blockSize );
SDBOOL IsCardBusy(INT16 driveno);
#endif /* (USE_MMC || USE_MMC_EMULATION) */
#ifdef __cplusplus
}
#endif
#define __SDAPI_H__
#endif /* __SDAPI_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -