CTS-SAT-1-OBC-Firmware
Loading...
Searching...
No Matches
lfs_telecommand_defs.c File Reference
Include dependency graph for lfs_telecommand_defs.c:

Functions

uint8_t TCMDEXEC_fs_format_storage (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len)
 
uint8_t TCMDEXEC_fs_mount (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len)
 
uint8_t TCMDEXEC_fs_unmount (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len)
 
uint8_t TCMDEXEC_fs_list_directory (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len)
 Telecommand: List all the files and directories within a given directory.
 
uint8_t TCMDEXEC_fs_list_directory_json (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len)
 Telecommand: List all the files and directories within a given directory, as a JSON dict (key are paths, values are sizes)
 
uint8_t TCMDEXEC_fs_make_directory (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len)
 Telecommand: Create a directory.
 
uint8_t TCMDEXEC_fs_write_file_str (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len)
 Telecommand: Write data to a file in LittleFS.
 
uint8_t TCMDEXEC_fs_write_file_hex (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len)
 Telecommand: Write hex data to a file in LittleFS with offset support.
 
uint8_t TCMDEXEC_fs_delete_file (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len)
 Telecommand: Deletes a specified file in LittleFS.
 
static uint8_t parse_arg_str_for_file_offset_length (const char args_str[], char *dest_filename, uint16_t dest_filename_size, uint32_t *dest_offset, uint32_t *dest_length)
 Parse a telecommand argument str for the standard filename/offset/length arguments for reading files.
 
uint8_t TCMDEXEC_fs_read_file_hex (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len)
 Reads a file from LittleFS, and responds with its contents as 2-digit hex bytes (no spaces).
 
uint8_t TCMDEXEC_fs_read_text_file (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len)
 Reads a file from LittleFS, and responds with its contents as a string.
 
uint8_t TCMDEXEC_fs_read_file_sha256_hash_json (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len)
 Calculates the SHA256 hash of a file in LittleFS and returns it as a little-endian hex string.
 
uint8_t TCMDEXEC_fs_demo_write_then_read (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len)
 
uint8_t TCMDEXEC_fs_benchmark_write_read (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len)
 Telecommand: Benchmark LittleFS write and read operations.
 

Function Documentation

◆ parse_arg_str_for_file_offset_length()

static uint8_t parse_arg_str_for_file_offset_length ( const char args_str[],
char * dest_filename,
uint16_t dest_filename_size,
uint32_t * dest_offset,
uint32_t * dest_length )
static

Parse a telecommand argument str for the standard filename/offset/length arguments for reading files.

Parameters
args_str
dest_filename
dest_filename_size
dest_offset
dest_length
Returns
0 on success, >0 on error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TCMDEXEC_fs_benchmark_write_read()

uint8_t TCMDEXEC_fs_benchmark_write_read ( const char * args_str,
char * response_output_buf,
uint16_t response_output_buf_len )

Telecommand: Benchmark LittleFS write and read operations.

Parameters
args_str
  • Arg 0: Write chunk size (bytes)
  • Arg 1: Write chunk count
Returns
0 on success, 1 if error parsing args, 2 if benchmark failed
Note
The maximum write chunk size is 127 bytes, apparently; need to investigate why so small.
Here is the call graph for this function:

◆ TCMDEXEC_fs_delete_file()

uint8_t TCMDEXEC_fs_delete_file ( const char * args_str,
char * response_output_buf,
uint16_t response_output_buf_len )

Telecommand: Deletes a specified file in LittleFS.

Parameters
args_str
  • Arg 0: File name to be deleted
Note
Do not add quotations around the argument, write as is.
Here is the call graph for this function:

◆ TCMDEXEC_fs_demo_write_then_read()

uint8_t TCMDEXEC_fs_demo_write_then_read ( const char * args_str,
char * response_output_buf,
uint16_t response_output_buf_len )
Here is the call graph for this function:

◆ TCMDEXEC_fs_format_storage()

uint8_t TCMDEXEC_fs_format_storage ( const char * args_str,
char * response_output_buf,
uint16_t response_output_buf_len )
Here is the call graph for this function:

◆ TCMDEXEC_fs_list_directory()

uint8_t TCMDEXEC_fs_list_directory ( const char * args_str,
char * response_output_buf,
uint16_t response_output_buf_len )

Telecommand: List all the files and directories within a given directory.

Parameters
args_str
  • Arg 0: Root Directory path as string
  • Arg 1: (Offset) Number of entries to skip at the beginning
  • Arg 2: (Count) Number entries to display
Here is the call graph for this function:

◆ TCMDEXEC_fs_list_directory_json()

uint8_t TCMDEXEC_fs_list_directory_json ( const char * args_str,
char * response_output_buf,
uint16_t response_output_buf_len )

Telecommand: List all the files and directories within a given directory, as a JSON dict (key are paths, values are sizes)

Parameters
args_str
  • Arg 0: Root Directory path as string
  • Arg 1: (Offset) Number of entries to skip at the beginning
  • Arg 2: (Count) Number entries to display
Note
In the resulting JSON, the JSON value of directories is "null".
Here is the call graph for this function:

◆ TCMDEXEC_fs_make_directory()

uint8_t TCMDEXEC_fs_make_directory ( const char * args_str,
char * response_output_buf,
uint16_t response_output_buf_len )

Telecommand: Create a directory.

Parameters
args_str
  • Arg 0: Directory Name as string (e.g., "/dir1", "/dir1/subdir1")
Here is the call graph for this function:

◆ TCMDEXEC_fs_mount()

uint8_t TCMDEXEC_fs_mount ( const char * args_str,
char * response_output_buf,
uint16_t response_output_buf_len )
Here is the call graph for this function:

◆ TCMDEXEC_fs_read_file_hex()

uint8_t TCMDEXEC_fs_read_file_hex ( const char * args_str,
char * response_output_buf,
uint16_t response_output_buf_len )

Reads a file from LittleFS, and responds with its contents as 2-digit hex bytes (no spaces).

Parameters
args_str
  • Arg 0: File path as string
  • Arg 1: Start offset (bytes). Nominally, pick 0.
  • Arg 2: Length to read (bytes). 0 to read max.
Returns
0 on success, >0 on error
Here is the call graph for this function:

◆ TCMDEXEC_fs_read_file_sha256_hash_json()

uint8_t TCMDEXEC_fs_read_file_sha256_hash_json ( const char * args_str,
char * response_output_buf,
uint16_t response_output_buf_len )

Calculates the SHA256 hash of a file in LittleFS and returns it as a little-endian hex string.

Parameters
args_str
  • Arg 0: File path as string
  • Arg 1: Start offset (bytes). Nominally, pick 0.
  • Arg 2: Length to read (bytes). 0 to read max.
Returns
0 on success, >0 on error
Here is the call graph for this function:

◆ TCMDEXEC_fs_read_text_file()

uint8_t TCMDEXEC_fs_read_text_file ( const char * args_str,
char * response_output_buf,
uint16_t response_output_buf_len )

Reads a file from LittleFS, and responds with its contents as a string.

Parameters
args_str
  • Arg 0: File path as string
  • Arg 1: Start offset (bytes). Nominally, pick 0.
  • Arg 2: Length to read (bytes). 0 to read max.
Returns
0 on success, >0 on error
Here is the call graph for this function:

◆ TCMDEXEC_fs_unmount()

uint8_t TCMDEXEC_fs_unmount ( const char * args_str,
char * response_output_buf,
uint16_t response_output_buf_len )
Here is the call graph for this function:

◆ TCMDEXEC_fs_write_file_hex()

uint8_t TCMDEXEC_fs_write_file_hex ( const char * args_str,
char * response_output_buf,
uint16_t response_output_buf_len )

Telecommand: Write hex data to a file in LittleFS with offset support.

Parameters
args_str
  • Arg 0: File path as string
  • Arg 1: Offset within the file to start writing (uint64)
  • Arg 2: Hex string to write to file (e.g., "DEADBEEF" or "DE AD BE EF")
Note
The maximum number of bytes that can be written is 105 bytes
Here is the call graph for this function:

◆ TCMDEXEC_fs_write_file_str()

uint8_t TCMDEXEC_fs_write_file_str ( const char * args_str,
char * response_output_buf,
uint16_t response_output_buf_len )

Telecommand: Write data to a file in LittleFS.

Parameters
args_str
  • Arg 0: File path as string
  • Arg 1: String to write to file (up to 512 bytes)
Here is the call graph for this function: