/[gxemul]/trunk/src/devices/dev_le.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_le.c

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

revision 4 by dpavlin, Mon Oct 8 16:18:00 2007 UTC revision 18 by dpavlin, Mon Oct 8 16:19:11 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: dev_le.c,v 1.39 2005/03/14 19:14:02 debug Exp $   *  $Id: dev_le.c,v 1.44 2005/10/26 14:37:04 debug Exp $
29   *     *  
30   *  LANCE ethernet, as used in DECstations.   *  LANCE ethernet, as used in DECstations.
31   *   *
# Line 93  struct le_data { Line 93  struct le_data {
93          int             reg_select;          int             reg_select;
94          uint16_t        reg[N_REGISTERS];          uint16_t        reg[N_REGISTERS];
95    
96          unsigned char   sram[SRAM_SIZE];          unsigned char   *sram;
97    
98          /*  Initialization block:  */          /*  Initialization block:  */
99          uint32_t        init_block_addr;          uint32_t        init_block_addr;
# Line 658  int dev_le_access(struct cpu *cpu, struc Line 658  int dev_le_access(struct cpu *cpu, struc
658          int i, retval = 1;          int i, retval = 1;
659          struct le_data *d = extra;          struct le_data *d = extra;
660    
661          idata = memory_readmax64(cpu, data, len);          if (writeflag == MEM_WRITE)
662                    idata = memory_readmax64(cpu, data, len);
663    
664  #ifdef LE_DEBUG  #ifdef LE_DEBUG
665          if (writeflag == MEM_WRITE) {          if (writeflag == MEM_WRITE) {
# Line 768  void dev_le_init(struct machine *machine Line 769  void dev_le_init(struct machine *machine
769          uint64_t buf_start, uint64_t buf_end, int irq_nr, int len)          uint64_t buf_start, uint64_t buf_end, int irq_nr, int len)
770  {  {
771          char *name2;          char *name2;
772            size_t nlen = 55;
773          struct le_data *d = malloc(sizeof(struct le_data));          struct le_data *d = malloc(sizeof(struct le_data));
774    
775          if (d == NULL) {          if (d == NULL) {
# Line 778  void dev_le_init(struct machine *machine Line 780  void dev_le_init(struct machine *machine
780          memset(d, 0, sizeof(struct le_data));          memset(d, 0, sizeof(struct le_data));
781          d->irq_nr    = irq_nr;          d->irq_nr    = irq_nr;
782    
783            d->sram = malloc(SRAM_SIZE);
784            if (d->sram == NULL) {
785                    fprintf(stderr, "out of memory\n");
786                    exit(1);
787            }
788            memset(d->sram, 0, SRAM_SIZE);
789    
790          /*  TODO:  Are these actually used yet?  */          /*  TODO:  Are these actually used yet?  */
791          d->len       = len;          d->len       = len;
792          d->buf_start = buf_start;          d->buf_start = buf_start;
# Line 816  void dev_le_init(struct machine *machine Line 825  void dev_le_init(struct machine *machine
825    
826          memory_device_register(mem, "le_sram", baseaddr,          memory_device_register(mem, "le_sram", baseaddr,
827              SRAM_SIZE, dev_le_sram_access, (void *)d,              SRAM_SIZE, dev_le_sram_access, (void *)d,
828              MEM_BINTRANS_OK | MEM_BINTRANS_WRITE_OK, d->sram);              MEM_DYNTRANS_OK | MEM_DYNTRANS_WRITE_OK
829                | MEM_READING_HAS_NO_SIDE_EFFECTS, d->sram);
830    
831          name2 = malloc(50);          name2 = malloc(nlen);
832          if (name2 == NULL) {          if (name2 == NULL) {
833                  fprintf(stderr, "out of memory in dev_le_init()\n");                  fprintf(stderr, "out of memory in dev_le_init()\n");
834                  exit(1);                  exit(1);
835          }          }
836          sprintf(name2, "le [%02x:%02x:%02x:%02x:%02x:%02x]",          snprintf(name2, nlen, "le [%02x:%02x:%02x:%02x:%02x:%02x]",
837              d->rom[0], d->rom[1], d->rom[2], d->rom[3], d->rom[4], d->rom[5]);              d->rom[0], d->rom[1], d->rom[2], d->rom[3], d->rom[4], d->rom[5]);
838    
839          memory_device_register(mem, name2, baseaddr + 0x100000,          memory_device_register(mem, name2, baseaddr + 0x100000,

Legend:
Removed from v.4  
changed lines
  Added in v.18

  ViewVC Help
Powered by ViewVC 1.1.26