Merge branch 'mmc' of git@github.com:optixx/quickdev16 into mmc
This commit is contained in:
commit
31768e2a41
@ -33,7 +33,7 @@ ifeq ($(DEBUG),1)
|
|||||||
OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o \
|
OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o \
|
||||||
main.o usb_bulk.o uart.o fifo.o sram.o crc.o debug.o \
|
main.o usb_bulk.o uart.o fifo.o sram.o crc.o debug.o \
|
||||||
dump.o timer.o watchdog.o rle.c loader.o info.o shared_memory.o \
|
dump.o timer.o watchdog.o rle.c loader.o info.o shared_memory.o \
|
||||||
command.o mmc.o fat.o file.o testing.o
|
command.o mmc.o fat.o file.o dir.o testing.o
|
||||||
else
|
else
|
||||||
LDFLAGS = -Wl,-u
|
LDFLAGS = -Wl,-u
|
||||||
CFLAGS = -Iusbdrv -I. -DDEBUG_LEVEL=0 -DNO_DEBUG -DNO_INFO
|
CFLAGS = -Iusbdrv -I. -DDEBUG_LEVEL=0 -DNO_DEBUG -DNO_INFO
|
||||||
|
|||||||
51
avr/usbload/dir.c
Normal file
51
avr/usbload/dir.c
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* =====================================================================================
|
||||||
|
*
|
||||||
|
* ________ .__ __ ________ ____ ________
|
||||||
|
* \_____ \ __ __|__| ____ | | __\______ \ _______ _/_ |/ _____/
|
||||||
|
* / / \ \| | \ |/ ___\| |/ / | | \_/ __ \ \/ /| / __ \
|
||||||
|
* / \_/. \ | / \ \___| < | ` \ ___/\ / | \ |__\ \
|
||||||
|
* \_____\ \_/____/|__|\___ >__|_ \/_______ /\___ >\_/ |___|\_____ /
|
||||||
|
* \__> \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* www.optixx.org
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Version: 1.0
|
||||||
|
* Created: 07/21/2009 03:32:16 PM
|
||||||
|
* Author: david@optixx.org
|
||||||
|
*
|
||||||
|
* =====================================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "dir.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
uint16_t positon = 0;
|
||||||
|
|
||||||
|
void dir_entry_start(){
|
||||||
|
positon = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dir_add_entry(uint16_t id, uint8_t file_name,uint32_t file_size,uint8_t file_attr){
|
||||||
|
uint32_t addr;
|
||||||
|
dir_ent_t ent;
|
||||||
|
strncpy(ent.file_name,file_name,13);
|
||||||
|
ent.file_size = file_size;
|
||||||
|
ent.file_attr = file_attr;
|
||||||
|
addr = DIR_ENTRY_LOC + (positon << DIR_ENTRY_SIZE_SHIFT );
|
||||||
|
sram_bulk_copy(addr, (uint8_t *) &ent, DIR_ENTRY_SIZE );
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
46
avr/usbload/dir.h
Normal file
46
avr/usbload/dir.h
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* =====================================================================================
|
||||||
|
*
|
||||||
|
* ________ .__ __ ________ ____ ________
|
||||||
|
* \_____ \ __ __|__| ____ | | __\______ \ _______ _/_ |/ _____/
|
||||||
|
* / / \ \| | \ |/ ___\| |/ / | | \_/ __ \ \/ /| / __ \
|
||||||
|
* / \_/. \ | / \ \___| < | ` \ ___/\ / | \ |__\ \
|
||||||
|
* \_____\ \_/____/|__|\___ >__|_ \/_______ /\___ >\_/ |___|\_____ /
|
||||||
|
* \__> \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* www.optixx.org
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Version: 1.0
|
||||||
|
* Created: 07/21/2009 03:32:16 PM
|
||||||
|
* Author: david@optixx.org
|
||||||
|
*
|
||||||
|
* =====================================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __DIR_H__
|
||||||
|
#define __DIR_H__
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define DIR_ENTRY_LOC 0x010000
|
||||||
|
#define DIR_ENTRY_SIZE 64
|
||||||
|
#define DIR_ENTRY_SIZE_SHIFT 6
|
||||||
|
#define DIR_ENTRY_HEADER_SIZE 44
|
||||||
|
#define DIR_ENTRY_HEADER_OFF 20
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint16_t id; // 1
|
||||||
|
uint8_t file_name[13]; // 8.3 = 12 + 1 = 12
|
||||||
|
uint32_t file_size; // 4
|
||||||
|
uint8_t file_attr; // 1
|
||||||
|
uint8_t snes_header[44]; // 44
|
||||||
|
} dir_ent_t; // 64
|
||||||
|
|
||||||
|
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_header(uint16_t position, uint8_t * header);
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user