*** stock_iot-lab_M3/openwsn/02a-MAClow/stupidmac/stupidmac.c Thu Apr 24 11:01:36 2014 --- riot-openwsn-wip/openwsn/02a-MAClow/stupidmac/stupidmac.c Thu Apr 24 16:55:54 2014 *************** *** 31,44 **** //=========================== prototypes ====================================== #include "IEEE802154_common.c" ! void packetReceived(); ! void armRandomBackoffTimer(); void change_state(uint8_t newstate); //======= from upper layer //in stupidMAC, the radio is always on, listening ! void stupidmac_init() { radio_rxOn(openwsn_frequency_channel); change_state(S_IDLE_LISTENING); stupidmac_dataFrameToSend = NULL; --- 31,44 ---- //=========================== prototypes ====================================== #include "IEEE802154_common.c" ! void packetReceived(void); ! void armRandomBackoffTimer(void); void change_state(uint8_t newstate); //======= from upper layer //in stupidMAC, the radio is always on, listening ! void stupidmac_init(void) { radio_rxOn(openwsn_frequency_channel); change_state(S_IDLE_LISTENING); stupidmac_dataFrameToSend = NULL; *************** *** 238,244 **** //=========================== private ========================================= ! void packetReceived() { if (stupidmac_dataFrameReceived->length>0) { //packet contains payload destined to an upper layer nores_receive(stupidmac_dataFrameReceived); --- 238,244 ---- //=========================== private ========================================= ! void packetReceived(void) { if (stupidmac_dataFrameReceived->length>0) { //packet contains payload destined to an upper layer nores_receive(stupidmac_dataFrameReceived); *************** *** 249,255 **** stupidmac_dataFrameReceived = NULL; } ! void armRandomBackoffTimer() { timer_startOneShot(TIMER_MAC_BACKOFF,MINBACKOFF); //TODO randomize } --- 249,255 ---- stupidmac_dataFrameReceived = NULL; } ! void armRandomBackoffTimer(void) { timer_startOneShot(TIMER_MAC_BACKOFF,MINBACKOFF); //TODO randomize } *************** *** 271,284 **** } } ! bool stupidmac_debugPrint() { return FALSE; } //======= timers firing //periodic timer used to transmit, and to trigger serial input/output ! void timer_mac_periodic_fired() { #ifndef SERIALINSCHEDULER openserial_stop(); #endif --- 271,284 ---- } } ! bool stupidmac_debugPrint(void) { return FALSE; } //======= timers firing //periodic timer used to transmit, and to trigger serial input/output ! void timer_mac_periodic_fired(void) { #ifndef SERIALINSCHEDULER openserial_stop(); #endif *************** *** 297,303 **** //this function is the one which really initiates the transmission of a packet. //It only does so if the MAC layer is in S_IDLE_LISTENING stupidmac_state, otherwise it defers ! void timer_mac_backoff_fired() { if (stupidmac_state==S_IDLE_LISTENING) { if (stupidmac_dataFrameToSend!=NULL) { openserial_printError(COMPONENT_MAC,ERR_DATAFRAMETOSEND_ERROR, --- 297,303 ---- //this function is the one which really initiates the transmission of a packet. //It only does so if the MAC layer is in S_IDLE_LISTENING stupidmac_state, otherwise it defers ! void timer_mac_backoff_fired(void) { if (stupidmac_state==S_IDLE_LISTENING) { if (stupidmac_dataFrameToSend!=NULL) { openserial_printError(COMPONENT_MAC,ERR_DATAFRAMETOSEND_ERROR, *************** *** 326,332 **** } } ! void timer_mac_watchdog_fired() { switch (stupidmac_state) { case S_TX_RXACK: //I'm a transmitter, didn't receive ACK (end of TX sequence). --- 326,332 ---- } } ! void timer_mac_watchdog_fired(void) { switch (stupidmac_state) { case S_TX_RXACK: //I'm a transmitter, didn't receive ACK (end of TX sequence).