esd/common/fpga.c: fix indentation.

Signed-off-by: Wolfgang Denk <wd@denx.de>
This commit is contained in:
Wolfgang Denk 2008-03-09 10:50:41 +01:00
parent cc3843e364
commit 2b3e7e61d6

View file

@ -97,6 +97,7 @@ static int fpga_boot(const unsigned char *fpgadata, int size)
int i, index, len;
int count;
unsigned char b;
#ifdef CFG_FPGA_SPARTAN2
int j;
#else
@ -105,8 +106,7 @@ static int fpga_boot(const unsigned char *fpgadata, int size)
/* display infos on fpgaimage */
index = 15;
for (i=0; i<4; i++)
{
for (i = 0; i < 4; i++) {
len = fpgadata[index];
DBG ("FPGA: %s\n", &(fpgadata[index + 1]));
index += len + 3;
@ -114,19 +114,19 @@ static int fpga_boot(const unsigned char *fpgadata, int size)
#ifdef CFG_FPGA_SPARTAN2
/* search for preamble 0xFFFFFFFF */
while (1)
{
if ((fpgadata[index] == 0xff) && (fpgadata[index+1] == 0xff) &&
(fpgadata[index+2] == 0xff) && (fpgadata[index+3] == 0xff))
while (1) {
if ((fpgadata[index] == 0xff) && (fpgadata[index + 1] == 0xff)
&& (fpgadata[index + 2] == 0xff)
&& (fpgadata[index + 3] == 0xff))
break; /* preamble found */
else
index++;
}
#else
/* search for preamble 0xFF2X */
for (index = 0; index < size-1 ; index++)
{
if ((fpgadata[index] == 0xff) && ((fpgadata[index+1] & 0xf0) == 0x30))
for (index = 0; index < size - 1; index++) {
if ((fpgadata[index] == 0xff)
&& ((fpgadata[index + 1] & 0xf0) == 0x30))
break;
}
index += 2;
@ -154,12 +154,10 @@ static int fpga_boot(const unsigned char *fpgadata, int size)
/* Wait for FPGA init line low */
count = 0;
while (FPGA_INIT_STATE)
{
while (FPGA_INIT_STATE) {
udelay (1000); /* wait 1ms */
/* Check for timeout - 100us max, so use 3ms */
if (count++ > 3)
{
if (count++ > 3) {
DBG ("FPGA: Booting failed!\n");
return ERROR_FPGA_PRG_INIT_LOW;
}
@ -173,12 +171,10 @@ static int fpga_boot(const unsigned char *fpgadata, int size)
/* Wait for FPGA end of init period . */
count = 0;
while (!(FPGA_INIT_STATE))
{
while (!(FPGA_INIT_STATE)) {
udelay (1000); /* wait 1ms */
/* Check for timeout */
if (count++ > 3)
{
if (count++ > 3) {
DBG ("FPGA: Booting failed!\n");
return ERROR_FPGA_PRG_INIT_HIGH;
}
@ -194,17 +190,12 @@ static int fpga_boot(const unsigned char *fpgadata, int size)
/*
* Load uncompressed image into fpga
*/
for (i=index; i<size; i++)
{
for (i = index; i < size; i++) {
b = fpgadata[i];
for (j=0; j<8; j++)
{
if ((b & 0x80) == 0x80)
{
for (j = 0; j < 8; j++) {
if ((b & 0x80) == 0x80) {
FPGA_WRITE_1;
}
else
{
} else {
FPGA_WRITE_0;
}
b <<= 1;
@ -212,10 +203,22 @@ static int fpga_boot(const unsigned char *fpgadata, int size)
}
#else
/* send 0xff 0x20 */
FPGA_WRITE_1; FPGA_WRITE_1; FPGA_WRITE_1; FPGA_WRITE_1;
FPGA_WRITE_1; FPGA_WRITE_1; FPGA_WRITE_1; FPGA_WRITE_1;
FPGA_WRITE_0; FPGA_WRITE_0; FPGA_WRITE_1; FPGA_WRITE_0;
FPGA_WRITE_0; FPGA_WRITE_0; FPGA_WRITE_0; FPGA_WRITE_0;
FPGA_WRITE_1;
FPGA_WRITE_1;
FPGA_WRITE_1;
FPGA_WRITE_1;
FPGA_WRITE_1;
FPGA_WRITE_1;
FPGA_WRITE_1;
FPGA_WRITE_1;
FPGA_WRITE_0;
FPGA_WRITE_0;
FPGA_WRITE_1;
FPGA_WRITE_0;
FPGA_WRITE_0;
FPGA_WRITE_0;
FPGA_WRITE_0;
FPGA_WRITE_0;
/*
** Bit_DeCompression
@ -225,34 +228,23 @@ static int fpga_boot(const unsigned char *fpgadata, int size)
** 255 : '1'
*/
for (i=index; i<size; i++)
{
for (i = index; i < size; i++) {
b = fpgadata[i];
if ((b >= 1) && (b <= MAX_ONES))
{
for(bit=0; bit<b; bit++)
{
if ((b >= 1) && (b <= MAX_ONES)) {
for (bit = 0; bit < b; bit++) {
FPGA_WRITE_1;
}
FPGA_WRITE_0;
}
else if (b == (MAX_ONES+1))
{
for(bit=1; bit<b; bit++)
{
} else if (b == (MAX_ONES + 1)) {
for (bit = 1; bit < b; bit++) {
FPGA_WRITE_1;
}
}
else if ((b >= (MAX_ONES+2)) && (b <= 254))
{
for(bit=0; bit<(b-(MAX_ONES+2)); bit++)
{
} else if ((b >= (MAX_ONES + 2)) && (b <= 254)) {
for (bit = 0; bit < (b - (MAX_ONES + 2)); bit++) {
FPGA_WRITE_0;
}
FPGA_WRITE_1;
}
else if (b == 255)
{
} else if (b == 255) {
FPGA_WRITE_1;
}
}
@ -267,12 +259,10 @@ static int fpga_boot(const unsigned char *fpgadata, int size)
/* Wait for FPGA end of programming period . */
count = 0;
while (!(FPGA_DONE_STATE))
{
while (!(FPGA_DONE_STATE)) {
udelay (1000); /* wait 1ms */
/* Check for timeout */
if (count++ > 3)
{
if (count++ > 3) {
DBG ("FPGA: Booting failed!\n");
return ERROR_FPGA_PRG_DONE;
}