MICAutoParam

Definition

#include <nitro/spi.h>
typedef struct
{
    MICSamplingType     type;
    void*               buffer;
    u32                 size;
    u32                 rate;
    BOOL                loop_enable;
    MICCallback         full_callback;
    void*               full_arg;

} MICAutoParam;

Elements

type Sampling type as one of the MICSamplingType enumerated types.
buffer Specifies a pointer to the buffer that stores the sampling result. Because ARM7 writes the sampling result directly to this buffer, this buffer needs to be 32-byte aligned to match the cache line.
Also, this buffer must be in a memory space that both ARM9 and ARM7 can access. This specifiable memory space consists of all of main memory including the extended region, WRAM-B, and WRAM-C. Note, however, that this memory mapping changes depending on the program's operating hardware and operating mode. See Protection Units (Overview) and Work RAM (Overview) for more about memory mapping.
size Size of the buffer storing the sampling result
rate The sampling rate. Directly specifies ARM7 CPU timer cycles.
This can also be selected from the MICSamplingRate enumerated type.
loop_enable Flag for looping buffer during continuous sampling
full_callback Pointer to callback function called when buffer is full
full_arg Argument to pass to callback function called when buffer is full

Description

This structure shows the settings for microphone auto-sampling. When TRUE is specified for the loop_enable flag, continuous sampling continues when the buffer becomes full by returning the sampling-data storage-position to the start of the buffer. Continuous sampling will proceed until the function that stops auto-sampling is called. When FALSE is set for the loop_enable flag, microphone sampling will stop automatically when the buffer becomes full. Regardless of the setting of the loop_enable flag, the function specified by full_callback will be called when the buffer becomes full.

Note

The buffer that will store the sampling results should have an address with 32-byte alignment and be a size that is a multiple of 32. This is because when the sampling results are read, the cache of the target area gets destroyed.

When TRUE is specified for the loop_enable flag, the buffer is treated as a ring buffer and the data will be overwritten from the start of the buffer when it becomes full.
For this reason, the data in the buffer is not guaranteed secure during the period of time between the generation of the buffer-full callback and the next sampling (i.e., the sampling period as specified by rate).
Given this fact, when you are using a ring buffer, if you are going to perform some process on the buffer's data from inside the buffer callback, you should finish performing the process until the next sampling takes place.
Also be aware that if interrupts are prohibited for a long period of time and the buffer callback itself is late to generate, then there is a risk that the buffer will get overwritten before the processing on the buffer's data can take place.

See Also

MIC_StartAutoSampling
MIC_StartAutoSamplingAsync
MIC_StopAutoSampling
MIC_StopAutoSamplingAsync

Revision History

Ver. 2008/08/19 Revised the description of the memory space that can be specified for the buffer member.
Ver. 2007/04/12 Added a note when using the buffer loop.
Ver. 2006/02/16 Added the fact that expanded main memory cannot be specified for the buffer member.
Ver. 2004/09/17 Added a description about the alignment of the buffer member.
Ver. 2004/06/01 Initial version.


CONFIDENTIAL