|
|
|
|
/home/brennan/Software/sensix/tools/sim/sim_net.c File Reference#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <math.h>
#include <signal.h>
#include <pthread.h>
#include <igraph/igraph.h>
#include "platform.pc/external_comm.h"
#include "sense_endian.h"
#include "SensixMsg.h"
Go to the source code of this file.
|
Classes |
struct | GuiMsg |
struct | adc_request_t |
struct | radio_msg_t |
struct | client_t |
Defines |
#define | _GNU_SOURCE |
#define | norace |
#define | MAX_CLIENTS 1024 |
#define | MAX_MOTES 100000 |
#define | MAX_ADC_PORTS 16 |
#define | SLEEP_MSECS 500 |
#define | TIME_ADJUST 4000.0 |
#define | DATA_BUFFER_SIZE 256 |
#define | MAX_MSG_SIZE 512 |
#define | ACK 65 |
#define | NACK 66 |
#define | APP "NETSIM: " |
#define | BROADCAST 0xffff |
#define | INSTRUMENTATION |
#define | DEBUG_VERBOSE |
#define | DEBUG_RADIO |
#define | DEBUG_ADC |
#define | GUI_MSG_HEADER_LENGTH 14 |
Typedefs |
typedef struct GuiMsg | GuiMsg_t |
Enumerations |
enum | {
AM_DEBUGMSGEVENT = 1,
AM_RADIOMSGSENTEVENT = 1 << 1,
AM_UARTMSGSENTEVENT = 1 << 2,
AM_ADCDATAREADYEVENT = 1 << 3,
AM_TOSSIMINITEVENT = 1 << 4,
AM_INTERRUPTEVENT = 1 << 5,
AM_LEDEVENT = 1 << 6,
AM_TURNONMOTECOMMAND = 1 << 12,
AM_TURNOFFMOTECOMMAND,
AM_RADIOMSGSENDCOMMAND,
AM_UARTMSGSENDCOMMAND,
AM_SETLINKPROBCOMMAND,
AM_SETADCPORTVALUECOMMAND,
AM_INTERRUPTCOMMAND,
AM_SETRATECOMMAND,
AM_SETDBGCOMMAND,
AM_VARIABLERESOLVECOMMAND,
AM_VARIABLERESOLVERESPONSE,
AM_VARIABLEREQUESTCOMMAND,
AM_VARIABLEREQUESTRESPONSE,
AM_GETMOTECOUNTCOMMAND,
AM_GETMOTECOUNTRESPONSE,
AM_SETEVENTMASKCOMMAND,
AM_BEGINBATCHCOMMAND,
AM_ENDBATCHCOMMAND
} |
Functions |
void * | service_thread (void *idx_ptr) |
void * | accept_thread (void *unused) |
int | main (int argc, char *argv[]) |
Variables |
pthread_t | threads [MAX_CLIENTS+1] |
pthread_mutex_t | num_threads_mutex = PTHREAD_MUTEX_INITIALIZER |
pthread_mutex_t | sim_time_mutex = PTHREAD_MUTEX_INITIALIZER |
pthread_mutex_t | not_done_mutex = PTHREAD_MUTEX_INITIALIZER |
pthread_mutex_t | clients_mutex = PTHREAD_MUTEX_INITIALIZER |
pthread_mutex_t | adc_mutex = PTHREAD_MUTEX_INITIALIZER |
Define Documentation
#define DATA_BUFFER_SIZE 256 |
#define GUI_MSG_HEADER_LENGTH 14 |
#define TIME_ADJUST 4000.0 |
Typedef Documentation
Enumeration Type Documentation
- Enumerator:
-
AM_DEBUGMSGEVENT |
|
AM_RADIOMSGSENTEVENT |
|
AM_UARTMSGSENTEVENT |
|
AM_ADCDATAREADYEVENT |
|
AM_TOSSIMINITEVENT |
|
AM_INTERRUPTEVENT |
|
AM_LEDEVENT |
|
AM_TURNONMOTECOMMAND |
|
AM_TURNOFFMOTECOMMAND |
|
AM_RADIOMSGSENDCOMMAND |
|
AM_UARTMSGSENDCOMMAND |
|
AM_SETLINKPROBCOMMAND |
|
AM_SETADCPORTVALUECOMMAND |
|
AM_INTERRUPTCOMMAND |
|
AM_SETRATECOMMAND |
|
AM_SETDBGCOMMAND |
|
AM_VARIABLERESOLVECOMMAND |
|
AM_VARIABLERESOLVERESPONSE |
|
AM_VARIABLEREQUESTCOMMAND |
|
AM_VARIABLEREQUESTRESPONSE |
|
AM_GETMOTECOUNTCOMMAND |
|
AM_GETMOTECOUNTRESPONSE |
|
AM_SETEVENTMASKCOMMAND |
|
AM_BEGINBATCHCOMMAND |
|
AM_ENDBATCHCOMMAND |
|
Definition at line 85 of file sim_net.c.
Function Documentation
void* accept_thread |
( |
void * |
unused |
) |
|
int main |
( |
int |
argc, |
|
|
char * |
argv[] | |
|
) |
| | |
void* service_thread |
( |
void * |
idx_ptr |
) |
|
Variable Documentation
pthread_mutex_t adc_mutex = PTHREAD_MUTEX_INITIALIZER |
|