diff options
author | Josh Blum <josh@joshknows.com> | 2010-04-16 09:42:46 +0000 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-04-16 09:42:46 +0000 |
commit | 835cb56ef820a69e1e6e0ccde7c5a0e78ca5ad25 (patch) | |
tree | 4fe48bdaf92311deedfbe1a5e77dd209468a2d7d /fpga/usrp2/opencores/spi_boot/sw | |
parent | f1838b9284a124fcfb5996eaf1647a69b4473278 (diff) | |
parent | 067491b58676cbdaa754334949a8ffc2daf32979 (diff) | |
download | uhd-835cb56ef820a69e1e6e0ccde7c5a0e78ca5ad25.tar.gz uhd-835cb56ef820a69e1e6e0ccde7c5a0e78ca5ad25.tar.bz2 uhd-835cb56ef820a69e1e6e0ccde7c5a0e78ca5ad25.zip |
Merge branch 'master' of git@ettus.sourcerepo.com:ettus/uhdpriv into usrp_e
Conflicts:
.gitignore
Diffstat (limited to 'fpga/usrp2/opencores/spi_boot/sw')
-rw-r--r-- | fpga/usrp2/opencores/spi_boot/sw/CVS/Entries | 1 | ||||
-rw-r--r-- | fpga/usrp2/opencores/spi_boot/sw/CVS/Repository | 1 | ||||
-rw-r--r-- | fpga/usrp2/opencores/spi_boot/sw/CVS/Root | 1 | ||||
-rw-r--r-- | fpga/usrp2/opencores/spi_boot/sw/CVS/Template | 0 | ||||
-rw-r--r-- | fpga/usrp2/opencores/spi_boot/sw/misc/CVS/Entries | 2 | ||||
-rw-r--r-- | fpga/usrp2/opencores/spi_boot/sw/misc/CVS/Repository | 1 | ||||
-rw-r--r-- | fpga/usrp2/opencores/spi_boot/sw/misc/CVS/Root | 1 | ||||
-rw-r--r-- | fpga/usrp2/opencores/spi_boot/sw/misc/CVS/Template | 0 | ||||
-rw-r--r-- | fpga/usrp2/opencores/spi_boot/sw/misc/bit_reverse.c | 74 |
9 files changed, 81 insertions, 0 deletions
diff --git a/fpga/usrp2/opencores/spi_boot/sw/CVS/Entries b/fpga/usrp2/opencores/spi_boot/sw/CVS/Entries new file mode 100644 index 000000000..0f2bd88d4 --- /dev/null +++ b/fpga/usrp2/opencores/spi_boot/sw/CVS/Entries @@ -0,0 +1 @@ +D/misc//// diff --git a/fpga/usrp2/opencores/spi_boot/sw/CVS/Repository b/fpga/usrp2/opencores/spi_boot/sw/CVS/Repository new file mode 100644 index 000000000..98d181ecb --- /dev/null +++ b/fpga/usrp2/opencores/spi_boot/sw/CVS/Repository @@ -0,0 +1 @@ +spi_boot/sw diff --git a/fpga/usrp2/opencores/spi_boot/sw/CVS/Root b/fpga/usrp2/opencores/spi_boot/sw/CVS/Root new file mode 100644 index 000000000..44b2aa23b --- /dev/null +++ b/fpga/usrp2/opencores/spi_boot/sw/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@cvs.opencores.org:/cvsroot/anonymous diff --git a/fpga/usrp2/opencores/spi_boot/sw/CVS/Template b/fpga/usrp2/opencores/spi_boot/sw/CVS/Template new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/fpga/usrp2/opencores/spi_boot/sw/CVS/Template diff --git a/fpga/usrp2/opencores/spi_boot/sw/misc/CVS/Entries b/fpga/usrp2/opencores/spi_boot/sw/misc/CVS/Entries new file mode 100644 index 000000000..e46425fde --- /dev/null +++ b/fpga/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/fpga/usrp2/opencores/spi_boot/sw/misc/CVS/Repository b/fpga/usrp2/opencores/spi_boot/sw/misc/CVS/Repository new file mode 100644 index 000000000..0519f4b59 --- /dev/null +++ b/fpga/usrp2/opencores/spi_boot/sw/misc/CVS/Repository @@ -0,0 +1 @@ +spi_boot/sw/misc diff --git a/fpga/usrp2/opencores/spi_boot/sw/misc/CVS/Root b/fpga/usrp2/opencores/spi_boot/sw/misc/CVS/Root new file mode 100644 index 000000000..44b2aa23b --- /dev/null +++ b/fpga/usrp2/opencores/spi_boot/sw/misc/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@cvs.opencores.org:/cvsroot/anonymous diff --git a/fpga/usrp2/opencores/spi_boot/sw/misc/CVS/Template b/fpga/usrp2/opencores/spi_boot/sw/misc/CVS/Template new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/fpga/usrp2/opencores/spi_boot/sw/misc/CVS/Template diff --git a/fpga/usrp2/opencores/spi_boot/sw/misc/bit_reverse.c b/fpga/usrp2/opencores/spi_boot/sw/misc/bit_reverse.c new file mode 100644 index 000000000..9defb106a --- /dev/null +++ b/fpga/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); +} |