From 3a93185ff42ac7bffd8b6203b336ae32ef6c04ab Mon Sep 17 00:00:00 2001 From: Leo C Date: Tue, 17 Apr 2018 11:43:03 +0200 Subject: [PATCH] fat cp: reorg --- .gitignore | 2 ++ avr/cmd_fat.c | 23 ++++++++++------------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index c267536..55e046a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ /.tup /build-* /scratch +*.o + diff --git a/avr/cmd_fat.c b/avr/cmd_fat.c index 8acbf8a..f6e1bcc 100644 --- a/avr/cmd_fat.c +++ b/avr/cmd_fat.c @@ -36,8 +36,14 @@ /* TODO: detect_ramsize() should be moved to z80-if.c */ #define MAX_MEMORY CONFIG_SYS_RAMSIZE_MAX #define BUFFER_SIZE 512 +#define MAX_PATHLEN CONFIG_SYS_MAX_PATHLEN +typedef struct { + char *p_end; /* pointer to NULL at end of path */ + char p_path[MAX_PATHLEN + 1]; /* pointer to the start of a path */ +} PATH_T; + /* * Multible (fat) partitions per physical drive are not supported, * but we have up to 2 sdcard slots. @@ -45,6 +51,10 @@ FATFS FatFs0; FATFS FatFs1; +uint8_t *blockbuf; +int blockbuf_size; +PATH_T from; +PATH_T to; command_ret_t command_ret; void setup_fatfs(void) @@ -233,7 +243,6 @@ command_ret_t do_cd(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag UNUSED, int argc, return CMD_RET_SUCCESS; } -#define MAX_PATHLEN CONFIG_SYS_MAX_PATHLEN /* * Remove trailing slashes, @@ -438,11 +447,6 @@ FRESULT mkpath(TCHAR *path) */ -typedef struct { - char *p_end; /* pointer to NULL at end of path */ - char p_path[MAX_PATHLEN + 1]; /* pointer to the start of a path */ -} PATH_T; - static void strip_trailing_slash(PATH_T *p) { char *beg = p->p_path; @@ -540,13 +544,6 @@ char *path_basename(PATH_T *p) static uint8_t flags; -PATH_T from; -PATH_T to; -//PATH_T *from = &from_static; -//PATH_T *to = &to_static; -static uint8_t *blockbuf; -static int blockbuf_size; - #define F_FLAG (1<<3) // overwrite existing file ignoring write protection #define I_FLAG (1<<1) // prompt before overwrite (overrides a previous -n option) #define N_FLAG (1<<2) // do not overwrite an existing file (overrides a previous -i option) -- 2.39.2