OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [peripheral/] [generic.c] - Blame information for rev 93

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 jeremybenn
/* generic.c -- Generic external peripheral
2
 
3
   Copyright (C) 2008 Embecosm Limited
4
 
5
   Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
6
 
7
   This file is part of OpenRISC 1000 Architectural Simulator.
8
 
9
   This program is free software; you can redistribute it and/or modify it
10
   under the terms of the GNU General Public License as published by the Free
11
   Software Foundation; either version 3 of the License, or (at your option)
12
   any later version.
13
 
14
   This program is distributed in the hope that it will be useful, but WITHOUT
15
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
17
   more details.
18
 
19
   You should have received a copy of the GNU General Public License along
20
   with this program.  If not, see <http://www.gnu.org/licenses/>. */
21
 
22
/* This program is commented throughout in a fashion suitable for processing
23
   with Doxygen. */
24
 
25
 
26
/* This is functional simulation of any external peripheral. It's job is to
27
 * trap accesses in a specific range, so that the simulator can drive an
28
 * external device.
29
 *
30
 * A note on endianess. All external communication is done using HOST
31
 * endianess. A set of functions are provided to convert between host and
32
 * model endianess (htoml, htoms, mtohl, mtohs).
33
 */
34
 
35
/* Autoconf and/or portability configuration */
36
#include "config.h"
37
 
38
/* System includes */
39
#include <stdlib.h>
40
#include <stdio.h>
41
 
42
/* Package includes */
43
#include "arch.h"
44
#include "sim-config.h"
45
#include "abstract.h"
46
#include "toplevel-support.h"
47
#include "sim-cmd.h"
48
 
49
 
50
/*! State associated with the generic device. */
51
struct dev_generic
52
{
53
 
54
  /* Info about a particular transaction */
55
 
56
  enum
57
  {                             /* Direction of the access */
58
    GENERIC_READ,
59
    GENERIC_WRITE
60
  } trans_direction;
61
 
62
  enum
63
  {                             /* Size of the access */
64
    GENERIC_BYTE,
65
    GENERIC_HW,
66
    GENERIC_WORD
67
  } trans_size;
68
 
69
  uint32_t value;               /* The value to read/write */
70
 
71
  /* Configuration */
72
 
73
  int enabled;                  /* Device enabled */
74
  int byte_enabled;             /* Byte R/W allowed */
75
  int hw_enabled;               /* Half word R/W allowed */
76
  int word_enabled;             /* Full word R/W allowed */
77
  char *name;                   /* Name of the device */
78
  oraddr_t baseaddr;            /* Base address of device */
79
  uint32_t size;                /* Address space size (bytes) */
80
 
81
};
82
 
83
 
84 93 jeremybenn
/* --------------------------------------------------------------------------*/
85
/*!Read a byte from an external device
86 19 jeremybenn
 
87 93 jeremybenn
   To model Wishbone accurately, we always do this as a 4-byte access, with a
88
   mask for the bytes we don't want.
89 19 jeremybenn
 
90 93 jeremybenn
   Since this is only a byte, the endianess of the result is irrelevant.
91 19 jeremybenn
 
92 93 jeremybenn
   @note We are passed the device address, but we must convert it to a full
93
         address for external use, to allow the single upcall handler to
94
         decode multiple generic devices.
95 19 jeremybenn
 
96 93 jeremybenn
   @param[in] addr  The device address to read from (host endian).
97
   @param[in] dat   The device data structure
98 19 jeremybenn
 
99 93 jeremybenn
   @return  The byte read.                                                   */
100
/* --------------------------------------------------------------------------*/
101 19 jeremybenn
static uint8_t
102 93 jeremybenn
generic_read_byte (oraddr_t  addr,
103
                   void     *dat)
104 19 jeremybenn
{
105
  struct dev_generic *dev = (struct dev_generic *) dat;
106
 
107 93 jeremybenn
  if (!config.ext.read_up)
108 19 jeremybenn
    {
109
      fprintf (stderr, "Byte read from disabled generic device\n");
110
      return 0;
111
    }
112
  else if (addr >= dev->size)
113
    {
114
      fprintf (stderr, "Byte read  out of range for generic device %s "
115
               "(addr %" PRIxADDR ")\n", dev->name, addr);
116
      return 0;
117
    }
118
  else
119
    {
120 93 jeremybenn
      unsigned long int  fulladdr = (unsigned long int) (addr + dev->baseaddr);
121
      unsigned long int  wordaddr = fulladdr & 0xfffffffc;
122
      int                bytenum  = fulladdr & 0x00000003;
123 19 jeremybenn
 
124 93 jeremybenn
      unsigned char      mask[4];
125
      unsigned char      res[4];
126 19 jeremybenn
 
127 93 jeremybenn
      /* Set the mask, read and get the result */
128
      memset (mask, 0, sizeof (mask));
129
      mask[bytenum] = 0xff;
130 19 jeremybenn
 
131 93 jeremybenn
      if (0 != config.ext.read_up (NULL, wordaddr, mask, res, 4))
132
        {
133
          fprintf (stderr, "Warning: external byte read failed.\n");
134
          return  0;
135
        }
136 19 jeremybenn
 
137 93 jeremybenn
      return  res[bytenum];
138 19 jeremybenn
    }
139 93 jeremybenn
}       /* generic_read_byte() */
140 19 jeremybenn
 
141
 
142 93 jeremybenn
/* --------------------------------------------------------------------------*/
143
/*!Write a byte to an external device
144
 
145
   To model Wishbone accurately, we always do this as a 4-byte access, with a
146
   mask for the bytes we don't want.
147
 
148
   Since this is only a byte, the endianess of the value is irrelevant.
149
 
150
   @note We are passed the device address, but we must convert it to a full
151
         address for external use, to allow the single upcall handler to
152
         decode multiple generic devices.
153
 
154
   @param[in] addr  The device address to write to (host endian)
155
   @param[in] value The byte value to write
156
   @param[in] dat   The device data structure                                */
157
/* --------------------------------------------------------------------------*/
158 19 jeremybenn
static void
159 93 jeremybenn
generic_write_byte (oraddr_t  addr,
160
                    uint8_t   value,
161
                    void     *dat)
162 19 jeremybenn
{
163
  struct dev_generic *dev = (struct dev_generic *) dat;
164
 
165 93 jeremybenn
  if (!config.ext.write_up)
166 19 jeremybenn
    {
167
      fprintf (stderr, "Byte write to disabled generic device\n");
168
    }
169
  else if (addr >= dev->size)
170
    {
171
      fprintf (stderr, "Byte written out of range for generic device %s "
172
               "(addr %" PRIxADDR ")\n", dev->name, addr);
173
    }
174
  else
175
    {
176 93 jeremybenn
      unsigned long int  fulladdr = (unsigned long int) (addr + dev->baseaddr);
177
      unsigned long int  wordaddr = fulladdr & 0xfffffffc;
178
      int                bytenum  = fulladdr & 0x00000003;
179 19 jeremybenn
 
180 93 jeremybenn
      unsigned char      mask[4];
181
      unsigned char      val[4];
182 19 jeremybenn
 
183 93 jeremybenn
      /* Set the mask and write data do the write. */
184
      memset (mask, 0, sizeof (mask));
185
      mask[bytenum] = 0xff;
186
      val[bytenum]  = value;
187 19 jeremybenn
 
188 93 jeremybenn
      if (0 != config.ext.write_up (NULL, wordaddr, mask, val, 4))
189
        {
190
          fprintf (stderr, "Warning: external byte write failed.\n");
191
        }
192 19 jeremybenn
    }
193 93 jeremybenn
}       /* generic_write_byte() */
194 19 jeremybenn
 
195
 
196 93 jeremybenn
/* --------------------------------------------------------------------------*/
197
/*!Read a half word from an external device
198
 
199
   To model Wishbone accurately, we always do this as a 4-byte access, with a
200
   mask for the bytes we don't want.
201
 
202
   Since this is a half word, the result must be converted to host endianess.
203
 
204
   @note We are passed the device address, but we must convert it to a full
205
         address for external use, to allow the single upcall handler to
206
         decode multiple generic devices.
207
 
208
   @param[in] addr  The device address to read from (host endian).
209
   @param[in] dat   The device data structure.
210
 
211
   @return  The half word read (host endian).                                */
212
/* --------------------------------------------------------------------------*/
213 19 jeremybenn
static uint16_t
214 93 jeremybenn
generic_read_hw (oraddr_t  addr,
215
                 void     *dat)
216 19 jeremybenn
{
217
  struct dev_generic *dev = (struct dev_generic *) dat;
218
 
219 93 jeremybenn
  if (!config.ext.read_up)
220 19 jeremybenn
    {
221
      fprintf (stderr, "Half word read from disabled generic device\n");
222
      return 0;
223
    }
224
  else if (addr >= dev->size)
225
    {
226
      fprintf (stderr, "Half-word read  out of range for generic device %s "
227
               "(addr %" PRIxADDR ")\n", dev->name, addr);
228
      return 0;
229
    }
230
  else if (addr & 0x1)
231
    {
232 93 jeremybenn
      /* This should be trapped elsewhere - here for safety. */
233 19 jeremybenn
      fprintf (stderr,
234
               "Unaligned half word read from 0x%" PRIxADDR " ignored\n",
235
               addr);
236
      return 0;
237
    }
238
  else
239
    {
240 93 jeremybenn
      unsigned long int  fulladdr = (unsigned long int) (addr + dev->baseaddr);
241
      unsigned long int  wordaddr = fulladdr & 0xfffffffc;
242
      int                hwnum    = fulladdr & 0x00000002;
243 19 jeremybenn
 
244 93 jeremybenn
      unsigned char      mask[4];
245
      unsigned char      res[4];
246 19 jeremybenn
 
247 93 jeremybenn
      /* Set the mask, read and get the result */
248
      memset (mask, 0, sizeof (mask));
249
      mask[hwnum    ] = 0xff;
250
      mask[hwnum + 1] = 0xff;
251 19 jeremybenn
 
252 93 jeremybenn
      if (0 != config.ext.read_up (NULL, wordaddr, mask, res, 4))
253
        {
254
          fprintf (stderr, "Warning: external half word read failed.\n");
255
          return  0;
256
        }
257 19 jeremybenn
 
258 93 jeremybenn
      /* Result converted according to endianess */
259
#ifdef OR32_BIG_ENDIAN
260
      return  (unsigned short int) res[hwnum    ] << 8 |
261
              (unsigned short int) res[hwnum + 1];
262
#else
263
      return  (unsigned short int) res[hwnum + 1] << 8 |
264
              (unsigned short int) res[hwnum    ];
265
#endif
266 19 jeremybenn
    }
267 93 jeremybenn
}       /* generic_read_hw() */
268 19 jeremybenn
 
269
 
270 93 jeremybenn
/* --------------------------------------------------------------------------*/
271
/*!Write a half word to an external device
272
 
273
   To model Wishbone accurately, we always do this as a 4-byte access, with a
274
   mask for the bytes we don't want.
275
 
276
   Since this is a half word, the value must be converted from host endianess.
277
 
278
   @note We are passed the device address, but we must convert it to a full
279
         address for external use, to allow the single upcall handler to
280
         decode multiple generic devices.
281
 
282
   @param[in] addr  The device address to write to (host endian).
283
   @param[in] value The half word value to write (model endian).
284
   @param[in] dat   The device data structure.                               */
285
/* --------------------------------------------------------------------------*/
286 19 jeremybenn
static void
287 93 jeremybenn
generic_write_hw (oraddr_t  addr,
288
                  uint16_t  value,
289
                  void     *dat)
290 19 jeremybenn
{
291
  struct dev_generic *dev = (struct dev_generic *) dat;
292
 
293 93 jeremybenn
  if (!config.ext.write_up)
294 19 jeremybenn
    {
295
      fprintf (stderr, "Half word write to disabled generic device\n");
296
    }
297
  else if (addr >= dev->size)
298
    {
299
      fprintf (stderr, "Half-word written  out of range for generic device %s "
300
               "(addr %" PRIxADDR ")\n", dev->name, addr);
301
    }
302
  else if (addr & 0x1)
303
    {
304
      fprintf (stderr,
305
               "Unaligned half word write to 0x%" PRIxADDR " ignored\n", addr);
306
    }
307
  else
308
    {
309 93 jeremybenn
      unsigned long int  fulladdr = (unsigned long int) (addr + dev->baseaddr);
310
      unsigned long int  wordaddr = fulladdr & 0xfffffffc;
311
      int                hwnum    = fulladdr & 0x00000002;
312 19 jeremybenn
 
313 93 jeremybenn
      unsigned char      mask[4];
314
      unsigned char      val[4];
315 19 jeremybenn
 
316 93 jeremybenn
      /* Set the mask and write data do the write. */
317
      memset (mask, 0, sizeof (mask));
318
      mask[hwnum    ] = 0xff;
319
      mask[hwnum + 1] = 0xff;
320 19 jeremybenn
 
321 93 jeremybenn
      /* Value converted according to endianess */
322
#ifdef OR32_BIG_ENDIAN
323
      val[hwnum    ] = (unsigned char) (value >> 8);
324
      val[hwnum + 1] = (unsigned char) (value     );
325
#else
326
      val[hwnum + 1] = (unsigned char) (value >> 8);
327
      val[hwnum    ] = (unsigned char) (value     );
328
#endif
329 19 jeremybenn
 
330 93 jeremybenn
      if (0 != config.ext.write_up (NULL, wordaddr, mask, val, 4))
331
        {
332
          fprintf (stderr, "Warning: external half word write failed.\n");
333
        }
334 19 jeremybenn
    }
335 93 jeremybenn
}       /* generic_write_hw() */
336 19 jeremybenn
 
337
 
338 93 jeremybenn
/* --------------------------------------------------------------------------*/
339
/*!Read a full word from an external device
340
 
341
   Since this is a full word, the result must be converted to host endianess.
342
 
343
   @note We are passed the device address, but we must convert it to a full
344
         address for external use, to allow the single upcall handler to
345
         decode multiple generic devices.
346
 
347
   @param[in] addr  The device address to read from (host endian).
348
   @param[in] dat   The device data structure.
349
 
350
   @return  The full word read (host endian).                                */
351
/* --------------------------------------------------------------------------*/
352 19 jeremybenn
static uint32_t
353 93 jeremybenn
generic_read_word (oraddr_t  addr,
354
                   void     *dat)
355 19 jeremybenn
{
356
  struct dev_generic *dev = (struct dev_generic *) dat;
357
 
358 93 jeremybenn
  if (!config.ext.read_up)
359 19 jeremybenn
    {
360
      fprintf (stderr, "Full word read from disabled generic device\n");
361
      return 0;
362
    }
363
  else if (addr >= dev->size)
364
    {
365
      fprintf (stderr, "Full word read  out of range for generic device %s "
366
               "(addr %" PRIxADDR ")\n", dev->name, addr);
367
      return 0;
368
    }
369
  else if (0 != (addr & 0x3))
370
    {
371
      fprintf (stderr,
372
               "Unaligned full word read from 0x%" PRIxADDR " ignored\n",
373
               addr);
374
      return 0;
375
    }
376
  else
377
    {
378 93 jeremybenn
      unsigned long int  wordaddr = (unsigned long int) (addr + dev->baseaddr);
379 19 jeremybenn
 
380 93 jeremybenn
      unsigned char      mask[4];
381
      unsigned char      res[4];
382
 
383
      /* Set the mask, read and get the result */
384
      memset (mask, 0xff, sizeof (mask));
385
 
386
      if (0 != config.ext.read_up (NULL, wordaddr, mask, res, 4))
387
        {
388
          fprintf (stderr, "Warning: external full word read failed.\n");
389
          return  0;
390
        }
391
 
392
      /* Result converted according to endianess */
393
#ifdef OR32_BIG_ENDIAN
394
      return  (unsigned long int) res[0] << 24 |
395
              (unsigned long int) res[1] << 16 |
396
              (unsigned long int) res[2] <<  8 |
397
              (unsigned long int) res[3];
398
#else
399
      return  (unsigned long int) res[3] << 24 |
400
              (unsigned long int) res[2] << 16 |
401
              (unsigned long int) res[1] <<  8 |
402
              (unsigned long int) res[0];
403
#endif
404 19 jeremybenn
    }
405 93 jeremybenn
}       /* generic_read_word() */
406 19 jeremybenn
 
407
 
408 93 jeremybenn
/* --------------------------------------------------------------------------*/
409
/*!Write a full word to an external device
410
 
411
   Since this is a half word, the value must be converted from host endianess.
412
 
413
   @note We are passed the device address, but we must convert it to a full
414
         address for external use, to allow the single upcall handler to
415
         decode multiple generic devices.
416
 
417
   @param[in] addr  The device address to write to (host endian).
418
   @param[in] value The full word value to write (host endian).
419
   @param[in] dat   The device data structure.                               */
420
/* --------------------------------------------------------------------------*/
421 19 jeremybenn
static void
422 93 jeremybenn
generic_write_word (oraddr_t  addr,
423
                    uint32_t  value,
424
                    void     *dat)
425 19 jeremybenn
{
426
  struct dev_generic *dev = (struct dev_generic *) dat;
427
 
428 93 jeremybenn
  if (!config.ext.write_up)
429 19 jeremybenn
    {
430
      fprintf (stderr, "Full word write to disabled generic device\n");
431
    }
432
  else if (addr >= dev->size)
433
    {
434
      fprintf (stderr, "Full word written  out of range for generic device %s "
435
               "(addr %" PRIxADDR ")\n", dev->name, addr);
436
    }
437
  else if (0 != (addr & 0x3))
438
    {
439
      fprintf (stderr,
440
               "Unaligned full word write to 0x%" PRIxADDR " ignored\n", addr);
441
    }
442
  else
443
    {
444 93 jeremybenn
      unsigned long int  wordaddr = (unsigned long int) (addr + dev->baseaddr);
445 19 jeremybenn
 
446 93 jeremybenn
      unsigned char      mask[4];
447
      unsigned char      val[4];
448
 
449
      /* Set the mask and write data do the write. */
450
      memset (mask, 0xff, sizeof (mask));
451
 
452
      /* Value converted according to endianess */
453
#ifdef OR32_BIG_ENDIAN
454
      val[0] = (unsigned char) (value >> 24);
455
      val[1] = (unsigned char) (value >> 16);
456
      val[2] = (unsigned char) (value >>  8);
457
      val[3] = (unsigned char) (value      );
458
#else
459
      val[3] = (unsigned char) (value >> 24);
460
      val[2] = (unsigned char) (value >> 16);
461
      val[1] = (unsigned char) (value >>  8);
462
      val[0] = (unsigned char) (value      );
463
#endif
464
 
465
      if (0 != config.ext.write_up (NULL, wordaddr, mask, val, 4))
466
        {
467
          fprintf (stderr, "Warning: external full word write failed.\n");
468
        }
469 19 jeremybenn
    }
470 93 jeremybenn
}       /* generic_write_word() */
471 19 jeremybenn
 
472
 
473
/* Reset is a null operation */
474
 
475
static void
476
generic_reset (void *dat)
477
{
478
  return;
479
 
480
}                               /* generic_reset() */
481
 
482
 
483
/* Status report can only advise of configuration. */
484
 
485
static void
486
generic_status (void *dat)
487
{
488
  struct dev_generic *dev = (struct dev_generic *) dat;
489
 
490
  PRINTF ("\nGeneric device \"%s\" at 0x%" PRIxADDR ":\n", dev->name,
491
          dev->baseaddr);
492
  PRINTF ("  Size 0x%" PRIx32 "\n", dev->size);
493
 
494
  if (dev->byte_enabled)
495
    {
496
      PRINTF ("  Byte R/W enabled\n");
497
    }
498
 
499
  if (dev->hw_enabled)
500
    {
501
      PRINTF ("  Half word R/W enabled\n");
502
    }
503
 
504
  if (dev->word_enabled)
505
    {
506
      PRINTF ("  Full word R/W enabled\n");
507
    }
508
 
509
  PRINTF ("\n");
510
 
511
}                               /* generic_status() */
512
 
513
 
514
/* Functions to set configuration */
515
 
516
static void
517
generic_enabled (union param_val val, void *dat)
518
{
519
  ((struct dev_generic *) dat)->enabled = val.int_val;
520
 
521
}                               /* generic_enabled() */
522
 
523
 
524
static void
525
generic_byte_enabled (union param_val val, void *dat)
526
{
527
  ((struct dev_generic *) dat)->byte_enabled = val.int_val;
528
 
529
}                               /* generic_byte_enabled() */
530
 
531
 
532
static void
533
generic_hw_enabled (union param_val val, void *dat)
534
{
535
  ((struct dev_generic *) dat)->hw_enabled = val.int_val;
536
 
537
}                               /* generic_hw_enabled() */
538
 
539
 
540
static void
541
generic_word_enabled (union param_val val, void *dat)
542
{
543
  ((struct dev_generic *) dat)->word_enabled = val.int_val;
544
 
545
}                               /* generic_word_enabled() */
546
 
547
 
548
static void
549
generic_name (union param_val val, void *dat)
550
{
551
  ((struct dev_generic *) dat)->name = strdup (val.str_val);
552
 
553
  if (!((struct dev_generic *) dat)->name)
554
    {
555
      fprintf (stderr, "Peripheral 16450: name \"%s\": Run out of memory\n",
556
               val.str_val);
557
      exit (-1);
558
    }
559
}                               /* generic_name() */
560
 
561
 
562
static void
563
generic_baseaddr (union param_val val, void *dat)
564
{
565
  ((struct dev_generic *) dat)->baseaddr = val.addr_val;
566
 
567
}                               /* generic_baseaddr() */
568
 
569
 
570
static void
571
generic_size (union param_val val, void *dat)
572
{
573
  ((struct dev_generic *) dat)->size = val.int_val;
574
 
575
}                               /* generic_size() */
576
 
577
 
578
/* Start of new generic section */
579
 
580
static void *
581
generic_sec_start ()
582
{
583
  struct dev_generic *new =
584
    (struct dev_generic *) malloc (sizeof (struct dev_generic));
585
 
586
  if (0 == new)
587
    {
588
      fprintf (stderr, "Generic peripheral: Run out of memory\n");
589
      exit (-1);
590
    }
591
 
592
  /* Default names */
593
 
594
  new->enabled = 1;
595
  new->byte_enabled = 1;
596
  new->hw_enabled = 1;
597
  new->word_enabled = 1;
598
  new->name = "anonymous external peripheral";
599
  new->baseaddr = 0;
600
  new->size = 0;
601
 
602
  return new;
603
 
604
}                               /* generic_sec_start() */
605
 
606
 
607
/* End of new generic section */
608
 
609
static void
610
generic_sec_end (void *dat)
611
{
612
  struct dev_generic *generic = (struct dev_generic *) dat;
613
  struct mem_ops ops;
614
 
615
  /* Give up if not enabled, or if size is zero, or if no access size is
616
     enabled. */
617
 
618
  if (!generic->enabled)
619
    {
620
      free (dat);
621
      return;
622
    }
623
 
624
  if (0 == generic->size)
625
    {
626
      fprintf (stderr, "Generic peripheral \"%s\" has size 0: ignoring",
627
               generic->name);
628
      free (dat);
629
      return;
630
    }
631
 
632
  if (!generic->byte_enabled &&
633
      !generic->hw_enabled && !generic->word_enabled)
634
    {
635
      fprintf (stderr, "Generic peripheral \"%s\" has no access: ignoring",
636
               generic->name);
637
      free (dat);
638
      return;
639
    }
640
 
641
  /* Zero all the ops, then set the ones we care about. Read/write delays will
642
   * come from the peripheral if desired.
643
   */
644
 
645
  memset (&ops, 0, sizeof (struct mem_ops));
646
 
647
  if (generic->byte_enabled)
648
    {
649
      ops.readfunc8 = generic_read_byte;
650
      ops.writefunc8 = generic_write_byte;
651
      ops.read_dat8 = dat;
652
      ops.write_dat8 = dat;
653
    }
654
 
655
  if (generic->hw_enabled)
656
    {
657
      ops.readfunc16 = generic_read_hw;
658
      ops.writefunc16 = generic_write_hw;
659
      ops.read_dat16 = dat;
660
      ops.write_dat16 = dat;
661
    }
662
 
663
  if (generic->word_enabled)
664
    {
665
      ops.readfunc32 = generic_read_word;
666
      ops.writefunc32 = generic_write_word;
667
      ops.read_dat32 = dat;
668
      ops.write_dat32 = dat;
669
    }
670
 
671
  /* Register everything */
672
 
673
  reg_mem_area (generic->baseaddr, generic->size, 0, &ops);
674
 
675
  reg_sim_reset (generic_reset, dat);
676
  reg_sim_stat (generic_status, dat);
677
 
678
}                               /* generic_sec_end() */
679
 
680
 
681
/* Register a generic section. */
682
 
683
void
684
reg_generic_sec (void)
685
{
686
  struct config_section *sec = reg_config_sec ("generic",
687
                                               generic_sec_start,
688
                                               generic_sec_end);
689
 
690
  reg_config_param (sec, "enabled", paramt_int, generic_enabled);
691
  reg_config_param (sec, "byte_enabled", paramt_int, generic_byte_enabled);
692
  reg_config_param (sec, "hw_enabled", paramt_int, generic_hw_enabled);
693
  reg_config_param (sec, "word_enabled", paramt_int, generic_word_enabled);
694
  reg_config_param (sec, "name", paramt_str, generic_name);
695
  reg_config_param (sec, "baseaddr", paramt_addr, generic_baseaddr);
696
  reg_config_param (sec, "size", paramt_int, generic_size);
697
 
698
}                               /* reg_generic_sec */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.