TRfd::~TRfd(void) { delete Node_Body; delete Node_Range; delete Node_Label; ClearMessageBuffer(); delete Msg_Buffer; } // End of destructor
void KnxMSG_Init(void) #endif /* KSTACK_MEMORY_MAPPING */ { uint8 t; for (t = (uint8)0; t < MSG_NUM_BUFFERS; t++) { ClearMessageBuffer(t); } KnxMSG_Queues[TASK_FREE_ID] = (uint8)0x00; /* the first Queue contains the Freelist. */ for (t = (uint8)0; t <= MSG_NUM_BUFFERS; t++) { /* Setup Freelist. */ KnxMSG_Buffers[t].next = t + (uint8)1; } KnxMSG_Buffers[MSG_NUM_BUFFERS - 1].next = MSG_NO_NEXT; for (t = (uint8)1; t < MSG_NUM_TASKS; t++) { KnxMSG_Queues[t] = MSG_QUEUE_EMPTY; } }
void KnxMSG_ReleaseBuffer(KnxMSG_BufferPtr ptr) #endif /* KSTACK_MEMORY_MAPPING */ { uint8 buf_num; uint8 old_fp; uint8 t_fp; DISABLE_ALL_INTERRUPTS(); if ((buf_num = GetBufferNumber(ptr)) == MSG_INVALID_BUFFER) { /* TODO: call error-handler */ ENABLE_ALL_INTERRUPTS(); return; } ReleaseCount++; old_fp = KnxMSG_Queues[TASK_FREE_ID]; t_fp = old_fp; while (t_fp != MSG_NO_NEXT) { if (t_fp == buf_num) { ENABLE_ALL_INTERRUPTS(); /* TODO: call error-handler */ return; /* not allocated. */ } t_fp = KnxMSG_Buffers[t_fp].next; } KnxMSG_Queues[TASK_FREE_ID] = buf_num; KnxMSG_Buffers[buf_num].next = old_fp; ClearMessageBuffer(buf_num); ptr = (KnxMSG_BufferPtr)NULL; /* invalidate Buffer. */ ENABLE_ALL_INTERRUPTS(); }