summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/LCDriver.rc6
-rw-r--r--source/LCDriverMethods.cpp14
-rw-r--r--source/LCDriverMethods.h9
-rw-r--r--source/LCM/include/t_bulk_protocol.h91
-rw-r--r--source/utilities/MemMappedFile.cpp6
5 files changed, 55 insertions, 71 deletions
diff --git a/source/LCDriver.rc b/source/LCDriver.rc
index 6a8185f..05c89ca 100644
--- a/source/LCDriver.rc
+++ b/source/LCDriver.rc
@@ -81,15 +81,15 @@ BEGIN
BEGIN
BLOCK "000904b0"
BEGIN
- VALUE "Comments", "Build date: 2011-09-28"
+ VALUE "Comments", "Build date: 2011-10-13"
VALUE "CompanyName", "STEricsson AB"
VALUE "FileDescription", "LCDriver Dynamic Link Library"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "Loader Communication Driver"
VALUE "LegalCopyright", "Copyright (C) STEricsson AB 2011"
- VALUE "PrivateBuild", "Change-Id: I23db5d677a9eef4771bc3a76089faf32fc60424f"
+ VALUE "PrivateBuild", "Change-Id: I372f164a742d031976ae9aed50a509f130a101cd"
VALUE "ProductName", "CXC 173 0865, LCDriver DLL"
- VALUE "ProductVersion", "P1S"
+ VALUE "ProductVersion", "PT5"
END
END
BLOCK "VarFileInfo"
diff --git a/source/LCDriverMethods.cpp b/source/LCDriverMethods.cpp
index 8a23a40..147bb2a 100644
--- a/source/LCDriverMethods.cpp
+++ b/source/LCDriverMethods.cpp
@@ -92,7 +92,6 @@ CLCDriverMethods::CLCDriverMethods(const char *pchInterfaceId):
CLCDriverMethods::~CLCDriverMethods()
{
m_EventQueue.SignalEvent();
- CLockCS lock(LCDMethodsCS);
OS::Sleep(200);
if (0 != m_pMainThread) {
@@ -331,16 +330,16 @@ ErrorCode_e CLCDriverMethods::CEH_A2_CallbackFunction(void *pObject, CommandData
//----------------------------------------
-void CLCDriverMethods::BulkCommandReqCallback(void *pObject, uint16 uiSession, uint32 uiChunkSize, uint64 uiOffset, uint32 uiLength, boolean bAckRead)
+void CLCDriverMethods::BulkCommandReqCallback(void *pObject, uint16 *puiSession, uint32 *puiChunkSize, uint64 *puiOffset, uint32 *puiLength, boolean bAckRead)
{
CLCDriverMethods *pLcdMethods = static_cast<CLCDriverMethods *>(pObject);
- return pLcdMethods->m_pBulkHandler->HandleCommandRequest(uiSession, uiChunkSize, uiOffset, uiLength, bAckRead ? true : false);
+ return pLcdMethods->m_pBulkHandler->HandleCommandRequest(*puiSession, *puiChunkSize, *puiOffset, *puiLength, bAckRead ? true : false);
}
-void CLCDriverMethods::BulkDataReqCallback(void *pObject, uint16 uiSession, uint32 uiChunkSize, uint64 uiOffset, uint32 uiLength, uint64 uiTotalLength, uint32 uiTransferedLength)
+void CLCDriverMethods::BulkDataReqCallback(void *pObject, uint16 *puiSession, uint32 *puiChunkSize, uint64 *puiOffset, uint32 *puiLength, uint64 *puiTotalLength, uint32 *puiTransferedLength)
{
CLCDriverMethods *pLcdMethods = static_cast<CLCDriverMethods *>(pObject);
- return pLcdMethods->Do_BulkDataReqCallback(uiSession, uiChunkSize, uiOffset, uiLength, uiTotalLength, uiTransferedLength);
+ return pLcdMethods->Do_BulkDataReqCallback(puiSession, puiChunkSize, puiOffset, puiLength, puiTotalLength, puiTransferedLength);
}
void CLCDriverMethods::BulkDataEndOfDumpCallback(void *pObject)
@@ -908,7 +907,6 @@ int CLCDriverMethods::Do_Flash_ProcessFile(const char *pchPath, const char *pchT
#endif
if (iUseBulk) {
- CLockCS lock(LCDMethodsCS);
m_pLcmInterface->BulkSetCallbacks((void *)BulkCommandReqCallback, (void *)BulkDataReqCallback, (void *)BulkDataEndOfDumpCallback);
VERIFY_SUCCESS(m_pBuffers->AllocateBulkFile(pchPath));
uint64 uiLength = m_pBuffers->GetBulkFileLength();
@@ -2603,9 +2601,9 @@ int CLCDriverMethods::WaitForPROTROMResponseOrCancelOrTimeout(int iReceivePdu)
return iResult;
}
-void CLCDriverMethods::Do_BulkDataReqCallback(uint16 Session, uint32 ChunkSize, uint64 Offset, uint32 Length, uint64 TotalLength, uint32 TransferredLength)
+void CLCDriverMethods::Do_BulkDataReqCallback(uint16 *Session_p, uint32 *ChunkSize_p, uint64 *Offset_p, uint32 *Length_p, uint64 *TotalLength_p, uint32 *TransferredLength_p)
{
- m_uiBulkTransferred += ChunkSize;
+ m_uiBulkTransferred += *ChunkSize_p;
}
void CLCDriverMethods::UpdateBulkProgress()
diff --git a/source/LCDriverMethods.h b/source/LCDriverMethods.h
index 2bbf189..c63cd84 100644
--- a/source/LCDriverMethods.h
+++ b/source/LCDriverMethods.h
@@ -155,7 +155,6 @@ private:
LoaderRpcInterfaceImpl *m_pLoaderRpcFunctions;
A2LoaderRpcInterfaceImpl *m_pA2LoaderRpcFunctions;
CLCDriverThread *m_pMainThread;
- CCriticalSectionObject LCDMethodsCS;
//------------------------------------------
// Static methods for support modules: timers, hash, buffers and queue
@@ -205,11 +204,11 @@ public:
//-----------------------------------------
// Bulk Transfer Protocol callbacks
//-----------------------------------------
- static void BulkCommandReqCallback(void *pObject, uint16 uiSession, uint32 uiChunkSize, uint64 uiOffset, uint32 uiLength, boolean bAckRead);
- void Do_BulkCommandReqCallback(uint16 uiSession, uint32 uiChunkSize, uint64 uiOffset, uint32 uiLength);
+ static void BulkCommandReqCallback(void *pObject, uint16 *puiSession, uint32 *puiChunkSize, uint64 *puiOffset, uint32 *puiLength, boolean bAckRead);
+ void Do_BulkCommandReqCallback(uint16 *puiSession, uint32 *puiChunkSize, uint64 *puiOffset, uint32 *puiLength);
- static void BulkDataReqCallback(void *pObject, uint16 uiSession, uint32 uiChunkSize, uint64 uiOffset, uint32 uiLength, uint64 uiTotalLength, uint32 uiTransferedLength);
- void Do_BulkDataReqCallback(uint16 uiSession, uint32 uiChunkSize, uint64 uiOffset, uint32 uiLength, uint64 uiTotalLength, uint32 uiTransferedLength);
+ static void BulkDataReqCallback(void *pObject, uint16 *puiSession, uint32 *puiChunkSize, uint64 *puiOffset, uint32 *puiLength, uint64 *puiTotalLength, uint32 *puiTransferedLength);
+ void Do_BulkDataReqCallback(uint16 *puiSession, uint32 *puiChunkSize, uint64 *puiOffset, uint32 *puiLength, uint64 *puiTotalLength, uint32 *puiTransferedLength);
static void BulkDataEndOfDumpCallback(void *pObject);
void Do_BulkDataEndOfDumpCallback();
diff --git a/source/LCM/include/t_bulk_protocol.h b/source/LCM/include/t_bulk_protocol.h
index 99109e6..fabc1a4 100644
--- a/source/LCM/include/t_bulk_protocol.h
+++ b/source/LCM/include/t_bulk_protocol.h
@@ -18,7 +18,6 @@
******************************************************************************/
#include "t_basicdefinitions.h"
#include "t_r15_network_layer.h"
-#include "t_critical_section.h"
/*******************************************************************************
* Types, constants
@@ -35,12 +34,11 @@
/** Defined bulk error in 64 bits format. */
#define BULK_ERROR_64 0xffffffffffffffff
-#ifndef CFG_ENABLE_LOADER_TYPE
/** Defined Callback functions used for bulk transfer in the LCM on PC side. */
-typedef void (*BulkCommandReqCallback_t)(void *Object_p, uint16 Session, uint32 ChunkSize, uint64 Offset, uint32 Length, boolean ACK_Read);
-typedef void (*BulkDataReqCallback_t)(void *Object_p, uint16 Session, uint32 ChunkSize, uint64 Offset, uint32 Length, uint64 TotalLength, uint32 TransferedLength);
-typedef void (*BulkDataEndOfDump_t)(void *Object_p);
-#endif // CFG_ENABLE_LOADER_TYPE
+typedef void (*BulkCommandReqCallback_t)(void *Object_p, uint16 *Session_p, uint32 *ChunkSize_p, uint64 *Offset_p, uint32 *Length_p, boolean ACK_Read);
+typedef void(*BulkDataReqCallback_t)(void *Object_p, uint16 *Session_p, uint32 *ChunkSize_p, uint64 *Offset_p, uint32 *Length_p, uint64 *TotalLength_p, uint32 *TransferedLength_p);
+typedef void(*BulkDataEndOfDump_t)(void *Object_p);
+
/** Defined bulk commands. */
typedef enum {
@@ -59,19 +57,19 @@ typedef enum {
/** States of bulk protocol. */
TYPEDEF_ENUM {
- BULK_IDLE_STATE = 0, /**< Idle state. */
- SEND_READ_REQUEST = 1, /**< Send read request command to PC. */
- WAIT_CHUNKS = 2, /**< Wait to receive all expected chunks. */
- SEND_WRITE_REQUEST = 3, /**< Send write request command. */
- WAIT_READ_REQUEST = 4, /**< Wait read request from PC. */
- PROCESSING_CHUNKS = 5, /**< Calculate CRC and get chunks ready for sending. */
- WAIT_CHUNK_SENT = 6, /**< Wait for chunk to be sent. */
- SENDING_CHUNKS = 7, /**< Send chunks to PC. */
- WAIT_BULK_ACK = 8, /**< Wait bulk acknowledge to PC. */
- WAIT_TX_DONE = 9, /**< Wait all chunks to be sent. */
- WRITE_BULK_FINISH = 10, /**< Bulk acknowledge has been received,
- finish the write bulk process. */
- WAIT_WRITE_REQUEST = 11 /**< Wait bulk request command. */
+ BULK_IDLE_STATE = 0, /**< Idle state. */
+ SEND_READ_REQUEST = 1, /**< Send read request command to PC. */
+ WAIT_CHUNKS = 2, /**< Wait to receive all expected chunks. */
+ SEND_BULK_ACK = 3, /**< Send bulk acknowledge to PC. */
+ WAIT_BULK_ACK_TIMEOUT = 4, /**< Wait timeout for confirmation of bulk
+ ack command. */
+ SEND_WRITE_REQUEST = 5, /**< Send write request command. */
+ WAIT_READ_REQUEST = 6, /**< Wait read request from PC. */
+ SENDING_CHUNKS = 7, /**< Send chunks to PC. */
+ WAIT_BULK_ACK = 8, /**< Wait bulk acknowledge to PC. */
+ WRITE_BULK_FINISH = 9, /**< Bulk acknowledge has been received,
+ finish the write bulk process. */
+ WAIT_WRITE_REQUEST = 10 /**< Wait bulk request command. */
} ENUM8(TL_BulkProtocolState_t);
/** Defined bulk process states. */
@@ -106,60 +104,49 @@ typedef enum {
* Bulk Vector Entry parameters
*/
typedef struct {
- PacketMeta_t *Buffer_p; /**< Pointer to reserved buffer meta info. */
- uint8 *Payload_p; /**< Pointer to payload data in reserved
- buffer. */
- uint8 *Hash_p; /**< Pointer to calculated payload hash. */
- boolean RetransmissionRequested; /**< Determines if retransmission for the packet
- was requested earlier to avoid sending requests
- for the same packet multiple times. */
+ PacketMeta_t *Buffer_p; /**< Pointer to reserved buffer meta info. */
+ uint8 *Payload_p; /**< Pointer to payload data in reserved
+ buffer. */
+ uint8 *Hash_p; /**< Pointer to calculated payload hash. */
} TL_BulkVectorEntry_t;
/**
* This type defines Bulk Vector parameters
*/
typedef struct {
- /** Bulk session status. */
+ /**< Bulk session status. */
TL_BulkSessionState_t Status;
- /** Requested bulk process(Read or Write). */
+ /**< Requested bulk process(Read or Write). */
TL_SessionMode_t Mode;
- /** State of bulk protocol state machine. */
+ /**< State of bulk protocol state machine. */
TL_BulkProtocolState_t State;
- /** Current bulk session ID. */
+ /**< Current bulk session ID. */
uint16 SessionId;
- /** Length of the file transfered with bulk transfer. */
+ /**< Length of the file transfered with bulk transfer. */
uint64 TotalLength;
- /** Length of payload data transfered with bulk transfer. */
+ /**< Length of payload data transfered with bulk transfer. */
uint32 Length;
- /** Number of used buffers for bulk transfer. */
+ /**< Number of used buffers for bulk transfer. */
uint32 Buffers;
- /** requested size of payload. */
+ /**< requested size of payload. */
uint32 ChunkSize;
- /** Offset in the current opened file.*/
+ /**< Offset in the cuurent opened file.*/
uint64 Offset;
- /** Length of payload data transfered with bulk transfer. */
+ /**< Length of payload data transfered with bulk transfer. */
uint32 TransferedLength;
- /** ID of the chunk that currently being sent. */
- uint32 SendingChunkId;
- /** Callback function pointer for bulk command handling.*/
- void *BulkCommandCallback_p;
- /** Callback function pointer for bulk data command handling.*/
- void *BulkDataCallback_p;
- /** Array with information for used buffers. */
+ /**< Callback function pointer for bulk command handling.*/
+ void *BulkCommandCallback_p;
+ /**< Callback function pointer for bulk data command handling.*/
+ void *BulkDataCallback_p;
+ /**< Array with information for used buffers. */
TL_BulkVectorEntry_t Entries[MAX_BULK_TL_PROCESSES];
} TL_BulkVectorList_t;
/** Structure for current bulk transfer handling. */
typedef struct {
- uint32 TimerKey; /**< Timer Id for current used timer. */
- TL_BulkVectorList_t *BulkVector_p; /**< Current used bulk vector for bulk
- transfer.*/
- CriticalSection_t BulkTransferCS; /**< Synchronization object used to avoid
- parallel access in bulk transmitter
- function. */
- BulkExtendedHeader_t *PendingBulkHeader_p; /**< Pending Read Request data. Needed for
- opening new session, received while
- current session is in process of sending. */
+ uint32 TimerKey; /**< Timer Id for current used timer. */
+ TL_BulkVectorList_t *BulkVector_p; /**< Current used bulk vector for bulk
+ transfer.*/
} BulkHandle_t;
/** @} */
diff --git a/source/utilities/MemMappedFile.cpp b/source/utilities/MemMappedFile.cpp
index 04a47f0..018a7c0 100644
--- a/source/utilities/MemMappedFile.cpp
+++ b/source/utilities/MemMappedFile.cpp
@@ -116,9 +116,9 @@ int MemMappedFile::LoadFileData(const char *path)
size_ = fileStat.st_size;
- /* Map file in memory, BUT DON"T Reserve SWAP memory, use only physical memory */
- mappedData_ = static_cast<uint8 *>(mmap(0, size_, PROT_READ, MAP_PRIVATE | MAP_NORESERVE /*| MAP_POPULATE*/, descriptor_, 0));
-
+ /* Map file in memory, BUT DON"T Reserve SWAP memory, use only physical memory */
+ mappedData_ = static_cast<uint8 *>(mmap(0, size_, PROT_READ, MAP_PRIVATE | MAP_NORESERVE /*| MAP_POPULATE*/, descriptor_, 0));
+
if (MAP_FAILED != mappedData_) {
isMapped_ = true;
} else {