usb: Moved usb_get_state() into the main usb implementation
This commit is contained in:
parent
bf6c146786
commit
832c056e6d
|
@ -48,8 +48,6 @@
|
|||
|
||||
#include <libopencm3/usb/cdc.h>
|
||||
|
||||
static int configured;
|
||||
|
||||
static bool gdb_uart_dtr = true;
|
||||
|
||||
static void usb_serial_set_state(usbd_device *dev, uint16_t iface, uint8_t ep);
|
||||
|
@ -103,11 +101,6 @@ static enum usbd_request_return_codes debug_uart_control_request(usbd_device *de
|
|||
return USBD_REQ_NOTSUPP;
|
||||
}
|
||||
|
||||
int usb_get_config(void)
|
||||
{
|
||||
return configured;
|
||||
}
|
||||
|
||||
bool gdb_uart_get_dtr(void)
|
||||
{
|
||||
return gdb_uart_dtr;
|
||||
|
@ -130,7 +123,7 @@ void usb_serial_set_state(usbd_device *const dev, const uint16_t iface, const ui
|
|||
|
||||
void usb_serial_set_config(usbd_device *dev, uint16_t wValue)
|
||||
{
|
||||
configured = wValue;
|
||||
usb_config = wValue;
|
||||
|
||||
/* GDB interface */
|
||||
#if defined(STM32F4) || defined(LM4F)
|
||||
|
|
|
@ -28,12 +28,13 @@
|
|||
#ifndef __CDCACM_H
|
||||
#define __CDCACM_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "usb.h"
|
||||
|
||||
void usb_serial_set_config(usbd_device *dev, uint16_t wValue);
|
||||
/* Returns current usb configuration, or 0 if not configured. */
|
||||
int usb_get_config(void);
|
||||
uint16_t usb_get_config(void);
|
||||
|
||||
bool gdb_uart_get_dtr(void);
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "serialno.h"
|
||||
|
||||
usbd_device *usbdev = NULL;
|
||||
uint16_t usb_config;
|
||||
|
||||
/* We need a special large control buffer for this device: */
|
||||
static uint8_t usbd_control_buffer[256];
|
||||
|
@ -46,6 +47,11 @@ void blackmagic_usb_init(void)
|
|||
nvic_enable_irq(USB_IRQ);
|
||||
}
|
||||
|
||||
uint16_t usb_get_config(void)
|
||||
{
|
||||
return usb_config;
|
||||
}
|
||||
|
||||
void USB_ISR(void)
|
||||
{
|
||||
usbd_poll(usbdev);
|
||||
|
|
|
@ -21,9 +21,11 @@
|
|||
#ifndef USB_H
|
||||
#define USB_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <libopencm3/usb/usbd.h>
|
||||
|
||||
extern usbd_device *usbdev;
|
||||
extern uint16_t usb_config;
|
||||
|
||||
#define CDCACM_PACKET_SIZE 64
|
||||
|
||||
|
|
Loading…
Reference in New Issue