Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
stress-test.c File Reference
#include <assert.h>
#include <pthread.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include "ca821x-posix/ca821x-posix-evbme.h"
#include "ca821x-posix/ca821x-posix.h"
#include "evbme_messages.h"
Include dependency graph for stress-test.c:

Classes

struct  inst_priv
 

Macros

#define _DEFAULT_SOURCE   1
 
#define RED   "\x1b[31m"
 
#define GREEN   "\x1b[32m"
 
#define YELLOW   "\x1b[33m"
 
#define BLUE   "\x1b[34m"
 
#define MAGENTA   "\x1b[35m"
 
#define CYAN   "\x1b[36m"
 
#define BOLDWHITE   "\x1b[1m\x1b[37m"
 
#define RESET   "\x1b[0m"
 
#define COLOR_SET(C, X)   C X RESET
 
#define CHANNEL   22
 
#define M_PANID   0x1AAA
 
#define MAX_MSDU_LEN   100
 
#define MIN_MSDU_LEN   100
 
#define MAX_INSTANCES   5
 
#define TX_PERIOD   ((struct timespec){0, getRand(6000000, 7000000)})
 
#define TO_BACKOFF   ((struct timespec){0, 10000000})
 
#define WAIT_CONFIRM   0
 
#define ONE_DIRECTION   0
 
#define INSERT_SYNC   (getRand(0, 0))
 
#define INDIRECT   1
 
#define INDIRECTJUNK   0
 
#define USELONGADDR   (getRand(0, 0))
 
#define ACKREQ   (getRand(1, 1))
 
#define NUMRETRIES   4
 
#define HISTORY_LENGTH   200
 
#define MSDU_HISTORY   100
 
#define M_MSDU_LENGTH   (getRand(MIN_MSDU_LEN, MAX_MSDU_LEN))
 
#define STATUS_RECEIVED   (1 << 0)
 
#define STATUS_ACKNOWLEDGED   (1 << 1)
 
#define STATUS_REPEATED   (1 << 2)
 
#define STATUS_CONFIRMED   (1 << 3)
 

Functions

void initInst (struct inst_priv *cur)
 
void drawTableHeader ()
 
void drawTableRow (unsigned int time)
 
int main (int argc, char *argv[])
 

Variables

int numInsts
 
struct inst_priv insts [MAX_INSTANCES] = {}
 
pthread_mutex_t out_mutex = PTHREAD_MUTEX_INITIALIZER
 
pthread_mutex_t rand_mutex = PTHREAD_MUTEX_INITIALIZER
 

Macro Definition Documentation

◆ _DEFAULT_SOURCE

#define _DEFAULT_SOURCE   1

◆ ACKREQ

#define ACKREQ   (getRand(1, 1))

◆ BLUE

#define BLUE   "\x1b[34m"

◆ BOLDWHITE

#define BOLDWHITE   "\x1b[1m\x1b[37m"

◆ CHANNEL

#define CHANNEL   22

◆ COLOR_SET

#define COLOR_SET (   C,
 
)    C X RESET

◆ CYAN

#define CYAN   "\x1b[36m"

◆ GREEN

#define GREEN   "\x1b[32m"

◆ HISTORY_LENGTH

#define HISTORY_LENGTH   200

◆ INDIRECT

#define INDIRECT   1

◆ INDIRECTJUNK

#define INDIRECTJUNK   0

◆ INSERT_SYNC

#define INSERT_SYNC   (getRand(0, 0))

◆ M_MSDU_LENGTH

#define M_MSDU_LENGTH   (getRand(MIN_MSDU_LEN, MAX_MSDU_LEN))

◆ M_PANID

#define M_PANID   0x1AAA

◆ MAGENTA

#define MAGENTA   "\x1b[35m"

◆ MAX_INSTANCES

#define MAX_INSTANCES   5

◆ MAX_MSDU_LEN

#define MAX_MSDU_LEN   100

◆ MIN_MSDU_LEN

#define MIN_MSDU_LEN   100

◆ MSDU_HISTORY

#define MSDU_HISTORY   100

◆ NUMRETRIES

#define NUMRETRIES   4

◆ ONE_DIRECTION

#define ONE_DIRECTION   0

◆ RED

#define RED   "\x1b[31m"

◆ RESET

#define RESET   "\x1b[0m"

◆ STATUS_ACKNOWLEDGED

#define STATUS_ACKNOWLEDGED   (1 << 1)

◆ STATUS_CONFIRMED

#define STATUS_CONFIRMED   (1 << 3)

◆ STATUS_RECEIVED

#define STATUS_RECEIVED   (1 << 0)

◆ STATUS_REPEATED

#define STATUS_REPEATED   (1 << 2)

◆ TO_BACKOFF

#define TO_BACKOFF   ((struct timespec){0, 10000000})

◆ TX_PERIOD

#define TX_PERIOD   ((struct timespec){0, getRand(6000000, 7000000)})

◆ USELONGADDR

#define USELONGADDR   (getRand(0, 0))

◆ WAIT_CONFIRM

#define WAIT_CONFIRM   0

◆ YELLOW

#define YELLOW   "\x1b[33m"

Function Documentation

◆ drawTableHeader()

void drawTableHeader ( )

◆ drawTableRow()

void drawTableRow ( unsigned int  time)

◆ initInst()

void initInst ( struct inst_priv cur)

◆ main()

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

Variable Documentation

◆ insts

struct inst_priv insts[MAX_INSTANCES] = {}

◆ numInsts

int numInsts

◆ out_mutex

pthread_mutex_t out_mutex = PTHREAD_MUTEX_INITIALIZER

◆ rand_mutex

pthread_mutex_t rand_mutex = PTHREAD_MUTEX_INITIALIZER