Operating System
Macros | Functions
fsapi.h File Reference

below define the api for filesystem. they are low level api. More...

#include <stdint.h>
#include "../FATMacro.h"
#include "../filesystem.h"
#include "../fsutilities.h"
#include "../../include/mystring.h"
#include "fsErrorCode.h"
#include "../../include/utilities.h"
#include "../../include/stdio.h"

Go to the source code of this file.

Macros

#define ERR_NOT_FOUND   -1
 file not found More...
 
#define TYPE_FLDR   0
 type file directory More...
 
#define TYPE_FILE   1
 type file More...
 
#define TYPE_DOC   2
 type (reserved) document for file system More...
 

Functions

static FAT_ITEM__get_root_dir ()
 
static int16_t __has_next_item (const FAT_ITEM *p)
 
static int16_t __has_prev_item (const FAT_ITEM *p)
 
static FAT_ITEM__next_item (FAT_ITEM *p)
 
static FAT_ITEM__prev_item (FAT_ITEM *p)
 
static int16_t __FAT_item_type (const FAT_ITEM *p)
 
static int16_t __FAT_showable_item (const FAT_ITEM *p)
 
static FAT_ITEM__jmp_into_dir (const FAT_ITEM *p)
 
static int16_t __rm_this_file (FAT_ITEM *p)
 
static int16_t __run_this_file (FAT_ITEM *p)
 
static int16_t __load_program (const char *targetFilename)
 
static void __print_file_cluster_list (const FAT_ITEM *pfat)
 

Detailed Description

below define the api for filesystem. they are low level api.

Definition in file fsapi.h.

Macro Definition Documentation

◆ ERR_NOT_FOUND

#define ERR_NOT_FOUND   -1

file not found

Definition at line 13 of file fsErrorCode.h.

Function Documentation

◆ __FAT_item_type()

static int16_t __FAT_item_type ( const FAT_ITEM p)
inlinestatic

return the type of a fat item

Returns
macro indicating the type
See also
FileType

Definition at line 83 of file fsapi.h.

◆ __FAT_showable_item()

static int16_t __FAT_showable_item ( const FAT_ITEM p)
inlinestatic

whether the item is showable

Returns
true only if it is not TYPE_DOC
See also
FileType

Definition at line 95 of file fsapi.h.

◆ __get_root_dir()

static FAT_ITEM* __get_root_dir ( )
inlinestatic

return a pointer pointed to root directory

Parameters
None
Returns
pointer to fat item.

Definition at line 35 of file fsapi.h.

◆ __has_next_item()

static int16_t __has_next_item ( const FAT_ITEM p)
inlinestatic

whether a fat item has an available next item. available means not deleted

Definition at line 42 of file fsapi.h.

◆ __has_prev_item()

static int16_t __has_prev_item ( const FAT_ITEM p)
inlinestatic
See also
__has_next_item

Definition at line 51 of file fsapi.h.

◆ __jmp_into_dir()

static FAT_ITEM* __jmp_into_dir ( const FAT_ITEM p)
inlinestatic

jump into the directory that the pointer points

Parameters
pthe directory that is currently pointing
Returns
a new pointer that point at the new directory entered

Definition at line 102 of file fsapi.h.

◆ __load_program()

static int16_t __load_program ( const char *  targetFilename)
inlinestatic

try and load the program. search from the root directory, trying to match filename. if file is found, try runing it by calling __run_this_file.

Parameters
targetFilenamethe file to load. without '.ext'. no longer than 5 bytes.
Returns
errorcode.
NO_ERR if no error
See also
fsErrorCode.h

Definition at line 171 of file fsapi.h.

◆ __next_item()

static FAT_ITEM* __next_item ( FAT_ITEM p)
inlinestatic

get the next item of a fat item

Parameters
pfat item pointer

Definition at line 62 of file fsapi.h.

◆ __prev_item()

static FAT_ITEM* __prev_item ( FAT_ITEM p)
inlinestatic
See also
__next_item

Definition at line 71 of file fsapi.h.

◆ __print_file_cluster_list()

static void __print_file_cluster_list ( const FAT_ITEM pfat)
inlinestatic

no directly run it

Definition at line 187 of file fsapi.h.

◆ __rm_this_file()

static int16_t __rm_this_file ( FAT_ITEM p)
inlinestatic

try and delete a fat item (file or directory)

Returns
error code. defined in fsErrorCode.h
return NO_ERR if no error

Definition at line 115 of file fsapi.h.

◆ __run_this_file()

static int16_t __run_this_file ( FAT_ITEM p)
inlinestatic

helper function. no need to directly call it. check whether it is run-able. load EVERY-SECTOR into memory.

Returns
forever return 0 currently.
See also
fsErrorCode.h

Definition at line 142 of file fsapi.h.