GONEC_ARTERY_FF/fs_interface.h

148 lines
4.0 KiB
C

//
// Created by cfif on 27.12.22.
//
#ifndef GONEC_GSM_FS_INTERFACE_H
#define GONEC_GSM_FS_INTERFACE_H
#include "cmsis_os.h"
#include "ff.h"
#include "LoggerToSerialPort.h"
extern const char dir_inbox[];
extern const char dir_outbox[];
extern const char dir_sentbox[];
extern const char dir_temp[];
extern const char dir_rep_out[];
extern const char dir_frag_inbox[];
extern const char dir_tracert[];
extern const char dir_kvitin[];
extern const char dir_web[];
extern const char dir_almhs[];
extern const char file_cur_almhs[];
extern const char file_tmp_almhs[];
extern const char dir_logs[];
extern const char dir_logs2[];
extern const char file_dir_proc[];
extern const char file_dir_tmp[];
extern const char file_setup[];
extern const char file_counter[];
#include "time.h"
#include "memory.h"
typedef struct __attribute__ ((packed)) {
uint32_t second: 5;
uint32_t minute: 6;
uint32_t hour: 5;
uint32_t day: 5;
uint32_t month: 4;
uint32_t year: 7;
} tFatTime;
void fatTimeToTimeStamp(uint32_t fatTime, struct tm *timestampTM, int32_t grn);
typedef struct {
tLoggerInterface *logger;
FATFS fs;
} tFs;
/*-----------------------------------------------------------------------*/
/* Create a Directory */
/*-----------------------------------------------------------------------*/
FRESULT f_mkdir_i (
tFs* fs,
const TCHAR* path
);
FRESULT f_readdir_i (
tFs* fs,
DIR* dp, /* Pointer to the open directory object */
FILINFO* fno /* Pointer to file information to return */
);
FRESULT f_opendir_i (
tFs* fs,
DIR* dp, /* Pointer to directory object to create */
const TCHAR* path /* Pointer to the directory path */
);
FRESULT f_open_i (
tFs* fs,
FIL* fp, /* Pointer to the blank file object */
const TCHAR* path, /* Pointer to the file name */
BYTE mode /* Access mode and open mode flags */
);
FRESULT f_write_i (
tFs* fs,
FIL* fp, /* Open file to be written */
const void* buff, /* Data to be written */
UINT btw, /* Number of bytes to write */
UINT* bw /* Number of bytes written */
);
FRESULT f_read_i (
tFs* fs,
FIL* fp, /* Open file to be read */
void* buff, /* Data buffer to store the read data */
UINT btr, /* Number of bytes to read */
UINT* br /* Number of bytes read */
);
FRESULT f_close_i (
tFs* fs,
FIL* fp /* Open file to be closed */
);
FRESULT f_unlink_i (
tFs* fs,
const TCHAR* path /* Pointer to the file or directory path */
);
FRESULT f_rename_i (
tFs* fs,
const TCHAR* path_old, /* Pointer to the object name to be renamed */
const TCHAR* path_new /* Pointer to the new name */
);
FRESULT f_findfirst_i (
tFs* fs,
DIR* dp, /* Pointer to the blank directory object */
FILINFO* fno, /* Pointer to the file information structure */
const TCHAR* path, /* Pointer to the directory to open */
const TCHAR* pattern /* Pointer to the matching pattern */
);
FRESULT f_findnext_i (
tFs* fs,
DIR* dp, /* Pointer to the open directory object */
FILINFO* fno /* Pointer to the file information structure */
);
/*-----------------------------------------------------------------------*/
/* Seek File Read/Write Pointer */
/*-----------------------------------------------------------------------*/
FRESULT f_lseek_i (
tFs* fs,
FIL* fp, /* Pointer to the file object */
FSIZE_t ofs /* File pointer from top of file */
);
/*-----------------------------------------------------------------------*/
/* Close Directory */
/*-----------------------------------------------------------------------*/
FRESULT f_closedir_i (
tFs* fs,
DIR *dp /* Pointer to the directory object to be closed */
);
#endif //GONEC_GSM_FS_INTERFACE_H