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 Wed Feb 15 17:54:51 2012 +1000 (10 years ago)
permissions -rw-r--r--
last change Use GL_TEXTURE_2D instead of GL_TEXTURE_RECTANGLE_ARB for frame buffers, for
systems that don't provide the latter (and there's not really much
difference anyway).
Add macro wrangling for GL_DEPTH24_STENCIL8 format
file annotate diff log raw
nkeynes@1104
     1
/**
nkeynes@1104
     2
 * $Id$
nkeynes@1104
     3
 *
nkeynes@1104
     4
 * mmio register code generator
nkeynes@1104
     5
 *
nkeynes@1104
     6
 * Copyright (c) 2010 Nathan Keynes.
nkeynes@1104
     7
 *
nkeynes@1104
     8
 * This program is free software; you can redistribute it and/or modify
nkeynes@1104
     9
 * it under the terms of the GNU General Public License as published by
nkeynes@1104
    10
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@1104
    11
 * (at your option) any later version.
nkeynes@1104
    12
 *
nkeynes@1104
    13
 * This program is distributed in the hope that it will be useful,
nkeynes@1104
    14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@1104
    15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@1104
    16
 * GNU General Public License for more details.
nkeynes@1104
    17
 */
nkeynes@1104
    18
nkeynes@1104
    19
#ifndef lxdream_genmmio_H
nkeynes@1104
    20
#define lxdream_genmmio_H 1
nkeynes@1104
    21
nkeynes@1104
    22
#include <stdint.h>
nkeynes@1104
    23
#include <glib/glist.h>
nkeynes@1104
    24
nkeynes@1104
    25
#ifdef __cplusplus
nkeynes@1104
    26
extern "C" {
nkeynes@1104
    27
#endif
nkeynes@1104
    28
nkeynes@1104
    29
typedef enum {
nkeynes@1104
    30
    REG_CONST,
nkeynes@1104
    31
    REG_RW,
nkeynes@1104
    32
    REG_RO,
nkeynes@1104
    33
    REG_WO,
nkeynes@1104
    34
    REG_MIRROR, /* Additional address for an existing register - value is the offset of the target reg */
nkeynes@1104
    35
} register_mode_t;
nkeynes@1104
    36
nkeynes@1104
    37
typedef enum {
nkeynes@1104
    38
    REG_I8,
nkeynes@1104
    39
    REG_I16,
nkeynes@1104
    40
    REG_I32,
nkeynes@1104
    41
    REG_I64,
nkeynes@1104
    42
    REG_F32,
nkeynes@1104
    43
    REG_F64,
nkeynes@1104
    44
    REG_STRING,
nkeynes@1104
    45
} register_type_t;
nkeynes@1104
    46
nkeynes@1104
    47
typedef enum {
nkeynes@1104
    48
    ENDIAN_DEFAULT,
nkeynes@1104
    49
    ENDIAN_LITTLE,
nkeynes@1104
    50
    ENDIAN_BIG
nkeynes@1104
    51
} register_endian_t;
nkeynes@1104
    52
nkeynes@1104
    53
typedef enum {
nkeynes@1104
    54
    ACCESS_DEFAULT,
nkeynes@1104
    55
    ACCESS_ANY,
nkeynes@1104
    56
    ACCESS_NOOFFSET,
nkeynes@1104
    57
    ACCESS_EXACT
nkeynes@1104
    58
} register_access_t;
nkeynes@1104
    59
nkeynes@1104
    60
typedef enum {
nkeynes@1104
    61
    TRACE_DEFAULT,
nkeynes@1104
    62
    TRACE_NEVER,
nkeynes@1104
    63
    TRACE_ALWAYS
nkeynes@1104
    64
} register_trace_t;
nkeynes@1104
    65
nkeynes@1104
    66
typedef enum {
nkeynes@1104
    67
    TEST_DEFAULT,
nkeynes@1104
    68
    TEST_OFF,
nkeynes@1104
    69
    TEST_ON
nkeynes@1104
    70
} register_test_t;
nkeynes@1104
    71
nkeynes@1104
    72
union apval {
nkeynes@1104
    73
    uint64_t i;
nkeynes@1104
    74
    char a[8];
nkeynes@1104
    75
    const char *s;
nkeynes@1104
    76
};
nkeynes@1104
    77
nkeynes@1104
    78
struct action {
nkeynes@1104
    79
    const char *filename;
nkeynes@1104
    80
    int lineno;
nkeynes@1104
    81
    const char *text;
nkeynes@1104
    82
};
nkeynes@1104
    83
nkeynes@1104
    84
typedef struct regflags {
nkeynes@1104
    85
    register_endian_t endian;
nkeynes@1104
    86
    register_access_t access;
nkeynes@1104
    87
    register_trace_t traceFlag;
nkeynes@1104
    88
    register_test_t testFlag;
nkeynes@1104
    89
    union apval maskValue;
nkeynes@1104
    90
    unsigned int fillSizeBytes;
nkeynes@1104
    91
    union apval fillValue;
nkeynes@1104
    92
} *regflags_t;
nkeynes@1104
    93
nkeynes@1104
    94
typedef struct regdef {
nkeynes@1104
    95
    const char *name;
nkeynes@1104
    96
    const char *description;
nkeynes@1104
    97
    uint32_t offset;
nkeynes@1104
    98
    unsigned numBytes;
nkeynes@1104
    99
    unsigned numElements;
nkeynes@1104
   100
    unsigned stride;
nkeynes@1104
   101
    register_mode_t mode;
nkeynes@1104
   102
    register_type_t type;
nkeynes@1104
   103
    gboolean initUndefined;
nkeynes@1104
   104
    union apval initValue;
nkeynes@1104
   105
    struct regflags flags;
nkeynes@1104
   106
    struct action *action;
nkeynes@1104
   107
} *regdef_t;
nkeynes@1104
   108
nkeynes@1104
   109
typedef struct regblock {
nkeynes@1104
   110
    const char *name;
nkeynes@1104
   111
    const char *description;
nkeynes@1104
   112
    uint32_t address;
nkeynes@1104
   113
    struct regflags flags;
nkeynes@1104
   114
    unsigned numRegs;
nkeynes@1104
   115
    unsigned blockSize;
nkeynes@1104
   116
    regdef_t regs[];
nkeynes@1104
   117
} *regblock_t;
nkeynes@1104
   118
nkeynes@1104
   119
nkeynes@1104
   120
nkeynes@1104
   121
GList *ioparse( const char *filename, GList *list );
nkeynes@1104
   122
nkeynes@1104
   123
#ifdef __cplusplus
nkeynes@1104
   124
}
nkeynes@1104
   125
#endif
nkeynes@1104
   126
nkeynes@1104
   127
#endif /* !lxdream_genmmio_H */
.