1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #13148 from chrysn-pull-requests/usb-default-vidpid

USB: Use default VID/PID for RIOT-included peripherals
This commit is contained in:
Martine Lenders 2020-01-30 17:37:52 +01:00 committed by GitHub
commit 8d749dc024
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 70 additions and 8 deletions

View File

@ -19,6 +19,9 @@
* @author Koen Zandberg <koen@bergzand.net>
* @}
*/
#define USB_H_USER_IS_RIOT_INTERNAL
#include <stdint.h>
#include <stdlib.h>
#include <errno.h>

View File

@ -15,6 +15,9 @@
* @author Koen Zandberg <koen@bergzand.net>
* @}
*/
#define USB_H_USER_IS_RIOT_INTERNAL
#include <stdint.h>
#include <stdlib.h>
#include <errno.h>

View File

@ -20,6 +20,8 @@
* @}
*/
#define USB_H_USER_IS_RIOT_INTERNAL
#ifdef MODULE_PERIPH_I2C
#include "periph/i2c.h"
#endif

View File

@ -19,6 +19,8 @@
#ifdef MODULE_USBUS_CDC_ECM
#define USB_H_USER_IS_RIOT_INTERNAL
#include "log.h"
#include "usb/usbus/cdc/ecm.h"
#include "net/gnrc/netif/ethernet.h"

View File

@ -22,6 +22,8 @@
* @}
*/
#define USB_H_USER_IS_RIOT_INTERNAL
#include "usb/usbus.h"
#ifdef MODULE_USBUS_CDC_ECM

View File

@ -29,18 +29,26 @@ extern "C" {
* @ingroup config
* @{
*/
#if !(defined(CONFIG_USB_VID) && defined(CONFIG_USB_PID))
#ifdef USB_H_USER_IS_RIOT_INTERNAL
/* Reserved for RIOT standard peripherals as per http://pid.codes/1209/7D00/ */
#define CONFIG_USB_VID (0x1209)
#define CONFIG_USB_PID (0x7D00)
#else
#error Please configure your vendor and product IDs. For development, you may \
set CONFIG_USB_VID=0x1209 CONFIG_USB_PID=0x7D01.
#endif
#endif
/**
* @brief USB peripheral device vendor ID
*
* @note You must provide your own VID/PID combination when manufacturing a
* device with USB.
*/
#ifndef CONFIG_USB_VID
#ifdef DOXYGEN
#define CONFIG_USB_VID
#else
#error Please supply your vendor ID by setting CONFIG_USB_VID
#endif
#endif
/**
@ -49,12 +57,8 @@ extern "C" {
* @note You must provide your own VID/PID combination when manufacturing a
* device with USB.
*/
#ifndef CONFIG_USB_PID
#ifdef DOXYGEN
#define CONFIG_USB_PID
#else
#error Please supply your vendor ID by setting CONFIG_USB_PID
#endif
#endif
/**
@ -123,6 +127,35 @@ extern "C" {
#endif
/** @} */
/**
* @brief RIOT-internal USB peripheral clearance indicator
*
* This define must only be set in compilation units that are RIOT internal,
* and only when they implement peripherals that can be considered default RIOT
* peripherals.
*
* When this is defined in all uses of `usb.h`, the board can use the
* 0x1209/0x7D00 VID/PID pair unless explicit configuration using @ref
* CONFIG_USB_VID and @ref CONFIG_USB_PID say otherwise.
*
* There is no sharp characterization of what consititutes an internal
* peripheral; a good check is this: If an application can, just by switching
* between boards, can have a feature provided by either RIOT's USB stack or a
* different mechanism, the USB version is a default RIOT peripheral.
*
* Examples are stdio access (is provided by most boards using a UART and an
* external USB UART adapter), Ethernet (is provided by other boards using
* ethos) and firmware upload and reset (is provided by other boards using an
* on-board programmer).
*
* See http://pid.codes/1209/7D00/ for the allocation of that code.
* @{
*/
#ifdef DOXYGEN
#define USB_H_USER_IS_RIOT_INTERNAL
#endif
/** @} */
/**
* @brief USB version definitions
*/

View File

@ -16,6 +16,8 @@
* @}
*/
#define USB_H_USER_IS_RIOT_INTERNAL
#include <string.h>
#include "tsrb.h"

View File

@ -19,6 +19,8 @@
* @}
*/
#define USB_H_USER_IS_RIOT_INTERNAL
#include <stdio.h>
#include "isrpipe.h"

View File

@ -15,6 +15,8 @@
* @}
*/
#define USB_H_USER_IS_RIOT_INTERNAL
#include "event.h"
#include "fmt.h"
#include "kernel_defines.h"

View File

@ -15,6 +15,8 @@
* @}
*/
#define USB_H_USER_IS_RIOT_INTERNAL
#include <string.h>
#include "kernel_defines.h"

View File

@ -16,6 +16,8 @@
* @}
*/
#define USB_H_USER_IS_RIOT_INTERNAL
#include "bitarithm.h"
#include "event.h"
#include "thread.h"

View File

@ -15,6 +15,9 @@
* @author Koen Zandberg <koen@bergzand.net>
* @}
*/
#define USB_H_USER_IS_RIOT_INTERNAL
#include "periph/usbdev.h"
#include "usb/descriptor.h"
#include "usb/usbus.h"

View File

@ -16,6 +16,8 @@
* @}
*/
#define USB_H_USER_IS_RIOT_INTERNAL
#include <string.h>
#include "periph/usbdev.h"
#include "usb/usbus.h"

View File

@ -16,6 +16,8 @@
* @}
*/
#define USB_H_USER_IS_RIOT_INTERNAL
#include <string.h>
#include <stdio.h>
#include "usb/descriptor.h"