HP85 GPIB Disk Emulator  1.0
HP85GPIBDiskEmulator
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions | Variables
fatfs_sup.c File Reference
#include "user_config.h"
#include "fatfs.h"
#include "mathio.h"
#include "time.h"

Go to the source code of this file.

Functions

MEMSPACE uint32_t tm_to_fat (tm_t *t)
 FAT time structer reference. More...
 
MEMSPACE DWORD get_fattime (void)
 Read time and convert to FAT32 time. More...
 
MEMSPACE void put_rc (int rc)
 display FatFs return code as ascii string More...
 
static MEMSPACE int fatfs_scan_files (char *path)
 Compute space used, number of directories and files contained under a specified directory. More...
 
MEMSPACE char * fatfs_fstype (int type)
 return a string with the file system type More...
 
MEMSPACE int fatfs_status (char *name)
 Compute space used, number of directories and files contained used by a drive. More...
 
MEMSPACE void fatfs_filinfo_list (FILINFO *info)
 Display FILINFO structure in a readable format. More...
 

Variables

FATFS Fatfs [FF_VOLUMES]
 FatFs Drive Volumes. More...
 
DWORD AccSize
 Total file space used. More...
 
WORD AccFiles
 Total number or Files and Directories. More...
 
WORD AccDirs
 

Function Documentation

◆ fatfs_filinfo_list()

MEMSPACE void fatfs_filinfo_list ( FILINFO info)

Display FILINFO structure in a readable format.

  • Credit: part of FatFs avr example project (C)ChaN, 2013.
  • Example:
    /// ----A 2014/10/16 00:39        14    test2.txt
    /// D---- 2014/10/12 21:29         0          tmp
    /// 
    @param[in] : FILINFO pointer
    @return  void 
    

Definition at line 340 of file fatfs_sup.c.

Referenced by fatfs_ls().

◆ fatfs_fstype()

MEMSPACE char* fatfs_fstype ( int  type)

return a string with the file system type

Parameters
[in]typefile system type
Returns
string with file system type

Definition at line 222 of file fatfs_sup.c.

Referenced by fatfs_status().

◆ fatfs_scan_files()

static MEMSPACE int fatfs_scan_files ( char *  path)
static

Compute space used, number of directories and files contained under a specified directory.

  • Credit: part of FatFs avr example project (C)ChaN, 2013
Parameters
[in]path
See also
f_opendir()
f_readdir()
AccDirs: Total number of directories
AccFiles: Total number of Files
AccSize: Total size of all files WARNING path MUST be big enought for the lonest path length
Returns
0 if no error

Definition at line 180 of file fatfs_sup.c.

Referenced by fatfs_status().

◆ fatfs_status()

MEMSPACE int fatfs_status ( char *  name)

Compute space used, number of directories and files contained used by a drive.

  • Credit: part of FatFs avr example project (C)ChaN, 2013
Parameters
[in]ptrDrive path like "/"
See also
f_getfree() drive free space
fatfs_scan_files()
AccDirs: Total number of directories
AccFiles: Total number of Files
AccSize: Total size of all files
Returns
1 on success 0 on error

Definition at line 259 of file fatfs_sup.c.

Referenced by fatfs_tests(), and mmc_init().

◆ get_fattime()

MEMSPACE DWORD get_fattime ( void  )

Read time and convert to FAT32 time.

Returns
FAT32 time.
See also
tm_to_fat().

Definition at line 129 of file fatfs_sup.c.

◆ put_rc()

MEMSPACE void put_rc ( int  rc)

display FatFs return code as ascii string

Credit: Part of FatFs avr example project (C)ChaN, 2013

Parameters
[in]rcFatFs status return code
Returns
void

Definition at line 145 of file fatfs_sup.c.

Referenced by dbf_close(), dbf_lseek(), dbf_open(), dbf_read(), dbf_write(), and mmc_init().

◆ tm_to_fat()

MEMSPACE uint32_t tm_to_fat ( tm_t t)

FAT time structer reference.

See also
rtc.h
http://lxr.free-electrons.com/source/fs/fat/misc.c
/// typedef struct
/// {
///     WORD   year;                                  /* 2000..2099 */
///     BYTE   month;                                 /* 1..12 */
///     BYTE   mday;                                  /* 1.. 31 */
///     BYTE   wday;                                  /* 1..7 */
///     BYTE   hour;                                  /* 0..23 */
///     BYTE   min;                                   /* 0..59 */
///     BYTE   sec;                                   /* 0..59 */
/// } RTC;
/// 

Convert Linux POSIX tm_t * to FAT32 time.

Parameters
[in]tPOSIX struct tm * to convert.
Returns
FAT32 time.

Definition at line 110 of file fatfs_sup.c.

Referenced by get_fattime().

Variable Documentation

◆ AccDirs

WORD AccDirs

Definition at line 164 of file fatfs_sup.c.

Referenced by fatfs_scan_files(), and fatfs_status().

◆ AccFiles

WORD AccFiles

Total number or Files and Directories.

Definition at line 164 of file fatfs_sup.c.

Referenced by fatfs_scan_files(), and fatfs_status().

◆ AccSize

DWORD AccSize

Total file space used.

Definition at line 161 of file fatfs_sup.c.

Referenced by fatfs_scan_files(), and fatfs_status().

◆ Fatfs

FATFS Fatfs[FF_VOLUMES]

FatFs Drive Volumes.

Definition at line 42 of file fatfs_sup.c.

Referenced by mmc_init().