Changeset 9693fac4 in rtems


Ignore:
Timestamp:
Aug 12, 1998, 11:10:38 PM (21 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
ae320e0
Parents:
3f9da79
Message:

Added more debug information. There are probably debug prints left in.

Fixed one important bug. After wrapping the RX Descriptors all had the
EOL bit set which resulted in everything slowing down massively.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/dmv177/sonic/sonic.c

    r3f9da79 r9693fac4  
    5555#define SONIC_DEBUG_CAM              0x0008
    5656#define SONIC_DEBUG_DESCRIPTORS      0x0010
    57 
    58 #define SONIC_DEBUG (SONIC_DEBUG_NONE)
     57#define SONIC_DEBUG_ERRORS           0x0020
     58
     59#define SONIC_DEBUG (SONIC_DEBUG_ERRORS)
    5960
    6061/* (SONIC_DEBUG_MEMORY|SONIC_DEBUG_DESCRIPTORS) */
     
    119120 */
    120121#define SONIC_DCR \
    121    (DCR_DW32 | DCR_WAIT0 | DCR_PO0 | DCR_PO1  | DCR_RFT24 | DCR_TFT28)
     122   (DCR_DW32 | DCR_WAIT0 | DCR_PO0 | DCR_PO1  | DCR_RFT4 | DCR_TFT8)
    122123#ifndef SONIC_DCR
    123124# define SONIC_DCR (DCR_DW32 | DCR_TFT28)
     
    131132 */
    132133#define RDA_COUNT     20
    133 #define TDA_COUNT     10
     134#define TDA_COUNT     100
    134135
    135136/*
     
    138139 * receive resource area bigger than the receive descriptor area.
    139140 */
    140 #define RRA_EXTRA_COUNT  3
     141#define RRA_EXTRA_COUNT  0
    141142
    142143/*
     
    253254);
    254255
     256void sonic_enable_interrupts(
     257  void       *rp,
     258  unsigned32  mask
     259)
     260{
     261  rtems_interrupt_level level;
     262
     263  rtems_interrupt_disable( level );
     264      sonic_write_register(
     265         rp,
     266         SONIC_REG_IMR,
     267         sonic_read_register(rp, SONIC_REG_IMR) | mask
     268      );
     269  rtems_interrupt_enable( level );
     270}
     271
    255272/*
    256273 * Allocate non-cacheable memory on a single 64k page.
     
    293310  void *rp = dp->sonic;
    294311
     312printf( "sonic_stop\n" );
    295313  /*
    296314   * Stop the transmitter and receiver.
     
    431449#if (SONIC_DEBUG & SONIC_DEBUG_DESCRIPTORS)
    432450    printf( "retire TDA %p (0x%04x)\n", dp->tdaTail, status );
     451#endif
     452
     453#if (SONIC_DEBUG & SONIC_DEBUG_ERRORS)
     454    if ( status != 0x0001 )
     455      printf( "ERROR: retire TDA %p (0x%04x)\n", dp->tdaTail, status );
    433456#endif
    434457
     
    538561   */
    539562  if (dp->txWaitTid) {
     563printf( "TX: conflict delay\n" );
    540564    dp->txRawWait++;
    541565    while (dp->txWaitTid)
     
    577601       * Enable transmitter interrupts.
    578602       */
    579       sonic_write_register(
    580          rp,
    581          SONIC_REG_IMR,
    582          sonic_read_register( rp, SONIC_REG_IMR) |
    583                 (IMR_PINTEN | IMR_PTXEN | IMR_TXEREN)
    584       );
     603      sonic_enable_interrupts( rp, (IMR_PINTEN | IMR_PTXEN | IMR_TXEREN) );
    585604
    586605      /*
     
    662681  dp->tdaHead = tdp;
    663682
    664   sonic_write_register(
    665      rp,
    666      SONIC_REG_IMR,
    667      sonic_read_register( rp, SONIC_REG_IMR) |
    668             (IMR_PINTEN | IMR_PTXEN | IMR_TXEREN)
    669   );
     683  sonic_enable_interrupts( rp, (IMR_PINTEN | IMR_PTXEN | IMR_TXEREN) );
    670684  sonic_write_register( rp, SONIC_REG_CR, CR_TXP );
    671685
     
    728742     */
    729743    if (sonic_read_register( rp, SONIC_REG_ISR ) & ISR_RBAE) {
     744
     745#if (SONIC_DEBUG & SONIC_DEBUG_ERRORS)
     746      printf( "ERROR: looks like a giant packet -- RBAE\n" );
     747#endif
     748
    730749      /*
    731750       * One more check to soak up any Receive Descriptors
    732751       * that may already have been handed back to the driver.
    733752       */
    734       if (rdp->in_use == RDA_IN_USE)
     753      if (rdp->in_use == RDA_IN_USE) {
     754#if (SONIC_DEBUG & SONIC_DEBUG_ERRORS)
     755      printf( "ERROR: nope just an RBAE\n" );
     756#endif
    735757        break;
     758      }
    736759
    737760      /*
     
    793816     * Enable interrupts.
    794817     */
    795     sonic_write_register(
    796        rp,
    797        SONIC_REG_IMR,
    798        sonic_read_register( rp, SONIC_REG_IMR) | (IMR_PRXEN | IMR_RBAEEN)
    799     );
     818    sonic_enable_interrupts( rp, (IMR_PRXEN | IMR_RBAEEN) );
    800819
    801820    /*
     
    809828  printf( "RDA %p\n", rdp );
    810829#endif
     830
     831#if (SONIC_DEBUG & SONIC_DEBUG_ERRORS)
     832    if (rdp->status & 0x000E)
     833      printf( "ERROR: RDA %p (0x%04x)\n", rdp, rdp->status );
     834#endif
     835
    811836}
    812837
     
    889914       * using up all the available memory.
    890915       */
    891       if (++continuousCount >= dp->rdaCount)
     916      if (++continuousCount >= dp->rdaCount) {
     917#if (SONIC_DEBUG & SONIC_DEBUG_ERRORS)
     918        printf( "ERROR: RX processed too many in a row\n" );
     919#endif
    892920        kwait_null ();
     921      }
    893922
    894923      /*
     
    955984     * Move to next receive descriptor
    956985     */
    957     rdp->link |= RDA_LINK_EOL;
     986    /* rdp->link |= RDA_LINK_EOL; XXX */
    958987    rdp->in_use = RDA_FREE;
    959988    rdp = rdp->next;
Note: See TracChangeset for help on using the changeset viewer.