Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions drivers/usb/udc/udc_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ struct udc_stm32_data {

struct udc_stm32_config {
uint32_t num_endpoints;
uint32_t pma_offset;
uint32_t dram_size;
uint16_t ep_mps;
/* PHY selected for use by instance */
Expand Down Expand Up @@ -608,7 +607,12 @@ static inline void udc_stm32_mem_init(const struct device *dev)
struct udc_stm32_data *priv = udc_get_private(dev);
const struct udc_stm32_config *cfg = dev->config;

priv->occupied_mem = cfg->pma_offset;
/**
* Endpoint configuration table is placed at the
* beginning of Private Memory Area and consumes
* 8 bytes for each endpoint.
*/
priv->occupied_mem = (8 * cfg->num_endpoints);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicking: could drop parentheses.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, copy-paste artifact from expanding USB_BTABLE_SIZE = (8 * USB_NUM_BIDIR_ENDPOINTS).

}

static int udc_stm32_ep_mem_config(const struct device *dev,
Expand Down Expand Up @@ -1074,7 +1078,6 @@ static const struct udc_api udc_stm32_api = {

#if defined(USB) || defined(USB_DRD_FS)
#define EP_MPS 64U
#define USB_BTABLE_SIZE (8 * USB_NUM_BIDIR_ENDPOINTS)
#define USB_RAM_SIZE DT_INST_PROP(0, ram_size)
#else /* USB_OTG_FS */
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otghs)
Expand All @@ -1083,7 +1086,6 @@ static const struct udc_api udc_stm32_api = {
#define EP_MPS USB_OTG_FS_MAX_PACKET_SIZE
#endif
#define USB_RAM_SIZE DT_INST_PROP(0, ram_size)
#define USB_BTABLE_SIZE 0
#endif /* USB */

static struct udc_stm32_data udc0_priv;
Expand All @@ -1096,7 +1098,6 @@ static struct udc_data udc0_data = {
static const struct udc_stm32_config udc0_cfg = {
.num_endpoints = USB_NUM_BIDIR_ENDPOINTS,
.dram_size = USB_RAM_SIZE,
.pma_offset = USB_BTABLE_SIZE,
.ep_mps = EP_MPS,
.selected_phy = UDC_STM32_NODE_PHY_ITFACE(DT_DRV_INST(0)),
.selected_speed = UDC_STM32_NODE_SPEED(DT_DRV_INST(0)),
Expand Down