/[gxemul]/trunk/src/devices/dev_sn.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_sn.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_sn.c,v 1.18 2007/04/21 06:13:53 debug Exp $   *  $Id: dev_sn.c,v 1.19 2007/06/15 19:57:34 debug Exp $
29   *     *  
30   *  National Semiconductor SONIC ("sn") DP83932 ethernet.   *  COMMENT: National Semiconductor SONIC ("sn") DP83932 ethernet controller
  *  
31   *   *
32   *  TODO   *  TODO
33   */   */
# Line 59  struct sn_data { Line 58  struct sn_data {
58    
59  DEVICE_ACCESS(sn)  DEVICE_ACCESS(sn)
60  {  {
61          struct sn_data *d = (struct sn_data *) extra;          struct sn_data *d = extra;
62          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
63          int regnr;          int regnr;
64    
# Line 100  DEVINIT(sn) Line 99  DEVINIT(sn)
99  {  {
100          char *name2;          char *name2;
101          size_t nlen = 55;          size_t nlen = 55;
102          struct sn_data *d = malloc(sizeof(struct sn_data));          struct sn_data *d;
103    
104          if (d == NULL) {          CHECK_ALLOCATION(d = malloc(sizeof(struct sn_data)));
                 fprintf(stderr, "out of memory\n");  
                 exit(1);  
         }  
105          memset(d, 0, sizeof(struct sn_data));          memset(d, 0, sizeof(struct sn_data));
106    
107          INTERRUPT_CONNECT(devinit->interrupt_path, d->irq);          INTERRUPT_CONNECT(devinit->interrupt_path, d->irq);
108    
109          net_generate_unique_mac(devinit->machine, d->macaddr);          net_generate_unique_mac(devinit->machine, d->macaddr);
110    
111          name2 = malloc(nlen);          CHECK_ALLOCATION(name2 = malloc(nlen));
         if (name2 == NULL) {  
                 fprintf(stderr, "out of memory in dev_sn_init()\n");  
                 exit(1);  
         }  
112          snprintf(name2, nlen, "%s [%02x:%02x:%02x:%02x:%02x:%02x]",          snprintf(name2, nlen, "%s [%02x:%02x:%02x:%02x:%02x:%02x]",
113              devinit->name, d->macaddr[0], d->macaddr[1], d->macaddr[2],              devinit->name, d->macaddr[0], d->macaddr[1], d->macaddr[2],
114              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