All of the SD card commands are moved into their own file, with functions sd_init, sd_get_rca, sd_select_card, sd_get_status, and sd_readblock. The FAT functions are movied into fat.c and give functions fat_init and fat_read. Note that the filename is ignored for now, it always reads the first file in the root directory. The loading of o65 files is done in o65.c, and executing is done in exec.c This cleans up the main file signifigantly and leaves the project open to expansion.
18 lines
373 B
C
18 lines
373 B
C
#ifndef _SD_CARD_H
|
|
#define _SD_CARD_H
|
|
|
|
#include <stdint.h>
|
|
|
|
void sd_init();
|
|
uint16_t sd_get_rca();
|
|
uint16_t sd_select_card(uint16_t rca);
|
|
uint16_t sd_get_status(uint16_t rca);
|
|
void sd_readblock(uint32_t addr, void* buf);
|
|
|
|
void sd_card_command(uint32_t arg, uint8_t cmd);
|
|
|
|
void sd_card_resp(uint32_t* resp);
|
|
uint8_t sd_card_read_byte();
|
|
void sd_card_wait_for_data();
|
|
|
|
#endif |