Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac85195bb8 |
@@ -30,7 +30,7 @@ SIZE = avr-size
|
|||||||
ifeq ($(DEBUG),1)
|
ifeq ($(DEBUG),1)
|
||||||
LDFLAGS = -Wl,-u,vfprintf -lprintf_flt
|
LDFLAGS = -Wl,-u,vfprintf -lprintf_flt
|
||||||
CFLAGS = -Iusbdrv -I. -DDEBUG_LEVEL=0
|
CFLAGS = -Iusbdrv -I. -DDEBUG_LEVEL=0
|
||||||
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 dump.o timer.o watchdog.o rle.c loader.o info.o shared_memory.o mmc.o fat.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 dump.o timer.o watchdog.o huffman-decode.o rle.c loader.o info.o shared_memory.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
|
||||||
|
|||||||
@@ -1,192 +0,0 @@
|
|||||||
#include "fat.h"
|
|
||||||
|
|
||||||
uint8_t cluster_size;
|
|
||||||
uint16_t fat_offset;
|
|
||||||
uint16_t cluster_offset;
|
|
||||||
uint16_t volume_boot_record_addr;
|
|
||||||
|
|
||||||
void fat_init(uint8_t * Buffer)
|
|
||||||
{
|
|
||||||
struct BootSec *bootp;
|
|
||||||
mmc_read_sector(MASTER_BOOT_RECORD, Buffer);
|
|
||||||
if (Buffer[510] == 0x55 && Buffer[511] == 0xAA) {
|
|
||||||
FAT_DEBUG("MBR Signatur found!\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
FAT_DEBUG("MBR Signatur not found!\r\n");
|
|
||||||
while (1);
|
|
||||||
}
|
|
||||||
volume_boot_record_addr = Buffer[VBR_ADDR] + (Buffer[VBR_ADDR + 1] << 8);
|
|
||||||
mmc_read_sector(volume_boot_record_addr, Buffer);
|
|
||||||
if (Buffer[510] == 0x55 && Buffer[511] == 0xAA) {
|
|
||||||
FAT_DEBUG("VBR Signatur found!\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
FAT_DEBUG("VBR Signatur not found!\r\n");
|
|
||||||
volume_boot_record_addr = MASTER_BOOT_RECORD;
|
|
||||||
mmc_read_sector(MASTER_BOOT_RECORD, Buffer);
|
|
||||||
}
|
|
||||||
bootp = (struct BootSec *) Buffer;
|
|
||||||
cluster_size = bootp->BPB_SecPerClus;
|
|
||||||
fat_offset = bootp->BPB_RsvdSecCnt;
|
|
||||||
cluster_offset = ((bootp->BPB_BytesPerSec * 32) / BlockSize);
|
|
||||||
cluster_offset += fat_root_dir_addr(Buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t fat_root_dir_addr(uint8_t * Buffer)
|
|
||||||
{
|
|
||||||
struct BootSec *bootp;
|
|
||||||
uint16_t FirstRootDirSecNum;
|
|
||||||
|
|
||||||
|
|
||||||
mmc_read_sector(volume_boot_record_addr, Buffer);
|
|
||||||
bootp = (struct BootSec *) Buffer;
|
|
||||||
|
|
||||||
|
|
||||||
FirstRootDirSecNum = (bootp->BPB_RsvdSecCnt +
|
|
||||||
(bootp->BPB_NumFATs * bootp->BPB_FATSz16));
|
|
||||||
FirstRootDirSecNum += volume_boot_record_addr;
|
|
||||||
return (FirstRootDirSecNum);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint16_t fat_read_dir_ent(uint16_t dir_cluster,
|
|
||||||
uint8_t Entry_Count,
|
|
||||||
uint32_t * Size,
|
|
||||||
uint8_t * Dir_Attrib, uint8_t * Buffer)
|
|
||||||
{
|
|
||||||
uint8_t *pointer;
|
|
||||||
uint16_t TMP_Entry_Count = 0;
|
|
||||||
uint32_t Block = 0;
|
|
||||||
struct DirEntry *dir;
|
|
||||||
uint16_t blk;
|
|
||||||
uint16_t a;
|
|
||||||
uint8_t b;
|
|
||||||
pointer = Buffer;
|
|
||||||
if (dir_cluster == 0) {
|
|
||||||
Block = fat_root_dir_addr(Buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
fat_load(dir_cluster, &Block, Buffer);
|
|
||||||
Block = ((Block - 2) * cluster_size) + cluster_offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for (blk = Block;; blk++) {
|
|
||||||
mmc_read_sector(blk, Buffer);
|
|
||||||
for (a = 0; a < BlockSize; a = a + 32) {
|
|
||||||
dir = (struct DirEntry *) &Buffer[a];
|
|
||||||
if (dir->DIR_Name[0] == 0) {
|
|
||||||
return (0xFFFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((dir->DIR_Attr != ATTR_LONG_NAME) &&
|
|
||||||
(dir->DIR_Name[0] != DIR_ENTRY_IS_FREE)) {
|
|
||||||
|
|
||||||
|
|
||||||
if (TMP_Entry_Count == Entry_Count) {
|
|
||||||
|
|
||||||
|
|
||||||
for (b = 0; b < 11; b++) {
|
|
||||||
if (dir->DIR_Name[b] != SPACE) {
|
|
||||||
if (b == 8) {
|
|
||||||
*pointer++ = '.';
|
|
||||||
}
|
|
||||||
*pointer++ = dir->DIR_Name[b];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*pointer++ = '\0';
|
|
||||||
*Dir_Attrib = dir->DIR_Attr;
|
|
||||||
|
|
||||||
|
|
||||||
*Size = dir->DIR_FileSize;
|
|
||||||
|
|
||||||
|
|
||||||
dir_cluster = dir->DIR_FstClusLO;
|
|
||||||
|
|
||||||
|
|
||||||
return (dir_cluster);
|
|
||||||
}
|
|
||||||
TMP_Entry_Count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (0xFFFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
void fat_load(uint16_t Cluster, uint32_t * Block, uint8_t * TMP_Buffer)
|
|
||||||
{
|
|
||||||
uint16_t FAT_Block_Store = 0;
|
|
||||||
uint16_t FAT_Byte_Addresse;
|
|
||||||
uint16_t FAT_Block_Addresse;
|
|
||||||
uint16_t a;
|
|
||||||
|
|
||||||
for (a = 0;; a++) {
|
|
||||||
if (a == *Block) {
|
|
||||||
*Block = (0x0000FFFF & Cluster);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Cluster == 0xFFFF) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
FAT_Byte_Addresse = (Cluster * 2) % BlockSize;
|
|
||||||
|
|
||||||
|
|
||||||
FAT_Block_Addresse =
|
|
||||||
((Cluster * 2) / BlockSize) + volume_boot_record_addr + fat_offset;
|
|
||||||
|
|
||||||
if (FAT_Block_Addresse != FAT_Block_Store) {
|
|
||||||
FAT_Block_Store = FAT_Block_Addresse;
|
|
||||||
mmc_read_sector(FAT_Block_Addresse, TMP_Buffer);
|
|
||||||
}
|
|
||||||
Cluster =
|
|
||||||
(TMP_Buffer[FAT_Byte_Addresse + 1] << 8) +
|
|
||||||
TMP_Buffer[FAT_Byte_Addresse];
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void fat_read_file(uint16_t Cluster, uint8_t * Buffer, uint32_t BlockCount)
|
|
||||||
{
|
|
||||||
|
|
||||||
uint32_t Block = (BlockCount / cluster_size);
|
|
||||||
fat_load(Cluster, &Block, Buffer);
|
|
||||||
Block = ((Block - 2) * cluster_size) + cluster_offset;
|
|
||||||
Block += (BlockCount % cluster_size);
|
|
||||||
mmc_read_sector(Block, Buffer);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void fat_write_file(uint16_t cluster, uint8_t * buffer, uint32_t blockCount)
|
|
||||||
{
|
|
||||||
uint8_t tmp_buffer[513];
|
|
||||||
uint32_t block = (blockCount / cluster_size);
|
|
||||||
fat_load(cluster, &block, tmp_buffer);
|
|
||||||
block = ((block - 2) * cluster_size) + cluster_offset;
|
|
||||||
block += (blockCount % cluster_size);
|
|
||||||
mmc_write_sector(block, buffer);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t fat_search_file(uint8_t * File_Name,
|
|
||||||
uint16_t * Cluster,
|
|
||||||
uint32_t * Size, uint8_t * Dir_Attrib, uint8_t * Buffer)
|
|
||||||
{
|
|
||||||
uint16_t Dir_Cluster_Store = *Cluster;
|
|
||||||
uint8_t a;
|
|
||||||
for (a = 0; a < 100; a++) {
|
|
||||||
*Cluster =
|
|
||||||
fat_read_dir_ent(Dir_Cluster_Store, a, Size, Dir_Attrib, Buffer);
|
|
||||||
if (*Cluster == 0xffff) {
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
if (strcasecmp((char *) File_Name, (char *) Buffer) == 0) {
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (2);
|
|
||||||
}
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
/*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _FAT_H_
|
|
||||||
#define _FAT_H_
|
|
||||||
#include <string.h>
|
|
||||||
#include "mmc.h"
|
|
||||||
#include "uart.h"
|
|
||||||
|
|
||||||
#define FAT_DEBUG uart_puts
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern uint16_t fat_root_dir_addr(uint8_t *);
|
|
||||||
extern uint16_t fat_read_dir_ent(uint16_t, uint8_t,
|
|
||||||
uint32_t *, uint8_t *, uint8_t *);
|
|
||||||
extern void fat_load(uint16_t, uint32_t *, uint8_t *);
|
|
||||||
extern void fat_read_file(uint16_t, uint8_t *, uint32_t);
|
|
||||||
extern void fat_write_file(uint16_t, uint8_t *, uint32_t);
|
|
||||||
extern void fat_init(uint8_t * Buffer);
|
|
||||||
extern uint8_t fat_search_file(uint8_t *, uint16_t *,
|
|
||||||
uint32_t *, uint8_t *, uint8_t *);
|
|
||||||
|
|
||||||
|
|
||||||
#define BlockSize 512
|
|
||||||
|
|
||||||
|
|
||||||
#define MASTER_BOOT_RECORD 0
|
|
||||||
|
|
||||||
|
|
||||||
#define VBR_ADDR 0x1C6
|
|
||||||
|
|
||||||
|
|
||||||
#define SPACE 0x20
|
|
||||||
#define DIR_ENTRY_IS_FREE 0xE5
|
|
||||||
#define FIRST_LONG_ENTRY 0x01
|
|
||||||
#define SECOND_LONG_ENTRY 0x42
|
|
||||||
|
|
||||||
|
|
||||||
#define ATTR_LONG_NAME 0x0F
|
|
||||||
#define ATTR_READ_ONLY 0x01
|
|
||||||
#define ATTR_HIDDEN 0x02
|
|
||||||
#define ATTR_SYSTEM 0x04
|
|
||||||
#define ATTR_VOLUME_ID 0x08
|
|
||||||
#define ATTR_DIRECTORY 0x10
|
|
||||||
#define ATTR_ARCHIVE 0x20
|
|
||||||
struct BootSec {
|
|
||||||
uint8_t BS_jmpBoot[3];
|
|
||||||
uint8_t BS_OEMName[8];
|
|
||||||
uint16_t BPB_BytesPerSec;
|
|
||||||
uint8_t BPB_SecPerClus;
|
|
||||||
uint16_t BPB_RsvdSecCnt;
|
|
||||||
uint8_t BPB_NumFATs;
|
|
||||||
uint16_t BPB_RootEntCnt;
|
|
||||||
uint16_t BPB_TotSec16;
|
|
||||||
uint8_t BPB_Media;
|
|
||||||
uint16_t BPB_FATSz16;
|
|
||||||
uint16_t BPB_SecPerTrk;
|
|
||||||
uint16_t BPB_NumHeads;
|
|
||||||
uint32_t BPB_HiddSec;
|
|
||||||
uint32_t BPB_TotSec32;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#define BS_DRVNUM 36
|
|
||||||
#define BS_RESERVED1 37
|
|
||||||
#define BS_BOOTSIG 38
|
|
||||||
#define BS_VOLID 39
|
|
||||||
#define BS_VOLLAB 43
|
|
||||||
#define BS_FILSYSTYPE 54
|
|
||||||
|
|
||||||
|
|
||||||
#define BPB_FATSZ32 36
|
|
||||||
#define BPB_EXTFLAGS 40
|
|
||||||
#define BPB_FSVER 42
|
|
||||||
#define BPB_ROOTCLUS 44
|
|
||||||
#define BPB_FSINFO 48
|
|
||||||
#define BPB_BKBOOTSEC 50
|
|
||||||
#define BPB_RESERVED 52
|
|
||||||
|
|
||||||
#define FAT32_BS_DRVNUM 64
|
|
||||||
#define FAT32_BS_RESERVED1 65
|
|
||||||
#define FAT32_BS_BOOTSIG 66
|
|
||||||
#define FAT32_BS_VOLID 67
|
|
||||||
#define FAT32_BS_VOLLAB 71
|
|
||||||
#define FAT32_BS_FILSYSTYPE 82
|
|
||||||
|
|
||||||
struct DirEntry {
|
|
||||||
uint8_t DIR_Name[11];
|
|
||||||
uint8_t DIR_Attr;
|
|
||||||
uint8_t DIR_NTRes;
|
|
||||||
uint8_t DIR_CrtTimeTenth;
|
|
||||||
uint16_t DIR_CrtTime;
|
|
||||||
uint16_t DIR_CrtDate;
|
|
||||||
uint16_t DIR_LastAccDate;
|
|
||||||
uint16_t DIR_FstClusHI;
|
|
||||||
uint16_t DIR_WrtTime;
|
|
||||||
uint16_t DIR_WrtDate;
|
|
||||||
uint16_t DIR_FstClusLO;
|
|
||||||
uint32_t DIR_FileSize;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
267
avr/usbload/huffman-decode.c
Normal file
267
avr/usbload/huffman-decode.c
Normal file
@@ -0,0 +1,267 @@
|
|||||||
|
/*
|
||||||
|
* =====================================================================================
|
||||||
|
*
|
||||||
|
* ________ .__ __ ________ ____ ________
|
||||||
|
* \_____ \ __ __|__| ____ | | __\______ \ _______ _/_ |/ _____/
|
||||||
|
* / / \ \| | \ |/ ___\| |/ / | | \_/ __ \ \/ /| / __ \
|
||||||
|
* / \_/. \ | / \ \___| < | ` \ ___/\ / | \ |__\ \
|
||||||
|
* \_____\ \_/____/|__|\___ >__|_ \/_______ /\___ >\_/ |___|\_____ /
|
||||||
|
* \__> \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* www.optixx.org
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Version: 1.0
|
||||||
|
* Created: 07/21/2009 03:32:16 PM
|
||||||
|
*
|
||||||
|
* =====================================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "huffman-decode.h"
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "info.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define DEBUG 1
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define V_NODE (-2)
|
||||||
|
#define V_EOF (-1)
|
||||||
|
|
||||||
|
#define PREFIX_SIZE_B 32
|
||||||
|
|
||||||
|
#define ALLOC_ERROR {}
|
||||||
|
|
||||||
|
#undef BLOCK_ALLOC
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int16_t value;
|
||||||
|
void* left;
|
||||||
|
void* right;
|
||||||
|
} node_t;
|
||||||
|
|
||||||
|
#if HUFFMAN_USE_ADDR_16
|
||||||
|
void huffman_dec_init(huffman_dec_ctx_t* ctx, uint16_t(*rb_func)(uint16_t)){
|
||||||
|
#else
|
||||||
|
void huffman_dec_init(huffman_dec_ctx_t* ctx, uint16_t(*rb_func)(uint32_t)){
|
||||||
|
#endif
|
||||||
|
ctx->tree = NULL;
|
||||||
|
ctx->addr = 0;
|
||||||
|
ctx->read_byte = rb_func;
|
||||||
|
ctx->rbuffer_index = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if HUFFMAN_USE_ADDR_16
|
||||||
|
void huffman_dec_set_addr(huffman_dec_ctx_t* ctx, uint16_t addr){
|
||||||
|
#else
|
||||||
|
void huffman_dec_set_addr(huffman_dec_ctx_t* ctx, uint32_t addr){
|
||||||
|
#endif
|
||||||
|
ctx->addr = addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void prefix_increment(uint8_t* prefix){
|
||||||
|
uint8_t i;
|
||||||
|
for(i=0; i<PREFIX_SIZE_B; ++i){
|
||||||
|
prefix[i] += 1;
|
||||||
|
if(prefix[i]!=0)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void prefix_shiftleft(uint8_t* prefix){
|
||||||
|
uint8_t i;
|
||||||
|
uint8_t c[2]={0,0};
|
||||||
|
uint8_t ci=0;
|
||||||
|
for(i=0; i<PREFIX_SIZE_B; ++i){
|
||||||
|
c[ci] = (prefix[i])>>7;
|
||||||
|
prefix[i]<<=1;
|
||||||
|
ci ^= 1;
|
||||||
|
prefix[i]|=c[ci];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void set_last_to_eof(node_t* start){
|
||||||
|
node_t* current = start;
|
||||||
|
while(current->value==V_NODE){
|
||||||
|
current=current->right;
|
||||||
|
}
|
||||||
|
current->value=V_EOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
void print_tree(node_t* node){
|
||||||
|
if(node->value==V_NODE){
|
||||||
|
info("\n%p --> node->left=%p node->right=%p",node,node->left, node->right);
|
||||||
|
print_tree(node->left);
|
||||||
|
print_tree(node->right);
|
||||||
|
}else{
|
||||||
|
info("\n%p => %i",node,node->value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uint8_t build_tree(huffman_dec_ctx_t* ctx){
|
||||||
|
uint16_t treesize;
|
||||||
|
uint16_t treeindex=1;
|
||||||
|
int8_t i,t;
|
||||||
|
if(ctx->read_byte(ctx->addr++)!=0xC0)
|
||||||
|
return 1;
|
||||||
|
if(((treesize=ctx->read_byte(ctx->addr++))&0xFE)!=0xDE)
|
||||||
|
return 1;
|
||||||
|
treesize = (treesize&1)<<8;
|
||||||
|
treesize += ctx->read_byte(ctx->addr++);
|
||||||
|
if(treesize>0x1ff)
|
||||||
|
return 2;
|
||||||
|
#if BLOCK_ALLOC
|
||||||
|
ctx->tree = malloc((2*treesize-1) * sizeof(node_t));
|
||||||
|
#else
|
||||||
|
ctx->tree = malloc(sizeof(node_t));
|
||||||
|
#endif
|
||||||
|
((node_t*)(ctx->tree))->value = V_NODE;
|
||||||
|
uint16_t depth=0;
|
||||||
|
uint16_t count=0;
|
||||||
|
uint16_t v;
|
||||||
|
uint8_t prefix[PREFIX_SIZE_B];
|
||||||
|
uint8_t cdepth=0;
|
||||||
|
node_t* current=ctx->tree;
|
||||||
|
current->value = V_NODE;
|
||||||
|
memset(prefix, 0, PREFIX_SIZE_B);
|
||||||
|
do{
|
||||||
|
while(count==0){
|
||||||
|
depth++;
|
||||||
|
count= ctx->read_byte(ctx->addr++);
|
||||||
|
if(count==255)
|
||||||
|
count += ctx->read_byte(ctx->addr++);
|
||||||
|
}
|
||||||
|
v = ctx->read_byte(ctx->addr++);
|
||||||
|
if(v>0xff)
|
||||||
|
return 3;
|
||||||
|
--count;
|
||||||
|
for(;cdepth<depth;++cdepth){
|
||||||
|
prefix_shiftleft(prefix);
|
||||||
|
}
|
||||||
|
#if DEBUG
|
||||||
|
printf("\n value %x => ",v);
|
||||||
|
#endif
|
||||||
|
current=ctx->tree;
|
||||||
|
for(i=depth-1; i>=0; --i){
|
||||||
|
t=(prefix[i/8])&(1<<(i%8));
|
||||||
|
if(t==0){
|
||||||
|
#if DEBUG
|
||||||
|
printf("0");
|
||||||
|
#endif
|
||||||
|
if(current->left==NULL){
|
||||||
|
#if BLOCK_ALLOC
|
||||||
|
current->left=&(((node_t*)(ctx->tree))[treeindex++]);
|
||||||
|
#else
|
||||||
|
current->left=malloc(sizeof(node_t));
|
||||||
|
#endif
|
||||||
|
((node_t*)(current->left))->value = V_NODE;
|
||||||
|
}
|
||||||
|
current = current->left;
|
||||||
|
} else {
|
||||||
|
#if DEBUG
|
||||||
|
printf("1");
|
||||||
|
#endif
|
||||||
|
if(current->right==NULL){
|
||||||
|
#if BLOCK_ALLOC
|
||||||
|
current->right=&(((node_t*)(ctx->tree))[treeindex++]);
|
||||||
|
#else
|
||||||
|
current->right=malloc( sizeof(node_t));
|
||||||
|
#endif
|
||||||
|
((node_t*)(current->right))->value=V_NODE;
|
||||||
|
}
|
||||||
|
current = current->right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#if !BLOCK_ALLOC
|
||||||
|
if(current==NULL)
|
||||||
|
ALLOC_ERROR
|
||||||
|
#endif
|
||||||
|
current->value=v;
|
||||||
|
prefix_increment(prefix);
|
||||||
|
}while(!(prefix[depth/8]&(1<<(depth%8))));
|
||||||
|
#if DEBUG
|
||||||
|
print_tree(ctx->tree);
|
||||||
|
#endif
|
||||||
|
set_last_to_eof(ctx->tree);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void free_tree(node_t* node){
|
||||||
|
#if !BLOCK_ALLOC
|
||||||
|
if(node->value==V_NODE){
|
||||||
|
free_tree(node->left);
|
||||||
|
free_tree(node->right);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
free(node);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8_t read_bit(huffman_dec_ctx_t* ctx){
|
||||||
|
uint16_t x;
|
||||||
|
uint8_t t;
|
||||||
|
if(ctx->rbuffer_index==8){
|
||||||
|
x=ctx->read_byte(ctx->addr);
|
||||||
|
ctx->addr++;
|
||||||
|
if(t>0xff)
|
||||||
|
return 0xFF;
|
||||||
|
ctx->rbuffer = (uint8_t)x;
|
||||||
|
ctx->rbuffer_index=0;
|
||||||
|
}
|
||||||
|
t=(ctx->rbuffer)>>7;
|
||||||
|
ctx->rbuffer<<=1;
|
||||||
|
ctx->rbuffer_index++;
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t huffman_dec_byte(huffman_dec_ctx_t* ctx){
|
||||||
|
node_t* current=ctx->tree;
|
||||||
|
uint8_t t;
|
||||||
|
if(current==NULL){
|
||||||
|
#if DEBUG
|
||||||
|
printf("\nbuild tree");
|
||||||
|
#endif
|
||||||
|
t=build_tree(ctx);
|
||||||
|
if(t!=0){
|
||||||
|
#if DEBUG
|
||||||
|
printf("\n!!! building tree failed !!!\r\n");
|
||||||
|
#endif
|
||||||
|
return 0xFFFF;
|
||||||
|
}
|
||||||
|
#if DEBUG
|
||||||
|
printf("\ntree build successful");
|
||||||
|
#endif
|
||||||
|
current=ctx->tree;
|
||||||
|
}
|
||||||
|
while(current->value==V_NODE){
|
||||||
|
t=read_bit(ctx);
|
||||||
|
if(t==0xFF)
|
||||||
|
goto eof_detected;
|
||||||
|
if(t==0){
|
||||||
|
current=current->left;
|
||||||
|
} else {
|
||||||
|
current=current->right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(current->value!=V_EOF){
|
||||||
|
return current->value;
|
||||||
|
}
|
||||||
|
eof_detected:
|
||||||
|
free_tree(ctx->tree);
|
||||||
|
ctx->tree = NULL;
|
||||||
|
return 0xFFFF;
|
||||||
|
}
|
||||||
51
avr/usbload/huffman-decode.h
Normal file
51
avr/usbload/huffman-decode.h
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* =====================================================================================
|
||||||
|
*
|
||||||
|
* ________ .__ __ ________ ____ ________
|
||||||
|
* \_____ \ __ __|__| ____ | | __\______ \ _______ _/_ |/ _____/
|
||||||
|
* / / \ \| | \ |/ ___\| |/ / | | \_/ __ \ \/ /| / __ \
|
||||||
|
* / \_/. \ | / \ \___| < | ` \ ___/\ / | \ |__\ \
|
||||||
|
* \_____\ \_/____/|__|\___ >__|_ \/_______ /\___ >\_/ |___|\_____ /
|
||||||
|
* \__> \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* www.optixx.org
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Version: 1.0
|
||||||
|
* Created: 07/21/2009 03:32:16 PM
|
||||||
|
*
|
||||||
|
* =====================================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AVR_HUFFMAN_DECODE_H_
|
||||||
|
#define AVR_HUFFMAN_DECODE_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define HUFFMAN_USE_ADDR_16 1
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
void* tree;
|
||||||
|
uint8_t rbuffer;
|
||||||
|
uint8_t rbuffer_index;
|
||||||
|
#if HUFFMAN_USE_ADDR_16
|
||||||
|
uint16_t(*read_byte)(uint16_t addr);
|
||||||
|
uint16_t addr;
|
||||||
|
#else
|
||||||
|
uint16_t(*read_byte)(uint32_t addr);
|
||||||
|
uint32_t addr;
|
||||||
|
#endif
|
||||||
|
} huffman_dec_ctx_t;
|
||||||
|
|
||||||
|
#if HUFFMAN_USE_ADDR_16
|
||||||
|
void huffman_dec_init(huffman_dec_ctx_t* ctx, uint16_t(*rb_func)(uint16_t));
|
||||||
|
void huffman_dec_set_addr(huffman_dec_ctx_t* ctx,uint16_t addr);
|
||||||
|
#else
|
||||||
|
void huffman_dec_init(huffman_dec_ctx_t* ctx, uint16_t(*rb_func)(uint32_t));
|
||||||
|
void huffman_dec_set_addr(huffman_dec_ctx_t* ctx,uint32_t addr);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
uint16_t huffman_dec_byte(huffman_dec_ctx_t* ctx);
|
||||||
|
|
||||||
|
#endif /* AVR_HUFFMAN_DECODE_H_ */
|
||||||
3654
avr/usbload/loader.c
3654
avr/usbload/loader.c
File diff suppressed because it is too large
Load Diff
@@ -2,8 +2,8 @@
|
|||||||
#ifndef __FIFO_H__
|
#ifndef __FIFO_H__
|
||||||
#define __FIFO_H__
|
#define __FIFO_H__
|
||||||
|
|
||||||
#define ROM_BUFFER_SIZE 31091
|
#define ROM_BUFFER_SIZE 27288
|
||||||
#define ROM_HUFFMAN_SIZE 0
|
#define ROM_HUFFMAN_SIZE 27288
|
||||||
#define ROM_RLE_SIZE 31091
|
#define ROM_RLE_SIZE 30344
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -28,7 +28,8 @@
|
|||||||
#include <avr/eeprom.h>
|
#include <avr/eeprom.h>
|
||||||
|
|
||||||
#include "usbdrv.h"
|
#include "usbdrv.h"
|
||||||
#include "oddebug.h" /* This is also an example for using debug macros */
|
#include "oddebug.h" /* This is also an example for using debug
|
||||||
|
* macros */
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "requests.h" /* The custom request numbers we use */
|
#include "requests.h" /* The custom request numbers we use */
|
||||||
#include "uart.h"
|
#include "uart.h"
|
||||||
@@ -40,18 +41,16 @@
|
|||||||
#include "usb_bulk.h"
|
#include "usb_bulk.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "watchdog.h"
|
#include "watchdog.h"
|
||||||
|
#include "huffman-decode.h"
|
||||||
#include "rle.h"
|
#include "rle.h"
|
||||||
#include "loader.h"
|
#include "loader.h"
|
||||||
#include "shared_memory.h"
|
#include "shared_memory.h"
|
||||||
#include "mmc.h"
|
|
||||||
#include "fat.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern const char _rom[] PROGMEM;
|
extern const char _rom[] PROGMEM;
|
||||||
extern FILE uart_stdout;
|
extern FILE uart_stdout;
|
||||||
|
|
||||||
uint8_t debug_level = (DEBUG | DEBUG_USB | DEBUG_CRC);
|
uint8_t debug_level = ( DEBUG | DEBUG_USB | DEBUG_CRC );
|
||||||
|
|
||||||
uint8_t read_buffer[TRANSFER_BUFFER_SIZE];
|
uint8_t read_buffer[TRANSFER_BUFFER_SIZE];
|
||||||
uint32_t req_addr = 0;
|
uint32_t req_addr = 0;
|
||||||
@@ -77,25 +76,24 @@ usbMsgLen_t usbFunctionSetup(uchar data[8])
|
|||||||
|
|
||||||
usbRequest_t *rq = (void *) data;
|
usbRequest_t *rq = (void *) data;
|
||||||
uint8_t ret_len = 0;
|
uint8_t ret_len = 0;
|
||||||
/*
|
/*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
if (rq->bRequest == USB_UPLOAD_INIT) {
|
if (rq->bRequest == USB_UPLOAD_INIT) {
|
||||||
|
|
||||||
if (req_state != REQ_STATUS_IDLE) {
|
if (req_state != REQ_STATUS_IDLE){
|
||||||
debug(DEBUG_USB,
|
debug(DEBUG_USB,"USB_UPLOAD_INIT: ERROR state is not REQ_STATUS_IDLE\n");
|
||||||
"USB_UPLOAD_INIT: ERROR state is not REQ_STATUS_IDLE\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
req_bank = 0;
|
req_bank = 0;
|
||||||
rx_remaining = 0;
|
rx_remaining = 0;
|
||||||
req_bank_size = (uint32_t) 1 << rq->wValue.word;
|
req_bank_size = (uint32_t)1 << rq->wValue.word;
|
||||||
sync_errors = 0;
|
sync_errors = 0;
|
||||||
crc = 0;
|
crc = 0;
|
||||||
debug(DEBUG_USB, "USB_UPLOAD_INIT: bank_size=0x%08lx\n", req_bank_size);
|
debug(DEBUG_USB,"USB_UPLOAD_INIT: bank_size=0x%08lx\n", req_bank_size);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
} else if (rq->bRequest == USB_UPLOAD_ADDR) {
|
} else if (rq->bRequest == USB_UPLOAD_ADDR) {
|
||||||
@@ -107,8 +105,7 @@ usbMsgLen_t usbFunctionSetup(uchar data[8])
|
|||||||
if (rx_remaining) {
|
if (rx_remaining) {
|
||||||
sync_errors++;
|
sync_errors++;
|
||||||
debug
|
debug
|
||||||
(DEBUG_USB,
|
(DEBUG_USB,"USB_UPLOAD_ADDR: Out of sync addr=0x%lx remain=%i packet=%i sync_error=%i\n",
|
||||||
"USB_UPLOAD_ADDR: Out of sync addr=0x%lx remain=%i packet=%i sync_error=%i\n",
|
|
||||||
req_addr, rx_remaining, rq->wLength.word, sync_errors);
|
req_addr, rx_remaining, rq->wLength.word, sync_errors);
|
||||||
ret_len = 0;
|
ret_len = 0;
|
||||||
}
|
}
|
||||||
@@ -117,55 +114,50 @@ usbMsgLen_t usbFunctionSetup(uchar data[8])
|
|||||||
|
|
||||||
|
|
||||||
if (req_addr && (req_addr % 0x1000) == 0) {
|
if (req_addr && (req_addr % 0x1000) == 0) {
|
||||||
debug(DEBUG_USB,
|
debug(DEBUG_USB,"USB_UPLOAD_ADDR: bank=0x%02x addr=0x%08lx crc=%04x\n",
|
||||||
"USB_UPLOAD_ADDR: bank=0x%02x addr=0x%08lx crc=%04x\n",
|
req_bank, req_addr,crc_check_bulk_memory(req_addr - 0x1000,req_addr,req_bank_size));
|
||||||
req_bank, req_addr, crc_check_bulk_memory(req_addr - 0x1000,
|
|
||||||
req_addr,
|
|
||||||
req_bank_size));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (req_addr && req_addr % req_bank_size == 0) {
|
if (req_addr && req_addr % req_bank_size == 0) {
|
||||||
debug(DEBUG_USB, "USB_UPLOAD_ADDR: req_bank=0x%02x addr=0x%08lx\n",
|
debug(DEBUG_USB,"USB_UPLOAD_ADDR: req_bank=0x%02x addr=0x%08lx\n",
|
||||||
req_bank, req_addr);
|
req_bank, req_addr);
|
||||||
|
|
||||||
req_bank++;
|
req_bank++;
|
||||||
// shared_memory_put(SHARED_MEM_CMD_UPLOAD_PROGESS,req_bank);
|
//shared_memory_put(SHARED_MEM_CMD_UPLOAD_PROGESS,req_bank);
|
||||||
}
|
}
|
||||||
ret_len = USB_MAX_TRANS;
|
ret_len = USB_MAX_TRANS;
|
||||||
/*
|
/*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
} else if (rq->bRequest == USB_DOWNLOAD_INIT) {
|
} else if (rq->bRequest == USB_DOWNLOAD_INIT) {
|
||||||
debug(DEBUG_USB, "USB_DOWNLOAD_INIT\n");
|
debug(DEBUG_USB,"USB_DOWNLOAD_INIT\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
} else if (rq->bRequest == USB_DOWNLOAD_ADDR) {
|
} else if (rq->bRequest == USB_DOWNLOAD_ADDR) {
|
||||||
debug(DEBUG_USB, "USB_DOWNLOAD_ADDR\n");
|
debug(DEBUG_USB,"USB_DOWNLOAD_ADDR\n");
|
||||||
/*
|
/*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
} else if (rq->bRequest == USB_BULK_UPLOAD_INIT) {
|
} else if (rq->bRequest == USB_BULK_UPLOAD_INIT) {
|
||||||
|
|
||||||
req_bank = 0;
|
req_bank = 0;
|
||||||
rx_remaining = 0;
|
rx_remaining = 0;
|
||||||
debug(DEBUG_USB, "USB_BULK_UPLOAD_INIT: %i %i\n", rq->wValue.word,
|
debug(DEBUG_USB,"USB_BULK_UPLOAD_INIT: %i %i\n",rq->wValue.word, rq->wIndex.word);
|
||||||
rq->wIndex.word);
|
req_bank_size = (uint32_t)(1L << rq->wValue.word);
|
||||||
req_bank_size = (uint32_t) (1L << rq->wValue.word);
|
|
||||||
req_bank_cnt = rq->wIndex.word;
|
req_bank_cnt = rq->wIndex.word;
|
||||||
req_addr_end = (uint32_t) req_bank_size *req_bank_cnt;
|
req_addr_end = (uint32_t)req_bank_size * req_bank_cnt;
|
||||||
|
|
||||||
sync_errors = 0;
|
sync_errors = 0;
|
||||||
debug(DEBUG_USB,
|
debug(DEBUG_USB,"USB_BULK_UPLOAD_INIT: bank_size=0x%08lx bank_cnt=0x%x end_addr=0x%08lx\n",
|
||||||
"USB_BULK_UPLOAD_INIT: bank_size=0x%08lx bank_cnt=0x%x end_addr=0x%08lx\n",
|
|
||||||
req_bank_size, req_bank_cnt, req_addr_end);
|
req_bank_size, req_bank_cnt, req_addr_end);
|
||||||
|
|
||||||
shared_memory_put(SHARED_MEM_CMD_BANK_COUNT, req_bank_cnt);
|
shared_memory_put(SHARED_MEM_CMD_BANK_COUNT,req_bank_cnt);
|
||||||
if (req_addr == 0x000000) {
|
if (req_addr == 0x000000){
|
||||||
timer_start();
|
timer_start();
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
} else if (rq->bRequest == USB_BULK_UPLOAD_ADDR) {
|
} else if (rq->bRequest == USB_BULK_UPLOAD_ADDR) {
|
||||||
@@ -177,17 +169,15 @@ usbMsgLen_t usbFunctionSetup(uchar data[8])
|
|||||||
rx_remaining = rq->wLength.word;
|
rx_remaining = rq->wLength.word;
|
||||||
|
|
||||||
if (req_addr && req_addr % req_bank_size == 0) {
|
if (req_addr && req_addr % req_bank_size == 0) {
|
||||||
#ifdef FLT_DEBUG
|
#ifdef FLT_DEBUG
|
||||||
debug(DEBUG_USB,
|
debug(DEBUG_USB,"USB_BULK_UPLOAD_ADDR: req_bank=0x%02x addr=0x%08lx time=%.4f\n",
|
||||||
"USB_BULK_UPLOAD_ADDR: req_bank=0x%02x addr=0x%08lx time=%.4f\n",
|
req_bank, req_addr,timer_stop());
|
||||||
req_bank, req_addr, timer_stop());
|
#else
|
||||||
#else
|
debug(DEBUG_USB,"USB_BULK_UPLOAD_ADDR: req_bank=0x%02x addr=0x%08lx time=%i\n",
|
||||||
debug(DEBUG_USB,
|
req_bank, req_addr,timer_stop_int());
|
||||||
"USB_BULK_UPLOAD_ADDR: req_bank=0x%02x addr=0x%08lx time=%i\n",
|
#endif
|
||||||
req_bank, req_addr, timer_stop_int());
|
|
||||||
#endif
|
|
||||||
req_bank++;
|
req_bank++;
|
||||||
shared_memory_put(SHARED_MEM_CMD_UPLOAD_PROGESS, req_bank);
|
shared_memory_put(SHARED_MEM_CMD_UPLOAD_PROGESS,req_bank);
|
||||||
sram_bulk_write_start(req_addr);
|
sram_bulk_write_start(req_addr);
|
||||||
timer_start();
|
timer_start();
|
||||||
|
|
||||||
@@ -196,7 +186,7 @@ usbMsgLen_t usbFunctionSetup(uchar data[8])
|
|||||||
}
|
}
|
||||||
ret_len = USB_MAX_TRANS;
|
ret_len = USB_MAX_TRANS;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
} else if (rq->bRequest == USB_BULK_UPLOAD_NEXT) {
|
} else if (rq->bRequest == USB_BULK_UPLOAD_NEXT) {
|
||||||
@@ -208,79 +198,73 @@ usbMsgLen_t usbFunctionSetup(uchar data[8])
|
|||||||
rx_remaining = rq->wLength.word;
|
rx_remaining = rq->wLength.word;
|
||||||
#if 0
|
#if 0
|
||||||
if (req_addr && (req_addr % 0x1000) == 0) {
|
if (req_addr && (req_addr % 0x1000) == 0) {
|
||||||
debug(DEBUG_USB,
|
debug(DEBUG_USB,"USB_BULK_UPLOAD_NEXT: bank=0x%02x addr=0x%08lx crc=%04x\n",
|
||||||
"USB_BULK_UPLOAD_NEXT: bank=0x%02x addr=0x%08lx crc=%04x\n",
|
req_bank, req_addr,crc_check_bulk_memory(req_addr - 0x1000,req_addr,req_bank_size));
|
||||||
req_bank, req_addr, crc_check_bulk_memory(req_addr - 0x1000,
|
|
||||||
req_addr,
|
|
||||||
req_bank_size));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
sram_bulk_write_start(req_addr);
|
sram_bulk_write_start(req_addr);
|
||||||
#endif
|
#endif
|
||||||
if (req_addr && (req_addr % req_bank_size) == 0) {
|
if (req_addr && ( req_addr % req_bank_size) == 0) {
|
||||||
#ifdef FLT_DEBUG
|
#ifdef FLT_DEBUG
|
||||||
debug(DEBUG_USB,
|
debug(DEBUG_USB,"USB_BULK_UPLOAD_NEXT: req_bank=0x%02x addr=0x%08lx time=%.4f\n",
|
||||||
"USB_BULK_UPLOAD_NEXT: req_bank=0x%02x addr=0x%08lx time=%.4f\n",
|
req_bank, req_addr,timer_stop());
|
||||||
req_bank, req_addr, timer_stop());
|
#else
|
||||||
#else
|
debug(DEBUG_USB,"USB_BULK_UPLOAD_NEXT: req_bank=0x%02x addr=0x%08lx time=%i\n",
|
||||||
debug(DEBUG_USB,
|
req_bank, req_addr,timer_stop_int());
|
||||||
"USB_BULK_UPLOAD_NEXT: req_bank=0x%02x addr=0x%08lx time=%i\n",
|
#endif
|
||||||
req_bank, req_addr, timer_stop_int());
|
|
||||||
#endif
|
|
||||||
req_bank++;
|
req_bank++;
|
||||||
timer_start();
|
timer_start();
|
||||||
shared_memory_put(SHARED_MEM_CMD_BANK_CURRENT, req_bank);
|
shared_memory_put(SHARED_MEM_CMD_BANK_CURRENT,req_bank);
|
||||||
sram_bulk_write_start(req_addr);
|
sram_bulk_write_start(req_addr);
|
||||||
|
|
||||||
}
|
}
|
||||||
ret_len = USB_MAX_TRANS;
|
ret_len = USB_MAX_TRANS;
|
||||||
/*
|
/*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
} else if (rq->bRequest == USB_BULK_UPLOAD_END) {
|
} else if (rq->bRequest == USB_BULK_UPLOAD_END) {
|
||||||
if (req_state != REQ_STATUS_BULK_UPLOAD) {
|
if (req_state != REQ_STATUS_BULK_UPLOAD){
|
||||||
debug(DEBUG_USB,
|
debug(DEBUG_USB,"USB_BULK_UPLOAD_END: ERROR state is not REQ_STATUS_BULK_UPLOAD\n");
|
||||||
"USB_BULK_UPLOAD_END: ERROR state is not REQ_STATUS_BULK_UPLOAD\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
debug(DEBUG_USB, "USB_BULK_UPLOAD_END:\n");
|
debug(DEBUG_USB,"USB_BULK_UPLOAD_END:\n");
|
||||||
req_state = REQ_STATUS_IDLE;
|
req_state = REQ_STATUS_IDLE;
|
||||||
sram_bulk_write_end();
|
sram_bulk_write_end();
|
||||||
shared_memory_put(SHARED_MEM_CMD_UPLOAD_END, 0);
|
shared_memory_put(SHARED_MEM_CMD_UPLOAD_END,0);
|
||||||
ret_len = 0;
|
ret_len = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
} else if (rq->bRequest == USB_CRC) {
|
} else if (rq->bRequest == USB_CRC) {
|
||||||
req_addr = rq->wValue.word;
|
req_addr = rq->wValue.word;
|
||||||
req_addr = req_addr << 16;
|
req_addr = req_addr << 16;
|
||||||
req_addr = req_addr | rq->wIndex.word;
|
req_addr = req_addr | rq->wIndex.word;
|
||||||
debug(DEBUG_USB, "USB_CRC: addr=0x%08lx \n", req_addr);
|
debug(DEBUG_USB,"USB_CRC: addr=0x%08lx \n", req_addr);
|
||||||
crc_check_bulk_memory(0x000000, req_addr, req_bank_size);
|
crc_check_bulk_memory(0x000000, req_addr, req_bank_size);
|
||||||
ret_len = 0;
|
ret_len = 0;
|
||||||
/*
|
/*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
} else if (rq->bRequest == USB_MODE_SNES) {
|
} else if (rq->bRequest == USB_MODE_SNES) {
|
||||||
req_state = REQ_STATUS_SNES;
|
req_state = REQ_STATUS_SNES;
|
||||||
debug(DEBUG_USB, "USB_MODE_SNES:\n");
|
debug(DEBUG_USB,"USB_MODE_SNES:\n");
|
||||||
ret_len = 0;
|
ret_len = 0;
|
||||||
/*
|
/*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
} else if (rq->bRequest == USB_MODE_AVR) {
|
} else if (rq->bRequest == USB_MODE_AVR) {
|
||||||
req_state = REQ_STATUS_AVR;
|
req_state = REQ_STATUS_AVR;
|
||||||
debug(DEBUG_USB, "USB_MODE_AVR:\n");
|
debug(DEBUG_USB,"USB_MODE_AVR:\n");
|
||||||
ret_len = 0;
|
ret_len = 0;
|
||||||
/*
|
/*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
} else if (rq->bRequest == USB_AVR_RESET) {
|
} else if (rq->bRequest == USB_AVR_RESET) {
|
||||||
debug(DEBUG_USB, "USB_AVR_RESET:\n");
|
debug(DEBUG_USB,"USB_AVR_RESET:\n");
|
||||||
soft_reset();
|
soft_reset();
|
||||||
ret_len = 0;
|
ret_len = 0;
|
||||||
/*
|
/*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -289,13 +273,12 @@ usbMsgLen_t usbFunctionSetup(uchar data[8])
|
|||||||
req_addr = rq->wValue.word;
|
req_addr = rq->wValue.word;
|
||||||
req_addr = req_addr << 16;
|
req_addr = req_addr << 16;
|
||||||
req_addr = req_addr | rq->wIndex.word;
|
req_addr = req_addr | rq->wIndex.word;
|
||||||
debug(DEBUG_USB, "USB_CRC_ADDR: addr=0x%lx size=%i\n", req_addr,
|
debug(DEBUG_USB,"USB_CRC_ADDR: addr=0x%lx size=%i\n", req_addr,
|
||||||
rq->wLength.word);
|
rq->wLength.word);
|
||||||
req_size = rq->wLength.word;
|
req_size = rq->wLength.word;
|
||||||
req_size = req_size << 2;
|
req_size = req_size << 2;
|
||||||
tx_remaining = 2;
|
tx_remaining = 2;
|
||||||
debug(DEBUG_USB, "USB_CRC_ADDR: addr=0x%lx size=%li\n", req_addr,
|
debug(DEBUG_USB,"USB_CRC_ADDR: addr=0x%lx size=%li\n", req_addr, req_size);
|
||||||
req_size);
|
|
||||||
|
|
||||||
crc = crc_check_memory_range(req_addr, req_size, read_buffer);
|
crc = crc_check_memory_range(req_addr, req_size, read_buffer);
|
||||||
tx_buffer[0] = crc & 0xff;
|
tx_buffer[0] = crc & 0xff;
|
||||||
@@ -305,100 +288,34 @@ usbMsgLen_t usbFunctionSetup(uchar data[8])
|
|||||||
}
|
}
|
||||||
|
|
||||||
usbMsgPtr = data_buffer;
|
usbMsgPtr = data_buffer;
|
||||||
return ret_len; /* default for not implemented requests: return no data back to host */
|
return ret_len; /* default for not implemented requests: return
|
||||||
|
* no data back to host */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#define ENABLE_TEST
|
|
||||||
#ifdef ENABLE_TEST
|
|
||||||
|
|
||||||
|
void test_read_write(){
|
||||||
uint8_t buffer[512];
|
|
||||||
|
|
||||||
void test_sdcard(){
|
|
||||||
uint16_t fat_cluster = 0;
|
|
||||||
uint8_t fat_attrib = 0;
|
|
||||||
uint32_t fat_size = 0;
|
|
||||||
uint32_t rom_addr = 0;
|
|
||||||
uint8_t bank_cnt = 0;
|
|
||||||
uint16_t crc = 0;
|
|
||||||
uint16_t block_cnt;
|
|
||||||
uint16_t clustervar;
|
|
||||||
uint8_t dir_attrib = 0;
|
|
||||||
uint32_t file_size = 0;
|
|
||||||
uint8_t i = 0;
|
|
||||||
|
|
||||||
#define FILENAME "mrdo.smc" //failed
|
|
||||||
#define ROMSIZE 2 // 4 == 4mbit == 512kb
|
|
||||||
#define BUFFER_SIZE 512
|
|
||||||
#define BLOCKS (ROMSIZE << 8)
|
|
||||||
|
|
||||||
while ( mmc_init() !=0) {
|
|
||||||
info("No sdcard...\n");
|
|
||||||
}
|
|
||||||
info("MMC Init done\n");
|
|
||||||
fat_init(read_buffer);
|
|
||||||
info("FAT Init done.\n");
|
|
||||||
|
|
||||||
|
|
||||||
info("\r\nDirectory\r\n");
|
|
||||||
for (i = 1;i < 240;i++){
|
|
||||||
clustervar = fat_read_dir_ent(0,i,&file_size,&dir_attrib,buffer);
|
|
||||||
if (clustervar == 0xffff){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
info("Cluster = %4x DirA = %2x FileName = %s size=%li\n",clustervar,dir_attrib,buffer,file_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
info("Look for %s\n",FILENAME);
|
|
||||||
|
|
||||||
if (fat_search_file((uint8_t*)FILENAME,
|
|
||||||
&fat_cluster,
|
|
||||||
&fat_size,
|
|
||||||
&fat_attrib,
|
|
||||||
read_buffer) == 1) {
|
|
||||||
|
|
||||||
|
|
||||||
for (block_cnt=0; block_cnt<BLOCKS; block_cnt++) {
|
|
||||||
fat_read_file (fat_cluster,read_buffer,block_cnt);
|
|
||||||
|
|
||||||
if (block_cnt && block_cnt % 64 == 0){
|
|
||||||
printf("Write Ram Bank: 0x%x Addr: 0x%lx Block: %x CRC: %x\n",bank_cnt,rom_addr,block_cnt,crc);
|
|
||||||
bank_cnt++;
|
|
||||||
crc = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
printf("Write Ram Bank: 0x%x Addr: 0x%lx Block: %x CRC: %x\n",bank_cnt,rom_addr,block_cnt,crc);
|
|
||||||
printf("Done\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void test_read_write()
|
|
||||||
{
|
|
||||||
|
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
uint32_t addr;
|
uint32_t addr;
|
||||||
avr_bus_active();
|
avr_bus_active();
|
||||||
addr = 0x000000;
|
addr = 0x000000;
|
||||||
i = 1;
|
i = 1;
|
||||||
while (addr++ <= 0x0000ff) {
|
while (addr++ <= 0x0000ff){
|
||||||
sram_write(addr, i++);
|
sram_write(addr,i++);
|
||||||
}
|
}
|
||||||
addr = 0x000000;
|
addr = 0x000000;
|
||||||
while (addr++ <= 0x0000ff) {
|
while (addr++ <= 0x0000ff){
|
||||||
info("read addr=0x%08lx %x\n", addr, sram_read(addr));
|
info("read addr=0x%08lx %x\n",addr,sram_read(addr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void test_bulk_read_write()
|
void test_bulk_read_write(){
|
||||||
{
|
|
||||||
|
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
uint32_t addr;
|
uint32_t addr;
|
||||||
@@ -406,7 +323,7 @@ void test_bulk_read_write()
|
|||||||
addr = 0x000000;
|
addr = 0x000000;
|
||||||
i = 0;
|
i = 0;
|
||||||
sram_bulk_write_start(addr);
|
sram_bulk_write_start(addr);
|
||||||
while (addr++ <= 0x8000) {
|
while (addr++ <= 0x8000){
|
||||||
sram_bulk_write(i++);
|
sram_bulk_write(i++);
|
||||||
sram_bulk_write_next();
|
sram_bulk_write_next();
|
||||||
}
|
}
|
||||||
@@ -414,8 +331,8 @@ void test_bulk_read_write()
|
|||||||
|
|
||||||
addr = 0x000000;
|
addr = 0x000000;
|
||||||
sram_bulk_read_start(addr);
|
sram_bulk_read_start(addr);
|
||||||
while (addr <= 0x8000) {
|
while (addr <= 0x8000){
|
||||||
info("addr=0x%08lx %x\n", addr, sram_bulk_read());
|
info("addr=0x%08lx %x\n",addr,sram_bulk_read());
|
||||||
sram_bulk_read_next();
|
sram_bulk_read_next();
|
||||||
addr++;
|
addr++;
|
||||||
}
|
}
|
||||||
@@ -423,15 +340,15 @@ void test_bulk_read_write()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void test_non_zero_memory(uint32_t bottom_addr, uint32_t top_addr)
|
void test_non_zero_memory(uint32_t bottom_addr,uint32_t top_addr)
|
||||||
{
|
{
|
||||||
uint32_t addr = 0;
|
uint32_t addr = 0;
|
||||||
uint8_t c;
|
uint8_t c;
|
||||||
sram_bulk_read_start(bottom_addr);
|
sram_bulk_read_start(bottom_addr);
|
||||||
for (addr = bottom_addr; addr < top_addr; addr++) {
|
for (addr = bottom_addr; addr < top_addr; addr++) {
|
||||||
c = sram_bulk_read();
|
c = sram_bulk_read();
|
||||||
if (c != 0xff)
|
if (c!=0xff)
|
||||||
info("addr=0x%08lx c=0x%x\n", addr, c);
|
info("addr=0x%08lx c=0x%x\n",addr,c);
|
||||||
sram_bulk_read_next();
|
sram_bulk_read_next();
|
||||||
}
|
}
|
||||||
sram_bulk_read_end();
|
sram_bulk_read_end();
|
||||||
@@ -439,20 +356,45 @@ void test_non_zero_memory(uint32_t bottom_addr, uint32_t top_addr)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void test_crc()
|
void test_crc(){
|
||||||
{
|
|
||||||
info("test_crc: clear\n");
|
info("test_crc: clear\n");
|
||||||
avr_bus_active();
|
avr_bus_active();
|
||||||
sram_bulk_set(0x000000, 0x10000, 0xff);
|
sram_bulk_set(0x000000,0x10000,0xff);
|
||||||
info("test_crc: crc\n");
|
info("test_crc: crc\n");
|
||||||
crc_check_bulk_memory(0x000000, 0x10000, 0x8000);
|
crc_check_bulk_memory(0x000000,0x10000,0x8000);
|
||||||
info("test_crc: check\n");
|
info("test_crc: check\n");
|
||||||
test_non_zero_memory(0x000000, 0x10000);
|
test_non_zero_memory(0x000000,0x10000);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void send_reset()
|
uint16_t read_byte_pgm(uint16_t addr){
|
||||||
{
|
return pgm_read_byte((PGM_VOID_P)addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void decompress_huffman(PGM_VOID_P addr, uint16_t(*fp)(uint16_t)){
|
||||||
|
uint16_t c;
|
||||||
|
uint32_t i = 0;
|
||||||
|
huffman_dec_ctx_t ctx;
|
||||||
|
info("ok1\n");
|
||||||
|
huffman_dec_init(&ctx, fp);
|
||||||
|
info("ok2\n");
|
||||||
|
huffman_dec_set_addr(&ctx, (uint16_t)addr);
|
||||||
|
info("ok3\n");
|
||||||
|
while(1){
|
||||||
|
info("ok4\n");
|
||||||
|
i++;
|
||||||
|
c=huffman_dec_byte(&ctx);
|
||||||
|
if (i%1024==0)
|
||||||
|
info(".");
|
||||||
|
if(c>0xff){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
c&=0xff;
|
||||||
|
sram_bulk_write(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void send_reset(){
|
||||||
info("Reset Snes\n");
|
info("Reset Snes\n");
|
||||||
snes_reset_on();
|
snes_reset_on();
|
||||||
snes_reset_lo();
|
snes_reset_lo();
|
||||||
@@ -461,8 +403,7 @@ void send_reset()
|
|||||||
snes_reset_off();
|
snes_reset_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_irq()
|
void send_irq(){
|
||||||
{
|
|
||||||
snes_irq_on();
|
snes_irq_on();
|
||||||
snes_irq_lo();
|
snes_irq_lo();
|
||||||
_delay_us(20);
|
_delay_us(20);
|
||||||
@@ -470,9 +411,8 @@ void send_irq()
|
|||||||
snes_irq_off();
|
snes_irq_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_rom_mode()
|
void set_rom_mode(){
|
||||||
{
|
if (req_bank_size == 0x8000){
|
||||||
if (req_bank_size == 0x8000) {
|
|
||||||
snes_lorom();
|
snes_lorom();
|
||||||
info("Set Snes lowrom \n");
|
info("Set Snes lowrom \n");
|
||||||
} else {
|
} else {
|
||||||
@@ -482,8 +422,7 @@ void set_rom_mode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void usb_connect()
|
void usb_connect(){
|
||||||
{
|
|
||||||
uint8_t i = 0;
|
uint8_t i = 0;
|
||||||
info("USB init\n");
|
info("USB init\n");
|
||||||
usbDeviceDisconnect(); /* enforce re-enumeration, do this while */
|
usbDeviceDisconnect(); /* enforce re-enumeration, do this while */
|
||||||
@@ -502,14 +441,12 @@ void usb_connect()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void boot_startup_rom()
|
void boot_startup_rom(){
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
info("Activate AVR bus\n");
|
info("Activate AVR bus\n");
|
||||||
avr_bus_active();
|
avr_bus_active();
|
||||||
|
|
||||||
|
|
||||||
info("IRQ off\n");
|
info("IRQ off\n");
|
||||||
snes_irq_lo();
|
snes_irq_lo();
|
||||||
snes_irq_off();
|
snes_irq_off();
|
||||||
@@ -517,7 +454,13 @@ void boot_startup_rom()
|
|||||||
snes_lorom();
|
snes_lorom();
|
||||||
info("Set Snes lowrom \n");
|
info("Set Snes lowrom \n");
|
||||||
|
|
||||||
rle_decode(&_rom, ROM_BUFFER_SIZE, 0x000000);
|
|
||||||
|
info("Huffman decompress to 0x010000\n",(void*)_rom);
|
||||||
|
sram_bulk_write_start(0x010000);
|
||||||
|
decompress_huffman(&_rom,read_byte_pgm);
|
||||||
|
sram_bulk_write_end();
|
||||||
|
info("RLE decompress to 0x000000\n",(void*)_rom);
|
||||||
|
rle_decode_sram(0x010000, ROM_RLE_SIZE, 0x000000);
|
||||||
dump_memory(0x10000 - 0x100, 0x10000);
|
dump_memory(0x10000 - 0x100, 0x10000);
|
||||||
|
|
||||||
snes_reset_hi();
|
snes_reset_hi();
|
||||||
@@ -538,7 +481,7 @@ void boot_startup_rom()
|
|||||||
uint8_t i = 0;
|
uint8_t i = 0;
|
||||||
i = 20;
|
i = 20;
|
||||||
info("Wait");
|
info("Wait");
|
||||||
while (--i) {
|
while (--i){
|
||||||
_delay_ms(500);
|
_delay_ms(500);
|
||||||
info(".");
|
info(".");
|
||||||
}
|
}
|
||||||
@@ -554,13 +497,12 @@ int main(void)
|
|||||||
|
|
||||||
info("Sytem start\n");
|
info("Sytem start\n");
|
||||||
system_init();
|
system_init();
|
||||||
test_sdcard();
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
test_read_write();
|
test_read_write();
|
||||||
test_bulk_read_write();
|
test_bulk_read_write();
|
||||||
test_crc();
|
test_crc();
|
||||||
while (1);
|
while(1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
info("Boot startup rom\n");
|
info("Boot startup rom\n");
|
||||||
@@ -569,7 +511,7 @@ int main(void)
|
|||||||
usbInit();
|
usbInit();
|
||||||
usb_connect();
|
usb_connect();
|
||||||
|
|
||||||
while (1) {
|
while (1){
|
||||||
avr_bus_active();
|
avr_bus_active();
|
||||||
info("Activate AVR bus\n");
|
info("Activate AVR bus\n");
|
||||||
info("IRQ off\n");
|
info("IRQ off\n");
|
||||||
@@ -581,10 +523,10 @@ int main(void)
|
|||||||
snes_wr_disable();
|
snes_wr_disable();
|
||||||
sei();
|
sei();
|
||||||
info("USB poll\n");
|
info("USB poll\n");
|
||||||
while (req_state != REQ_STATUS_SNES) {
|
while (req_state != REQ_STATUS_SNES){
|
||||||
usbPoll();
|
usbPoll();
|
||||||
}
|
}
|
||||||
shared_memory_put(SHARED_MEM_CMD_TERMINATE, 0);
|
shared_memory_put(SHARED_MEM_CMD_TERMINATE,0);
|
||||||
info("USB poll done\n");
|
info("USB poll done\n");
|
||||||
snes_reset_hi();
|
snes_reset_hi();
|
||||||
snes_reset_off();
|
snes_reset_off();
|
||||||
@@ -601,7 +543,7 @@ int main(void)
|
|||||||
send_reset();
|
send_reset();
|
||||||
|
|
||||||
info("Poll\n");
|
info("Poll\n");
|
||||||
while (req_state != REQ_STATUS_AVR) {
|
while (req_state != REQ_STATUS_AVR){
|
||||||
|
|
||||||
usbPoll();
|
usbPoll();
|
||||||
|
|
||||||
@@ -612,7 +554,7 @@ int main(void)
|
|||||||
while (--i) {
|
while (--i) {
|
||||||
_delay_ms(100);
|
_delay_ms(100);
|
||||||
}
|
}
|
||||||
info("Send IRQ %i\n", ++irq_count);
|
info("Send IRQ %i\n",++irq_count);
|
||||||
send_irq();
|
send_irq();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -626,7 +568,7 @@ int main(void)
|
|||||||
info("Wait to switch to snes mode %i\n", i);
|
info("Wait to switch to snes mode %i\n", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req_bank_size == 0x8000) {
|
if (req_bank_size == 0x8000){
|
||||||
snes_lorom();
|
snes_lorom();
|
||||||
info("Set Snes lowrom \n");
|
info("Set Snes lowrom \n");
|
||||||
} else {
|
} else {
|
||||||
@@ -637,10 +579,11 @@ int main(void)
|
|||||||
info("Disable snes WR\n");
|
info("Disable snes WR\n");
|
||||||
snes_bus_active();
|
snes_bus_active();
|
||||||
info("Activate Snes bus\n");
|
info("Activate Snes bus\n");
|
||||||
info("Read 0x3000=%c\n", c);
|
info("Read 0x3000=%c\n",c);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,194 +0,0 @@
|
|||||||
#include "mmc.h"
|
|
||||||
#include <util/delay.h>
|
|
||||||
|
|
||||||
uint8_t mmc_init()
|
|
||||||
{
|
|
||||||
uint16_t Timeout = 0, i;
|
|
||||||
MMC_REG |= ((1 << MMC_DO) | (1 << MMC_CS) | (1 << MMC_CLK));
|
|
||||||
MMC_REG &= ~(1 << MMC_DI);
|
|
||||||
MMC_WRITE |= ((1 << MMC_DO) | (1 << MMC_DI) | (1 << MMC_CS));
|
|
||||||
_delay_ms(20);
|
|
||||||
for (i = 0; i < 250; i++) {
|
|
||||||
MMC_WRITE ^= (1 << MMC_CLK);
|
|
||||||
_delay_us(4);
|
|
||||||
}
|
|
||||||
MMC_WRITE &= ~(1 << MMC_CLK);
|
|
||||||
_delay_us(10);
|
|
||||||
MMC_WRITE &= ~(1 << MMC_CS);
|
|
||||||
_delay_us(3);
|
|
||||||
|
|
||||||
uint8_t CMD[] = { 0x40, 0x00, 0x00, 0x00, 0x00, 0x95 };
|
|
||||||
while (mmc_write_command(CMD) != 1) {
|
|
||||||
if (Timeout++ > 20) {
|
|
||||||
mmc_disable();
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timeout = 0;
|
|
||||||
CMD[0] = 0x41;
|
|
||||||
CMD[5] = 0xFF;
|
|
||||||
while (mmc_write_command(CMD) != 0) {
|
|
||||||
if (Timeout++ > 800) {
|
|
||||||
mmc_disable();
|
|
||||||
return (9);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t mmc_write_command(uint8_t * cmd)
|
|
||||||
{
|
|
||||||
uint8_t tmp = 0xff;
|
|
||||||
uint16_t Timeout = 0;
|
|
||||||
uint8_t a;
|
|
||||||
|
|
||||||
for (a = 0; a < 0x06; a++) {
|
|
||||||
mmc_write_byte(*cmd++);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (tmp == 0xff) {
|
|
||||||
tmp = mmc_read_byte();
|
|
||||||
if (Timeout++ > 50) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t mmc_read_byte(void)
|
|
||||||
{
|
|
||||||
uint8_t Byte = 0, j;
|
|
||||||
for (j = 0; j < 8; j++) {
|
|
||||||
Byte = (Byte << 1);
|
|
||||||
MMC_WRITE |= (1 << MMC_CLK);
|
|
||||||
_delay_us(4);
|
|
||||||
if (PINB & (1 << MMC_DI)) {
|
|
||||||
Byte |= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
Byte &= ~1;
|
|
||||||
}
|
|
||||||
MMC_WRITE &= ~(1 << MMC_CLK);
|
|
||||||
_delay_us(4);
|
|
||||||
}
|
|
||||||
return (Byte);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void mmc_write_byte(uint8_t Byte)
|
|
||||||
{
|
|
||||||
uint8_t i;
|
|
||||||
for (i = 0; i < 8; i++) {
|
|
||||||
if (Byte & 0x80) {
|
|
||||||
MMC_WRITE |= (1 << MMC_DO);
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
MMC_WRITE &= ~(1 << MMC_DO);
|
|
||||||
}
|
|
||||||
Byte = (Byte << 1);
|
|
||||||
MMC_WRITE |= (1 << MMC_CLK);
|
|
||||||
_delay_us(4);
|
|
||||||
MMC_WRITE &= ~(1 << MMC_CLK);
|
|
||||||
_delay_us(4);
|
|
||||||
}
|
|
||||||
MMC_WRITE |= (1 << MMC_DO);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t mmc_write_sector(uint32_t addr, uint8_t * Buffer)
|
|
||||||
{
|
|
||||||
uint8_t tmp;
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t cmd[] = { 0x58, 0x00, 0x00, 0x00, 0x00, 0xFF };
|
|
||||||
uint8_t a;
|
|
||||||
uint16_t i;
|
|
||||||
|
|
||||||
addr = addr << 9;
|
|
||||||
cmd[1] = ((addr & 0xFF000000) >> 24);
|
|
||||||
cmd[2] = ((addr & 0x00FF0000) >> 16);
|
|
||||||
cmd[3] = ((addr & 0x0000FF00) >> 8);
|
|
||||||
|
|
||||||
|
|
||||||
tmp = mmc_write_command(cmd);
|
|
||||||
if (tmp != 0) {
|
|
||||||
return (tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (a = 0; a < 100; a++) {
|
|
||||||
mmc_read_byte();
|
|
||||||
}
|
|
||||||
|
|
||||||
mmc_write_byte(0xFE);
|
|
||||||
|
|
||||||
for (a = 0; i < 512; i++) {
|
|
||||||
mmc_write_byte(*Buffer++);
|
|
||||||
}
|
|
||||||
|
|
||||||
mmc_write_byte(0xFF);
|
|
||||||
mmc_write_byte(0xFF);
|
|
||||||
|
|
||||||
if ((mmc_read_byte() & 0x1F) != 0x05)
|
|
||||||
return (1);
|
|
||||||
|
|
||||||
while (mmc_read_byte() != 0xff) {
|
|
||||||
};
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void mmc_read_block(uint8_t * cmd, uint8_t * Buffer, uint16_t Bytes)
|
|
||||||
{
|
|
||||||
uint16_t a;
|
|
||||||
|
|
||||||
if (mmc_write_command(cmd) != 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (mmc_read_byte() != 0xfe) {
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
for (a = 0; a < Bytes; a++) {
|
|
||||||
*Buffer++ = mmc_read_byte();
|
|
||||||
}
|
|
||||||
|
|
||||||
mmc_read_byte();
|
|
||||||
mmc_read_byte();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t mmc_read_sector(uint32_t addr, uint8_t * Buffer)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t cmd[] = { 0x51, 0x00, 0x00, 0x00, 0x00, 0xFF };
|
|
||||||
|
|
||||||
addr = addr << 9;
|
|
||||||
cmd[1] = ((addr & 0xFF000000) >> 24);
|
|
||||||
cmd[2] = ((addr & 0x00FF0000) >> 16);
|
|
||||||
cmd[3] = ((addr & 0x0000FF00) >> 8);
|
|
||||||
mmc_read_block(cmd, Buffer, 512);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t mmc_read_cid(uint8_t * Buffer)
|
|
||||||
{
|
|
||||||
|
|
||||||
uint8_t cmd[] = { 0x4A, 0x00, 0x00, 0x00, 0x00, 0xFF };
|
|
||||||
mmc_read_block(cmd, Buffer, 16);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t mmc_read_csd(uint8_t * Buffer)
|
|
||||||
{
|
|
||||||
|
|
||||||
uint8_t cmd[] = { 0x49, 0x00, 0x00, 0x00, 0x00, 0xFF };
|
|
||||||
mmc_read_block(cmd, Buffer, 16);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
#ifndef _MMC_H_
|
|
||||||
#define _MMC_H_
|
|
||||||
|
|
||||||
#include <avr/io.h>
|
|
||||||
|
|
||||||
|
|
||||||
#define MMC_WRITE PORTB
|
|
||||||
#define MMC_READ PINB
|
|
||||||
#define MMC_REG DDRB
|
|
||||||
|
|
||||||
#define MMC_CS PB4
|
|
||||||
#define MMC_DO PB6
|
|
||||||
#define MMC_DI PB5
|
|
||||||
#define MMC_CLK PB7
|
|
||||||
extern uint8_t mmc_read_byte(void);
|
|
||||||
extern void mmc_write_byte(uint8_t);
|
|
||||||
extern void mmc_read_block(uint8_t *, uint8_t *, unsigned in);
|
|
||||||
extern uint8_t mmc_init(void);
|
|
||||||
extern uint8_t mmc_read_sector(uint32_t, uint8_t *);
|
|
||||||
extern uint8_t mmc_write_sector(uint32_t, uint8_t *);
|
|
||||||
extern uint8_t mmc_write_command(uint8_t *);
|
|
||||||
extern uint8_t mmc_read_csd(uint8_t *);
|
|
||||||
extern uint8_t mmc_read_cid(uint8_t *);
|
|
||||||
|
|
||||||
#define mmc_disable() MMC_WRITE|= (1<<MMC_CS);
|
|
||||||
|
|
||||||
#define mmc_enable() MMC_WRITE&=~(1<<MMC_CS);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -36,7 +36,7 @@ uint8_t rle_decode(PGM_VOID_P in_addr, int32_t in_len, uint32_t out_addr)
|
|||||||
{
|
{
|
||||||
uint8_t in_byte, in_repeat, last_byte;
|
uint8_t in_byte, in_repeat, last_byte;
|
||||||
uint32_t out_len, out_len_left;
|
uint32_t out_len, out_len_left;
|
||||||
info("RLE decode len=%li addr=0x%08lx\n", in_len, out_addr);
|
info("RLE decode len=%li addr=0x%08lx\n",in_len,out_addr);
|
||||||
last_byte = 0;
|
last_byte = 0;
|
||||||
|
|
||||||
out_len_left = out_len;
|
out_len_left = out_len;
|
||||||
@@ -71,29 +71,23 @@ uint8_t rle_decode(PGM_VOID_P in_addr, int32_t in_len, uint32_t out_addr)
|
|||||||
OUTBYTE(in_byte);
|
OUTBYTE(in_byte);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (in_len > 0) {
|
while( in_len > 0 ) {
|
||||||
INBYTE(in_byte);
|
INBYTE(in_byte);
|
||||||
if (in_len % 1024 == 0)
|
if (in_len%1024==0)
|
||||||
info(".");
|
info(".");
|
||||||
if (in_byte == RUNCHAR) {
|
if (in_byte == RUNCHAR) {
|
||||||
INBYTE(in_repeat);
|
INBYTE(in_repeat);
|
||||||
if (in_repeat == 0) {
|
if ( in_repeat == 0 ) {
|
||||||
/*
|
/* Just an escaped RUNCHAR value */
|
||||||
* Just an escaped RUNCHAR value
|
|
||||||
*/
|
|
||||||
OUTBYTE(RUNCHAR);
|
OUTBYTE(RUNCHAR);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/* Pick up value and output a sequence of it */
|
||||||
* Pick up value and output a sequence of it
|
in_byte = last_byte; //;out_data[-1];
|
||||||
*/
|
while ( --in_repeat > 0 )
|
||||||
in_byte = last_byte; // ;out_data[-1];
|
|
||||||
while (--in_repeat > 0)
|
|
||||||
OUTBYTE(in_byte);
|
OUTBYTE(in_byte);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/*
|
/* Normal byte */
|
||||||
* Normal byte
|
|
||||||
*/
|
|
||||||
OUTBYTE(in_byte);
|
OUTBYTE(in_byte);
|
||||||
}
|
}
|
||||||
last_byte = in_byte;
|
last_byte = in_byte;
|
||||||
@@ -101,3 +95,63 @@ uint8_t rle_decode(PGM_VOID_P in_addr, int32_t in_len, uint32_t out_addr)
|
|||||||
sram_bulk_write_end();
|
sram_bulk_write_end();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t rle_decode_sram(uint32_t in_addr, int32_t in_len, uint32_t out_addr)
|
||||||
|
{
|
||||||
|
uint8_t in_byte, in_repeat, last_byte;
|
||||||
|
uint32_t out_len, out_len_left;
|
||||||
|
info("RLE decode len=%li addr=0x%08lx\n",in_len,out_addr);
|
||||||
|
last_byte = 0;
|
||||||
|
out_len_left = out_len;
|
||||||
|
#define INBYTE(b) \
|
||||||
|
do { \
|
||||||
|
if ( --in_len < 0 ) { \
|
||||||
|
return 1; \
|
||||||
|
} \
|
||||||
|
b = sram_read(in_addr);\
|
||||||
|
in_addr++;\
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define OUTBYTE(b) \
|
||||||
|
do { \
|
||||||
|
sram_write(out_addr,b);\
|
||||||
|
out_addr++;\
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
INBYTE(in_byte);
|
||||||
|
|
||||||
|
if (in_byte == RUNCHAR) {
|
||||||
|
INBYTE(in_repeat);
|
||||||
|
if (in_repeat != 0) {
|
||||||
|
info("Orphaned RLE code at start\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
OUTBYTE(RUNCHAR);
|
||||||
|
} else {
|
||||||
|
OUTBYTE(in_byte);
|
||||||
|
}
|
||||||
|
|
||||||
|
while( in_len > 0 ) {
|
||||||
|
INBYTE(in_byte);
|
||||||
|
if (in_len%1024==0)
|
||||||
|
info(".");
|
||||||
|
if (in_byte == RUNCHAR) {
|
||||||
|
INBYTE(in_repeat);
|
||||||
|
if ( in_repeat == 0 ) {
|
||||||
|
/* Just an escaped RUNCHAR value */
|
||||||
|
OUTBYTE(RUNCHAR);
|
||||||
|
} else {
|
||||||
|
/* Pick up value and output a sequence of it */
|
||||||
|
in_byte = last_byte; //;out_data[-1];
|
||||||
|
while ( --in_repeat > 0 )
|
||||||
|
OUTBYTE(in_byte);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Normal byte */
|
||||||
|
OUTBYTE(in_byte);
|
||||||
|
}
|
||||||
|
last_byte = in_byte;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,11 +18,12 @@
|
|||||||
* =====================================================================================
|
* =====================================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __RLE_H__
|
#ifndef __RLE_H__
|
||||||
#define __RLE_H__
|
#define __RLE_H__
|
||||||
|
|
||||||
#include <avr/pgmspace.h>
|
#include <avr/pgmspace.h>
|
||||||
|
|
||||||
uint8_t rle_decode(PGM_VOID_P in_addr, uint32_t in_len, uint32_t out_addr);
|
uint8_t rle_decode(PGM_VOID_P in_addr,uint32_t in_len, uint32_t out_addr);
|
||||||
|
uint8_t rle_decode_sram(uint32_t in_addr, int32_t in_len, uint32_t out_addr);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -38,46 +38,40 @@ uint8_t scratchpad_state;
|
|||||||
uint8_t scratchpad_cmd;
|
uint8_t scratchpad_cmd;
|
||||||
uint8_t scratchpad_payload;
|
uint8_t scratchpad_payload;
|
||||||
|
|
||||||
void shared_memory_scratchpad_save()
|
void shared_memory_scratchpad_save(){
|
||||||
{
|
|
||||||
scratchpad_state = sram_read(SHARED_MEM_LOC_STATE);
|
scratchpad_state = sram_read(SHARED_MEM_LOC_STATE);
|
||||||
scratchpad_cmd = sram_read(SHARED_MEM_LOC_CMD);
|
scratchpad_cmd = sram_read(SHARED_MEM_LOC_CMD);
|
||||||
scratchpad_payload = sram_read(SHARED_MEM_LOC_PAYLOAD);
|
scratchpad_payload = sram_read(SHARED_MEM_LOC_PAYLOAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
void shared_memory_scratchpad_restore()
|
void shared_memory_scratchpad_restore(){
|
||||||
{
|
|
||||||
sram_write(SHARED_MEM_LOC_STATE, scratchpad_state);
|
sram_write(SHARED_MEM_LOC_STATE, scratchpad_state);
|
||||||
sram_write(SHARED_MEM_LOC_CMD, scratchpad_cmd);
|
sram_write(SHARED_MEM_LOC_CMD, scratchpad_cmd);
|
||||||
sram_write(SHARED_MEM_LOC_PAYLOAD, scratchpad_payload);
|
sram_write(SHARED_MEM_LOC_PAYLOAD, scratchpad_payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
void shared_memory_irq_hook()
|
void shared_memory_irq_hook(){
|
||||||
{
|
|
||||||
irq_addr_lo = sram_read(SHARED_IRQ_LOC_LO);
|
irq_addr_lo = sram_read(SHARED_IRQ_LOC_LO);
|
||||||
irq_addr_hi = sram_read(SHARED_IRQ_LOC_HI);
|
irq_addr_hi = sram_read(SHARED_IRQ_LOC_HI);
|
||||||
sram_write(SHARED_IRQ_HANDLER_LO, 0);
|
sram_write(SHARED_IRQ_HANDLER_LO, 0);
|
||||||
sram_write(SHARED_IRQ_HANDLER_HI, 0);
|
sram_write(SHARED_IRQ_HANDLER_HI, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void shared_memory_irq_restore()
|
void shared_memory_irq_restore(){
|
||||||
{
|
|
||||||
sram_write(SHARED_IRQ_LOC_LO, irq_addr_lo);
|
sram_write(SHARED_IRQ_LOC_LO, irq_addr_lo);
|
||||||
sram_write(SHARED_IRQ_LOC_HI, irq_addr_hi);
|
sram_write(SHARED_IRQ_LOC_HI, irq_addr_hi);
|
||||||
}
|
}
|
||||||
|
|
||||||
void shared_memory_put(uint8_t cmd, uint8_t value)
|
void shared_memory_put(uint8_t cmd, uint8_t value){
|
||||||
{
|
|
||||||
|
|
||||||
info("Write shared memory 0x%04x=0x%02x 0x%04x=0x%02x \n",
|
info("Write shared memory 0x%04x=0x%02x 0x%04x=0x%02x \n",SHARED_MEM_LOC_CMD,cmd,SHARED_MEM_LOC_PAYLOAD,value);
|
||||||
SHARED_MEM_LOC_CMD, cmd, SHARED_MEM_LOC_PAYLOAD, value);
|
|
||||||
|
|
||||||
shared_memory_scratchpad_save();
|
shared_memory_scratchpad_save();
|
||||||
shared_memory_irq_hook();
|
shared_memory_irq_hook();
|
||||||
|
|
||||||
sram_write(SHARED_MEM_LOC_STATE, SHARED_MEM_SNES_ACK);
|
sram_write(SHARED_MEM_LOC_STATE,SHARED_MEM_SNES_ACK);
|
||||||
sram_write(SHARED_MEM_LOC_CMD, cmd);
|
sram_write(SHARED_MEM_LOC_CMD,cmd);
|
||||||
sram_write(SHARED_MEM_LOC_PAYLOAD, value);
|
sram_write(SHARED_MEM_LOC_PAYLOAD,value);
|
||||||
|
|
||||||
snes_hirom();
|
snes_hirom();
|
||||||
snes_wr_disable();
|
snes_wr_disable();
|
||||||
@@ -95,3 +89,4 @@ void shared_memory_put(uint8_t cmd, uint8_t value)
|
|||||||
shared_memory_irq_restore();
|
shared_memory_irq_restore();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>currentDocument</key>
|
||||||
|
<string>avr/usbload/loader.c</string>
|
||||||
<key>documents</key>
|
<key>documents</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -19,6 +21,646 @@
|
|||||||
<integer>271</integer>
|
<integer>271</integer>
|
||||||
<key>metaData</key>
|
<key>metaData</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>avr/bootloader/bootloader.c</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>2</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>161</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>139</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/bootloader/config.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>15</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/bootloader/usbconfig.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>39</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>50</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/Makefile</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>5</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>14</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/commandline/Makefile</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>24</integer>
|
||||||
|
</dict>
|
||||||
|
<key>columnSelection</key>
|
||||||
|
<false/>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>selectFrom</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>selectTo</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>24</integer>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/commandline/opendevice.c</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>columnSelection</key>
|
||||||
|
<false/>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>selectFrom</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>selectTo</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/commandline/opendevice.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/commandline/snesuploader.c</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/commandline/snesuploader.ll</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>36</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>9</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/config.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>20</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/crc.c</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/crc.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/debug.c</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/debug.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>columnSelection</key>
|
||||||
|
<false/>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>selectFrom</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>21</integer>
|
||||||
|
</dict>
|
||||||
|
<key>selectTo</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/dump.c</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/dump.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/fifo.c</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/fifo.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>21</integer>
|
||||||
|
</dict>
|
||||||
|
<key>columnSelection</key>
|
||||||
|
<false/>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>selectFrom</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>selectTo</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>21</integer>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/huffman-decode.c</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>15</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/huffman-decode.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>15</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/loader.c</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>1843</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/main.c</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>483</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>431</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/requests.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/rle.c</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>15</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>36</integer>
|
||||||
|
</dict>
|
||||||
|
<key>columnSelection</key>
|
||||||
|
<false/>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>20</integer>
|
||||||
|
<key>selectFrom</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>10</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>36</integer>
|
||||||
|
</dict>
|
||||||
|
<key>selectTo</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>17</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>36</integer>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/rle.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>14</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>21</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/sram.c</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/sram.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/timer.c</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/timer.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>9</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/uart.c</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/uart.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/usb_bulk.c</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/usb_bulk.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/usbconfig.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/watchdog.c</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>avr/usbload/watchdog.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>19</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>poc/avr_sdcard/fat.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>poc/avr_sdcard/mmc.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>scripts/dev_server.py</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>60</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>33</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>scripts/link_webpy.sh</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
<key>snes/banktest/LoadGraphics.asm</key>
|
<key>snes/banktest/LoadGraphics.asm</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>caret</key>
|
<key>caret</key>
|
||||||
@@ -47,7 +689,138 @@
|
|||||||
<key>firstVisibleLine</key>
|
<key>firstVisibleLine</key>
|
||||||
<integer>211</integer>
|
<integer>211</integer>
|
||||||
</dict>
|
</dict>
|
||||||
|
<key>snes/loader/conv_rle.py</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>18</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>8</integer>
|
||||||
</dict>
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>snes/loader/main.asm</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>4</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>235</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>220</integer>
|
||||||
|
</dict>
|
||||||
|
<key>snes/loader/makefile</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>25</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>snes/loader/routines/memoryclear.asm</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>2</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>127</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>101</integer>
|
||||||
|
</dict>
|
||||||
|
<key>snes/loader/routines/songs.asm</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>9</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>14</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<key>snes/loadertest/main.c</key>
|
||||||
|
<dict>
|
||||||
|
<key>caret</key>
|
||||||
|
<dict>
|
||||||
|
<key>column</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>line</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
</dict>
|
||||||
|
<key>firstVisibleColumn</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>firstVisibleLine</key>
|
||||||
|
<integer>42</integer>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<key>openDocuments</key>
|
||||||
|
<array>
|
||||||
|
<string>avr/usbload/huffman-decode.c</string>
|
||||||
|
<string>scripts/link_webpy.sh</string>
|
||||||
|
<string>avr/usbload/huffman-decode.h</string>
|
||||||
|
<string>avr/usbload/rle.c</string>
|
||||||
|
<string>avr/usbload/sram.c</string>
|
||||||
|
<string>avr/usbload/rle.h</string>
|
||||||
|
<string>avr/usbload/crc.c</string>
|
||||||
|
<string>avr/usbload/crc.h</string>
|
||||||
|
<string>avr/usbload/main.c</string>
|
||||||
|
<string>avr/usbload/requests.h</string>
|
||||||
|
<string>avr/usbload/fifo.c</string>
|
||||||
|
<string>snes/loadertest/main.c</string>
|
||||||
|
<string>avr/usbload/usb_bulk.c</string>
|
||||||
|
<string>avr/usbload/usb_bulk.h</string>
|
||||||
|
<string>avr/usbload/usbconfig.h</string>
|
||||||
|
<string>avr/usbload/watchdog.c</string>
|
||||||
|
<string>avr/usbload/commandline/opendevice.c</string>
|
||||||
|
<string>avr/usbload/commandline/Makefile</string>
|
||||||
|
<string>avr/usbload/commandline/snesuploader.c</string>
|
||||||
|
<string>avr/usbload/commandline/snesuploader.ll</string>
|
||||||
|
<string>avr/usbload/watchdog.h</string>
|
||||||
|
<string>avr/usbload/loader.c</string>
|
||||||
|
<string>scripts/dev_server.py</string>
|
||||||
|
<string>snes/loader/makefile</string>
|
||||||
|
<string>snes/loader/conv_rle.py</string>
|
||||||
|
<string>avr/usbload/dump.c</string>
|
||||||
|
<string>snes/loader/routines/songs.asm</string>
|
||||||
|
<string>snes/loader/routines/memoryclear.asm</string>
|
||||||
|
<string>snes/loader/main.asm</string>
|
||||||
|
<string>avr/usbload/fifo.h</string>
|
||||||
|
<string>avr/usbload/debug.h</string>
|
||||||
|
<string>avr/usbload/dump.h</string>
|
||||||
|
<string>avr/usbload/commandline/opendevice.h</string>
|
||||||
|
<string>avr/usbload/timer.c</string>
|
||||||
|
<string>avr/usbload/timer.h</string>
|
||||||
|
<string>avr/usbload/uart.c</string>
|
||||||
|
<string>avr/usbload/uart.h</string>
|
||||||
|
<string>avr/usbload/sram.h</string>
|
||||||
|
<string>avr/usbload/config.h</string>
|
||||||
|
<string>avr/usbload/debug.c</string>
|
||||||
|
<string>avr/usbload/Makefile</string>
|
||||||
|
<string>avr/bootloader/bootloader.c</string>
|
||||||
|
<string>avr/bootloader/usbconfig.h</string>
|
||||||
|
<string>avr/bootloader/config.h</string>
|
||||||
|
</array>
|
||||||
<key>showFileHierarchyDrawer</key>
|
<key>showFileHierarchyDrawer</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>showFileHierarchyPanel</key>
|
<key>showFileHierarchyPanel</key>
|
||||||
@@ -66,22 +839,20 @@
|
|||||||
<true/>
|
<true/>
|
||||||
<key>subItems</key>
|
<key>subItems</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>bootloader</key>
|
||||||
|
<dict>
|
||||||
|
<key>isExpanded</key>
|
||||||
|
<true/>
|
||||||
|
<key>subItems</key>
|
||||||
|
<dict/>
|
||||||
|
</dict>
|
||||||
<key>usbload</key>
|
<key>usbload</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>isExpanded</key>
|
<key>isExpanded</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>subItems</key>
|
<key>subItems</key>
|
||||||
<dict/>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
<key>poc</key>
|
|
||||||
<dict>
|
<dict>
|
||||||
<key>isExpanded</key>
|
<key>commandline</key>
|
||||||
<true/>
|
|
||||||
<key>subItems</key>
|
|
||||||
<dict>
|
|
||||||
<key>avr_sdcard</key>
|
|
||||||
<dict>
|
<dict>
|
||||||
<key>isExpanded</key>
|
<key>isExpanded</key>
|
||||||
<true/>
|
<true/>
|
||||||
@@ -90,6 +861,8 @@
|
|||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
<key>scripts</key>
|
<key>scripts</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>isExpanded</key>
|
<key>isExpanded</key>
|
||||||
@@ -102,37 +875,8 @@
|
|||||||
<key>isExpanded</key>
|
<key>isExpanded</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>subItems</key>
|
<key>subItems</key>
|
||||||
<dict/>
|
|
||||||
</dict>
|
|
||||||
<key>tools</key>
|
|
||||||
<dict>
|
<dict>
|
||||||
<key>isExpanded</key>
|
<key>loader</key>
|
||||||
<true/>
|
|
||||||
<key>subItems</key>
|
|
||||||
<dict>
|
|
||||||
<key>ff</key>
|
|
||||||
<dict>
|
|
||||||
<key>isExpanded</key>
|
|
||||||
<true/>
|
|
||||||
<key>subItems</key>
|
|
||||||
<dict/>
|
|
||||||
</dict>
|
|
||||||
<key>ffsample</key>
|
|
||||||
<dict>
|
|
||||||
<key>isExpanded</key>
|
|
||||||
<true/>
|
|
||||||
<key>subItems</key>
|
|
||||||
<dict>
|
|
||||||
<key>avr</key>
|
|
||||||
<dict>
|
|
||||||
<key>isExpanded</key>
|
|
||||||
<true/>
|
|
||||||
<key>subItems</key>
|
|
||||||
<dict/>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
<key>huffman</key>
|
|
||||||
<dict>
|
<dict>
|
||||||
<key>isExpanded</key>
|
<key>isExpanded</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import time
|
|||||||
|
|
||||||
|
|
||||||
LEN = 2**16
|
LEN = 2**16
|
||||||
huffman = False
|
|
||||||
TARGET="/Users/david/Devel/arch/avr/code/quickdev16/avr/usbload"
|
TARGET="/Users/david/Devel/arch/avr/code/quickdev16/avr/usbload"
|
||||||
HUFFMAN_ENCODER="/Users/david/Devel/arch/avr/code/quickdev16/tools/huffman/huffman-encode"
|
HUFFMAN_ENCODER="/Users/david/Devel/arch/avr/code/quickdev16/tools/huffman/huffman-encode"
|
||||||
data = open(sys.argv[1],"r").read()
|
data = open(sys.argv[1],"r").read()
|
||||||
@@ -15,21 +15,19 @@ print "Use %i bytes" % (len(data))
|
|||||||
data = binascii.rlecode_hqx(data)
|
data = binascii.rlecode_hqx(data)
|
||||||
print "RLE crunch (%i) bytes" % (len(data))
|
print "RLE crunch (%i) bytes" % (len(data))
|
||||||
|
|
||||||
|
binfile = open("/tmp/loader.rle","w")
|
||||||
|
binfile.write(data)
|
||||||
|
binfile.close()
|
||||||
rle_size = len(data)
|
rle_size = len(data)
|
||||||
huffman_size = 0
|
|
||||||
|
|
||||||
if huffman == True:
|
cmd = "%s /tmp/loader.rle" % HUFFMAN_ENCODER
|
||||||
binfile = open("/tmp/loader.rle","w")
|
os.system(cmd)
|
||||||
binfile.write(data)
|
data = open("/tmp/loader.rle.hfm","r").read()
|
||||||
binfile.close()
|
print "HUFFMAN crunch (%i) bytes" % (len(data))
|
||||||
|
huffman_size = len(data)
|
||||||
|
|
||||||
cmd = "%s /tmp/loader.rle" % HUFFMAN_ENCODER
|
os.unlink("/tmp/loader.rle")
|
||||||
os.system(cmd)
|
os.unlink("/tmp/loader.rle.hfm")
|
||||||
data = open("/tmp/loader.rle.hfm","r").read()
|
|
||||||
print "HUFFMAN crunch (%i) bytes" % (len(data))
|
|
||||||
huffman_size = len(data)
|
|
||||||
os.unlink("/tmp/loader.rle")
|
|
||||||
os.unlink("/tmp/loader.rle.hfm")
|
|
||||||
|
|
||||||
cfile = open("/tmp/loader.c","w")
|
cfile = open("/tmp/loader.c","w")
|
||||||
hfile = open("/tmp/loader.h","w")
|
hfile = open("/tmp/loader.h","w")
|
||||||
|
|||||||
Reference in New Issue
Block a user