Search
lxdream.org :: lxdream/src/tools/genmach.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/tools/genmach.h
changeset 1104:700e16c321e5
next1296:30ecee61f811
author nkeynes
date Sat Mar 03 15:52:59 2012 +1000 (10 years ago)
permissions -rw-r--r--
last change Swap between run + pause icons when pressed
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/tools/genmach.h Sat Mar 03 15:52:59 2012 +1000
1.3 @@ -0,0 +1,127 @@
1.4 +/**
1.5 + * $Id$
1.6 + *
1.7 + * mmio register code generator
1.8 + *
1.9 + * Copyright (c) 2010 Nathan Keynes.
1.10 + *
1.11 + * This program is free software; you can redistribute it and/or modify
1.12 + * it under the terms of the GNU General Public License as published by
1.13 + * the Free Software Foundation; either version 2 of the License, or
1.14 + * (at your option) any later version.
1.15 + *
1.16 + * This program is distributed in the hope that it will be useful,
1.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.19 + * GNU General Public License for more details.
1.20 + */
1.21 +
1.22 +#ifndef lxdream_genmmio_H
1.23 +#define lxdream_genmmio_H 1
1.24 +
1.25 +#include <stdint.h>
1.26 +#include <glib/glist.h>
1.27 +
1.28 +#ifdef __cplusplus
1.29 +extern "C" {
1.30 +#endif
1.31 +
1.32 +typedef enum {
1.33 + REG_CONST,
1.34 + REG_RW,
1.35 + REG_RO,
1.36 + REG_WO,
1.37 + REG_MIRROR, /* Additional address for an existing register - value is the offset of the target reg */
1.38 +} register_mode_t;
1.39 +
1.40 +typedef enum {
1.41 + REG_I8,
1.42 + REG_I16,
1.43 + REG_I32,
1.44 + REG_I64,
1.45 + REG_F32,
1.46 + REG_F64,
1.47 + REG_STRING,
1.48 +} register_type_t;
1.49 +
1.50 +typedef enum {
1.51 + ENDIAN_DEFAULT,
1.52 + ENDIAN_LITTLE,
1.53 + ENDIAN_BIG
1.54 +} register_endian_t;
1.55 +
1.56 +typedef enum {
1.57 + ACCESS_DEFAULT,
1.58 + ACCESS_ANY,
1.59 + ACCESS_NOOFFSET,
1.60 + ACCESS_EXACT
1.61 +} register_access_t;
1.62 +
1.63 +typedef enum {
1.64 + TRACE_DEFAULT,
1.65 + TRACE_NEVER,
1.66 + TRACE_ALWAYS
1.67 +} register_trace_t;
1.68 +
1.69 +typedef enum {
1.70 + TEST_DEFAULT,
1.71 + TEST_OFF,
1.72 + TEST_ON
1.73 +} register_test_t;
1.74 +
1.75 +union apval {
1.76 + uint64_t i;
1.77 + char a[8];
1.78 + const char *s;
1.79 +};
1.80 +
1.81 +struct action {
1.82 + const char *filename;
1.83 + int lineno;
1.84 + const char *text;
1.85 +};
1.86 +
1.87 +typedef struct regflags {
1.88 + register_endian_t endian;
1.89 + register_access_t access;
1.90 + register_trace_t traceFlag;
1.91 + register_test_t testFlag;
1.92 + union apval maskValue;
1.93 + unsigned int fillSizeBytes;
1.94 + union apval fillValue;
1.95 +} *regflags_t;
1.96 +
1.97 +typedef struct regdef {
1.98 + const char *name;
1.99 + const char *description;
1.100 + uint32_t offset;
1.101 + unsigned numBytes;
1.102 + unsigned numElements;
1.103 + unsigned stride;
1.104 + register_mode_t mode;
1.105 + register_type_t type;
1.106 + gboolean initUndefined;
1.107 + union apval initValue;
1.108 + struct regflags flags;
1.109 + struct action *action;
1.110 +} *regdef_t;
1.111 +
1.112 +typedef struct regblock {
1.113 + const char *name;
1.114 + const char *description;
1.115 + uint32_t address;
1.116 + struct regflags flags;
1.117 + unsigned numRegs;
1.118 + unsigned blockSize;
1.119 + regdef_t regs[];
1.120 +} *regblock_t;
1.121 +
1.122 +
1.123 +
1.124 +GList *ioparse( const char *filename, GList *list );
1.125 +
1.126 +#ifdef __cplusplus
1.127 +}
1.128 +#endif
1.129 +
1.130 +#endif /* !lxdream_genmmio_H */
.