Commit 2f95eea1 authored by Dean Camera's avatar Dean Camera
Browse files

Add LOAD ADDRESS command parsing to the V2 Protocol hander in the AVRISP project.

Fix up references to functions in the Endpoint/Pipe documentation.
parent a9602f02
......@@ -97,7 +97,7 @@
/** Event for USB device attachment. This event fires when a the USB interface is in host mode, and
* a USB device has been connected to the USB interface. This is interrupt driven, thus fires before
* the standard \ref EVENT_USB_Device_Connect event and so can be used to programmatically start the USB
* the standard \ref EVENT_USB_Device_Connect() event and so can be used to programmatically start the USB
* management task to reduce CPU consumption.
*
* \note This event only exists on USB AVR models which supports host mode.
......
......@@ -789,7 +789,7 @@
*/
uint8_t Endpoint_Write_Stream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE.
/** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE().
*
* \ingroup Group_EndpointStreamRW
*
......@@ -801,7 +801,7 @@
*/
uint8_t Endpoint_Write_EStream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** FLASH buffer source version of \ref Endpoint_Write_Stream_LE.
/** FLASH buffer source version of \ref Endpoint_Write_Stream_LE().
*
* \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
*
......@@ -838,7 +838,7 @@
*/
uint8_t Endpoint_Write_Stream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE.
/** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE().
*
* \ingroup Group_EndpointStreamRW
*
......@@ -850,7 +850,7 @@
*/
uint8_t Endpoint_Write_EStream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** FLASH buffer source version of \ref Endpoint_Write_Stream_BE.
/** FLASH buffer source version of \ref Endpoint_Write_Stream_BE().
*
* \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
*
......@@ -887,7 +887,7 @@
*/
uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Endpoint_Read_Stream_LE.
/** EEPROM buffer source version of \ref Endpoint_Read_Stream_LE().
*
* \ingroup Group_EndpointStreamRW
*
......@@ -922,7 +922,7 @@
*/
uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Endpoint_Read_Stream_BE.
/** EEPROM buffer source version of \ref Endpoint_Read_Stream_BE().
*
* \ingroup Group_EndpointStreamRW
*
......@@ -975,7 +975,7 @@
*/
uint8_t Endpoint_Write_Control_EStream_LE(void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
/** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE.
/** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE().
*
* \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction.
......@@ -1018,7 +1018,7 @@
*/
uint8_t Endpoint_Write_Control_Stream_BE(void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE.
/** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE().
*
* \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction.
......@@ -1037,7 +1037,7 @@
*/
uint8_t Endpoint_Write_Control_EStream_BE(void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
/** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE.
/** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE().
*
* \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction.
......@@ -1080,7 +1080,7 @@
*/
uint8_t Endpoint_Read_Control_Stream_LE(void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE.
/** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE().
*
* \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction.
......@@ -1121,7 +1121,7 @@
*/
uint8_t Endpoint_Read_Control_Stream_BE(void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE.
/** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE().
*
* \note This function automatically clears the control transfer's status stage. Do not manually attempt
* to clear the status stage when using this routine in a control transaction.
......
......@@ -836,7 +836,7 @@
*/
uint8_t Pipe_Write_Stream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Pipe_Write_Stream_LE.
/** EEPROM buffer source version of \ref Pipe_Write_Stream_LE().
*
* \ingroup Group_PipeStreamRW
*
......@@ -848,7 +848,7 @@
*/
uint8_t Pipe_Write_EStream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** FLASH buffer source version of \ref Pipe_Write_Stream_LE.
/** FLASH buffer source version of \ref Pipe_Write_Stream_LE().
*
* \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
*
......@@ -885,7 +885,7 @@
*/
uint8_t Pipe_Write_Stream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Pipe_Write_Stream_BE.
/** EEPROM buffer source version of \ref Pipe_Write_Stream_BE().
*
* \ingroup Group_PipeStreamRW
*
......@@ -897,7 +897,7 @@
*/
uint8_t Pipe_Write_EStream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** FLASH buffer source version of \ref Pipe_Write_Stream_BE.
/** FLASH buffer source version of \ref Pipe_Write_Stream_BE().
*
* \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
*
......@@ -926,7 +926,7 @@
*
* \ingroup Group_PipeStreamRW
*
* \param[out] Buffer Pointer to the source data buffer to write to.
* \param[out] Buffer Pointer to the source data buffer to write to.
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
*
......@@ -934,11 +934,11 @@
*/
uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Pipe_Read_Stream_LE.
/** EEPROM buffer source version of \ref Pipe_Read_Stream_LE().
*
* \ingroup Group_PipeStreamRW
*
* \param[out] Buffer Pointer to the source data buffer to write to.
* \param[out] Buffer Pointer to the source data buffer to write to.
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
*
......@@ -961,7 +961,7 @@
*
* \ingroup Group_PipeStreamRW
*
* \param[out] Buffer Pointer to the source data buffer to write to.
* \param[out] Buffer Pointer to the source data buffer to write to.
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
*
......@@ -969,11 +969,11 @@
*/
uint8_t Pipe_Read_Stream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
/** EEPROM buffer source version of \ref Pipe_Read_Stream_BE.
/** EEPROM buffer source version of \ref Pipe_Read_Stream_BE().
*
* \ingroup Group_PipeStreamRW
*
* \param[out] Buffer Pointer to the source data buffer to write to.
* \param[out] Buffer Pointer to the source data buffer to write to.
* \param[in] Length Number of bytes to read for the currently selected pipe to read from.
* \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback
*
......
......@@ -36,6 +36,9 @@
#define INCLUDE_FROM_V2PROTOCOL_C
#include "V2Protocol.h"
uint32_t CurrentAddress;
/* Table of masks for SPI_Init() from a given PARAM_SCK_DURATION value */
static const uint8_t SPIMaskFromSCKDuration[MAX_SPI_SETTINGS] =
{
......@@ -88,6 +91,9 @@ void V2Protocol_ProcessCommand(void)
case CMD_GET_PARAMETER:
V2Protocol_Command_GetSetParam(V2Command);
break;
case CMD_LOAD_ADDRESS:
V2Protocol_Command_LoadAddress();
break;
case CMD_SPI_MULTI:
V2Protocol_Command_SPIMulti();
break;
......@@ -127,6 +133,7 @@ static void V2Protocol_Command_SignOn(void)
Endpoint_WaitUntilReady();
V2Protocol_ReconfigureSPI();
CurrentAddress = 0;
Endpoint_Write_Byte(CMD_SIGN_ON);
Endpoint_Write_Byte(STATUS_CMD_OK);
......@@ -166,6 +173,19 @@ static void V2Protocol_Command_GetSetParam(uint8_t V2Command)
Endpoint_ClearIN();
}
static void V2Protocol_Command_LoadAddress(void)
{
CurrentAddress = Endpoint_Read_DWord_LE();
Endpoint_ClearOUT();
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
Endpoint_WaitUntilReady();
Endpoint_Write_Byte(CMD_LOAD_ADDRESS);
Endpoint_Write_Byte(STATUS_CMD_OK);
Endpoint_ClearIN();
}
static void V2Protocol_Command_SPIMulti(void)
{
uint8_t TxBytes = Endpoint_Read_Byte();
......
......@@ -62,6 +62,7 @@
static void V2Protocol_Command_Unknown(uint8_t V2Command);
static void V2Protocol_Command_SignOn(void);
static void V2Protocol_Command_GetSetParam(uint8_t V2Command);
static void V2Protocol_Command_LoadAddress(void);
static void V2Protocol_Command_SPIMulti(void);
#endif
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment