Mercurial > flash_v2
comparison packages/devs/eth/cf/current/src/if_sc_lpe.c @ 126:518f42066aba ecos-sw-2000-09-19
Merge from eCos master repository on 2000-09-19-06:25:26-BST
| author | jlarmour |
|---|---|
| date | Tue, 19 Sep 2000 05:53:51 +0000 |
| parents | 6bd9d475ed4b |
| children | f2545e5de153 |
comparison
equal
deleted
inserted
replaced
| 125:b4407dc7f59d | 126:518f42066aba |
|---|---|
| 146 dp8390_regs *regs; | 146 dp8390_regs *regs; |
| 147 unsigned char *vers_product, *vers_manuf, *vers_revision, *vers_date; | 147 unsigned char *vers_product, *vers_manuf, *vers_revision, *vers_date; |
| 148 #ifndef CYGPKG_NET | 148 #ifndef CYGPKG_NET |
| 149 int tries = 0; | 149 int tries = 0; |
| 150 #endif | 150 #endif |
| 151 bool first = true; | |
| 151 | 152 |
| 152 slot = dp->slot; | 153 slot = dp->slot; |
| 153 cyg_drv_dsr_lock(); | 154 cyg_drv_dsr_lock(); |
| 154 while (true) { | 155 while (true) { |
| 155 cyg_drv_dsr_unlock(); // Give DSRs a chance to run (card insertion) | 156 cyg_drv_dsr_unlock(); // Give DSRs a chance to run (card insertion) |
| 156 cyg_drv_dsr_lock(); | 157 cyg_drv_dsr_lock(); |
| 157 if (slot->state == CF_SLOT_STATE_Inserted) { | 158 if ((slot->state == CF_SLOT_STATE_Inserted) || |
| 159 ((slot->state == CF_SLOT_STATE_Ready) && first)) { | |
| 160 first = false; | |
| 158 if (slot->state != CF_SLOT_STATE_Ready) { | 161 if (slot->state != CF_SLOT_STATE_Ready) { |
| 159 cf_change_state(slot, CF_SLOT_STATE_Ready); | 162 cf_change_state(slot, CF_SLOT_STATE_Ready); |
| 160 } | 163 } |
| 161 if (slot->state != CF_SLOT_STATE_Ready) { | 164 if (slot->state != CF_SLOT_STATE_Ready) { |
| 162 diag_printf("CF card won't go ready!\n"); | 165 diag_printf("CF card won't go ready!\n"); |
| 166 #ifndef CYGPKG_NET | |
| 167 return false; | |
| 168 #else | |
| 163 continue; | 169 continue; |
| 170 #endif | |
| 164 } | 171 } |
| 165 len = sizeof(buf); | 172 len = sizeof(buf); |
| 166 ptr = 0; | 173 ptr = 0; |
| 167 if (cf_get_CIS(slot, CF_CISTPL_MANFID, buf, &len, &ptr)) { | 174 if (cf_get_CIS(slot, CF_CISTPL_MANFID, buf, &len, &ptr)) { |
| 168 if (*(short *)&buf[2] != SC_LPE_MANUF) { | 175 if (*(short *)&buf[2] != SC_LPE_MANUF) { |
| 191 if (cf_parse_config(buf, len, &config)) { | 198 if (cf_parse_config(buf, len, &config)) { |
| 192 cor = config.base; | 199 cor = config.base; |
| 193 } | 200 } |
| 194 } | 201 } |
| 195 if (!cor) { | 202 if (!cor) { |
| 196 diag_printf("Couldn't find COR pointer!\n"); | 203 // diag_printf("Couldn't find COR pointer!\n"); |
| 197 continue; | 204 continue; |
| 198 } | 205 } |
| 199 // Fetch hardware address from card - terrible, but not well defined | 206 // Fetch hardware address from card - terrible, but not well defined |
| 200 for (i = 0; i < ETHER_ADDR_LEN; i++) { | 207 for (i = 0; i < ETHER_ADDR_LEN; i++) { |
| 201 enaddr[i] = slot->attr[0x1C0+(i*2)]; | 208 enaddr[i] = slot->attr[0x1C0+(i*2)]; |
| 558 } | 565 } |
| 559 | 566 |
| 560 static void | 567 static void |
| 561 sc_lpe_BufEvent(struct eth_drv_sc *sc, int stat) | 568 sc_lpe_BufEvent(struct eth_drv_sc *sc, int stat) |
| 562 { | 569 { |
| 563 diag_printf("%s\n", __FUNCTION__); | 570 // What to do if the receive buffers overflow? |
| 564 #if 0 | 571 if (stat & DP8390_ISR_OFLW) { |
| 565 if (stat & PP_BufCFG_RxMiss) { | 572 // Note: [so far] it seems safe to just ignore this condition |
| 566 } | 573 // The Linux driver goes through extraordinary pains to handle |
| 567 if (stat & PP_BufCFG_TxUE) { | 574 // it, including totally shutting down the chip and restarting. |
| 568 } | 575 } |
| 569 #endif | |
| 570 } | 576 } |
| 571 | 577 |
| 572 static void | 578 static void |
| 573 sc_lpe_int(struct eth_drv_sc *sc) | 579 sc_lpe_int(struct eth_drv_sc *sc) |
| 574 { | 580 { |
