]> rtime.felk.cvut.cz Git - arc.git/commitdiff
Refactoring and includefile structure changes in Dcm.
authorpete <devnull@localhost>
Mon, 19 Apr 2010 10:54:07 +0000 (12:54 +0200)
committerpete <devnull@localhost>
Mon, 19 Apr 2010 10:54:07 +0000 (12:54 +0200)
diagnostic/Dcm/Dcm.c
diagnostic/Dcm/Dcm_Dsd.c
diagnostic/Dcm/Dcm_Dsl.c
diagnostic/Dcm/Dcm_Dsp.c
diagnostic/Dcm/Dcm_Lcfg.h
include/Dcm.h

index c8a7664beacad00ce9915e45dba58c639adadd84..f2b76845a90fd858527caafa25b296aa49bce906 100644 (file)
@@ -18,8 +18,6 @@
 
 
 #include <string.h>
-#include "Dcm_Cfg.h"
-#include "Dcm_Cbk.h"
 #include "Dcm.h"
 #include "Dcm_Internal.h"
 #include "Dem.h"
index 7041d87c06bbbbe75acb29ba500c72b0b93aa32a..fe0763c1454b0ae06f17d498330ad1f9a424d304 100644 (file)
@@ -16,7 +16,6 @@
 \r
 \r
 #include <string.h>\r
-#include "Dcm_Cfg.h"\r
 #include "Dcm.h"\r
 #include "Dcm_Internal.h"\r
 #include "Det.h"\r
index 23dcea3551c503ce8324b40e6b6f80716ea75b98..871d3553ea814f00063febfab2816e788f99330b 100644 (file)
@@ -15,8 +15,6 @@
 \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
@@ -416,10 +408,10 @@ void DslInit(void) {
        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
@@ -446,7 +438,7 @@ void DslMain(void) {
                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
@@ -458,7 +450,7 @@ void DslMain(void) {
                        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
@@ -468,7 +460,7 @@ void DslMain(void) {
                                                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
@@ -554,7 +546,7 @@ BufReq_ReturnType DslProvideRxBufferToPdur(PduIdType dcmRxPduId,
                                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
@@ -752,8 +744,8 @@ void DslTxConfirmation(PduIdType dcmTxPduId, NotifResultType result) {
                                        = 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
@@ -767,7 +759,7 @@ void DslTxConfirmation(PduIdType dcmTxPduId, NotifResultType result) {
                        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
index 187f9f92f5f5eb22e83a16d6160a132d241440dc..fd48a9847c586eb4ac9f625356c5f1c082ad1fc8 100644 (file)
@@ -16,7 +16,6 @@
 \r
 \r
 #include <string.h>\r
-#include "Dcm_Cfg.h"\r
 #include "Dcm.h"\r
 #include "Dcm_Internal.h"\r
 #include "Dem.h"\r
index 3a17c6d363c95d49ddb0ec03ffd75973232fdc35..0119e755691131aa1792aba300ef65e82db9634b 100644 (file)
@@ -462,18 +462,18 @@ struct Dcm_DslConnectionType_t {
 };
 
 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
@@ -482,11 +482,11 @@ typedef enum {
 
 // 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;
index 1bfd3e32ed4258f8fd6bc8f023afe521d4bf4669..80997b995e3165e95bf4eef2d4d296436809d3f2 100644 (file)
@@ -34,6 +34,7 @@
 #include "Dcm_Cfg.h"
 #include "Dcm_Lcfg.h"
 #include "ComStack_Types.h"
+#include "Dcm_Cbk.h"
 
 #if (DCM_DEV_ERROR_DETECT == STD_ON)
 // Error codes produced by this module