From: Michael McMaster Date: Tue, 29 Oct 2013 11:48:07 +0000 (+1000) Subject: Added the scsi2sd-config utility, and updated firmware to suit. X-Git-Tag: v3.0~1 X-Git-Url: http://git.codesrc.com/gitweb.cgi?a=commitdiff_plain;h=7193c6f29b2aba6ff239395479afe4b62238924e;p=SCSI2SD.git Added the scsi2sd-config utility, and updated firmware to suit. --- diff --git a/STATUS b/STATUS index 03bc964..6e099b1 100644 --- a/STATUS +++ b/STATUS @@ -1,9 +1,4 @@ -- Configuration options cannot be set via USB. Must use the USB bootloader to - load a new firmware instead. - - SCSI ID hardcoded to 0 - - Partity checking is on - - Unit Attention Condition is off - - DMA is not used for SPI transfers + - Potential for large performance improvement. - Parity checking not implemented for the PSoC Datapath implementation diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS.c b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS.c new file mode 100755 index 0000000..081e687 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS.c @@ -0,0 +1,1335 @@ +/******************************************************************************* +* File Name: USBFS.c +* Version 2.60 +* +* Description: +* API for USBFS Component. +* +* Note: +* Many of the functions use endpoint number. RAM arrays are sized with 9 +* elements so they are indexed directly by epNumber. The SIE and ARB +* registers are indexed by variations of epNumber - 1. +* +******************************************************************************** +* Copyright 2008-2013, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#include +#include "USBFS.h" +#include "USBFS_pvt.h" +#include "USBFS_hid.h" +#if(USBFS_DMA1_REMOVE == 0u) + #include "USBFS_ep1_dma.h" +#endif /* End USBFS_DMA1_REMOVE */ +#if(USBFS_DMA2_REMOVE == 0u) + #include "USBFS_ep2_dma.h" +#endif /* End USBFS_DMA2_REMOVE */ +#if(USBFS_DMA3_REMOVE == 0u) + #include "USBFS_ep3_dma.h" +#endif /* End USBFS_DMA3_REMOVE */ +#if(USBFS_DMA4_REMOVE == 0u) + #include "USBFS_ep4_dma.h" +#endif /* End USBFS_DMA4_REMOVE */ +#if(USBFS_DMA5_REMOVE == 0u) + #include "USBFS_ep5_dma.h" +#endif /* End USBFS_DMA5_REMOVE */ +#if(USBFS_DMA6_REMOVE == 0u) + #include "USBFS_ep6_dma.h" +#endif /* End USBFS_DMA6_REMOVE */ +#if(USBFS_DMA7_REMOVE == 0u) + #include "USBFS_ep7_dma.h" +#endif /* End USBFS_DMA7_REMOVE */ +#if(USBFS_DMA8_REMOVE == 0u) + #include "USBFS_ep8_dma.h" +#endif /* End USBFS_DMA8_REMOVE */ + + +/*************************************** +* Global data allocation +***************************************/ + +uint8 USBFS_initVar = 0u; +#if(USBFS_EP_MM != USBFS__EP_MANUAL) + uint8 USBFS_DmaChan[USBFS_MAX_EP]; + uint8 USBFS_DmaTd[USBFS_MAX_EP]; +#endif /* End USBFS_EP_MM */ + + +/******************************************************************************* +* Function Name: USBFS_Start +******************************************************************************** +* +* Summary: +* This function initialize the USB SIE, arbiter and the +* endpoint APIs, including setting the D+ Pullup +* +* Parameters: +* device: Contains the device number of the desired device descriptor. +* The device number can be found in the Device Descriptor Tab of +* "Configure" dialog, under the settings of desired Device Descriptor, +* in the "Device Number" field. +* mode: The operating voltage. This determines whether the voltage regulator +* is enabled for 5V operation or if pass through mode is used for 3.3V +* operation. Symbolic names and their associated values are given in the +* following table. +* USBFS_3V_OPERATION - Disable voltage regulator and pass-thru +* Vcc for pull-up +* USBFS_5V_OPERATION - Enable voltage regulator and use +* regulator for pull-up +* USBFS_DWR_VDDD_OPERATION - Enable or Disable voltage +* regulator depend on Vddd Voltage configuration in DWR. +* +* Return: +* None. +* +* Global variables: +* The USBFS_intiVar variable is used to indicate initial +* configuration of this component. The variable is initialized to zero (0u) +* and set to one (1u) the first time USBFS_Start() is called. +* This allows for component Re-Start without unnecessary re-initialization +* in all subsequent calls to the USBFS_Start() routine. +* If re-initialization of the component is required the variable should be set +* to zero before call of UART_Start() routine, or the user may call +* USBFS_Init() and USBFS_InitComponent() as done +* in the USBFS_Start() routine. +* +* Side Effects: +* This function will reset all communication states to default. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_Start(uint8 device, uint8 mode) +{ + /* If not Initialized then initialize all required hardware and software */ + if(USBFS_initVar == 0u) + { + USBFS_Init(); + USBFS_initVar = 1u; + } + USBFS_InitComponent(device, mode); +} + + +/******************************************************************************* +* Function Name: USBFS_Init +******************************************************************************** +* +* Summary: +* Initialize component's hardware. Usually called in USBFS_Start(). +* +* Parameters: +* None. +* +* Return: +* None. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_Init(void) +{ + uint8 enableInterrupts; + #if(USBFS_EP_MM != USBFS__EP_MANUAL) + uint16 i; + #endif /* End USBFS_EP_MM != USBFS__EP_MANUAL */ + + enableInterrupts = CyEnterCriticalSection(); + + /* Enable USB block */ + USBFS_PM_ACT_CFG_REG |= USBFS_PM_ACT_EN_FSUSB; + /* Enable USB block for Standby Power Mode */ + USBFS_PM_STBY_CFG_REG |= USBFS_PM_STBY_EN_FSUSB; + + /* Enable core clock */ + USBFS_USB_CLK_EN_REG = USBFS_USB_CLK_ENABLE; + + USBFS_CR1_REG = USBFS_CR1_ENABLE_LOCK; + + /* ENABLING USBIO PADS IN USB MODE FROM I/O MODE */ + /* Ensure USB transmit enable is low (USB_USBIO_CR0.ten). - Manual Transmission - Disabled */ + USBFS_USBIO_CR0_REG &= ((uint8)(~USBFS_USBIO_CR0_TEN)); + CyDelayUs(0u); /*~50ns delay */ + /* Disable the USBIO by asserting PM.USB_CR0.fsusbio_pd_n(Inverted) + * high. This will have been set low by the power manger out of reset. + * Also confirm USBIO pull-up disabled + */ + USBFS_PM_USB_CR0_REG &= ((uint8)(~(USBFS_PM_USB_CR0_PD_N | + USBFS_PM_USB_CR0_PD_PULLUP_N))); + + /* Select iomode to USB mode*/ + USBFS_USBIO_CR1_REG &= ((uint8)(~USBFS_USBIO_CR1_IOMODE)); + + /* Enable the USBIO reference by setting PM.USB_CR0.fsusbio_ref_en.*/ + USBFS_PM_USB_CR0_REG |= USBFS_PM_USB_CR0_REF_EN; + /* The reference will be available 1 us after the regulator is enabled */ + CyDelayUs(1u); + /* OR 40us after power restored */ + CyDelayUs(40u); + /* Ensure the single ended disable bits are low (PRT15.INP_DIS[7:6])(input receiver enabled). */ + USBFS_DM_INP_DIS_REG &= ((uint8)(~USBFS_DM_MASK)); + USBFS_DP_INP_DIS_REG &= ((uint8)(~USBFS_DP_MASK)); + + /* Enable USBIO */ + USBFS_PM_USB_CR0_REG |= USBFS_PM_USB_CR0_PD_N; + CyDelayUs(2u); + /* Set the USBIO pull-up enable */ + USBFS_PM_USB_CR0_REG |= USBFS_PM_USB_CR0_PD_PULLUP_N; + + /* Write WAx */ + CY_SET_REG8(USBFS_ARB_RW1_WA_PTR, 0u); + CY_SET_REG8(USBFS_ARB_RW1_WA_MSB_PTR, 0u); + + #if(USBFS_EP_MM != USBFS__EP_MANUAL) + /* Init transfer descriptor. This will be used to detect the DMA state - initialized or not. */ + for (i = 0u; i < USBFS_MAX_EP; i++) + { + USBFS_DmaTd[i] = DMA_INVALID_TD; + } + #endif /* End USBFS_EP_MM != USBFS__EP_MANUAL */ + + CyExitCriticalSection(enableInterrupts); + + + /* Set the bus reset Interrupt. */ + (void) CyIntSetVector(USBFS_BUS_RESET_VECT_NUM, &USBFS_BUS_RESET_ISR); + CyIntSetPriority(USBFS_BUS_RESET_VECT_NUM, USBFS_BUS_RESET_PRIOR); + + /* Set the SOF Interrupt. */ + #if(USBFS_SOF_ISR_REMOVE == 0u) + (void) CyIntSetVector(USBFS_SOF_VECT_NUM, &USBFS_SOF_ISR); + CyIntSetPriority(USBFS_SOF_VECT_NUM, USBFS_SOF_PRIOR); + #endif /* End USBFS_SOF_ISR_REMOVE */ + + /* Set the Control Endpoint Interrupt. */ + (void) CyIntSetVector(USBFS_EP_0_VECT_NUM, &USBFS_EP_0_ISR); + CyIntSetPriority(USBFS_EP_0_VECT_NUM, USBFS_EP_0_PRIOR); + + /* Set the Data Endpoint 1 Interrupt. */ + #if(USBFS_EP1_ISR_REMOVE == 0u) + (void) CyIntSetVector(USBFS_EP_1_VECT_NUM, &USBFS_EP_1_ISR); + CyIntSetPriority(USBFS_EP_1_VECT_NUM, USBFS_EP_1_PRIOR); + #endif /* End USBFS_EP1_ISR_REMOVE */ + + /* Set the Data Endpoint 2 Interrupt. */ + #if(USBFS_EP2_ISR_REMOVE == 0u) + (void) CyIntSetVector(USBFS_EP_2_VECT_NUM, &USBFS_EP_2_ISR); + CyIntSetPriority(USBFS_EP_2_VECT_NUM, USBFS_EP_2_PRIOR); + #endif /* End USBFS_EP2_ISR_REMOVE */ + + /* Set the Data Endpoint 3 Interrupt. */ + #if(USBFS_EP3_ISR_REMOVE == 0u) + (void) CyIntSetVector(USBFS_EP_3_VECT_NUM, &USBFS_EP_3_ISR); + CyIntSetPriority(USBFS_EP_3_VECT_NUM, USBFS_EP_3_PRIOR); + #endif /* End USBFS_EP3_ISR_REMOVE */ + + /* Set the Data Endpoint 4 Interrupt. */ + #if(USBFS_EP4_ISR_REMOVE == 0u) + (void) CyIntSetVector(USBFS_EP_4_VECT_NUM, &USBFS_EP_4_ISR); + CyIntSetPriority(USBFS_EP_4_VECT_NUM, USBFS_EP_4_PRIOR); + #endif /* End USBFS_EP4_ISR_REMOVE */ + + /* Set the Data Endpoint 5 Interrupt. */ + #if(USBFS_EP5_ISR_REMOVE == 0u) + (void) CyIntSetVector(USBFS_EP_5_VECT_NUM, &USBFS_EP_5_ISR); + CyIntSetPriority(USBFS_EP_5_VECT_NUM, USBFS_EP_5_PRIOR); + #endif /* End USBFS_EP5_ISR_REMOVE */ + + /* Set the Data Endpoint 6 Interrupt. */ + #if(USBFS_EP6_ISR_REMOVE == 0u) + (void) CyIntSetVector(USBFS_EP_6_VECT_NUM, &USBFS_EP_6_ISR); + CyIntSetPriority(USBFS_EP_6_VECT_NUM, USBFS_EP_6_PRIOR); + #endif /* End USBFS_EP6_ISR_REMOVE */ + + /* Set the Data Endpoint 7 Interrupt. */ + #if(USBFS_EP7_ISR_REMOVE == 0u) + (void) CyIntSetVector(USBFS_EP_7_VECT_NUM, &USBFS_EP_7_ISR); + CyIntSetPriority(USBFS_EP_7_VECT_NUM, USBFS_EP_7_PRIOR); + #endif /* End USBFS_EP7_ISR_REMOVE */ + + /* Set the Data Endpoint 8 Interrupt. */ + #if(USBFS_EP8_ISR_REMOVE == 0u) + (void) CyIntSetVector(USBFS_EP_8_VECT_NUM, &USBFS_EP_8_ISR); + CyIntSetPriority(USBFS_EP_8_VECT_NUM, USBFS_EP_8_PRIOR); + #endif /* End USBFS_EP8_ISR_REMOVE */ + + #if((USBFS_EP_MM != USBFS__EP_MANUAL) && (USBFS_ARB_ISR_REMOVE == 0u)) + /* Set the ARB Interrupt. */ + (void) CyIntSetVector(USBFS_ARB_VECT_NUM, &USBFS_ARB_ISR); + CyIntSetPriority(USBFS_ARB_VECT_NUM, USBFS_ARB_PRIOR); + #endif /* End USBFS_EP_MM != USBFS__EP_MANUAL */ + +} + + +/******************************************************************************* +* Function Name: USBFS_InitComponent +******************************************************************************** +* +* Summary: +* Initialize the component, except for the HW which is done one time in +* the Start function. This function pulls up D+. +* +* Parameters: +* device: Contains the device number of the desired device descriptor. +* The device number can be found in the Device Descriptor Tab of +* "Configure" dialog, under the settings of desired Device Descriptor, +* in the "Device Number" field. +* mode: The operating voltage. This determines whether the voltage regulator +* is enabled for 5V operation or if pass through mode is used for 3.3V +* operation. Symbolic names and their associated values are given in the +* following table. +* USBFS_3V_OPERATION - Disable voltage regulator and pass-thru +* Vcc for pull-up +* USBFS_5V_OPERATION - Enable voltage regulator and use +* regulator for pull-up +* USBFS_DWR_VDDD_OPERATION - Enable or Disable voltage +* regulator depend on Vddd Voltage configuration in DWR. +* +* Return: +* None. +* +* Global variables: +* USBFS_device: Contains the device number of the desired device +* descriptor. The device number can be found in the Device Descriptor Tab +* of "Configure" dialog, under the settings of desired Device Descriptor, +* in the "Device Number" field. +* USBFS_transferState: This variable used by the communication +* functions to handle current transfer state. Initialized to +* TRANS_STATE_IDLE in this API. +* USBFS_configuration: Contains current configuration number +* which is set by the Host using SET_CONFIGURATION request. +* Initialized to zero in this API. +* USBFS_deviceAddress: Contains current device address. This +* variable is initialized to zero in this API. Host starts to communicate +* to device with address 0 and then set it to whatever value using +* SET_ADDRESS request. +* USBFS_deviceStatus: initialized to 0. +* This is two bit variable which contain power status in first bit +* (DEVICE_STATUS_BUS_POWERED or DEVICE_STATUS_SELF_POWERED) and remote +* wakeup status (DEVICE_STATUS_REMOTE_WAKEUP) in second bit. +* USBFS_lastPacketSize initialized to 0; +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_InitComponent(uint8 device, uint8 mode) +{ + /* Initialize _hidProtocol variable to comply with + * HID 7.2.6 Set_Protocol Request: + * "When initialized, all devices default to report protocol." + */ + #if defined(USBFS_ENABLE_HID_CLASS) + uint8 i; + + for (i = 0u; i < USBFS_MAX_INTERFACES_NUMBER; i++) + { + USBFS_hidProtocol[i] = USBFS_PROTOCOL_REPORT; + } + #endif /* USBFS_ENABLE_HID_CLASS */ + + /* Enable Interrupts. */ + CyIntEnable(USBFS_BUS_RESET_VECT_NUM); + CyIntEnable(USBFS_EP_0_VECT_NUM); + #if(USBFS_EP1_ISR_REMOVE == 0u) + CyIntEnable(USBFS_EP_1_VECT_NUM); + #endif /* End USBFS_EP1_ISR_REMOVE */ + #if(USBFS_EP2_ISR_REMOVE == 0u) + CyIntEnable(USBFS_EP_2_VECT_NUM); + #endif /* End USBFS_EP2_ISR_REMOVE */ + #if(USBFS_EP3_ISR_REMOVE == 0u) + CyIntEnable(USBFS_EP_3_VECT_NUM); + #endif /* End USBFS_EP3_ISR_REMOVE */ + #if(USBFS_EP4_ISR_REMOVE == 0u) + CyIntEnable(USBFS_EP_4_VECT_NUM); + #endif /* End USBFS_EP4_ISR_REMOVE */ + #if(USBFS_EP5_ISR_REMOVE == 0u) + CyIntEnable(USBFS_EP_5_VECT_NUM); + #endif /* End USBFS_EP5_ISR_REMOVE */ + #if(USBFS_EP6_ISR_REMOVE == 0u) + CyIntEnable(USBFS_EP_6_VECT_NUM); + #endif /* End USBFS_EP6_ISR_REMOVE */ + #if(USBFS_EP7_ISR_REMOVE == 0u) + CyIntEnable(USBFS_EP_7_VECT_NUM); + #endif /* End USBFS_EP7_ISR_REMOVE */ + #if(USBFS_EP8_ISR_REMOVE == 0u) + CyIntEnable(USBFS_EP_8_VECT_NUM); + #endif /* End USBFS_EP8_ISR_REMOVE */ + #if((USBFS_EP_MM != USBFS__EP_MANUAL) && (USBFS_ARB_ISR_REMOVE == 0u)) + /* usb arb interrupt enable */ + USBFS_ARB_INT_EN_REG = USBFS_ARB_INT_MASK; + CyIntEnable(USBFS_ARB_VECT_NUM); + #endif /* End USBFS_EP_MM != USBFS__EP_MANUAL */ + + /* Arbiter configuration for DMA transfers */ + #if(USBFS_EP_MM != USBFS__EP_MANUAL) + + #if(USBFS_EP_MM == USBFS__EP_DMAMANUAL) + USBFS_ARB_CFG_REG = USBFS_ARB_CFG_MANUAL_DMA; + #endif /* End USBFS_EP_MM == USBFS__EP_DMAMANUAL */ + #if(USBFS_EP_MM == USBFS__EP_DMAAUTO) + /*Set cfg cmplt this rises DMA request when the full configuration is done */ + USBFS_ARB_CFG_REG = USBFS_ARB_CFG_AUTO_DMA | USBFS_ARB_CFG_AUTO_MEM; + #endif /* End USBFS_EP_MM == USBFS__EP_DMAAUTO */ + #endif /* End USBFS_EP_MM != USBFS__EP_MANUAL */ + + USBFS_transferState = USBFS_TRANS_STATE_IDLE; + + /* USB Locking: Enabled, VRegulator: depend on mode or DWR Voltage configuration*/ + switch(mode) + { + case USBFS_3V_OPERATION: + USBFS_CR1_REG = USBFS_CR1_ENABLE_LOCK; + break; + case USBFS_5V_OPERATION: + USBFS_CR1_REG = USBFS_CR1_ENABLE_LOCK | USBFS_CR1_REG_ENABLE; + break; + default: /*USBFS_DWR_VDDD_OPERATION */ + #if(USBFS_VDDD_MV < USBFS_3500MV) + USBFS_CR1_REG = USBFS_CR1_ENABLE_LOCK; + #else + USBFS_CR1_REG = USBFS_CR1_ENABLE_LOCK | USBFS_CR1_REG_ENABLE; + #endif /* End USBFS_VDDD_MV < USBFS_3500MV */ + break; + } + + /* Record the descriptor selection */ + USBFS_device = device; + + /* Clear all of the component data */ + USBFS_configuration = 0u; + USBFS_interfaceNumber = 0u; + USBFS_configurationChanged = 0u; + USBFS_deviceAddress = 0u; + USBFS_deviceStatus = 0u; + + USBFS_lastPacketSize = 0u; + + /* ACK Setup, Stall IN/OUT */ + CY_SET_REG8(USBFS_EP0_CR_PTR, USBFS_MODE_STALL_IN_OUT); + + /* Enable the SIE with an address 0 */ + CY_SET_REG8(USBFS_CR0_PTR, USBFS_CR0_ENABLE); + + /* Workaround for PSOC5LP */ + CyDelayCycles(1u); + + /* Finally, Enable d+ pullup and select iomode to USB mode*/ + CY_SET_REG8(USBFS_USBIO_CR1_PTR, USBFS_USBIO_CR1_USBPUEN); +} + + +/******************************************************************************* +* Function Name: USBFS_ReInitComponent +******************************************************************************** +* +* Summary: +* This function reinitialize the component configuration and is +* intend to be called from the Reset interrupt. +* +* Parameters: +* None. +* +* Return: +* None. +* +* Global variables: +* USBFS_device: Contains the device number of the desired device +* descriptor. The device number can be found in the Device Descriptor Tab +* of "Configure" dialog, under the settings of desired Device Descriptor, +* in the "Device Number" field. +* USBFS_transferState: This variable used by the communication +* functions to handle current transfer state. Initialized to +* TRANS_STATE_IDLE in this API. +* USBFS_configuration: Contains current configuration number +* which is set by the Host using SET_CONFIGURATION request. +* Initialized to zero in this API. +* USBFS_deviceAddress: Contains current device address. This +* variable is initialized to zero in this API. Host starts to communicate +* to device with address 0 and then set it to whatever value using +* SET_ADDRESS request. +* USBFS_deviceStatus: initialized to 0. +* This is two bit variable which contain power status in first bit +* (DEVICE_STATUS_BUS_POWERED or DEVICE_STATUS_SELF_POWERED) and remote +* wakeup status (DEVICE_STATUS_REMOTE_WAKEUP) in second bit. +* USBFS_lastPacketSize initialized to 0; +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_ReInitComponent(void) +{ + /* Initialize _hidProtocol variable to comply with HID 7.2.6 Set_Protocol + * Request: "When initialized, all devices default to report protocol." + */ + #if defined(USBFS_ENABLE_HID_CLASS) + uint8 i; + + for (i = 0u; i < USBFS_MAX_INTERFACES_NUMBER; i++) + { + USBFS_hidProtocol[i] = USBFS_PROTOCOL_REPORT; + } + #endif /* USBFS_ENABLE_HID_CLASS */ + + USBFS_transferState = USBFS_TRANS_STATE_IDLE; + + /* Clear all of the component data */ + USBFS_configuration = 0u; + USBFS_interfaceNumber = 0u; + USBFS_configurationChanged = 0u; + USBFS_deviceAddress = 0u; + USBFS_deviceStatus = 0u; + + USBFS_lastPacketSize = 0u; + + + /* ACK Setup, Stall IN/OUT */ + CY_SET_REG8(USBFS_EP0_CR_PTR, USBFS_MODE_STALL_IN_OUT); + + /* Enable the SIE with an address 0 */ + CY_SET_REG8(USBFS_CR0_PTR, USBFS_CR0_ENABLE); + +} + + +/******************************************************************************* +* Function Name: USBFS_Stop +******************************************************************************** +* +* Summary: +* This function shuts down the USB function including to release +* the D+ Pullup and disabling the SIE. +* +* Parameters: +* None. +* +* Return: +* None. +* +* Global variables: +* USBFS_configuration: Contains current configuration number +* which is set by the Host using SET_CONFIGURATION request. +* Initialized to zero in this API. +* USBFS_deviceAddress: Contains current device address. This +* variable is initialized to zero in this API. Host starts to communicate +* to device with address 0 and then set it to whatever value using +* SET_ADDRESS request. +* USBFS_deviceStatus: initialized to 0. +* This is two bit variable which contain power status in first bit +* (DEVICE_STATUS_BUS_POWERED or DEVICE_STATUS_SELF_POWERED) and remote +* wakeup status (DEVICE_STATUS_REMOTE_WAKEUP) in second bit. +* USBFS_configurationChanged: This variable is set to one after +* SET_CONFIGURATION request and cleared in this function. +* USBFS_intiVar variable is set to zero +* +*******************************************************************************/ +void USBFS_Stop(void) +{ + + #if(USBFS_EP_MM != USBFS__EP_MANUAL) + USBFS_Stop_DMA(USBFS_MAX_EP); /* Stop all DMAs */ + #endif /* End USBFS_EP_MM != USBFS__EP_MANUAL */ + + /* Disable the SIE */ + USBFS_CR0_REG &= (uint8)(~USBFS_CR0_ENABLE); + /* Disable the d+ pullup */ + USBFS_USBIO_CR1_REG &= (uint8)(~USBFS_USBIO_CR1_USBPUEN); + /* Disable USB in ACT PM */ + USBFS_PM_ACT_CFG_REG &= (uint8)(~USBFS_PM_ACT_EN_FSUSB); + /* Disable USB block for Standby Power Mode */ + USBFS_PM_STBY_CFG_REG &= (uint8)(~USBFS_PM_STBY_EN_FSUSB); + + /* Disable the reset and EP interrupts */ + CyIntDisable(USBFS_BUS_RESET_VECT_NUM); + CyIntDisable(USBFS_EP_0_VECT_NUM); + #if(USBFS_EP1_ISR_REMOVE == 0u) + CyIntDisable(USBFS_EP_1_VECT_NUM); + #endif /* End USBFS_EP1_ISR_REMOVE */ + #if(USBFS_EP2_ISR_REMOVE == 0u) + CyIntDisable(USBFS_EP_2_VECT_NUM); + #endif /* End USBFS_EP2_ISR_REMOVE */ + #if(USBFS_EP3_ISR_REMOVE == 0u) + CyIntDisable(USBFS_EP_3_VECT_NUM); + #endif /* End USBFS_EP3_ISR_REMOVE */ + #if(USBFS_EP4_ISR_REMOVE == 0u) + CyIntDisable(USBFS_EP_4_VECT_NUM); + #endif /* End USBFS_EP4_ISR_REMOVE */ + #if(USBFS_EP5_ISR_REMOVE == 0u) + CyIntDisable(USBFS_EP_5_VECT_NUM); + #endif /* End USBFS_EP5_ISR_REMOVE */ + #if(USBFS_EP6_ISR_REMOVE == 0u) + CyIntDisable(USBFS_EP_6_VECT_NUM); + #endif /* End USBFS_EP6_ISR_REMOVE */ + #if(USBFS_EP7_ISR_REMOVE == 0u) + CyIntDisable(USBFS_EP_7_VECT_NUM); + #endif /* End USBFS_EP7_ISR_REMOVE */ + #if(USBFS_EP8_ISR_REMOVE == 0u) + CyIntDisable(USBFS_EP_8_VECT_NUM); + #endif /* End USBFS_EP8_ISR_REMOVE */ + + /* Clear all of the component data */ + USBFS_configuration = 0u; + USBFS_interfaceNumber = 0u; + USBFS_configurationChanged = 0u; + USBFS_deviceAddress = 0u; + USBFS_deviceStatus = 0u; + USBFS_initVar = 0u; + +} + + +/******************************************************************************* +* Function Name: USBFS_CheckActivity +******************************************************************************** +* +* Summary: +* Returns the activity status of the bus. Clears the status hardware to +* provide fresh activity status on the next call of this routine. +* +* Parameters: +* None. +* +* Return: +* 1 - If bus activity was detected since the last call to this function +* 0 - If bus activity not was detected since the last call to this function +* +*******************************************************************************/ +uint8 USBFS_CheckActivity(void) +{ + uint8 r; + + r = CY_GET_REG8(USBFS_CR1_PTR); + CY_SET_REG8(USBFS_CR1_PTR, (r & ((uint8)(~USBFS_CR1_BUS_ACTIVITY)))); + + return((r & USBFS_CR1_BUS_ACTIVITY) >> USBFS_CR1_BUS_ACTIVITY_SHIFT); +} + + +/******************************************************************************* +* Function Name: USBFS_GetConfiguration +******************************************************************************** +* +* Summary: +* Returns the current configuration setting +* +* Parameters: +* None. +* +* Return: +* configuration. +* +*******************************************************************************/ +uint8 USBFS_GetConfiguration(void) +{ + return(USBFS_configuration); +} + + +/******************************************************************************* +* Function Name: USBFS_IsConfigurationChanged +******************************************************************************** +* +* Summary: +* Returns the clear on read configuration state. It is usefull when PC send +* double SET_CONFIGURATION request with same configuration number. +* +* Parameters: +* None. +* +* Return: +* Not zero value when new configuration has been changed, otherwise zero is +* returned. +* +* Global variables: +* USBFS_configurationChanged: This variable is set to one after +* SET_CONFIGURATION request and cleared in this function. +* +*******************************************************************************/ +uint8 USBFS_IsConfigurationChanged(void) +{ + uint8 res = 0u; + + if(USBFS_configurationChanged != 0u) + { + res = USBFS_configurationChanged; + USBFS_configurationChanged = 0u; + } + + return(res); +} + + +/******************************************************************************* +* Function Name: USBFS_GetInterfaceSetting +******************************************************************************** +* +* Summary: +* Returns the alternate setting from current interface +* +* Parameters: +* uint8 interfaceNumber, interface number +* +* Return: +* Alternate setting. +* +*******************************************************************************/ +uint8 USBFS_GetInterfaceSetting(uint8 interfaceNumber) + +{ + return(USBFS_interfaceSetting[interfaceNumber]); +} + + +/******************************************************************************* +* Function Name: USBFS_GetEPState +******************************************************************************** +* +* Summary: +* Returned the state of the requested endpoint. +* +* Parameters: +* epNumber: Endpoint Number +* +* Return: +* State of the requested endpoint. +* +*******************************************************************************/ +uint8 USBFS_GetEPState(uint8 epNumber) +{ + return(USBFS_EP[epNumber].apiEpState); +} + + +/******************************************************************************* +* Function Name: USBFS_GetEPCount +******************************************************************************** +* +* Summary: +* This function supports Data Endpoints only(EP1-EP8). +* Returns the transfer count for the requested endpoint. The value from +* the count registers includes 2 counts for the two byte checksum of the +* packet. This function subtracts the two counts. +* +* Parameters: +* epNumber: Data Endpoint Number. +* Valid values are between 1 and 8. +* +* Return: +* Returns the current byte count from the specified endpoint or 0 for an +* invalid endpoint. +* +*******************************************************************************/ +uint16 USBFS_GetEPCount(uint8 epNumber) +{ + uint8 ri; + uint16 result = 0u; + + if((epNumber > USBFS_EP0) && (epNumber < USBFS_MAX_EP)) + { + ri = ((epNumber - USBFS_EP1) << USBFS_EPX_CNTX_ADDR_SHIFT); + + result = (uint8)(CY_GET_REG8((reg8 *)(USBFS_SIE_EP1_CNT0_IND + ri)) & + USBFS_EPX_CNT0_MASK); + result = (result << 8u) | CY_GET_REG8((reg8 *)(USBFS_SIE_EP1_CNT1_IND + ri)); + result -= USBFS_EPX_CNTX_CRC_COUNT; + } + return(result); +} + + +#if(USBFS_EP_MM != USBFS__EP_MANUAL) + + + /******************************************************************************* + * Function Name: USBFS_InitEP_DMA + ******************************************************************************** + * + * Summary: + * This function allocates and initializes a DMA channel to be used by the + * USBFS_LoadInEP() or USBFS_ReadOutEP() APIs for data + * transfer. + * + * Parameters: + * epNumber: Contains the data endpoint number. + * Valid values are between 1 and 8. + * *pData: Pointer to a data array that is related to the EP transfers. + * + * Return: + * None. + * + * Reentrant: + * No. + * + *******************************************************************************/ + void USBFS_InitEP_DMA(uint8 epNumber, const uint8 *pData) + + { + uint16 src; + uint16 dst; + #if (CY_PSOC3) /* PSoC 3 */ + src = HI16(CYDEV_SRAM_BASE); + dst = HI16(CYDEV_PERIPH_BASE); + pData = pData; + #else /* PSoC 5 */ + if((USBFS_EP[epNumber].addr & USBFS_DIR_IN) != 0u ) + { /* for the IN EP source is the SRAM memory buffer */ + src = HI16(pData); + dst = HI16(CYDEV_PERIPH_BASE); + } + else + { /* for the OUT EP source is the SIE register */ + src = HI16(CYDEV_PERIPH_BASE); + dst = HI16(pData); + } + #endif /* End C51 */ + switch(epNumber) + { + case USBFS_EP1: + #if(USBFS_DMA1_REMOVE == 0u) + USBFS_DmaChan[epNumber] = USBFS_ep1_DmaInitialize( + USBFS_DMA_BYTES_PER_BURST, USBFS_DMA_REQUEST_PER_BURST, src, dst); + #endif /* End USBFS_DMA1_REMOVE */ + break; + case USBFS_EP2: + #if(USBFS_DMA2_REMOVE == 0u) + USBFS_DmaChan[epNumber] = USBFS_ep2_DmaInitialize( + USBFS_DMA_BYTES_PER_BURST, USBFS_DMA_REQUEST_PER_BURST, src, dst); + #endif /* End USBFS_DMA2_REMOVE */ + break; + case USBFS_EP3: + #if(USBFS_DMA3_REMOVE == 0u) + USBFS_DmaChan[epNumber] = USBFS_ep3_DmaInitialize( + USBFS_DMA_BYTES_PER_BURST, USBFS_DMA_REQUEST_PER_BURST, src, dst); + #endif /* End USBFS_DMA3_REMOVE */ + break; + case USBFS_EP4: + #if(USBFS_DMA4_REMOVE == 0u) + USBFS_DmaChan[epNumber] = USBFS_ep4_DmaInitialize( + USBFS_DMA_BYTES_PER_BURST, USBFS_DMA_REQUEST_PER_BURST, src, dst); + #endif /* End USBFS_DMA4_REMOVE */ + break; + case USBFS_EP5: + #if(USBFS_DMA5_REMOVE == 0u) + USBFS_DmaChan[epNumber] = USBFS_ep5_DmaInitialize( + USBFS_DMA_BYTES_PER_BURST, USBFS_DMA_REQUEST_PER_BURST, src, dst); + #endif /* End USBFS_DMA5_REMOVE */ + break; + case USBFS_EP6: + #if(USBFS_DMA6_REMOVE == 0u) + USBFS_DmaChan[epNumber] = USBFS_ep6_DmaInitialize( + USBFS_DMA_BYTES_PER_BURST, USBFS_DMA_REQUEST_PER_BURST, src, dst); + #endif /* End USBFS_DMA6_REMOVE */ + break; + case USBFS_EP7: + #if(USBFS_DMA7_REMOVE == 0u) + USBFS_DmaChan[epNumber] = USBFS_ep7_DmaInitialize( + USBFS_DMA_BYTES_PER_BURST, USBFS_DMA_REQUEST_PER_BURST, src, dst); + #endif /* End USBFS_DMA7_REMOVE */ + break; + case USBFS_EP8: + #if(USBFS_DMA8_REMOVE == 0u) + USBFS_DmaChan[epNumber] = USBFS_ep8_DmaInitialize( + USBFS_DMA_BYTES_PER_BURST, USBFS_DMA_REQUEST_PER_BURST, src, dst); + #endif /* End USBFS_DMA8_REMOVE */ + break; + default: + /* Do not support EP0 DMA transfers */ + break; + } + if((epNumber > USBFS_EP0) && (epNumber < USBFS_MAX_EP)) + { + USBFS_DmaTd[epNumber] = CyDmaTdAllocate(); + } + } + + + /******************************************************************************* + * Function Name: USBFS_Stop_DMA + ******************************************************************************** + * + * Summary: Stops and free DMA + * + * Parameters: + * epNumber: Contains the data endpoint number or + * USBFS_MAX_EP to stop all DMAs + * + * Return: + * None. + * + * Reentrant: + * No. + * + *******************************************************************************/ + void USBFS_Stop_DMA(uint8 epNumber) + { + uint8 i; + i = (epNumber < USBFS_MAX_EP) ? epNumber : USBFS_EP1; + do + { + if(USBFS_DmaTd[i] != DMA_INVALID_TD) + { + (void) CyDmaChDisable(USBFS_DmaChan[i]); + CyDmaTdFree(USBFS_DmaTd[i]); + USBFS_DmaTd[i] = DMA_INVALID_TD; + } + i++; + }while((i < USBFS_MAX_EP) && (epNumber == USBFS_MAX_EP)); + } + +#endif /* End USBFS_EP_MM != USBFS__EP_MANUAL */ + + +/******************************************************************************* +* Function Name: USBFS_LoadInEP +******************************************************************************** +* +* Summary: +* Loads and enables the specified USB data endpoint for an IN interrupt or bulk +* transfer. +* +* Parameters: +* epNumber: Contains the data endpoint number. +* Valid values are between 1 and 8. +* *pData: A pointer to a data array from which the data for the endpoint space +* is loaded. +* length: The number of bytes to transfer from the array and then send as a +* result of an IN request. Valid values are between 0 and 512. +* +* Return: +* None. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_LoadInEP(uint8 epNumber, const uint8 pData[], uint16 length) + +{ + uint8 ri; + reg8 *p; + #if(USBFS_EP_MM == USBFS__EP_MANUAL) + uint16 i; + #endif /* End USBFS_EP_MM == USBFS__EP_MANUAL */ + + if((epNumber > USBFS_EP0) && (epNumber < USBFS_MAX_EP)) + { + ri = ((epNumber - USBFS_EP1) << USBFS_EPX_CNTX_ADDR_SHIFT); + p = (reg8 *)(USBFS_ARB_RW1_DR_IND + ri); + + #if(USBFS_EP_MM != USBFS__EP_DMAAUTO) + /* Limits length to available buffer space, auto MM could send packets up to 1024 bytes */ + if(length > (USBFS_EPX_DATA_BUF_MAX - USBFS_EP[epNumber].buffOffset)) + { + length = USBFS_EPX_DATA_BUF_MAX - USBFS_EP[epNumber].buffOffset; + } + #endif /* End USBFS_EP_MM != USBFS__EP_DMAAUTO */ + + /* Set the count and data toggle */ + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CNT0_IND + ri), + (length >> 8u) | (USBFS_EP[epNumber].epToggle)); + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CNT1_IND + ri), length & 0xFFu); + + #if(USBFS_EP_MM == USBFS__EP_MANUAL) + if(pData != NULL) + { + /* Copy the data using the arbiter data register */ + for (i = 0u; i < length; i++) + { + CY_SET_REG8(p, pData[i]); + } + } + USBFS_EP[epNumber].apiEpState = USBFS_NO_EVENT_PENDING; + /* Write the Mode register */ + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + ri), USBFS_EP[epNumber].epMode); + #else + /* Init DMA if it was not initialized */ + if(USBFS_DmaTd[epNumber] == DMA_INVALID_TD) + { + USBFS_InitEP_DMA(epNumber, pData); + } + #endif /* End USBFS_EP_MM == USBFS__EP_MANUAL */ + + #if(USBFS_EP_MM == USBFS__EP_DMAMANUAL) + USBFS_EP[epNumber].apiEpState = USBFS_NO_EVENT_PENDING; + if((pData != NULL) && (length > 0u)) + { + /* Enable DMA in mode2 for transferring data */ + (void) CyDmaChDisable(USBFS_DmaChan[epNumber]); + (void) CyDmaTdSetConfiguration(USBFS_DmaTd[epNumber], length, CY_DMA_DISABLE_TD, + TD_TERMIN_EN | TD_INC_SRC_ADR); + (void) CyDmaTdSetAddress(USBFS_DmaTd[epNumber], LO16((uint32)pData), LO16((uint32)p)); + /* Enable the DMA */ + (void) CyDmaChSetInitialTd(USBFS_DmaChan[epNumber], USBFS_DmaTd[epNumber]); + (void) CyDmaChEnable(USBFS_DmaChan[epNumber], 1u); + /* Generate DMA request */ + * (reg8 *)(USBFS_ARB_EP1_CFG_IND + ri) |= USBFS_ARB_EPX_CFG_DMA_REQ; + * (reg8 *)(USBFS_ARB_EP1_CFG_IND + ri) &= ((uint8)(~USBFS_ARB_EPX_CFG_DMA_REQ)); + /* Mode register will be written in arb ISR after DMA transfer complete */ + } + else + { + /* When zero-length packet - write the Mode register directly */ + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + ri), USBFS_EP[epNumber].epMode); + } + #endif /* End USBFS_EP_MM == USBFS__EP_DMAMANUAL */ + + #if(USBFS_EP_MM == USBFS__EP_DMAAUTO) + if(pData != NULL) + { + /* Enable DMA in mode3 for transferring data */ + (void) CyDmaChDisable(USBFS_DmaChan[epNumber]); + (void) CyDmaTdSetConfiguration(USBFS_DmaTd[epNumber], length, + USBFS_DmaTd[epNumber], TD_TERMIN_EN | TD_INC_SRC_ADR); + (void) CyDmaTdSetAddress(USBFS_DmaTd[epNumber], LO16((uint32)pData), LO16((uint32)p)); + /* Clear Any potential pending DMA requests before starting the DMA channel to transfer data */ + (void) CyDmaClearPendingDrq(USBFS_DmaChan[epNumber]); + /* Enable the DMA */ + (void) CyDmaChSetInitialTd(USBFS_DmaChan[epNumber], USBFS_DmaTd[epNumber]); + (void) CyDmaChEnable(USBFS_DmaChan[epNumber], 1u); + } + else + { + USBFS_EP[epNumber].apiEpState = USBFS_NO_EVENT_PENDING; + if(length > 0u) + { + /* Set Data ready status, This will generate DMA request */ + * (reg8 *)(USBFS_ARB_EP1_CFG_IND + ri) |= USBFS_ARB_EPX_CFG_IN_DATA_RDY; + /* Mode register will be written in arb ISR(In Buffer Full) after first DMA transfer complete */ + } + else + { + /* When zero-length packet - write the Mode register directly */ + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + ri), USBFS_EP[epNumber].epMode); + } + } + #endif /* End USBFS_EP_MM == USBFS__EP_DMAAUTO */ + + } +} + + +/******************************************************************************* +* Function Name: USBFS_ReadOutEP +******************************************************************************** +* +* Summary: +* Read data from an endpoint. The application must call +* USBFS_GetEPState to see if an event is pending. +* +* Parameters: +* epNumber: Contains the data endpoint number. +* Valid values are between 1 and 8. +* pData: A pointer to a data array from which the data for the endpoint space +* is loaded. +* length: The number of bytes to transfer from the USB Out endpoint and loads +* it into data array. Valid values are between 0 and 1023. The function +* moves fewer than the requested number of bytes if the host sends +* fewer bytes than requested. +* +* Returns: +* Number of bytes received, 0 for an invalid endpoint. +* +* Reentrant: +* No. +* +*******************************************************************************/ +uint16 USBFS_ReadOutEP(uint8 epNumber, uint8 pData[], uint16 length) + +{ + uint8 ri; + reg8 *p; + #if(USBFS_EP_MM == USBFS__EP_MANUAL) + uint16 i; + #endif /* End USBFS_EP_MM == USBFS__EP_MANUAL */ + #if(USBFS_EP_MM != USBFS__EP_DMAAUTO) + uint16 xferCount; + #endif /* End USBFS_EP_MM != USBFS__EP_DMAAUTO */ + + if((epNumber > USBFS_EP0) && (epNumber < USBFS_MAX_EP) && (pData != NULL)) + { + ri = ((epNumber - USBFS_EP1) << USBFS_EPX_CNTX_ADDR_SHIFT); + p = (reg8 *)(USBFS_ARB_RW1_DR_IND + ri); + + #if(USBFS_EP_MM != USBFS__EP_DMAAUTO) + /* Determine which is smaller the requested data or the available data */ + xferCount = USBFS_GetEPCount(epNumber); + if (length > xferCount) + { + length = xferCount; + } + #endif /* End USBFS_EP_MM != USBFS__EP_DMAAUTO */ + + #if(USBFS_EP_MM == USBFS__EP_MANUAL) + /* Copy the data using the arbiter data register */ + for (i = 0u; i < length; i++) + { + pData[i] = CY_GET_REG8(p); + } + + /* (re)arming of OUT endpoint */ + USBFS_EnableOutEP(epNumber); + #else + /*Init DMA if it was not initialized */ + if(USBFS_DmaTd[epNumber] == DMA_INVALID_TD) + { + USBFS_InitEP_DMA(epNumber, pData); + } + #endif /* End USBFS_EP_MM == USBFS__EP_MANUAL */ + + #if(USBFS_EP_MM == USBFS__EP_DMAMANUAL) + /* Enable DMA in mode2 for transferring data */ + (void) CyDmaChDisable(USBFS_DmaChan[epNumber]); + (void) CyDmaTdSetConfiguration(USBFS_DmaTd[epNumber], length, CY_DMA_DISABLE_TD, + TD_TERMIN_EN | TD_INC_DST_ADR); + (void) CyDmaTdSetAddress(USBFS_DmaTd[epNumber], LO16((uint32)p), LO16((uint32)pData)); + /* Enable the DMA */ + (void) CyDmaChSetInitialTd(USBFS_DmaChan[epNumber], USBFS_DmaTd[epNumber]); + (void) CyDmaChEnable(USBFS_DmaChan[epNumber], 1u); + + /* Generate DMA request */ + * (reg8 *)(USBFS_ARB_EP1_CFG_IND + ri) |= USBFS_ARB_EPX_CFG_DMA_REQ; + * (reg8 *)(USBFS_ARB_EP1_CFG_IND + ri) &= ((uint8)(~USBFS_ARB_EPX_CFG_DMA_REQ)); + /* Out EP will be (re)armed in arb ISR after transfer complete */ + #endif /* End USBFS_EP_MM == USBFS__EP_DMAMANUAL */ + + #if(USBFS_EP_MM == USBFS__EP_DMAAUTO) + /* Enable DMA in mode3 for transferring data */ + (void) CyDmaChDisable(USBFS_DmaChan[epNumber]); + (void) CyDmaTdSetConfiguration(USBFS_DmaTd[epNumber], length, USBFS_DmaTd[epNumber], + TD_TERMIN_EN | TD_INC_DST_ADR); + (void) CyDmaTdSetAddress(USBFS_DmaTd[epNumber], LO16((uint32)p), LO16((uint32)pData)); + + /* Clear Any potential pending DMA requests before starting the DMA channel to transfer data */ + (void) CyDmaClearPendingDrq(USBFS_DmaChan[epNumber]); + /* Enable the DMA */ + (void) CyDmaChSetInitialTd(USBFS_DmaChan[epNumber], USBFS_DmaTd[epNumber]); + (void) CyDmaChEnable(USBFS_DmaChan[epNumber], 1u); + /* Out EP will be (re)armed in arb ISR after transfer complete */ + #endif /* End USBFS_EP_MM == USBFS__EP_DMAAUTO */ + + } + else + { + length = 0u; + } + + return(length); +} + + +/******************************************************************************* +* Function Name: USBFS_EnableOutEP +******************************************************************************** +* +* Summary: +* This function enables an OUT endpoint. It should not be +* called for an IN endpoint. +* +* Parameters: +* epNumber: Endpoint Number +* Valid values are between 1 and 8. +* +* Return: +* None. +* +* Global variables: +* USBFS_EP[epNumber].apiEpState - set to NO_EVENT_PENDING +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_EnableOutEP(uint8 epNumber) +{ + uint8 ri; + + if((epNumber > USBFS_EP0) && (epNumber < USBFS_MAX_EP)) + { + ri = ((epNumber - USBFS_EP1) << USBFS_EPX_CNTX_ADDR_SHIFT); + USBFS_EP[epNumber].apiEpState = USBFS_NO_EVENT_PENDING; + /* Write the Mode register */ + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + ri), USBFS_EP[epNumber].epMode); + } +} + + +/******************************************************************************* +* Function Name: USBFS_DisableOutEP +******************************************************************************** +* +* Summary: +* This function disables an OUT endpoint. It should not be +* called for an IN endpoint. +* +* Parameters: +* epNumber: Endpoint Number +* Valid values are between 1 and 8. +* +* Return: +* None. +* +*******************************************************************************/ +void USBFS_DisableOutEP(uint8 epNumber) +{ + uint8 ri ; + + if((epNumber > USBFS_EP0) && (epNumber < USBFS_MAX_EP)) + { + ri = ((epNumber - USBFS_EP1) << USBFS_EPX_CNTX_ADDR_SHIFT); + /* Write the Mode register */ + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + ri), USBFS_MODE_NAK_OUT); + } +} + + +/******************************************************************************* +* Function Name: USBFS_Force +******************************************************************************** +* +* Summary: +* Forces the bus state +* +* Parameters: +* bState +* USBFS_FORCE_J +* USBFS_FORCE_K +* USBFS_FORCE_SE0 +* USBFS_FORCE_NONE +* +* Return: +* None. +* +*******************************************************************************/ +void USBFS_Force(uint8 bState) +{ + CY_SET_REG8(USBFS_USBIO_CR0_PTR, bState); +} + + +/******************************************************************************* +* Function Name: USBFS_GetEPAckState +******************************************************************************** +* +* Summary: +* Returns the ACK of the CR0 Register (ACKD) +* +* Parameters: +* epNumber: Endpoint Number +* Valid values are between 1 and 8. +* +* Returns +* 0 if nothing has been ACKD, non-=zero something has been ACKD +* +*******************************************************************************/ +uint8 USBFS_GetEPAckState(uint8 epNumber) +{ + uint8 ri; + uint8 cr = 0u; + + if((epNumber > USBFS_EP0) && (epNumber < USBFS_MAX_EP)) + { + ri = ((epNumber - USBFS_EP1) << USBFS_EPX_CNTX_ADDR_SHIFT); + cr = CY_GET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + ri)) & USBFS_MODE_ACKD; + } + + return(cr); +} + + +/******************************************************************************* +* Function Name: USBFS_SetPowerStatus +******************************************************************************** +* +* Summary: +* Sets the device power status for reporting in the Get Device Status +* request +* +* Parameters: +* powerStatus: USBFS_DEVICE_STATUS_BUS_POWERED(0) - Bus Powered, +* USBFS_DEVICE_STATUS_SELF_POWERED(1) - Self Powered +* +* Return: +* None. +* +* Global variables: +* USBFS_deviceStatus - set power status +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_SetPowerStatus(uint8 powerStatus) +{ + if (powerStatus != USBFS_DEVICE_STATUS_BUS_POWERED) + { + USBFS_deviceStatus |= USBFS_DEVICE_STATUS_SELF_POWERED; + } + else + { + USBFS_deviceStatus &= ((uint8)(~USBFS_DEVICE_STATUS_SELF_POWERED)); + } +} + + +#if (USBFS_MON_VBUS == 1u) + + /******************************************************************************* + * Function Name: USBFS_VBusPresent + ******************************************************************************** + * + * Summary: + * Determines VBUS presence for Self Powered Devices. + * + * Parameters: + * None. + * + * Return: + * 1 if VBUS is present, otherwise 0. + * + *******************************************************************************/ + uint8 USBFS_VBusPresent(void) + { + return((0u != (CY_GET_REG8(USBFS_VBUS_PS_PTR) & USBFS_VBUS_MASK)) ? 1u : 0u); + } + +#endif /* USBFS_MON_VBUS */ + + +/******************************************************************************* +* Function Name: USBFS_RWUEnabled +******************************************************************************** +* +* Summary: +* Returns TRUE if Remote Wake Up is enabled, otherwise FALSE +* +* Parameters: +* None. +* +* Return: +* TRUE - Remote Wake Up Enabled +* FALSE - Remote Wake Up Disabled +* +* Global variables: +* USBFS_deviceStatus - checked to determine remote status +* +*******************************************************************************/ +uint8 USBFS_RWUEnabled(void) +{ + uint8 result = USBFS_FALSE; + if((USBFS_deviceStatus & USBFS_DEVICE_STATUS_REMOTE_WAKEUP) != 0u) + { + result = USBFS_TRUE; + } + + return(result); +} + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS.h b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS.h new file mode 100755 index 0000000..e7fd899 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS.h @@ -0,0 +1,1189 @@ +/******************************************************************************* +* File Name: USBFS.h +* Version 2.60 +* +* Description: +* Header File for the USFS component. Contains prototypes and constant values. +* +******************************************************************************** +* Copyright 2008-2013, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#if !defined(CY_USBFS_USBFS_H) +#define CY_USBFS_USBFS_H + +#include "cytypes.h" +#include "cydevice_trm.h" +#include "cyfitter.h" +#include "CyLib.h" + + +/*************************************** +* Conditional Compilation Parameters +***************************************/ + +/* Check to see if required defines such as CY_PSOC5LP are available */ +/* They are defined starting with cy_boot v3.0 */ +#if !defined (CY_PSOC5LP) + #error Component USBFS_v2_60 requires cy_boot v3.0 or later +#endif /* (CY_PSOC5LP) */ + + +/*************************************** +* Memory Type Definitions +***************************************/ + +/* Renamed Type Definitions for backward compatibility. +* Should not be used in new designs. +*/ +#define USBFS_CODE CYCODE +#define USBFS_FAR CYFAR +#if defined(__C51__) || defined(__CX51__) + #define USBFS_DATA data + #define USBFS_XDATA xdata +#else + #define USBFS_DATA + #define USBFS_XDATA +#endif /* End __C51__ */ +#define USBFS_NULL NULL + + +/*************************************** +* Enumerated Types and Parameters +***************************************/ + +#define USBFS__EP_MANUAL 0 +#define USBFS__EP_DMAMANUAL 1 +#define USBFS__EP_DMAAUTO 2 + +#define USBFS__MA_STATIC 0 +#define USBFS__MA_DYNAMIC 1 + + + +/*************************************** +* Initial Parameter Constants +***************************************/ + +#define USBFS_NUM_DEVICES (1u) +#define USBFS_ENABLE_DESCRIPTOR_STRINGS +#define USBFS_ENABLE_SN_STRING +#define USBFS_ENABLE_STRINGS +#define USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_IN_BUF_SIZE (65u) +#define USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_NUM_IN_RPTS (1u) +#define USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_OUT_BUF_SIZE (65u) +#define USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_NUM_OUT_RPTS (1u) +#define USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_COUNT (1u) +#define USBFS_ENABLE_HID_CLASS +#define USBFS_HID_RPT_1_SIZE_LSB (0x24u) +#define USBFS_HID_RPT_1_SIZE_MSB (0x00u) +#define USBFS_MAX_REPORTID_NUMBER (0u) + +#define USBFS_MON_VBUS (0u) +#define USBFS_EXTERN_VBUS (0u) +#define USBFS_EXTERN_VND (0u) +#define USBFS_EXTERN_CLS (0u) +#define USBFS_MAX_INTERFACES_NUMBER (1u) +#define USBFS_EP0_ISR_REMOVE (0u) +#define USBFS_EP1_ISR_REMOVE (0u) +#define USBFS_EP2_ISR_REMOVE (0u) +#define USBFS_EP3_ISR_REMOVE (1u) +#define USBFS_EP4_ISR_REMOVE (1u) +#define USBFS_EP5_ISR_REMOVE (1u) +#define USBFS_EP6_ISR_REMOVE (1u) +#define USBFS_EP7_ISR_REMOVE (1u) +#define USBFS_EP8_ISR_REMOVE (1u) +#define USBFS_EP_MM (0u) +#define USBFS_EP_MA (0u) +#define USBFS_DMA1_REMOVE (1u) +#define USBFS_DMA2_REMOVE (1u) +#define USBFS_DMA3_REMOVE (1u) +#define USBFS_DMA4_REMOVE (1u) +#define USBFS_DMA5_REMOVE (1u) +#define USBFS_DMA6_REMOVE (1u) +#define USBFS_DMA7_REMOVE (1u) +#define USBFS_DMA8_REMOVE (1u) +#define USBFS_SOF_ISR_REMOVE (0u) +#define USBFS_ARB_ISR_REMOVE (0u) +#define USBFS_DP_ISR_REMOVE (0u) +#define USBFS_ENABLE_CDC_CLASS_API (1u) +#define USBFS_ENABLE_MIDI_API (1u) +#define USBFS_MIDI_EXT_MODE (0u) + + +/*************************************** +* Data Struct Definition +***************************************/ + +typedef struct +{ + uint8 attrib; + uint8 apiEpState; + uint8 hwEpState; + uint8 epToggle; + uint8 addr; + uint8 epMode; + uint16 buffOffset; + uint16 bufferSize; + uint8 interface; +} T_USBFS_EP_CTL_BLOCK; + +typedef struct +{ + uint8 interface; + uint8 altSetting; + uint8 addr; + uint8 attributes; + uint16 bufferSize; + uint8 bMisc; +} T_USBFS_EP_SETTINGS_BLOCK; + +typedef struct +{ + uint8 status; + uint16 length; +} T_USBFS_XFER_STATUS_BLOCK; + +typedef struct +{ + uint16 count; + volatile uint8 *pData; + T_USBFS_XFER_STATUS_BLOCK *pStatusBlock; +} T_USBFS_TD; + + +typedef struct +{ + uint8 c; + const void *p_list; +} T_USBFS_LUT; + +/* Resume/Suspend API Support */ +typedef struct +{ + uint8 enableState; + uint8 mode; +} USBFS_BACKUP_STRUCT; + + +/* Renamed structure fields for backward compatibility. +* Should not be used in new designs. +*/ +#define wBuffOffset buffOffset +#define wBufferSize bufferSize +#define bStatus status +#define wLength length +#define wCount count + +/* Renamed global variable for backward compatibility. +* Should not be used in new designs. +*/ +#define CurrentTD USBFS_currentTD + + +/*************************************** +* Function Prototypes +***************************************/ + +void USBFS_Start(uint8 device, uint8 mode) ; +void USBFS_Init(void) ; +void USBFS_InitComponent(uint8 device, uint8 mode) ; +void USBFS_Stop(void) ; +uint8 USBFS_CheckActivity(void) ; +uint8 USBFS_GetConfiguration(void) ; +uint8 USBFS_IsConfigurationChanged(void) ; +uint8 USBFS_GetInterfaceSetting(uint8 interfaceNumber) + ; +uint8 USBFS_GetEPState(uint8 epNumber) ; +uint16 USBFS_GetEPCount(uint8 epNumber) ; +void USBFS_LoadInEP(uint8 epNumber, const uint8 pData[], uint16 length) + ; +uint16 USBFS_ReadOutEP(uint8 epNumber, uint8 pData[], uint16 length) + ; +void USBFS_EnableOutEP(uint8 epNumber) ; +void USBFS_DisableOutEP(uint8 epNumber) ; +void USBFS_Force(uint8 bState) ; +uint8 USBFS_GetEPAckState(uint8 epNumber) ; +void USBFS_SetPowerStatus(uint8 powerStatus) ; +uint8 USBFS_RWUEnabled(void) ; +void USBFS_TerminateEP(uint8 ep) ; + +void USBFS_Suspend(void) ; +void USBFS_Resume(void) ; + +#if defined(USBFS_ENABLE_FWSN_STRING) + void USBFS_SerialNumString(uint8 snString[]) ; +#endif /* USBFS_ENABLE_FWSN_STRING */ +#if (USBFS_MON_VBUS == 1u) + uint8 USBFS_VBusPresent(void) ; +#endif /* End USBFS_MON_VBUS */ + +#if defined(CYDEV_BOOTLOADER_IO_COMP) && ((CYDEV_BOOTLOADER_IO_COMP == CyBtldr_USBFS) || \ + (CYDEV_BOOTLOADER_IO_COMP == CyBtldr_Custom_Interface)) + + void USBFS_CyBtldrCommStart(void) ; + void USBFS_CyBtldrCommStop(void) ; + void USBFS_CyBtldrCommReset(void) ; + cystatus USBFS_CyBtldrCommWrite(uint8 *pData, uint16 size, uint16 *count, uint8 timeOut) CYSMALL + ; + cystatus USBFS_CyBtldrCommRead( uint8 *pData, uint16 size, uint16 *count, uint8 timeOut) CYSMALL + ; + + #define USBFS_BTLDR_SIZEOF_WRITE_BUFFER (64u) /* EP 1 OUT */ + #define USBFS_BTLDR_SIZEOF_READ_BUFFER (64u) /* EP 2 IN */ + #define USBFS_BTLDR_MAX_PACKET_SIZE USBFS_BTLDR_SIZEOF_WRITE_BUFFER + + /* These defines active if used USBFS interface as an + * IO Component for bootloading. When Custom_Interface selected + * in Bootloder configuration as the IO Component, user must + * provide these functions + */ + #if (CYDEV_BOOTLOADER_IO_COMP == CyBtldr_USBFS) + #define CyBtldrCommStart USBFS_CyBtldrCommStart + #define CyBtldrCommStop USBFS_CyBtldrCommStop + #define CyBtldrCommReset USBFS_CyBtldrCommReset + #define CyBtldrCommWrite USBFS_CyBtldrCommWrite + #define CyBtldrCommRead USBFS_CyBtldrCommRead + #endif /*End CYDEV_BOOTLOADER_IO_COMP == CyBtldr_USBFS */ + +#endif /* End CYDEV_BOOTLOADER_IO_COMP */ + +#if(USBFS_EP_MM != USBFS__EP_MANUAL) + void USBFS_InitEP_DMA(uint8 epNumber, const uint8 *pData) + ; + void USBFS_Stop_DMA(uint8 epNumber) ; +#endif /* End USBFS_EP_MM != USBFS__EP_MANUAL) */ + +#if defined(USBFS_ENABLE_MIDI_STREAMING) && (USBFS_ENABLE_MIDI_API != 0u) + void USBFS_MIDI_EP_Init(void) ; + + #if (USBFS_MIDI_IN_BUFF_SIZE > 0) + void USBFS_MIDI_IN_Service(void) ; + uint8 USBFS_PutUsbMidiIn(uint8 ic, const uint8 midiMsg[], uint8 cable) + ; + #endif /* USBFS_MIDI_IN_BUFF_SIZE > 0 */ + + #if (USBFS_MIDI_OUT_BUFF_SIZE > 0) + void USBFS_MIDI_OUT_EP_Service(void) ; + #endif /* USBFS_MIDI_OUT_BUFF_SIZE > 0 */ + +#endif /* End USBFS_ENABLE_MIDI_API != 0u */ + +/* Renamed Functions for backward compatibility. +* Should not be used in new designs. +*/ + +#define USBFS_bCheckActivity USBFS_CheckActivity +#define USBFS_bGetConfiguration USBFS_GetConfiguration +#define USBFS_bGetInterfaceSetting USBFS_GetInterfaceSetting +#define USBFS_bGetEPState USBFS_GetEPState +#define USBFS_wGetEPCount USBFS_GetEPCount +#define USBFS_bGetEPAckState USBFS_GetEPAckState +#define USBFS_bRWUEnabled USBFS_RWUEnabled +#define USBFS_bVBusPresent USBFS_VBusPresent + +#define USBFS_bConfiguration USBFS_configuration +#define USBFS_bInterfaceSetting USBFS_interfaceSetting +#define USBFS_bDeviceAddress USBFS_deviceAddress +#define USBFS_bDeviceStatus USBFS_deviceStatus +#define USBFS_bDevice USBFS_device +#define USBFS_bTransferState USBFS_transferState +#define USBFS_bLastPacketSize USBFS_lastPacketSize + +#define USBFS_LoadEP USBFS_LoadInEP +#define USBFS_LoadInISOCEP USBFS_LoadInEP +#define USBFS_EnableOutISOCEP USBFS_EnableOutEP + +#define USBFS_SetVector CyIntSetVector +#define USBFS_SetPriority CyIntSetPriority +#define USBFS_EnableInt CyIntEnable + + +/*************************************** +* API Constants +***************************************/ + +#define USBFS_EP0 (0u) +#define USBFS_EP1 (1u) +#define USBFS_EP2 (2u) +#define USBFS_EP3 (3u) +#define USBFS_EP4 (4u) +#define USBFS_EP5 (5u) +#define USBFS_EP6 (6u) +#define USBFS_EP7 (7u) +#define USBFS_EP8 (8u) +#define USBFS_MAX_EP (9u) + +#define USBFS_TRUE (1u) +#define USBFS_FALSE (0u) + +#define USBFS_NO_EVENT_ALLOWED (2u) +#define USBFS_EVENT_PENDING (1u) +#define USBFS_NO_EVENT_PENDING (0u) + +#define USBFS_IN_BUFFER_FULL USBFS_NO_EVENT_PENDING +#define USBFS_IN_BUFFER_EMPTY USBFS_EVENT_PENDING +#define USBFS_OUT_BUFFER_FULL USBFS_EVENT_PENDING +#define USBFS_OUT_BUFFER_EMPTY USBFS_NO_EVENT_PENDING + +#define USBFS_FORCE_J (0xA0u) +#define USBFS_FORCE_K (0x80u) +#define USBFS_FORCE_SE0 (0xC0u) +#define USBFS_FORCE_NONE (0x00u) + +#define USBFS_IDLE_TIMER_RUNNING (0x02u) +#define USBFS_IDLE_TIMER_EXPIRED (0x01u) +#define USBFS_IDLE_TIMER_INDEFINITE (0x00u) + +#define USBFS_DEVICE_STATUS_BUS_POWERED (0x00u) +#define USBFS_DEVICE_STATUS_SELF_POWERED (0x01u) + +#define USBFS_3V_OPERATION (0x00u) +#define USBFS_5V_OPERATION (0x01u) +#define USBFS_DWR_VDDD_OPERATION (0x02u) + +#define USBFS_MODE_DISABLE (0x00u) +#define USBFS_MODE_NAK_IN_OUT (0x01u) +#define USBFS_MODE_STATUS_OUT_ONLY (0x02u) +#define USBFS_MODE_STALL_IN_OUT (0x03u) +#define USBFS_MODE_RESERVED_0100 (0x04u) +#define USBFS_MODE_ISO_OUT (0x05u) +#define USBFS_MODE_STATUS_IN_ONLY (0x06u) +#define USBFS_MODE_ISO_IN (0x07u) +#define USBFS_MODE_NAK_OUT (0x08u) +#define USBFS_MODE_ACK_OUT (0x09u) +#define USBFS_MODE_RESERVED_1010 (0x0Au) +#define USBFS_MODE_ACK_OUT_STATUS_IN (0x0Bu) +#define USBFS_MODE_NAK_IN (0x0Cu) +#define USBFS_MODE_ACK_IN (0x0Du) +#define USBFS_MODE_RESERVED_1110 (0x0Eu) +#define USBFS_MODE_ACK_IN_STATUS_OUT (0x0Fu) +#define USBFS_MODE_MASK (0x0Fu) +#define USBFS_MODE_STALL_DATA_EP (0x80u) + +#define USBFS_MODE_ACKD (0x10u) +#define USBFS_MODE_OUT_RCVD (0x20u) +#define USBFS_MODE_IN_RCVD (0x40u) +#define USBFS_MODE_SETUP_RCVD (0x80u) + +#define USBFS_RQST_TYPE_MASK (0x60u) +#define USBFS_RQST_TYPE_STD (0x00u) +#define USBFS_RQST_TYPE_CLS (0x20u) +#define USBFS_RQST_TYPE_VND (0x40u) +#define USBFS_RQST_DIR_MASK (0x80u) +#define USBFS_RQST_DIR_D2H (0x80u) +#define USBFS_RQST_DIR_H2D (0x00u) +#define USBFS_RQST_RCPT_MASK (0x03u) +#define USBFS_RQST_RCPT_DEV (0x00u) +#define USBFS_RQST_RCPT_IFC (0x01u) +#define USBFS_RQST_RCPT_EP (0x02u) +#define USBFS_RQST_RCPT_OTHER (0x03u) + +/* USB Class Codes */ +#define USBFS_CLASS_DEVICE (0x00u) /* Use class code info from Interface Descriptors */ +#define USBFS_CLASS_AUDIO (0x01u) /* Audio device */ +#define USBFS_CLASS_CDC (0x02u) /* Communication device class */ +#define USBFS_CLASS_HID (0x03u) /* Human Interface Device */ +#define USBFS_CLASS_PDC (0x05u) /* Physical device class */ +#define USBFS_CLASS_IMAGE (0x06u) /* Still Imaging device */ +#define USBFS_CLASS_PRINTER (0x07u) /* Printer device */ +#define USBFS_CLASS_MSD (0x08u) /* Mass Storage device */ +#define USBFS_CLASS_HUB (0x09u) /* Full/Hi speed Hub */ +#define USBFS_CLASS_CDC_DATA (0x0Au) /* CDC data device */ +#define USBFS_CLASS_SMART_CARD (0x0Bu) /* Smart Card device */ +#define USBFS_CLASS_CSD (0x0Du) /* Content Security device */ +#define USBFS_CLASS_VIDEO (0x0Eu) /* Video device */ +#define USBFS_CLASS_PHD (0x0Fu) /* Personal Healthcare device */ +#define USBFS_CLASS_WIRELESSD (0xDCu) /* Wireless Controller */ +#define USBFS_CLASS_MIS (0xE0u) /* Miscellaneous */ +#define USBFS_CLASS_APP (0xEFu) /* Application Specific */ +#define USBFS_CLASS_VENDOR (0xFFu) /* Vendor specific */ + + +/* Standard Request Types (Table 9-4) */ +#define USBFS_GET_STATUS (0x00u) +#define USBFS_CLEAR_FEATURE (0x01u) +#define USBFS_SET_FEATURE (0x03u) +#define USBFS_SET_ADDRESS (0x05u) +#define USBFS_GET_DESCRIPTOR (0x06u) +#define USBFS_SET_DESCRIPTOR (0x07u) +#define USBFS_GET_CONFIGURATION (0x08u) +#define USBFS_SET_CONFIGURATION (0x09u) +#define USBFS_GET_INTERFACE (0x0Au) +#define USBFS_SET_INTERFACE (0x0Bu) +#define USBFS_SYNCH_FRAME (0x0Cu) + +/* Vendor Specific Request Types */ +/* Request for Microsoft OS String Descriptor */ +#define USBFS_GET_EXTENDED_CONFIG_DESCRIPTOR (0x01u) + +/* Descriptor Types (Table 9-5) */ +#define USBFS_DESCR_DEVICE (1u) +#define USBFS_DESCR_CONFIG (2u) +#define USBFS_DESCR_STRING (3u) +#define USBFS_DESCR_INTERFACE (4u) +#define USBFS_DESCR_ENDPOINT (5u) +#define USBFS_DESCR_DEVICE_QUALIFIER (6u) +#define USBFS_DESCR_OTHER_SPEED (7u) +#define USBFS_DESCR_INTERFACE_POWER (8u) + +/* Device Descriptor Defines */ +#define USBFS_DEVICE_DESCR_LENGTH (18u) +#define USBFS_DEVICE_DESCR_SN_SHIFT (16u) + +/* Config Descriptor Shifts and Masks */ +#define USBFS_CONFIG_DESCR_LENGTH (0u) +#define USBFS_CONFIG_DESCR_TYPE (1u) +#define USBFS_CONFIG_DESCR_TOTAL_LENGTH_LOW (2u) +#define USBFS_CONFIG_DESCR_TOTAL_LENGTH_HI (3u) +#define USBFS_CONFIG_DESCR_NUM_INTERFACES (4u) +#define USBFS_CONFIG_DESCR_CONFIG_VALUE (5u) +#define USBFS_CONFIG_DESCR_CONFIGURATION (6u) +#define USBFS_CONFIG_DESCR_ATTRIB (7u) +#define USBFS_CONFIG_DESCR_ATTRIB_SELF_POWERED (0x40u) +#define USBFS_CONFIG_DESCR_ATTRIB_RWU_EN (0x20u) + +/* Feature Selectors (Table 9-6) */ +#define USBFS_DEVICE_REMOTE_WAKEUP (0x01u) +#define USBFS_ENDPOINT_HALT (0x00u) +#define USBFS_TEST_MODE (0x02u) + +/* USB Device Status (Figure 9-4) */ +#define USBFS_DEVICE_STATUS_BUS_POWERED (0x00u) +#define USBFS_DEVICE_STATUS_SELF_POWERED (0x01u) +#define USBFS_DEVICE_STATUS_REMOTE_WAKEUP (0x02u) + +/* USB Endpoint Status (Figure 9-4) */ +#define USBFS_ENDPOINT_STATUS_HALT (0x01u) + +/* USB Endpoint Directions */ +#define USBFS_DIR_IN (0x80u) +#define USBFS_DIR_OUT (0x00u) +#define USBFS_DIR_UNUSED (0x7Fu) + +/* USB Endpoint Attributes */ +#define USBFS_EP_TYPE_CTRL (0x00u) +#define USBFS_EP_TYPE_ISOC (0x01u) +#define USBFS_EP_TYPE_BULK (0x02u) +#define USBFS_EP_TYPE_INT (0x03u) +#define USBFS_EP_TYPE_MASK (0x03u) + +#define USBFS_EP_SYNC_TYPE_NO_SYNC (0x00u) +#define USBFS_EP_SYNC_TYPE_ASYNC (0x04u) +#define USBFS_EP_SYNC_TYPE_ADAPTIVE (0x08u) +#define USBFS_EP_SYNC_TYPE_SYNCHRONOUS (0x0Cu) +#define USBFS_EP_SYNC_TYPE_MASK (0x0Cu) + +#define USBFS_EP_USAGE_TYPE_DATA (0x00u) +#define USBFS_EP_USAGE_TYPE_FEEDBACK (0x10u) +#define USBFS_EP_USAGE_TYPE_IMPLICIT (0x20u) +#define USBFS_EP_USAGE_TYPE_RESERVED (0x30u) +#define USBFS_EP_USAGE_TYPE_MASK (0x30u) + +/* Endpoint Status defines */ +#define USBFS_EP_STATUS_LENGTH (0x02u) + +/* Endpoint Device defines */ +#define USBFS_DEVICE_STATUS_LENGTH (0x02u) + +#define USBFS_STATUS_LENGTH_MAX \ + ( (USBFS_EP_STATUS_LENGTH > USBFS_DEVICE_STATUS_LENGTH) ? \ + USBFS_EP_STATUS_LENGTH : USBFS_DEVICE_STATUS_LENGTH ) +/* Transfer Completion Notification */ +#define USBFS_XFER_IDLE (0x00u) +#define USBFS_XFER_STATUS_ACK (0x01u) +#define USBFS_XFER_PREMATURE (0x02u) +#define USBFS_XFER_ERROR (0x03u) + +/* Driver State defines */ +#define USBFS_TRANS_STATE_IDLE (0x00u) +#define USBFS_TRANS_STATE_CONTROL_READ (0x02u) +#define USBFS_TRANS_STATE_CONTROL_WRITE (0x04u) +#define USBFS_TRANS_STATE_NO_DATA_CONTROL (0x06u) + +/* String Descriptor defines */ +#define USBFS_STRING_MSOS (0xEEu) +#define USBFS_MSOS_DESCRIPTOR_LENGTH (18u) +#define USBFS_MSOS_CONF_DESCR_LENGTH (40u) + +#if(USBFS_EP_MM == USBFS__EP_DMAMANUAL) + /* DMA manual mode defines */ + #define USBFS_DMA_BYTES_PER_BURST (0u) + #define USBFS_DMA_REQUEST_PER_BURST (0u) +#endif /* End USBFS_EP_MM == USBFS__EP_DMAMANUAL */ +#if(USBFS_EP_MM == USBFS__EP_DMAAUTO) + /* DMA automatic mode defines */ + #define USBFS_DMA_BYTES_PER_BURST (32u) + /* BUF_SIZE-BYTES_PER_BURST examples: 55-32 bytes 44-16 bytes 33-8 bytes 22-4 bytes 11-2 bytes */ + #define USBFS_DMA_BUF_SIZE (0x55u) + #define USBFS_DMA_REQUEST_PER_BURST (1u) +#endif /* End USBFS_EP_MM == USBFS__EP_DMAAUTO */ + +/* DIE ID string descriptor defines */ +#if defined(USBFS_ENABLE_IDSN_STRING) + #define USBFS_IDSN_DESCR_LENGTH (0x22u) +#endif /* USBFS_ENABLE_IDSN_STRING */ + + +/*************************************** +* External data references +***************************************/ + +extern uint8 USBFS_initVar; +extern volatile uint8 USBFS_device; +extern volatile uint8 USBFS_transferState; +extern volatile uint8 USBFS_configuration; +extern volatile uint8 USBFS_configurationChanged; +extern volatile uint8 USBFS_deviceStatus; + +/* HID Variables */ +#if defined(USBFS_ENABLE_HID_CLASS) + extern volatile uint8 USBFS_hidProtocol[USBFS_MAX_INTERFACES_NUMBER]; + extern volatile uint8 USBFS_hidIdleRate[USBFS_MAX_INTERFACES_NUMBER]; + extern volatile uint8 USBFS_hidIdleTimer[USBFS_MAX_INTERFACES_NUMBER]; +#endif /* USBFS_ENABLE_HID_CLASS */ + + +/*************************************** +* Registers +***************************************/ + +#define USBFS_ARB_CFG_PTR ( (reg8 *) USBFS_USB__ARB_CFG) +#define USBFS_ARB_CFG_REG (* (reg8 *) USBFS_USB__ARB_CFG) + +#define USBFS_ARB_EP1_CFG_PTR ( (reg8 *) USBFS_USB__ARB_EP1_CFG) +#define USBFS_ARB_EP1_CFG_REG (* (reg8 *) USBFS_USB__ARB_EP1_CFG) +#define USBFS_ARB_EP1_CFG_IND USBFS_USB__ARB_EP1_CFG +#define USBFS_ARB_EP1_INT_EN_PTR ( (reg8 *) USBFS_USB__ARB_EP1_INT_EN) +#define USBFS_ARB_EP1_INT_EN_REG (* (reg8 *) USBFS_USB__ARB_EP1_INT_EN) +#define USBFS_ARB_EP1_INT_EN_IND USBFS_USB__ARB_EP1_INT_EN +#define USBFS_ARB_EP1_SR_PTR ( (reg8 *) USBFS_USB__ARB_EP1_SR) +#define USBFS_ARB_EP1_SR_REG (* (reg8 *) USBFS_USB__ARB_EP1_SR) +#define USBFS_ARB_EP1_SR_IND USBFS_USB__ARB_EP1_SR + +#define USBFS_ARB_EP2_CFG_PTR ( (reg8 *) USBFS_USB__ARB_EP2_CFG) +#define USBFS_ARB_EP2_CFG_REG (* (reg8 *) USBFS_USB__ARB_EP2_CFG) +#define USBFS_ARB_EP2_INT_EN_PTR ( (reg8 *) USBFS_USB__ARB_EP2_INT_EN) +#define USBFS_ARB_EP2_INT_EN_REG (* (reg8 *) USBFS_USB__ARB_EP2_INT_EN) +#define USBFS_ARB_EP2_SR_PTR ( (reg8 *) USBFS_USB__ARB_EP2_SR) +#define USBFS_ARB_EP2_SR_REG (* (reg8 *) USBFS_USB__ARB_EP2_SR) + +#define USBFS_ARB_EP3_CFG_PTR ( (reg8 *) USBFS_USB__ARB_EP3_CFG) +#define USBFS_ARB_EP3_CFG_REG (* (reg8 *) USBFS_USB__ARB_EP3_CFG) +#define USBFS_ARB_EP3_INT_EN_PTR ( (reg8 *) USBFS_USB__ARB_EP3_INT_EN) +#define USBFS_ARB_EP3_INT_EN_REG (* (reg8 *) USBFS_USB__ARB_EP3_INT_EN) +#define USBFS_ARB_EP3_SR_PTR ( (reg8 *) USBFS_USB__ARB_EP3_SR) +#define USBFS_ARB_EP3_SR_REG (* (reg8 *) USBFS_USB__ARB_EP3_SR) + +#define USBFS_ARB_EP4_CFG_PTR ( (reg8 *) USBFS_USB__ARB_EP4_CFG) +#define USBFS_ARB_EP4_CFG_REG (* (reg8 *) USBFS_USB__ARB_EP4_CFG) +#define USBFS_ARB_EP4_INT_EN_PTR ( (reg8 *) USBFS_USB__ARB_EP4_INT_EN) +#define USBFS_ARB_EP4_INT_EN_REG (* (reg8 *) USBFS_USB__ARB_EP4_INT_EN) +#define USBFS_ARB_EP4_SR_PTR ( (reg8 *) USBFS_USB__ARB_EP4_SR) +#define USBFS_ARB_EP4_SR_REG (* (reg8 *) USBFS_USB__ARB_EP4_SR) + +#define USBFS_ARB_EP5_CFG_PTR ( (reg8 *) USBFS_USB__ARB_EP5_CFG) +#define USBFS_ARB_EP5_CFG_REG (* (reg8 *) USBFS_USB__ARB_EP5_CFG) +#define USBFS_ARB_EP5_INT_EN_PTR ( (reg8 *) USBFS_USB__ARB_EP5_INT_EN) +#define USBFS_ARB_EP5_INT_EN_REG (* (reg8 *) USBFS_USB__ARB_EP5_INT_EN) +#define USBFS_ARB_EP5_SR_PTR ( (reg8 *) USBFS_USB__ARB_EP5_SR) +#define USBFS_ARB_EP5_SR_REG (* (reg8 *) USBFS_USB__ARB_EP5_SR) + +#define USBFS_ARB_EP6_CFG_PTR ( (reg8 *) USBFS_USB__ARB_EP6_CFG) +#define USBFS_ARB_EP6_CFG_REG (* (reg8 *) USBFS_USB__ARB_EP6_CFG) +#define USBFS_ARB_EP6_INT_EN_PTR ( (reg8 *) USBFS_USB__ARB_EP6_INT_EN) +#define USBFS_ARB_EP6_INT_EN_REG (* (reg8 *) USBFS_USB__ARB_EP6_INT_EN) +#define USBFS_ARB_EP6_SR_PTR ( (reg8 *) USBFS_USB__ARB_EP6_SR) +#define USBFS_ARB_EP6_SR_REG (* (reg8 *) USBFS_USB__ARB_EP6_SR) + +#define USBFS_ARB_EP7_CFG_PTR ( (reg8 *) USBFS_USB__ARB_EP7_CFG) +#define USBFS_ARB_EP7_CFG_REG (* (reg8 *) USBFS_USB__ARB_EP7_CFG) +#define USBFS_ARB_EP7_INT_EN_PTR ( (reg8 *) USBFS_USB__ARB_EP7_INT_EN) +#define USBFS_ARB_EP7_INT_EN_REG (* (reg8 *) USBFS_USB__ARB_EP7_INT_EN) +#define USBFS_ARB_EP7_SR_PTR ( (reg8 *) USBFS_USB__ARB_EP7_SR) +#define USBFS_ARB_EP7_SR_REG (* (reg8 *) USBFS_USB__ARB_EP7_SR) + +#define USBFS_ARB_EP8_CFG_PTR ( (reg8 *) USBFS_USB__ARB_EP8_CFG) +#define USBFS_ARB_EP8_CFG_REG (* (reg8 *) USBFS_USB__ARB_EP8_CFG) +#define USBFS_ARB_EP8_INT_EN_PTR ( (reg8 *) USBFS_USB__ARB_EP8_INT_EN) +#define USBFS_ARB_EP8_INT_EN_REG (* (reg8 *) USBFS_USB__ARB_EP8_INT_EN) +#define USBFS_ARB_EP8_SR_PTR ( (reg8 *) USBFS_USB__ARB_EP8_SR) +#define USBFS_ARB_EP8_SR_REG (* (reg8 *) USBFS_USB__ARB_EP8_SR) + +#define USBFS_ARB_INT_EN_PTR ( (reg8 *) USBFS_USB__ARB_INT_EN) +#define USBFS_ARB_INT_EN_REG (* (reg8 *) USBFS_USB__ARB_INT_EN) +#define USBFS_ARB_INT_SR_PTR ( (reg8 *) USBFS_USB__ARB_INT_SR) +#define USBFS_ARB_INT_SR_REG (* (reg8 *) USBFS_USB__ARB_INT_SR) + +#define USBFS_ARB_RW1_DR_PTR ((reg8 *) USBFS_USB__ARB_RW1_DR) +#define USBFS_ARB_RW1_DR_IND USBFS_USB__ARB_RW1_DR +#define USBFS_ARB_RW1_RA_PTR ((reg8 *) USBFS_USB__ARB_RW1_RA) +#define USBFS_ARB_RW1_RA_IND USBFS_USB__ARB_RW1_RA +#define USBFS_ARB_RW1_RA_MSB_PTR ((reg8 *) USBFS_USB__ARB_RW1_RA_MSB) +#define USBFS_ARB_RW1_RA_MSB_IND USBFS_USB__ARB_RW1_RA_MSB +#define USBFS_ARB_RW1_WA_PTR ((reg8 *) USBFS_USB__ARB_RW1_WA) +#define USBFS_ARB_RW1_WA_IND USBFS_USB__ARB_RW1_WA +#define USBFS_ARB_RW1_WA_MSB_PTR ((reg8 *) USBFS_USB__ARB_RW1_WA_MSB) +#define USBFS_ARB_RW1_WA_MSB_IND USBFS_USB__ARB_RW1_WA_MSB + +#define USBFS_ARB_RW2_DR_PTR ((reg8 *) USBFS_USB__ARB_RW2_DR) +#define USBFS_ARB_RW2_RA_PTR ((reg8 *) USBFS_USB__ARB_RW2_RA) +#define USBFS_ARB_RW2_RA_MSB_PTR ((reg8 *) USBFS_USB__ARB_RW2_RA_MSB) +#define USBFS_ARB_RW2_WA_PTR ((reg8 *) USBFS_USB__ARB_RW2_WA) +#define USBFS_ARB_RW2_WA_MSB_PTR ((reg8 *) USBFS_USB__ARB_RW2_WA_MSB) + +#define USBFS_ARB_RW3_DR_PTR ((reg8 *) USBFS_USB__ARB_RW3_DR) +#define USBFS_ARB_RW3_RA_PTR ((reg8 *) USBFS_USB__ARB_RW3_RA) +#define USBFS_ARB_RW3_RA_MSB_PTR ((reg8 *) USBFS_USB__ARB_RW3_RA_MSB) +#define USBFS_ARB_RW3_WA_PTR ((reg8 *) USBFS_USB__ARB_RW3_WA) +#define USBFS_ARB_RW3_WA_MSB_PTR ((reg8 *) USBFS_USB__ARB_RW3_WA_MSB) + +#define USBFS_ARB_RW4_DR_PTR ((reg8 *) USBFS_USB__ARB_RW4_DR) +#define USBFS_ARB_RW4_RA_PTR ((reg8 *) USBFS_USB__ARB_RW4_RA) +#define USBFS_ARB_RW4_RA_MSB_PTR ((reg8 *) USBFS_USB__ARB_RW4_RA_MSB) +#define USBFS_ARB_RW4_WA_PTR ((reg8 *) USBFS_USB__ARB_RW4_WA) +#define USBFS_ARB_RW4_WA_MSB_PTR ((reg8 *) USBFS_USB__ARB_RW4_WA_MSB) + +#define USBFS_ARB_RW5_DR_PTR ((reg8 *) USBFS_USB__ARB_RW5_DR) +#define USBFS_ARB_RW5_RA_PTR ((reg8 *) USBFS_USB__ARB_RW5_RA) +#define USBFS_ARB_RW5_RA_MSB_PTR ((reg8 *) USBFS_USB__ARB_RW5_RA_MSB) +#define USBFS_ARB_RW5_WA_PTR ((reg8 *) USBFS_USB__ARB_RW5_WA) +#define USBFS_ARB_RW5_WA_MSB_PTR ((reg8 *) USBFS_USB__ARB_RW5_WA_MSB) + +#define USBFS_ARB_RW6_DR_PTR ((reg8 *) USBFS_USB__ARB_RW6_DR) +#define USBFS_ARB_RW6_RA_PTR ((reg8 *) USBFS_USB__ARB_RW6_RA) +#define USBFS_ARB_RW6_RA_MSB_PTR ((reg8 *) USBFS_USB__ARB_RW6_RA_MSB) +#define USBFS_ARB_RW6_WA_PTR ((reg8 *) USBFS_USB__ARB_RW6_WA) +#define USBFS_ARB_RW6_WA_MSB_PTR ((reg8 *) USBFS_USB__ARB_RW6_WA_MSB) + +#define USBFS_ARB_RW7_DR_PTR ((reg8 *) USBFS_USB__ARB_RW7_DR) +#define USBFS_ARB_RW7_RA_PTR ((reg8 *) USBFS_USB__ARB_RW7_RA) +#define USBFS_ARB_RW7_RA_MSB_PTR ((reg8 *) USBFS_USB__ARB_RW7_RA_MSB) +#define USBFS_ARB_RW7_WA_PTR ((reg8 *) USBFS_USB__ARB_RW7_WA) +#define USBFS_ARB_RW7_WA_MSB_PTR ((reg8 *) USBFS_USB__ARB_RW7_WA_MSB) + +#define USBFS_ARB_RW8_DR_PTR ((reg8 *) USBFS_USB__ARB_RW8_DR) +#define USBFS_ARB_RW8_RA_PTR ((reg8 *) USBFS_USB__ARB_RW8_RA) +#define USBFS_ARB_RW8_RA_MSB_PTR ((reg8 *) USBFS_USB__ARB_RW8_RA_MSB) +#define USBFS_ARB_RW8_WA_PTR ((reg8 *) USBFS_USB__ARB_RW8_WA) +#define USBFS_ARB_RW8_WA_MSB_PTR ((reg8 *) USBFS_USB__ARB_RW8_WA_MSB) + +#define USBFS_BUF_SIZE_PTR ( (reg8 *) USBFS_USB__BUF_SIZE) +#define USBFS_BUF_SIZE_REG (* (reg8 *) USBFS_USB__BUF_SIZE) +#define USBFS_BUS_RST_CNT_PTR ( (reg8 *) USBFS_USB__BUS_RST_CNT) +#define USBFS_BUS_RST_CNT_REG (* (reg8 *) USBFS_USB__BUS_RST_CNT) +#define USBFS_CWA_PTR ( (reg8 *) USBFS_USB__CWA) +#define USBFS_CWA_REG (* (reg8 *) USBFS_USB__CWA) +#define USBFS_CWA_MSB_PTR ( (reg8 *) USBFS_USB__CWA_MSB) +#define USBFS_CWA_MSB_REG (* (reg8 *) USBFS_USB__CWA_MSB) +#define USBFS_CR0_PTR ( (reg8 *) USBFS_USB__CR0) +#define USBFS_CR0_REG (* (reg8 *) USBFS_USB__CR0) +#define USBFS_CR1_PTR ( (reg8 *) USBFS_USB__CR1) +#define USBFS_CR1_REG (* (reg8 *) USBFS_USB__CR1) + +#define USBFS_DMA_THRES_PTR ( (reg8 *) USBFS_USB__DMA_THRES) +#define USBFS_DMA_THRES_REG (* (reg8 *) USBFS_USB__DMA_THRES) +#define USBFS_DMA_THRES_MSB_PTR ( (reg8 *) USBFS_USB__DMA_THRES_MSB) +#define USBFS_DMA_THRES_MSB_REG (* (reg8 *) USBFS_USB__DMA_THRES_MSB) + +#define USBFS_EP_ACTIVE_PTR ( (reg8 *) USBFS_USB__EP_ACTIVE) +#define USBFS_EP_ACTIVE_REG (* (reg8 *) USBFS_USB__EP_ACTIVE) +#define USBFS_EP_TYPE_PTR ( (reg8 *) USBFS_USB__EP_TYPE) +#define USBFS_EP_TYPE_REG (* (reg8 *) USBFS_USB__EP_TYPE) + +#define USBFS_EP0_CNT_PTR ( (reg8 *) USBFS_USB__EP0_CNT) +#define USBFS_EP0_CNT_REG (* (reg8 *) USBFS_USB__EP0_CNT) +#define USBFS_EP0_CR_PTR ( (reg8 *) USBFS_USB__EP0_CR) +#define USBFS_EP0_CR_REG (* (reg8 *) USBFS_USB__EP0_CR) +#define USBFS_EP0_DR0_PTR ( (reg8 *) USBFS_USB__EP0_DR0) +#define USBFS_EP0_DR0_REG (* (reg8 *) USBFS_USB__EP0_DR0) +#define USBFS_EP0_DR0_IND USBFS_USB__EP0_DR0 +#define USBFS_EP0_DR1_PTR ( (reg8 *) USBFS_USB__EP0_DR1) +#define USBFS_EP0_DR1_REG (* (reg8 *) USBFS_USB__EP0_DR1) +#define USBFS_EP0_DR2_PTR ( (reg8 *) USBFS_USB__EP0_DR2) +#define USBFS_EP0_DR2_REG (* (reg8 *) USBFS_USB__EP0_DR2) +#define USBFS_EP0_DR3_PTR ( (reg8 *) USBFS_USB__EP0_DR3) +#define USBFS_EP0_DR3_REG (* (reg8 *) USBFS_USB__EP0_DR3) +#define USBFS_EP0_DR4_PTR ( (reg8 *) USBFS_USB__EP0_DR4) +#define USBFS_EP0_DR4_REG (* (reg8 *) USBFS_USB__EP0_DR4) +#define USBFS_EP0_DR5_PTR ( (reg8 *) USBFS_USB__EP0_DR5) +#define USBFS_EP0_DR5_REG (* (reg8 *) USBFS_USB__EP0_DR5) +#define USBFS_EP0_DR6_PTR ( (reg8 *) USBFS_USB__EP0_DR6) +#define USBFS_EP0_DR6_REG (* (reg8 *) USBFS_USB__EP0_DR6) +#define USBFS_EP0_DR7_PTR ( (reg8 *) USBFS_USB__EP0_DR7) +#define USBFS_EP0_DR7_REG (* (reg8 *) USBFS_USB__EP0_DR7) + +#define USBFS_OSCLK_DR0_PTR ( (reg8 *) USBFS_USB__OSCLK_DR0) +#define USBFS_OSCLK_DR0_REG (* (reg8 *) USBFS_USB__OSCLK_DR0) +#define USBFS_OSCLK_DR1_PTR ( (reg8 *) USBFS_USB__OSCLK_DR1) +#define USBFS_OSCLK_DR1_REG (* (reg8 *) USBFS_USB__OSCLK_DR1) + +#define USBFS_PM_ACT_CFG_PTR ( (reg8 *) USBFS_USB__PM_ACT_CFG) +#define USBFS_PM_ACT_CFG_REG (* (reg8 *) USBFS_USB__PM_ACT_CFG) +#define USBFS_PM_STBY_CFG_PTR ( (reg8 *) USBFS_USB__PM_STBY_CFG) +#define USBFS_PM_STBY_CFG_REG (* (reg8 *) USBFS_USB__PM_STBY_CFG) + +#define USBFS_SIE_EP_INT_EN_PTR ( (reg8 *) USBFS_USB__SIE_EP_INT_EN) +#define USBFS_SIE_EP_INT_EN_REG (* (reg8 *) USBFS_USB__SIE_EP_INT_EN) +#define USBFS_SIE_EP_INT_SR_PTR ( (reg8 *) USBFS_USB__SIE_EP_INT_SR) +#define USBFS_SIE_EP_INT_SR_REG (* (reg8 *) USBFS_USB__SIE_EP_INT_SR) + +#define USBFS_SIE_EP1_CNT0_PTR ( (reg8 *) USBFS_USB__SIE_EP1_CNT0) +#define USBFS_SIE_EP1_CNT0_REG (* (reg8 *) USBFS_USB__SIE_EP1_CNT0) +#define USBFS_SIE_EP1_CNT0_IND USBFS_USB__SIE_EP1_CNT0 +#define USBFS_SIE_EP1_CNT1_PTR ( (reg8 *) USBFS_USB__SIE_EP1_CNT1) +#define USBFS_SIE_EP1_CNT1_REG (* (reg8 *) USBFS_USB__SIE_EP1_CNT1) +#define USBFS_SIE_EP1_CNT1_IND USBFS_USB__SIE_EP1_CNT1 +#define USBFS_SIE_EP1_CR0_PTR ( (reg8 *) USBFS_USB__SIE_EP1_CR0) +#define USBFS_SIE_EP1_CR0_REG (* (reg8 *) USBFS_USB__SIE_EP1_CR0) +#define USBFS_SIE_EP1_CR0_IND USBFS_USB__SIE_EP1_CR0 + +#define USBFS_SIE_EP2_CNT0_PTR ( (reg8 *) USBFS_USB__SIE_EP2_CNT0) +#define USBFS_SIE_EP2_CNT0_REG (* (reg8 *) USBFS_USB__SIE_EP2_CNT0) +#define USBFS_SIE_EP2_CNT1_PTR ( (reg8 *) USBFS_USB__SIE_EP2_CNT1) +#define USBFS_SIE_EP2_CNT1_REG (* (reg8 *) USBFS_USB__SIE_EP2_CNT1) +#define USBFS_SIE_EP2_CR0_PTR ( (reg8 *) USBFS_USB__SIE_EP2_CR0) +#define USBFS_SIE_EP2_CR0_REG (* (reg8 *) USBFS_USB__SIE_EP2_CR0) + +#define USBFS_SIE_EP3_CNT0_PTR ( (reg8 *) USBFS_USB__SIE_EP3_CNT0) +#define USBFS_SIE_EP3_CNT0_REG (* (reg8 *) USBFS_USB__SIE_EP3_CNT0) +#define USBFS_SIE_EP3_CNT1_PTR ( (reg8 *) USBFS_USB__SIE_EP3_CNT1) +#define USBFS_SIE_EP3_CNT1_REG (* (reg8 *) USBFS_USB__SIE_EP3_CNT1) +#define USBFS_SIE_EP3_CR0_PTR ( (reg8 *) USBFS_USB__SIE_EP3_CR0) +#define USBFS_SIE_EP3_CR0_REG (* (reg8 *) USBFS_USB__SIE_EP3_CR0) + +#define USBFS_SIE_EP4_CNT0_PTR ( (reg8 *) USBFS_USB__SIE_EP4_CNT0) +#define USBFS_SIE_EP4_CNT0_REG (* (reg8 *) USBFS_USB__SIE_EP4_CNT0) +#define USBFS_SIE_EP4_CNT1_PTR ( (reg8 *) USBFS_USB__SIE_EP4_CNT1) +#define USBFS_SIE_EP4_CNT1_REG (* (reg8 *) USBFS_USB__SIE_EP4_CNT1) +#define USBFS_SIE_EP4_CR0_PTR ( (reg8 *) USBFS_USB__SIE_EP4_CR0) +#define USBFS_SIE_EP4_CR0_REG (* (reg8 *) USBFS_USB__SIE_EP4_CR0) + +#define USBFS_SIE_EP5_CNT0_PTR ( (reg8 *) USBFS_USB__SIE_EP5_CNT0) +#define USBFS_SIE_EP5_CNT0_REG (* (reg8 *) USBFS_USB__SIE_EP5_CNT0) +#define USBFS_SIE_EP5_CNT1_PTR ( (reg8 *) USBFS_USB__SIE_EP5_CNT1) +#define USBFS_SIE_EP5_CNT1_REG (* (reg8 *) USBFS_USB__SIE_EP5_CNT1) +#define USBFS_SIE_EP5_CR0_PTR ( (reg8 *) USBFS_USB__SIE_EP5_CR0) +#define USBFS_SIE_EP5_CR0_REG (* (reg8 *) USBFS_USB__SIE_EP5_CR0) + +#define USBFS_SIE_EP6_CNT0_PTR ( (reg8 *) USBFS_USB__SIE_EP6_CNT0) +#define USBFS_SIE_EP6_CNT0_REG (* (reg8 *) USBFS_USB__SIE_EP6_CNT0) +#define USBFS_SIE_EP6_CNT1_PTR ( (reg8 *) USBFS_USB__SIE_EP6_CNT1) +#define USBFS_SIE_EP6_CNT1_REG (* (reg8 *) USBFS_USB__SIE_EP6_CNT1) +#define USBFS_SIE_EP6_CR0_PTR ( (reg8 *) USBFS_USB__SIE_EP6_CR0) +#define USBFS_SIE_EP6_CR0_REG (* (reg8 *) USBFS_USB__SIE_EP6_CR0) + +#define USBFS_SIE_EP7_CNT0_PTR ( (reg8 *) USBFS_USB__SIE_EP7_CNT0) +#define USBFS_SIE_EP7_CNT0_REG (* (reg8 *) USBFS_USB__SIE_EP7_CNT0) +#define USBFS_SIE_EP7_CNT1_PTR ( (reg8 *) USBFS_USB__SIE_EP7_CNT1) +#define USBFS_SIE_EP7_CNT1_REG (* (reg8 *) USBFS_USB__SIE_EP7_CNT1) +#define USBFS_SIE_EP7_CR0_PTR ( (reg8 *) USBFS_USB__SIE_EP7_CR0) +#define USBFS_SIE_EP7_CR0_REG (* (reg8 *) USBFS_USB__SIE_EP7_CR0) + +#define USBFS_SIE_EP8_CNT0_PTR ( (reg8 *) USBFS_USB__SIE_EP8_CNT0) +#define USBFS_SIE_EP8_CNT0_REG (* (reg8 *) USBFS_USB__SIE_EP8_CNT0) +#define USBFS_SIE_EP8_CNT1_PTR ( (reg8 *) USBFS_USB__SIE_EP8_CNT1) +#define USBFS_SIE_EP8_CNT1_REG (* (reg8 *) USBFS_USB__SIE_EP8_CNT1) +#define USBFS_SIE_EP8_CR0_PTR ( (reg8 *) USBFS_USB__SIE_EP8_CR0) +#define USBFS_SIE_EP8_CR0_REG (* (reg8 *) USBFS_USB__SIE_EP8_CR0) + +#define USBFS_SOF0_PTR ( (reg8 *) USBFS_USB__SOF0) +#define USBFS_SOF0_REG (* (reg8 *) USBFS_USB__SOF0) +#define USBFS_SOF1_PTR ( (reg8 *) USBFS_USB__SOF1) +#define USBFS_SOF1_REG (* (reg8 *) USBFS_USB__SOF1) + +#define USBFS_USB_CLK_EN_PTR ( (reg8 *) USBFS_USB__USB_CLK_EN) +#define USBFS_USB_CLK_EN_REG (* (reg8 *) USBFS_USB__USB_CLK_EN) + +#define USBFS_USBIO_CR0_PTR ( (reg8 *) USBFS_USB__USBIO_CR0) +#define USBFS_USBIO_CR0_REG (* (reg8 *) USBFS_USB__USBIO_CR0) +#define USBFS_USBIO_CR1_PTR ( (reg8 *) USBFS_USB__USBIO_CR1) +#define USBFS_USBIO_CR1_REG (* (reg8 *) USBFS_USB__USBIO_CR1) +#if(!CY_PSOC5LP) + #define USBFS_USBIO_CR2_PTR ( (reg8 *) USBFS_USB__USBIO_CR2) + #define USBFS_USBIO_CR2_REG (* (reg8 *) USBFS_USB__USBIO_CR2) +#endif /* End CY_PSOC5LP */ + +#define USBFS_DIE_ID CYDEV_FLSHID_CUST_TABLES_BASE + +#define USBFS_PM_USB_CR0_PTR ( (reg8 *) CYREG_PM_USB_CR0) +#define USBFS_PM_USB_CR0_REG (* (reg8 *) CYREG_PM_USB_CR0) +#define USBFS_DYN_RECONFIG_PTR ( (reg8 *) USBFS_USB__DYN_RECONFIG) +#define USBFS_DYN_RECONFIG_REG (* (reg8 *) USBFS_USB__DYN_RECONFIG) + +#define USBFS_DM_INP_DIS_PTR ( (reg8 *) USBFS_Dm__INP_DIS) +#define USBFS_DM_INP_DIS_REG (* (reg8 *) USBFS_Dm__INP_DIS) +#define USBFS_DP_INP_DIS_PTR ( (reg8 *) USBFS_Dp__INP_DIS) +#define USBFS_DP_INP_DIS_REG (* (reg8 *) USBFS_Dp__INP_DIS) +#define USBFS_DP_INTSTAT_PTR ( (reg8 *) USBFS_Dp__INTSTAT) +#define USBFS_DP_INTSTAT_REG (* (reg8 *) USBFS_Dp__INTSTAT) + +#if (USBFS_MON_VBUS == 1u) + #if (USBFS_EXTERN_VBUS == 0u) + #define USBFS_VBUS_DR_PTR ( (reg8 *) USBFS_VBUS__DR) + #define USBFS_VBUS_DR_REG (* (reg8 *) USBFS_VBUS__DR) + #define USBFS_VBUS_PS_PTR ( (reg8 *) USBFS_VBUS__PS) + #define USBFS_VBUS_PS_REG (* (reg8 *) USBFS_VBUS__PS) + #define USBFS_VBUS_MASK USBFS_VBUS__MASK + #else + #define USBFS_VBUS_PS_PTR ( (reg8 *) USBFS_Vbus_ps_sts_sts_reg__STATUS_REG ) + #define USBFS_VBUS_MASK (0x01u) + #endif /* End USBFS_EXTERN_VBUS == 0u */ +#endif /* End USBFS_MON_VBUS */ + +/* Renamed Registers for backward compatibility. +* Should not be used in new designs. +*/ +#define USBFS_ARB_CFG USBFS_ARB_CFG_PTR + +#define USBFS_ARB_EP1_CFG USBFS_ARB_EP1_CFG_PTR +#define USBFS_ARB_EP1_INT_EN USBFS_ARB_EP1_INT_EN_PTR +#define USBFS_ARB_EP1_SR USBFS_ARB_EP1_SR_PTR + +#define USBFS_ARB_EP2_CFG USBFS_ARB_EP2_CFG_PTR +#define USBFS_ARB_EP2_INT_EN USBFS_ARB_EP2_INT_EN_PTR +#define USBFS_ARB_EP2_SR USBFS_ARB_EP2_SR_PTR + +#define USBFS_ARB_EP3_CFG USBFS_ARB_EP3_CFG_PTR +#define USBFS_ARB_EP3_INT_EN USBFS_ARB_EP3_INT_EN_PTR +#define USBFS_ARB_EP3_SR USBFS_ARB_EP3_SR_PTR + +#define USBFS_ARB_EP4_CFG USBFS_ARB_EP4_CFG_PTR +#define USBFS_ARB_EP4_INT_EN USBFS_ARB_EP4_INT_EN_PTR +#define USBFS_ARB_EP4_SR USBFS_ARB_EP4_SR_PTR + +#define USBFS_ARB_EP5_CFG USBFS_ARB_EP5_CFG_PTR +#define USBFS_ARB_EP5_INT_EN USBFS_ARB_EP5_INT_EN_PTR +#define USBFS_ARB_EP5_SR USBFS_ARB_EP5_SR_PTR + +#define USBFS_ARB_EP6_CFG USBFS_ARB_EP6_CFG_PTR +#define USBFS_ARB_EP6_INT_EN USBFS_ARB_EP6_INT_EN_PTR +#define USBFS_ARB_EP6_SR USBFS_ARB_EP6_SR_PTR + +#define USBFS_ARB_EP7_CFG USBFS_ARB_EP7_CFG_PTR +#define USBFS_ARB_EP7_INT_EN USBFS_ARB_EP7_INT_EN_PTR +#define USBFS_ARB_EP7_SR USBFS_ARB_EP7_SR_PTR + +#define USBFS_ARB_EP8_CFG USBFS_ARB_EP8_CFG_PTR +#define USBFS_ARB_EP8_INT_EN USBFS_ARB_EP8_INT_EN_PTR +#define USBFS_ARB_EP8_SR USBFS_ARB_EP8_SR_PTR + +#define USBFS_ARB_INT_EN USBFS_ARB_INT_EN_PTR +#define USBFS_ARB_INT_SR USBFS_ARB_INT_SR_PTR + +#define USBFS_ARB_RW1_DR USBFS_ARB_RW1_DR_PTR +#define USBFS_ARB_RW1_RA USBFS_ARB_RW1_RA_PTR +#define USBFS_ARB_RW1_RA_MSB USBFS_ARB_RW1_RA_MSB_PTR +#define USBFS_ARB_RW1_WA USBFS_ARB_RW1_WA_PTR +#define USBFS_ARB_RW1_WA_MSB USBFS_ARB_RW1_WA_MSB_PTR + +#define USBFS_ARB_RW2_DR USBFS_ARB_RW2_DR_PTR +#define USBFS_ARB_RW2_RA USBFS_ARB_RW2_RA_PTR +#define USBFS_ARB_RW2_RA_MSB USBFS_ARB_RW2_RA_MSB_PTR +#define USBFS_ARB_RW2_WA USBFS_ARB_RW2_WA_PTR +#define USBFS_ARB_RW2_WA_MSB USBFS_ARB_RW2_WA_MSB_PTR + +#define USBFS_ARB_RW3_DR USBFS_ARB_RW3_DR_PTR +#define USBFS_ARB_RW3_RA USBFS_ARB_RW3_RA_PTR +#define USBFS_ARB_RW3_RA_MSB USBFS_ARB_RW3_RA_MSB_PTR +#define USBFS_ARB_RW3_WA USBFS_ARB_RW3_WA_PTR +#define USBFS_ARB_RW3_WA_MSB USBFS_ARB_RW3_WA_MSB_PTR + +#define USBFS_ARB_RW4_DR USBFS_ARB_RW4_DR_PTR +#define USBFS_ARB_RW4_RA USBFS_ARB_RW4_RA_PTR +#define USBFS_ARB_RW4_RA_MSB USBFS_ARB_RW4_RA_MSB_PTR +#define USBFS_ARB_RW4_WA USBFS_ARB_RW4_WA_PTR +#define USBFS_ARB_RW4_WA_MSB USBFS_ARB_RW4_WA_MSB_PTR + +#define USBFS_ARB_RW5_DR USBFS_ARB_RW5_DR_PTR +#define USBFS_ARB_RW5_RA USBFS_ARB_RW5_RA_PTR +#define USBFS_ARB_RW5_RA_MSB USBFS_ARB_RW5_RA_MSB_PTR +#define USBFS_ARB_RW5_WA USBFS_ARB_RW5_WA_PTR +#define USBFS_ARB_RW5_WA_MSB USBFS_ARB_RW5_WA_MSB_PTR + +#define USBFS_ARB_RW6_DR USBFS_ARB_RW6_DR_PTR +#define USBFS_ARB_RW6_RA USBFS_ARB_RW6_RA_PTR +#define USBFS_ARB_RW6_RA_MSB USBFS_ARB_RW6_RA_MSB_PTR +#define USBFS_ARB_RW6_WA USBFS_ARB_RW6_WA_PTR +#define USBFS_ARB_RW6_WA_MSB USBFS_ARB_RW6_WA_MSB_PTR + +#define USBFS_ARB_RW7_DR USBFS_ARB_RW7_DR_PTR +#define USBFS_ARB_RW7_RA USBFS_ARB_RW7_RA_PTR +#define USBFS_ARB_RW7_RA_MSB USBFS_ARB_RW7_RA_MSB_PTR +#define USBFS_ARB_RW7_WA USBFS_ARB_RW7_WA_PTR +#define USBFS_ARB_RW7_WA_MSB USBFS_ARB_RW7_WA_MSB_PTR + +#define USBFS_ARB_RW8_DR USBFS_ARB_RW8_DR_PTR +#define USBFS_ARB_RW8_RA USBFS_ARB_RW8_RA_PTR +#define USBFS_ARB_RW8_RA_MSB USBFS_ARB_RW8_RA_MSB_PTR +#define USBFS_ARB_RW8_WA USBFS_ARB_RW8_WA_PTR +#define USBFS_ARB_RW8_WA_MSB USBFS_ARB_RW8_WA_MSB_PTR + +#define USBFS_BUF_SIZE USBFS_BUF_SIZE_PTR +#define USBFS_BUS_RST_CNT USBFS_BUS_RST_CNT_PTR +#define USBFS_CR0 USBFS_CR0_PTR +#define USBFS_CR1 USBFS_CR1_PTR +#define USBFS_CWA USBFS_CWA_PTR +#define USBFS_CWA_MSB USBFS_CWA_MSB_PTR + +#define USBFS_DMA_THRES USBFS_DMA_THRES_PTR +#define USBFS_DMA_THRES_MSB USBFS_DMA_THRES_MSB_PTR + +#define USBFS_EP_ACTIVE USBFS_EP_ACTIVE_PTR +#define USBFS_EP_TYPE USBFS_EP_TYPE_PTR + +#define USBFS_EP0_CNT USBFS_EP0_CNT_PTR +#define USBFS_EP0_CR USBFS_EP0_CR_PTR +#define USBFS_EP0_DR0 USBFS_EP0_DR0_PTR +#define USBFS_EP0_DR1 USBFS_EP0_DR1_PTR +#define USBFS_EP0_DR2 USBFS_EP0_DR2_PTR +#define USBFS_EP0_DR3 USBFS_EP0_DR3_PTR +#define USBFS_EP0_DR4 USBFS_EP0_DR4_PTR +#define USBFS_EP0_DR5 USBFS_EP0_DR5_PTR +#define USBFS_EP0_DR6 USBFS_EP0_DR6_PTR +#define USBFS_EP0_DR7 USBFS_EP0_DR7_PTR + +#define USBFS_OSCLK_DR0 USBFS_OSCLK_DR0_PTR +#define USBFS_OSCLK_DR1 USBFS_OSCLK_DR1_PTR + +#define USBFS_PM_ACT_CFG USBFS_PM_ACT_CFG_PTR +#define USBFS_PM_STBY_CFG USBFS_PM_STBY_CFG_PTR + +#define USBFS_SIE_EP_INT_EN USBFS_SIE_EP_INT_EN_PTR +#define USBFS_SIE_EP_INT_SR USBFS_SIE_EP_INT_SR_PTR + +#define USBFS_SIE_EP1_CNT0 USBFS_SIE_EP1_CNT0_PTR +#define USBFS_SIE_EP1_CNT1 USBFS_SIE_EP1_CNT1_PTR +#define USBFS_SIE_EP1_CR0 USBFS_SIE_EP1_CR0_PTR + +#define USBFS_SIE_EP2_CNT0 USBFS_SIE_EP2_CNT0_PTR +#define USBFS_SIE_EP2_CNT1 USBFS_SIE_EP2_CNT1_PTR +#define USBFS_SIE_EP2_CR0 USBFS_SIE_EP2_CR0_PTR + +#define USBFS_SIE_EP3_CNT0 USBFS_SIE_EP3_CNT0_PTR +#define USBFS_SIE_EP3_CNT1 USBFS_SIE_EP3_CNT1_PTR +#define USBFS_SIE_EP3_CR0 USBFS_SIE_EP3_CR0_PTR + +#define USBFS_SIE_EP4_CNT0 USBFS_SIE_EP4_CNT0_PTR +#define USBFS_SIE_EP4_CNT1 USBFS_SIE_EP4_CNT1_PTR +#define USBFS_SIE_EP4_CR0 USBFS_SIE_EP4_CR0_PTR + +#define USBFS_SIE_EP5_CNT0 USBFS_SIE_EP5_CNT0_PTR +#define USBFS_SIE_EP5_CNT1 USBFS_SIE_EP5_CNT1_PTR +#define USBFS_SIE_EP5_CR0 USBFS_SIE_EP5_CR0_PTR + +#define USBFS_SIE_EP6_CNT0 USBFS_SIE_EP6_CNT0_PTR +#define USBFS_SIE_EP6_CNT1 USBFS_SIE_EP6_CNT1_PTR +#define USBFS_SIE_EP6_CR0 USBFS_SIE_EP6_CR0_PTR + +#define USBFS_SIE_EP7_CNT0 USBFS_SIE_EP7_CNT0_PTR +#define USBFS_SIE_EP7_CNT1 USBFS_SIE_EP7_CNT1_PTR +#define USBFS_SIE_EP7_CR0 USBFS_SIE_EP7_CR0_PTR + +#define USBFS_SIE_EP8_CNT0 USBFS_SIE_EP8_CNT0_PTR +#define USBFS_SIE_EP8_CNT1 USBFS_SIE_EP8_CNT1_PTR +#define USBFS_SIE_EP8_CR0 USBFS_SIE_EP8_CR0_PTR + +#define USBFS_SOF0 USBFS_SOF0_PTR +#define USBFS_SOF1 USBFS_SOF1_PTR + +#define USBFS_USB_CLK_EN USBFS_USB_CLK_EN_PTR + +#define USBFS_USBIO_CR0 USBFS_USBIO_CR0_PTR +#define USBFS_USBIO_CR1 USBFS_USBIO_CR1_PTR +#define USBFS_USBIO_CR2 USBFS_USBIO_CR2_PTR + +#define USBFS_USB_MEM ((reg8 *) CYDEV_USB_MEM_BASE) + +#if(CYDEV_CHIP_DIE_EXPECT == CYDEV_CHIP_DIE_LEOPARD) + /* PSoC3 interrupt registers*/ + #define USBFS_USB_ISR_PRIOR ((reg8 *) CYDEV_INTC_PRIOR0) + #define USBFS_USB_ISR_SET_EN ((reg8 *) CYDEV_INTC_SET_EN0) + #define USBFS_USB_ISR_CLR_EN ((reg8 *) CYDEV_INTC_CLR_EN0) + #define USBFS_USB_ISR_VECT ((cyisraddress *) CYDEV_INTC_VECT_MBASE) +#elif(CYDEV_CHIP_DIE_EXPECT == CYDEV_CHIP_DIE_PANTHER) + /* PSoC5 interrupt registers*/ + #define USBFS_USB_ISR_PRIOR ((reg8 *) CYDEV_NVIC_PRI_0) + #define USBFS_USB_ISR_SET_EN ((reg8 *) CYDEV_NVIC_SETENA0) + #define USBFS_USB_ISR_CLR_EN ((reg8 *) CYDEV_NVIC_CLRENA0) + #define USBFS_USB_ISR_VECT ((cyisraddress *) CYDEV_NVIC_VECT_OFFSET) +#endif /* End CYDEV_CHIP_DIE_EXPECT */ + + +/*************************************** +* Interrupt vectors, masks and priorities +***************************************/ + +#define USBFS_BUS_RESET_PRIOR USBFS_bus_reset__INTC_PRIOR_NUM +#define USBFS_BUS_RESET_MASK USBFS_bus_reset__INTC_MASK +#define USBFS_BUS_RESET_VECT_NUM USBFS_bus_reset__INTC_NUMBER + +#define USBFS_SOF_PRIOR USBFS_sof_int__INTC_PRIOR_NUM +#define USBFS_SOF_MASK USBFS_sof_int__INTC_MASK +#define USBFS_SOF_VECT_NUM USBFS_sof_int__INTC_NUMBER + +#define USBFS_EP_0_PRIOR USBFS_ep_0__INTC_PRIOR_NUM +#define USBFS_EP_0_MASK USBFS_ep_0__INTC_MASK +#define USBFS_EP_0_VECT_NUM USBFS_ep_0__INTC_NUMBER + +#define USBFS_EP_1_PRIOR USBFS_ep_1__INTC_PRIOR_NUM +#define USBFS_EP_1_MASK USBFS_ep_1__INTC_MASK +#define USBFS_EP_1_VECT_NUM USBFS_ep_1__INTC_NUMBER + +#define USBFS_EP_2_PRIOR USBFS_ep_2__INTC_PRIOR_NUM +#define USBFS_EP_2_MASK USBFS_ep_2__INTC_MASK +#define USBFS_EP_2_VECT_NUM USBFS_ep_2__INTC_NUMBER + +#define USBFS_EP_3_PRIOR USBFS_ep_3__INTC_PRIOR_NUM +#define USBFS_EP_3_MASK USBFS_ep_3__INTC_MASK +#define USBFS_EP_3_VECT_NUM USBFS_ep_3__INTC_NUMBER + +#define USBFS_EP_4_PRIOR USBFS_ep_4__INTC_PRIOR_NUM +#define USBFS_EP_4_MASK USBFS_ep_4__INTC_MASK +#define USBFS_EP_4_VECT_NUM USBFS_ep_4__INTC_NUMBER + +#define USBFS_EP_5_PRIOR USBFS_ep_5__INTC_PRIOR_NUM +#define USBFS_EP_5_MASK USBFS_ep_5__INTC_MASK +#define USBFS_EP_5_VECT_NUM USBFS_ep_5__INTC_NUMBER + +#define USBFS_EP_6_PRIOR USBFS_ep_6__INTC_PRIOR_NUM +#define USBFS_EP_6_MASK USBFS_ep_6__INTC_MASK +#define USBFS_EP_6_VECT_NUM USBFS_ep_6__INTC_NUMBER + +#define USBFS_EP_7_PRIOR USBFS_ep_7__INTC_PRIOR_NUM +#define USBFS_EP_7_MASK USBFS_ep_7__INTC_MASK +#define USBFS_EP_7_VECT_NUM USBFS_ep_7__INTC_NUMBER + +#define USBFS_EP_8_PRIOR USBFS_ep_8__INTC_PRIOR_NUM +#define USBFS_EP_8_MASK USBFS_ep_8__INTC_MASK +#define USBFS_EP_8_VECT_NUM USBFS_ep_8__INTC_NUMBER + +#define USBFS_DP_INTC_PRIOR USBFS_dp_int__INTC_PRIOR_NUM +#define USBFS_DP_INTC_MASK USBFS_dp_int__INTC_MASK +#define USBFS_DP_INTC_VECT_NUM USBFS_dp_int__INTC_NUMBER + +/* ARB ISR should have higher priority from EP_X ISR, therefore it is defined to highest (0) */ +#define USBFS_ARB_PRIOR (0u) +#define USBFS_ARB_MASK USBFS_arb_int__INTC_MASK +#define USBFS_ARB_VECT_NUM USBFS_arb_int__INTC_NUMBER + +/*************************************** + * Endpoint 0 offsets (Table 9-2) + **************************************/ + +#define USBFS_bmRequestType USBFS_EP0_DR0_PTR +#define USBFS_bRequest USBFS_EP0_DR1_PTR +#define USBFS_wValue USBFS_EP0_DR2_PTR +#define USBFS_wValueHi USBFS_EP0_DR3_PTR +#define USBFS_wValueLo USBFS_EP0_DR2_PTR +#define USBFS_wIndex USBFS_EP0_DR4_PTR +#define USBFS_wIndexHi USBFS_EP0_DR5_PTR +#define USBFS_wIndexLo USBFS_EP0_DR4_PTR +#define USBFS_length USBFS_EP0_DR6_PTR +#define USBFS_lengthHi USBFS_EP0_DR7_PTR +#define USBFS_lengthLo USBFS_EP0_DR6_PTR + + +/*************************************** +* Register Constants +***************************************/ +#define USBFS_VDDD_MV CYDEV_VDDD_MV +#define USBFS_3500MV (3500u) + +#define USBFS_CR1_REG_ENABLE (0x01u) +#define USBFS_CR1_ENABLE_LOCK (0x02u) +#define USBFS_CR1_BUS_ACTIVITY_SHIFT (0x02u) +#define USBFS_CR1_BUS_ACTIVITY ((uint8)(0x01u << USBFS_CR1_BUS_ACTIVITY_SHIFT)) +#define USBFS_CR1_TRIM_MSB_EN (0x08u) + +#define USBFS_EP0_CNT_DATA_TOGGLE (0x80u) +#define USBFS_EPX_CNT_DATA_TOGGLE (0x80u) +#define USBFS_EPX_CNT0_MASK (0x0Fu) +#define USBFS_EPX_CNTX_MSB_MASK (0x07u) +#define USBFS_EPX_CNTX_ADDR_SHIFT (0x04u) +#define USBFS_EPX_CNTX_ADDR_OFFSET (0x10u) +#define USBFS_EPX_CNTX_CRC_COUNT (0x02u) +#define USBFS_EPX_DATA_BUF_MAX (512u) + +#define USBFS_CR0_ENABLE (0x80u) + +/* A 100 KHz clock is used for BUS reset count. Recommended is to count 10 pulses */ +#define USBFS_BUS_RST_COUNT (0x0au) + +#define USBFS_USBIO_CR1_IOMODE (0x20u) +#define USBFS_USBIO_CR1_USBPUEN (0x04u) +#define USBFS_USBIO_CR1_DP0 (0x02u) +#define USBFS_USBIO_CR1_DM0 (0x01u) + +#define USBFS_USBIO_CR0_TEN (0x80u) +#define USBFS_USBIO_CR0_TSE0 (0x40u) +#define USBFS_USBIO_CR0_TD (0x20u) +#define USBFS_USBIO_CR0_RD (0x01u) + +#define USBFS_FASTCLK_IMO_CR_USBCLK_ON (0x40u) +#define USBFS_FASTCLK_IMO_CR_XCLKEN (0x20u) +#define USBFS_FASTCLK_IMO_CR_FX2ON (0x10u) + +#define USBFS_ARB_EPX_CFG_RESET (0x08u) +#define USBFS_ARB_EPX_CFG_CRC_BYPASS (0x04u) +#define USBFS_ARB_EPX_CFG_DMA_REQ (0x02u) +#define USBFS_ARB_EPX_CFG_IN_DATA_RDY (0x01u) + +#define USBFS_ARB_EPX_SR_IN_BUF_FULL (0x01u) +#define USBFS_ARB_EPX_SR_DMA_GNT (0x02u) +#define USBFS_ARB_EPX_SR_BUF_OVER (0x04u) +#define USBFS_ARB_EPX_SR_BUF_UNDER (0x08u) + +#define USBFS_ARB_CFG_AUTO_MEM (0x10u) +#define USBFS_ARB_CFG_MANUAL_DMA (0x20u) +#define USBFS_ARB_CFG_AUTO_DMA (0x40u) +#define USBFS_ARB_CFG_CFG_CPM (0x80u) + +#if(USBFS_EP_MM == USBFS__EP_DMAAUTO) + #define USBFS_ARB_EPX_INT_MASK (0x1Du) +#else + #define USBFS_ARB_EPX_INT_MASK (0x1Fu) +#endif /* End USBFS_EP_MM == USBFS__EP_DMAAUTO */ +#define USBFS_ARB_INT_MASK (uint8)((USBFS_DMA1_REMOVE ^ 1u) | \ + (uint8)((USBFS_DMA2_REMOVE ^ 1u) << 1u) | \ + (uint8)((USBFS_DMA3_REMOVE ^ 1u) << 2u) | \ + (uint8)((USBFS_DMA4_REMOVE ^ 1u) << 3u) | \ + (uint8)((USBFS_DMA5_REMOVE ^ 1u) << 4u) | \ + (uint8)((USBFS_DMA6_REMOVE ^ 1u) << 5u) | \ + (uint8)((USBFS_DMA7_REMOVE ^ 1u) << 6u) | \ + (uint8)((USBFS_DMA8_REMOVE ^ 1u) << 7u) ) + +#define USBFS_SIE_EP_INT_EP1_MASK (0x01u) +#define USBFS_SIE_EP_INT_EP2_MASK (0x02u) +#define USBFS_SIE_EP_INT_EP3_MASK (0x04u) +#define USBFS_SIE_EP_INT_EP4_MASK (0x08u) +#define USBFS_SIE_EP_INT_EP5_MASK (0x10u) +#define USBFS_SIE_EP_INT_EP6_MASK (0x20u) +#define USBFS_SIE_EP_INT_EP7_MASK (0x40u) +#define USBFS_SIE_EP_INT_EP8_MASK (0x80u) + +#define USBFS_PM_ACT_EN_FSUSB USBFS_USB__PM_ACT_MSK +#define USBFS_PM_STBY_EN_FSUSB USBFS_USB__PM_STBY_MSK +#define USBFS_PM_AVAIL_EN_FSUSBIO (0x10u) + +#define USBFS_PM_USB_CR0_REF_EN (0x01u) +#define USBFS_PM_USB_CR0_PD_N (0x02u) +#define USBFS_PM_USB_CR0_PD_PULLUP_N (0x04u) + +#define USBFS_USB_CLK_ENABLE (0x01u) + +#define USBFS_DM_MASK USBFS_Dm__0__MASK +#define USBFS_DP_MASK USBFS_Dp__0__MASK + +#define USBFS_DYN_RECONFIG_ENABLE (0x01u) +#define USBFS_DYN_RECONFIG_EP_SHIFT (0x01u) +#define USBFS_DYN_RECONFIG_RDY_STS (0x10u) + + +#endif /* End CY_USBFS_USBFS_H */ + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dm.c b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dm.c new file mode 100755 index 0000000..afae8fa --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dm.c @@ -0,0 +1,137 @@ +/******************************************************************************* +* File Name: USBFS_Dm.c +* Version 1.90 +* +* Description: +* This file contains API to enable firmware control of a Pins component. +* +* Note: +* +******************************************************************************** +* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#include "cytypes.h" +#include "USBFS_Dm.h" + +/* APIs are not generated for P15[7:6] on PSoC 5 */ +#if !(CY_PSOC5A &&\ + USBFS_Dm__PORT == 15 && ((USBFS_Dm__MASK & 0xC0) != 0)) + + +/******************************************************************************* +* Function Name: USBFS_Dm_Write +******************************************************************************** +* +* Summary: +* Assign a new value to the digital port's data output register. +* +* Parameters: +* prtValue: The value to be assigned to the Digital Port. +* +* Return: +* None +* +*******************************************************************************/ +void USBFS_Dm_Write(uint8 value) +{ + uint8 staticBits = (USBFS_Dm_DR & (uint8)(~USBFS_Dm_MASK)); + USBFS_Dm_DR = staticBits | ((uint8)(value << USBFS_Dm_SHIFT) & USBFS_Dm_MASK); +} + + +/******************************************************************************* +* Function Name: USBFS_Dm_SetDriveMode +******************************************************************************** +* +* Summary: +* Change the drive mode on the pins of the port. +* +* Parameters: +* mode: Change the pins to this drive mode. +* +* Return: +* None +* +*******************************************************************************/ +void USBFS_Dm_SetDriveMode(uint8 mode) +{ + CyPins_SetPinDriveMode(USBFS_Dm_0, mode); +} + + +/******************************************************************************* +* Function Name: USBFS_Dm_Read +******************************************************************************** +* +* Summary: +* Read the current value on the pins of the Digital Port in right justified +* form. +* +* Parameters: +* None +* +* Return: +* Returns the current value of the Digital Port as a right justified number +* +* Note: +* Macro USBFS_Dm_ReadPS calls this function. +* +*******************************************************************************/ +uint8 USBFS_Dm_Read(void) +{ + return (USBFS_Dm_PS & USBFS_Dm_MASK) >> USBFS_Dm_SHIFT; +} + + +/******************************************************************************* +* Function Name: USBFS_Dm_ReadDataReg +******************************************************************************** +* +* Summary: +* Read the current value assigned to a Digital Port's data output register +* +* Parameters: +* None +* +* Return: +* Returns the current value assigned to the Digital Port's data output register +* +*******************************************************************************/ +uint8 USBFS_Dm_ReadDataReg(void) +{ + return (USBFS_Dm_DR & USBFS_Dm_MASK) >> USBFS_Dm_SHIFT; +} + + +/* If Interrupts Are Enabled for this Pins component */ +#if defined(USBFS_Dm_INTSTAT) + + /******************************************************************************* + * Function Name: USBFS_Dm_ClearInterrupt + ******************************************************************************** + * Summary: + * Clears any active interrupts attached to port and returns the value of the + * interrupt status register. + * + * Parameters: + * None + * + * Return: + * Returns the value of the interrupt status register + * + *******************************************************************************/ + uint8 USBFS_Dm_ClearInterrupt(void) + { + return (USBFS_Dm_INTSTAT & USBFS_Dm_MASK) >> USBFS_Dm_SHIFT; + } + +#endif /* If Interrupts Are Enabled for this Pins component */ + +#endif /* CY_PSOC5A... */ + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dm.h b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dm.h new file mode 100755 index 0000000..c1aa9b9 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dm.h @@ -0,0 +1,130 @@ +/******************************************************************************* +* File Name: USBFS_Dm.h +* Version 1.90 +* +* Description: +* This file containts Control Register function prototypes and register defines +* +* Note: +* +******************************************************************************** +* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#if !defined(CY_PINS_USBFS_Dm_H) /* Pins USBFS_Dm_H */ +#define CY_PINS_USBFS_Dm_H + +#include "cytypes.h" +#include "cyfitter.h" +#include "cypins.h" +#include "USBFS_Dm_aliases.h" + +/* Check to see if required defines such as CY_PSOC5A are available */ +/* They are defined starting with cy_boot v3.0 */ +#if !defined (CY_PSOC5A) + #error Component cy_pins_v1_90 requires cy_boot v3.0 or later +#endif /* (CY_PSOC5A) */ + +/* APIs are not generated for P15[7:6] */ +#if !(CY_PSOC5A &&\ + USBFS_Dm__PORT == 15 && ((USBFS_Dm__MASK & 0xC0) != 0)) + + +/*************************************** +* Function Prototypes +***************************************/ + +void USBFS_Dm_Write(uint8 value) ; +void USBFS_Dm_SetDriveMode(uint8 mode) ; +uint8 USBFS_Dm_ReadDataReg(void) ; +uint8 USBFS_Dm_Read(void) ; +uint8 USBFS_Dm_ClearInterrupt(void) ; + + +/*************************************** +* API Constants +***************************************/ + +/* Drive Modes */ +#define USBFS_Dm_DM_ALG_HIZ PIN_DM_ALG_HIZ +#define USBFS_Dm_DM_DIG_HIZ PIN_DM_DIG_HIZ +#define USBFS_Dm_DM_RES_UP PIN_DM_RES_UP +#define USBFS_Dm_DM_RES_DWN PIN_DM_RES_DWN +#define USBFS_Dm_DM_OD_LO PIN_DM_OD_LO +#define USBFS_Dm_DM_OD_HI PIN_DM_OD_HI +#define USBFS_Dm_DM_STRONG PIN_DM_STRONG +#define USBFS_Dm_DM_RES_UPDWN PIN_DM_RES_UPDWN + +/* Digital Port Constants */ +#define USBFS_Dm_MASK USBFS_Dm__MASK +#define USBFS_Dm_SHIFT USBFS_Dm__SHIFT +#define USBFS_Dm_WIDTH 1u + + +/*************************************** +* Registers +***************************************/ + +/* Main Port Registers */ +/* Pin State */ +#define USBFS_Dm_PS (* (reg8 *) USBFS_Dm__PS) +/* Data Register */ +#define USBFS_Dm_DR (* (reg8 *) USBFS_Dm__DR) +/* Port Number */ +#define USBFS_Dm_PRT_NUM (* (reg8 *) USBFS_Dm__PRT) +/* Connect to Analog Globals */ +#define USBFS_Dm_AG (* (reg8 *) USBFS_Dm__AG) +/* Analog MUX bux enable */ +#define USBFS_Dm_AMUX (* (reg8 *) USBFS_Dm__AMUX) +/* Bidirectional Enable */ +#define USBFS_Dm_BIE (* (reg8 *) USBFS_Dm__BIE) +/* Bit-mask for Aliased Register Access */ +#define USBFS_Dm_BIT_MASK (* (reg8 *) USBFS_Dm__BIT_MASK) +/* Bypass Enable */ +#define USBFS_Dm_BYP (* (reg8 *) USBFS_Dm__BYP) +/* Port wide control signals */ +#define USBFS_Dm_CTL (* (reg8 *) USBFS_Dm__CTL) +/* Drive Modes */ +#define USBFS_Dm_DM0 (* (reg8 *) USBFS_Dm__DM0) +#define USBFS_Dm_DM1 (* (reg8 *) USBFS_Dm__DM1) +#define USBFS_Dm_DM2 (* (reg8 *) USBFS_Dm__DM2) +/* Input Buffer Disable Override */ +#define USBFS_Dm_INP_DIS (* (reg8 *) USBFS_Dm__INP_DIS) +/* LCD Common or Segment Drive */ +#define USBFS_Dm_LCD_COM_SEG (* (reg8 *) USBFS_Dm__LCD_COM_SEG) +/* Enable Segment LCD */ +#define USBFS_Dm_LCD_EN (* (reg8 *) USBFS_Dm__LCD_EN) +/* Slew Rate Control */ +#define USBFS_Dm_SLW (* (reg8 *) USBFS_Dm__SLW) + +/* DSI Port Registers */ +/* Global DSI Select Register */ +#define USBFS_Dm_PRTDSI__CAPS_SEL (* (reg8 *) USBFS_Dm__PRTDSI__CAPS_SEL) +/* Double Sync Enable */ +#define USBFS_Dm_PRTDSI__DBL_SYNC_IN (* (reg8 *) USBFS_Dm__PRTDSI__DBL_SYNC_IN) +/* Output Enable Select Drive Strength */ +#define USBFS_Dm_PRTDSI__OE_SEL0 (* (reg8 *) USBFS_Dm__PRTDSI__OE_SEL0) +#define USBFS_Dm_PRTDSI__OE_SEL1 (* (reg8 *) USBFS_Dm__PRTDSI__OE_SEL1) +/* Port Pin Output Select Registers */ +#define USBFS_Dm_PRTDSI__OUT_SEL0 (* (reg8 *) USBFS_Dm__PRTDSI__OUT_SEL0) +#define USBFS_Dm_PRTDSI__OUT_SEL1 (* (reg8 *) USBFS_Dm__PRTDSI__OUT_SEL1) +/* Sync Output Enable Registers */ +#define USBFS_Dm_PRTDSI__SYNC_OUT (* (reg8 *) USBFS_Dm__PRTDSI__SYNC_OUT) + + +#if defined(USBFS_Dm__INTSTAT) /* Interrupt Registers */ + + #define USBFS_Dm_INTSTAT (* (reg8 *) USBFS_Dm__INTSTAT) + #define USBFS_Dm_SNAP (* (reg8 *) USBFS_Dm__SNAP) + +#endif /* Interrupt Registers */ + +#endif /* CY_PSOC5A... */ + +#endif /* CY_PINS_USBFS_Dm_H */ + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dm_aliases.h b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dm_aliases.h new file mode 100755 index 0000000..bc4f686 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dm_aliases.h @@ -0,0 +1,32 @@ +/******************************************************************************* +* File Name: USBFS_Dm.h +* Version 1.90 +* +* Description: +* This file containts Control Register function prototypes and register defines +* +* Note: +* +******************************************************************************** +* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#if !defined(CY_PINS_USBFS_Dm_ALIASES_H) /* Pins USBFS_Dm_ALIASES_H */ +#define CY_PINS_USBFS_Dm_ALIASES_H + +#include "cytypes.h" +#include "cyfitter.h" + + + +/*************************************** +* Constants +***************************************/ +#define USBFS_Dm_0 USBFS_Dm__0__PC + +#endif /* End Pins USBFS_Dm_ALIASES_H */ + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dp.c b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dp.c new file mode 100755 index 0000000..304d5d6 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dp.c @@ -0,0 +1,137 @@ +/******************************************************************************* +* File Name: USBFS_Dp.c +* Version 1.90 +* +* Description: +* This file contains API to enable firmware control of a Pins component. +* +* Note: +* +******************************************************************************** +* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#include "cytypes.h" +#include "USBFS_Dp.h" + +/* APIs are not generated for P15[7:6] on PSoC 5 */ +#if !(CY_PSOC5A &&\ + USBFS_Dp__PORT == 15 && ((USBFS_Dp__MASK & 0xC0) != 0)) + + +/******************************************************************************* +* Function Name: USBFS_Dp_Write +******************************************************************************** +* +* Summary: +* Assign a new value to the digital port's data output register. +* +* Parameters: +* prtValue: The value to be assigned to the Digital Port. +* +* Return: +* None +* +*******************************************************************************/ +void USBFS_Dp_Write(uint8 value) +{ + uint8 staticBits = (USBFS_Dp_DR & (uint8)(~USBFS_Dp_MASK)); + USBFS_Dp_DR = staticBits | ((uint8)(value << USBFS_Dp_SHIFT) & USBFS_Dp_MASK); +} + + +/******************************************************************************* +* Function Name: USBFS_Dp_SetDriveMode +******************************************************************************** +* +* Summary: +* Change the drive mode on the pins of the port. +* +* Parameters: +* mode: Change the pins to this drive mode. +* +* Return: +* None +* +*******************************************************************************/ +void USBFS_Dp_SetDriveMode(uint8 mode) +{ + CyPins_SetPinDriveMode(USBFS_Dp_0, mode); +} + + +/******************************************************************************* +* Function Name: USBFS_Dp_Read +******************************************************************************** +* +* Summary: +* Read the current value on the pins of the Digital Port in right justified +* form. +* +* Parameters: +* None +* +* Return: +* Returns the current value of the Digital Port as a right justified number +* +* Note: +* Macro USBFS_Dp_ReadPS calls this function. +* +*******************************************************************************/ +uint8 USBFS_Dp_Read(void) +{ + return (USBFS_Dp_PS & USBFS_Dp_MASK) >> USBFS_Dp_SHIFT; +} + + +/******************************************************************************* +* Function Name: USBFS_Dp_ReadDataReg +******************************************************************************** +* +* Summary: +* Read the current value assigned to a Digital Port's data output register +* +* Parameters: +* None +* +* Return: +* Returns the current value assigned to the Digital Port's data output register +* +*******************************************************************************/ +uint8 USBFS_Dp_ReadDataReg(void) +{ + return (USBFS_Dp_DR & USBFS_Dp_MASK) >> USBFS_Dp_SHIFT; +} + + +/* If Interrupts Are Enabled for this Pins component */ +#if defined(USBFS_Dp_INTSTAT) + + /******************************************************************************* + * Function Name: USBFS_Dp_ClearInterrupt + ******************************************************************************** + * Summary: + * Clears any active interrupts attached to port and returns the value of the + * interrupt status register. + * + * Parameters: + * None + * + * Return: + * Returns the value of the interrupt status register + * + *******************************************************************************/ + uint8 USBFS_Dp_ClearInterrupt(void) + { + return (USBFS_Dp_INTSTAT & USBFS_Dp_MASK) >> USBFS_Dp_SHIFT; + } + +#endif /* If Interrupts Are Enabled for this Pins component */ + +#endif /* CY_PSOC5A... */ + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dp.h b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dp.h new file mode 100755 index 0000000..2d03ad9 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dp.h @@ -0,0 +1,130 @@ +/******************************************************************************* +* File Name: USBFS_Dp.h +* Version 1.90 +* +* Description: +* This file containts Control Register function prototypes and register defines +* +* Note: +* +******************************************************************************** +* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#if !defined(CY_PINS_USBFS_Dp_H) /* Pins USBFS_Dp_H */ +#define CY_PINS_USBFS_Dp_H + +#include "cytypes.h" +#include "cyfitter.h" +#include "cypins.h" +#include "USBFS_Dp_aliases.h" + +/* Check to see if required defines such as CY_PSOC5A are available */ +/* They are defined starting with cy_boot v3.0 */ +#if !defined (CY_PSOC5A) + #error Component cy_pins_v1_90 requires cy_boot v3.0 or later +#endif /* (CY_PSOC5A) */ + +/* APIs are not generated for P15[7:6] */ +#if !(CY_PSOC5A &&\ + USBFS_Dp__PORT == 15 && ((USBFS_Dp__MASK & 0xC0) != 0)) + + +/*************************************** +* Function Prototypes +***************************************/ + +void USBFS_Dp_Write(uint8 value) ; +void USBFS_Dp_SetDriveMode(uint8 mode) ; +uint8 USBFS_Dp_ReadDataReg(void) ; +uint8 USBFS_Dp_Read(void) ; +uint8 USBFS_Dp_ClearInterrupt(void) ; + + +/*************************************** +* API Constants +***************************************/ + +/* Drive Modes */ +#define USBFS_Dp_DM_ALG_HIZ PIN_DM_ALG_HIZ +#define USBFS_Dp_DM_DIG_HIZ PIN_DM_DIG_HIZ +#define USBFS_Dp_DM_RES_UP PIN_DM_RES_UP +#define USBFS_Dp_DM_RES_DWN PIN_DM_RES_DWN +#define USBFS_Dp_DM_OD_LO PIN_DM_OD_LO +#define USBFS_Dp_DM_OD_HI PIN_DM_OD_HI +#define USBFS_Dp_DM_STRONG PIN_DM_STRONG +#define USBFS_Dp_DM_RES_UPDWN PIN_DM_RES_UPDWN + +/* Digital Port Constants */ +#define USBFS_Dp_MASK USBFS_Dp__MASK +#define USBFS_Dp_SHIFT USBFS_Dp__SHIFT +#define USBFS_Dp_WIDTH 1u + + +/*************************************** +* Registers +***************************************/ + +/* Main Port Registers */ +/* Pin State */ +#define USBFS_Dp_PS (* (reg8 *) USBFS_Dp__PS) +/* Data Register */ +#define USBFS_Dp_DR (* (reg8 *) USBFS_Dp__DR) +/* Port Number */ +#define USBFS_Dp_PRT_NUM (* (reg8 *) USBFS_Dp__PRT) +/* Connect to Analog Globals */ +#define USBFS_Dp_AG (* (reg8 *) USBFS_Dp__AG) +/* Analog MUX bux enable */ +#define USBFS_Dp_AMUX (* (reg8 *) USBFS_Dp__AMUX) +/* Bidirectional Enable */ +#define USBFS_Dp_BIE (* (reg8 *) USBFS_Dp__BIE) +/* Bit-mask for Aliased Register Access */ +#define USBFS_Dp_BIT_MASK (* (reg8 *) USBFS_Dp__BIT_MASK) +/* Bypass Enable */ +#define USBFS_Dp_BYP (* (reg8 *) USBFS_Dp__BYP) +/* Port wide control signals */ +#define USBFS_Dp_CTL (* (reg8 *) USBFS_Dp__CTL) +/* Drive Modes */ +#define USBFS_Dp_DM0 (* (reg8 *) USBFS_Dp__DM0) +#define USBFS_Dp_DM1 (* (reg8 *) USBFS_Dp__DM1) +#define USBFS_Dp_DM2 (* (reg8 *) USBFS_Dp__DM2) +/* Input Buffer Disable Override */ +#define USBFS_Dp_INP_DIS (* (reg8 *) USBFS_Dp__INP_DIS) +/* LCD Common or Segment Drive */ +#define USBFS_Dp_LCD_COM_SEG (* (reg8 *) USBFS_Dp__LCD_COM_SEG) +/* Enable Segment LCD */ +#define USBFS_Dp_LCD_EN (* (reg8 *) USBFS_Dp__LCD_EN) +/* Slew Rate Control */ +#define USBFS_Dp_SLW (* (reg8 *) USBFS_Dp__SLW) + +/* DSI Port Registers */ +/* Global DSI Select Register */ +#define USBFS_Dp_PRTDSI__CAPS_SEL (* (reg8 *) USBFS_Dp__PRTDSI__CAPS_SEL) +/* Double Sync Enable */ +#define USBFS_Dp_PRTDSI__DBL_SYNC_IN (* (reg8 *) USBFS_Dp__PRTDSI__DBL_SYNC_IN) +/* Output Enable Select Drive Strength */ +#define USBFS_Dp_PRTDSI__OE_SEL0 (* (reg8 *) USBFS_Dp__PRTDSI__OE_SEL0) +#define USBFS_Dp_PRTDSI__OE_SEL1 (* (reg8 *) USBFS_Dp__PRTDSI__OE_SEL1) +/* Port Pin Output Select Registers */ +#define USBFS_Dp_PRTDSI__OUT_SEL0 (* (reg8 *) USBFS_Dp__PRTDSI__OUT_SEL0) +#define USBFS_Dp_PRTDSI__OUT_SEL1 (* (reg8 *) USBFS_Dp__PRTDSI__OUT_SEL1) +/* Sync Output Enable Registers */ +#define USBFS_Dp_PRTDSI__SYNC_OUT (* (reg8 *) USBFS_Dp__PRTDSI__SYNC_OUT) + + +#if defined(USBFS_Dp__INTSTAT) /* Interrupt Registers */ + + #define USBFS_Dp_INTSTAT (* (reg8 *) USBFS_Dp__INTSTAT) + #define USBFS_Dp_SNAP (* (reg8 *) USBFS_Dp__SNAP) + +#endif /* Interrupt Registers */ + +#endif /* CY_PSOC5A... */ + +#endif /* CY_PINS_USBFS_Dp_H */ + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dp_aliases.h b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dp_aliases.h new file mode 100755 index 0000000..b77c3b9 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_Dp_aliases.h @@ -0,0 +1,32 @@ +/******************************************************************************* +* File Name: USBFS_Dp.h +* Version 1.90 +* +* Description: +* This file containts Control Register function prototypes and register defines +* +* Note: +* +******************************************************************************** +* Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#if !defined(CY_PINS_USBFS_Dp_ALIASES_H) /* Pins USBFS_Dp_ALIASES_H */ +#define CY_PINS_USBFS_Dp_ALIASES_H + +#include "cytypes.h" +#include "cyfitter.h" + + + +/*************************************** +* Constants +***************************************/ +#define USBFS_Dp_0 USBFS_Dp__0__PC + +#endif /* End Pins USBFS_Dp_ALIASES_H */ + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_audio.c b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_audio.c new file mode 100755 index 0000000..cec388b --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_audio.c @@ -0,0 +1,318 @@ +/******************************************************************************* +* File Name: USBFS_audio.c +* Version 2.60 +* +* Description: +* USB AUDIO Class request handler. +* +* Note: +* +******************************************************************************** +* Copyright 2008-2013, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#include "USBFS.h" + +#if defined(USBFS_ENABLE_AUDIO_CLASS) + +#include "USBFS_audio.h" +#include "USBFS_pvt.h" +#if defined(USBFS_ENABLE_MIDI_STREAMING) + #include "USBFS_midi.h" +#endif /* End USBFS_ENABLE_MIDI_STREAMING*/ + + +/*************************************** +* Custom Declarations +***************************************/ + +/* `#START CUSTOM_DECLARATIONS` Place your declaration here */ + +/* `#END` */ + + +#if !defined(USER_SUPPLIED_AUDIO_HANDLER) + + +/*************************************** +* AUDIO Variables +***************************************/ + +#if defined(USBFS_ENABLE_AUDIO_STREAMING) + volatile uint8 USBFS_currentSampleFrequency[USBFS_MAX_EP][USBFS_SAMPLE_FREQ_LEN]; + volatile uint8 USBFS_frequencyChanged; + volatile uint8 USBFS_currentMute; + volatile uint8 USBFS_currentVolume[USBFS_VOLUME_LEN]; + volatile uint8 USBFS_minimumVolume[USBFS_VOLUME_LEN] = {USBFS_VOL_MIN_LSB, + USBFS_VOL_MIN_MSB}; + volatile uint8 USBFS_maximumVolume[USBFS_VOLUME_LEN] = {USBFS_VOL_MAX_LSB, + USBFS_VOL_MAX_MSB}; + volatile uint8 USBFS_resolutionVolume[USBFS_VOLUME_LEN] = {USBFS_VOL_RES_LSB, + USBFS_VOL_RES_MSB}; +#endif /* End USBFS_ENABLE_AUDIO_STREAMING */ + + +/******************************************************************************* +* Function Name: USBFS_DispatchAUDIOClassRqst +******************************************************************************** +* +* Summary: +* This routine dispatches class requests +* +* Parameters: +* None. +* +* Return: +* requestHandled +* +* Global variables: +* USBFS_currentSampleFrequency: Contains the current audio Sample +* Frequency. It is set by the Host using SET_CUR request to the endpoint. +* USBFS_frequencyChanged: This variable is used as a flag for the +* user code, to be aware that Host has been sent request for changing +* Sample Frequency. Sample frequency will be sent on the next OUT +* transaction. It is contains endpoint address when set. The following +* code is recommended for detecting new Sample Frequency in main code: +* if((USBFS_frequencyChanged != 0) && +* (USBFS_transferState == USBFS_TRANS_STATE_IDLE)) +* { +* USBFS_frequencyChanged = 0; +* } +* USBFS_transferState variable is checked to be sure that +* transfer completes. +* USBFS_currentMute: Contains mute configuration set by Host. +* USBFS_currentVolume: Contains volume level set by Host. +* +* Reentrant: +* No. +* +*******************************************************************************/ +uint8 USBFS_DispatchAUDIOClassRqst(void) +{ + uint8 requestHandled = USBFS_FALSE; + + #if defined(USBFS_ENABLE_AUDIO_STREAMING) + uint8 epNumber; + epNumber = CY_GET_REG8(USBFS_wIndexLo) & USBFS_DIR_UNUSED; + #endif /* End USBFS_ENABLE_AUDIO_STREAMING */ + + if ((CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_DIR_MASK) == USBFS_RQST_DIR_D2H) + { + /* Control Read */ + if((CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_RCPT_MASK) == \ + USBFS_RQST_RCPT_EP) + { + /* Endpoint */ + switch (CY_GET_REG8(USBFS_bRequest)) + { + case USBFS_GET_CUR: + #if defined(USBFS_ENABLE_AUDIO_STREAMING) + if(CY_GET_REG8(USBFS_wValueHi) == USBFS_SAMPLING_FREQ_CONTROL) + { + /* Endpoint Control Selector is Sampling Frequency */ + USBFS_currentTD.wCount = USBFS_SAMPLE_FREQ_LEN; + USBFS_currentTD.pData = USBFS_currentSampleFrequency[epNumber]; + requestHandled = USBFS_InitControlRead(); + } + #endif /* End USBFS_ENABLE_AUDIO_STREAMING */ + + /* `#START AUDIO_READ_REQUESTS` Place other request handler here */ + + /* `#END` */ + break; + default: + break; + } + } + else if((CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_RCPT_MASK) == \ + USBFS_RQST_RCPT_IFC) + { + /* Interface or Entity ID */ + switch (CY_GET_REG8(USBFS_bRequest)) + { + case USBFS_GET_CUR: + #if defined(USBFS_ENABLE_AUDIO_STREAMING) + if(CY_GET_REG8(USBFS_wValueHi) == USBFS_MUTE_CONTROL) + { + /* `#START MUTE_CONTROL_GET_REQUEST` Place multi-channel handler here */ + + /* `#END` */ + + /* Entity ID Control Selector is MUTE */ + USBFS_currentTD.wCount = 1u; + USBFS_currentTD.pData = &USBFS_currentMute; + requestHandled = USBFS_InitControlRead(); + } + else if(CY_GET_REG8(USBFS_wValueHi) == USBFS_VOLUME_CONTROL) + { + /* `#START VOLUME_CONTROL_GET_REQUEST` Place multi-channel handler here */ + + /* `#END` */ + + /* Entity ID Control Selector is VOLUME, */ + USBFS_currentTD.wCount = USBFS_VOLUME_LEN; + USBFS_currentTD.pData = USBFS_currentVolume; + requestHandled = USBFS_InitControlRead(); + } + else + { + /* `#START OTHER_GET_CUR_REQUESTS` Place other request handler here */ + + /* `#END` */ + } + break; + case USBFS_GET_MIN: /* GET_MIN */ + if(CY_GET_REG8(USBFS_wValueHi) == USBFS_VOLUME_CONTROL) + { + /* Entity ID Control Selector is VOLUME, */ + USBFS_currentTD.wCount = USBFS_VOLUME_LEN; + USBFS_currentTD.pData = &USBFS_minimumVolume[0]; + requestHandled = USBFS_InitControlRead(); + } + break; + case USBFS_GET_MAX: /* GET_MAX */ + if(CY_GET_REG8(USBFS_wValueHi) == USBFS_VOLUME_CONTROL) + { + /* Entity ID Control Selector is VOLUME, */ + USBFS_currentTD.wCount = USBFS_VOLUME_LEN; + USBFS_currentTD.pData = &USBFS_maximumVolume[0]; + requestHandled = USBFS_InitControlRead(); + } + break; + case USBFS_GET_RES: /* GET_RES */ + if(CY_GET_REG8(USBFS_wValueHi) == USBFS_VOLUME_CONTROL) + { + /* Entity ID Control Selector is VOLUME, */ + USBFS_currentTD.wCount = USBFS_VOLUME_LEN; + USBFS_currentTD.pData = &USBFS_resolutionVolume[0]; + requestHandled = USBFS_InitControlRead(); + } + break; + /* The contents of the status message is reserved for future use. + * For the time being, a null packet should be returned in the data stage of the + * control transfer, and the received null packet should be ACKed. + */ + case USBFS_GET_STAT: + USBFS_currentTD.wCount = 0u; + requestHandled = USBFS_InitControlWrite(); + + #endif /* End USBFS_ENABLE_AUDIO_STREAMING */ + + /* `#START AUDIO_WRITE_REQUESTS` Place other request handler here */ + + /* `#END` */ + break; + default: + break; + } + } + else + { /* USBFS_RQST_RCPT_OTHER */ + } + } + else if ((CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_DIR_MASK) == \ + USBFS_RQST_DIR_H2D) + { + /* Control Write */ + if((CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_RCPT_MASK) == \ + USBFS_RQST_RCPT_EP) + { + /* Endpoint */ + switch (CY_GET_REG8(USBFS_bRequest)) + { + case USBFS_SET_CUR: + #if defined(USBFS_ENABLE_AUDIO_STREAMING) + if(CY_GET_REG8(USBFS_wValueHi) == USBFS_SAMPLING_FREQ_CONTROL) + { + /* Endpoint Control Selector is Sampling Frequency */ + USBFS_currentTD.wCount = USBFS_SAMPLE_FREQ_LEN; + USBFS_currentTD.pData = USBFS_currentSampleFrequency[epNumber]; + requestHandled = USBFS_InitControlWrite(); + USBFS_frequencyChanged = epNumber; + } + #endif /* End USBFS_ENABLE_AUDIO_STREAMING */ + + /* `#START AUDIO_SAMPLING_FREQ_REQUESTS` Place other request handler here */ + + /* `#END` */ + break; + default: + break; + } + } + else if((CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_RCPT_MASK) == \ + USBFS_RQST_RCPT_IFC) + { + /* Interface or Entity ID */ + switch (CY_GET_REG8(USBFS_bRequest)) + { + case USBFS_SET_CUR: + #if defined(USBFS_ENABLE_AUDIO_STREAMING) + if(CY_GET_REG8(USBFS_wValueHi) == USBFS_MUTE_CONTROL) + { + /* `#START MUTE_SET_REQUEST` Place multi-channel handler here */ + + /* `#END` */ + + /* Entity ID Control Selector is MUTE */ + USBFS_currentTD.wCount = 1u; + USBFS_currentTD.pData = &USBFS_currentMute; + requestHandled = USBFS_InitControlWrite(); + } + else if(CY_GET_REG8(USBFS_wValueHi) == USBFS_VOLUME_CONTROL) + { + /* `#START VOLUME_CONTROL_SET_REQUEST` Place multi-channel handler here */ + + /* `#END` */ + + /* Entity ID Control Selector is VOLUME */ + USBFS_currentTD.wCount = USBFS_VOLUME_LEN; + USBFS_currentTD.pData = USBFS_currentVolume; + requestHandled = USBFS_InitControlWrite(); + } + else + { + /* `#START OTHER_SET_CUR_REQUESTS` Place other request handler here */ + + /* `#END` */ + } + #endif /* End USBFS_ENABLE_AUDIO_STREAMING */ + + /* `#START AUDIO_CONTROL_SEL_REQUESTS` Place other request handler here */ + + /* `#END` */ + break; + default: + break; + } + } + else + { /* USBFS_RQST_RCPT_OTHER */ + } + } + else + { /* requestHandled is initialized as FALSE by default */ + } + + return(requestHandled); +} + + +#endif /* USER_SUPPLIED_AUDIO_HANDLER */ + + +/******************************************************************************* +* Additional user functions supporting AUDIO Requests +********************************************************************************/ + +/* `#START AUDIO_FUNCTIONS` Place any additional functions here */ + +/* `#END` */ + +#endif /* End USBFS_ENABLE_AUDIO_CLASS*/ + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_audio.h b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_audio.h new file mode 100755 index 0000000..1e6186b --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_audio.h @@ -0,0 +1,95 @@ +/******************************************************************************* +* File Name: USBFS_audio.h +* Version 2.60 +* +* Description: +* Header File for the USFS component. Contains prototypes and constant values. +* +******************************************************************************** +* Copyright 2008-2013, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#if !defined(CY_USBFS_USBFS_audio_H) +#define CY_USBFS_USBFS_audio_H + +#include "cytypes.h" + + +/*************************************** +* Custom Declarations +***************************************/ + +/* `#START CUSTOM_CONSTANTS` Place your declaration here */ + +/* `#END` */ + + +/*************************************** +* Constants for USBFS_audio API. +***************************************/ + +/* Audio Class-Specific Request Codes (AUDIO Table A-9) */ +#define USBFS_REQUEST_CODE_UNDEFINED (0x00u) +#define USBFS_SET_CUR (0x01u) +#define USBFS_GET_CUR (0x81u) +#define USBFS_SET_MIN (0x02u) +#define USBFS_GET_MIN (0x82u) +#define USBFS_SET_MAX (0x03u) +#define USBFS_GET_MAX (0x83u) +#define USBFS_SET_RES (0x04u) +#define USBFS_GET_RES (0x84u) +#define USBFS_SET_MEM (0x05u) +#define USBFS_GET_MEM (0x85u) +#define USBFS_GET_STAT (0xFFu) + +/* Endpoint Control Selectors (AUDIO Table A-19) */ +#define USBFS_EP_CONTROL_UNDEFINED (0x00u) +#define USBFS_SAMPLING_FREQ_CONTROL (0x01u) +#define USBFS_PITCH_CONTROL (0x02u) + +/* Feature Unit Control Selectors (AUDIO Table A-11) */ +#define USBFS_FU_CONTROL_UNDEFINED (0x00u) +#define USBFS_MUTE_CONTROL (0x01u) +#define USBFS_VOLUME_CONTROL (0x02u) +#define USBFS_BASS_CONTROL (0x03u) +#define USBFS_MID_CONTROL (0x04u) +#define USBFS_TREBLE_CONTROL (0x05u) +#define USBFS_GRAPHIC_EQUALIZER_CONTROL (0x06u) +#define USBFS_AUTOMATIC_GAIN_CONTROL (0x07u) +#define USBFS_DELAY_CONTROL (0x08u) +#define USBFS_BASS_BOOST_CONTROL (0x09u) +#define USBFS_LOUDNESS_CONTROL (0x0Au) + +#define USBFS_SAMPLE_FREQ_LEN (3u) +#define USBFS_VOLUME_LEN (2u) + +#if !defined(USER_SUPPLIED_DEFAULT_VOLUME_VALUE) + #define USBFS_VOL_MIN_MSB (0x80u) + #define USBFS_VOL_MIN_LSB (0x01u) + #define USBFS_VOL_MAX_MSB (0x7Fu) + #define USBFS_VOL_MAX_LSB (0xFFu) + #define USBFS_VOL_RES_MSB (0x00u) + #define USBFS_VOL_RES_LSB (0x01u) +#endif /* USER_SUPPLIED_DEFAULT_VOLUME_VALUE */ + + +/*************************************** +* External data references +***************************************/ + +extern volatile uint8 USBFS_currentSampleFrequency[USBFS_MAX_EP] + [USBFS_SAMPLE_FREQ_LEN]; +extern volatile uint8 USBFS_frequencyChanged; +extern volatile uint8 USBFS_currentMute; +extern volatile uint8 USBFS_currentVolume[USBFS_VOLUME_LEN]; +extern volatile uint8 USBFS_minimumVolume[USBFS_VOLUME_LEN]; +extern volatile uint8 USBFS_maximumVolume[USBFS_VOLUME_LEN]; +extern volatile uint8 USBFS_resolutionVolume[USBFS_VOLUME_LEN]; + +#endif /* End CY_USBFS_USBFS_audio_H */ + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_boot.c b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_boot.c new file mode 100755 index 0000000..2843057 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_boot.c @@ -0,0 +1,262 @@ +/******************************************************************************* +* File Name: USBFS_boot.c +* Version 2.60 +* +* Description: +* Boot loader API for USBFS Component. +* +* Note: +* +******************************************************************************** +* Copyright 2008-2013, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#include "USBFS.h" + +#if defined(CYDEV_BOOTLOADER_IO_COMP) && ((CYDEV_BOOTLOADER_IO_COMP == CyBtldr_USBFS) || \ + (CYDEV_BOOTLOADER_IO_COMP == CyBtldr_Custom_Interface)) + + +/*************************************** +* Bootloader defines +***************************************/ + +#define USBFS_CyBtLdrStarttimer(X, T) {USBFS_universalTime = T * 10; X = 0u;} +#define USBFS_CyBtLdrChecktimer(X) ((X++ < USBFS_universalTime) ? 1u : 0u) + +#define USBFS_BTLDR_OUT_EP (0x01u) +#define USBFS_BTLDR_IN_EP (0x02u) + + +/*************************************** +* Bootloader Variables +***************************************/ + +static uint16 USBFS_universalTime; +static uint8 USBFS_started = 0u; + + +/******************************************************************************* +* Function Name: USBFS_CyBtldrCommStart +******************************************************************************** +* +* Summary: +* Starts the component and enables the interrupt. +* +* Parameters: +* None. +* +* Return: +* None. +* +* Side Effects: +* This function starts the USB with 3V or 5V operation. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_CyBtldrCommStart(void) +{ + CyGlobalIntEnable; /* Enable Global Interrupts */ + + /*Start USBFS Operation/device 0 and with 5V or 3V operation depend on Voltage Configuration in DWR */ + USBFS_Start(0u, USBFS_DWR_VDDD_OPERATION); + + /* USB component started, the correct enumeration will be checked in first Read operation */ + USBFS_started = 1u; + +} + + +/******************************************************************************* +* Function Name: USBFS_CyBtldrCommStop. +******************************************************************************** +* +* Summary: +* Disable the component and disable the interrupt. +* +* Parameters: +* None. +* +* Return: +* None. +* +*******************************************************************************/ +void USBFS_CyBtldrCommStop(void) +{ + USBFS_Stop(); +} + + +/******************************************************************************* +* Function Name: USBFS_CyBtldrCommReset. +******************************************************************************** +* +* Summary: +* Resets the receive and transmit communication Buffers. +* +* Parameters: +* None. +* +* Return: +* None. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_CyBtldrCommReset(void) +{ + USBFS_EnableOutEP(USBFS_BTLDR_OUT_EP); /* Enable the OUT endpoint */ +} + + +/******************************************************************************* +* Function Name: USBFS_CyBtldrCommWrite. +******************************************************************************** +* +* Summary: +* Allows the caller to write data to the boot loader host. The function will +* handle polling to allow a block of data to be completely sent to the host +* device. +* +* Parameters: +* pData: A pointer to the block of data to send to the device +* size: The number of bytes to write. +* count: Pointer to an unsigned short variable to write the number of +* bytes actually written. +* timeOut: Number of units to wait before returning because of a timeout. +* +* Return: +* Returns the value that best describes the problem. +* +* Reentrant: +* No. +* +*******************************************************************************/ +cystatus USBFS_CyBtldrCommWrite(uint8 *pData, uint16 size, uint16 *count, uint8 timeOut) CYSMALL + +{ + uint16 time; + cystatus status; + + /* Enable IN transfer */ + USBFS_LoadInEP(USBFS_BTLDR_IN_EP, pData, USBFS_BTLDR_SIZEOF_READ_BUFFER); + + /* Start a timer to wait on. */ + USBFS_CyBtLdrStarttimer(time, timeOut); + + /* Wait for the master to read it. */ + while((USBFS_GetEPState(USBFS_BTLDR_IN_EP) == USBFS_IN_BUFFER_FULL) && \ + USBFS_CyBtLdrChecktimer(time)) + { + CyDelay(1u); /* 1ms delay */ + } + + if (USBFS_GetEPState(USBFS_BTLDR_IN_EP) == USBFS_IN_BUFFER_FULL) + { + status = CYRET_TIMEOUT; + } + else + { + *count = size; + status = CYRET_SUCCESS; + } + + return(status); +} + + +/******************************************************************************* +* Function Name: USBFS_CyBtldrCommRead. +******************************************************************************** +* +* Summary: +* Allows the caller to read data from the boot loader host. The function will +* handle polling to allow a block of data to be completely received from the +* host device. +* +* Parameters: +* pData: A pointer to the area to store the block of data received +* from the device. +* size: The number of bytes to read. +* count: Pointer to an unsigned short variable to write the number +* of bytes actually read. +* timeOut: Number of units to wait before returning because of a timeOut. +* Timeout is measured in 10s of ms. +* +* Return: +* Returns the value that best describes the problem. +* +* Reentrant: +* No. +* +*******************************************************************************/ +cystatus USBFS_CyBtldrCommRead(uint8 *pData, uint16 size, uint16 *count, uint8 timeOut) CYSMALL + +{ + cystatus status; + uint16 time; + + if(size > USBFS_BTLDR_SIZEOF_WRITE_BUFFER) + { + size = USBFS_BTLDR_SIZEOF_WRITE_BUFFER; + } + /* Start a timer to wait on. */ + USBFS_CyBtLdrStarttimer(time, timeOut); + + /* Wait on enumeration in first time */ + if(USBFS_started) + { + /* Wait for Device to enumerate */ + while(!USBFS_GetConfiguration() && USBFS_CyBtLdrChecktimer(time)) + { + CyDelay(1u); /* 1ms delay */ + } + /* Enable first OUT, if enumeration complete */ + if(USBFS_GetConfiguration()) + { + USBFS_IsConfigurationChanged(); /* Clear configuration changes state status */ + USBFS_CyBtldrCommReset(); + USBFS_started = 0u; + } + } + else /* Check for configuration changes, has been done by Host */ + { + if(USBFS_IsConfigurationChanged() != 0u) /* Host could send double SET_INTERFACE request or RESET */ + { + if(USBFS_GetConfiguration() != 0u) /* Init OUT endpoints when device reconfigured */ + { + USBFS_CyBtldrCommReset(); + } + } + } + /* Wait on next packet */ + while((USBFS_GetEPState(USBFS_BTLDR_OUT_EP) != USBFS_OUT_BUFFER_FULL) && \ + USBFS_CyBtLdrChecktimer(time)) + { + CyDelay(1u); /* 1ms delay */ + } + + /* OUT EP has completed */ + if (USBFS_GetEPState(USBFS_BTLDR_OUT_EP) == USBFS_OUT_BUFFER_FULL) + { + *count = USBFS_ReadOutEP(USBFS_BTLDR_OUT_EP, pData, size); + status = CYRET_SUCCESS; + } + else + { + *count = 0u; + status = CYRET_TIMEOUT; + } + return(status); +} + +#endif /* End CYDEV_BOOTLOADER_IO_COMP == CyBtldr_USBFS */ + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_cdc.c b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_cdc.c new file mode 100755 index 0000000..82951c8 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_cdc.c @@ -0,0 +1,706 @@ +/******************************************************************************* +* File Name: USBFS_cdc.c +* Version 2.60 +* +* Description: +* USB HID Class request handler. +* +* Note: +* +******************************************************************************** +* Copyright 2012-2013, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#include "USBFS.h" + +#if defined(USBFS_ENABLE_CDC_CLASS) + +#include "USBFS_cdc.h" +#include "USBFS_pvt.h" + + +/*************************************** +* CDC Variables +***************************************/ + +volatile uint8 USBFS_lineCoding[USBFS_LINE_CODING_SIZE]; +volatile uint8 USBFS_lineChanged; +volatile uint16 USBFS_lineControlBitmap; +volatile uint8 USBFS_cdc_data_in_ep; +volatile uint8 USBFS_cdc_data_out_ep; + + +/*************************************** +* Static Function Prototypes +***************************************/ +static uint16 USBFS_StrLen(const char8 string[]) ; + + +/*************************************** +* Custom Declarations +***************************************/ + +/* `#START CDC_CUSTOM_DECLARATIONS` Place your declaration here */ + +/* `#END` */ + + +/******************************************************************************* +* Function Name: USBFS_DispatchCDCClassRqst +******************************************************************************** +* +* Summary: +* This routine dispatches CDC class requests. +* +* Parameters: +* None. +* +* Return: +* requestHandled +* +* Global variables: +* USBFS_lineCoding: Contains the current line coding structure. +* It is set by the Host using SET_LINE_CODING request and returned to the +* user code by the USBFS_GetDTERate(), USBFS_GetCharFormat(), +* USBFS_GetParityType(), USBFS_GetDataBits() APIs. +* USBFS_lineControlBitmap: Contains the current control signal +* bitmap. It is set by the Host using SET_CONTROL_LINE request and returned +* to the user code by the USBFS_GetLineControl() API. +* USBFS_lineChanged: This variable is used as a flag for the +* USBFS_IsLineChanged() API, to be aware that Host has been sent request +* for changing Line Coding or Control Bitmap. +* +* Reentrant: +* No. +* +*******************************************************************************/ +uint8 USBFS_DispatchCDCClassRqst(void) +{ + uint8 requestHandled = USBFS_FALSE; + + if ((CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_DIR_MASK) == USBFS_RQST_DIR_D2H) + { /* Control Read */ + switch (CY_GET_REG8(USBFS_bRequest)) + { + case USBFS_CDC_GET_LINE_CODING: + USBFS_currentTD.count = USBFS_LINE_CODING_SIZE; + USBFS_currentTD.pData = USBFS_lineCoding; + requestHandled = USBFS_InitControlRead(); + break; + + /* `#START CDC_READ_REQUESTS` Place other request handler here */ + + /* `#END` */ + + default: /* requestHandled is initialized as FALSE by default */ + break; + } + } + else if ((CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_DIR_MASK) == \ + USBFS_RQST_DIR_H2D) + { /* Control Write */ + switch (CY_GET_REG8(USBFS_bRequest)) + { + case USBFS_CDC_SET_LINE_CODING: + USBFS_currentTD.count = USBFS_LINE_CODING_SIZE; + USBFS_currentTD.pData = USBFS_lineCoding; + USBFS_lineChanged |= USBFS_LINE_CODING_CHANGED; + requestHandled = USBFS_InitControlWrite(); + break; + + case USBFS_CDC_SET_CONTROL_LINE_STATE: + USBFS_lineControlBitmap = CY_GET_REG8(USBFS_wValueLo); + USBFS_lineChanged |= USBFS_LINE_CONTROL_CHANGED; + requestHandled = USBFS_InitNoDataControlTransfer(); + break; + + /* `#START CDC_WRITE_REQUESTS` Place other request handler here */ + + /* `#END` */ + + default: /* requestHandled is initialized as FALSE by default */ + break; + } + } + else + { /* requestHandled is initialized as FALSE by default */ + } + + return(requestHandled); +} + + +/*************************************** +* Optional CDC APIs +***************************************/ +#if (USBFS_ENABLE_CDC_CLASS_API != 0u) + + + /******************************************************************************* + * Function Name: USBFS_CDC_Init + ******************************************************************************** + * + * Summary: + * This function initialize the CDC interface to be ready for the receive data + * from the PC. + * + * Parameters: + * None. + * + * Return: + * None. + * + * Global variables: + * USBFS_lineChanged: Initialized to zero. + * USBFS_cdc_data_out_ep: Used as an OUT endpoint number. + * + * Reentrant: + * No. + * + *******************************************************************************/ + void USBFS_CDC_Init(void) + { + USBFS_lineChanged = 0u; + USBFS_EnableOutEP(USBFS_cdc_data_out_ep); + } + + + /******************************************************************************* + * Function Name: USBFS_PutData + ******************************************************************************** + * + * Summary: + * Sends a specified number of bytes from the location specified by a + * pointer to the PC. + * + * Parameters: + * pData: pointer to the buffer containing data to be sent. + * length: Specifies the number of bytes to send from the pData + * buffer. Maximum length will be limited by the maximum packet + * size for the endpoint. + * + * Return: + * None. + * + * Global variables: + * USBFS_cdc_data_in_ep: CDC IN endpoint number used for sending + * data. + * + * Reentrant: + * No. + * + *******************************************************************************/ + void USBFS_PutData(const uint8* pData, uint16 length) + { + /* Limits length to maximum packet size for the EP */ + if(length > USBFS_EP[USBFS_cdc_data_in_ep].bufferSize) + { + /* Caution: Data will be lost if length is greater than Max Packet Length */ + length = USBFS_EP[USBFS_cdc_data_in_ep].bufferSize; + /* Halt CPU in debug mode */ + CYASSERT(0u != 0u); + } + USBFS_LoadInEP(USBFS_cdc_data_in_ep, pData, length); + } + + + /******************************************************************************* + * Function Name: USBFS_StrLen + ******************************************************************************** + * + * Summary: + * Calculates length of a null terminated string. + * + * Parameters: + * string: pointer to the string. + * + * Return: + * Length of the string + * + *******************************************************************************/ + static uint16 USBFS_StrLen(const char8 string[]) + { + uint16 len = 0u; + + while (string[len] != (char8)0) + { + len++; + } + + return (len); + } + + + /******************************************************************************* + * Function Name: USBFS_PutString + ******************************************************************************** + * + * Summary: + * Sends a null terminated string to the PC. + * + * Parameters: + * string: pointer to the string to be sent to the PC + * + * Return: + * None. + * + * Global variables: + * USBFS_cdc_data_in_ep: CDC IN endpoint number used for sending + * data. + * + * Reentrant: + * No. + * + * Theory: + * This function will block if there is not enough memory to place the whole + * string, it will block until the entire string has been written to the + * transmit buffer. + * + *******************************************************************************/ + void USBFS_PutString(const char8 string[]) + { + uint16 str_length; + uint16 send_length; + uint16 buf_index = 0u; + + /* Get length of the null terminated string */ + str_length = USBFS_StrLen(string); + do + { + /* Limits length to maximum packet size for the EP */ + send_length = (str_length > USBFS_EP[USBFS_cdc_data_in_ep].bufferSize) ? + USBFS_EP[USBFS_cdc_data_in_ep].bufferSize : str_length; + /* Enable IN transfer */ + USBFS_LoadInEP(USBFS_cdc_data_in_ep, (const uint8 *)&string[buf_index], send_length); + str_length -= send_length; + + /* If more data are present to send */ + if(str_length > 0u) + { + buf_index += send_length; + /* Wait for the Host to read it. */ + while(USBFS_EP[USBFS_cdc_data_in_ep].apiEpState == + USBFS_IN_BUFFER_FULL) + { + ; + } + } + }while(str_length > 0u); + } + + + /******************************************************************************* + * Function Name: USBFS_PutChar + ******************************************************************************** + * + * Summary: + * Writes a single character to the PC. + * + * Parameters: + * txDataByte: Character to be sent to the PC. + * + * Return: + * None. + * + * Global variables: + * USBFS_cdc_data_in_ep: CDC IN endpoint number used for sending + * data. + * + * Reentrant: + * No. + * + *******************************************************************************/ + void USBFS_PutChar(char8 txDataByte) + { + uint8 dataByte; + dataByte = (uint8)txDataByte; + + USBFS_LoadInEP(USBFS_cdc_data_in_ep, &dataByte, 1u); + } + + + /******************************************************************************* + * Function Name: USBFS_PutCRLF + ******************************************************************************** + * + * Summary: + * Sends a carriage return (0x0D) and line feed (0x0A) to the PC + * + * Parameters: + * None. + * + * Return: + * None. + * + * Global variables: + * USBFS_cdc_data_in_ep: CDC IN endpoint number used for sending + * data. + * + * Reentrant: + * No. + * + *******************************************************************************/ + void USBFS_PutCRLF(void) + { + const uint8 CYCODE txData[] = {0x0Du, 0x0Au}; + + USBFS_LoadInEP(USBFS_cdc_data_in_ep, (const uint8 *)txData, 2u); + } + + + /******************************************************************************* + * Function Name: USBFS_GetCount + ******************************************************************************** + * + * Summary: + * This function returns the number of bytes that were received from the PC. + * + * Parameters: + * None. + * + * Return: + * Returns the number of received bytes. + * + * Global variables: + * USBFS_cdc_data_out_ep: CDC OUT endpoint number used. + * + *******************************************************************************/ + uint16 USBFS_GetCount(void) + { + uint16 bytesCount = 0u; + + if (USBFS_EP[USBFS_cdc_data_out_ep].apiEpState == USBFS_OUT_BUFFER_FULL) + { + bytesCount = USBFS_GetEPCount(USBFS_cdc_data_out_ep); + } + + return(bytesCount); + } + + + /******************************************************************************* + * Function Name: USBFS_DataIsReady + ******************************************************************************** + * + * Summary: + * Returns a nonzero value if the component received data or received + * zero-length packet. The GetAll() or GetData() API should be called to read + * data from the buffer and re-init OUT endpoint even when zero-length packet + * received. + * + * Parameters: + * None. + * + * Return: + * If the OUT packet received this function returns a nonzero value. + * Otherwise zero is returned. + * + * Global variables: + * USBFS_cdc_data_out_ep: CDC OUT endpoint number used. + * + *******************************************************************************/ + uint8 USBFS_DataIsReady(void) + { + return(USBFS_EP[USBFS_cdc_data_out_ep].apiEpState); + } + + + /******************************************************************************* + * Function Name: USBFS_CDCIsReady + ******************************************************************************** + * + * Summary: + * Returns a nonzero value if the component is ready to send more data to the + * PC. Otherwise returns zero. Should be called before sending new data to + * ensure the previous data has finished sending.This function returns the + * number of bytes that were received from the PC. + * + * Parameters: + * None. + * + * Return: + * If the buffer can accept new data then this function returns a nonzero value. + * Otherwise zero is returned. + * + * Global variables: + * USBFS_cdc_data_in_ep: CDC IN endpoint number used. + * + *******************************************************************************/ + uint8 USBFS_CDCIsReady(void) + { + return(USBFS_EP[USBFS_cdc_data_in_ep].apiEpState); + } + + + /******************************************************************************* + * Function Name: USBFS_GetData + ******************************************************************************** + * + * Summary: + * Gets a specified number of bytes from the input buffer and places it in a + * data array specified by the passed pointer. + * USBFS_DataIsReady() API should be called before, to be sure + * that data is received from the Host. + * + * Parameters: + * pData: Pointer to the data array where data will be placed. + * Length: Number of bytes to read into the data array from the RX buffer. + * Maximum length is limited by the the number of received bytes. + * + * Return: + * Number of bytes received. + * + * Global variables: + * USBFS_cdc_data_out_ep: CDC OUT endpoint number used. + * + * Reentrant: + * No. + * + *******************************************************************************/ + uint16 USBFS_GetData(uint8* pData, uint16 length) + { + return(USBFS_ReadOutEP(USBFS_cdc_data_out_ep, pData, length)); + } + + + /******************************************************************************* + * Function Name: USBFS_GetAll + ******************************************************************************** + * + * Summary: + * Gets all bytes of received data from the input buffer and places it into a + * specified data array. USBFS_DataIsReady() API should be called + * before, to be sure that data is received from the Host. + * + * Parameters: + * pData: Pointer to the data array where data will be placed. + * + * Return: + * Number of bytes received. + * + * Global variables: + * USBFS_cdc_data_out_ep: CDC OUT endpoint number used. + * USBFS_EP[].bufferSize: EP max packet size is used as a length + * to read all data from the EP buffer. + * + * Reentrant: + * No. + * + *******************************************************************************/ + uint16 USBFS_GetAll(uint8* pData) + { + return (USBFS_ReadOutEP(USBFS_cdc_data_out_ep, pData, + USBFS_EP[USBFS_cdc_data_out_ep].bufferSize)); + } + + + /******************************************************************************* + * Function Name: USBFS_GetChar + ******************************************************************************** + * + * Summary: + * Reads one byte of received data from the buffer. + * + * Parameters: + * None. + * + * Return: + * Received one character. + * + * Global variables: + * USBFS_cdc_data_out_ep: CDC OUT endpoint number used. + * + * Reentrant: + * No. + * + *******************************************************************************/ + uint8 USBFS_GetChar(void) + { + uint8 rxData; + + (void) USBFS_ReadOutEP(USBFS_cdc_data_out_ep, &rxData, 1u); + + return(rxData); + } + + /******************************************************************************* + * Function Name: USBFS_IsLineChanged + ******************************************************************************** + * + * Summary: + * This function returns clear on read status of the line. + * + * Parameters: + * None. + * + * Return: + * If SET_LINE_CODING or CDC_SET_CONTROL_LINE_STATE request received then not + * zero value returned. Otherwise zero is returned. + * + * Global variables: + * USBFS_transferState - it is checked to be sure then OUT data + * phase has been complete, and data written to the lineCoding or Control + * Bitmap buffer. + * USBFS_lineChanged: used as a flag to be aware that Host has been + * sent request for changing Line Coding or Control Bitmap. + * + *******************************************************************************/ + uint8 USBFS_IsLineChanged(void) + { + uint8 state = 0u; + + /* transferState is checked to be sure then OUT data phase has been complete */ + if(USBFS_transferState == USBFS_TRANS_STATE_IDLE) + { + if(USBFS_lineChanged != 0u) + { + state = USBFS_lineChanged; + USBFS_lineChanged = 0u; + } + } + + return(state); + } + + + /******************************************************************************* + * Function Name: USBFS_GetDTERate + ******************************************************************************** + * + * Summary: + * Returns the data terminal rate set for this port in bits per second. + * + * Parameters: + * None. + * + * Return: + * Returns a uint32 value of the data rate in bits per second. + * + * Global variables: + * USBFS_lineCoding: First four bytes converted to uint32 + * depend on compiler, and returned as a data rate. + * + *******************************************************************************/ + uint32 USBFS_GetDTERate(void) + { + uint32 rate; + + rate = USBFS_lineCoding[USBFS_LINE_CODING_RATE + 3u]; + rate = (rate << 8u) | USBFS_lineCoding[USBFS_LINE_CODING_RATE + 2u]; + rate = (rate << 8u) | USBFS_lineCoding[USBFS_LINE_CODING_RATE + 1u]; + rate = (rate << 8u) | USBFS_lineCoding[USBFS_LINE_CODING_RATE]; + + return(rate); + } + + + /******************************************************************************* + * Function Name: USBFS_GetCharFormat + ******************************************************************************** + * + * Summary: + * Returns the number of stop bits. + * + * Parameters: + * None. + * + * Return: + * Returns the number of stop bits. + * + * Global variables: + * USBFS_lineCoding: used to get a parameter. + * + *******************************************************************************/ + uint8 USBFS_GetCharFormat(void) + { + return(USBFS_lineCoding[USBFS_LINE_CODING_STOP_BITS]); + } + + + /******************************************************************************* + * Function Name: USBFS_GetParityType + ******************************************************************************** + * + * Summary: + * Returns the parity type for the CDC port. + * + * Parameters: + * None. + * + * Return: + * Returns the parity type. + * + * Global variables: + * USBFS_lineCoding: used to get a parameter. + * + *******************************************************************************/ + uint8 USBFS_GetParityType(void) + { + return(USBFS_lineCoding[USBFS_LINE_CODING_PARITY]); + } + + + /******************************************************************************* + * Function Name: USBFS_GetDataBits + ******************************************************************************** + * + * Summary: + * Returns the number of data bits for the CDC port. + * + * Parameters: + * None. + * + * Return: + * Returns the number of data bits. + * The number of data bits can be 5, 6, 7, 8 or 16. + * + * Global variables: + * USBFS_lineCoding: used to get a parameter. + * + *******************************************************************************/ + uint8 USBFS_GetDataBits(void) + { + return(USBFS_lineCoding[USBFS_LINE_CODING_DATA_BITS]); + } + + + /******************************************************************************* + * Function Name: USBFS_GetLineControl + ******************************************************************************** + * + * Summary: + * Returns Line control bitmap. + * + * Parameters: + * None. + * + * Return: + * Returns Line control bitmap. + * + * Global variables: + * USBFS_lineControlBitmap: used to get a parameter. + * + *******************************************************************************/ + uint16 USBFS_GetLineControl(void) + { + return(USBFS_lineControlBitmap); + } + +#endif /* End USBFS_ENABLE_CDC_CLASS_API*/ + + +/******************************************************************************* +* Additional user functions supporting CDC Requests +********************************************************************************/ + +/* `#START CDC_FUNCTIONS` Place any additional functions here */ + +/* `#END` */ + +#endif /* End USBFS_ENABLE_CDC_CLASS*/ + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_cdc.h b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_cdc.h new file mode 100755 index 0000000..334bc58 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_cdc.h @@ -0,0 +1,92 @@ +/******************************************************************************* +* File Name: USBFS_cdc.h +* Version 2.60 +* +* Description: +* Header File for the USFS component. +* Contains CDC class prototypes and constant values. +* +******************************************************************************** +* Copyright 2012-2013, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#if !defined(CY_USBFS_USBFS_cdc_H) +#define CY_USBFS_USBFS_cdc_H + +#include "cytypes.h" + + +/*************************************** +* Prototypes of the USBFS_cdc API. +***************************************/ + +#if (USBFS_ENABLE_CDC_CLASS_API != 0u) + void USBFS_CDC_Init(void) ; + void USBFS_PutData(const uint8* pData, uint16 length) ; + void USBFS_PutString(const char8 string[]) ; + void USBFS_PutChar(char8 txDataByte) ; + void USBFS_PutCRLF(void) ; + uint16 USBFS_GetCount(void) ; + uint8 USBFS_CDCIsReady(void) ; + uint8 USBFS_DataIsReady(void) ; + uint16 USBFS_GetData(uint8* pData, uint16 length) ; + uint16 USBFS_GetAll(uint8* pData) ; + uint8 USBFS_GetChar(void) ; + uint8 USBFS_IsLineChanged(void) ; + uint32 USBFS_GetDTERate(void) ; + uint8 USBFS_GetCharFormat(void) ; + uint8 USBFS_GetParityType(void) ; + uint8 USBFS_GetDataBits(void) ; + uint16 USBFS_GetLineControl(void) ; +#endif /* End USBFS_ENABLE_CDC_CLASS_API*/ + + +/*************************************** +* Constants for USBFS_cdc API. +***************************************/ + +/* CDC Class-Specific Request Codes (CDC ver 1.2 Table 19) */ +#define USBFS_CDC_SET_LINE_CODING (0x20u) +#define USBFS_CDC_GET_LINE_CODING (0x21u) +#define USBFS_CDC_SET_CONTROL_LINE_STATE (0x22u) + +#define USBFS_LINE_CODING_CHANGED (0x01u) +#define USBFS_LINE_CONTROL_CHANGED (0x02u) + +#define USBFS_1_STOPBIT (0x00u) +#define USBFS_1_5_STOPBITS (0x01u) +#define USBFS_2_STOPBITS (0x02u) + +#define USBFS_PARITY_NONE (0x00u) +#define USBFS_PARITY_ODD (0x01u) +#define USBFS_PARITY_EVEN (0x02u) +#define USBFS_PARITY_MARK (0x03u) +#define USBFS_PARITY_SPACE (0x04u) + +#define USBFS_LINE_CODING_SIZE (0x07u) +#define USBFS_LINE_CODING_RATE (0x00u) +#define USBFS_LINE_CODING_STOP_BITS (0x04u) +#define USBFS_LINE_CODING_PARITY (0x05u) +#define USBFS_LINE_CODING_DATA_BITS (0x06u) + +#define USBFS_LINE_CONTROL_DTR (0x01u) +#define USBFS_LINE_CONTROL_RTS (0x02u) + + +/*************************************** +* External data references +***************************************/ + +extern volatile uint8 USBFS_lineCoding[USBFS_LINE_CODING_SIZE]; +extern volatile uint8 USBFS_lineChanged; +extern volatile uint16 USBFS_lineControlBitmap; +extern volatile uint8 USBFS_cdc_data_in_ep; +extern volatile uint8 USBFS_cdc_data_out_ep; + +#endif /* End CY_USBFS_USBFS_cdc_H */ + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_cdc.inf b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_cdc.inf new file mode 100755 index 0000000..c3477c2 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_cdc.inf @@ -0,0 +1,122 @@ +;****************************************************************************** +; File Name: USBFS_cdc.inf +; Version 2.60 +; +; Description: +; Windows USB CDC setup file for USBUART Device. +; +;****************************************************************************** +; Copyright 2007-2013, Cypress Semiconductor Corporation. All rights reserved. +; You may use this file only in accordance with the license, terms, conditions, +; disclaimers, and limitations in the end user license agreement accompanying +; the software package with which this file was provided. +;****************************************************************************** + +[Version] +Signature="$Windows NT$" +Class=Ports +ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} +Provider=%PROVIDER% +LayoutFile=layout.inf +DriverVer=03/05/2007,2.0.0000.0 + +[Manufacturer] +%MFGNAME%=DeviceList, NTx86, NTia64, NTamd64 + +[DestinationDirs] +DefaultDestDir=12 + +[SourceDisksFiles] + +[SourceDisksNames] + +[DeviceList.NTx86] +%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232 + +[DeviceList.NTia64] +%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232 + +[DeviceList.NTamd64] +%DESCRIPTION%=DriverInstall, USB\VID_04B4&PID_F232 + + +;------------------------------------------------------------------------------ +; 32 bit section for Windows 2000/2003/XP/Vista +;------------------------------------------------------------------------------ + +[DriverInstall.NTx86] +include=mdmcpq.inf +CopyFiles=DriverCopyFiles +AddReg=DriverInstall.NTx86.AddReg + +[DriverCopyFiles] +usbser.sys,,,0x20 + +[DriverInstall.NTx86.AddReg] +HKR,,DevLoader,,*ntkern +HKR,,NTMPDriver,,usbser.sys +HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" + +[DriverInstall.NTx86.Services] +AddService=usbser, 0x00000002, DriverService + +;------------------------------------------------------------------------------ +; 64 bit section for Intel Itanium based systems +;------------------------------------------------------------------------------ + +[DriverInstall.NTia64] +include=mdmcpq.inf +CopyFiles=DriverCopyFiles +AddReg=DriverInstall.NTia64.AddReg + +[DriverCopyFiles] +usbser.sys,,,0x20 + +[DriverInstall.NTia64.AddReg] +HKR,,DevLoader,,*ntkern +HKR,,NTMPDriver,,usbser.sys +HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" + +[DriverInstall.NTia64.Services] +AddService=usbser, 0x00000002, DriverService + +;------------------------------------------------------------------------------ +; 64 bit section for AMD64 and Intel EM64T based systems +;------------------------------------------------------------------------------ + +[DriverInstall.NTamd64] +include=mdmcpq.inf +CopyFiles=DriverCopyFiles +AddReg=DriverInstall.NTamd64.AddReg + +[DriverCopyFiles] +usbser.sys,,,0x20 + +[DriverInstall.NTamd64.AddReg] +HKR,,DevLoader,,*ntkern +HKR,,NTMPDriver,,usbser.sys +HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" + +[DriverInstall.NTamd64.Services] +AddService=usbser, 0x00000002, DriverService + +;------------------------------------------------------------------------------ +; +;------------------------------------------------------------------------------ + +[DriverService] +DisplayName=%SERVICE% +ServiceType=1 +StartType=3 +ErrorControl=1 +ServiceBinary=%12%\usbser.sys + +;------------------------------------------------------------------------------ +; String Definitions +;------------------------------------------------------------------------------ + +[Strings] +PROVIDER="Cypress" +MFGNAME="Cypress Semiconductor Corporation" +DESCRIPTION="Cypress USB UART" +SERVICE="USB UART" diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_cls.c b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_cls.c new file mode 100755 index 0000000..7bbd8d1 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_cls.c @@ -0,0 +1,107 @@ +/******************************************************************************* +* File Name: USBFS_cls.c +* Version 2.60 +* +* Description: +* USB Class request handler. +* +* Note: +* +******************************************************************************** +* Copyright 2008-2013, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#include "USBFS.h" + +#if(USBFS_EXTERN_CLS == USBFS_FALSE) + +#include "USBFS_pvt.h" + + +/*************************************** +* User Implemented Class Driver Declarations. +***************************************/ +/* `#START USER_DEFINED_CLASS_DECLARATIONS` Place your declaration here */ + +/* `#END` */ + + +/******************************************************************************* +* Function Name: USBFS_DispatchClassRqst +******************************************************************************** +* Summary: +* This routine dispatches class specific requests depend on interface class. +* +* Parameters: +* None. +* +* Return: +* requestHandled. +* +* Reentrant: +* No. +* +*******************************************************************************/ +uint8 USBFS_DispatchClassRqst(void) +{ + uint8 requestHandled = USBFS_FALSE; + uint8 interfaceNumber = 0u; + + switch(CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_RCPT_MASK) + { + case USBFS_RQST_RCPT_IFC: /* Class-specific request directed to an interface */ + interfaceNumber = CY_GET_REG8(USBFS_wIndexLo); /* wIndexLo contain Interface number */ + break; + case USBFS_RQST_RCPT_EP: /* Class-specific request directed to the endpoint */ + /* Find related interface to the endpoint, wIndexLo contain EP number */ + interfaceNumber = + USBFS_EP[CY_GET_REG8(USBFS_wIndexLo) & USBFS_DIR_UNUSED].interface; + break; + default: /* RequestHandled is initialized as FALSE by default */ + break; + } + /* Handle Class request depend on interface type */ + switch(USBFS_interfaceClass[interfaceNumber]) + { + case USBFS_CLASS_HID: + #if defined(USBFS_ENABLE_HID_CLASS) + requestHandled = USBFS_DispatchHIDClassRqst(); + #endif /* USBFS_ENABLE_HID_CLASS */ + break; + case USBFS_CLASS_AUDIO: + #if defined(USBFS_ENABLE_AUDIO_CLASS) + requestHandled = USBFS_DispatchAUDIOClassRqst(); + #endif /* USBFS_ENABLE_HID_CLASS */ + break; + case USBFS_CLASS_CDC: + #if defined(USBFS_ENABLE_CDC_CLASS) + requestHandled = USBFS_DispatchCDCClassRqst(); + #endif /* USBFS_ENABLE_CDC_CLASS */ + break; + default: /* requestHandled is initialized as FALSE by default */ + break; + } + + /* `#START USER_DEFINED_CLASS_CODE` Place your Class request here */ + + /* `#END` */ + + return(requestHandled); +} + + +/******************************************************************************* +* Additional user functions supporting Class Specific Requests +********************************************************************************/ + +/* `#START CLASS_SPECIFIC_FUNCTIONS` Place any additional functions here */ + +/* `#END` */ + +#endif /* USBFS_EXTERN_CLS */ + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_descr.c b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_descr.c new file mode 100755 index 0000000..cce3cf3 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_descr.c @@ -0,0 +1,319 @@ +/******************************************************************************* +* File Name: USBFS_descr.c +* Version 2.60 +* +* Description: +* USB descriptors and storage. +* +* Note: +* +******************************************************************************** +* Copyright 2008-2013, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#include "USBFS.h" +#include "USBFS_pvt.h" + + +/***************************************************************************** +* User supplied descriptors. If you want to specify your own descriptors, +* remove the comments around the define USER_SUPPLIED_DESCRIPTORS below and +* add your descriptors. +*****************************************************************************/ +/* `#START USER_DESCRIPTORS_DECLARATIONS` Place your declaration here */ + +/* `#END` */ + + +/*************************************** +* USB Customizer Generated Descriptors +***************************************/ + +#if !defined(USER_SUPPLIED_DESCRIPTORS) +/********************************************************************* +* Device Descriptors +*********************************************************************/ +const uint8 CYCODE USBFS_DEVICE0_DESCR[18u] = { +/* Descriptor Length */ 0x12u, +/* DescriptorType: DEVICE */ 0x01u, +/* bcdUSB (ver 2.0) */ 0x00u, 0x02u, +/* bDeviceClass */ 0x00u, +/* bDeviceSubClass */ 0x00u, +/* bDeviceProtocol */ 0x00u, +/* bMaxPacketSize0 */ 0x08u, +/* idVendor */ 0xB4u, 0x04u, +/* idProduct */ 0x37u, 0x13u, +/* bcdDevice */ 0x00u, 0x30u, +/* iManufacturer */ 0x02u, +/* iProduct */ 0x01u, +/* iSerialNumber */ 0x80u, +/* bNumConfigurations */ 0x01u +}; +/********************************************************************* +* Config Descriptor +*********************************************************************/ +const uint8 CYCODE USBFS_DEVICE0_CONFIGURATION0_DESCR[41u] = { +/* Config Descriptor Length */ 0x09u, +/* DescriptorType: CONFIG */ 0x02u, +/* wTotalLength */ 0x29u, 0x00u, +/* bNumInterfaces */ 0x01u, +/* bConfigurationValue */ 0x01u, +/* iConfiguration */ 0x00u, +/* bmAttributes */ 0x80u, +/* bMaxPower */ 0xFAu, +/********************************************************************* +* Interface Descriptor +*********************************************************************/ +/* Interface Descriptor Length */ 0x09u, +/* DescriptorType: INTERFACE */ 0x04u, +/* bInterfaceNumber */ 0x00u, +/* bAlternateSetting */ 0x00u, +/* bNumEndpoints */ 0x02u, +/* bInterfaceClass */ 0x03u, +/* bInterfaceSubClass */ 0x00u, +/* bInterfaceProtocol */ 0x00u, +/* iInterface */ 0x00u, +/********************************************************************* +* HID Class Descriptor +*********************************************************************/ +/* HID Class Descriptor Length */ 0x09u, +/* DescriptorType: HID_CLASS */ 0x21u, +/* bcdHID */ 0x11u, 0x01u, +/* bCountryCode */ 0x00u, +/* bNumDescriptors */ 0x01u, +/* bDescriptorType */ 0x22u, +/* wDescriptorLength (LSB) */ USBFS_HID_RPT_1_SIZE_LSB, +/* wDescriptorLength (MSB) */ USBFS_HID_RPT_1_SIZE_MSB, +/********************************************************************* +* Endpoint Descriptor +*********************************************************************/ +/* Endpoint Descriptor Length */ 0x07u, +/* DescriptorType: ENDPOINT */ 0x05u, +/* bEndpointAddress */ 0x01u, +/* bmAttributes */ 0x03u, +/* wMaxPacketSize */ 0x40u, 0x00u, +/* bInterval */ 0x80u, +/********************************************************************* +* Endpoint Descriptor +*********************************************************************/ +/* Endpoint Descriptor Length */ 0x07u, +/* DescriptorType: ENDPOINT */ 0x05u, +/* bEndpointAddress */ 0x82u, +/* bmAttributes */ 0x03u, +/* wMaxPacketSize */ 0x40u, 0x00u, +/* bInterval */ 0x80u +}; + +/********************************************************************* +* String Descriptor Table +*********************************************************************/ +const uint8 CYCODE USBFS_STRING_DESCRIPTORS[45u] = { +/********************************************************************* +* Language ID Descriptor +*********************************************************************/ +/* Descriptor Length */ 0x04u, +/* DescriptorType: STRING */ 0x03u, +/* Language Id */ 0x09u, 0x04u, +/********************************************************************* +* String Descriptor: "SCSI2SD" +*********************************************************************/ +/* Descriptor Length */ 0x10u, +/* DescriptorType: STRING */ 0x03u, + (uint8)'S', 0u,(uint8)'C', 0u,(uint8)'S', 0u,(uint8)'I', 0u,(uint8)'2', 0u, + (uint8)'S', 0u,(uint8)'D', 0u, +/********************************************************************* +* String Descriptor: "codesrc.com" +*********************************************************************/ +/* Descriptor Length */ 0x18u, +/* DescriptorType: STRING */ 0x03u, + (uint8)'c', 0u,(uint8)'o', 0u,(uint8)'d', 0u,(uint8)'e', 0u,(uint8)'s', 0u, + (uint8)'r', 0u,(uint8)'c', 0u,(uint8)'.', 0u,(uint8)'c', 0u,(uint8)'o', 0u, + (uint8)'m', 0u, +/*********************************************************************/ +/* Marks the end of the list. */ 0x00u}; +/*********************************************************************/ + +/********************************************************************* +* Serial Number String Descriptor +*********************************************************************/ +const uint8 CYCODE USBFS_SN_STRING_DESCRIPTOR[10] = { +/* Descriptor Length */ 0x0Au, +/* DescriptorType: STRING */ 0x03u, +(uint8)'1', 0u,(uint8)'2', 0u,(uint8)'3', 0u,(uint8)'4', 0u +}; + +/********************************************************************* +* HID Report Descriptor: Generic HID +*********************************************************************/ +const uint8 CYCODE USBFS_HIDREPORT_DESCRIPTOR1[40u] = { +/* Descriptor Size (Not part of descriptor)*/ USBFS_HID_RPT_1_SIZE_LSB, +USBFS_HID_RPT_1_SIZE_MSB, +/* USAGE_PAGE */ 0x05u, 0x01u, +/* USAGE */ 0x09u, 0x00u, +/* COLLECTION */ 0xA1u, 0x00u, +/* USAGE */ 0x09u, 0x00u, +/* COLLECTION */ 0xA1u, 0x00u, +/* USAGE */ 0x09u, 0x00u, +/* LOGICAL_MINIMUM */ 0x15u, 0x00u, +/* LOGICAL_MAXIMUM */ 0x25u, 0xFFu, +/* REPORT_SIZE */ 0x75u, 0x08u, +/* REPORT_COUNT */ 0x95u, 0x40u, +/* OUTPUT */ 0x91u, 0x02u, +/* USAGE */ 0x09u, 0x00u, +/* LOGICAL_MINIMUM */ 0x15u, 0x00u, +/* LOGICAL_MAXIMUM */ 0x25u, 0xFFu, +/* REPORT_SIZE */ 0x75u, 0x08u, +/* REPORT_COUNT */ 0x95u, 0x40u, +/* INPUT */ 0x81u, 0x02u, +/* END_COLLECTION */ 0xC0u, +/* END_COLLECTION */ 0xC0u, +/*********************************************************************/ +/* End of the HID Report Descriptor */ 0x00u, 0x00u}; +/*********************************************************************/ + +#if !defined(USER_DEFINE_USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_HID_RPT_STORAGE) +/********************************************************************* +* HID Input Report Storage +*********************************************************************/ +T_USBFS_XFER_STATUS_BLOCK USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_IN_RPT_SCB; +uint8 USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_IN_BUF[ + USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_IN_BUF_SIZE]; + +/********************************************************************* +* HID Input Report TD Table +*********************************************************************/ +const T_USBFS_TD CYCODE USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_IN_RPT_TABLE[1u] = { + {USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_IN_BUF_SIZE, + &USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_IN_BUF[0u], + &USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_IN_RPT_SCB}, +}; +/********************************************************************* +* HID Output Report Storage +*********************************************************************/ +T_USBFS_XFER_STATUS_BLOCK USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_OUT_RPT_SCB; +uint8 USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_OUT_BUF[ + USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_OUT_BUF_SIZE]; + +/********************************************************************* +* HID Output Report TD Table +*********************************************************************/ +const T_USBFS_TD CYCODE USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_OUT_RPT_TABLE[1u] = { + {USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_OUT_BUF_SIZE, + &USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_OUT_BUF[0u], + &USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_OUT_RPT_SCB}, +}; +/********************************************************************* +* HID Report Look Up Table This table has four entries: +* IN Report Table +* OUT Report Table +* Feature Report Table +* HID Report Descriptor +* HID Class Descriptor +*********************************************************************/ +const T_USBFS_LUT CYCODE USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_TABLE[5u] = { + {0x00u, &USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_IN_RPT_TABLE}, + {0x00u, &USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_OUT_RPT_TABLE}, + {0x00u, NULL}, + {0x01u, (const void *)&USBFS_HIDREPORT_DESCRIPTOR1[0]}, + {0x01u, (const void *)&USBFS_DEVICE0_CONFIGURATION0_DESCR[18]} +}; +#endif /* USER_DEFINE_USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_HID_RPT_STORAGE */ + +/********************************************************************* +* Interface Dispatch Table -- Points to the Class Dispatch Tables +*********************************************************************/ +const T_USBFS_LUT CYCODE USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_TABLE[1u] = { + {USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_COUNT, + &USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_TABLE} +}; +/********************************************************************* +* Endpoint Setting Table -- This table contain the endpoint setting +* for each endpoint in the configuration. It +* contains the necessary information to +* configure the endpoint hardware for each +* interface and alternate setting. +*********************************************************************/ +const T_USBFS_EP_SETTINGS_BLOCK CYCODE USBFS_DEVICE0_CONFIGURATION0_EP_SETTINGS_TABLE[2u] = { +/* IFC ALT EPAddr bmAttr MaxPktSize Class ********************/ +{0x00u, 0x00u, 0x01u, 0x03u, 0x0040u, 0x03u}, +{0x00u, 0x00u, 0x82u, 0x03u, 0x0040u, 0x03u} +}; +const uint8 CYCODE USBFS_DEVICE0_CONFIGURATION0_INTERFACE_CLASS[1u] = { +0x03u +}; +/********************************************************************* +* Config Dispatch Table -- Points to the Config Descriptor and each of +* and endpoint setup table and to each +* interface table if it specifies a USB Class +*********************************************************************/ +const T_USBFS_LUT CYCODE USBFS_DEVICE0_CONFIGURATION0_TABLE[4u] = { + {0x01u, &USBFS_DEVICE0_CONFIGURATION0_DESCR}, + {0x02u, &USBFS_DEVICE0_CONFIGURATION0_EP_SETTINGS_TABLE}, + {0x01u, &USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_TABLE}, + {0x00u, &USBFS_DEVICE0_CONFIGURATION0_INTERFACE_CLASS} +}; +/********************************************************************* +* Device Dispatch Table -- Points to the Device Descriptor and each of +* and Configuration Tables for this Device +*********************************************************************/ +const T_USBFS_LUT CYCODE USBFS_DEVICE0_TABLE[2u] = { + {0x01u, &USBFS_DEVICE0_DESCR}, + {0x01u, &USBFS_DEVICE0_CONFIGURATION0_TABLE} +}; +/********************************************************************* +* Device Table -- Indexed by the device number. +*********************************************************************/ +const T_USBFS_LUT CYCODE USBFS_TABLE[1u] = { + {0x01u, &USBFS_DEVICE0_TABLE} +}; + +#endif /* USER_SUPPLIED_DESCRIPTORS */ + +#if defined(USBFS_ENABLE_MSOS_STRING) + + /****************************************************************************** + * USB Microsoft OS String Descriptor + * "MSFT" identifies a Microsoft host + * "100" specifies version 1.00 + * USBFS_GET_EXTENDED_CONFIG_DESCRIPTOR becomes the bRequest value + * in a host vendor device/class request + ******************************************************************************/ + + const uint8 CYCODE USBFS_MSOS_DESCRIPTOR[USBFS_MSOS_DESCRIPTOR_LENGTH] = { + /* Descriptor Length */ 0x12u, + /* DescriptorType: STRING */ 0x03u, + /* qwSignature - "MSFT100" */ (uint8)'M', 0u, (uint8)'S', 0u, (uint8)'F', 0u, (uint8)'T', 0u, + (uint8)'1', 0u, (uint8)'0', 0u, (uint8)'0', 0u, + /* bMS_VendorCode: */ USBFS_GET_EXTENDED_CONFIG_DESCRIPTOR, + /* bPad */ 0x00u + }; + + /* Extended Configuration Descriptor */ + + const uint8 CYCODE USBFS_MSOS_CONFIGURATION_DESCR[USBFS_MSOS_CONF_DESCR_LENGTH] = { + /* Length of the descriptor 4 bytes */ 0x28u, 0x00u, 0x00u, 0x00u, + /* Version of the descriptor 2 bytes */ 0x00u, 0x01u, + /* wIndex - Fixed:INDEX_CONFIG_DESCRIPTOR */ 0x04u, 0x00u, + /* bCount - Count of device functions. */ 0x01u, + /* Reserved : 7 bytes */ 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, + /* bFirstInterfaceNumber */ 0x00u, + /* Reserved */ 0x01u, + /* compatibleID - "CYUSB\0\0" */ (uint8)'C', (uint8)'Y', (uint8)'U', (uint8)'S', (uint8)'B', + 0x00u, 0x00u, 0x00u, + /* subcompatibleID - "00001\0\0" */ (uint8)'0', (uint8)'0', (uint8)'0', (uint8)'0', (uint8)'1', + 0x00u, 0x00u, 0x00u, + /* Reserved : 6 bytes */ 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u + }; + +#endif /* USBFS_ENABLE_MSOS_STRING */ + +/* DIE ID string descriptor for 8 bytes ID */ +#if defined(USBFS_ENABLE_IDSN_STRING) + uint8 USBFS_idSerialNumberStringDescriptor[USBFS_IDSN_DESCR_LENGTH]; +#endif /* USBFS_ENABLE_IDSN_STRING */ + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_drv.c b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_drv.c new file mode 100755 index 0000000..e78a41b --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_drv.c @@ -0,0 +1,781 @@ +/******************************************************************************* +* File Name: USBFS_drv.c +* Version 2.60 +* +* Description: +* Endpoint 0 Driver for the USBFS Component. +* +* Note: +* +******************************************************************************** +* Copyright 2008-2013, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#include "USBFS.h" +#include "USBFS_pvt.h" + + +/*************************************** +* Global data allocation +***************************************/ + +volatile T_USBFS_EP_CTL_BLOCK USBFS_EP[USBFS_MAX_EP]; +volatile uint8 USBFS_configuration; +volatile uint8 USBFS_interfaceNumber; +volatile uint8 USBFS_configurationChanged; +volatile uint8 USBFS_deviceAddress; +volatile uint8 USBFS_deviceStatus; +volatile uint8 USBFS_interfaceSetting[USBFS_MAX_INTERFACES_NUMBER]; +volatile uint8 USBFS_interfaceSetting_last[USBFS_MAX_INTERFACES_NUMBER]; +volatile uint8 USBFS_interfaceStatus[USBFS_MAX_INTERFACES_NUMBER]; +volatile uint8 USBFS_device; +const uint8 CYCODE *USBFS_interfaceClass; + + +/*************************************** +* Local data allocation +***************************************/ + +volatile uint8 USBFS_ep0Toggle; +volatile uint8 USBFS_lastPacketSize; +volatile uint8 USBFS_transferState; +volatile T_USBFS_TD USBFS_currentTD; +volatile uint8 USBFS_ep0Mode; +volatile uint8 USBFS_ep0Count; +volatile uint16 USBFS_transferByteCount; + + +/******************************************************************************* +* Function Name: USBFS_ep_0_Interrupt +******************************************************************************** +* +* Summary: +* This Interrupt Service Routine handles Endpoint 0 (Control Pipe) traffic. +* It dispatches setup requests and handles the data and status stages. +* +* Parameters: +* None. +* +* Return: +* None. +* +*******************************************************************************/ +CY_ISR(USBFS_EP_0_ISR) +{ + uint8 bRegTemp; + uint8 modifyReg; + + + bRegTemp = CY_GET_REG8(USBFS_EP0_CR_PTR); + if ((bRegTemp & USBFS_MODE_ACKD) != 0u) + { + modifyReg = 1u; + if ((bRegTemp & USBFS_MODE_SETUP_RCVD) != 0u) + { + if((bRegTemp & USBFS_MODE_MASK) != USBFS_MODE_NAK_IN_OUT) + { + modifyReg = 0u; /* When mode not NAK_IN_OUT => invalid setup */ + } + else + { + USBFS_HandleSetup(); + if((USBFS_ep0Mode & USBFS_MODE_SETUP_RCVD) != 0u) + { + modifyReg = 0u; /* if SETUP bit set -> exit without modifying the mode */ + } + + } + } + else if ((bRegTemp & USBFS_MODE_IN_RCVD) != 0u) + { + USBFS_HandleIN(); + } + else if ((bRegTemp & USBFS_MODE_OUT_RCVD) != 0u) + { + USBFS_HandleOUT(); + } + else + { + modifyReg = 0u; + } + if(modifyReg != 0u) + { + bRegTemp = CY_GET_REG8(USBFS_EP0_CR_PTR); /* unlock registers */ + if((bRegTemp & USBFS_MODE_SETUP_RCVD) == 0u) /* Check if SETUP bit is not set, otherwise exit */ + { + /* Update the count register */ + bRegTemp = USBFS_ep0Toggle | USBFS_ep0Count; + CY_SET_REG8(USBFS_EP0_CNT_PTR, bRegTemp); + if(bRegTemp == CY_GET_REG8(USBFS_EP0_CNT_PTR)) /* continue if writing was successful */ + { + do + { + modifyReg = USBFS_ep0Mode; /* Init temporary variable */ + /* Unlock registers */ + bRegTemp = CY_GET_REG8(USBFS_EP0_CR_PTR) & USBFS_MODE_SETUP_RCVD; + if(bRegTemp == 0u) /* Check if SETUP bit is not set */ + { + /* Set the Mode Register */ + CY_SET_REG8(USBFS_EP0_CR_PTR, USBFS_ep0Mode); + /* Writing check */ + modifyReg = CY_GET_REG8(USBFS_EP0_CR_PTR) & USBFS_MODE_MASK; + } + }while(modifyReg != USBFS_ep0Mode); /* Repeat if writing was not successful */ + } + } + } + } +} + + +/******************************************************************************* +* Function Name: USBFS_HandleSetup +******************************************************************************** +* +* Summary: +* This Routine dispatches requests for the four USB request types +* +* Parameters: +* None. +* +* Return: +* None. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_HandleSetup(void) +{ + uint8 requestHandled; + + requestHandled = CY_GET_REG8(USBFS_EP0_CR_PTR); /* unlock registers */ + CY_SET_REG8(USBFS_EP0_CR_PTR, requestHandled); /* clear setup bit */ + requestHandled = CY_GET_REG8(USBFS_EP0_CR_PTR); /* reread register */ + if((requestHandled & USBFS_MODE_SETUP_RCVD) != 0u) + { + USBFS_ep0Mode = requestHandled; /* if SETUP bit set -> exit without modifying the mode */ + } + else + { + /* In case the previous transfer did not complete, close it out */ + USBFS_UpdateStatusBlock(USBFS_XFER_PREMATURE); + + switch (CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_TYPE_MASK) + { + case USBFS_RQST_TYPE_STD: + requestHandled = USBFS_HandleStandardRqst(); + break; + case USBFS_RQST_TYPE_CLS: + requestHandled = USBFS_DispatchClassRqst(); + break; + case USBFS_RQST_TYPE_VND: + requestHandled = USBFS_HandleVendorRqst(); + break; + default: + requestHandled = USBFS_FALSE; + break; + } + if (requestHandled == USBFS_FALSE) + { + USBFS_ep0Mode = USBFS_MODE_STALL_IN_OUT; + } + } +} + + +/******************************************************************************* +* Function Name: USBFS_HandleIN +******************************************************************************** +* +* Summary: +* This routine handles EP0 IN transfers. +* +* Parameters: +* None. +* +* Return: +* None. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_HandleIN(void) +{ + switch (USBFS_transferState) + { + case USBFS_TRANS_STATE_IDLE: + break; + case USBFS_TRANS_STATE_CONTROL_READ: + USBFS_ControlReadDataStage(); + break; + case USBFS_TRANS_STATE_CONTROL_WRITE: + USBFS_ControlWriteStatusStage(); + break; + case USBFS_TRANS_STATE_NO_DATA_CONTROL: + USBFS_NoDataControlStatusStage(); + break; + default: /* there are no more states */ + break; + } +} + + +/******************************************************************************* +* Function Name: USBFS_HandleOUT +******************************************************************************** +* +* Summary: +* This routine handles EP0 OUT transfers. +* +* Parameters: +* None. +* +* Return: +* None. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_HandleOUT(void) +{ + switch (USBFS_transferState) + { + case USBFS_TRANS_STATE_IDLE: + break; + case USBFS_TRANS_STATE_CONTROL_READ: + USBFS_ControlReadStatusStage(); + break; + case USBFS_TRANS_STATE_CONTROL_WRITE: + USBFS_ControlWriteDataStage(); + break; + case USBFS_TRANS_STATE_NO_DATA_CONTROL: + /* Update the completion block */ + USBFS_UpdateStatusBlock(USBFS_XFER_ERROR); + /* We expect no more data, so stall INs and OUTs */ + USBFS_ep0Mode = USBFS_MODE_STALL_IN_OUT; + break; + default: /* There are no more states */ + break; + } +} + + +/******************************************************************************* +* Function Name: USBFS_LoadEP0 +******************************************************************************** +* +* Summary: +* This routine loads the EP0 data registers for OUT transfers. It uses the +* currentTD (previously initialized by the _InitControlWrite function and +* updated for each OUT transfer, and the bLastPacketSize) to determine how +* many uint8s to transfer on the current OUT. +* +* If the number of uint8s remaining is zero and the last transfer was full, +* we need to send a zero length packet. Otherwise we send the minimum +* of the control endpoint size (8) or remaining number of uint8s for the +* transaction. +* +* Parameters: +* None. +* +* Return: +* None. +* +* Global variables: +* USBFS_transferByteCount - Update the transfer byte count from the +* last transaction. +* USBFS_ep0Count - counts the data loaded to the SIE memory in +* current packet. +* USBFS_lastPacketSize - remembers the USBFS_ep0Count value for the +* next packet. +* USBFS_transferByteCount - sum of the previous bytes transferred +* on previous packets(sum of USBFS_lastPacketSize) +* USBFS_ep0Toggle - inverted +* USBFS_ep0Mode - prepare for mode register content. +* USBFS_transferState - set to TRANS_STATE_CONTROL_READ +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_LoadEP0(void) +{ + uint8 ep0Count = 0u; + + /* Update the transfer byte count from the last transaction */ + USBFS_transferByteCount += USBFS_lastPacketSize; + /* Now load the next transaction */ + while ((USBFS_currentTD.count > 0u) && (ep0Count < 8u)) + { + CY_SET_REG8((reg8 *)(USBFS_EP0_DR0_IND + ep0Count), *USBFS_currentTD.pData); + USBFS_currentTD.pData = &USBFS_currentTD.pData[1u]; + ep0Count++; + USBFS_currentTD.count--; + } + /* Support zero-length packet*/ + if( (USBFS_lastPacketSize == 8u) || (ep0Count > 0u) ) + { + /* Update the data toggle */ + USBFS_ep0Toggle ^= USBFS_EP0_CNT_DATA_TOGGLE; + /* Set the Mode Register */ + USBFS_ep0Mode = USBFS_MODE_ACK_IN_STATUS_OUT; + /* Update the state (or stay the same) */ + USBFS_transferState = USBFS_TRANS_STATE_CONTROL_READ; + } + else + { + /* Expect Status Stage Out */ + USBFS_ep0Mode = USBFS_MODE_STATUS_OUT_ONLY; + /* Update the state (or stay the same) */ + USBFS_transferState = USBFS_TRANS_STATE_CONTROL_READ; + } + + /* Save the packet size for next time */ + USBFS_lastPacketSize = ep0Count; + USBFS_ep0Count = ep0Count; +} + + +/******************************************************************************* +* Function Name: USBFS_InitControlRead +******************************************************************************** +* +* Summary: +* Initialize a control read transaction, usable to send data to the host. +* The following global variables should be initialized before this function +* called. To send zero length packet use InitZeroLengthControlTransfer +* function. +* +* Parameters: +* None. +* +* Return: +* requestHandled state. +* +* Global variables: +* USBFS_currentTD.count - counts of data to be sent. +* USBFS_currentTD.pData - data pointer. +* +* Reentrant: +* No. +* +*******************************************************************************/ +uint8 USBFS_InitControlRead(void) +{ + uint16 xferCount; + if(USBFS_currentTD.count == 0u) + { + (void) USBFS_InitZeroLengthControlTransfer(); + } + else + { + /* Set up the state machine */ + USBFS_transferState = USBFS_TRANS_STATE_CONTROL_READ; + /* Set the toggle, it gets updated in LoadEP */ + USBFS_ep0Toggle = 0u; + /* Initialize the Status Block */ + USBFS_InitializeStatusBlock(); + xferCount = (((uint16)CY_GET_REG8(USBFS_lengthHi) << 8u) | (CY_GET_REG8(USBFS_lengthLo))); + + if (USBFS_currentTD.count > xferCount) + { + USBFS_currentTD.count = xferCount; + } + USBFS_LoadEP0(); + } + + return(USBFS_TRUE); +} + + +/******************************************************************************* +* Function Name: USBFS_InitZeroLengthControlTransfer +******************************************************************************** +* +* Summary: +* Initialize a zero length data IN transfer. +* +* Parameters: +* None. +* +* Return: +* requestHandled state. +* +* Global variables: +* USBFS_ep0Toggle - set to EP0_CNT_DATA_TOGGLE +* USBFS_ep0Mode - prepare for mode register content. +* USBFS_transferState - set to TRANS_STATE_CONTROL_READ +* USBFS_ep0Count - cleared, means the zero-length packet. +* USBFS_lastPacketSize - cleared. +* +* Reentrant: +* No. +* +*******************************************************************************/ +uint8 USBFS_InitZeroLengthControlTransfer(void) + +{ + /* Update the state */ + USBFS_transferState = USBFS_TRANS_STATE_CONTROL_READ; + /* Set the data toggle */ + USBFS_ep0Toggle = USBFS_EP0_CNT_DATA_TOGGLE; + /* Set the Mode Register */ + USBFS_ep0Mode = USBFS_MODE_ACK_IN_STATUS_OUT; + /* Save the packet size for next time */ + USBFS_lastPacketSize = 0u; + USBFS_ep0Count = 0u; + + return(USBFS_TRUE); +} + + +/******************************************************************************* +* Function Name: USBFS_ControlReadDataStage +******************************************************************************** +* +* Summary: +* Handle the Data Stage of a control read transfer. +* +* Parameters: +* None. +* +* Return: +* None. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_ControlReadDataStage(void) + +{ + USBFS_LoadEP0(); +} + + +/******************************************************************************* +* Function Name: USBFS_ControlReadStatusStage +******************************************************************************** +* +* Summary: +* Handle the Status Stage of a control read transfer. +* +* Parameters: +* None. +* +* Return: +* None. +* +* Global variables: +* USBFS_USBFS_transferByteCount - updated with last packet size. +* USBFS_transferState - set to TRANS_STATE_IDLE. +* USBFS_ep0Mode - set to MODE_STALL_IN_OUT. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_ControlReadStatusStage(void) +{ + /* Update the transfer byte count */ + USBFS_transferByteCount += USBFS_lastPacketSize; + /* Go Idle */ + USBFS_transferState = USBFS_TRANS_STATE_IDLE; + /* Update the completion block */ + USBFS_UpdateStatusBlock(USBFS_XFER_STATUS_ACK); + /* We expect no more data, so stall INs and OUTs */ + USBFS_ep0Mode = USBFS_MODE_STALL_IN_OUT; +} + + +/******************************************************************************* +* Function Name: USBFS_InitControlWrite +******************************************************************************** +* +* Summary: +* Initialize a control write transaction +* +* Parameters: +* None. +* +* Return: +* requestHandled state. +* +* Global variables: +* USBFS_USBFS_transferState - set to TRANS_STATE_CONTROL_WRITE +* USBFS_ep0Toggle - set to EP0_CNT_DATA_TOGGLE +* USBFS_ep0Mode - set to MODE_ACK_OUT_STATUS_IN +* +* Reentrant: +* No. +* +*******************************************************************************/ +uint8 USBFS_InitControlWrite(void) +{ + uint16 xferCount; + + /* Set up the state machine */ + USBFS_transferState = USBFS_TRANS_STATE_CONTROL_WRITE; + /* This might not be necessary */ + USBFS_ep0Toggle = USBFS_EP0_CNT_DATA_TOGGLE; + /* Initialize the Status Block */ + USBFS_InitializeStatusBlock(); + + xferCount = (((uint16)CY_GET_REG8(USBFS_lengthHi) << 8u) | (CY_GET_REG8(USBFS_lengthLo))); + + if (USBFS_currentTD.count > xferCount) + { + USBFS_currentTD.count = xferCount; + } + + /* Expect Data or Status Stage */ + USBFS_ep0Mode = USBFS_MODE_ACK_OUT_STATUS_IN; + + return(USBFS_TRUE); +} + + +/******************************************************************************* +* Function Name: USBFS_ControlWriteDataStage +******************************************************************************** +* +* Summary: +* Handle the Data Stage of a control write transfer +* 1. Get the data (We assume the destination was validated previously) +* 2. Update the count and data toggle +* 3. Update the mode register for the next transaction +* +* Parameters: +* None. +* +* Return: +* None. +* +* Global variables: +* USBFS_transferByteCount - Update the transfer byte count from the +* last transaction. +* USBFS_ep0Count - counts the data loaded from the SIE memory +* in current packet. +* USBFS_transferByteCount - sum of the previous bytes transferred +* on previous packets(sum of USBFS_lastPacketSize) +* USBFS_ep0Toggle - inverted +* USBFS_ep0Mode - set to MODE_ACK_OUT_STATUS_IN. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_ControlWriteDataStage(void) +{ + uint8 ep0Count; + uint8 regIndex = 0u; + + ep0Count = (CY_GET_REG8(USBFS_EP0_CNT_PTR) & USBFS_EPX_CNT0_MASK) - + USBFS_EPX_CNTX_CRC_COUNT; + + USBFS_transferByteCount += ep0Count; + + while ((USBFS_currentTD.count > 0u) && (ep0Count > 0u)) + { + *USBFS_currentTD.pData = CY_GET_REG8((reg8 *)(USBFS_EP0_DR0_IND + regIndex)); + USBFS_currentTD.pData = &USBFS_currentTD.pData[1u]; + regIndex++; + ep0Count--; + USBFS_currentTD.count--; + } + USBFS_ep0Count = ep0Count; + /* Update the data toggle */ + USBFS_ep0Toggle ^= USBFS_EP0_CNT_DATA_TOGGLE; + /* Expect Data or Status Stage */ + USBFS_ep0Mode = USBFS_MODE_ACK_OUT_STATUS_IN; +} + + +/******************************************************************************* +* Function Name: USBFS_ControlWriteStatusStage +******************************************************************************** +* +* Summary: +* Handle the Status Stage of a control write transfer +* +* Parameters: +* None. +* +* Return: +* None. +* +* Global variables: +* USBFS_transferState - set to TRANS_STATE_IDLE. +* USBFS_USBFS_ep0Mode - set to MODE_STALL_IN_OUT. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_ControlWriteStatusStage(void) +{ + /* Go Idle */ + USBFS_transferState = USBFS_TRANS_STATE_IDLE; + /* Update the completion block */ + USBFS_UpdateStatusBlock(USBFS_XFER_STATUS_ACK); + /* We expect no more data, so stall INs and OUTs */ + USBFS_ep0Mode = USBFS_MODE_STALL_IN_OUT; +} + + +/******************************************************************************* +* Function Name: USBFS_InitNoDataControlTransfer +******************************************************************************** +* +* Summary: +* Initialize a no data control transfer +* +* Parameters: +* None. +* +* Return: +* requestHandled state. +* +* Global variables: +* USBFS_transferState - set to TRANS_STATE_NO_DATA_CONTROL. +* USBFS_ep0Mode - set to MODE_STATUS_IN_ONLY. +* USBFS_ep0Count - cleared. +* USBFS_ep0Toggle - set to EP0_CNT_DATA_TOGGLE +* +* Reentrant: +* No. +* +*******************************************************************************/ +uint8 USBFS_InitNoDataControlTransfer(void) +{ + USBFS_transferState = USBFS_TRANS_STATE_NO_DATA_CONTROL; + USBFS_ep0Mode = USBFS_MODE_STATUS_IN_ONLY; + USBFS_ep0Toggle = USBFS_EP0_CNT_DATA_TOGGLE; + USBFS_ep0Count = 0u; + + return(USBFS_TRUE); +} + + +/******************************************************************************* +* Function Name: USBFS_NoDataControlStatusStage +******************************************************************************** +* Summary: +* Handle the Status Stage of a no data control transfer. +* +* SET_ADDRESS is special, since we need to receive the status stage with +* the old address. +* +* Parameters: +* None. +* +* Return: +* None. +* +* Global variables: +* USBFS_transferState - set to TRANS_STATE_IDLE. +* USBFS_ep0Mode - set to MODE_STALL_IN_OUT. +* USBFS_ep0Toggle - set to EP0_CNT_DATA_TOGGLE +* USBFS_deviceAddress - used to set new address and cleared +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_NoDataControlStatusStage(void) +{ + /* Change the USB address register if we got a SET_ADDRESS. */ + if (USBFS_deviceAddress != 0u) + { + CY_SET_REG8(USBFS_CR0_PTR, USBFS_deviceAddress | USBFS_CR0_ENABLE); + USBFS_deviceAddress = 0u; + } + /* Go Idle */ + USBFS_transferState = USBFS_TRANS_STATE_IDLE; + /* Update the completion block */ + USBFS_UpdateStatusBlock(USBFS_XFER_STATUS_ACK); + /* We expect no more data, so stall INs and OUTs */ + USBFS_ep0Mode = USBFS_MODE_STALL_IN_OUT; +} + + +/******************************************************************************* +* Function Name: USBFS_UpdateStatusBlock +******************************************************************************** +* +* Summary: +* Update the Completion Status Block for a Request. The block is updated +* with the completion code the USBFS_transferByteCount. The +* StatusBlock Pointer is set to NULL. +* +* Parameters: +* completionCode - status. +* +* Return: +* None. +* +* Global variables: +* USBFS_currentTD.pStatusBlock->status - updated by the +* completionCode parameter. +* USBFS_currentTD.pStatusBlock->length - updated. +* USBFS_currentTD.pStatusBlock - cleared. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_UpdateStatusBlock(uint8 completionCode) +{ + if (USBFS_currentTD.pStatusBlock != NULL) + { + USBFS_currentTD.pStatusBlock->status = completionCode; + USBFS_currentTD.pStatusBlock->length = USBFS_transferByteCount; + USBFS_currentTD.pStatusBlock = NULL; + } +} + + +/******************************************************************************* +* Function Name: USBFS_InitializeStatusBlock +******************************************************************************** +* +* Summary: +* Initialize the Completion Status Block for a Request. The completion +* code is set to USB_XFER_IDLE. +* +* Also, initializes USBFS_transferByteCount. Save some space, +* this is the only consumer. +* +* Parameters: +* None. +* +* Return: +* None. +* +* Global variables: +* USBFS_currentTD.pStatusBlock->status - set to XFER_IDLE. +* USBFS_currentTD.pStatusBlock->length - cleared. +* USBFS_transferByteCount - cleared. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_InitializeStatusBlock(void) +{ + USBFS_transferByteCount = 0u; + if(USBFS_currentTD.pStatusBlock != NULL) + { + USBFS_currentTD.pStatusBlock->status = USBFS_XFER_IDLE; + USBFS_currentTD.pStatusBlock->length = 0u; + } +} + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_episr.c b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_episr.c new file mode 100755 index 0000000..cd88e92 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_episr.c @@ -0,0 +1,658 @@ +/******************************************************************************* +* File Name: USBFS_episr.c +* Version 2.60 +* +* Description: +* Data endpoint Interrupt Service Routines +* +* Note: +* +******************************************************************************** +* Copyright 2008-2013, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#include "USBFS.h" +#include "USBFS_pvt.h" +#if defined(USBFS_ENABLE_MIDI_STREAMING) && (USBFS_ENABLE_MIDI_API != 0u) + #include "USBFS_midi.h" +#endif /* End USBFS_ENABLE_MIDI_STREAMING*/ + + +/*************************************** +* Custom Declarations +***************************************/ +/* `#START CUSTOM_DECLARATIONS` Place your declaration here */ + +/* `#END` */ + + +#if(USBFS_EP1_ISR_REMOVE == 0u) + + + /****************************************************************************** + * Function Name: USBFS_EP_1_ISR + ******************************************************************************* + * + * Summary: + * Endpoint 1 Interrupt Service Routine + * + * Parameters: + * None. + * + * Return: + * None. + * + ******************************************************************************/ + CY_ISR(USBFS_EP_1_ISR) + { + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + uint8 int_en; + #endif /* USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3 */ + + /* `#START EP1_USER_CODE` Place your code here */ + + /* `#END` */ + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + int_en = EA; + CyGlobalIntEnable; /* Make sure nested interrupt is enabled */ + #endif /* USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3 */ + + CY_GET_REG8(USBFS_SIE_EP1_CR0_PTR); /* Must read the mode reg */ + /* Do not toggle ISOC endpoint */ + if((USBFS_EP[USBFS_EP1].attrib & USBFS_EP_TYPE_MASK) != + USBFS_EP_TYPE_ISOC) + { + USBFS_EP[USBFS_EP1].epToggle ^= USBFS_EPX_CNT_DATA_TOGGLE; + } + USBFS_EP[USBFS_EP1].apiEpState = USBFS_EVENT_PENDING; + CY_SET_REG8(USBFS_SIE_EP_INT_SR_PTR, CY_GET_REG8(USBFS_SIE_EP_INT_SR_PTR) & + (uint8)~USBFS_SIE_EP_INT_EP1_MASK); + + #if( defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT ) + if(USBFS_midi_out_ep == USBFS_EP1) + { + USBFS_MIDI_OUT_EP_Service(); + } + #endif /* End USBFS_ISR_SERVICE_MIDI_OUT */ + + /* `#START EP1_END_USER_CODE` Place your code here */ + + /* `#END` */ + + #if ( defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3 ) + EA = int_en; + #endif /* USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3 */ + } + +#endif /* End USBFS_EP1_ISR_REMOVE */ + + +#if(USBFS_EP2_ISR_REMOVE == 0u) + + /******************************************************************************* + * Function Name: USBFS_EP_2_ISR + ******************************************************************************** + * + * Summary: + * Endpoint 2 Interrupt Service Routine + * + * Parameters: + * None. + * + * Return: + * None. + * + *******************************************************************************/ + CY_ISR(USBFS_EP_2_ISR) + { + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + uint8 int_en; + #endif /* USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3 */ + + /* `#START EP2_USER_CODE` Place your code here */ + + /* `#END` */ + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3 ) + int_en = EA; + CyGlobalIntEnable; /* Make sure nested interrupt is enabled */ + #endif /* USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3 */ + + CY_GET_REG8(USBFS_SIE_EP2_CR0_PTR); /* Must read the mode reg */ + /* Do not toggle ISOC endpoint */ + if((USBFS_EP[USBFS_EP2].attrib & USBFS_EP_TYPE_MASK) != + USBFS_EP_TYPE_ISOC) + { + USBFS_EP[USBFS_EP2].epToggle ^= USBFS_EPX_CNT_DATA_TOGGLE; + } + USBFS_EP[USBFS_EP2].apiEpState = USBFS_EVENT_PENDING; + CY_SET_REG8(USBFS_SIE_EP_INT_SR_PTR, CY_GET_REG8(USBFS_SIE_EP_INT_SR_PTR) + & (uint8)~USBFS_SIE_EP_INT_EP2_MASK); + + #if( defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT ) + if(USBFS_midi_out_ep == USBFS_EP2) + { + USBFS_MIDI_OUT_EP_Service(); + } + #endif /* End USBFS_ISR_SERVICE_MIDI_OUT */ + + /* `#START EP2_END_USER_CODE` Place your code here */ + + /* `#END` */ + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + EA = int_en; + #endif /* USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3 */ + } + +#endif /* End USBFS_EP2_ISR_REMOVE */ + + +#if(USBFS_EP3_ISR_REMOVE == 0u) + + /******************************************************************************* + * Function Name: USBFS_EP_3_ISR + ******************************************************************************** + * + * Summary: + * Endpoint 3 Interrupt Service Routine + * + * Parameters: + * None. + * + * Return: + * None. + * + *******************************************************************************/ + CY_ISR(USBFS_EP_3_ISR) + { + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + uint8 int_en; + #endif /* USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3 */ + + /* `#START EP3_USER_CODE` Place your code here */ + + /* `#END` */ + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + int_en = EA; + CyGlobalIntEnable; /* Make sure nested interrupt is enabled */ + #endif /* CY_PSOC3 & USBFS_ISR_SERVICE_MIDI_OUT */ + + CY_GET_REG8(USBFS_SIE_EP3_CR0_PTR); /* Must read the mode reg */ + /* Do not toggle ISOC endpoint */ + if((USBFS_EP[USBFS_EP3].attrib & USBFS_EP_TYPE_MASK) != + USBFS_EP_TYPE_ISOC) + { + USBFS_EP[USBFS_EP3].epToggle ^= USBFS_EPX_CNT_DATA_TOGGLE; + } + USBFS_EP[USBFS_EP3].apiEpState = USBFS_EVENT_PENDING; + CY_SET_REG8(USBFS_SIE_EP_INT_SR_PTR, CY_GET_REG8(USBFS_SIE_EP_INT_SR_PTR) + & (uint8)~USBFS_SIE_EP_INT_EP3_MASK); + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT) + if(USBFS_midi_out_ep == USBFS_EP3) + { + USBFS_MIDI_OUT_EP_Service(); + } + #endif /* End USBFS_ISR_SERVICE_MIDI_OUT */ + + /* `#START EP3_END_USER_CODE` Place your code here */ + + /* `#END` */ + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + EA = int_en; + #endif /* CY_PSOC3 & USBFS_ISR_SERVICE_MIDI_OUT */ + } + +#endif /* End USBFS_EP3_ISR_REMOVE */ + + +#if(USBFS_EP4_ISR_REMOVE == 0u) + + /******************************************************************************* + * Function Name: USBFS_EP_4_ISR + ******************************************************************************** + * + * Summary: + * Endpoint 4 Interrupt Service Routine + * + * Parameters: + * None. + * + * Return: + * None. + * + *******************************************************************************/ + CY_ISR(USBFS_EP_4_ISR) + { + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + uint8 int_en; + #endif /* CY_PSOC3 & USBFS_ISR_SERVICE_MIDI_OUT */ + + /* `#START EP4_USER_CODE` Place your code here */ + + /* `#END` */ + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + int_en = EA; + CyGlobalIntEnable; /* Make sure nested interrupt is enabled */ + #endif /* CY_PSOC3 & USBFS_ISR_SERVICE_MIDI_OUT */ + + CY_GET_REG8(USBFS_SIE_EP4_CR0_PTR); /* Must read the mode reg */ + /* Do not toggle ISOC endpoint */ + if((USBFS_EP[USBFS_EP4].attrib & USBFS_EP_TYPE_MASK) != + USBFS_EP_TYPE_ISOC) + { + USBFS_EP[USBFS_EP4].epToggle ^= USBFS_EPX_CNT_DATA_TOGGLE; + } + USBFS_EP[USBFS_EP4].apiEpState = USBFS_EVENT_PENDING; + CY_SET_REG8(USBFS_SIE_EP_INT_SR_PTR, CY_GET_REG8(USBFS_SIE_EP_INT_SR_PTR) + & (uint8)~USBFS_SIE_EP_INT_EP4_MASK); + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT) + if(USBFS_midi_out_ep == USBFS_EP4) + { + USBFS_MIDI_OUT_EP_Service(); + } + #endif /* End USBFS_ISR_SERVICE_MIDI_OUT */ + + /* `#START EP4_END_USER_CODE` Place your code here */ + + /* `#END` */ + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + EA = int_en; + #endif /* CY_PSOC3 & USBFS_ISR_SERVICE_MIDI_OUT */ + } + +#endif /* End USBFS_EP4_ISR_REMOVE */ + + +#if(USBFS_EP5_ISR_REMOVE == 0u) + + /******************************************************************************* + * Function Name: USBFS_EP_5_ISR + ******************************************************************************** + * + * Summary: + * Endpoint 5 Interrupt Service Routine + * + * Parameters: + * None. + * + * Return: + * None. + * + *******************************************************************************/ + CY_ISR(USBFS_EP_5_ISR) + { + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + uint8 int_en; + #endif /* CY_PSOC3 & USBFS_ISR_SERVICE_MIDI_OUT */ + + /* `#START EP5_USER_CODE` Place your code here */ + + /* `#END` */ + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + int_en = EA; + CyGlobalIntEnable; /* Make sure nested interrupt is enabled */ + #endif /* CY_PSOC3 & USBFS_ISR_SERVICE_MIDI_OUT */ + + CY_GET_REG8(USBFS_SIE_EP5_CR0_PTR); /* Must read the mode reg */ + /* Do not toggle ISOC endpoint */ + if((USBFS_EP[USBFS_EP5].attrib & USBFS_EP_TYPE_MASK) != + USBFS_EP_TYPE_ISOC) + { + USBFS_EP[USBFS_EP5].epToggle ^= USBFS_EPX_CNT_DATA_TOGGLE; + } + USBFS_EP[USBFS_EP5].apiEpState = USBFS_EVENT_PENDING; + CY_SET_REG8(USBFS_SIE_EP_INT_SR_PTR, CY_GET_REG8(USBFS_SIE_EP_INT_SR_PTR) + & (uint8)~USBFS_SIE_EP_INT_EP5_MASK); + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT) + if(USBFS_midi_out_ep == USBFS_EP5) + { + USBFS_MIDI_OUT_EP_Service(); + } + #endif /* End USBFS_ISR_SERVICE_MIDI_OUT */ + + /* `#START EP5_END_USER_CODE` Place your code here */ + + /* `#END` */ + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + EA = int_en; + #endif /* CY_PSOC3 & USBFS_ISR_SERVICE_MIDI_OUT */ + } +#endif /* End USBFS_EP5_ISR_REMOVE */ + + +#if(USBFS_EP6_ISR_REMOVE == 0u) + + /******************************************************************************* + * Function Name: USBFS_EP_6_ISR + ******************************************************************************** + * + * Summary: + * Endpoint 6 Interrupt Service Routine + * + * Parameters: + * None. + * + * Return: + * None. + * + *******************************************************************************/ + CY_ISR(USBFS_EP_6_ISR) + { + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + uint8 int_en; + #endif /* CY_PSOC3 & USBFS_ISR_SERVICE_MIDI_OUT */ + + /* `#START EP6_USER_CODE` Place your code here */ + + /* `#END` */ + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + int_en = EA; + CyGlobalIntEnable; /* Make sure nested interrupt is enabled */ + #endif /* CY_PSOC3 & USBFS_ISR_SERVICE_MIDI_OUT */ + + CY_GET_REG8(USBFS_SIE_EP6_CR0_PTR); /* Must read the mode reg */ + /* Do not toggle ISOC endpoint */ + if((USBFS_EP[USBFS_EP6].attrib & USBFS_EP_TYPE_MASK) != + USBFS_EP_TYPE_ISOC) + { + USBFS_EP[USBFS_EP6].epToggle ^= USBFS_EPX_CNT_DATA_TOGGLE; + } + USBFS_EP[USBFS_EP6].apiEpState = USBFS_EVENT_PENDING; + CY_SET_REG8(USBFS_SIE_EP_INT_SR_PTR, CY_GET_REG8(USBFS_SIE_EP_INT_SR_PTR) + & (uint8)~USBFS_SIE_EP_INT_EP6_MASK); + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT) + if(USBFS_midi_out_ep == USBFS_EP6) + { + USBFS_MIDI_OUT_EP_Service(); + } + #endif /* End USBFS_ISR_SERVICE_MIDI_OUT */ + + /* `#START EP6_END_USER_CODE` Place your code here */ + + /* `#END` */ + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + EA = int_en; + #endif /* CY_PSOC3 & USBFS_ISR_SERVICE_MIDI_OUT */ + } + +#endif /* End USBFS_EP6_ISR_REMOVE */ + + +#if(USBFS_EP7_ISR_REMOVE == 0u) + + /******************************************************************************* + * Function Name: USBFS_EP_7_ISR + ******************************************************************************** + * + * Summary: + * Endpoint 7 Interrupt Service Routine + * + * Parameters: + * None. + * + * Return: + * None. + * + *******************************************************************************/ + CY_ISR(USBFS_EP_7_ISR) + { + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + uint8 int_en; + #endif /* CY_PSOC3 & USBFS_ISR_SERVICE_MIDI_OUT */ + + /* `#START EP7_USER_CODE` Place your code here */ + + /* `#END` */ + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + int_en = EA; + CyGlobalIntEnable; /* Make sure nested interrupt is enabled */ + #endif /* CY_PSOC3 & USBFS_ISR_SERVICE_MIDI_OUT */ + + CY_GET_REG8(USBFS_SIE_EP7_CR0_PTR); /* Must read the mode reg */ + /* Do not toggle ISOC endpoint */ + if((USBFS_EP[USBFS_EP7].attrib & USBFS_EP_TYPE_MASK) != + USBFS_EP_TYPE_ISOC) + { + USBFS_EP[USBFS_EP7].epToggle ^= USBFS_EPX_CNT_DATA_TOGGLE; + } + USBFS_EP[USBFS_EP7].apiEpState = USBFS_EVENT_PENDING; + CY_SET_REG8(USBFS_SIE_EP_INT_SR_PTR, CY_GET_REG8(USBFS_SIE_EP_INT_SR_PTR) + & (uint8)~USBFS_SIE_EP_INT_EP7_MASK); + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT) + if(USBFS_midi_out_ep == USBFS_EP7) + { + USBFS_MIDI_OUT_EP_Service(); + } + #endif /* End USBFS_ISR_SERVICE_MIDI_OUT */ + + /* `#START EP7_END_USER_CODE` Place your code here */ + + /* `#END` */ + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + EA = int_en; + #endif /* CY_PSOC3 & USBFS_ISR_SERVICE_MIDI_OUT */ + } + +#endif /* End USBFS_EP7_ISR_REMOVE */ + + +#if(USBFS_EP8_ISR_REMOVE == 0u) + + /******************************************************************************* + * Function Name: USBFS_EP_8_ISR + ******************************************************************************** + * + * Summary: + * Endpoint 8 Interrupt Service Routine + * + * Parameters: + * None. + * + * Return: + * None. + * + *******************************************************************************/ + CY_ISR(USBFS_EP_8_ISR) + { + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + uint8 int_en; + #endif /* CY_PSOC3 & USBFS_ISR_SERVICE_MIDI_OUT */ + + /* `#START EP8_USER_CODE` Place your code here */ + + /* `#END` */ + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + int_en = EA; + CyGlobalIntEnable; /* Make sure nested interrupt is enabled */ + #endif /* CY_PSOC3 & USBFS_ISR_SERVICE_MIDI_OUT */ + + CY_GET_REG8(USBFS_SIE_EP8_CR0_PTR); /* Must read the mode reg */ + /* Do not toggle ISOC endpoint */ + if((USBFS_EP[USBFS_EP8].attrib & USBFS_EP_TYPE_MASK) != + USBFS_EP_TYPE_ISOC) + { + USBFS_EP[USBFS_EP8].epToggle ^= USBFS_EPX_CNT_DATA_TOGGLE; + } + USBFS_EP[USBFS_EP8].apiEpState = USBFS_EVENT_PENDING; + CY_SET_REG8(USBFS_SIE_EP_INT_SR_PTR, CY_GET_REG8(USBFS_SIE_EP_INT_SR_PTR) + & (uint8)~USBFS_SIE_EP_INT_EP8_MASK); + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT) + if(USBFS_midi_out_ep == USBFS_EP8) + { + USBFS_MIDI_OUT_EP_Service(); + } + #endif /* End USBFS_ISR_SERVICE_MIDI_OUT */ + + /* `#START EP8_END_USER_CODE` Place your code here */ + + /* `#END` */ + + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_OUT && CY_PSOC3) + EA = int_en; + #endif /* CY_PSOC3 & USBFS_ISR_SERVICE_MIDI_OUT */ + } + +#endif /* End USBFS_EP8_ISR_REMOVE */ + + +/******************************************************************************* +* Function Name: USBFS_SOF_ISR +******************************************************************************** +* +* Summary: +* Start of Frame Interrupt Service Routine +* +* Parameters: +* None. +* +* Return: +* None. +* +*******************************************************************************/ +CY_ISR(USBFS_SOF_ISR) +{ + /* `#START SOF_USER_CODE` Place your code here */ + + /* `#END` */ +} + + +/******************************************************************************* +* Function Name: USBFS_BUS_RESET_ISR +******************************************************************************** +* +* Summary: +* USB Bus Reset Interrupt Service Routine. Calls _Start with the same +* parameters as the last USER call to _Start +* +* Parameters: +* None. +* +* Return: +* None. +* +*******************************************************************************/ +CY_ISR(USBFS_BUS_RESET_ISR) +{ + /* `#START BUS_RESET_USER_CODE` Place your code here */ + + /* `#END` */ + + USBFS_ReInitComponent(); +} + + +#if((USBFS_EP_MM != USBFS__EP_MANUAL) && (USBFS_ARB_ISR_REMOVE == 0u)) + + + /******************************************************************************* + * Function Name: USBFS_ARB_ISR + ******************************************************************************** + * + * Summary: + * Arbiter Interrupt Service Routine + * + * Parameters: + * None. + * + * Return: + * None. + * + * Side effect: + * Search for EP8 int_status will be much slower than search for EP1 int_status. + * + *******************************************************************************/ + CY_ISR(USBFS_ARB_ISR) + { + uint8 int_status; + uint8 ep_status; + uint8 ep = USBFS_EP1; + uint8 ptr = 0u; + + /* `#START ARB_BEGIN_USER_CODE` Place your code here */ + + /* `#END` */ + + int_status = USBFS_ARB_INT_SR_REG; /* read Arbiter Status Register */ + USBFS_ARB_INT_SR_REG = int_status; /* Clear Serviced Interrupts */ + + while(int_status != 0u) + { + if((int_status & 1u) != 0u) /* If EpX interrupt present */ + { /* read Endpoint Status Register */ + ep_status = CY_GET_REG8((reg8 *)(USBFS_ARB_EP1_SR_IND + ptr)); + /* If In Buffer Full */ + if((ep_status & USBFS_ARB_EPX_SR_IN_BUF_FULL) != 0u) + { + if((USBFS_EP[ep].addr & USBFS_DIR_IN) != 0u) + { + /* Clear Data ready status */ + *(reg8 *)(USBFS_ARB_EP1_CFG_IND + ptr) &= + (uint8)~USBFS_ARB_EPX_CFG_IN_DATA_RDY; + /* Write the Mode register */ + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + ptr), USBFS_EP[ep].epMode); + #if (defined(USBFS_ENABLE_MIDI_STREAMING) && USBFS_ISR_SERVICE_MIDI_IN) + if(ep == USBFS_midi_in_ep) + { /* Clear MIDI input pointer */ + USBFS_midiInPointer = 0u; + } + #endif /* End USBFS_ENABLE_MIDI_STREAMING*/ + } + } + /* (re)arm Out EP only for mode2 */ + #if(USBFS_EP_MM != USBFS__EP_DMAAUTO) + /* If DMA Grant */ + if((ep_status & USBFS_ARB_EPX_SR_DMA_GNT) != 0u) + { + if((USBFS_EP[ep].addr & USBFS_DIR_IN) == 0u) + { + USBFS_EP[ep].apiEpState = USBFS_NO_EVENT_PENDING; + /* Write the Mode register */ + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + ptr), + USBFS_EP[ep].epMode); + } + } + #endif /* End USBFS_EP_MM */ + + /* `#START ARB_USER_CODE` Place your code here for handle Buffer Underflow/Overflow */ + + /* `#END` */ + + CY_SET_REG8((reg8 *)(USBFS_ARB_EP1_SR_IND + ptr), ep_status); /* Clear Serviced events */ + } + ptr += USBFS_EPX_CNTX_ADDR_OFFSET; /* prepare pointer for next EP */ + ep++; + int_status >>= 1u; + } + + /* `#START ARB_END_USER_CODE` Place your code here */ + + /* `#END` */ + } + +#endif /* End USBFS_EP_MM */ + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_hid.c b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_hid.c new file mode 100755 index 0000000..ba9fdf5 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_hid.c @@ -0,0 +1,422 @@ +/******************************************************************************* +* File Name: USBFS_hid.c +* Version 2.60 +* +* Description: +* USB HID Class request handler. +* +* Note: +* +******************************************************************************** +* Copyright 2008-2013, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#include "USBFS.h" + +#if defined(USBFS_ENABLE_HID_CLASS) + +#include "USBFS_pvt.h" +#include "USBFS_hid.h" + + +/*************************************** +* HID Variables +***************************************/ + +volatile uint8 USBFS_hidProtocol[USBFS_MAX_INTERFACES_NUMBER]; /* HID device protocol status */ +volatile uint8 USBFS_hidIdleRate[USBFS_MAX_INTERFACES_NUMBER]; /* HID device idle reload value */ +volatile uint8 USBFS_hidIdleTimer[USBFS_MAX_INTERFACES_NUMBER]; /* HID device idle rate value */ + + +/*************************************** +* Custom Declarations +***************************************/ + +/* `#START HID_CUSTOM_DECLARATIONS` Place your declaration here */ + +/* `#END` */ + + +/******************************************************************************* +* Function Name: USBFS_UpdateHIDTimer +******************************************************************************** +* +* Summary: +* Updates the HID report timer and reloads it if expired +* +* Parameters: +* interface: Interface Number. +* +* Return: +* status. +* +* Reentrant: +* No. +* +*******************************************************************************/ +uint8 USBFS_UpdateHIDTimer(uint8 interface) +{ + uint8 stat = USBFS_IDLE_TIMER_INDEFINITE; + + if(USBFS_hidIdleRate[interface] != 0u) + { + if(USBFS_hidIdleTimer[interface] > 0u) + { + USBFS_hidIdleTimer[interface]--; + stat = USBFS_IDLE_TIMER_RUNNING; + } + else + { + USBFS_hidIdleTimer[interface] = USBFS_hidIdleRate[interface]; + stat = USBFS_IDLE_TIMER_EXPIRED; + } + } + + return(stat); +} + + +/******************************************************************************* +* Function Name: USBFS_GetProtocol +******************************************************************************** +* +* Summary: +* Returns the selected protocol value to the application +* +* Parameters: +* interface: Interface Number. +* +* Return: +* Interface protocol. +* +*******************************************************************************/ +uint8 USBFS_GetProtocol(uint8 interface) +{ + return(USBFS_hidProtocol[interface]); +} + + +/******************************************************************************* +* Function Name: USBFS_DispatchHIDClassRqst +******************************************************************************** +* +* Summary: +* This routine dispatches class requests +* +* Parameters: +* None. +* +* Return: +* requestHandled +* +* Reentrant: +* No. +* +*******************************************************************************/ +uint8 USBFS_DispatchHIDClassRqst(void) +{ + uint8 requestHandled = USBFS_FALSE; + uint8 interfaceNumber; + + interfaceNumber = CY_GET_REG8(USBFS_wIndexLo); + if ((CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_DIR_MASK) == USBFS_RQST_DIR_D2H) + { /* Control Read */ + switch (CY_GET_REG8(USBFS_bRequest)) + { + case USBFS_GET_DESCRIPTOR: + if (CY_GET_REG8(USBFS_wValueHi) == USBFS_DESCR_HID_CLASS) + { + USBFS_FindHidClassDecriptor(); + if (USBFS_currentTD.count != 0u) + { + requestHandled = USBFS_InitControlRead(); + } + } + else if (CY_GET_REG8(USBFS_wValueHi) == USBFS_DESCR_HID_REPORT) + { + USBFS_FindReportDescriptor(); + if (USBFS_currentTD.count != 0u) + { + requestHandled = USBFS_InitControlRead(); + } + } + else + { /* requestHandled is initialezed as FALSE by default */ + } + break; + case USBFS_HID_GET_REPORT: + USBFS_FindReport(); + if (USBFS_currentTD.count != 0u) + { + requestHandled = USBFS_InitControlRead(); + } + break; + + case USBFS_HID_GET_IDLE: + /* This function does not support multiple reports per interface*/ + /* Validate interfaceNumber and Report ID (should be 0) */ + if( (interfaceNumber < USBFS_MAX_INTERFACES_NUMBER) && + (CY_GET_REG8(USBFS_wValueLo) == 0u ) ) /* Do not support Idle per Report ID */ + { + USBFS_currentTD.count = 1u; + USBFS_currentTD.pData = &USBFS_hidIdleRate[interfaceNumber]; + requestHandled = USBFS_InitControlRead(); + } + break; + case USBFS_HID_GET_PROTOCOL: + /* Validate interfaceNumber */ + if( interfaceNumber < USBFS_MAX_INTERFACES_NUMBER) + { + USBFS_currentTD.count = 1u; + USBFS_currentTD.pData = &USBFS_hidProtocol[interfaceNumber]; + requestHandled = USBFS_InitControlRead(); + } + break; + default: /* requestHandled is initialized as FALSE by default */ + break; + } + } + else if ((CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_DIR_MASK) == + USBFS_RQST_DIR_H2D) + { /* Control Write */ + switch (CY_GET_REG8(USBFS_bRequest)) + { + case USBFS_HID_SET_REPORT: + USBFS_FindReport(); + if (USBFS_currentTD.count != 0u) + { + requestHandled = USBFS_InitControlWrite(); + } + break; + case USBFS_HID_SET_IDLE: + /* This function does not support multiple reports per interface */ + /* Validate interfaceNumber and Report ID (should be 0) */ + if( (interfaceNumber < USBFS_MAX_INTERFACES_NUMBER) && + (CY_GET_REG8(USBFS_wValueLo) == 0u ) ) /* Do not support Idle per Report ID */ + { + USBFS_hidIdleRate[interfaceNumber] = CY_GET_REG8(USBFS_wValueHi); + /* With regards to HID spec: "7.2.4 Set_Idle Request" + * Latency. If the current period has gone past the + * newly proscribed time duration, then a report + * will be generated immediately. + */ + if(USBFS_hidIdleRate[interfaceNumber] < + USBFS_hidIdleTimer[interfaceNumber]) + { + /* Set the timer to zero and let the UpdateHIDTimer() API return IDLE_TIMER_EXPIRED status*/ + USBFS_hidIdleTimer[interfaceNumber] = 0u; + } + /* If the new request is received within 4 milliseconds + * (1 count) of the end of the current period, then the + * new request will have no effect until after the report. + */ + else if(USBFS_hidIdleTimer[interfaceNumber] <= 1u) + { + /* Do nothing. + * Let the UpdateHIDTimer() API continue to work and + * return IDLE_TIMER_EXPIRED status + */ + } + else + { /* Reload the timer*/ + USBFS_hidIdleTimer[interfaceNumber] = + USBFS_hidIdleRate[interfaceNumber]; + } + requestHandled = USBFS_InitNoDataControlTransfer(); + } + break; + + case USBFS_HID_SET_PROTOCOL: + /* Validate interfaceNumber and protocol (must be 0 or 1) */ + if( (interfaceNumber < USBFS_MAX_INTERFACES_NUMBER) && + (CY_GET_REG8(USBFS_wValueLo) <= 1u) ) + { + USBFS_hidProtocol[interfaceNumber] = CY_GET_REG8(USBFS_wValueLo); + requestHandled = USBFS_InitNoDataControlTransfer(); + } + break; + default: /* requestHandled is initialized as FALSE by default */ + break; + } + } + else + { /* requestHandled is initialized as FALSE by default */ + } + + return(requestHandled); +} + + +/******************************************************************************* +* Function Name: USB_FindHidClassDescriptor +******************************************************************************** +* +* Summary: +* This routine find Hid Class Descriptor pointer based on the Interface number +* and Alternate setting then loads the currentTD structure with the address of +* the buffer and the size. +* The HID Class Descriptor resides inside the config descriptor. +* +* Parameters: +* None. +* +* Return: +* currentTD +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_FindHidClassDecriptor(void) +{ + const T_USBFS_LUT CYCODE *pTmp; + volatile uint8 *pDescr; + uint8 interfaceN; + + pTmp = USBFS_GetConfigTablePtr(USBFS_configuration - 1u); + interfaceN = CY_GET_REG8(USBFS_wIndexLo); + /* Third entry in the LUT starts the Interface Table pointers */ + /* Now use the request interface number*/ + pTmp = &pTmp[interfaceN + 2u]; + /* USB_DEVICEx_CONFIGURATIONy_INTERFACEz_TABLE */ + pTmp = (const T_USBFS_LUT CYCODE *) pTmp->p_list; + /* Now use Alternate setting number */ + pTmp = &pTmp[USBFS_interfaceSetting[interfaceN]]; + /* USB_DEVICEx_CONFIGURATIONy_INTERFACEz_ALTERNATEi_HID_TABLE */ + pTmp = (const T_USBFS_LUT CYCODE *) pTmp->p_list; + /* Fifth entry in the LUT points to Hid Class Descriptor in Configuration Descriptor */ + pTmp = &pTmp[4u]; + pDescr = (volatile uint8 *)pTmp->p_list; + /* The first byte contains the descriptor length */ + USBFS_currentTD.count = *pDescr; + USBFS_currentTD.pData = pDescr; +} + + +/******************************************************************************* +* Function Name: USB_FindReportDescriptor +******************************************************************************** +* +* Summary: +* This routine find Hid Report Descriptor pointer based on the Interface +* number, then loads the currentTD structure with the address of the buffer +* and the size. +* Hid Report Descriptor is located after IN/OUT/FEATURE reports. +* +* Parameters: +* void +* +* Return: +* currentTD +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_FindReportDescriptor(void) +{ + const T_USBFS_LUT CYCODE *pTmp; + volatile uint8 *pDescr; + uint8 interfaceN; + + pTmp = USBFS_GetConfigTablePtr(USBFS_configuration - 1u); + interfaceN = CY_GET_REG8(USBFS_wIndexLo); + /* Third entry in the LUT starts the Interface Table pointers */ + /* Now use the request interface number */ + pTmp = &pTmp[interfaceN + 2u]; + /* USB_DEVICEx_CONFIGURATIONy_INTERFACEz_TABLE */ + pTmp = (const T_USBFS_LUT CYCODE *) pTmp->p_list; + /* Now use Alternate setting number */ + pTmp = &pTmp[USBFS_interfaceSetting[interfaceN]]; + /* USB_DEVICEx_CONFIGURATIONy_INTERFACEz_ALTERNATEi_HID_TABLE */ + pTmp = (const T_USBFS_LUT CYCODE *) pTmp->p_list; + /* Fourth entry in the LUT starts the Hid Report Descriptor */ + pTmp = &pTmp[3u]; + pDescr = (volatile uint8 *)pTmp->p_list; + /* The 1st and 2nd bytes of descriptor contain its length. LSB is 1st. */ + USBFS_currentTD.count = (((uint16)pDescr[1u] << 8u) | pDescr[0u]); + USBFS_currentTD.pData = &pDescr[2u]; +} + + +/******************************************************************************* +* Function Name: USBFS_FindReport +******************************************************************************** +* +* Summary: +* This routine sets up a transfer based on the Interface number, Report Type +* and Report ID, then loads the currentTD structure with the address of the +* buffer and the size. The caller has to decide if it is a control read or +* control write. +* +* Parameters: +* None. +* +* Return: +* currentTD +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_FindReport(void) +{ + const T_USBFS_LUT CYCODE *pTmp; + T_USBFS_TD *pTD; + uint8 interfaceN; + uint8 reportType; + + /* `#START HID_FINDREPORT` Place custom handling here */ + + /* `#END` */ + USBFS_currentTD.count = 0u; /* Init not supported condition */ + pTmp = USBFS_GetConfigTablePtr(USBFS_configuration - 1u); + reportType = CY_GET_REG8(USBFS_wValueHi); + interfaceN = CY_GET_REG8(USBFS_wIndexLo); + /* Third entry in the LUT COnfiguration Table starts the Interface Table pointers */ + /* Now use the request interface number */ + pTmp = &pTmp[interfaceN + 2u]; + /* USB_DEVICEx_CONFIGURATIONy_INTERFACEz_TABLE*/ + pTmp = (const T_USBFS_LUT CYCODE *) pTmp->p_list; + if(interfaceN < USBFS_MAX_INTERFACES_NUMBER) + { + /* Now use Alternate setting number */ + pTmp = &pTmp[USBFS_interfaceSetting[interfaceN]]; + /* USB_DEVICEx_CONFIGURATIONy_INTERFACEz_ALTERNATEi_HID_TABLE */ + pTmp = (const T_USBFS_LUT CYCODE *) pTmp->p_list; + /* Validate reportType to comply with "7.2.1 Get_Report Request" */ + if((reportType >= USBFS_HID_GET_REPORT_INPUT) && + (reportType <= USBFS_HID_GET_REPORT_FEATURE)) + { + /* Get the entry proper TD (IN, OUT or Feature Report Table)*/ + pTmp = &pTmp[reportType - 1u]; + reportType = CY_GET_REG8(USBFS_wValueLo); /* Get reportID */ + /* Validate table support by the HID descriptor, compare table count with reportID */ + if(pTmp->c >= reportType) + { + pTD = (T_USBFS_TD *) pTmp->p_list; + pTD = &pTD[reportType]; /* select entry depend on report ID*/ + USBFS_currentTD.pData = pTD->pData; /* Buffer pointer */ + USBFS_currentTD.count = pTD->count; /* Buffer Size */ + USBFS_currentTD.pStatusBlock = pTD->pStatusBlock; + } + } + } +} + + +/******************************************************************************* +* Additional user functions supporting HID Requests +********************************************************************************/ + +/* `#START HID_FUNCTIONS` Place any additional functions here */ + +/* `#END` */ + +#endif /* End USBFS_ENABLE_HID_CLASS */ + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_hid.h b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_hid.h new file mode 100755 index 0000000..9a6201c --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_hid.h @@ -0,0 +1,64 @@ +/******************************************************************************* +* File Name: USBFS_hid.h +* Version 2.60 +* +* Description: +* Header File for the USFS component. Contains prototypes and constant values. +* +******************************************************************************** +* Copyright 2008-2013, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#if !defined(CY_USBFS_USBFS_hid_H) +#define CY_USBFS_USBFS_hid_H + +#include "cytypes.h" + + +/*************************************** +* Prototypes of the USBFS_hid API. +***************************************/ + +uint8 USBFS_UpdateHIDTimer(uint8 interface) ; +uint8 USBFS_GetProtocol(uint8 interface) ; + + +/*************************************** +*Renamed Functions for backward compatible +***************************************/ + +#define USBFS_bGetProtocol USBFS_GetProtocol + + +/*************************************** +* Constants for USBFS_hid API. +***************************************/ + +#define USBFS_PROTOCOL_BOOT (0x00u) +#define USBFS_PROTOCOL_REPORT (0x01u) + +/* Request Types (HID Chapter 7.2) */ +#define USBFS_HID_GET_REPORT (0x01u) +#define USBFS_HID_GET_IDLE (0x02u) +#define USBFS_HID_GET_PROTOCOL (0x03u) +#define USBFS_HID_SET_REPORT (0x09u) +#define USBFS_HID_SET_IDLE (0x0Au) +#define USBFS_HID_SET_PROTOCOL (0x0Bu) + +/* Descriptor Types (HID Chapter 7.1) */ +#define USBFS_DESCR_HID_CLASS (0x21u) +#define USBFS_DESCR_HID_REPORT (0x22u) +#define USBFS_DESCR_HID_PHYSICAL (0x23u) + +/* Report Request Types (HID Chapter 7.2.1) */ +#define USBFS_HID_GET_REPORT_INPUT (0x01u) +#define USBFS_HID_GET_REPORT_OUTPUT (0x02u) +#define USBFS_HID_GET_REPORT_FEATURE (0x03u) + +#endif /* End CY_USBFS_USBFS_hid_H */ + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_midi.c b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_midi.c new file mode 100755 index 0000000..1f0ce51 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_midi.c @@ -0,0 +1,1341 @@ +/******************************************************************************* +* File Name: USBFS_midi.c +* Version 2.60 +* +* Description: +* MIDI Streaming request handler. +* This file contains routines for sending and receiving MIDI +* messages, and handles running status in both directions. +* +******************************************************************************** +* Copyright 2008-2013, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#include "USBFS.h" + +#if defined(USBFS_ENABLE_MIDI_STREAMING) + +#include "USBFS_midi.h" +#include "USBFS_pvt.h" + + +/*************************************** +* MIDI Constants +***************************************/ + +#if (USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF) + /* The Size of the MIDI messages (MIDI Table 4-1) */ + static const uint8 CYCODE USBFS_MIDI_SIZE[] = { + /* Miscellaneous function codes(Reserved) */ 0x03u, + /* Cable events (Reserved) */ 0x03u, + /* Two-byte System Common messages */ 0x02u, + /* Three-byte System Common messages */ 0x03u, + /* SysEx starts or continues */ 0x03u, + /* Single-byte System Common Message or + SysEx ends with following single byte */ 0x01u, + /* SysEx ends with following two bytes */ 0x02u, + /* SysEx ends with following three bytes */ 0x03u, + /* Note-off */ 0x03u, + /* Note-on */ 0x03u, + /* Poly-KeyPress */ 0x03u, + /* Control Change */ 0x03u, + /* Program Change */ 0x02u, + /* Channel Pressure */ 0x02u, + /* PitchBend Change */ 0x03u, + /* Single Byte */ 0x01u + }; +#endif /* USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF */ + + + +/*************************************** +* Global variables +***************************************/ + +#if (USBFS_MIDI_IN_BUFF_SIZE > 0) + #if (USBFS_MIDI_IN_BUFF_SIZE >= 256) + volatile uint16 USBFS_midiInPointer; /* Input endpoint buffer pointer */ + #else + volatile uint8 USBFS_midiInPointer; /* Input endpoint buffer pointer */ + #endif /* End USBFS_MIDI_IN_BUFF_SIZE >=256 */ + volatile uint8 USBFS_midi_in_ep; /* Input endpoint number */ + uint8 USBFS_midiInBuffer[USBFS_MIDI_IN_BUFF_SIZE]; /* Input endpoint buffer */ +#endif /* USBFS_MIDI_IN_BUFF_SIZE > 0 */ + +#if (USBFS_MIDI_OUT_BUFF_SIZE > 0) + volatile uint8 USBFS_midi_out_ep; /* Output endpoint number */ + uint8 USBFS_midiOutBuffer[USBFS_MIDI_OUT_BUFF_SIZE]; /* Output endpoint buffer */ +#endif /* USBFS_MIDI_OUT_BUFF_SIZE > 0 */ + +#if (USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF) + static USBFS_MIDI_RX_STATUS USBFS_MIDI1_Event; /* MIDI RX status structure */ + static volatile uint8 USBFS_MIDI1_TxRunStat; /* MIDI Output running status */ + volatile uint8 USBFS_MIDI1_InqFlags; /* Device inquiry flag */ + + #if (USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF) + static USBFS_MIDI_RX_STATUS USBFS_MIDI2_Event; /* MIDI RX status structure */ + static volatile uint8 USBFS_MIDI2_TxRunStat; /* MIDI Output running status */ + volatile uint8 USBFS_MIDI2_InqFlags; /* Device inquiry flag */ + #endif /* End USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF */ +#endif /* End USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF */ + + +/*************************************** +* Custom Declarations +***************************************/ + +/* `#START MIDI_CUSTOM_DECLARATIONS` Place your declaration here */ + +/* `#END` */ + + +/*************************************** +* Optional MIDI APIs +***************************************/ +#if (USBFS_ENABLE_MIDI_API != 0u) + + +/******************************************************************************* +* Function Name: USBFS_MIDI_EP_Init +******************************************************************************** +* +* Summary: +* This function initializes the MIDI interface and UART(s) to be ready to +* receive data from the PC and MIDI ports. +* +* Parameters: +* None +* +* Return: +* None +* +* Global variables: +* USBFS_midiInBuffer: This buffer is used for saving and combining +* the received data from UART(s) and(or) generated internally by +* PutUsbMidiIn() function messages. USBFS_MIDI_IN_EP_Service() +* function transfers the data from this buffer to the PC. +* USBFS_midiOutBuffer: This buffer is used by the +* USBFS_MIDI_OUT_EP_Service() function for saving the received +* from the PC data, then the data are parsed and transferred to UART(s) +* buffer and to the internal processing by the +* USBFS_callbackLocalMidiEvent function. +* USBFS_midi_out_ep: Used as an OUT endpoint number. +* USBFS_midi_in_ep: Used as an IN endpoint number. +* USBFS_midiInPointer: Initialized to zero. +* +* Reentrant: +* No +* +*******************************************************************************/ +void USBFS_MIDI_EP_Init(void) +{ + #if (USBFS_MIDI_IN_BUFF_SIZE > 0) + USBFS_midiInPointer = 0u; + #endif /* USBFS_MIDI_IN_BUFF_SIZE > 0 */ + + #if(USBFS_EP_MM == USBFS__EP_DMAAUTO) + #if (USBFS_MIDI_IN_BUFF_SIZE > 0) + /* Init DMA configurations for IN EP*/ + USBFS_LoadInEP(USBFS_midi_in_ep, USBFS_midiInBuffer, + USBFS_MIDI_IN_BUFF_SIZE); + + #endif /* USBFS_MIDI_IN_BUFF_SIZE > 0 */ + #if (USBFS_MIDI_OUT_BUFF_SIZE > 0) + /* Init DMA configurations for OUT EP*/ + (void)USBFS_ReadOutEP(USBFS_midi_out_ep, USBFS_midiOutBuffer, + USBFS_MIDI_OUT_BUFF_SIZE); + #endif /*USBFS_MIDI_OUT_BUFF_SIZE > 0 */ + #endif /* End USBFS__EP_DMAAUTO */ + + #if (USBFS_MIDI_OUT_BUFF_SIZE > 0) + USBFS_EnableOutEP(USBFS_midi_out_ep); + #endif /* USBFS_MIDI_OUT_BUFF_SIZE > 0 */ + + /* Initialize the MIDI port(s) */ + #if (USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF) + USBFS_MIDI_Init(); + #endif /* USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF */ +} + +#if (USBFS_MIDI_OUT_BUFF_SIZE > 0) + + + /******************************************************************************* + * Function Name: USBFS_MIDI_OUT_EP_Service + ******************************************************************************** + * + * Summary: + * Services the USB MIDI OUT endpoints. + * This function is called from OUT EP ISR. It transfers the received from PC + * data to the external MIDI port(UART TX buffer) and calls the + * USBFS_callbackLocalMidiEvent() function to internal process + * of the MIDI data. + * This function is blocked by UART, if not enough space is available in UART + * TX buffer. Therefore it is recommended to use large UART TX buffer size. + * + * Parameters: + * None + * + * Return: + * None + * + * Global variables: + * USBFS_midiOutBuffer: Used as temporary buffer between USB internal + * memory and UART TX buffer. + * USBFS_midi_out_ep: Used as an OUT endpoint number. + * + * Reentrant: + * No + * + *******************************************************************************/ + void USBFS_MIDI_OUT_EP_Service(void) + { + #if USBFS_MIDI_OUT_BUFF_SIZE >= 256 + uint16 outLength; + uint16 outPointer; + #else + uint8 outLength; + uint8 outPointer; + #endif /* End USBFS_MIDI_OUT_BUFF_SIZE >=256 */ + + uint8 dmaState = 0u; + + /* Service the USB MIDI output endpoint */ + if (USBFS_GetEPState(USBFS_midi_out_ep) == USBFS_OUT_BUFFER_FULL) + { + #if USBFS_MIDI_OUT_BUFF_SIZE >= 256 + outLength = USBFS_GetEPCount(USBFS_midi_out_ep); + #else + outLength = (uint8)USBFS_GetEPCount(USBFS_midi_out_ep); + #endif /* End USBFS_MIDI_OUT_BUFF_SIZE >= 256 */ + #if(USBFS_EP_MM != USBFS__EP_DMAAUTO) + #if USBFS_MIDI_OUT_BUFF_SIZE >= 256 + outLength = USBFS_ReadOutEP(USBFS_midi_out_ep, + USBFS_midiOutBuffer, outLength); + #else + outLength = (uint8)USBFS_ReadOutEP(USBFS_midi_out_ep, + USBFS_midiOutBuffer, (uint16)outLength); + #endif /* End USBFS_MIDI_OUT_BUFF_SIZE >= 256 */ + #if(USBFS_EP_MM == USBFS__EP_DMAMANUAL) + do /* wait for DMA transfer complete */ + { + (void)CyDmaChStatus(USBFS_DmaChan[USBFS_midi_out_ep], NULL, &dmaState); + }while((dmaState & (STATUS_TD_ACTIVE | STATUS_CHAIN_ACTIVE)) != 0u); + #endif /* End USBFS_EP_MM == USBFS__EP_DMAMANUAL */ + #endif /* End USBFS_EP_MM != USBFS__EP_DMAAUTO */ + if(dmaState != 0u) + { + /* Suppress compiler warning */ + } + if (outLength >= USBFS_EVENT_LENGTH) + { + outPointer = 0u; + while (outPointer < outLength) + { + /* In some OS OUT packet could be appended by nulls which could be skipped */ + if (USBFS_midiOutBuffer[outPointer] == 0u) + { + break; + } + /* Route USB MIDI to the External connection */ + #if (USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF) + if ((USBFS_midiOutBuffer[outPointer] & USBFS_CABLE_MASK) == + USBFS_MIDI_CABLE_00) + { + USBFS_MIDI1_ProcessUsbOut(&USBFS_midiOutBuffer[outPointer]); + } + else if ((USBFS_midiOutBuffer[outPointer] & USBFS_CABLE_MASK) == + USBFS_MIDI_CABLE_01) + { + #if (USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF) + USBFS_MIDI2_ProcessUsbOut(&USBFS_midiOutBuffer[outPointer]); + #endif /* End USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF */ + } + else + { + /* `#START CUSTOM_MIDI_OUT_EP_SERV` Place your code here */ + + /* `#END` */ + } + #endif /* End USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF */ + + /* Process any local MIDI output functions */ + USBFS_callbackLocalMidiEvent( + USBFS_midiOutBuffer[outPointer] & USBFS_CABLE_MASK, + &USBFS_midiOutBuffer[outPointer + USBFS_EVENT_BYTE1]); + outPointer += USBFS_EVENT_LENGTH; + } + } + #if(USBFS_EP_MM == USBFS__EP_DMAAUTO) + /* Enable Out EP*/ + USBFS_EnableOutEP(USBFS_midi_out_ep); + #endif /* End USBFS_EP_MM == USBFS__EP_DMAAUTO */ + } + } + +#endif /* #if (USBFS_MIDI_OUT_BUFF_SIZE > 0) */ + +#if (USBFS_MIDI_IN_BUFF_SIZE > 0) + + + /******************************************************************************* + * Function Name: USBFS_MIDI_IN_EP_Service + ******************************************************************************** + * + * Summary: + * Services the USB MIDI IN endpoint. Non-blocking. + * Checks that previous packet was processed by HOST, otherwise service the + * input endpoint on the subsequent call. It is called from the + * USBFS_MIDI_IN_Service() and from the + * USBFS_PutUsbMidiIn() function. + * + * Parameters: + * None + * + * Return: + * None + * + * Global variables: + * USBFS_midi_in_ep: Used as an IN endpoint number. + * USBFS_midiInBuffer: Function loads the data from this buffer to + * the USB IN endpoint. + * USBFS_midiInPointer: Cleared to zero when data are sent. + * + * Reentrant: + * No + * + *******************************************************************************/ + void USBFS_MIDI_IN_EP_Service(void) + { + /* Service the USB MIDI input endpoint */ + /* Check that previous packet was processed by HOST, otherwise service the USB later */ + if (USBFS_midiInPointer != 0u) + { + if(USBFS_GetEPState(USBFS_midi_in_ep) == USBFS_EVENT_PENDING) + { + #if(USBFS_EP_MM != USBFS__EP_DMAAUTO) + USBFS_LoadInEP(USBFS_midi_in_ep, USBFS_midiInBuffer, + (uint16)USBFS_midiInPointer); + #else /* USBFS_EP_MM != USBFS__EP_DMAAUTO */ + /* rearm IN EP */ + USBFS_LoadInEP(USBFS_midi_in_ep, NULL, (uint16)USBFS_midiInPointer); + #endif /* End USBFS_EP_MM != USBFS__EP_DMAAUTO*/ + + /* Clear the midiInPointer. For DMA mode, clear this pointer in the ARB ISR when data are moved by DMA */ + #if(USBFS_EP_MM == USBFS__EP_MANUAL) + USBFS_midiInPointer = 0u; + #endif /* USBFS_EP_MM == USBFS__EP_MANUAL */ + } + } + } + + + /******************************************************************************* + * Function Name: USBFS_MIDI_IN_Service + ******************************************************************************** + * + * Summary: + * Services the traffic from the MIDI input ports (RX UART) and prepare data + * in USB MIDI IN endpoint buffer. + * Calls the USBFS_MIDI_IN_EP_Service() function to sent the + * data from buffer to PC. Non-blocking. Should be called from main foreground + * task. + * This function is not protected from the reentrant calls. When it is required + * to use this function in UART RX ISR to guaranty low latency, care should be + * taken to protect from reentrant calls. + * + * Parameters: + * None + * + * Return: + * None + * + * Global variables: + * USBFS_midiInPointer: Cleared to zero when data are sent. + * + * Reentrant: + * No + * + *******************************************************************************/ + void USBFS_MIDI_IN_Service(void) + { + /* Service the MIDI UART inputs until either both receivers have no more + * events or until the input endpoint buffer fills up. + */ + #if (USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF) + uint8 m1 = 0u; + uint8 m2 = 0u; + do + { + if (USBFS_midiInPointer <= (USBFS_MIDI_IN_BUFF_SIZE - USBFS_EVENT_LENGTH)) + { + /* Check MIDI1 input port for a complete event */ + m1 = USBFS_MIDI1_GetEvent(); + if (m1 != 0u) + { + USBFS_PrepareInBuffer(m1, (uint8 *)&USBFS_MIDI1_Event.msgBuff[0], + USBFS_MIDI1_Event.size, USBFS_MIDI_CABLE_00); + } + } + + #if (USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF) + if (USBFS_midiInPointer <= (USBFS_MIDI_IN_BUFF_SIZE - USBFS_EVENT_LENGTH)) + { + /* Check MIDI2 input port for a complete event */ + m2 = USBFS_MIDI2_GetEvent(); + if (m2 != 0u) + { + USBFS_PrepareInBuffer(m2, (uint8 *)&USBFS_MIDI2_Event.msgBuff[0], + USBFS_MIDI2_Event.size, USBFS_MIDI_CABLE_01); + } + } + #endif /* End USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF */ + + }while( (USBFS_midiInPointer <= (USBFS_MIDI_IN_BUFF_SIZE - USBFS_EVENT_LENGTH)) + && ((m1 != 0u) || (m2 != 0u)) ); + #endif /* End USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF */ + + /* Service the USB MIDI input endpoint */ + USBFS_MIDI_IN_EP_Service(); + } + + + /******************************************************************************* + * Function Name: USBFS_PutUsbMidiIn + ******************************************************************************** + * + * Summary: + * Puts one MIDI messages into the USB MIDI In endpoint buffer. These are + * MIDI input messages to the host. This function is only used if the device + * has internal MIDI input functionality. USBMIDI_MIDI_IN_Service() function + * should additionally be called to send the message from local buffer to + * IN endpoint. + * + * Parameters: + * ic: 0 = No message (should never happen) + * 1 - 3 = Complete MIDI message in midiMsg + * 3 - IN EP LENGTH = Complete SySEx message(without EOSEX byte) in + * midiMsg. The length is limited by the max BULK EP size(64) + * MIDI_SYSEX = Start or continuation of SysEx message + * (put event bytes in midiMsg buffer) + * MIDI_EOSEX = End of SysEx message + * (put event bytes in midiMsg buffer) + * MIDI_TUNEREQ = Tune Request message (single byte system common msg) + * 0xf8 - 0xff = Single byte real-time message + * midiMsg: pointer to MIDI message. + * cable: cable number. + * + * Return: + * USBFS_TRUE if error. + * USBFS_FALSE if success. + * + * Global variables: + * USBFS_midi_in_ep: MIDI IN endpoint number used for sending data. + * USBFS_midiInPointer: Checked this variable to see if there is + * enough free space in the IN endpoint buffer. If buffer is full, initiate + * sending to PC. + * + * Reentrant: + * No + * + *******************************************************************************/ + uint8 USBFS_PutUsbMidiIn(uint8 ic, const uint8 midiMsg[], uint8 cable) + + { + uint8 retError = USBFS_FALSE; + uint8 msgIndex; + + /* Protect PrepareInBuffer() function from concurrent calls */ + #if (USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF) + MIDI1_UART_DisableRxInt(); + #if (USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF) + MIDI2_UART_DisableRxInt(); + #endif /* End USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF */ + #endif /* End USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF */ + + if (USBFS_midiInPointer > + (USBFS_EP[USBFS_midi_in_ep].bufferSize - USBFS_EVENT_LENGTH)) + { + USBFS_MIDI_IN_EP_Service(); + } + if (USBFS_midiInPointer <= + (USBFS_EP[USBFS_midi_in_ep].bufferSize - USBFS_EVENT_LENGTH)) + { + if((ic < USBFS_EVENT_LENGTH) || (ic >= USBFS_MIDI_STATUS_MASK)) + { + USBFS_PrepareInBuffer(ic, midiMsg, ic, cable); + } + else + { /* Only SysEx message is greater than 4 bytes */ + msgIndex = 0u; + do + { + USBFS_PrepareInBuffer(USBFS_MIDI_SYSEX, &midiMsg[msgIndex], + USBFS_EVENT_BYTE3, cable); + ic -= USBFS_EVENT_BYTE3; + msgIndex += USBFS_EVENT_BYTE3; + if (USBFS_midiInPointer > + (USBFS_EP[USBFS_midi_in_ep].bufferSize - USBFS_EVENT_LENGTH)) + { + USBFS_MIDI_IN_EP_Service(); + if (USBFS_midiInPointer > + (USBFS_EP[USBFS_midi_in_ep].bufferSize - USBFS_EVENT_LENGTH)) + { + /* Error condition. HOST is not ready to receive this packet. */ + retError = USBFS_TRUE; + break; + } + } + }while(ic > USBFS_EVENT_BYTE3); + + if(retError == USBFS_FALSE) + { + USBFS_PrepareInBuffer(USBFS_MIDI_EOSEX, midiMsg, ic, cable); + } + } + } + else + { + /* Error condition. HOST is not ready to receive this packet. */ + retError = USBFS_TRUE; + } + + #if (USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF) + MIDI1_UART_EnableRxInt(); + #if (USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF) + MIDI2_UART_EnableRxInt(); + #endif /* End USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF */ + #endif /* End USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF */ + + return (retError); + } + + + /******************************************************************************* + * Function Name: USBFS_PrepareInBuffer + ******************************************************************************** + * + * Summary: + * Builds a USB MIDI event in the input endpoint buffer at the current pointer. + * Puts one MIDI message into the USB MIDI In endpoint buffer. + * + * Parameters: + * ic: 0 = No message (should never happen) + * 1 - 3 = Complete MIDI message at pMdat[0] + * MIDI_SYSEX = Start or continuation of SysEx message + * (put eventLen bytes in buffer) + * MIDI_EOSEX = End of SysEx message + * (put eventLen bytes in buffer, + * and append MIDI_EOSEX) + * MIDI_TUNEREQ = Tune Request message (single byte system common msg) + * 0xf8 - 0xff = Single byte real-time message + * + * srcBuff: pointer to MIDI data + * eventLen: number of bytes in MIDI event + * cable: MIDI source port number + * + * Return: + * None + * + * Global variables: + * USBFS_midiInBuffer: This buffer is used for saving and combine the + * received from UART(s) and(or) generated internally by + * USBFS_PutUsbMidiIn() function messages. + * USBFS_midiInPointer: Used as an index for midiInBuffer to + * write data. + * + * Reentrant: + * No + * + *******************************************************************************/ + void USBFS_PrepareInBuffer(uint8 ic, const uint8 srcBuff[], uint8 eventLen, uint8 cable) + + { + uint8 srcBuffZero; + uint8 srcBuffOne; + + srcBuffZero = srcBuff[0u]; + srcBuffOne = srcBuff[1u]; + + if (ic >= (USBFS_MIDI_STATUS_MASK | USBFS_MIDI_SINGLE_BYTE_MASK)) + { + USBFS_midiInBuffer[USBFS_midiInPointer] = USBFS_SINGLE_BYTE | cable; + USBFS_midiInPointer++; + USBFS_midiInBuffer[USBFS_midiInPointer] = ic; + USBFS_midiInPointer++; + USBFS_midiInBuffer[USBFS_midiInPointer] = 0u; + USBFS_midiInPointer++; + USBFS_midiInBuffer[USBFS_midiInPointer] = 0u; + USBFS_midiInPointer++; + } + else if((ic < USBFS_EVENT_LENGTH) || (ic == USBFS_MIDI_SYSEX)) + { + if(ic == USBFS_MIDI_SYSEX) + { + USBFS_midiInBuffer[USBFS_midiInPointer] = USBFS_SYSEX | cable; + USBFS_midiInPointer++; + } + else if (srcBuffZero < USBFS_MIDI_SYSEX) + { + USBFS_midiInBuffer[USBFS_midiInPointer] = (srcBuffZero >> 4u) | cable; + USBFS_midiInPointer++; + } + else if (srcBuffZero == USBFS_MIDI_TUNEREQ) + { + USBFS_midiInBuffer[USBFS_midiInPointer] = USBFS_1BYTE_COMMON | cable; + USBFS_midiInPointer++; + } + else if ((srcBuffZero == USBFS_MIDI_QFM) || (srcBuffZero == USBFS_MIDI_SONGSEL)) + { + USBFS_midiInBuffer[USBFS_midiInPointer] = USBFS_2BYTE_COMMON | cable; + USBFS_midiInPointer++; + } + else if (srcBuffZero == USBFS_MIDI_SPP) + { + USBFS_midiInBuffer[USBFS_midiInPointer] = USBFS_3BYTE_COMMON | cable; + USBFS_midiInPointer++; + } + else + { + } + + USBFS_midiInBuffer[USBFS_midiInPointer] = srcBuffZero; + USBFS_midiInPointer++; + USBFS_midiInBuffer[USBFS_midiInPointer] = srcBuffOne; + USBFS_midiInPointer++; + USBFS_midiInBuffer[USBFS_midiInPointer] = srcBuff[2u]; + USBFS_midiInPointer++; + } + else if (ic == USBFS_MIDI_EOSEX) + { + switch (eventLen) + { + case 0u: + USBFS_midiInBuffer[USBFS_midiInPointer] = + USBFS_SYSEX_ENDS_WITH1 | cable; + USBFS_midiInPointer++; + USBFS_midiInBuffer[USBFS_midiInPointer] = USBFS_MIDI_EOSEX; + USBFS_midiInPointer++; + USBFS_midiInBuffer[USBFS_midiInPointer] = 0u; + USBFS_midiInPointer++; + USBFS_midiInBuffer[USBFS_midiInPointer] = 0u; + USBFS_midiInPointer++; + break; + case 1u: + USBFS_midiInBuffer[USBFS_midiInPointer] = + USBFS_SYSEX_ENDS_WITH2 | cable; + USBFS_midiInPointer++; + USBFS_midiInBuffer[USBFS_midiInPointer] = srcBuffZero; + USBFS_midiInPointer++; + USBFS_midiInBuffer[USBFS_midiInPointer] = USBFS_MIDI_EOSEX; + USBFS_midiInPointer++; + USBFS_midiInBuffer[USBFS_midiInPointer] = 0u; + USBFS_midiInPointer++; + break; + case 2u: + USBFS_midiInBuffer[USBFS_midiInPointer] = + USBFS_SYSEX_ENDS_WITH3 | cable; + USBFS_midiInPointer++; + USBFS_midiInBuffer[USBFS_midiInPointer] = srcBuffZero; + USBFS_midiInPointer++; + USBFS_midiInBuffer[USBFS_midiInPointer] = srcBuffOne; + USBFS_midiInPointer++; + USBFS_midiInBuffer[USBFS_midiInPointer] = USBFS_MIDI_EOSEX; + USBFS_midiInPointer++; + break; + default: + break; + } + } + else + { + } + } + +#endif /* #if (USBFS_MIDI_IN_BUFF_SIZE > 0) */ + + +/* The implementation for external serial input and output connections +* to route USB MIDI data to and from those connections. +*/ +#if (USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF) + + + /******************************************************************************* + * Function Name: USBFS_MIDI_Init + ******************************************************************************** + * + * Summary: + * Initializes MIDI variables and starts the UART(s) hardware block(s). + * + * Parameters: + * None + * + * Return: + * None + * + * Side Effects: + * Change the priority of the UART(s) TX interrupts to be higher than the + * default EP ISR priority. + * + * Global variables: + * USBFS_MIDI_Event: initialized to zero. + * USBFS_MIDI_TxRunStat: initialized to zero. + * + *******************************************************************************/ + void USBFS_MIDI_Init(void) + { + USBFS_MIDI1_Event.length = 0u; + USBFS_MIDI1_Event.count = 0u; + USBFS_MIDI1_Event.size = 0u; + USBFS_MIDI1_Event.runstat = 0u; + USBFS_MIDI1_TxRunStat = 0u; + USBFS_MIDI1_InqFlags = 0u; + /* Start UART block */ + MIDI1_UART_Start(); + /* Change the priority of the UART TX and RX interrupt */ + CyIntSetPriority(MIDI1_UART_TX_VECT_NUM, USBFS_CUSTOM_UART_TX_PRIOR_NUM); + CyIntSetPriority(MIDI1_UART_RX_VECT_NUM, USBFS_CUSTOM_UART_RX_PRIOR_NUM); + + #if (USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF) + USBFS_MIDI2_Event.length = 0u; + USBFS_MIDI2_Event.count = 0u; + USBFS_MIDI2_Event.size = 0u; + USBFS_MIDI2_Event.runstat = 0u; + USBFS_MIDI2_TxRunStat = 0u; + USBFS_MIDI2_InqFlags = 0u; + /* Start second UART block */ + MIDI2_UART_Start(); + /* Change the priority of the UART TX interrupt */ + CyIntSetPriority(MIDI2_UART_TX_VECT_NUM, USBFS_CUSTOM_UART_TX_PRIOR_NUM); + CyIntSetPriority(MIDI2_UART_RX_VECT_NUM, USBFS_CUSTOM_UART_RX_PRIOR_NUM); + #endif /* End USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF*/ + + /* `#START MIDI_INIT_CUSTOM` Init other extended UARTs here */ + + /* `#END` */ + + } + + + /******************************************************************************* + * Function Name: USBFS_ProcessMidiIn + ******************************************************************************** + * + * Summary: + * Processes one byte of incoming MIDI data. + * + * Parameters: + * mData = current MIDI input data byte + * *rxStat = pointer to a MIDI_RX_STATUS structure + * + * Return: + * 0, if no complete message + * 1 - 4, if message complete + * MIDI_SYSEX, if start or continuation of system exclusive + * MIDI_EOSEX, if end of system exclusive + * 0xf8 - 0xff, if single byte real time message + * + *******************************************************************************/ + uint8 USBFS_ProcessMidiIn(uint8 mData, USBFS_MIDI_RX_STATUS *rxStat) + + { + uint8 midiReturn = 0u; + + /* Check for a MIDI status byte. All status bytes, except real time messages, + * which are a single byte, force the start of a new buffer cycle. + */ + if ((mData & USBFS_MIDI_STATUS_BYTE_MASK) != 0u) + { + if ((mData & USBFS_MIDI_STATUS_MASK) == USBFS_MIDI_STATUS_MASK) + { + if ((mData & USBFS_MIDI_SINGLE_BYTE_MASK) != 0u) /* System Real-Time Messages(single byte) */ + { + midiReturn = mData; + } + else /* System Common Messages */ + { + switch (mData) + { + case USBFS_MIDI_SYSEX: + rxStat->msgBuff[0u] = USBFS_MIDI_SYSEX; + rxStat->runstat = USBFS_MIDI_SYSEX; + rxStat->count = 1u; + rxStat->length = 3u; + break; + case USBFS_MIDI_EOSEX: + rxStat->runstat = 0u; + rxStat->size = rxStat->count; + rxStat->count = 0u; + midiReturn = USBFS_MIDI_EOSEX; + break; + case USBFS_MIDI_SPP: + rxStat->msgBuff[0u] = USBFS_MIDI_SPP; + rxStat->runstat = 0u; + rxStat->count = 1u; + rxStat->length = 3u; + break; + case USBFS_MIDI_SONGSEL: + rxStat->msgBuff[0u] = USBFS_MIDI_SONGSEL; + rxStat->runstat = 0u; + rxStat->count = 1u; + rxStat->length = 2u; + break; + case USBFS_MIDI_QFM: + rxStat->msgBuff[0u] = USBFS_MIDI_QFM; + rxStat->runstat = 0u; + rxStat->count = 1u; + rxStat->length = 2u; + break; + case USBFS_MIDI_TUNEREQ: + rxStat->msgBuff[0u] = USBFS_MIDI_TUNEREQ; + rxStat->runstat = 0u; + rxStat->size = 1u; + rxStat->count = 0u; + midiReturn = rxStat->size; + break; + default: + break; + } + } + } + else /* Channel Messages */ + { + rxStat->msgBuff[0u] = mData; + rxStat->runstat = mData; + rxStat->count = 1u; + switch (mData & USBFS_MIDI_STATUS_MASK) + { + case USBFS_MIDI_NOTE_OFF: + case USBFS_MIDI_NOTE_ON: + case USBFS_MIDI_POLY_KEY_PRESSURE: + case USBFS_MIDI_CONTROL_CHANGE: + case USBFS_MIDI_PITCH_BEND_CHANGE: + rxStat->length = 3u; + break; + case USBFS_MIDI_PROGRAM_CHANGE: + case USBFS_MIDI_CHANNEL_PRESSURE: + rxStat->length = 2u; + break; + default: + rxStat->runstat = 0u; + rxStat->count = 0u; + break; + } + } + } + + /* Otherwise, it's a data byte */ + else + { + if (rxStat->runstat == USBFS_MIDI_SYSEX) + { + rxStat->msgBuff[rxStat->count] = mData; + rxStat->count++; + if (rxStat->count >= rxStat->length) + { + rxStat->size = rxStat->count; + rxStat->count = 0u; + midiReturn = USBFS_MIDI_SYSEX; + } + } + else if (rxStat->count > 0u) + { + rxStat->msgBuff[rxStat->count] = mData; + rxStat->count++; + if (rxStat->count >= rxStat->length) + { + rxStat->size = rxStat->count; + rxStat->count = 0u; + midiReturn = rxStat->size; + } + } + else if (rxStat->runstat != 0u) + { + rxStat->msgBuff[0u] = rxStat->runstat; + rxStat->msgBuff[1u] = mData; + rxStat->count = 2u; + switch (rxStat->runstat & USBFS_MIDI_STATUS_MASK) + { + case USBFS_MIDI_NOTE_OFF: + case USBFS_MIDI_NOTE_ON: + case USBFS_MIDI_POLY_KEY_PRESSURE: + case USBFS_MIDI_CONTROL_CHANGE: + case USBFS_MIDI_PITCH_BEND_CHANGE: + rxStat->length = 3u; + break; + case USBFS_MIDI_PROGRAM_CHANGE: + case USBFS_MIDI_CHANNEL_PRESSURE: + rxStat->size =rxStat->count; + rxStat->count = 0u; + midiReturn = rxStat->size; + break; + default: + rxStat->count = 0u; + break; + } + } + else + { + } + } + return (midiReturn); + } + + + /******************************************************************************* + * Function Name: USBFS_MIDI1_GetEvent + ******************************************************************************** + * + * Summary: + * Checks for incoming MIDI data, calls the MIDI event builder if so. + * Returns either empty or with a complete event. + * + * Parameters: + * None + * + * Return: + * 0, if no complete message + * 1 - 4, if message complete + * MIDI_SYSEX, if start or continuation of system exclusive + * MIDI_EOSEX, if end of system exclusive + * 0xf8 - 0xff, if single byte real time message + * + * Global variables: + * USBFS_MIDI1_Event: RX status structure used to parse received + * data. + * + *******************************************************************************/ + uint8 USBFS_MIDI1_GetEvent(void) + { + uint8 msgRtn = 0u; + uint8 rxData; + #if (MIDI1_UART_RXBUFFERSIZE >= 256u) + uint16 rxBufferRead; + #if CY_PSOC3 /* This local variable is required only for PSOC3 and large buffer */ + uint16 rxBufferWrite; + #endif /* end CY_PSOC3 */ + #else + uint8 rxBufferRead; + #endif /* End MIDI1_UART_RXBUFFERSIZE >= 256 */ + uint8 rxBufferLoopDetect; + /* Read buffer loop condition to the local variable */ + rxBufferLoopDetect = MIDI1_UART_rxBufferLoopDetect; + + if ( (MIDI1_UART_rxBufferRead != MIDI1_UART_rxBufferWrite) || (rxBufferLoopDetect != 0u) ) + { + /* Protect variables that could change on interrupt by disabling Rx interrupt.*/ + #if ((MIDI1_UART_RXBUFFERSIZE >= 256u) && (CY_PSOC3)) + CyIntDisable(MIDI1_UART_RX_VECT_NUM); + #endif /* End MIDI1_UART_RXBUFFERSIZE >= 256 */ + rxBufferRead = MIDI1_UART_rxBufferRead; + #if ((MIDI1_UART_RXBUFFERSIZE >= 256u) && (CY_PSOC3)) + rxBufferWrite = MIDI1_UART_rxBufferWrite; + CyIntEnable(MIDI1_UART_RX_VECT_NUM); + #endif /* End MIDI1_UART_RXBUFFERSIZE >= 256 */ + + /* Stay here until either the buffer is empty or we have a complete message + * in the message buffer. Note that we must use a temporary buffer pointer + * since it takes two instructions to increment with a wrap, and we can't + * risk doing that with the real pointer and getting an interrupt in between + * instructions. + */ + + #if ((MIDI1_UART_RXBUFFERSIZE >= 256u) && (CY_PSOC3)) + while ( ((rxBufferRead != rxBufferWrite) || (rxBufferLoopDetect != 0u)) && (msgRtn == 0u) ) + #else + while ( ((rxBufferRead != MIDI1_UART_rxBufferWrite) || (rxBufferLoopDetect != 0u)) && (msgRtn == 0u) ) + #endif /* End MIDI1_UART_RXBUFFERSIZE >= 256 && CY_PSOC3 */ + { + rxData = MIDI1_UART_rxBuffer[rxBufferRead]; + /* Increment pointer with a wrap */ + rxBufferRead++; + if(rxBufferRead >= MIDI1_UART_RXBUFFERSIZE) + { + rxBufferRead = 0u; + } + /* If loop condition was set - update real read buffer pointer + * to avoid overflow status + */ + if(rxBufferLoopDetect != 0u ) + { + MIDI1_UART_rxBufferLoopDetect = 0u; + #if ((MIDI1_UART_RXBUFFERSIZE >= 256u) && (CY_PSOC3)) + CyIntDisable(MIDI1_UART_RX_VECT_NUM); + #endif /* End MIDI1_UART_RXBUFFERSIZE >= 256 */ + MIDI1_UART_rxBufferRead = rxBufferRead; + #if ((MIDI1_UART_RXBUFFERSIZE >= 256u) && (CY_PSOC3)) + CyIntEnable(MIDI1_UART_RX_VECT_NUM); + #endif /* End MIDI1_UART_RXBUFFERSIZE >= 256 */ + } + + msgRtn = USBFS_ProcessMidiIn(rxData, + (USBFS_MIDI_RX_STATUS *)&USBFS_MIDI1_Event); + + /* Read buffer loop condition to the local variable */ + rxBufferLoopDetect = MIDI1_UART_rxBufferLoopDetect; + } + + /* Finally, update the real output pointer, then return with + * an indication as to whether there's a complete message in the buffer. + */ + #if ((MIDI1_UART_RXBUFFERSIZE >= 256u) && (CY_PSOC3)) + CyIntDisable(MIDI1_UART_RX_VECT_NUM); + #endif /* End MIDI1_UART_RXBUFFERSIZE >= 256 */ + MIDI1_UART_rxBufferRead = rxBufferRead; + #if ((MIDI1_UART_RXBUFFERSIZE >= 256u) && (CY_PSOC3)) + CyIntEnable(MIDI1_UART_RX_VECT_NUM); + #endif /* End MIDI1_UART_RXBUFFERSIZE >= 256 */ + } + + return (msgRtn); + } + + + /******************************************************************************* + * Function Name: USBFS_MIDI1_ProcessUsbOut + ******************************************************************************** + * + * Summary: + * Process a USB MIDI output event. + * Puts data into the MIDI TX output buffer. + * + * Parameters: + * *epBuf: pointer on MIDI event. + * + * Return: + * None + * + * Global variables: + * USBFS_MIDI1_TxRunStat: This variable used to save the MIDI + * status byte and skip to send the repeated status byte in subsequent event. + * USBFS_MIDI1_InqFlags: The following flags are set when SysEx + * message comes. + * USBFS_INQ_SYSEX_FLAG: Non-Real Time SySEx message received. + * USBFS_INQ_IDENTITY_REQ_FLAG: Identity Request received. + * This bit should be cleared by user when Identity Reply message generated. + * + *******************************************************************************/ + void USBFS_MIDI1_ProcessUsbOut(const uint8 epBuf[]) + + { + uint8 cmd; + uint8 len; + uint8 i; + + /* User code is required at the beginning of the procedure */ + /* `#START MIDI1_PROCESS_OUT_BEGIN` */ + + /* `#END` */ + + cmd = epBuf[USBFS_EVENT_BYTE0] & USBFS_CIN_MASK; + if((cmd != USBFS_RESERVED0) && (cmd != USBFS_RESERVED1)) + { + len = USBFS_MIDI_SIZE[cmd]; + i = USBFS_EVENT_BYTE1; + /* Universal System Exclusive message parsing */ + if(cmd == USBFS_SYSEX) + { + if((epBuf[USBFS_EVENT_BYTE1] == USBFS_MIDI_SYSEX) && + (epBuf[USBFS_EVENT_BYTE2] == USBFS_MIDI_SYSEX_NON_REAL_TIME)) + { /* Non-Real Time SySEx starts */ + USBFS_MIDI1_InqFlags |= USBFS_INQ_SYSEX_FLAG; + } + else + { + USBFS_MIDI1_InqFlags &= (uint8)~USBFS_INQ_SYSEX_FLAG; + } + } + else if(cmd == USBFS_SYSEX_ENDS_WITH1) + { + USBFS_MIDI1_InqFlags &= (uint8)~USBFS_INQ_SYSEX_FLAG; + } + else if(cmd == USBFS_SYSEX_ENDS_WITH2) + { + USBFS_MIDI1_InqFlags &= (uint8)~USBFS_INQ_SYSEX_FLAG; + } + else if(cmd == USBFS_SYSEX_ENDS_WITH3) + { + /* Identify Request support */ + if((USBFS_MIDI1_InqFlags & USBFS_INQ_SYSEX_FLAG) != 0u) + { + USBFS_MIDI1_InqFlags &= (uint8)~USBFS_INQ_SYSEX_FLAG; + if((epBuf[USBFS_EVENT_BYTE1] == USBFS_MIDI_SYSEX_GEN_INFORMATION) && + (epBuf[USBFS_EVENT_BYTE2] == USBFS_MIDI_SYSEX_IDENTITY_REQ)) + { /* Set the flag about received the Identity Request. + * The Identity Reply message may be send by user code. + */ + USBFS_MIDI1_InqFlags |= USBFS_INQ_IDENTITY_REQ_FLAG; + } + } + } + else /* Do nothing for other command */ + { + } + /* Running Status for Voice and Mode messages only. */ + if((cmd >= USBFS_NOTE_OFF) && ( cmd <= USBFS_PITCH_BEND_CHANGE)) + { + if(USBFS_MIDI1_TxRunStat == epBuf[USBFS_EVENT_BYTE1]) + { /* Skip the repeated Status byte */ + i++; + } + else + { /* Save Status byte for next event */ + USBFS_MIDI1_TxRunStat = epBuf[USBFS_EVENT_BYTE1]; + } + } + else + { /* Clear Running Status */ + USBFS_MIDI1_TxRunStat = 0u; + } + /* Puts data into the MIDI TX output buffer.*/ + do + { + MIDI1_UART_PutChar(epBuf[i]); + i++; + } while (i <= len); + } + + /* User code is required at the end of the procedure */ + /* `#START MIDI1_PROCESS_OUT_END` */ + + /* `#END` */ + } + +#if (USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF) + + + /******************************************************************************* + * Function Name: USBFS_MIDI2_GetEvent + ******************************************************************************** + * + * Summary: + * Checks for incoming MIDI data, calls the MIDI event builder if so. + * Returns either empty or with a complete event. + * + * Parameters: + * None + * + * Return: + * 0, if no complete message + * 1 - 4, if message complete + * MIDI_SYSEX, if start or continuation of system exclusive + * MIDI_EOSEX, if end of system exclusive + * 0xf8 - 0xff, if single byte real time message + * + * Global variables: + * USBFS_MIDI2_Event: RX status structure used to parse received + * data. + * + *******************************************************************************/ + uint8 USBFS_MIDI2_GetEvent(void) + { + uint8 msgRtn = 0u; + uint8 rxData; + #if (MIDI2_UART_RXBUFFERSIZE >= 256u) + uint16 rxBufferRead; + #if CY_PSOC3 /* This local variable required only for PSOC3 and large buffer */ + uint16 rxBufferWrite; + #endif /* end CY_PSOC3 */ + #else + uint8 rxBufferRead; + #endif /* End MIDI2_UART_RXBUFFERSIZE >= 256 */ + uint8 rxBufferLoopDetect; + /* Read buffer loop condition to the local variable */ + rxBufferLoopDetect = MIDI2_UART_rxBufferLoopDetect; + + if ( (MIDI2_UART_rxBufferRead != MIDI2_UART_rxBufferWrite) || (rxBufferLoopDetect != 0u) ) + { + /* Protect variables that could change on interrupt by disabling Rx interrupt.*/ + #if ((MIDI2_UART_RXBUFFERSIZE >= 256u) && (CY_PSOC3)) + CyIntDisable(MIDI2_UART_RX_VECT_NUM); + #endif /* End MIDI2_UART_RXBUFFERSIZE >= 256 */ + rxBufferRead = MIDI2_UART_rxBufferRead; + #if ((MIDI2_UART_RXBUFFERSIZE >= 256u) && (CY_PSOC3)) + rxBufferWrite = MIDI2_UART_rxBufferWrite; + CyIntEnable(MIDI2_UART_RX_VECT_NUM); + #endif /* End MIDI2_UART_RXBUFFERSIZE >= 256 */ + + /* Stay here until either the buffer is empty or we have a complete message + * in the message buffer. Note that we must use a temporary output pointer to + * since it takes two instructions to increment with a wrap, and we can't + * risk doing that with the real pointer and getting an interrupt in between + * instructions. + */ + + #if ((MIDI2_UART_RXBUFFERSIZE >= 256u) && (CY_PSOC3)) + while ( ((rxBufferRead != rxBufferWrite) || (rxBufferLoopDetect != 0u)) && (msgRtn == 0u) ) + #else + while ( ((rxBufferRead != MIDI2_UART_rxBufferWrite) || (rxBufferLoopDetect != 0u)) && (msgRtn == 0u) ) + #endif /* End MIDI2_UART_RXBUFFERSIZE >= 256 && CY_PSOC3 */ + { + rxData = MIDI2_UART_rxBuffer[rxBufferRead]; + rxBufferRead++; + if(rxBufferRead >= MIDI2_UART_RXBUFFERSIZE) + { + rxBufferRead = 0u; + } + /* If loop condition was set - update real read buffer pointer + * to avoid overflow status + */ + if(rxBufferLoopDetect != 0u ) + { + MIDI2_UART_rxBufferLoopDetect = 0u; + #if ((MIDI2_UART_RXBUFFERSIZE >= 256u) && (CY_PSOC3)) + CyIntDisable(MIDI2_UART_RX_VECT_NUM); + #endif /* End MIDI2_UART_RXBUFFERSIZE >= 256 */ + MIDI2_UART_rxBufferRead = rxBufferRead; + #if ((MIDI2_UART_RXBUFFERSIZE >= 256u) && (CY_PSOC3)) + CyIntEnable(MIDI2_UART_RX_VECT_NUM); + #endif /* End MIDI2_UART_RXBUFFERSIZE >= 256 */ + } + + msgRtn = USBFS_ProcessMidiIn(rxData, + (USBFS_MIDI_RX_STATUS *)&USBFS_MIDI2_Event); + + /* Read buffer loop condition to the local variable */ + rxBufferLoopDetect = MIDI2_UART_rxBufferLoopDetect; + } + + /* Finally, update the real output pointer, then return with + * an indication as to whether there's a complete message in the buffer. + */ + #if ((MIDI2_UART_RXBUFFERSIZE >= 256u) && (CY_PSOC3)) + CyIntDisable(MIDI2_UART_RX_VECT_NUM); + #endif /* End MIDI2_UART_RXBUFFERSIZE >= 256 */ + MIDI2_UART_rxBufferRead = rxBufferRead; + #if ((MIDI2_UART_RXBUFFERSIZE >= 256u) && (CY_PSOC3)) + CyIntEnable(MIDI2_UART_RX_VECT_NUM); + #endif /* End MIDI2_UART_RXBUFFERSIZE >= 256 */ + } + + return (msgRtn); + } + + + /******************************************************************************* + * Function Name: USBFS_MIDI2_ProcessUsbOut + ******************************************************************************** + * + * Summary: + * Process a USB MIDI output event. + * Puts data into the MIDI TX output buffer. + * + * Parameters: + * *epBuf: pointer on MIDI event. + * + * Return: + * None + * + * Global variables: + * USBFS_MIDI2_TxRunStat: This variable used to save the MIDI + * status byte and skip to send the repeated status byte in subsequent event. + * USBFS_MIDI2_InqFlags: The following flags are set when SysEx + * message comes. + * USBFS_INQ_SYSEX_FLAG: Non-Real Time SySEx message received. + * USBFS_INQ_IDENTITY_REQ_FLAG: Identity Request received. + * This bit should be cleared by user when Identity Reply message generated. + * + *******************************************************************************/ + void USBFS_MIDI2_ProcessUsbOut(const uint8 epBuf[]) + + { + uint8 cmd; + uint8 len; + uint8 i; + + /* User code is required at the beginning of the procedure */ + /* `#START MIDI2_PROCESS_OUT_START` */ + + /* `#END` */ + + cmd = epBuf[USBFS_EVENT_BYTE0] & USBFS_CIN_MASK; + if((cmd != USBFS_RESERVED0) && (cmd != USBFS_RESERVED1)) + { + len = USBFS_MIDI_SIZE[cmd]; + i = USBFS_EVENT_BYTE1; + /* Universal System Exclusive message parsing */ + if(cmd == USBFS_SYSEX) + { + if((epBuf[USBFS_EVENT_BYTE1] == USBFS_MIDI_SYSEX) && + (epBuf[USBFS_EVENT_BYTE2] == USBFS_MIDI_SYSEX_NON_REAL_TIME)) + { /* SySEx starts */ + USBFS_MIDI2_InqFlags |= USBFS_INQ_SYSEX_FLAG; + } + else + { + USBFS_MIDI2_InqFlags &= (uint8)~USBFS_INQ_SYSEX_FLAG; + } + } + else if(cmd == USBFS_SYSEX_ENDS_WITH1) + { + USBFS_MIDI2_InqFlags &= (uint8)~USBFS_INQ_SYSEX_FLAG; + } + else if(cmd == USBFS_SYSEX_ENDS_WITH2) + { + USBFS_MIDI2_InqFlags &= (uint8)~USBFS_INQ_SYSEX_FLAG; + } + else if(cmd == USBFS_SYSEX_ENDS_WITH3) + { + /* Identify Request support */ + if((USBFS_MIDI2_InqFlags & USBFS_INQ_SYSEX_FLAG) != 0u) + { + USBFS_MIDI2_InqFlags &= (uint8)~USBFS_INQ_SYSEX_FLAG; + if((epBuf[USBFS_EVENT_BYTE1] == USBFS_MIDI_SYSEX_GEN_INFORMATION) && + (epBuf[USBFS_EVENT_BYTE2] == USBFS_MIDI_SYSEX_IDENTITY_REQ)) + { /* Set the flag about received the Identity Request. + * The Identity Reply message may be send by user code. + */ + USBFS_MIDI2_InqFlags |= USBFS_INQ_IDENTITY_REQ_FLAG; + } + } + } + else /* Do nothing for other command */ + { + } + /* Running Status for Voice and Mode messages only. */ + if((cmd >= USBFS_NOTE_OFF) && ( cmd <= USBFS_PITCH_BEND_CHANGE)) + { + if(USBFS_MIDI2_TxRunStat == epBuf[USBFS_EVENT_BYTE1]) + { /* Skip the repeated Status byte */ + i++; + } + else + { /* Save Status byte for next event */ + USBFS_MIDI2_TxRunStat = epBuf[USBFS_EVENT_BYTE1]; + } + } + else + { /* Clear Running Status */ + USBFS_MIDI2_TxRunStat = 0u; + } + /* Puts data into the MIDI TX output buffer.*/ + do + { + MIDI2_UART_PutChar(epBuf[i]); + i++; + } while (i <= len); + } + + /* User code is required at the end of the procedure */ + /* `#START MIDI2_PROCESS_OUT_END` */ + + /* `#END` */ + } +#endif /* End USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF */ +#endif /* End USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF */ + +#endif /* End (USBFS_ENABLE_MIDI_API != 0u) */ + + +/* `#START MIDI_FUNCTIONS` Place any additional functions here */ + +/* `#END` */ + +#endif /* End defined(USBFS_ENABLE_MIDI_STREAMING) */ + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_midi.h b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_midi.h new file mode 100755 index 0000000..5a72034 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_midi.h @@ -0,0 +1,200 @@ +/******************************************************************************* +* File Name: USBFS_midi.h +* Version 2.60 +* +* Description: +* Header File for the USBFS MIDI module. +* Contains prototypes and constant values. +* +******************************************************************************** +* Copyright 2008-2013, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#if !defined(CY_USBFS_USBFS_midi_H) +#define CY_USBFS_USBFS_midi_H + +#include "cytypes.h" +#include "USBFS.h" + + +/*************************************** +* Data Struct Definition +***************************************/ + +/* The following structure is used to hold status information for + building and parsing incoming MIDI messages. */ +typedef struct +{ + uint8 length; /* expected length */ + uint8 count; /* current byte count */ + uint8 size; /* complete size */ + uint8 runstat; /* running status */ + uint8 msgBuff[4]; /* message buffer */ +} USBFS_MIDI_RX_STATUS; + + +/*************************************** +* MIDI Constants. +***************************************/ + +#define USBFS_ONE_EXT_INTRF (0x01u) +#define USBFS_TWO_EXT_INTRF (0x02u) + +/* Flag definitions for use with MIDI device inquiry */ +#define USBFS_INQ_SYSEX_FLAG (0x01u) +#define USBFS_INQ_IDENTITY_REQ_FLAG (0x02u) + +/* USB-MIDI Code Index Number Classifications (MIDI Table 4-1) */ +#define USBFS_CIN_MASK (0x0Fu) +#define USBFS_RESERVED0 (0x00u) +#define USBFS_RESERVED1 (0x01u) +#define USBFS_2BYTE_COMMON (0x02u) +#define USBFS_3BYTE_COMMON (0x03u) +#define USBFS_SYSEX (0x04u) +#define USBFS_1BYTE_COMMON (0x05u) +#define USBFS_SYSEX_ENDS_WITH1 (0x05u) +#define USBFS_SYSEX_ENDS_WITH2 (0x06u) +#define USBFS_SYSEX_ENDS_WITH3 (0x07u) +#define USBFS_NOTE_OFF (0x08u) +#define USBFS_NOTE_ON (0x09u) +#define USBFS_POLY_KEY_PRESSURE (0x0Au) +#define USBFS_CONTROL_CHANGE (0x0Bu) +#define USBFS_PROGRAM_CHANGE (0x0Cu) +#define USBFS_CHANNEL_PRESSURE (0x0Du) +#define USBFS_PITCH_BEND_CHANGE (0x0Eu) +#define USBFS_SINGLE_BYTE (0x0Fu) + +#define USBFS_CABLE_MASK (0xF0u) +#define USBFS_MIDI_CABLE_00 (0x00u) +#define USBFS_MIDI_CABLE_01 (0x10u) + +#define USBFS_EVENT_BYTE0 (0x00u) +#define USBFS_EVENT_BYTE1 (0x01u) +#define USBFS_EVENT_BYTE2 (0x02u) +#define USBFS_EVENT_BYTE3 (0x03u) +#define USBFS_EVENT_LENGTH (0x04u) + +#define USBFS_MIDI_STATUS_BYTE_MASK (0x80u) +#define USBFS_MIDI_STATUS_MASK (0xF0u) +#define USBFS_MIDI_SINGLE_BYTE_MASK (0x08u) +#define USBFS_MIDI_NOTE_OFF (0x80u) +#define USBFS_MIDI_NOTE_ON (0x90u) +#define USBFS_MIDI_POLY_KEY_PRESSURE (0xA0u) +#define USBFS_MIDI_CONTROL_CHANGE (0xB0u) +#define USBFS_MIDI_PROGRAM_CHANGE (0xC0u) +#define USBFS_MIDI_CHANNEL_PRESSURE (0xD0u) +#define USBFS_MIDI_PITCH_BEND_CHANGE (0xE0u) +#define USBFS_MIDI_SYSEX (0xF0u) +#define USBFS_MIDI_EOSEX (0xF7u) +#define USBFS_MIDI_QFM (0xF1u) +#define USBFS_MIDI_SPP (0xF2u) +#define USBFS_MIDI_SONGSEL (0xF3u) +#define USBFS_MIDI_TUNEREQ (0xF6u) +#define USBFS_MIDI_ACTIVESENSE (0xFEu) + +/* MIDI Universal System Exclusive defines */ +#define USBFS_MIDI_SYSEX_NON_REAL_TIME (0x7Eu) +#define USBFS_MIDI_SYSEX_REALTIME (0x7Fu) +/* ID of target device */ +#define USBFS_MIDI_SYSEX_ID_ALL (0x7Fu) +/* Sub-ID#1*/ +#define USBFS_MIDI_SYSEX_GEN_INFORMATION (0x06u) +#define USBFS_MIDI_SYSEX_GEN_MESSAGE (0x09u) +/* Sub-ID#2*/ +#define USBFS_MIDI_SYSEX_IDENTITY_REQ (0x01u) +#define USBFS_MIDI_SYSEX_IDENTITY_REPLY (0x02u) +#define USBFS_MIDI_SYSEX_SYSTEM_ON (0x01u) +#define USBFS_MIDI_SYSEX_SYSTEM_OFF (0x02u) + +#define USBFS_CUSTOM_UART_TX_PRIOR_NUM (0x04u) +#define USBFS_CUSTOM_UART_RX_PRIOR_NUM (0x02u) + +#define USBFS_ISR_SERVICE_MIDI_OUT \ + ( (USBFS_ENABLE_MIDI_API != 0u) && \ + (USBFS_MIDI_OUT_BUFF_SIZE > 0) && (USBFS_EP_MM == USBFS__EP_DMAAUTO) ) +#define USBFS_ISR_SERVICE_MIDI_IN \ + ( (USBFS_ENABLE_MIDI_API != 0u) && (USBFS_MIDI_IN_BUFF_SIZE > 0) ) + +/*************************************** +* External function references +***************************************/ + +void USBFS_callbackLocalMidiEvent(uint8 cable, uint8 *midiMsg) + ; + + +/*************************************** +* External references +***************************************/ + +#if (USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF) + #include "MIDI1_UART.h" +#endif /* End USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF */ +#if (USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF) + #include "MIDI2_UART.h" +#endif /* End USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF */ +#if(USBFS_EP_MM != USBFS__EP_MANUAL) + #include +#endif /* End USBFS_EP_MM */ + + +/*************************************** +* Private function prototypes +***************************************/ + +void USBFS_PrepareInBuffer(uint8 ic, const uint8 srcBuff[], uint8 eventLen, uint8 cable) + ; +#if (USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF) + void USBFS_MIDI_Init(void) ; + uint8 USBFS_ProcessMidiIn(uint8 mData, USBFS_MIDI_RX_STATUS *rxStat) + ; + uint8 USBFS_MIDI1_GetEvent(void) ; + void USBFS_MIDI1_ProcessUsbOut(const uint8 epBuf[]) + ; + + #if (USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF) + uint8 USBFS_MIDI2_GetEvent(void) ; + void USBFS_MIDI2_ProcessUsbOut(const uint8 epBuf[]) + ; + #endif /* End USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF */ +#endif /* End USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF */ + + +/*************************************** +* External data references +***************************************/ + +#if defined(USBFS_ENABLE_MIDI_STREAMING) + +#if (USBFS_MIDI_IN_BUFF_SIZE > 0) + #if (USBFS_MIDI_IN_BUFF_SIZE >= 256) + extern volatile uint16 USBFS_midiInPointer; /* Input endpoint buffer pointer */ + #else + extern volatile uint8 USBFS_midiInPointer; /* Input endpoint buffer pointer */ + #endif /* End USBFS_MIDI_IN_BUFF_SIZE >=256 */ + extern volatile uint8 USBFS_midi_in_ep; /* Input endpoint number */ + extern uint8 USBFS_midiInBuffer[USBFS_MIDI_IN_BUFF_SIZE]; /* Input endpoint buffer */ +#endif /* USBFS_MIDI_IN_BUFF_SIZE > 0 */ + +#if (USBFS_MIDI_OUT_BUFF_SIZE > 0) + extern volatile uint8 USBFS_midi_out_ep; /* Output endpoint number */ + extern uint8 USBFS_midiOutBuffer[USBFS_MIDI_OUT_BUFF_SIZE]; /* Output endpoint buffer */ +#endif /* USBFS_MIDI_OUT_BUFF_SIZE > 0 */ + +#if (USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF) + extern volatile uint8 USBFS_MIDI1_InqFlags; /* Device inquiry flag */ + #if (USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF) + extern volatile uint8 USBFS_MIDI2_InqFlags; /* Device inquiry flag */ + #endif /* End USBFS_MIDI_EXT_MODE >= USBFS_TWO_EXT_INTRF */ +#endif /* End USBFS_MIDI_EXT_MODE >= USBFS_ONE_EXT_INTRF */ + +#endif /* USBFS_ENABLE_MIDI_STREAMING */ + + +#endif /* End CY_USBFS_USBFS_midi_H */ + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_pm.c b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_pm.c new file mode 100755 index 0000000..00c88f6 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_pm.c @@ -0,0 +1,277 @@ +/******************************************************************************* +* File Name: USBFS_pm.c +* Version 2.60 +* +* Description: +* This file provides Suspend/Resume APIs functionality. +* +* Note: +* +******************************************************************************** +* Copyright 2008-2013, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#include "project.h" +#include "USBFS.h" +#include "USBFS_pvt.h" + + +/*************************************** +* Custom Declarations +***************************************/ +/* `#START PM_CUSTOM_DECLARATIONS` Place your declaration here */ + +/* `#END` */ + + +/*************************************** +* Local data allocation +***************************************/ + +static USBFS_BACKUP_STRUCT USBFS_backup; + + +#if(USBFS_DP_ISR_REMOVE == 0u) + + + /******************************************************************************* + * Function Name: USBFS_DP_Interrupt + ******************************************************************************** + * + * Summary: + * This Interrupt Service Routine handles DP pin changes for wake-up from + * the sleep mode. + * + * Parameters: + * None. + * + * Return: + * None. + * + *******************************************************************************/ + CY_ISR(USBFS_DP_ISR) + { + /* `#START DP_USER_CODE` Place your code here */ + + /* `#END` */ + + /* Clears active interrupt */ + CY_GET_REG8(USBFS_DP_INTSTAT_PTR); + } + +#endif /* (USBFS_DP_ISR_REMOVE == 0u) */ + + +/******************************************************************************* +* Function Name: USBFS_SaveConfig +******************************************************************************** +* +* Summary: +* Saves the current user configuration. +* +* Parameters: +* None. +* +* Return: +* None. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_SaveConfig(void) +{ + +} + + +/******************************************************************************* +* Function Name: USBFS_RestoreConfig +******************************************************************************** +* +* Summary: +* Restores the current user configuration. +* +* Parameters: +* None. +* +* Return: +* None. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_RestoreConfig(void) +{ + if(USBFS_configuration != 0u) + { + USBFS_ConfigReg(); + } +} + + +/******************************************************************************* +* Function Name: USBFS_Suspend +******************************************************************************** +* +* Summary: +* This function disables the USBFS block and prepares for power donwn mode. +* +* Parameters: +* None. +* +* Return: +* None. +* +* Global variables: +* USBFS_backup.enable: modified. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_Suspend(void) +{ + uint8 enableInterrupts; + enableInterrupts = CyEnterCriticalSection(); + + if((CY_GET_REG8(USBFS_CR0_PTR) & USBFS_CR0_ENABLE) != 0u) + { /* USB block is enabled */ + USBFS_backup.enableState = 1u; + + #if(USBFS_EP_MM != USBFS__EP_MANUAL) + USBFS_Stop_DMA(USBFS_MAX_EP); /* Stop all DMAs */ + #endif /* End USBFS_EP_MM != USBFS__EP_MANUAL */ + + /* Ensure USB transmit enable is low (USB_USBIO_CR0.ten). - Manual Transmission - Disabled */ + USBFS_USBIO_CR0_REG &= (uint8)~USBFS_USBIO_CR0_TEN; + CyDelayUs(0u); /*~50ns delay */ + + /* Disable the USBIO by asserting PM.USB_CR0.fsusbio_pd_n(Inverted) and pd_pullup_hv(Inverted) high. */ + USBFS_PM_USB_CR0_REG &= + (uint8)~(USBFS_PM_USB_CR0_PD_N | USBFS_PM_USB_CR0_PD_PULLUP_N); + + /* Disable the SIE */ + USBFS_CR0_REG &= (uint8)~USBFS_CR0_ENABLE; + + CyDelayUs(0u); /*~50ns delay */ + /* Store mode and Disable VRegulator*/ + USBFS_backup.mode = USBFS_CR1_REG & USBFS_CR1_REG_ENABLE; + USBFS_CR1_REG &= (uint8)~USBFS_CR1_REG_ENABLE; + + CyDelayUs(1u); /* 0.5 us min delay */ + /* Disable the USBIO reference by setting PM.USB_CR0.fsusbio_ref_en.*/ + USBFS_PM_USB_CR0_REG &= (uint8)~USBFS_PM_USB_CR0_REF_EN; + + /* Switch DP and DM terminals to GPIO mode and disconnect 1.5k pullup*/ + USBFS_USBIO_CR1_REG |= USBFS_USBIO_CR1_IOMODE; + + /* Disable USB in ACT PM */ + USBFS_PM_ACT_CFG_REG &= (uint8)~USBFS_PM_ACT_EN_FSUSB; + /* Disable USB block for Standby Power Mode */ + USBFS_PM_STBY_CFG_REG &= (uint8)~USBFS_PM_STBY_EN_FSUSB; + CyDelayUs(1u); /* min 0.5us delay required */ + + } + else + { + USBFS_backup.enableState = 0u; + } + CyExitCriticalSection(enableInterrupts); + + /* Set the DP Interrupt for wake-up from sleep mode. */ + #if(USBFS_DP_ISR_REMOVE == 0u) + (void) CyIntSetVector(USBFS_DP_INTC_VECT_NUM, &USBFS_DP_ISR); + CyIntSetPriority(USBFS_DP_INTC_VECT_NUM, USBFS_DP_INTC_PRIOR); + CyIntClearPending(USBFS_DP_INTC_VECT_NUM); + CyIntEnable(USBFS_DP_INTC_VECT_NUM); + #endif /* (USBFS_DP_ISR_REMOVE == 0u) */ + +} + + +/******************************************************************************* +* Function Name: USBFS_Resume +******************************************************************************** +* +* Summary: +* This function enables the USBFS block after power down mode. +* +* Parameters: +* None. +* +* Return: +* None. +* +* Global variables: +* USBFS_backup - checked. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_Resume(void) +{ + uint8 enableInterrupts; + enableInterrupts = CyEnterCriticalSection(); + + if(USBFS_backup.enableState != 0u) + { + #if(USBFS_DP_ISR_REMOVE == 0u) + CyIntDisable(USBFS_DP_INTC_VECT_NUM); + #endif /* End USBFS_DP_ISR_REMOVE */ + + /* Enable USB block */ + USBFS_PM_ACT_CFG_REG |= USBFS_PM_ACT_EN_FSUSB; + /* Enable USB block for Standby Power Mode */ + USBFS_PM_STBY_CFG_REG |= USBFS_PM_STBY_EN_FSUSB; + /* Enable core clock */ + USBFS_USB_CLK_EN_REG |= USBFS_USB_CLK_ENABLE; + + /* Enable the USBIO reference by setting PM.USB_CR0.fsusbio_ref_en.*/ + USBFS_PM_USB_CR0_REG |= USBFS_PM_USB_CR0_REF_EN; + /* The reference will be available ~40us after power restored */ + CyDelayUs(40u); + /* Return VRegulator*/ + USBFS_CR1_REG |= USBFS_backup.mode; + CyDelayUs(0u); /*~50ns delay */ + /* Enable USBIO */ + USBFS_PM_USB_CR0_REG |= USBFS_PM_USB_CR0_PD_N; + CyDelayUs(2u); + /* Set the USBIO pull-up enable */ + USBFS_PM_USB_CR0_REG |= USBFS_PM_USB_CR0_PD_PULLUP_N; + + /* Reinit Arbiter configuration for DMA transfers */ + #if(USBFS_EP_MM != USBFS__EP_MANUAL) + /* usb arb interrupt enable */ + USBFS_ARB_INT_EN_REG = USBFS_ARB_INT_MASK; + #if(USBFS_EP_MM == USBFS__EP_DMAMANUAL) + USBFS_ARB_CFG_REG = USBFS_ARB_CFG_MANUAL_DMA; + #endif /* End USBFS_EP_MM == USBFS__EP_DMAMANUAL */ + #if(USBFS_EP_MM == USBFS__EP_DMAAUTO) + /*Set cfg cmplt this rises DMA request when the full configuration is done */ + USBFS_ARB_CFG_REG = USBFS_ARB_CFG_AUTO_DMA | USBFS_ARB_CFG_AUTO_MEM; + #endif /* End USBFS_EP_MM == USBFS__EP_DMAAUTO */ + #endif /* End USBFS_EP_MM != USBFS__EP_MANUAL */ + + /* STALL_IN_OUT */ + CY_SET_REG8(USBFS_EP0_CR_PTR, USBFS_MODE_STALL_IN_OUT); + /* Enable the SIE with a last address */ + USBFS_CR0_REG |= USBFS_CR0_ENABLE; + CyDelayCycles(1u); + /* Finally, Enable d+ pullup and select iomode to USB mode*/ + CY_SET_REG8(USBFS_USBIO_CR1_PTR, USBFS_USBIO_CR1_USBPUEN); + + /* Restore USB register settings */ + USBFS_RestoreConfig(); + + } + CyExitCriticalSection(enableInterrupts); +} + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_pvt.h b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_pvt.h new file mode 100755 index 0000000..3811937 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_pvt.h @@ -0,0 +1,203 @@ +/******************************************************************************* +* File Name: .h +* Version 2.60 +* +* Description: +* This private file provides constants and parameter values for the +* USBFS Component. +* Please do not use this file or its content in your project. +* +* Note: +* +******************************************************************************** +* Copyright 2013, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#if !defined(CY_USBFS_USBFS_pvt_H) +#define CY_USBFS_USBFS_pvt_H + + +/*************************************** +* Private Variables +***************************************/ + +/* Generated external references for descriptors*/ +extern const uint8 CYCODE USBFS_DEVICE0_DESCR[18u]; +extern const uint8 CYCODE USBFS_DEVICE0_CONFIGURATION0_DESCR[41u]; +extern const T_USBFS_LUT CYCODE USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_TABLE[1u]; +extern const T_USBFS_EP_SETTINGS_BLOCK CYCODE USBFS_DEVICE0_CONFIGURATION0_EP_SETTINGS_TABLE[2u]; +extern const uint8 CYCODE USBFS_DEVICE0_CONFIGURATION0_INTERFACE_CLASS[1u]; +extern const T_USBFS_LUT CYCODE USBFS_DEVICE0_CONFIGURATION0_TABLE[4u]; +extern const T_USBFS_LUT CYCODE USBFS_DEVICE0_TABLE[2u]; +extern const T_USBFS_LUT CYCODE USBFS_TABLE[1u]; +extern const uint8 CYCODE USBFS_SN_STRING_DESCRIPTOR[10]; +extern const uint8 CYCODE USBFS_STRING_DESCRIPTORS[45u]; +extern T_USBFS_XFER_STATUS_BLOCK USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_IN_RPT_SCB; +extern uint8 USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_IN_BUF[ + USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_IN_BUF_SIZE]; +extern T_USBFS_XFER_STATUS_BLOCK USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_OUT_RPT_SCB; +extern uint8 USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_OUT_BUF[ + USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_OUT_BUF_SIZE]; +extern const uint8 CYCODE USBFS_HIDREPORT_DESCRIPTOR1[40u]; +extern const T_USBFS_TD CYCODE USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_IN_RPT_TABLE[1u]; +extern const T_USBFS_TD CYCODE USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_OUT_RPT_TABLE[1u]; +extern const T_USBFS_LUT CYCODE USBFS_DEVICE0_CONFIGURATION0_INTERFACE0_ALTERNATE0_HID_TABLE[5u]; + + +extern const uint8 CYCODE USBFS_MSOS_DESCRIPTOR[USBFS_MSOS_DESCRIPTOR_LENGTH]; +extern const uint8 CYCODE USBFS_MSOS_CONFIGURATION_DESCR[USBFS_MSOS_CONF_DESCR_LENGTH]; +#if defined(USBFS_ENABLE_IDSN_STRING) + extern uint8 USBFS_idSerialNumberStringDescriptor[USBFS_IDSN_DESCR_LENGTH]; +#endif /* USBFS_ENABLE_IDSN_STRING */ + +extern volatile uint8 USBFS_interfaceNumber; +extern volatile uint8 USBFS_interfaceSetting[USBFS_MAX_INTERFACES_NUMBER]; +extern volatile uint8 USBFS_interfaceSetting_last[USBFS_MAX_INTERFACES_NUMBER]; +extern volatile uint8 USBFS_deviceAddress; +extern volatile uint8 USBFS_interfaceStatus[USBFS_MAX_INTERFACES_NUMBER]; +extern const uint8 CYCODE *USBFS_interfaceClass; + +extern volatile T_USBFS_EP_CTL_BLOCK USBFS_EP[USBFS_MAX_EP]; +extern volatile T_USBFS_TD USBFS_currentTD; + +#if(USBFS_EP_MM != USBFS__EP_MANUAL) + extern uint8 USBFS_DmaChan[USBFS_MAX_EP]; + extern uint8 USBFS_DmaTd[USBFS_MAX_EP]; +#endif /* End USBFS_EP_MM */ + +extern volatile uint8 USBFS_ep0Toggle; +extern volatile uint8 USBFS_lastPacketSize; +extern volatile uint8 USBFS_ep0Mode; +extern volatile uint8 USBFS_ep0Count; +extern volatile uint16 USBFS_transferByteCount; + + +/*************************************** +* Private Function Prototypes +***************************************/ +void USBFS_ReInitComponent(void) ; +void USBFS_HandleSetup(void) ; +void USBFS_HandleIN(void) ; +void USBFS_HandleOUT(void) ; +void USBFS_LoadEP0(void) ; +uint8 USBFS_InitControlRead(void) ; +uint8 USBFS_InitControlWrite(void) ; +void USBFS_ControlReadDataStage(void) ; +void USBFS_ControlReadStatusStage(void) ; +void USBFS_ControlReadPrematureStatus(void) + ; +uint8 USBFS_InitControlWrite(void) ; +uint8 USBFS_InitZeroLengthControlTransfer(void) + ; +void USBFS_ControlWriteDataStage(void) ; +void USBFS_ControlWriteStatusStage(void) ; +void USBFS_ControlWritePrematureStatus(void) + ; +uint8 USBFS_InitNoDataControlTransfer(void) ; +void USBFS_NoDataControlStatusStage(void) ; +void USBFS_InitializeStatusBlock(void) ; +void USBFS_UpdateStatusBlock(uint8 completionCode) ; +uint8 USBFS_DispatchClassRqst(void) ; + +void USBFS_Config(uint8 clearAltSetting) ; +void USBFS_ConfigAltChanged(void) ; +void USBFS_ConfigReg(void) ; + +const T_USBFS_LUT CYCODE *USBFS_GetConfigTablePtr(uint8 c) + ; +const T_USBFS_LUT CYCODE *USBFS_GetDeviceTablePtr(void) + ; +const uint8 CYCODE *USBFS_GetInterfaceClassTablePtr(void) + ; +uint8 USBFS_ClearEndpointHalt(void) ; +uint8 USBFS_SetEndpointHalt(void) ; +uint8 USBFS_ValidateAlternateSetting(void) ; + +void USBFS_SaveConfig(void) ; +void USBFS_RestoreConfig(void) ; + +#if defined(USBFS_ENABLE_IDSN_STRING) + void USBFS_ReadDieID(uint8 descr[]) ; +#endif /* USBFS_ENABLE_IDSN_STRING */ + +#if defined(USBFS_ENABLE_HID_CLASS) + uint8 USBFS_DispatchHIDClassRqst(void); +#endif /* End USBFS_ENABLE_HID_CLASS */ +#if defined(USBFS_ENABLE_AUDIO_CLASS) + uint8 USBFS_DispatchAUDIOClassRqst(void); +#endif /* End USBFS_ENABLE_HID_CLASS */ +#if defined(USBFS_ENABLE_CDC_CLASS) + uint8 USBFS_DispatchCDCClassRqst(void); +#endif /* End USBFS_ENABLE_CDC_CLASS */ + +CY_ISR_PROTO(USBFS_EP_0_ISR); +#if(USBFS_EP1_ISR_REMOVE == 0u) + CY_ISR_PROTO(USBFS_EP_1_ISR); +#endif /* End USBFS_EP1_ISR_REMOVE */ +#if(USBFS_EP2_ISR_REMOVE == 0u) + CY_ISR_PROTO(USBFS_EP_2_ISR); +#endif /* End USBFS_EP2_ISR_REMOVE */ +#if(USBFS_EP3_ISR_REMOVE == 0u) + CY_ISR_PROTO(USBFS_EP_3_ISR); +#endif /* End USBFS_EP3_ISR_REMOVE */ +#if(USBFS_EP4_ISR_REMOVE == 0u) + CY_ISR_PROTO(USBFS_EP_4_ISR); +#endif /* End USBFS_EP4_ISR_REMOVE */ +#if(USBFS_EP5_ISR_REMOVE == 0u) + CY_ISR_PROTO(USBFS_EP_5_ISR); +#endif /* End USBFS_EP5_ISR_REMOVE */ +#if(USBFS_EP6_ISR_REMOVE == 0u) + CY_ISR_PROTO(USBFS_EP_6_ISR); +#endif /* End USBFS_EP6_ISR_REMOVE */ +#if(USBFS_EP7_ISR_REMOVE == 0u) + CY_ISR_PROTO(USBFS_EP_7_ISR); +#endif /* End USBFS_EP7_ISR_REMOVE */ +#if(USBFS_EP8_ISR_REMOVE == 0u) + CY_ISR_PROTO(USBFS_EP_8_ISR); +#endif /* End USBFS_EP8_ISR_REMOVE */ +CY_ISR_PROTO(USBFS_BUS_RESET_ISR); +#if(USBFS_SOF_ISR_REMOVE == 0u) + CY_ISR_PROTO(USBFS_SOF_ISR); +#endif /* End USBFS_SOF_ISR_REMOVE */ +#if(USBFS_EP_MM != USBFS__EP_MANUAL) + CY_ISR_PROTO(USBFS_ARB_ISR); +#endif /* End USBFS_EP_MM */ +#if(USBFS_DP_ISR_REMOVE == 0u) + CY_ISR_PROTO(USBFS_DP_ISR); +#endif /* End USBFS_DP_ISR_REMOVE */ + + +/*************************************** +* Request Handlers +***************************************/ + +uint8 USBFS_HandleStandardRqst(void) ; +uint8 USBFS_DispatchClassRqst(void) ; +uint8 USBFS_HandleVendorRqst(void) ; + + +/*************************************** +* HID Internal references +***************************************/ +#if defined(USBFS_ENABLE_HID_CLASS) + void USBFS_FindReport(void) ; + void USBFS_FindReportDescriptor(void) ; + void USBFS_FindHidClassDecriptor(void) ; +#endif /* USBFS_ENABLE_HID_CLASS */ + + +/*************************************** +* MIDI Internal references +***************************************/ +#if defined(USBFS_ENABLE_MIDI_STREAMING) + void USBFS_MIDI_IN_EP_Service(void) ; +#endif /* USBFS_ENABLE_MIDI_STREAMING */ + + +#endif /* CY_USBFS_USBFS_pvt_H */ + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_std.c b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_std.c new file mode 100755 index 0000000..18f0364 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_std.c @@ -0,0 +1,1134 @@ +/******************************************************************************* +* File Name: USBFS_std.c +* Version 2.60 +* +* Description: +* USB Standard request handler. +* +* Note: +* +******************************************************************************** +* Copyright 2008-2013, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#include "USBFS.h" +#include "USBFS_cdc.h" +#include "USBFS_pvt.h" +#if defined(USBFS_ENABLE_MIDI_STREAMING) + #include "USBFS_midi.h" +#endif /* End USBFS_ENABLE_MIDI_STREAMING*/ + + +/*************************************** +* Static data allocation +***************************************/ + +#if defined(USBFS_ENABLE_FWSN_STRING) + static volatile uint8 *USBFS_fwSerialNumberStringDescriptor; + static volatile uint8 USBFS_snStringConfirm = USBFS_FALSE; +#endif /* USBFS_ENABLE_FWSN_STRING */ + +#if defined(USBFS_ENABLE_FWSN_STRING) + + + /******************************************************************************* + * Function Name: USBFS_SerialNumString + ******************************************************************************** + * + * Summary: + * Application firmware may supply the source of the USB device descriptors + * serial number string during runtime. + * + * Parameters: + * snString: pointer to string. + * + * Return: + * None. + * + * Reentrant: + * No. + * + *******************************************************************************/ + void USBFS_SerialNumString(uint8 snString[]) + { + USBFS_snStringConfirm = USBFS_FALSE; + if(snString != NULL) + { + USBFS_fwSerialNumberStringDescriptor = snString; + /* Check descriptor validation */ + if( (snString[0u] > 1u ) && (snString[1u] == USBFS_DESCR_STRING) ) + { + USBFS_snStringConfirm = USBFS_TRUE; + } + } + } + +#endif /* USBFS_ENABLE_FWSN_STRING */ + + +/******************************************************************************* +* Function Name: USBFS_HandleStandardRqst +******************************************************************************** +* +* Summary: +* This Routine dispatches standard requests +* +* Parameters: +* None. +* +* Return: +* TRUE if request handled. +* +* Reentrant: +* No. +* +*******************************************************************************/ +uint8 USBFS_HandleStandardRqst(void) +{ + uint8 requestHandled = USBFS_FALSE; + uint8 interfaceNumber; + #if defined(USBFS_ENABLE_STRINGS) + volatile uint8 *pStr = 0u; + #if defined(USBFS_ENABLE_DESCRIPTOR_STRINGS) + uint8 nStr; + uint8 descrLength; + #endif /* USBFS_ENABLE_DESCRIPTOR_STRINGS */ + #endif /* USBFS_ENABLE_STRINGS */ + static volatile uint8 USBFS_tBuffer[USBFS_STATUS_LENGTH_MAX]; + const T_USBFS_LUT CYCODE *pTmp; + USBFS_currentTD.count = 0u; + + if ((CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_DIR_MASK) == USBFS_RQST_DIR_D2H) + { + /* Control Read */ + switch (CY_GET_REG8(USBFS_bRequest)) + { + case USBFS_GET_DESCRIPTOR: + if (CY_GET_REG8(USBFS_wValueHi) == USBFS_DESCR_DEVICE) + { + pTmp = USBFS_GetDeviceTablePtr(); + USBFS_currentTD.pData = (volatile uint8 *)pTmp->p_list; + USBFS_currentTD.count = USBFS_DEVICE_DESCR_LENGTH; + requestHandled = USBFS_InitControlRead(); + } + else if (CY_GET_REG8(USBFS_wValueHi) == USBFS_DESCR_CONFIG) + { + pTmp = USBFS_GetConfigTablePtr(CY_GET_REG8(USBFS_wValueLo)); + USBFS_currentTD.pData = (volatile uint8 *)pTmp->p_list; + USBFS_currentTD.count = ((uint16)(USBFS_currentTD.pData)[ \ + USBFS_CONFIG_DESCR_TOTAL_LENGTH_HI] << 8u) | \ + (USBFS_currentTD.pData)[USBFS_CONFIG_DESCR_TOTAL_LENGTH_LOW]; + requestHandled = USBFS_InitControlRead(); + } + #if defined(USBFS_ENABLE_STRINGS) + else if (CY_GET_REG8(USBFS_wValueHi) == USBFS_DESCR_STRING) + { + /* Descriptor Strings*/ + #if defined(USBFS_ENABLE_DESCRIPTOR_STRINGS) + nStr = 0u; + pStr = (volatile uint8 *)&USBFS_STRING_DESCRIPTORS[0u]; + while ( (CY_GET_REG8(USBFS_wValueLo) > nStr) && (*pStr != 0u) ) + { + /* Read descriptor length from 1st byte */ + descrLength = *pStr; + /* Move to next string descriptor */ + pStr = &pStr[descrLength]; + nStr++; + } + #endif /* End USBFS_ENABLE_DESCRIPTOR_STRINGS */ + /* Microsoft OS String*/ + #if defined(USBFS_ENABLE_MSOS_STRING) + if( CY_GET_REG8(USBFS_wValueLo) == USBFS_STRING_MSOS ) + { + pStr = (volatile uint8 *)&USBFS_MSOS_DESCRIPTOR[0u]; + } + #endif /* End USBFS_ENABLE_MSOS_STRING*/ + /* SN string */ + #if defined(USBFS_ENABLE_SN_STRING) + if( (CY_GET_REG8(USBFS_wValueLo) != 0u) && + (CY_GET_REG8(USBFS_wValueLo) == + USBFS_DEVICE0_DESCR[USBFS_DEVICE_DESCR_SN_SHIFT]) ) + { + pStr = (volatile uint8 *)&USBFS_SN_STRING_DESCRIPTOR[0u]; + #if defined(USBFS_ENABLE_FWSN_STRING) + if(USBFS_snStringConfirm != USBFS_FALSE) + { + pStr = USBFS_fwSerialNumberStringDescriptor; + } + #endif /* USBFS_ENABLE_FWSN_STRING */ + #if defined(USBFS_ENABLE_IDSN_STRING) + /* Read DIE ID and generate string descriptor in RAM */ + USBFS_ReadDieID(USBFS_idSerialNumberStringDescriptor); + pStr = USBFS_idSerialNumberStringDescriptor; + #endif /* End USBFS_ENABLE_IDSN_STRING */ + } + #endif /* End USBFS_ENABLE_SN_STRING */ + if (*pStr != 0u) + { + USBFS_currentTD.count = *pStr; + USBFS_currentTD.pData = pStr; + requestHandled = USBFS_InitControlRead(); + } + } + #endif /* End USBFS_ENABLE_STRINGS */ + else + { + requestHandled = USBFS_DispatchClassRqst(); + } + break; + case USBFS_GET_STATUS: + switch ((CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_RCPT_MASK)) + { + case USBFS_RQST_RCPT_EP: + USBFS_currentTD.count = USBFS_EP_STATUS_LENGTH; + USBFS_tBuffer[0u] = USBFS_EP[ \ + CY_GET_REG8(USBFS_wIndexLo) & USBFS_DIR_UNUSED].hwEpState; + USBFS_tBuffer[1u] = 0u; + USBFS_currentTD.pData = &USBFS_tBuffer[0u]; + requestHandled = USBFS_InitControlRead(); + break; + case USBFS_RQST_RCPT_DEV: + USBFS_currentTD.count = USBFS_DEVICE_STATUS_LENGTH; + USBFS_tBuffer[0u] = USBFS_deviceStatus; + USBFS_tBuffer[1u] = 0u; + USBFS_currentTD.pData = &USBFS_tBuffer[0u]; + requestHandled = USBFS_InitControlRead(); + break; + default: /* requestHandled is initialized as FALSE by default */ + break; + } + break; + case USBFS_GET_CONFIGURATION: + USBFS_currentTD.count = 1u; + USBFS_currentTD.pData = (volatile uint8 *)&USBFS_configuration; + requestHandled = USBFS_InitControlRead(); + break; + case USBFS_GET_INTERFACE: + USBFS_currentTD.count = 1u; + USBFS_currentTD.pData = (volatile uint8 *)&USBFS_interfaceSetting[ \ + CY_GET_REG8(USBFS_wIndexLo)]; + requestHandled = USBFS_InitControlRead(); + break; + default: /* requestHandled is initialized as FALSE by default */ + break; + } + } + else { + /* Control Write */ + switch (CY_GET_REG8(USBFS_bRequest)) + { + case USBFS_SET_ADDRESS: + USBFS_deviceAddress = CY_GET_REG8(USBFS_wValueLo); + requestHandled = USBFS_InitNoDataControlTransfer(); + break; + case USBFS_SET_CONFIGURATION: + USBFS_configuration = CY_GET_REG8(USBFS_wValueLo); + USBFS_configurationChanged = USBFS_TRUE; + USBFS_Config(USBFS_TRUE); + requestHandled = USBFS_InitNoDataControlTransfer(); + break; + case USBFS_SET_INTERFACE: + if (USBFS_ValidateAlternateSetting() != 0u) + { + interfaceNumber = CY_GET_REG8(USBFS_wIndexLo); + USBFS_interfaceNumber = interfaceNumber; + USBFS_configurationChanged = USBFS_TRUE; + #if ((USBFS_EP_MA == USBFS__MA_DYNAMIC) && \ + (USBFS_EP_MM == USBFS__EP_MANUAL) ) + USBFS_Config(USBFS_FALSE); + #else + USBFS_ConfigAltChanged(); + #endif /* End (USBFS_EP_MA == USBFS__MA_DYNAMIC) */ + /* Update handled Alt setting changes status */ + USBFS_interfaceSetting_last[interfaceNumber] = + USBFS_interfaceSetting[interfaceNumber]; + requestHandled = USBFS_InitNoDataControlTransfer(); + } + break; + case USBFS_CLEAR_FEATURE: + switch (CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_RCPT_MASK) + { + case USBFS_RQST_RCPT_EP: + if (CY_GET_REG8(USBFS_wValueLo) == USBFS_ENDPOINT_HALT) + { + requestHandled = USBFS_ClearEndpointHalt(); + } + break; + case USBFS_RQST_RCPT_DEV: + /* Clear device REMOTE_WAKEUP */ + if (CY_GET_REG8(USBFS_wValueLo) == USBFS_DEVICE_REMOTE_WAKEUP) + { + USBFS_deviceStatus &= (uint8)~USBFS_DEVICE_STATUS_REMOTE_WAKEUP; + requestHandled = USBFS_InitNoDataControlTransfer(); + } + break; + case USBFS_RQST_RCPT_IFC: + /* Validate interfaceNumber */ + if (CY_GET_REG8(USBFS_wIndexLo) < USBFS_MAX_INTERFACES_NUMBER) + { + USBFS_interfaceStatus[CY_GET_REG8(USBFS_wIndexLo)] &= + (uint8)~(CY_GET_REG8(USBFS_wValueLo)); + requestHandled = USBFS_InitNoDataControlTransfer(); + } + break; + default: /* requestHandled is initialized as FALSE by default */ + break; + } + break; + case USBFS_SET_FEATURE: + switch (CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_RCPT_MASK) + { + case USBFS_RQST_RCPT_EP: + if (CY_GET_REG8(USBFS_wValueLo) == USBFS_ENDPOINT_HALT) + { + requestHandled = USBFS_SetEndpointHalt(); + } + break; + case USBFS_RQST_RCPT_DEV: + /* Set device REMOTE_WAKEUP */ + if (CY_GET_REG8(USBFS_wValueLo) == USBFS_DEVICE_REMOTE_WAKEUP) + { + USBFS_deviceStatus |= USBFS_DEVICE_STATUS_REMOTE_WAKEUP; + requestHandled = USBFS_InitNoDataControlTransfer(); + } + break; + case USBFS_RQST_RCPT_IFC: + /* Validate interfaceNumber */ + if (CY_GET_REG8(USBFS_wIndexLo) < USBFS_MAX_INTERFACES_NUMBER) + { + USBFS_interfaceStatus[CY_GET_REG8(USBFS_wIndexLo)] &= + (uint8)~(CY_GET_REG8(USBFS_wValueLo)); + requestHandled = USBFS_InitNoDataControlTransfer(); + } + break; + default: /* requestHandled is initialized as FALSE by default */ + break; + } + break; + default: /* requestHandled is initialized as FALSE by default */ + break; + } + } + return(requestHandled); +} + + +#if defined(USBFS_ENABLE_IDSN_STRING) + + /*************************************************************************** + * Function Name: USBFS_ReadDieID + **************************************************************************** + * + * Summary: + * This routine read Die ID and generate Serial Number string descriptor. + * + * Parameters: + * descr: pointer on string descriptor. + * + * Return: + * None. + * + * Reentrant: + * No. + * + ***************************************************************************/ + void USBFS_ReadDieID(uint8 descr[]) + { + uint8 i; + uint8 j = 0u; + uint8 value; + const char8 CYCODE hex[16u] = "0123456789ABCDEF"; + + + /* Check descriptor validation */ + if( descr != NULL) + { + descr[0u] = USBFS_IDSN_DESCR_LENGTH; + descr[1u] = USBFS_DESCR_STRING; + + /* fill descriptor */ + for(i = 2u; i < USBFS_IDSN_DESCR_LENGTH; i += 4u) + { + value = CY_GET_XTND_REG8((void CYFAR *)(USBFS_DIE_ID + j)); + j++; + descr[i] = (uint8)hex[value >> 4u]; + descr[i + 2u] = (uint8)hex[value & 0x0Fu]; + } + } + } + +#endif /* End USBFS_ENABLE_IDSN_STRING */ + + +/******************************************************************************* +* Function Name: USBFS_ConfigReg +******************************************************************************** +* +* Summary: +* This routine configures hardware registers from the variables. +* It is called from USBFS_Config() function and from RestoreConfig +* after Wakeup. +* +* Parameters: +* None. +* +* Return: +* None. +* +*******************************************************************************/ +void USBFS_ConfigReg(void) +{ + uint8 ep; + uint8 i; + #if(USBFS_EP_MM == USBFS__EP_DMAAUTO) + uint8 ep_type = 0u; + #endif /* End USBFS_EP_MM == USBFS__EP_DMAAUTO */ + + /* Set the endpoint buffer addresses */ + ep = USBFS_EP1; + for (i = 0u; i < 0x80u; i+= 0x10u) + { + CY_SET_REG8((reg8 *)(USBFS_ARB_EP1_CFG_IND + i), USBFS_ARB_EPX_CFG_CRC_BYPASS | + USBFS_ARB_EPX_CFG_RESET); + + #if(USBFS_EP_MM != USBFS__EP_MANUAL) + /* Enable all Arbiter EP Interrupts : err, buf under, buf over, dma gnt(mode2 only), in buf full */ + CY_SET_REG8((reg8 *)(USBFS_ARB_EP1_INT_EN_IND + i), USBFS_ARB_EPX_INT_MASK); + #endif /* End USBFS_EP_MM != USBFS__EP_MANUAL */ + + if(USBFS_EP[ep].epMode != USBFS_MODE_DISABLE) + { + if((USBFS_EP[ep].addr & USBFS_DIR_IN) != 0u ) + { + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + i), USBFS_MODE_NAK_IN); + } + else + { + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + i), USBFS_MODE_NAK_OUT); + /* Prepare EP type mask for automatic memory allocation */ + #if(USBFS_EP_MM == USBFS__EP_DMAAUTO) + ep_type |= (uint8)(0x01u << (ep - USBFS_EP1)); + #endif /* End USBFS_EP_MM == USBFS__EP_DMAAUTO */ + } + } + else + { + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + i), USBFS_MODE_STALL_DATA_EP); + } + + #if(USBFS_EP_MM != USBFS__EP_DMAAUTO) + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CNT0_IND + i), USBFS_EP[ep].bufferSize >> 8u); + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CNT1_IND + i), USBFS_EP[ep].bufferSize & 0xFFu); + + CY_SET_REG8((reg8 *)(USBFS_ARB_RW1_RA_IND + i), USBFS_EP[ep].buffOffset & 0xFFu); + CY_SET_REG8((reg8 *)(USBFS_ARB_RW1_RA_MSB_IND + i), USBFS_EP[ep].buffOffset >> 8u); + CY_SET_REG8((reg8 *)(USBFS_ARB_RW1_WA_IND + i), USBFS_EP[ep].buffOffset & 0xFFu); + CY_SET_REG8((reg8 *)(USBFS_ARB_RW1_WA_MSB_IND + i), USBFS_EP[ep].buffOffset >> 8u); + #endif /* End USBFS_EP_MM != USBFS__EP_DMAAUTO */ + + ep++; + } + + #if(USBFS_EP_MM == USBFS__EP_DMAAUTO) + /* BUF_SIZE depend on DMA_THRESS value: 55-32 bytes 44-16 bytes 33-8 bytes 22-4 bytes 11-2 bytes */ + USBFS_BUF_SIZE_REG = USBFS_DMA_BUF_SIZE; + USBFS_DMA_THRES_REG = USBFS_DMA_BYTES_PER_BURST; /* DMA burst threshold */ + USBFS_DMA_THRES_MSB_REG = 0u; + USBFS_EP_ACTIVE_REG = USBFS_ARB_INT_MASK; + USBFS_EP_TYPE_REG = ep_type; + /* Cfg_cmp bit set to 1 once configuration is complete. */ + USBFS_ARB_CFG_REG = USBFS_ARB_CFG_AUTO_DMA | USBFS_ARB_CFG_AUTO_MEM | + USBFS_ARB_CFG_CFG_CPM; + /* Cfg_cmp bit set to 0 during configuration of PFSUSB Registers. */ + USBFS_ARB_CFG_REG = USBFS_ARB_CFG_AUTO_DMA | USBFS_ARB_CFG_AUTO_MEM; + #endif /* End USBFS_EP_MM == USBFS__EP_DMAAUTO */ + + CY_SET_REG8(USBFS_SIE_EP_INT_EN_PTR, 0xFFu); +} + + +/******************************************************************************* +* Function Name: USBFS_Config +******************************************************************************** +* +* Summary: +* This routine configures endpoints for the entire configuration by scanning +* the configuration descriptor. +* +* Parameters: +* clearAltSetting: It configures the bAlternateSetting 0 for each interface. +* +* Return: +* None. +* +* USBFS_interfaceClass - Initialized class array for each interface. +* It is used for handling Class specific requests depend on interface class. +* Different classes in multiple Alternate settings does not supported. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_Config(uint8 clearAltSetting) +{ + uint8 ep; + uint8 cur_ep; + uint8 i; + uint8 ep_type; + const uint8 *pDescr; + #if(USBFS_EP_MM != USBFS__EP_DMAAUTO) + uint16 buffCount = 0u; + #endif /* End USBFS_EP_MM != USBFS__EP_DMAAUTO */ + + const T_USBFS_LUT CYCODE *pTmp; + const T_USBFS_EP_SETTINGS_BLOCK CYCODE *pEP; + + /* Clear all of the endpoints */ + for (ep = 0u; ep < USBFS_MAX_EP; ep++) + { + USBFS_EP[ep].attrib = 0u; + USBFS_EP[ep].hwEpState = 0u; + USBFS_EP[ep].apiEpState = USBFS_NO_EVENT_PENDING; + USBFS_EP[ep].epToggle = 0u; + USBFS_EP[ep].epMode = USBFS_MODE_DISABLE; + USBFS_EP[ep].bufferSize = 0u; + USBFS_EP[ep].interface = 0u; + + } + + /* Clear Alternate settings for all interfaces */ + if(clearAltSetting != 0u) + { + for (i = 0u; i < USBFS_MAX_INTERFACES_NUMBER; i++) + { + USBFS_interfaceSetting[i] = 0x00u; + USBFS_interfaceSetting_last[i] = 0x00u; + } + } + + /* Init Endpoints and Device Status if configured */ + if(USBFS_configuration > 0u) + { + pTmp = USBFS_GetConfigTablePtr(USBFS_configuration - 1u); + /* Set Power status for current configuration */ + pDescr = (const uint8 *)pTmp->p_list; + if((pDescr[USBFS_CONFIG_DESCR_ATTRIB] & USBFS_CONFIG_DESCR_ATTRIB_SELF_POWERED) != 0u) + { + USBFS_deviceStatus |= USBFS_DEVICE_STATUS_SELF_POWERED; + } + else + { + USBFS_deviceStatus &= (uint8)~USBFS_DEVICE_STATUS_SELF_POWERED; + } + /* Move to next element */ + pTmp = &pTmp[1u]; + ep = pTmp->c; /* For this table, c is the number of endpoints configurations */ + + #if ((USBFS_EP_MA == USBFS__MA_DYNAMIC) && \ + (USBFS_EP_MM == USBFS__EP_MANUAL) ) + /* Configure for dynamic EP memory allocation */ + /* p_list points the endpoint setting table. */ + pEP = (T_USBFS_EP_SETTINGS_BLOCK *) pTmp->p_list; + for (i = 0u; i < ep; i++) + { + /* Compare current Alternate setting with EP Alt*/ + if(USBFS_interfaceSetting[pEP->interface] == pEP->altSetting) + { + cur_ep = pEP->addr & USBFS_DIR_UNUSED; + ep_type = pEP->attributes & USBFS_EP_TYPE_MASK; + if (pEP->addr & USBFS_DIR_IN) + { + /* IN Endpoint */ + USBFS_EP[cur_ep].apiEpState = USBFS_EVENT_PENDING; + USBFS_EP[cur_ep].epMode = (ep_type == USBFS_EP_TYPE_ISOC) ? + USBFS_MODE_ISO_IN : USBFS_MODE_ACK_IN; + #if defined(USBFS_ENABLE_CDC_CLASS) + if(((pEP->bMisc == USBFS_CLASS_CDC_DATA) || + (pEP->bMisc == USBFS_CLASS_CDC)) && + (ep_type != USBFS_EP_TYPE_INT)) + { + USBFS_cdc_data_in_ep = cur_ep; + } + #endif /* End USBFS_ENABLE_CDC_CLASS*/ + #if ( defined(USBFS_ENABLE_MIDI_STREAMING) && \ + (USBFS_MIDI_IN_BUFF_SIZE > 0) ) + if((pEP->bMisc == USBFS_CLASS_AUDIO) && + (ep_type == USBFS_EP_TYPE_BULK)) + { + USBFS_midi_in_ep = cur_ep; + } + #endif /* End USBFS_ENABLE_MIDI_STREAMING*/ + } + else + { + /* OUT Endpoint */ + USBFS_EP[cur_ep].apiEpState = USBFS_NO_EVENT_PENDING; + USBFS_EP[cur_ep].epMode = (ep_type == USBFS_EP_TYPE_ISOC) ? + USBFS_MODE_ISO_OUT : USBFS_MODE_ACK_OUT; + #if defined(USBFS_ENABLE_CDC_CLASS) + if(((pEP->bMisc == USBFS_CLASS_CDC_DATA) || + (pEP->bMisc == USBFS_CLASS_CDC)) && + (ep_type != USBFS_EP_TYPE_INT)) + { + USBFS_cdc_data_out_ep = cur_ep; + } + #endif /* End USBFS_ENABLE_CDC_CLASS*/ + #if ( defined(USBFS_ENABLE_MIDI_STREAMING) && \ + (USBFS_MIDI_OUT_BUFF_SIZE > 0) ) + if((pEP->bMisc == USBFS_CLASS_AUDIO) && + (ep_type == USBFS_EP_TYPE_BULK)) + { + USBFS_midi_out_ep = cur_ep; + } + #endif /* End USBFS_ENABLE_MIDI_STREAMING*/ + } + USBFS_EP[cur_ep].bufferSize = pEP->bufferSize; + USBFS_EP[cur_ep].addr = pEP->addr; + USBFS_EP[cur_ep].attrib = pEP->attributes; + } + pEP = &pEP[1u]; + } + #else /* Config for static EP memory allocation */ + for (i = USBFS_EP1; i < USBFS_MAX_EP; i++) + { + /* p_list points the endpoint setting table. */ + pEP = (const T_USBFS_EP_SETTINGS_BLOCK CYCODE *) pTmp->p_list; + /* Find max length for each EP and select it (length could be different in different Alt settings) */ + /* but other settings should be correct with regards to Interface alt Setting */ + for (cur_ep = 0u; cur_ep < ep; cur_ep++) + { + /* EP count is equal to EP # in table and we found larger EP length than have before*/ + if(i == (pEP->addr & USBFS_DIR_UNUSED)) + { + if(USBFS_EP[i].bufferSize < pEP->bufferSize) + { + USBFS_EP[i].bufferSize = pEP->bufferSize; + } + /* Compare current Alternate setting with EP Alt*/ + if(USBFS_interfaceSetting[pEP->interface] == pEP->altSetting) + { + ep_type = pEP->attributes & USBFS_EP_TYPE_MASK; + if ((pEP->addr & USBFS_DIR_IN) != 0u) + { + /* IN Endpoint */ + USBFS_EP[i].apiEpState = USBFS_EVENT_PENDING; + USBFS_EP[i].epMode = (ep_type == USBFS_EP_TYPE_ISOC) ? + USBFS_MODE_ISO_IN : USBFS_MODE_ACK_IN; + /* Find and init CDC IN endpoint number */ + #if defined(USBFS_ENABLE_CDC_CLASS) + if(((pEP->bMisc == USBFS_CLASS_CDC_DATA) || + (pEP->bMisc == USBFS_CLASS_CDC)) && + (ep_type != USBFS_EP_TYPE_INT)) + { + USBFS_cdc_data_in_ep = i; + } + #endif /* End USBFS_ENABLE_CDC_CLASS*/ + #if ( defined(USBFS_ENABLE_MIDI_STREAMING) && \ + (USBFS_MIDI_IN_BUFF_SIZE > 0) ) + if((pEP->bMisc == USBFS_CLASS_AUDIO) && + (ep_type == USBFS_EP_TYPE_BULK)) + { + USBFS_midi_in_ep = i; + } + #endif /* End USBFS_ENABLE_MIDI_STREAMING*/ + } + else + { + /* OUT Endpoint */ + USBFS_EP[i].apiEpState = USBFS_NO_EVENT_PENDING; + USBFS_EP[i].epMode = (ep_type == USBFS_EP_TYPE_ISOC) ? + USBFS_MODE_ISO_OUT : USBFS_MODE_ACK_OUT; + /* Find and init CDC IN endpoint number */ + #if defined(USBFS_ENABLE_CDC_CLASS) + if(((pEP->bMisc == USBFS_CLASS_CDC_DATA) || + (pEP->bMisc == USBFS_CLASS_CDC)) && + (ep_type != USBFS_EP_TYPE_INT)) + { + USBFS_cdc_data_out_ep = i; + } + #endif /* End USBFS_ENABLE_CDC_CLASS*/ + #if ( defined(USBFS_ENABLE_MIDI_STREAMING) && \ + (USBFS_MIDI_OUT_BUFF_SIZE > 0) ) + if((pEP->bMisc == USBFS_CLASS_AUDIO) && + (ep_type == USBFS_EP_TYPE_BULK)) + { + USBFS_midi_out_ep = i; + } + #endif /* End USBFS_ENABLE_MIDI_STREAMING*/ + } + USBFS_EP[i].addr = pEP->addr; + USBFS_EP[i].attrib = pEP->attributes; + + #if(USBFS_EP_MM == USBFS__EP_DMAAUTO) + break; /* use first EP setting in Auto memory managment */ + #endif /* End USBFS_EP_MM == USBFS__EP_DMAAUTO */ + } + } + pEP = &pEP[1u]; + } + } + #endif /* End (USBFS_EP_MA == USBFS__MA_DYNAMIC) */ + + /* Init class array for each interface and interface number for each EP. + * It is used for handling Class specific requests directed to either an + * interface or the endpoint. + */ + /* p_list points the endpoint setting table. */ + pEP = (const T_USBFS_EP_SETTINGS_BLOCK CYCODE *) pTmp->p_list; + for (i = 0u; i < ep; i++) + { + /* Configure interface number for each EP*/ + USBFS_EP[pEP->addr & USBFS_DIR_UNUSED].interface = pEP->interface; + pEP = &pEP[1u]; + } + /* Init pointer on interface class table*/ + USBFS_interfaceClass = USBFS_GetInterfaceClassTablePtr(); + /* Set the endpoint buffer addresses */ + + #if(USBFS_EP_MM != USBFS__EP_DMAAUTO) + for (ep = USBFS_EP1; ep < USBFS_MAX_EP; ep++) + { + USBFS_EP[ep].buffOffset = buffCount; + buffCount += USBFS_EP[ep].bufferSize; + } + #endif /* End USBFS_EP_MM != USBFS__EP_DMAAUTO */ + + /* Configure hardware registers */ + USBFS_ConfigReg(); + } /* USBFS_configuration > 0 */ +} + + +/******************************************************************************* +* Function Name: USBFS_ConfigAltChanged +******************************************************************************** +* +* Summary: +* This routine update configuration for the required endpoints only. +* It is called after SET_INTERFACE request when Static memory allocation used. +* +* Parameters: +* None. +* +* Return: +* None. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_ConfigAltChanged(void) +{ + uint8 ep; + uint8 cur_ep; + uint8 i; + uint8 ep_type; + uint8 ri; + + const T_USBFS_LUT CYCODE *pTmp; + const T_USBFS_EP_SETTINGS_BLOCK CYCODE *pEP; + + + /* Init Endpoints and Device Status if configured */ + if(USBFS_configuration > 0u) + { + pTmp = USBFS_GetConfigTablePtr(USBFS_configuration - 1u); + pTmp = &pTmp[1u]; + ep = pTmp->c; /* For this table, c is the number of endpoints configurations */ + + /* Do not touch EP which doesn't need reconfiguration */ + /* When Alt setting changed, the only required endpoints need to be reconfigured */ + /* p_list points the endpoint setting table. */ + pEP = (const T_USBFS_EP_SETTINGS_BLOCK CYCODE *) pTmp->p_list; + for (i = 0u; i < ep; i++) + { + /*If Alt setting changed and new is same with EP Alt */ + if((USBFS_interfaceSetting[pEP->interface] != + USBFS_interfaceSetting_last[pEP->interface] ) && + (USBFS_interfaceSetting[pEP->interface] == pEP->altSetting) && + (pEP->interface == CY_GET_REG8(USBFS_wIndexLo))) + { + cur_ep = pEP->addr & USBFS_DIR_UNUSED; + ri = ((cur_ep - USBFS_EP1) << USBFS_EPX_CNTX_ADDR_SHIFT); + ep_type = pEP->attributes & USBFS_EP_TYPE_MASK; + if ((pEP->addr & USBFS_DIR_IN) != 0u) + { + /* IN Endpoint */ + USBFS_EP[cur_ep].apiEpState = USBFS_EVENT_PENDING; + USBFS_EP[cur_ep].epMode = (ep_type == USBFS_EP_TYPE_ISOC) ? + USBFS_MODE_ISO_IN : USBFS_MODE_ACK_IN; + } + else + { + /* OUT Endpoint */ + USBFS_EP[cur_ep].apiEpState = USBFS_NO_EVENT_PENDING; + USBFS_EP[cur_ep].epMode = (ep_type == USBFS_EP_TYPE_ISOC) ? + USBFS_MODE_ISO_OUT : USBFS_MODE_ACK_OUT; + } + /* Change the SIE mode for the selected EP to NAK ALL */ + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + ri), USBFS_MODE_NAK_IN_OUT); + USBFS_EP[cur_ep].bufferSize = pEP->bufferSize; + USBFS_EP[cur_ep].addr = pEP->addr; + USBFS_EP[cur_ep].attrib = pEP->attributes; + + /* Clear the data toggle */ + USBFS_EP[cur_ep].epToggle = 0u; + + /* Dynamic reconfiguration for mode 3 transfer */ + #if(USBFS_EP_MM == USBFS__EP_DMAAUTO) + /* In_data_rdy for selected EP should be set to 0 */ + * (reg8 *)(USBFS_ARB_EP1_CFG_IND + ri) &= (uint8)~USBFS_ARB_EPX_CFG_IN_DATA_RDY; + + /* write the EP number for which reconfiguration is required */ + USBFS_DYN_RECONFIG_REG = (cur_ep - USBFS_EP1) << + USBFS_DYN_RECONFIG_EP_SHIFT; + /* Set the dyn_config_en bit in dynamic reconfiguration register */ + USBFS_DYN_RECONFIG_REG |= USBFS_DYN_RECONFIG_ENABLE; + /* wait for the dyn_config_rdy bit to set by the block, + * this bit will be set to 1 when block is ready for reconfiguration. + */ + while((USBFS_DYN_RECONFIG_REG & USBFS_DYN_RECONFIG_RDY_STS) == 0u) + { + ; + } + /* Once dyn_config_rdy bit is set, FW can change the EP configuration. */ + /* Change EP Type with new direction */ + if((pEP->addr & USBFS_DIR_IN) == 0u) + { + USBFS_EP_TYPE_REG |= (uint8)(0x01u << (cur_ep - USBFS_EP1)); + } + else + { + USBFS_EP_TYPE_REG &= (uint8)~(uint8)(0x01u << (cur_ep - USBFS_EP1)); + } + /* dynamic reconfiguration enable bit cleared, pointers and control/status + * signals for the selected EP is cleared/re-initialized on negative edge + * of dynamic reconfiguration enable bit). + */ + USBFS_DYN_RECONFIG_REG &= (uint8)~USBFS_DYN_RECONFIG_ENABLE; + /* The main loop has to re-enable DMA and OUT endpoint*/ + #else + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CNT0_IND + ri), + USBFS_EP[cur_ep].bufferSize >> 8u); + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CNT1_IND + ri), + USBFS_EP[cur_ep].bufferSize & 0xFFu); + CY_SET_REG8((reg8 *)(USBFS_ARB_RW1_RA_IND + ri), + USBFS_EP[cur_ep].buffOffset & 0xFFu); + CY_SET_REG8((reg8 *)(USBFS_ARB_RW1_RA_MSB_IND + ri), + USBFS_EP[cur_ep].buffOffset >> 8u); + CY_SET_REG8((reg8 *)(USBFS_ARB_RW1_WA_IND + ri), + USBFS_EP[cur_ep].buffOffset & 0xFFu); + CY_SET_REG8((reg8 *)(USBFS_ARB_RW1_WA_MSB_IND + ri), + USBFS_EP[cur_ep].buffOffset >> 8u); + #endif /* End USBFS_EP_MM == USBFS__EP_DMAAUTO */ + } + /* Get next EP element */ + pEP = &pEP[1u]; + } + } /* USBFS_configuration > 0 */ +} + + +/******************************************************************************* +* Function Name: USBFS_GetConfigTablePtr +******************************************************************************** +* +* Summary: +* This routine returns a pointer a configuration table entry +* +* Parameters: +* c: Configuration Index +* +* Return: +* Device Descriptor pointer. +* +*******************************************************************************/ +const T_USBFS_LUT CYCODE *USBFS_GetConfigTablePtr(uint8 c) + +{ + /* Device Table */ + const T_USBFS_LUT CYCODE *pTmp; + + pTmp = (const T_USBFS_LUT CYCODE *) USBFS_TABLE[USBFS_device].p_list; + + /* The first entry points to the Device Descriptor, + * the rest configuration entries. + */ + return( (const T_USBFS_LUT CYCODE *) pTmp[c + 1u].p_list ); +} + + +/******************************************************************************* +* Function Name: USBFS_GetDeviceTablePtr +******************************************************************************** +* +* Summary: +* This routine returns a pointer to the Device table +* +* Parameters: +* None. +* +* Return: +* Device Table pointer +* +*******************************************************************************/ +const T_USBFS_LUT CYCODE *USBFS_GetDeviceTablePtr(void) + +{ + /* Device Table */ + return( (const T_USBFS_LUT CYCODE *) USBFS_TABLE[USBFS_device].p_list ); +} + + +/******************************************************************************* +* Function Name: USB_GetInterfaceClassTablePtr +******************************************************************************** +* +* Summary: +* This routine returns Interface Class table pointer, which contains +* the relation between interface number and interface class. +* +* Parameters: +* None. +* +* Return: +* Interface Class table pointer. +* +*******************************************************************************/ +const uint8 CYCODE *USBFS_GetInterfaceClassTablePtr(void) + +{ + const T_USBFS_LUT CYCODE *pTmp; + uint8 currentInterfacesNum; + + pTmp = USBFS_GetConfigTablePtr(USBFS_configuration - 1u); + currentInterfacesNum = ((const uint8 *) pTmp->p_list)[USBFS_CONFIG_DESCR_NUM_INTERFACES]; + /* Third entry in the LUT starts the Interface Table pointers */ + /* The INTERFACE_CLASS table is located after all interfaces */ + pTmp = &pTmp[currentInterfacesNum + 2u]; + return( (const uint8 CYCODE *) pTmp->p_list ); +} + + +/******************************************************************************* +* Function Name: USBFS_TerminateEP +******************************************************************************** +* +* Summary: +* This function terminates the specified USBFS endpoint. +* This function should be used before endpoint reconfiguration. +* +* Parameters: +* Endpoint number. +* +* Return: +* None. +* +* Reentrant: +* No. +* +*******************************************************************************/ +void USBFS_TerminateEP(uint8 ep) +{ + uint8 ri; + + ep &= USBFS_DIR_UNUSED; + ri = ((ep - USBFS_EP1) << USBFS_EPX_CNTX_ADDR_SHIFT); + + if ((ep > USBFS_EP0) && (ep < USBFS_MAX_EP)) + { + /* Set the endpoint Halt */ + USBFS_EP[ep].hwEpState |= (USBFS_ENDPOINT_STATUS_HALT); + + /* Clear the data toggle */ + USBFS_EP[ep].epToggle = 0u; + USBFS_EP[ep].apiEpState = USBFS_NO_EVENT_ALLOWED; + + if ((USBFS_EP[ep].addr & USBFS_DIR_IN) != 0u) + { + /* IN Endpoint */ + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + ri), USBFS_MODE_NAK_IN); + } + else + { + /* OUT Endpoint */ + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + ri), USBFS_MODE_NAK_OUT); + } + } +} + + +/******************************************************************************* +* Function Name: USBFS_SetEndpointHalt +******************************************************************************** +* +* Summary: +* This routine handles set endpoint halt. +* +* Parameters: +* None. +* +* Return: +* requestHandled. +* +* Reentrant: +* No. +* +*******************************************************************************/ +uint8 USBFS_SetEndpointHalt(void) +{ + uint8 ep; + uint8 ri; + uint8 requestHandled = USBFS_FALSE; + + /* Set endpoint halt */ + ep = CY_GET_REG8(USBFS_wIndexLo) & USBFS_DIR_UNUSED; + ri = ((ep - USBFS_EP1) << USBFS_EPX_CNTX_ADDR_SHIFT); + + if ((ep > USBFS_EP0) && (ep < USBFS_MAX_EP)) + { + /* Set the endpoint Halt */ + USBFS_EP[ep].hwEpState |= (USBFS_ENDPOINT_STATUS_HALT); + + /* Clear the data toggle */ + USBFS_EP[ep].epToggle = 0u; + USBFS_EP[ep].apiEpState |= USBFS_NO_EVENT_ALLOWED; + + if ((USBFS_EP[ep].addr & USBFS_DIR_IN) != 0u) + { + /* IN Endpoint */ + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + ri), USBFS_MODE_STALL_DATA_EP | + USBFS_MODE_ACK_IN); + } + else + { + /* OUT Endpoint */ + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + ri), USBFS_MODE_STALL_DATA_EP | + USBFS_MODE_ACK_OUT); + } + requestHandled = USBFS_InitNoDataControlTransfer(); + } + + return(requestHandled); +} + + +/******************************************************************************* +* Function Name: USBFS_ClearEndpointHalt +******************************************************************************** +* +* Summary: +* This routine handles clear endpoint halt. +* +* Parameters: +* None. +* +* Return: +* requestHandled. +* +* Reentrant: +* No. +* +*******************************************************************************/ +uint8 USBFS_ClearEndpointHalt(void) +{ + uint8 ep; + uint8 ri; + uint8 requestHandled = USBFS_FALSE; + + /* Clear endpoint halt */ + ep = CY_GET_REG8(USBFS_wIndexLo) & USBFS_DIR_UNUSED; + ri = ((ep - USBFS_EP1) << USBFS_EPX_CNTX_ADDR_SHIFT); + + if ((ep > USBFS_EP0) && (ep < USBFS_MAX_EP)) + { + /* Clear the endpoint Halt */ + USBFS_EP[ep].hwEpState &= (uint8)~(USBFS_ENDPOINT_STATUS_HALT); + + /* Clear the data toggle */ + USBFS_EP[ep].epToggle = 0u; + /* Clear toggle bit for already armed packet */ + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CNT0_IND + ri), CY_GET_REG8( + (reg8 *)(USBFS_SIE_EP1_CNT0_IND + ri)) & (uint8)~USBFS_EPX_CNT_DATA_TOGGLE); + /* Return API State as it was defined before */ + USBFS_EP[ep].apiEpState &= (uint8)~USBFS_NO_EVENT_ALLOWED; + + if ((USBFS_EP[ep].addr & USBFS_DIR_IN) != 0u) + { + /* IN Endpoint */ + if(USBFS_EP[ep].apiEpState == USBFS_IN_BUFFER_EMPTY) + { /* Wait for next packet from application */ + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + ri), USBFS_MODE_NAK_IN); + } + else /* Continue armed transfer */ + { + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + ri), USBFS_MODE_ACK_IN); + } + } + else + { + /* OUT Endpoint */ + if(USBFS_EP[ep].apiEpState == USBFS_OUT_BUFFER_FULL) + { /* Allow application to read full buffer */ + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + ri), USBFS_MODE_NAK_OUT); + } + else /* Mark endpoint as empty, so it will be reloaded */ + { + CY_SET_REG8((reg8 *)(USBFS_SIE_EP1_CR0_IND + ri), USBFS_MODE_ACK_OUT); + } + } + requestHandled = USBFS_InitNoDataControlTransfer(); + } + + return(requestHandled); +} + + +/******************************************************************************* +* Function Name: USBFS_ValidateAlternateSetting +******************************************************************************** +* +* Summary: +* Validates (and records) a SET INTERFACE request. +* +* Parameters: +* None. +* +* Return: +* requestHandled. +* +* Reentrant: +* No. +* +*******************************************************************************/ +uint8 USBFS_ValidateAlternateSetting(void) +{ + uint8 requestHandled = USBFS_TRUE; + uint8 interfaceNum; + const T_USBFS_LUT CYCODE *pTmp; + uint8 currentInterfacesNum; + + interfaceNum = CY_GET_REG8(USBFS_wIndexLo); + /* Validate interface setting, stall if invalid. */ + pTmp = USBFS_GetConfigTablePtr(USBFS_configuration - 1u); + currentInterfacesNum = ((const uint8 *) pTmp->p_list)[USBFS_CONFIG_DESCR_NUM_INTERFACES]; + + if((interfaceNum >= currentInterfacesNum) || (interfaceNum >= USBFS_MAX_INTERFACES_NUMBER)) + { /* Wrong interface number */ + requestHandled = USBFS_FALSE; + } + else + { + /* Save current Alt setting to find out the difference in Config() function */ + USBFS_interfaceSetting_last[interfaceNum] = USBFS_interfaceSetting[interfaceNum]; + USBFS_interfaceSetting[interfaceNum] = CY_GET_REG8(USBFS_wValueLo); + } + + return (requestHandled); +} + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_vnd.c b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_vnd.c new file mode 100755 index 0000000..15b68a5 --- /dev/null +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/USBFS_vnd.c @@ -0,0 +1,96 @@ +/******************************************************************************* +* File Name: USBFS_vnd.c +* Version 2.60 +* +* Description: +* USB vendor request handler. +* +* Note: +* +******************************************************************************** +* Copyright 2008-2013, Cypress Semiconductor Corporation. All rights reserved. +* You may use this file only in accordance with the license, terms, conditions, +* disclaimers, and limitations in the end user license agreement accompanying +* the software package with which this file was provided. +*******************************************************************************/ + +#include "USBFS.h" +#include "USBFS_pvt.h" + +#if(USBFS_EXTERN_VND == USBFS_FALSE) + + +/*************************************** +* Vendor Specific Declarations +***************************************/ + +/* `#START VENDOR_SPECIFIC_DECLARATIONS` Place your declaration here */ + +/* `#END` */ + + +/******************************************************************************* +* Function Name: USBFS_HandleVendorRqst +******************************************************************************** +* +* Summary: +* This routine provide users with a method to implement vendor specifc +* requests. +* +* To implement vendor specific requests, add your code in this function to +* decode and disposition the request. If the request is handled, your code +* must set the variable "requestHandled" to TRUE, indicating that the +* request has been handled. +* +* Parameters: +* None. +* +* Return: +* requestHandled. +* +* Reentrant: +* No. +* +*******************************************************************************/ +uint8 USBFS_HandleVendorRqst(void) +{ + uint8 requestHandled = USBFS_FALSE; + + if ((CY_GET_REG8(USBFS_bmRequestType) & USBFS_RQST_DIR_MASK) == USBFS_RQST_DIR_D2H) + { + /* Control Read */ + switch (CY_GET_REG8(USBFS_bRequest)) + { + case USBFS_GET_EXTENDED_CONFIG_DESCRIPTOR: + #if defined(USBFS_ENABLE_MSOS_STRING) + USBFS_currentTD.pData = (volatile uint8 *)&USBFS_MSOS_CONFIGURATION_DESCR[0u]; + USBFS_currentTD.count = USBFS_MSOS_CONFIGURATION_DESCR[0u]; + requestHandled = USBFS_InitControlRead(); + #endif /* End USBFS_ENABLE_MSOS_STRING */ + break; + default: + break; + } + } + + /* `#START VENDOR_SPECIFIC_CODE` Place your vendor specific request here */ + + /* `#END` */ + + return(requestHandled); +} + + +/******************************************************************************* +* Additional user functions supporting Vendor Specific Requests +********************************************************************************/ + +/* `#START VENDOR_SPECIFIC_FUNCTIONS` Place any additional functions here */ + +/* `#END` */ + + +#endif /* USBFS_EXTERN_VND */ + + +/* [] END OF FILE */ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfitter.h b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfitter.h index 5deeff6..bc90348 100755 --- a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfitter.h +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfitter.h @@ -3,45 +3,35 @@ #include #include -/* USBFS_1_bus_reset */ -#define USBFS_1_bus_reset__INTC_CLR_EN_REG CYREG_NVIC_CLRENA0 -#define USBFS_1_bus_reset__INTC_CLR_PD_REG CYREG_NVIC_CLRPEND0 -#define USBFS_1_bus_reset__INTC_MASK 0x800000u -#define USBFS_1_bus_reset__INTC_NUMBER 23u -#define USBFS_1_bus_reset__INTC_PRIOR_NUM 7u -#define USBFS_1_bus_reset__INTC_PRIOR_REG CYREG_NVIC_PRI_23 -#define USBFS_1_bus_reset__INTC_SET_EN_REG CYREG_NVIC_SETENA0 -#define USBFS_1_bus_reset__INTC_SET_PD_REG CYREG_NVIC_SETPEND0 +/* USBFS_bus_reset */ +#define USBFS_bus_reset__INTC_CLR_EN_REG CYREG_NVIC_CLRENA0 +#define USBFS_bus_reset__INTC_CLR_PD_REG CYREG_NVIC_CLRPEND0 +#define USBFS_bus_reset__INTC_MASK 0x800000u +#define USBFS_bus_reset__INTC_NUMBER 23u +#define USBFS_bus_reset__INTC_PRIOR_NUM 7u +#define USBFS_bus_reset__INTC_PRIOR_REG CYREG_NVIC_PRI_23 +#define USBFS_bus_reset__INTC_SET_EN_REG CYREG_NVIC_SETENA0 +#define USBFS_bus_reset__INTC_SET_PD_REG CYREG_NVIC_SETPEND0 -/* USBFS_1_arb_int */ -#define USBFS_1_arb_int__INTC_CLR_EN_REG CYREG_NVIC_CLRENA0 -#define USBFS_1_arb_int__INTC_CLR_PD_REG CYREG_NVIC_CLRPEND0 -#define USBFS_1_arb_int__INTC_MASK 0x400000u -#define USBFS_1_arb_int__INTC_NUMBER 22u -#define USBFS_1_arb_int__INTC_PRIOR_NUM 7u -#define USBFS_1_arb_int__INTC_PRIOR_REG CYREG_NVIC_PRI_22 -#define USBFS_1_arb_int__INTC_SET_EN_REG CYREG_NVIC_SETENA0 -#define USBFS_1_arb_int__INTC_SET_PD_REG CYREG_NVIC_SETPEND0 +/* USBFS_arb_int */ +#define USBFS_arb_int__INTC_CLR_EN_REG CYREG_NVIC_CLRENA0 +#define USBFS_arb_int__INTC_CLR_PD_REG CYREG_NVIC_CLRPEND0 +#define USBFS_arb_int__INTC_MASK 0x400000u +#define USBFS_arb_int__INTC_NUMBER 22u +#define USBFS_arb_int__INTC_PRIOR_NUM 7u +#define USBFS_arb_int__INTC_PRIOR_REG CYREG_NVIC_PRI_22 +#define USBFS_arb_int__INTC_SET_EN_REG CYREG_NVIC_SETENA0 +#define USBFS_arb_int__INTC_SET_PD_REG CYREG_NVIC_SETPEND0 -/* USBFS_1_sof_int */ -#define USBFS_1_sof_int__INTC_CLR_EN_REG CYREG_NVIC_CLRENA0 -#define USBFS_1_sof_int__INTC_CLR_PD_REG CYREG_NVIC_CLRPEND0 -#define USBFS_1_sof_int__INTC_MASK 0x200000u -#define USBFS_1_sof_int__INTC_NUMBER 21u -#define USBFS_1_sof_int__INTC_PRIOR_NUM 7u -#define USBFS_1_sof_int__INTC_PRIOR_REG CYREG_NVIC_PRI_21 -#define USBFS_1_sof_int__INTC_SET_EN_REG CYREG_NVIC_SETENA0 -#define USBFS_1_sof_int__INTC_SET_PD_REG CYREG_NVIC_SETPEND0 - -/* USBFS_1_dp_int */ -#define USBFS_1_dp_int__INTC_CLR_EN_REG CYREG_NVIC_CLRENA0 -#define USBFS_1_dp_int__INTC_CLR_PD_REG CYREG_NVIC_CLRPEND0 -#define USBFS_1_dp_int__INTC_MASK 0x1000u -#define USBFS_1_dp_int__INTC_NUMBER 12u -#define USBFS_1_dp_int__INTC_PRIOR_NUM 7u -#define USBFS_1_dp_int__INTC_PRIOR_REG CYREG_NVIC_PRI_12 -#define USBFS_1_dp_int__INTC_SET_EN_REG CYREG_NVIC_SETENA0 -#define USBFS_1_dp_int__INTC_SET_PD_REG CYREG_NVIC_SETPEND0 +/* USBFS_sof_int */ +#define USBFS_sof_int__INTC_CLR_EN_REG CYREG_NVIC_CLRENA0 +#define USBFS_sof_int__INTC_CLR_PD_REG CYREG_NVIC_CLRPEND0 +#define USBFS_sof_int__INTC_MASK 0x200000u +#define USBFS_sof_int__INTC_NUMBER 21u +#define USBFS_sof_int__INTC_PRIOR_NUM 7u +#define USBFS_sof_int__INTC_PRIOR_REG CYREG_NVIC_PRI_21 +#define USBFS_sof_int__INTC_SET_EN_REG CYREG_NVIC_SETENA0 +#define USBFS_sof_int__INTC_SET_PD_REG CYREG_NVIC_SETPEND0 /* SCSI_ATN_ISR */ #define SCSI_ATN_ISR__INTC_CLR_EN_REG CYREG_NVIC_CLRENA0 @@ -572,25 +562,15 @@ #define SDCard_BSPIM_sR8_Dp_u0__MSK_DP_AUX_CTL_REG CYREG_B0_UDB07_MSK_ACTL #define SDCard_BSPIM_sR8_Dp_u0__PER_DP_AUX_CTL_REG CYREG_B0_UDB07_MSK_ACTL -/* USBFS_1_ep_0 */ -#define USBFS_1_ep_0__INTC_CLR_EN_REG CYREG_NVIC_CLRENA0 -#define USBFS_1_ep_0__INTC_CLR_PD_REG CYREG_NVIC_CLRPEND0 -#define USBFS_1_ep_0__INTC_MASK 0x1000000u -#define USBFS_1_ep_0__INTC_NUMBER 24u -#define USBFS_1_ep_0__INTC_PRIOR_NUM 7u -#define USBFS_1_ep_0__INTC_PRIOR_REG CYREG_NVIC_PRI_24 -#define USBFS_1_ep_0__INTC_SET_EN_REG CYREG_NVIC_SETENA0 -#define USBFS_1_ep_0__INTC_SET_PD_REG CYREG_NVIC_SETPEND0 - -/* USBFS_1_ep_1 */ -#define USBFS_1_ep_1__INTC_CLR_EN_REG CYREG_NVIC_CLRENA0 -#define USBFS_1_ep_1__INTC_CLR_PD_REG CYREG_NVIC_CLRPEND0 -#define USBFS_1_ep_1__INTC_MASK 0x01u -#define USBFS_1_ep_1__INTC_NUMBER 0u -#define USBFS_1_ep_1__INTC_PRIOR_NUM 7u -#define USBFS_1_ep_1__INTC_PRIOR_REG CYREG_NVIC_PRI_0 -#define USBFS_1_ep_1__INTC_SET_EN_REG CYREG_NVIC_SETENA0 -#define USBFS_1_ep_1__INTC_SET_PD_REG CYREG_NVIC_SETPEND0 +/* USBFS_dp_int */ +#define USBFS_dp_int__INTC_CLR_EN_REG CYREG_NVIC_CLRENA0 +#define USBFS_dp_int__INTC_CLR_PD_REG CYREG_NVIC_CLRPEND0 +#define USBFS_dp_int__INTC_MASK 0x1000u +#define USBFS_dp_int__INTC_NUMBER 12u +#define USBFS_dp_int__INTC_PRIOR_NUM 7u +#define USBFS_dp_int__INTC_PRIOR_REG CYREG_NVIC_PRI_12 +#define USBFS_dp_int__INTC_SET_EN_REG CYREG_NVIC_SETENA0 +#define USBFS_dp_int__INTC_SET_PD_REG CYREG_NVIC_SETPEND0 /* SCSI_CTL_IO */ #define SCSI_CTL_IO_Sync_ctrl_reg__0__MASK 0x01u @@ -1068,132 +1048,6 @@ #define SD_Init_Clk__PM_STBY_CFG CYREG_PM_STBY_CFG2 #define SD_Init_Clk__PM_STBY_MSK 0x02u -/* USBFS_1_USB */ -#define USBFS_1_USB__ARB_CFG CYREG_USB_ARB_CFG -#define USBFS_1_USB__ARB_EP1_CFG CYREG_USB_ARB_EP1_CFG -#define USBFS_1_USB__ARB_EP1_INT_EN CYREG_USB_ARB_EP1_INT_EN -#define USBFS_1_USB__ARB_EP1_SR CYREG_USB_ARB_EP1_SR -#define USBFS_1_USB__ARB_EP2_CFG CYREG_USB_ARB_EP2_CFG -#define USBFS_1_USB__ARB_EP2_INT_EN CYREG_USB_ARB_EP2_INT_EN -#define USBFS_1_USB__ARB_EP2_SR CYREG_USB_ARB_EP2_SR -#define USBFS_1_USB__ARB_EP3_CFG CYREG_USB_ARB_EP3_CFG -#define USBFS_1_USB__ARB_EP3_INT_EN CYREG_USB_ARB_EP3_INT_EN -#define USBFS_1_USB__ARB_EP3_SR CYREG_USB_ARB_EP3_SR -#define USBFS_1_USB__ARB_EP4_CFG CYREG_USB_ARB_EP4_CFG -#define USBFS_1_USB__ARB_EP4_INT_EN CYREG_USB_ARB_EP4_INT_EN -#define USBFS_1_USB__ARB_EP4_SR CYREG_USB_ARB_EP4_SR -#define USBFS_1_USB__ARB_EP5_CFG CYREG_USB_ARB_EP5_CFG -#define USBFS_1_USB__ARB_EP5_INT_EN CYREG_USB_ARB_EP5_INT_EN -#define USBFS_1_USB__ARB_EP5_SR CYREG_USB_ARB_EP5_SR -#define USBFS_1_USB__ARB_EP6_CFG CYREG_USB_ARB_EP6_CFG -#define USBFS_1_USB__ARB_EP6_INT_EN CYREG_USB_ARB_EP6_INT_EN -#define USBFS_1_USB__ARB_EP6_SR CYREG_USB_ARB_EP6_SR -#define USBFS_1_USB__ARB_EP7_CFG CYREG_USB_ARB_EP7_CFG -#define USBFS_1_USB__ARB_EP7_INT_EN CYREG_USB_ARB_EP7_INT_EN -#define USBFS_1_USB__ARB_EP7_SR CYREG_USB_ARB_EP7_SR -#define USBFS_1_USB__ARB_EP8_CFG CYREG_USB_ARB_EP8_CFG -#define USBFS_1_USB__ARB_EP8_INT_EN CYREG_USB_ARB_EP8_INT_EN -#define USBFS_1_USB__ARB_EP8_SR CYREG_USB_ARB_EP8_SR -#define USBFS_1_USB__ARB_INT_EN CYREG_USB_ARB_INT_EN -#define USBFS_1_USB__ARB_INT_SR CYREG_USB_ARB_INT_SR -#define USBFS_1_USB__ARB_RW1_DR CYREG_USB_ARB_RW1_DR -#define USBFS_1_USB__ARB_RW1_RA CYREG_USB_ARB_RW1_RA -#define USBFS_1_USB__ARB_RW1_RA_MSB CYREG_USB_ARB_RW1_RA_MSB -#define USBFS_1_USB__ARB_RW1_WA CYREG_USB_ARB_RW1_WA -#define USBFS_1_USB__ARB_RW1_WA_MSB CYREG_USB_ARB_RW1_WA_MSB -#define USBFS_1_USB__ARB_RW2_DR CYREG_USB_ARB_RW2_DR -#define USBFS_1_USB__ARB_RW2_RA CYREG_USB_ARB_RW2_RA -#define USBFS_1_USB__ARB_RW2_RA_MSB CYREG_USB_ARB_RW2_RA_MSB -#define USBFS_1_USB__ARB_RW2_WA CYREG_USB_ARB_RW2_WA -#define USBFS_1_USB__ARB_RW2_WA_MSB CYREG_USB_ARB_RW2_WA_MSB -#define USBFS_1_USB__ARB_RW3_DR CYREG_USB_ARB_RW3_DR -#define USBFS_1_USB__ARB_RW3_RA CYREG_USB_ARB_RW3_RA -#define USBFS_1_USB__ARB_RW3_RA_MSB CYREG_USB_ARB_RW3_RA_MSB -#define USBFS_1_USB__ARB_RW3_WA CYREG_USB_ARB_RW3_WA -#define USBFS_1_USB__ARB_RW3_WA_MSB CYREG_USB_ARB_RW3_WA_MSB -#define USBFS_1_USB__ARB_RW4_DR CYREG_USB_ARB_RW4_DR -#define USBFS_1_USB__ARB_RW4_RA CYREG_USB_ARB_RW4_RA -#define USBFS_1_USB__ARB_RW4_RA_MSB CYREG_USB_ARB_RW4_RA_MSB -#define USBFS_1_USB__ARB_RW4_WA CYREG_USB_ARB_RW4_WA -#define USBFS_1_USB__ARB_RW4_WA_MSB CYREG_USB_ARB_RW4_WA_MSB -#define USBFS_1_USB__ARB_RW5_DR CYREG_USB_ARB_RW5_DR -#define USBFS_1_USB__ARB_RW5_RA CYREG_USB_ARB_RW5_RA -#define USBFS_1_USB__ARB_RW5_RA_MSB CYREG_USB_ARB_RW5_RA_MSB -#define USBFS_1_USB__ARB_RW5_WA CYREG_USB_ARB_RW5_WA -#define USBFS_1_USB__ARB_RW5_WA_MSB CYREG_USB_ARB_RW5_WA_MSB -#define USBFS_1_USB__ARB_RW6_DR CYREG_USB_ARB_RW6_DR -#define USBFS_1_USB__ARB_RW6_RA CYREG_USB_ARB_RW6_RA -#define USBFS_1_USB__ARB_RW6_RA_MSB CYREG_USB_ARB_RW6_RA_MSB -#define USBFS_1_USB__ARB_RW6_WA CYREG_USB_ARB_RW6_WA -#define USBFS_1_USB__ARB_RW6_WA_MSB CYREG_USB_ARB_RW6_WA_MSB -#define USBFS_1_USB__ARB_RW7_DR CYREG_USB_ARB_RW7_DR -#define USBFS_1_USB__ARB_RW7_RA CYREG_USB_ARB_RW7_RA -#define USBFS_1_USB__ARB_RW7_RA_MSB CYREG_USB_ARB_RW7_RA_MSB -#define USBFS_1_USB__ARB_RW7_WA CYREG_USB_ARB_RW7_WA -#define USBFS_1_USB__ARB_RW7_WA_MSB CYREG_USB_ARB_RW7_WA_MSB -#define USBFS_1_USB__ARB_RW8_DR CYREG_USB_ARB_RW8_DR -#define USBFS_1_USB__ARB_RW8_RA CYREG_USB_ARB_RW8_RA -#define USBFS_1_USB__ARB_RW8_RA_MSB CYREG_USB_ARB_RW8_RA_MSB -#define USBFS_1_USB__ARB_RW8_WA CYREG_USB_ARB_RW8_WA -#define USBFS_1_USB__ARB_RW8_WA_MSB CYREG_USB_ARB_RW8_WA_MSB -#define USBFS_1_USB__BUF_SIZE CYREG_USB_BUF_SIZE -#define USBFS_1_USB__BUS_RST_CNT CYREG_USB_BUS_RST_CNT -#define USBFS_1_USB__CR0 CYREG_USB_CR0 -#define USBFS_1_USB__CR1 CYREG_USB_CR1 -#define USBFS_1_USB__CWA CYREG_USB_CWA -#define USBFS_1_USB__CWA_MSB CYREG_USB_CWA_MSB -#define USBFS_1_USB__DMA_THRES CYREG_USB_DMA_THRES -#define USBFS_1_USB__DMA_THRES_MSB CYREG_USB_DMA_THRES_MSB -#define USBFS_1_USB__DYN_RECONFIG CYREG_USB_DYN_RECONFIG -#define USBFS_1_USB__EP0_CNT CYREG_USB_EP0_CNT -#define USBFS_1_USB__EP0_CR CYREG_USB_EP0_CR -#define USBFS_1_USB__EP0_DR0 CYREG_USB_EP0_DR0 -#define USBFS_1_USB__EP0_DR1 CYREG_USB_EP0_DR1 -#define USBFS_1_USB__EP0_DR2 CYREG_USB_EP0_DR2 -#define USBFS_1_USB__EP0_DR3 CYREG_USB_EP0_DR3 -#define USBFS_1_USB__EP0_DR4 CYREG_USB_EP0_DR4 -#define USBFS_1_USB__EP0_DR5 CYREG_USB_EP0_DR5 -#define USBFS_1_USB__EP0_DR6 CYREG_USB_EP0_DR6 -#define USBFS_1_USB__EP0_DR7 CYREG_USB_EP0_DR7 -#define USBFS_1_USB__EP_ACTIVE CYREG_USB_EP_ACTIVE -#define USBFS_1_USB__EP_TYPE CYREG_USB_EP_TYPE -#define USBFS_1_USB__MEM_DATA CYREG_USB_MEM_DATA_MBASE -#define USBFS_1_USB__PM_ACT_CFG CYREG_PM_ACT_CFG5 -#define USBFS_1_USB__PM_ACT_MSK 0x01u -#define USBFS_1_USB__PM_STBY_CFG CYREG_PM_STBY_CFG5 -#define USBFS_1_USB__PM_STBY_MSK 0x01u -#define USBFS_1_USB__SIE_EP1_CNT0 CYREG_USB_SIE_EP1_CNT0 -#define USBFS_1_USB__SIE_EP1_CNT1 CYREG_USB_SIE_EP1_CNT1 -#define USBFS_1_USB__SIE_EP1_CR0 CYREG_USB_SIE_EP1_CR0 -#define USBFS_1_USB__SIE_EP2_CNT0 CYREG_USB_SIE_EP2_CNT0 -#define USBFS_1_USB__SIE_EP2_CNT1 CYREG_USB_SIE_EP2_CNT1 -#define USBFS_1_USB__SIE_EP2_CR0 CYREG_USB_SIE_EP2_CR0 -#define USBFS_1_USB__SIE_EP3_CNT0 CYREG_USB_SIE_EP3_CNT0 -#define USBFS_1_USB__SIE_EP3_CNT1 CYREG_USB_SIE_EP3_CNT1 -#define USBFS_1_USB__SIE_EP3_CR0 CYREG_USB_SIE_EP3_CR0 -#define USBFS_1_USB__SIE_EP4_CNT0 CYREG_USB_SIE_EP4_CNT0 -#define USBFS_1_USB__SIE_EP4_CNT1 CYREG_USB_SIE_EP4_CNT1 -#define USBFS_1_USB__SIE_EP4_CR0 CYREG_USB_SIE_EP4_CR0 -#define USBFS_1_USB__SIE_EP5_CNT0 CYREG_USB_SIE_EP5_CNT0 -#define USBFS_1_USB__SIE_EP5_CNT1 CYREG_USB_SIE_EP5_CNT1 -#define USBFS_1_USB__SIE_EP5_CR0 CYREG_USB_SIE_EP5_CR0 -#define USBFS_1_USB__SIE_EP6_CNT0 CYREG_USB_SIE_EP6_CNT0 -#define USBFS_1_USB__SIE_EP6_CNT1 CYREG_USB_SIE_EP6_CNT1 -#define USBFS_1_USB__SIE_EP6_CR0 CYREG_USB_SIE_EP6_CR0 -#define USBFS_1_USB__SIE_EP7_CNT0 CYREG_USB_SIE_EP7_CNT0 -#define USBFS_1_USB__SIE_EP7_CNT1 CYREG_USB_SIE_EP7_CNT1 -#define USBFS_1_USB__SIE_EP7_CR0 CYREG_USB_SIE_EP7_CR0 -#define USBFS_1_USB__SIE_EP8_CNT0 CYREG_USB_SIE_EP8_CNT0 -#define USBFS_1_USB__SIE_EP8_CNT1 CYREG_USB_SIE_EP8_CNT1 -#define USBFS_1_USB__SIE_EP8_CR0 CYREG_USB_SIE_EP8_CR0 -#define USBFS_1_USB__SIE_EP_INT_EN CYREG_USB_SIE_EP_INT_EN -#define USBFS_1_USB__SIE_EP_INT_SR CYREG_USB_SIE_EP_INT_SR -#define USBFS_1_USB__SOF0 CYREG_USB_SOF0 -#define USBFS_1_USB__SOF1 CYREG_USB_SOF1 -#define USBFS_1_USB__USBIO_CR0 CYREG_USB_USBIO_CR0 -#define USBFS_1_USB__USBIO_CR1 CYREG_USB_USBIO_CR1 -#define USBFS_1_USB__USB_CLK_EN CYREG_USB_USB_CLK_EN - /* scsiTarget */ #define scsiTarget_StatusReg__0__MASK 0x01u #define scsiTarget_StatusReg__0__POS 0 @@ -1277,71 +1131,161 @@ #define SD_Clk_Ctl_Sync_ctrl_reg__PERIOD_REG CYREG_B0_UDB01_MSK #define SD_Clk_Ctl_Sync_ctrl_reg__PER_CTL_AUX_CTL_REG CYREG_B0_UDB01_MSK_ACTL -/* USBFS_1_Dm */ -#define USBFS_1_Dm__0__MASK 0x80u -#define USBFS_1_Dm__0__PC CYREG_IO_PC_PRT15_7_6_PC1 -#define USBFS_1_Dm__0__PORT 15u -#define USBFS_1_Dm__0__SHIFT 7 -#define USBFS_1_Dm__AG CYREG_PRT15_AG -#define USBFS_1_Dm__AMUX CYREG_PRT15_AMUX -#define USBFS_1_Dm__BIE CYREG_PRT15_BIE -#define USBFS_1_Dm__BIT_MASK CYREG_PRT15_BIT_MASK -#define USBFS_1_Dm__BYP CYREG_PRT15_BYP -#define USBFS_1_Dm__CTL CYREG_PRT15_CTL -#define USBFS_1_Dm__DM0 CYREG_PRT15_DM0 -#define USBFS_1_Dm__DM1 CYREG_PRT15_DM1 -#define USBFS_1_Dm__DM2 CYREG_PRT15_DM2 -#define USBFS_1_Dm__DR CYREG_PRT15_DR -#define USBFS_1_Dm__INP_DIS CYREG_PRT15_INP_DIS -#define USBFS_1_Dm__LCD_COM_SEG CYREG_PRT15_LCD_COM_SEG -#define USBFS_1_Dm__LCD_EN CYREG_PRT15_LCD_EN -#define USBFS_1_Dm__MASK 0x80u -#define USBFS_1_Dm__PORT 15u -#define USBFS_1_Dm__PRT CYREG_PRT15_PRT -#define USBFS_1_Dm__PRTDSI__CAPS_SEL CYREG_PRT15_CAPS_SEL -#define USBFS_1_Dm__PRTDSI__DBL_SYNC_IN CYREG_PRT15_DBL_SYNC_IN -#define USBFS_1_Dm__PRTDSI__OE_SEL0 CYREG_PRT15_OE_SEL0 -#define USBFS_1_Dm__PRTDSI__OE_SEL1 CYREG_PRT15_OE_SEL1 -#define USBFS_1_Dm__PRTDSI__OUT_SEL0 CYREG_PRT15_OUT_SEL0 -#define USBFS_1_Dm__PRTDSI__OUT_SEL1 CYREG_PRT15_OUT_SEL1 -#define USBFS_1_Dm__PRTDSI__SYNC_OUT CYREG_PRT15_SYNC_OUT -#define USBFS_1_Dm__PS CYREG_PRT15_PS -#define USBFS_1_Dm__SHIFT 7 -#define USBFS_1_Dm__SLW CYREG_PRT15_SLW +/* USBFS_ep_0 */ +#define USBFS_ep_0__INTC_CLR_EN_REG CYREG_NVIC_CLRENA0 +#define USBFS_ep_0__INTC_CLR_PD_REG CYREG_NVIC_CLRPEND0 +#define USBFS_ep_0__INTC_MASK 0x1000000u +#define USBFS_ep_0__INTC_NUMBER 24u +#define USBFS_ep_0__INTC_PRIOR_NUM 7u +#define USBFS_ep_0__INTC_PRIOR_REG CYREG_NVIC_PRI_24 +#define USBFS_ep_0__INTC_SET_EN_REG CYREG_NVIC_SETENA0 +#define USBFS_ep_0__INTC_SET_PD_REG CYREG_NVIC_SETPEND0 + +/* USBFS_ep_1 */ +#define USBFS_ep_1__INTC_CLR_EN_REG CYREG_NVIC_CLRENA0 +#define USBFS_ep_1__INTC_CLR_PD_REG CYREG_NVIC_CLRPEND0 +#define USBFS_ep_1__INTC_MASK 0x01u +#define USBFS_ep_1__INTC_NUMBER 0u +#define USBFS_ep_1__INTC_PRIOR_NUM 7u +#define USBFS_ep_1__INTC_PRIOR_REG CYREG_NVIC_PRI_0 +#define USBFS_ep_1__INTC_SET_EN_REG CYREG_NVIC_SETENA0 +#define USBFS_ep_1__INTC_SET_PD_REG CYREG_NVIC_SETPEND0 -/* USBFS_1_Dp */ -#define USBFS_1_Dp__0__MASK 0x40u -#define USBFS_1_Dp__0__PC CYREG_IO_PC_PRT15_7_6_PC0 -#define USBFS_1_Dp__0__PORT 15u -#define USBFS_1_Dp__0__SHIFT 6 -#define USBFS_1_Dp__AG CYREG_PRT15_AG -#define USBFS_1_Dp__AMUX CYREG_PRT15_AMUX -#define USBFS_1_Dp__BIE CYREG_PRT15_BIE -#define USBFS_1_Dp__BIT_MASK CYREG_PRT15_BIT_MASK -#define USBFS_1_Dp__BYP CYREG_PRT15_BYP -#define USBFS_1_Dp__CTL CYREG_PRT15_CTL -#define USBFS_1_Dp__DM0 CYREG_PRT15_DM0 -#define USBFS_1_Dp__DM1 CYREG_PRT15_DM1 -#define USBFS_1_Dp__DM2 CYREG_PRT15_DM2 -#define USBFS_1_Dp__DR CYREG_PRT15_DR -#define USBFS_1_Dp__INP_DIS CYREG_PRT15_INP_DIS -#define USBFS_1_Dp__INTSTAT CYREG_PICU15_INTSTAT -#define USBFS_1_Dp__LCD_COM_SEG CYREG_PRT15_LCD_COM_SEG -#define USBFS_1_Dp__LCD_EN CYREG_PRT15_LCD_EN -#define USBFS_1_Dp__MASK 0x40u -#define USBFS_1_Dp__PORT 15u -#define USBFS_1_Dp__PRT CYREG_PRT15_PRT -#define USBFS_1_Dp__PRTDSI__CAPS_SEL CYREG_PRT15_CAPS_SEL -#define USBFS_1_Dp__PRTDSI__DBL_SYNC_IN CYREG_PRT15_DBL_SYNC_IN -#define USBFS_1_Dp__PRTDSI__OE_SEL0 CYREG_PRT15_OE_SEL0 -#define USBFS_1_Dp__PRTDSI__OE_SEL1 CYREG_PRT15_OE_SEL1 -#define USBFS_1_Dp__PRTDSI__OUT_SEL0 CYREG_PRT15_OUT_SEL0 -#define USBFS_1_Dp__PRTDSI__OUT_SEL1 CYREG_PRT15_OUT_SEL1 -#define USBFS_1_Dp__PRTDSI__SYNC_OUT CYREG_PRT15_SYNC_OUT -#define USBFS_1_Dp__PS CYREG_PRT15_PS -#define USBFS_1_Dp__SHIFT 6 -#define USBFS_1_Dp__SLW CYREG_PRT15_SLW -#define USBFS_1_Dp__SNAP CYREG_PICU_15_SNAP_15 +/* USBFS_ep_2 */ +#define USBFS_ep_2__INTC_CLR_EN_REG CYREG_NVIC_CLRENA0 +#define USBFS_ep_2__INTC_CLR_PD_REG CYREG_NVIC_CLRPEND0 +#define USBFS_ep_2__INTC_MASK 0x02u +#define USBFS_ep_2__INTC_NUMBER 1u +#define USBFS_ep_2__INTC_PRIOR_NUM 7u +#define USBFS_ep_2__INTC_PRIOR_REG CYREG_NVIC_PRI_1 +#define USBFS_ep_2__INTC_SET_EN_REG CYREG_NVIC_SETENA0 +#define USBFS_ep_2__INTC_SET_PD_REG CYREG_NVIC_SETPEND0 + +/* USBFS_USB */ +#define USBFS_USB__ARB_CFG CYREG_USB_ARB_CFG +#define USBFS_USB__ARB_EP1_CFG CYREG_USB_ARB_EP1_CFG +#define USBFS_USB__ARB_EP1_INT_EN CYREG_USB_ARB_EP1_INT_EN +#define USBFS_USB__ARB_EP1_SR CYREG_USB_ARB_EP1_SR +#define USBFS_USB__ARB_EP2_CFG CYREG_USB_ARB_EP2_CFG +#define USBFS_USB__ARB_EP2_INT_EN CYREG_USB_ARB_EP2_INT_EN +#define USBFS_USB__ARB_EP2_SR CYREG_USB_ARB_EP2_SR +#define USBFS_USB__ARB_EP3_CFG CYREG_USB_ARB_EP3_CFG +#define USBFS_USB__ARB_EP3_INT_EN CYREG_USB_ARB_EP3_INT_EN +#define USBFS_USB__ARB_EP3_SR CYREG_USB_ARB_EP3_SR +#define USBFS_USB__ARB_EP4_CFG CYREG_USB_ARB_EP4_CFG +#define USBFS_USB__ARB_EP4_INT_EN CYREG_USB_ARB_EP4_INT_EN +#define USBFS_USB__ARB_EP4_SR CYREG_USB_ARB_EP4_SR +#define USBFS_USB__ARB_EP5_CFG CYREG_USB_ARB_EP5_CFG +#define USBFS_USB__ARB_EP5_INT_EN CYREG_USB_ARB_EP5_INT_EN +#define USBFS_USB__ARB_EP5_SR CYREG_USB_ARB_EP5_SR +#define USBFS_USB__ARB_EP6_CFG CYREG_USB_ARB_EP6_CFG +#define USBFS_USB__ARB_EP6_INT_EN CYREG_USB_ARB_EP6_INT_EN +#define USBFS_USB__ARB_EP6_SR CYREG_USB_ARB_EP6_SR +#define USBFS_USB__ARB_EP7_CFG CYREG_USB_ARB_EP7_CFG +#define USBFS_USB__ARB_EP7_INT_EN CYREG_USB_ARB_EP7_INT_EN +#define USBFS_USB__ARB_EP7_SR CYREG_USB_ARB_EP7_SR +#define USBFS_USB__ARB_EP8_CFG CYREG_USB_ARB_EP8_CFG +#define USBFS_USB__ARB_EP8_INT_EN CYREG_USB_ARB_EP8_INT_EN +#define USBFS_USB__ARB_EP8_SR CYREG_USB_ARB_EP8_SR +#define USBFS_USB__ARB_INT_EN CYREG_USB_ARB_INT_EN +#define USBFS_USB__ARB_INT_SR CYREG_USB_ARB_INT_SR +#define USBFS_USB__ARB_RW1_DR CYREG_USB_ARB_RW1_DR +#define USBFS_USB__ARB_RW1_RA CYREG_USB_ARB_RW1_RA +#define USBFS_USB__ARB_RW1_RA_MSB CYREG_USB_ARB_RW1_RA_MSB +#define USBFS_USB__ARB_RW1_WA CYREG_USB_ARB_RW1_WA +#define USBFS_USB__ARB_RW1_WA_MSB CYREG_USB_ARB_RW1_WA_MSB +#define USBFS_USB__ARB_RW2_DR CYREG_USB_ARB_RW2_DR +#define USBFS_USB__ARB_RW2_RA CYREG_USB_ARB_RW2_RA +#define USBFS_USB__ARB_RW2_RA_MSB CYREG_USB_ARB_RW2_RA_MSB +#define USBFS_USB__ARB_RW2_WA CYREG_USB_ARB_RW2_WA +#define USBFS_USB__ARB_RW2_WA_MSB CYREG_USB_ARB_RW2_WA_MSB +#define USBFS_USB__ARB_RW3_DR CYREG_USB_ARB_RW3_DR +#define USBFS_USB__ARB_RW3_RA CYREG_USB_ARB_RW3_RA +#define USBFS_USB__ARB_RW3_RA_MSB CYREG_USB_ARB_RW3_RA_MSB +#define USBFS_USB__ARB_RW3_WA CYREG_USB_ARB_RW3_WA +#define USBFS_USB__ARB_RW3_WA_MSB CYREG_USB_ARB_RW3_WA_MSB +#define USBFS_USB__ARB_RW4_DR CYREG_USB_ARB_RW4_DR +#define USBFS_USB__ARB_RW4_RA CYREG_USB_ARB_RW4_RA +#define USBFS_USB__ARB_RW4_RA_MSB CYREG_USB_ARB_RW4_RA_MSB +#define USBFS_USB__ARB_RW4_WA CYREG_USB_ARB_RW4_WA +#define USBFS_USB__ARB_RW4_WA_MSB CYREG_USB_ARB_RW4_WA_MSB +#define USBFS_USB__ARB_RW5_DR CYREG_USB_ARB_RW5_DR +#define USBFS_USB__ARB_RW5_RA CYREG_USB_ARB_RW5_RA +#define USBFS_USB__ARB_RW5_RA_MSB CYREG_USB_ARB_RW5_RA_MSB +#define USBFS_USB__ARB_RW5_WA CYREG_USB_ARB_RW5_WA +#define USBFS_USB__ARB_RW5_WA_MSB CYREG_USB_ARB_RW5_WA_MSB +#define USBFS_USB__ARB_RW6_DR CYREG_USB_ARB_RW6_DR +#define USBFS_USB__ARB_RW6_RA CYREG_USB_ARB_RW6_RA +#define USBFS_USB__ARB_RW6_RA_MSB CYREG_USB_ARB_RW6_RA_MSB +#define USBFS_USB__ARB_RW6_WA CYREG_USB_ARB_RW6_WA +#define USBFS_USB__ARB_RW6_WA_MSB CYREG_USB_ARB_RW6_WA_MSB +#define USBFS_USB__ARB_RW7_DR CYREG_USB_ARB_RW7_DR +#define USBFS_USB__ARB_RW7_RA CYREG_USB_ARB_RW7_RA +#define USBFS_USB__ARB_RW7_RA_MSB CYREG_USB_ARB_RW7_RA_MSB +#define USBFS_USB__ARB_RW7_WA CYREG_USB_ARB_RW7_WA +#define USBFS_USB__ARB_RW7_WA_MSB CYREG_USB_ARB_RW7_WA_MSB +#define USBFS_USB__ARB_RW8_DR CYREG_USB_ARB_RW8_DR +#define USBFS_USB__ARB_RW8_RA CYREG_USB_ARB_RW8_RA +#define USBFS_USB__ARB_RW8_RA_MSB CYREG_USB_ARB_RW8_RA_MSB +#define USBFS_USB__ARB_RW8_WA CYREG_USB_ARB_RW8_WA +#define USBFS_USB__ARB_RW8_WA_MSB CYREG_USB_ARB_RW8_WA_MSB +#define USBFS_USB__BUF_SIZE CYREG_USB_BUF_SIZE +#define USBFS_USB__BUS_RST_CNT CYREG_USB_BUS_RST_CNT +#define USBFS_USB__CR0 CYREG_USB_CR0 +#define USBFS_USB__CR1 CYREG_USB_CR1 +#define USBFS_USB__CWA CYREG_USB_CWA +#define USBFS_USB__CWA_MSB CYREG_USB_CWA_MSB +#define USBFS_USB__DMA_THRES CYREG_USB_DMA_THRES +#define USBFS_USB__DMA_THRES_MSB CYREG_USB_DMA_THRES_MSB +#define USBFS_USB__DYN_RECONFIG CYREG_USB_DYN_RECONFIG +#define USBFS_USB__EP0_CNT CYREG_USB_EP0_CNT +#define USBFS_USB__EP0_CR CYREG_USB_EP0_CR +#define USBFS_USB__EP0_DR0 CYREG_USB_EP0_DR0 +#define USBFS_USB__EP0_DR1 CYREG_USB_EP0_DR1 +#define USBFS_USB__EP0_DR2 CYREG_USB_EP0_DR2 +#define USBFS_USB__EP0_DR3 CYREG_USB_EP0_DR3 +#define USBFS_USB__EP0_DR4 CYREG_USB_EP0_DR4 +#define USBFS_USB__EP0_DR5 CYREG_USB_EP0_DR5 +#define USBFS_USB__EP0_DR6 CYREG_USB_EP0_DR6 +#define USBFS_USB__EP0_DR7 CYREG_USB_EP0_DR7 +#define USBFS_USB__EP_ACTIVE CYREG_USB_EP_ACTIVE +#define USBFS_USB__EP_TYPE CYREG_USB_EP_TYPE +#define USBFS_USB__MEM_DATA CYREG_USB_MEM_DATA_MBASE +#define USBFS_USB__PM_ACT_CFG CYREG_PM_ACT_CFG5 +#define USBFS_USB__PM_ACT_MSK 0x01u +#define USBFS_USB__PM_STBY_CFG CYREG_PM_STBY_CFG5 +#define USBFS_USB__PM_STBY_MSK 0x01u +#define USBFS_USB__SIE_EP1_CNT0 CYREG_USB_SIE_EP1_CNT0 +#define USBFS_USB__SIE_EP1_CNT1 CYREG_USB_SIE_EP1_CNT1 +#define USBFS_USB__SIE_EP1_CR0 CYREG_USB_SIE_EP1_CR0 +#define USBFS_USB__SIE_EP2_CNT0 CYREG_USB_SIE_EP2_CNT0 +#define USBFS_USB__SIE_EP2_CNT1 CYREG_USB_SIE_EP2_CNT1 +#define USBFS_USB__SIE_EP2_CR0 CYREG_USB_SIE_EP2_CR0 +#define USBFS_USB__SIE_EP3_CNT0 CYREG_USB_SIE_EP3_CNT0 +#define USBFS_USB__SIE_EP3_CNT1 CYREG_USB_SIE_EP3_CNT1 +#define USBFS_USB__SIE_EP3_CR0 CYREG_USB_SIE_EP3_CR0 +#define USBFS_USB__SIE_EP4_CNT0 CYREG_USB_SIE_EP4_CNT0 +#define USBFS_USB__SIE_EP4_CNT1 CYREG_USB_SIE_EP4_CNT1 +#define USBFS_USB__SIE_EP4_CR0 CYREG_USB_SIE_EP4_CR0 +#define USBFS_USB__SIE_EP5_CNT0 CYREG_USB_SIE_EP5_CNT0 +#define USBFS_USB__SIE_EP5_CNT1 CYREG_USB_SIE_EP5_CNT1 +#define USBFS_USB__SIE_EP5_CR0 CYREG_USB_SIE_EP5_CR0 +#define USBFS_USB__SIE_EP6_CNT0 CYREG_USB_SIE_EP6_CNT0 +#define USBFS_USB__SIE_EP6_CNT1 CYREG_USB_SIE_EP6_CNT1 +#define USBFS_USB__SIE_EP6_CR0 CYREG_USB_SIE_EP6_CR0 +#define USBFS_USB__SIE_EP7_CNT0 CYREG_USB_SIE_EP7_CNT0 +#define USBFS_USB__SIE_EP7_CNT1 CYREG_USB_SIE_EP7_CNT1 +#define USBFS_USB__SIE_EP7_CR0 CYREG_USB_SIE_EP7_CR0 +#define USBFS_USB__SIE_EP8_CNT0 CYREG_USB_SIE_EP8_CNT0 +#define USBFS_USB__SIE_EP8_CNT1 CYREG_USB_SIE_EP8_CNT1 +#define USBFS_USB__SIE_EP8_CR0 CYREG_USB_SIE_EP8_CR0 +#define USBFS_USB__SIE_EP_INT_EN CYREG_USB_SIE_EP_INT_EN +#define USBFS_USB__SIE_EP_INT_SR CYREG_USB_SIE_EP_INT_SR +#define USBFS_USB__SOF0 CYREG_USB_SOF0 +#define USBFS_USB__SOF1 CYREG_USB_SOF1 +#define USBFS_USB__USBIO_CR0 CYREG_USB_USBIO_CR0 +#define USBFS_USB__USBIO_CR1 CYREG_USB_USBIO_CR1 +#define USBFS_USB__USB_CLK_EN CYREG_USB_USB_CLK_EN /* SCSI_ATN */ #define SCSI_ATN__0__MASK 0x20u @@ -1960,6 +1904,72 @@ #define SCSI_RST__SLW CYREG_PRT6_SLW #define SCSI_RST__SNAP CYREG_PICU6_SNAP +/* USBFS_Dm */ +#define USBFS_Dm__0__MASK 0x80u +#define USBFS_Dm__0__PC CYREG_IO_PC_PRT15_7_6_PC1 +#define USBFS_Dm__0__PORT 15u +#define USBFS_Dm__0__SHIFT 7 +#define USBFS_Dm__AG CYREG_PRT15_AG +#define USBFS_Dm__AMUX CYREG_PRT15_AMUX +#define USBFS_Dm__BIE CYREG_PRT15_BIE +#define USBFS_Dm__BIT_MASK CYREG_PRT15_BIT_MASK +#define USBFS_Dm__BYP CYREG_PRT15_BYP +#define USBFS_Dm__CTL CYREG_PRT15_CTL +#define USBFS_Dm__DM0 CYREG_PRT15_DM0 +#define USBFS_Dm__DM1 CYREG_PRT15_DM1 +#define USBFS_Dm__DM2 CYREG_PRT15_DM2 +#define USBFS_Dm__DR CYREG_PRT15_DR +#define USBFS_Dm__INP_DIS CYREG_PRT15_INP_DIS +#define USBFS_Dm__LCD_COM_SEG CYREG_PRT15_LCD_COM_SEG +#define USBFS_Dm__LCD_EN CYREG_PRT15_LCD_EN +#define USBFS_Dm__MASK 0x80u +#define USBFS_Dm__PORT 15u +#define USBFS_Dm__PRT CYREG_PRT15_PRT +#define USBFS_Dm__PRTDSI__CAPS_SEL CYREG_PRT15_CAPS_SEL +#define USBFS_Dm__PRTDSI__DBL_SYNC_IN CYREG_PRT15_DBL_SYNC_IN +#define USBFS_Dm__PRTDSI__OE_SEL0 CYREG_PRT15_OE_SEL0 +#define USBFS_Dm__PRTDSI__OE_SEL1 CYREG_PRT15_OE_SEL1 +#define USBFS_Dm__PRTDSI__OUT_SEL0 CYREG_PRT15_OUT_SEL0 +#define USBFS_Dm__PRTDSI__OUT_SEL1 CYREG_PRT15_OUT_SEL1 +#define USBFS_Dm__PRTDSI__SYNC_OUT CYREG_PRT15_SYNC_OUT +#define USBFS_Dm__PS CYREG_PRT15_PS +#define USBFS_Dm__SHIFT 7 +#define USBFS_Dm__SLW CYREG_PRT15_SLW + +/* USBFS_Dp */ +#define USBFS_Dp__0__MASK 0x40u +#define USBFS_Dp__0__PC CYREG_IO_PC_PRT15_7_6_PC0 +#define USBFS_Dp__0__PORT 15u +#define USBFS_Dp__0__SHIFT 6 +#define USBFS_Dp__AG CYREG_PRT15_AG +#define USBFS_Dp__AMUX CYREG_PRT15_AMUX +#define USBFS_Dp__BIE CYREG_PRT15_BIE +#define USBFS_Dp__BIT_MASK CYREG_PRT15_BIT_MASK +#define USBFS_Dp__BYP CYREG_PRT15_BYP +#define USBFS_Dp__CTL CYREG_PRT15_CTL +#define USBFS_Dp__DM0 CYREG_PRT15_DM0 +#define USBFS_Dp__DM1 CYREG_PRT15_DM1 +#define USBFS_Dp__DM2 CYREG_PRT15_DM2 +#define USBFS_Dp__DR CYREG_PRT15_DR +#define USBFS_Dp__INP_DIS CYREG_PRT15_INP_DIS +#define USBFS_Dp__INTSTAT CYREG_PICU15_INTSTAT +#define USBFS_Dp__LCD_COM_SEG CYREG_PRT15_LCD_COM_SEG +#define USBFS_Dp__LCD_EN CYREG_PRT15_LCD_EN +#define USBFS_Dp__MASK 0x40u +#define USBFS_Dp__PORT 15u +#define USBFS_Dp__PRT CYREG_PRT15_PRT +#define USBFS_Dp__PRTDSI__CAPS_SEL CYREG_PRT15_CAPS_SEL +#define USBFS_Dp__PRTDSI__DBL_SYNC_IN CYREG_PRT15_DBL_SYNC_IN +#define USBFS_Dp__PRTDSI__OE_SEL0 CYREG_PRT15_OE_SEL0 +#define USBFS_Dp__PRTDSI__OE_SEL1 CYREG_PRT15_OE_SEL1 +#define USBFS_Dp__PRTDSI__OUT_SEL0 CYREG_PRT15_OUT_SEL0 +#define USBFS_Dp__PRTDSI__OUT_SEL1 CYREG_PRT15_OUT_SEL1 +#define USBFS_Dp__PRTDSI__SYNC_OUT CYREG_PRT15_SYNC_OUT +#define USBFS_Dp__PS CYREG_PRT15_PS +#define USBFS_Dp__SHIFT 6 +#define USBFS_Dp__SLW CYREG_PRT15_SLW +#define USBFS_Dp__SNAP CYREG_PICU_15_SNAP_15 + /* SCSI_In */ #define SCSI_In__0__AG CYREG_PRT2_AG #define SCSI_In__0__AMUX CYREG_PRT2_AMUX diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfitter_cfg.c b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfitter_cfg.c index 17b57aa..200bad6 100755 --- a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfitter_cfg.c +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfitter_cfg.c @@ -366,34 +366,34 @@ void cyfitter_cfg(void) 0x40005209u, /* Base address: 0x40005200 Count: 9 */ 0x40006402u, /* Base address: 0x40006400 Count: 2 */ 0x40010044u, /* Base address: 0x40010000 Count: 68 */ - 0x40010136u, /* Base address: 0x40010100 Count: 54 */ + 0x40010135u, /* Base address: 0x40010100 Count: 53 */ 0x4001023Eu, /* Base address: 0x40010200 Count: 62 */ - 0x4001034Eu, /* Base address: 0x40010300 Count: 78 */ + 0x40010350u, /* Base address: 0x40010300 Count: 80 */ 0x4001044Bu, /* Base address: 0x40010400 Count: 75 */ - 0x40010557u, /* Base address: 0x40010500 Count: 87 */ + 0x40010554u, /* Base address: 0x40010500 Count: 84 */ 0x40010605u, /* Base address: 0x40010600 Count: 5 */ - 0x4001074Au, /* Base address: 0x40010700 Count: 74 */ - 0x40010914u, /* Base address: 0x40010900 Count: 20 */ + 0x4001074Bu, /* Base address: 0x40010700 Count: 75 */ + 0x40010911u, /* Base address: 0x40010900 Count: 17 */ 0x40010A37u, /* Base address: 0x40010A00 Count: 55 */ - 0x40010B38u, /* Base address: 0x40010B00 Count: 56 */ + 0x40010B35u, /* Base address: 0x40010B00 Count: 53 */ 0x40010D0Fu, /* Base address: 0x40010D00 Count: 15 */ 0x40010F02u, /* Base address: 0x40010F00 Count: 2 */ - 0x40011505u, /* Base address: 0x40011500 Count: 5 */ + 0x40011504u, /* Base address: 0x40011500 Count: 4 */ 0x40011642u, /* Base address: 0x40011600 Count: 66 */ - 0x40011744u, /* Base address: 0x40011700 Count: 68 */ + 0x40011747u, /* Base address: 0x40011700 Count: 71 */ 0x40011908u, /* Base address: 0x40011900 Count: 8 */ - 0x40011B04u, /* Base address: 0x40011B00 Count: 4 */ - 0x4001400Eu, /* Base address: 0x40014000 Count: 14 */ - 0x4001410Eu, /* Base address: 0x40014100 Count: 14 */ - 0x40014205u, /* Base address: 0x40014200 Count: 5 */ - 0x40014305u, /* Base address: 0x40014300 Count: 5 */ + 0x40011B05u, /* Base address: 0x40011B00 Count: 5 */ + 0x4001400Fu, /* Base address: 0x40014000 Count: 15 */ + 0x4001410Du, /* Base address: 0x40014100 Count: 13 */ + 0x40014206u, /* Base address: 0x40014200 Count: 6 */ + 0x40014308u, /* Base address: 0x40014300 Count: 8 */ 0x4001440Au, /* Base address: 0x40014400 Count: 10 */ - 0x40014516u, /* Base address: 0x40014500 Count: 22 */ - 0x40014608u, /* Base address: 0x40014600 Count: 8 */ - 0x40014708u, /* Base address: 0x40014700 Count: 8 */ - 0x40014808u, /* Base address: 0x40014800 Count: 8 */ - 0x4001490Cu, /* Base address: 0x40014900 Count: 12 */ - 0x40014C01u, /* Base address: 0x40014C00 Count: 1 */ + 0x40014514u, /* Base address: 0x40014500 Count: 20 */ + 0x40014609u, /* Base address: 0x40014600 Count: 9 */ + 0x40014709u, /* Base address: 0x40014700 Count: 9 */ + 0x4001480Bu, /* Base address: 0x40014800 Count: 11 */ + 0x40014907u, /* Base address: 0x40014900 Count: 7 */ + 0x40014C02u, /* Base address: 0x40014C00 Count: 2 */ 0x40015006u, /* Base address: 0x40015000 Count: 6 */ 0x40015101u, /* Base address: 0x40015100 Count: 1 */ }; @@ -403,7 +403,7 @@ void cyfitter_cfg(void) {0x65u, 0x02u}, {0x7Eu, 0x02u}, {0x01u, 0x01u}, - {0x18u, 0x04u}, + {0x18u, 0x0Cu}, {0x19u, 0x04u}, {0x1Cu, 0x61u}, {0x20u, 0x50u}, @@ -413,6 +413,7 @@ void cyfitter_cfg(void) {0x7Cu, 0x40u}, {0x33u, 0x03u}, {0x87u, 0x0Fu}, + {0x00u, 0x0Du}, {0x03u, 0x04u}, {0x04u, 0x01u}, {0x06u, 0x32u}, @@ -424,7 +425,6 @@ void cyfitter_cfg(void) {0x0Du, 0x24u}, {0x0Eu, 0x10u}, {0x0Fu, 0x09u}, - {0x10u, 0x0Du}, {0x14u, 0x62u}, {0x16u, 0x08u}, {0x1Bu, 0x03u}, @@ -449,21 +449,21 @@ void cyfitter_cfg(void) {0x5Bu, 0x04u}, {0x5Cu, 0x99u}, {0x5Fu, 0x01u}, - {0x82u, 0x80u}, + {0x80u, 0x24u}, + {0x82u, 0x09u}, + {0x85u, 0x08u}, + {0x87u, 0x04u}, {0x8Au, 0x18u}, {0x8Bu, 0x09u}, {0x8Eu, 0x03u}, - {0x91u, 0x08u}, - {0x93u, 0x03u}, {0x96u, 0x24u}, {0x98u, 0x24u}, - {0x99u, 0x08u}, {0x9Au, 0x12u}, - {0x9Bu, 0x04u}, {0x9Eu, 0x20u}, {0x9Fu, 0x06u}, - {0xA0u, 0x24u}, - {0xA2u, 0x09u}, + {0xA1u, 0x08u}, + {0xA2u, 0x80u}, + {0xA3u, 0x03u}, {0xA6u, 0x04u}, {0xAAu, 0x40u}, {0xACu, 0x40u}, @@ -471,50 +471,49 @@ void cyfitter_cfg(void) {0xAFu, 0x08u}, {0xB0u, 0xC0u}, {0xB1u, 0x0Eu}, - {0xB3u, 0x01u}, {0xB4u, 0x38u}, + {0xB5u, 0x01u}, {0xB6u, 0x07u}, {0xBEu, 0x01u}, - {0xBFu, 0x04u}, + {0xBFu, 0x10u}, {0xD8u, 0x04u}, {0xD9u, 0x04u}, {0xDBu, 0x04u}, {0xDCu, 0x99u}, {0xDFu, 0x01u}, - {0x00u, 0x40u}, - {0x02u, 0x08u}, - {0x03u, 0x20u}, + {0x00u, 0x60u}, + {0x03u, 0x60u}, {0x05u, 0x50u}, - {0x06u, 0x80u}, - {0x08u, 0x01u}, + {0x06u, 0x40u}, + {0x07u, 0x04u}, {0x0Au, 0x22u}, {0x0Du, 0x14u}, {0x0Eu, 0x01u}, - {0x10u, 0xA0u}, - {0x11u, 0x10u}, - {0x13u, 0x40u}, + {0x11u, 0x14u}, + {0x13u, 0x41u}, {0x15u, 0x40u}, - {0x16u, 0x28u}, - {0x17u, 0x01u}, + {0x16u, 0xA4u}, {0x18u, 0x40u}, {0x1Au, 0x02u}, {0x1Du, 0x50u}, - {0x1Eu, 0x44u}, + {0x1Eu, 0x40u}, {0x21u, 0x20u}, {0x22u, 0x84u}, {0x23u, 0x08u}, - {0x27u, 0xA0u}, + {0x25u, 0x10u}, + {0x27u, 0x80u}, {0x29u, 0x01u}, - {0x2Au, 0x10u}, + {0x2Bu, 0x04u}, {0x2Cu, 0x02u}, + {0x2Fu, 0x40u}, {0x31u, 0x20u}, {0x32u, 0x80u}, - {0x36u, 0x21u}, - {0x37u, 0x81u}, + {0x37u, 0x80u}, {0x39u, 0x28u}, - {0x3Au, 0x02u}, + {0x3Au, 0x42u}, {0x3Bu, 0x80u}, - {0x3Cu, 0x20u}, + {0x3Cu, 0x10u}, + {0x3Fu, 0x04u}, {0x58u, 0x84u}, {0x59u, 0x02u}, {0x5Bu, 0x10u}, @@ -525,19 +524,19 @@ void cyfitter_cfg(void) {0x80u, 0x40u}, {0x81u, 0x20u}, {0x86u, 0x80u}, - {0xC0u, 0xD7u}, - {0xC2u, 0xEDu}, + {0xC0u, 0xDFu}, + {0xC2u, 0xE5u}, {0xC4u, 0xFFu}, - {0xCAu, 0x15u}, - {0xCCu, 0xBCu}, - {0xCEu, 0x2Fu}, + {0xCAu, 0x95u}, + {0xCCu, 0x1Cu}, + {0xCEu, 0x6Fu}, {0xD6u, 0x0Fu}, {0xDEu, 0x01u}, {0xE0u, 0x04u}, {0xE4u, 0x08u}, + {0x0Cu, 0x01u}, {0x14u, 0x01u}, {0x18u, 0x02u}, - {0x1Cu, 0x01u}, {0x2Eu, 0x01u}, {0x36u, 0x03u}, {0x3Au, 0xC0u}, @@ -550,28 +549,28 @@ void cyfitter_cfg(void) {0x86u, 0x69u}, {0x87u, 0x2Du}, {0x89u, 0x67u}, + {0x8Au, 0xFFu}, {0x8Bu, 0x18u}, {0x8Cu, 0x33u}, {0x8Du, 0x02u}, {0x8Eu, 0xCCu}, {0x94u, 0x55u}, {0x96u, 0xAAu}, - {0x9Au, 0xFFu}, - {0x9Du, 0x02u}, + {0x9Bu, 0x40u}, {0xA0u, 0x0Fu}, - {0xA1u, 0x16u}, + {0xA1u, 0x02u}, {0xA2u, 0xF0u}, - {0xA3u, 0x48u}, {0xA4u, 0xFFu}, - {0xA7u, 0x40u}, - {0xADu, 0x01u}, + {0xA5u, 0x01u}, + {0xA7u, 0x02u}, + {0xADu, 0x16u}, {0xAEu, 0xFFu}, - {0xAFu, 0x02u}, + {0xAFu, 0x48u}, {0xB1u, 0x08u}, - {0xB2u, 0xFFu}, {0xB3u, 0x70u}, {0xB5u, 0x07u}, - {0xBEu, 0x04u}, + {0xB6u, 0xFFu}, + {0xBEu, 0x40u}, {0xBFu, 0x01u}, {0xC0u, 0x32u}, {0xC1u, 0x05u}, @@ -599,39 +598,39 @@ void cyfitter_cfg(void) {0xEEu, 0x08u}, {0x01u, 0x80u}, {0x02u, 0x10u}, - {0x09u, 0x08u}, - {0x0Au, 0x04u}, - {0x0Du, 0x10u}, - {0x0Eu, 0x02u}, - {0x0Fu, 0x10u}, + {0x03u, 0x04u}, + {0x04u, 0x08u}, + {0x05u, 0x40u}, + {0x07u, 0x10u}, + {0x0Au, 0x10u}, + {0x0Fu, 0x14u}, {0x11u, 0x40u}, {0x13u, 0x0Au}, {0x15u, 0x40u}, - {0x16u, 0x04u}, - {0x17u, 0x10u}, - {0x1Bu, 0x08u}, + {0x1Bu, 0x80u}, + {0x1Du, 0x40u}, {0x1Eu, 0x02u}, - {0x1Fu, 0xC0u}, - {0x20u, 0x60u}, + {0x1Fu, 0x40u}, + {0x20u, 0x50u}, {0x21u, 0x14u}, - {0x22u, 0x20u}, - {0x23u, 0x10u}, - {0x29u, 0x04u}, - {0x2Bu, 0x82u}, - {0x32u, 0x80u}, + {0x23u, 0x14u}, + {0x29u, 0x42u}, + {0x2Au, 0x08u}, + {0x30u, 0x20u}, {0x38u, 0x80u}, {0x39u, 0x28u}, - {0x40u, 0x40u}, - {0x41u, 0x14u}, - {0x49u, 0x06u}, - {0x4Au, 0x81u}, - {0x50u, 0x40u}, - {0x52u, 0x44u}, + {0x40u, 0x50u}, + {0x41u, 0x10u}, + {0x48u, 0x20u}, + {0x49u, 0x02u}, + {0x4Au, 0x01u}, + {0x50u, 0x44u}, + {0x52u, 0x40u}, {0x53u, 0x01u}, {0x58u, 0x50u}, - {0x5Au, 0x08u}, - {0x5Bu, 0x01u}, - {0x60u, 0x18u}, + {0x5Au, 0x0Au}, + {0x60u, 0x08u}, + {0x61u, 0x08u}, {0x63u, 0x82u}, {0x68u, 0x06u}, {0x6Au, 0x01u}, @@ -640,79 +639,81 @@ void cyfitter_cfg(void) {0x71u, 0x21u}, {0x72u, 0x22u}, {0x81u, 0x40u}, - {0x83u, 0x40u}, - {0x87u, 0x01u}, - {0x88u, 0x10u}, - {0x8Bu, 0x02u}, - {0x8Du, 0x10u}, - {0x8Eu, 0x10u}, - {0x92u, 0x4Cu}, - {0x95u, 0x38u}, + {0x82u, 0x80u}, + {0x83u, 0x42u}, + {0x86u, 0x08u}, + {0x89u, 0x08u}, + {0x8Au, 0x01u}, + {0x8Fu, 0x08u}, + {0x92u, 0x48u}, + {0x94u, 0x10u}, + {0x95u, 0x3Cu}, {0x96u, 0x21u}, - {0x97u, 0xC2u}, - {0x99u, 0x10u}, - {0x9Bu, 0x88u}, - {0x9Cu, 0x07u}, + {0x97u, 0xC7u}, + {0x9Bu, 0x8Cu}, + {0x9Cu, 0x06u}, {0x9Du, 0x03u}, - {0x9Eu, 0xAAu}, - {0x9Fu, 0x10u}, - {0xA4u, 0xB2u}, - {0xA6u, 0x29u}, + {0x9Eu, 0xA6u}, + {0x9Fu, 0x50u}, + {0xA1u, 0x10u}, + {0xA4u, 0x12u}, {0xA7u, 0x20u}, + {0xABu, 0x04u}, {0xADu, 0x40u}, - {0xAFu, 0x20u}, - {0xB2u, 0x10u}, - {0xC0u, 0x05u}, - {0xC2u, 0xE6u}, + {0xB5u, 0x10u}, + {0xC0u, 0x87u}, + {0xC2u, 0x64u}, {0xC4u, 0x8Du}, {0xCAu, 0x0Bu}, - {0xCCu, 0x08u}, + {0xCCu, 0x04u}, {0xCEu, 0x0Eu}, {0xD0u, 0x07u}, {0xD2u, 0x08u}, {0xD6u, 0x0Fu}, {0xD8u, 0x0Fu}, - {0xE2u, 0x06u}, - {0xE6u, 0x10u}, + {0xE2u, 0x14u}, + {0xE4u, 0x01u}, + {0xE6u, 0x02u}, {0xECu, 0x08u}, + {0xEEu, 0x04u}, + {0x00u, 0x40u}, {0x03u, 0x04u}, {0x06u, 0x04u}, {0x07u, 0x30u}, - {0x08u, 0x40u}, {0x09u, 0x41u}, {0x0Eu, 0x03u}, {0x0Fu, 0x41u}, - {0x10u, 0x24u}, - {0x11u, 0x41u}, - {0x12u, 0x09u}, - {0x15u, 0x12u}, - {0x16u, 0x18u}, - {0x17u, 0x0Du}, + {0x11u, 0x23u}, + {0x12u, 0x18u}, + {0x13u, 0x0Cu}, + {0x14u, 0x40u}, + {0x15u, 0x02u}, + {0x17u, 0x01u}, {0x19u, 0x41u}, {0x1Au, 0x20u}, {0x1Cu, 0x40u}, - {0x1Du, 0x02u}, - {0x1Fu, 0x01u}, - {0x20u, 0x40u}, + {0x1Du, 0x41u}, + {0x20u, 0x24u}, {0x21u, 0x41u}, + {0x22u, 0x09u}, {0x24u, 0x24u}, - {0x25u, 0x05u}, + {0x25u, 0x12u}, {0x26u, 0x12u}, - {0x27u, 0x0Au}, - {0x29u, 0x23u}, + {0x27u, 0x0Du}, + {0x29u, 0x05u}, {0x2Au, 0x24u}, - {0x2Bu, 0x0Cu}, + {0x2Bu, 0x0Au}, {0x2Cu, 0x40u}, {0x2Fu, 0x08u}, + {0x30u, 0x38u}, {0x31u, 0x40u}, - {0x32u, 0x38u}, - {0x34u, 0x40u}, + {0x32u, 0x40u}, + {0x33u, 0x03u}, {0x35u, 0x3Cu}, {0x36u, 0x07u}, - {0x37u, 0x03u}, - {0x38u, 0x20u}, - {0x3Bu, 0x80u}, - {0x3Eu, 0x10u}, + {0x38u, 0x08u}, + {0x3Bu, 0x08u}, + {0x3Eu, 0x04u}, {0x3Fu, 0x01u}, {0x58u, 0x04u}, {0x59u, 0x0Bu}, @@ -720,9 +721,8 @@ void cyfitter_cfg(void) {0x5Fu, 0x01u}, {0x82u, 0xFFu}, {0x84u, 0x96u}, - {0x85u, 0x69u}, + {0x85u, 0xFFu}, {0x86u, 0x69u}, - {0x87u, 0x96u}, {0x88u, 0xFFu}, {0x8Cu, 0x0Fu}, {0x8Du, 0x33u}, @@ -733,7 +733,8 @@ void cyfitter_cfg(void) {0x92u, 0xCCu}, {0x93u, 0xF0u}, {0x95u, 0xFFu}, - {0x99u, 0xFFu}, + {0x99u, 0x69u}, + {0x9Bu, 0x96u}, {0x9Du, 0x55u}, {0x9Fu, 0xAAu}, {0xA6u, 0xFFu}, @@ -752,77 +753,75 @@ void cyfitter_cfg(void) {0xDFu, 0x01u}, {0x00u, 0x08u}, {0x01u, 0x80u}, - {0x03u, 0x08u}, + {0x03u, 0x80u}, {0x04u, 0x02u}, - {0x05u, 0x50u}, - {0x06u, 0x10u}, - {0x07u, 0x02u}, - {0x09u, 0x20u}, - {0x0Au, 0x11u}, - {0x0Bu, 0x80u}, + {0x05u, 0x40u}, + {0x06u, 0x18u}, + {0x07u, 0x16u}, + {0x09u, 0x24u}, + {0x0Au, 0x81u}, {0x0Fu, 0x80u}, - {0x11u, 0x80u}, - {0x12u, 0x60u}, - {0x13u, 0x10u}, + {0x11u, 0x81u}, + {0x13u, 0x14u}, {0x17u, 0x88u}, {0x19u, 0x80u}, - {0x1Au, 0x10u}, - {0x1Bu, 0x50u}, + {0x1Au, 0x80u}, + {0x1Bu, 0x48u}, {0x1Eu, 0x01u}, {0x20u, 0x04u}, - {0x22u, 0x43u}, + {0x22u, 0x0Bu}, {0x25u, 0x40u}, - {0x28u, 0x04u}, + {0x28u, 0x20u}, + {0x29u, 0x10u}, {0x2Au, 0x02u}, - {0x2Bu, 0x22u}, + {0x2Bu, 0x02u}, {0x2Du, 0x40u}, - {0x30u, 0x01u}, - {0x32u, 0x48u}, - {0x33u, 0x10u}, - {0x35u, 0x10u}, - {0x37u, 0x8Au}, + {0x30u, 0x20u}, + {0x32u, 0x08u}, + {0x33u, 0x41u}, + {0x37u, 0x9Au}, {0x38u, 0x04u}, - {0x39u, 0x90u}, - {0x3Bu, 0x41u}, - {0x3Fu, 0x84u}, - {0x5Eu, 0x40u}, + {0x39u, 0x92u}, + {0x3Bu, 0x40u}, + {0x3Eu, 0x08u}, + {0x3Fu, 0x80u}, + {0x4Eu, 0x08u}, + {0x4Fu, 0x20u}, + {0x5Du, 0x01u}, + {0x5Eu, 0x42u}, {0x64u, 0x02u}, {0x66u, 0x80u}, {0x78u, 0x02u}, - {0x80u, 0x08u}, - {0x82u, 0x10u}, - {0x84u, 0x40u}, + {0x80u, 0x0Cu}, {0x8Au, 0x80u}, {0x8Cu, 0x01u}, {0x8Du, 0x40u}, + {0x8Eu, 0x40u}, {0x91u, 0x68u}, {0x92u, 0x40u}, - {0x93u, 0x90u}, - {0x95u, 0x10u}, - {0x96u, 0x30u}, - {0x97u, 0x40u}, - {0x99u, 0x10u}, + {0x93u, 0x14u}, + {0x95u, 0x14u}, + {0x96u, 0x20u}, + {0x97u, 0x41u}, {0x9Au, 0x01u}, - {0x9Bu, 0xA8u}, - {0x9Cu, 0x4Bu}, + {0x9Bu, 0xACu}, + {0x9Cu, 0x0Au}, {0x9Du, 0x80u}, - {0x9Eu, 0x18u}, - {0x9Fu, 0x02u}, + {0x9Eu, 0x14u}, + {0x9Fu, 0x42u}, {0xA0u, 0x04u}, {0xA1u, 0x20u}, - {0xA2u, 0x21u}, - {0xA3u, 0x08u}, - {0xA4u, 0xA0u}, - {0xA6u, 0x08u}, - {0xA7u, 0x31u}, - {0xA8u, 0x10u}, - {0xA9u, 0x08u}, + {0xA2u, 0x01u}, + {0xA3u, 0x80u}, + {0xA4u, 0x10u}, + {0xA7u, 0x29u}, + {0xAAu, 0x10u}, {0xABu, 0x80u}, - {0xACu, 0x04u}, + {0xACu, 0x54u}, {0xAEu, 0x40u}, - {0xB6u, 0x81u}, - {0xB7u, 0x10u}, - {0xC0u, 0xF7u}, + {0xB5u, 0x10u}, + {0xB6u, 0x01u}, + {0xC0u, 0xFDu}, {0xC2u, 0x1Fu}, {0xC4u, 0xAFu}, {0xCAu, 0x1Fu}, @@ -831,21 +830,21 @@ void cyfitter_cfg(void) {0xD6u, 0x10u}, {0xD8u, 0x10u}, {0xDEu, 0x01u}, - {0xE0u, 0x01u}, - {0xE6u, 0x0Cu}, + {0xE0u, 0x04u}, + {0xE2u, 0x10u}, + {0xE6u, 0x04u}, {0xE8u, 0x01u}, - {0xEAu, 0x10u}, - {0xECu, 0x10u}, - {0xEEu, 0x01u}, + {0xEEu, 0x1Au}, {0x2Cu, 0x01u}, {0x36u, 0x01u}, {0x3Eu, 0x40u}, {0x58u, 0x04u}, {0x5Fu, 0x01u}, - {0x01u, 0x50u}, + {0x01u, 0x70u}, {0x03u, 0x60u}, - {0x08u, 0x04u}, - {0x0Au, 0xA8u}, + {0x08u, 0x01u}, + {0x0Au, 0x80u}, + {0x0Bu, 0x14u}, {0x0Eu, 0x01u}, {0x0Fu, 0x02u}, {0x10u, 0x22u}, @@ -854,56 +853,56 @@ void cyfitter_cfg(void) {0x16u, 0x01u}, {0x19u, 0x01u}, {0x1Eu, 0x01u}, - {0x20u, 0x04u}, - {0x22u, 0x04u}, - {0x23u, 0x01u}, - {0x28u, 0x21u}, + {0x21u, 0x09u}, + {0x22u, 0x40u}, + {0x28u, 0x01u}, {0x29u, 0x11u}, + {0x2Bu, 0x10u}, {0x30u, 0x22u}, - {0x32u, 0x44u}, - {0x38u, 0x04u}, + {0x31u, 0x08u}, + {0x33u, 0x40u}, {0x39u, 0x40u}, {0x3Au, 0x02u}, - {0x3Bu, 0x10u}, - {0x42u, 0x60u}, - {0x43u, 0x20u}, - {0x44u, 0x01u}, + {0x3Bu, 0x14u}, + {0x40u, 0xB0u}, + {0x41u, 0x20u}, + {0x45u, 0x40u}, {0x47u, 0x40u}, - {0x49u, 0x04u}, - {0x4Au, 0x0Au}, + {0x49u, 0x14u}, + {0x4Au, 0x02u}, {0x4Bu, 0x02u}, {0x50u, 0x02u}, - {0x52u, 0x14u}, + {0x52u, 0x50u}, {0x53u, 0x02u}, {0x62u, 0x80u}, - {0x68u, 0x60u}, + {0x68u, 0x20u}, {0x69u, 0xD4u}, - {0x6Bu, 0x50u}, - {0x70u, 0x80u}, + {0x6Bu, 0x48u}, {0x72u, 0x02u}, - {0x73u, 0x02u}, + {0x73u, 0x03u}, {0x78u, 0x02u}, - {0x89u, 0x02u}, + {0x80u, 0x80u}, + {0x8Eu, 0x40u}, {0x91u, 0x28u}, - {0x92u, 0x82u}, - {0x95u, 0x90u}, + {0x92u, 0x02u}, + {0x95u, 0x96u}, {0x96u, 0x20u}, {0x97u, 0x01u}, {0x98u, 0x02u}, {0x9Au, 0x01u}, {0x9Bu, 0x20u}, - {0x9Cu, 0x05u}, - {0x9Du, 0x40u}, - {0x9Eu, 0x0Au}, - {0x9Fu, 0x10u}, - {0xA2u, 0x83u}, - {0xA4u, 0xA0u}, - {0xA6u, 0x08u}, + {0x9Cu, 0x20u}, + {0x9Du, 0x50u}, + {0x9Eu, 0x02u}, + {0x9Fu, 0x41u}, + {0xA2u, 0x8Bu}, + {0xA3u, 0x10u}, + {0xA4u, 0x30u}, {0xA7u, 0x23u}, + {0xA9u, 0x04u}, + {0xAAu, 0x04u}, {0xADu, 0x80u}, - {0xB2u, 0xD0u}, - {0xB3u, 0x04u}, - {0xB4u, 0x04u}, + {0xB2u, 0x90u}, {0xC0u, 0x0Fu}, {0xC2u, 0x0Eu}, {0xC4u, 0x8Fu}, @@ -914,33 +913,30 @@ void cyfitter_cfg(void) {0xD2u, 0x0Cu}, {0xD8u, 0x08u}, {0xDEu, 0x01u}, - {0xE6u, 0x01u}, {0xE8u, 0x08u}, - {0x80u, 0x10u}, - {0x88u, 0x01u}, - {0x90u, 0x10u}, + {0xEAu, 0x04u}, + {0x8Fu, 0x40u}, + {0x90u, 0x20u}, + {0x96u, 0x04u}, {0x97u, 0x80u}, {0x9Cu, 0x40u}, {0x9Du, 0x08u}, - {0x9Eu, 0x20u}, - {0xA4u, 0x01u}, - {0xA9u, 0x08u}, + {0xA7u, 0x40u}, + {0xA9u, 0x09u}, {0xADu, 0x01u}, {0xAFu, 0x80u}, {0xB1u, 0x22u}, - {0xB2u, 0x11u}, + {0xB2u, 0x10u}, {0xB4u, 0x04u}, - {0xB7u, 0x40u}, - {0xE0u, 0x80u}, + {0xE4u, 0x40u}, {0xE8u, 0x08u}, {0xEAu, 0x83u}, - {0xECu, 0x40u}, - {0xEEu, 0xA0u}, + {0xEEu, 0x20u}, {0x00u, 0x33u}, {0x02u, 0xCCu}, {0x08u, 0x55u}, + {0x09u, 0x01u}, {0x0Au, 0xAAu}, - {0x0Du, 0x01u}, {0x10u, 0x69u}, {0x12u, 0x96u}, {0x16u, 0xFFu}, @@ -949,33 +945,33 @@ void cyfitter_cfg(void) {0x1Eu, 0xF0u}, {0x26u, 0xFFu}, {0x29u, 0x02u}, - {0x33u, 0x01u}, - {0x35u, 0x02u}, - {0x36u, 0xFFu}, - {0x3Eu, 0x40u}, - {0x3Fu, 0x14u}, + {0x30u, 0xFFu}, + {0x31u, 0x02u}, + {0x35u, 0x01u}, + {0x3Eu, 0x01u}, + {0x3Fu, 0x11u}, {0x58u, 0x04u}, {0x59u, 0x04u}, {0x5Fu, 0x01u}, {0x80u, 0x05u}, - {0x81u, 0x38u}, {0x82u, 0x0Au}, {0x84u, 0x20u}, - {0x89u, 0x25u}, - {0x8Bu, 0x02u}, + {0x85u, 0x25u}, + {0x87u, 0x02u}, + {0x88u, 0x06u}, + {0x8Au, 0x09u}, {0x8Cu, 0x03u}, + {0x8Du, 0x38u}, {0x8Eu, 0x0Cu}, - {0x8Fu, 0x38u}, {0x94u, 0x10u}, - {0x95u, 0x09u}, - {0x97u, 0x06u}, + {0x97u, 0x38u}, {0x99u, 0x04u}, {0x9Bu, 0x03u}, - {0x9Cu, 0x06u}, {0x9Du, 0x40u}, - {0x9Eu, 0x09u}, {0xA1u, 0x03u}, {0xA3u, 0x14u}, + {0xA5u, 0x09u}, + {0xA7u, 0x06u}, {0xACu, 0x40u}, {0xB0u, 0x0Fu}, {0xB2u, 0x40u}, @@ -993,81 +989,77 @@ void cyfitter_cfg(void) {0xDFu, 0x01u}, {0x01u, 0x01u}, {0x02u, 0x04u}, - {0x04u, 0x08u}, + {0x04u, 0x18u}, {0x05u, 0x42u}, {0x08u, 0x68u}, {0x09u, 0x02u}, {0x0Du, 0x08u}, - {0x0Fu, 0x01u}, - {0x13u, 0x08u}, + {0x11u, 0x08u}, {0x16u, 0x01u}, - {0x1Au, 0x01u}, + {0x19u, 0x01u}, {0x1Cu, 0x08u}, {0x1Du, 0x02u}, {0x1Fu, 0x84u}, - {0x22u, 0x08u}, - {0x23u, 0x04u}, - {0x24u, 0x10u}, + {0x21u, 0x21u}, + {0x24u, 0x20u}, {0x26u, 0x10u}, - {0x27u, 0x02u}, + {0x27u, 0x01u}, {0x29u, 0x20u}, + {0x2Du, 0x08u}, {0x2Fu, 0x40u}, - {0x35u, 0x08u}, {0x36u, 0x10u}, - {0x37u, 0x80u}, - {0x38u, 0x80u}, - {0x3Cu, 0x02u}, - {0x3Eu, 0x20u}, + {0x37u, 0x88u}, + {0x3Au, 0x10u}, + {0x3Eu, 0x04u}, {0x3Fu, 0x80u}, {0x7Eu, 0x02u}, - {0x83u, 0x81u}, - {0x87u, 0x04u}, + {0x83u, 0x88u}, {0x8Au, 0x02u}, - {0x8Cu, 0x08u}, - {0x90u, 0x80u}, - {0x97u, 0x04u}, + {0x8Cu, 0x18u}, + {0x95u, 0x02u}, + {0x97u, 0x08u}, {0x98u, 0x20u}, {0x99u, 0x42u}, - {0x9Au, 0x05u}, - {0x9Bu, 0x08u}, - {0x9Cu, 0x40u}, - {0x9Fu, 0x02u}, + {0x9Au, 0x15u}, + {0x9Fu, 0x01u}, + {0xA1u, 0x04u}, {0xA4u, 0x04u}, - {0xA6u, 0x08u}, + {0xA5u, 0x20u}, {0xAAu, 0x04u}, - {0xABu, 0x02u}, - {0xC0u, 0xBAu}, - {0xC2u, 0xAFu}, + {0xACu, 0x04u}, + {0xAFu, 0x04u}, + {0xB2u, 0x10u}, + {0xC0u, 0xFAu}, + {0xC2u, 0x2Fu}, {0xC4u, 0x84u}, - {0xCAu, 0x84u}, + {0xCAu, 0xC4u}, {0xCCu, 0x70u}, - {0xCEu, 0xB8u}, + {0xCEu, 0x54u}, {0xDEu, 0x10u}, - {0xE0u, 0x40u}, + {0xE0u, 0x50u}, {0xE4u, 0x20u}, {0xE8u, 0x01u}, {0xEEu, 0x40u}, - {0x82u, 0x08u}, - {0x84u, 0x40u}, - {0x87u, 0x04u}, - {0x88u, 0x04u}, - {0x8Cu, 0x60u}, + {0x81u, 0x20u}, + {0x89u, 0x01u}, + {0x8Bu, 0x01u}, + {0x98u, 0x20u}, {0x99u, 0x42u}, {0x9Au, 0x01u}, - {0x9Bu, 0x08u}, + {0xA1u, 0x04u}, {0xADu, 0x02u}, + {0xB4u, 0x20u}, {0xB6u, 0x01u}, - {0xE0u, 0x40u}, {0xE2u, 0x20u}, - {0xE4u, 0x08u}, - {0xE6u, 0x80u}, - {0xEEu, 0x20u}, - {0x83u, 0x08u}, + {0xE4u, 0x01u}, + {0xE6u, 0x22u}, + {0xE8u, 0x40u}, + {0xEEu, 0x04u}, + {0x81u, 0x04u}, {0x85u, 0x40u}, - {0x82u, 0x20u}, - {0x9Eu, 0x20u}, - {0xAEu, 0x08u}, - {0xB2u, 0x08u}, + {0xACu, 0x21u}, + {0xB2u, 0x02u}, + {0xB3u, 0x14u}, {0xB5u, 0x10u}, {0x06u, 0x04u}, {0x0Eu, 0x03u}, @@ -1083,39 +1075,39 @@ void cyfitter_cfg(void) {0x5Cu, 0x09u}, {0x5Du, 0x90u}, {0x5Fu, 0x01u}, - {0x80u, 0x30u}, - {0x84u, 0x10u}, - {0x85u, 0x42u}, - {0x86u, 0x0Fu}, - {0x87u, 0x04u}, - {0x88u, 0x40u}, - {0x8Au, 0x0Cu}, - {0x8Bu, 0x46u}, - {0x8Cu, 0x4Cu}, + {0x80u, 0x08u}, + {0x84u, 0x44u}, + {0x85u, 0x01u}, + {0x86u, 0x08u}, + {0x87u, 0x5Eu}, + {0x88u, 0x04u}, + {0x89u, 0x39u}, + {0x8Bu, 0x06u}, + {0x8Cu, 0x0Cu}, {0x8Du, 0x46u}, - {0x90u, 0x04u}, + {0x8Eu, 0x40u}, + {0x90u, 0x30u}, {0x94u, 0x01u}, - {0x95u, 0x39u}, + {0x95u, 0x42u}, {0x96u, 0x2Eu}, - {0x97u, 0x06u}, {0x98u, 0x01u}, - {0x99u, 0x01u}, + {0x99u, 0x42u}, {0x9Au, 0x12u}, - {0x9Bu, 0x5Eu}, - {0x9Du, 0x42u}, + {0x9Bu, 0x04u}, + {0x9Du, 0x46u}, {0x9Eu, 0x40u}, {0xA0u, 0x4Cu}, {0xA1u, 0x46u}, - {0xA4u, 0x44u}, - {0xA5u, 0x04u}, - {0xA6u, 0x08u}, - {0xA7u, 0x20u}, - {0xA8u, 0x08u}, - {0xA9u, 0x77u}, - {0xABu, 0x08u}, - {0xACu, 0x0Cu}, - {0xADu, 0x46u}, - {0xAEu, 0x40u}, + {0xA4u, 0x40u}, + {0xA5u, 0x77u}, + {0xA6u, 0x0Cu}, + {0xA7u, 0x08u}, + {0xA8u, 0x10u}, + {0xAAu, 0x0Fu}, + {0xABu, 0x46u}, + {0xACu, 0x4Cu}, + {0xADu, 0x04u}, + {0xAFu, 0x20u}, {0xB0u, 0x31u}, {0xB1u, 0x08u}, {0xB2u, 0x40u}, @@ -1135,35 +1127,38 @@ void cyfitter_cfg(void) {0xDCu, 0x99u}, {0xDDu, 0x90u}, {0xDFu, 0x01u}, - {0x00u, 0x84u}, - {0x01u, 0x12u}, + {0x00u, 0x02u}, + {0x01u, 0x44u}, + {0x02u, 0x48u}, {0x05u, 0x40u}, {0x07u, 0x20u}, - {0x0Au, 0x84u}, + {0x0Au, 0x44u}, {0x0Bu, 0x12u}, {0x0Du, 0x14u}, {0x0Eu, 0x02u}, - {0x10u, 0x20u}, - {0x11u, 0x40u}, + {0x11u, 0x80u}, {0x12u, 0x04u}, - {0x13u, 0x02u}, - {0x19u, 0x1Au}, - {0x1Au, 0x04u}, + {0x13u, 0x0Au}, + {0x19u, 0x18u}, + {0x1Au, 0x44u}, {0x1Bu, 0x20u}, {0x1Du, 0x40u}, - {0x20u, 0x04u}, + {0x20u, 0x30u}, {0x21u, 0x20u}, - {0x22u, 0x98u}, - {0x23u, 0x98u}, - {0x28u, 0x11u}, - {0x29u, 0x10u}, - {0x2Au, 0x06u}, - {0x31u, 0x20u}, - {0x32u, 0x48u}, - {0x39u, 0x54u}, - {0x44u, 0x20u}, - {0x47u, 0x08u}, - {0x58u, 0x10u}, + {0x22u, 0x90u}, + {0x23u, 0x94u}, + {0x29u, 0x20u}, + {0x2Au, 0x42u}, + {0x2Bu, 0x20u}, + {0x30u, 0x20u}, + {0x32u, 0x08u}, + {0x33u, 0x40u}, + {0x36u, 0x02u}, + {0x37u, 0x01u}, + {0x39u, 0x40u}, + {0x3Au, 0x04u}, + {0x3Bu, 0x14u}, + {0x58u, 0x20u}, {0x59u, 0x04u}, {0x5Au, 0x02u}, {0x5Bu, 0x80u}, @@ -1173,24 +1168,24 @@ void cyfitter_cfg(void) {0x67u, 0x02u}, {0x78u, 0x02u}, {0x7Cu, 0x02u}, - {0x81u, 0x20u}, - {0x82u, 0x40u}, {0x89u, 0x40u}, - {0x91u, 0x7Cu}, - {0x92u, 0x82u}, + {0x91u, 0x6Cu}, + {0x92u, 0x02u}, {0x93u, 0x02u}, + {0x94u, 0x10u}, {0x96u, 0x60u}, - {0x97u, 0x10u}, - {0x98u, 0x03u}, - {0x99u, 0x04u}, - {0x9Au, 0x16u}, - {0x9Bu, 0x22u}, - {0x9Cu, 0x20u}, - {0x9Du, 0x52u}, - {0x9Eu, 0x28u}, - {0xA0u, 0x60u}, - {0xA2u, 0x01u}, - {0xA6u, 0x08u}, + {0x97u, 0x14u}, + {0x98u, 0x02u}, + {0x99u, 0x24u}, + {0x9Au, 0x52u}, + {0x9Bu, 0x6Au}, + {0x9Du, 0x50u}, + {0x9Fu, 0x01u}, + {0xA0u, 0x20u}, + {0xA1u, 0x40u}, + {0xA2u, 0x09u}, + {0xA4u, 0x10u}, + {0xA5u, 0x20u}, {0xA7u, 0x20u}, {0xC0u, 0xAFu}, {0xC2u, 0xEFu}, @@ -1201,61 +1196,66 @@ void cyfitter_cfg(void) {0xD6u, 0x0Fu}, {0xD8u, 0x78u}, {0xDEu, 0x81u}, - {0xE0u, 0x04u}, - {0xEEu, 0x08u}, - {0x82u, 0x20u}, + {0xEAu, 0x04u}, + {0xEEu, 0x0Au}, {0x88u, 0x40u}, + {0x96u, 0x04u}, {0x97u, 0x80u}, {0x9Cu, 0x40u}, {0x9Du, 0x08u}, - {0x9Eu, 0x20u}, + {0xA8u, 0x10u}, {0xE0u, 0x80u}, - {0xEEu, 0x08u}, + {0xEEu, 0x0Au}, + {0xB2u, 0x04u}, {0xB3u, 0x40u}, {0xB5u, 0x08u}, {0xE8u, 0x40u}, - {0xECu, 0x80u}, + {0xECu, 0xA0u}, {0x33u, 0x80u}, - {0x5Bu, 0x40u}, + {0x36u, 0x40u}, + {0x5Au, 0x80u}, + {0x5Eu, 0x02u}, {0x62u, 0x01u}, {0x63u, 0x02u}, - {0x66u, 0x80u}, {0x67u, 0x08u}, {0x82u, 0x03u}, {0x87u, 0x04u}, - {0xCCu, 0x10u}, + {0xCCu, 0x30u}, {0xD4u, 0x80u}, {0xD6u, 0xC0u}, {0xD8u, 0xC0u}, {0xE2u, 0x20u}, {0xE6u, 0x30u}, - {0x52u, 0x10u}, + {0x51u, 0x08u}, {0x53u, 0x01u}, - {0x83u, 0x01u}, - {0x8Eu, 0x80u}, - {0x9Au, 0x12u}, - {0x9Eu, 0x80u}, - {0x9Fu, 0x40u}, + {0x83u, 0x05u}, + {0x8Eu, 0x40u}, + {0x96u, 0x80u}, + {0x9Au, 0x02u}, + {0xA6u, 0x41u}, {0xA7u, 0x80u}, - {0xAEu, 0x10u}, {0xAFu, 0x01u}, {0xD4u, 0xA0u}, + {0xE0u, 0x80u}, {0xE6u, 0x20u}, - {0xEAu, 0x40u}, {0xEEu, 0x10u}, - {0x94u, 0x01u}, + {0x8Eu, 0x01u}, {0x9Au, 0x02u}, + {0x9Fu, 0x04u}, + {0xA6u, 0x41u}, {0xA7u, 0x80u}, - {0xB4u, 0x01u}, - {0xB7u, 0x40u}, - {0x82u, 0x20u}, - {0x94u, 0x01u}, + {0xB5u, 0x08u}, + {0x81u, 0x04u}, {0x9Au, 0x02u}, + {0x9Fu, 0x84u}, + {0xA6u, 0x40u}, {0xA7u, 0x80u}, - {0xE6u, 0x80u}, - {0x0Cu, 0x04u}, + {0xABu, 0x80u}, + {0xE4u, 0x80u}, + {0xE8u, 0x80u}, + {0x0Eu, 0x80u}, {0x10u, 0x80u}, - {0x53u, 0x80u}, + {0x50u, 0x04u}, {0x54u, 0x10u}, {0x5Au, 0x10u}, {0x5Cu, 0x40u}, @@ -1264,71 +1264,70 @@ void cyfitter_cfg(void) {0xD4u, 0x07u}, {0xD6u, 0x04u}, {0x03u, 0x01u}, - {0x04u, 0x81u}, + {0x04u, 0x80u}, + {0x06u, 0x80u}, + {0x08u, 0x20u}, {0x09u, 0x04u}, - {0x0Bu, 0x04u}, {0x0Eu, 0x02u}, {0x0Fu, 0x40u}, - {0x87u, 0x80u}, - {0x88u, 0x04u}, - {0x8Cu, 0x41u}, - {0x94u, 0x40u}, + {0x80u, 0x04u}, + {0x86u, 0x40u}, + {0x94u, 0x08u}, {0x96u, 0x10u}, - {0x97u, 0x04u}, - {0x98u, 0x04u}, + {0x9Cu, 0x20u}, + {0xA2u, 0x40u}, {0xA4u, 0x10u}, - {0xA7u, 0x80u}, - {0xB3u, 0x04u}, - {0xB4u, 0x80u}, + {0xA8u, 0x20u}, + {0xB4u, 0xC0u}, {0xC0u, 0x07u}, {0xC2u, 0x0Fu}, - {0xE0u, 0x02u}, - {0xE6u, 0x09u}, - {0xEEu, 0x06u}, + {0xE8u, 0x02u}, + {0xEEu, 0x02u}, {0x90u, 0x80u}, {0x93u, 0x40u}, {0x9Bu, 0x01u}, {0xA2u, 0x01u}, {0xA4u, 0x10u}, {0xAAu, 0x10u}, + {0xB2u, 0x80u}, {0xB5u, 0x04u}, - {0xEEu, 0x02u}, + {0xEEu, 0x06u}, {0x08u, 0x08u}, + {0x0Fu, 0x40u}, {0xA8u, 0x40u}, {0xACu, 0x10u}, {0xAFu, 0x01u}, {0xB3u, 0x40u}, {0xB6u, 0x01u}, - {0xC2u, 0x08u}, + {0xC2u, 0x0Cu}, {0xEAu, 0x0Cu}, - {0x23u, 0x40u}, - {0x24u, 0x01u}, - {0x94u, 0x01u}, - {0x9Au, 0x02u}, - {0xA2u, 0x20u}, + {0x23u, 0x80u}, + {0x27u, 0x04u}, + {0x9Au, 0x22u}, + {0x9Du, 0x04u}, + {0x9Fu, 0x84u}, + {0xAAu, 0x20u}, + {0xAEu, 0x40u}, {0xAFu, 0x80u}, {0xC8u, 0x60u}, - {0xEEu, 0x10u}, - {0x07u, 0x10u}, - {0x52u, 0x20u}, - {0x56u, 0x02u}, - {0x83u, 0x10u}, - {0x9Au, 0x02u}, - {0xA2u, 0x20u}, - {0xAFu, 0x40u}, + {0xEAu, 0x20u}, + {0xEEu, 0x50u}, + {0x05u, 0x04u}, + {0x56u, 0x22u}, + {0x9Au, 0x22u}, + {0x9Du, 0x04u}, {0xC0u, 0x20u}, - {0xD4u, 0x20u}, + {0xD4u, 0x40u}, {0xD6u, 0x20u}, - {0xE0u, 0x20u}, - {0xECu, 0x40u}, {0xACu, 0x08u}, + {0xAFu, 0x40u}, {0x01u, 0x01u}, {0x09u, 0x01u}, {0x0Bu, 0x01u}, {0x0Du, 0x01u}, {0x11u, 0x01u}, {0x1Bu, 0x01u}, - {0x00u, 0x02u}, + {0x00u, 0x0Au}, }; @@ -1358,11 +1357,11 @@ void cyfitter_cfg(void) /* UDB_1_2_0_CONFIG Address: CYDEV_UCFG_B0_P3_U1_BASE Size (bytes): 128 */ static const uint8 CYCODE BS_UDB_1_2_0_CONFIG_VAL[] = { - 0xC0u, 0x01u, 0x02u, 0x00u, 0x1Fu, 0x40u, 0x20u, 0x00u, 0xC0u, 0x08u, 0x08u, 0x21u, 0x90u, 0x01u, 0x40u, 0x00u, - 0x80u, 0x10u, 0x00u, 0x80u, 0x7Fu, 0x04u, 0x80u, 0x00u, 0x00u, 0x01u, 0x60u, 0x00u, 0x00u, 0x01u, 0x00u, 0x00u, - 0xC0u, 0x40u, 0x01u, 0x00u, 0xC0u, 0x22u, 0x04u, 0x08u, 0x00u, 0x07u, 0xFFu, 0x18u, 0x00u, 0x01u, 0x9Fu, 0x00u, - 0xFFu, 0x00u, 0x00u, 0x40u, 0x00u, 0x3Fu, 0x00u, 0x80u, 0x00u, 0x28u, 0x00u, 0x00u, 0x00u, 0x00u, 0x01u, 0x10u, - 0x64u, 0x02u, 0x50u, 0x00u, 0x03u, 0xDEu, 0xF0u, 0xBCu, 0x3Bu, 0xFFu, 0xFFu, 0xFFu, 0x22u, 0x00u, 0xF0u, 0x08u, + 0xC0u, 0x01u, 0x02u, 0x00u, 0x1Fu, 0x22u, 0x20u, 0x08u, 0xC0u, 0x08u, 0x08u, 0x21u, 0x90u, 0x01u, 0x40u, 0x00u, + 0x00u, 0x10u, 0x60u, 0x80u, 0x00u, 0x40u, 0xFFu, 0x00u, 0x7Fu, 0x01u, 0x80u, 0x00u, 0x00u, 0x01u, 0x00u, 0x00u, + 0xC0u, 0x40u, 0x01u, 0x00u, 0xC0u, 0x01u, 0x04u, 0x00u, 0x80u, 0x07u, 0x00u, 0x18u, 0x00u, 0x04u, 0x9Fu, 0x00u, + 0xFFu, 0x80u, 0x00u, 0x3Fu, 0x00u, 0x00u, 0x00u, 0x40u, 0x00u, 0x88u, 0x00u, 0x00u, 0x00u, 0x00u, 0x01u, 0x04u, + 0x32u, 0x06u, 0x50u, 0x00u, 0x04u, 0xDEu, 0xFCu, 0xB0u, 0x2Fu, 0xFFu, 0xFFu, 0xFFu, 0x22u, 0x00u, 0xF0u, 0x08u, 0x04u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x02u, 0x20u, 0x04u, 0x0Bu, 0x0Bu, 0x0Bu, 0x90u, 0x99u, 0x00u, 0x01u, 0x00u, 0x00u, 0xC0u, 0x00u, 0x40u, 0x01u, 0x10u, 0x11u, 0xC0u, 0x01u, 0x00u, 0x11u, 0x40u, 0x01u, 0x40u, 0x01u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u}; diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfittergnu.inc b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfittergnu.inc index 3558ef1..1cdc92f 100755 --- a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfittergnu.inc +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfittergnu.inc @@ -3,45 +3,35 @@ .include "cydevicegnu.inc" .include "cydevicegnu_trm.inc" -/* USBFS_1_bus_reset */ -.set USBFS_1_bus_reset__INTC_CLR_EN_REG, CYREG_NVIC_CLRENA0 -.set USBFS_1_bus_reset__INTC_CLR_PD_REG, CYREG_NVIC_CLRPEND0 -.set USBFS_1_bus_reset__INTC_MASK, 0x800000 -.set USBFS_1_bus_reset__INTC_NUMBER, 23 -.set USBFS_1_bus_reset__INTC_PRIOR_NUM, 7 -.set USBFS_1_bus_reset__INTC_PRIOR_REG, CYREG_NVIC_PRI_23 -.set USBFS_1_bus_reset__INTC_SET_EN_REG, CYREG_NVIC_SETENA0 -.set USBFS_1_bus_reset__INTC_SET_PD_REG, CYREG_NVIC_SETPEND0 +/* USBFS_bus_reset */ +.set USBFS_bus_reset__INTC_CLR_EN_REG, CYREG_NVIC_CLRENA0 +.set USBFS_bus_reset__INTC_CLR_PD_REG, CYREG_NVIC_CLRPEND0 +.set USBFS_bus_reset__INTC_MASK, 0x800000 +.set USBFS_bus_reset__INTC_NUMBER, 23 +.set USBFS_bus_reset__INTC_PRIOR_NUM, 7 +.set USBFS_bus_reset__INTC_PRIOR_REG, CYREG_NVIC_PRI_23 +.set USBFS_bus_reset__INTC_SET_EN_REG, CYREG_NVIC_SETENA0 +.set USBFS_bus_reset__INTC_SET_PD_REG, CYREG_NVIC_SETPEND0 -/* USBFS_1_arb_int */ -.set USBFS_1_arb_int__INTC_CLR_EN_REG, CYREG_NVIC_CLRENA0 -.set USBFS_1_arb_int__INTC_CLR_PD_REG, CYREG_NVIC_CLRPEND0 -.set USBFS_1_arb_int__INTC_MASK, 0x400000 -.set USBFS_1_arb_int__INTC_NUMBER, 22 -.set USBFS_1_arb_int__INTC_PRIOR_NUM, 7 -.set USBFS_1_arb_int__INTC_PRIOR_REG, CYREG_NVIC_PRI_22 -.set USBFS_1_arb_int__INTC_SET_EN_REG, CYREG_NVIC_SETENA0 -.set USBFS_1_arb_int__INTC_SET_PD_REG, CYREG_NVIC_SETPEND0 +/* USBFS_arb_int */ +.set USBFS_arb_int__INTC_CLR_EN_REG, CYREG_NVIC_CLRENA0 +.set USBFS_arb_int__INTC_CLR_PD_REG, CYREG_NVIC_CLRPEND0 +.set USBFS_arb_int__INTC_MASK, 0x400000 +.set USBFS_arb_int__INTC_NUMBER, 22 +.set USBFS_arb_int__INTC_PRIOR_NUM, 7 +.set USBFS_arb_int__INTC_PRIOR_REG, CYREG_NVIC_PRI_22 +.set USBFS_arb_int__INTC_SET_EN_REG, CYREG_NVIC_SETENA0 +.set USBFS_arb_int__INTC_SET_PD_REG, CYREG_NVIC_SETPEND0 -/* USBFS_1_sof_int */ -.set USBFS_1_sof_int__INTC_CLR_EN_REG, CYREG_NVIC_CLRENA0 -.set USBFS_1_sof_int__INTC_CLR_PD_REG, CYREG_NVIC_CLRPEND0 -.set USBFS_1_sof_int__INTC_MASK, 0x200000 -.set USBFS_1_sof_int__INTC_NUMBER, 21 -.set USBFS_1_sof_int__INTC_PRIOR_NUM, 7 -.set USBFS_1_sof_int__INTC_PRIOR_REG, CYREG_NVIC_PRI_21 -.set USBFS_1_sof_int__INTC_SET_EN_REG, CYREG_NVIC_SETENA0 -.set USBFS_1_sof_int__INTC_SET_PD_REG, CYREG_NVIC_SETPEND0 - -/* USBFS_1_dp_int */ -.set USBFS_1_dp_int__INTC_CLR_EN_REG, CYREG_NVIC_CLRENA0 -.set USBFS_1_dp_int__INTC_CLR_PD_REG, CYREG_NVIC_CLRPEND0 -.set USBFS_1_dp_int__INTC_MASK, 0x1000 -.set USBFS_1_dp_int__INTC_NUMBER, 12 -.set USBFS_1_dp_int__INTC_PRIOR_NUM, 7 -.set USBFS_1_dp_int__INTC_PRIOR_REG, CYREG_NVIC_PRI_12 -.set USBFS_1_dp_int__INTC_SET_EN_REG, CYREG_NVIC_SETENA0 -.set USBFS_1_dp_int__INTC_SET_PD_REG, CYREG_NVIC_SETPEND0 +/* USBFS_sof_int */ +.set USBFS_sof_int__INTC_CLR_EN_REG, CYREG_NVIC_CLRENA0 +.set USBFS_sof_int__INTC_CLR_PD_REG, CYREG_NVIC_CLRPEND0 +.set USBFS_sof_int__INTC_MASK, 0x200000 +.set USBFS_sof_int__INTC_NUMBER, 21 +.set USBFS_sof_int__INTC_PRIOR_NUM, 7 +.set USBFS_sof_int__INTC_PRIOR_REG, CYREG_NVIC_PRI_21 +.set USBFS_sof_int__INTC_SET_EN_REG, CYREG_NVIC_SETENA0 +.set USBFS_sof_int__INTC_SET_PD_REG, CYREG_NVIC_SETPEND0 /* SCSI_ATN_ISR */ .set SCSI_ATN_ISR__INTC_CLR_EN_REG, CYREG_NVIC_CLRENA0 @@ -572,25 +562,15 @@ .set SDCard_BSPIM_sR8_Dp_u0__MSK_DP_AUX_CTL_REG, CYREG_B0_UDB07_MSK_ACTL .set SDCard_BSPIM_sR8_Dp_u0__PER_DP_AUX_CTL_REG, CYREG_B0_UDB07_MSK_ACTL -/* USBFS_1_ep_0 */ -.set USBFS_1_ep_0__INTC_CLR_EN_REG, CYREG_NVIC_CLRENA0 -.set USBFS_1_ep_0__INTC_CLR_PD_REG, CYREG_NVIC_CLRPEND0 -.set USBFS_1_ep_0__INTC_MASK, 0x1000000 -.set USBFS_1_ep_0__INTC_NUMBER, 24 -.set USBFS_1_ep_0__INTC_PRIOR_NUM, 7 -.set USBFS_1_ep_0__INTC_PRIOR_REG, CYREG_NVIC_PRI_24 -.set USBFS_1_ep_0__INTC_SET_EN_REG, CYREG_NVIC_SETENA0 -.set USBFS_1_ep_0__INTC_SET_PD_REG, CYREG_NVIC_SETPEND0 - -/* USBFS_1_ep_1 */ -.set USBFS_1_ep_1__INTC_CLR_EN_REG, CYREG_NVIC_CLRENA0 -.set USBFS_1_ep_1__INTC_CLR_PD_REG, CYREG_NVIC_CLRPEND0 -.set USBFS_1_ep_1__INTC_MASK, 0x01 -.set USBFS_1_ep_1__INTC_NUMBER, 0 -.set USBFS_1_ep_1__INTC_PRIOR_NUM, 7 -.set USBFS_1_ep_1__INTC_PRIOR_REG, CYREG_NVIC_PRI_0 -.set USBFS_1_ep_1__INTC_SET_EN_REG, CYREG_NVIC_SETENA0 -.set USBFS_1_ep_1__INTC_SET_PD_REG, CYREG_NVIC_SETPEND0 +/* USBFS_dp_int */ +.set USBFS_dp_int__INTC_CLR_EN_REG, CYREG_NVIC_CLRENA0 +.set USBFS_dp_int__INTC_CLR_PD_REG, CYREG_NVIC_CLRPEND0 +.set USBFS_dp_int__INTC_MASK, 0x1000 +.set USBFS_dp_int__INTC_NUMBER, 12 +.set USBFS_dp_int__INTC_PRIOR_NUM, 7 +.set USBFS_dp_int__INTC_PRIOR_REG, CYREG_NVIC_PRI_12 +.set USBFS_dp_int__INTC_SET_EN_REG, CYREG_NVIC_SETENA0 +.set USBFS_dp_int__INTC_SET_PD_REG, CYREG_NVIC_SETPEND0 /* SCSI_CTL_IO */ .set SCSI_CTL_IO_Sync_ctrl_reg__0__MASK, 0x01 @@ -1068,132 +1048,6 @@ .set SD_Init_Clk__PM_STBY_CFG, CYREG_PM_STBY_CFG2 .set SD_Init_Clk__PM_STBY_MSK, 0x02 -/* USBFS_1_USB */ -.set USBFS_1_USB__ARB_CFG, CYREG_USB_ARB_CFG -.set USBFS_1_USB__ARB_EP1_CFG, CYREG_USB_ARB_EP1_CFG -.set USBFS_1_USB__ARB_EP1_INT_EN, CYREG_USB_ARB_EP1_INT_EN -.set USBFS_1_USB__ARB_EP1_SR, CYREG_USB_ARB_EP1_SR -.set USBFS_1_USB__ARB_EP2_CFG, CYREG_USB_ARB_EP2_CFG -.set USBFS_1_USB__ARB_EP2_INT_EN, CYREG_USB_ARB_EP2_INT_EN -.set USBFS_1_USB__ARB_EP2_SR, CYREG_USB_ARB_EP2_SR -.set USBFS_1_USB__ARB_EP3_CFG, CYREG_USB_ARB_EP3_CFG -.set USBFS_1_USB__ARB_EP3_INT_EN, CYREG_USB_ARB_EP3_INT_EN -.set USBFS_1_USB__ARB_EP3_SR, CYREG_USB_ARB_EP3_SR -.set USBFS_1_USB__ARB_EP4_CFG, CYREG_USB_ARB_EP4_CFG -.set USBFS_1_USB__ARB_EP4_INT_EN, CYREG_USB_ARB_EP4_INT_EN -.set USBFS_1_USB__ARB_EP4_SR, CYREG_USB_ARB_EP4_SR -.set USBFS_1_USB__ARB_EP5_CFG, CYREG_USB_ARB_EP5_CFG -.set USBFS_1_USB__ARB_EP5_INT_EN, CYREG_USB_ARB_EP5_INT_EN -.set USBFS_1_USB__ARB_EP5_SR, CYREG_USB_ARB_EP5_SR -.set USBFS_1_USB__ARB_EP6_CFG, CYREG_USB_ARB_EP6_CFG -.set USBFS_1_USB__ARB_EP6_INT_EN, CYREG_USB_ARB_EP6_INT_EN -.set USBFS_1_USB__ARB_EP6_SR, CYREG_USB_ARB_EP6_SR -.set USBFS_1_USB__ARB_EP7_CFG, CYREG_USB_ARB_EP7_CFG -.set USBFS_1_USB__ARB_EP7_INT_EN, CYREG_USB_ARB_EP7_INT_EN -.set USBFS_1_USB__ARB_EP7_SR, CYREG_USB_ARB_EP7_SR -.set USBFS_1_USB__ARB_EP8_CFG, CYREG_USB_ARB_EP8_CFG -.set USBFS_1_USB__ARB_EP8_INT_EN, CYREG_USB_ARB_EP8_INT_EN -.set USBFS_1_USB__ARB_EP8_SR, CYREG_USB_ARB_EP8_SR -.set USBFS_1_USB__ARB_INT_EN, CYREG_USB_ARB_INT_EN -.set USBFS_1_USB__ARB_INT_SR, CYREG_USB_ARB_INT_SR -.set USBFS_1_USB__ARB_RW1_DR, CYREG_USB_ARB_RW1_DR -.set USBFS_1_USB__ARB_RW1_RA, CYREG_USB_ARB_RW1_RA -.set USBFS_1_USB__ARB_RW1_RA_MSB, CYREG_USB_ARB_RW1_RA_MSB -.set USBFS_1_USB__ARB_RW1_WA, CYREG_USB_ARB_RW1_WA -.set USBFS_1_USB__ARB_RW1_WA_MSB, CYREG_USB_ARB_RW1_WA_MSB -.set USBFS_1_USB__ARB_RW2_DR, CYREG_USB_ARB_RW2_DR -.set USBFS_1_USB__ARB_RW2_RA, CYREG_USB_ARB_RW2_RA -.set USBFS_1_USB__ARB_RW2_RA_MSB, CYREG_USB_ARB_RW2_RA_MSB -.set USBFS_1_USB__ARB_RW2_WA, CYREG_USB_ARB_RW2_WA -.set USBFS_1_USB__ARB_RW2_WA_MSB, CYREG_USB_ARB_RW2_WA_MSB -.set USBFS_1_USB__ARB_RW3_DR, CYREG_USB_ARB_RW3_DR -.set USBFS_1_USB__ARB_RW3_RA, CYREG_USB_ARB_RW3_RA -.set USBFS_1_USB__ARB_RW3_RA_MSB, CYREG_USB_ARB_RW3_RA_MSB -.set USBFS_1_USB__ARB_RW3_WA, CYREG_USB_ARB_RW3_WA -.set USBFS_1_USB__ARB_RW3_WA_MSB, CYREG_USB_ARB_RW3_WA_MSB -.set USBFS_1_USB__ARB_RW4_DR, CYREG_USB_ARB_RW4_DR -.set USBFS_1_USB__ARB_RW4_RA, CYREG_USB_ARB_RW4_RA -.set USBFS_1_USB__ARB_RW4_RA_MSB, CYREG_USB_ARB_RW4_RA_MSB -.set USBFS_1_USB__ARB_RW4_WA, CYREG_USB_ARB_RW4_WA -.set USBFS_1_USB__ARB_RW4_WA_MSB, CYREG_USB_ARB_RW4_WA_MSB -.set USBFS_1_USB__ARB_RW5_DR, CYREG_USB_ARB_RW5_DR -.set USBFS_1_USB__ARB_RW5_RA, CYREG_USB_ARB_RW5_RA -.set USBFS_1_USB__ARB_RW5_RA_MSB, CYREG_USB_ARB_RW5_RA_MSB -.set USBFS_1_USB__ARB_RW5_WA, CYREG_USB_ARB_RW5_WA -.set USBFS_1_USB__ARB_RW5_WA_MSB, CYREG_USB_ARB_RW5_WA_MSB -.set USBFS_1_USB__ARB_RW6_DR, CYREG_USB_ARB_RW6_DR -.set USBFS_1_USB__ARB_RW6_RA, CYREG_USB_ARB_RW6_RA -.set USBFS_1_USB__ARB_RW6_RA_MSB, CYREG_USB_ARB_RW6_RA_MSB -.set USBFS_1_USB__ARB_RW6_WA, CYREG_USB_ARB_RW6_WA -.set USBFS_1_USB__ARB_RW6_WA_MSB, CYREG_USB_ARB_RW6_WA_MSB -.set USBFS_1_USB__ARB_RW7_DR, CYREG_USB_ARB_RW7_DR -.set USBFS_1_USB__ARB_RW7_RA, CYREG_USB_ARB_RW7_RA -.set USBFS_1_USB__ARB_RW7_RA_MSB, CYREG_USB_ARB_RW7_RA_MSB -.set USBFS_1_USB__ARB_RW7_WA, CYREG_USB_ARB_RW7_WA -.set USBFS_1_USB__ARB_RW7_WA_MSB, CYREG_USB_ARB_RW7_WA_MSB -.set USBFS_1_USB__ARB_RW8_DR, CYREG_USB_ARB_RW8_DR -.set USBFS_1_USB__ARB_RW8_RA, CYREG_USB_ARB_RW8_RA -.set USBFS_1_USB__ARB_RW8_RA_MSB, CYREG_USB_ARB_RW8_RA_MSB -.set USBFS_1_USB__ARB_RW8_WA, CYREG_USB_ARB_RW8_WA -.set USBFS_1_USB__ARB_RW8_WA_MSB, CYREG_USB_ARB_RW8_WA_MSB -.set USBFS_1_USB__BUF_SIZE, CYREG_USB_BUF_SIZE -.set USBFS_1_USB__BUS_RST_CNT, CYREG_USB_BUS_RST_CNT -.set USBFS_1_USB__CR0, CYREG_USB_CR0 -.set USBFS_1_USB__CR1, CYREG_USB_CR1 -.set USBFS_1_USB__CWA, CYREG_USB_CWA -.set USBFS_1_USB__CWA_MSB, CYREG_USB_CWA_MSB -.set USBFS_1_USB__DMA_THRES, CYREG_USB_DMA_THRES -.set USBFS_1_USB__DMA_THRES_MSB, CYREG_USB_DMA_THRES_MSB -.set USBFS_1_USB__DYN_RECONFIG, CYREG_USB_DYN_RECONFIG -.set USBFS_1_USB__EP0_CNT, CYREG_USB_EP0_CNT -.set USBFS_1_USB__EP0_CR, CYREG_USB_EP0_CR -.set USBFS_1_USB__EP0_DR0, CYREG_USB_EP0_DR0 -.set USBFS_1_USB__EP0_DR1, CYREG_USB_EP0_DR1 -.set USBFS_1_USB__EP0_DR2, CYREG_USB_EP0_DR2 -.set USBFS_1_USB__EP0_DR3, CYREG_USB_EP0_DR3 -.set USBFS_1_USB__EP0_DR4, CYREG_USB_EP0_DR4 -.set USBFS_1_USB__EP0_DR5, CYREG_USB_EP0_DR5 -.set USBFS_1_USB__EP0_DR6, CYREG_USB_EP0_DR6 -.set USBFS_1_USB__EP0_DR7, CYREG_USB_EP0_DR7 -.set USBFS_1_USB__EP_ACTIVE, CYREG_USB_EP_ACTIVE -.set USBFS_1_USB__EP_TYPE, CYREG_USB_EP_TYPE -.set USBFS_1_USB__MEM_DATA, CYREG_USB_MEM_DATA_MBASE -.set USBFS_1_USB__PM_ACT_CFG, CYREG_PM_ACT_CFG5 -.set USBFS_1_USB__PM_ACT_MSK, 0x01 -.set USBFS_1_USB__PM_STBY_CFG, CYREG_PM_STBY_CFG5 -.set USBFS_1_USB__PM_STBY_MSK, 0x01 -.set USBFS_1_USB__SIE_EP1_CNT0, CYREG_USB_SIE_EP1_CNT0 -.set USBFS_1_USB__SIE_EP1_CNT1, CYREG_USB_SIE_EP1_CNT1 -.set USBFS_1_USB__SIE_EP1_CR0, CYREG_USB_SIE_EP1_CR0 -.set USBFS_1_USB__SIE_EP2_CNT0, CYREG_USB_SIE_EP2_CNT0 -.set USBFS_1_USB__SIE_EP2_CNT1, CYREG_USB_SIE_EP2_CNT1 -.set USBFS_1_USB__SIE_EP2_CR0, CYREG_USB_SIE_EP2_CR0 -.set USBFS_1_USB__SIE_EP3_CNT0, CYREG_USB_SIE_EP3_CNT0 -.set USBFS_1_USB__SIE_EP3_CNT1, CYREG_USB_SIE_EP3_CNT1 -.set USBFS_1_USB__SIE_EP3_CR0, CYREG_USB_SIE_EP3_CR0 -.set USBFS_1_USB__SIE_EP4_CNT0, CYREG_USB_SIE_EP4_CNT0 -.set USBFS_1_USB__SIE_EP4_CNT1, CYREG_USB_SIE_EP4_CNT1 -.set USBFS_1_USB__SIE_EP4_CR0, CYREG_USB_SIE_EP4_CR0 -.set USBFS_1_USB__SIE_EP5_CNT0, CYREG_USB_SIE_EP5_CNT0 -.set USBFS_1_USB__SIE_EP5_CNT1, CYREG_USB_SIE_EP5_CNT1 -.set USBFS_1_USB__SIE_EP5_CR0, CYREG_USB_SIE_EP5_CR0 -.set USBFS_1_USB__SIE_EP6_CNT0, CYREG_USB_SIE_EP6_CNT0 -.set USBFS_1_USB__SIE_EP6_CNT1, CYREG_USB_SIE_EP6_CNT1 -.set USBFS_1_USB__SIE_EP6_CR0, CYREG_USB_SIE_EP6_CR0 -.set USBFS_1_USB__SIE_EP7_CNT0, CYREG_USB_SIE_EP7_CNT0 -.set USBFS_1_USB__SIE_EP7_CNT1, CYREG_USB_SIE_EP7_CNT1 -.set USBFS_1_USB__SIE_EP7_CR0, CYREG_USB_SIE_EP7_CR0 -.set USBFS_1_USB__SIE_EP8_CNT0, CYREG_USB_SIE_EP8_CNT0 -.set USBFS_1_USB__SIE_EP8_CNT1, CYREG_USB_SIE_EP8_CNT1 -.set USBFS_1_USB__SIE_EP8_CR0, CYREG_USB_SIE_EP8_CR0 -.set USBFS_1_USB__SIE_EP_INT_EN, CYREG_USB_SIE_EP_INT_EN -.set USBFS_1_USB__SIE_EP_INT_SR, CYREG_USB_SIE_EP_INT_SR -.set USBFS_1_USB__SOF0, CYREG_USB_SOF0 -.set USBFS_1_USB__SOF1, CYREG_USB_SOF1 -.set USBFS_1_USB__USBIO_CR0, CYREG_USB_USBIO_CR0 -.set USBFS_1_USB__USBIO_CR1, CYREG_USB_USBIO_CR1 -.set USBFS_1_USB__USB_CLK_EN, CYREG_USB_USB_CLK_EN - /* scsiTarget */ .set scsiTarget_StatusReg__0__MASK, 0x01 .set scsiTarget_StatusReg__0__POS, 0 @@ -1277,71 +1131,161 @@ .set SD_Clk_Ctl_Sync_ctrl_reg__PERIOD_REG, CYREG_B0_UDB01_MSK .set SD_Clk_Ctl_Sync_ctrl_reg__PER_CTL_AUX_CTL_REG, CYREG_B0_UDB01_MSK_ACTL -/* USBFS_1_Dm */ -.set USBFS_1_Dm__0__MASK, 0x80 -.set USBFS_1_Dm__0__PC, CYREG_IO_PC_PRT15_7_6_PC1 -.set USBFS_1_Dm__0__PORT, 15 -.set USBFS_1_Dm__0__SHIFT, 7 -.set USBFS_1_Dm__AG, CYREG_PRT15_AG -.set USBFS_1_Dm__AMUX, CYREG_PRT15_AMUX -.set USBFS_1_Dm__BIE, CYREG_PRT15_BIE -.set USBFS_1_Dm__BIT_MASK, CYREG_PRT15_BIT_MASK -.set USBFS_1_Dm__BYP, CYREG_PRT15_BYP -.set USBFS_1_Dm__CTL, CYREG_PRT15_CTL -.set USBFS_1_Dm__DM0, CYREG_PRT15_DM0 -.set USBFS_1_Dm__DM1, CYREG_PRT15_DM1 -.set USBFS_1_Dm__DM2, CYREG_PRT15_DM2 -.set USBFS_1_Dm__DR, CYREG_PRT15_DR -.set USBFS_1_Dm__INP_DIS, CYREG_PRT15_INP_DIS -.set USBFS_1_Dm__LCD_COM_SEG, CYREG_PRT15_LCD_COM_SEG -.set USBFS_1_Dm__LCD_EN, CYREG_PRT15_LCD_EN -.set USBFS_1_Dm__MASK, 0x80 -.set USBFS_1_Dm__PORT, 15 -.set USBFS_1_Dm__PRT, CYREG_PRT15_PRT -.set USBFS_1_Dm__PRTDSI__CAPS_SEL, CYREG_PRT15_CAPS_SEL -.set USBFS_1_Dm__PRTDSI__DBL_SYNC_IN, CYREG_PRT15_DBL_SYNC_IN -.set USBFS_1_Dm__PRTDSI__OE_SEL0, CYREG_PRT15_OE_SEL0 -.set USBFS_1_Dm__PRTDSI__OE_SEL1, CYREG_PRT15_OE_SEL1 -.set USBFS_1_Dm__PRTDSI__OUT_SEL0, CYREG_PRT15_OUT_SEL0 -.set USBFS_1_Dm__PRTDSI__OUT_SEL1, CYREG_PRT15_OUT_SEL1 -.set USBFS_1_Dm__PRTDSI__SYNC_OUT, CYREG_PRT15_SYNC_OUT -.set USBFS_1_Dm__PS, CYREG_PRT15_PS -.set USBFS_1_Dm__SHIFT, 7 -.set USBFS_1_Dm__SLW, CYREG_PRT15_SLW +/* USBFS_ep_0 */ +.set USBFS_ep_0__INTC_CLR_EN_REG, CYREG_NVIC_CLRENA0 +.set USBFS_ep_0__INTC_CLR_PD_REG, CYREG_NVIC_CLRPEND0 +.set USBFS_ep_0__INTC_MASK, 0x1000000 +.set USBFS_ep_0__INTC_NUMBER, 24 +.set USBFS_ep_0__INTC_PRIOR_NUM, 7 +.set USBFS_ep_0__INTC_PRIOR_REG, CYREG_NVIC_PRI_24 +.set USBFS_ep_0__INTC_SET_EN_REG, CYREG_NVIC_SETENA0 +.set USBFS_ep_0__INTC_SET_PD_REG, CYREG_NVIC_SETPEND0 + +/* USBFS_ep_1 */ +.set USBFS_ep_1__INTC_CLR_EN_REG, CYREG_NVIC_CLRENA0 +.set USBFS_ep_1__INTC_CLR_PD_REG, CYREG_NVIC_CLRPEND0 +.set USBFS_ep_1__INTC_MASK, 0x01 +.set USBFS_ep_1__INTC_NUMBER, 0 +.set USBFS_ep_1__INTC_PRIOR_NUM, 7 +.set USBFS_ep_1__INTC_PRIOR_REG, CYREG_NVIC_PRI_0 +.set USBFS_ep_1__INTC_SET_EN_REG, CYREG_NVIC_SETENA0 +.set USBFS_ep_1__INTC_SET_PD_REG, CYREG_NVIC_SETPEND0 -/* USBFS_1_Dp */ -.set USBFS_1_Dp__0__MASK, 0x40 -.set USBFS_1_Dp__0__PC, CYREG_IO_PC_PRT15_7_6_PC0 -.set USBFS_1_Dp__0__PORT, 15 -.set USBFS_1_Dp__0__SHIFT, 6 -.set USBFS_1_Dp__AG, CYREG_PRT15_AG -.set USBFS_1_Dp__AMUX, CYREG_PRT15_AMUX -.set USBFS_1_Dp__BIE, CYREG_PRT15_BIE -.set USBFS_1_Dp__BIT_MASK, CYREG_PRT15_BIT_MASK -.set USBFS_1_Dp__BYP, CYREG_PRT15_BYP -.set USBFS_1_Dp__CTL, CYREG_PRT15_CTL -.set USBFS_1_Dp__DM0, CYREG_PRT15_DM0 -.set USBFS_1_Dp__DM1, CYREG_PRT15_DM1 -.set USBFS_1_Dp__DM2, CYREG_PRT15_DM2 -.set USBFS_1_Dp__DR, CYREG_PRT15_DR -.set USBFS_1_Dp__INP_DIS, CYREG_PRT15_INP_DIS -.set USBFS_1_Dp__INTSTAT, CYREG_PICU15_INTSTAT -.set USBFS_1_Dp__LCD_COM_SEG, CYREG_PRT15_LCD_COM_SEG -.set USBFS_1_Dp__LCD_EN, CYREG_PRT15_LCD_EN -.set USBFS_1_Dp__MASK, 0x40 -.set USBFS_1_Dp__PORT, 15 -.set USBFS_1_Dp__PRT, CYREG_PRT15_PRT -.set USBFS_1_Dp__PRTDSI__CAPS_SEL, CYREG_PRT15_CAPS_SEL -.set USBFS_1_Dp__PRTDSI__DBL_SYNC_IN, CYREG_PRT15_DBL_SYNC_IN -.set USBFS_1_Dp__PRTDSI__OE_SEL0, CYREG_PRT15_OE_SEL0 -.set USBFS_1_Dp__PRTDSI__OE_SEL1, CYREG_PRT15_OE_SEL1 -.set USBFS_1_Dp__PRTDSI__OUT_SEL0, CYREG_PRT15_OUT_SEL0 -.set USBFS_1_Dp__PRTDSI__OUT_SEL1, CYREG_PRT15_OUT_SEL1 -.set USBFS_1_Dp__PRTDSI__SYNC_OUT, CYREG_PRT15_SYNC_OUT -.set USBFS_1_Dp__PS, CYREG_PRT15_PS -.set USBFS_1_Dp__SHIFT, 6 -.set USBFS_1_Dp__SLW, CYREG_PRT15_SLW -.set USBFS_1_Dp__SNAP, CYREG_PICU_15_SNAP_15 +/* USBFS_ep_2 */ +.set USBFS_ep_2__INTC_CLR_EN_REG, CYREG_NVIC_CLRENA0 +.set USBFS_ep_2__INTC_CLR_PD_REG, CYREG_NVIC_CLRPEND0 +.set USBFS_ep_2__INTC_MASK, 0x02 +.set USBFS_ep_2__INTC_NUMBER, 1 +.set USBFS_ep_2__INTC_PRIOR_NUM, 7 +.set USBFS_ep_2__INTC_PRIOR_REG, CYREG_NVIC_PRI_1 +.set USBFS_ep_2__INTC_SET_EN_REG, CYREG_NVIC_SETENA0 +.set USBFS_ep_2__INTC_SET_PD_REG, CYREG_NVIC_SETPEND0 + +/* USBFS_USB */ +.set USBFS_USB__ARB_CFG, CYREG_USB_ARB_CFG +.set USBFS_USB__ARB_EP1_CFG, CYREG_USB_ARB_EP1_CFG +.set USBFS_USB__ARB_EP1_INT_EN, CYREG_USB_ARB_EP1_INT_EN +.set USBFS_USB__ARB_EP1_SR, CYREG_USB_ARB_EP1_SR +.set USBFS_USB__ARB_EP2_CFG, CYREG_USB_ARB_EP2_CFG +.set USBFS_USB__ARB_EP2_INT_EN, CYREG_USB_ARB_EP2_INT_EN +.set USBFS_USB__ARB_EP2_SR, CYREG_USB_ARB_EP2_SR +.set USBFS_USB__ARB_EP3_CFG, CYREG_USB_ARB_EP3_CFG +.set USBFS_USB__ARB_EP3_INT_EN, CYREG_USB_ARB_EP3_INT_EN +.set USBFS_USB__ARB_EP3_SR, CYREG_USB_ARB_EP3_SR +.set USBFS_USB__ARB_EP4_CFG, CYREG_USB_ARB_EP4_CFG +.set USBFS_USB__ARB_EP4_INT_EN, CYREG_USB_ARB_EP4_INT_EN +.set USBFS_USB__ARB_EP4_SR, CYREG_USB_ARB_EP4_SR +.set USBFS_USB__ARB_EP5_CFG, CYREG_USB_ARB_EP5_CFG +.set USBFS_USB__ARB_EP5_INT_EN, CYREG_USB_ARB_EP5_INT_EN +.set USBFS_USB__ARB_EP5_SR, CYREG_USB_ARB_EP5_SR +.set USBFS_USB__ARB_EP6_CFG, CYREG_USB_ARB_EP6_CFG +.set USBFS_USB__ARB_EP6_INT_EN, CYREG_USB_ARB_EP6_INT_EN +.set USBFS_USB__ARB_EP6_SR, CYREG_USB_ARB_EP6_SR +.set USBFS_USB__ARB_EP7_CFG, CYREG_USB_ARB_EP7_CFG +.set USBFS_USB__ARB_EP7_INT_EN, CYREG_USB_ARB_EP7_INT_EN +.set USBFS_USB__ARB_EP7_SR, CYREG_USB_ARB_EP7_SR +.set USBFS_USB__ARB_EP8_CFG, CYREG_USB_ARB_EP8_CFG +.set USBFS_USB__ARB_EP8_INT_EN, CYREG_USB_ARB_EP8_INT_EN +.set USBFS_USB__ARB_EP8_SR, CYREG_USB_ARB_EP8_SR +.set USBFS_USB__ARB_INT_EN, CYREG_USB_ARB_INT_EN +.set USBFS_USB__ARB_INT_SR, CYREG_USB_ARB_INT_SR +.set USBFS_USB__ARB_RW1_DR, CYREG_USB_ARB_RW1_DR +.set USBFS_USB__ARB_RW1_RA, CYREG_USB_ARB_RW1_RA +.set USBFS_USB__ARB_RW1_RA_MSB, CYREG_USB_ARB_RW1_RA_MSB +.set USBFS_USB__ARB_RW1_WA, CYREG_USB_ARB_RW1_WA +.set USBFS_USB__ARB_RW1_WA_MSB, CYREG_USB_ARB_RW1_WA_MSB +.set USBFS_USB__ARB_RW2_DR, CYREG_USB_ARB_RW2_DR +.set USBFS_USB__ARB_RW2_RA, CYREG_USB_ARB_RW2_RA +.set USBFS_USB__ARB_RW2_RA_MSB, CYREG_USB_ARB_RW2_RA_MSB +.set USBFS_USB__ARB_RW2_WA, CYREG_USB_ARB_RW2_WA +.set USBFS_USB__ARB_RW2_WA_MSB, CYREG_USB_ARB_RW2_WA_MSB +.set USBFS_USB__ARB_RW3_DR, CYREG_USB_ARB_RW3_DR +.set USBFS_USB__ARB_RW3_RA, CYREG_USB_ARB_RW3_RA +.set USBFS_USB__ARB_RW3_RA_MSB, CYREG_USB_ARB_RW3_RA_MSB +.set USBFS_USB__ARB_RW3_WA, CYREG_USB_ARB_RW3_WA +.set USBFS_USB__ARB_RW3_WA_MSB, CYREG_USB_ARB_RW3_WA_MSB +.set USBFS_USB__ARB_RW4_DR, CYREG_USB_ARB_RW4_DR +.set USBFS_USB__ARB_RW4_RA, CYREG_USB_ARB_RW4_RA +.set USBFS_USB__ARB_RW4_RA_MSB, CYREG_USB_ARB_RW4_RA_MSB +.set USBFS_USB__ARB_RW4_WA, CYREG_USB_ARB_RW4_WA +.set USBFS_USB__ARB_RW4_WA_MSB, CYREG_USB_ARB_RW4_WA_MSB +.set USBFS_USB__ARB_RW5_DR, CYREG_USB_ARB_RW5_DR +.set USBFS_USB__ARB_RW5_RA, CYREG_USB_ARB_RW5_RA +.set USBFS_USB__ARB_RW5_RA_MSB, CYREG_USB_ARB_RW5_RA_MSB +.set USBFS_USB__ARB_RW5_WA, CYREG_USB_ARB_RW5_WA +.set USBFS_USB__ARB_RW5_WA_MSB, CYREG_USB_ARB_RW5_WA_MSB +.set USBFS_USB__ARB_RW6_DR, CYREG_USB_ARB_RW6_DR +.set USBFS_USB__ARB_RW6_RA, CYREG_USB_ARB_RW6_RA +.set USBFS_USB__ARB_RW6_RA_MSB, CYREG_USB_ARB_RW6_RA_MSB +.set USBFS_USB__ARB_RW6_WA, CYREG_USB_ARB_RW6_WA +.set USBFS_USB__ARB_RW6_WA_MSB, CYREG_USB_ARB_RW6_WA_MSB +.set USBFS_USB__ARB_RW7_DR, CYREG_USB_ARB_RW7_DR +.set USBFS_USB__ARB_RW7_RA, CYREG_USB_ARB_RW7_RA +.set USBFS_USB__ARB_RW7_RA_MSB, CYREG_USB_ARB_RW7_RA_MSB +.set USBFS_USB__ARB_RW7_WA, CYREG_USB_ARB_RW7_WA +.set USBFS_USB__ARB_RW7_WA_MSB, CYREG_USB_ARB_RW7_WA_MSB +.set USBFS_USB__ARB_RW8_DR, CYREG_USB_ARB_RW8_DR +.set USBFS_USB__ARB_RW8_RA, CYREG_USB_ARB_RW8_RA +.set USBFS_USB__ARB_RW8_RA_MSB, CYREG_USB_ARB_RW8_RA_MSB +.set USBFS_USB__ARB_RW8_WA, CYREG_USB_ARB_RW8_WA +.set USBFS_USB__ARB_RW8_WA_MSB, CYREG_USB_ARB_RW8_WA_MSB +.set USBFS_USB__BUF_SIZE, CYREG_USB_BUF_SIZE +.set USBFS_USB__BUS_RST_CNT, CYREG_USB_BUS_RST_CNT +.set USBFS_USB__CR0, CYREG_USB_CR0 +.set USBFS_USB__CR1, CYREG_USB_CR1 +.set USBFS_USB__CWA, CYREG_USB_CWA +.set USBFS_USB__CWA_MSB, CYREG_USB_CWA_MSB +.set USBFS_USB__DMA_THRES, CYREG_USB_DMA_THRES +.set USBFS_USB__DMA_THRES_MSB, CYREG_USB_DMA_THRES_MSB +.set USBFS_USB__DYN_RECONFIG, CYREG_USB_DYN_RECONFIG +.set USBFS_USB__EP0_CNT, CYREG_USB_EP0_CNT +.set USBFS_USB__EP0_CR, CYREG_USB_EP0_CR +.set USBFS_USB__EP0_DR0, CYREG_USB_EP0_DR0 +.set USBFS_USB__EP0_DR1, CYREG_USB_EP0_DR1 +.set USBFS_USB__EP0_DR2, CYREG_USB_EP0_DR2 +.set USBFS_USB__EP0_DR3, CYREG_USB_EP0_DR3 +.set USBFS_USB__EP0_DR4, CYREG_USB_EP0_DR4 +.set USBFS_USB__EP0_DR5, CYREG_USB_EP0_DR5 +.set USBFS_USB__EP0_DR6, CYREG_USB_EP0_DR6 +.set USBFS_USB__EP0_DR7, CYREG_USB_EP0_DR7 +.set USBFS_USB__EP_ACTIVE, CYREG_USB_EP_ACTIVE +.set USBFS_USB__EP_TYPE, CYREG_USB_EP_TYPE +.set USBFS_USB__MEM_DATA, CYREG_USB_MEM_DATA_MBASE +.set USBFS_USB__PM_ACT_CFG, CYREG_PM_ACT_CFG5 +.set USBFS_USB__PM_ACT_MSK, 0x01 +.set USBFS_USB__PM_STBY_CFG, CYREG_PM_STBY_CFG5 +.set USBFS_USB__PM_STBY_MSK, 0x01 +.set USBFS_USB__SIE_EP1_CNT0, CYREG_USB_SIE_EP1_CNT0 +.set USBFS_USB__SIE_EP1_CNT1, CYREG_USB_SIE_EP1_CNT1 +.set USBFS_USB__SIE_EP1_CR0, CYREG_USB_SIE_EP1_CR0 +.set USBFS_USB__SIE_EP2_CNT0, CYREG_USB_SIE_EP2_CNT0 +.set USBFS_USB__SIE_EP2_CNT1, CYREG_USB_SIE_EP2_CNT1 +.set USBFS_USB__SIE_EP2_CR0, CYREG_USB_SIE_EP2_CR0 +.set USBFS_USB__SIE_EP3_CNT0, CYREG_USB_SIE_EP3_CNT0 +.set USBFS_USB__SIE_EP3_CNT1, CYREG_USB_SIE_EP3_CNT1 +.set USBFS_USB__SIE_EP3_CR0, CYREG_USB_SIE_EP3_CR0 +.set USBFS_USB__SIE_EP4_CNT0, CYREG_USB_SIE_EP4_CNT0 +.set USBFS_USB__SIE_EP4_CNT1, CYREG_USB_SIE_EP4_CNT1 +.set USBFS_USB__SIE_EP4_CR0, CYREG_USB_SIE_EP4_CR0 +.set USBFS_USB__SIE_EP5_CNT0, CYREG_USB_SIE_EP5_CNT0 +.set USBFS_USB__SIE_EP5_CNT1, CYREG_USB_SIE_EP5_CNT1 +.set USBFS_USB__SIE_EP5_CR0, CYREG_USB_SIE_EP5_CR0 +.set USBFS_USB__SIE_EP6_CNT0, CYREG_USB_SIE_EP6_CNT0 +.set USBFS_USB__SIE_EP6_CNT1, CYREG_USB_SIE_EP6_CNT1 +.set USBFS_USB__SIE_EP6_CR0, CYREG_USB_SIE_EP6_CR0 +.set USBFS_USB__SIE_EP7_CNT0, CYREG_USB_SIE_EP7_CNT0 +.set USBFS_USB__SIE_EP7_CNT1, CYREG_USB_SIE_EP7_CNT1 +.set USBFS_USB__SIE_EP7_CR0, CYREG_USB_SIE_EP7_CR0 +.set USBFS_USB__SIE_EP8_CNT0, CYREG_USB_SIE_EP8_CNT0 +.set USBFS_USB__SIE_EP8_CNT1, CYREG_USB_SIE_EP8_CNT1 +.set USBFS_USB__SIE_EP8_CR0, CYREG_USB_SIE_EP8_CR0 +.set USBFS_USB__SIE_EP_INT_EN, CYREG_USB_SIE_EP_INT_EN +.set USBFS_USB__SIE_EP_INT_SR, CYREG_USB_SIE_EP_INT_SR +.set USBFS_USB__SOF0, CYREG_USB_SOF0 +.set USBFS_USB__SOF1, CYREG_USB_SOF1 +.set USBFS_USB__USBIO_CR0, CYREG_USB_USBIO_CR0 +.set USBFS_USB__USBIO_CR1, CYREG_USB_USBIO_CR1 +.set USBFS_USB__USB_CLK_EN, CYREG_USB_USB_CLK_EN /* SCSI_ATN */ .set SCSI_ATN__0__MASK, 0x20 @@ -1960,6 +1904,72 @@ .set SCSI_RST__SLW, CYREG_PRT6_SLW .set SCSI_RST__SNAP, CYREG_PICU6_SNAP +/* USBFS_Dm */ +.set USBFS_Dm__0__MASK, 0x80 +.set USBFS_Dm__0__PC, CYREG_IO_PC_PRT15_7_6_PC1 +.set USBFS_Dm__0__PORT, 15 +.set USBFS_Dm__0__SHIFT, 7 +.set USBFS_Dm__AG, CYREG_PRT15_AG +.set USBFS_Dm__AMUX, CYREG_PRT15_AMUX +.set USBFS_Dm__BIE, CYREG_PRT15_BIE +.set USBFS_Dm__BIT_MASK, CYREG_PRT15_BIT_MASK +.set USBFS_Dm__BYP, CYREG_PRT15_BYP +.set USBFS_Dm__CTL, CYREG_PRT15_CTL +.set USBFS_Dm__DM0, CYREG_PRT15_DM0 +.set USBFS_Dm__DM1, CYREG_PRT15_DM1 +.set USBFS_Dm__DM2, CYREG_PRT15_DM2 +.set USBFS_Dm__DR, CYREG_PRT15_DR +.set USBFS_Dm__INP_DIS, CYREG_PRT15_INP_DIS +.set USBFS_Dm__LCD_COM_SEG, CYREG_PRT15_LCD_COM_SEG +.set USBFS_Dm__LCD_EN, CYREG_PRT15_LCD_EN +.set USBFS_Dm__MASK, 0x80 +.set USBFS_Dm__PORT, 15 +.set USBFS_Dm__PRT, CYREG_PRT15_PRT +.set USBFS_Dm__PRTDSI__CAPS_SEL, CYREG_PRT15_CAPS_SEL +.set USBFS_Dm__PRTDSI__DBL_SYNC_IN, CYREG_PRT15_DBL_SYNC_IN +.set USBFS_Dm__PRTDSI__OE_SEL0, CYREG_PRT15_OE_SEL0 +.set USBFS_Dm__PRTDSI__OE_SEL1, CYREG_PRT15_OE_SEL1 +.set USBFS_Dm__PRTDSI__OUT_SEL0, CYREG_PRT15_OUT_SEL0 +.set USBFS_Dm__PRTDSI__OUT_SEL1, CYREG_PRT15_OUT_SEL1 +.set USBFS_Dm__PRTDSI__SYNC_OUT, CYREG_PRT15_SYNC_OUT +.set USBFS_Dm__PS, CYREG_PRT15_PS +.set USBFS_Dm__SHIFT, 7 +.set USBFS_Dm__SLW, CYREG_PRT15_SLW + +/* USBFS_Dp */ +.set USBFS_Dp__0__MASK, 0x40 +.set USBFS_Dp__0__PC, CYREG_IO_PC_PRT15_7_6_PC0 +.set USBFS_Dp__0__PORT, 15 +.set USBFS_Dp__0__SHIFT, 6 +.set USBFS_Dp__AG, CYREG_PRT15_AG +.set USBFS_Dp__AMUX, CYREG_PRT15_AMUX +.set USBFS_Dp__BIE, CYREG_PRT15_BIE +.set USBFS_Dp__BIT_MASK, CYREG_PRT15_BIT_MASK +.set USBFS_Dp__BYP, CYREG_PRT15_BYP +.set USBFS_Dp__CTL, CYREG_PRT15_CTL +.set USBFS_Dp__DM0, CYREG_PRT15_DM0 +.set USBFS_Dp__DM1, CYREG_PRT15_DM1 +.set USBFS_Dp__DM2, CYREG_PRT15_DM2 +.set USBFS_Dp__DR, CYREG_PRT15_DR +.set USBFS_Dp__INP_DIS, CYREG_PRT15_INP_DIS +.set USBFS_Dp__INTSTAT, CYREG_PICU15_INTSTAT +.set USBFS_Dp__LCD_COM_SEG, CYREG_PRT15_LCD_COM_SEG +.set USBFS_Dp__LCD_EN, CYREG_PRT15_LCD_EN +.set USBFS_Dp__MASK, 0x40 +.set USBFS_Dp__PORT, 15 +.set USBFS_Dp__PRT, CYREG_PRT15_PRT +.set USBFS_Dp__PRTDSI__CAPS_SEL, CYREG_PRT15_CAPS_SEL +.set USBFS_Dp__PRTDSI__DBL_SYNC_IN, CYREG_PRT15_DBL_SYNC_IN +.set USBFS_Dp__PRTDSI__OE_SEL0, CYREG_PRT15_OE_SEL0 +.set USBFS_Dp__PRTDSI__OE_SEL1, CYREG_PRT15_OE_SEL1 +.set USBFS_Dp__PRTDSI__OUT_SEL0, CYREG_PRT15_OUT_SEL0 +.set USBFS_Dp__PRTDSI__OUT_SEL1, CYREG_PRT15_OUT_SEL1 +.set USBFS_Dp__PRTDSI__SYNC_OUT, CYREG_PRT15_SYNC_OUT +.set USBFS_Dp__PS, CYREG_PRT15_PS +.set USBFS_Dp__SHIFT, 6 +.set USBFS_Dp__SLW, CYREG_PRT15_SLW +.set USBFS_Dp__SNAP, CYREG_PICU_15_SNAP_15 + /* SCSI_In */ .set SCSI_In__0__AG, CYREG_PRT2_AG .set SCSI_In__0__AMUX, CYREG_PRT2_AMUX diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfitteriar.inc b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfitteriar.inc index 7f43e85..e4afa13 100755 --- a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfitteriar.inc +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfitteriar.inc @@ -3,45 +3,35 @@ INCLUDE cydeviceiar.inc INCLUDE cydeviceiar_trm.inc -/* USBFS_1_bus_reset */ -USBFS_1_bus_reset__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 -USBFS_1_bus_reset__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 -USBFS_1_bus_reset__INTC_MASK EQU 0x800000 -USBFS_1_bus_reset__INTC_NUMBER EQU 23 -USBFS_1_bus_reset__INTC_PRIOR_NUM EQU 7 -USBFS_1_bus_reset__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_23 -USBFS_1_bus_reset__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 -USBFS_1_bus_reset__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 +/* USBFS_bus_reset */ +USBFS_bus_reset__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 +USBFS_bus_reset__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 +USBFS_bus_reset__INTC_MASK EQU 0x800000 +USBFS_bus_reset__INTC_NUMBER EQU 23 +USBFS_bus_reset__INTC_PRIOR_NUM EQU 7 +USBFS_bus_reset__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_23 +USBFS_bus_reset__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 +USBFS_bus_reset__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 -/* USBFS_1_arb_int */ -USBFS_1_arb_int__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 -USBFS_1_arb_int__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 -USBFS_1_arb_int__INTC_MASK EQU 0x400000 -USBFS_1_arb_int__INTC_NUMBER EQU 22 -USBFS_1_arb_int__INTC_PRIOR_NUM EQU 7 -USBFS_1_arb_int__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_22 -USBFS_1_arb_int__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 -USBFS_1_arb_int__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 +/* USBFS_arb_int */ +USBFS_arb_int__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 +USBFS_arb_int__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 +USBFS_arb_int__INTC_MASK EQU 0x400000 +USBFS_arb_int__INTC_NUMBER EQU 22 +USBFS_arb_int__INTC_PRIOR_NUM EQU 7 +USBFS_arb_int__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_22 +USBFS_arb_int__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 +USBFS_arb_int__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 -/* USBFS_1_sof_int */ -USBFS_1_sof_int__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 -USBFS_1_sof_int__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 -USBFS_1_sof_int__INTC_MASK EQU 0x200000 -USBFS_1_sof_int__INTC_NUMBER EQU 21 -USBFS_1_sof_int__INTC_PRIOR_NUM EQU 7 -USBFS_1_sof_int__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_21 -USBFS_1_sof_int__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 -USBFS_1_sof_int__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 - -/* USBFS_1_dp_int */ -USBFS_1_dp_int__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 -USBFS_1_dp_int__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 -USBFS_1_dp_int__INTC_MASK EQU 0x1000 -USBFS_1_dp_int__INTC_NUMBER EQU 12 -USBFS_1_dp_int__INTC_PRIOR_NUM EQU 7 -USBFS_1_dp_int__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_12 -USBFS_1_dp_int__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 -USBFS_1_dp_int__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 +/* USBFS_sof_int */ +USBFS_sof_int__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 +USBFS_sof_int__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 +USBFS_sof_int__INTC_MASK EQU 0x200000 +USBFS_sof_int__INTC_NUMBER EQU 21 +USBFS_sof_int__INTC_PRIOR_NUM EQU 7 +USBFS_sof_int__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_21 +USBFS_sof_int__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 +USBFS_sof_int__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 /* SCSI_ATN_ISR */ SCSI_ATN_ISR__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 @@ -572,25 +562,15 @@ SDCard_BSPIM_sR8_Dp_u0__F1_REG EQU CYREG_B0_UDB07_F1 SDCard_BSPIM_sR8_Dp_u0__MSK_DP_AUX_CTL_REG EQU CYREG_B0_UDB07_MSK_ACTL SDCard_BSPIM_sR8_Dp_u0__PER_DP_AUX_CTL_REG EQU CYREG_B0_UDB07_MSK_ACTL -/* USBFS_1_ep_0 */ -USBFS_1_ep_0__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 -USBFS_1_ep_0__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 -USBFS_1_ep_0__INTC_MASK EQU 0x1000000 -USBFS_1_ep_0__INTC_NUMBER EQU 24 -USBFS_1_ep_0__INTC_PRIOR_NUM EQU 7 -USBFS_1_ep_0__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_24 -USBFS_1_ep_0__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 -USBFS_1_ep_0__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 - -/* USBFS_1_ep_1 */ -USBFS_1_ep_1__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 -USBFS_1_ep_1__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 -USBFS_1_ep_1__INTC_MASK EQU 0x01 -USBFS_1_ep_1__INTC_NUMBER EQU 0 -USBFS_1_ep_1__INTC_PRIOR_NUM EQU 7 -USBFS_1_ep_1__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_0 -USBFS_1_ep_1__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 -USBFS_1_ep_1__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 +/* USBFS_dp_int */ +USBFS_dp_int__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 +USBFS_dp_int__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 +USBFS_dp_int__INTC_MASK EQU 0x1000 +USBFS_dp_int__INTC_NUMBER EQU 12 +USBFS_dp_int__INTC_PRIOR_NUM EQU 7 +USBFS_dp_int__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_12 +USBFS_dp_int__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 +USBFS_dp_int__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 /* SCSI_CTL_IO */ SCSI_CTL_IO_Sync_ctrl_reg__0__MASK EQU 0x01 @@ -1068,132 +1048,6 @@ SD_Init_Clk__PM_ACT_MSK EQU 0x02 SD_Init_Clk__PM_STBY_CFG EQU CYREG_PM_STBY_CFG2 SD_Init_Clk__PM_STBY_MSK EQU 0x02 -/* USBFS_1_USB */ -USBFS_1_USB__ARB_CFG EQU CYREG_USB_ARB_CFG -USBFS_1_USB__ARB_EP1_CFG EQU CYREG_USB_ARB_EP1_CFG -USBFS_1_USB__ARB_EP1_INT_EN EQU CYREG_USB_ARB_EP1_INT_EN -USBFS_1_USB__ARB_EP1_SR EQU CYREG_USB_ARB_EP1_SR -USBFS_1_USB__ARB_EP2_CFG EQU CYREG_USB_ARB_EP2_CFG -USBFS_1_USB__ARB_EP2_INT_EN EQU CYREG_USB_ARB_EP2_INT_EN -USBFS_1_USB__ARB_EP2_SR EQU CYREG_USB_ARB_EP2_SR -USBFS_1_USB__ARB_EP3_CFG EQU CYREG_USB_ARB_EP3_CFG -USBFS_1_USB__ARB_EP3_INT_EN EQU CYREG_USB_ARB_EP3_INT_EN -USBFS_1_USB__ARB_EP3_SR EQU CYREG_USB_ARB_EP3_SR -USBFS_1_USB__ARB_EP4_CFG EQU CYREG_USB_ARB_EP4_CFG -USBFS_1_USB__ARB_EP4_INT_EN EQU CYREG_USB_ARB_EP4_INT_EN -USBFS_1_USB__ARB_EP4_SR EQU CYREG_USB_ARB_EP4_SR -USBFS_1_USB__ARB_EP5_CFG EQU CYREG_USB_ARB_EP5_CFG -USBFS_1_USB__ARB_EP5_INT_EN EQU CYREG_USB_ARB_EP5_INT_EN -USBFS_1_USB__ARB_EP5_SR EQU CYREG_USB_ARB_EP5_SR -USBFS_1_USB__ARB_EP6_CFG EQU CYREG_USB_ARB_EP6_CFG -USBFS_1_USB__ARB_EP6_INT_EN EQU CYREG_USB_ARB_EP6_INT_EN -USBFS_1_USB__ARB_EP6_SR EQU CYREG_USB_ARB_EP6_SR -USBFS_1_USB__ARB_EP7_CFG EQU CYREG_USB_ARB_EP7_CFG -USBFS_1_USB__ARB_EP7_INT_EN EQU CYREG_USB_ARB_EP7_INT_EN -USBFS_1_USB__ARB_EP7_SR EQU CYREG_USB_ARB_EP7_SR -USBFS_1_USB__ARB_EP8_CFG EQU CYREG_USB_ARB_EP8_CFG -USBFS_1_USB__ARB_EP8_INT_EN EQU CYREG_USB_ARB_EP8_INT_EN -USBFS_1_USB__ARB_EP8_SR EQU CYREG_USB_ARB_EP8_SR -USBFS_1_USB__ARB_INT_EN EQU CYREG_USB_ARB_INT_EN -USBFS_1_USB__ARB_INT_SR EQU CYREG_USB_ARB_INT_SR -USBFS_1_USB__ARB_RW1_DR EQU CYREG_USB_ARB_RW1_DR -USBFS_1_USB__ARB_RW1_RA EQU CYREG_USB_ARB_RW1_RA -USBFS_1_USB__ARB_RW1_RA_MSB EQU CYREG_USB_ARB_RW1_RA_MSB -USBFS_1_USB__ARB_RW1_WA EQU CYREG_USB_ARB_RW1_WA -USBFS_1_USB__ARB_RW1_WA_MSB EQU CYREG_USB_ARB_RW1_WA_MSB -USBFS_1_USB__ARB_RW2_DR EQU CYREG_USB_ARB_RW2_DR -USBFS_1_USB__ARB_RW2_RA EQU CYREG_USB_ARB_RW2_RA -USBFS_1_USB__ARB_RW2_RA_MSB EQU CYREG_USB_ARB_RW2_RA_MSB -USBFS_1_USB__ARB_RW2_WA EQU CYREG_USB_ARB_RW2_WA -USBFS_1_USB__ARB_RW2_WA_MSB EQU CYREG_USB_ARB_RW2_WA_MSB -USBFS_1_USB__ARB_RW3_DR EQU CYREG_USB_ARB_RW3_DR -USBFS_1_USB__ARB_RW3_RA EQU CYREG_USB_ARB_RW3_RA -USBFS_1_USB__ARB_RW3_RA_MSB EQU CYREG_USB_ARB_RW3_RA_MSB -USBFS_1_USB__ARB_RW3_WA EQU CYREG_USB_ARB_RW3_WA -USBFS_1_USB__ARB_RW3_WA_MSB EQU CYREG_USB_ARB_RW3_WA_MSB -USBFS_1_USB__ARB_RW4_DR EQU CYREG_USB_ARB_RW4_DR -USBFS_1_USB__ARB_RW4_RA EQU CYREG_USB_ARB_RW4_RA -USBFS_1_USB__ARB_RW4_RA_MSB EQU CYREG_USB_ARB_RW4_RA_MSB -USBFS_1_USB__ARB_RW4_WA EQU CYREG_USB_ARB_RW4_WA -USBFS_1_USB__ARB_RW4_WA_MSB EQU CYREG_USB_ARB_RW4_WA_MSB -USBFS_1_USB__ARB_RW5_DR EQU CYREG_USB_ARB_RW5_DR -USBFS_1_USB__ARB_RW5_RA EQU CYREG_USB_ARB_RW5_RA -USBFS_1_USB__ARB_RW5_RA_MSB EQU CYREG_USB_ARB_RW5_RA_MSB -USBFS_1_USB__ARB_RW5_WA EQU CYREG_USB_ARB_RW5_WA -USBFS_1_USB__ARB_RW5_WA_MSB EQU CYREG_USB_ARB_RW5_WA_MSB -USBFS_1_USB__ARB_RW6_DR EQU CYREG_USB_ARB_RW6_DR -USBFS_1_USB__ARB_RW6_RA EQU CYREG_USB_ARB_RW6_RA -USBFS_1_USB__ARB_RW6_RA_MSB EQU CYREG_USB_ARB_RW6_RA_MSB -USBFS_1_USB__ARB_RW6_WA EQU CYREG_USB_ARB_RW6_WA -USBFS_1_USB__ARB_RW6_WA_MSB EQU CYREG_USB_ARB_RW6_WA_MSB -USBFS_1_USB__ARB_RW7_DR EQU CYREG_USB_ARB_RW7_DR -USBFS_1_USB__ARB_RW7_RA EQU CYREG_USB_ARB_RW7_RA -USBFS_1_USB__ARB_RW7_RA_MSB EQU CYREG_USB_ARB_RW7_RA_MSB -USBFS_1_USB__ARB_RW7_WA EQU CYREG_USB_ARB_RW7_WA -USBFS_1_USB__ARB_RW7_WA_MSB EQU CYREG_USB_ARB_RW7_WA_MSB -USBFS_1_USB__ARB_RW8_DR EQU CYREG_USB_ARB_RW8_DR -USBFS_1_USB__ARB_RW8_RA EQU CYREG_USB_ARB_RW8_RA -USBFS_1_USB__ARB_RW8_RA_MSB EQU CYREG_USB_ARB_RW8_RA_MSB -USBFS_1_USB__ARB_RW8_WA EQU CYREG_USB_ARB_RW8_WA -USBFS_1_USB__ARB_RW8_WA_MSB EQU CYREG_USB_ARB_RW8_WA_MSB -USBFS_1_USB__BUF_SIZE EQU CYREG_USB_BUF_SIZE -USBFS_1_USB__BUS_RST_CNT EQU CYREG_USB_BUS_RST_CNT -USBFS_1_USB__CR0 EQU CYREG_USB_CR0 -USBFS_1_USB__CR1 EQU CYREG_USB_CR1 -USBFS_1_USB__CWA EQU CYREG_USB_CWA -USBFS_1_USB__CWA_MSB EQU CYREG_USB_CWA_MSB -USBFS_1_USB__DMA_THRES EQU CYREG_USB_DMA_THRES -USBFS_1_USB__DMA_THRES_MSB EQU CYREG_USB_DMA_THRES_MSB -USBFS_1_USB__DYN_RECONFIG EQU CYREG_USB_DYN_RECONFIG -USBFS_1_USB__EP0_CNT EQU CYREG_USB_EP0_CNT -USBFS_1_USB__EP0_CR EQU CYREG_USB_EP0_CR -USBFS_1_USB__EP0_DR0 EQU CYREG_USB_EP0_DR0 -USBFS_1_USB__EP0_DR1 EQU CYREG_USB_EP0_DR1 -USBFS_1_USB__EP0_DR2 EQU CYREG_USB_EP0_DR2 -USBFS_1_USB__EP0_DR3 EQU CYREG_USB_EP0_DR3 -USBFS_1_USB__EP0_DR4 EQU CYREG_USB_EP0_DR4 -USBFS_1_USB__EP0_DR5 EQU CYREG_USB_EP0_DR5 -USBFS_1_USB__EP0_DR6 EQU CYREG_USB_EP0_DR6 -USBFS_1_USB__EP0_DR7 EQU CYREG_USB_EP0_DR7 -USBFS_1_USB__EP_ACTIVE EQU CYREG_USB_EP_ACTIVE -USBFS_1_USB__EP_TYPE EQU CYREG_USB_EP_TYPE -USBFS_1_USB__MEM_DATA EQU CYREG_USB_MEM_DATA_MBASE -USBFS_1_USB__PM_ACT_CFG EQU CYREG_PM_ACT_CFG5 -USBFS_1_USB__PM_ACT_MSK EQU 0x01 -USBFS_1_USB__PM_STBY_CFG EQU CYREG_PM_STBY_CFG5 -USBFS_1_USB__PM_STBY_MSK EQU 0x01 -USBFS_1_USB__SIE_EP1_CNT0 EQU CYREG_USB_SIE_EP1_CNT0 -USBFS_1_USB__SIE_EP1_CNT1 EQU CYREG_USB_SIE_EP1_CNT1 -USBFS_1_USB__SIE_EP1_CR0 EQU CYREG_USB_SIE_EP1_CR0 -USBFS_1_USB__SIE_EP2_CNT0 EQU CYREG_USB_SIE_EP2_CNT0 -USBFS_1_USB__SIE_EP2_CNT1 EQU CYREG_USB_SIE_EP2_CNT1 -USBFS_1_USB__SIE_EP2_CR0 EQU CYREG_USB_SIE_EP2_CR0 -USBFS_1_USB__SIE_EP3_CNT0 EQU CYREG_USB_SIE_EP3_CNT0 -USBFS_1_USB__SIE_EP3_CNT1 EQU CYREG_USB_SIE_EP3_CNT1 -USBFS_1_USB__SIE_EP3_CR0 EQU CYREG_USB_SIE_EP3_CR0 -USBFS_1_USB__SIE_EP4_CNT0 EQU CYREG_USB_SIE_EP4_CNT0 -USBFS_1_USB__SIE_EP4_CNT1 EQU CYREG_USB_SIE_EP4_CNT1 -USBFS_1_USB__SIE_EP4_CR0 EQU CYREG_USB_SIE_EP4_CR0 -USBFS_1_USB__SIE_EP5_CNT0 EQU CYREG_USB_SIE_EP5_CNT0 -USBFS_1_USB__SIE_EP5_CNT1 EQU CYREG_USB_SIE_EP5_CNT1 -USBFS_1_USB__SIE_EP5_CR0 EQU CYREG_USB_SIE_EP5_CR0 -USBFS_1_USB__SIE_EP6_CNT0 EQU CYREG_USB_SIE_EP6_CNT0 -USBFS_1_USB__SIE_EP6_CNT1 EQU CYREG_USB_SIE_EP6_CNT1 -USBFS_1_USB__SIE_EP6_CR0 EQU CYREG_USB_SIE_EP6_CR0 -USBFS_1_USB__SIE_EP7_CNT0 EQU CYREG_USB_SIE_EP7_CNT0 -USBFS_1_USB__SIE_EP7_CNT1 EQU CYREG_USB_SIE_EP7_CNT1 -USBFS_1_USB__SIE_EP7_CR0 EQU CYREG_USB_SIE_EP7_CR0 -USBFS_1_USB__SIE_EP8_CNT0 EQU CYREG_USB_SIE_EP8_CNT0 -USBFS_1_USB__SIE_EP8_CNT1 EQU CYREG_USB_SIE_EP8_CNT1 -USBFS_1_USB__SIE_EP8_CR0 EQU CYREG_USB_SIE_EP8_CR0 -USBFS_1_USB__SIE_EP_INT_EN EQU CYREG_USB_SIE_EP_INT_EN -USBFS_1_USB__SIE_EP_INT_SR EQU CYREG_USB_SIE_EP_INT_SR -USBFS_1_USB__SOF0 EQU CYREG_USB_SOF0 -USBFS_1_USB__SOF1 EQU CYREG_USB_SOF1 -USBFS_1_USB__USBIO_CR0 EQU CYREG_USB_USBIO_CR0 -USBFS_1_USB__USBIO_CR1 EQU CYREG_USB_USBIO_CR1 -USBFS_1_USB__USB_CLK_EN EQU CYREG_USB_USB_CLK_EN - /* scsiTarget */ scsiTarget_StatusReg__0__MASK EQU 0x01 scsiTarget_StatusReg__0__POS EQU 0 @@ -1277,71 +1131,161 @@ SD_Clk_Ctl_Sync_ctrl_reg__MASK_CTL_AUX_CTL_REG EQU CYREG_B0_UDB01_MSK_ACTL SD_Clk_Ctl_Sync_ctrl_reg__PERIOD_REG EQU CYREG_B0_UDB01_MSK SD_Clk_Ctl_Sync_ctrl_reg__PER_CTL_AUX_CTL_REG EQU CYREG_B0_UDB01_MSK_ACTL -/* USBFS_1_Dm */ -USBFS_1_Dm__0__MASK EQU 0x80 -USBFS_1_Dm__0__PC EQU CYREG_IO_PC_PRT15_7_6_PC1 -USBFS_1_Dm__0__PORT EQU 15 -USBFS_1_Dm__0__SHIFT EQU 7 -USBFS_1_Dm__AG EQU CYREG_PRT15_AG -USBFS_1_Dm__AMUX EQU CYREG_PRT15_AMUX -USBFS_1_Dm__BIE EQU CYREG_PRT15_BIE -USBFS_1_Dm__BIT_MASK EQU CYREG_PRT15_BIT_MASK -USBFS_1_Dm__BYP EQU CYREG_PRT15_BYP -USBFS_1_Dm__CTL EQU CYREG_PRT15_CTL -USBFS_1_Dm__DM0 EQU CYREG_PRT15_DM0 -USBFS_1_Dm__DM1 EQU CYREG_PRT15_DM1 -USBFS_1_Dm__DM2 EQU CYREG_PRT15_DM2 -USBFS_1_Dm__DR EQU CYREG_PRT15_DR -USBFS_1_Dm__INP_DIS EQU CYREG_PRT15_INP_DIS -USBFS_1_Dm__LCD_COM_SEG EQU CYREG_PRT15_LCD_COM_SEG -USBFS_1_Dm__LCD_EN EQU CYREG_PRT15_LCD_EN -USBFS_1_Dm__MASK EQU 0x80 -USBFS_1_Dm__PORT EQU 15 -USBFS_1_Dm__PRT EQU CYREG_PRT15_PRT -USBFS_1_Dm__PRTDSI__CAPS_SEL EQU CYREG_PRT15_CAPS_SEL -USBFS_1_Dm__PRTDSI__DBL_SYNC_IN EQU CYREG_PRT15_DBL_SYNC_IN -USBFS_1_Dm__PRTDSI__OE_SEL0 EQU CYREG_PRT15_OE_SEL0 -USBFS_1_Dm__PRTDSI__OE_SEL1 EQU CYREG_PRT15_OE_SEL1 -USBFS_1_Dm__PRTDSI__OUT_SEL0 EQU CYREG_PRT15_OUT_SEL0 -USBFS_1_Dm__PRTDSI__OUT_SEL1 EQU CYREG_PRT15_OUT_SEL1 -USBFS_1_Dm__PRTDSI__SYNC_OUT EQU CYREG_PRT15_SYNC_OUT -USBFS_1_Dm__PS EQU CYREG_PRT15_PS -USBFS_1_Dm__SHIFT EQU 7 -USBFS_1_Dm__SLW EQU CYREG_PRT15_SLW +/* USBFS_ep_0 */ +USBFS_ep_0__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 +USBFS_ep_0__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 +USBFS_ep_0__INTC_MASK EQU 0x1000000 +USBFS_ep_0__INTC_NUMBER EQU 24 +USBFS_ep_0__INTC_PRIOR_NUM EQU 7 +USBFS_ep_0__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_24 +USBFS_ep_0__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 +USBFS_ep_0__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 + +/* USBFS_ep_1 */ +USBFS_ep_1__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 +USBFS_ep_1__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 +USBFS_ep_1__INTC_MASK EQU 0x01 +USBFS_ep_1__INTC_NUMBER EQU 0 +USBFS_ep_1__INTC_PRIOR_NUM EQU 7 +USBFS_ep_1__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_0 +USBFS_ep_1__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 +USBFS_ep_1__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 -/* USBFS_1_Dp */ -USBFS_1_Dp__0__MASK EQU 0x40 -USBFS_1_Dp__0__PC EQU CYREG_IO_PC_PRT15_7_6_PC0 -USBFS_1_Dp__0__PORT EQU 15 -USBFS_1_Dp__0__SHIFT EQU 6 -USBFS_1_Dp__AG EQU CYREG_PRT15_AG -USBFS_1_Dp__AMUX EQU CYREG_PRT15_AMUX -USBFS_1_Dp__BIE EQU CYREG_PRT15_BIE -USBFS_1_Dp__BIT_MASK EQU CYREG_PRT15_BIT_MASK -USBFS_1_Dp__BYP EQU CYREG_PRT15_BYP -USBFS_1_Dp__CTL EQU CYREG_PRT15_CTL -USBFS_1_Dp__DM0 EQU CYREG_PRT15_DM0 -USBFS_1_Dp__DM1 EQU CYREG_PRT15_DM1 -USBFS_1_Dp__DM2 EQU CYREG_PRT15_DM2 -USBFS_1_Dp__DR EQU CYREG_PRT15_DR -USBFS_1_Dp__INP_DIS EQU CYREG_PRT15_INP_DIS -USBFS_1_Dp__INTSTAT EQU CYREG_PICU15_INTSTAT -USBFS_1_Dp__LCD_COM_SEG EQU CYREG_PRT15_LCD_COM_SEG -USBFS_1_Dp__LCD_EN EQU CYREG_PRT15_LCD_EN -USBFS_1_Dp__MASK EQU 0x40 -USBFS_1_Dp__PORT EQU 15 -USBFS_1_Dp__PRT EQU CYREG_PRT15_PRT -USBFS_1_Dp__PRTDSI__CAPS_SEL EQU CYREG_PRT15_CAPS_SEL -USBFS_1_Dp__PRTDSI__DBL_SYNC_IN EQU CYREG_PRT15_DBL_SYNC_IN -USBFS_1_Dp__PRTDSI__OE_SEL0 EQU CYREG_PRT15_OE_SEL0 -USBFS_1_Dp__PRTDSI__OE_SEL1 EQU CYREG_PRT15_OE_SEL1 -USBFS_1_Dp__PRTDSI__OUT_SEL0 EQU CYREG_PRT15_OUT_SEL0 -USBFS_1_Dp__PRTDSI__OUT_SEL1 EQU CYREG_PRT15_OUT_SEL1 -USBFS_1_Dp__PRTDSI__SYNC_OUT EQU CYREG_PRT15_SYNC_OUT -USBFS_1_Dp__PS EQU CYREG_PRT15_PS -USBFS_1_Dp__SHIFT EQU 6 -USBFS_1_Dp__SLW EQU CYREG_PRT15_SLW -USBFS_1_Dp__SNAP EQU CYREG_PICU_15_SNAP_15 +/* USBFS_ep_2 */ +USBFS_ep_2__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 +USBFS_ep_2__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 +USBFS_ep_2__INTC_MASK EQU 0x02 +USBFS_ep_2__INTC_NUMBER EQU 1 +USBFS_ep_2__INTC_PRIOR_NUM EQU 7 +USBFS_ep_2__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_1 +USBFS_ep_2__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 +USBFS_ep_2__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 + +/* USBFS_USB */ +USBFS_USB__ARB_CFG EQU CYREG_USB_ARB_CFG +USBFS_USB__ARB_EP1_CFG EQU CYREG_USB_ARB_EP1_CFG +USBFS_USB__ARB_EP1_INT_EN EQU CYREG_USB_ARB_EP1_INT_EN +USBFS_USB__ARB_EP1_SR EQU CYREG_USB_ARB_EP1_SR +USBFS_USB__ARB_EP2_CFG EQU CYREG_USB_ARB_EP2_CFG +USBFS_USB__ARB_EP2_INT_EN EQU CYREG_USB_ARB_EP2_INT_EN +USBFS_USB__ARB_EP2_SR EQU CYREG_USB_ARB_EP2_SR +USBFS_USB__ARB_EP3_CFG EQU CYREG_USB_ARB_EP3_CFG +USBFS_USB__ARB_EP3_INT_EN EQU CYREG_USB_ARB_EP3_INT_EN +USBFS_USB__ARB_EP3_SR EQU CYREG_USB_ARB_EP3_SR +USBFS_USB__ARB_EP4_CFG EQU CYREG_USB_ARB_EP4_CFG +USBFS_USB__ARB_EP4_INT_EN EQU CYREG_USB_ARB_EP4_INT_EN +USBFS_USB__ARB_EP4_SR EQU CYREG_USB_ARB_EP4_SR +USBFS_USB__ARB_EP5_CFG EQU CYREG_USB_ARB_EP5_CFG +USBFS_USB__ARB_EP5_INT_EN EQU CYREG_USB_ARB_EP5_INT_EN +USBFS_USB__ARB_EP5_SR EQU CYREG_USB_ARB_EP5_SR +USBFS_USB__ARB_EP6_CFG EQU CYREG_USB_ARB_EP6_CFG +USBFS_USB__ARB_EP6_INT_EN EQU CYREG_USB_ARB_EP6_INT_EN +USBFS_USB__ARB_EP6_SR EQU CYREG_USB_ARB_EP6_SR +USBFS_USB__ARB_EP7_CFG EQU CYREG_USB_ARB_EP7_CFG +USBFS_USB__ARB_EP7_INT_EN EQU CYREG_USB_ARB_EP7_INT_EN +USBFS_USB__ARB_EP7_SR EQU CYREG_USB_ARB_EP7_SR +USBFS_USB__ARB_EP8_CFG EQU CYREG_USB_ARB_EP8_CFG +USBFS_USB__ARB_EP8_INT_EN EQU CYREG_USB_ARB_EP8_INT_EN +USBFS_USB__ARB_EP8_SR EQU CYREG_USB_ARB_EP8_SR +USBFS_USB__ARB_INT_EN EQU CYREG_USB_ARB_INT_EN +USBFS_USB__ARB_INT_SR EQU CYREG_USB_ARB_INT_SR +USBFS_USB__ARB_RW1_DR EQU CYREG_USB_ARB_RW1_DR +USBFS_USB__ARB_RW1_RA EQU CYREG_USB_ARB_RW1_RA +USBFS_USB__ARB_RW1_RA_MSB EQU CYREG_USB_ARB_RW1_RA_MSB +USBFS_USB__ARB_RW1_WA EQU CYREG_USB_ARB_RW1_WA +USBFS_USB__ARB_RW1_WA_MSB EQU CYREG_USB_ARB_RW1_WA_MSB +USBFS_USB__ARB_RW2_DR EQU CYREG_USB_ARB_RW2_DR +USBFS_USB__ARB_RW2_RA EQU CYREG_USB_ARB_RW2_RA +USBFS_USB__ARB_RW2_RA_MSB EQU CYREG_USB_ARB_RW2_RA_MSB +USBFS_USB__ARB_RW2_WA EQU CYREG_USB_ARB_RW2_WA +USBFS_USB__ARB_RW2_WA_MSB EQU CYREG_USB_ARB_RW2_WA_MSB +USBFS_USB__ARB_RW3_DR EQU CYREG_USB_ARB_RW3_DR +USBFS_USB__ARB_RW3_RA EQU CYREG_USB_ARB_RW3_RA +USBFS_USB__ARB_RW3_RA_MSB EQU CYREG_USB_ARB_RW3_RA_MSB +USBFS_USB__ARB_RW3_WA EQU CYREG_USB_ARB_RW3_WA +USBFS_USB__ARB_RW3_WA_MSB EQU CYREG_USB_ARB_RW3_WA_MSB +USBFS_USB__ARB_RW4_DR EQU CYREG_USB_ARB_RW4_DR +USBFS_USB__ARB_RW4_RA EQU CYREG_USB_ARB_RW4_RA +USBFS_USB__ARB_RW4_RA_MSB EQU CYREG_USB_ARB_RW4_RA_MSB +USBFS_USB__ARB_RW4_WA EQU CYREG_USB_ARB_RW4_WA +USBFS_USB__ARB_RW4_WA_MSB EQU CYREG_USB_ARB_RW4_WA_MSB +USBFS_USB__ARB_RW5_DR EQU CYREG_USB_ARB_RW5_DR +USBFS_USB__ARB_RW5_RA EQU CYREG_USB_ARB_RW5_RA +USBFS_USB__ARB_RW5_RA_MSB EQU CYREG_USB_ARB_RW5_RA_MSB +USBFS_USB__ARB_RW5_WA EQU CYREG_USB_ARB_RW5_WA +USBFS_USB__ARB_RW5_WA_MSB EQU CYREG_USB_ARB_RW5_WA_MSB +USBFS_USB__ARB_RW6_DR EQU CYREG_USB_ARB_RW6_DR +USBFS_USB__ARB_RW6_RA EQU CYREG_USB_ARB_RW6_RA +USBFS_USB__ARB_RW6_RA_MSB EQU CYREG_USB_ARB_RW6_RA_MSB +USBFS_USB__ARB_RW6_WA EQU CYREG_USB_ARB_RW6_WA +USBFS_USB__ARB_RW6_WA_MSB EQU CYREG_USB_ARB_RW6_WA_MSB +USBFS_USB__ARB_RW7_DR EQU CYREG_USB_ARB_RW7_DR +USBFS_USB__ARB_RW7_RA EQU CYREG_USB_ARB_RW7_RA +USBFS_USB__ARB_RW7_RA_MSB EQU CYREG_USB_ARB_RW7_RA_MSB +USBFS_USB__ARB_RW7_WA EQU CYREG_USB_ARB_RW7_WA +USBFS_USB__ARB_RW7_WA_MSB EQU CYREG_USB_ARB_RW7_WA_MSB +USBFS_USB__ARB_RW8_DR EQU CYREG_USB_ARB_RW8_DR +USBFS_USB__ARB_RW8_RA EQU CYREG_USB_ARB_RW8_RA +USBFS_USB__ARB_RW8_RA_MSB EQU CYREG_USB_ARB_RW8_RA_MSB +USBFS_USB__ARB_RW8_WA EQU CYREG_USB_ARB_RW8_WA +USBFS_USB__ARB_RW8_WA_MSB EQU CYREG_USB_ARB_RW8_WA_MSB +USBFS_USB__BUF_SIZE EQU CYREG_USB_BUF_SIZE +USBFS_USB__BUS_RST_CNT EQU CYREG_USB_BUS_RST_CNT +USBFS_USB__CR0 EQU CYREG_USB_CR0 +USBFS_USB__CR1 EQU CYREG_USB_CR1 +USBFS_USB__CWA EQU CYREG_USB_CWA +USBFS_USB__CWA_MSB EQU CYREG_USB_CWA_MSB +USBFS_USB__DMA_THRES EQU CYREG_USB_DMA_THRES +USBFS_USB__DMA_THRES_MSB EQU CYREG_USB_DMA_THRES_MSB +USBFS_USB__DYN_RECONFIG EQU CYREG_USB_DYN_RECONFIG +USBFS_USB__EP0_CNT EQU CYREG_USB_EP0_CNT +USBFS_USB__EP0_CR EQU CYREG_USB_EP0_CR +USBFS_USB__EP0_DR0 EQU CYREG_USB_EP0_DR0 +USBFS_USB__EP0_DR1 EQU CYREG_USB_EP0_DR1 +USBFS_USB__EP0_DR2 EQU CYREG_USB_EP0_DR2 +USBFS_USB__EP0_DR3 EQU CYREG_USB_EP0_DR3 +USBFS_USB__EP0_DR4 EQU CYREG_USB_EP0_DR4 +USBFS_USB__EP0_DR5 EQU CYREG_USB_EP0_DR5 +USBFS_USB__EP0_DR6 EQU CYREG_USB_EP0_DR6 +USBFS_USB__EP0_DR7 EQU CYREG_USB_EP0_DR7 +USBFS_USB__EP_ACTIVE EQU CYREG_USB_EP_ACTIVE +USBFS_USB__EP_TYPE EQU CYREG_USB_EP_TYPE +USBFS_USB__MEM_DATA EQU CYREG_USB_MEM_DATA_MBASE +USBFS_USB__PM_ACT_CFG EQU CYREG_PM_ACT_CFG5 +USBFS_USB__PM_ACT_MSK EQU 0x01 +USBFS_USB__PM_STBY_CFG EQU CYREG_PM_STBY_CFG5 +USBFS_USB__PM_STBY_MSK EQU 0x01 +USBFS_USB__SIE_EP1_CNT0 EQU CYREG_USB_SIE_EP1_CNT0 +USBFS_USB__SIE_EP1_CNT1 EQU CYREG_USB_SIE_EP1_CNT1 +USBFS_USB__SIE_EP1_CR0 EQU CYREG_USB_SIE_EP1_CR0 +USBFS_USB__SIE_EP2_CNT0 EQU CYREG_USB_SIE_EP2_CNT0 +USBFS_USB__SIE_EP2_CNT1 EQU CYREG_USB_SIE_EP2_CNT1 +USBFS_USB__SIE_EP2_CR0 EQU CYREG_USB_SIE_EP2_CR0 +USBFS_USB__SIE_EP3_CNT0 EQU CYREG_USB_SIE_EP3_CNT0 +USBFS_USB__SIE_EP3_CNT1 EQU CYREG_USB_SIE_EP3_CNT1 +USBFS_USB__SIE_EP3_CR0 EQU CYREG_USB_SIE_EP3_CR0 +USBFS_USB__SIE_EP4_CNT0 EQU CYREG_USB_SIE_EP4_CNT0 +USBFS_USB__SIE_EP4_CNT1 EQU CYREG_USB_SIE_EP4_CNT1 +USBFS_USB__SIE_EP4_CR0 EQU CYREG_USB_SIE_EP4_CR0 +USBFS_USB__SIE_EP5_CNT0 EQU CYREG_USB_SIE_EP5_CNT0 +USBFS_USB__SIE_EP5_CNT1 EQU CYREG_USB_SIE_EP5_CNT1 +USBFS_USB__SIE_EP5_CR0 EQU CYREG_USB_SIE_EP5_CR0 +USBFS_USB__SIE_EP6_CNT0 EQU CYREG_USB_SIE_EP6_CNT0 +USBFS_USB__SIE_EP6_CNT1 EQU CYREG_USB_SIE_EP6_CNT1 +USBFS_USB__SIE_EP6_CR0 EQU CYREG_USB_SIE_EP6_CR0 +USBFS_USB__SIE_EP7_CNT0 EQU CYREG_USB_SIE_EP7_CNT0 +USBFS_USB__SIE_EP7_CNT1 EQU CYREG_USB_SIE_EP7_CNT1 +USBFS_USB__SIE_EP7_CR0 EQU CYREG_USB_SIE_EP7_CR0 +USBFS_USB__SIE_EP8_CNT0 EQU CYREG_USB_SIE_EP8_CNT0 +USBFS_USB__SIE_EP8_CNT1 EQU CYREG_USB_SIE_EP8_CNT1 +USBFS_USB__SIE_EP8_CR0 EQU CYREG_USB_SIE_EP8_CR0 +USBFS_USB__SIE_EP_INT_EN EQU CYREG_USB_SIE_EP_INT_EN +USBFS_USB__SIE_EP_INT_SR EQU CYREG_USB_SIE_EP_INT_SR +USBFS_USB__SOF0 EQU CYREG_USB_SOF0 +USBFS_USB__SOF1 EQU CYREG_USB_SOF1 +USBFS_USB__USBIO_CR0 EQU CYREG_USB_USBIO_CR0 +USBFS_USB__USBIO_CR1 EQU CYREG_USB_USBIO_CR1 +USBFS_USB__USB_CLK_EN EQU CYREG_USB_USB_CLK_EN /* SCSI_ATN */ SCSI_ATN__0__MASK EQU 0x20 @@ -1960,6 +1904,72 @@ SCSI_RST__SHIFT EQU 6 SCSI_RST__SLW EQU CYREG_PRT6_SLW SCSI_RST__SNAP EQU CYREG_PICU6_SNAP +/* USBFS_Dm */ +USBFS_Dm__0__MASK EQU 0x80 +USBFS_Dm__0__PC EQU CYREG_IO_PC_PRT15_7_6_PC1 +USBFS_Dm__0__PORT EQU 15 +USBFS_Dm__0__SHIFT EQU 7 +USBFS_Dm__AG EQU CYREG_PRT15_AG +USBFS_Dm__AMUX EQU CYREG_PRT15_AMUX +USBFS_Dm__BIE EQU CYREG_PRT15_BIE +USBFS_Dm__BIT_MASK EQU CYREG_PRT15_BIT_MASK +USBFS_Dm__BYP EQU CYREG_PRT15_BYP +USBFS_Dm__CTL EQU CYREG_PRT15_CTL +USBFS_Dm__DM0 EQU CYREG_PRT15_DM0 +USBFS_Dm__DM1 EQU CYREG_PRT15_DM1 +USBFS_Dm__DM2 EQU CYREG_PRT15_DM2 +USBFS_Dm__DR EQU CYREG_PRT15_DR +USBFS_Dm__INP_DIS EQU CYREG_PRT15_INP_DIS +USBFS_Dm__LCD_COM_SEG EQU CYREG_PRT15_LCD_COM_SEG +USBFS_Dm__LCD_EN EQU CYREG_PRT15_LCD_EN +USBFS_Dm__MASK EQU 0x80 +USBFS_Dm__PORT EQU 15 +USBFS_Dm__PRT EQU CYREG_PRT15_PRT +USBFS_Dm__PRTDSI__CAPS_SEL EQU CYREG_PRT15_CAPS_SEL +USBFS_Dm__PRTDSI__DBL_SYNC_IN EQU CYREG_PRT15_DBL_SYNC_IN +USBFS_Dm__PRTDSI__OE_SEL0 EQU CYREG_PRT15_OE_SEL0 +USBFS_Dm__PRTDSI__OE_SEL1 EQU CYREG_PRT15_OE_SEL1 +USBFS_Dm__PRTDSI__OUT_SEL0 EQU CYREG_PRT15_OUT_SEL0 +USBFS_Dm__PRTDSI__OUT_SEL1 EQU CYREG_PRT15_OUT_SEL1 +USBFS_Dm__PRTDSI__SYNC_OUT EQU CYREG_PRT15_SYNC_OUT +USBFS_Dm__PS EQU CYREG_PRT15_PS +USBFS_Dm__SHIFT EQU 7 +USBFS_Dm__SLW EQU CYREG_PRT15_SLW + +/* USBFS_Dp */ +USBFS_Dp__0__MASK EQU 0x40 +USBFS_Dp__0__PC EQU CYREG_IO_PC_PRT15_7_6_PC0 +USBFS_Dp__0__PORT EQU 15 +USBFS_Dp__0__SHIFT EQU 6 +USBFS_Dp__AG EQU CYREG_PRT15_AG +USBFS_Dp__AMUX EQU CYREG_PRT15_AMUX +USBFS_Dp__BIE EQU CYREG_PRT15_BIE +USBFS_Dp__BIT_MASK EQU CYREG_PRT15_BIT_MASK +USBFS_Dp__BYP EQU CYREG_PRT15_BYP +USBFS_Dp__CTL EQU CYREG_PRT15_CTL +USBFS_Dp__DM0 EQU CYREG_PRT15_DM0 +USBFS_Dp__DM1 EQU CYREG_PRT15_DM1 +USBFS_Dp__DM2 EQU CYREG_PRT15_DM2 +USBFS_Dp__DR EQU CYREG_PRT15_DR +USBFS_Dp__INP_DIS EQU CYREG_PRT15_INP_DIS +USBFS_Dp__INTSTAT EQU CYREG_PICU15_INTSTAT +USBFS_Dp__LCD_COM_SEG EQU CYREG_PRT15_LCD_COM_SEG +USBFS_Dp__LCD_EN EQU CYREG_PRT15_LCD_EN +USBFS_Dp__MASK EQU 0x40 +USBFS_Dp__PORT EQU 15 +USBFS_Dp__PRT EQU CYREG_PRT15_PRT +USBFS_Dp__PRTDSI__CAPS_SEL EQU CYREG_PRT15_CAPS_SEL +USBFS_Dp__PRTDSI__DBL_SYNC_IN EQU CYREG_PRT15_DBL_SYNC_IN +USBFS_Dp__PRTDSI__OE_SEL0 EQU CYREG_PRT15_OE_SEL0 +USBFS_Dp__PRTDSI__OE_SEL1 EQU CYREG_PRT15_OE_SEL1 +USBFS_Dp__PRTDSI__OUT_SEL0 EQU CYREG_PRT15_OUT_SEL0 +USBFS_Dp__PRTDSI__OUT_SEL1 EQU CYREG_PRT15_OUT_SEL1 +USBFS_Dp__PRTDSI__SYNC_OUT EQU CYREG_PRT15_SYNC_OUT +USBFS_Dp__PS EQU CYREG_PRT15_PS +USBFS_Dp__SHIFT EQU 6 +USBFS_Dp__SLW EQU CYREG_PRT15_SLW +USBFS_Dp__SNAP EQU CYREG_PICU_15_SNAP_15 + /* SCSI_In */ SCSI_In__0__AG EQU CYREG_PRT2_AG SCSI_In__0__AMUX EQU CYREG_PRT2_AMUX diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfitterrv.inc b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfitterrv.inc index d0378d2..bb7ab3a 100755 --- a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfitterrv.inc +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/cyfitterrv.inc @@ -3,45 +3,35 @@ INCLUDED_CYFITTERRV_INC EQU 1 GET cydevicerv.inc GET cydevicerv_trm.inc -; USBFS_1_bus_reset -USBFS_1_bus_reset__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 -USBFS_1_bus_reset__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 -USBFS_1_bus_reset__INTC_MASK EQU 0x800000 -USBFS_1_bus_reset__INTC_NUMBER EQU 23 -USBFS_1_bus_reset__INTC_PRIOR_NUM EQU 7 -USBFS_1_bus_reset__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_23 -USBFS_1_bus_reset__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 -USBFS_1_bus_reset__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 +; USBFS_bus_reset +USBFS_bus_reset__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 +USBFS_bus_reset__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 +USBFS_bus_reset__INTC_MASK EQU 0x800000 +USBFS_bus_reset__INTC_NUMBER EQU 23 +USBFS_bus_reset__INTC_PRIOR_NUM EQU 7 +USBFS_bus_reset__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_23 +USBFS_bus_reset__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 +USBFS_bus_reset__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 -; USBFS_1_arb_int -USBFS_1_arb_int__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 -USBFS_1_arb_int__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 -USBFS_1_arb_int__INTC_MASK EQU 0x400000 -USBFS_1_arb_int__INTC_NUMBER EQU 22 -USBFS_1_arb_int__INTC_PRIOR_NUM EQU 7 -USBFS_1_arb_int__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_22 -USBFS_1_arb_int__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 -USBFS_1_arb_int__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 +; USBFS_arb_int +USBFS_arb_int__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 +USBFS_arb_int__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 +USBFS_arb_int__INTC_MASK EQU 0x400000 +USBFS_arb_int__INTC_NUMBER EQU 22 +USBFS_arb_int__INTC_PRIOR_NUM EQU 7 +USBFS_arb_int__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_22 +USBFS_arb_int__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 +USBFS_arb_int__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 -; USBFS_1_sof_int -USBFS_1_sof_int__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 -USBFS_1_sof_int__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 -USBFS_1_sof_int__INTC_MASK EQU 0x200000 -USBFS_1_sof_int__INTC_NUMBER EQU 21 -USBFS_1_sof_int__INTC_PRIOR_NUM EQU 7 -USBFS_1_sof_int__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_21 -USBFS_1_sof_int__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 -USBFS_1_sof_int__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 - -; USBFS_1_dp_int -USBFS_1_dp_int__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 -USBFS_1_dp_int__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 -USBFS_1_dp_int__INTC_MASK EQU 0x1000 -USBFS_1_dp_int__INTC_NUMBER EQU 12 -USBFS_1_dp_int__INTC_PRIOR_NUM EQU 7 -USBFS_1_dp_int__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_12 -USBFS_1_dp_int__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 -USBFS_1_dp_int__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 +; USBFS_sof_int +USBFS_sof_int__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 +USBFS_sof_int__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 +USBFS_sof_int__INTC_MASK EQU 0x200000 +USBFS_sof_int__INTC_NUMBER EQU 21 +USBFS_sof_int__INTC_PRIOR_NUM EQU 7 +USBFS_sof_int__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_21 +USBFS_sof_int__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 +USBFS_sof_int__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 ; SCSI_ATN_ISR SCSI_ATN_ISR__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 @@ -572,25 +562,15 @@ SDCard_BSPIM_sR8_Dp_u0__F1_REG EQU CYREG_B0_UDB07_F1 SDCard_BSPIM_sR8_Dp_u0__MSK_DP_AUX_CTL_REG EQU CYREG_B0_UDB07_MSK_ACTL SDCard_BSPIM_sR8_Dp_u0__PER_DP_AUX_CTL_REG EQU CYREG_B0_UDB07_MSK_ACTL -; USBFS_1_ep_0 -USBFS_1_ep_0__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 -USBFS_1_ep_0__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 -USBFS_1_ep_0__INTC_MASK EQU 0x1000000 -USBFS_1_ep_0__INTC_NUMBER EQU 24 -USBFS_1_ep_0__INTC_PRIOR_NUM EQU 7 -USBFS_1_ep_0__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_24 -USBFS_1_ep_0__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 -USBFS_1_ep_0__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 - -; USBFS_1_ep_1 -USBFS_1_ep_1__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 -USBFS_1_ep_1__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 -USBFS_1_ep_1__INTC_MASK EQU 0x01 -USBFS_1_ep_1__INTC_NUMBER EQU 0 -USBFS_1_ep_1__INTC_PRIOR_NUM EQU 7 -USBFS_1_ep_1__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_0 -USBFS_1_ep_1__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 -USBFS_1_ep_1__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 +; USBFS_dp_int +USBFS_dp_int__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 +USBFS_dp_int__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 +USBFS_dp_int__INTC_MASK EQU 0x1000 +USBFS_dp_int__INTC_NUMBER EQU 12 +USBFS_dp_int__INTC_PRIOR_NUM EQU 7 +USBFS_dp_int__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_12 +USBFS_dp_int__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 +USBFS_dp_int__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 ; SCSI_CTL_IO SCSI_CTL_IO_Sync_ctrl_reg__0__MASK EQU 0x01 @@ -1068,132 +1048,6 @@ SD_Init_Clk__PM_ACT_MSK EQU 0x02 SD_Init_Clk__PM_STBY_CFG EQU CYREG_PM_STBY_CFG2 SD_Init_Clk__PM_STBY_MSK EQU 0x02 -; USBFS_1_USB -USBFS_1_USB__ARB_CFG EQU CYREG_USB_ARB_CFG -USBFS_1_USB__ARB_EP1_CFG EQU CYREG_USB_ARB_EP1_CFG -USBFS_1_USB__ARB_EP1_INT_EN EQU CYREG_USB_ARB_EP1_INT_EN -USBFS_1_USB__ARB_EP1_SR EQU CYREG_USB_ARB_EP1_SR -USBFS_1_USB__ARB_EP2_CFG EQU CYREG_USB_ARB_EP2_CFG -USBFS_1_USB__ARB_EP2_INT_EN EQU CYREG_USB_ARB_EP2_INT_EN -USBFS_1_USB__ARB_EP2_SR EQU CYREG_USB_ARB_EP2_SR -USBFS_1_USB__ARB_EP3_CFG EQU CYREG_USB_ARB_EP3_CFG -USBFS_1_USB__ARB_EP3_INT_EN EQU CYREG_USB_ARB_EP3_INT_EN -USBFS_1_USB__ARB_EP3_SR EQU CYREG_USB_ARB_EP3_SR -USBFS_1_USB__ARB_EP4_CFG EQU CYREG_USB_ARB_EP4_CFG -USBFS_1_USB__ARB_EP4_INT_EN EQU CYREG_USB_ARB_EP4_INT_EN -USBFS_1_USB__ARB_EP4_SR EQU CYREG_USB_ARB_EP4_SR -USBFS_1_USB__ARB_EP5_CFG EQU CYREG_USB_ARB_EP5_CFG -USBFS_1_USB__ARB_EP5_INT_EN EQU CYREG_USB_ARB_EP5_INT_EN -USBFS_1_USB__ARB_EP5_SR EQU CYREG_USB_ARB_EP5_SR -USBFS_1_USB__ARB_EP6_CFG EQU CYREG_USB_ARB_EP6_CFG -USBFS_1_USB__ARB_EP6_INT_EN EQU CYREG_USB_ARB_EP6_INT_EN -USBFS_1_USB__ARB_EP6_SR EQU CYREG_USB_ARB_EP6_SR -USBFS_1_USB__ARB_EP7_CFG EQU CYREG_USB_ARB_EP7_CFG -USBFS_1_USB__ARB_EP7_INT_EN EQU CYREG_USB_ARB_EP7_INT_EN -USBFS_1_USB__ARB_EP7_SR EQU CYREG_USB_ARB_EP7_SR -USBFS_1_USB__ARB_EP8_CFG EQU CYREG_USB_ARB_EP8_CFG -USBFS_1_USB__ARB_EP8_INT_EN EQU CYREG_USB_ARB_EP8_INT_EN -USBFS_1_USB__ARB_EP8_SR EQU CYREG_USB_ARB_EP8_SR -USBFS_1_USB__ARB_INT_EN EQU CYREG_USB_ARB_INT_EN -USBFS_1_USB__ARB_INT_SR EQU CYREG_USB_ARB_INT_SR -USBFS_1_USB__ARB_RW1_DR EQU CYREG_USB_ARB_RW1_DR -USBFS_1_USB__ARB_RW1_RA EQU CYREG_USB_ARB_RW1_RA -USBFS_1_USB__ARB_RW1_RA_MSB EQU CYREG_USB_ARB_RW1_RA_MSB -USBFS_1_USB__ARB_RW1_WA EQU CYREG_USB_ARB_RW1_WA -USBFS_1_USB__ARB_RW1_WA_MSB EQU CYREG_USB_ARB_RW1_WA_MSB -USBFS_1_USB__ARB_RW2_DR EQU CYREG_USB_ARB_RW2_DR -USBFS_1_USB__ARB_RW2_RA EQU CYREG_USB_ARB_RW2_RA -USBFS_1_USB__ARB_RW2_RA_MSB EQU CYREG_USB_ARB_RW2_RA_MSB -USBFS_1_USB__ARB_RW2_WA EQU CYREG_USB_ARB_RW2_WA -USBFS_1_USB__ARB_RW2_WA_MSB EQU CYREG_USB_ARB_RW2_WA_MSB -USBFS_1_USB__ARB_RW3_DR EQU CYREG_USB_ARB_RW3_DR -USBFS_1_USB__ARB_RW3_RA EQU CYREG_USB_ARB_RW3_RA -USBFS_1_USB__ARB_RW3_RA_MSB EQU CYREG_USB_ARB_RW3_RA_MSB -USBFS_1_USB__ARB_RW3_WA EQU CYREG_USB_ARB_RW3_WA -USBFS_1_USB__ARB_RW3_WA_MSB EQU CYREG_USB_ARB_RW3_WA_MSB -USBFS_1_USB__ARB_RW4_DR EQU CYREG_USB_ARB_RW4_DR -USBFS_1_USB__ARB_RW4_RA EQU CYREG_USB_ARB_RW4_RA -USBFS_1_USB__ARB_RW4_RA_MSB EQU CYREG_USB_ARB_RW4_RA_MSB -USBFS_1_USB__ARB_RW4_WA EQU CYREG_USB_ARB_RW4_WA -USBFS_1_USB__ARB_RW4_WA_MSB EQU CYREG_USB_ARB_RW4_WA_MSB -USBFS_1_USB__ARB_RW5_DR EQU CYREG_USB_ARB_RW5_DR -USBFS_1_USB__ARB_RW5_RA EQU CYREG_USB_ARB_RW5_RA -USBFS_1_USB__ARB_RW5_RA_MSB EQU CYREG_USB_ARB_RW5_RA_MSB -USBFS_1_USB__ARB_RW5_WA EQU CYREG_USB_ARB_RW5_WA -USBFS_1_USB__ARB_RW5_WA_MSB EQU CYREG_USB_ARB_RW5_WA_MSB -USBFS_1_USB__ARB_RW6_DR EQU CYREG_USB_ARB_RW6_DR -USBFS_1_USB__ARB_RW6_RA EQU CYREG_USB_ARB_RW6_RA -USBFS_1_USB__ARB_RW6_RA_MSB EQU CYREG_USB_ARB_RW6_RA_MSB -USBFS_1_USB__ARB_RW6_WA EQU CYREG_USB_ARB_RW6_WA -USBFS_1_USB__ARB_RW6_WA_MSB EQU CYREG_USB_ARB_RW6_WA_MSB -USBFS_1_USB__ARB_RW7_DR EQU CYREG_USB_ARB_RW7_DR -USBFS_1_USB__ARB_RW7_RA EQU CYREG_USB_ARB_RW7_RA -USBFS_1_USB__ARB_RW7_RA_MSB EQU CYREG_USB_ARB_RW7_RA_MSB -USBFS_1_USB__ARB_RW7_WA EQU CYREG_USB_ARB_RW7_WA -USBFS_1_USB__ARB_RW7_WA_MSB EQU CYREG_USB_ARB_RW7_WA_MSB -USBFS_1_USB__ARB_RW8_DR EQU CYREG_USB_ARB_RW8_DR -USBFS_1_USB__ARB_RW8_RA EQU CYREG_USB_ARB_RW8_RA -USBFS_1_USB__ARB_RW8_RA_MSB EQU CYREG_USB_ARB_RW8_RA_MSB -USBFS_1_USB__ARB_RW8_WA EQU CYREG_USB_ARB_RW8_WA -USBFS_1_USB__ARB_RW8_WA_MSB EQU CYREG_USB_ARB_RW8_WA_MSB -USBFS_1_USB__BUF_SIZE EQU CYREG_USB_BUF_SIZE -USBFS_1_USB__BUS_RST_CNT EQU CYREG_USB_BUS_RST_CNT -USBFS_1_USB__CR0 EQU CYREG_USB_CR0 -USBFS_1_USB__CR1 EQU CYREG_USB_CR1 -USBFS_1_USB__CWA EQU CYREG_USB_CWA -USBFS_1_USB__CWA_MSB EQU CYREG_USB_CWA_MSB -USBFS_1_USB__DMA_THRES EQU CYREG_USB_DMA_THRES -USBFS_1_USB__DMA_THRES_MSB EQU CYREG_USB_DMA_THRES_MSB -USBFS_1_USB__DYN_RECONFIG EQU CYREG_USB_DYN_RECONFIG -USBFS_1_USB__EP0_CNT EQU CYREG_USB_EP0_CNT -USBFS_1_USB__EP0_CR EQU CYREG_USB_EP0_CR -USBFS_1_USB__EP0_DR0 EQU CYREG_USB_EP0_DR0 -USBFS_1_USB__EP0_DR1 EQU CYREG_USB_EP0_DR1 -USBFS_1_USB__EP0_DR2 EQU CYREG_USB_EP0_DR2 -USBFS_1_USB__EP0_DR3 EQU CYREG_USB_EP0_DR3 -USBFS_1_USB__EP0_DR4 EQU CYREG_USB_EP0_DR4 -USBFS_1_USB__EP0_DR5 EQU CYREG_USB_EP0_DR5 -USBFS_1_USB__EP0_DR6 EQU CYREG_USB_EP0_DR6 -USBFS_1_USB__EP0_DR7 EQU CYREG_USB_EP0_DR7 -USBFS_1_USB__EP_ACTIVE EQU CYREG_USB_EP_ACTIVE -USBFS_1_USB__EP_TYPE EQU CYREG_USB_EP_TYPE -USBFS_1_USB__MEM_DATA EQU CYREG_USB_MEM_DATA_MBASE -USBFS_1_USB__PM_ACT_CFG EQU CYREG_PM_ACT_CFG5 -USBFS_1_USB__PM_ACT_MSK EQU 0x01 -USBFS_1_USB__PM_STBY_CFG EQU CYREG_PM_STBY_CFG5 -USBFS_1_USB__PM_STBY_MSK EQU 0x01 -USBFS_1_USB__SIE_EP1_CNT0 EQU CYREG_USB_SIE_EP1_CNT0 -USBFS_1_USB__SIE_EP1_CNT1 EQU CYREG_USB_SIE_EP1_CNT1 -USBFS_1_USB__SIE_EP1_CR0 EQU CYREG_USB_SIE_EP1_CR0 -USBFS_1_USB__SIE_EP2_CNT0 EQU CYREG_USB_SIE_EP2_CNT0 -USBFS_1_USB__SIE_EP2_CNT1 EQU CYREG_USB_SIE_EP2_CNT1 -USBFS_1_USB__SIE_EP2_CR0 EQU CYREG_USB_SIE_EP2_CR0 -USBFS_1_USB__SIE_EP3_CNT0 EQU CYREG_USB_SIE_EP3_CNT0 -USBFS_1_USB__SIE_EP3_CNT1 EQU CYREG_USB_SIE_EP3_CNT1 -USBFS_1_USB__SIE_EP3_CR0 EQU CYREG_USB_SIE_EP3_CR0 -USBFS_1_USB__SIE_EP4_CNT0 EQU CYREG_USB_SIE_EP4_CNT0 -USBFS_1_USB__SIE_EP4_CNT1 EQU CYREG_USB_SIE_EP4_CNT1 -USBFS_1_USB__SIE_EP4_CR0 EQU CYREG_USB_SIE_EP4_CR0 -USBFS_1_USB__SIE_EP5_CNT0 EQU CYREG_USB_SIE_EP5_CNT0 -USBFS_1_USB__SIE_EP5_CNT1 EQU CYREG_USB_SIE_EP5_CNT1 -USBFS_1_USB__SIE_EP5_CR0 EQU CYREG_USB_SIE_EP5_CR0 -USBFS_1_USB__SIE_EP6_CNT0 EQU CYREG_USB_SIE_EP6_CNT0 -USBFS_1_USB__SIE_EP6_CNT1 EQU CYREG_USB_SIE_EP6_CNT1 -USBFS_1_USB__SIE_EP6_CR0 EQU CYREG_USB_SIE_EP6_CR0 -USBFS_1_USB__SIE_EP7_CNT0 EQU CYREG_USB_SIE_EP7_CNT0 -USBFS_1_USB__SIE_EP7_CNT1 EQU CYREG_USB_SIE_EP7_CNT1 -USBFS_1_USB__SIE_EP7_CR0 EQU CYREG_USB_SIE_EP7_CR0 -USBFS_1_USB__SIE_EP8_CNT0 EQU CYREG_USB_SIE_EP8_CNT0 -USBFS_1_USB__SIE_EP8_CNT1 EQU CYREG_USB_SIE_EP8_CNT1 -USBFS_1_USB__SIE_EP8_CR0 EQU CYREG_USB_SIE_EP8_CR0 -USBFS_1_USB__SIE_EP_INT_EN EQU CYREG_USB_SIE_EP_INT_EN -USBFS_1_USB__SIE_EP_INT_SR EQU CYREG_USB_SIE_EP_INT_SR -USBFS_1_USB__SOF0 EQU CYREG_USB_SOF0 -USBFS_1_USB__SOF1 EQU CYREG_USB_SOF1 -USBFS_1_USB__USBIO_CR0 EQU CYREG_USB_USBIO_CR0 -USBFS_1_USB__USBIO_CR1 EQU CYREG_USB_USBIO_CR1 -USBFS_1_USB__USB_CLK_EN EQU CYREG_USB_USB_CLK_EN - ; scsiTarget scsiTarget_StatusReg__0__MASK EQU 0x01 scsiTarget_StatusReg__0__POS EQU 0 @@ -1277,71 +1131,161 @@ SD_Clk_Ctl_Sync_ctrl_reg__MASK_CTL_AUX_CTL_REG EQU CYREG_B0_UDB01_MSK_ACTL SD_Clk_Ctl_Sync_ctrl_reg__PERIOD_REG EQU CYREG_B0_UDB01_MSK SD_Clk_Ctl_Sync_ctrl_reg__PER_CTL_AUX_CTL_REG EQU CYREG_B0_UDB01_MSK_ACTL -; USBFS_1_Dm -USBFS_1_Dm__0__MASK EQU 0x80 -USBFS_1_Dm__0__PC EQU CYREG_IO_PC_PRT15_7_6_PC1 -USBFS_1_Dm__0__PORT EQU 15 -USBFS_1_Dm__0__SHIFT EQU 7 -USBFS_1_Dm__AG EQU CYREG_PRT15_AG -USBFS_1_Dm__AMUX EQU CYREG_PRT15_AMUX -USBFS_1_Dm__BIE EQU CYREG_PRT15_BIE -USBFS_1_Dm__BIT_MASK EQU CYREG_PRT15_BIT_MASK -USBFS_1_Dm__BYP EQU CYREG_PRT15_BYP -USBFS_1_Dm__CTL EQU CYREG_PRT15_CTL -USBFS_1_Dm__DM0 EQU CYREG_PRT15_DM0 -USBFS_1_Dm__DM1 EQU CYREG_PRT15_DM1 -USBFS_1_Dm__DM2 EQU CYREG_PRT15_DM2 -USBFS_1_Dm__DR EQU CYREG_PRT15_DR -USBFS_1_Dm__INP_DIS EQU CYREG_PRT15_INP_DIS -USBFS_1_Dm__LCD_COM_SEG EQU CYREG_PRT15_LCD_COM_SEG -USBFS_1_Dm__LCD_EN EQU CYREG_PRT15_LCD_EN -USBFS_1_Dm__MASK EQU 0x80 -USBFS_1_Dm__PORT EQU 15 -USBFS_1_Dm__PRT EQU CYREG_PRT15_PRT -USBFS_1_Dm__PRTDSI__CAPS_SEL EQU CYREG_PRT15_CAPS_SEL -USBFS_1_Dm__PRTDSI__DBL_SYNC_IN EQU CYREG_PRT15_DBL_SYNC_IN -USBFS_1_Dm__PRTDSI__OE_SEL0 EQU CYREG_PRT15_OE_SEL0 -USBFS_1_Dm__PRTDSI__OE_SEL1 EQU CYREG_PRT15_OE_SEL1 -USBFS_1_Dm__PRTDSI__OUT_SEL0 EQU CYREG_PRT15_OUT_SEL0 -USBFS_1_Dm__PRTDSI__OUT_SEL1 EQU CYREG_PRT15_OUT_SEL1 -USBFS_1_Dm__PRTDSI__SYNC_OUT EQU CYREG_PRT15_SYNC_OUT -USBFS_1_Dm__PS EQU CYREG_PRT15_PS -USBFS_1_Dm__SHIFT EQU 7 -USBFS_1_Dm__SLW EQU CYREG_PRT15_SLW +; USBFS_ep_0 +USBFS_ep_0__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 +USBFS_ep_0__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 +USBFS_ep_0__INTC_MASK EQU 0x1000000 +USBFS_ep_0__INTC_NUMBER EQU 24 +USBFS_ep_0__INTC_PRIOR_NUM EQU 7 +USBFS_ep_0__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_24 +USBFS_ep_0__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 +USBFS_ep_0__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 + +; USBFS_ep_1 +USBFS_ep_1__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 +USBFS_ep_1__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 +USBFS_ep_1__INTC_MASK EQU 0x01 +USBFS_ep_1__INTC_NUMBER EQU 0 +USBFS_ep_1__INTC_PRIOR_NUM EQU 7 +USBFS_ep_1__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_0 +USBFS_ep_1__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 +USBFS_ep_1__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 -; USBFS_1_Dp -USBFS_1_Dp__0__MASK EQU 0x40 -USBFS_1_Dp__0__PC EQU CYREG_IO_PC_PRT15_7_6_PC0 -USBFS_1_Dp__0__PORT EQU 15 -USBFS_1_Dp__0__SHIFT EQU 6 -USBFS_1_Dp__AG EQU CYREG_PRT15_AG -USBFS_1_Dp__AMUX EQU CYREG_PRT15_AMUX -USBFS_1_Dp__BIE EQU CYREG_PRT15_BIE -USBFS_1_Dp__BIT_MASK EQU CYREG_PRT15_BIT_MASK -USBFS_1_Dp__BYP EQU CYREG_PRT15_BYP -USBFS_1_Dp__CTL EQU CYREG_PRT15_CTL -USBFS_1_Dp__DM0 EQU CYREG_PRT15_DM0 -USBFS_1_Dp__DM1 EQU CYREG_PRT15_DM1 -USBFS_1_Dp__DM2 EQU CYREG_PRT15_DM2 -USBFS_1_Dp__DR EQU CYREG_PRT15_DR -USBFS_1_Dp__INP_DIS EQU CYREG_PRT15_INP_DIS -USBFS_1_Dp__INTSTAT EQU CYREG_PICU15_INTSTAT -USBFS_1_Dp__LCD_COM_SEG EQU CYREG_PRT15_LCD_COM_SEG -USBFS_1_Dp__LCD_EN EQU CYREG_PRT15_LCD_EN -USBFS_1_Dp__MASK EQU 0x40 -USBFS_1_Dp__PORT EQU 15 -USBFS_1_Dp__PRT EQU CYREG_PRT15_PRT -USBFS_1_Dp__PRTDSI__CAPS_SEL EQU CYREG_PRT15_CAPS_SEL -USBFS_1_Dp__PRTDSI__DBL_SYNC_IN EQU CYREG_PRT15_DBL_SYNC_IN -USBFS_1_Dp__PRTDSI__OE_SEL0 EQU CYREG_PRT15_OE_SEL0 -USBFS_1_Dp__PRTDSI__OE_SEL1 EQU CYREG_PRT15_OE_SEL1 -USBFS_1_Dp__PRTDSI__OUT_SEL0 EQU CYREG_PRT15_OUT_SEL0 -USBFS_1_Dp__PRTDSI__OUT_SEL1 EQU CYREG_PRT15_OUT_SEL1 -USBFS_1_Dp__PRTDSI__SYNC_OUT EQU CYREG_PRT15_SYNC_OUT -USBFS_1_Dp__PS EQU CYREG_PRT15_PS -USBFS_1_Dp__SHIFT EQU 6 -USBFS_1_Dp__SLW EQU CYREG_PRT15_SLW -USBFS_1_Dp__SNAP EQU CYREG_PICU_15_SNAP_15 +; USBFS_ep_2 +USBFS_ep_2__INTC_CLR_EN_REG EQU CYREG_NVIC_CLRENA0 +USBFS_ep_2__INTC_CLR_PD_REG EQU CYREG_NVIC_CLRPEND0 +USBFS_ep_2__INTC_MASK EQU 0x02 +USBFS_ep_2__INTC_NUMBER EQU 1 +USBFS_ep_2__INTC_PRIOR_NUM EQU 7 +USBFS_ep_2__INTC_PRIOR_REG EQU CYREG_NVIC_PRI_1 +USBFS_ep_2__INTC_SET_EN_REG EQU CYREG_NVIC_SETENA0 +USBFS_ep_2__INTC_SET_PD_REG EQU CYREG_NVIC_SETPEND0 + +; USBFS_USB +USBFS_USB__ARB_CFG EQU CYREG_USB_ARB_CFG +USBFS_USB__ARB_EP1_CFG EQU CYREG_USB_ARB_EP1_CFG +USBFS_USB__ARB_EP1_INT_EN EQU CYREG_USB_ARB_EP1_INT_EN +USBFS_USB__ARB_EP1_SR EQU CYREG_USB_ARB_EP1_SR +USBFS_USB__ARB_EP2_CFG EQU CYREG_USB_ARB_EP2_CFG +USBFS_USB__ARB_EP2_INT_EN EQU CYREG_USB_ARB_EP2_INT_EN +USBFS_USB__ARB_EP2_SR EQU CYREG_USB_ARB_EP2_SR +USBFS_USB__ARB_EP3_CFG EQU CYREG_USB_ARB_EP3_CFG +USBFS_USB__ARB_EP3_INT_EN EQU CYREG_USB_ARB_EP3_INT_EN +USBFS_USB__ARB_EP3_SR EQU CYREG_USB_ARB_EP3_SR +USBFS_USB__ARB_EP4_CFG EQU CYREG_USB_ARB_EP4_CFG +USBFS_USB__ARB_EP4_INT_EN EQU CYREG_USB_ARB_EP4_INT_EN +USBFS_USB__ARB_EP4_SR EQU CYREG_USB_ARB_EP4_SR +USBFS_USB__ARB_EP5_CFG EQU CYREG_USB_ARB_EP5_CFG +USBFS_USB__ARB_EP5_INT_EN EQU CYREG_USB_ARB_EP5_INT_EN +USBFS_USB__ARB_EP5_SR EQU CYREG_USB_ARB_EP5_SR +USBFS_USB__ARB_EP6_CFG EQU CYREG_USB_ARB_EP6_CFG +USBFS_USB__ARB_EP6_INT_EN EQU CYREG_USB_ARB_EP6_INT_EN +USBFS_USB__ARB_EP6_SR EQU CYREG_USB_ARB_EP6_SR +USBFS_USB__ARB_EP7_CFG EQU CYREG_USB_ARB_EP7_CFG +USBFS_USB__ARB_EP7_INT_EN EQU CYREG_USB_ARB_EP7_INT_EN +USBFS_USB__ARB_EP7_SR EQU CYREG_USB_ARB_EP7_SR +USBFS_USB__ARB_EP8_CFG EQU CYREG_USB_ARB_EP8_CFG +USBFS_USB__ARB_EP8_INT_EN EQU CYREG_USB_ARB_EP8_INT_EN +USBFS_USB__ARB_EP8_SR EQU CYREG_USB_ARB_EP8_SR +USBFS_USB__ARB_INT_EN EQU CYREG_USB_ARB_INT_EN +USBFS_USB__ARB_INT_SR EQU CYREG_USB_ARB_INT_SR +USBFS_USB__ARB_RW1_DR EQU CYREG_USB_ARB_RW1_DR +USBFS_USB__ARB_RW1_RA EQU CYREG_USB_ARB_RW1_RA +USBFS_USB__ARB_RW1_RA_MSB EQU CYREG_USB_ARB_RW1_RA_MSB +USBFS_USB__ARB_RW1_WA EQU CYREG_USB_ARB_RW1_WA +USBFS_USB__ARB_RW1_WA_MSB EQU CYREG_USB_ARB_RW1_WA_MSB +USBFS_USB__ARB_RW2_DR EQU CYREG_USB_ARB_RW2_DR +USBFS_USB__ARB_RW2_RA EQU CYREG_USB_ARB_RW2_RA +USBFS_USB__ARB_RW2_RA_MSB EQU CYREG_USB_ARB_RW2_RA_MSB +USBFS_USB__ARB_RW2_WA EQU CYREG_USB_ARB_RW2_WA +USBFS_USB__ARB_RW2_WA_MSB EQU CYREG_USB_ARB_RW2_WA_MSB +USBFS_USB__ARB_RW3_DR EQU CYREG_USB_ARB_RW3_DR +USBFS_USB__ARB_RW3_RA EQU CYREG_USB_ARB_RW3_RA +USBFS_USB__ARB_RW3_RA_MSB EQU CYREG_USB_ARB_RW3_RA_MSB +USBFS_USB__ARB_RW3_WA EQU CYREG_USB_ARB_RW3_WA +USBFS_USB__ARB_RW3_WA_MSB EQU CYREG_USB_ARB_RW3_WA_MSB +USBFS_USB__ARB_RW4_DR EQU CYREG_USB_ARB_RW4_DR +USBFS_USB__ARB_RW4_RA EQU CYREG_USB_ARB_RW4_RA +USBFS_USB__ARB_RW4_RA_MSB EQU CYREG_USB_ARB_RW4_RA_MSB +USBFS_USB__ARB_RW4_WA EQU CYREG_USB_ARB_RW4_WA +USBFS_USB__ARB_RW4_WA_MSB EQU CYREG_USB_ARB_RW4_WA_MSB +USBFS_USB__ARB_RW5_DR EQU CYREG_USB_ARB_RW5_DR +USBFS_USB__ARB_RW5_RA EQU CYREG_USB_ARB_RW5_RA +USBFS_USB__ARB_RW5_RA_MSB EQU CYREG_USB_ARB_RW5_RA_MSB +USBFS_USB__ARB_RW5_WA EQU CYREG_USB_ARB_RW5_WA +USBFS_USB__ARB_RW5_WA_MSB EQU CYREG_USB_ARB_RW5_WA_MSB +USBFS_USB__ARB_RW6_DR EQU CYREG_USB_ARB_RW6_DR +USBFS_USB__ARB_RW6_RA EQU CYREG_USB_ARB_RW6_RA +USBFS_USB__ARB_RW6_RA_MSB EQU CYREG_USB_ARB_RW6_RA_MSB +USBFS_USB__ARB_RW6_WA EQU CYREG_USB_ARB_RW6_WA +USBFS_USB__ARB_RW6_WA_MSB EQU CYREG_USB_ARB_RW6_WA_MSB +USBFS_USB__ARB_RW7_DR EQU CYREG_USB_ARB_RW7_DR +USBFS_USB__ARB_RW7_RA EQU CYREG_USB_ARB_RW7_RA +USBFS_USB__ARB_RW7_RA_MSB EQU CYREG_USB_ARB_RW7_RA_MSB +USBFS_USB__ARB_RW7_WA EQU CYREG_USB_ARB_RW7_WA +USBFS_USB__ARB_RW7_WA_MSB EQU CYREG_USB_ARB_RW7_WA_MSB +USBFS_USB__ARB_RW8_DR EQU CYREG_USB_ARB_RW8_DR +USBFS_USB__ARB_RW8_RA EQU CYREG_USB_ARB_RW8_RA +USBFS_USB__ARB_RW8_RA_MSB EQU CYREG_USB_ARB_RW8_RA_MSB +USBFS_USB__ARB_RW8_WA EQU CYREG_USB_ARB_RW8_WA +USBFS_USB__ARB_RW8_WA_MSB EQU CYREG_USB_ARB_RW8_WA_MSB +USBFS_USB__BUF_SIZE EQU CYREG_USB_BUF_SIZE +USBFS_USB__BUS_RST_CNT EQU CYREG_USB_BUS_RST_CNT +USBFS_USB__CR0 EQU CYREG_USB_CR0 +USBFS_USB__CR1 EQU CYREG_USB_CR1 +USBFS_USB__CWA EQU CYREG_USB_CWA +USBFS_USB__CWA_MSB EQU CYREG_USB_CWA_MSB +USBFS_USB__DMA_THRES EQU CYREG_USB_DMA_THRES +USBFS_USB__DMA_THRES_MSB EQU CYREG_USB_DMA_THRES_MSB +USBFS_USB__DYN_RECONFIG EQU CYREG_USB_DYN_RECONFIG +USBFS_USB__EP0_CNT EQU CYREG_USB_EP0_CNT +USBFS_USB__EP0_CR EQU CYREG_USB_EP0_CR +USBFS_USB__EP0_DR0 EQU CYREG_USB_EP0_DR0 +USBFS_USB__EP0_DR1 EQU CYREG_USB_EP0_DR1 +USBFS_USB__EP0_DR2 EQU CYREG_USB_EP0_DR2 +USBFS_USB__EP0_DR3 EQU CYREG_USB_EP0_DR3 +USBFS_USB__EP0_DR4 EQU CYREG_USB_EP0_DR4 +USBFS_USB__EP0_DR5 EQU CYREG_USB_EP0_DR5 +USBFS_USB__EP0_DR6 EQU CYREG_USB_EP0_DR6 +USBFS_USB__EP0_DR7 EQU CYREG_USB_EP0_DR7 +USBFS_USB__EP_ACTIVE EQU CYREG_USB_EP_ACTIVE +USBFS_USB__EP_TYPE EQU CYREG_USB_EP_TYPE +USBFS_USB__MEM_DATA EQU CYREG_USB_MEM_DATA_MBASE +USBFS_USB__PM_ACT_CFG EQU CYREG_PM_ACT_CFG5 +USBFS_USB__PM_ACT_MSK EQU 0x01 +USBFS_USB__PM_STBY_CFG EQU CYREG_PM_STBY_CFG5 +USBFS_USB__PM_STBY_MSK EQU 0x01 +USBFS_USB__SIE_EP1_CNT0 EQU CYREG_USB_SIE_EP1_CNT0 +USBFS_USB__SIE_EP1_CNT1 EQU CYREG_USB_SIE_EP1_CNT1 +USBFS_USB__SIE_EP1_CR0 EQU CYREG_USB_SIE_EP1_CR0 +USBFS_USB__SIE_EP2_CNT0 EQU CYREG_USB_SIE_EP2_CNT0 +USBFS_USB__SIE_EP2_CNT1 EQU CYREG_USB_SIE_EP2_CNT1 +USBFS_USB__SIE_EP2_CR0 EQU CYREG_USB_SIE_EP2_CR0 +USBFS_USB__SIE_EP3_CNT0 EQU CYREG_USB_SIE_EP3_CNT0 +USBFS_USB__SIE_EP3_CNT1 EQU CYREG_USB_SIE_EP3_CNT1 +USBFS_USB__SIE_EP3_CR0 EQU CYREG_USB_SIE_EP3_CR0 +USBFS_USB__SIE_EP4_CNT0 EQU CYREG_USB_SIE_EP4_CNT0 +USBFS_USB__SIE_EP4_CNT1 EQU CYREG_USB_SIE_EP4_CNT1 +USBFS_USB__SIE_EP4_CR0 EQU CYREG_USB_SIE_EP4_CR0 +USBFS_USB__SIE_EP5_CNT0 EQU CYREG_USB_SIE_EP5_CNT0 +USBFS_USB__SIE_EP5_CNT1 EQU CYREG_USB_SIE_EP5_CNT1 +USBFS_USB__SIE_EP5_CR0 EQU CYREG_USB_SIE_EP5_CR0 +USBFS_USB__SIE_EP6_CNT0 EQU CYREG_USB_SIE_EP6_CNT0 +USBFS_USB__SIE_EP6_CNT1 EQU CYREG_USB_SIE_EP6_CNT1 +USBFS_USB__SIE_EP6_CR0 EQU CYREG_USB_SIE_EP6_CR0 +USBFS_USB__SIE_EP7_CNT0 EQU CYREG_USB_SIE_EP7_CNT0 +USBFS_USB__SIE_EP7_CNT1 EQU CYREG_USB_SIE_EP7_CNT1 +USBFS_USB__SIE_EP7_CR0 EQU CYREG_USB_SIE_EP7_CR0 +USBFS_USB__SIE_EP8_CNT0 EQU CYREG_USB_SIE_EP8_CNT0 +USBFS_USB__SIE_EP8_CNT1 EQU CYREG_USB_SIE_EP8_CNT1 +USBFS_USB__SIE_EP8_CR0 EQU CYREG_USB_SIE_EP8_CR0 +USBFS_USB__SIE_EP_INT_EN EQU CYREG_USB_SIE_EP_INT_EN +USBFS_USB__SIE_EP_INT_SR EQU CYREG_USB_SIE_EP_INT_SR +USBFS_USB__SOF0 EQU CYREG_USB_SOF0 +USBFS_USB__SOF1 EQU CYREG_USB_SOF1 +USBFS_USB__USBIO_CR0 EQU CYREG_USB_USBIO_CR0 +USBFS_USB__USBIO_CR1 EQU CYREG_USB_USBIO_CR1 +USBFS_USB__USB_CLK_EN EQU CYREG_USB_USB_CLK_EN ; SCSI_ATN SCSI_ATN__0__MASK EQU 0x20 @@ -1960,6 +1904,72 @@ SCSI_RST__SHIFT EQU 6 SCSI_RST__SLW EQU CYREG_PRT6_SLW SCSI_RST__SNAP EQU CYREG_PICU6_SNAP +; USBFS_Dm +USBFS_Dm__0__MASK EQU 0x80 +USBFS_Dm__0__PC EQU CYREG_IO_PC_PRT15_7_6_PC1 +USBFS_Dm__0__PORT EQU 15 +USBFS_Dm__0__SHIFT EQU 7 +USBFS_Dm__AG EQU CYREG_PRT15_AG +USBFS_Dm__AMUX EQU CYREG_PRT15_AMUX +USBFS_Dm__BIE EQU CYREG_PRT15_BIE +USBFS_Dm__BIT_MASK EQU CYREG_PRT15_BIT_MASK +USBFS_Dm__BYP EQU CYREG_PRT15_BYP +USBFS_Dm__CTL EQU CYREG_PRT15_CTL +USBFS_Dm__DM0 EQU CYREG_PRT15_DM0 +USBFS_Dm__DM1 EQU CYREG_PRT15_DM1 +USBFS_Dm__DM2 EQU CYREG_PRT15_DM2 +USBFS_Dm__DR EQU CYREG_PRT15_DR +USBFS_Dm__INP_DIS EQU CYREG_PRT15_INP_DIS +USBFS_Dm__LCD_COM_SEG EQU CYREG_PRT15_LCD_COM_SEG +USBFS_Dm__LCD_EN EQU CYREG_PRT15_LCD_EN +USBFS_Dm__MASK EQU 0x80 +USBFS_Dm__PORT EQU 15 +USBFS_Dm__PRT EQU CYREG_PRT15_PRT +USBFS_Dm__PRTDSI__CAPS_SEL EQU CYREG_PRT15_CAPS_SEL +USBFS_Dm__PRTDSI__DBL_SYNC_IN EQU CYREG_PRT15_DBL_SYNC_IN +USBFS_Dm__PRTDSI__OE_SEL0 EQU CYREG_PRT15_OE_SEL0 +USBFS_Dm__PRTDSI__OE_SEL1 EQU CYREG_PRT15_OE_SEL1 +USBFS_Dm__PRTDSI__OUT_SEL0 EQU CYREG_PRT15_OUT_SEL0 +USBFS_Dm__PRTDSI__OUT_SEL1 EQU CYREG_PRT15_OUT_SEL1 +USBFS_Dm__PRTDSI__SYNC_OUT EQU CYREG_PRT15_SYNC_OUT +USBFS_Dm__PS EQU CYREG_PRT15_PS +USBFS_Dm__SHIFT EQU 7 +USBFS_Dm__SLW EQU CYREG_PRT15_SLW + +; USBFS_Dp +USBFS_Dp__0__MASK EQU 0x40 +USBFS_Dp__0__PC EQU CYREG_IO_PC_PRT15_7_6_PC0 +USBFS_Dp__0__PORT EQU 15 +USBFS_Dp__0__SHIFT EQU 6 +USBFS_Dp__AG EQU CYREG_PRT15_AG +USBFS_Dp__AMUX EQU CYREG_PRT15_AMUX +USBFS_Dp__BIE EQU CYREG_PRT15_BIE +USBFS_Dp__BIT_MASK EQU CYREG_PRT15_BIT_MASK +USBFS_Dp__BYP EQU CYREG_PRT15_BYP +USBFS_Dp__CTL EQU CYREG_PRT15_CTL +USBFS_Dp__DM0 EQU CYREG_PRT15_DM0 +USBFS_Dp__DM1 EQU CYREG_PRT15_DM1 +USBFS_Dp__DM2 EQU CYREG_PRT15_DM2 +USBFS_Dp__DR EQU CYREG_PRT15_DR +USBFS_Dp__INP_DIS EQU CYREG_PRT15_INP_DIS +USBFS_Dp__INTSTAT EQU CYREG_PICU15_INTSTAT +USBFS_Dp__LCD_COM_SEG EQU CYREG_PRT15_LCD_COM_SEG +USBFS_Dp__LCD_EN EQU CYREG_PRT15_LCD_EN +USBFS_Dp__MASK EQU 0x40 +USBFS_Dp__PORT EQU 15 +USBFS_Dp__PRT EQU CYREG_PRT15_PRT +USBFS_Dp__PRTDSI__CAPS_SEL EQU CYREG_PRT15_CAPS_SEL +USBFS_Dp__PRTDSI__DBL_SYNC_IN EQU CYREG_PRT15_DBL_SYNC_IN +USBFS_Dp__PRTDSI__OE_SEL0 EQU CYREG_PRT15_OE_SEL0 +USBFS_Dp__PRTDSI__OE_SEL1 EQU CYREG_PRT15_OE_SEL1 +USBFS_Dp__PRTDSI__OUT_SEL0 EQU CYREG_PRT15_OUT_SEL0 +USBFS_Dp__PRTDSI__OUT_SEL1 EQU CYREG_PRT15_OUT_SEL1 +USBFS_Dp__PRTDSI__SYNC_OUT EQU CYREG_PRT15_SYNC_OUT +USBFS_Dp__PS EQU CYREG_PRT15_PS +USBFS_Dp__SHIFT EQU 6 +USBFS_Dp__SLW EQU CYREG_PRT15_SLW +USBFS_Dp__SNAP EQU CYREG_PICU_15_SNAP_15 + ; SCSI_In SCSI_In__0__AG EQU CYREG_PRT2_AG SCSI_In__0__AMUX EQU CYREG_PRT2_AMUX diff --git a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/project.h b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/project.h old mode 100644 new mode 100755 index f19d076..4f8d256 --- a/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/project.h +++ b/software/SCSI2SD/SCSI2SD.cydsn/Generated_Source/PSoC5/project.h @@ -52,17 +52,17 @@ #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include diff --git a/software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.cycdx b/software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.cycdx index f01cc26..658cb56 100755 --- a/software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.cycdx +++ b/software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.cycdx @@ -8,82 +8,83 @@ - + + - + - + - - - + + + - + - + - + - - - - - - - - - + + + + + + + + + - + - - + + - + - - - - - - - - - - - + + + + + + + + + + + diff --git a/software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.cyfit b/software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.cyfit index 73b4316..9cb0e8a 100755 Binary files a/software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.cyfit and b/software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.cyfit differ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.cyprj b/software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.cyprj index 15b7507..d2665e2 100755 --- a/software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.cyprj +++ b/software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.cyprj @@ -1761,14 +1761,14 @@ - + - + @@ -1777,7 +1777,7 @@ - + @@ -1786,7 +1786,7 @@ - + @@ -1795,7 +1795,7 @@ - + @@ -1804,7 +1804,7 @@ - + @@ -1813,7 +1813,7 @@ - + @@ -1822,7 +1822,7 @@ - + @@ -1831,7 +1831,7 @@ - + @@ -1840,7 +1840,7 @@ - + @@ -1849,7 +1849,7 @@ - + @@ -1858,7 +1858,7 @@ - + @@ -1867,7 +1867,7 @@ - + @@ -1876,7 +1876,7 @@ - + @@ -1885,7 +1885,7 @@ - + @@ -1894,7 +1894,7 @@ - + @@ -1903,7 +1903,7 @@ - + @@ -1912,7 +1912,7 @@ - + @@ -1921,7 +1921,7 @@ - + @@ -1930,7 +1930,7 @@ - + @@ -1939,7 +1939,7 @@ - + @@ -1953,14 +1953,14 @@ - + - + @@ -1969,7 +1969,7 @@ - + @@ -1978,7 +1978,7 @@ - + @@ -1992,14 +1992,14 @@ - + - + @@ -2008,7 +2008,7 @@ - + @@ -2017,7 +2017,7 @@ - + @@ -2076,6 +2076,276 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.svd b/software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.svd index cf1bd42..9b19422 100755 --- a/software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.svd +++ b/software/SCSI2SD/SCSI2SD.cydsn/SCSI2SD.svd @@ -7,7 +7,7 @@ 32 - USBFS_1 + USBFS USBFS 0x40004394 @@ -17,7 +17,7 @@ - USBFS_1_PM_USB_CR0 + USBFS_PM_USB_CR0 USB Power Mode Control Register 0 0x0 8 @@ -49,7 +49,7 @@ - USBFS_1_PM_ACT_CFG + USBFS_PM_ACT_CFG Active Power Mode Configuration Register 0x11 8 @@ -58,7 +58,7 @@ 0 - USBFS_1_PM_STBY_CFG + USBFS_PM_STBY_CFG Standby Power Mode Configuration Register 0x21 8 @@ -67,7 +67,7 @@ 0 - USBFS_1_PRT_PS + USBFS_PRT_PS Port Pin State Register 0xE5D 8 @@ -92,7 +92,7 @@ - USBFS_1_PRT_DM0 + USBFS_PRT_DM0 Port Drive Mode Register 0xE5E 8 @@ -117,7 +117,7 @@ - USBFS_1_PRT_DM1 + USBFS_PRT_DM1 Port Drive Mode Register 0xE5F 8 @@ -142,7 +142,7 @@ - USBFS_1_PRT_INP_DIS + USBFS_PRT_INP_DIS Input buffer disable override 0xE64 8 @@ -167,7 +167,7 @@ - USBFS_1_EP0_DR0 + USBFS_EP0_DR0 bmRequestType 0x1C6C 8 @@ -176,7 +176,7 @@ 0 - USBFS_1_EP0_DR1 + USBFS_EP0_DR1 bRequest 0x1C6D 8 @@ -185,7 +185,7 @@ 0 - USBFS_1_EP0_DR2 + USBFS_EP0_DR2 wValueLo 0x1C6E 8 @@ -194,7 +194,7 @@ 0 - USBFS_1_EP0_DR3 + USBFS_EP0_DR3 wValueHi 0x1C6F 8 @@ -203,7 +203,7 @@ 0 - USBFS_1_EP0_DR4 + USBFS_EP0_DR4 wIndexLo 0x1C70 8 @@ -212,7 +212,7 @@ 0 - USBFS_1_EP0_DR5 + USBFS_EP0_DR5 wIndexHi 0x1C71 8 @@ -221,7 +221,7 @@ 0 - USBFS_1_EP0_DR6 + USBFS_EP0_DR6 lengthLo 0x1C72 8 @@ -230,7 +230,7 @@ 0 - USBFS_1_EP0_DR7 + USBFS_EP0_DR7 lengthHi 0x1C73 8 @@ -239,7 +239,7 @@ 0 - USBFS_1_CR0 + USBFS_CR0 USB Control Register 0 0x1C74 8 @@ -264,7 +264,7 @@ - USBFS_1_CR1 + USBFS_CR1 USB Control Register 1 0x1C75 8 @@ -303,7 +303,7 @@ - USBFS_1_SIE_EP1_CR0 + USBFS_SIE_EP1_CR0 The Endpoint1 Control Register 0x1C7A 8 @@ -312,7 +312,7 @@ 0 - USBFS_1_USBIO_CR0 + USBFS_USBIO_CR0 USBIO Control Register 0 0x1C7C 8 @@ -351,7 +351,7 @@ - USBFS_1_USBIO_CR1 + USBFS_USBIO_CR1 USBIO Control Register 1 0x1C7E 8 @@ -390,7 +390,7 @@ - USBFS_1_SIE_EP2_CR0 + USBFS_SIE_EP2_CR0 The Endpoint2 Control Register 0x1C8A 8 @@ -399,7 +399,7 @@ 0 - USBFS_1_SIE_EP3_CR0 + USBFS_SIE_EP3_CR0 The Endpoint3 Control Register 0x1C9A 8 @@ -408,7 +408,7 @@ 0 - USBFS_1_SIE_EP4_CR0 + USBFS_SIE_EP4_CR0 The Endpoint4 Control Register 0x1CAA 8 @@ -417,7 +417,7 @@ 0 - USBFS_1_SIE_EP5_CR0 + USBFS_SIE_EP5_CR0 The Endpoint5 Control Register 0x1CBA 8 @@ -426,7 +426,7 @@ 0 - USBFS_1_SIE_EP6_CR0 + USBFS_SIE_EP6_CR0 The Endpoint6 Control Register 0x1CCA 8 @@ -435,7 +435,7 @@ 0 - USBFS_1_SIE_EP7_CR0 + USBFS_SIE_EP7_CR0 The Endpoint7 Control Register 0x1CDA 8 @@ -444,7 +444,7 @@ 0 - USBFS_1_SIE_EP8_CR0 + USBFS_SIE_EP8_CR0 The Endpoint8 Control Register 0x1CEA 8 @@ -453,7 +453,7 @@ 0 - USBFS_1_BUF_SIZE + USBFS_BUF_SIZE Dedicated Endpoint Buffer Size Register 0x1CF8 8 @@ -462,7 +462,7 @@ 0 - USBFS_1_EP_ACTIVE + USBFS_EP_ACTIVE Endpoint Active Indication Register 0x1CFA 8 @@ -471,7 +471,7 @@ 0 - USBFS_1_EP_TYPE + USBFS_EP_TYPE Endpoint Type (IN/OUT) Indication 0x1CFB 8 @@ -480,7 +480,7 @@ 0 - USBFS_1_USB_CLK_EN + USBFS_USB_CLK_EN USB Block Clock Enable Register 0x1D09 8 diff --git a/software/SCSI2SD/SCSI2SD.cydsn/TopDesign/TopDesign.cysch b/software/SCSI2SD/SCSI2SD.cydsn/TopDesign/TopDesign.cysch index 7def179..5eb78a5 100755 Binary files a/software/SCSI2SD/SCSI2SD.cydsn/TopDesign/TopDesign.cysch and b/software/SCSI2SD/SCSI2SD.cydsn/TopDesign/TopDesign.cysch differ diff --git a/software/SCSI2SD/SCSI2SD.cydsn/config.c b/software/SCSI2SD/SCSI2SD.cydsn/config.c index 2855dc9..fc1809d 100755 --- a/software/SCSI2SD/SCSI2SD.cydsn/config.c +++ b/software/SCSI2SD/SCSI2SD.cydsn/config.c @@ -17,6 +17,8 @@ #include "device.h" #include "config.h" +#include "USBFS.h" +#include "led.h" #include @@ -32,38 +34,77 @@ static Config shadow = "2.0a", // revision (68k Apple Drive Setup: Set to "1.0 ") 1, // enable parity 0, // disable unit attention, - 0, // Max blocks (0 == disabled) - "" // reserved + 0 // Max blocks (0 == disabled) + // reserved bytes will be initialised to 0. }; +enum USB_ENDPOINTS +{ + USB_EP_OUT = 1, + USB_EP_IN = 2 +}; +enum USB_STATE +{ + USB_IDLE, + USB_DATA_SENT +}; +int usbInEpState; + +int usbReady; + // Global Config* config = NULL; +// The PSoC 5LP compile to little-endian format. +static uint32_t ntohl(uint32_t val) +{ + return + ((val & 0xFF) << 24) | + ((val & 0xFF00) << 8) | + ((val >> 8) & 0xFF00) | + ((val >> 24) & 0xFF); +} +static uint32_t htonl(uint32_t val) +{ + return + ((val & 0xFF) << 24) | + ((val & 0xFF00) << 8) | + ((val >> 8) & 0xFF00) | + ((val >> 24) & 0xFF); +} + +static void saveConfig() +{ + int shadowRows = (sizeof(shadow) / CYDEV_EEPROM_ROW_SIZE) + 1; + int row; + int status = CYRET_SUCCESS; + + CySetTemp(); + for (row = 0; (row < shadowRows) && (status == CYRET_SUCCESS); ++row) + { + CFG_EEPROM_Write(((uint8*)&shadow) + (row * CYDEV_EEPROM_ROW_SIZE), row); + } + if (status == CYRET_SUCCESS) + { + CFG_EEPROM_Write((uint8*)magic, row); + } +} + void configInit() { // We could map cfgPtr directly into the EEPROM memory, // but that would waste power. Copy it to RAM then turn off - // the EEPROM. + // the EEPROM. CFG_EEPROM_Start(); CyDelayUs(5); // 5us to start per datasheet. - + // Check magic int shadowRows = (sizeof(shadow) / CYDEV_EEPROM_ROW_SIZE) + 1; int shadowBytes = CYDEV_EEPROM_ROW_SIZE * shadowRows; - uint8* eeprom = (uint8*)CYDEV_EE_BASE; - if (memcmp(eeprom + shadowBytes, magic, sizeof(magic))) + uint8* eeprom = (uint8*)CYDEV_EE_BASE; + if (memcmp(eeprom + shadowBytes, magic, sizeof(magic))) { - CySetTemp(); - int row; - int status = CYRET_SUCCESS; - for (row = 0; (row < shadowRows) && (status == CYRET_SUCCESS); ++row) - { - CFG_EEPROM_Write(((uint8*)&shadow) + (row * CYDEV_EEPROM_ROW_SIZE), row); - } - if (status == CYRET_SUCCESS) - { - CFG_EEPROM_Write((uint8*)magic, row); - } + saveConfig(); } else { @@ -71,4 +112,76 @@ void configInit() } config = &shadow; CFG_EEPROM_Stop(); -} \ No newline at end of file + + // The USB block will be powered by an internal 3.3V regulator. + // The PSoC must be operating between 4.6V and 5V for the regulator + // to work. + USBFS_Start(0, USBFS_5V_OPERATION); + usbInEpState = USB_IDLE; + usbReady = 0; // We don't know if host is connected yet. +} + +void configPoll() +{ + int reset = 0; + if (!usbReady || USBFS_IsConfigurationChanged()) + { + reset = 1; + } + usbReady = USBFS_bGetConfiguration(); + + if (!usbReady) + { + return; + } + + if (reset) + { + USBFS_EnableOutEP(USB_EP_OUT); + usbInEpState = USB_IDLE; + } + + if(USBFS_GetEPState(USB_EP_OUT) == USBFS_OUT_BUFFER_FULL) + { + ledOn(); + // The host sent us some data! + int byteCount = USBFS_GetEPCount(USB_EP_OUT); + + // Assume that byteCount <= sizeof(shadow). + // shadow should be padded out to 64bytes, which is the largest + // possible HID transfer. + USBFS_ReadOutEP(USB_EP_OUT, (uint8 *)&shadow, byteCount); + shadow.maxBlocks = htonl(shadow.maxBlocks); + + CFG_EEPROM_Start(); + saveConfig(); // write to eeprom + CFG_EEPROM_Stop(); + + // Send the updated data. + usbInEpState = USB_IDLE; + + // Allow the host to send us another updated config. + USBFS_EnableOutEP(USB_EP_OUT); + + ledOff(); + } + + switch (usbInEpState) + { + case USB_IDLE: + shadow.maxBlocks = htonl(shadow.maxBlocks); + USBFS_LoadInEP(USB_EP_IN, (uint8 *)&shadow, sizeof(shadow)); + shadow.maxBlocks = ntohl(shadow.maxBlocks); + usbInEpState = USB_DATA_SENT; + break; + + case USB_DATA_SENT: + if (USBFS_bGetEPAckState(USB_EP_IN)) + { + // Data accepted. + usbInEpState = USB_IDLE; + } + break; + } +} + diff --git a/software/SCSI2SD/SCSI2SD.cydsn/config.h b/software/SCSI2SD/SCSI2SD.cydsn/config.h index b17ebe1..4cb26ef 100755 --- a/software/SCSI2SD/SCSI2SD.cydsn/config.h +++ b/software/SCSI2SD/SCSI2SD.cydsn/config.h @@ -27,6 +27,7 @@ typedef struct char revision[4]; uint8 enableParity; uint8 enableUnitAttention; + uint8 reserved1; // Unused. Ensures maxBlocks is aligned. uint32 maxBlocks; // Pad to 64 bytes, which is what we can fit into a USB HID packet. @@ -36,5 +37,6 @@ typedef struct extern Config* config; void configInit(); +void configPoll(); #endif diff --git a/software/SCSI2SD/SCSI2SD.cydsn/main.c b/software/SCSI2SD/SCSI2SD.cydsn/main.c index 79b7f2c..bb0deb6 100755 --- a/software/SCSI2SD/SCSI2SD.cydsn/main.c +++ b/software/SCSI2SD/SCSI2SD.cydsn/main.c @@ -56,6 +56,7 @@ int main() { scsiPoll(); scsiDiskPoll(); + configPoll(); } return 0; } diff --git a/software/SCSI2SD/SCSI2SD.cydsn/scsi.c b/software/SCSI2SD/SCSI2SD.cydsn/scsi.c index 8eebc5d..60ea9b3 100755 --- a/software/SCSI2SD/SCSI2SD.cydsn/scsi.c +++ b/software/SCSI2SD/SCSI2SD.cydsn/scsi.c @@ -345,14 +345,11 @@ static void scsiReset() // We must be ready again within the "Reset to selection time" of // 250ms. // There is no guarantee that the RST line will be negated by then. - int reset; - do - { - CyDelay(10); // 10ms. - reset = SCSI_ReadPin(SCSI_RST_INT); - } while (reset); - - scsiDev.resetFlag = 0; + // NOTE: We could be connected and powered by USB for configuration, + // in which case TERMPWR cannot be supplied, and reset will ALWAYS + // be true. + CyDelay(10); // 10ms. + scsiDev.resetFlag = SCSI_ReadPin(SCSI_RST_INT); scsiDev.atnFlag = 0; } diff --git a/software/SCSI2SD/USB_Bootloader.cydsn/USB_Bootloader.cyprj.Micha_000 b/software/SCSI2SD/USB_Bootloader.cydsn/USB_Bootloader.cyprj.Micha_000 index 2289bb1..c974aa2 100755 --- a/software/SCSI2SD/USB_Bootloader.cydsn/USB_Bootloader.cyprj.Micha_000 +++ b/software/SCSI2SD/USB_Bootloader.cydsn/USB_Bootloader.cyprj.Micha_000 @@ -589,6 +589,8 @@ Cypress Component Catalog\System\ILO Trim [v1.0] Cypress Component Catalog\System\Interrupt [v1.70] Cypress Component Catalog\System\RTC [v2.0] +Cypress Component Catalog\System\SleepTimer [v3.20] +Cypress Component Catalog\Thermal Management diff --git a/software/bootloaderhost/.gitignore b/software/bootloaderhost/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/software/bootloaderhost/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/software/bootloaderhost/Makefile b/software/bootloaderhost/Makefile index 8c09067..9a24f03 100644 --- a/software/bootloaderhost/Makefile +++ b/software/bootloaderhost/Makefile @@ -1,4 +1,4 @@ -all: bootloaderhost +all: build/bootloaderhost CYAPI = \ cybootloaderutils/cybtldr_api2.c \ @@ -20,8 +20,9 @@ ifeq ($(UNAME_S),Darwin) endif -bootloaderhost: main.c $(HID_C) $(CYAPI) +build/bootloaderhost: main.c $(HID_C) $(CYAPI) + mkdir -p $(dir $@) $(CC) $(CFLAGS) -I cybootloaderutils -I hidapi/hidapi $^ $(LDFLAGS) -o $@ clean: - rm bootloaderhost + rm build/bootloaderhost diff --git a/software/scsi2sd-config/.gitignore b/software/scsi2sd-config/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/software/scsi2sd-config/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/software/scsi2sd-config/Makefile b/software/scsi2sd-config/Makefile new file mode 100644 index 0000000..4f16bd2 --- /dev/null +++ b/software/scsi2sd-config/Makefile @@ -0,0 +1,22 @@ +all: build/scsi2sd-config + +CFLAGS += -Wall + +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + HID_C = ../bootloaderhost/hidapi/linux/hid.c + LDFLAGS += -ludev +endif +ifeq ($(UNAME_S),Darwin) + # Should match OSX + HID_C = ../bootloaderost/hidapi/mac/hid.c + LDFLAGS += -framework IOKit -framework CoreFoundation +endif + + +build/scsi2sd-config: main.c $(HID_C) $(CYAPI) + mkdir -p $(dir $@) + $(CC) $(CFLAGS) -I ../bootloaderhost/hidapi/hidapi $^ $(LDFLAGS) -o $@ + +clean: + rm build/scsi2sd-config diff --git a/software/scsi2sd-config/Makefile.mingw b/software/scsi2sd-config/Makefile.mingw new file mode 100644 index 0000000..ecc9a9b --- /dev/null +++ b/software/scsi2sd-config/Makefile.mingw @@ -0,0 +1,19 @@ +all: build/windows/32bit/scsi2sd-config.exe build/windows/64bit/scsi2sd-config.exe + +CFLAGS += -Wall +LDFLAGS=-mconsole -mwindows -lsetupapi -lws2_32 + +HID_C = ../bootloaderhost/hidapi/windows/hid.c + + +build/windows/32bit/scsi2sd-config.exe: main.c $(HID_C) + mkdir -p $(dir $@) + i686-w64-mingw32-gcc $(CFLAGS) -I ../bootloaderhost/hidapi/hidapi $^ $(LDFLAGS) -o $@ + +build/windows/64bit/scsi2sd-config.exe: main.c $(HID_C) + mkdir -p $(dir $@) + x86_64-w64-mingw32-gcc $(CFLAGS) -I ../bootloaderhost/hidapi/hidapi $^ $(LDFLAGS) -o $@ + +clean: + rm -r build/windows + diff --git a/software/scsi2sd-config/main.c b/software/scsi2sd-config/main.c new file mode 100644 index 0000000..25b66bf --- /dev/null +++ b/software/scsi2sd-config/main.c @@ -0,0 +1,364 @@ +// Copyright (C) 2013 Michael McMaster +// +// This file is part of SCSI2SD. +// +// SCSI2SD 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. +// +// SCSI2SD 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 SCSI2SD. If not, see . + +#include +#include +#include +#include +#include +#include +#include + +// htonl/ntohl includes. +#ifdef WIN32 +#include +#else +#include +#endif + +#include "hidapi.h" + +#define MIN(a,b) (a < b ? a : b) + +enum +{ + PARAM_ID, + PARAM_PARITY, + PARAM_NOPARITY, + PARAM_UNITATT, + PARAM_NOUNITATT, + PARAM_MAXBLOCKS, + PARAM_APPLE, + PARAM_VENDOR, + PARAM_PRODID, + PARAM_REV +}; + +// Must be consistent with the structure defined in the SCSI2SD config.h header. +// We always transfer data in network byte order. +typedef struct __attribute((packed)) +{ + uint8_t scsiId; + char vendor[8]; + char prodId[16]; + char revision[4]; + uint8_t enableParity; + uint8_t enableUnitAttention; + uint8_t reserved1; // Unused. Ensures maxBlocks is aligned. + uint32_t maxBlocks; + + // Pad to 64 bytes, which is what we can fit into a USB HID packet. + char reserved[28]; +} ConfigPacket; + +static void printConfig(ConfigPacket* packet) +{ + printf("SCSI ID:\t\t\t%d\n", packet->scsiId); + printf("Vendor:\t\t\t\t\"%.*s\"\n", 8, packet->vendor); + printf("Product ID:\t\t\t\"%.*s\"\n", 16, packet->prodId); + printf("Revision:\t\t\t\"%.*s\"\n", 4, packet->revision); + printf("\n"); + printf("Parity Checking:\t\t%s\n", packet->enableParity ? "enabled" : "disabled"); + printf("Unit Attention Condition:\t%s\n", packet->enableUnitAttention ? "enabled" : "disabled"); + if (packet->maxBlocks) + { + char sizeBuf[64]; + uint64_t maxBytes = packet->maxBlocks * (uint64_t) 512; + if (maxBytes > (1024*1024*1024)) + { + sprintf(sizeBuf, "%.02fGB", maxBytes / (1024.0*1024.0*1024.0)); + } + else if (maxBytes > (1024*1024)) + { + sprintf(sizeBuf, "%.02fMB", maxBytes / (1024.0*1024.0)); + } + else if (maxBytes > (1024)) + { + sprintf(sizeBuf, "%.02fKB", maxBytes / (1024.0)); + } + else + { + sprintf(sizeBuf, "%" PRIu64 " bytes", maxBytes); + } + + printf("Maximum Size:\t\t\t%s (%d blocks)\n", sizeBuf, packet->maxBlocks); + } + else + { + printf("Maximum Size:\t\t\tUnlimited\n"); + } +} + +static int readConfig(hid_device* handle, ConfigPacket* packet) +{ + // First byte is the report ID (0) + unsigned char buf[1 + sizeof(ConfigPacket)]; + memset(buf, 0, sizeof(buf)); + memset(packet, 0, sizeof(ConfigPacket)); + int result = hid_read(handle, buf, sizeof(buf)); + + if (result < 0) + { + fprintf(stderr, "USB HID Read Failure: %ls\n", hid_error(handle)); + } + + memcpy(packet, buf, result); + packet->maxBlocks = ntohl(packet->maxBlocks); + + return result; +} + +static int writeConfig(hid_device* handle, ConfigPacket* packet) +{ + unsigned char buf[1 + sizeof(ConfigPacket)]; + buf[0] = 0; // report ID + + packet->maxBlocks = htonl(packet->maxBlocks); + memcpy(buf + 1, packet, sizeof(ConfigPacket)); + packet->maxBlocks = ntohl(packet->maxBlocks); + + int result = hid_write(handle, buf, sizeof(buf)); + + if (result < 0) + { + fprintf(stderr, "USB HID Write Failure: %ls\n", hid_error(handle)); + } + + return result; +} + +static void usage() +{ + printf("Usage: scsi2sd-config [options...]\n"); + printf("\n"); + printf("--id={0-7}\tSCSI device ID.\n\n"); + printf("--parity\tCheck the SCSI parity signal, and reject data where\n"); + printf("\t\tthe parity is bad.\n\n"); + printf("--no-parity\tDon't check the SCSI parity signal.\n"); + printf("\t\tThis is required for SCSI host controllers that do not provide\n"); + printf("\t\tparity.\n\n"); + printf("--attention\tRespond with a Unit Attention status on device reset.\n"); + printf("\t\tSome systems will fail on this response, even though it is\n"); + printf("\t\trequired by the SCSI-2 standard.\n\n"); + printf("--no-attention\tDisable Unit Attention responses.\n\n"); + printf("--blocks={0-4294967295}\n\t\tSet a limit to the reported device size.\n"); + printf("\t\tEach block is 512 bytes. The maximum possible size is 2TB.\n"); + printf("\t\tThe reported size will be the lower of this value and the SD\n"); + printf("\t\tcard size. 0 disables the limit.\n\n"); + printf("--apple\t\tSet the vendor, product ID and revision fields to simulate an \n"); + printf("\t\tapple-suppled disk. Provides support for the Apple Drive Setup\n"); + printf("\t\tutility.\n\n"); + printf("--vendor={vendor}\tSets the reported device vendor. Up to 8 characters.\n\n"); + printf("--prod-id={prod-id}\tSets the reported product ID. Up to 16 characters.\n\n"); + printf("--rev={revision}\tSets the reported device revision. Up to 4 characters.\n\n"); + printf("\n"); + printf("\nThe current configuration settings are displayed if no options are supplied"); + printf("\n\n"); + exit(1); +} + +int main(int argc, char* argv[]) +{ + printf("SCSI2SD Configuration Utility.\n"); + printf("Copyright (C) 2013 Michael McMaster \n\n"); + + uint16_t vendorId = 0x04B4; // Cypress + uint16_t productId = 0x1337; // SCSI2SD + + printf( + "USB device parameters\n\tVendor ID:\t0x%04X\n\tProduct ID:\t0x%04X\n", + vendorId, + productId); + + // Enumerate and print the HID devices on the system + struct hid_device_info *dev = hid_enumerate(vendorId, productId); + if (!dev) + { + fprintf(stderr, "ERROR: SCSI2SD USB device not found.\n"); + exit(1); + } + + printf("USB Device Found\n type: %04hx %04hx\n path: %s\n serial_number: %ls", + dev->vendor_id, dev->product_id, dev->path, dev->serial_number); + printf("\n"); + printf(" Manufacturer: %ls\n", dev->manufacturer_string); + printf(" Product: %ls\n", dev->product_string); + printf("\n"); + + // Open the device using the VID, PID, + // and optionally the Serial number. + hid_device* handle = hid_open(vendorId, productId, NULL); + if (!handle) + { + fprintf( + stderr, + "ERROR: Could not open device %s. Check permissions.\n", dev->path + ); + exit(1); + } + + ConfigPacket packet; + if (readConfig(handle, &packet) <= 0) + { + fprintf(stderr, "ERROR: Invalid data received from device.\n"); + exit(1); + } + + struct option options[] = + { + { + "id", required_argument, NULL, PARAM_ID + }, + { + "parity", no_argument, NULL, PARAM_PARITY + }, + { + "no-parity", no_argument, NULL, PARAM_NOPARITY + }, + { + "attention", no_argument, NULL, PARAM_UNITATT + }, + { + "no-attention", no_argument, NULL, PARAM_NOUNITATT + }, + { + "blocks", required_argument, NULL, PARAM_MAXBLOCKS + }, + { + "apple", no_argument, NULL, PARAM_APPLE + }, + { + "vendor", required_argument, NULL, PARAM_VENDOR + }, + { + "prod-id", required_argument, NULL, PARAM_PRODID + }, + { + "rev", required_argument, NULL, PARAM_REV + }, + { + NULL, 0, NULL, 0 + } + }; + + int doWrite = 0; + int optIdx = 0; + int c; + while ((c = getopt_long(argc, argv, "", options, &optIdx)) != -1) + { + doWrite = 1; + switch (c) + { + case PARAM_ID: + { + int id = -1; + if (sscanf(optarg, "%d", &id) == 1 && id >= 0 && id <= 7) + { + packet.scsiId = id; + } + else + { + usage(); + } + break; + } + + case PARAM_PARITY: + packet.enableParity = 1; + break; + + case PARAM_NOPARITY: + packet.enableParity = 0; + break; + + case PARAM_UNITATT: + packet.enableUnitAttention = 1; + break; + + case PARAM_NOUNITATT: + packet.enableUnitAttention = 0; + break; + + case PARAM_MAXBLOCKS: + { + int64_t maxBlocks = -1; + if (sscanf(optarg, "%" PRId64, &maxBlocks) == 1 && + maxBlocks >= 0 && maxBlocks <= UINT32_MAX) + { + packet.maxBlocks = maxBlocks; + } + else + { + usage(); + } + break; + } + + case PARAM_APPLE: + memcpy(packet.vendor, " SEAGATE", 8); + memcpy(packet.prodId, " ST225N", 16); + memcpy(packet.revision, "1.0 ", 4); + break; + + case PARAM_VENDOR: + memset(packet.vendor, ' ', 8); + memcpy(packet.vendor, optarg, MIN(strlen(optarg), 8)); + break; + + case PARAM_PRODID: + memset(packet.prodId, ' ', 16); + memcpy(packet.prodId, optarg, MIN(strlen(optarg), 16)); + break; + + case PARAM_REV: + memset(packet.revision, ' ', 4); + memcpy(packet.revision, optarg, MIN(strlen(optarg), 4)); + break; + + case '?': + usage(); + } + } + + if (doWrite) + { + printf("Saving configuration..."); + if (writeConfig(handle, &packet) <= 0) + { + printf(" Fail.\n"); + fprintf(stderr, "ERROR: Failed to save config.\n"); + exit(1); + } + printf(" Done.\n"); + + // Clear outstanding stale data + readConfig(handle, &packet); + + // Proper update + if (readConfig(handle, &packet) <= 0) + { + fprintf(stderr, "ERROR: Invalid data received from device.\n"); + exit(1); + } + } + + printf("\nCurrent Device Settings:\n"); + printConfig(&packet); + + return 0; +} +