📄 app.c
字号:
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_unnamed4271 { 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_unnamed4272 { 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 "D:/tinyos-1.x/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);static void sendTossimEvent(uint16_t moteID, uint16_t type, long long ftime, void *data);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;# 49 "D:/tinyos-1.x/cygwin/opt/tinyos-1.x/tos/types/AM.h"enum __nesc_unnamed4273 { TOS_BCAST_ADDR = 0xffff, TOS_UART_ADDR = 0x007e};enum __nesc_unnamed4274 { TOS_DEFAULT_AM_GROUP = 0x7d};uint8_t TOS_AM_GROUP = TOS_DEFAULT_AM_GROUP;#line 84typedef struct TOS_Msg { uint16_t addr; uint8_t type; uint8_t group; uint8_t length; int8_t data[29]; uint16_t crc; uint16_t strength; uint8_t ack; uint16_t time; uint8_t sendSecurityMode; uint8_t receiveSecurityMode;} TOS_Msg;typedef struct TOS_Msg_TinySecCompat { uint16_t addr; uint8_t type; uint8_t length; uint8_t group; int8_t data[29]; uint16_t crc; uint16_t strength; uint8_t ack; uint16_t time; uint8_t sendSecurityMode; uint8_t receiveSecurityMode;} TOS_Msg_TinySecCompat;typedef struct TinySec_Msg { uint16_t addr; uint8_t type; uint8_t length; uint8_t iv[4]; uint8_t enc[29]; uint8_t mac[4]; uint8_t calc_mac[4]; uint8_t ack_byte; bool cryptoDone; bool receiveDone; bool validMAC;} __attribute((packed)) TinySec_Msg;enum __nesc_unnamed4275 { MSG_DATA_SIZE = (size_t )& ((struct TOS_Msg *)0)->crc + sizeof(uint16_t ), TINYSEC_MSG_DATA_SIZE = (size_t )& ((struct TinySec_Msg *)0)->mac + 4, DATA_LENGTH = 29, LENGTH_BYTE_NUMBER = (size_t )& ((struct TOS_Msg *)0)->length + 1, TINYSEC_NODE_ID_SIZE = sizeof(uint16_t )};enum __nesc_unnamed4276 { TINYSEC_AUTH_ONLY = 1, TINYSEC_ENCRYPT_AND_AUTH = 2, TINYSEC_DISABLED = 3, TINYSEC_ENABLED_BIT = 128, TINYSEC_ENCRYPT_ENABLED_BIT = 64} __attribute((packed)) ;typedef TOS_Msg *TOS_MsgPtr;# 58 "D:/tinyos-1.x/cygwin/opt/tinyos-1.x/tos/platform/pc/GuiMsg.h"enum __nesc_unnamed4277 { AM_DEBUGMSGEVENT, AM_RADIOMSGSENTEVENT, AM_UARTMSGSENTEVENT, AM_ADCDATAREADYEVENT, AM_TOSSIMINITEVENT, AM_TURNONMOTECOMMAND, AM_TURNOFFMOTECOMMAND, AM_RADIOMSGSENDCOMMAND, AM_UARTMSGSENDCOMMAND, AM_SETLINKPROBCOMMAND, AM_SETADCPORTVALUECOMMAND};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 TossimInitEvent { int numMotes;} __attribute((packed)) TossimInitEvent;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;# 72 "D:/tinyos-1.x/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;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(TOS_dbg_mode mode, const char *format, ...);#line 107static void dbg_clear(TOS_dbg_mode mode, const char *format, ...);# 66 "D:/tinyos-1.x/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_unnamed4278 { TOSH_ADC_PORTMAPSIZE = 255};# 48 "D:/tinyos-1.x/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); # 42 "D:/tinyos-1.x/cygwin/opt/tinyos-1.x/tos/platform/pc/hardware.c"struct __nesc_unnamed4279 { 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);static short set_io_bit(char port, char bit);static inline #line 99short clear_io_bit(char port, char bit);static inline char inp_emulate(char port);static inline #line 132char outp_emulate(char val, char port);# 48 "D:/tinyos-1.x/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 #line 87int queue_is_empty(event_queue_t *queue);static long long queue_peek_event_time(event_queue_t *queue);static #line 110void queue_handle_next_event(event_queue_t *queue);static inline # 43 "D:/tinyos-1.x/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);# 36 "D:/tinyos-1.x/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 inline void SIG_OUTPUT_COMPARE2_interrupt(void );static void TOSH_clock_set_rate(char interval, char scale);#line 71struct timeval;static inline void event_clocktick_handle(event_t *event, struct TOS_state *state);static inline #line 103void event_clocktick_create(event_t *event, int mote, long long eventTime, int interval);static inline #line 122void event_clocktick_invalidate(event_t *event);enum __nesc_unnamed4280 { ADC_LATENCY = 200};#line 253uint8_t radioWaitingState[TOSNODES];char TOSH_MHSR_start[12] = { 0xf0, 0xf0, 0xf0, 0xff, 0x00, 0xff, 0x0f, 0x00, 0xff, 0x0f, 0x0f, 0x0f };enum __nesc_unnamed4281 { NOT_WAITING = 0, WAITING_FOR_ONE_TO_PASS = 1, WAITING_FOR_ONE_TO_CAPTURE = 2};static #line 300uint8_t TOSH_rfm_rx_bit(void );static inline void TOSH_rfm_tx_bit(uint8_t data);#line 381void event_spi_byte_create(event_t *fevent, int mote, long long ftime, int interval, int count);event_t *spiByteEvents[TOSNODES];int RADIO_TICKS_PER_EVENT = 100;# 46 "D:/tinyos-1.x/cygwin/opt/tinyos-1.x/tos/platform/pc/dbg.c"static TOS_dbg_mode_names dbg_nametab[33] = { { "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 }, { "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_add_mode(const char *name);#line 76void dbg_add_modes(const char *modes);void dbg_init(void );#line 99void dbg_help(void );static # 38 "D:/tinyos-1.x/cygwin/opt/tinyos-1.x/tos/platform/pc/external_comm.c"int64_t bswap_64(int64_t n);#line 65int commandServerSocket = -1;int eventServerSocket = -1;int commandClients[4]; int eventClients[4];pthread_t clientAcceptThread;pthread_t commandReadThread;pthread_mutex_t commandClientsLock;pthread_cond_t commandClientsCond;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 *clientAcceptThreadFunc(void *arg);static inline void *commandReadThreadFunc(void *arg);static inline void initializeSockets(void);static #line 117int acceptConnection(int servfd);static #line 133int createServerSocket(short port);static inline #line 190void waitForGuiConnection(void);static #line 210int printOtherTime(char *buf, int len, long long int ftime);static inline #line 227int printTime(char *buf, int len);static void addClient(int *clientSockets, int clifd);static inline #line 248void *clientAcceptThreadFunc(void *arg);#line 295typedef struct __nesc_unnamed4282 { GuiMsg *msg; char *payLoad;} incoming_command_data_t;void nido_start_mote(uint16_t moteID);void nido_stop_mote(uint16_t moteID);TOS_MsgPtr NIDO_received_radio(TOS_MsgPtr packet);TOS_MsgPtr NIDO_received_uart(TOS_MsgPtr packet);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -