# MIC_StartLimitedSampling

## Syntax

  `#include <twl/spi.h>`

      MICResult MIC_StartLimitedSampling(
                  const MICAutoParam*    param );

## Arguments

param | Pointer to a `MICAutoParam`-type auto-sampling settings structure.

## Return Values

Returns the processing result as a `MICResult` enumerated type. Returns `MIC_RESULT_SUCCESS` if processing completed successfully; returns some other value if the process failed.

## Description

Starts frequency-limited microphone auto-sampling.
Use the `PM_SetAmp*` function to turn on the programmable gain amp before sampling.
This function issues a request to the ARM7 to start frequency-limited auto-sampling, waits for the ARM7 to respond, and returns the processing result. This is a synchronous version of the `MIC_StartLimitedSamplingAsync` function. Where the input volume falls outside the minimum or maximum value, the sampling data is clamped.

Frequency-limited auto-sampling differs from normal auto-sampling in that the hardware does the actual sampling. As a result, stable sampling can be performed at precise cycles; also, with the CPU burden on the ARM7 relaxed, effects of sampling on wireless communications and other I/O are reduced. On the other hand, sampling cannot be performed at frequencies that are unsupported by the hardware. The following sampling frequencies can be specified for param`->rate`, but the frequencies that can be specified at a given time depend on the sound master frequency settings and thus are further limited to four of the following. A value of `MIC_RESULT_ILLEGAL_PARAMETER` is returned if one of the limited frequencies is not specified.

Sound Master Frequency | Settable Frequency | Description
--- | --- | ---
32.73 kHz | `MIC_SAMPLING_RATE_32730` | 32.73 kHz (1/1 of the master frequency)
`MIC_SAMPLING_RATE_16360` | 16.36 kHz (1/2 of the master frequency)
`MIC_SAMPLING_RATE_10910` | 10.91 kHz (1/3 of the master frequency)
`MIC_SAMPLING_RATE_8180` | 8.18 kHz (1/4 of the master frequency)
47.61kHz | `MIC_SAMPLING_RATE_47610` | 47.61 kHz (1/1 of the master frequency)
`MIC_SAMPLING_RATE_23810` | 23.81 kHz (1/2 of the master frequency)
`MIC_SAMPLING_RATE_15870` | 15.87 kHz (1/3 of the master frequency)
`MIC_SAMPLING_RATE_11900` | 11.90 kHz (1/4 of the master frequency)

## Note

This function waits for a PXI interrupt for synchronization purposes. Do not call it when PXI interrupts are prohibited.
Because frequency-limited auto-sampling cannot be performed on the NITRO platform or when the CODEC is running in CODEC-DS mode, this function instead calls the `MIC_StartAutoSampling` auto-sampling control function.

It has been confirmed that slight hardware noise is mixed with the microphone input on the TWL system. See here for a workaround.

## See Also

`MIC_StartLimitedSamplingAsync`
`MIC_StopLimitedSampling`
`MIC_AdjustLimitedSampling`

## Revision History

2009/06/25 Added description of using the `PM_SetAmp*` function.
2008/01/09 Added a note about the difference in behavior with CODEC mode.
2007/11/17 Initial version.

CONFIDENTIAL