📄 app.c
字号:
TOS_ADC_CC_RSSI_PORT = 0, TOS_ADC_VOLTAGE_PORT = 7, TOS_ADC_BANDGAP_PORT = 10, TOS_ADC_GND_PORT = 11};# 18 "/usr/include/cygwin/socket.h"struct sockaddr { unsigned short sa_family; char sa_data[14];};# 37 "/usr/include/cygwin/if.h"struct ifreq { union __nesc_unnamed4275 { char ifrn_name[16]; } ifr_ifrn; union __nesc_unnamed4276 { struct sockaddr ifru_addr; struct sockaddr ifru_broadaddr; struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; short ifru_flags; int ifru_metric; int ifru_mtu; } ifr_ifru;};#line 74struct ifconf { int ifc_len; union __nesc_unnamed4277 { caddr_t ifcu_buf; struct ifreq *ifcu_req; } ifc_ifcu;};# 28 "/usr/include/cygwin/socket.h"struct linger { unsigned short l_onoff; unsigned short l_linger;};struct msghdr { void *msg_name; int msg_namelen; struct iovec *msg_iov; int msg_iovlen; void *msg_accrights; int msg_accrightslen;};# 29 "/usr/include/sys/socket.h"int accept(int , struct sockaddr *__peer, int *);int bind(int , const struct sockaddr *__my_addr, int __addrlen);int listen(int , int __n);int send(int , const void *__buff, int __len, int __flags);int setsockopt(int __s, int __level, int __optname, const void *optval, int __optlen);int socket(int __family, int __type, int __protocol);struct servent;# 24 "/usr/include/cygwin/in.h"enum __nesc_unnamed4278 { IPPROTO_IP = 0, IPPROTO_ICMP = 1, IPPROTO_IGMP = 2, IPPROTO_IPIP = 4, IPPROTO_TCP = 6, IPPROTO_EGP = 8, IPPROTO_PUP = 12, IPPROTO_UDP = 17, IPPROTO_IDP = 22, IPPROTO_RAW = 255, IPPROTO_MAX};typedef uint16_t in_port_t;enum __nesc_unnamed4279 { IPPORT_ECHO = 7, IPPORT_DISCARD = 9, IPPORT_SYSTAT = 11, IPPORT_DAYTIME = 13, IPPORT_NETSTAT = 15, IPPORT_FTP = 21, IPPORT_TELNET = 23, IPPORT_SMTP = 25, IPPORT_TIMESERVER = 37, IPPORT_NAMESERVER = 42, IPPORT_WHOIS = 43, IPPORT_MTP = 57, IPPORT_TFTP = 69, IPPORT_RJE = 77, IPPORT_FINGER = 79, IPPORT_TTYLINK = 87, IPPORT_SUPDUP = 95, IPPORT_EXECSERVER = 512, IPPORT_LOGINSERVER = 513, IPPORT_CMDSERVER = 514, IPPORT_EFSSERVER = 520, IPPORT_BIFFUDP = 512, IPPORT_WHOSERVER = 513, IPPORT_ROUTESERVER = 520, IPPORT_RESERVED = 1024, IPPORT_USERRESERVED = 5000};typedef uint32_t in_addr_t;struct in_addr { unsigned int s_addr;};struct ip_mreq { struct in_addr imr_multiaddr; struct in_addr imr_interface;};struct sockaddr_in { short int sin_family; unsigned short int sin_port; struct in_addr sin_addr; unsigned char __pad [#line 106 16 - sizeof(short int ) - sizeof(unsigned short int ) - sizeof(struct in_addr )];};# 35 "/usr/include/asm/byteorder.h" 3extern unsigned short int ntohs(unsigned short int );extern unsigned long int htonl(unsigned long int );extern unsigned short int htons(unsigned short int );# 175 "/usr/include/cygwin/in.h"struct in6_addr { unsigned char s6_addr[16];};struct sockaddr_in6 { unsigned short sin6_family; unsigned short sin6_port; unsigned long sin6_flowinfo; struct in6_addr sin6_addr;};# 4 "/usr/include/errno.h"typedef int error_t;# 15 "/usr/include/sys/errno.h"extern int *__errno(void ); # 46 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/pc/external_comm.h"static int socketsInitialized = 0;static inline void initializeSockets(void);static inline int readTossimCommand(int clifd, int clidx);static void buildTossimEvent(uint16_t moteID, uint16_t type, long long ftime, void *data, unsigned char **msgp, int *lenp);static void sendTossimEvent(uint16_t moteID, uint16_t type, long long ftime, void *data);static int writeTossimEvent(void *data, int datalen, int clifd);static inline char *currentTime(void);static inline int printTime(char *buf, int len);static int printOtherTime(char *buf, int len, long long int ftime);# 111 "/usr/lib/gcc-lib/i686-pc-cygwin/3.2/include/stdarg.h" 3typedef __gnuc_va_list va_list;# 58 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/pc/GuiMsg.h"enum __nesc_unnamed4280 { 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};typedef struct GuiMsg { uint16_t msgType; uint16_t moteID; long long time; uint16_t payLoadLen;} GuiMsg;typedef struct DebugMsgEvent { char debugMessage[512];} DebugMsgEvent;typedef struct RadioMsgSentEvent { TOS_Msg message;} RadioMsgSentEvent;typedef struct UARTMsgSentEvent { TOS_Msg message;} UARTMsgSentEvent;typedef struct ADCDataReadyEvent { uint8_t port; uint16_t data;} ADCDataReadyEvent;typedef struct VariableResolveResponse { uint32_t addr; uint32_t length;} VariableResolveResponse;typedef struct VariableRequestResponse { uint32_t length; char value[256];} VariableRequestResponse;typedef struct TossimInitEvent { int numMotes; uint8_t radioModel; uint32_t rate;} __attribute((packed)) TossimInitEvent;typedef struct InterruptEvent { uint32_t id;} InterruptEvent;typedef struct TurnOnMoteCommand {} TurnOnMoteCommand;typedef struct TurnOffMoteCommand {} TurnOffMoteCommand;typedef struct RadioMsgSendCommand { TOS_Msg message;} RadioMsgSendCommand;typedef struct UARTMsgSendCommand { TOS_Msg message;} UARTMsgSendCommand;typedef struct SetLinkProbCommand { uint16_t moteReceiver; uint32_t scaledProb;} SetLinkProbCommand;typedef struct SetADCPortValueCommand { uint8_t port; uint16_t value;} SetADCPortValueCommand;typedef struct VariableResolveCommand { char name[256];} VariableResolveCommand;typedef struct VariableRequestCommand { uint32_t addr; uint8_t length;} VariableRequestCommand;typedef struct InterruptCommand { uint32_t id;} InterruptCommand;typedef struct SetRateCommand { uint32_t rate;} SetRateCommand;typedef struct LedEvent { uint8_t red : 1; uint8_t green : 1; uint8_t yellow : 1;} LedEvent;typedef struct SetDBGCommand { long long dbg;} SetDBGCommand;typedef struct GetMoteCountCommand { uint8_t placeholder;} GetMoteCountCommand;typedef struct GetMoteCountResponse { uint16_t totalMotes; uint8_t bitmask[(TOSNODES + 7) / 8];} GetMoteCountResponse;typedef struct SetEventMaskCommand { uint16_t mask;} SetEventMaskCommand;typedef struct BeginBatchCommand {} BeginBatchCommand;typedef struct EndBatchCommand {} EndBatchCommand;# 72 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/types/dbg.h"typedef struct dbg_mode { char *d_name; unsigned long long d_mode;} TOS_dbg_mode_names;TOS_dbg_mode dbg_modes = 0; bool dbg_suppress_stdout = 0;static bool dbg_active(TOS_dbg_mode mode);static void dbg_add_mode(const char *mode);static void dbg_add_modes(const char *modes);static void dbg_init(void );static void dbg_help(void );static void dbg_set(TOS_dbg_mode );static void dbg(TOS_dbg_mode mode, const char *format, ...);#line 112static void dbg_clear(TOS_dbg_mode mode, const char *format, ...);# 66 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/pc/hardware.h"extern TOS_dbg_mode dbg_modes; TOS_state_t tos_state;#line 86typedef uint8_t __nesc_atomic_t;__inline __nesc_atomic_t __nesc_atomic_start(void );__inline void __nesc_atomic_end(__nesc_atomic_t oldSreg);enum __nesc_unnamed4281 { TOSH_ADC_PORTMAPSIZE = 255};# 48 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/pc/heap_array.c"const int STARTING_SIZE = 511;typedef struct node { void *data; long long key;} node_t;static void down_heap(heap_t *heap, int findex);static void up_heap(heap_t *heap, int findex);static void swap(node_t *first, node_t *second);static inline void init_heap(heap_t *heap);static inline int is_empty(heap_t *heap);static inline int heap_is_empty(heap_t *heap);static inline long long heap_get_min_key(heap_t *heap);static #line 104void *heap_pop_min_data(heap_t *heap, long long *key);static inline #line 120void expand_heap(heap_t *heap);static inline #line 134void heap_insert(heap_t *heap, void *data, long long key);static #line 148void swap(node_t *first, node_t *second);static #line 161void down_heap(heap_t *heap, int findex);static #line 187void up_heap(heap_t *heap, int findex); # 41 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/pc/hardware.c"struct __nesc_unnamed4282 { char status_register; char register_A; char register_B; char register_C; char register_D; char register_E; char register_default;} TOSH_pc_hardware;static inline void init_hardware(void);# 47 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/pc/event_queue.c"struct timespec;static inline void queue_init(event_queue_t *queue, int fpause);static void queue_insert_event(event_queue_t *queue, event_t *event);static inline event_t *queue_pop_event(event_queue_t *queue);static inline #line 86int queue_is_empty(event_queue_t *queue);static inline long long queue_peek_event_time(event_queue_t *queue);static inline #line 109void queue_handle_next_event(event_queue_t *queue);static inline # 43 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/pc/events.c"void event_default_cleanup(event_t *event);static void event_total_cleanup(event_t *event);static inline void event_cleanup(event_t *fevent); # 11 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/pc/powermod.h"double *cycles; int power_init; int prof_on; int cpu_prof_on;# 39 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/pc/hpl.c"static int clockScales[8] = { -1, 122, 976, 3906, 7812, 15625, 31250, 125000 }; static event_t *clockEvents[TOSNODES]; static uint8_t intervals[TOSNODES]; static uint8_t scales[TOSNODES]; static long long setTime[TOSNODES]; static uint8_t interruptPending[TOSNODES];static inline void SIG_OUTPUT_COMPARE2_interrupt(void );static void TOSH_clock_set_interval(uint8_t interval);static #line 86void TOSH_clock_set_rate(char interval, char scale);static inline #line 115uint8_t TOSH_get_clock_interval(void);static uint8_t TOSH_get_clock0_counter(void);#line 154struct timeval;static inline void event_clocktick_handle(event_t *event, struct TOS_state *state);static #line 191void event_clocktick_create(event_t *event, int mote, long long eventTime, int interval);static inline #line 211void event_clocktick_invalidate(event_t *event);enum __nesc_unnamed4283 { ADC_LATENCY = 200};#line 345enum __nesc_unnamed4284 { NOT_WAITING = 0, WAITING_FOR_ONE_TO_PASS = 1, WAITING_FOR_ONE_TO_CAPTURE = 2};#line 470void event_spi_byte_create(event_t *fevent, int mote, long long ftime, int interval, int count);# 46 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/pc/dbg.c"static TOS_dbg_mode_names dbg_nametab[34] = { { "all", DBG_ALL }, { "boot", DBG_BOOT | DBG_ERROR }, { "clock", DBG_CLOCK | DBG_ERROR }, { "task", DBG_TASK | DBG_ERROR }, { "sched", DBG_SCHED | DBG_ERROR }, { "sensor", DBG_SENSOR | DBG_ERROR }, { "led", DBG_LED | DBG_ERROR }, { "crypto", DBG_CRYPTO | DBG_ERROR }, { "route", DBG_ROUTE | DBG_ERROR }, { "am", DBG_AM | DBG_ERROR }, { "crc", DBG_CRC | DBG_ERROR }, { "packet", DBG_PACKET | DBG_ERROR }, { "encode", DBG_ENCODE | DBG_ERROR }, { "radio", DBG_RADIO | DBG_ERROR }, { "logger", DBG_LOG | DBG_ERROR }, { "adc", DBG_ADC | DBG_ERROR }, { "i2c", DBG_I2C | DBG_ERROR }, { "uart", DBG_UART | DBG_ERROR }, { "prog", DBG_PROG | DBG_ERROR }, { "sounder", DBG_SOUNDER | DBG_ERROR }, { "time", DBG_TIME | DBG_ERROR }, { "power", DBG_POWER | DBG_ERROR }, { "sim", DBG_SIM | DBG_ERROR }, { "queue", DBG_QUEUE | DBG_ERROR }, { "simradio", DBG_SIMRADIO | DBG_ERROR }, { "hardware", DBG_HARD | DBG_ERROR }, { "simmem", DBG_MEM | DBG_ERROR }, { "usr1", DBG_USR1 | DBG_ERROR }, { "usr2", DBG_USR2 | DBG_ERROR }, { "usr3", DBG_USR3 | DBG_ERROR }, { "temp", DBG_TEMP | DBG_ERROR }, { "error", DBG_ERROR }, { "none", DBG_NONE }, { (void *)0, DBG_ERROR } };void dbg_set(TOS_dbg_mode modes);void dbg_add_mode(const char *name);#line 84void dbg_add_modes(const char *modes);void dbg_init(void );#line 107void dbg_help(void );static # 36 "C:/tinyos/cygwin/opt/tinyos-1.x/tos/platform/pc/external_comm.c"int64_t bswap_64(int64_t n);#line 83int commandServerSocket = -1;int eventServerSocket = -1;int commandClients[4];uint8_t batchState[4]; int eventClients[4]; uint16_t eventMask;pthread_t eventAcceptThread;pthread_t commandReadThread;pthread_mutex_t eventClientsLock;pthread_cond_t eventClientsCond;TOS_Msg external_comm_msgs_[TOSNODES];TOS_MsgPtr external_comm_buffers_[TOSNODES]; static int GUI_enabled;static int createServerSocket(short port);static inline void *eventAcceptThreadFunc(void *arg);static inline void *commandReadThreadFunc(void *arg);static int __nesc_nido_resolve(int __nesc_mote, char *varname, uintptr_t *addr, size_t *size);static inline
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -