Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
diskio.c
00001 /*-----------------------------------------------------------------------*/ 00002 /* Low level disk I/O module skeleton for FatFs (C)ChaN, 2013 */ 00003 /* */ 00004 /* Portions COPYRIGHT 2014 STMicroelectronics */ 00005 /* Portions Copyright (C) 2012, ChaN, all right reserved */ 00006 /*-----------------------------------------------------------------------*/ 00007 /* If a working storage control module is available, it should be */ 00008 /* attached to the FatFs via a glue function rather than modifying it. */ 00009 /* This is an example of glue functions to attach various exsisting */ 00010 /* storage control module to the FatFs module with a defined API. */ 00011 /*-----------------------------------------------------------------------*/ 00012 00013 /** 00014 ****************************************************************************** 00015 * @file diskio.c 00016 * @author MCD Application Team 00017 * @version V1.1.0 00018 * @date 22-April-2014 00019 * @brief FatFs low level disk I/O module. 00020 ****************************************************************************** 00021 * @attention 00022 * 00023 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 00024 * You may not use this file except in compliance with the License. 00025 * You may obtain a copy of the License at: 00026 * 00027 * http://www.st.com/software_license_agreement_liberty_v2 00028 * 00029 * Unless required by applicable law or agreed to in writing, software 00030 * distributed under the License is distributed on an "AS IS" BASIS, 00031 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00032 * See the License for the specific language governing permissions and 00033 * limitations under the License. 00034 * 00035 ****************************************************************************** 00036 */ 00037 00038 /* Includes ------------------------------------------------------------------*/ 00039 #include "diskio.h" 00040 #include "ff_gen_drv.h" 00041 00042 /* Private typedef -----------------------------------------------------------*/ 00043 /* Private define ------------------------------------------------------------*/ 00044 /* Private variables ---------------------------------------------------------*/ 00045 extern Disk_drvTypeDef disk; 00046 00047 /* Private function prototypes -----------------------------------------------*/ 00048 /* Private functions ---------------------------------------------------------*/ 00049 00050 /** 00051 * @brief Initializes a Drive 00052 * @param pdrv: Physical drive number (0..) 00053 * @retval DSTATUS: Operation status 00054 */ 00055 DSTATUS disk_initialize(BYTE pdrv) 00056 { 00057 DSTATUS stat = RES_OK; 00058 00059 if(disk.is_initialized[pdrv] == 0) 00060 { 00061 disk.is_initialized[pdrv] = 1; 00062 stat = disk.drv[pdrv]->disk_initialize (); 00063 } 00064 return stat; 00065 } 00066 00067 /** 00068 * @brief Gets Disk Status 00069 * @param pdrv: Physical drive number (0..) 00070 * @retval DSTATUS: Operation status 00071 */ 00072 DSTATUS disk_status(BYTE pdrv) 00073 { 00074 DSTATUS stat; 00075 00076 stat = disk.drv[pdrv]->disk_status (); 00077 return stat; 00078 } 00079 00080 /** 00081 * @brief Reads Sector(s) 00082 * @param pdrv: Physical drive number (0..) 00083 * @param *buff: Data buffer to store read data 00084 * @param sector: Sector address (LBA) 00085 * @param count: Number of sectors to read (1..128) 00086 * @retval DRESULT: Operation result 00087 */ 00088 DRESULT disk_read(BYTE pdrv, BYTE *buff, DWORD sector, BYTE count) 00089 { 00090 DRESULT res; 00091 00092 res = disk.drv[pdrv]->disk_read (buff, sector, count); 00093 return res; 00094 } 00095 00096 /** 00097 * @brief Writes Sector(s) 00098 * @param pdrv: Physical drive number (0..) 00099 * @param *buff: Data to be written 00100 * @param sector: Sector address (LBA) 00101 * @param count: Number of sectors to write (1..128) 00102 * @retval DRESULT: Operation result 00103 */ 00104 #if _USE_WRITE == 1 00105 DRESULT disk_write(BYTE pdrv, const BYTE *buff, DWORD sector, BYTE count) 00106 { 00107 DRESULT res; 00108 00109 res = disk.drv[pdrv]->disk_write (buff, sector, count); 00110 return res; 00111 } 00112 #endif /* _USE_WRITE == 1 */ 00113 00114 /** 00115 * @brief I/O control operation 00116 * @param pdrv: Physical drive number (0..) 00117 * @param cmd: Control code 00118 * @param *buff: Buffer to send/receive control data 00119 * @retval DRESULT: Operation result 00120 */ 00121 #if _USE_IOCTL == 1 00122 DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff) 00123 { 00124 DRESULT res; 00125 00126 res = disk.drv[pdrv]->disk_ioctl (cmd, buff); 00127 return res; 00128 } 00129 #endif /* _USE_IOCTL == 1 */ 00130 00131 /** 00132 * @brief Gets Time from RTC 00133 * @param None 00134 * @retval Time in DWORD 00135 */ 00136 DWORD get_fattime (void) 00137 { 00138 return 0; 00139 } 00140 00141 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 00142
Generated on Tue Jul 12 2022 20:10:41 by
