\r
#include <string.h>\r
#include "Mcu.h"\r
-#include "Dcm_Cfg.h"\r
-#include "Dcm_Cbk.h"\r
#include "Dcm.h"\r
#include "Dcm_Internal.h"\r
#include "Det.h"\r
#define USE_DEBUG_PRINTF\r
#include "debug.h"\r
\r
-#define TIMER_DECREMENT(timer) \\r
- if (timer > 0) { \\r
- timer = timer - 1; \\r
- } \\r
+#define DECREMENT(timer) { if (timer > 0) timer--; }\r
+#define DCM_CONVERT_MS_TO_MAIN_CYCLES(x) ((x)/DCM_MAIN_FUNCTION_PERIOD_TIME_MS)\r
\r
-#define COUNT_DECREMENT(timer) \\r
- if (timer > 0) { \\r
- timer = timer - 1; \\r
- } \\r
\r
/*\r
* Type definitions.\r
listEntry = DCM_Config.Dsl->DslProtocol->DslProtocolRowList;\r
while (listEntry->Arc_EOL == FALSE) {\r
runtime = listEntry->DslRunTimeProtocolParameters;\r
- runtime->externalRxBufferStatus = IDLE;\r
- runtime->externalTxBufferStatus = IDLE;\r
- runtime->localRxBuffer.status = IDLE;\r
- runtime->localTxBuffer.status = IDLE;\r
+ runtime->externalRxBufferStatus = DCM_IDLE;\r
+ runtime->externalTxBufferStatus = DCM_IDLE;\r
+ runtime->localRxBuffer.status = DCM_IDLE;\r
+ runtime->localTxBuffer.status = DCM_IDLE;\r
runtime->securityLevel = DCM_SEC_LEV_LOCKED;\r
runtime->sessionControl = DCM_DEFAULT_SESSION;\r
listEntry->DslProtocolRxBufferID->externalBufferRuntimeData->status\r
runtime = protocolRowEntry->DslRunTimeProtocolParameters;\r
if ( runtime != NULL ) {\r
if (runtime->sessionControl != DCM_DEFAULT_SESSION) { // Timeout if tester present is lost.\r
- TIMER_DECREMENT(runtime->S3ServerTimeoutCount);\r
+ DECREMENT(runtime->S3ServerTimeoutCount);\r
if ( runtime->S3ServerTimeoutCount == 0 ) {\r
changeDiagnosticSession( runtime, DCM_DEFAULT_SESSION );\r
}\r
case PROVIDED_TO_DSD:\r
{\r
DEBUG( DEBUG_MEDIUM, "debug_count=%d\n", debug_count);\r
- TIMER_DECREMENT(runtime->stateTimeoutCount);\r
+ DECREMENT(runtime->stateTimeoutCount);\r
DEBUG( DEBUG_MEDIUM, "state PROVIDED_TO_DSD!\n");\r
if (runtime->stateTimeoutCount == 0) {\r
timeParams = protocolRowEntry->DslProtocolTimeLimit;\r
if ( runtime->responsePendingCount != 0 ) {\r
DEBUG( DEBUG_MEDIUM, "No response withing timeout, sending response pending!\n");\r
sendResponse(protocolRowEntry, DCM_E_RESPONSEPENDING);\r
- COUNT_DECREMENT( runtime->responsePendingCount );\r
+ DECREMENT( runtime->responsePendingCount );\r
} else {\r
DEBUG( DEBUG_MEDIUM, "Sent all response pending, now sending general reject!\n");\r
sendResponse(protocolRowEntry, DCM_E_GENERALREJECT);\r
if (runtime->externalRxBufferStatus == PROVIDED_TO_DSD) {\r
// ### EXTERNAL BUFFER IS IN USE BY THE DSD, TRY TO USE LOCAL BUFFER! ###\r
if (runtime->localRxBuffer.status == NOT_IN_USE) {\r
- if (tpSduLength < LOCAL_BUFFER_LENGTH) {\r
+ if (tpSduLength < DCM_DSL_LOCAL_BUFFER_LENGTH) {\r
runtime->localRxBuffer.status = PROVIDED_TO_PDUR;\r
runtime->localRxBuffer.PduInfo.SduDataPtr\r
= runtime->localRxBuffer.buffer;\r
= BUFFER_AVAILABLE;\r
protocolRow->DslProtocolRxBufferID->externalBufferRuntimeData->status\r
= BUFFER_AVAILABLE; \r
- runtime->externalTxBufferStatus = IDLE;\r
- runtime->externalRxBufferStatus = IDLE;\r
+ runtime->externalTxBufferStatus = DCM_IDLE;\r
+ runtime->externalRxBufferStatus = DCM_IDLE;\r
*/\r
DEBUG( DEBUG_MEDIUM, "Released external buffer sucessfully!\n");\r
externalBufferReleased = TRUE;\r
switch (runtime->localTxBuffer.status) { // ### LOCAL TX BUFFER ###\r
case PROVIDED_TO_PDUR:\r
DEBUG( DEBUG_MEDIUM, "Released local buffer buffer!\n");\r
- runtime->localTxBuffer.status = IDLE;\r
+ runtime->localTxBuffer.status = DCM_IDLE;\r
break;\r
default:\r
DEBUG( DEBUG_MEDIUM, "WARNING! DslTxConfirmation could not release any buffer!\n");\r
};
typedef enum {
- IDLE = 0, /* Not in use. */
- WAITING_DIAGNOSTIC_RESPONSE, /* A diagnostic request has been forwarded to the DSD, and DSL is waiting for response. */
- DIAGNOSTIC_RESPONSE_PENDING, /* A diagnostic response has been deployed to the external buffer and is waiting to be transmitted. */
- TRANSMITTING_EXTERNAL_BUFFER_DATA_TO_PDUR, /* We are in the process of transmitting a diagnostic response most likely that reside in the external buffer, from DSD to PDUR. */
- TRANSMITTING_LOCAL_BUFFER_DATA_TO_PDUR /* */
+ DCM_IDLE = 0, /* Not in use. */
+ DCM_WAITING_DIAGNOSTIC_RESPONSE, /* A diagnostic request has been forwarded to the DSD, and DSL is waiting for response. */
+ DCM_DIAGNOSTIC_RESPONSE_PENDING, /* A diagnostic response has been deployed to the external buffer and is waiting to be transmitted. */
+ DCM_TRANSMITTING_EXTERNAL_BUFFER_DATA_TO_PDUR, /* We are in the process of transmitting a diagnostic response most likely that reside in the external buffer, from DSD to PDUR. */
+ DCM_TRANSMITTING_LOCAL_BUFFER_DATA_TO_PDUR /* */
} Dcm_DslProtocolStateType;
typedef enum {
- DSL_PDUR_IDLE = 0,
+ DCM_DSL_PDUR_DCM_IDLE = 0,
- PDUR_TRANSMIT_INDICATED = 1,
- PDUR_TRANSMIT_TX_BUFFER_PROVIDED = 2,
+ DCM_DSL_PDUR_TRANSMIT_INDICATED = 1,
+ DCM_DSL_PDUR_TRANSMIT_TX_BUFFER_PROVIDED = 2,
DCM_DSL_RECEPTION_INDICATED = 3,
DCM_DSL_RX_BUFFER_PROVIDED = 4
// This buffer is used for implement 7.2.4.3 (Concurrent "tester present").
-#define LOCAL_BUFFER_LENGTH 8
+#define DCM_DSL_LOCAL_BUFFER_LENGTH 8
typedef struct {
Dcm_DslBufferUserType status;
- uint8 buffer[LOCAL_BUFFER_LENGTH];
+ uint8 buffer[DCM_DSL_LOCAL_BUFFER_LENGTH];
PduLengthType messageLenght;
PduInfoType PduInfo;
} Dcm_DslLocalBufferType;