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

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

revision 21 by dpavlin, Mon Oct 8 16:19:23 2007 UTC revision 22 by dpavlin, Mon Oct 8 16:19:37 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2003-2005  Anders Gavare.  All rights reserved.   *  Copyright (C) 2003-2006  Anders Gavare.  All rights reserved.
3   *   *
4   *  Redistribution and use in source and binary forms, with or without   *  Redistribution and use in source and binary forms, with or without
5   *  modification, are permitted provided that the following conditions are met:   *  modification, are permitted provided that the following conditions are met:
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: dev_cons.c,v 1.28 2005/11/13 00:14:08 debug Exp $   *  $Id: dev_cons.c,v 1.33 2006/02/09 20:02:59 debug Exp $
29   *     *  
30   *  A simple console device, useful for simple tests.   *  A simple console device, useful for simple tests.
31   *   *
# Line 69  void dev_cons_tick(struct cpu *cpu, void Line 69  void dev_cons_tick(struct cpu *cpu, void
69  /*  /*
70   *  dev_cons_access():   *  dev_cons_access():
71   */   */
72  int dev_cons_access(struct cpu *cpu, struct memory *mem,  DEVICE_ACCESS(cons)
         uint64_t relative_addr, unsigned char *data, size_t len,  
         int writeflag, void *extra)  
73  {  {
74          struct cons_data *d = extra;          struct cons_data *d = extra;
75          int i;          unsigned int i;
76    
77          /*  Exit the emulator:  */          /*  Exit the emulator:  */
78          if (relative_addr == DEV_CONS_HALT) {          if (relative_addr == DEV_CONS_HALT) {
# Line 112  int dev_cons_access(struct cpu *cpu, str Line 110  int dev_cons_access(struct cpu *cpu, str
110  }  }
111    
112    
113  /*  DEVINIT(cons)
  *  devinit_cons():  
  */  
 int devinit_cons(struct devinit *devinit)  
114  {  {
115          struct cons_data *d;          struct cons_data *d;
116          char *name3;          char *name3;
# Line 142  int devinit_cons(struct devinit *devinit Line 137  int devinit_cons(struct devinit *devinit
137                  snprintf(name3, nlen, "%s", devinit->name);                  snprintf(name3, nlen, "%s", devinit->name);
138    
139          d->irq_nr = devinit->irq_nr;          d->irq_nr = devinit->irq_nr;
140          d->console_handle = console_start_slave(devinit->machine, name3);          d->in_use = devinit->in_use;
141            d->console_handle = console_start_slave(devinit->machine, name3,
142                d->in_use);
143    
144          memory_device_register(devinit->machine->memory, name3,          memory_device_register(devinit->machine->memory, name3,
145              devinit->addr, DEV_CONS_LENGTH, dev_cons_access, d,              devinit->addr, DEV_CONS_LENGTH, dev_cons_access, d,
# Line 150  int devinit_cons(struct devinit *devinit Line 147  int devinit_cons(struct devinit *devinit
147          machine_add_tickfunction(devinit->machine, dev_cons_tick,          machine_add_tickfunction(devinit->machine, dev_cons_tick,
148              d, CONS_TICK_SHIFT);              d, CONS_TICK_SHIFT);
149    
150          devinit->return_ptr = d;          /*  NOTE: Ugly cast into pointer  */
151            devinit->return_ptr = (void *)(size_t)d->console_handle;
152          return 1;          return 1;
153  }  }
154    

Legend:
Removed from v.21  
changed lines
  Added in v.22

  ViewVC Help
Powered by ViewVC 1.1.26