+ * ****************************************************************/
+void LwrMacEnqueueWlsBlock()
+{
+ void *memPtr;
+ void *wlsHdlr = NULLP;
+
+ WLS_MEM_ALLOC(memPtr, LWR_MAC_WLS_BUF_SIZE);
+
+ if(memPtr)
+ {
+ mtGetWlsHdl(&wlsHdlr);
+ /* allocate blocks for UL transmittion */
+ while(WLS_EnqueueBlock(wlsHdlr, WLS_VA2PA(wlsHdlr, memPtr)))
+ {
+ WLS_MEM_ALLOC(memPtr, LWR_MAC_WLS_BUF_SIZE);
+ if(!memPtr)
+ break;
+ }
+
+ // free not enqueued block
+ if(memPtr)
+ {
+ WLS_MEM_FREE(memPtr, LWR_MAC_WLS_BUF_SIZE);
+ }
+ }
+}/* LwrMacEnqueueWlsBlock */
+
+/*******************************************************************
+ *
+ * @brief Add memory block (to be freed later) to list
+ *
+ * @details
+ *
+ * Function : addWlsBlockToFree
+ *
+ * Functionality:
+ * Add memory block (to be freed later) to list
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+void addWlsBlockToFree(void *msg, uint32_t msgLen, uint8_t idx)
+{
+ CmLList *node = NULLP;
+ WlsBlockToFree *block = NULLP;
+ MAC_ALLOC(block, sizeof(WlsBlockToFree));
+ if(block)
+ {
+ MAC_ALLOC(node, sizeof(CmLList));
+ if(node)
+ {
+ block->ptr = msg;
+ block->size = msgLen;
+
+ node->node = (PTR)block;
+ cmLListAdd2Tail(&wlsBlockToFreeList[idx], node);
+ }
+ }
+}/* addWlsBlockToFree */
+
+
+/*******************************************************************
+ *
+ * @brief Free DL Memory blocks stored in list
+ *
+ * @details
+ *
+ * Function : freeWlsBlockList
+ *
+ * Functionality: Free DL Memory blocks stored in list
+ *
+ * @params[in] Array index to be freed
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+void freeWlsBlockList(uint8_t idx)
+{
+ CmLList *node;
+ WlsBlockToFree *block;
+ if(wlsBlockToFreeList[idx].count)
+ {
+ CM_LLIST_FIRST_NODE(&wlsBlockToFreeList[idx], node);
+ while(node)
+ {
+ block = (WlsBlockToFree *)node->node;
+ cmLListDelFrm(&wlsBlockToFreeList[idx], node);
+ WLS_MEM_FREE(block->ptr, block->size);
+ MAC_FREE(block, sizeof(WlsBlockToFree));
+ MAC_FREE(node, sizeof(CmLList));
+ node = NULL;
+ CM_LLIST_FIRST_NODE(&wlsBlockToFreeList[idx], node);
+ }
+ }
+}
+
+/*******************************************************************
+ *
+ * @brief Receives msg from L1
+ *
+ * @details
+ *
+ * Function :LwrMacRecvPhyMsg
+ *
+ * Functionality:
+ * Receives L1 Msg and enqueues memort for UL msg
+ *
+ * @params[in]
+ * @return
+ * ****************************************************************/
+void LwrMacRecvPhyMsg()
+{
+#ifdef INTEL_FAPI
+ uint32_t numMsgToGet; /* Number of Memory blocks to get */
+ void *wlsHdlr; /* WLS handler */
+ uint64_t l1Msg; /* Message received */
+ void *l1MsgPtr;
+ uint32_t msgSize;
+ uint16_t msgType;
+ uint16_t flag = 0;
+ p_fapi_api_queue_elem_t currElem = NULLP;
+
+ mtGetWlsHdl(&wlsHdlr);
+ if(WLS_Ready(wlsHdlr) == 0)
+ {
+ while(true)
+ {
+ numMsgToGet = WLS_Wait(wlsHdlr);
+ if(numMsgToGet == 0)
+ {
+ continue;
+ }
+
+ while(numMsgToGet--)
+ {
+ currElem = NULLP;
+ l1Msg = (uint64_t)NULLP;
+ l1MsgPtr = NULLP;
+ l1Msg = WLS_Get(wlsHdlr, &msgSize, &msgType, &flag);
+ if(l1Msg)
+ {
+ l1MsgPtr = WLS_PA2VA(wlsHdlr, l1Msg);
+ currElem = (p_fapi_api_queue_elem_t) l1MsgPtr;
+ if(currElem->msg_type != FAPI_VENDOR_MSG_HEADER_IND)
+ {
+ procPhyMessages(currElem->msg_type, 0, (void *)(currElem + 1));
+ }
+ WLS_MEM_FREE(currElem, LWR_MAC_WLS_BUF_SIZE);
+ }
+ }
+ LwrMacEnqueueWlsBlock();
+ }
+ }
+#endif
+} /* LwrMacRecvPhyMsg */
+
+#endif /* INTEL_WLS_MEM */