HAL_ChibiOS: added NODMA option

this allows a peripheral to be configured without DMA (for low-use
UARTs)
This commit is contained in:
Andrew Tridgell 2018-02-06 18:20:09 +11:00
parent 74f4d5a3c9
commit ad5a04fc89
2 changed files with 16 additions and 2 deletions

View File

@ -699,6 +699,16 @@ def write_peripheral_enable(f):
if type.startswith('I2C'):
f.write('#define STM32_I2C_USE_%s TRUE\n' % type)
def get_dma_exclude(periph_list):
'''return list of DMA devices to exclude from DMA'''
dma_exclude = []
for periph in periph_list:
if periph not in bylabel:
continue
p = bylabel[periph]
if p.has_extra('NODMA'):
dma_exclude.append(periph)
return dma_exclude
def write_hwdef_header(outfilename):
'''write hwdef header file'''
@ -724,7 +734,7 @@ def write_hwdef_header(outfilename):
write_peripheral_enable(f)
write_prototype_file()
dma_resolver.write_dma_header(f, periph_list, mcu_type)
dma_resolver.write_dma_header(f, periph_list, mcu_type, dma_exclude=get_dma_exclude(periph_list))
write_UART_config(f)
@ -900,3 +910,4 @@ write_hwdef_header(os.path.join(outdir, "hwdef.h"))
# write out ldscript.ld
write_ldscript(os.path.join(outdir, "ldscript.ld"))

View File

@ -68,7 +68,7 @@ def chibios_dma_define_name(key):
sys.exit(1)
def write_dma_header(f, peripheral_list, mcu_type):
def write_dma_header(f, peripheral_list, mcu_type, dma_exclude=[]):
'''write out a DMA resolver header file'''
global dma_map
try:
@ -83,6 +83,8 @@ def write_dma_header(f, peripheral_list, mcu_type):
curr_dict = {}
for periph in peripheral_list:
if periph in dma_exclude:
continue
assigned = False
check_list = []
if not periph in dma_map:
@ -195,3 +197,4 @@ if __name__ == '__main__':
f = open("dma.h", "w")
write_dma_header(f, plist, mcu_type)