usb: device_next: rename usbd_class_node to usb_class_data
Since only usbd_class_node contains the class instance data, rename it
to usbd_class_data.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
diff --git a/include/zephyr/usb/usbd.h b/include/zephyr/usb/usbd.h
index b97ecc8..fddffc0 100644
--- a/include/zephyr/usb/usbd.h
+++ b/include/zephyr/usb/usbd.h
@@ -213,64 +213,64 @@
/** USB Class instance registered flag */
#define USBD_CCTX_REGISTERED 0
-struct usbd_class_node;
+struct usbd_class_data;
/**
* @brief USB device support class instance API
*/
struct usbd_class_api {
/** Feature halt state update handler */
- void (*feature_halt)(struct usbd_class_node *const node,
+ void (*feature_halt)(struct usbd_class_data *const c_data,
uint8_t ep, bool halted);
/** Configuration update handler */
- void (*update)(struct usbd_class_node *const node,
+ void (*update)(struct usbd_class_data *const c_data,
uint8_t iface, uint8_t alternate);
/** USB control request handler to device */
- int (*control_to_dev)(struct usbd_class_node *const node,
+ int (*control_to_dev)(struct usbd_class_data *const c_data,
const struct usb_setup_packet *const setup,
const struct net_buf *const buf);
/** USB control request handler to host */
- int (*control_to_host)(struct usbd_class_node *const node,
+ int (*control_to_host)(struct usbd_class_data *const c_data,
const struct usb_setup_packet *const setup,
struct net_buf *const buf);
/** Endpoint request completion event handler */
- int (*request)(struct usbd_class_node *const node,
+ int (*request)(struct usbd_class_data *const c_data,
struct net_buf *buf, int err);
/** USB power management handler suspended */
- void (*suspended)(struct usbd_class_node *const node);
+ void (*suspended)(struct usbd_class_data *const c_data);
/** USB power management handler resumed */
- void (*resumed)(struct usbd_class_node *const node);
+ void (*resumed)(struct usbd_class_data *const c_data);
/** Start of Frame */
- void (*sof)(struct usbd_class_node *const node);
+ void (*sof)(struct usbd_class_data *const c_data);
/** Class associated configuration is selected */
- void (*enable)(struct usbd_class_node *const node);
+ void (*enable)(struct usbd_class_data *const c_data);
/** Class associated configuration is disabled */
- void (*disable)(struct usbd_class_node *const node);
+ void (*disable)(struct usbd_class_data *const c_data);
/** Initialization of the class implementation */
- int (*init)(struct usbd_class_node *const node);
+ int (*init)(struct usbd_class_data *const c_data);
/** Shutdown of the class implementation */
- void (*shutdown)(struct usbd_class_node *const node);
+ void (*shutdown)(struct usbd_class_data *const c_data);
/** Get function descriptor based on speed parameter */
- void *(*get_desc)(struct usbd_class_node *const node,
+ void *(*get_desc)(struct usbd_class_data *const c_data,
const enum usbd_speed speed);
};
/**
* @brief USB device support class data
*/
-struct usbd_class_node {
+struct usbd_class_data {
/** Name of the USB device class instance */
const char *name;
/** Pointer to USB device stack context structure */
@@ -288,14 +288,14 @@
*
* Variables necessary for per speed class management. For each speed (Full,
* High) there is separate `struct usbd_class_iter` pointing to the same
- * `struct usbd_class_node` (because the class can only operate at one speed
+ * `struct usbd_class_data` (because the class can only operate at one speed
* at a time).
*/
struct usbd_class_iter {
/** Node information for the slist. */
sys_snode_t node;
/** Pointer to public class node instance. */
- struct usbd_class_node *const c_nd;
+ struct usbd_class_data *const c_data;
/** Bitmap of all endpoints assigned to the instance.
* The IN endpoints are mapped in the upper halfword.
*/
@@ -318,13 +318,13 @@
* The class implementation must use this function and not access the members
* of the struct directly.
*
- * @param[in] node Pointer to USB device class node
+ * @param[in] c_data Pointer to USB device class data
*
* @return Pointer to USB device runtime context
*/
-static inline struct usbd_contex *usbd_class_get_ctx(const struct usbd_class_node *const c_nd)
+static inline struct usbd_contex *usbd_class_get_ctx(const struct usbd_class_data *const c_data)
{
- return c_nd->uds_ctx;
+ return c_data->uds_ctx;
}
/**
@@ -333,13 +333,13 @@
* The class implementation must use this function and not access the members
* of the struct directly.
*
- * @param[in] node Pointer to USB device class node
+ * @param[in] c_data Pointer to USB device class data
*
* @return Pointer to class implementation private data
*/
-static inline void *usbd_class_get_private(const struct usbd_class_node *const c_nd)
+static inline void *usbd_class_get_private(const struct usbd_class_data *const c_data)
{
- return c_nd->priv;
+ return c_data->priv;
}
#define USBD_DEVICE_DEFINE(device_name, uhc_dev, vid, pid) \
@@ -488,7 +488,7 @@
USBD_DESC_STRING_DEFINE(d_name, d_string, USBD_DUT_STRING_SERIAL_NUMBER)
#define USBD_DEFINE_CLASS(class_name, class_api, class_priv, class_v_reqs) \
- static struct usbd_class_node class_name = { \
+ static struct usbd_class_data class_name = { \
.name = STRINGIFY(class_name), \
.api = class_api, \
.v_reqs = class_v_reqs, \
@@ -496,11 +496,11 @@
}; \
static STRUCT_SECTION_ITERABLE_ALTERNATE( \
usbd_class_fs, usbd_class_iter, class_name##_fs) = { \
- .c_nd = &class_name, \
+ .c_data = &class_name, \
}; \
static STRUCT_SECTION_ITERABLE_ALTERNATE( \
usbd_class_hs, usbd_class_iter, class_name##_hs) = { \
- .c_nd = &class_name, \
+ .c_data = &class_name, \
}
/** @brief Helper to declare request table of usbd_cctx_vendor_req
@@ -700,13 +700,13 @@
*
* Allocate a new buffer from controller's driver buffer pool.
*
- * @param[in] c_nd Pointer to USB device class node
+ * @param[in] c_data Pointer to USB device class data
* @param[in] ep Endpoint address
* @param[in] size Size of the request buffer
*
* @return pointer to allocated request or NULL on error.
*/
-struct net_buf *usbd_ep_buf_alloc(const struct usbd_class_node *const c_nd,
+struct net_buf *usbd_ep_buf_alloc(const struct usbd_class_data *const c_data,
const uint8_t ep, const size_t size);
/**
@@ -727,12 +727,12 @@
*
* Add request to the queue.
*
- * @param[in] c_nd Pointer to USB device class node
+ * @param[in] c_data Pointer to USB device class data
* @param[in] buf Pointer to UDC request buffer
*
* @return 0 on success, or error from udc_ep_enqueue()
*/
-int usbd_ep_enqueue(const struct usbd_class_node *const c_nd,
+int usbd_ep_enqueue(const struct usbd_class_data *const c_data,
struct net_buf *const buf);
/**
diff --git a/samples/subsys/usb/common/sample_usbd_init.c b/samples/subsys/usb/common/sample_usbd_init.c
index a9a4974..ee82d33 100644
--- a/samples/subsys/usb/common/sample_usbd_init.c
+++ b/samples/subsys/usb/common/sample_usbd_init.c
@@ -43,15 +43,15 @@
STRUCT_SECTION_FOREACH_ALTERNATE(usbd_class_fs, usbd_class_iter, iter) {
/* Pull everything that is enabled in our configuration. */
- err = usbd_register_class(uds_ctx, iter->c_nd->name,
+ err = usbd_register_class(uds_ctx, iter->c_data->name,
USBD_SPEED_FS, 1);
if (err) {
LOG_ERR("Failed to register FS %s (%d)",
- iter->c_nd->name, err);
+ iter->c_data->name, err);
return err;
}
- LOG_DBG("Register FS %s", iter->c_nd->name);
+ LOG_DBG("Register FS %s", iter->c_data->name);
}
return err;
@@ -63,15 +63,15 @@
STRUCT_SECTION_FOREACH_ALTERNATE(usbd_class_hs, usbd_class_iter, iter) {
/* Pull everything that is enabled in our configuration. */
- err = usbd_register_class(uds_ctx, iter->c_nd->name,
+ err = usbd_register_class(uds_ctx, iter->c_data->name,
USBD_SPEED_HS, 1);
if (err) {
LOG_ERR("Failed to register HS %s (%d)",
- iter->c_nd->name, err);
+ iter->c_data->name, err);
return err;
}
- LOG_DBG("Register HS %s", iter->c_nd->name);
+ LOG_DBG("Register HS %s", iter->c_data->name);
}
return err;
diff --git a/subsys/usb/device_next/class/bt_hci.c b/subsys/usb/device_next/class/bt_hci.c
index 4db8d7c..7c1c727 100644
--- a/subsys/usb/device_next/class/bt_hci.c
+++ b/subsys/usb/device_next/class/bt_hci.c
@@ -124,18 +124,18 @@
static const struct usbd_cctx_vendor_req bt_hci_vregs =
USBD_VENDOR_REQ(0x00, 0xe0);
-static uint8_t bt_hci_get_int_in(struct usbd_class_node *const c_nd)
+static uint8_t bt_hci_get_int_in(struct usbd_class_data *const c_data)
{
- struct bt_hci_data *data = usbd_class_get_private(c_nd);
+ struct bt_hci_data *data = usbd_class_get_private(c_data);
struct usbd_bt_hci_desc *desc = data->desc;
return desc->if0_int_ep.bEndpointAddress;
}
-static uint8_t bt_hci_get_bulk_in(struct usbd_class_node *const c_nd)
+static uint8_t bt_hci_get_bulk_in(struct usbd_class_data *const c_data)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_nd);
- struct bt_hci_data *data = usbd_class_get_private(c_nd);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
+ struct bt_hci_data *data = usbd_class_get_private(c_data);
struct usbd_bt_hci_desc *desc = data->desc;
if (usbd_bus_speed(uds_ctx) == USBD_SPEED_HS) {
@@ -145,10 +145,10 @@
return desc->if0_in_ep.bEndpointAddress;
}
-static uint8_t bt_hci_get_bulk_out(struct usbd_class_node *const c_nd)
+static uint8_t bt_hci_get_bulk_out(struct usbd_class_data *const c_data)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_nd);
- struct bt_hci_data *data = usbd_class_get_private(c_nd);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
+ struct bt_hci_data *data = usbd_class_get_private(c_data);
struct usbd_bt_hci_desc *desc = data->desc;
if (usbd_bus_speed(uds_ctx) == USBD_SPEED_HS) {
@@ -175,10 +175,10 @@
return buf;
}
-static void bt_hci_tx_sync_in(struct usbd_class_node *const c_nd,
+static void bt_hci_tx_sync_in(struct usbd_class_data *const c_data,
struct net_buf *const bt_buf, const uint8_t ep)
{
- struct bt_hci_data *hci_data = usbd_class_get_private(c_nd);
+ struct bt_hci_data *hci_data = usbd_class_get_private(c_data);
struct net_buf *buf;
buf = bt_hci_buf_alloc(ep);
@@ -188,14 +188,14 @@
}
net_buf_add_mem(buf, bt_buf->data, bt_buf->len);
- usbd_ep_enqueue(c_nd, buf);
+ usbd_ep_enqueue(c_data, buf);
k_sem_take(&hci_data->sync_sem, K_FOREVER);
net_buf_unref(buf);
}
static void bt_hci_tx_thread(void *p1, void *p2, void *p3)
{
- struct usbd_class_node *const c_nd = p1;
+ struct usbd_class_data *const c_data = p1;
ARG_UNUSED(p2);
ARG_UNUSED(p3);
@@ -208,10 +208,10 @@
switch (bt_buf_get_type(bt_buf)) {
case BT_BUF_EVT:
- ep = bt_hci_get_int_in(c_nd);
+ ep = bt_hci_get_int_in(c_data);
break;
case BT_BUF_ACL_IN:
- ep = bt_hci_get_bulk_in(c_nd);
+ ep = bt_hci_get_bulk_in(c_data);
break;
default:
LOG_ERR("Unknown type %u", bt_buf_get_type(bt_buf));
@@ -219,7 +219,7 @@
}
- bt_hci_tx_sync_in(c_nd, bt_buf, ep);
+ bt_hci_tx_sync_in(c_data, bt_buf, ep);
net_buf_unref(bt_buf);
}
}
@@ -241,9 +241,9 @@
}
}
-static int bt_hci_acl_out_start(struct usbd_class_node *const c_nd)
+static int bt_hci_acl_out_start(struct usbd_class_data *const c_data)
{
- struct bt_hci_data *hci_data = usbd_class_get_private(c_nd);
+ struct bt_hci_data *hci_data = usbd_class_get_private(c_data);
struct net_buf *buf;
uint8_t ep;
int ret;
@@ -256,13 +256,13 @@
return -EBUSY;
}
- ep = bt_hci_get_bulk_out(c_nd);
+ ep = bt_hci_get_bulk_out(c_data);
buf = bt_hci_buf_alloc(ep);
if (buf == NULL) {
return -ENOMEM;
}
- ret = usbd_ep_enqueue(c_nd, buf);
+ ret = usbd_ep_enqueue(c_data, buf);
if (ret) {
LOG_ERR("Failed to enqueue net_buf for 0x%02x", ep);
net_buf_unref(buf);
@@ -310,10 +310,10 @@
return (size < hdr_len) ? 0 : len;
}
-static int bt_hci_acl_out_cb(struct usbd_class_node *const c_nd,
+static int bt_hci_acl_out_cb(struct usbd_class_data *const c_data,
struct net_buf *const buf, const int err)
{
- struct bt_hci_data *hci_data = usbd_class_get_private(c_nd);
+ struct bt_hci_data *hci_data = usbd_class_get_private(c_data);
if (err) {
goto restart_out_transfer;
@@ -364,24 +364,24 @@
net_buf_unref(buf);
atomic_clear_bit(&hci_data->state, BT_HCI_ACL_RX_ENGAGED);
- return bt_hci_acl_out_start(c_nd);
+ return bt_hci_acl_out_start(c_data);
}
-static int bt_hci_request(struct usbd_class_node *const c_nd,
+static int bt_hci_request(struct usbd_class_data *const c_data,
struct net_buf *buf, int err)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_nd);
- struct bt_hci_data *hci_data = usbd_class_get_private(c_nd);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
+ struct bt_hci_data *hci_data = usbd_class_get_private(c_data);
struct udc_buf_info *bi;
bi = udc_get_buf_info(buf);
- if (bi->ep == bt_hci_get_bulk_out(c_nd)) {
- return bt_hci_acl_out_cb(c_nd, buf, err);
+ if (bi->ep == bt_hci_get_bulk_out(c_data)) {
+ return bt_hci_acl_out_cb(c_data, buf, err);
}
- if (bi->ep == bt_hci_get_bulk_in(c_nd) ||
- bi->ep == bt_hci_get_int_in(c_nd)) {
+ if (bi->ep == bt_hci_get_bulk_in(c_data) ||
+ bi->ep == bt_hci_get_int_in(c_data)) {
k_sem_give(&hci_data->sync_sem);
return 0;
@@ -390,34 +390,34 @@
return usbd_ep_buf_free(uds_ctx, buf);
}
-static void bt_hci_update(struct usbd_class_node *const c_nd,
+static void bt_hci_update(struct usbd_class_data *const c_data,
uint8_t iface, uint8_t alternate)
{
LOG_DBG("New configuration, interface %u alternate %u",
iface, alternate);
}
-static void bt_hci_enable(struct usbd_class_node *const c_nd)
+static void bt_hci_enable(struct usbd_class_data *const c_data)
{
- struct bt_hci_data *hci_data = usbd_class_get_private(c_nd);
+ struct bt_hci_data *hci_data = usbd_class_get_private(c_data);
atomic_set_bit(&hci_data->state, BT_HCI_CLASS_ENABLED);
LOG_INF("Configuration enabled");
- if (bt_hci_acl_out_start(c_nd)) {
+ if (bt_hci_acl_out_start(c_data)) {
LOG_ERR("Failed to start ACL OUT transfer");
}
}
-static void bt_hci_disable(struct usbd_class_node *const c_nd)
+static void bt_hci_disable(struct usbd_class_data *const c_data)
{
- struct bt_hci_data *hci_data = usbd_class_get_private(c_nd);
+ struct bt_hci_data *hci_data = usbd_class_get_private(c_data);
atomic_clear_bit(&hci_data->state, BT_HCI_CLASS_ENABLED);
LOG_INF("Configuration disabled");
}
-static int bt_hci_ctd(struct usbd_class_node *const c_nd,
+static int bt_hci_ctd(struct usbd_class_data *const c_data,
const struct usb_setup_packet *const setup,
const struct net_buf *const buf)
{
@@ -445,10 +445,10 @@
return 0;
}
-static void *bt_hci_get_desc(struct usbd_class_node *const c_nd,
+static void *bt_hci_get_desc(struct usbd_class_data *const c_data,
const enum usbd_speed speed)
{
- struct bt_hci_data *data = usbd_class_get_private(c_nd);
+ struct bt_hci_data *data = usbd_class_get_private(c_data);
if (speed == USBD_SPEED_HS) {
return data->hs_desc;
@@ -457,10 +457,10 @@
return data->fs_desc;
}
-static int bt_hci_init(struct usbd_class_node *const c_nd)
+static int bt_hci_init(struct usbd_class_data *const c_data)
{
- struct bt_hci_data *data = usbd_class_get_private(c_nd);
+ struct bt_hci_data *data = usbd_class_get_private(c_data);
struct usbd_bt_hci_desc *desc = data->desc;
desc->iad.bFirstInterface = desc->if0.bInterfaceNumber;
diff --git a/subsys/usb/device_next/class/loopback.c b/subsys/usb/device_next/class/loopback.c
index 90e1cd8..edddb86 100644
--- a/subsys/usb/device_next/class/loopback.c
+++ b/subsys/usb/device_next/class/loopback.c
@@ -55,14 +55,14 @@
atomic_t state;
};
-static void lb_update(struct usbd_class_node *c_nd,
+static void lb_update(struct usbd_class_data *c_data,
uint8_t iface, uint8_t alternate)
{
LOG_DBG("Instance %p, interface %u alternate %u changed",
- c_nd, iface, alternate);
+ c_data, iface, alternate);
}
-static int lb_control_to_host(struct usbd_class_node *c_nd,
+static int lb_control_to_host(struct usbd_class_data *c_data,
const struct usb_setup_packet *const setup,
struct net_buf *const buf)
{
@@ -87,7 +87,7 @@
return 0;
}
-static int lb_control_to_dev(struct usbd_class_node *c_nd,
+static int lb_control_to_dev(struct usbd_class_data *c_data,
const struct usb_setup_packet *const setup,
const struct net_buf *const buf)
{
@@ -109,22 +109,22 @@
return 0;
}
-static int lb_request_handler(struct usbd_class_node *c_nd,
+static int lb_request_handler(struct usbd_class_data *c_data,
struct net_buf *buf, int err)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_nd);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
struct udc_buf_info *bi = NULL;
bi = (struct udc_buf_info *)net_buf_user_data(buf);
- LOG_DBG("%p -> ep 0x%02x, len %u, err %d", c_nd, bi->ep, buf->len, err);
+ LOG_DBG("%p -> ep 0x%02x, len %u, err %d", c_data, bi->ep, buf->len, err);
return usbd_ep_buf_free(uds_ctx, buf);
}
-static void *lb_get_desc(struct usbd_class_node *const c_nd,
+static void *lb_get_desc(struct usbd_class_data *const c_data,
const enum usbd_speed speed)
{
- struct lb_data *data = usbd_class_get_private(c_nd);
+ struct lb_data *data = usbd_class_get_private(c_data);
if (speed == USBD_SPEED_HS) {
return data->hs_desc;
@@ -133,14 +133,14 @@
return data->fs_desc;
}
-static int lb_init(struct usbd_class_node *c_nd)
+static int lb_init(struct usbd_class_data *c_data)
{
- struct lb_data *data = usbd_class_get_private(c_nd);
+ struct lb_data *data = usbd_class_get_private(c_data);
struct loopback_desc *desc = data->desc;
desc->iad.bFirstInterface = desc->if0.bInterfaceNumber;
- LOG_DBG("Init class instance %p", c_nd);
+ LOG_DBG("Init class instance %p", c_data);
return 0;
}
diff --git a/subsys/usb/device_next/class/usbd_cdc_acm.c b/subsys/usb/device_next/class/usbd_cdc_acm.c
index d9507c4..b0be2cc 100644
--- a/subsys/usb/device_next/class/usbd_cdc_acm.c
+++ b/subsys/usb/device_next/class/usbd_cdc_acm.c
@@ -71,7 +71,7 @@
struct cdc_acm_uart_data {
/* Pointer to the associated USBD class node */
- struct usbd_class_node *c_nd;
+ struct usbd_class_data *c_data;
/* Pointer to the class interface descriptors */
struct usbd_cdc_acm_desc *const desc;
const struct usb_desc_header **const fs_desc;
@@ -133,10 +133,10 @@
return k_current_get() == k_work_queue_thread_get(&cdc_acm_work_q);
}
-static uint8_t cdc_acm_get_int_in(struct usbd_class_node *const c_nd)
+static uint8_t cdc_acm_get_int_in(struct usbd_class_data *const c_data)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_nd);
- const struct device *dev = usbd_class_get_private(c_nd);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_acm_uart_data *data = dev->data;
struct usbd_cdc_acm_desc *desc = data->desc;
@@ -147,10 +147,10 @@
return desc->if0_int_ep.bEndpointAddress;
}
-static uint8_t cdc_acm_get_bulk_in(struct usbd_class_node *const c_nd)
+static uint8_t cdc_acm_get_bulk_in(struct usbd_class_data *const c_data)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_nd);
- const struct device *dev = usbd_class_get_private(c_nd);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_acm_uart_data *data = dev->data;
struct usbd_cdc_acm_desc *desc = data->desc;
@@ -161,10 +161,10 @@
return desc->if1_in_ep.bEndpointAddress;
}
-static uint8_t cdc_acm_get_bulk_out(struct usbd_class_node *const c_nd)
+static uint8_t cdc_acm_get_bulk_out(struct usbd_class_data *const c_data)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_nd);
- const struct device *dev = usbd_class_get_private(c_nd);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_acm_uart_data *data = dev->data;
struct usbd_cdc_acm_desc *desc = data->desc;
@@ -175,9 +175,9 @@
return desc->if1_out_ep.bEndpointAddress;
}
-static size_t cdc_acm_get_bulk_mps(struct usbd_class_node *const c_nd)
+static size_t cdc_acm_get_bulk_mps(struct usbd_class_data *const c_data)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_nd);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
if (usbd_bus_speed(uds_ctx) == USBD_SPEED_HS) {
return 512U;
@@ -186,11 +186,11 @@
return 64U;
}
-static int usbd_cdc_acm_request(struct usbd_class_node *const c_nd,
+static int usbd_cdc_acm_request(struct usbd_class_data *const c_data,
struct net_buf *buf, int err)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_nd);
- const struct device *dev = usbd_class_get_private(c_nd);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_acm_uart_data *data = dev->data;
struct udc_buf_info *bi;
@@ -204,14 +204,14 @@
bi->ep, buf->len);
}
- if (bi->ep == cdc_acm_get_bulk_out(c_nd)) {
+ if (bi->ep == cdc_acm_get_bulk_out(c_data)) {
atomic_clear_bit(&data->state, CDC_ACM_RX_FIFO_BUSY);
}
goto ep_request_error;
}
- if (bi->ep == cdc_acm_get_bulk_out(c_nd)) {
+ if (bi->ep == cdc_acm_get_bulk_out(c_data)) {
/* RX transfer completion */
size_t done;
@@ -225,14 +225,14 @@
cdc_acm_work_submit(&data->rx_fifo_work);
}
- if (bi->ep == cdc_acm_get_bulk_in(c_nd)) {
+ if (bi->ep == cdc_acm_get_bulk_in(c_data)) {
/* TX transfer completion */
if (data->cb) {
cdc_acm_work_submit(&data->irq_cb_work);
}
}
- if (bi->ep == cdc_acm_get_int_in(c_nd)) {
+ if (bi->ep == cdc_acm_get_int_in(c_data)) {
k_sem_give(&data->notif_sem);
}
@@ -240,16 +240,16 @@
return usbd_ep_buf_free(uds_ctx, buf);
}
-static void usbd_cdc_acm_update(struct usbd_class_node *const c_nd,
+static void usbd_cdc_acm_update(struct usbd_class_data *const c_data,
uint8_t iface, uint8_t alternate)
{
LOG_DBG("New configuration, interface %u alternate %u",
iface, alternate);
}
-static void usbd_cdc_acm_enable(struct usbd_class_node *const c_nd)
+static void usbd_cdc_acm_enable(struct usbd_class_data *const c_data)
{
- const struct device *dev = usbd_class_get_private(c_nd);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_acm_uart_data *data = dev->data;
atomic_set_bit(&data->state, CDC_ACM_CLASS_ENABLED);
@@ -264,9 +264,9 @@
}
}
-static void usbd_cdc_acm_disable(struct usbd_class_node *const c_nd)
+static void usbd_cdc_acm_disable(struct usbd_class_data *const c_data)
{
- const struct device *dev = usbd_class_get_private(c_nd);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_acm_uart_data *data = dev->data;
atomic_clear_bit(&data->state, CDC_ACM_CLASS_ENABLED);
@@ -274,27 +274,27 @@
LOG_INF("Configuration disabled");
}
-static void usbd_cdc_acm_suspended(struct usbd_class_node *const c_nd)
+static void usbd_cdc_acm_suspended(struct usbd_class_data *const c_data)
{
- const struct device *dev = usbd_class_get_private(c_nd);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_acm_uart_data *data = dev->data;
/* FIXME: filter stray suspended events earlier */
atomic_set_bit(&data->state, CDC_ACM_CLASS_SUSPENDED);
}
-static void usbd_cdc_acm_resumed(struct usbd_class_node *const c_nd)
+static void usbd_cdc_acm_resumed(struct usbd_class_data *const c_data)
{
- const struct device *dev = usbd_class_get_private(c_nd);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_acm_uart_data *data = dev->data;
atomic_clear_bit(&data->state, CDC_ACM_CLASS_SUSPENDED);
}
-static void *usbd_cdc_acm_get_desc(struct usbd_class_node *const c_nd,
+static void *usbd_cdc_acm_get_desc(struct usbd_class_data *const c_data,
const enum usbd_speed speed)
{
- const struct device *dev = usbd_class_get_private(c_nd);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_acm_uart_data *data = dev->data;
if (speed == USBD_SPEED_HS) {
@@ -376,11 +376,11 @@
}
}
-static int usbd_cdc_acm_cth(struct usbd_class_node *const c_nd,
+static int usbd_cdc_acm_cth(struct usbd_class_data *const c_data,
const struct usb_setup_packet *const setup,
struct net_buf *const buf)
{
- const struct device *dev = usbd_class_get_private(c_nd);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_acm_uart_data *data = dev->data;
size_t min_len;
@@ -403,12 +403,12 @@
return 0;
}
-static int usbd_cdc_acm_ctd(struct usbd_class_node *const c_nd,
+static int usbd_cdc_acm_ctd(struct usbd_class_data *const c_data,
const struct usb_setup_packet *const setup,
const struct net_buf *const buf)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_nd);
- const struct device *dev = usbd_class_get_private(c_nd);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_acm_uart_data *data = dev->data;
size_t len;
@@ -442,9 +442,9 @@
return 0;
}
-static int usbd_cdc_acm_init(struct usbd_class_node *const c_nd)
+static int usbd_cdc_acm_init(struct usbd_class_data *const c_data)
{
- const struct device *dev = usbd_class_get_private(c_nd);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_acm_uart_data *data = dev->data;
struct usbd_cdc_acm_desc *desc = data->desc;
@@ -467,7 +467,7 @@
.data = sys_cpu_to_le16(serial_state),
};
struct cdc_acm_uart_data *data = dev->data;
- struct usbd_class_node *c_nd = data->c_nd;
+ struct usbd_class_data *c_data = data->c_data;
struct net_buf *buf;
uint8_t ep;
int ret;
@@ -482,14 +482,14 @@
return -EACCES;
}
- ep = cdc_acm_get_int_in(c_nd);
- buf = usbd_ep_buf_alloc(c_nd, ep, sizeof(struct cdc_acm_notification));
+ ep = cdc_acm_get_int_in(c_data);
+ buf = usbd_ep_buf_alloc(c_data, ep, sizeof(struct cdc_acm_notification));
if (buf == NULL) {
return -ENOMEM;
}
net_buf_add_mem(buf, ¬ification, sizeof(struct cdc_acm_notification));
- ret = usbd_ep_enqueue(c_nd, buf);
+ ret = usbd_ep_enqueue(c_data, buf);
/* FIXME: support for sync transfers */
k_sem_take(&data->notif_sem, K_FOREVER);
@@ -502,13 +502,13 @@
static void cdc_acm_tx_fifo_handler(struct k_work *work)
{
struct cdc_acm_uart_data *data;
- struct usbd_class_node *c_nd;
+ struct usbd_class_data *c_data;
struct net_buf *buf;
size_t len;
int ret;
data = CONTAINER_OF(work, struct cdc_acm_uart_data, tx_fifo_work);
- c_nd = data->c_nd;
+ c_data = data->c_data;
if (!atomic_test_bit(&data->state, CDC_ACM_CLASS_ENABLED)) {
LOG_DBG("USB configuration is not enabled");
@@ -525,7 +525,7 @@
return;
}
- buf = cdc_acm_buf_alloc(cdc_acm_get_bulk_in(c_nd));
+ buf = cdc_acm_buf_alloc(cdc_acm_get_bulk_in(c_data));
if (buf == NULL) {
cdc_acm_work_submit(&data->tx_fifo_work);
goto tx_fifo_handler_exit;
@@ -534,7 +534,7 @@
len = ring_buf_get(data->tx_fifo.rb, buf->data, buf->size);
net_buf_add(buf, len);
- ret = usbd_ep_enqueue(c_nd, buf);
+ ret = usbd_ep_enqueue(c_data, buf);
if (ret) {
LOG_ERR("Failed to enqueue");
net_buf_unref(buf);
@@ -555,13 +555,13 @@
static void cdc_acm_rx_fifo_handler(struct k_work *work)
{
struct cdc_acm_uart_data *data;
- struct usbd_class_node *c_nd;
+ struct usbd_class_data *c_data;
struct net_buf *buf;
uint8_t ep;
int ret;
data = CONTAINER_OF(work, struct cdc_acm_uart_data, rx_fifo_work);
- c_nd = data->c_nd;
+ c_data = data->c_data;
if (!atomic_test_bit(&data->state, CDC_ACM_CLASS_ENABLED) ||
atomic_test_bit(&data->state, CDC_ACM_CLASS_SUSPENDED)) {
@@ -569,7 +569,7 @@
return;
}
- if (ring_buf_space_get(data->rx_fifo.rb) < cdc_acm_get_bulk_mps(c_nd)) {
+ if (ring_buf_space_get(data->rx_fifo.rb) < cdc_acm_get_bulk_mps(c_data)) {
LOG_INF("RX buffer to small, throttle");
return;
}
@@ -579,13 +579,13 @@
return;
}
- ep = cdc_acm_get_bulk_out(c_nd);
+ ep = cdc_acm_get_bulk_out(c_data);
buf = cdc_acm_buf_alloc(ep);
if (buf == NULL) {
return;
}
- ret = usbd_ep_enqueue(c_nd, buf);
+ ret = usbd_ep_enqueue(c_data, buf);
if (ret) {
LOG_ERR("Failed to enqueue net_buf for 0x%02x", ep);
net_buf_unref(buf);
@@ -775,10 +775,10 @@
static void cdc_acm_irq_cb_handler(struct k_work *work)
{
struct cdc_acm_uart_data *data;
- struct usbd_class_node *c_nd;
+ struct usbd_class_data *c_data;
data = CONTAINER_OF(work, struct cdc_acm_uart_data, irq_cb_work);
- c_nd = data->c_nd;
+ c_data = data->c_data;
if (data->cb == NULL) {
LOG_ERR("IRQ callback is not set");
@@ -798,7 +798,7 @@
if (atomic_test_bit(&data->state, CDC_ACM_IRQ_RX_ENABLED) ||
atomic_test_bit(&data->state, CDC_ACM_IRQ_TX_ENABLED)) {
- data->cb(usbd_class_get_private(c_nd), data->cb_data);
+ data->cb(usbd_class_get_private(c_data), data->cb_data);
}
if (data->rx_fifo.altered) {
@@ -1219,7 +1219,7 @@
\
static struct cdc_acm_uart_data uart_data_##n = { \
.line_coding = CDC_ACM_DEFAULT_LINECODING, \
- .c_nd = &cdc_acm_##n, \
+ .c_data = &cdc_acm_##n, \
.rx_fifo.rb = &cdc_acm_rb_rx_##n, \
.tx_fifo.rb = &cdc_acm_rb_tx_##n, \
.notif_sem = Z_SEM_INITIALIZER(uart_data_##n.notif_sem, 0, 1), \
diff --git a/subsys/usb/device_next/class/usbd_cdc_ecm.c b/subsys/usb/device_next/class/usbd_cdc_ecm.c
index a9db3e2..7cbbc8d 100644
--- a/subsys/usb/device_next/class/usbd_cdc_ecm.c
+++ b/subsys/usb/device_next/class/usbd_cdc_ecm.c
@@ -79,8 +79,8 @@
};
struct cdc_ecm_eth_data {
- struct usbd_class_node *c_nd;
- struct usbd_desc_node *const mac_desc_nd;
+ struct usbd_class_data *c_data;
+ struct usbd_desc_node *const mac_desc_data;
struct usbd_cdc_ecm_desc *const desc;
const struct usb_desc_header **const fs_desc;
const struct usb_desc_header **const hs_desc;
@@ -100,10 +100,10 @@
return desc->if0.bInterfaceNumber;
}
-static uint8_t cdc_ecm_get_int_in(struct usbd_class_node *const c_nd)
+static uint8_t cdc_ecm_get_int_in(struct usbd_class_data *const c_data)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_nd);
- const struct device *dev = usbd_class_get_private(c_nd);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_ecm_eth_data *data = dev->data;
struct usbd_cdc_ecm_desc *desc = data->desc;
@@ -114,10 +114,10 @@
return desc->if0_int_ep.bEndpointAddress;
}
-static uint8_t cdc_ecm_get_bulk_in(struct usbd_class_node *const c_nd)
+static uint8_t cdc_ecm_get_bulk_in(struct usbd_class_data *const c_data)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_nd);
- const struct device *dev = usbd_class_get_private(c_nd);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_ecm_eth_data *data = dev->data;
struct usbd_cdc_ecm_desc *desc = data->desc;
@@ -128,9 +128,9 @@
return desc->if1_1_in_ep.bEndpointAddress;
}
-static uint16_t cdc_ecm_get_bulk_in_mps(struct usbd_class_node *const c_nd)
+static uint16_t cdc_ecm_get_bulk_in_mps(struct usbd_class_data *const c_data)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_nd);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
if (usbd_bus_speed(uds_ctx) == USBD_SPEED_HS) {
return 512U;
@@ -139,10 +139,10 @@
return 64U;
}
-static uint8_t cdc_ecm_get_bulk_out(struct usbd_class_node *const c_nd)
+static uint8_t cdc_ecm_get_bulk_out(struct usbd_class_data *const c_data)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_nd);
- const struct device *dev = usbd_class_get_private(c_nd);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_ecm_eth_data *data = dev->data;
struct usbd_cdc_ecm_desc *desc = data->desc;
@@ -199,9 +199,9 @@
return sizeof(struct net_eth_hdr) + ip_len;
}
-static int cdc_ecm_out_start(struct usbd_class_node *const c_nd)
+static int cdc_ecm_out_start(struct usbd_class_data *const c_data)
{
- const struct device *dev = usbd_class_get_private(c_nd);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_ecm_eth_data *data = dev->data;
struct net_buf *buf;
uint8_t ep;
@@ -215,13 +215,13 @@
return -EBUSY;
}
- ep = cdc_ecm_get_bulk_out(c_nd);
+ ep = cdc_ecm_get_bulk_out(c_data);
buf = cdc_ecm_buf_alloc(ep);
if (buf == NULL) {
return -ENOMEM;
}
- ret = usbd_ep_enqueue(c_nd, buf);
+ ret = usbd_ep_enqueue(c_data, buf);
if (ret) {
LOG_ERR("Failed to enqueue net_buf for 0x%02x", ep);
net_buf_unref(buf);
@@ -230,10 +230,10 @@
return ret;
}
-static int cdc_ecm_acl_out_cb(struct usbd_class_node *const c_nd,
+static int cdc_ecm_acl_out_cb(struct usbd_class_data *const c_data,
struct net_buf *const buf, const int err)
{
- const struct device *dev = usbd_class_get_private(c_nd);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_ecm_eth_data *data = dev->data;
struct net_pkt *pkt;
@@ -277,30 +277,30 @@
net_buf_unref(buf);
atomic_clear_bit(&data->state, CDC_ECM_OUT_ENGAGED);
- return cdc_ecm_out_start(c_nd);
+ return cdc_ecm_out_start(c_data);
}
-static int usbd_cdc_ecm_request(struct usbd_class_node *const c_nd,
+static int usbd_cdc_ecm_request(struct usbd_class_data *const c_data,
struct net_buf *buf, int err)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_nd);
- const struct device *dev = usbd_class_get_private(c_nd);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_ecm_eth_data *data = dev->data;
struct udc_buf_info *bi;
bi = udc_get_buf_info(buf);
- if (bi->ep == cdc_ecm_get_bulk_out(c_nd)) {
- return cdc_ecm_acl_out_cb(c_nd, buf, err);
+ if (bi->ep == cdc_ecm_get_bulk_out(c_data)) {
+ return cdc_ecm_acl_out_cb(c_data, buf, err);
}
- if (bi->ep == cdc_ecm_get_bulk_in(c_nd)) {
+ if (bi->ep == cdc_ecm_get_bulk_in(c_data)) {
k_sem_give(&data->sync_sem);
return 0;
}
- if (bi->ep == cdc_ecm_get_int_in(c_nd)) {
+ if (bi->ep == cdc_ecm_get_int_in(c_data)) {
k_sem_give(&data->notif_sem);
return 0;
@@ -313,7 +313,7 @@
const bool connected)
{
struct cdc_ecm_eth_data *data = dev->data;
- struct usbd_class_node *c_nd = data->c_nd;
+ struct usbd_class_data *c_data = data->c_data;
struct cdc_ecm_notification notification = {
.RequestType = {
.direction = USB_REQTYPE_DIR_TO_HOST,
@@ -339,14 +339,14 @@
return 0;
}
- ep = cdc_ecm_get_int_in(c_nd);
- buf = usbd_ep_buf_alloc(c_nd, ep, sizeof(struct cdc_ecm_notification));
+ ep = cdc_ecm_get_int_in(c_data);
+ buf = usbd_ep_buf_alloc(c_data, ep, sizeof(struct cdc_ecm_notification));
if (buf == NULL) {
return -ENOMEM;
}
net_buf_add_mem(buf, ¬ification, sizeof(struct cdc_ecm_notification));
- ret = usbd_ep_enqueue(c_nd, buf);
+ ret = usbd_ep_enqueue(c_data, buf);
if (ret) {
LOG_ERR("Failed to enqueue net_buf for 0x%02x", ep);
net_buf_unref(buf);
@@ -359,10 +359,10 @@
return 0;
}
-static void usbd_cdc_ecm_update(struct usbd_class_node *const c_nd,
+static void usbd_cdc_ecm_update(struct usbd_class_data *const c_data,
const uint8_t iface, const uint8_t alternate)
{
- const struct device *dev = usbd_class_get_private(c_nd);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_ecm_eth_data *data = dev->data;
struct usbd_cdc_ecm_desc *desc = data->desc;
const uint8_t data_iface = desc->if1_1.bInterfaceNumber;
@@ -376,25 +376,25 @@
if (data_iface == iface && alternate == 1) {
net_if_carrier_on(data->iface);
- if (cdc_ecm_out_start(c_nd)) {
+ if (cdc_ecm_out_start(c_data)) {
LOG_ERR("Failed to start OUT transfer");
}
}
}
-static void usbd_cdc_ecm_enable(struct usbd_class_node *const c_nd)
+static void usbd_cdc_ecm_enable(struct usbd_class_data *const c_data)
{
- const struct device *dev = usbd_class_get_private(c_nd);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_ecm_eth_data *data = dev->data;
atomic_set_bit(&data->state, CDC_ECM_CLASS_ENABLED);
LOG_DBG("Configuration enabled");
}
-static void usbd_cdc_ecm_disable(struct usbd_class_node *const c_nd)
+static void usbd_cdc_ecm_disable(struct usbd_class_data *const c_data)
{
- const struct device *dev = usbd_class_get_private(c_nd);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_ecm_eth_data *data = dev->data;
if (atomic_test_and_clear_bit(&data->state, CDC_ECM_CLASS_ENABLED)) {
@@ -405,23 +405,23 @@
LOG_INF("Configuration disabled");
}
-static void usbd_cdc_ecm_suspended(struct usbd_class_node *const c_nd)
+static void usbd_cdc_ecm_suspended(struct usbd_class_data *const c_data)
{
- const struct device *dev = usbd_class_get_private(c_nd);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_ecm_eth_data *data = dev->data;
atomic_set_bit(&data->state, CDC_ECM_CLASS_SUSPENDED);
}
-static void usbd_cdc_ecm_resumed(struct usbd_class_node *const c_nd)
+static void usbd_cdc_ecm_resumed(struct usbd_class_data *const c_data)
{
- const struct device *dev = usbd_class_get_private(c_nd);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_ecm_eth_data *data = dev->data;
atomic_clear_bit(&data->state, CDC_ECM_CLASS_SUSPENDED);
}
-static int usbd_cdc_ecm_ctd(struct usbd_class_node *const c_nd,
+static int usbd_cdc_ecm_ctd(struct usbd_class_data *const c_data,
const struct usb_setup_packet *const setup,
const struct net_buf *const buf)
{
@@ -440,10 +440,10 @@
return 0;
}
-static int usbd_cdc_ecm_init(struct usbd_class_node *const c_nd)
+static int usbd_cdc_ecm_init(struct usbd_class_data *const c_data)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_nd);
- const struct device *dev = usbd_class_get_private(c_nd);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_ecm_eth_data *const data = dev->data;
struct usbd_cdc_ecm_desc *desc = data->desc;
const uint8_t if_num = desc->if0.bInterfaceNumber;
@@ -454,29 +454,29 @@
desc->if0_union.bSubordinateInterface0 = if_num + 1;
LOG_DBG("CDC ECM class initialized");
- if (usbd_add_descriptor(uds_ctx, data->mac_desc_nd)) {
+ if (usbd_add_descriptor(uds_ctx, data->mac_desc_data)) {
LOG_ERR("Failed to add iMACAddress string descriptor");
} else {
- desc->if0_ecm.iMACAddress = data->mac_desc_nd->idx;
+ desc->if0_ecm.iMACAddress = data->mac_desc_data->idx;
}
return 0;
}
-static void usbd_cdc_ecm_shutdown(struct usbd_class_node *const c_nd)
+static void usbd_cdc_ecm_shutdown(struct usbd_class_data *const c_data)
{
- const struct device *dev = usbd_class_get_private(c_nd);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_ecm_eth_data *const data = dev->data;
struct usbd_cdc_ecm_desc *desc = data->desc;
desc->if0_ecm.iMACAddress = 0;
- sys_dlist_remove(&data->mac_desc_nd->node);
+ sys_dlist_remove(&data->mac_desc_data->node);
}
-static void *usbd_cdc_ecm_get_desc(struct usbd_class_node *const c_nd,
+static void *usbd_cdc_ecm_get_desc(struct usbd_class_data *const c_data,
const enum usbd_speed speed)
{
- const struct device *dev = usbd_class_get_private(c_nd);
+ const struct device *dev = usbd_class_get_private(c_data);
struct cdc_ecm_eth_data *const data = dev->data;
if (speed == USBD_SPEED_HS) {
@@ -489,7 +489,7 @@
static int cdc_ecm_send(const struct device *dev, struct net_pkt *const pkt)
{
struct cdc_ecm_eth_data *const data = dev->data;
- struct usbd_class_node *c_nd = data->c_nd;
+ struct usbd_class_data *c_data = data->c_data;
size_t len = net_pkt_get_len(pkt);
struct net_buf *buf;
@@ -504,7 +504,7 @@
return -EACCES;
}
- buf = cdc_ecm_buf_alloc(cdc_ecm_get_bulk_in(c_nd));
+ buf = cdc_ecm_buf_alloc(cdc_ecm_get_bulk_in(c_data));
if (buf == NULL) {
LOG_ERR("Failed to allocate buffer");
return -ENOMEM;
@@ -519,11 +519,11 @@
net_buf_add(buf, len);
- if (!(buf->len % cdc_ecm_get_bulk_in_mps(c_nd))) {
+ if (!(buf->len % cdc_ecm_get_bulk_in_mps(c_data))) {
udc_ep_buf_set_zlp(buf);
}
- usbd_ep_enqueue(c_nd, buf);
+ usbd_ep_enqueue(c_data, buf);
k_sem_take(&data->sync_sem, K_FOREVER);
net_buf_unref(buf);
@@ -805,7 +805,7 @@
#define USBD_CDC_ECM_DT_DEVICE_DEFINE(n) \
CDC_ECM_DEFINE_DESCRIPTOR(n); \
- USBD_DESC_STRING_DEFINE(mac_desc_nd_##n, \
+ USBD_DESC_STRING_DEFINE(mac_desc_data_##n, \
DT_INST_PROP(n, remote_mac_address), \
USBD_DUT_STRING_INTERFACE); \
\
@@ -814,11 +814,11 @@
(void *)DEVICE_DT_GET(DT_DRV_INST(n)), NULL); \
\
static struct cdc_ecm_eth_data eth_data_##n = { \
- .c_nd = &cdc_ecm_##n, \
+ .c_data = &cdc_ecm_##n, \
.mac_addr = DT_INST_PROP_OR(n, local_mac_address, {0}), \
.sync_sem = Z_SEM_INITIALIZER(eth_data_##n.sync_sem, 0, 1), \
.notif_sem = Z_SEM_INITIALIZER(eth_data_##n.notif_sem, 0, 1), \
- .mac_desc_nd = &mac_desc_nd_##n, \
+ .mac_desc_data = &mac_desc_data_##n, \
.desc = &cdc_ecm_desc_##n, \
.fs_desc = cdc_ecm_fs_desc_##n, \
.hs_desc = cdc_ecm_hs_desc_##n, \
diff --git a/subsys/usb/device_next/class/usbd_msc.c b/subsys/usb/device_next/class/usbd_msc.c
index 55f8715..1cf2317 100644
--- a/subsys/usb/device_next/class/usbd_msc.c
+++ b/subsys/usb/device_next/class/usbd_msc.c
@@ -68,7 +68,7 @@
sizeof(struct udc_buf_info), NULL);
struct msc_event {
- struct usbd_class_node *node;
+ struct usbd_class_data *c_data;
/* NULL to request Bulk-Only Mass Storage Reset
* Otherwise must point to previously enqueued endpoint buffer
*/
@@ -111,7 +111,7 @@
};
struct msc_bot_ctx {
- struct usbd_class_node *class_node;
+ struct usbd_class_data *class_node;
struct msc_bot_desc *const desc;
const struct usb_desc_header **const fs_desc;
const struct usb_desc_header **const hs_desc;
@@ -144,10 +144,10 @@
return buf;
}
-static uint8_t msc_get_bulk_in(struct usbd_class_node *const node)
+static uint8_t msc_get_bulk_in(struct usbd_class_data *const c_data)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(node);
- struct msc_bot_ctx *ctx = usbd_class_get_private(node);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
+ struct msc_bot_ctx *ctx = usbd_class_get_private(c_data);
struct msc_bot_desc *desc = ctx->desc;
if (usbd_bus_speed(uds_ctx) == USBD_SPEED_HS) {
@@ -157,10 +157,10 @@
return desc->if0_in_ep.bEndpointAddress;
}
-static uint8_t msc_get_bulk_out(struct usbd_class_node *const node)
+static uint8_t msc_get_bulk_out(struct usbd_class_data *const c_data)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(node);
- struct msc_bot_ctx *ctx = usbd_class_get_private(node);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
+ struct msc_bot_ctx *ctx = usbd_class_get_private(c_data);
struct msc_bot_desc *desc = ctx->desc;
if (usbd_bus_speed(uds_ctx) == USBD_SPEED_HS) {
@@ -170,9 +170,9 @@
return desc->if0_out_ep.bEndpointAddress;
}
-static void msc_queue_bulk_out_ep(struct usbd_class_node *const node)
+static void msc_queue_bulk_out_ep(struct usbd_class_data *const c_data)
{
- struct msc_bot_ctx *ctx = usbd_class_get_private(node);
+ struct msc_bot_ctx *ctx = usbd_class_get_private(c_data);
struct net_buf *buf;
uint8_t ep;
int ret;
@@ -183,14 +183,14 @@
}
LOG_DBG("Queuing OUT");
- ep = msc_get_bulk_out(node);
+ ep = msc_get_bulk_out(c_data);
buf = msc_buf_alloc(ep);
/* The pool is large enough to support all allocations. Failing alloc
* indicates either a memory leak or logic error.
*/
__ASSERT_NO_MSG(buf);
- ret = usbd_ep_enqueue(node, buf);
+ ret = usbd_ep_enqueue(c_data, buf);
if (ret) {
LOG_ERR("Failed to enqueue net_buf for 0x%02x", ep);
net_buf_unref(buf);
@@ -198,25 +198,25 @@
}
}
-static void msc_stall_bulk_out_ep(struct usbd_class_node *const node)
+static void msc_stall_bulk_out_ep(struct usbd_class_data *const c_data)
{
uint8_t ep;
- ep = msc_get_bulk_out(node);
- usbd_ep_set_halt(usbd_class_get_ctx(node), ep);
+ ep = msc_get_bulk_out(c_data);
+ usbd_ep_set_halt(usbd_class_get_ctx(c_data), ep);
}
-static void msc_stall_bulk_in_ep(struct usbd_class_node *const node)
+static void msc_stall_bulk_in_ep(struct usbd_class_data *const c_data)
{
uint8_t ep;
- ep = msc_get_bulk_in(node);
- usbd_ep_set_halt(usbd_class_get_ctx(node), ep);
+ ep = msc_get_bulk_in(c_data);
+ usbd_ep_set_halt(usbd_class_get_ctx(c_data), ep);
}
-static void msc_reset_handler(struct usbd_class_node *node)
+static void msc_reset_handler(struct usbd_class_data *c_data)
{
- struct msc_bot_ctx *ctx = usbd_class_get_private(node);
+ struct msc_bot_ctx *ctx = usbd_class_get_private(c_data);
int i;
LOG_INF("Bulk-Only Mass Storage Reset");
@@ -563,11 +563,11 @@
ctx->state = MSC_BBB_WAIT_FOR_CSW_SENT;
}
-static void usbd_msc_handle_request(struct usbd_class_node *node,
+static void usbd_msc_handle_request(struct usbd_class_data *c_data,
struct net_buf *buf, int err)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(node);
- struct msc_bot_ctx *ctx = usbd_class_get_private(node);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
+ struct msc_bot_ctx *ctx = usbd_class_get_private(c_data);
struct udc_buf_info *bi;
bi = udc_get_buf_info(buf);
@@ -583,16 +583,16 @@
goto ep_request_error;
}
- if (bi->ep == msc_get_bulk_out(node)) {
+ if (bi->ep == msc_get_bulk_out(c_data)) {
msc_handle_bulk_out(ctx, buf->data, buf->len);
- } else if (bi->ep == msc_get_bulk_in(node)) {
+ } else if (bi->ep == msc_get_bulk_in(c_data)) {
msc_handle_bulk_in(ctx, buf->data, buf->len);
}
ep_request_error:
- if (bi->ep == msc_get_bulk_out(node)) {
+ if (bi->ep == msc_get_bulk_out(c_data)) {
atomic_clear_bit(&ctx->bits, MSC_BULK_OUT_QUEUED);
- } else if (bi->ep == msc_get_bulk_in(node)) {
+ } else if (bi->ep == msc_get_bulk_in(c_data)) {
atomic_clear_bit(&ctx->bits, MSC_BULK_IN_QUEUED);
}
usbd_ep_buf_free(uds_ctx, buf);
@@ -609,11 +609,11 @@
while (1) {
k_msgq_get(&msc_msgq, &evt, K_FOREVER);
- ctx = usbd_class_get_private(evt.node);
+ ctx = usbd_class_get_private(evt.c_data);
if (evt.buf == NULL) {
- msc_reset_handler(evt.node);
+ msc_reset_handler(evt.c_data);
} else {
- usbd_msc_handle_request(evt.node, evt.buf, evt.err);
+ usbd_msc_handle_request(evt.c_data, evt.buf, evt.err);
}
if (!atomic_test_bit(&ctx->bits, MSC_CLASS_ENABLED)) {
@@ -624,7 +624,7 @@
case MSC_BBB_EXPECT_CBW:
case MSC_BBB_PROCESS_WRITE:
/* Ensure we can accept next OUT packet */
- msc_queue_bulk_out_ep(evt.node);
+ msc_queue_bulk_out_ep(evt.c_data);
break;
default:
break;
@@ -644,17 +644,17 @@
if (ctx->state == MSC_BBB_PROCESS_READ) {
msc_process_read(ctx);
} else if (ctx->state == MSC_BBB_PROCESS_WRITE) {
- msc_queue_bulk_out_ep(evt.node);
+ msc_queue_bulk_out_ep(evt.c_data);
} else if (ctx->state == MSC_BBB_SEND_CSW) {
msc_send_csw(ctx);
}
}
}
-static void msc_bot_schedule_reset(struct usbd_class_node *node)
+static void msc_bot_schedule_reset(struct usbd_class_data *c_data)
{
struct msc_event request = {
- .node = node,
+ .c_data = c_data,
.buf = NULL, /* Bulk-Only Mass Storage Reset */
};
@@ -662,30 +662,30 @@
}
/* Feature endpoint halt state handler */
-static void msc_bot_feature_halt(struct usbd_class_node *const node,
+static void msc_bot_feature_halt(struct usbd_class_data *const c_data,
const uint8_t ep, const bool halted)
{
- struct msc_bot_ctx *ctx = usbd_class_get_private(node);
+ struct msc_bot_ctx *ctx = usbd_class_get_private(c_data);
- if (ep == msc_get_bulk_in(node) && !halted &&
+ if (ep == msc_get_bulk_in(c_data) && !halted &&
atomic_test_bit(&ctx->bits, MSC_BULK_IN_WEDGED)) {
/* Endpoint shall remain halted until Reset Recovery */
- usbd_ep_set_halt(usbd_class_get_ctx(node), ep);
- } else if (ep == msc_get_bulk_out(node) && !halted &&
+ usbd_ep_set_halt(usbd_class_get_ctx(c_data), ep);
+ } else if (ep == msc_get_bulk_out(c_data) && !halted &&
atomic_test_bit(&ctx->bits, MSC_BULK_OUT_WEDGED)) {
/* Endpoint shall remain halted until Reset Recovery */
- usbd_ep_set_halt(usbd_class_get_ctx(node), ep);
+ usbd_ep_set_halt(usbd_class_get_ctx(c_data), ep);
}
}
/* USB control request handler to device */
-static int msc_bot_control_to_dev(struct usbd_class_node *const node,
+static int msc_bot_control_to_dev(struct usbd_class_data *const c_data,
const struct usb_setup_packet *const setup,
const struct net_buf *const buf)
{
if (setup->bRequest == BULK_ONLY_MASS_STORAGE_RESET &&
setup->wValue == 0 && setup->wLength == 0) {
- msc_bot_schedule_reset(node);
+ msc_bot_schedule_reset(c_data);
} else {
errno = -ENOTSUP;
}
@@ -694,11 +694,11 @@
}
/* USB control request handler to host */
-static int msc_bot_control_to_host(struct usbd_class_node *const node,
+static int msc_bot_control_to_host(struct usbd_class_data *const c_data,
const struct usb_setup_packet *const setup,
struct net_buf *const buf)
{
- struct msc_bot_ctx *ctx = usbd_class_get_private(node);
+ struct msc_bot_ctx *ctx = usbd_class_get_private(c_data);
uint8_t max_lun;
if (setup->bRequest == GET_MAX_LUN &&
@@ -717,11 +717,11 @@
}
/* Endpoint request completion event handler */
-static int msc_bot_request_handler(struct usbd_class_node *const node,
+static int msc_bot_request_handler(struct usbd_class_data *const c_data,
struct net_buf *buf, int err)
{
struct msc_event request = {
- .node = node,
+ .c_data = c_data,
.buf = buf,
.err = err,
};
@@ -733,28 +733,28 @@
}
/* Class associated configuration is selected */
-static void msc_bot_enable(struct usbd_class_node *const node)
+static void msc_bot_enable(struct usbd_class_data *const c_data)
{
- struct msc_bot_ctx *ctx = usbd_class_get_private(node);
+ struct msc_bot_ctx *ctx = usbd_class_get_private(c_data);
LOG_INF("Enable");
atomic_set_bit(&ctx->bits, MSC_CLASS_ENABLED);
- msc_bot_schedule_reset(node);
+ msc_bot_schedule_reset(c_data);
}
/* Class associated configuration is disabled */
-static void msc_bot_disable(struct usbd_class_node *const node)
+static void msc_bot_disable(struct usbd_class_data *const c_data)
{
- struct msc_bot_ctx *ctx = usbd_class_get_private(node);
+ struct msc_bot_ctx *ctx = usbd_class_get_private(c_data);
LOG_INF("Disable");
atomic_clear_bit(&ctx->bits, MSC_CLASS_ENABLED);
}
-static void *msc_bot_get_desc(struct usbd_class_node *const node,
+static void *msc_bot_get_desc(struct usbd_class_data *const c_data,
const enum usbd_speed speed)
{
- struct msc_bot_ctx *ctx = usbd_class_get_private(node);
+ struct msc_bot_ctx *ctx = usbd_class_get_private(c_data);
if (speed == USBD_SPEED_HS) {
return ctx->hs_desc;
@@ -764,11 +764,11 @@
}
/* Initialization of the class implementation */
-static int msc_bot_init(struct usbd_class_node *const node)
+static int msc_bot_init(struct usbd_class_data *const c_data)
{
- struct msc_bot_ctx *ctx = usbd_class_get_private(node);
+ struct msc_bot_ctx *ctx = usbd_class_get_private(c_data);
- ctx->class_node = node;
+ ctx->class_node = c_data;
ctx->state = MSC_BBB_EXPECT_CBW;
ctx->registered_luns = 0;
diff --git a/subsys/usb/device_next/class/usbd_uac2.c b/subsys/usb/device_next/class/usbd_uac2.c
index 4103139..f69da75 100644
--- a/subsys/usb/device_next/class/usbd_uac2.c
+++ b/subsys/usb/device_next/class/usbd_uac2.c
@@ -68,7 +68,7 @@
ENTITY_TYPE_OUTPUT_TERMINAL,
} entity_type_t;
-static size_t clock_frequencies(struct usbd_class_node *const node,
+static size_t clock_frequencies(struct usbd_class_data *const c_data,
const uint8_t id, const uint32_t **frequencies);
/* UAC2 device runtime data */
@@ -85,7 +85,7 @@
/* UAC2 device constant data */
struct uac2_cfg {
- struct usbd_class_node *const node;
+ struct usbd_class_data *const c_data;
const struct usb_desc_header **descriptors;
/* Entity 1 type is at entity_types[0] */
const entity_type_t *entity_types;
@@ -104,9 +104,9 @@
uint8_t num_entities;
};
-static entity_type_t id_type(struct usbd_class_node *const node, uint8_t id)
+static entity_type_t id_type(struct usbd_class_data *const c_data, uint8_t id)
{
- const struct device *dev = usbd_class_get_private(node);
+ const struct device *dev = usbd_class_get_private(c_data);
const struct uac2_cfg *cfg = dev->config;
if ((id - 1) < cfg->num_entities) {
@@ -117,9 +117,9 @@
}
static const struct usb_ep_descriptor *
-get_as_data_ep(struct usbd_class_node *const node, int as_idx)
+get_as_data_ep(struct usbd_class_data *const c_data, int as_idx)
{
- const struct device *dev = usbd_class_get_private(node);
+ const struct device *dev = usbd_class_get_private(c_data);
const struct uac2_cfg *cfg = dev->config;
const struct usb_desc_header *desc = NULL;
@@ -131,9 +131,9 @@
}
static const struct usb_ep_descriptor *
-get_as_feedback_ep(struct usbd_class_node *const node, int as_idx)
+get_as_feedback_ep(struct usbd_class_data *const c_data, int as_idx)
{
- const struct device *dev = usbd_class_get_private(node);
+ const struct device *dev = usbd_class_get_private(c_data);
const struct uac2_cfg *cfg = dev->config;
const struct usb_desc_header *desc = NULL;
@@ -157,13 +157,13 @@
continue;
}
- desc = get_as_data_ep(cfg->node, i);
+ desc = get_as_data_ep(cfg->c_data, i);
if (desc && (ep == desc->bEndpointAddress)) {
*fb = false;
return i;
}
- desc = get_as_feedback_ep(cfg->node, i);
+ desc = get_as_feedback_ep(cfg->c_data, i);
if (desc && (ep == desc->bEndpointAddress)) {
*fb = true;
return i;
@@ -232,7 +232,7 @@
int as_idx = terminal_to_as_interface(dev, terminal);
int ret;
- desc = get_as_data_ep(cfg->node, as_idx);
+ desc = get_as_data_ep(cfg->c_data, as_idx);
if (desc) {
ep = desc->bEndpointAddress;
}
@@ -264,7 +264,7 @@
return -ENOMEM;
}
- ret = usbd_ep_enqueue(cfg->node, buf);
+ ret = usbd_ep_enqueue(cfg->c_data, buf);
if (ret) {
LOG_ERR("Failed to enqueue net_buf for 0x%02x", ep);
net_buf_unref(buf);
@@ -275,10 +275,10 @@
return ret;
}
-static void schedule_iso_out_read(struct usbd_class_node *const node,
+static void schedule_iso_out_read(struct usbd_class_data *const c_data,
uint8_t ep, uint16_t mps, uint8_t terminal)
{
- const struct device *dev = usbd_class_get_private(node);
+ const struct device *dev = usbd_class_get_private(c_data);
const struct uac2_cfg *cfg = dev->config;
struct uac2_ctx *ctx = dev->data;
struct net_buf *buf;
@@ -324,7 +324,7 @@
return;
}
- ret = usbd_ep_enqueue(node, buf);
+ ret = usbd_ep_enqueue(c_data, buf);
if (ret) {
LOG_ERR("Failed to enqueue net_buf for 0x%02x", ep);
net_buf_unref(buf);
@@ -332,11 +332,11 @@
}
}
-static void write_explicit_feedback(struct usbd_class_node *const node,
+static void write_explicit_feedback(struct usbd_class_data *const c_data,
uint8_t ep, uint8_t terminal)
{
- const struct device *dev = usbd_class_get_private(node);
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(node);
+ const struct device *dev = usbd_class_get_private(c_data);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
struct uac2_ctx *ctx = dev->data;
struct net_buf *buf;
struct udc_buf_info *bi;
@@ -366,7 +366,7 @@
net_buf_add_le32(buf, fb_value);
}
- ret = usbd_ep_enqueue(node, buf);
+ ret = usbd_ep_enqueue(c_data, buf);
if (ret) {
LOG_ERR("Failed to enqueue net_buf for 0x%02x", ep);
net_buf_unref(buf);
@@ -375,11 +375,11 @@
}
}
-void uac2_update(struct usbd_class_node *const node,
+void uac2_update(struct usbd_class_data *const c_data,
uint8_t iface, uint8_t alternate)
{
- const struct device *dev = usbd_class_get_private(node);
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(node);
+ const struct device *dev = usbd_class_get_private(c_data);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
const struct uac2_cfg *cfg = dev->config;
struct uac2_ctx *ctx = dev->data;
const struct usb_association_descriptor *iad;
@@ -421,20 +421,20 @@
atomic_set_bit(&ctx->as_active, as_idx);
- data_ep = get_as_data_ep(node, as_idx);
+ data_ep = get_as_data_ep(c_data, as_idx);
/* External interfaces (i.e. NULL data_ep) do not have alternate
* configuration and therefore data_ep must be valid here.
*/
__ASSERT_NO_MSG(data_ep);
if (USB_EP_DIR_IS_OUT(data_ep->bEndpointAddress)) {
- schedule_iso_out_read(node, data_ep->bEndpointAddress,
+ schedule_iso_out_read(c_data, data_ep->bEndpointAddress,
sys_le16_to_cpu(data_ep->wMaxPacketSize),
cfg->as_terminals[as_idx]);
- fb_ep = get_as_feedback_ep(node, as_idx);
+ fb_ep = get_as_feedback_ep(c_data, as_idx);
if (fb_ep) {
- write_explicit_feedback(node, fb_ep->bEndpointAddress,
+ write_explicit_feedback(c_data, fb_ep->bEndpointAddress,
cfg->as_terminals[as_idx]);
}
}
@@ -494,7 +494,7 @@
}
}
-static int get_clock_source_request(struct usbd_class_node *const node,
+static int get_clock_source_request(struct usbd_class_data *const c_data,
const struct usb_setup_packet *const setup,
struct net_buf *const buf)
{
@@ -509,7 +509,7 @@
return 0;
}
- count = clock_frequencies(node, CONTROL_ENTITY_ID(setup), &frequencies);
+ count = clock_frequencies(c_data, CONTROL_ENTITY_ID(setup), &frequencies);
if (CONTROL_SELECTOR(setup) == CS_SAM_FREQ_CONTROL) {
if (CONTROL_ATTRIBUTE(setup) == CUR) {
@@ -536,7 +536,7 @@
return 0;
}
-static int uac2_control_to_host(struct usbd_class_node *const node,
+static int uac2_control_to_host(struct usbd_class_data *const c_data,
const struct usb_setup_packet *const setup,
struct net_buf *const buf)
{
@@ -549,9 +549,9 @@
}
if (setup->bmRequestType == GET_CLASS_REQUEST_TYPE) {
- entity_type = id_type(node, CONTROL_ENTITY_ID(setup));
+ entity_type = id_type(c_data, CONTROL_ENTITY_ID(setup));
if (entity_type == ENTITY_TYPE_CLOCK_SOURCE) {
- return get_clock_source_request(node, setup, buf);
+ return get_clock_source_request(c_data, setup, buf);
}
}
@@ -559,13 +559,13 @@
return 0;
}
-static int uac2_request(struct usbd_class_node *const node, struct net_buf *buf,
+static int uac2_request(struct usbd_class_data *const c_data, struct net_buf *buf,
int err)
{
- const struct device *dev = usbd_class_get_private(node);
+ const struct device *dev = usbd_class_get_private(c_data);
const struct uac2_cfg *cfg = dev->config;
struct uac2_ctx *ctx = dev->data;
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(node);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
struct udc_buf_info *bi;
uint8_t ep, terminal;
uint16_t mps;
@@ -609,15 +609,15 @@
/* Reschedule the read or explicit feedback write */
if (USB_EP_DIR_IS_OUT(ep)) {
- schedule_iso_out_read(node, ep, mps, terminal);
+ schedule_iso_out_read(c_data, ep, mps, terminal);
}
return 0;
}
-static void uac2_sof(struct usbd_class_node *const node)
+static void uac2_sof(struct usbd_class_data *const c_data)
{
- const struct device *dev = usbd_class_get_private(node);
+ const struct device *dev = usbd_class_get_private(c_data);
const struct usb_ep_descriptor *data_ep;
const struct usb_ep_descriptor *feedback_ep;
const struct uac2_cfg *cfg = dev->config;
@@ -631,15 +631,15 @@
* won't be pending only if there was buffer underrun, i.e. the
* application failed to supply receive buffer.
*/
- data_ep = get_as_data_ep(node, as_idx);
+ data_ep = get_as_data_ep(c_data, as_idx);
if (data_ep && USB_EP_DIR_IS_OUT(data_ep->bEndpointAddress)) {
- schedule_iso_out_read(node, data_ep->bEndpointAddress,
+ schedule_iso_out_read(c_data, data_ep->bEndpointAddress,
sys_le16_to_cpu(data_ep->wMaxPacketSize),
cfg->as_terminals[as_idx]);
}
/* Skip interfaces without explicit feedback endpoint */
- feedback_ep = get_as_feedback_ep(node, as_idx);
+ feedback_ep = get_as_feedback_ep(c_data, as_idx);
if (feedback_ep == NULL) {
continue;
}
@@ -661,15 +661,15 @@
* previous SOF is "gone" even if USB host did not attempt to
* read it).
*/
- write_explicit_feedback(node, feedback_ep->bEndpointAddress,
+ write_explicit_feedback(c_data, feedback_ep->bEndpointAddress,
cfg->as_terminals[as_idx]);
}
}
-static void *uac2_get_desc(struct usbd_class_node *const node,
+static void *uac2_get_desc(struct usbd_class_data *const c_data,
const enum usbd_speed speed)
{
- struct device *dev = usbd_class_get_private(node);
+ struct device *dev = usbd_class_get_private(c_data);
const struct uac2_cfg *cfg = dev->config;
if (speed == USBD_SPEED_FS) {
@@ -679,9 +679,9 @@
return NULL;
}
-static int uac2_init(struct usbd_class_node *const node)
+static int uac2_init(struct usbd_class_data *const c_data)
{
- const struct device *dev = usbd_class_get_private(node);
+ const struct device *dev = usbd_class_get_private(c_data);
struct uac2_ctx *ctx = dev->data;
if (ctx->ops == NULL) {
@@ -764,7 +764,7 @@
(void *)DEVICE_DT_GET(DT_DRV_INST(inst)), NULL); \
DEFINE_LOOKUP_TABLES(inst) \
static const struct uac2_cfg uac2_cfg_##inst = { \
- .node = &uac2_##inst, \
+ .c_data = &uac2_##inst, \
.descriptors = uac2_descriptors_##inst, \
.entity_types = entity_types_##inst, \
.ep_indexes = ep_indexes_##inst, \
@@ -783,10 +783,10 @@
NULL);
DT_INST_FOREACH_STATUS_OKAY(DEFINE_UAC2_CLASS_DATA)
-static size_t clock_frequencies(struct usbd_class_node *const node,
+static size_t clock_frequencies(struct usbd_class_data *const c_data,
const uint8_t id, const uint32_t **frequencies)
{
- const struct device *dev = usbd_class_get_private(node);
+ const struct device *dev = usbd_class_get_private(c_data);
size_t count;
#define GET_FREQUENCY_TABLE(node, i) \
diff --git a/subsys/usb/device_next/usbd_ch9.c b/subsys/usb/device_next/usbd_ch9.c
index e7e032f..09708a6 100644
--- a/subsys/usb/device_next/usbd_ch9.c
+++ b/subsys/usb/device_next/usbd_ch9.c
@@ -212,7 +212,7 @@
struct usbd_class_iter *iter = usbd_class_get_by_ep(uds_ctx, ep);
if (iter != NULL) {
- usbd_class_feature_halt(iter->c_nd, ep, halted);
+ usbd_class_feature_halt(iter->c_data, ep, halted);
}
}
@@ -499,7 +499,7 @@
SYS_SLIST_FOR_EACH_CONTAINER(&cfg_nd->class_list, iter, node) {
struct usb_desc_header **dhp;
- dhp = usbd_class_get_desc(iter->c_nd, get_desc_speed);
+ dhp = usbd_class_get_desc(iter->c_data, get_desc_speed);
if (dhp == NULL) {
continue;
}
@@ -747,9 +747,9 @@
if (iter != NULL) {
if (reqtype_is_to_device(setup)) {
- ret = usbd_class_control_to_dev(iter->c_nd, setup, dbuf);
+ ret = usbd_class_control_to_dev(iter->c_data, setup, dbuf);
} else {
- ret = usbd_class_control_to_host(iter->c_nd, setup, dbuf);
+ ret = usbd_class_control_to_host(iter->c_data, setup, dbuf);
}
} else {
errno = -ENOTSUP;
diff --git a/subsys/usb/device_next/usbd_class.c b/subsys/usb/device_next/usbd_class.c
index 2c269fa..969348d 100644
--- a/subsys/usb/device_next/usbd_class.c
+++ b/subsys/usb/device_next/usbd_class.c
@@ -24,13 +24,13 @@
#endif
LOG_MODULE_REGISTER(usbd_class, CONFIG_USBD_LOG_LEVEL);
-size_t usbd_class_desc_len(struct usbd_class_node *const c_nd,
+size_t usbd_class_desc_len(struct usbd_class_data *const c_data,
const enum usbd_speed speed)
{
struct usb_desc_header **dhp;
size_t len = 0;
- dhp = usbd_class_get_desc(c_nd, speed);
+ dhp = usbd_class_get_desc(c_data, speed);
/*
* If the desired descriptor is available, count to the last element,
* which must be a pointer to a nil descriptor.
@@ -95,7 +95,7 @@
struct usbd_class_iter *iter;
SYS_SLIST_FOR_EACH_CONTAINER(&cfg_nd->class_list, iter, node) {
- if (bi->owner == iter->c_nd) {
+ if (bi->owner == iter->c_data) {
uint32_t ep_active = iter->ep_active;
uint32_t ep_assigned = iter->ep_assigned;
@@ -187,16 +187,16 @@
}
SYS_SLIST_FOR_EACH_CONTAINER(&cfg_nd->class_list, iter, node) {
- if (iter->c_nd->v_reqs == NULL) {
+ if (iter->c_data->v_reqs == NULL) {
continue;
}
- for (int i = 0; i < iter->c_nd->v_reqs->len; i++) {
+ for (int i = 0; i < iter->c_data->v_reqs->len; i++) {
/*
* First instance always wins.
* There is no other way to determine the recipient.
*/
- if (iter->c_nd->v_reqs->reqs[i] == request) {
+ if (iter->c_data->v_reqs->reqs[i] == request) {
return iter;
}
}
@@ -211,14 +211,14 @@
if (speed == USBD_SPEED_FS) {
STRUCT_SECTION_FOREACH_ALTERNATE(usbd_class_fs,
usbd_class_iter, iter) {
- if (strcmp(name, iter->c_nd->name) == 0) {
+ if (strcmp(name, iter->c_data->name) == 0) {
return iter;
}
}
} else if (speed == USBD_SPEED_HS) {
STRUCT_SECTION_FOREACH_ALTERNATE(usbd_class_hs,
usbd_class_iter, iter) {
- if (strcmp(name, iter->c_nd->name) == 0) {
+ if (strcmp(name, iter->c_data->name) == 0) {
return iter;
}
}
@@ -281,7 +281,7 @@
while ((node = sys_slist_get(&cfg_nd->class_list))) {
iter = CONTAINER_OF(node, struct usbd_class_iter, node);
atomic_clear_bit(&iter->state, USBD_CCTX_REGISTERED);
- usbd_class_shutdown(iter->c_nd);
+ usbd_class_shutdown(iter->c_data);
LOG_DBG("Remove class node %p from configuration %u", iter, cfg);
}
@@ -297,7 +297,7 @@
const enum usbd_speed speed, const uint8_t cfg)
{
struct usbd_class_iter *iter;
- struct usbd_class_node *c_nd;
+ struct usbd_class_data *c_data;
int ret;
iter = usbd_class_iter_get(name, speed);
@@ -313,7 +313,7 @@
goto register_class_error;
}
- c_nd = iter->c_nd;
+ c_data = iter->c_data;
/* TODO: does it still need to be atomic ? */
if (atomic_test_bit(&iter->state, USBD_CCTX_REGISTERED)) {
@@ -322,7 +322,7 @@
goto register_class_error;
}
- if ((c_nd->uds_ctx != NULL) && (c_nd->uds_ctx != uds_ctx)) {
+ if ((c_data->uds_ctx != NULL) && (c_data->uds_ctx != uds_ctx)) {
LOG_ERR("Class registered to other context at different speed");
ret = -EBUSY;
goto register_class_error;
@@ -332,7 +332,7 @@
if (ret == 0) {
/* Initialize pointer back to the device struct */
atomic_set_bit(&iter->state, USBD_CCTX_REGISTERED);
- c_nd->uds_ctx = uds_ctx;
+ c_data->uds_ctx = uds_ctx;
}
register_class_error:
@@ -345,7 +345,7 @@
const enum usbd_speed speed, const uint8_t cfg)
{
struct usbd_class_iter *iter;
- struct usbd_class_node *c_nd;
+ struct usbd_class_data *c_data;
bool can_release_data = true;
int ret;
@@ -362,7 +362,7 @@
goto unregister_class_error;
}
- c_nd = iter->c_nd;
+ c_data = iter->c_data;
/* TODO: does it still need to be atomic ? */
if (!atomic_test_bit(&iter->state, USBD_CCTX_REGISTERED)) {
LOG_WRN("Class instance not registered");
@@ -376,7 +376,7 @@
if (speed == USBD_SPEED_HS) {
STRUCT_SECTION_FOREACH_ALTERNATE(usbd_class_fs,
usbd_class_iter, i) {
- if ((i->c_nd == iter->c_nd) &&
+ if ((i->c_data == iter->c_data) &&
atomic_test_bit(&i->state, USBD_CCTX_REGISTERED)) {
can_release_data = false;
break;
@@ -385,7 +385,7 @@
} else {
STRUCT_SECTION_FOREACH_ALTERNATE(usbd_class_hs,
usbd_class_iter, i) {
- if ((i->c_nd == iter->c_nd) &&
+ if ((i->c_data == iter->c_data) &&
atomic_test_bit(&i->state, USBD_CCTX_REGISTERED)) {
can_release_data = false;
break;
@@ -396,10 +396,10 @@
ret = usbd_class_remove(uds_ctx, iter, speed, cfg);
if (ret == 0) {
atomic_clear_bit(&iter->state, USBD_CCTX_REGISTERED);
- usbd_class_shutdown(iter->c_nd);
+ usbd_class_shutdown(iter->c_data);
if (can_release_data) {
- c_nd->uds_ctx = NULL;
+ c_data->uds_ctx = NULL;
}
}
diff --git a/subsys/usb/device_next/usbd_class.h b/subsys/usb/device_next/usbd_class.h
index 469433e..7636d8a 100644
--- a/subsys/usb/device_next/usbd_class.h
+++ b/subsys/usb/device_next/usbd_class.h
@@ -29,12 +29,12 @@
* Calculated length does not include any string descriptors that may be
* used by the class instance.
*
- * @param[in] node Pointer to a class node
+ * @param[in] c_data Pointer to a class data
* @param[in] speed Speed-dependent descriptor selector
*
* @return Length of the class descriptor
*/
-size_t usbd_class_desc_len(struct usbd_class_node *const c_nd,
+size_t usbd_class_desc_len(struct usbd_class_data *const c_data,
const enum usbd_speed speed);
/**
diff --git a/subsys/usb/device_next/usbd_class_api.h b/subsys/usb/device_next/usbd_class_api.h
index a312a09..88207cc 100644
--- a/subsys/usb/device_next/usbd_class_api.h
+++ b/subsys/usb/device_next/usbd_class_api.h
@@ -22,18 +22,18 @@
* This is the event handler for all endpoint accommodated
* by a class instance.
*
- * @param[in] node Pointer to USB device class node
+ * @param[in] c_data Pointer to USB device class data
* @param[in] buf Control Request Data buffer
* @param[in] err Result of the transfer. 0 if the transfer was successful.
*/
-static inline int usbd_class_request(struct usbd_class_node *const node,
+static inline int usbd_class_request(struct usbd_class_data *const c_data,
struct net_buf *const buf,
int err)
{
- const struct usbd_class_api *api = node->api;
+ const struct usbd_class_api *api = c_data->api;
if (api->request != NULL) {
- return api->request(node, buf, err);
+ return api->request(c_data, buf, err);
}
return -ENOTSUP;
@@ -53,20 +53,20 @@
*
* The execution of the handler must not block.
*
- * @param[in] node Pointer to USB device class node
+ * @param[in] c_data Pointer to USB device class data
* @param[in] setup Pointer to USB Setup Packet
* @param[in] buf Control Request Data buffer
*
* @return 0 on success, other values on fail.
*/
-static inline int usbd_class_control_to_host(struct usbd_class_node *const node,
+static inline int usbd_class_control_to_host(struct usbd_class_data *const c_data,
struct usb_setup_packet *const setup,
struct net_buf *const buf)
{
- const struct usbd_class_api *api = node->api;
+ const struct usbd_class_api *api = c_data->api;
if (api->control_to_host != NULL) {
- return api->control_to_host(node, setup, buf);
+ return api->control_to_host(c_data, setup, buf);
}
errno = -ENOTSUP;
@@ -86,20 +86,20 @@
*
* The execution of the handler must not block.
*
- * @param[in] node Pointer to USB device class node
+ * @param[in] c_data Pointer to USB device class data
* @param[in] setup Pointer to USB Setup Packet
* @param[in] buf Control Request Data buffer
*
* @return 0 on success, other values on fail.
*/
-static inline int usbd_class_control_to_dev(struct usbd_class_node *const node,
+static inline int usbd_class_control_to_dev(struct usbd_class_data *const c_data,
struct usb_setup_packet *const setup,
struct net_buf *const buf)
{
- const struct usbd_class_api *api = node->api;
+ const struct usbd_class_api *api = c_data->api;
if (api->control_to_dev != NULL) {
- return api->control_to_dev(node, setup, buf);
+ return api->control_to_dev(c_data, setup, buf);
}
errno = -ENOTSUP;
@@ -115,19 +115,19 @@
*
* The execution of the handler must not block.
*
- * @param[in] node Pointer to USB device class node
+ * @param[in] c_data Pointer to USB device class data
* @param[in] ep Endpoint
* @param[in] halted True if the endpoint has been halted and false if
* the endpoint halt has been cleared by a Feature request.
*/
-static inline void usbd_class_feature_halt(struct usbd_class_node *const node,
+static inline void usbd_class_feature_halt(struct usbd_class_data *const c_data,
const uint8_t ep,
const bool halted)
{
- const struct usbd_class_api *api = node->api;
+ const struct usbd_class_api *api = c_data->api;
if (api->feature_halt != NULL) {
- api->feature_halt(node, ep, halted);
+ api->feature_halt(c_data, ep, halted);
}
}
@@ -140,18 +140,18 @@
*
* The execution of the handler must not block.
*
- * @param[in] node Pointer to USB device class node
+ * @param[in] c_data Pointer to USB device class data
* @param[in] iface Interface
* @param[in] alternate Alternate setting
*/
-static inline void usbd_class_update(struct usbd_class_node *const node,
+static inline void usbd_class_update(struct usbd_class_data *const c_data,
const uint8_t iface,
const uint8_t alternate)
{
- const struct usbd_class_api *api = node->api;
+ const struct usbd_class_api *api = c_data->api;
if (api->update != NULL) {
- api->update(node, iface, alternate);
+ api->update(c_data, iface, alternate);
}
}
@@ -159,14 +159,14 @@
/**
* @brief USB suspended handler
*
- * @param[in] node Pointer to USB device class node
+ * @param[in] c_data Pointer to USB device class data
*/
-static inline void usbd_class_suspended(struct usbd_class_node *const node)
+static inline void usbd_class_suspended(struct usbd_class_data *const c_data)
{
- const struct usbd_class_api *api = node->api;
+ const struct usbd_class_api *api = c_data->api;
if (api->suspended != NULL) {
- api->suspended(node);
+ api->suspended(c_data);
}
}
@@ -174,14 +174,14 @@
/**
* @brief USB resumed handler
*
- * @param[in] node Pointer to USB device class node
+ * @param[in] c_data Pointer to USB device class data
*/
-static inline void usbd_class_resumed(struct usbd_class_node *const node)
+static inline void usbd_class_resumed(struct usbd_class_data *const c_data)
{
- const struct usbd_class_api *api = node->api;
+ const struct usbd_class_api *api = c_data->api;
if (api->resumed != NULL) {
- api->resumed(node);
+ api->resumed(c_data);
}
}
@@ -190,14 +190,14 @@
*
* @note The execution of the handler must not block.
*
- * @param[in] node Pointer to USB device class node
+ * @param[in] c_data Pointer to USB device class data
*/
-static inline void usbd_class_sof(struct usbd_class_node *const node)
+static inline void usbd_class_sof(struct usbd_class_data *const c_data)
{
- const struct usbd_class_api *api = node->api;
+ const struct usbd_class_api *api = c_data->api;
if (api->sof != NULL) {
- api->sof(node);
+ api->sof(c_data);
}
}
@@ -206,14 +206,14 @@
*
* @note The execution of the handler must not block.
*
- * @param[in] node Pointer to USB device class node
+ * @param[in] c_data Pointer to USB device class data
*/
-static inline void usbd_class_enable(struct usbd_class_node *const node)
+static inline void usbd_class_enable(struct usbd_class_data *const c_data)
{
- const struct usbd_class_api *api = node->api;
+ const struct usbd_class_api *api = c_data->api;
if (api->enable != NULL) {
- api->enable(node);
+ api->enable(c_data);
}
}
@@ -222,14 +222,14 @@
*
* @note The execution of the handler must not block.
*
- * @param[in] node Pointer to USB device class node
+ * @param[in] c_data Pointer to USB device class data
*/
-static inline void usbd_class_disable(struct usbd_class_node *const node)
+static inline void usbd_class_disable(struct usbd_class_data *const c_data)
{
- const struct usbd_class_api *api = node->api;
+ const struct usbd_class_api *api = c_data->api;
if (api->disable != NULL) {
- api->disable(node);
+ api->disable(c_data);
}
}
@@ -244,16 +244,16 @@
*
* @note If this call fails the core will terminate stack initialization.
*
- * @param[in] node Pointer to USB device class node
+ * @param[in] c_data Pointer to USB device class data
*
* @return 0 on success, other values on fail.
*/
-static inline int usbd_class_init(struct usbd_class_node *const node)
+static inline int usbd_class_init(struct usbd_class_data *const c_data)
{
- const struct usbd_class_api *api = node->api;
+ const struct usbd_class_api *api = c_data->api;
if (api->init != NULL) {
- return api->init(node);
+ return api->init(c_data);
}
return -ENOTSUP;
@@ -266,33 +266,33 @@
*
* @note The execution of the handler must not block.
*
- * @param[in] node Pointer to USB device class node
+ * @param[in] c_data Pointer to USB device class data
*/
-static inline void usbd_class_shutdown(struct usbd_class_node *const node)
+static inline void usbd_class_shutdown(struct usbd_class_data *const c_data)
{
- const struct usbd_class_api *api = node->api;
+ const struct usbd_class_api *api = c_data->api;
if (api->shutdown != NULL) {
- api->shutdown(node);
+ api->shutdown(c_data);
}
}
/**
* @brief Get function descriptor
*
- * @param[in] node Pointer to USB device class node
+ * @param[in] c_data Pointer to USB device class data
* @param[in] speed For which speed descriptor is requested.
*
* @return Array of struct usb_desc_header pointers with a last element
* pointing to a nil descriptor on success, NULL if not available.
*/
-static inline void *usbd_class_get_desc(struct usbd_class_node *const node,
+static inline void *usbd_class_get_desc(struct usbd_class_data *const c_data,
const enum usbd_speed speed)
{
- const struct usbd_class_api *api = node->api;
+ const struct usbd_class_api *api = c_data->api;
if (api->get_desc != NULL) {
- return api->get_desc(node, speed);
+ return api->get_desc(c_data, speed);
}
return NULL;
diff --git a/subsys/usb/device_next/usbd_config.c b/subsys/usb/device_next/usbd_config.c
index f9f37c9..f1528bf 100644
--- a/subsys/usb/device_next/usbd_config.c
+++ b/subsys/usb/device_next/usbd_config.c
@@ -63,9 +63,9 @@
SYS_SLIST_FOR_EACH_CONTAINER(&cfg_nd->class_list, iter, node) {
if (enable) {
- usbd_class_enable(iter->c_nd);
+ usbd_class_enable(iter->c_data);
} else {
- usbd_class_disable(iter->c_nd);
+ usbd_class_disable(iter->c_data);
}
}
}
diff --git a/subsys/usb/device_next/usbd_core.c b/subsys/usb/device_next/usbd_core.c
index 0fffac2..cdd91ab 100644
--- a/subsys/usb/device_next/usbd_core.c
+++ b/subsys/usb/device_next/usbd_core.c
@@ -78,13 +78,13 @@
SYS_SLIST_FOR_EACH_CONTAINER(&cfg_nd->class_list, iter, node) {
switch (event->type) {
case UDC_EVT_SUSPEND:
- usbd_class_suspended(iter->c_nd);
+ usbd_class_suspended(iter->c_data);
break;
case UDC_EVT_RESUME:
- usbd_class_resumed(iter->c_nd);
+ usbd_class_resumed(iter->c_data);
break;
case UDC_EVT_SOF:
- usbd_class_sof(iter->c_nd);
+ usbd_class_sof(iter->c_data);
break;
default:
break;
@@ -265,11 +265,11 @@
LOG_DBG("Available USB class iterators:");
STRUCT_SECTION_FOREACH_ALTERNATE(usbd_class_fs, usbd_class_iter, iter) {
atomic_set(&iter->state, 0);
- LOG_DBG("\t%p->%p, name %s", iter, iter->c_nd, iter->c_nd->name);
+ LOG_DBG("\t%p->%p, name %s", iter, iter->c_data, iter->c_data->name);
}
STRUCT_SECTION_FOREACH_ALTERNATE(usbd_class_hs, usbd_class_iter, iter) {
atomic_set(&iter->state, 0);
- LOG_DBG("\t%p->%p, name %s", iter, iter->c_nd, iter->c_nd->name);
+ LOG_DBG("\t%p->%p, name %s", iter, iter->c_data, iter->c_data->name);
}
return 0;
diff --git a/subsys/usb/device_next/usbd_endpoint.c b/subsys/usb/device_next/usbd_endpoint.c
index 82f3509..31ac1a5 100644
--- a/subsys/usb/device_next/usbd_endpoint.c
+++ b/subsys/usb/device_next/usbd_endpoint.c
@@ -120,18 +120,18 @@
return udc_ep_enqueue(uds_ctx->dev, buf);
}
-struct net_buf *usbd_ep_buf_alloc(const struct usbd_class_node *const c_nd,
+struct net_buf *usbd_ep_buf_alloc(const struct usbd_class_data *const c_data,
const uint8_t ep, const size_t size)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_nd);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
return udc_ep_buf_alloc(uds_ctx->dev, ep, size);
}
-int usbd_ep_enqueue(const struct usbd_class_node *const c_nd,
+int usbd_ep_enqueue(const struct usbd_class_data *const c_data,
struct net_buf *const buf)
{
- struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_nd);
+ struct usbd_contex *uds_ctx = usbd_class_get_ctx(c_data);
struct udc_buf_info *bi = udc_get_buf_info(buf);
if (USB_EP_DIR_IS_IN(bi->ep)) {
@@ -140,7 +140,7 @@
}
}
- bi->owner = (void *)c_nd;
+ bi->owner = (void *)c_data;
return udc_ep_enqueue(uds_ctx->dev, buf);
}
diff --git a/subsys/usb/device_next/usbd_init.c b/subsys/usb/device_next/usbd_init.c
index cfa3a06..7f18a79 100644
--- a/subsys/usb/device_next/usbd_init.c
+++ b/subsys/usb/device_next/usbd_init.c
@@ -122,7 +122,7 @@
int ret;
LOG_DBG("Initializing configuration for %u speed", speed);
- dhp = usbd_class_get_desc(iter->c_nd, speed);
+ dhp = usbd_class_get_desc(iter->c_data, speed);
if (dhp == NULL) {
return 0;
}
@@ -211,15 +211,15 @@
return ret;
}
- ret = usbd_class_init(iter->c_nd);
+ ret = usbd_class_init(iter->c_data);
if (ret != 0) {
LOG_ERR("Failed to initialize class instance");
return ret;
}
LOG_INF("Init class node %p, descriptor length %zu",
- iter->c_nd, usbd_class_desc_len(iter->c_nd, speed));
- cfg_len += usbd_class_desc_len(iter->c_nd, speed);
+ iter->c_data, usbd_class_desc_len(iter->c_data, speed));
+ cfg_len += usbd_class_desc_len(iter->c_data, speed);
}
/* Update wTotalLength and bNumInterfaces of configuration descriptor */
diff --git a/subsys/usb/device_next/usbd_interface.c b/subsys/usb/device_next/usbd_interface.c
index 9859dd5..1ab1683 100644
--- a/subsys/usb/device_next/usbd_interface.c
+++ b/subsys/usb/device_next/usbd_interface.c
@@ -60,7 +60,7 @@
bool found_iface = false;
int ret;
- dhp = usbd_class_get_desc(iter->c_nd, usbd_bus_speed(uds_ctx));
+ dhp = usbd_class_get_desc(iter->c_data, usbd_bus_speed(uds_ctx));
if (dhp == NULL) {
return -EINVAL;
}
@@ -207,7 +207,7 @@
return ret;
}
- usbd_class_update(class->c_nd, iface, alt);
+ usbd_class_update(class->c_data, iface, alt);
usbd_set_alt_value(uds_ctx, iface, alt);
return 0;
diff --git a/subsys/usb/device_next/usbd_shell.c b/subsys/usb/device_next/usbd_shell.c
index d3e771d..9351b73 100644
--- a/subsys/usb/device_next/usbd_shell.c
+++ b/subsys/usb/device_next/usbd_shell.c
@@ -401,10 +401,10 @@
entry->subcmd = NULL;
STRUCT_SECTION_FOREACH_ALTERNATE(usbd_class_fs, usbd_class_iter, iter) {
- if ((iter->c_nd->name != NULL) &&
- (strlen(iter->c_nd->name) != 0)) {
+ if ((iter->c_data->name != NULL) &&
+ (strlen(iter->c_data->name) != 0)) {
if (match_idx == idx) {
- entry->syntax = iter->c_nd->name;
+ entry->syntax = iter->c_data->name;
break;
}