]> rtime.felk.cvut.cz Git - arc.git/commitdiff
Changes to comply with new PduR generators. Updated buffer handling.
authormaek <devnull@localhost>
Fri, 27 May 2011 07:37:33 +0000 (09:37 +0200)
committermaek <devnull@localhost>
Fri, 27 May 2011 07:37:33 +0000 (09:37 +0200)
communication/PduR/PduR_Logic.c
include/PduR_Types.h

index c33aa483c317d697db75f4c7b22fadd44776fd6e..315e59593c112f2a6690533e7ecc49b481eacb46 100644 (file)
@@ -39,10 +39,11 @@ BufReq_ReturnType PduR_ARC_AllocateRxBuffer(PduIdType PduId, PduLengthType TpSdu
        BufReq_ReturnType failRetVal = BUFREQ_BUSY;\r
        for (uint8 i = 0; PduRTpBuffer(i)->pduInfoPtr != NULL; i++) {\r
                if (PduRTpBuffer(i)->status == PDUR_BUFFER_FREE) {\r
-                       if (PduRTpBuffer(i)->pduInfoPtr->SduLength < TpSduLength) {\r
+                       if (PduRTpBuffer(i)->bufferSize < TpSduLength) {\r
                                failRetVal = BUFREQ_OVFL;\r
                        } else {\r
                                PduRTpRouteBuffer(PduId) = PduRTpBuffer(i);\r
+                               PduRTpBuffer(i)->pduInfoPtr->SduLength = TpSduLength;\r
                                PduRTpRouteBuffer(PduId)->status = PDUR_BUFFER_RX_BUSY;\r
                                return BUFREQ_OK;\r
                        }\r
@@ -53,7 +54,7 @@ BufReq_ReturnType PduR_ARC_AllocateRxBuffer(PduIdType PduId, PduLengthType TpSdu
 \r
 BufReq_ReturnType PduR_ARC_AllocateTxBuffer(PduIdType PduId, uint16 length) {\r
        if (PduRTpRouteBuffer(PduId)->status == PDUR_BUFFER_TX_READY) {\r
-               if (length >= PduRTpRouteBuffer(PduId)->pduInfoPtr->SduLength) {\r
+               if ((length >= PduRTpRouteBuffer(PduId)->pduInfoPtr->SduLength) || (length == 0)) {\r
                        PduRTpRouteBuffer(PduId)->status = PDUR_BUFFER_TX_BUSY;\r
                        return BUFREQ_OK;\r
                } else {\r
index 5f15bbec3992d44bf30019b0f6dd9e44ceab147e..8e00ea3c3de2adfa23aafc8aa8dfc97da9034be6 100644 (file)
@@ -98,6 +98,7 @@ typedef enum {
 typedef struct {\r
        PduInfoType *pduInfoPtr;\r
        PduRTpBufferStatus_type status;\r
+       const uint16 bufferSize;\r
 } PduRTpBufferInfo_type;\r
 \r
 typedef struct {\r
@@ -141,7 +142,7 @@ typedef struct {
         *\r
         * Comment: Only required if a TX buffer is configured.\r
         */\r
-       const uint8 SduLength;\r
+       const uint16 SduLength;\r
 \r
        /**\r
         * Chunk size for routing on the fly.\r