当前位置: 首页>>代码示例>>C++>>正文


C++ Endpoint_SetEndpointDirection函数代码示例

本文整理汇总了C++中Endpoint_SetEndpointDirection函数的典型用法代码示例。如果您正苦于以下问题:C++ Endpoint_SetEndpointDirection函数的具体用法?C++ Endpoint_SetEndpointDirection怎么用?C++ Endpoint_SetEndpointDirection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Endpoint_SetEndpointDirection函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ISPProtocol_LeaveISPMode

/** Handler for the CMD_LEAVE_ISP command, which releases the target from programming mode. */
void ISPProtocol_LeaveISPMode(void)
{
	struct
	{
		uint8_t PreDelayMS;
		uint8_t PostDelayMS;
	} Leave_ISP_Params;

	Endpoint_Read_Stream_LE(&Leave_ISP_Params, sizeof(Leave_ISP_Params), NO_STREAM_CALLBACK);
	
	Endpoint_ClearOUT();
	Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
	Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);

	/* Perform pre-exit delay, release the target /RESET, disable the SPI bus and perform the post-exit delay */
	ISPProtocol_DelayMS(Leave_ISP_Params.PreDelayMS);
	ISPTarget_ChangeTargetResetLine(false);
	ISPTarget_ShutDown();
	ISPProtocol_DelayMS(Leave_ISP_Params.PostDelayMS);

	/* Turn off the synchronous USART to terminate the recovery clock on XCK pin */
	UBRR1  = (F_CPU / 500000UL);
	UCSR1B = (1 << TXEN1);
	UCSR1C = (1 << UMSEL10) | (1 << UPM11) | (1 << USBS1) | (1 << UCSZ11) | (1 << UCSZ10) | (1 << UCPOL1);
	DDRD  &= ~(1 << 5);

	Endpoint_Write_Byte(CMD_LEAVE_PROGMODE_ISP);
	Endpoint_Write_Byte(STATUS_CMD_OK);
	Endpoint_ClearIN();
}
开发者ID:jevinskie,项目名称:lufa-lib,代码行数:31,代码来源:ISPProtocol.c

示例2: V2Protocol_GetSetParam

/** Handler for the CMD_SET_PARAMETER and CMD_GET_PARAMETER commands from the host, setting or
 *  getting a device parameter's value from the parameter table.
 *
 *  \param[in] V2Command  Issued V2 Protocol command byte from the host
 */
static void V2Protocol_GetSetParam(const uint8_t V2Command)
{
	uint8_t ParamID = Endpoint_Read_Byte();
	uint8_t ParamValue;

	if (V2Command == CMD_SET_PARAMETER)
	  ParamValue = Endpoint_Read_Byte();

	Endpoint_ClearOUT();
	Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
	Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);

	Endpoint_Write_Byte(V2Command);

	uint8_t ParamPrivs = V2Params_GetParameterPrivileges(ParamID);

	if ((V2Command == CMD_SET_PARAMETER) && (ParamPrivs & PARAM_PRIV_WRITE))
	{
		Endpoint_Write_Byte(STATUS_CMD_OK);
		V2Params_SetParameterValue(ParamID, ParamValue);
	}
	else if ((V2Command == CMD_GET_PARAMETER) && (ParamPrivs & PARAM_PRIV_READ))
	{
		Endpoint_Write_Byte(STATUS_CMD_OK);
		Endpoint_Write_Byte(V2Params_GetParameterValue(ParamID));
	}
	else
	{
		Endpoint_Write_Byte(STATUS_CMD_FAILED);
	}

	Endpoint_ClearIN();
}
开发者ID:softants,项目名称:lufa-lib,代码行数:38,代码来源:V2Protocol.c

示例3: ISPProtocol_LeaveISPMode

/** Handler for the CMD_LEAVE_ISP command, which releases the target from programming mode. */
void ISPProtocol_LeaveISPMode(void)
{
    struct
    {
        uint8_t PreDelayMS;
        uint8_t PostDelayMS;
    } Leave_ISP_Params;

    Endpoint_Read_Stream_LE(&Leave_ISP_Params, sizeof(Leave_ISP_Params), NULL);

    Endpoint_ClearOUT();
    Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
    Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);

    /* Perform pre-exit delay, release the target /RESET, disable the SPI bus and perform the post-exit delay */
    ISPProtocol_DelayMS(Leave_ISP_Params.PreDelayMS);
    ISPTarget_ChangeTargetResetLine(false);
    ISPTarget_DisableTargetISP();
    ISPProtocol_DelayMS(Leave_ISP_Params.PostDelayMS);

    Endpoint_Write_8(CMD_LEAVE_PROGMODE_ISP);
    Endpoint_Write_8(STATUS_CMD_OK);
    Endpoint_ClearIN();

    ISPActive = false;
}
开发者ID:pbrook,项目名称:minimizer,代码行数:27,代码来源:ISPProtocol.c

示例4: V2Protocol_ResetProtection

/** Handler for the CMD_RESET_PROTECTION command, implemented as a dummy ACK function as
 *  no target short-circuit protection is currently implemented.
 */
static void V2Protocol_ResetProtection(void)
{
	Endpoint_ClearOUT();
	Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
	Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);

	Endpoint_Write_Byte(CMD_RESET_PROTECTION);
	Endpoint_Write_Byte(STATUS_CMD_OK);
	Endpoint_ClearIN();
}
开发者ID:softants,项目名称:lufa-lib,代码行数:13,代码来源:V2Protocol.c

示例5: XPROGProtocol_ReadCRC

/** Handler for the XPROG CRC command to read a specific memory space's CRC value for comparison between the
 *  attached device's memory and a data set on the host.
 */
static void XPROGProtocol_ReadCRC(void)
{
	uint8_t ReturnStatus = XPROG_ERR_OK;

	struct
	{
		uint8_t CRCType;
	} ReadCRC_XPROG_Params;

	Endpoint_Read_Stream_LE(&ReadCRC_XPROG_Params, sizeof(ReadCRC_XPROG_Params), NULL);

	Endpoint_ClearOUT();
	Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
	Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);

	uint32_t MemoryCRC;

	if (XPROG_SelectedProtocol == XPROG_PROTOCOL_PDI)
	{
		uint8_t CRCCommand;

		/* Determine which NVM command to send to the device depending on the memory to CRC */
		switch (ReadCRC_XPROG_Params.CRCType)
		{
			case XPROG_CRC_APP:
				CRCCommand = XMEGA_NVM_CMD_APPCRC;
				break;
			case XPROG_CRC_BOOT:
				CRCCommand = XMEGA_NVM_CMD_BOOTCRC;
				break;
			default:
				CRCCommand = XMEGA_NVM_CMD_FLASHCRC;
				break;
		}

		/* Perform and retrieve the memory CRC, indicate timeout if occurred */
		if (!(XMEGANVM_GetMemoryCRC(CRCCommand, &MemoryCRC)))
		  ReturnStatus = XPROG_ERR_TIMEOUT;
	}
	else
	{
		/* TPI does not support memory CRC */
		ReturnStatus = XPROG_ERR_FAILED;
	}

	Endpoint_Write_8(CMD_XPROG);
	Endpoint_Write_8(XPROG_CMD_CRC);
	Endpoint_Write_8(ReturnStatus);

	if (ReturnStatus == XPROG_ERR_OK)
	{
		Endpoint_Write_8(MemoryCRC >> 16);
		Endpoint_Write_16_LE(MemoryCRC & 0xFFFF);
	}
开发者ID:Steffen-Engel,项目名称:lufa,代码行数:57,代码来源:XPROGProtocol.c

示例6: V2Protocol_SignOn

/** Handler for the CMD_SIGN_ON command, returning the programmer ID string to the host. */
static void V2Protocol_SignOn(void)
{
	Endpoint_ClearOUT();
	Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
	Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);

	Endpoint_Write_Byte(CMD_SIGN_ON);
	Endpoint_Write_Byte(STATUS_CMD_OK);
	Endpoint_Write_Byte(sizeof(PROGRAMMER_ID) - 1);
	Endpoint_Write_Stream_LE(PROGRAMMER_ID, (sizeof(PROGRAMMER_ID) - 1), NO_STREAM_CALLBACK);
	Endpoint_ClearIN();
}
开发者ID:softants,项目名称:lufa-lib,代码行数:13,代码来源:V2Protocol.c

示例7: V2Protocol_SignOn

/** Handler for the CMD_SIGN_ON command, returning the programmer ID string to the host. */
static void V2Protocol_SignOn(void)
{
    Endpoint_ClearOUT();
    Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
    Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);

    Endpoint_Write_8(CMD_SIGN_ON);
    Endpoint_Write_8(STATUS_CMD_OK);
    Endpoint_Write_8(sizeof(PROGRAMMER_ID) - 1);
    Endpoint_Write_Stream_LE(PROGRAMMER_ID, (sizeof(PROGRAMMER_ID) - 1), NULL);
    Endpoint_ClearIN();
}
开发者ID:madhephaestus,项目名称:bowler-bootloader,代码行数:13,代码来源:V2Protocol.c

示例8: XPROGProtocol_EnterXPROGMode

/** Handler for the XPROG ENTER_PROGMODE command to establish a connection with the attached device. */
static void XPROGProtocol_EnterXPROGMode(void)
{
    Endpoint_ClearOUT();
    Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
    Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);

    bool NVMBusEnabled = false;

    if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
    {
        /* Enable PDI programming mode with the attached target */
        XPROGTarget_EnableTargetPDI();

        /* Store the RESET key into the RESET PDI register to keep the XMEGA in reset */
        XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
        XPROGTarget_SendByte(PDI_RESET_KEY);

        /* Lower direction change guard time to 0 USART bits */
        XPROGTarget_SendByte(PDI_CMD_STCS | PDI_CTRL_REG);
        XPROGTarget_SendByte(0x07);

        /* Enable access to the XPROG NVM bus by sending the documented NVM access key to the device */
        XPROGTarget_SendByte(PDI_CMD_KEY);
        for (uint8_t i = sizeof(PDI_NVMENABLE_KEY); i > 0; i--)
            XPROGTarget_SendByte(PDI_NVMENABLE_KEY[i - 1]);

        /* Wait until the NVM bus becomes active */
        NVMBusEnabled = XMEGANVM_WaitWhileNVMBusBusy();
    }
    else if (XPROG_SelectedProtocol == XPRG_PROTOCOL_TPI)
    {
        /* Enable TPI programming mode with the attached target */
        XPROGTarget_EnableTargetTPI();

        /* Lower direction change guard time to 0 USART bits */
        XPROGTarget_SendByte(TPI_CMD_SSTCS | TPI_CTRL_REG);
        XPROGTarget_SendByte(0x07);

        /* Enable access to the XPROG NVM bus by sending the documented NVM access key to the device */
        XPROGTarget_SendByte(TPI_CMD_SKEY);
        for (uint8_t i = sizeof(TPI_NVMENABLE_KEY); i > 0; i--)
            XPROGTarget_SendByte(TPI_NVMENABLE_KEY[i - 1]);

        /* Wait until the NVM bus becomes active */
        NVMBusEnabled = TINYNVM_WaitWhileNVMBusBusy();
    }

    Endpoint_Write_Byte(CMD_XPROG);
    Endpoint_Write_Byte(XPRG_CMD_ENTER_PROGMODE);
    Endpoint_Write_Byte(NVMBusEnabled ? XPRG_ERR_OK : XPRG_ERR_FAILED);
    Endpoint_ClearIN();
}
开发者ID:kimoi,项目名称:XBox-360-AVR-flasher,代码行数:53,代码来源:XPROGProtocol.c

示例9: V2Protocol_LoadAddress

/** Handler for the CMD_LOAD_ADDRESS command, loading the given device address into a
 *  global storage variable for later use, and issuing LOAD EXTENDED ADDRESS commands
 *  to the attached device as required.
 */
static void V2Protocol_LoadAddress(void)
{
	Endpoint_Read_Stream_BE(&CurrentAddress, sizeof(CurrentAddress), NO_STREAM_CALLBACK);

	Endpoint_ClearOUT();
	Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
	Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);

	if (CurrentAddress & (1UL << 31))
	  MustLoadExtendedAddress = true;

	Endpoint_Write_Byte(CMD_LOAD_ADDRESS);
	Endpoint_Write_Byte(STATUS_CMD_OK);
	Endpoint_ClearIN();
}
开发者ID:softants,项目名称:lufa-lib,代码行数:19,代码来源:V2Protocol.c

示例10: V2Protocol_ResetProtection

/** Handler for the CMD_RESET_PROTECTION command, implemented as a dummy ACK function as
 *  no target short-circuit protection is currently implemented.
 */
static void V2Protocol_ResetProtection(void)
{
	Endpoint_ClearOUT();

	if ( use_libusb == true ) {
		Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM__LIBUSB);

	} else {
		Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM__DEFAULT);
	}

	Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);

	Endpoint_Write_8(CMD_RESET_PROTECTION);
	Endpoint_Write_8(STATUS_CMD_OK);
	Endpoint_ClearIN();
}
开发者ID:madworm,项目名称:avrispmkII_LUFA,代码行数:20,代码来源:V2Protocol.c

示例11: V2Protocol_UnknownCommand

/** Handler for unknown V2 protocol commands. This discards all sent data and returns a
 *  STATUS_CMD_UNKNOWN status back to the host.
 *
 *  \param[in] V2Command  Issued V2 Protocol command byte from the host
 */
static void V2Protocol_UnknownCommand(const uint8_t V2Command)
{
	/* Discard all incoming data */
	while (Endpoint_BytesInEndpoint() == AVRISP_DATA_EPSIZE)
	{
		Endpoint_ClearOUT();
		Endpoint_WaitUntilReady();
	}

	Endpoint_ClearOUT();
	Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
	Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);

	Endpoint_Write_Byte(V2Command);
	Endpoint_Write_Byte(STATUS_CMD_UNKNOWN);
	Endpoint_ClearIN();
}
开发者ID:softants,项目名称:lufa-lib,代码行数:22,代码来源:V2Protocol.c

示例12: XPROGProtocol_EnterXPROGMode

/** Handler for the XPROG ENTER_PROGMODE command to establish a connection with the attached device. */
static void XPROGProtocol_EnterXPROGMode(void)
{
	Endpoint_ClearOUT();
	Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
	Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);

	bool NVMBusEnabled = false;

	if (XPROG_SelectedProtocol == XPROG_PROTOCOL_PDI)
	  NVMBusEnabled = XMEGANVM_EnablePDI();
	else if (XPROG_SelectedProtocol == XPROG_PROTOCOL_TPI)
	  NVMBusEnabled = TINYNVM_EnableTPI();

	Endpoint_Write_8(CMD_XPROG);
	Endpoint_Write_8(XPROG_CMD_ENTER_PROGMODE);
	Endpoint_Write_8(NVMBusEnabled ? XPROG_ERR_OK : XPROG_ERR_FAILED);
	Endpoint_ClearIN();
}
开发者ID:Steffen-Engel,项目名称:lufa,代码行数:19,代码来源:XPROGProtocol.c

示例13: V2Protocol_SignOn

/** Handler for the CMD_SIGN_ON command, returning the programmer ID string to the host. */
static void V2Protocol_SignOn(void)
{
	Endpoint_ClearOUT();

	if ( use_libusb == true ) {
		Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM__LIBUSB);

	} else {
		Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM__DEFAULT);
	}

	Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);

	Endpoint_Write_8(CMD_SIGN_ON);
	Endpoint_Write_8(STATUS_CMD_OK);
	Endpoint_Write_8(sizeof(PROGRAMMER_ID) - 1);
	Endpoint_Write_Stream_LE(PROGRAMMER_ID, (sizeof(PROGRAMMER_ID) - 1), NULL);
	Endpoint_ClearIN();
}
开发者ID:madworm,项目名称:avrispmkII_LUFA,代码行数:20,代码来源:V2Protocol.c

示例14: XPROGProtocol_ReadMemory

/** Handler for the XPROG READ_MEMORY command to read data from a specific address space within the
 *  attached device.
 */
static void XPROGProtocol_ReadMemory(void)
{
	uint8_t ReturnStatus = XPROG_ERR_OK;

	struct
	{
		uint8_t  MemoryType;
		uint32_t Address;
		uint16_t Length;
	} ReadMemory_XPROG_Params;

	Endpoint_Read_Stream_LE(&ReadMemory_XPROG_Params, sizeof(ReadMemory_XPROG_Params), NULL);
	ReadMemory_XPROG_Params.Address = SwapEndian_32(ReadMemory_XPROG_Params.Address);
	ReadMemory_XPROG_Params.Length  = SwapEndian_16(ReadMemory_XPROG_Params.Length);

	Endpoint_ClearOUT();
	Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
	Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);

	uint8_t ReadBuffer[256];

	if (XPROG_SelectedProtocol == XPROG_PROTOCOL_PDI)
	{
		/* Read the PDI target's memory, indicate timeout if occurred */
		if (!(XMEGANVM_ReadMemory(ReadMemory_XPROG_Params.Address, ReadBuffer, ReadMemory_XPROG_Params.Length)))
		  ReturnStatus = XPROG_ERR_TIMEOUT;
	}
	else
	{
		/* Read the TPI target's memory, indicate timeout if occurred */
		if (!(TINYNVM_ReadMemory(ReadMemory_XPROG_Params.Address, ReadBuffer, ReadMemory_XPROG_Params.Length)))
		  ReturnStatus = XPROG_ERR_TIMEOUT;
	}

	Endpoint_Write_8(CMD_XPROG);
	Endpoint_Write_8(XPROG_CMD_READ_MEM);
	Endpoint_Write_8(ReturnStatus);

	if (ReturnStatus == XPROG_ERR_OK)
	  Endpoint_Write_Stream_LE(ReadBuffer, ReadMemory_XPROG_Params.Length, NULL);

	Endpoint_ClearIN();
}
开发者ID:Steffen-Engel,项目名称:lufa,代码行数:46,代码来源:XPROGProtocol.c

示例15: XPROGProtocol_SetMode

/** Handler for the CMD_XPROG_SETMODE command, which sets the programmer-to-target protocol used for PDI/TPI
 *  programming.
 */
void XPROGProtocol_SetMode(void)
{
	struct
	{
		uint8_t Protocol;
	} SetMode_XPROG_Params;

	Endpoint_Read_Stream_LE(&SetMode_XPROG_Params, sizeof(SetMode_XPROG_Params), NULL);

	Endpoint_ClearOUT();
	Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR);
	Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);

	XPROG_SelectedProtocol = SetMode_XPROG_Params.Protocol;

	Endpoint_Write_8(CMD_XPROG_SETMODE);
	Endpoint_Write_8((SetMode_XPROG_Params.Protocol != XPROG_PROTOCOL_JTAG) ? STATUS_CMD_OK : STATUS_CMD_FAILED);
	Endpoint_ClearIN();
}
开发者ID:Steffen-Engel,项目名称:lufa,代码行数:22,代码来源:XPROGProtocol.c


注:本文中的Endpoint_SetEndpointDirection函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。