/[gxemul]/trunk/src/devices/dev_rtl8139c.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/devices/dev_rtl8139c.c

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

revision 41 by dpavlin, Mon Oct 8 16:22:11 2007 UTC revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: dev_rtl8139c.c,v 1.3 2007/04/22 03:57:38 debug Exp $   *  $Id: dev_rtl8139c.c,v 1.5 2007/06/15 19:57:34 debug Exp $
29   *   *
30   *  Realtek 8139-style NIC.   *  COMMENT: Realtek 8139 ethernet controller
31   *   *
32   *  TODO: Pretty much everything.   *  TODO: Pretty much everything.
33   */   */
# Line 125  static void eeprom_clk(struct rtl8139c_d Line 125  static void eeprom_clk(struct rtl8139c_d
125    
126  DEVICE_ACCESS(rtl8139c)  DEVICE_ACCESS(rtl8139c)
127  {  {
128          struct rtl8139c_data *d = (struct rtl8139c_data *) extra;          struct rtl8139c_data *d = extra;
129          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
130    
131          if (writeflag == MEM_WRITE)          if (writeflag == MEM_WRITE)
# Line 201  DEVINIT(rtl8139c) Line 201  DEVINIT(rtl8139c)
201  {  {
202          char *name2;          char *name2;
203          size_t nlen = 100;          size_t nlen = 100;
204          struct rtl8139c_data *d = malloc(sizeof(struct rtl8139c_data));          struct rtl8139c_data *d;
205    
206          if (d == NULL) {          CHECK_ALLOCATION(d = malloc(sizeof(struct rtl8139c_data)));
                 fprintf(stderr, "out of memory\n");  
                 exit(1);  
         }  
207          memset(d, 0, sizeof(struct rtl8139c_data));          memset(d, 0, sizeof(struct rtl8139c_data));
208    
209          INTERRUPT_CONNECT(devinit->interrupt_path, d->irq);          INTERRUPT_CONNECT(devinit->interrupt_path, d->irq);
# Line 220  DEVINIT(rtl8139c) Line 217  DEVINIT(rtl8139c)
217          d->eeprom_reg[8] = d->macaddr[2] + (d->macaddr[3] << 8);          d->eeprom_reg[8] = d->macaddr[2] + (d->macaddr[3] << 8);
218          d->eeprom_reg[9] = d->macaddr[4] + (d->macaddr[5] << 8);          d->eeprom_reg[9] = d->macaddr[4] + (d->macaddr[5] << 8);
219    
220          name2 = malloc(nlen);          CHECK_ALLOCATION(name2 = malloc(nlen));
         if (name2 == NULL) {  
                 fprintf(stderr, "out of memory\n");  
                 exit(1);  
         }  
221          snprintf(name2, nlen, "%s [%02x:%02x:%02x:%02x:%02x:%02x]",          snprintf(name2, nlen, "%s [%02x:%02x:%02x:%02x:%02x:%02x]",
222              devinit->name, d->macaddr[0], d->macaddr[1], d->macaddr[2],              devinit->name, d->macaddr[0], d->macaddr[1], d->macaddr[2],
223              d->macaddr[3], d->macaddr[4], d->macaddr[5]);              d->macaddr[3], d->macaddr[4], d->macaddr[5]);

Legend:
Removed from v.41  
changed lines
  Added in v.42

  ViewVC Help
Powered by ViewVC 1.1.26