ECE 486 Support Libraries
|
Functions | |
int | getblocksize (void) |
Return the number of samples that the user should expect to process per block. More... | |
void | setblocksize (uint32_t blksiz) |
Set the number of samples that the user should expect to process per block. More... | |
void | getblock (float *working) |
Request a block of data from the ADC sample stream. More... | |
void | getblockstereo (float *chan1, float *chan2) |
Request a block of data from the two ADC sample streams (Stereo input case) More... | |
void | putblock (float *working) |
Send a buffer of data to the DAC output stream. More... | |
void | putblockstereo (float *chan1, float *chan2) |
Send two buffers of data to the DACs for stereo output. More... | |
void getblock | ( | float * | working | ) |
Request a block of data from the ADC sample stream.
For one input channel (MONO_IN), getblock() is called by the user to request the next input data block. getblock() will wait until the ADC/DMA completes filling the requested block of samples. The binary data is then converted to float values and returned to the user.
Output samples will range from -1.0 to +1.0 to cover the range of the ADC input voltages. The converter is a 12-bit device, so the resolution of the output samples is roughly 2/4096 = 0.000488.
Assuming the original voltage range of the ADC is 0 to 3.0 volts, the conversion between the returned sample value and the input voltage is: Vin = 1.5 + (sample*1.5). (A zero sample value indicates the ADC is mid-scale, at 1.5 volts) For a 0-3 V ADC range, the ADC resolution is 3/4096 = 732 uV.
[in,out] | working | pointer to an array of floats (large enough to hold one buffer) |
Definition at line 103 of file sample486.c.
int getblocksize | ( | void | ) |
Return the number of samples that the user should expect to process per block.
Users should call getblocksize() once to determine the required number of samples which must be handled on each call to getblock() or getblockstereo(). Typically, the result is used to allocate required memory to handle the data
Definition at line 59 of file sample486.c.
void getblockstereo | ( | float * | chan1, |
float * | chan2 | ||
) |
Request a block of data from the two ADC sample streams (Stereo input case)
For two input channel (STEREO_IN), getblockstero() is called by the user to request the next input data blocks. getblockstereo() will wait until the ADCs/DMA completes filling the requested block of samples. The binary data is then converted to float values and returned to the user.
Output samples will range from -1.0 to +1.0 to cover the range of the ADC input voltages. The converter is a 12-bit device, so the resolution of the output samples is roughly 2/4096 = 0.000488.
Assuming the original voltage range of the ADC is 0 to 3.0 volts, the conversion between the returned sample value and the input voltage is: Vin = 1.5 + (sample*1.5). (A zero sample value indicates the ADC is mid-scale, at 1.5 volts) For a 0-3 V ADC range, the ADC resolution is 3/4096 = 732 uV.
[in,out] | chan1 | pointer to an array of floats for the main ADC channel |
[in,out] | chan2 | pointer to an array of floats for the stereo ADC channel |
Definition at line 182 of file sample486.c.
void putblock | ( | float * | working | ) |
Send a buffer of data to the DAC output stream.
For one output stream (MONO_OUT), putblock() is called by the user when they've finished processing a block of data and are ready to stream the data to the DAC output. Samples passed to putblock() are assumed to range from -1.0 to 1.0 to cover the entire output range of the DAC.
[in] | working | Array of output samples |
Definition at line 143 of file sample486.c.
void putblockstereo | ( | float * | chan1, |
float * | chan2 | ||
) |
Send two buffers of data to the DACs for stereo output.
For two output streams (STEREO_OUT), putblockstereo() is called by the user when they've finished processing a block of data and are ready to stream the data to the DACs. Samples passed to putblock() are assumed to range from -1.0 to 1.0 to cover the entire output range of the DAC.
[in] | chan1 | Array of output samples for the main output channel |
[in] | chan2 | Array of output samples for the stereo output channel |
Definition at line 158 of file sample486.c.
void setblocksize | ( | uint32_t | blksiz | ) |
Set the number of samples that the user should expect to process per block.
setblocksize() may be called before calling initialize() to specify the number of samples which should be delivered to the user on each call to getblock() or getblockstereo().
If setblocksize() is not called, the default block size of DEFAULT_BLOCKSIZE is used for data transfers. Using a smaller block size (down to a limit of one sample) can reduced the latency between the input and output stream, at the cost of some efficiency in handling the data.
blksiz | Number of samples per block of ADC/DAC data processed |
Definition at line 68 of file sample486.c.