Skip to content

Poor design practise - dcd_stm32_fsdev.c - duplicate potentially inconsistent initialisation of ep_buf_ptr. #3309

@HattonLe

Description

@HattonLe

Operating System

Linux

Commit SHA

no idea

Board

STM32F103 Bluepill

Firmware

Working on a custom implementation of "examples/device/cdc_dual_ports", I found an coding inconsistency.

What happened ?

In "src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c"

Two different initialisations of "ep_buf_ptr" variable defined in handle_bus_reset() and dcd_edpt_close_all().

static void handle_bus_reset(uint8_t rhport)
// Reset PMA allocation
ep_buf_ptr = FSDEV_BTABLE_BASE + 8 * FSDEV_EP_COUNT;

void dcd_edpt_close_all(uint8_t rhport)
// Reset PMA allocation
ep_buf_ptr = FSDEV_BTABLE_BASE + 8 * CFG_TUD_ENDPPOINT_MAX + 2 * CFG_TUD_ENDPOINT0_SIZE;

How to reproduce ?

Code just needs rejigging so you reuse the initialisation code (which ever one is the correct one).

Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)

Not required.

Screenshots

No response

I have checked existing issues, discussion and documentation

  • I confirm I have checked existing issues, discussion and documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions