Zephyr API
4.4.99
A Scalable Open Source RTOS
Toggle main menu visibility
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
11
12
#ifndef ZEPHYR_INCLUDE_USBD_MSG_H_
13
#define ZEPHYR_INCLUDE_USBD_MSG_H_
14
15
#include <
stdint.h
>
16
17
#ifdef __cplusplus
18
extern
"C"
{
19
#endif
20
28
34
enum
usbd_msg_type
{
36
USBD_MSG_VBUS_READY
,
38
USBD_MSG_VBUS_REMOVED
,
40
USBD_MSG_RESUME
,
42
USBD_MSG_SUSPEND
,
44
USBD_MSG_RESET
,
46
USBD_MSG_CONFIGURATION
,
48
USBD_MSG_UDC_ERROR
,
50
USBD_MSG_STACK_ERROR
,
52
USBD_MSG_CDC_ACM_LINE_CODING
,
54
USBD_MSG_CDC_ACM_CONTROL_LINE_STATE
,
56
USBD_MSG_DFU_APP_DETACH
,
58
USBD_MSG_DFU_DOWNLOAD_COMPLETED
,
60
USBD_MSG_MAX_NUMBER
,
61
};
62
66
static
const
char
*
const
usbd_msg_type_list[] = {
67
"VBUS ready"
,
68
"VBUS removed"
,
69
"Device resumed"
,
70
"Device suspended"
,
71
"Bus reset"
,
72
"New device configuration"
,
73
"Controller error"
,
74
"Stack error"
,
75
"CDC ACM line coding"
,
76
"CDC ACM control line state"
,
77
"DFU detach request"
,
78
"DFU download completed"
,
79
};
80
81
BUILD_ASSERT(
ARRAY_SIZE
(usbd_msg_type_list) ==
USBD_MSG_MAX_NUMBER
,
82
"Number of entries in usbd_msg_type_list is not equal to USBD_MSG_MAX_NUMBER"
);
84
88
struct
usbd_msg
{
90
enum
usbd_msg_type
type
;
92
union
{
93
int
status
;
94
const
struct
device
*
dev
;
95
};
96
};
97
105
static
inline
const
char
*
usbd_msg_type_string
(
const
enum
usbd_msg_type
type)
106
{
107
if
(type >= 0 && type <
USBD_MSG_MAX_NUMBER
) {
108
return
usbd_msg_type_list[type];
109
}
110
111
return
"?"
;
112
}
113
117
118
#ifdef __cplusplus
119
}
120
#endif
121
122
#endif
/* ZEPHYR_INCLUDE_USBD_MSG_H_ */
ARRAY_SIZE
#define ARRAY_SIZE(array)
Number of elements in the given array.
Definition
util.h:118
usbd_msg_type_string
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:105
usbd_msg_type
usbd_msg_type
USB device support message types.
Definition
usbd_msg.h:34
USBD_MSG_RESUME
@ USBD_MSG_RESUME
Device resume message.
Definition
usbd_msg.h:40
USBD_MSG_UDC_ERROR
@ USBD_MSG_UDC_ERROR
Non-correctable UDC error message.
Definition
usbd_msg.h:48
USBD_MSG_VBUS_READY
@ USBD_MSG_VBUS_READY
VBUS ready message (optional).
Definition
usbd_msg.h:36
USBD_MSG_SUSPEND
@ USBD_MSG_SUSPEND
Device suspended message.
Definition
usbd_msg.h:42
USBD_MSG_CDC_ACM_LINE_CODING
@ USBD_MSG_CDC_ACM_LINE_CODING
CDC ACM Line Coding update.
Definition
usbd_msg.h:52
USBD_MSG_DFU_DOWNLOAD_COMPLETED
@ USBD_MSG_DFU_DOWNLOAD_COMPLETED
USB DFU class download completed.
Definition
usbd_msg.h:58
USBD_MSG_VBUS_REMOVED
@ USBD_MSG_VBUS_REMOVED
VBUS removed message (optional).
Definition
usbd_msg.h:38
USBD_MSG_CDC_ACM_CONTROL_LINE_STATE
@ USBD_MSG_CDC_ACM_CONTROL_LINE_STATE
CDC ACM Line State update.
Definition
usbd_msg.h:54
USBD_MSG_RESET
@ USBD_MSG_RESET
Bus reset detected.
Definition
usbd_msg.h:44
USBD_MSG_STACK_ERROR
@ USBD_MSG_STACK_ERROR
Unrecoverable device stack error message.
Definition
usbd_msg.h:50
USBD_MSG_MAX_NUMBER
@ USBD_MSG_MAX_NUMBER
Maximum number of message types.
Definition
usbd_msg.h:60
USBD_MSG_CONFIGURATION
@ USBD_MSG_CONFIGURATION
Device changed configuration.
Definition
usbd_msg.h:46
USBD_MSG_DFU_APP_DETACH
@ USBD_MSG_DFU_APP_DETACH
USB DFU class detach request.
Definition
usbd_msg.h:56
stdint.h
device
Runtime device structure (in ROM) per driver instance.
Definition
device.h:513
usbd_msg
USB device message.
Definition
usbd_msg.h:88
usbd_msg::type
enum usbd_msg_type type
Message type.
Definition
usbd_msg.h:90
usbd_msg::dev
const struct device * dev
Definition
usbd_msg.h:94
usbd_msg::status
int status
Definition
usbd_msg.h:93
zephyr
usb
usbd_msg.h
Generated on
for Zephyr API by
1.17.0