diff --git a/right/src/buspal/bm_usb/composite.h b/right/src/buspal/bm_usb/composite.h index ca054be..31e5f3f 100644 --- a/right/src/buspal/bm_usb/composite.h +++ b/right/src/buspal/bm_usb/composite.h @@ -1,63 +1,27 @@ #ifndef __USB_DEVICE_COMPOSITE_H__ -#define __USB_DEVICE_COMPOSITE_H__ 1 +#define __USB_DEVICE_COMPOSITE_H__ #include "hid_bootloader.h" #include "usb_device_config.h" -#if defined(USB_DEVICE_CONFIG_EHCI) && (USB_DEVICE_CONFIG_EHCI > 0U) -#define CONTROLLER_ID kUSB_ControllerEhci0 -#endif -#if defined(USB_DEVICE_CONFIG_KHCI) && (USB_DEVICE_CONFIG_KHCI > 0U) #define CONTROLLER_ID kUSB_ControllerKhci0 -#endif +#define USB_DEVICE_INTERRUPT_PRIORITY 4 -#define USB_DEVICE_INTERRUPT_PRIORITY (4) - -typedef struct _usb_device_composite_struct -{ - usb_device_handle device_handle; // USB device handle. -#if ((defined(USB_DEVICE_CONFIG_HID)) && (USB_DEVICE_CONFIG_HID > 0U)) +typedef struct _usb_device_composite_struct { + usb_device_handle device_handle; // USB device handle. usb_hid_generic_struct_t hid_generic; // HID device structure -#endif -#if USB_DEVICE_CONFIG_MSC - usb_msc_struct_t msc_disk; // MSC disk device structure. -#endif // USB_DEVICE_CONFIG_MSC - uint8_t speed; // Speed of USB device. USB_SPEED_FULL/USB_SPEED_LOW/USB_SPEED_HIGH. - uint8_t attach; // A flag to indicate whether a usb device is attached. 1: attached, 0: not attached - uint8_t current_configuration; // Current configuration value. - uint8_t current_interface_alternate_setting[USB_COMPOSITE_INTERFACE_COUNT]; // Current alternate setting value for - // each interface. + uint8_t speed; // Speed of USB device. USB_SPEED_FULL/USB_SPEED_LOW/USB_SPEED_HIGH. + uint8_t attach; // A flag to indicate whether a usb device is attached. 1: attached, 0: not attached + uint8_t current_configuration; // Current configuration value. + uint8_t current_interface_alternate_setting[USB_COMPOSITE_INTERFACE_COUNT]; // Current alternate setting value for each interface. } usb_device_composite_struct_t; extern usb_status_t usb_device_callback(usb_device_handle handle, uint32_t event, void *param); - -#if (BL_CONFIG_USB_HID || BL_CONFIG_HS_USB_HID) -// HID device initialization function extern usb_status_t usb_device_hid_generic_init(usb_device_composite_struct_t *device_composite); -// HID class specific callback function extern usb_status_t usb_device_hid_generic_callback(class_handle_t handle, uint32_t event, void *param); -// HID device set configuration function extern usb_status_t usb_device_hid_generic_set_configure(class_handle_t handle, uint8_t configure); -// HID device set interface function -extern usb_status_t usb_device_hid_generic_set_interface(class_handle_t handle, - uint8_t interface, - uint8_t alternate_setting); -// HID device de-initialization function +extern usb_status_t usb_device_hid_generic_set_interface(class_handle_t handle, uint8_t interface, uint8_t alternate_setting); extern usb_status_t usb_device_hid_generic_deinit(usb_device_composite_struct_t *device_composite); -#endif // #if BL_CONFIG_USB_HID - -#if (BL_CONFIG_USB_MSC || BL_CONFIG_HS_USB_MSC) -// MSC disk device initialization function -extern usb_status_t usb_device_msc_disk_init(usb_device_composite_struct_t *device_composite); -// MSC class specific callback function -extern usb_status_t usb_device_msc_callback(class_handle_t handle, uint32_t event, void *param); -// MSC disk device set configuration function -extern usb_status_t usb_device_msc_disk_set_configure(class_handle_t handle, uint8_t configure); -// MSC disk device de-initialization function -extern usb_status_t usb_device_msc_disk_deinit(usb_device_composite_struct_t *device_composite); - -void usb_device_msc_disk_pump(void); -#endif // #if BL_CONFIG_USB_MSC extern usb_device_class_config_list_struct_t g_composite_device_config_list; diff --git a/right/src/buspal/bm_usb/hid_bootloader.c b/right/src/buspal/bm_usb/hid_bootloader.c index 01a5b69..d994916 100644 --- a/right/src/buspal/bm_usb/hid_bootloader.c +++ b/right/src/buspal/bm_usb/hid_bootloader.c @@ -1,28 +1,6 @@ -#include "usb_device_config.h" -#include "usb.h" -#include "usb_device.h" - -#include "usb_device_class.h" -#include "usb_device_hid.h" -#include "usb_device_ch9.h" #include "usb_descriptor.h" -#include "hid_bootloader.h" - -#include "fsl_device_registers.h" -#include "bootloader_hid_report_ids.h" -#include "fsl_rtos_abstraction.h" - -#include -#include -#include - #include "composite.h" -#if (BL_CONFIG_USB_HID || BL_CONFIG_HS_USB_HID) - -/******************************************************************************* - * Variables - ******************************************************************************/ extern usb_device_endpoint_struct_t g_hid_generic_endpoints[]; static usb_device_composite_struct_t *g_device_composite; @@ -30,11 +8,8 @@ static usb_device_composite_struct_t *g_device_composite; usb_status_t usb_device_hid_generic_callback(class_handle_t handle, uint32_t event, void *param) { usb_status_t error = kStatus_USB_Error; - usb_device_hid_report_struct_t *hid_report_param; - hid_report_param = (usb_device_hid_report_struct_t *)param; - const bl_hid_header_t *header; switch (event) @@ -168,5 +143,3 @@ usb_status_t usb_device_hid_generic_deinit(usb_device_composite_struct_t *device g_device_composite->hid_generic.hid_handle = (class_handle_t)NULL; return kStatus_USB_Success; } - -#endif // BL_CONFIG_USB_HID diff --git a/right/src/buspal/bm_usb/hid_bootloader.h b/right/src/buspal/bm_usb/hid_bootloader.h index 57e64fe..e7d9a85 100644 --- a/right/src/buspal/bm_usb/hid_bootloader.h +++ b/right/src/buspal/bm_usb/hid_bootloader.h @@ -4,8 +4,6 @@ #include "fsl_rtos_abstraction.h" #include "bootloader_hid_report_ids.h" -#define USB_DEVICE_INTERRUPT_PRIORITY (4) - //! @brief Request parameters. enum { diff --git a/right/src/buspal/bootloader_config.h b/right/src/buspal/bootloader_config.h index 10c081c..21251ad 100644 --- a/right/src/buspal/bootloader_config.h +++ b/right/src/buspal/bootloader_config.h @@ -1,103 +1,6 @@ #ifndef __BOOTLOADER_CONFIG_H__ #define __BOOTLOADER_CONFIG_H__ -//////////////////////////////////////////////////////////////////////////////// -// Definitions -//////////////////////////////////////////////////////////////////////////////// - #define ENABLE_BUSPAL -// -// Bootloader configuration options -// - -//! @name Peripheral configuration macros -//@{ - -#if !defined(BL_CONFIG_SCUART) -#define BL_CONFIG_SCUART (0) #endif -#if !defined(BL_CONFIG_I2C) -#define BL_CONFIG_I2C (1) -#endif -#if !defined(BL_CONFIG_DSPI) -#define BL_CONFIG_DSPI (0) -#endif -#if !defined(BL_CONFIG_USB_HID) -#define BL_CONFIG_USB_HID (1) -#endif -#if !defined(BL_CONFIG_USB_MSC) -#define BL_CONFIG_USB_MSC (0) -#endif - -//@} - -#if !defined(BL_TARGET_FLASH) && !defined(BL_TARGET_RAM) -#define BL_TARGET_FLASH (0) -#endif - -#if defined(BL_TARGET_RAM) -#define BL_FEATURE_FLASH_SECURITY (0) -#else -#define BL_FEATURE_FLASH_SECURITY (1) -#endif - -#define BL_FEATURE_ENCRYPTION (0) - -// Bootloader peripheral detection default timeout in milliseconds -// After coming out of reset the bootloader will spin in a peripheral detection -// loop for this amount of time. A zero value means no time out. -#if DEBUG -#define BL_DEFAULT_PERIPHERAL_DETECT_TIMEOUT 0 -#else -#define BL_DEFAULT_PERIPHERAL_DETECT_TIMEOUT 5000 -#endif // DEBUG - -#define BL_FEATURE_POWERDOWN (0) - -// Bootloader powerdown timeout in milliseconds -// The bootloader enters a low power mode after waiting for this amount of time. A zero value means // no time out. Only -// applicable if BL_FEATURE_POWERDOWN is enabled. -#if DEBUG -#define BL_DEFAULT_POWERDOWN_TIMEOUT 10000 -#else -#define BL_DEFAULT_POWERDOWN_TIMEOUT 600000 -#endif // DEBUG - -#if !defined(BL_TARGET_RAM) -#define BL_FEATURE_CRC_CHECK (1) -#endif - -#define BL_FEATURE_UART_AUTOBAUD_IRQ (1) - -// The bootloader will check this address for the application vector table upon startup. -#if !defined(BL_APP_VECTOR_TABLE_ADDRESS) -#define BL_APP_VECTOR_TABLE_ADDRESS 0xa000 -#endif - -/* Serial Port Info */ - -/************************************************************************** - * Note: - * - * Because of the changes to the UART modules, we can no longer define - * the TERM_PORT as a base pointer. The uart functions have been modified - * accommodate this change. Now, TERM_PORT_NUM must be defined as the - * number of the UART port desired to use - * - * TERM_PORT_NUM = 0 -- This allows you to use UART0; default pins are - * PTA14 and PTA15 - * - * TERM_PORT_NUM = 1 -- This allows you to use UART1; default pins are - * PTC3 and PTC4 - * - * TERM_PORT_NUM = 2 -- This allows you to use UART2; default pins are - * PTD2 and PTD3 - * - *************************************************************************/ -#define TERM_PORT_NUM 0 - -#define TERMINAL_BAUD 19200 -#undef HW_FLOW_CONTROL - -#endif // __BOOTLOADER_CONFIG_H__