/* Releases a Modbus RTU transport layer object, previously created with  */
void TbxMbRtuFree(tTbxMbTp transport)
/* Releases a Modbus RTU transport layer object, previously created with  */
void TbxMbRtuFree(tTbxMbTp transport)
{
  TBX_ASSERT(transport != NULL);
  if (transport != NULL)
  {
    tTbxMbTpCtx * tpCtx = (tTbxMbTpCtx *)transport;
    TBX_ASSERT(tpCtx->type == TBX_MB_RTU_CONTEXT_TYPE);
    TbxMbOsalSemFree(tpCtx->initStateExitSem);
    TbxCriticalSectionEnter();
    tbxMbRtuCtx[tpCtx->port] = NULL;
    tpCtx->type = 0U;
    tpCtx->pollFcn = NULL;
    tpCtx->processFcn = NULL;
    TbxCriticalSectionExit();
    TbxMemPoolRelease(tpCtx);
  }
}