Skip to content

Commit 1e5363c

Browse files
committed
Added FAT filesystem support
1 parent 7a57470 commit 1e5363c

File tree

12 files changed

+5762
-87
lines changed

12 files changed

+5762
-87
lines changed

SDL2/src/core/raspberry/SDL_raspberry.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,8 @@ void SDL_Interrupt_Handler() {
206206
USPiInterruptHandler ();
207207
#endif
208208
}
209+
210+
void log_printf (const char *ptr, ...)
211+
{
212+
// Do nothing
213+
}

kernel/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ OBJS = \
66
console.o \
77
emmc.o \
88
fb.o \
9+
ff.o \
910
platform.o \
1011
wiring.o
1112

kernel/common.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ OBJCOPY := $(TOOLCHAIN)-objcopy
1111
DEPDIR := .deps
1212

1313
ASFLAGS = --warn -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=softfp
14-
CFLAGS = -Wall -O2 -ffreestanding -marm -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=softfp -D__RASPBERRY_PI__ -I../kernel
14+
CFLAGS = -Wall -O2 -ffreestanding -marm -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=softfp -D__RASPBERRY_PI__ -I../kernel -I../uspi/include
1515
CPPFLAGS = $(CFLAGS) -fno-exceptions -fno-unwind-tables -fno-rtti
1616
LDFLAGS = -T ../kernel/raspberry.ld -nostartfiles -fno-exceptions -fno-unwind-tables -fno-rtti -Wl,-Map=kernel.map -o kernel.elf
1717

18-
LIBS = -L../kernel -lkernel
19-
LIBS_DEP = ../kernel/libkernel.a
18+
LIBS = -L../kernel -lkernel -L../uspi -luspi
19+
LIBS_DEP = ../kernel/libkernel.a ../uspi/libuspi.a
2020

2121
%.o: %.c
2222
@mkdir -p $(DEPDIR)/$(@D)

kernel/emmc.c

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -97,37 +97,7 @@ struct sd_scr
9797
int sd_version;
9898
};
9999

100-
struct emmc_block_dev
101-
{
102-
struct block_device bd;
103-
uint32_t card_supports_sdhc;
104-
uint32_t card_supports_18v;
105-
uint32_t card_ocr;
106-
uint32_t card_rca;
107-
uint32_t last_interrupt;
108-
uint32_t last_error;
109-
110-
struct sd_scr *scr;
111-
112-
int failed_voltage_switch;
113-
114-
uint32_t last_cmd_reg;
115-
uint32_t last_cmd;
116-
uint32_t last_cmd_success;
117-
uint32_t last_r0;
118-
uint32_t last_r1;
119-
uint32_t last_r2;
120-
uint32_t last_r3;
121-
122-
void *buf;
123-
int blocks_to_transfer;
124-
size_t block_size;
125-
int use_sdma;
126-
int card_removal;
127-
uint32_t base_clock;
128-
};
129-
130-
static struct emmc_block_dev emmc_dev;
100+
struct emmc_block_dev emmc_dev;
131101

132102
#define EMMC_BASE 0x20300000
133103
#define EMMC_ARG2 0

kernel/emmc.h

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,39 @@ struct block_device
4747
struct fs *fs;
4848
};
4949

50-
int sd_card_init(struct block_device **dev);
50+
struct sd_scr;
51+
52+
struct emmc_block_dev
53+
{
54+
struct block_device bd;
55+
uint32_t card_supports_sdhc;
56+
uint32_t card_supports_18v;
57+
uint32_t card_ocr;
58+
uint32_t card_rca;
59+
uint32_t last_interrupt;
60+
uint32_t last_error;
61+
62+
struct sd_scr *scr;
63+
64+
int failed_voltage_switch;
5165

52-
size_t sd_get_block_size();
53-
size_t sd_get_num_blocks();
66+
uint32_t last_cmd_reg;
67+
uint32_t last_cmd;
68+
uint32_t last_cmd_success;
69+
uint32_t last_r0;
70+
uint32_t last_r1;
71+
uint32_t last_r2;
72+
uint32_t last_r3;
73+
74+
void *buf;
75+
int blocks_to_transfer;
76+
size_t block_size;
77+
int use_sdma;
78+
int card_removal;
79+
uint32_t base_clock;
80+
};
81+
82+
int sd_card_init(struct block_device **dev);
5483

5584
size_t sd_read(uint8_t *buf, size_t buf_size, uint32_t block_no);
5685
size_t sd_write(uint8_t *buf, size_t buf_size, uint32_t block_no);

kernel/ff.c

Lines changed: 4604 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)