flinklib
flinklib: flink C library for Linux
base_device_test.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdbool.h>
#include <getopt.h>
#include <ctype.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include <flinklib.h>
#include <flink_funcid.h>
Include dependency graph for base_device_test.c:

Go to the source code of this file.

Macros

#define DEFAULT_DEV   "/dev/flink0"
 
#define INFO_DEVICE_DESCRIPTOR   "baseDeviceTesting"
 
#define INFO_DEVICE_DESCRIPTOR_LENGTH   strlen(INFO_DEVICE_DESCRIPTOR)
 
#define COUNTER_FUNCTION_ID   0x6
 
#define NUMBER_OF_SUBDEVICES   8
 
#define INFO_DEVICE_UNIQUE_ID   1
 
#define ENC_B_GPIO_UNIQUE_ID   0x2
 
#define ENC_A_GPIO_UNIQUE_ID   0x3
 
#define FQD_GPIO_UNIQUE_ID   0x4
 
#define PWM_UNIQUE_ID   0x5
 
#define PWM_IN_GPIO_UNIQUE_ID   0x6
 
#define NUMBER_OF_PWM_CHANNELS   4
 
#define PWM_RATIO_THRESHOLD   0.2
 
#define PWM_PERIOD_THRESHOLD   0.2
 
#define NUMBER_OF_PWM_RATIO_PERIOD_TEST   100
 
#define PWM_TIMEOUT   10000000
 
#define IN_GPIO_UNIQUE_ID   0x7
 
#define OUT_GPIO_UNIQUE_ID   0x8
 
#define NUMBER_OF_GPIO_CHANNELS_TEST   128
 
#define NUMBER_OF_GPIO_TESTS   1000
 
#define NUMBER_OF_FQD_CHANNELS   4
 
#define OUT_IO_SUBFUNCTION_ID   1
 
#define IN_IO_SUBFUNCTION_ID   2
 

Functions

int testInfoDevice (flink_dev *dev, int unique_id, char *designDescriptor, int descriptorLength)
 
void stepVorward (int channel)
 
void stepBackward (int channel)
 
int testFQD ()
 
int testGPIODevice ()
 
int testPWMDevice ()
 
int testRatio (float ratio, uint32_t period, int channel)
 
int main (int argc, char *argv[])
 

Variables

flink_devdev
 
flink_subdevenc_a_gpio_device
 
flink_subdevenc_b_gpio_device
 
uint32_t frequency = 0
 
flink_subdevpwm_device
 
flink_subdevin_gpio_device
 

Macro Definition Documentation

#define COUNTER_FUNCTION_ID   0x6

Definition at line 21 of file base_device_test.c.

#define DEFAULT_DEV   "/dev/flink0"

Definition at line 15 of file base_device_test.c.

#define ENC_A_GPIO_UNIQUE_ID   0x3

Definition at line 28 of file base_device_test.c.

#define ENC_B_GPIO_UNIQUE_ID   0x2

Definition at line 27 of file base_device_test.c.

#define FQD_GPIO_UNIQUE_ID   0x4

Definition at line 29 of file base_device_test.c.

#define IN_GPIO_UNIQUE_ID   0x7

Definition at line 41 of file base_device_test.c.

#define IN_IO_SUBFUNCTION_ID   2

Definition at line 52 of file base_device_test.c.

#define INFO_DEVICE_DESCRIPTOR   "baseDeviceTesting"

Definition at line 18 of file base_device_test.c.

#define INFO_DEVICE_DESCRIPTOR_LENGTH   strlen(INFO_DEVICE_DESCRIPTOR)

Definition at line 19 of file base_device_test.c.

#define INFO_DEVICE_UNIQUE_ID   1

Definition at line 26 of file base_device_test.c.

#define NUMBER_OF_FQD_CHANNELS   4

Definition at line 50 of file base_device_test.c.

#define NUMBER_OF_GPIO_CHANNELS_TEST   128

Definition at line 43 of file base_device_test.c.

#define NUMBER_OF_GPIO_TESTS   1000

Definition at line 44 of file base_device_test.c.

#define NUMBER_OF_PWM_CHANNELS   4

Definition at line 33 of file base_device_test.c.

#define NUMBER_OF_PWM_RATIO_PERIOD_TEST   100

Definition at line 36 of file base_device_test.c.

#define NUMBER_OF_SUBDEVICES   8

Definition at line 25 of file base_device_test.c.

#define OUT_GPIO_UNIQUE_ID   0x8

Definition at line 42 of file base_device_test.c.

#define OUT_IO_SUBFUNCTION_ID   1

Definition at line 51 of file base_device_test.c.

#define PWM_IN_GPIO_UNIQUE_ID   0x6

Definition at line 32 of file base_device_test.c.

#define PWM_PERIOD_THRESHOLD   0.2

Definition at line 35 of file base_device_test.c.

#define PWM_RATIO_THRESHOLD   0.2

Definition at line 34 of file base_device_test.c.

#define PWM_TIMEOUT   10000000

Definition at line 37 of file base_device_test.c.

#define PWM_UNIQUE_ID   0x5

Definition at line 31 of file base_device_test.c.

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 70 of file base_device_test.c.

void stepBackward ( int  channel)

Definition at line 161 of file base_device_test.c.

Here is the caller graph for this function:

void stepVorward ( int  channel)

Definition at line 144 of file base_device_test.c.

Here is the caller graph for this function:

int testFQD ( )

Definition at line 179 of file base_device_test.c.

Here is the caller graph for this function:

int testGPIODevice ( )

Definition at line 306 of file base_device_test.c.

Here is the caller graph for this function:

int testInfoDevice ( flink_dev dev,
int  unique_id,
char *  designDescriptor,
int  descriptorLength 
)

Definition at line 659 of file base_device_test.c.

Here is the caller graph for this function:

int testPWMDevice ( )

Definition at line 469 of file base_device_test.c.

Here is the caller graph for this function:

int testRatio ( float  ratio,
uint32_t  period,
int  channel 
)

Definition at line 585 of file base_device_test.c.

Here is the caller graph for this function:

Variable Documentation

flink_dev* dev

Definition at line 65 of file base_device_test.c.

flink_subdev* enc_a_gpio_device

Definition at line 66 of file base_device_test.c.

flink_subdev* enc_b_gpio_device

Definition at line 67 of file base_device_test.c.

uint32_t frequency = 0

Definition at line 464 of file base_device_test.c.

flink_subdev* in_gpio_device

Definition at line 466 of file base_device_test.c.

flink_subdev* pwm_device

Definition at line 465 of file base_device_test.c.