#include <swapi_utils.h>
Data Fields | |
char * | name |
int | sample_sz |
int | max_buffer_len |
void * | buffer |
int(* | get_block_sz )() |
int(* | process_fnc )(int) |
Regardless the direction of the interface, the user must provide a buffer for storing data of size max_buffer_len elements of size sample_sz (in bytes).
For input interfaces. Set the variable to the name input_itf: process_fnc() will be called as soon as the required amount of samples is available. This number is provided by the function get_block_sz() which will be called at the beginning of every timeslot (if needed). Setting get_block_sz() to NULL is equivalent to returning 0 from this function. As soon as any data is available the processing function will be called.
For output interfaces. Set the variable to the name output_itf: If data needs to be generated, point get_block_sz() to a function returning the amount of samples to be generated (you can use GetTempo to convert from frequency to number of samples). Then, process_fnc() will be called to generate such data. If data is being provided synchronously to any input interface, set get_block_sz to NULL and use SendItf() function to send the data.
Example:
Configure an input interface which can process any amount of samples (not block oriented)
typedef int input1_t;
struct utils__itf input_itfs[] = { {"myInputInterface", sizeof(input1_t), 1024, input_buffer, NULL, process_input},
{NULL, 0, 0, 0, 0, 0}};
char* utils_itf::name |
< Name of the interface