Defines | |
#define | INPUT_MAX_CONTROL 1 |
#define | INPUT_MAX_DATA 100*1024 |
Typedefs | |
typedef char | input1_t |
Functions | |
int | process_inputcontrol (int len) |
int | controlin_length () |
int | process_inputdata (int len) |
int | datain_length () |
Variables | |
ControlMODULENAME_h | ctrlpkt |
input1_t | input_data [INPUT_MAX_DATA] |
struct utils_itf | input_itfs [] |
#define INPUT_MAX_CONTROL 1 |
Sample input interfaces configuration file.
This file configures static input interfaces. In general, data types are configurable (with an initialization parameter). Therefore, here we will declare the input_data buffer as a simple byte. In the processing function, typetools library will convert from a variable type to an internal type.
If the component only allows certain type, e.g. BITSTREAM in a CRC, you MUST INDICATE it in this file as a comment.
Read sw_api/include/swapi_utils.h and http://flexnets.upc.edu/trac/wiki/ObjectDeveloperGuide for more documentation on how to use this file INTERFACE 1: CONTROL maximum input buffer for control interface (in bytes)
#define INPUT_MAX_DATA 100*1024 |
INTERFACE 2: DATA maximum input buffer for data interface (in bytes)
typedef char input1_t |
input buffer is declared as an array of bytes
int controlin_length | ( | ) |
declare control in length function. returns number of control wordtypes to be readed
INPUT INTERFACE 1: CONTROL //////////////////////////////////////////CONTROL controlin_length() Returns the maximum length (in control type words) of the expected control flow at each time-slot Funtion activated if control flow has been received
int datain_length | ( | ) |
declare data in length function returns the number od bytes to be readed
END INPUT INTERFACE 1: CONTROL /////////////////////////////////////CONTROL /** INPUT INTERFACE 2: DATA ///////////////////////////////////////////////DATA datain_length() Returns the maximum length (in data type words) of the expected data flow at each time-slot Funtion activated if data flow has been received
int process_inputcontrol | ( | int | len | ) |
declare processing function for the control interface
Process the received control flow according to the length returned by get_controlin_length() "len" indicates the number of control words to be processed This is the processing function for the control interface. Here, we simply have to validate the parameters and update our internal state variables.
int process_inputdata | ( | int | lengthbytes | ) |
declare processing function for the input interface
Process the received data flow according to the length returned by datain_length(). Run function. return 1 if ok, 0 if error. "len" indicates the number of data bytes (input buffer defined as char) to be processed This is the main processing function. It will be called every time data is available for process. Here you will place your signal processing code.
In general, we want to make sure we have received the expected amount of data. The function typeSizeArray() returns the expected bytes as a function of a general datatype and expected number of elements. For example, if blockLength=128 and datatype is INTEGER, it returns 128*4=512. If for example the datatype is BITSTREAM the function will return 128/8=16
PRINTF
LOG FILE
if NONACTIVE print status
if TEST_FLOW Perform a BYPASS of data inputs to data output
if ACTIVE perform normal operation
PRINT INPUT IN CASE
CONVERT TYPE RECEIVED TO TYPE TO BE PROCESSED
YOUR PROCESSING FUNCTION
CONVERT TYPE PROCESSED TO TYPE TO BE SENT
PRINT OUTPUT IN CASE
CALCULATE THE NUMBER OF BYTES TO BE SENT
The skeleton will read from the output_data buffer the required amount of bytes (depending of the data type) that must be sended.
ControlMODULENAME_h ctrlpkt |
This is the structure for the control interface. It is declared in the itf_types.h file. Other components sending control parameters to the module will include the itf_types.h file
input1_t input_data[INPUT_MAX_DATA] |
struct utils_itf input_itfs[] |
Initial value:
{ { "control_flow_in", sizeof(ctrlpkt), INPUT_MAX_CONTROL, &ctrlpkt, controlin_length, process_inputcontrol }, { "data_flow_in", sizeof(input1_t), INPUT_MAX_DATA, input_data, datain_length, process_inputdata }, {NULL, 0, 0, 0, 0, 0}}