o cleanup

This commit is contained in:
optixx
2009-09-23 15:58:13 +02:00
parent 1bbc73c363
commit 3f91df1af6
632 changed files with 0 additions and 266690 deletions

View File

@@ -0,0 +1,24 @@
include ../../conf/config.makefile
#BASE=c:\efsl\efsl-0.3
#INC=-I$(BASE)\src\base\include -I $(BASE)\src\include -I $(BASE)\src\fs\vfat\include -I $(BASE)\src\hwdrivers\atmega_spi\include -I $(BASE)\src\protocols\sdcard_spi\include -I$(BASE)\conf
BASE=../../
INC=-I$(BASE)/src/base/include -I $(BASE)/src/include -I $(BASE)/src/fs/vfat/include -I $(BASE)/src/hwdrivers/atmega_spi/include -I $(BASE)/src/protocols/sdcard_spi/include -I$(BASE)/conf
LIBS= -L $(BASE)\lib -lefsl-base -lefsl-fs-vfat -lefsl-hwd-atmega_spi -lefsl-prot-sdspi
avrtest: lib
$(CC) $(GCFLAGS) $(INC) -o avrtest.o avrtest.c $(LIBS)
$(OBJCOPY) -j .text -j .data -O ihex avrtest.o avrtest.hex
flash: avrtest
avrdude -P /dev/ttyS0 -c stk500v2 -pm128 -Uflash:w:avrtest.hex
debug: avrtest
avarice -j /dev/ttyS0 -e -p -f avrtest.o -D :4242
avr-gdb avrtest.o
lib:
make -C $(BASE) avr
clean:
make -C $(BASE) clean
rm -rf *.hex *.o

95
packages/efsl-0.3.6/examples/avr/avrtest.c vendored Executable file
View File

@@ -0,0 +1,95 @@
/*****************************************************************************/
#include <efs.h>
#include <sd.h>
#include <atmega_spi.h>
/*****************************************************************************/
/*****************************************************************************/
void hang(void);
/*****************************************************************************/
void main(void)
{
efsl_storage_conf storage_conf;
efsl_fs_conf fs_conf;
efsl_storage storage;
efsl_fs fs;
File file_r;
File file_w;
atmegaSpiInterface spi_interface;
SdSpiProtocol sd_protocol;
char buf[512];
unsigned short e;
/* Init */
debug_init();
spi_interface.pinSelect=0x01;
sd_protocol.spiHwInterface=&spi_interface;
sd_protocol.spiHwInit=(void *)atmega_spi_init;
sd_protocol.spiSendByte=(void *)atmega_spi_send;
storage_conf.hwObject=&sd_protocol;
storage_conf.if_init_fptr=(void *)sd_Init;
storage_conf.if_read_fptr=(void *)sd_readSector;
storage_conf.if_write_fptr=(void *)sd_writeSector;
storage_conf.if_ioctl_fptr=(void *)sd_ioctl;
storage_conf.ioman_bufmem=0;
fs_conf.no_partitions=0;
fs_conf.storage=&storage;
DBG((TXT("Let's go...\n")));
if(efsl_initStorage(&storage,&storage_conf)){
DBG((TXT("Error initializing storage: %d")));
hang();
}
if(efsl_initFs(&fs,&fs_conf)){
DBG((TXT("Unable to mount fs")));
hang();
}
if(file_fopen(&file_r,&fs.filesystem,"orig.txt",'r')!=0){
DBG((TXT("Could not open file for reading\n")));
hang();
}
DBG((TXT("File opened for reading\n")));
if(file_fopen(&file_w,&fs.filesystem,"copy.txt",'w')!=0){
DBG((TXT("Could not open file for writing\n")));
hang();
}
DBG((TXT("File opened for writing\n")));
while((e=file_read(&file_r,512,buf))){
DBG((TXT("Read sector\n")));
file_write(&file_w,e,buf);
DBG((TXT("Wrote sector\n")));
}
DBG((TXT("Done writing, now umount\n")));
file_fclose(&file_r);
file_fclose(&file_w);
fs_umount(&fs.filesystem);
DBG((TXT("Done :-)")));
hang();
}
/*****************************************************************************/
void hang(void)
{
while((1))
_NOP();
}
/*****************************************************************************/

View File

@@ -0,0 +1 @@
avr-gcc -I../../src/base/include/ -I ../../src/include/ -I ../../src/fs/vfat/include/ -I ../../src/hwdrivers/atmega_spi/include/ -I ../../src/protocols/sdcard_spi/include/ -I../../conf -ffreestanding -mmcu=atmega128 -Os -o avrtest.o avrtest.c -L ../../lib/ -lefsl-base -lefsl-fs-vfat -lefsl-hwd-atmega_spi -lefsl-prot-sdspi && avr-objcopy -j .text -j .data -O ihex avrtest.o avrtest.hex && avrdude -P /dev/ttyS0 -c stk500v2 -pm128 -Uflash:w:avrtest.hex

83
packages/efsl-0.3.6/examples/avr/dumpfile.c vendored Executable file
View File

@@ -0,0 +1,83 @@
/*****************************************************************************/
#include <efs.h>
#include <sd.h>
#include <atmega_spi.h>
/*****************************************************************************/
/*****************************************************************************/
void hang(void);
/*****************************************************************************/
void main(void)
{
efsl_storage_conf storage_conf;
efsl_fs_conf fs_conf;
efsl_storage storage;
efsl_fs fs;
File file_r;
atmegaSpiInterface spi_interface;
SdSpiProtocol sd_protocol;
char buf[512];
unsigned short i,e;
debug_init();
DBG((TXT("\nHello :-)\n")));
/* Init */
spi_interface.pinSelect=0x01;
sd_protocol.spiHwInterface=&spi_interface;
sd_protocol.spiHwInit=(void *)atmega_spi_init;
sd_protocol.spiSendByte=(void *)atmega_spi_send;
storage_conf.hwObject=&sd_protocol;
storage_conf.if_init_fptr=(void *)sd_Init;
storage_conf.if_read_fptr=(void *)sd_readSector;
storage_conf.if_write_fptr=(void *)sd_writeSector;
storage_conf.if_ioctl_fptr=(void *)sd_ioctl;
storage_conf.ioman_bufmem=0;
fs_conf.no_partitions=0;
fs_conf.storage=&storage;
DBG((TXT("Let's go...\n")));
if(efsl_initStorage(&storage,&storage_conf)){
DBG((TXT("Error initializing storage: %d")));
hang();
}
if(efsl_initFs(&fs,&fs_conf)){
DBG((TXT("Unable to mount fs")));
hang();
}
if(file_fopen(&file_r,&fs.filesystem,"orig.txt",'r')!=0){
DBG((TXT("Could not open file\n")));
hang();
}
DBG((TXT("File opened")));
while((e=file_read(&file_r,512,buf))){
for(i=0;i<e;i++){
DBG((TXT("%c"),buf[i]));
}
}
DBG((TXT("Done :-)")));
hang();
}
/*****************************************************************************/
void hang(void)
{
while((1))
_NOP();
}
/*****************************************************************************/