Search
lxdream.org :: lxdream/src/tools/genmach.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/tools/genmach.h
changeset 1104:700e16c321e5
next1296:30ecee61f811
author nkeynes
date Tue Feb 07 11:20:00 2012 +1000 (12 years ago)
permissions -rw-r--r--
last change Gen helper functions for uniform + attribute variables, along with the main
program use, to provide a more usable interface to the shaders
view annotate diff log raw
     1 /**
     2  * $Id$
     3  *
     4  * mmio register code generator
     5  *
     6  * Copyright (c) 2010 Nathan Keynes.
     7  *
     8  * This program is free software; you can redistribute it and/or modify
     9  * it under the terms of the GNU General Public License as published by
    10  * the Free Software Foundation; either version 2 of the License, or
    11  * (at your option) any later version.
    12  *
    13  * This program is distributed in the hope that it will be useful,
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  * GNU General Public License for more details.
    17  */
    19 #ifndef lxdream_genmmio_H
    20 #define lxdream_genmmio_H 1
    22 #include <stdint.h>
    23 #include <glib/glist.h>
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    29 typedef enum {
    30     REG_CONST,
    31     REG_RW,
    32     REG_RO,
    33     REG_WO,
    34     REG_MIRROR, /* Additional address for an existing register - value is the offset of the target reg */
    35 } register_mode_t;
    37 typedef enum {
    38     REG_I8,
    39     REG_I16,
    40     REG_I32,
    41     REG_I64,
    42     REG_F32,
    43     REG_F64,
    44     REG_STRING,
    45 } register_type_t;
    47 typedef enum {
    48     ENDIAN_DEFAULT,
    49     ENDIAN_LITTLE,
    50     ENDIAN_BIG
    51 } register_endian_t;
    53 typedef enum {
    54     ACCESS_DEFAULT,
    55     ACCESS_ANY,
    56     ACCESS_NOOFFSET,
    57     ACCESS_EXACT
    58 } register_access_t;
    60 typedef enum {
    61     TRACE_DEFAULT,
    62     TRACE_NEVER,
    63     TRACE_ALWAYS
    64 } register_trace_t;
    66 typedef enum {
    67     TEST_DEFAULT,
    68     TEST_OFF,
    69     TEST_ON
    70 } register_test_t;
    72 union apval {
    73     uint64_t i;
    74     char a[8];
    75     const char *s;
    76 };
    78 struct action {
    79     const char *filename;
    80     int lineno;
    81     const char *text;
    82 };
    84 typedef struct regflags {
    85     register_endian_t endian;
    86     register_access_t access;
    87     register_trace_t traceFlag;
    88     register_test_t testFlag;
    89     union apval maskValue;
    90     unsigned int fillSizeBytes;
    91     union apval fillValue;
    92 } *regflags_t;
    94 typedef struct regdef {
    95     const char *name;
    96     const char *description;
    97     uint32_t offset;
    98     unsigned numBytes;
    99     unsigned numElements;
   100     unsigned stride;
   101     register_mode_t mode;
   102     register_type_t type;
   103     gboolean initUndefined;
   104     union apval initValue;
   105     struct regflags flags;
   106     struct action *action;
   107 } *regdef_t;
   109 typedef struct regblock {
   110     const char *name;
   111     const char *description;
   112     uint32_t address;
   113     struct regflags flags;
   114     unsigned numRegs;
   115     unsigned blockSize;
   116     regdef_t regs[];
   117 } *regblock_t;
   121 GList *ioparse( const char *filename, GList *list );
   123 #ifdef __cplusplus
   124 }
   125 #endif
   127 #endif /* !lxdream_genmmio_H */
.