[sky9x] Revert to last version where massstorage was ok for all SDs!

[stock] Flash saving
[stock] Voice mod port from er9x
This commit is contained in:
bsongis
2012-09-19 22:15:20 +00:00
parent 9a7976cf6e
commit 3a9c375908
286 changed files with 79393 additions and 7903 deletions
@@ -0,0 +1,72 @@
/* based on LPC213x.h from Keil GmbH (keil.com/arm.com) */
#ifndef LPC2000_regs_h
#define LPC2000_regs_h
/* Pin Connect Block */
#define PINSEL0 (*((volatile unsigned long *) 0xE002C000))
#define PINSEL1 (*((volatile unsigned long *) 0xE002C004))
#define PINSEL2 (*((volatile unsigned long *) 0xE002C014))
/* General Purpose Input/Output (GPIO) */
#define IOPIN0 (*((volatile unsigned long *) 0xE0028000))
#define IOSET0 (*((volatile unsigned long *) 0xE0028004))
#define IODIR0 (*((volatile unsigned long *) 0xE0028008))
#define IOCLR0 (*((volatile unsigned long *) 0xE002800C))
#define IOPIN1 (*((volatile unsigned long *) 0xE0028010))
#define IOSET1 (*((volatile unsigned long *) 0xE0028014))
#define IODIR1 (*((volatile unsigned long *) 0xE0028018))
#define IOCLR1 (*((volatile unsigned long *) 0xE002801C))
/* SPI0 (Serial Peripheral Interface 0) */
#define S0SPCR (*((volatile unsigned char *) 0xE0020000))
#define S0SPSR (*((volatile unsigned char *) 0xE0020004))
#define S0SPDR (*((volatile unsigned char *) 0xE0020008))
#define S0SPCCR (*((volatile unsigned char *) 0xE002000C))
#define S0SPTCR (*((volatile unsigned char *) 0xE0020010))
#define S0SPTSR (*((volatile unsigned char *) 0xE0020014))
#define S0SPTOR (*((volatile unsigned char *) 0xE0020018))
#define S0SPINT (*((volatile unsigned char *) 0xE002001C))
/* SSP Controller */
#define SSPCR0 (*((volatile unsigned short* ) 0xE0068000))
#define SSPCR1 (*((volatile unsigned char * ) 0xE0068004))
#define SSPDR (*((volatile unsigned short* ) 0xE0068008))
#define SSPSR (*((volatile unsigned char * ) 0xE006800C))
#define SSPCPSR (*((volatile unsigned char * ) 0xE0068010))
#define SSPIMSC (*((volatile unsigned char * ) 0xE0068014))
#define SSPRIS (*((volatile unsigned char * ) 0xE0068018))
#define SSPMIS (*((volatile unsigned char * ) 0xE006801C))
#define SSPICR (*((volatile unsigned char * ) 0xE0068020))
#define SSPDMACR (*((volatile unsigned char * ) 0xE0068024))
/* Real Time Clock */
/* maybe useful for the efsl time-handling : */
#define ILR (*((volatile unsigned char *) 0xE0024000))
#define CTC (*((volatile unsigned short*) 0xE0024004))
#define CCR (*((volatile unsigned char *) 0xE0024008))
#define CIIR (*((volatile unsigned char *) 0xE002400C))
#define AMR (*((volatile unsigned char *) 0xE0024010))
#define CTIME0 (*((volatile unsigned long *) 0xE0024014))
#define CTIME1 (*((volatile unsigned long *) 0xE0024018))
#define CTIME2 (*((volatile unsigned long *) 0xE002401C))
#define SEC (*((volatile unsigned char *) 0xE0024020))
#define MIN (*((volatile unsigned char *) 0xE0024024))
#define HOUR (*((volatile unsigned char *) 0xE0024028))
#define DOM (*((volatile unsigned char *) 0xE002402C))
#define DOW (*((volatile unsigned char *) 0xE0024030))
#define DOY (*((volatile unsigned short*) 0xE0024034))
#define MONTH (*((volatile unsigned char *) 0xE0024038))
#define YEAR (*((volatile unsigned short*) 0xE002403C))
#define ALSEC (*((volatile unsigned char *) 0xE0024060))
#define ALMIN (*((volatile unsigned char *) 0xE0024064))
#define ALHOUR (*((volatile unsigned char *) 0xE0024068))
#define ALDOM (*((volatile unsigned char *) 0xE002406C))
#define ALDOW (*((volatile unsigned char *) 0xE0024070))
#define ALDOY (*((volatile unsigned short*) 0xE0024074))
#define ALMON (*((volatile unsigned char *) 0xE0024078))
#define ALYEAR (*((volatile unsigned short*) 0xE002407C))
#define PREINT (*((volatile unsigned short*) 0xE0024080))
#define PREFRAC (*((volatile unsigned short*) 0xE0024084))
#endif
@@ -0,0 +1,63 @@
/*****************************************************************************\
* efs - General purpose Embedded Filesystem library *
* --------------------- ----------------------------------- *
* *
* Filename : at91sam7s_spi.h *
* Description : Headerfile for at91sam7s_spi.c *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; version 2 *
* of the License. *
*
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* As a special exception, if other files instantiate templates or *
* use macros or inline functions from this file, or you compile this *
* file and link it with other works to produce a work based on this file, *
* this file does not by itself cause the resulting work to be covered *
* by the GNU General Public License. However the source code for this *
* file must still be made available in accordance with section (3) of *
* the GNU General Public License. *
* *
* This exception does not invalidate any other reasons why a work based *
* on this file might be covered by the GNU General Public License. *
* *
* AT91SAM7S ARM7 Interface (c)2007 Stanimir Bonev *
\*****************************************************************************/
#ifndef __AT91SAM7S_SPI_H_
#define __AT91SAM7S_SPI_H_
#ifndef FALSE
#define FALSE 0x00
#define TRUE 0x01
#endif
#include "../debug.h"
#include "config.h"
/*************************************************************\
hwInterface
----------
* FILE* imagefile File emulation of hw interface.
* long sectorCount Number of sectors on the file.
\*************************************************************/
struct hwInterface{
//FILE *imageFile;
eint32 sectorCount;
};
typedef struct hwInterface hwInterface;
esint8 if_initInterface(hwInterface* file,eint8* opts);
esint8 if_readBuf(hwInterface* file,euint32 address,euint8* buf);
esint8 if_writeBuf(hwInterface* file,euint32 address,euint8* buf);
esint8 if_setPos(hwInterface* file,euint32 address);
#endif // __AT91SAM7S_SPI_H_
@@ -0,0 +1,64 @@
/*****************************************************************************\
* efs - General purpose Embedded Filesystem library *
* --------------------- ----------------------------------- *
* *
* Filename : at91sam_ramdisk.h *
* Description : Headerfile for at91sam xxx.c *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; version 2 *
* of the License. *
*
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* As a special exception, if other files instantiate templates or *
* use macros or inline functions from this file, or you compile this *
* file and link it with other works to produce a work based on this file, *
* this file does not by itself cause the resulting work to be covered *
* by the GNU General Public License. However the source code for this *
* file must still be made available in accordance with section (3) of *
* the GNU General Public License. *
* *
* This exception does not invalidate any other reasons why a work based *
* on this file might be covered by the GNU General Public License. *
* *
* AT91SAM7S ARM7 Interface (c)2007 Stanimir Bonev *
\*****************************************************************************/
#ifndef __AT91SAM_RAMDISK_H_
#define __AT91SAM_RAMDISK_H_
#ifndef FALSE
#define FALSE 0x00
#define TRUE 0x01
#endif
#include "../debug.h"
#include "config.h"
#include "Media.h"
/*************************************************************\
hwInterface
----------
* Media* pMedia Pointer to emulation of Media interface.
* long sectorCount Number of sectors on the file.
\*************************************************************/
struct hwInterface{
Media* pMedia;
eint32 sectorCount;
};
typedef struct hwInterface hwInterface;
esint8 if_initInterface(hwInterface* file,eint8* opts);
esint8 if_readBuf(hwInterface* file,euint32 address,euint8* buf);
esint8 if_writeBuf(hwInterface* file,euint32 address,euint8* buf);
esint8 if_setPos(hwInterface* file,euint32 address);
#endif // __AT91SAM_RAMDISK_H_
@@ -0,0 +1,70 @@
/*****************************************************************************\
* efs - General purpose Embedded Filesystem library *
* --------------------- ----------------------------------- *
* *
* Filename : atmega128.h *
* Description : Headerfile for atmega128.c *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; version 2 *
* of the License. *
*
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* As a special exception, if other files instantiate templates or *
* use macros or inline functions from this file, or you compile this *
* file and link it with other works to produce a work based on this file, *
* this file does not by itself cause the resulting work to be covered *
* by the GNU General Public License. However the source code for this *
* file must still be made available in accordance with section (3) of *
* the GNU General Public License. *
* *
* This exception does not invalidate any other reasons why a work based *
* on this file might be covered by the GNU General Public License. *
* *
* (c)2006 Lennart Yseboodt *
* (c)2006 Michael De Nil *
\*****************************************************************************/
#ifndef __ATMEGA128_SD_H_
#define __ATMEGA128_SD_H_
#define __AVR_ATmega128__ 1
#define FALSE 0X00
#define TRUE 0x01
#define DDR_SPI DDRB
#define DD_MOSI DDB2
#define DD_SCK DDB1
#include <avr/io.h>
#include <compat/ina90.h>
#include "../debug.h"
#include "config.h"
/*************************************************************\
hwInterface
----------
* FILE* imagefile File emulation of hw interface.
* long sectorCount Number of sectors on the file.
\*************************************************************/
struct hwInterface{
/*FILE *imageFile;*/
eint32 sectorCount;
};
typedef struct hwInterface hwInterface;
esint8 if_initInterface(hwInterface* file,eint8* opts);
esint8 if_readBuf(hwInterface* file,euint32 address,euint8* buf);
esint8 if_writeBuf(hwInterface* file,euint32 address,euint8* buf);
esint8 if_setPos(hwInterface* file,euint32 address);
void if_spiInit(hwInterface *iface);
euint8 if_spiSend(hwInterface *iface, euint8 outgoing);
#endif
@@ -0,0 +1,61 @@
/*****************************************************************************\
* efs - General purpose Embedded Filesystem library *
* --------------------- ----------------------------------- *
* *
* Filename : dsp67xx.h *
* Revision : Initial developement *
* Description : Headerfile for dsp67xx.h *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; version 2 *
* of the License. *
*
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* As a special exception, if other files instantiate templates or *
* use macros or inline functions from this file, or you compile this *
* file and link it with other works to produce a work based on this file, *
* this file does not by itself cause the resulting work to be covered *
* by the GNU General Public License. However the source code for this *
* file must still be made available in accordance with section (3) of *
* the GNU General Public License. *
* *
* This exception does not invalidate any other reasons why a work based *
* on this file might be covered by the GNU General Public License. *
* *
* (c)2006 Lennart Yseboodt *
* (c)2006 Michael De Nil *
\*****************************************************************************/
#ifndef __DSP67XX_H_
#define __DSP67XX_H_
#include "config.h"
#include "mcbsp/mcbsp.h"
/*************************************************************\
hwInterface
----------
* FILE* imagefile File emulation of hw interface.
* long sectorCount Number of sectors on the file.
\*************************************************************/
struct hwInterface{
/*FILE *imageFile;*/
long sectorCount;
BspPort *port;
};
typedef struct hwInterface hwInterface;
short if_initInterface(hwInterface* file,char* opts);
short if_readBuf(hwInterface* file,euint32 address,unsigned char* buf);
short if_writeBuf(hwInterface* file,unsigned long address,unsigned char* buf);
short if_setPos(hwInterface* file,unsigned long address);
signed char if_spiInit(hwInterface *iface);
unsigned char if_spiSend(hwInterface *iface,euint8 outgoing);
#endif
@@ -0,0 +1,49 @@
/*****************************************************************************\
* efs - General purpose Embedded Filesystem library *
* --------------------- ----------------------------------- *
* *
* Filename : helper.h *
* Description : Headerfile for helper.c *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; version 2 *
* of the License. *
*
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* As a special exception, if other files instantiate templates or *
* use macros or inline functions from this file, or you compile this *
* file and link it with other works to produce a work based on this file, *
* this file does not by itself cause the resulting work to be covered *
* by the GNU General Public License. However the source code for this *
* file must still be made available in accordance with section (3) of *
* the GNU General Public License. *
* *
* This exception does not invalidate any other reasons why a work based *
* on this file might be covered by the GNU General Public License. *
* *
* (c)2006 Lennart Yseboodt *
* (c)2006 Michael De Nil *
\*****************************************************************************/
#ifndef __HELPER_H__
#define __HELPER_H__
/*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include "../debug.h"
#include "../types.h"
#include "config.h"
/*****************************************************************************/
void* Malloc(eint32 size);
void Fopen(FILE **f,eint8* filename);
void MMap(eint8* filename,void**x,eint32* size);
int getFileSize(FILE* file);
#endif
@@ -0,0 +1,67 @@
/*****************************************************************************\
* efs - General purpose Embedded Filesystem library *
* --------------------------------------------------------- *
* *
* Filename : linuxfile.h *
* Description : Headerfile for linuxfile.c *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; version 2 *
* of the License. *
*
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* As a special exception, if other files instantiate templates or *
* use macros or inline functions from this file, or you compile this *
* file and link it with other works to produce a work based on this file, *
* this file does not by itself cause the resulting work to be covered *
* by the GNU General Public License. However the source code for this *
* file must still be made available in accordance with section (3) of *
* the GNU General Public License. *
* *
* This exception does not invalidate any other reasons why a work based *
* on this file might be covered by the GNU General Public License. *
* *
* (c)2006 Lennart Yseboodt *
* (c)2006 Michael De Nil *
\*****************************************************************************/
#ifndef __LINUXFILE_H__
#define __LINUXFILE_H__
/*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include "helper.h"
#include "../debug.h"
#include "../types.h"
#include "config.h"
/*****************************************************************************/
#define _LARGEFILE_SOURCE
#define _GNU_SOURCE
#define _FILE_OFFSET_BITS 64
/*************************************************************\
hwInterface
----------
* FILE* imagefile File emulation of hw interface.
* long sectorCount Number of sectors on the file.
\*************************************************************/
struct hwInterface{
FILE *imageFile;
eint32 sectorCount;
euint32 readCount,writeCount;
};
typedef struct hwInterface hwInterface;
esint8 if_initInterface(hwInterface* file,eint8* fileName);
esint8 if_readBuf(hwInterface* file,euint32 address,euint8* buf);
esint8 if_writeBuf(hwInterface* file,euint32 address,euint8* buf);
esint8 if_setPos(hwInterface* file,euint32 address);
#endif
@@ -0,0 +1,7 @@
#ifndef lpc2000_debug_printf_h_
#define lpc2000_debug_printf_h_
extern void lpc2000_debug_devopen( int(*put)(int) );
extern void lpc2000_debug_printf(char const *format, ...);
#endif
@@ -0,0 +1,65 @@
/*****************************************************************************\
* efs - General purpose Embedded Filesystem library *
* --------------------- ----------------------------------- *
* *
* Filename : lpc2000_spi.h *
* Description : Headerfile for lpc2000_spi.c *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; version 2 *
* of the License. *
*
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* As a special exception, if other files instantiate templates or *
* use macros or inline functions from this file, or you compile this *
* file and link it with other works to produce a work based on this file, *
* this file does not by itself cause the resulting work to be covered *
* by the GNU General Public License. However the source code for this *
* file must still be made available in accordance with section (3) of *
* the GNU General Public License. *
* *
* This exception does not invalidate any other reasons why a work based *
* on this file might be covered by the GNU General Public License. *
* *
* LPC2000 ARM7 Interface (c)2005 Martin Thomas *
\*****************************************************************************/
#ifndef __LPC2000_SPI_H_
#define __LPC2000_SPI_H_
#ifndef FALSE
#define FALSE 0x00
#define TRUE 0x01
#endif
#include "../debug.h"
#include "config.h"
/*************************************************************\
hwInterface
----------
* FILE* imagefile File emulation of hw interface.
* long sectorCount Number of sectors on the file.
\*************************************************************/
struct hwInterface{
/*FILE *imageFile;*/
eint32 sectorCount;
};
typedef struct hwInterface hwInterface;
esint8 if_initInterface(hwInterface* file,eint8* opts);
esint8 if_readBuf(hwInterface* file,euint32 address,euint8* buf);
esint8 if_writeBuf(hwInterface* file,euint32 address,euint8* buf);
esint8 if_setPos(hwInterface* file,euint32 address);
void if_spiInit(hwInterface *iface);
void if_spiSetSpeed(euint8 speed);
euint8 if_spiSend(hwInterface *iface, euint8 outgoing);
#endif
@@ -0,0 +1,62 @@
/*****************************************************************************\
* efs - General purpose Embedded Filesystem library *
* --------------------- ----------------------------------- *
* *
* Filename : nios2.h *
* Description : Headerfile for nios2.c *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; version 2 *
* of the License. *
*
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* As a special exception, if other files instantiate templates or *
* use macros or inline functions from this file, or you compile this *
* file and link it with other works to produce a work based on this file, *
* this file does not by itself cause the resulting work to be covered *
* by the GNU General Public License. However the source code for this *
* file must still be made available in accordance with section (3) of *
* the GNU General Public License. *
* *
* This exception does not invalidate any other reasons why a work based *
* on this file might be covered by the GNU General Public License. *
* *
* (c)2005 Marcio Troccoli *
\*****************************************************************************/
#ifndef __NIOS_2_SD_H_
#define __NIOS_2_SD_H_
#define FALSE 0X00
#define TRUE 0x01
#include "../debug.h"
#include "config.h"
/*************************************************************\
hwInterface
----------
* FILE* imagefile File emulation of hw interface.
* long sectorCount Number of sectors on the file.
\*************************************************************/
struct hwInterface{
/*FILE *imageFile;*/
eint32 sectorCount;
};
typedef struct hwInterface hwInterface;
esint8 if_initInterface(hwInterface* file,eint8* opts);
esint8 if_readBuf(hwInterface* file,euint32 address,euint8* buf);
esint8 if_writeBuf(hwInterface* file,euint32 address,euint8* buf);
esint8 if_setPos(hwInterface* file,euint32 address);
void if_spiInit(hwInterface *iface);
euint8 if_spiSend(hwInterface *iface, euint8 outgoing);
#endif
@@ -0,0 +1,66 @@
/*****************************************************************************\
* efs - General purpose Embedded Filesystem library *
* --------------------------------------------------------- *
* *
* Filename : sd.h *
* Revision : Initial developement *
* Description : Headerfile for sd.c *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; version 2 *
* of the License. *
*
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* As a special exception, if other files instantiate templates or *
* use macros or inline functions from this file, or you compile this *
* file and link it with other works to produce a work based on this file, *
* this file does not by itself cause the resulting work to be covered *
* by the GNU General Public License. However the source code for this *
* file must still be made available in accordance with section (3) of *
* the GNU General Public License. *
* *
* This exception does not invalidate any other reasons why a work based *
* on this file might be covered by the GNU General Public License. *
* *
* (c)2006 Lennart Yseboodt *
* (c)2006 Michael De Nil *
\*****************************************************************************/
#ifndef __SD_H_
#define __SD_H_
#include "config.h"
#include "types.h"
#include "../debug.h"
#ifdef HW_ENDPOINT_ATMEGA128_SD
#include "interfaces/atmega128.h"
#endif
#ifdef HW_ENDPOINT_DSP_TI6713_SD
#include "interfaces/dsp67xx.h"
#endif
#ifdef HW_ENDPOINT_LPC2000_SD
#include "interfaces/lpc2000_spi.h"
#endif
#define CMDREAD 17
#define CMDWRITE 24
#define CMDREADCSD 9
esint8 sd_Init(hwInterface *iface);
void sd_Command(hwInterface *iface,euint8 cmd, euint16 paramx, euint16 paramy);
euint8 sd_Resp8b(hwInterface *iface);
void sd_Resp8bError(hwInterface *iface,euint8 value);
euint16 sd_Resp16b(hwInterface *iface);
esint8 sd_State(hwInterface *iface);
esint8 sd_readSector(hwInterface *iface,euint32 address,euint8* buf, euint16 len);
esint8 sd_writeSector(hwInterface *iface,euint32 address, euint8* buf);
esint8 sd_getDriveSize(hwInterface *iface, euint32* drive_size );
#endif