Beispiel #1
0
def process(mainfile):
    db = rnn.Database()
    rnn.parsefile(db, mainfile)
    db.prep()

    for file in db.files:
        fouts[file] = open(file.replace('/', '_') + '.h', 'w')
        printhead(file, db)

    for enum in db.enums:
        if not enum.inline:
            for val in enum.vals:
                printvalue(val, 0)

    for bitset in db.bitsets:
        if not bitset.inline:
            for bitfield in bitset.bitfields:
                printbitfield(bitfield, 0)

    for domain in db.domains:
        if domain.size:
            printdef(domain.fullname + "__SIZE", hex(domain.size), domain.file)
        for elem in domain.elems:
            printdelem(elem, 0, [])

    for file in fouts:
        fouts[file].write("\n#endif /* {} */\n".format(guard(file)))
        fouts[file].close()

    return db.estatus
Beispiel #2
0
def process(mainfile):
    db = rnn.Database()
    rnn.parsefile(db, mainfile)
    db.prep()

    for file in db.files:
        fouts[file] = open(file.replace('/', '_') + '.h', 'w')
        printhead(file, db)

    for enum in db.enums:
        if not enum.inline:
            for val in enum.vals:
                printvalue(val, 0)

    for bitset in db.bitsets:
        if not bitset.inline:
            for bitfield in bitset.bitfields:
                printbitfield(bitfield, 0)

    for domain in db.domains:
        if domain.size:
            printdef(domain.fullname + "__SIZE", hex(domain.size), domain.file)
        for elem in domain.elems:
            printdelem(elem, 0, [])

    for file in fouts:
        fouts[file].write("\n#endif /* {} */\n".format(guard(file)))
        fouts[file].close()

    return db.estatus
Beispiel #3
0
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import sys
import rnn

if len(sys.argv) < 2:
	sys.stdout.write ("Usage:\n"
			"\trnncheck file.xml\n"
		)
	sys.exit(2)

db = rnn.Database()
rnn.parsefile(db, sys.argv[1])
db.prep()
sys.exit(db.estatus)
Beispiel #4
0
                    default=colors.term)
select = parser.add_mutually_exclusive_group()
select.add_argument('-d', '--domain', default='NV_MMIO')
select.add_argument('-e', '--enum')
select.add_argument('-b', '--bitset')
parser.add_argument('-w', '--write', action='store_true', default=False)
parser.add_argument('-v', '--variant', nargs=2, action='append', default=[])
parser.add_argument('address', type=aint, help="Address to be looked up")
parser.add_argument('value',
                    type=aint,
                    nargs='?',
                    help="Value to be looked up")
args = parser.parse_args()

db = rnn.Database()
rnn.parsefile(db, args.file)
db.prep()

vc = rnndec.Context(db, args.colors)
if args.chipset is not None:
    vc.varadd('chipset', args.chipset)
for varset, variant in args.variant:
    vc.varadd(varset, variant)

if args.enum:
    en = db.findenum(args.enum)
    if not en:
        sys.stderr.write("Not an enum: '{}'\n".format(args.enum))
        sys.exit(1)
    print(vc.decodeval(en, args.address, None))
elif args.bitset:
Beispiel #5
0
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import sys
import rnn

if len(sys.argv) < 2:
    sys.stdout.write("Usage:\n" "\trnncheck file.xml\n")
    sys.exit(2)

db = rnn.Database()
rnn.parsefile(db, sys.argv[1])
db.prep()
sys.exit(db.estatus)
Beispiel #6
0
parser = argparse.ArgumentParser(description="rnn database lookup.")
parser.add_argument('-f', '--file', default='root.xml')
parser.add_argument('-a', '--chipset')
parser.add_argument('-c', '--nocolor', action='store_const', const=colors.null, dest='colors', default=colors.term)
select = parser.add_mutually_exclusive_group()
select.add_argument('-d', '--domain', default='NV_MMIO')
select.add_argument('-e', '--enum')
select.add_argument('-b', '--bitset')
parser.add_argument('-w', '--write', action='store_true', default=False)
parser.add_argument('-v', '--variant', nargs=2, action='append', default=[])
parser.add_argument('address', type=aint, help="Address to be looked up")
parser.add_argument('value', type=aint, nargs='?', help="Value to be looked up")
args = parser.parse_args()

db = rnn.Database()
rnn.parsefile(db, args.file)
db.prep()

vc = rnndec.Context(db, args.colors)
if args.chipset is not None:
    vc.varadd('chipset', args.chipset)
for varset, variant in args.variant:
    vc.varadd(varset, variant)

if args.enum:
    en = db.findenum(args.enum)
    if not en:
        sys.stderr.write("Not an enum: '{}'\n".format(args.enum))
        sys.exit(1)
    print(vc.decodeval(en, args.address, None))
elif args.bitset: