Instead of passing FatFS structs around, unmount; other changes

This commit is contained in:
TuxSH
2018-05-05 17:33:49 +02:00
parent 0fca6c2296
commit 67b76cc8f1
12 changed files with 54 additions and 76 deletions

View File

@@ -92,7 +92,7 @@ int main(void) {
printk("Please do not seek support for it until it is done.\n");
generic_panic();
#endif
/* Try to load the SBK into the security engine, if possible. */
/* TODO: Should this be done later? */
load_sbk();
@@ -115,11 +115,10 @@ int main(void) {
args->lfb = (uint32_t *)lfb_base;
args->console_col = video_get_col();
args->console_row = video_get_row();
save_sd_state(&args->sd_mmc, &args->sd_fs);
save_sd_state(&args->sd_mmc);
f_unmount("");
/* Jump to Stage 2. */
stage2_entrypoint(STAGE2_ARGC, stage2_argv);
return 0;
}

View File

@@ -10,15 +10,13 @@ FATFS sd_fs;
static int initialized_sd = 0;
static int mounted_sd = 0;
void save_sd_state(void **mmc, void **ff) {
void save_sd_state(void **mmc) {
*mmc = &sd_mmc;
*ff = &ff;
}
void resume_sd_state(void *mmc, void *ff) {
void resume_sd_state(void *mmc) {
sd_mmc = *(struct mmc *)mmc;
sd_fs = *(FATFS *)ff;
initialized_sd = 1;
mounted_sd = 1;
}
int initialize_sd(void) {

View File

@@ -5,8 +5,8 @@
#include "sdmmc.h"
#include "lib/fatfs/ff.h"
void save_sd_state(void **mmc, void **ff);
void resume_sd_state(void *mmc, void *ff);
void save_sd_state(void **mmc);
void resume_sd_state(void *mmc);
size_t read_sd_file(void *dst, size_t dst_size, const char *filename);

View File

@@ -27,10 +27,9 @@ typedef struct {
uint32_t console_row;
uint32_t console_col;
void *sd_mmc;
void *sd_fs;
} stage2_args_t;
const char *stage2_get_program_path(void);
stage2_entrypoint_t load_stage2(const char *bct0);
#endif
#endif