1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

Updated USB on PipX to latest CDC changes.

This commit is contained in:
Brian Webb 2012-05-20 19:34:43 -07:00
parent 6cb13aa2ba
commit e57543ec29
3 changed files with 35 additions and 32 deletions

View File

@ -163,16 +163,16 @@ SRC += $(PIOSSTM32F10X)/pios_eeprom.c
SRC += $(PIOSSTM32F10X)/pios_bl_helper.c
# PIOS USB related files (seperated to make code maintenance more easy)
ifeq ($(USE_USB), YES)
SRC += $(PIOSSTM32F10X)/pios_usb.c
SRC += $(PIOSSTM32F10X)/pios_usbhook.c
SRC += $(PIOSSTM32F10X)/pios_usb_hid.c
SRC += $(PIOSSTM32F10X)/pios_usb_hid_istr.c
SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c
SRC += $(HOME_DIR)/pios_usb_board_data.c
SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c
SRC += $(PIOSCOMMON)/pios_usb_util.c
endif
SRC += $(PIOSSTM32F10X)/pios_usb.c
SRC += $(PIOSSTM32F10X)/pios_usbhook.c
SRC += $(PIOSSTM32F10X)/pios_usb_hid.c
SRC += $(PIOSSTM32F10X)/pios_usb_cdc.c
SRC += $(PIOSSTM32F10X)/pios_usb_hid_istr.c
SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c
SRC += $(OPSYSTEM)/pios_usb_board_data.c
SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c
SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c
SRC += $(PIOSCOMMON)/pios_usb_util.c
## PIOS Hardware (Common)
SRC += $(PIOSCOMMON)/pios_crc.c

View File

@ -127,36 +127,37 @@ void PIOS_Board_Init(void) {
/* Initialize board specific USB data */
PIOS_USB_BOARD_DATA_Init();
/* Flags to determine if various USB interfaces are advertised */
bool usb_hid_present = false;
bool usb_cdc_present = false;
#if defined(PIOS_INCLUDE_USB_CDC)
switch (pipxSettings.VCPConfig)
{
case PIPXSETTINGS_VCPCONFIG_SERIAL:
case PIPXSETTINGS_VCPCONFIG_DEBUG:
if (PIOS_USB_DESC_HID_CDC_Init()) {
PIOS_Assert(0);
}
usb_cdc_present = true;
break;
case PIPXSETTINGS_VCPCONFIG_DISABLED:
if (PIOS_USB_DESC_HID_ONLY_Init()) {
PIOS_Assert(0);
}
break;
if (PIOS_USB_DESC_HID_CDC_Init()) {
PIOS_Assert(0);
}
usb_hid_present = true;
usb_cdc_present = true;
#else
if (PIOS_USB_DESC_HID_ONLY_Init()) {
PIOS_Assert(0);
}
usb_hid_present = true;
#endif
uint32_t pios_usb_id;
PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg);
#if defined(PIOS_INCLUDE_USB_CDC)
if (!usb_cdc_present) {
/* Force VCP port function to disabled if we haven't advertised VCP in our USB descriptor */
pipxSettings.VCPConfig = PIPXSETTINGS_VCPCONFIG_DISABLED;
}
#if defined(PIOS_INCLUDE_COM)
if(usb_cdc_present)
switch (pipxSettings.VCPConfig)
{
case PIPXSETTINGS_VCPCONFIG_SERIAL:
case PIPXSETTINGS_VCPCONFIG_DEBUG:
{
uint32_t pios_usb_cdc_id;
if (PIOS_USB_CDC_Init(&pios_usb_cdc_id, &pios_usb_cdc_cfg, pios_usb_id)) {
@ -180,10 +181,12 @@ void PIOS_Board_Init(void) {
pios_com_debug_id = pios_com_vcp_id;
break;
}
break;
}
#endif /* PIOS_INCLUDE_COM */
#endif /* PIOS_INCLUDE_USB_CDC */
case PIPXSETTINGS_VCPCONFIG_DISABLED:
break;
}
#endif
#if defined(PIOS_INCLUDE_USB_HID)

View File

@ -504,7 +504,7 @@ static const struct pios_usb_cfg pios_usb_main_cfg = {
#include <pios_usb_hid_priv.h>
const struct pios_usb_hid_cfg pios_usb_hid_cfg = {
.data_if = 0,
.data_if = 2,
.data_rx_ep = 1,
.data_tx_ep = 1,
};
@ -514,10 +514,10 @@ const struct pios_usb_hid_cfg pios_usb_hid_cfg = {
#include <pios_usb_cdc_priv.h>
const struct pios_usb_cdc_cfg pios_usb_cdc_cfg = {
.ctrl_if = 1,
.ctrl_if = 0,
.ctrl_tx_ep = 2,
.data_if = 2,
.data_if = 1,
.data_rx_ep = 3,
.data_tx_ep = 3,
};