Inter-container suppress rules for devices are now autogenerated.

This commit is contained in:
Bahadir Balban
2009-11-29 14:20:44 +02:00
parent 2d4e64f795
commit fa660514df
4 changed files with 45 additions and 85 deletions

View File

@@ -7,6 +7,7 @@
#
import os, sys, shelve, glob
from os.path import join
from string import Template
PROJRELROOT = '../../'
@@ -34,6 +35,43 @@ def add_container_constraint(cid):
cml_string = containers_constraint % (cid, cid)
return cml_string
device_suppress_rule = \
'''
when CONT${CONTID}_CAP_${DEVNAME}_DEVICE_USE == y suppress
'''
device_suppress_sym = \
'''\tcont${CONTID}_device_${DEVNAME_LOWER}
'''
devices = ['UART1', 'UART2', 'UART3', 'TIMER1']
#
# When a symbol is used by a single container, sometimes it is
# necessary to hide it in other containers. This cannot be
# achieved statically but rather needs to be autogenerated
# depending on the number of containers used.
#
def generate_container_suppress_rules(ncont):
finalstr = ''
# For each device on the platform
for devname in devices:
# Generate rule for each container
for cont in range(ncont):
# Create string templates
rule_templ = Template(device_suppress_rule)
sym_templ = Template(device_suppress_sym)
rulestr = rule_templ.substitute(CONTID = cont, DEVNAME = devname)
symstr = ''
# Fill for each container
for other_cont in range(ncont):
if other_cont == cont:
continue
symstr += sym_templ.substitute(CONTID = other_cont, DEVNAME_LOWER = devname.lower())
finalstr += rulestr + symstr + "\n"
return finalstr
def generate_container_cml(arch, ncont):
print "Autogenerating new rule file"
fbody = ""
@@ -49,6 +87,9 @@ def generate_container_cml(arch, ncont):
for cont in range(ncont):
fbody += '\tcont%d_menu\n' % cont
# Generate inter-container suppression rules for as many rules as containers
fbody += generate_container_suppress_rules(ncont)
# Write each container's rules
for cont in range(ncont):
with open(CML2_CONT_DEFFILE, "rU") as contdefs:

View File

@@ -108,7 +108,7 @@ pager_ifdefs_todotext = \
* TODO:
* This had to be defined this way because in CML2 there
* is no straightforward way to derive symbols from expressions, even
* it is stated in the manual that it can be done.
* if it is stated in the manual that it can be done.
* As a workaround, a ternary expression of (? : ) was tried but this
* complains that type deduction could not be done.
*/'''