diff --git a/README.md b/README.md index 8244817..8ff4245 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ families, including: - :heavy_check_mark: Interrupts - :heavy_check_mark: GPIO AlternateFunction mappings (except F1) - :construction: Register blocks for all peripherals -- :x: DMA stream mappings +- :construction: DMA stream mappings - :x: Per-package pinouts - :heavy_check_mark: Links to applicable reference manuals, datasheets, appnotes PDFs. diff --git a/data/registers/rcc_l0.yaml b/data/registers/rcc_l0.yaml index eb962d2..11c0e42 100644 --- a/data/registers/rcc_l0.yaml +++ b/data/registers/rcc_l0.yaml @@ -593,7 +593,7 @@ fieldset/AHBENR: - bit_offset: 0 bit_size: 1 description: DMA clock enable bit - name: DMAEN + name: DMA1EN - bit_offset: 8 bit_size: 1 description: NVM interface clock enable bit @@ -621,7 +621,7 @@ fieldset/AHBRSTR: bit_size: 1 description: DMA reset enum_write: CRYPRSTW - name: DMARST + name: DMA1RST - bit_offset: 8 bit_size: 1 description: Memory interface reset @@ -653,7 +653,7 @@ fieldset/AHBSMENR: - bit_offset: 0 bit_size: 1 description: DMA clock enable during sleep mode bit - name: DMASMEN + name: DMA1SMEN - bit_offset: 8 bit_size: 1 description: NVM interface clock enable during sleep mode bit diff --git a/parse.py b/parse.py index 8bad457..c487a0b 100755 --- a/parse.py +++ b/parse.py @@ -491,7 +491,15 @@ def parse_chips(): gpio_af = next(filter(lambda x: x['@Name'] == 'GPIO', r['IP']))['@Version'] gpio_af = removesuffix(gpio_af, '_gpio_v1_0') - dma = next(filter(lambda x: x['@Name'] == 'DMA', r['IP']))['@Version'] + dma = next(filter(lambda x: x['@Name'] == 'DMA', r['IP']), None) + bdma = next(filter(lambda x: x['@Name'] == 'BDMA', r['IP']), None) + + if dma is not None: + dma = dma['@Version'] + if bdma is not None: + bdma = bdma['@Version'] + #dma = next(filter(lambda x: x['@Name'] == 'DMA', r['IP']), None)['@Version'] + #bdma = next(filter(lambda x: x['@Name'] == 'BDMA', r['IP']), None)['@Version'] rcc = next(filter(lambda x: x['@Name'] == 'RCC', r['IP']))['@Version'] @@ -532,6 +540,7 @@ def parse_chips(): 'application-notes': [], 'rcc': rcc, # temporarily stashing it here 'dma': dma, # temporarily stashing it here + 'bdma': bdma, # temporarily stashing it here }) chips[chip_name]['packages'].append(OrderedDict({ @@ -606,6 +615,9 @@ def parse_chips(): chip_dma = chip['dma'] del chip['dma'] + chip_bdma = chip['bdma'] + del chip['bdma'] + h = find_header(chip_name) if h is None: raise Exception("missing header for {}".format(chip_name)) @@ -624,8 +636,11 @@ def parse_chips(): defines = h['defines'][core_name] core['interrupts'] = interrupts + core['dma_channels'] = {} if chip_dma in dma_channels: - core['dma_channels'] = dma_channels[chip_dma]['channels'] + core['dma_channels'].update(dma_channels[chip_dma]['channels']) + if chip_bdma in dma_channels: + core['dma_channels'].update(dma_channels[chip_bdma]['channels']) # print("INterrupts for", core, ":", interrupts) #print("Defines for", core, ":", defines) @@ -634,8 +649,6 @@ def parse_chips(): addr = defines.get(pname) if addr is None: if pname == 'ADC_COMMON': - addr = defines.get('ADC_COMMON') - if addr is None: addr = defines.get('ADC1_COMMON') if addr is None: addr = defines.get('ADC12_COMMON') @@ -827,9 +840,12 @@ dma_channels = {} def parse_dma(): - - for f in glob('sources/cubedb/mcu/IP/DMA-*Modes.xml'): - ff = removeprefix(f, 'sources/cubedb/mcu/IP/DMA-') + for f in glob('sources/cubedb/mcu/IP/*DMA-*Modes.xml'): + ff = removeprefix(f, 'sources/cubedb/mcu/IP/') + if not ( ff.startswith('B') or ff.startswith( 'D' ) ): + continue + ff = removeprefix(ff, 'DMA-') + ff = removeprefix(ff, 'BDMA-') ff = removesuffix(ff, '_Modes.xml') r = xmltodict.parse(open(f, 'rb'), force_list={'Mode', 'RefMode'}) @@ -871,14 +887,15 @@ def parse_dma(): request_num += 1 for n in dma_peri_name.split(","): n = n.strip() - if result := re.match('.*' + n + '_Channel\[(\d+)-(\d+)\]', channels[0]['@Name']): - low = int(result.group(1)) - high = int(result.group(2)) + if result := re.match('.*' + n + '_(Channel|Stream)\[(\d+)-(\d+)\]', channels[0]['@Name']): + low = int(result.group(2)) + high = int(result.group(3)) for i in range(low, high+1): chip_dma['channels'][n+'_'+str(i)] = OrderedDict({ 'dma': n, 'channel': i, }) + else: # see if we can scrape out requests requests = {} @@ -976,6 +993,8 @@ def parse_rcc_regs(): if key.startswith("fieldset/A") and key.endswith("ENR"): clock = removesuffix(key, "ENR") clock = removeprefix(clock, "fieldset/") + clock = removesuffix(clock, "L") + clock = removesuffix(clock, "H") for field in body['fields']: if field['name'].endswith('EN'): peri = removesuffix(field['name'], 'EN')