Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
usbd_msg.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12#ifndef ZEPHYR_INCLUDE_USBD_MSG_H_
13#define ZEPHYR_INCLUDE_USBD_MSG_H_
14
15#include <stdint.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
53};
54
55
56static const char *const usbd_msg_type_list[] = {
57 "VBUS ready",
58 "VBUS removed",
59 "Device resumed",
60 "Device suspended",
61 "Bus reset",
62 "Controller error",
63 "Stack error",
64 "CDC ACM line coding",
65 "CDC ACM control line state",
66};
67
69 "Number of entries in usbd_msg_type_list is not equal to USBD_MSG_MAX_NUMBER");
70
74struct usbd_msg {
78 union {
79 int status;
80 const struct device *dev;
81 };
82};
83
91static inline const char *usbd_msg_type_string(const enum usbd_msg_type type)
92{
93 if (type >= 0 && type < USBD_MSG_MAX_NUMBER) {
94 return usbd_msg_type_list[type];
95 }
96
97 return "?";
98}
99
104#ifdef __cplusplus
105}
106#endif
107
108#endif /* ZEPHYR_INCLUDE_USBD_MSG_H_ */
#define ARRAY_SIZE(array)
Number of elements in the given array.
Definition: util.h:127
static const char *const usbd_msg_type_list[]
Definition: usbd_msg.h:56
Number of entries in usbd_msg_type_list is not equal to USBD_MSG_MAX_NUMBER
Maximum number of message types.
Definition: usbd_msg.h:69
static const char * usbd_msg_type_string(const enum usbd_msg_type type)
Returns the message type as a constant string.
Definition: usbd_msg.h:91
usbd_msg_type
USB device support message types.
Definition: usbd_msg.h:32
@ USBD_MSG_RESUME
Device resume message.
Definition: usbd_msg.h:38
@ USBD_MSG_UDC_ERROR
Non-correctable UDC error message
Definition: usbd_msg.h:44
@ USBD_MSG_VBUS_READY
VBUS ready message (optional)
Definition: usbd_msg.h:34
@ USBD_MSG_SUSPEND
Device suspended message.
Definition: usbd_msg.h:40
@ USBD_MSG_CDC_ACM_LINE_CODING
CDC ACM Line Coding update.
Definition: usbd_msg.h:48
@ USBD_MSG_VBUS_REMOVED
VBUS removed message (optional)
Definition: usbd_msg.h:36
@ USBD_MSG_CDC_ACM_CONTROL_LINE_STATE
CDC ACM Line State update.
Definition: usbd_msg.h:50
@ USBD_MSG_RESET
Bus reset detected.
Definition: usbd_msg.h:42
@ USBD_MSG_STACK_ERROR
Unrecoverable device stack error message
Definition: usbd_msg.h:46
Runtime device structure (in ROM) per driver instance.
Definition: device.h:399
USB device message.
Definition: usbd_msg.h:74
enum usbd_msg_type type
Message type.
Definition: usbd_msg.h:76
const struct device * dev
Definition: usbd_msg.h:80
int status
Definition: usbd_msg.h:79