Platform/ECM3532/M3/hw/hal/ecm3532/pdm/src/pdm_hal.c
/**
 * DeInit PDM, will free up resources
 *
 * @param u8Chan PDM channel number
 * @return 0 on success, non-zero error code on failure
 */
DeInit PDM, will free up resources
@param u8Chan PDM channel number
@return 0 on success, non-zero error code on failure
DeInit PDM will free up resources @param u8Chan PDM channel number @return 0 on success non - zero error code on failure
int ecm3532_pdm_deinit(uint8_t pdmNum)
{
  uint16_t *data;
  xSemaphoreTake(pdmLock, portMAX_DELAY);
  if (sPdmDev[PDM_INDEX(pdmNum)].st == AUDIO_START)
  {
    xSemaphoreGive(pdmLock);
    return -EINPROGRESS;
  }
  data = SharedMemAlloc(sizeof(uint16_t));
  data[0] = pdmNum;
  rpcSubmitWork(RPC_MODULE_ID_AUDIO, AUDIO_DEINIT, data);
  xSemaphoreTake(pdmDspRespSem, portMAX_DELAY);
  SharedMemFree(data);
  vPortFree(sPdmDev[PDM_INDEX(pdmNum)].fPtr);
  sPdmDev[PDM_INDEX(pdmNum)].st = AUDIO_DEINIT;
  xSemaphoreGive(pdmLock);
  return 0;
}
int ecm3532_pdm_deinit ( uint8_t pdmNum ) { uint16_t * data ; xSemaphoreTake ( pdmLock , portMAX_DELAY ) ; if ( sPdmDev [ PDM_INDEX ( pdmNum ) ] . st == AUDIO_START ) { xSemaphoreGive ( pdmLock ) ; return - EINPROGRESS ; } data = SharedMemAlloc ( sizeof ( uint16_t ) ) ; data [ 0 ] = pdmNum ; rpcSubmitWork ( RPC_MODULE_ID_AUDIO , AUDIO_DEINIT , data ) ; xSemaphoreTake ( pdmDspRespSem , portMAX_DELAY ) ; SharedMemFree ( data ) ; vPortFree ( sPdmDev [ PDM_INDEX ( pdmNum ) ] . fPtr ) ; sPdmDev [ PDM_INDEX ( pdmNum ) ] . st = AUDIO_DEINIT ; xSemaphoreGive ( pdmLock ) ; return 0 ; }
DeInit PDM, will free up resources
 @param u8Chan PDM channel number
 @return 0 on success, non-zero error code on failure
DeInit PDM will free up resources @param u8Chan PDM channel number @return 0 on success non - zero error code on failure