void Endpoint_StallTransaction(void) { if(endpointselected==ENDPOINT_CONTROLEP) SIE_WriteCommandData( CMD_SET_EP_STAT(endpointhandle[endpointselected]), DAT_WR_BYTE(EP_STAT_CND_ST) ); else SIE_WriteCommandData( CMD_SET_EP_STAT(endpointhandle[endpointselected]), DAT_WR_BYTE(EP_STAT_ST) ); }
/********************************************************************//** * @brief * @param * @return *********************************************************************/ bool Endpoint_ConfigureEndpoint(const uint8_t Number, const uint8_t Type, const uint8_t Direction, const uint16_t Size, const uint8_t Banks) { uint32_t PhyEP = 2*Number + (Direction == ENDPOINT_DIR_OUT ? 0 : 1); if((!IsConfigured)&&(PhyEP>1)) { IsConfigured = true; SIE_WriteCommandData(CMD_CFG_DEV, DAT_WR_BYTE(CONF_DVICE)); } LPC_USB->ReEp |= (1 << PhyEP); /* Realize endpoint */ LPC_USB->EpInd = PhyEP; /* Endpoint Index */ LPC_USB->MaxPSize = Size & 0x3ff; /* Max Packet Size */ while ((LPC_USB->DevIntSt & EP_RLZED_INT) == 0); /* TODO shouldd we wait for this */ LPC_USB->DevIntClr = EP_RLZED_INT; if (Number == ENDPOINT_CONTROLEP) /* Control endpoints have to uses slave mode */ { LPC_USB->EpIntEn |= _BIT(PhyEP); DataInRemainCount = 0; DataInRemainOffset = 0; }else /* all other endpoints use DMA mode */ { memset(&dmaDescriptor[PhyEP], 0, sizeof(DMADescriptor)); dmaDescriptor[PhyEP].Isochronous = (Type == EP_TYPE_ISOCHRONOUS ? 1 : 0 ); dmaDescriptor[PhyEP].MaxPacketSize = Size; dmaDescriptor[PhyEP].Retired = 1; /* inactive DD */ LPC_USB->EpDMAEn = _BIT(PhyEP); } SIE_WriteCommandData(CMD_SET_EP_STAT(PhyEP), DAT_WR_BYTE(0)); /*enable endpoint*/ SIE_WriteCommandData(CMD_SET_EP_STAT(PhyEP), DAT_WR_BYTE(0)); /* Reset Endpoint */ endpointhandle[Number] = (Number==ENDPOINT_CONTROLEP) ? ENDPOINT_CONTROLEP : PhyEP; (void)Banks; return true; }
/********************************************************************//** * @brief * @param * @return *********************************************************************/ void HAL17XX_USBConnect (uint32_t con) { SIE_WriteCommandData(CMD_SET_DEV_STAT, DAT_WR_BYTE(con ? DEV_CON : 0)); GPIO_OutputValue(USB_CONNECT_PORT, _BIT(USB_CONNECT_PIN), con ? 0 : DEV_CON); }
void HAL17XX_USBConnect(uint32_t con) { SIE_WriteCommandData(CMD_SET_DEV_STAT, DAT_WR_BYTE(con ? DEV_CON : 0)); }
void HAL17XX_SetDeviceAddress(uint8_t Address) { SIE_WriteCommandData(CMD_SET_ADDR, DAT_WR_BYTE(DEV_EN | Address)); /* Don't wait for next */ SIE_WriteCommandData(CMD_SET_ADDR, DAT_WR_BYTE(DEV_EN | Address)); /* Setup Status Phase */ }
void Endpoint_StallTransaction(uint8_t corenum) { if (endpointselected[corenum] == ENDPOINT_CONTROLEP) { SIE_WriteCommandData(CMD_SET_EP_STAT(endpointhandle(corenum)[endpointselected[corenum]]), DAT_WR_BYTE(EP_STAT_CND_ST) ); } else { SIE_WriteCommandData(CMD_SET_EP_STAT(endpointhandle(corenum)[endpointselected[corenum]]), DAT_WR_BYTE(EP_STAT_ST) ); } }