#include <phal_sw_api.h>
#include <swapi_utils.h>
#include "typetools.h"
#include "itf_types.h"
#include "skeletonExtendedInputs.h"
#include "skeletonExtendedOutputs.h"
#include "stats.h"
#include "my_prog.h"
Defines | |
#define | BITSPERCHAR 8 |
#define | ERROR -1 |
#define | READY 1 |
#define | NONREADY 0 |
Functions | |
void | print_array (char *Pin, int Dtype, int Dlength, int Dcolums, int print, int numTS, int printingTS, int nprintTS) |
int | datainflow_bypass (int len, int numTS, int print, int numcols, int dattype, int outdattype) |
void | check_config () |
int | controlin_length () |
int | process_inputcontrol (int len) |
int | datain_length () |
int | process_inputdata (int lengthbytes) |
int | get_output_length () |
int | generate_outputdata (int len) |
int | RunCustom () |
int | InitCustom () |
void | ConfigInterfaces () |
Variables | |
int | configured = 0 |
int | dataprocessedready = NONREADY |
int | input_temp [INPUT_MAX_DATA *8] |
int | output_temp [OUTPUT_MAX_DATA *8] |
char | pinput [INPUT_MAX_DATA *8] |
char | poutput [INPUT_MAX_DATA *8] |
#define BITSPERCHAR 8 |
Sample ALOE component implementation file Include SW API header and SW API utils (skeleton) Include general data type library include input/output interfaces and stats. itf_types.h must be included 'before' input.h if it defines e.g. control interface packet structure
#define ERROR -1 |
#define NONREADY 0 |
#define READY 1 |
void check_config | ( | ) |
Checks the current module status and capture the configuration defined at stats.h
int controlin_length | ( | ) |
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 | ( | ) |
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 datainflow_bypass | ( | int | len, | |
int | numTS, | |||
int | print, | |||
int | numcols, | |||
int | indattype, | |||
int | outdattype | |||
) |
Perfom a bypass input output without any data modification Parameters int len Data lenght (number of received bytes) int numTS Time slot when print int print print (1) or no print (0) int numcols Number of printing columns int indattype Intput Data type to print int outdattype Output Data type to print
Print output in case
BYPASS DATA TYPE RECEIVED TO DATA TYPE TO BE SEND
Print output in case
CALCULATE THE NUMBER OF DATA TO BE SENT
int generate_outputdata | ( | int | len | ) |
Run function. return 1 if ok, 0 if error Our output process function does nothing. It can be used to make sure we have processed all data, or to generate data if there are not inputs
int get_output_length | ( | ) |
OUTPUT INTERFACE 2: DATA //////////////////////////////////////////////DATA /** get_output_length() function returns the amount of data typewords the skeleton will send through the output interface (after all input functions finished). Note that again we are using the typetools library to convert from the desired processing data types to transport data types
void print_array | ( | char * | Pin, | |
int | Dtype, | |||
int | Dlength, | |||
int | Dcolums, | |||
int | print, | |||
int | numTS, | |||
int | printingTS, | |||
int | nprintTS | |||
) |
print_array(): Prints an array according their type at selected Time-Slot and between Time-Slot printingTS and Time-Slot printingTS+nprintTS. print parameter allow to desactivate printing.
char *Pin :Input data pointers int Dtype :Data type int Dlength :Number of data int Dcolums :Printed columns int print :Print command int numTS :number of Time-slot int printingTS :Initial Printing Time-slot int nprintTS :Number of printing Time-slots
int process_inputcontrol | ( | int | len | ) |
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 | ) |
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.
int configured = 0 |
int dataprocessedready = NONREADY |
int input_temp[INPUT_MAX_DATA *8] |
int output_temp[OUTPUT_MAX_DATA *8] |
char pinput[INPUT_MAX_DATA *8] |
char poutput[INPUT_MAX_DATA *8] |