Read a little bit of the data from the file
This commit is contained in:
@@ -36,8 +36,6 @@ int8_t fat32_get_cluster_by_name(char* name, struct fat32_directory_entry* dentr
|
||||
}
|
||||
|
||||
cprintf("Found file!\n");
|
||||
|
||||
cprintf("attr1: %x\n", local_entry->attr1);
|
||||
cprintf("cluster: %x %x\n", local_entry->cluster_high, local_entry->cluster_low);
|
||||
cprintf("File Size: %lx\n", local_entry->file_size);
|
||||
memcpy(dentry, local_entry, 32);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include <filesystems/fat32.h>
|
||||
#include <conio.h>
|
||||
|
||||
void fat32_init(void);
|
||||
|
||||
int main(void) {
|
||||
struct fat32_directory_entry dentry;
|
||||
int i;
|
||||
uint32_t offset = 0;
|
||||
uint32_t cluster;
|
||||
fat32_init();
|
||||
|
||||
/* This is what is going to be part of open */
|
||||
fat32_get_cluster_by_name("TEST TXT", &dentry);
|
||||
cprintf("attr1: %x\n", dentry.attr1);
|
||||
cprintf("cluster: %x%x\n", dentry.cluster_high, dentry.cluster_low);
|
||||
cprintf("File Size: %lx\n", dentry.file_size);
|
||||
|
||||
|
||||
/* This will become part of read */
|
||||
cluster = (dentry.cluster_high << 16) | dentry.cluster_low;
|
||||
fat32_read_cluster(cluster + offset/512, sd_buf);
|
||||
|
||||
for (i = 0; i < dentry.file_size; i++) {
|
||||
cprintf("%c", sd_buf[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user