Minor correction to MagStripe demo to fix build problems.
authorDean Camera <dean@fourwalledcubicle.com>
Mon, 29 Jun 2009 11:11:51 +0000 (11:11 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Mon, 29 Jun 2009 11:11:51 +0000 (11:11 +0000)
Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.c
Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c
Projects/Magstripe/Magstripe.c
Projects/Magstripe/Magstripe.h

index 2335a5e..f335b67 100644 (file)
@@ -53,16 +53,17 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* MSInterfaceInfo, co
        uint8_t  CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);\r
        bool     UsingSecondBuffer   = false;\r
 \r
-       /* Copy selected dataflash's current page contents to the dataflash buffer */\r
+       /* Select the correct starting Dataflash IC for the block requested */\r
        Dataflash_SelectChipFromPage(CurrDFPage);\r
+\r
 #if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)\r
+       /* Copy selected dataflash's current page contents to the dataflash buffer */\r
        Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);\r
        Dataflash_SendAddressBytes(CurrDFPage, 0);\r
-#endif\r
        Dataflash_WaitWhileBusy();\r
+#endif\r
 \r
        /* Send the dataflash buffer write command */\r
-       Dataflash_ToggleSelectedChipCS();\r
        Dataflash_SendByte(DF_CMD_BUFF1WRITE);\r
        Dataflash_SendAddressBytes(0, CurrDFPageByte);\r
 \r
@@ -182,8 +183,10 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* MSInterfaceInfo, con
        uint16_t CurrDFPageByte      = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);\r
        uint8_t  CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);\r
 \r
-       /* Send the dataflash main memory page read command */\r
+       /* Select the correct starting Dataflash IC for the block requested */\r
        Dataflash_SelectChipFromPage(CurrDFPage);\r
+\r
+       /* Send the dataflash main memory page read command */\r
        Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);\r
        Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);\r
        Dataflash_SendByte(0x00);\r
@@ -287,19 +290,20 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t Tota
        uint8_t  CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);\r
        bool     UsingSecondBuffer   = false;\r
 \r
-       /* Copy selected dataflash's current page contents to the dataflash buffer */\r
+       /* Select the correct starting Dataflash IC for the block requested */\r
        Dataflash_SelectChipFromPage(CurrDFPage);\r
+\r
 #if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)\r
+       /* Copy selected dataflash's current page contents to the dataflash buffer */\r
        Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);\r
        Dataflash_SendAddressBytes(CurrDFPage, 0);\r
-#endif\r
        Dataflash_WaitWhileBusy();\r
+#endif\r
 \r
        /* Send the dataflash buffer write command */\r
-       Dataflash_ToggleSelectedChipCS();\r
        Dataflash_SendByte(DF_CMD_BUFF1WRITE);\r
        Dataflash_SendAddressBytes(0, CurrDFPageByte);\r
-\r
+       \r
        while (TotalBlocks)\r
        {\r
                uint8_t BytesInBlockDiv16 = 0;\r
@@ -384,8 +388,10 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t Total
        uint16_t CurrDFPageByte      = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);\r
        uint8_t  CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);\r
 \r
-       /* Send the dataflash main memory page read command */\r
+       /* Select the correct starting Dataflash IC for the block requested */\r
        Dataflash_SelectChipFromPage(CurrDFPage);\r
+\r
+       /* Send the dataflash main memory page read command */\r
        Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);\r
        Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);\r
        Dataflash_SendByte(0x00);\r
index 6dc5495..fdc91dd 100644 (file)
@@ -53,16 +53,17 @@ void DataflashManager_WriteBlocks(const uint32_t BlockAddress, uint16_t TotalBlo
        uint8_t  CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);\r
        bool     UsingSecondBuffer   = false;\r
 \r
-       /* Copy selected dataflash's current page contents to the dataflash buffer */\r
+       /* Select the correct starting Dataflash IC for the block requested */\r
        Dataflash_SelectChipFromPage(CurrDFPage);\r
+\r
 #if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)\r
+       /* Copy selected dataflash's current page contents to the dataflash buffer */\r
        Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);\r
        Dataflash_SendAddressBytes(CurrDFPage, 0);\r
-#endif\r
        Dataflash_WaitWhileBusy();\r
+#endif\r
 \r
        /* Send the dataflash buffer write command */\r
-       Dataflash_ToggleSelectedChipCS();\r
        Dataflash_SendByte(DF_CMD_BUFF1WRITE);\r
        Dataflash_SendAddressBytes(0, CurrDFPageByte);\r
 \r
@@ -182,8 +183,10 @@ void DataflashManager_ReadBlocks(const uint32_t BlockAddress, uint16_t TotalBloc
        uint16_t CurrDFPageByte      = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);\r
        uint8_t  CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);\r
 \r
-       /* Send the dataflash main memory page read command */\r
+       /* Select the correct starting Dataflash IC for the block requested */\r
        Dataflash_SelectChipFromPage(CurrDFPage);\r
+\r
+       /* Send the dataflash main memory page read command */\r
        Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);\r
        Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);\r
        Dataflash_SendByte(0x00);\r
@@ -287,16 +290,17 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress, uint16_t Tota
        uint8_t  CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);\r
        bool     UsingSecondBuffer   = false;\r
 \r
-       /* Copy selected dataflash's current page contents to the dataflash buffer */\r
+       /* Select the correct starting Dataflash IC for the block requested */\r
        Dataflash_SelectChipFromPage(CurrDFPage);\r
+\r
 #if (DATAFLASH_PAGE_SIZE > VIRTUAL_MEMORY_BLOCK_SIZE)\r
+       /* Copy selected dataflash's current page contents to the dataflash buffer */\r
        Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF1);\r
        Dataflash_SendAddressBytes(CurrDFPage, 0);\r
-#endif\r
        Dataflash_WaitWhileBusy();\r
+#endif\r
 \r
        /* Send the dataflash buffer write command */\r
-       Dataflash_ToggleSelectedChipCS();\r
        Dataflash_SendByte(DF_CMD_BUFF1WRITE);\r
        Dataflash_SendAddressBytes(0, CurrDFPageByte);\r
 \r
@@ -384,8 +388,10 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress, uint16_t Total
        uint16_t CurrDFPageByte      = ((BlockAddress * VIRTUAL_MEMORY_BLOCK_SIZE) % DATAFLASH_PAGE_SIZE);\r
        uint8_t  CurrDFPageByteDiv16 = (CurrDFPageByte >> 4);\r
 \r
-       /* Send the dataflash main memory page read command */\r
+       /* Select the correct starting Dataflash IC for the block requested */\r
        Dataflash_SelectChipFromPage(CurrDFPage);\r
+\r
+       /* Send the dataflash main memory page read command */\r
        Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);\r
        Dataflash_SendAddressBytes(CurrDFPage, CurrDFPageByte);\r
        Dataflash_SendByte(0x00);\r
index ec2313c..95c81f3 100644 (file)
@@ -166,14 +166,14 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
  *\r
  *  \return Number of bytes in the created report\r
  */\r
-uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData)\r
+uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID, void* ReportData)\r
 {\r
        static bool IsKeyReleaseReport;\r
        static bool IsNewlineReport;\r
 \r
        BitBuffer_t*               Buffer         = NULL;\r
        USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;\r
-               \r
+       \r
        /* Key reports must be interleaved with 0 Key Code reports to release the keys, or repeated keys will be ignored */\r
        IsKeyReleaseReport = !IsKeyReleaseReport;       \r
 \r
@@ -214,8 +214,8 @@ uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* HIDInte
  *  \param[in] ReportData        Pointer to the report buffer where the received report is stored\r
  *  \param[in] ReportSize        Size in bytes of the report received from the host\r
  */\r
-void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo, uint8_t ReportID,\r
-                                          void* ReportData, uint16_t ReportSize)\r
+void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,\r
+                                          const void* ReportData, const uint16_t ReportSize)\r
 {\r
        // Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports\r
 }\r
index 21aa2f2..1009e32 100644 (file)
@@ -79,9 +79,9 @@
                void EVENT_USB_ConfigurationChanged(void);\r
                void EVENT_USB_UnhandledControlPacket(void);\r
 \r
-               uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo, uint8_t* ReportID,\r
+               uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,\r
                                                             void* ReportData);\r
-               void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo, uint8_t ReportID,\r
-                                                  void* ReportData, uint16_t ReportSize);\r
+               void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,\r
+                                                  const void* ReportData, const uint16_t ReportSize);\r
                                                                                                                  \r
 #endif\r