00001 00008 /******************************* Constants **********************************/ 00009 #ifndef _TIME_MANAGE_ 00010 #include <bite.h> 00011 #include <Messages.h> 00012 00013 #define TEMPO_TEST_NWK 100/*time between 2 sendings in the test = 1sec*/ 00014 #define NB_TOP_MAX 60000 // utilise 60000 00015 #define TEMPO_SINGLE_HOP() (3*400)/*duration during we can try to send a message to the good neighboor in single_hop mode*/ 00016 #define WAIT_DATA_AFTER_WB 100 /*40 time during it is waiting for receiving datas set to 4ms*/ //ok 00017 #define TIME_BASE 100 /*counted in ticks, currently 1 tick is about 100µs*/ //ok 00018 #define WAKEUP_BEACON_INTERVAL 10 /* *10 = Time in msec minimum time between two wakeup beacons was 10*/ //ok 00019 #define TEMPO_BROADCAST() (4*wakeup_interval) /*duration during we can send a message in modes BROADCAST*/ 00020 #define TEMPO_HOP_ACK() ((MAX_ENVOIS+1)*TEMPO_RENVOI())//nb of tops before clear message 00021 #define NB_WAITING_FOR_WB 20 //20 nb we wait for a wakeup beacon to emit data 00022 #define TEMPO_RENVOI() (10*wakeup_interval) /*nb of tops when we sent again if Ack is not arrived initially 150*/ 00023 #define RANDMAX_WAKEUP_INTERVAL 4 00024 #define NB_TICK_MAX 4294967295U 00025 /******************************* Structures **********************************/ 00026 /*To the different times out*/ 00027 typedef struct//de taille 8 bits 00028 { 00029 UINT8 Check_Temperature : 3; 00030 UINT8 inondation : 1; 00031 UINT8 bourrage : 5; 00032 }flag_time_out; 00033 00034 00035 typedef struct 00036 { 00037 UINT16 Deadline : 16; 00038 00039 }DeadlinesStruct; 00040 00041 typedef struct //length 16 bits 00042 { 00043 UINT16 recep : 1; 00044 UINT16 envoi : 1; 00045 UINT16 Test_NWK : 1; 00046 UINT16 : 13;//non utilise 00047 }flag_Nb_top_carry; 00048 00049 00050 /******************************* Variables **********************************/ 00051 extern flag_time_out F_TimeOut; 00052 extern DeadlinesStruct Deadlines[NB_DEADLINES]; 00053 extern UINT8 flag_Clock_ticks_carry; 00054 extern flag_Nb_top_carry F_Carry; 00055 extern unsigned int wakeup_interval; 00056 #endif