Skip to content

Commit

Permalink
Consolidated setting runtime config and memory usage count to LlInitS…
Browse files Browse the repository at this point in the history
…etLlRtCfg()
  • Loading branch information
crsz20 committed Sep 23, 2024
1 parent 0232186 commit 096893b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
7 changes: 1 addition & 6 deletions Examples/MAX32655/Bluetooth/BLE_datc/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,8 @@ int main(void)
.freeMemAvail = WsfHeapCountAvailable()
};

llmemUsed = LlInitSetBbRtCfg(llCfg.pBbRtCfg, llCfg.wlSizeCfg, llCfg.rlSizeCfg, llCfg.plSizeCfg,
llCfg.pFreeMem, llCfg.freeMemAvail);
llmemUsed = LlInitMemConfig(&llCfg);

llCfg.pFreeMem += llmemUsed;
llCfg.freeMemAvail -= llmemUsed;

llmemUsed += LlInitSetLlRtCfg(llCfg.pLlRtCfg, llCfg.pFreeMem, llCfg.freeMemAvail);

#if (WSF_TOKEN_ENABLED == TRUE) || (WSF_TRACE_ENABLED == TRUE)
WsfTraceEnable(TRUE);
Expand Down
7 changes: 1 addition & 6 deletions Examples/MAX32690/Bluetooth/BLE_datc/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,8 @@ int main(void)
.freeMemAvail = WsfHeapCountAvailable()
};

llmemUsed = LlInitSetBbRtCfg(llCfg.pBbRtCfg, llCfg.wlSizeCfg, llCfg.rlSizeCfg, llCfg.plSizeCfg,
llCfg.pFreeMem, llCfg.freeMemAvail);
llmemUsed = LlInitMemConfig(&llCfg);

llCfg.pFreeMem += llmemUsed;
llCfg.freeMemAvail -= llmemUsed;

llmemUsed += LlInitSetLlRtCfg(llCfg.pLlRtCfg, llCfg.pFreeMem, llCfg.freeMemAvail);

#if (WSF_TOKEN_ENABLED == TRUE) || (WSF_TRACE_ENABLED == TRUE)
WsfTraceEnable(TRUE);
Expand Down
2 changes: 2 additions & 0 deletions Libraries/Cordio/controller/include/ble/ll_init_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ void LlInitChciTrInit(uint16_t maxAclLen, uint16_t maxIsoLen);
void LlInitLhciInit(void);
void LlMathSetSeed(const uint32_t *pSeed);
void LlInitLhciHandler(void);
uint32_t LlInitMemConfig(LlInitRtCfg_t *pLlInitRtCfg);


/*! \} */ /* LL_INIT_API */

Expand Down
21 changes: 21 additions & 0 deletions Libraries/Cordio/controller/sources/ble/init/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,24 @@ uint32_t LlInit(LlInitRtCfg_t *pCfg)

return totalMemUsed;
}

/*************************************************************************************************/
/*!
* \brief Set LL and BB runtime configurations.
*
* \param pCfg Runtime configuration.
*
* \return Memory used.
*/
/*************************************************************************************************/
uint32_t LlInitMemConfig(LlInitRtCfg_t *pCfg)
{
uint32_t memUsed = LlInitSetBbRtCfg(pCfg->pBbRtCfg, pCfg->wlSizeCfg, pCfg->rlSizeCfg, pCfg->plSizeCfg,
pCfg->pFreeMem, pCfg->freeMemAvail);

pCfg->pFreeMem += memUsed;
pCfg->freeMemAvail -= memUsed;

memUsed += LlInitSetLlRtCfg(pCfg->pLlRtCfg, pCfg->pFreeMem, pCfg->freeMemAvail);
return memUsed;
}

0 comments on commit 096893b

Please sign in to comment.