aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--laser-tag software/disk.c1002
-rw-r--r--laser-tag software/disk.h11
-rw-r--r--laser-tag software/epaper.c11
-rw-r--r--laser-tag software/main.c12
-rw-r--r--laser-tag software/radio.c28
-rw-r--r--laser-tag software/usb_descriptor.c61
-rw-r--r--laser-tag software/usb_descriptor.h6
7 files changed, 330 insertions, 801 deletions
diff --git a/laser-tag software/disk.c b/laser-tag software/disk.c
index 84b1c3f..5a89d66 100644
--- a/laser-tag software/disk.c
+++ b/laser-tag software/disk.c
@@ -1,724 +1,278 @@
-/**HEADER********************************************************************
- *
- * Copyright (c) 2008, 2013 - 2014 Freescale Semiconductor;
- * All Rights Reserved
- *
- * Copyright (c) 1989-2008 ARC International;
- * All Rights Reserved
- *
- ***************************************************************************
- *
- * THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESSED OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL FREESCALE OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- *
- **************************************************************************
- *
- * $FileName: disk.c$
- * $Version :
- * $Date :
- *
- * Comments:
- *
- * @brief RAM Disk has been emulated via this Mass Storage Demo
- *****************************************************************************/
-
-/******************************************************************************
- * Includes
- *****************************************************************************/
-#include "usb_device_config.h"
-#include "usb.h"
-#include "usb_device_stack_interface.h"
-#include "disk.h"
-#include "adapter_cfg.h"
-#if (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_SDK)
-#include "fsl_device_registers.h"
-#include "fsl_clock_manager.h"
-//#include "board.h"
-#include "fsl_debug_console.h"
-#if (TWR_K64F120M || FRDM_K64F || TWR_K60D100M || TWR_K21F120M || TWR_K65F180M)
-#include "fsl_mpu_hal.h"
-#endif
-#include "fsl_port_hal.h"
-#include <stdio.h>
-#include <stdlib.h>
-#endif
-
-#if SD_CARD_APP
-#if (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_BM)
-#include "sd_esdhc_kinetis.h"
-#elif (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_SDK)
-#include "fsl_sdhc_card.h"
-#include "fsl_gpio_driver.h"
-#include "gpio_pins.h"
-#include "board.h"
-#else
-#include "sd.h"
-#endif
-#endif
-
-#if USBCFG_DEV_COMPOSITE
-#error This application requires USBCFG_DEV_COMPOSITE defined zero in usb_device_config.h. Please recompile usbd with this option.
-#endif
-
-#if !USBCFG_DEV_MSC
-#error This application requires USBCFG_DEV_MSC defined none zero in usb_device_config.h. Please recompile usbd with this option.
-#endif
-
-#if HIGH_SPEED
-
-#if !USBCFG_DEV_EHCI
-#error This application requires USBCFG_DEV_EHCI defined none zero in usb_device_config.h. Please recompile usbd with this option.
-#endif
-
-#endif
-
-extern void Main_Task(uint32_t param);
-#define MAIN_TASK 10
-
-#if (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_MQX)
-TASK_TEMPLATE_STRUCT MQX_template_list[] =
-{
- { MAIN_TASK, Main_Task, 2 * 3000L, 9L, "Main", MQX_AUTO_START_TASK, 0, 0 },
- { 0L, 0L, 0L, 0L, 0L, 0L, 0, 0 }
-};
-
-MQX_FILE_PTR g_sdcard_handle;
-#endif
-/*****************************************************************************
- * Constant and Macro's - None
- *****************************************************************************/
-
-/*****************************************************************************
- * Global Functions Prototypes
- *****************************************************************************/
-void TestApp_Init(void);
-
-/****************************************************************************
- * Global Variables
- ****************************************************************************/
-/* Add all the variables needed for disk.c to this structure */
-extern usb_desc_request_notify_struct_t desc_callback;
-usb_application_callback_struct_t msc_application_callback;
-usb_vendor_req_callback_struct_t vend_req_callback;
-usb_class_specific_callback_struct_t class_specific_callback;
-
-msc_config_struct_t g_msd_config;
-#if (RAM_DISK_APP)
-/* Here set storage_disk value to put the 24k buffer to RW region,
- if putting in ZI and 64k ram the ZI region cannot be put in upper/bottom 32k ram for iar */
-disk_struct_t g_disk =
-{
- .storage_disk = {0x01},
-};
-#else
-disk_struct_t g_disk;
-#endif
-
-#if SD_CARD_APP
- #define USE_SDHC_PROTOCOL (1)
- #define USE_SPI_PROTOCOL (0)
-#endif
-
-/*****************************************************************************
- * Local Types - None
- *****************************************************************************/
-
-/*****************************************************************************
- * Local Functions Prototypes
- *****************************************************************************/
-void USB_App_Device_Callback(uint8_t event_type, void* val, void* arg);
-uint8_t USB_App_Class_Callback
-(uint8_t event_type,
- uint16_t value,
- uint8_t ** data,
- uint32_t* size,
- void* arg
- );
-void Disk_App(void);
-/*****************************************************************************
- * Local Variables
- *****************************************************************************/
-#if SD_CARD_APP
-#if (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_SDK)
-#define SDCARD_BLOCK_SIZE_POWER (9)
-sdhc_card_t card = {0};
-sdhc_host_t host = {0};
-#endif
-#if (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_BM || OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_SDK)
-uint32_t g_msc_bulk_out_buff_temp[MSD_RECV_BUFFER_NUM][MSD_RECV_BUFFER_SIZE >> 2];
-uint32_t g_msc_bulk_in_buff_temp[MSD_SEND_BUFFER_SIZE >> 2];
-#endif
-uint8_t *g_msc_bulk_out_buff;
-uint8_t *g_msc_bulk_in_buff;
-#endif
-/*****************************************************************************
- * Local Functions
- *****************************************************************************/
-#if SD_CARD_APP
-os_msgq_handle write_buffer_msg_handler;
-
-/******************************************************************************
- *
- * @name get_write_buffer
- *
- * @brief This function get the buffer for writing
- *
- * @param None
- *
- * @return buffer pointer (return NULL when there is no idle buffer )
- **
- *****************************************************************************/
-uint32_t* get_write_buffer(void)
-{
- uint32_t msg;
- /* wait forever for RTOS; return immediately for bm */
- if (OS_MsgQ_recv(write_buffer_msg_handler, (void*)&msg, OS_MSGQ_RECEIVE_BLOCK_ON_EMPTY, 0) == OS_MSGQ_OK)
- {
- return (uint32_t*)msg;
- }
- return NULL;
-}
-
-/******************************************************************************
- *
- * @name get_write_buffer
- *
- * @brief This function get the buffer for writing
- *
- * @param buffer : The buffer pointer
- *
- * @return None
- **
- *****************************************************************************/
-void free_write_buffer(uint32_t* buffer)
-{
- uint32_t address = (uint32_t)buffer;
- OS_MsgQ_send(write_buffer_msg_handler, (void*)(&address), 0);
-}
-#endif
-
-#if MUTILE_BUFFER && (((OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_SDK) && (USE_RTOS)) || (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_MQX))
-os_msgq_handle write_msg_handler;
-os_mutex_handle sdhc_mutex;
-
-static void write_task(void *arg)
-{
- uint8_t* buff_ptr;
- uint32_t offset;
- uint32_t size;
- uint32_t msg[3];
-#if (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_SDK)
- sdhc_status_t error_code = kStatus_SDHC_NoError;
-#else
- _mqx_uint error_code = MQX_OK;
-#endif
-
- while (OS_MsgQ_recv(write_msg_handler, (void*)&msg, OS_MSGQ_RECEIVE_BLOCK_ON_EMPTY, 0) == OS_MSGQ_OK)
- {
- buff_ptr = (uint8_t*)msg[0];
- offset = msg[1];
- size = msg[2];
-
- OS_Mutex_lock(sdhc_mutex);
-#if (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_SDK)
- error_code = SDCARD_DRV_WriteBlocks(&card, buff_ptr, offset >> SDCARD_BLOCK_SIZE_POWER, size >> SDCARD_BLOCK_SIZE_POWER);
-#elif (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_MQX)
- error_code = sd_write_device_sectors(g_sdcard_handle, offset >> SDCARD_BLOCK_SIZE_POWER, size >> SDCARD_BLOCK_SIZE_POWER, 3, buff_ptr, NULL);
-#endif
- OS_Mutex_unlock(sdhc_mutex);
- free_write_buffer((uint32_t*)buff_ptr);
-#if (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_SDK)
- if (error_code != kStatus_SDHC_NoError)
-#elif (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_MQX)
- if (error_code != MQX_OK)
-#endif
- {
- g_disk.read_write_error = 1;
- USB_PRINTF("Write SD card error, error = 0x%x.\tPlease check recv buff size(must be less than 128 sectors).\r\n", error_code);
- }
- }
-}
-#endif
-
-#if (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_SDK && SD_CARD_APP)
-#if defined(FSL_RTOS_MQX)
-#include "fsl_sdhc_driver.h"
-void SDHC_MQX_IRQHandler(void)
-{
-#if defined BSP_FSL_SDHC_USING_IRQ
- SDHC_DRV_DoIrq(0);
-#endif
-}
-#endif
-
-/* don't use interrupt to detect the sdcard */
-gpio_input_pin_user_config_t sdhc_detect_pin[2];
-
-void sdhc_detect_io_init(void)
-{
- for (int i = 0; i < 2; ++i)
- {
- sdhc_detect_pin[i].pinName = sdhcCdPin[i].pinName;
- sdhc_detect_pin[i].config.isPullEnable = sdhcCdPin[i].config.isPullEnable;
- sdhc_detect_pin[i].config.pullSelect = sdhcCdPin[i].config.pullSelect;
- sdhc_detect_pin[i].config.isPassiveFilterEnabled = sdhcCdPin[i].config.isPassiveFilterEnabled;
- sdhc_detect_pin[i].config.interrupt = kPortIntDisabled; /* don't use interrupt */
- }
-
- GPIO_DRV_Init(sdhc_detect_pin, NULL);
-}
-
-uint8_t sdhc_detect(void)
-{
- uint32_t value = 0;
- if (sdhc_detect_pin[0].config.pullSelect == kPortPullUp) /* pull up */
- {
- value = GPIO_DRV_ReadPinInput(sdhc_detect_pin[0].pinName);
- return (!value);
- }
- else /* pull down */
- {
- return (GPIO_DRV_ReadPinInput(sdhc_detect_pin[0].pinName));
- }
-}
-
-uint8_t SD_Init(void)
-{
- sdhc_user_config_t config = {0};
- /* enable SDHC module instance */
- CLOCK_SYS_EnableSdhcClock(0);
- /* disable mpu for kSdhcTransModeAdma2 */
-#if (TWR_K64F120M || FRDM_K64F || TWR_K60D100M || TWR_K21F120M || TWR_K65F180M)
- MPU_HAL_Disable(MPU);
-#endif
- /* initialize user sdhc configuration structure */
- config.transMode = kSdhcTransModeAdma2; //kSdhcTransModePio;
- config.clock = SDMMC_CLK_100KHZ;
- config.cdType = kSdhcCardDetectGpio;
- /* initialize the SDHC driver with the user configuration */
- if (SDHC_DRV_Init(BOARD_SDHC_INSTANCE, &host, &config) != kStatus_SDHC_NoError)
- {
- USB_PRINTF("SDHC_DRV_Init failed\r\n");
- return 0;
- }
-
-#if defined (FSL_RTOS_MQX)
- OS_install_isr(SDHC_IRQn, SDHC_MQX_IRQHandler, NULL);
-#endif
-#if (USE_RTOS)
- OS_intr_init(SDHC_IRQn, 5, 0, TRUE);
-#endif
-
- /* A card is detected, now initialize the card driver */
- if (kStatus_SDHC_NoError != SDCARD_DRV_Init(&host, &card))
- {
- USB_PRINTF("SDCARD_DRV_Init failed\r\n");
- SDHC_DRV_Shutdown(card.hostInstance);
- return 0;
- }
- return 1;
-}
-
-#endif
-
-/******************************************************************************
- *
- * @name Disk_App
- *
- * @brief
- *
- * @param None
- *
- * @return None
- *
- *****************************************************************************/
-void Disk_App(void)
-{
- /* User Code */
- return;
-}
-
-/******************************************************************************
- *
- * @name USB_App_Device_Callback
- *
- * @brief This function handles the callback
- *
- * @param pointer :
- * @param event_type : value of the event
- * @param val : gives the configuration value
- *
- * @return None
- *
- *****************************************************************************/
-void USB_App_Device_Callback(uint8_t event_type, void* val, void* arg)
-{
- if (event_type == USB_DEV_EVENT_BUS_RESET)
- {
- g_disk.start_app = FALSE;
- if (USB_OK == USB_Class_MSC_Get_Speed(g_disk.app_handle, &g_disk.speed))
- {
- USB_Desc_Set_Speed(g_disk.app_handle, g_disk.speed);
- }
- }
- else if (event_type == USB_DEV_EVENT_ENUM_COMPLETE)
- {
- g_disk.start_app = TRUE;
- }
- else if (event_type == USB_DEV_EVENT_ERROR)
- {
- /* add user code for error handling */
- }
- else if (event_type == USB_MSC_DEVICE_GET_SEND_BUFF_INFO)
- {
- if (NULL != val)
- {
-#if SD_CARD_APP
- *((uint32_t *)val) = (uint32_t)MSD_SEND_BUFFER_SIZE;
-#elif RAM_DISK_APP
- *((uint32_t *)val) = (uint32_t)DISK_SIZE_NORMAL;
-#endif
- }
- }
- else if (event_type == USB_MSC_DEVICE_GET_RECV_BUFF_INFO)
- {
- if (NULL != val)
- {
-#if SD_CARD_APP
- *((uint32_t *)val) = (uint32_t)MSD_RECV_BUFFER_SIZE;
-#elif RAM_DISK_APP
- *((uint32_t *)val) = (uint32_t)DISK_SIZE_NORMAL;
-#endif
- }
- }
-
- return;
-}
-
-/******************************************************************************
- *
- * @name USB_App_Class_Callback
- *
- * @brief This function handles the callback
- *
- * @param pointer :
- * @param event_type : value of the event
- * @param val : gives the configuration value
- *
- * @return None
- *
- *****************************************************************************/
-uint8_t USB_App_Class_Callback
-(uint8_t event_type,
- uint16_t value,
- uint8_t ** data,
- uint32_t* size,
- void* arg
-)
-{
- lba_app_struct_t* lba_data_ptr;
- uint8_t * prevent_removal_ptr;
- device_lba_info_struct_t* device_lba_info_ptr;
- uint8_t error = USB_OK;
-#if SD_CARD_APP && (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_MQX)
- _mqx_uint error_code = MQX_OK;
-#endif
-#if SD_CARD_APP && (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_SDK)
- sdhc_status_t error_code = kStatus_SDHC_NoError;
-#endif
-
- if (g_disk.read_write_error)
- {
- return USBERR_ERROR;
- }
-
- switch(event_type)
- {
- case USB_DEV_EVENT_DATA_RECEIVED:
- /* Add User defined code -- if required*/
- lba_data_ptr = (lba_app_struct_t*) size;
-#if RAM_DISK_APP
-#elif SD_CARD_APP
- if (lba_data_ptr->size == 0)
- free_write_buffer((uint32_t*)lba_data_ptr->buff_ptr);
- else
- {
-#if (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_BM)
- SD_Write_Block(lba_data_ptr);
- free_write_buffer((uint32_t*)lba_data_ptr->buff_ptr);
-#elif (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_SDK)
-#if MUTILE_BUFFER && (USE_RTOS)
- uint32_t msg[3] = {(uint32_t)lba_data_ptr->buff_ptr, lba_data_ptr->offset, lba_data_ptr->size};
- OS_MsgQ_send(write_msg_handler, (void*)(msg), 0);
-#else
- error_code = SDCARD_DRV_WriteBlocks(&card, lba_data_ptr->buff_ptr, lba_data_ptr->offset >> SDCARD_BLOCK_SIZE_POWER,
- lba_data_ptr->size >> SDCARD_BLOCK_SIZE_POWER);
- free_write_buffer((uint32_t*)lba_data_ptr->buff_ptr);
- if (error_code != kStatus_SDHC_NoError)
- {
- error = USBERR_ERROR;
- g_disk.read_write_error=1;
- USB_PRINTF("Write SD card error, error = 0x%x.\tPlease check recv buff size(must be less than 128 sectors).\r\n", error_code);
- }
-#endif
-
-#else
-#if MUTILE_BUFFER
- uint32_t msg[3] = {(uint32_t)lba_data_ptr->buff_ptr, lba_data_ptr->offset, lba_data_ptr->size};
- OS_MsgQ_send(write_msg_handler, (void*)(msg), 0);
-#else
- error_code = sd_write_device_sectors(g_sdcard_handle, (lba_data_ptr->offset >> SDCARD_BLOCK_SIZE_POWER),
- (lba_data_ptr->size >> SDCARD_BLOCK_SIZE_POWER) , 3, lba_data_ptr->buff_ptr,NULL);
- free_write_buffer((uint32_t*)lba_data_ptr->buff_ptr);
- if (error_code != MQX_OK)
- {
- error = USBERR_ERROR;
- g_disk.read_write_error=1;
- USB_PRINTF("Write SD card error, error = 0x%x.\tPlease check recv buff size(must be less than 128 sectors).\r\n", error_code);
- }
-#endif
-#endif
- }
-#endif
- break;
- case USB_DEV_EVENT_SEND_COMPLETE:
- /* Add User defined code -- if required*/
- lba_data_ptr = (lba_app_struct_t*) size;
- if (lba_data_ptr->size != 0)
- {
- /* read data from mass storage device to driver buffer */
-#if RAM_DISK_APP
- if(data != NULL)
- {
- *data = g_disk.storage_disk + lba_data_ptr->offset;
- }
-#elif SD_CARD_APP
-#endif
- }
- break;
- case USB_MSC_START_STOP_EJECT_MEDIA:
- /* Code to be added by user for starting, stopping or
- ejecting the disk drive. e.g. starting/stopping the motor in
- case of CD/DVD*/
- break;
- case USB_MSC_DEVICE_READ_REQUEST:
- lba_data_ptr = (lba_app_struct_t*) size;
-
-#if RAM_DISK_APP
- if(data != NULL)
- {
- *data = g_disk.storage_disk + lba_data_ptr->offset;
- }
-#elif SD_CARD_APP
- if(data != NULL)
- {
- *data = g_msc_bulk_in_buff;
- }
- lba_data_ptr->buff_ptr = g_msc_bulk_in_buff;
-#if (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_BM)
- SD_Read_Block(lba_data_ptr);
-#elif (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_SDK)
-#if MUTILE_BUFFER && (USE_RTOS)
- OS_Mutex_lock(sdhc_mutex);
-#endif
- error_code = SDCARD_DRV_ReadBlocks(&card, lba_data_ptr->buff_ptr, lba_data_ptr->offset >> SDCARD_BLOCK_SIZE_POWER,
- lba_data_ptr->size >> SDCARD_BLOCK_SIZE_POWER);
-#if MUTILE_BUFFER && (USE_RTOS)
- OS_Mutex_unlock(sdhc_mutex);
-#endif
- if (error_code != kStatus_SDHC_NoError)
- {
- error = USBERR_ERROR;
- g_disk.read_write_error=1;
- USB_PRINTF("Read SD card error, error = 0x%x.\tPlease check send buff size(must be less than 128 sectors).\r\n", error_code);
- }
-#else
-#if MUTILE_BUFFER
- OS_Mutex_lock(sdhc_mutex);
-#endif
- error_code = sd_read_device_sectors(g_sdcard_handle, (lba_data_ptr->offset >> SDCARD_BLOCK_SIZE_POWER),
- (lba_data_ptr->size >> SDCARD_BLOCK_SIZE_POWER) , 3, lba_data_ptr->buff_ptr,NULL);
-#if MUTILE_BUFFER
- OS_Mutex_unlock(sdhc_mutex);
-#endif
- if (error_code != MQX_OK)
- {
- error = USBERR_ERROR;
- g_disk.read_write_error=1;
- USB_PRINTF("Read SD card error, error = 0x%x.\tPlease check send buff size(must be less than 128 sectors).\r\n", error_code);
- }
-#endif
-#endif
- break;
- case USB_MSC_DEVICE_WRITE_REQUEST:
- lba_data_ptr = (lba_app_struct_t*) size;
-#if RAM_DISK_APP
- if(data != NULL)
- {
- *data = g_disk.storage_disk + lba_data_ptr->offset;
- }
-#elif SD_CARD_APP
- if(data != NULL)
- {
- /* get_write_buffer should return NULL when there are no buffers for writing */
- *data = (uint8_t*)get_write_buffer();
- }
-#endif
- break;
- case USB_MSC_DEVICE_FORMAT_COMPLETE:
- break;
- case USB_MSC_DEVICE_REMOVAL_REQUEST:
- prevent_removal_ptr = (uint8_t *) size;
- if (SUPPORT_DISK_LOCKING_MECHANISM)
- {
- g_disk.disk_lock = *prevent_removal_ptr;
- }
- else if ((!SUPPORT_DISK_LOCKING_MECHANISM) && (!(*prevent_removal_ptr)))
- {
- /*there is no support for disk locking and removal of medium is enabled*/
- /* code to be added here for this condition, if required */
- }
- break;
- case USB_MSC_DEVICE_GET_INFO:
- device_lba_info_ptr = (device_lba_info_struct_t*) size;
-#if RAM_DISK_APP
- device_lba_info_ptr->total_lba_device_supports = TOTAL_LOGICAL_ADDRESS_BLOCKS_NORMAL;
- device_lba_info_ptr->length_of_each_lab_of_device = LENGTH_OF_EACH_LAB;
-#elif SD_CARD_APP
-#if (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_BM)
- SD_Card_Info(&device_lba_info_ptr->total_lba_device_supports,
- &device_lba_info_ptr->length_of_each_lab_of_device);
-#elif (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_SDK)
- device_lba_info_ptr->total_lba_device_supports = card.blockCount;
- device_lba_info_ptr->length_of_each_lab_of_device = card.blockSize;
-#else
- sd_get_block_size(g_sdcard_handle, &device_lba_info_ptr->length_of_each_lab_of_device);
- sd_get_blocks_num(g_sdcard_handle, &device_lba_info_ptr->total_lba_device_supports);
-#endif
-#endif
- device_lba_info_ptr->num_lun_supported = LOGICAL_UNIT_SUPPORTED;
- break;
- default:
- break;
- }
-
- return error;
-}
-
-/******************************************************************************
- *
- * @name TestApp_Init
- *
- * @brief This function is the entry for mouse (or other usage)
- *
- * @param None
- *
- * @return None
- **
- *****************************************************************************/
-
-void APP_init(void)
-{
-#if SD_CARD_APP
-
-#if ((OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_BM) || (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_SDK))
- g_msc_bulk_in_buff = (uint8_t*)g_msc_bulk_in_buff_temp;
- g_msc_bulk_out_buff = (uint8_t*)g_msc_bulk_out_buff_temp;
-#elif (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_MQX)
- g_msc_bulk_in_buff = (uint8_t*)OS_Mem_alloc_uncached_align(MSD_SEND_BUFFER_SIZE, 32);
- g_msc_bulk_out_buff = (uint8_t*)OS_Mem_alloc_uncached_align(MSD_RECV_BUFFER_SIZE * MSD_RECV_BUFFER_NUM, 32);
-#endif
-
-#endif
-
-#if SD_CARD_APP
- USB_PRINTF("Please insert SD card\n");
-#if (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_BM || OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_SDK)
-#if USE_SDHC_PROTOCOL
- sdhc_detect_io_init();
-#endif
- while (!sdhc_detect())
- {
- ;
- } /* SD Card inserted */
- if(!SD_Init()) return; /* Initialize SD_CARD and SPI Interface */
-#else
- g_sdcard_handle = sd_init();
-
-#endif
- USB_PRINTF("\nSD card inserted!\n");
-
-#endif
- OS_Mem_zero(&g_disk, sizeof(disk_struct_t));
-
- OS_Mem_zero(&g_msd_config, sizeof(msc_config_struct_t));
-
- msc_application_callback.callback = USB_App_Device_Callback;
- msc_application_callback.arg = &g_disk.app_handle;
-
- /* Register the callbacks to lower layers */
- g_msd_config.msc_application_callback = msc_application_callback;
- g_msd_config.vendor_req_callback = vend_req_callback;
- g_msd_config.class_specific_callback.callback = USB_App_Class_Callback;
- g_msd_config.class_specific_callback.arg = &g_disk.app_handle;
- g_msd_config.desc_callback_ptr = &desc_callback;
-
- g_disk.speed = USB_SPEED_FULL;
- /* Finally, Initialize the device and USB Stack layers*/
- USB_Class_MSC_Init(CONTROLLER_ID, &g_msd_config, &g_disk.app_handle);
-
-#if SD_CARD_APP
- write_buffer_msg_handler = OS_MsgQ_create((MSD_RECV_BUFFER_NUM + 1), 1); //msg_size = 4Bytes
- for (int i = 0; i < MSD_RECV_BUFFER_NUM; ++i)
- {
- uint32_t address = (uint32_t)(&g_msc_bulk_out_buff[i * MSD_RECV_BUFFER_SIZE]);
- OS_MsgQ_send(write_buffer_msg_handler, (void*)(&address), 0);
- }
-#endif
-}
-
-void APP_task()
-{
- if (g_disk.read_write_error)
- {
- return;
- }
- Disk_App();
-}
-
-#if (OS_ADAPTER_ACTIVE_OS == OS_ADAPTER_MQX)
-/*FUNCTION*----------------------------------------------------------------
- *
- * Function Name : Main_Task
- * Returned Value : None
- * Comments :
- * First function called. Calls Test_App
- * callback functions.
- *
- *END*--------------------------------------------------------------------*/
-void Main_Task
-(
- uint32_t param
- )
-{
- UNUSED_ARGUMENT (param)
- APP_init();
-#if MUTILE_BUFFER
- /* write sdhc task */
- sdhc_mutex = OS_Mutex_create();
- write_msg_handler = OS_MsgQ_create((MSD_RECV_BUFFER_NUM), 3);/* msg_size = 12Bytes */
- OS_Task_create(write_task, NULL, 8L, 2000L, "write_task", NULL);
-#endif
-}
-#endif
-
-/* EOF */
+/**HEADER********************************************************************
+ *
+ * Copyright (c) 2008, 2013 - 2014 Freescale Semiconductor;
+ * All Rights Reserved
+ *
+ * Copyright (c) 1989-2008 ARC International;
+ * All Rights Reserved
+ *
+ ***************************************************************************
+ *
+ * THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL FREESCALE OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ **************************************************************************
+ *
+ * $FileName: disk.c$
+ * $Version :
+ * $Date :
+ *
+ * Comments:
+ *
+ * @brief RAM Disk has been emulated via this Mass Storage Demo
+ *****************************************************************************/
+
+/******************************************************************************
+ * Includes
+ *****************************************************************************/
+#include "usb_device_config.h"
+#include "usb.h"
+#include "usb_device_stack_interface.h"
+#include "disk.h"
+#include "adapter_cfg.h"
+#include "fsl_device_registers.h"
+#include "fsl_clock_manager.h"
+#include "fsl_debug_console.h"
+#include "fsl_port_hal.h"
+
+#if USBCFG_DEV_COMPOSITE
+#error This application requires USBCFG_DEV_COMPOSITE defined zero in usb_device_config.h. Please recompile usbd with this option.
+#endif
+
+#if !USBCFG_DEV_MSC
+#error This application requires USBCFG_DEV_MSC defined none zero in usb_device_config.h. Please recompile usbd with this option.
+#endif
+
+#if HIGH_SPEED
+
+#if !USBCFG_DEV_EHCI
+#error This application requires USBCFG_DEV_EHCI defined none zero in usb_device_config.h. Please recompile usbd with this option.
+#endif
+
+#endif
+
+/****************************************************************************
+ * Global Variables
+ ****************************************************************************/
+/* Add all the variables needed for disk.c to this structure */
+extern usb_desc_request_notify_struct_t desc_callback;
+usb_application_callback_struct_t msc_application_callback;
+usb_vendor_req_callback_struct_t vend_req_callback;
+usb_class_specific_callback_struct_t class_specific_callback;
+
+msc_config_struct_t g_msd_config;
+disk_struct_t g_disk;
+
+/*****************************************************************************
+ * Local Types - None
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Local Functions Prototypes
+ *****************************************************************************/
+void USB_App_Device_Callback(uint8_t event_type, void* val, void* arg);
+uint8_t USB_App_Class_Callback
+(uint8_t event_type,
+ uint16_t value,
+ uint8_t ** data,
+ uint32_t* size,
+ void* arg
+ );
+
+/*****************************************************************************
+ * Local Variables
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Local Functions
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * @name USB_App_Device_Callback
+ *
+ * @brief This function handles the callback
+ *
+ * @param pointer :
+ * @param event_type : value of the event
+ * @param val : gives the configuration value
+ *
+ * @return None
+ *
+ *****************************************************************************/
+void USB_App_Device_Callback(uint8_t event_type, void* val, void* arg)
+{
+ if (event_type == USB_DEV_EVENT_BUS_RESET)
+ {
+ g_disk.start_app = FALSE;
+ if (USB_OK == USB_Class_MSC_Get_Speed(g_disk.app_handle, &g_disk.speed))
+ {
+ USB_Desc_Set_Speed(g_disk.app_handle, g_disk.speed);
+ }
+ }
+ else if (event_type == USB_DEV_EVENT_ENUM_COMPLETE)
+ {
+ g_disk.start_app = TRUE;
+ }
+ else if (event_type == USB_DEV_EVENT_ERROR)
+ {
+ /* add user code for error handling */
+ }
+ else if (event_type == USB_MSC_DEVICE_GET_SEND_BUFF_INFO)
+ {
+ if (NULL != val)
+ {
+ *((uint32_t *)val) = (uint32_t)DISK_SIZE_NORMAL;
+ }
+ }
+ else if (event_type == USB_MSC_DEVICE_GET_RECV_BUFF_INFO)
+ {
+ if (NULL != val)
+ {
+ *((uint32_t *)val) = (uint32_t)DISK_SIZE_NORMAL;
+ }
+ }
+
+ return;
+}
+
+/******************************************************************************
+ *
+ * @name USB_App_Class_Callback
+ *
+ * @brief This function handles the callback
+ *
+ * @param pointer :
+ * @param event_type : value of the event
+ * @param val : gives the configuration value
+ *
+ * @return None
+ *
+ *****************************************************************************/
+uint8_t USB_App_Class_Callback
+(uint8_t event_type,
+ uint16_t value,
+ uint8_t ** data,
+ uint32_t* size,
+ void* arg
+)
+{
+ lba_app_struct_t* lba_data_ptr;
+ uint8_t * prevent_removal_ptr;
+ device_lba_info_struct_t* device_lba_info_ptr;
+ uint8_t error = USB_OK;
+
+ if (g_disk.read_write_error)
+ {
+ return USBERR_ERROR;
+ }
+
+ switch(event_type)
+ {
+ case USB_DEV_EVENT_DATA_RECEIVED:
+ /* Add User defined code -- if required*/
+ lba_data_ptr = (lba_app_struct_t*) size;
+ break;
+ case USB_DEV_EVENT_SEND_COMPLETE:
+ /* Add User defined code -- if required*/
+ lba_data_ptr = (lba_app_struct_t*) size;
+ if (lba_data_ptr->size != 0)
+ {
+ /* read data from mass storage device to driver buffer */
+ if(data != NULL)
+ {
+ *data = g_disk.storage_disk + lba_data_ptr->offset;
+ }
+ }
+ break;
+ case USB_MSC_START_STOP_EJECT_MEDIA:
+ /* Code to be added by user for starting, stopping or
+ ejecting the disk drive. e.g. starting/stopping the motor in
+ case of CD/DVD*/
+ break;
+ case USB_MSC_DEVICE_READ_REQUEST:
+ lba_data_ptr = (lba_app_struct_t*) size;
+
+ if(data != NULL)
+ {
+ *data = g_disk.storage_disk + lba_data_ptr->offset;
+ }
+ break;
+ case USB_MSC_DEVICE_WRITE_REQUEST:
+ lba_data_ptr = (lba_app_struct_t*) size;
+ if(data != NULL)
+ {
+ *data = g_disk.storage_disk + lba_data_ptr->offset;
+ }
+ break;
+ case USB_MSC_DEVICE_FORMAT_COMPLETE:
+ break;
+ case USB_MSC_DEVICE_REMOVAL_REQUEST:
+ prevent_removal_ptr = (uint8_t *) size;
+ if (SUPPORT_DISK_LOCKING_MECHANISM)
+ {
+ g_disk.disk_lock = *prevent_removal_ptr;
+ }
+ else if ((!SUPPORT_DISK_LOCKING_MECHANISM) && (!(*prevent_removal_ptr)))
+ {
+ /*there is no support for disk locking and removal of medium is enabled*/
+ /* code to be added here for this condition, if required */
+ }
+ break;
+ case USB_MSC_DEVICE_GET_INFO:
+ device_lba_info_ptr = (device_lba_info_struct_t*) size;
+ device_lba_info_ptr->total_lba_device_supports = TOTAL_LOGICAL_ADDRESS_BLOCKS_NORMAL;
+ device_lba_info_ptr->length_of_each_lab_of_device = LENGTH_OF_EACH_LAB;
+ device_lba_info_ptr->num_lun_supported = LOGICAL_UNIT_SUPPORTED;
+ break;
+ default:
+ break;
+ }
+
+ return error;
+}
+
+/******************************************************************************
+ *
+ * @name disk_init
+ *
+ * @brief This function is the entry for mouse (or other usage)
+ *
+ * @param None
+ *
+ * @return None
+ **
+ *****************************************************************************/
+
+void disk_init(uint8_t *mem)
+{
+ OS_Mem_zero(&g_disk, sizeof(disk_struct_t));
+
+ OS_Mem_zero(&g_msd_config, sizeof(msc_config_struct_t));
+
+ msc_application_callback.callback = USB_App_Device_Callback;
+ msc_application_callback.arg = &g_disk.app_handle;
+
+ /* Register the callbacks to lower layers */
+ g_msd_config.msc_application_callback = msc_application_callback;
+ g_msd_config.vendor_req_callback = vend_req_callback;
+ g_msd_config.class_specific_callback.callback = USB_App_Class_Callback;
+ g_msd_config.class_specific_callback.arg = &g_disk.app_handle;
+ g_msd_config.desc_callback_ptr = &desc_callback;
+
+ g_disk.speed = USB_SPEED_FULL;
+ g_disk.storage_disk = mem;
+ /* Finally, Initialize the device and USB Stack layers*/
+ USB_Class_MSC_Init(CONTROLLER_ID, &g_msd_config, &g_disk.app_handle);
+}
+
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/laser-tag software/disk.h b/laser-tag software/disk.h
index a8ddb20..eb30314 100644
--- a/laser-tag software/disk.h
+++ b/laser-tag software/disk.h
@@ -51,7 +51,7 @@
/* Length of Each Logical Address Block */
#define LENGTH_OF_EACH_LAB (512)
/* total number of logical blocks present */
- #define TOTAL_LOGICAL_ADDRESS_BLOCKS_NORMAL (4)
+ #define TOTAL_LOGICAL_ADDRESS_BLOCKS_NORMAL (8)
/* Net Disk Size */
#define DISK_SIZE_NORMAL (TOTAL_LOGICAL_ADDRESS_BLOCKS_NORMAL * LENGTH_OF_EACH_LAB)
#endif
@@ -82,9 +82,7 @@ typedef struct _disk_variable_struct
msd_handle_t app_handle;
uint32_t start_app;
uint16_t speed;
-#if RAM_DISK_APP
- uint8_t storage_disk[DISK_SIZE_NORMAL];
-#endif
+ uint8_t *storage_disk;
uint8_t disk_lock;
uint8_t read_write_error;
} disk_struct_t;
@@ -92,9 +90,8 @@ typedef struct _disk_variable_struct
/*****************************************************************************
* Global Functions
*****************************************************************************/
-extern void APP_init(void);
-extern void Disk_App(void);
+void disk_init(uint8_t *mem);
#endif
-/* EOF */
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/laser-tag software/epaper.c b/laser-tag software/epaper.c
index 8bd1dbf..7d0effd 100644
--- a/laser-tag software/epaper.c
+++ b/laser-tag software/epaper.c
@@ -21,7 +21,7 @@ static const gpio_output_pin_user_config_t pinCS = {
};
static const spi_master_user_config_t spiConfig = {
- .bitsPerSec = 20000000, /* 20 MHz, max is 20 MHz */
+ .bitsPerSec = 20000000, /* max is 20 MHz */
.polarity = kSpiClockPolarity_ActiveHigh,
.phase = kSpiClockPhase_FirstEdge,
.direction = kSpiMsbFirst,
@@ -58,7 +58,7 @@ static spi_status_t SPI_Transfer(const uint8_t *tx, uint8_t *rx, size_t count)
if (rc != kStatus_SPI_Success) {
return rc;
}
- int i, timeout = (count + 127) / 128 + 1;
+ int i, timeout = count * 4;
for (i = 0; i < timeout; ++i) {
rc = SPI_DRV_MasterGetTransferStatus(1, NULL);
if (rc == kStatus_SPI_Success) {
@@ -117,7 +117,7 @@ static void EPD_Delay(uint32_t ms)
for (; ms > 0; --ms) {
/* XXX This is really stupid */
volatile int i;
- for (i = 0; i < 306 * 48; ++i);
+ for (i = 0; i < 306 * 12; ++i);
}
}
@@ -204,7 +204,7 @@ static void EPD_frame_repeat(const uint8_t *data, uint8_t fixed_value,
{
/* TODO this needs to repeat for about 630ms */
int i;
- for (i = 0; i < 4; ++i) {
+ for (i = 0; i < 6; ++i) {
EPD_frame(data, fixed_value, stage);
}
}
@@ -213,10 +213,11 @@ int EPD_Draw(const uint8_t *old_image, const uint8_t *new_image)
{
int rc = 0;
- /* Configure DMA channel */
+ /* Configure SPI1 */
SPI_DRV_MasterInit(1, &spiState);
uint32_t calculatedBaudRate;
SPI_DRV_MasterConfigureBus(1, &spiConfig, &calculatedBaudRate);
+ debug_printf("EPD baud rate %u Hz\r\n", calculatedBaudRate);
/* read the COG ID */
uint8_t id = EPD_ReadCogID();
diff --git a/laser-tag software/main.c b/laser-tag software/main.c
index 36a6ab6..becf2ca 100644
--- a/laser-tag software/main.c
+++ b/laser-tag software/main.c
@@ -244,7 +244,7 @@ static flexio_timer_config_t g_timerConfig = {
.timena = kFlexioTimerEnableOnTriggerHigh,
.tstop = kFlexioTimerStopBitDisabled,
.tstart = kFlexioTimerStartBitDisabled,
- .timcmp = (32 * 2 - 1) << 8 | (12 - 1), // 32 bits at 2 MHz
+ .timcmp = (32 * 2 - 1) << 8 | (10 - 1), // 32 bits at 2.4 MHz
};
static flexio_shifter_config_t g_shifterConfig = {
@@ -581,7 +581,7 @@ int main (void)
/* Throw up first image */
int ret = EPD_Draw(NULL, images[current_image]);
- debug_printf("Returned from EPD_Draw %d\r\n", ret);
+ debug_printf("EPD_Draw returned %d\r\n", ret);
if (-1 == ret) {
led(0xff, 0x00, 0x00);
} else if (-2 == ret) {
@@ -593,24 +593,26 @@ int main (void)
}
blank_led = 30;
- ret = 0; //radio_init();
+ ret = radio_init();
+ debug_printf("radio_init returned %d\r\n", ret);
if (0 == ret) {
led(0x22, 0x00, 0x22);
}
/* No good can come of this */
- //APP_init();
+ disk_init(images[2]);
/* We're done, everything else is triggered through interrupts */
for(;;) {
if (cue_next_image) {
int old_image = current_image;
current_image = (current_image + 1) % image_count;
+ debug_printf("drawing %d -> %d\r\n", old_image, current_image);
EPD_Draw(images[old_image], images[current_image]);
cue_next_image = 0;
}
#ifndef DEBUG
- SMC_HAL_SetMode(SMC, &g_idlePowerMode);
+ //SMC_HAL_SetMode(SMC, &g_idlePowerMode);
#endif
}
}
diff --git a/laser-tag software/radio.c b/laser-tag software/radio.c
index 4ee90ff..c78ec76 100644
--- a/laser-tag software/radio.c
+++ b/laser-tag software/radio.c
@@ -1,4 +1,5 @@
#include "radio.h"
+#include "fsl_debug_console.h"
#include "fsl_gpio_driver.h"
#include "fsl_spi_master_driver.h"
#include "RFM69registers.h"
@@ -18,7 +19,7 @@ static const gpio_output_pin_user_config_t pinDIO2 = {
};
static const spi_master_user_config_t spiConfig = {
- .bitsPerSec = 2000000, /* 2 MHz, max is 10 MHz */
+ .bitsPerSec = 10000000, /* max is 10 MHz */
.polarity = kSpiClockPolarity_ActiveHigh,
.phase = kSpiClockPhase_FirstEdge,
.direction = kSpiMsbFirst,
@@ -105,6 +106,15 @@ static const struct {
static spi_master_state_t spiState;
+static void delay(uint32_t ms)
+{
+ for (; ms > 0; --ms) {
+ /* XXX This is really stupid */
+ volatile int i;
+ for (i = 0; i < 306 * 12; ++i);
+ }
+}
+
static spi_status_t SPI_Transfer(const uint8_t *tx, uint8_t *rx, size_t count)
{
spi_status_t rc;
@@ -113,7 +123,7 @@ static spi_status_t SPI_Transfer(const uint8_t *tx, uint8_t *rx, size_t count)
if (rc != kStatus_SPI_Success) {
return rc;
}
- int i, timeout = (count + 127) / 128 + 1;
+ int i, timeout = count * 2;
for (i = 0; i < timeout; ++i) {
rc = SPI_DRV_MasterGetTransferStatus(0, NULL);
if (rc == kStatus_SPI_Success) {
@@ -139,15 +149,6 @@ static void write_reg(uint8_t reg, uint8_t val)
SPI_Transfer(tx, NULL, 2);
}
-static void delay(uint32_t ms)
-{
- for (; ms > 0; --ms) {
- /* XXX This is really stupid */
- volatile int i;
- for (i = 0; i < 306; ++i);
- }
-}
-
int radio_init()
{
PORT_HAL_SetMuxMode(g_portBase[GPIOC_IDX], 4, kPortMuxAlt2);
@@ -162,14 +163,15 @@ int radio_init()
GPIO_DRV_WritePinOutput(pinReset.pinName, 0);
delay(5);
- /* Configure DMA channel */
+ /* Configure SPI0 */
SPI_DRV_MasterInit(0, &spiState);
uint32_t calculatedBaudRate;
SPI_DRV_MasterConfigureBus(0, &spiConfig, &calculatedBaudRate);
+ debug_printf("radio baud rate %u Hz\r\n", calculatedBaudRate);
/* Use REG_SYNCVALUE1 to test that the radio is there */
write_reg(REG_SYNCVALUE1, 0x55);
- uint32_t reg = read_reg(REG_SYNCVALUE1);
+ uint8_t reg = read_reg(REG_SYNCVALUE1);
if (reg != 0x55) {
return -1;
}
diff --git a/laser-tag software/usb_descriptor.c b/laser-tag software/usb_descriptor.c
index 29d7a76..283bcb6 100644
--- a/laser-tag software/usb_descriptor.c
+++ b/laser-tag software/usb_descriptor.c
@@ -101,9 +101,9 @@ uint8_t g_device_descriptor[DEVICE_DESCRIPTOR_SIZE] =
/* Max Packet size */
CONTROL_MAX_PACKET_SIZE,
/* Vendor ID */
- 0xa2, 0x15,
+ 0x37, 0x13,
/* Product ID */
- 0x00, 0x02,
+ 0x41, 0x41,
/* BCD Device version */
0x02, 0x00,
/* Manufacturer string index */
@@ -259,56 +259,28 @@ uint8_t USB_STR_0[USB_STR_0_SIZE + USB_STR_DESC_SIZE] =
uint8_t USB_STR_1[USB_STR_1_SIZE + USB_STR_DESC_SIZE] =
{ sizeof(USB_STR_1),
USB_STRING_DESCRIPTOR,
- 'F', 0,
- 'R', 0,
- 'E', 0,
- 'E', 0,
- 'S', 0,
- 'C', 0,
'A', 0,
- 'L', 0,
- 'E', 0,
- ' ', 0,
- 'S', 0,
- 'E', 0,
- 'M', 0,
- 'I', 0,
- 'C', 0,
- 'O', 0,
- 'N', 0,
- 'D', 0,
- 'U', 0,
- 'C', 0,
- 'T', 0,
- 'O', 0,
- 'R', 0,
- ' ', 0,
- 'I', 0,
- 'N', 0,
- 'C', 0,
- '.', 0
+ 'm', 0,
+ 'a', 0,
+ 't', 0,
+ 'u', 0,
+ 's', 0,
};
/* Product string */
uint8_t USB_STR_2[USB_STR_2_SIZE + USB_STR_DESC_SIZE] =
{ sizeof(USB_STR_2),
USB_STRING_DESCRIPTOR,
- 'M', 0,
- 'Q', 0,
- 'X', 0,
- ' ', 0,
- 'M', 0,
'A', 0,
- 'S', 0,
- 'S', 0,
- ' ', 0,
- 'S', 0,
- 'T', 0,
- 'O', 0,
- 'R', 0,
+ 'H', 0,
'A', 0,
- 'G', 0,
- 'E', 0
+ '!', 0,
+ ' ', 0,
+ 'B', 0,
+ 'a', 0,
+ 'd', 0,
+ 'g', 0,
+ 'e', 0,
};
/* Serial number string */
@@ -816,4 +788,5 @@ usb_desc_request_notify_struct_t desc_callback =
USB_Set_Configuration,
USB_Desc_Get_Entity
};
-/* EOF */
+
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/laser-tag software/usb_descriptor.h b/laser-tag software/usb_descriptor.h
index b3228ce..d99176e 100644
--- a/laser-tag software/usb_descriptor.h
+++ b/laser-tag software/usb_descriptor.h
@@ -141,8 +141,8 @@
/* string descriptors sizes */
#define USB_STR_DESC_SIZE (2)
#define USB_STR_0_SIZE (2)
-#define USB_STR_1_SIZE (56)
-#define USB_STR_2_SIZE (32)
+#define USB_STR_1_SIZE (12)
+#define USB_STR_2_SIZE (20)
#define USB_STR_3_SIZE (32)
#define USB_STR_n_SIZE (32)
@@ -222,4 +222,4 @@ uint8_t USB_Desc_Set_Speed
);
#endif
-/* EOF */
+/* vim: set expandtab ts=4 sw=4: */