Skip to content

Commit

Permalink
usb: device_next: Rename usbd_contex to usbd_context
Browse files Browse the repository at this point in the history
Add the missing "t" to struct usbd_contex. No functional changes.

Signed-off-by: Tomasz Moń <[email protected]>
  • Loading branch information
tmon-nordic authored and carlescufi committed Jun 3, 2024
1 parent b76fde6 commit 8d344cc
Show file tree
Hide file tree
Showing 38 changed files with 209 additions and 209 deletions.
2 changes: 1 addition & 1 deletion cmake/linker_script/common/common-ram.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ endif()

if(CONFIG_USB_DEVICE_STACK OR CONFIG_USB_DEVICE_STACK_NEXT)
zephyr_iterable_section(NAME usb_cfg_data GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN CONFIG_LINKER_ITERABLE_SUBALIGN)
zephyr_iterable_section(NAME usbd_contex GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN CONFIG_LINKER_ITERABLE_SUBALIGN)
zephyr_iterable_section(NAME usbd_context GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN CONFIG_LINKER_ITERABLE_SUBALIGN)
zephyr_iterable_section(NAME usbd_class_fs GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN CONFIG_LINKER_ITERABLE_SUBALIGN)
zephyr_iterable_section(NAME usbd_class_hs GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN CONFIG_LINKER_ITERABLE_SUBALIGN)
endif()
Expand Down
66 changes: 33 additions & 33 deletions include/zephyr/usb/usbd.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ struct usbd_status {
enum usbd_speed speed : 2;
};

struct usbd_contex;
struct usbd_context;

/**
* @brief Callback type definition for USB device message delivery
Expand All @@ -212,7 +212,7 @@ struct usbd_contex;
* @param[in] ctx Pointer to USB device support context
* @param[in] msg Pointer to USB device message
*/
typedef void (*usbd_msg_cb_t)(struct usbd_contex *const ctx,
typedef void (*usbd_msg_cb_t)(struct usbd_context *const ctx,
const struct usbd_msg *const msg);

/**
Expand All @@ -221,7 +221,7 @@ typedef void (*usbd_msg_cb_t)(struct usbd_contex *const ctx,
* Main structure that organizes all descriptors, configuration,
* and interfaces. An UDC device must be assigned to this structure.
*/
struct usbd_contex {
struct usbd_context {
/** Name of the USB device */
const char *name;
/** Access mutex */
Expand Down Expand Up @@ -320,7 +320,7 @@ struct usbd_class_data {
/** Name of the USB device class instance */
const char *name;
/** Pointer to USB device stack context structure */
struct usbd_contex *uds_ctx;
struct usbd_context *uds_ctx;
/** Pointer to device support class API */
const struct usbd_class_api *api;
/** Supported vendor request table, can be NULL */
Expand Down Expand Up @@ -368,7 +368,7 @@ struct usbd_class_node {
*
* @return Pointer to USB device runtime context
*/
static inline struct usbd_contex *usbd_class_get_ctx(const struct usbd_class_data *const c_data)
static inline struct usbd_context *usbd_class_get_ctx(const struct usbd_class_data *const c_data)
{
return c_data->uds_ctx;
}
Expand Down Expand Up @@ -423,7 +423,7 @@ static inline void *usbd_class_get_private(const struct usbd_class_data *const c
.iSerialNumber = 0, \
.bNumConfigurations = 0, \
}; \
static STRUCT_SECTION_ITERABLE(usbd_contex, device_name) = { \
static STRUCT_SECTION_ITERABLE(usbd_context, device_name) = { \
.name = STRINGIFY(device_name), \
.dev = uhc_dev, \
.fs_desc = &fs_desc_##device_name, \
Expand Down Expand Up @@ -609,7 +609,7 @@ static inline void *usbd_class_get_private(const struct usbd_class_data *const c
*
* @return 0 on success, other values on fail.
*/
int usbd_add_descriptor(struct usbd_contex *uds_ctx,
int usbd_add_descriptor(struct usbd_context *uds_ctx,
struct usbd_desc_node *dn);

/**
Expand Down Expand Up @@ -639,7 +639,7 @@ void usbd_remove_descriptor(struct usbd_desc_node *const desc_nd);
*
* @return 0 on success, other values on fail.
*/
int usbd_add_configuration(struct usbd_contex *uds_ctx,
int usbd_add_configuration(struct usbd_context *uds_ctx,
const enum usbd_speed speed,
struct usbd_config_node *cd);

Expand All @@ -664,7 +664,7 @@ int usbd_add_configuration(struct usbd_contex *uds_ctx,
*
* @return 0 on success, other values on fail.
*/
int usbd_register_class(struct usbd_contex *uds_ctx,
int usbd_register_class(struct usbd_context *uds_ctx,
const char *name,
const enum usbd_speed speed, uint8_t cfg);

Expand All @@ -682,7 +682,7 @@ int usbd_register_class(struct usbd_contex *uds_ctx,
*
* @return 0 on success, other values on fail.
*/
int usbd_unregister_class(struct usbd_contex *uds_ctx,
int usbd_unregister_class(struct usbd_context *uds_ctx,
const char *name,
const enum usbd_speed speed, uint8_t cfg);

Expand All @@ -694,7 +694,7 @@ int usbd_unregister_class(struct usbd_contex *uds_ctx,
*
* @return 0 on success, other values on fail.
*/
int usbd_msg_register_cb(struct usbd_contex *const uds_ctx,
int usbd_msg_register_cb(struct usbd_context *const uds_ctx,
const usbd_msg_cb_t cb);

/**
Expand All @@ -710,7 +710,7 @@ int usbd_msg_register_cb(struct usbd_contex *const uds_ctx,
*
* @return 0 on success, other values on fail.
*/
int usbd_init(struct usbd_contex *uds_ctx);
int usbd_init(struct usbd_context *uds_ctx);

/**
* @brief Enable the USB device support and registered class instances
Expand All @@ -721,7 +721,7 @@ int usbd_init(struct usbd_contex *uds_ctx);
*
* @return 0 on success, other values on fail.
*/
int usbd_enable(struct usbd_contex *uds_ctx);
int usbd_enable(struct usbd_context *uds_ctx);

/**
* @brief Disable the USB device support
Expand All @@ -732,7 +732,7 @@ int usbd_enable(struct usbd_contex *uds_ctx);
*
* @return 0 on success, other values on fail.
*/
int usbd_disable(struct usbd_contex *uds_ctx);
int usbd_disable(struct usbd_context *uds_ctx);

/**
* @brief Shutdown the USB device support
Expand All @@ -743,7 +743,7 @@ int usbd_disable(struct usbd_contex *uds_ctx);
*
* @return 0 on success, other values on fail.
*/
int usbd_shutdown(struct usbd_contex *const uds_ctx);
int usbd_shutdown(struct usbd_context *const uds_ctx);

/**
* @brief Halt endpoint
Expand All @@ -753,7 +753,7 @@ int usbd_shutdown(struct usbd_contex *const uds_ctx);
*
* @return 0 on success, or error from udc_ep_set_halt()
*/
int usbd_ep_set_halt(struct usbd_contex *uds_ctx, uint8_t ep);
int usbd_ep_set_halt(struct usbd_context *uds_ctx, uint8_t ep);

/**
* @brief Clear endpoint halt
Expand All @@ -763,7 +763,7 @@ int usbd_ep_set_halt(struct usbd_contex *uds_ctx, uint8_t ep);
*
* @return 0 on success, or error from udc_ep_clear_halt()
*/
int usbd_ep_clear_halt(struct usbd_contex *uds_ctx, uint8_t ep);
int usbd_ep_clear_halt(struct usbd_context *uds_ctx, uint8_t ep);

/**
* @brief Checks whether the endpoint is halted.
Expand All @@ -773,7 +773,7 @@ int usbd_ep_clear_halt(struct usbd_contex *uds_ctx, uint8_t ep);
*
* @return true if endpoint is halted, false otherwise
*/
bool usbd_ep_is_halted(struct usbd_contex *uds_ctx, uint8_t ep);
bool usbd_ep_is_halted(struct usbd_context *uds_ctx, uint8_t ep);

/**
* @brief Allocate buffer for USB device request
Expand All @@ -799,7 +799,7 @@ struct net_buf *usbd_ep_buf_alloc(const struct usbd_class_data *const c_data,
*
* @return 0 on success, all other values should be treated as error.
*/
int usbd_ep_ctrl_enqueue(struct usbd_contex *const uds_ctx,
int usbd_ep_ctrl_enqueue(struct usbd_context *const uds_ctx,
struct net_buf *const buf);

/**
Expand All @@ -823,7 +823,7 @@ int usbd_ep_enqueue(const struct usbd_class_data *const c_data,
*
* @return 0 on success, or error from udc_ep_dequeue()
*/
int usbd_ep_dequeue(struct usbd_contex *uds_ctx, const uint8_t ep);
int usbd_ep_dequeue(struct usbd_context *uds_ctx, const uint8_t ep);

/**
* @brief Free USB device request buffer
Expand All @@ -835,7 +835,7 @@ int usbd_ep_dequeue(struct usbd_contex *uds_ctx, const uint8_t ep);
*
* @return 0 on success, all other values should be treated as error.
*/
int usbd_ep_buf_free(struct usbd_contex *uds_ctx, struct net_buf *buf);
int usbd_ep_buf_free(struct usbd_context *uds_ctx, struct net_buf *buf);

/**
* @brief Checks whether the USB device controller is suspended.
Expand All @@ -844,14 +844,14 @@ int usbd_ep_buf_free(struct usbd_contex *uds_ctx, struct net_buf *buf);
*
* @return true if endpoint is halted, false otherwise
*/
bool usbd_is_suspended(struct usbd_contex *uds_ctx);
bool usbd_is_suspended(struct usbd_context *uds_ctx);

/**
* @brief Initiate the USB remote wakeup (TBD)
*
* @return 0 on success, other values on fail.
*/
int usbd_wakeup_request(struct usbd_contex *uds_ctx);
int usbd_wakeup_request(struct usbd_context *uds_ctx);

/**
* @brief Get actual device speed
Expand All @@ -860,7 +860,7 @@ int usbd_wakeup_request(struct usbd_contex *uds_ctx);
*
* @return Actual device speed
*/
enum usbd_speed usbd_bus_speed(const struct usbd_contex *const uds_ctx);
enum usbd_speed usbd_bus_speed(const struct usbd_context *const uds_ctx);

/**
* @brief Get highest speed supported by the controller
Expand All @@ -869,7 +869,7 @@ enum usbd_speed usbd_bus_speed(const struct usbd_contex *const uds_ctx);
*
* @return Highest supported speed
*/
enum usbd_speed usbd_caps_speed(const struct usbd_contex *const uds_ctx);
enum usbd_speed usbd_caps_speed(const struct usbd_context *const uds_ctx);

/**
* @brief Set USB device descriptor value bcdUSB
Expand All @@ -880,7 +880,7 @@ enum usbd_speed usbd_caps_speed(const struct usbd_contex *const uds_ctx);
*
* @return 0 on success, other values on fail.
*/
int usbd_device_set_bcd(struct usbd_contex *const uds_ctx,
int usbd_device_set_bcd(struct usbd_context *const uds_ctx,
const enum usbd_speed speed, const uint16_t bcd);

/**
Expand All @@ -891,7 +891,7 @@ int usbd_device_set_bcd(struct usbd_contex *const uds_ctx,
*
* @return 0 on success, other values on fail.
*/
int usbd_device_set_vid(struct usbd_contex *const uds_ctx,
int usbd_device_set_vid(struct usbd_context *const uds_ctx,
const uint16_t vid);

/**
Expand All @@ -902,7 +902,7 @@ int usbd_device_set_vid(struct usbd_contex *const uds_ctx,
*
* @return 0 on success, other values on fail.
*/
int usbd_device_set_pid(struct usbd_contex *const uds_ctx,
int usbd_device_set_pid(struct usbd_context *const uds_ctx,
const uint16_t pid);

/**
Expand All @@ -916,7 +916,7 @@ int usbd_device_set_pid(struct usbd_contex *const uds_ctx,
*
* @return 0 on success, other values on fail.
*/
int usbd_device_set_code_triple(struct usbd_contex *const uds_ctx,
int usbd_device_set_code_triple(struct usbd_context *const uds_ctx,
const enum usbd_speed speed,
const uint8_t base_class,
const uint8_t subclass, const uint8_t protocol);
Expand All @@ -931,7 +931,7 @@ int usbd_device_set_code_triple(struct usbd_contex *const uds_ctx,
*
* @return 0 on success, other values on fail.
*/
int usbd_config_attrib_rwup(struct usbd_contex *const uds_ctx,
int usbd_config_attrib_rwup(struct usbd_context *const uds_ctx,
const enum usbd_speed speed,
const uint8_t cfg, const bool enable);

Expand All @@ -945,7 +945,7 @@ int usbd_config_attrib_rwup(struct usbd_contex *const uds_ctx,
*
* @return 0 on success, other values on fail.
*/
int usbd_config_attrib_self(struct usbd_contex *const uds_ctx,
int usbd_config_attrib_self(struct usbd_context *const uds_ctx,
const enum usbd_speed speed,
const uint8_t cfg, const bool enable);

Expand All @@ -959,7 +959,7 @@ int usbd_config_attrib_self(struct usbd_contex *const uds_ctx,
*
* @return 0 on success, other values on fail.
*/
int usbd_config_maxpower(struct usbd_contex *const uds_ctx,
int usbd_config_maxpower(struct usbd_context *const uds_ctx,
const enum usbd_speed speed,
const uint8_t cfg, const uint8_t power);

Expand All @@ -975,7 +975,7 @@ int usbd_config_maxpower(struct usbd_contex *const uds_ctx,
*
* @return true if controller can detect VBUS state change, false otherwise
*/
bool usbd_can_detect_vbus(struct usbd_contex *const uds_ctx);
bool usbd_can_detect_vbus(struct usbd_context *const uds_ctx);

/**
* @}
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/hci_usb/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

static int enable_usb_device_next(void)
{
struct usbd_contex *sample_usbd = sample_usbd_init_device(NULL);
struct usbd_context *sample_usbd = sample_usbd_init_device(NULL);

if (sample_usbd == NULL) {
printk("Failed to initialize USB device");
Expand Down
4 changes: 2 additions & 2 deletions samples/subsys/usb/cdc_acm/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ static inline void print_baudrate(const struct device *dev)
}

#if defined(CONFIG_USB_DEVICE_STACK_NEXT)
static struct usbd_contex *sample_usbd;
static struct usbd_context *sample_usbd;
K_SEM_DEFINE(dtr_sem, 0, 1);

static void sample_msg_cb(struct usbd_contex *const ctx, const struct usbd_msg *msg)
static void sample_msg_cb(struct usbd_context *const ctx, const struct usbd_msg *msg)
{
LOG_INF("USBD message: %s", usbd_msg_type_string(msg->type));

Expand Down
2 changes: 1 addition & 1 deletion samples/subsys/usb/common/sample_usbd.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
* It returns the configured and initialized USB device context on success,
* otherwise it returns NULL.
*/
struct usbd_contex *sample_usbd_init_device(usbd_msg_cb_t msg_cb);
struct usbd_context *sample_usbd_init_device(usbd_msg_cb_t msg_cb);

#endif /* ZEPHYR_SAMPLES_SUBSYS_USB_COMMON_SAMPLE_USBD_H */
8 changes: 4 additions & 4 deletions samples/subsys/usb/common/sample_usbd_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static const struct usb_bos_capability_lpm bos_cap_lpm = {

USBD_DESC_BOS_DEFINE(sample_usbext, sizeof(bos_cap_lpm), &bos_cap_lpm);

static int register_fs_classes(struct usbd_contex *uds_ctx)
static int register_fs_classes(struct usbd_context *uds_ctx)
{
int err = 0;

Expand All @@ -71,7 +71,7 @@ static int register_fs_classes(struct usbd_contex *uds_ctx)
return err;
}

static int register_hs_classes(struct usbd_contex *uds_ctx)
static int register_hs_classes(struct usbd_context *uds_ctx)
{
int err = 0;

Expand All @@ -91,7 +91,7 @@ static int register_hs_classes(struct usbd_contex *uds_ctx)
return err;
}

static int sample_add_configuration(struct usbd_contex *uds_ctx,
static int sample_add_configuration(struct usbd_context *uds_ctx,
const enum usbd_speed speed,
struct usbd_config_node *config)
{
Expand Down Expand Up @@ -131,7 +131,7 @@ static int sample_add_configuration(struct usbd_contex *uds_ctx,
return 0;
}

struct usbd_contex *sample_usbd_init_device(usbd_msg_cb_t msg_cb)
struct usbd_context *sample_usbd_init_device(usbd_msg_cb_t msg_cb)
{
int err;

Expand Down
2 changes: 1 addition & 1 deletion samples/subsys/usb/console/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ BUILD_ASSERT(DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart),
"Console device is not ACM CDC UART device");

#if defined(CONFIG_USB_DEVICE_STACK_NEXT)
static struct usbd_contex *sample_usbd;
static struct usbd_context *sample_usbd;

static int enable_usb_device_next(void)
{
Expand Down
2 changes: 1 addition & 1 deletion samples/subsys/usb/hid-keyboard/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ struct hid_device_ops kb_ops = {

int main(void)
{
struct usbd_contex *sample_usbd;
struct usbd_context *sample_usbd;
const struct device *hid_dev;
int ret;

Expand Down
2 changes: 1 addition & 1 deletion samples/subsys/usb/hid-mouse/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ INPUT_CALLBACK_DEFINE(NULL, input_cb);
#if defined(CONFIG_USB_DEVICE_STACK_NEXT)
static int enable_usb_device_next(void)
{
struct usbd_contex *sample_usbd;
struct usbd_context *sample_usbd;
int err;

sample_usbd = sample_usbd_init_device(NULL);
Expand Down
Loading

0 comments on commit 8d344cc

Please sign in to comment.