Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

PMIC_STATUS pmic_audio_get_protocol ( const PMIC_AUDIO_HANDLE  handle,
PMIC_AUDIO_DATA_BUS *const   busID,
PMIC_AUDIO_BUS_PROTOCOL *const   protocol,
PMIC_AUDIO_BUS_MODE *const   masterSlave,
PMIC_AUDIO_NUMSLOTS *const   numSlots 
)

Retrieve the current data bus protocol configuration.

Retrieve the parameters that define the current audio data bus protocol.

Parameters:
handle Device handle from pmic_audio_open() call.
busID The data bus being used.
protocol The data bus protocol being used.
masterSlave The data bus timing mode being used.
numSlots The number of timeslots being used (if in master mode).
Return values:
PMIC_SUCCESS If the protocol was successful retrieved.
PMIC_PARAMETER_ERROR If the handle is invalid.

Definition at line 1242 of file pmic_audio.c.

References PMIC_AUDIO_VCODEC_STATE::busID, PMIC_AUDIO_STDAC_STATE::busID, PMIC_AUDIO_VCODEC_STATE::handle, PMIC_AUDIO_STDAC_STATE::handle, HANDLE_IN_USE, PMIC_AUDIO_VCODEC_STATE::handleState, PMIC_AUDIO_STDAC_STATE::handleState, PMIC_AUDIO_VCODEC_STATE::masterSlave, PMIC_AUDIO_STDAC_STATE::masterSlave, PMIC_AUDIO_VCODEC_STATE::numSlots, PMIC_AUDIO_STDAC_STATE::numSlots, PMIC_AUDIO_VCODEC_STATE::protocol, and PMIC_AUDIO_STDAC_STATE::protocol.

{
      PMIC_STATUS rc = PMIC_PARAMETER_ERROR;

      if ((busID != (PMIC_AUDIO_DATA_BUS *) NULL) &&
          (protocol != (PMIC_AUDIO_BUS_PROTOCOL *) NULL) &&
          (masterSlave != (PMIC_AUDIO_BUS_MODE *) NULL) &&
          (numSlots != (PMIC_AUDIO_NUMSLOTS *) NULL)) {
            /* Enter a critical section so that we return a consistent state. */
            if (down_interruptible(&mutex))
                  return PMIC_SYSTEM_ERROR_EINTR;

            if ((handle == stDAC.handle) &&
                (stDAC.handleState == HANDLE_IN_USE)) {
                  *busID = stDAC.busID;
                  *protocol = stDAC.protocol;
                  *masterSlave = stDAC.masterSlave;
                  *numSlots = stDAC.numSlots;
                  rc = PMIC_SUCCESS;
            } else if ((handle == vCodec.handle) &&
                     (vCodec.handleState == HANDLE_IN_USE)) {
                  *busID = vCodec.busID;
                  *protocol = vCodec.protocol;
                  *masterSlave = vCodec.masterSlave;
                  *numSlots = vCodec.numSlots;
                  rc = PMIC_SUCCESS;
            }

            /* Exit critical section. */
            up(&mutex);
      }

      return rc;
}


Generated by  Doxygen 1.6.0   Back to index