diff --git a/flight/targets/boards/coptercontrol/firmware/Makefile b/flight/targets/boards/coptercontrol/firmware/Makefile index 08061757d..68d2a9af1 100644 --- a/flight/targets/boards/coptercontrol/firmware/Makefile +++ b/flight/targets/boards/coptercontrol/firmware/Makefile @@ -58,10 +58,10 @@ endif # Use file-extension c for "c-only"-files ifndef TESTAPP ## Application Core + SRC += ../pios_usb_board_data.c SRC += $(OPMODULEDIR)/System/systemmod.c SRC += $(OPSYSTEM)/coptercontrol.c SRC += $(OPSYSTEM)/pios_board.c - SRC += $(OPSYSTEM)/pios_usb_board_data.c SRC += $(FLIGHTLIB)/alarms.c SRC += $(OPUAVTALK)/uavtalk.c SRC += $(OPUAVOBJ)/uavobjectmanager.c diff --git a/flight/targets/boards/coptercontrol/firmware/pios_usb_board_data.c b/flight/targets/boards/coptercontrol/firmware/pios_usb_board_data.c deleted file mode 100644 index 67c19e6c3..000000000 --- a/flight/targets/boards/coptercontrol/firmware/pios_usb_board_data.c +++ /dev/null @@ -1,101 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup PIOS_USB_BOARD Board specific USB definitions - * @brief Board specific USB definitions - * @{ - * - * @file pios_usb_board_data.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Board specific USB definitions - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "inc/pios_usb_board_data.h" /* struct usb_*, USB_* */ -#include /* PIOS_SYS_SerialNumberGet */ -#include /* PIOS_USBHOOK_* */ -#include /* PIOS_USB_UTIL_AsciiToUtf8 */ - -static const uint8_t usb_product_id[28] = { - sizeof(usb_product_id), - USB_DESC_TYPE_STRING, - 'C', 0, - 'o', 0, - 'p', 0, - 't', 0, - 'e', 0, - 'r', 0, - 'C', 0, - 'o', 0, - 'n', 0, - 't', 0, - 'r', 0, - 'o', 0, - 'l', 0, -}; - -static uint8_t usb_serial_number[2 + PIOS_SYS_SERIAL_NUM_ASCII_LEN*2 + (sizeof(PIOS_USB_BOARD_SN_SUFFIX)-1)*2] = { - sizeof(usb_serial_number), - USB_DESC_TYPE_STRING, -}; - -static const struct usb_string_langid usb_lang_id = { - .bLength = sizeof(usb_lang_id), - .bDescriptorType = USB_DESC_TYPE_STRING, - .bLangID = htousbs(USB_LANGID_ENGLISH_US), -}; - -static const uint8_t usb_vendor_id[28] = { - sizeof(usb_vendor_id), - USB_DESC_TYPE_STRING, - 'o', 0, - 'p', 0, - 'e', 0, - 'n', 0, - 'p', 0, - 'i', 0, - 'l', 0, - 'o', 0, - 't', 0, - '.', 0, - 'o', 0, - 'r', 0, - 'g', 0 -}; - -int32_t PIOS_USB_BOARD_DATA_Init(void) -{ - /* Load device serial number into serial number string */ - uint8_t sn[PIOS_SYS_SERIAL_NUM_ASCII_LEN + 1]; - PIOS_SYS_SerialNumberGet((char *)sn); - - /* Concatenate the device serial number and the appropriate suffix ("+BL" or "+FW") into the USB serial number */ - uint8_t * utf8 = &(usb_serial_number[2]); - utf8 = PIOS_USB_UTIL_AsciiToUtf8(utf8, sn, PIOS_SYS_SERIAL_NUM_ASCII_LEN); - utf8 = PIOS_USB_UTIL_AsciiToUtf8(utf8, (uint8_t *)PIOS_USB_BOARD_SN_SUFFIX, sizeof(PIOS_USB_BOARD_SN_SUFFIX)-1); - - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_PRODUCT, (uint8_t *)&usb_product_id, sizeof(usb_product_id)); - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_SERIAL, (uint8_t *)&usb_serial_number, sizeof(usb_serial_number)); - - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_LANG, (uint8_t *)&usb_lang_id, sizeof(usb_lang_id)); - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_VENDOR, (uint8_t *)&usb_vendor_id, sizeof(usb_vendor_id)); - - return 0; -} diff --git a/flight/targets/boards/coptercontrol/bootloader/pios_usb_board_data.c b/flight/targets/boards/coptercontrol/pios_usb_board_data.c similarity index 100% rename from flight/targets/boards/coptercontrol/bootloader/pios_usb_board_data.c rename to flight/targets/boards/coptercontrol/pios_usb_board_data.c diff --git a/flight/targets/boards/oplinkmini/firmware/Makefile b/flight/targets/boards/oplinkmini/firmware/Makefile index dc7aa53e0..7cbff9fad 100644 --- a/flight/targets/boards/oplinkmini/firmware/Makefile +++ b/flight/targets/boards/oplinkmini/firmware/Makefile @@ -36,10 +36,10 @@ OPTMODULES = # Use file-extension c for "c-only"-files ifndef TESTAPP ## Application Core + SRC += ../pios_usb_board_data.c SRC += $(OPMODULEDIR)/OPLink/oplinkmod.c SRC += $(OPSYSTEM)/oplink.c SRC += $(OPSYSTEM)/pios_board.c - SRC += $(OPSYSTEM)/pios_usb_board_data.c SRC += $(OPUAVTALK)/uavtalk.c SRC += $(OPUAVOBJ)/uavobjectmanager.c SRC += $(OPUAVOBJ)/eventdispatcher.c diff --git a/flight/targets/boards/oplinkmini/firmware/pios_usb_board_data.c b/flight/targets/boards/oplinkmini/firmware/pios_usb_board_data.c deleted file mode 100644 index 070d8c392..000000000 --- a/flight/targets/boards/oplinkmini/firmware/pios_usb_board_data.c +++ /dev/null @@ -1,97 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup PIOS_USB_BOARD Board specific USB definitions - * @brief Board specific USB definitions - * @{ - * - * @file pios_usb_board_data.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Board specific USB definitions - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "inc/pios_usb_board_data.h" /* struct usb_*, USB_* */ -#include /* PIOS_SYS_SerialNumberGet */ -#include /* PIOS_USBHOOK_* */ -#include /* PIOS_USB_UTIL_AsciiToUtf8 */ - -static const uint8_t usb_product_id[20] = { - sizeof(usb_product_id), - USB_DESC_TYPE_STRING, - 'P', 0, - 'i', 0, - 'p', 0, - 'X', 0, - 't', 0, - 'r', 0, - 'e', 0, - 'm', 0, - 'e', 0, -}; - -static uint8_t usb_serial_number[2 + PIOS_SYS_SERIAL_NUM_ASCII_LEN*2 + (sizeof(PIOS_USB_BOARD_SN_SUFFIX)-1)*2] = { - sizeof(usb_serial_number), - USB_DESC_TYPE_STRING, -}; - -static const struct usb_string_langid usb_lang_id = { - .bLength = sizeof(usb_lang_id), - .bDescriptorType = USB_DESC_TYPE_STRING, - .bLangID = htousbs(USB_LANGID_ENGLISH_US), -}; - -static const uint8_t usb_vendor_id[28] = { - sizeof(usb_vendor_id), - USB_DESC_TYPE_STRING, - 'o', 0, - 'p', 0, - 'e', 0, - 'n', 0, - 'p', 0, - 'i', 0, - 'l', 0, - 'o', 0, - 't', 0, - '.', 0, - 'o', 0, - 'r', 0, - 'g', 0 -}; - -int32_t PIOS_USB_BOARD_DATA_Init(void) -{ - /* Load device serial number into serial number string */ - uint8_t sn[PIOS_SYS_SERIAL_NUM_ASCII_LEN + 1]; - PIOS_SYS_SerialNumberGet((char *)sn); - - /* Concatenate the device serial number and the appropriate suffix ("+BL" or "+FW") into the USB serial number */ - uint8_t * utf8 = &(usb_serial_number[2]); - utf8 = PIOS_USB_UTIL_AsciiToUtf8(utf8, sn, PIOS_SYS_SERIAL_NUM_ASCII_LEN); - utf8 = PIOS_USB_UTIL_AsciiToUtf8(utf8, (uint8_t *)PIOS_USB_BOARD_SN_SUFFIX, sizeof(PIOS_USB_BOARD_SN_SUFFIX)-1); - - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_PRODUCT, (uint8_t *)&usb_product_id, sizeof(usb_product_id)); - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_SERIAL, (uint8_t *)&usb_serial_number, sizeof(usb_serial_number)); - - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_LANG, (uint8_t *)&usb_lang_id, sizeof(usb_lang_id)); - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_VENDOR, (uint8_t *)&usb_vendor_id, sizeof(usb_vendor_id)); - - return 0; -} diff --git a/flight/targets/boards/oplinkmini/bootloader/pios_usb_board_data.c b/flight/targets/boards/oplinkmini/pios_usb_board_data.c similarity index 100% rename from flight/targets/boards/oplinkmini/bootloader/pios_usb_board_data.c rename to flight/targets/boards/oplinkmini/pios_usb_board_data.c diff --git a/flight/targets/boards/osd/firmware/Makefile b/flight/targets/boards/osd/firmware/Makefile index 53404e2fd..4f65bd58b 100644 --- a/flight/targets/boards/osd/firmware/Makefile +++ b/flight/targets/boards/osd/firmware/Makefile @@ -44,10 +44,10 @@ CFLAGS += -ffast-math # Use file-extension c for "c-only"-files ifndef TESTAPP ## Application Core + SRC += ../pios_usb_board_data.c SRC += $(OPMODULEDIR)/System/systemmod.c SRC += $(OPSYSTEM)/osd.c SRC += $(OPSYSTEM)/pios_board.c - SRC += $(OPSYSTEM)/pios_usb_board_data.c SRC += $(FLIGHTLIB)/alarms.c SRC += $(OPUAVTALK)/uavtalk.c SRC += $(OPUAVOBJ)/uavobjectmanager.c diff --git a/flight/targets/boards/osd/firmware/pios_usb_board_data.c b/flight/targets/boards/osd/firmware/pios_usb_board_data.c deleted file mode 100644 index 6e5e087cf..000000000 --- a/flight/targets/boards/osd/firmware/pios_usb_board_data.c +++ /dev/null @@ -1,91 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup PIOS_USB_BOARD Board specific USB definitions - * @brief Board specific USB definitions - * @{ - * - * @file pios_usb_board_data.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Board specific USB definitions - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "inc/pios_usb_board_data.h" /* struct usb_*, USB_* */ -#include /* PIOS_SYS_SerialNumberGet */ -#include /* PIOS_USBHOOK_* */ -#include /* PIOS_USB_UTIL_AsciiToUtf8 */ - -static const uint8_t usb_product_id[8] = { - sizeof(usb_product_id), - USB_DESC_TYPE_STRING, - 'O', 0, - 'S', 0, - 'D', 0, -}; - -static uint8_t usb_serial_number[2 + PIOS_SYS_SERIAL_NUM_ASCII_LEN*2 + (sizeof(PIOS_USB_BOARD_SN_SUFFIX)-1)*2] = { - sizeof(usb_serial_number), - USB_DESC_TYPE_STRING, -}; - -static const struct usb_string_langid usb_lang_id = { - .bLength = sizeof(usb_lang_id), - .bDescriptorType = USB_DESC_TYPE_STRING, - .bLangID = htousbs(USB_LANGID_ENGLISH_US), -}; - -static const uint8_t usb_vendor_id[28] = { - sizeof(usb_vendor_id), - USB_DESC_TYPE_STRING, - 'o', 0, - 'p', 0, - 'e', 0, - 'n', 0, - 'p', 0, - 'i', 0, - 'l', 0, - 'o', 0, - 't', 0, - '.', 0, - 'o', 0, - 'r', 0, - 'g', 0 -}; - -int32_t PIOS_USB_BOARD_DATA_Init(void) -{ - /* Load device serial number into serial number string */ - uint8_t sn[PIOS_SYS_SERIAL_NUM_ASCII_LEN + 1]; - PIOS_SYS_SerialNumberGet((char *)sn); - - /* Concatenate the device serial number and the appropriate suffix ("+BL" or "+FW") into the USB serial number */ - uint8_t * utf8 = &(usb_serial_number[2]); - utf8 = PIOS_USB_UTIL_AsciiToUtf8(utf8, sn, PIOS_SYS_SERIAL_NUM_ASCII_LEN); - utf8 = PIOS_USB_UTIL_AsciiToUtf8(utf8, (uint8_t *)PIOS_USB_BOARD_SN_SUFFIX, sizeof(PIOS_USB_BOARD_SN_SUFFIX)-1); - - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_PRODUCT, (uint8_t *)&usb_product_id, sizeof(usb_product_id)); - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_SERIAL, (uint8_t *)&usb_serial_number, sizeof(usb_serial_number)); - - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_LANG, (uint8_t *)&usb_lang_id, sizeof(usb_lang_id)); - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_VENDOR, (uint8_t *)&usb_vendor_id, sizeof(usb_vendor_id)); - - return 0; -} diff --git a/flight/targets/boards/osd/bootloader/pios_usb_board_data.c b/flight/targets/boards/osd/pios_usb_board_data.c similarity index 100% rename from flight/targets/boards/osd/bootloader/pios_usb_board_data.c rename to flight/targets/boards/osd/pios_usb_board_data.c diff --git a/flight/targets/boards/revolution/firmware/Makefile b/flight/targets/boards/revolution/firmware/Makefile index a9de50a75..0afbf4b0b 100644 --- a/flight/targets/boards/revolution/firmware/Makefile +++ b/flight/targets/boards/revolution/firmware/Makefile @@ -62,10 +62,10 @@ CFLAGS += -ffast-math # Use file-extension c for "c-only"-files ifndef TESTAPP ## Application Core + SRC += ../pios_usb_board_data.c SRC += $(OPMODULEDIR)/System/systemmod.c SRC += $(OPSYSTEM)/revolution.c SRC += $(OPSYSTEM)/pios_board.c - SRC += $(OPSYSTEM)/pios_usb_board_data.c SRC += $(FLIGHTLIB)/alarms.c SRC += $(OPUAVTALK)/uavtalk.c SRC += $(OPUAVOBJ)/uavobjectmanager.c diff --git a/flight/targets/boards/revolution/bootloader/pios_usb_board_data.c b/flight/targets/boards/revolution/pios_usb_board_data.c similarity index 100% rename from flight/targets/boards/revolution/bootloader/pios_usb_board_data.c rename to flight/targets/boards/revolution/pios_usb_board_data.c diff --git a/flight/targets/boards/sensortest/bootloader/pios_usb_board_data.c b/flight/targets/boards/sensortest/bootloader/pios_usb_board_data.c deleted file mode 100644 index df136bab4..000000000 --- a/flight/targets/boards/sensortest/bootloader/pios_usb_board_data.c +++ /dev/null @@ -1,98 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup PIOS_USB_BOARD Board specific USB definitions - * @brief Board specific USB definitions - * @{ - * - * @file pios_usb_board_data.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Board specific USB definitions - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "inc/pios_usb_board_data.h" /* struct usb_*, USB_* */ -#include /* PIOS_SYS_SerialNumberGet */ -#include /* PIOS_USBHOOK_* */ -#include /* PIOS_USB_UTIL_AsciiToUtf8 */ - -static const uint8_t usb_product_id[22] = { - sizeof(usb_product_id), - USB_DESC_TYPE_STRING, - 'R', 0, - 'e', 0, - 'v', 0, - 'o', 0, - 'l', 0, - 'u', 0, - 't', 0, - 'i', 0, - 'o', 0, - 'n', 0, -}; - -static uint8_t usb_serial_number[2 + PIOS_SYS_SERIAL_NUM_ASCII_LEN*2 + (sizeof(PIOS_USB_BOARD_SN_SUFFIX)-1)*2] = { - sizeof(usb_serial_number), - USB_DESC_TYPE_STRING, -}; - -static const struct usb_string_langid usb_lang_id = { - .bLength = sizeof(usb_lang_id), - .bDescriptorType = USB_DESC_TYPE_STRING, - .bLangID = htousbs(USB_LANGID_ENGLISH_US), -}; - -static const uint8_t usb_vendor_id[28] = { - sizeof(usb_vendor_id), - USB_DESC_TYPE_STRING, - 'o', 0, - 'p', 0, - 'e', 0, - 'n', 0, - 'p', 0, - 'i', 0, - 'l', 0, - 'o', 0, - 't', 0, - '.', 0, - 'o', 0, - 'r', 0, - 'g', 0 -}; - -int32_t PIOS_USB_BOARD_DATA_Init(void) -{ - /* Load device serial number into serial number string */ - uint8_t sn[PIOS_SYS_SERIAL_NUM_ASCII_LEN + 1]; - PIOS_SYS_SerialNumberGet((char *)sn); - - /* Concatenate the device serial number and the appropriate suffix ("+BL" or "+FW") into the USB serial number */ - uint8_t * utf8 = &(usb_serial_number[2]); - utf8 = PIOS_USB_UTIL_AsciiToUtf8(utf8, sn, PIOS_SYS_SERIAL_NUM_ASCII_LEN); - utf8 = PIOS_USB_UTIL_AsciiToUtf8(utf8, (uint8_t *)PIOS_USB_BOARD_SN_SUFFIX, sizeof(PIOS_USB_BOARD_SN_SUFFIX)-1); - - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_PRODUCT, (uint8_t *)&usb_product_id, sizeof(usb_product_id)); - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_SERIAL, (uint8_t *)&usb_serial_number, sizeof(usb_serial_number)); - - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_LANG, (uint8_t *)&usb_lang_id, sizeof(usb_lang_id)); - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_VENDOR, (uint8_t *)&usb_vendor_id, sizeof(usb_vendor_id)); - - return 0; -} diff --git a/flight/targets/boards/sensortest/firmware/Makefile b/flight/targets/boards/sensortest/firmware/Makefile index 522992243..d2bd6e764 100644 --- a/flight/targets/boards/sensortest/firmware/Makefile +++ b/flight/targets/boards/sensortest/firmware/Makefile @@ -62,10 +62,10 @@ CFLAGS += -ffast-math # Use file-extension c for "c-only"-files ifndef TESTAPP ## Application Core + SRC += ../pios_usb_board_data.c SRC += $(OPMODULEDIR)/System/systemmod.c SRC += $(OPSYSTEM)/revolution.c SRC += $(OPSYSTEM)/pios_board.c - SRC += $(OPSYSTEM)/pios_usb_board_data.c SRC += $(FLIGHTLIB)/alarms.c SRC += $(OPUAVTALK)/uavtalk.c SRC += $(OPUAVOBJ)/uavobjectmanager.c diff --git a/flight/targets/boards/sensortest/firmware/pios_usb_board_data.c b/flight/targets/boards/sensortest/firmware/pios_usb_board_data.c deleted file mode 100644 index df136bab4..000000000 --- a/flight/targets/boards/sensortest/firmware/pios_usb_board_data.c +++ /dev/null @@ -1,98 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup PIOS_USB_BOARD Board specific USB definitions - * @brief Board specific USB definitions - * @{ - * - * @file pios_usb_board_data.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Board specific USB definitions - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "inc/pios_usb_board_data.h" /* struct usb_*, USB_* */ -#include /* PIOS_SYS_SerialNumberGet */ -#include /* PIOS_USBHOOK_* */ -#include /* PIOS_USB_UTIL_AsciiToUtf8 */ - -static const uint8_t usb_product_id[22] = { - sizeof(usb_product_id), - USB_DESC_TYPE_STRING, - 'R', 0, - 'e', 0, - 'v', 0, - 'o', 0, - 'l', 0, - 'u', 0, - 't', 0, - 'i', 0, - 'o', 0, - 'n', 0, -}; - -static uint8_t usb_serial_number[2 + PIOS_SYS_SERIAL_NUM_ASCII_LEN*2 + (sizeof(PIOS_USB_BOARD_SN_SUFFIX)-1)*2] = { - sizeof(usb_serial_number), - USB_DESC_TYPE_STRING, -}; - -static const struct usb_string_langid usb_lang_id = { - .bLength = sizeof(usb_lang_id), - .bDescriptorType = USB_DESC_TYPE_STRING, - .bLangID = htousbs(USB_LANGID_ENGLISH_US), -}; - -static const uint8_t usb_vendor_id[28] = { - sizeof(usb_vendor_id), - USB_DESC_TYPE_STRING, - 'o', 0, - 'p', 0, - 'e', 0, - 'n', 0, - 'p', 0, - 'i', 0, - 'l', 0, - 'o', 0, - 't', 0, - '.', 0, - 'o', 0, - 'r', 0, - 'g', 0 -}; - -int32_t PIOS_USB_BOARD_DATA_Init(void) -{ - /* Load device serial number into serial number string */ - uint8_t sn[PIOS_SYS_SERIAL_NUM_ASCII_LEN + 1]; - PIOS_SYS_SerialNumberGet((char *)sn); - - /* Concatenate the device serial number and the appropriate suffix ("+BL" or "+FW") into the USB serial number */ - uint8_t * utf8 = &(usb_serial_number[2]); - utf8 = PIOS_USB_UTIL_AsciiToUtf8(utf8, sn, PIOS_SYS_SERIAL_NUM_ASCII_LEN); - utf8 = PIOS_USB_UTIL_AsciiToUtf8(utf8, (uint8_t *)PIOS_USB_BOARD_SN_SUFFIX, sizeof(PIOS_USB_BOARD_SN_SUFFIX)-1); - - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_PRODUCT, (uint8_t *)&usb_product_id, sizeof(usb_product_id)); - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_SERIAL, (uint8_t *)&usb_serial_number, sizeof(usb_serial_number)); - - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_LANG, (uint8_t *)&usb_lang_id, sizeof(usb_lang_id)); - PIOS_USBHOOK_RegisterString(USB_STRING_DESC_VENDOR, (uint8_t *)&usb_vendor_id, sizeof(usb_vendor_id)); - - return 0; -} diff --git a/flight/targets/boards/revolution/firmware/pios_usb_board_data.c b/flight/targets/boards/sensortest/pios_usb_board_data.c similarity index 100% rename from flight/targets/boards/revolution/firmware/pios_usb_board_data.c rename to flight/targets/boards/sensortest/pios_usb_board_data.c diff --git a/make/boot-defs.mk b/make/boot-defs.mk index 0c2e3cc31..19611a3cd 100644 --- a/make/boot-defs.mk +++ b/make/boot-defs.mk @@ -45,9 +45,9 @@ endif # Use file-extension c for "c-only"-files ## Bootloader Core +SRC += ../pios_usb_board_data.c SRC += $(OPSYSTEM)/main.c SRC += $(OPSYSTEM)/pios_board.c -SRC += $(OPSYSTEM)/pios_usb_board_data.c SRC += $(OPSYSTEM)/op_dfu.c ## PIOS Hardware (Common)