mirror of
https://github.com/drasko/codezero.git
synced 2026-03-02 18:43:16 +01:00
Inter-container suppress rules for devices are now autogenerated.
This commit is contained in:
@@ -216,6 +216,8 @@ menu cont%(cn)d_physmem_list
|
|||||||
#
|
#
|
||||||
# Device menu and options per container
|
# Device menu and options per container
|
||||||
#
|
#
|
||||||
|
# FIXME: All this is to be moved to a per-platform description file.
|
||||||
|
#
|
||||||
symbols
|
symbols
|
||||||
cont%(cn)d_device_uart1 'Container %(cn)d UART1 Menu'
|
cont%(cn)d_device_uart1 'Container %(cn)d UART1 Menu'
|
||||||
cont%(cn)d_device_uart2 'Container %(cn)d UART2 Menu'
|
cont%(cn)d_device_uart2 'Container %(cn)d UART2 Menu'
|
||||||
@@ -232,89 +234,6 @@ default CONT%(cn)d_CAP_UART2_DEVICE_USE from n
|
|||||||
default CONT%(cn)d_CAP_UART3_DEVICE_USE from n
|
default CONT%(cn)d_CAP_UART3_DEVICE_USE from n
|
||||||
default CONT%(cn)d_CAP_TIMER1_DEVICE_USE from n
|
default CONT%(cn)d_CAP_TIMER1_DEVICE_USE from n
|
||||||
|
|
||||||
# Note: We are suppressing the menu not symbol here, as in future
|
|
||||||
# we will add new parameters to menu, so suprpressing each symbol
|
|
||||||
# will be cumbersome
|
|
||||||
when CONT0_CAP_UART1_DEVICE_USE == y suppress
|
|
||||||
cont1_device_uart1
|
|
||||||
cont2_device_uart1
|
|
||||||
cont3_device_uart1
|
|
||||||
|
|
||||||
when CONT1_CAP_UART1_DEVICE_USE == y suppress
|
|
||||||
cont0_device_uart1
|
|
||||||
cont2_device_uart1
|
|
||||||
cont3_device_uart1
|
|
||||||
|
|
||||||
when CONT2_CAP_UART1_DEVICE_USE == y suppress
|
|
||||||
cont0_device_uart1
|
|
||||||
cont1_device_uart1
|
|
||||||
cont3_device_uart1
|
|
||||||
|
|
||||||
when CONT3_CAP_UART1_DEVICE_USE == y suppress
|
|
||||||
cont0_device_uart1
|
|
||||||
cont1_device_uart1
|
|
||||||
cont2_device_uart1
|
|
||||||
|
|
||||||
when CONT0_CAP_UART2_DEVICE_USE == y suppress
|
|
||||||
cont1_device_uart2
|
|
||||||
cont2_device_uart2
|
|
||||||
cont3_device_uart2
|
|
||||||
|
|
||||||
when CONT1_CAP_UART2_DEVICE_USE == y suppress
|
|
||||||
cont0_device_uart2
|
|
||||||
cont2_device_uart2
|
|
||||||
cont3_device_uart2
|
|
||||||
|
|
||||||
when CONT2_CAP_UART2_DEVICE_USE == y suppress
|
|
||||||
cont0_device_uart2
|
|
||||||
cont1_device_uart2
|
|
||||||
cont2_device_uart2
|
|
||||||
|
|
||||||
when CONT3_CAP_UART2_DEVICE_USE == y suppress
|
|
||||||
cont0_device_uart2
|
|
||||||
cont1_device_uart2
|
|
||||||
cont2_device_uart2
|
|
||||||
|
|
||||||
when CONT0_CAP_UART3_DEVICE_USE == y suppress
|
|
||||||
cont1_device_uart3
|
|
||||||
cont2_device_uart3
|
|
||||||
cont3_device_uart3
|
|
||||||
|
|
||||||
when CONT1_CAP_UART3_DEVICE_USE == y suppress
|
|
||||||
cont0_device_uart3
|
|
||||||
cont2_device_uart3
|
|
||||||
cont3_device_uart3
|
|
||||||
|
|
||||||
when CONT2_CAP_UART3_DEVICE_USE == y suppress
|
|
||||||
cont0_device_uart3
|
|
||||||
cont1_device_uart3
|
|
||||||
cont3_device_uart3
|
|
||||||
|
|
||||||
when CONT3_CAP_UART3_DEVICE_USE == y suppress
|
|
||||||
cont0_device_uart3
|
|
||||||
cont1_device_uart3
|
|
||||||
cont2_device_uart3
|
|
||||||
|
|
||||||
when CONT0_CAP_TIMER1_DEVICE_USE == y suppress
|
|
||||||
cont1_device_timer1
|
|
||||||
cont2_device_timer1
|
|
||||||
cont3_device_timer1
|
|
||||||
|
|
||||||
when CONT1_CAP_TIMER1_DEVICE_USE == y suppress
|
|
||||||
cont0_device_timer1
|
|
||||||
cont2_device_timer1
|
|
||||||
cont3_device_timer1
|
|
||||||
|
|
||||||
when CONT2_CAP_TIMER1_DEVICE_USE == y suppress
|
|
||||||
cont0_device_timer1
|
|
||||||
cont1_device_timer1
|
|
||||||
cont3_device_timer1
|
|
||||||
|
|
||||||
when CONT3_CAP_TIMER1_DEVICE_USE == y suppress
|
|
||||||
cont0_device_timer1
|
|
||||||
cont1_device_timer1
|
|
||||||
cont2_device_timer1
|
|
||||||
|
|
||||||
menu cont%(cn)d_device_uart1
|
menu cont%(cn)d_device_uart1
|
||||||
CONT%(cn)d_CAP_UART1_DEVICE_USE
|
CONT%(cn)d_CAP_UART1_DEVICE_USE
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#
|
#
|
||||||
import os, sys, shelve, glob
|
import os, sys, shelve, glob
|
||||||
from os.path import join
|
from os.path import join
|
||||||
|
from string import Template
|
||||||
|
|
||||||
PROJRELROOT = '../../'
|
PROJRELROOT = '../../'
|
||||||
|
|
||||||
@@ -34,6 +35,43 @@ def add_container_constraint(cid):
|
|||||||
cml_string = containers_constraint % (cid, cid)
|
cml_string = containers_constraint % (cid, cid)
|
||||||
return cml_string
|
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):
|
def generate_container_cml(arch, ncont):
|
||||||
print "Autogenerating new rule file"
|
print "Autogenerating new rule file"
|
||||||
fbody = ""
|
fbody = ""
|
||||||
@@ -49,6 +87,9 @@ def generate_container_cml(arch, ncont):
|
|||||||
for cont in range(ncont):
|
for cont in range(ncont):
|
||||||
fbody += '\tcont%d_menu\n' % cont
|
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
|
# Write each container's rules
|
||||||
for cont in range(ncont):
|
for cont in range(ncont):
|
||||||
with open(CML2_CONT_DEFFILE, "rU") as contdefs:
|
with open(CML2_CONT_DEFFILE, "rU") as contdefs:
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ pager_ifdefs_todotext = \
|
|||||||
* TODO:
|
* TODO:
|
||||||
* This had to be defined this way because in CML2 there
|
* This had to be defined this way because in CML2 there
|
||||||
* is no straightforward way to derive symbols from expressions, even
|
* 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
|
* As a workaround, a ternary expression of (? : ) was tried but this
|
||||||
* complains that type deduction could not be done.
|
* complains that type deduction could not be done.
|
||||||
*/'''
|
*/'''
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include <l4/api/thread.h>
|
#include <l4/api/thread.h>
|
||||||
#include <l4/api/exregs.h>
|
#include <l4/api/exregs.h>
|
||||||
#include <l4/api/ipc.h>
|
#include <l4/api/ipc.h>
|
||||||
//#include <l4/api/irq.h>
|
#include <l4/api/irq.h>
|
||||||
#include INC_GLUE(message.h)
|
#include INC_GLUE(message.h)
|
||||||
#include INC_GLUE(ipc.h)
|
#include INC_GLUE(ipc.h)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user