Commit 4af7549d authored by Johann Fischer's avatar Johann Fischer Committed by Chris Friedt
Browse files

usb: deprecate legacy USB device support

Deprecate legacy USB device support.

Signed-off-by: default avatarJohann Fischer <johann.fischer@nordicsemi.no>
parent 31303f73
Loading
Loading
Loading
Loading
+1 −0
Changes for drivers/usb/device/Kconfig: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@

menuconfig USB_DEVICE_DRIVER
	bool "USB device controller drivers"
	select DEPRECATED
	help
	  Enable USB device controller drivers.

+3 −1
Changes for include/zephyr/drivers/uart/cdc_acm.h: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ typedef void (*cdc_dte_rate_callback_t)(const struct device *dev,
/**
 * @brief Set the callback for dwDTERate SetLineCoding requests.
 *
 * @deprecated Use @ref usbd_api and @ref USBD_MSG_CDC_ACM_LINE_CODING instead.
 *
 * The callback is invoked when the USB host changes the baud rate.
 *
 * @note This function is available only when
@@ -44,7 +46,7 @@ typedef void (*cdc_dte_rate_callback_t)(const struct device *dev,
 *
 * @return	    0 on success.
 */
int cdc_acm_dte_rate_callback_set(const struct device *dev,
__deprecated int cdc_acm_dte_rate_callback_set(const struct device *dev,
				  cdc_dte_rate_callback_t callback);

#ifdef __cplusplus
+63 −21
Changes for include/zephyr/drivers/usb/usb_dc.h: 63 added lines, 21 removed lines.
Original line number Diff line number Diff line
@@ -138,57 +138,69 @@ typedef void (*usb_dc_status_callback)(enum usb_dc_status_code cb_status,
/**
 * @brief Attach USB for device connection
 *
 * @deprecated Use @ref udc_api instead
 *
 * Function to attach USB for device connection. Upon success, the USB PLL
 * is enabled, and the USB device is now capable of transmitting and receiving
 * on the USB bus and of generating interrupts.
 *
 * @return 0 on success, negative errno code on fail.
 */
int usb_dc_attach(void);
__deprecated int usb_dc_attach(void);

/**
 * @brief Detach the USB device
 *
 * @deprecated Use @ref udc_api instead
 *
 * Function to detach the USB device. Upon success, the USB hardware PLL
 * is powered down and USB communication is disabled.
 *
 * @return 0 on success, negative errno code on fail.
 */
int usb_dc_detach(void);
__deprecated int usb_dc_detach(void);

/**
 * @brief Reset the USB device
 *
 * @deprecated Use @ref udc_api instead
 *
 * This function returns the USB device and firmware back to it's initial state.
 * N.B. the USB PLL is handled by the usb_detach function
 *
 * @return 0 on success, negative errno code on fail.
 */
int usb_dc_reset(void);
__deprecated int usb_dc_reset(void);

/**
 * @brief Set USB device address
 *
 * @deprecated Use @ref udc_api instead
 *
 * @param[in] addr Device address
 *
 * @return 0 on success, negative errno code on fail.
 */
int usb_dc_set_address(const uint8_t addr);
__deprecated int usb_dc_set_address(const uint8_t addr);

/**
 * @brief Set USB device controller status callback
 *
 * @deprecated Use @ref udc_api instead
 *
 * Function to set USB device controller status callback. The registered
 * callback is used to report changes in the status of the device controller.
 * The status code are described by the usb_dc_status_code enumeration.
 *
 * @param[in] cb Callback function
 */
void usb_dc_set_status_callback(const usb_dc_status_callback cb);
__deprecated void usb_dc_set_status_callback(const usb_dc_status_callback cb);

/**
 * @brief check endpoint capabilities
 *
 * @deprecated Use @ref udc_api instead
 *
 * Function to check capabilities of an endpoint. usb_dc_ep_cfg_data structure
 * provides the endpoint configuration parameters: endpoint address,
 * endpoint maximum packet size and endpoint type.
@@ -199,11 +211,13 @@ void usb_dc_set_status_callback(const usb_dc_status_callback cb);
 *
 * @return 0 on success, negative errno code on fail.
 */
int usb_dc_ep_check_cap(const struct usb_dc_ep_cfg_data * const cfg);
__deprecated int usb_dc_ep_check_cap(const struct usb_dc_ep_cfg_data * const cfg);

/**
 * @brief Configure endpoint
 *
 * @deprecated Use @ref udc_api instead
 *
 * Function to configure an endpoint. usb_dc_ep_cfg_data structure provides
 * the endpoint configuration parameters: endpoint address, endpoint maximum
 * packet size and endpoint type.
@@ -212,52 +226,62 @@ int usb_dc_ep_check_cap(const struct usb_dc_ep_cfg_data * const cfg);
 *
 * @return 0 on success, negative errno code on fail.
 */
int usb_dc_ep_configure(const struct usb_dc_ep_cfg_data * const cfg);
__deprecated int usb_dc_ep_configure(const struct usb_dc_ep_cfg_data * const cfg);

/**
 * @brief Set stall condition for the selected endpoint
 *
 * @deprecated Use @ref udc_api instead
 *
 * @param[in] ep Endpoint address corresponding to the one
 *               listed in the device configuration table
 *
 * @return 0 on success, negative errno code on fail.
 */
int usb_dc_ep_set_stall(const uint8_t ep);
__deprecated int usb_dc_ep_set_stall(const uint8_t ep);

/**
 * @brief Clear stall condition for the selected endpoint
 *
 * @deprecated Use @ref udc_api instead
 *
 * @param[in] ep Endpoint address corresponding to the one
 *               listed in the device configuration table
 *
 * @return 0 on success, negative errno code on fail.
 */
int usb_dc_ep_clear_stall(const uint8_t ep);
__deprecated int usb_dc_ep_clear_stall(const uint8_t ep);

/**
 * @brief Check if the selected endpoint is stalled
 *
 * @deprecated Use @ref udc_api instead
 *
 * @param[in]  ep       Endpoint address corresponding to the one
 *                      listed in the device configuration table
 * @param[out] stalled  Endpoint stall status
 *
 * @return 0 on success, negative errno code on fail.
 */
int usb_dc_ep_is_stalled(const uint8_t ep, uint8_t *const stalled);
__deprecated int usb_dc_ep_is_stalled(const uint8_t ep, uint8_t *const stalled);

/**
 * @brief Halt the selected endpoint
 *
 * @deprecated Use @ref udc_api instead
 *
 * @param[in] ep Endpoint address corresponding to the one
 *               listed in the device configuration table
 *
 * @return 0 on success, negative errno code on fail.
 */
int usb_dc_ep_halt(const uint8_t ep);
__deprecated int usb_dc_ep_halt(const uint8_t ep);

/**
 * @brief Enable the selected endpoint
 *
 * @deprecated Use @ref udc_api instead
 *
 * Function to enable the selected endpoint. Upon success interrupts are
 * enabled for the corresponding endpoint and the endpoint is ready for
 * transmitting/receiving data.
@@ -267,11 +291,13 @@ int usb_dc_ep_halt(const uint8_t ep);
 *
 * @return 0 on success, negative errno code on fail.
 */
int usb_dc_ep_enable(const uint8_t ep);
__deprecated int usb_dc_ep_enable(const uint8_t ep);

/**
 * @brief Disable the selected endpoint
 *
 * @deprecated Use @ref udc_api instead
 *
 * Function to disable the selected endpoint. Upon success interrupts are
 * disabled for the corresponding endpoint and the endpoint is no longer able
 * for transmitting/receiving data.
@@ -281,11 +307,13 @@ int usb_dc_ep_enable(const uint8_t ep);
 *
 * @return 0 on success, negative errno code on fail.
 */
int usb_dc_ep_disable(const uint8_t ep);
__deprecated int usb_dc_ep_disable(const uint8_t ep);

/**
 * @brief Flush the selected endpoint
 *
 * @deprecated Use @ref udc_api instead
 *
 * This function flushes the FIFOs for the selected endpoint.
 *
 * @param[in] ep Endpoint address corresponding to the one
@@ -293,11 +321,13 @@ int usb_dc_ep_disable(const uint8_t ep);
 *
 * @return 0 on success, negative errno code on fail.
 */
int usb_dc_ep_flush(const uint8_t ep);
__deprecated int usb_dc_ep_flush(const uint8_t ep);

/**
 * @brief Write data to the specified endpoint
 *
 * @deprecated Use @ref udc_api instead
 *
 * This function is called to write data to the specified endpoint. The
 * supplied usb_ep_callback function will be called when data is transmitted
 * out.
@@ -313,12 +343,14 @@ int usb_dc_ep_flush(const uint8_t ep);
 *
 * @return 0 on success, negative errno code on fail.
 */
int usb_dc_ep_write(const uint8_t ep, const uint8_t *const data,
__deprecated int usb_dc_ep_write(const uint8_t ep, const uint8_t *const data,
		    const uint32_t data_len, uint32_t * const ret_bytes);

/**
 * @brief Read data from the specified endpoint
 *
 * @deprecated Use @ref udc_api instead
 *
 * This function is called by the endpoint handler function, after an OUT
 * interrupt has been received for that EP. The application must only call this
 * function through the supplied usb_ep_callback function. This function clears
@@ -335,12 +367,14 @@ int usb_dc_ep_write(const uint8_t ep, const uint8_t *const data,
 *
 * @return 0 on success, negative errno code on fail.
 */
int usb_dc_ep_read(const uint8_t ep, uint8_t *const data,
__deprecated int usb_dc_ep_read(const uint8_t ep, uint8_t *const data,
		   const uint32_t max_data_len, uint32_t *const read_bytes);

/**
 * @brief Set callback function for the specified endpoint
 *
 * @deprecated Use @ref udc_api instead
 *
 * Function to set callback function for notification of data received and
 * available to application or transmit done on the selected endpoint,
 * NULL if callback not required by application code. The callback status
@@ -352,11 +386,13 @@ int usb_dc_ep_read(const uint8_t ep, uint8_t *const data,
 *
 * @return 0 on success, negative errno code on fail.
 */
int usb_dc_ep_set_callback(const uint8_t ep, const usb_dc_ep_callback cb);
__deprecated int usb_dc_ep_set_callback(const uint8_t ep, const usb_dc_ep_callback cb);

/**
 * @brief Read data from the specified endpoint
 *
 * @deprecated Use @ref udc_api instead
 *
 * This is similar to usb_dc_ep_read, the difference being that, it doesn't
 * clear the endpoint NAKs so that the consumer is not bogged down by further
 * upcalls till he is done with the processing of the data. The caller should
@@ -372,12 +408,14 @@ int usb_dc_ep_set_callback(const uint8_t ep, const usb_dc_ep_callback cb);
 *
 * @return 0 on success, negative errno code on fail.
 */
int usb_dc_ep_read_wait(uint8_t ep, uint8_t *data, uint32_t max_data_len,
__deprecated int usb_dc_ep_read_wait(uint8_t ep, uint8_t *data, uint32_t max_data_len,
			uint32_t *read_bytes);

/**
 * @brief Continue reading data from the endpoint
 *
 * @deprecated Use @ref udc_api instead
 *
 * Clear the endpoint NAK and enable the endpoint to accept more data
 * from the host. Usually called after usb_dc_ep_read_wait() when the consumer
 * is fine to accept more data. Thus these calls together act as a flow control
@@ -388,26 +426,30 @@ int usb_dc_ep_read_wait(uint8_t ep, uint8_t *data, uint32_t max_data_len,
 *
 * @return 0 on success, negative errno code on fail.
 */
int usb_dc_ep_read_continue(uint8_t ep);
__deprecated int usb_dc_ep_read_continue(uint8_t ep);

/**
 * @brief Get endpoint max packet size
 *
 * @deprecated Use @ref udc_api instead
 *
 * @param[in]  ep           Endpoint address corresponding to the one
 *                          listed in the device configuration table
 *
 * @return Endpoint max packet size (mps)
 */
int usb_dc_ep_mps(uint8_t ep);
__deprecated int usb_dc_ep_mps(uint8_t ep);

/**
 * @brief Start the host wake up procedure.
 *
 * @deprecated Use @ref udc_api instead
 *
 * Function to wake up the host if it's currently in sleep mode.
 *
 * @return 0 on success, negative errno code on fail.
 */
int usb_dc_wakeup_request(void);
__deprecated int usb_dc_wakeup_request(void);

/**
 * @}
+9 −3
Changes for include/zephyr/usb/class/usb_audio.h: 9 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -279,6 +279,8 @@ struct usb_audio_ops {
};

/** @brief Get the frame size that is accepted by the Host.
 *
 * @deprecated Use @ref uac2_device instead.
 *
 * This function returns the frame size for Input Devices that is expected
 * by the Host. Returned value rely on Input Device configuration:
@@ -292,23 +294,27 @@ struct usb_audio_ops {
 * @warning Do not use with OUT only devices (Headphones).
 *	    For OUT only devices this function shall return 0.
 */
size_t usb_audio_get_in_frame_size(const struct device *dev);
__deprecated size_t usb_audio_get_in_frame_size(const struct device *dev);

/**
 * @brief Register the USB Audio device and make it usable.
 *	  This must be called in order to make the device work
 *	  and respond to all relevant requests.
 *
 * @deprecated Use @ref uac2_device instead.
 *
 * @param dev USB Audio device
 * @param ops USB audio callback structure. Callback are used to
 *	      inform the user about what is happening
 */
void usb_audio_register(const struct device *dev,
__deprecated void usb_audio_register(const struct device *dev,
			const struct usb_audio_ops *ops);

/**
 * @brief Send data using USB Audio device
 *
 * @deprecated Use @ref uac2_device instead.
 *
 * @param dev    USB Audio device which will send the data
 *		 over its ISO IN endpoint
 * @param buffer Pointer to the buffer that should be send. User is
@@ -326,7 +332,7 @@ void usb_audio_register(const struct device *dev,
 *
 * @return 0 on success, negative error on fail
 */
int usb_audio_send(const struct device *dev, struct net_buf *buffer,
__deprecated int usb_audio_send(const struct device *dev, struct net_buf *buffer,
		   size_t len);

#endif /* ZEPHYR_INCLUDE_USB_CLASS_AUDIO_H_ */
+1 −1
Changes for include/zephyr/usb/class/usb_cdc.h: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@
#define ZEPHYR_INCLUDE_USB_CLASS_USB_CDC_H_

/** CDC Specification release number in BCD format */
#define CDC_SRN_1_20			0x0120
#define CDC_SRN_1_20			0x0120 __DEPRECATED_MACRO

/** Communications Class Subclass Codes */
#define ACM_SUBCLASS			0x02
Loading