Changeset 9d81380 in rtems
- Timestamp:
- 03/01/99 23:50:22 (25 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- faf7f46
- Parents:
- 73f6236
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/i386/i386ex/network/network.c
r73f6236 r9d81380 5 5 6 6 void dump_scb(void); 7 void printk_time(void); 7 8 8 9 #ifdef DBG_VERSION … … 35 36 void dumpQ(void); 36 37 37 #define UTI_596_ASSERT( condition, str ) 38 /* 39 * { if (!( condition ) ) printf(str); } 40 */ 38 #define UTI_596_ASSERT( condition, str ) { if (!( condition ) ) printk(str); } 41 39 int count_rx = 0; 42 40 … … 107 105 #define RBUF_SIZE 1520 108 106 109 #define UTI_596_RFD_NUMBER 4110 107 111 108 /* … … 260 257 261 258 uti596_softc.pEndRFA -> next = I596_NULL; 262 UTI_596_ASSERT(uti596_softc.countRFD == UTI_596_RFD_NUMBER,"INIT:WRONG RFD COUNT\n" );259 UTI_596_ASSERT(uti596_softc.countRFD == RX_BUF_COUNT,"INIT:WRONG RFD COUNT\n" ); 263 260 264 261 #ifdef DBG_596_RFA … … 523 520 { 524 521 int boguscnt = 1000; 522 rtems_status_code status_code; 523 struct i596_cmd *pCmd; 524 525 pCmd = sc->pCmdHead; /* This is a tx command for sure (99.99999%) */ 525 526 526 527 /* reset the board */ … … 566 567 567 568 sc->pCmdHead = sc->scb.pCmd = I596_NULL; 569 /* 570 * Wake the transmitter if needed. 571 */ 572 if ( uti596_softc.txDaemonTid && pCmd != I596_NULL ){ 573 printf("****RESET: wakes transmitter!\n"); 574 status_code = rtems_event_send (uti596_softc.txDaemonTid, 575 INTERRUPT_EVENT); 576 577 if ( status_code != RTEMS_SUCCESSFUL ) 578 printk("****ERROR:Could NOT send event to tid 0x%x : %s\n", 579 uti596_softc.txDaemonTid, rtems_status_text (status_code) ); 580 } 568 581 569 582 #ifdef DBG_596 … … 964 977 965 978 /* abort ALL of the current work */ 966 sc->scb.command = CUC_ABORT | RX_ABORT; 967 968 outport_word(CHAN_ATTN,0); 969 UTI_WAIT_COMMAND_ACCEPTED(4000, "reset: abort requested"); 979 /* FEB 17 REMOVED 980 >>>>> 981 sc->scb.command = CUC_ABORT | RX_ABORT; 982 outport_word(CHAN_ATTN,0); 983 UTI_WAIT_COMMAND_ACCEPTED(4000, "reset: abort requested"); 984 <<<<< 985 */ 970 986 971 987 uti596_reset_hardware(&uti596_softc); /* reset the ethernet hardware. must re-config */ … … 1015 1031 printf("Reset Set Address Failed\n"); 1016 1032 /*******/ 1017 1033 1034 sc->pCmdHead = sc->pCmdTail = sc->scb.pCmd = I596_NULL; /* Feb 17. clear these out */ 1035 1018 1036 #ifdef DBG_RESET 1019 1037 printf( "After reset, status and command: 0x%x, 0x%x\n", … … 1025 1043 /* restore the RFA */ 1026 1044 1027 dumpQ();1045 /*dumpQ();*/ 1028 1046 1029 1047 if ( sc->pLastUnkRFD != I596_NULL ) { … … 1053 1071 uti596clearListStatus(sc->pBeginRFA ); 1054 1072 1055 dumpQ(); /* purely for testing*/1056 1057 sc->irqInfo.on(&sc->irqInfo); /* moved here. Was originally after command issued. */1073 /* dumpQ();*/ 1074 1075 printf("Reset:Starting NIC\n"); 1058 1076 sc->scb.command = RX_START; 1059 1077 sc->started = 1; /* we assume that the start works */ 1078 sc->resetDone = 1; /* moved here from after channel attn. */ 1060 1079 outport_word(CHAN_ATTN,0 ); 1061 1080 UTI_WAIT_COMMAND_ACCEPTED(4000, "reset"); 1081 printf("Reset:Start complete \n"); 1082 UTI_596_ASSERT(sc->pCmdHead == I596_NULL, "Reset: CMD not cleared\n"); 1083 sc->irqInfo.on(&sc->irqInfo); /* moved back here. Tried it before RX command issued. */ 1062 1084 1063 sc->resetDone = 1;1064 1065 sc->started = 1;1066 1067 1085 /* uti596addCmd(&uti506_softc.nop); */ /* just for fun */ 1068 1086 … … 1230 1248 uti596_softc.pCmdHead = uti596_softc.pCmdTail = uti596_softc.scb.pCmd = pCmd; 1231 1249 1232 UTI_WAIT_COMMAND_ACCEPTED(10000,"Add Polled command: wait prev"); /* ensure prev command complete */1250 UTI_WAIT_COMMAND_ACCEPTED(10000,"Add Polled command: wait prev"); 1233 1251 1234 1252 uti596_softc.scb.command = CUC_START; 1235 1253 outport_word (CHAN_ATTN,0); 1236 1254 1237 UTI_WAIT_COMMAND_ACCEPTED(2000000,"Add Polled command: start"); /* ensure previous command complete */ 1238 /* if ( !(pCmd -> status & STAT_C ) ){ 1239 printf("****FAILED poll command\n"); 1240 } 1241 */ 1255 UTI_WAIT_COMMAND_ACCEPTED(2000000,"Add Polled command: start"); 1242 1256 uti596_softc.pCmdHead = uti596_softc.pCmdTail = uti596_softc.scb.pCmd = I596_NULL; 1243 1257 … … 1269 1283 1270 1284 /* 1271 * Send packets till queue is empty 1285 * Send packets till queue is empty. 1286 * Ensure that irq is on before sending. 1272 1287 */ 1273 1288 for (;;) { 1274 /* 1275 * Get the next mbuf chain to transmit. 1276 */ 1277 IF_DEQUEUE(&ifp->if_snd, m); 1278 if (!m) 1279 break; 1280 1281 send_packet (ifp, m); /* blocks */ 1282 } 1289 /* Feb 17: No need to make sure a reset is in progress, 1290 * Since reset daemon runs at same priority as this thread 1291 */ 1292 /* 1293 * Get the next mbuf chain to transmit. 1294 */ 1295 IF_DEQUEUE(&ifp->if_snd, m); 1296 if (!m) 1297 break; 1298 1299 send_packet (ifp, m); /* blocks */ 1300 } /* end for */ 1283 1301 ifp->if_flags &= ~IFF_OACTIVE; /* no more to send, mark output inactive */ 1284 1302 } … … 1295 1313 struct uti596_softc *sc = (struct uti596_softc *)arg; 1296 1314 rtems_event_set events; 1315 rtems_time_of_day tm_struct; 1316 1297 1317 /* struct ifnet *ifp = &sc->arpcom.ac_if; */ 1298 1318 … … 1305 1325 RTEMS_NO_TIMEOUT, &events); 1306 1326 1307 printf("reset daemon: Resetting NIC\n"); 1327 rtems_clock_get(RTEMS_CLOCK_GET_TOD, &tm_struct); 1328 printf("reset daemon: Resetting NIC @ %d:%d:%d \n", 1329 tm_struct.hour, tm_struct.minute, tm_struct.second); 1308 1330 1309 1331 sc->stats.nic_reset_count++; … … 1912 1934 UTI_WAIT_COMMAND_ACCEPTED(20000, "****ERROR:on ISR entry"); 1913 1935 1936 if ( !(i8259s_cache & 0x20 )) { 1937 printk("****Error: network ISR running, no IRR!\n"); 1938 printk("****Error: i8259s_cache = 0x%x\n",i8259s_cache ); 1939 printk_time(); 1940 } 1941 1914 1942 scbStatus = uti596_softc.scb.status & 0xf000; 1915 1943 … … 1925 1953 } 1926 1954 else { 1927 printk(" \n***INFO:ISR won't process now\n");1955 printk("***INFO: ACK'd w/o processing. status = %x\n", scbStatus); 1928 1956 return; 1929 1957 } … … 1935 1963 1936 1964 if ( (scbStatus & SCB_STAT_CX) && !(scbStatus & SCB_STAT_CNA) ){ 1965 printk_time(); 1937 1966 printk("\n*****ERROR: Command Complete, and CNA available: 0x%x\nResetting...", scbStatus); 1938 1967 uti596_softc.nic_reset = 1; … … 1941 1970 1942 1971 if ( !(scbStatus & SCB_STAT_CX) && (scbStatus & SCB_STAT_CNA) ) { 1972 printk_time(); 1943 1973 printk("\n*****ERROR: CNA, NO CX:0x%x\nResetting...",scbStatus); 1944 1974 uti596_softc.nic_reset = 1; … … 1947 1977 1948 1978 if ( scbStatus & SCB_CUS_SUSPENDED ) { 1979 printk_time(); 1949 1980 printk("\n*****ERROR: Command unit suspended!:0x%x\nResetting...",scbStatus); 1950 1981 uti596_softc.nic_reset = 1; … … 1953 1984 1954 1985 if ( scbStatus & RU_SUSPENDED ) { 1986 printk_time(); 1955 1987 printk("\n*****ERROR: Receive unit suspended!:0x%x\nResetting...",scbStatus); 1956 1988 uti596_softc.nic_reset = 1; … … 1959 1991 1960 1992 if ( scbStatus & SCB_STAT_RNR ) { 1993 printk_time(); 1961 1994 printk("\n*****WARNING: RNR %x\n",scbStatus); 1995 printk("*****INFO: RFD cmd: %x status:%x\n", 1996 uti596_softc.pBeginRFA -> cmd, 1997 uti596_softc.pBeginRFA -> stat); 1962 1998 } 1963 1999 … … 2030 2066 if ( uti596_softc.countRFD != 0 ) { 2031 2067 printk("****ERROR:Count is %d, but begin ptr is NULL\n",uti596_softc.countRFD ); 2032 dumpQ();2033 2068 } 2034 2069 } … … 2056 2091 2057 2092 /* 2058 * Adjust the driverscommand block list2093 * Adjust the command block list 2059 2094 */ 2060 2095 uti596_softc.pCmdHead = pIsrCmd -> next; … … 2109 2144 printk("wake TX:0x%x\n",uti596_softc.txDaemonTid); 2110 2145 #endif 2111 if ( uti596_softc.txDaemonTid ){ /* Ensure that the transmitter is waiting*/2146 if ( uti596_softc.txDaemonTid ){ /* Ensure that the transmitter is present */ 2112 2147 sc = rtems_event_send (uti596_softc.txDaemonTid, 2113 2148 INTERRUPT_EVENT); … … 2167 2202 } /* end if pIsrCmd != NULL && pIsrCmd->stat & STAT_C */ 2168 2203 else { 2169 2170 /* Reset the ethernet card, and wake the transmitter (if necessary) */ 2171 2172 printk("****INFO: Resetting board ( tx )\n"); 2173 uti596_softc.nic_reset = 1; 2174 if ( uti596_softc.txDaemonTid){ /* Ensure that a transmitter is waiting */ 2175 /* printk("*****INFO:Wake Transmitter\n"); */ 2176 sc = rtems_event_send (uti596_softc.txDaemonTid, 2177 INTERRUPT_EVENT); 2204 if ( pIsrCmd != I596_NULL ) { /* The command MAY be NULL from a RESET */ 2178 2205 2179 if ( sc != RTEMS_SUCCESSFUL ) 2180 printk("****ERROR:Could NOT send event to tid 0x%x : %s\n",uti596_softc.txDaemonTid, rtems_status_text (sc) ); 2206 /* Reset the ethernet card, and wake the transmitter (if necessary) */ 2207 printk_time(); 2208 printk("****INFO: Request board reset ( tx )\n"); 2209 uti596_softc.nic_reset = 1; 2210 if ( uti596_softc.txDaemonTid){ /* Ensure that a transmitter is present */ 2211 sc = rtems_event_send (uti596_softc.txDaemonTid, 2212 INTERRUPT_EVENT); 2213 2214 if ( sc != RTEMS_SUCCESSFUL ) 2215 printk("****ERROR:Could NOT send event to tid 0x%x : %s\n",uti596_softc.txDaemonTid, rtems_status_text (sc) ); 2181 2216 #ifdef DBG_RAW_ISR 2182 2183 printk("****INFO:Tx wake: %#x\n",uti596_softc.txDaemonTid);2217 else 2218 printk("****INFO:Tx wake: %#x\n",uti596_softc.txDaemonTid); 2184 2219 #endif 2220 } 2185 2221 } 2186 2222 } … … 2215 2251 printk("***ERROR:UNK: %p not end->next: %p, end: %p\n", 2216 2252 uti596_softc.pLastUnkRFD,uti596_softc.pEndRFA -> next,uti596_softc.pEndRFA); 2217 dumpQ();2218 2253 printk("***INFO:countRFD now %d\n", uti596_softc.countRFD); 2219 2254 printk("\n\n"); … … 2235 2270 if ( uti596_softc.countRFD != 0 ) { 2236 2271 printk("****INFO:About to set begin to NULL, with count == %d\n", uti596_softc.countRFD ); 2237 dumpQ();2238 2272 printk("\n\n"); 2239 2273 } … … 2258 2292 if(uti596_softc.countRFD != 0) { 2259 2293 printk("****ERROR:Begin pointer is NULL, but count == %d\n",uti596_softc.countRFD); 2260 dumpQ();2261 2294 } 2262 2295 #endif … … 2269 2302 if ( uti596_softc.countRFD <= 0) { 2270 2303 printk("****ERROR:Begin pointer is not NULL, but count == %d\n",uti596_softc.countRFD); 2271 dumpQ();2272 2304 } 2273 2305 #endif … … 2295 2327 #endif 2296 2328 2297 if ( uti596_softc.countRFD > 1 && /* there is at least TWO */ 2298 !( uti596_softc.pBeginRFA -> stat & (STAT_C | STAT_B ))) { /* restart when not in use !! */ 2299 2329 if ( uti596_softc.countRFD > 1) { 2330 /****REMOVED FEB 18. 2331 && 2332 !( uti596_softc.pBeginRFA -> stat & (STAT_C | STAT_B ))) { 2333 *****/ 2334 printk_time(); 2335 printk("****INFO: pBeginRFA -> stat = 0x%x\n",uti596_softc.pBeginRFA -> stat); 2336 printk("****INFO: pBeginRFA -> cmd = 0x%x\n",uti596_softc.pBeginRFA -> cmd); 2337 uti596_softc.pBeginRFA -> stat = 0; 2300 2338 UTI_596_ASSERT(uti596_softc.scb.command == 0, "****ERROR:scb command must be zero\n"); 2301 2339 uti596_softc.scb.pRfd = uti596_softc.pBeginRFA; … … 2305 2343 outport_word(CHAN_ATTN, 0); 2306 2344 } 2307 else { 2345 /*****REMOVED FEB 18. 2346 else { 2308 2347 printk("****WARNING: Receiver NOT Started -- countRFD = %d\n", uti596_softc.countRFD); 2309 2348 printk("82596 cmd: 0x%x, status: 0x%x RFA len: %d\n", … … 2316 2355 pISR_Rfd != I596_NULL; 2317 2356 pISR_Rfd = pISR_Rfd->next) 2318 printk("Frame @ % p, status: %2.2x, cmd: %2.2x\n",2357 printk("Frame @ %x, status: %x, cmd: %x\n", 2319 2358 pISR_Rfd, pISR_Rfd->stat, pISR_Rfd->cmd); 2320 2359 … … 2323 2362 pISR_Rfd != I596_NULL; 2324 2363 pISR_Rfd = pISR_Rfd->next) 2325 printk("Frame @ % p, status: %2.2x, cmd: %2.2x\n",2364 printk("Frame @ %x, status: %x, cmd: %x\n", 2326 2365 pISR_Rfd, pISR_Rfd->stat, pISR_Rfd->cmd); 2327 2366 … … 2331 2370 pISR_Rfd != I596_NULL; 2332 2371 pISR_Rfd = pISR_Rfd->next) 2333 printk("Frame @ % p, status: %2.2x, cmd: %2.2x\n",2372 printk("Frame @ %x, status: %x, cmd: %x\n", 2334 2373 pISR_Rfd, pISR_Rfd->stat, pISR_Rfd->cmd); 2335 2374 printk("\nUnknown: %p\n",uti596_softc.pLastUnkRFD); 2336 2375 } 2376 *****/ 2337 2377 } /* end stat_rnr */ 2338 2378 2339 2379 } /* end if receiver started */ 2340 UTI_596_ASSERT(uti596_softc.scb.status == scbStatus, "****WARNING:scbStatus change!\n");2380 /* UTI_596_ASSERT(uti596_softc.scb.status == scbStatus, "****WARNING:scbStatus change!\n"); */ 2341 2381 2342 2382 #ifdef DBG_ISR … … 2704 2744 2705 2745 } 2706 void dump_scb( ){2746 void dump_scb(void){ 2707 2747 printk("status 0x%x\n",uti596_softc.scb.status); 2708 2748 printk("command 0x%x\n",uti596_softc.scb.command); … … 2719 2759 } 2720 2760 2761 void printk_time(void){ 2762 rtems_time_of_day tm_struct; 2763 2764 rtems_clock_get(RTEMS_CLOCK_GET_TOD, &tm_struct); 2765 printk("Current time: %d:%d:%d \n", tm_struct.hour, tm_struct.minute, tm_struct.second); 2766 }
Note: See TracChangeset
for help on using the changeset viewer.