Mercurial > ecos-v3_0-branch
diff packages/devs/eth/cl/cs8900a/current/src/if_cs8900a.c @ 197:51b34619b677
Merge from eCos master repository on 2001-11-30-11:22:06-GMT
| author | jlarmour |
|---|---|
| date | Fri, 30 Nov 2001 13:09:25 +0000 |
| parents | 9b55e9c69693 |
| children | e0c0827131d1 |
line wrap: on
line diff
--- a/packages/devs/eth/cl/cs8900a/current/src/if_cs8900a.c +++ b/packages/devs/eth/cl/cs8900a/current/src/if_cs8900a.c @@ -161,6 +161,7 @@ cs8900a_init(struct cyg_netdevtab_entry cyg_uint16 chip_type, chip_rev, chip_status; int i; long timeout = 500000; + cyg_bool esa_configured = false; cpd->tab = tab; @@ -229,33 +230,40 @@ cs8900a_init(struct cyg_netdevtab_entry // Disable reception whilst finding the ESA put_reg(base, PP_LineCTL, 0 ); - // Find ESA - if (!cpd->hardwired_esa) { - cyg_bool esa_configured = false; - if (NULL != cpd->provide_esa) { - esa_configured = cpd->provide_esa(cpd); + // Find ESA - check possible sources in sequence and stop when + // one provides the ESA: + // RedBoot option (via provide_esa) + // Compile-time configuration + // EEPROM + // <fail configuration of device> + if (NULL != cpd->provide_esa) { + esa_configured = cpd->provide_esa(cpd); # if DEBUG & 8 - if (esa_configured) - diag_printf("Got ESA from RedBoot option\n"); + if (esa_configured) + diag_printf("Got ESA from RedBoot option\n"); # endif + } + if (!esa_configured && cpd->hardwired_esa) { + // ESA is already set in cpd->esa[] + esa_configured = true; + } + if (!esa_configured && (chip_status & PP_SelfStat_EEPROM)) { + // Get ESA from EEPROM - via the PP_IA registers + cyg_uint16 esa_word; + for (i = 0; i < sizeof(cpd->esa); i += 2) { + esa_word = get_reg(base, PP_IA+i); + cpd->esa[i] = (esa_word & 0xFF); + cpd->esa[i+1] = (esa_word >> 8) & 0xFF; } - if (!esa_configured && (chip_status & PP_SelfStat_EEPROM)) { - // Get ESA from EEPROM - via the PP_IA registers - cyg_uint16 esa_word; - for (i = 0; i < sizeof(cpd->esa); i += 2) { - esa_word = get_reg(base, PP_IA+i); - cpd->esa[i] = (esa_word & 0xFF); - cpd->esa[i+1] = (esa_word >> 8) & 0xFF; - } - esa_configured = true; - } - if (!esa_configured) { + esa_configured = true; + } + if (!esa_configured) { # if DEBUG & 8 - diag_printf("CS8900 - no EEPROM, static ESA or RedBoot config option.\n"); + diag_printf("CS8900 - no EEPROM, static ESA or RedBoot config option.\n"); # endif - return false; - } + return false; } + // Tell the chip what ESA to use for (i = 0; i < sizeof(cpd->esa); i += 2) { put_reg(base, PP_IA+i, cpd->esa[i] | (cpd->esa[i+1] << 8));
