# MIC_AdjustLimitedSamplingAsync

## Syntax

  `#include <twl/spi.h>`

      MICResult MIC_AdjustLimitedSamplingAsync(
                u32             rate,
                MICCallback     callback,
                void*           arg );

## Arguments

rate | Specifies the sampling cycle.
callback | Specifies the pointer to the callback function. This callback is called from within the interrupt handler.
arg | Specifies the argument passed to the callback function.

## Return Values

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

## Description

Asynchronously begins adjustment of the sampling rate of the microphone's frequency-limited auto-sampling.
This function issues a request to the ARM7 to adjust frequency-limited auto-sampling, then returns control to the caller without waiting for a response. You must use the `result` argument passed by the user callback function to get the ARM7 processing result. If this function fails, the asynchronous operation is not performed and the user callback function is not called.
This function is only valid when frequency-limited auto-sampling has already begun. The sampling cycle is updated when the ARM7 receives the request, no earlier.

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, by relaxing the CPU burden on the ARM7, effects of sampling on wireless communications and other I/O will be 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 `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` will be returned if one of the limited frequencies is not specified.

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

## Note

Because frequency-limited auto-sampling cannot be performed on the NITRO platform or when the CODEC is running in CODEC-DS mode, this function will instead internally call the `MIC_AdjustAutoSamplingAsync` auto-sampling control function.

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

## See Also

`MIC_AdjustLimitedSampling, MIC_StartLimitedSamplingAsync, MIC_StopLimitedSamplingAsync`

## Revision History

2008/01/09 Added a note about the difference in behavior with CODEC mode.
2007/11/17 Initial version.

CONFIDENTIAL