diff options
author | Josh Blum <josh@joshknows.com> | 2010-01-22 11:56:55 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-01-22 11:56:55 -0800 |
commit | 7bf8a6df381a667134b55701993c6770d32bc76b (patch) | |
tree | 4a298fb5450f7277b5aaf5210740ae18f818c9aa /usrp2/opencores/spi_boot/sw/misc | |
parent | 8f2c33eab9396185df259639082b7d1618585973 (diff) | |
download | uhd-7bf8a6df381a667134b55701993c6770d32bc76b.tar.gz uhd-7bf8a6df381a667134b55701993c6770d32bc76b.tar.bz2 uhd-7bf8a6df381a667134b55701993c6770d32bc76b.zip |
Moved usrp2 fpga files into usrp2 subdir.
Diffstat (limited to 'usrp2/opencores/spi_boot/sw/misc')
-rw-r--r-- | usrp2/opencores/spi_boot/sw/misc/CVS/Entries | 2 | ||||
-rw-r--r-- | usrp2/opencores/spi_boot/sw/misc/CVS/Repository | 1 | ||||
-rw-r--r-- | usrp2/opencores/spi_boot/sw/misc/CVS/Root | 1 | ||||
-rw-r--r-- | usrp2/opencores/spi_boot/sw/misc/CVS/Template | 0 | ||||
-rw-r--r-- | usrp2/opencores/spi_boot/sw/misc/bit_reverse.c | 74 |
5 files changed, 78 insertions, 0 deletions
diff --git a/usrp2/opencores/spi_boot/sw/misc/CVS/Entries b/usrp2/opencores/spi_boot/sw/misc/CVS/Entries new file mode 100644 index 000000000..e46425fde --- /dev/null +++ b/usrp2/opencores/spi_boot/sw/misc/CVS/Entries @@ -0,0 +1,2 @@ +/bit_reverse.c/1.1/Sun May 21 11:58:00 2006/-ko/ +D diff --git a/usrp2/opencores/spi_boot/sw/misc/CVS/Repository b/usrp2/opencores/spi_boot/sw/misc/CVS/Repository new file mode 100644 index 000000000..0519f4b59 --- /dev/null +++ b/usrp2/opencores/spi_boot/sw/misc/CVS/Repository @@ -0,0 +1 @@ +spi_boot/sw/misc diff --git a/usrp2/opencores/spi_boot/sw/misc/CVS/Root b/usrp2/opencores/spi_boot/sw/misc/CVS/Root new file mode 100644 index 000000000..44b2aa23b --- /dev/null +++ b/usrp2/opencores/spi_boot/sw/misc/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@cvs.opencores.org:/cvsroot/anonymous diff --git a/usrp2/opencores/spi_boot/sw/misc/CVS/Template b/usrp2/opencores/spi_boot/sw/misc/CVS/Template new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/usrp2/opencores/spi_boot/sw/misc/CVS/Template diff --git a/usrp2/opencores/spi_boot/sw/misc/bit_reverse.c b/usrp2/opencores/spi_boot/sw/misc/bit_reverse.c new file mode 100644 index 000000000..9defb106a --- /dev/null +++ b/usrp2/opencores/spi_boot/sw/misc/bit_reverse.c @@ -0,0 +1,74 @@ +// Altera requires configuration bytes to be sent LSB first but the +// SD Card reads bytes MSB first +// This code reverses the bits of the altera bitstream so +// it will come out correct when read from the SD card +// $Log: bit_reverse.c,v $ +// Revision 1.1 2006/01/06 14:44:17 mbl +// initial version +// + + + +#include "stdio.h" +#include "string.h" + +FILE* fileOut; +FILE* fileIn; + +void outIOerror(char* pfn); +void inIOerror(char* pfn); + +int main(int argc, char* arg[]) +{ + unsigned char input, output; + unsigned char in_mask, out_mask; + int i; + + fileOut = fopen(arg[2],"wb"); + if (fileOut == NULL) + { + outIOerror(arg[2]); + exit(-1); + } + + printf("Opening input file %s\n", arg[1]); + fileIn = fopen(arg[1],"rb"); + if (fileIn == NULL) + { + inIOerror(arg[1]); + exit(-1); + } + + while (!feof(fileIn) && fgets((char*)&input, 2 ,fileIn) != NULL) + { + in_mask = 1; + out_mask = 0x80; + output = 0; + + for ( i=0; i < 8; ++i ) + { + if (input & in_mask) + { + output |= out_mask; + } + out_mask = out_mask >> 1; + in_mask = in_mask << 1; + } + fwrite((void*)&output,sizeof(char),1,fileOut); + } + + fclose(fileIn); + fclose(fileOut); + printf("\n%s has been created\n", arg[2]); + exit(0); +} + +void outIOerror(char *pfn) +{ + printf("I/O Error while writing to file=%s\n",pfn); +} + +void inIOerror(char *pfn) +{ + printf("I/O Error while reading file=%s\n",pfn); +} |