From 2efb46e01411e8e862f28d47806f40f45ca59979 Mon Sep 17 00:00:00 2001 From: maek Date: Fri, 27 May 2011 09:37:33 +0200 Subject: [PATCH] Changes to comply with new PduR generators. Updated buffer handling. --- communication/PduR/PduR_Logic.c | 5 +++-- include/PduR_Types.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/communication/PduR/PduR_Logic.c b/communication/PduR/PduR_Logic.c index c33aa483..315e5959 100644 --- a/communication/PduR/PduR_Logic.c +++ b/communication/PduR/PduR_Logic.c @@ -39,10 +39,11 @@ BufReq_ReturnType PduR_ARC_AllocateRxBuffer(PduIdType PduId, PduLengthType TpSdu BufReq_ReturnType failRetVal = BUFREQ_BUSY; for (uint8 i = 0; PduRTpBuffer(i)->pduInfoPtr != NULL; i++) { if (PduRTpBuffer(i)->status == PDUR_BUFFER_FREE) { - if (PduRTpBuffer(i)->pduInfoPtr->SduLength < TpSduLength) { + if (PduRTpBuffer(i)->bufferSize < TpSduLength) { failRetVal = BUFREQ_OVFL; } else { PduRTpRouteBuffer(PduId) = PduRTpBuffer(i); + PduRTpBuffer(i)->pduInfoPtr->SduLength = TpSduLength; PduRTpRouteBuffer(PduId)->status = PDUR_BUFFER_RX_BUSY; return BUFREQ_OK; } @@ -53,7 +54,7 @@ BufReq_ReturnType PduR_ARC_AllocateRxBuffer(PduIdType PduId, PduLengthType TpSdu BufReq_ReturnType PduR_ARC_AllocateTxBuffer(PduIdType PduId, uint16 length) { if (PduRTpRouteBuffer(PduId)->status == PDUR_BUFFER_TX_READY) { - if (length >= PduRTpRouteBuffer(PduId)->pduInfoPtr->SduLength) { + if ((length >= PduRTpRouteBuffer(PduId)->pduInfoPtr->SduLength) || (length == 0)) { PduRTpRouteBuffer(PduId)->status = PDUR_BUFFER_TX_BUSY; return BUFREQ_OK; } else { diff --git a/include/PduR_Types.h b/include/PduR_Types.h index 5f15bbec..8e00ea3c 100644 --- a/include/PduR_Types.h +++ b/include/PduR_Types.h @@ -98,6 +98,7 @@ typedef enum { typedef struct { PduInfoType *pduInfoPtr; PduRTpBufferStatus_type status; + const uint16 bufferSize; } PduRTpBufferInfo_type; typedef struct { @@ -141,7 +142,7 @@ typedef struct { * * Comment: Only required if a TX buffer is configured. */ - const uint8 SduLength; + const uint16 SduLength; /** * Chunk size for routing on the fly. -- 2.39.2