/[lwip]/contrib/ports/c16x/netif/cs8900if.c
ViewVC logotype

Diff of /contrib/ports/c16x/netif/cs8900if.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.21 by christiaans, Fri Oct 29 08:54:45 2004 UTC revision 1.22 by christiaans, Fri Nov 25 12:04:21 2005 UTC
# Line 142  static const struct eth_addr ethbroadcas Line 142  static const struct eth_addr ethbroadcas
142  static err_t cs8900_output(struct netif *netif, struct pbuf *p);  static err_t cs8900_output(struct netif *netif, struct pbuf *p);
143  static struct pbuf *cs8900_input(struct netif *netif);  static struct pbuf *cs8900_input(struct netif *netif);
144  static void cs8900_service(struct netif *netif);  static void cs8900_service(struct netif *netif);
145  static u32_t cs8900_chksum(void *dataptr, int len);  static u32_t cs8900_chksum(void *dataptr, s16_t len);
146  static void cs8900_reset(struct netif *netif);  static void cs8900_reset(struct netif *netif);
147    
148  // Define these to match your hardware setup  // Define these to match your hardware setup
# Line 320  static err_t cs8900_init(struct netif *n Line 320  static err_t cs8900_init(struct netif *n
320   */   */
321  static err_t cs8900_output(struct netif *netif, struct pbuf *p)  static err_t cs8900_output(struct netif *netif, struct pbuf *p)
322  {  {
323    int tries = 0;    s16_t tries = 0;
324    err_t result;    err_t result;
325    
326    // exit if link has failed    // exit if link has failed
# Line 352  static err_t cs8900_output(struct netif Line 352  static err_t cs8900_output(struct netif
352    // ready to transmit?    // ready to transmit?
353    if ((PPDATA & 0x0100U/*Rdy4TxNOW*/) != 0)    if ((PPDATA & 0x0100U/*Rdy4TxNOW*/) != 0)
354    {    {
355          unsigned long sent_bytes = 0;      u32_t sent_bytes = 0;
356      /* q traverses through linked list of pbuf's      /* q traverses through linked list of pbuf's
357       * This list MUST consist of a single packet ONLY */       * This list MUST consist of a single packet ONLY */
358      struct pbuf *q;      struct pbuf *q;
# Line 440  static struct pbuf *cs8900_input(struct Line 440  static struct pbuf *cs8900_input(struct
440      event_type = 0;      event_type = 0;
441      // read RxLength      // read RxLength
442      len = RXTXREG;      len = RXTXREG;
443      LWIP_DEBUGF(NETIF_DEBUG, ("cs8900_input: packet len %u\n", len));      LWIP_DEBUGF(NETIF_DEBUG, ("cs8900_input: packet len %"U16_F"\n", len));
444      snmp_add_ifinoctets(len);      snmp_add_ifinoctets(len);
445      // positive length?      // positive length?
446      if (len > 0)      if (len > 0)
# Line 456  static struct pbuf *cs8900_input(struct Line 456  static struct pbuf *cs8900_input(struct
456    
457          for (q = p; q != 0; q = q->next)          for (q = p; q != 0; q = q->next)
458          {          {
459                  LWIP_DEBUGF(NETIF_DEBUG, ("cs8900_input: pbuf @%p tot_len %u len %u\n", q, q->tot_len, q->len));                  LWIP_DEBUGF(NETIF_DEBUG, ("cs8900_input: pbuf @%p tot_len %"U16_F" len %"U16_F"\n", q, q->tot_len, q->len));
460                  ptr = q->payload;                  ptr = q->payload;
461            // TODO: CHECK: what if q->len is odd? we don't use the last byte?            // TODO: CHECK: what if q->len is odd? we don't use the last byte?
462            for (i = 0; i < (q->len + 1) / 2; i++)            for (i = 0; i < (q->len + 1) / 2; i++)
# Line 509  static struct pbuf *cs8900_input(struct Line 509  static struct pbuf *cs8900_input(struct
509  static void cs8900_service(struct netif *netif)  static void cs8900_service(struct netif *netif)
510  {  {
511    /* amount of ISQ's to handle (> 0) in one cs8900_service() call */    /* amount of ISQ's to handle (> 0) in one cs8900_service() call */
512    unsigned char events2service = 1;    u8_t events2service = 1;
513  #if (CS8900_STATS > 0)  #if (CS8900_STATS > 0)
514    unsigned int miss_count = 0, coll_count = 0;    u16_t miss_count = 0, coll_count = 0;
515  #endif  #endif
516    // NOTES:    // NOTES:
517    // static, so only initialized to zero at program start.    // static, so only initialized to zero at program start.
# Line 595  static void cs8900_service(struct netif Line 595  static void cs8900_service(struct netif
595  #if (CS8900_STATS > 0)  #if (CS8900_STATS > 0)
596    /* copy statistics counters into netif state fields */    /* copy statistics counters into netif state fields */
597    ((struct cs8900if *)netif->state)->missed += miss_count;    ((struct cs8900if *)netif->state)->missed += miss_count;
598    if (miss_count > 0) LWIP_DEBUGF(NETIF_DEBUG | 1, ("cs8900_input: %u missed packets due to rx buffer overrun\n", miss_count));    if (miss_count > 0) LWIP_DEBUGF(NETIF_DEBUG | 1, ("cs8900_input: %"U16_F" missed packets due to rx buffer overrun\n", miss_count));
599    
600    ((struct cs8900if *)netif->state)->collisions += coll_count;    ((struct cs8900if *)netif->state)->collisions += coll_count;
601    if (coll_count > 0) LWIP_DEBUGF(NETIF_DEBUG | 1, ("cs8900_input: %u packet collisions\n", coll_count));    if (coll_count > 0) LWIP_DEBUGF(NETIF_DEBUG | 1, ("cs8900_input: %"U16_F" packet collisions\n", coll_count));
602  #endif  #endif
603  }  }
604    
# Line 776  err_t cs8900if_init(struct netif *netif) Line 776  err_t cs8900if_init(struct netif *netif)
776   * @param p pointer to an array of bytes, at least with length 'len'   * @param p pointer to an array of bytes, at least with length 'len'
777   * @param len number of bytes available at the address pointed to by 'p'   * @param len number of bytes available at the address pointed to by 'p'
778   */   */
779  void cs8900_send_debug(unsigned char *p, unsigned int len)  void cs8900_send_debug(u8_t *p, u16_t len)
780  {  {
781    int tries = 0, i;    s16_t tries = 0, i;
782    
783    // network interface state    // network interface state
784    extern struct netif *ethif;    extern struct netif *ethif;
# Line 887  void cs8900_send_debug(unsigned char *p, Line 887  void cs8900_send_debug(unsigned char *p,
887    }    }
888  }  }
889    
890  static u32_t cs8900_chksum(void *dataptr, int len)  static u32_t cs8900_chksum(void *dataptr, s16_t len)
891  {  {
892    u32_t acc = 0;    u32_t acc = 0;
893    u16_t *ptr = (u16_t *)dataptr;    u16_t *ptr = (u16_t *)dataptr;

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26