summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-06-27 21:31:46 +0000
committerwdenk <wdenk>2003-06-27 21:31:46 +0000
commit8bde7f776c77b343aca29b8c7b58464d915ac245 (patch)
tree20f1fd99975215e7c658454a15cdb4ed4694e2d4 /examples
parent993cad9364c6b87ae429d1ed1130d8153f6f027e (diff)
* Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc. - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c) * Patches by Kenneth Johansson, 25 Jun 2003: - major rework of command structure (work done mostly by Michal Cendrowski and Joakim Kristiansen)
Diffstat (limited to 'examples')
-rw-r--r--examples/82559_eeprom.c61
-rw-r--r--examples/eepro100_eeprom.c1
-rw-r--r--examples/mem_to_mem_idma2intr.c1
-rw-r--r--examples/syscall.S6
-rw-r--r--examples/timer.c1
5 files changed, 33 insertions, 37 deletions
diff --git a/examples/82559_eeprom.c b/examples/82559_eeprom.c
index c710cd32c6..d66b3dd8e2 100644
--- a/examples/82559_eeprom.c
+++ b/examples/82559_eeprom.c
@@ -188,7 +188,7 @@ static int reset_eeprom(unsigned long ioaddr, unsigned char *hwaddr)
static unsigned int hatoi(char *p, char **errp)
{
unsigned int res = 0;
-
+
while (1) {
switch (*p) {
case 'a':
@@ -218,7 +218,7 @@ static unsigned int hatoi(char *p, char **errp)
case '8':
case '9':
res |= (*p - '0');
- break;
+ break;
default:
if (errp) {
*errp = p;
@@ -231,11 +231,11 @@ static unsigned int hatoi(char *p, char **errp)
}
res <<= 4;
}
-
+
if (errp) {
*errp = NULL;
}
-
+
return res;
}
@@ -244,7 +244,7 @@ static unsigned char *gethwaddr(char *in, unsigned char *out)
char tmp[3];
int i;
char *err;
-
+
for (i=0;i<6;i++) {
if (in[i*3+2] == 0 && i == 5) {
out[i] = hatoi(&in[i*3], &err);
@@ -261,60 +261,59 @@ static unsigned char *gethwaddr(char *in, unsigned char *out)
}
} else {
return NULL;
- }
+ }
}
-
+
return out;
}
static u32
read_config_dword(int bus, int dev, int func, int reg)
-{
+{
u32 res;
-
+
outl(0x80000000|(bus&0xff)<<16|(dev&0x1f)<<11|(func&7)<<8|(reg&0xfc),
0xcf8);
res = inl(0xcfc);
- outl(0, 0xcf8);
- return res;
+ outl(0, 0xcf8);
+ return res;
}
static u16
read_config_word(int bus, int dev, int func, int reg)
-{
+{
u32 res;
-
+
outl(0x80000000|(bus&0xff)<<16|(dev&0x1f)<<11|(func&7)<<8|(reg&0xfc),
0xcf8);
res = inw(0xcfc + (reg & 2));
- outl(0, 0xcf8);
- return res;
+ outl(0, 0xcf8);
+ return res;
}
static void
write_config_word(int bus, int dev, int func, int reg, u16 data)
-{
-
+{
+
outl(0x80000000|(bus&0xff)<<16|(dev&0x1f)<<11|(func&7)<<8|(reg&0xfc),
0xcf8);
outw(data, 0xcfc + (reg & 2));
- outl(0, 0xcf8);
+ outl(0, 0xcf8);
}
-
int main (int argc, char *argv[])
{
unsigned char *eth_addr;
char buf[6];
int instance;
-
+
if (argc != 2) {
mon_printf ("call with base Ethernet address\n");
return 1;
}
-
-
+
+
eth_addr = gethwaddr(argv[1], buf);
if (NULL == eth_addr) {
mon_printf ("Can not parse ethernet address\n");
@@ -323,8 +322,8 @@ int main (int argc, char *argv[])
if (eth_addr[5] & 0x01) {
mon_printf("Base Ethernet address must be even\n");
}
-
-
+
+
for (instance = 0; instance < 2; instance ++) {
unsigned int io_addr;
unsigned char mac[6];
@@ -335,19 +334,19 @@ int main (int argc, char *argv[])
mon_printf("ETH%d IO=0x%04x\n", instance, bar1 & ~3);
}
io_addr = (bar1 & (~3L));
-
-
- write_config_word(0, 6+instance, 0, 4,
+
+
+ write_config_word(0, 6+instance, 0, 4,
read_config_word(0, 6+instance, 0, 4) | 1);
mon_printf("ETH%d CMD %04x\n", instance,
read_config_word(0, 6+instance, 0, 4));
-
+
memcpy(mac, eth_addr, 6);
mac[5] += instance;
-
+
mon_printf("got io=%04x, ha=%02x:%02x:%02x:%02x:%02x:%02x\n",
- io_addr, mac[0], mac[1], mac[2],
- mac[3], mac[4], mac[5]);
+ io_addr, mac[0], mac[1], mac[2],
+ mac[3], mac[4], mac[5]);
reset_eeprom(io_addr, mac);
}
return 0;
diff --git a/examples/eepro100_eeprom.c b/examples/eepro100_eeprom.c
index 656b2382b8..23020037d3 100644
--- a/examples/eepro100_eeprom.c
+++ b/examples/eepro100_eeprom.c
@@ -207,4 +207,3 @@ static int reset_eeprom(unsigned long ioaddr, unsigned char *hwaddr)
mon_printf("done\n");
return 0;
}
-
diff --git a/examples/mem_to_mem_idma2intr.c b/examples/mem_to_mem_idma2intr.c
index 93c6f77ca5..3f0fd372b0 100644
--- a/examples/mem_to_mem_idma2intr.c
+++ b/examples/mem_to_mem_idma2intr.c
@@ -27,7 +27,6 @@
*/
-
#include <common.h>
#include <syscall.h>
diff --git a/examples/syscall.S b/examples/syscall.S
index 2af6f480d1..f319409ee6 100644
--- a/examples/syscall.S
+++ b/examples/syscall.S
@@ -72,7 +72,7 @@ mon_free:
#ifdef CONFIG_I386 /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
#define SYMBOL_NAME(X) X
#define SYMBOL_NAME_LABEL(X) X##:
-
+
#define SYSCALL(name,n) \
.globl SYMBOL_NAME(name) ; \
SYMBOL_NAME_LABEL(name) ; \
@@ -96,8 +96,8 @@ name: ; \
.text
/*
- * Make sure these functions are in the same order as they
- * appear in the "include/syscall.h" header file !!!
+ * Make sure these functions are in the same order as they
+ * appear in the "include/syscall.h" header file !!!
*/
SYSCALL(mon_getc,SYSCALL_GETC)
diff --git a/examples/timer.c b/examples/timer.c
index 33f53c0726..bfe3d668d8 100644
--- a/examples/timer.c
+++ b/examples/timer.c
@@ -104,7 +104,6 @@ typedef struct tid_8xx_cpmtimer_s {
#define CPMT_MR_CE_ANY 0x00C0 /* Capt./Interr. on any TIN edge*/
-
/*
* which CPM timer to use - index starts at 0 (= timer 1)
*/