Add LOAD ADDRESS command parsing to the V2 Protocol hander in the AVRISP project.
authorDean Camera <dean@fourwalledcubicle.com>
Thu, 20 Aug 2009 07:16:55 +0000 (07:16 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Thu, 20 Aug 2009 07:16:55 +0000 (07:16 +0000)
Fix up references to functions in the Endpoint/Pipe documentation.

LUFA/Drivers/USB/HighLevel/Events.h
LUFA/Drivers/USB/LowLevel/Endpoint.h
LUFA/Drivers/USB/LowLevel/Pipe.h
Projects/Unfinished/AVRISP/Lib/V2Protocol.c
Projects/Unfinished/AVRISP/Lib/V2Protocol.h

index 4ed6537..9b60a95 100644 (file)
@@ -97,7 +97,7 @@
                        \r
                        /** Event for USB device attachment. This event fires when a the USB interface is in host mode, and\r
                         *  a USB device has been connected to the USB interface. This is interrupt driven, thus fires before\r
-                        *  the standard \ref EVENT_USB_Device_Connect event and so can be used to programmatically start the USB\r
+                        *  the standard \ref EVENT_USB_Device_Connect() event and so can be used to programmatically start the USB\r
                         *  management task to reduce CPU consumption.\r
                         *\r
                         *  \note This event only exists on USB AVR models which supports host mode.\r
index e27ac50..977c63c 100644 (file)
                         */\r
                        uint8_t Endpoint_Write_Stream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
 \r
-                       /** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE.\r
+                       /** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE().\r
                         *\r
                         *  \ingroup Group_EndpointStreamRW\r
                         *\r
                         */\r
                        uint8_t Endpoint_Write_EStream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
 \r
-                       /** FLASH buffer source version of \ref Endpoint_Write_Stream_LE.\r
+                       /** FLASH buffer source version of \ref Endpoint_Write_Stream_LE().\r
                         *\r
                         *  \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.\r
                         *\r
                         */\r
                        uint8_t Endpoint_Write_Stream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
 \r
-                       /** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE.\r
+                       /** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE().\r
                         *\r
                         *  \ingroup Group_EndpointStreamRW\r
                         *\r
                         */\r
                        uint8_t Endpoint_Write_EStream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
 \r
-                       /** FLASH buffer source version of \ref Endpoint_Write_Stream_BE.\r
+                       /** FLASH buffer source version of \ref Endpoint_Write_Stream_BE().\r
                         *\r
                         *  \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.\r
                         *\r
                         */\r
                        uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
 \r
-                       /** EEPROM buffer source version of \ref Endpoint_Read_Stream_LE.\r
+                       /** EEPROM buffer source version of \ref Endpoint_Read_Stream_LE().\r
                         *\r
                         *  \ingroup Group_EndpointStreamRW\r
                         *\r
                         */\r
                        uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
 \r
-                       /** EEPROM buffer source version of \ref Endpoint_Read_Stream_BE.\r
+                       /** EEPROM buffer source version of \ref Endpoint_Read_Stream_BE().\r
                         *\r
                         *  \ingroup Group_EndpointStreamRW\r
                         *\r
                         */\r
                        uint8_t Endpoint_Write_Control_EStream_LE(void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);\r
 \r
-                       /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE.\r
+                       /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE().\r
                         *\r
                         *  \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
                         *        to clear the status stage when using this routine in a control transaction.\r
                         */\r
                        uint8_t Endpoint_Write_Control_Stream_BE(void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);\r
 \r
-                       /** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE.\r
+                       /** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE().\r
                         *\r
                         *  \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
                         *        to clear the status stage when using this routine in a control transaction.\r
                         */\r
                        uint8_t Endpoint_Write_Control_EStream_BE(void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);\r
 \r
-                       /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE.\r
+                       /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE().\r
                         *\r
                         *  \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
                         *        to clear the status stage when using this routine in a control transaction.\r
                         */\r
                        uint8_t Endpoint_Read_Control_Stream_LE(void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);\r
 \r
-                       /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE.\r
+                       /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE().\r
                         *\r
                         *  \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
                         *        to clear the status stage when using this routine in a control transaction.\r
                         */\r
                        uint8_t Endpoint_Read_Control_Stream_BE(void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);                \r
                        \r
-                       /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE.\r
+                       /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE().\r
                         *\r
                         *  \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
                         *        to clear the status stage when using this routine in a control transaction.\r
index b6fad51..3931f85 100644 (file)
                         */\r
                        uint8_t Pipe_Write_Stream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);                           \r
 \r
-                       /** EEPROM buffer source version of \ref Pipe_Write_Stream_LE.\r
+                       /** EEPROM buffer source version of \ref Pipe_Write_Stream_LE().\r
                         *\r
                         *  \ingroup Group_PipeStreamRW\r
                         *\r
                         */\r
                        uint8_t Pipe_Write_EStream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
                        \r
-                       /** FLASH buffer source version of \ref Pipe_Write_Stream_LE.\r
+                       /** FLASH buffer source version of \ref Pipe_Write_Stream_LE().\r
                         *\r
                         *  \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.\r
                         *\r
                         */\r
                        uint8_t Pipe_Write_Stream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
 \r
-                       /** EEPROM buffer source version of \ref Pipe_Write_Stream_BE.\r
+                       /** EEPROM buffer source version of \ref Pipe_Write_Stream_BE().\r
                         *\r
                         *  \ingroup Group_PipeStreamRW\r
                         *\r
                         */\r
                        uint8_t Pipe_Write_EStream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
                        \r
-                       /** FLASH buffer source version of \ref Pipe_Write_Stream_BE.\r
+                       /** FLASH buffer source version of \ref Pipe_Write_Stream_BE().\r
                         *\r
                         *  \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.\r
                         *\r
                         *\r
                         *  \ingroup Group_PipeStreamRW\r
                         *\r
-                        *  \param[out] Buffer    Pointer to the source data buffer to write to.\r
+                        *  \param[out] Buffer   Pointer to the source data buffer to write to.\r
                         *  \param[in] Length    Number of bytes to read for the currently selected pipe to read from.\r
                         *  \param[in] Callback  Name of a callback routine to call between successive USB packet transfers, NULL if no callback\r
                         *\r
                         */\r
                        uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
 \r
-                       /** EEPROM buffer source version of \ref Pipe_Read_Stream_LE.\r
+                       /** EEPROM buffer source version of \ref Pipe_Read_Stream_LE().\r
                         *\r
                         *  \ingroup Group_PipeStreamRW\r
                         *\r
-                        *  \param[out] Buffer    Pointer to the source data buffer to write to.\r
+                        *  \param[out] Buffer   Pointer to the source data buffer to write to.\r
                         *  \param[in] Length    Number of bytes to read for the currently selected pipe to read from.\r
                         *  \param[in] Callback  Name of a callback routine to call between successive USB packet transfers, NULL if no callback\r
                         *\r
                         *\r
                         *  \ingroup Group_PipeStreamRW\r
                         *\r
-                        *  \param[out] Buffer    Pointer to the source data buffer to write to.\r
+                        *  \param[out] Buffer   Pointer to the source data buffer to write to.\r
                         *  \param[in] Length    Number of bytes to read for the currently selected pipe to read from.\r
                         *  \param[in] Callback  Name of a callback routine to call between successive USB packet transfers, NULL if no callback\r
                         *\r
                         */\r
                        uint8_t Pipe_Read_Stream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
                        \r
-                       /** EEPROM buffer source version of \ref Pipe_Read_Stream_BE.\r
+                       /** EEPROM buffer source version of \ref Pipe_Read_Stream_BE().\r
                         *\r
                         *  \ingroup Group_PipeStreamRW\r
                         *\r
-                        *  \param[out] Buffer    Pointer to the source data buffer to write to.\r
+                        *  \param[out] Buffer   Pointer to the source data buffer to write to.\r
                         *  \param[in] Length    Number of bytes to read for the currently selected pipe to read from.\r
                         *  \param[in] Callback  Name of a callback routine to call between successive USB packet transfers, NULL if no callback\r
                         *\r
index dfa27ad..e55a700 100644 (file)
@@ -36,6 +36,9 @@
 #define  INCLUDE_FROM_V2PROTOCOL_C\r
 #include "V2Protocol.h"\r
 \r
+uint32_t CurrentAddress;\r
+\r
+\r
 /* Table of masks for SPI_Init() from a given PARAM_SCK_DURATION value */\r
 static const uint8_t SPIMaskFromSCKDuration[MAX_SPI_SETTINGS] =\r
        {\r
@@ -88,6 +91,9 @@ void V2Protocol_ProcessCommand(void)
                case CMD_GET_PARAMETER:\r
                        V2Protocol_Command_GetSetParam(V2Command);\r
                        break;\r
+               case CMD_LOAD_ADDRESS:\r
+                       V2Protocol_Command_LoadAddress();\r
+                       break;\r
                case CMD_SPI_MULTI:\r
                        V2Protocol_Command_SPIMulti();\r
                        break;          \r
@@ -127,6 +133,7 @@ static void V2Protocol_Command_SignOn(void)
        Endpoint_WaitUntilReady();\r
 \r
        V2Protocol_ReconfigureSPI();\r
+       CurrentAddress = 0;\r
 \r
        Endpoint_Write_Byte(CMD_SIGN_ON);\r
        Endpoint_Write_Byte(STATUS_CMD_OK);\r
@@ -166,6 +173,19 @@ static void V2Protocol_Command_GetSetParam(uint8_t V2Command)
        Endpoint_ClearIN();\r
 }\r
 \r
+static void V2Protocol_Command_LoadAddress(void)\r
+{\r
+       CurrentAddress = Endpoint_Read_DWord_LE();\r
+\r
+       Endpoint_ClearOUT();\r
+       Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);\r
+       Endpoint_WaitUntilReady();\r
+\r
+       Endpoint_Write_Byte(CMD_LOAD_ADDRESS);\r
+       Endpoint_Write_Byte(STATUS_CMD_OK);\r
+       Endpoint_ClearIN();\r
+}\r
+\r
 static void V2Protocol_Command_SPIMulti(void)\r
 {\r
        uint8_t TxBytes     = Endpoint_Read_Byte();\r
index 03ca835..5283f19 100644 (file)
@@ -62,6 +62,7 @@
                        static void    V2Protocol_Command_Unknown(uint8_t V2Command);\r
                        static void    V2Protocol_Command_SignOn(void);\r
                        static void    V2Protocol_Command_GetSetParam(uint8_t V2Command);\r
+                       static void    V2Protocol_Command_LoadAddress(void);\r
                        static void    V2Protocol_Command_SPIMulti(void);\r
                #endif