add dir ent to sram copy
This commit is contained in:
parent
8d961dc446
commit
cf090451df
@ -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
|
||||||
|
|||||||
46
avr/usbload/dir.c
Normal file
46
avr/usbload/dir.c
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* =====================================================================================
|
||||||
|
*
|
||||||
|
* ________ .__ __ ________ ____ ________
|
||||||
|
* \_____ \ __ __|__| ____ | | __\______ \ _______ _/_ |/ _____/
|
||||||
|
* / / \ \| | \ |/ ___\| |/ / | | \_/ __ \ \/ /| / __ \
|
||||||
|
* / \_/. \ | / \ \___| < | ` \ ___/\ / | \ |__\ \
|
||||||
|
* \_____\ \_/____/|__|\___ >__|_ \/_______ /\___ >\_/ |___|\_____ /
|
||||||
|
* \__> \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* 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++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
|
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 id, uint8_t header);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
x
Reference in New Issue
Block a user