add header

This commit is contained in:
optixx 2009-08-12 18:04:54 +02:00
parent cf090451df
commit 041cf089ad
3 changed files with 11 additions and 4 deletions

View File

@ -39,8 +39,13 @@ void dir_add_entry(uint16_t id, uint8_t file_name,uint32_t file_size,uint8_t fil
addr = DIR_ENTRY_LOC + (positon << DIR_ENTRY_SIZE_SHIFT ); addr = DIR_ENTRY_LOC + (positon << DIR_ENTRY_SIZE_SHIFT );
sram_bulk_copy(addr, (uint8_t *) &ent, DIR_ENTRY_SIZE ); sram_bulk_copy(addr, (uint8_t *) &ent, DIR_ENTRY_SIZE );
positon++; positon++;
}
void dir_add_header(uint16_t position, uint8_t * header){
uint32_t addr;
dir_ent_t ent;
addr = DIR_ENTRY_LOC + ( position << DIR_ENTRY_SIZE_SHIFT ) + DIR_ENTRY_HEADER_OFF;
sram_bulk_copy(addr, (uint8_t *) header, DIR_ENTRY_HEADER_SIZE);
} }

View File

@ -28,7 +28,8 @@
#define DIR_ENTRY_LOC 0x010000 #define DIR_ENTRY_LOC 0x010000
#define DIR_ENTRY_SIZE 64 #define DIR_ENTRY_SIZE 64
#define DIR_ENTRY_SIZE_SHIFT 6 #define DIR_ENTRY_SIZE_SHIFT 6
#define DIR_ENTRY_HEADER_SIZE 44
#define DIR_ENTRY_HEADER_OFF 20
typedef struct { typedef struct {
uint16_t id; // 1 uint16_t id; // 1
@ -40,7 +41,6 @@ typedef struct {
void dir_entry_start(); void dir_entry_start();
void dir_entry_add_(uint16_t id, uint8_t file_name,uint32_t file_size,uint8_t file_attr); void dir_entry_add_(uint16_t id, uint8_t file_name,uint32_t file_size,uint8_t file_attr);
void dir_entry_header(uint16_t id, uint8_t header); void dir_entry_header(uint16_t position, uint8_t * header);
#endif #endif

View File

@ -178,6 +178,7 @@ void ffls(void)
uint16_t s; // fat16 root dir sektoren uint16_t s; // fat16 root dir sektoren
if (fat.dir == 0 && fat.fatType == 16) { // IM ROOTDIR. fat16 if (fat.dir == 0 && fat.fatType == 16) { // IM ROOTDIR. fat16
printf("Fat16\n");
for (s = 0; s < (uint16_t) (fat.dataDirSec + 2 - fat.rootDir); s++) { // zählt durch RootDir sektoren (errechnet anzahl for (s = 0; s < (uint16_t) (fat.dataDirSec + 2 - fat.rootDir); s++) { // zählt durch RootDir sektoren (errechnet anzahl
// rootDir sektoren). // rootDir sektoren).
lsRowsOfClust(fat.rootDir + s); // zeigt reihen eines root dir clust an lsRowsOfClust(fat.rootDir + s); // zeigt reihen eines root dir clust an
@ -185,6 +186,7 @@ void ffls(void)
} }
else { else {
printf("Fat32\n");
if (fat.dir == 0 && fat.fatType == 32) if (fat.dir == 0 && fat.fatType == 32)
clust = fat.rootDir; // IM ROOTDIR. fat32 clust = fat.rootDir; // IM ROOTDIR. fat32
else else