/***************************************************************************** * FUNCTION: WFProcess * * RETURNS: None * * PARAMS: None * * NOTES: This function is called from WFProcess. It does the following: * 1) checks for and processes MRF24W external interrupt events * 2) checks for and processes received management messages from the MRF24W * 3) maintains the PS-Poll state (if applicable) * *****************************************************************************/ void WFProcess(void) { #if defined(__18CXX) static UINT16 len; #else UINT16 len; #endif //---------------------------------------------------------- // if there is a MRF24W External interrupt (EINT) to process //---------------------------------------------------------- if (g_ExIntNeedsServicing == TRUE) { g_ExIntNeedsServicing = FALSE; ProcessInterruptServiceResult(); } //---------------------------------------- // else if there is management msg to read //---------------------------------------- else if (g_MgmtReadMsgReady == TRUE) { RawGetMgmtRxBuffer(&len); // handle received managment message g_MgmtReadMsgReady = FALSE; ProcessMgmtRxMsg(); // reenable interrupts WF_EintEnable(); } }
/***************************************************************************** * FUNCTION: WFProcess * * RETURNS: None * * PARAMS: None * * NOTES: This function is called from WFProcess. It does the following: * 1) checks for and processes MRF24WB0M external interrupt events * 2) checks for and processes received management messages from the MRF24WB0M * 3) maintains the PS-Poll state (if applicable) * *****************************************************************************/ void WFProcess(void) { UINT16 len; //---------------------------------------------------------- // if there is a MRF24WB0M External interrupt (EINT) to process //---------------------------------------------------------- if (g_ExIntNeedsServicing == TRUE) { g_ExIntNeedsServicing = FALSE; ProcessInterruptServiceResult(); } //---------------------------------------- // else if there is management msg to read //---------------------------------------- else if (g_MgmtReadMsgReady == TRUE) { /* Ensure the MRF24WB0M is awake (only applies if PS-Poll was enabled) */ EnsureWFisAwake(); //----------------------------- // process management read //----------------------------- // if the Raw Rx buffer is available, or only has the scratch mounted, then mount it so // we can process received Mgmt message. Otherwise, stay in this state and keep checking // until we can mount the Raw Rx buffer and get the management message. Once the Raw Rx // is acquired, rx data packets are held off until we finish processing mgmt message. if ( RawGetMgmtRxBuffer(&len) ) { // handle received managment message g_MgmtReadMsgReady = FALSE; ProcessMgmtRxMsg(); // reenable interrupts WF_EintEnable(); } } //----------------------------------- // else no EINT or Mgmt Rx to process //----------------------------------- else { #if defined (WF_USE_POWER_SAVE_FUNCTIONS) /* if PS-Poll mode was enabled by application and was previously deactivated by WF driver */ if (WFisPsPollEnabled() && !WFIsPsPollActive() ) { /* reactivate PS-Poll mode on MRF24WB0M (allow MRF24WB0M to sleep) */ WFConfigureLowPowerMode(WF_LOW_POWER_MODE_ON); } #endif } }
/***************************************************************************** * FUNCTION: WFProcess * * RETURNS: None * * PARAMS: None * * NOTES: This function is called from WFProcess. It does the following: * 1) checks for and processes MRF24W external interrupt events * 2) checks for and processes received management messages from the MRF24W * 3) maintains the PS-Poll state (if applicable) * *****************************************************************************/ void WFProcess(void) { #if defined(__XC8) static uint16_t len; #else uint16_t len; #endif //---------------------------------------------------------- // if there is a MRF24W External interrupt (EINT) to process //---------------------------------------------------------- if (g_ExIntNeedsServicing == true) { g_ExIntNeedsServicing = false; ProcessInterruptServiceResult(); } //---------------------------------------- // else if there is management msg to read //---------------------------------------- else if (g_MgmtReadMsgReady == true) { //----------------------------- // process management read //----------------------------- // if the Raw Rx buffer is available, or only has the scratch mounted, then mount it so // we can process received Mgmt message. Otherwise, stay in this state and keep checking // until we can mount the Raw Rx buffer and get the management message. Once the Raw Rx // is acquired, rx data packets are held off until we finish processing mgmt message. if ( RawGetMgmtRxBuffer(&len) ) { // handle received managment message g_MgmtReadMsgReady = false; ProcessMgmtRxMsg(); // reenable interrupts WF_EintEnable(); } } }
/***************************************************************************** * FUNCTION: WFProcess * * RETURNS: None * * PARAMS: None * * NOTES: This function is called from WFProcess. It does the following: * 1) checks for and processes MRF24WB0M external interrupt events * 2) checks for and processes received management messages from the MRF24WB0M * 3) maintains the PS-Poll state (if applicable) * *****************************************************************************/ void WFProcess(void) { UINT16 len; //---------------------------------------------------------- // if there is a MRF24WB0M External interrupt (EINT) to process //---------------------------------------------------------- if (g_ExIntNeedsServicing == TRUE) { g_ExIntNeedsServicing = FALSE; ProcessInterruptServiceResult(); } //---------------------------------------- // else if there is management msg to read //---------------------------------------- else if (g_MgmtReadMsgReady == TRUE) { /* Ensure the MRF24WB0M is awake (only applies if PS-Poll was enabled) */ EnsureWFisAwake(); //----------------------------- // process management read //----------------------------- // if the Raw Rx buffer is available, or only has the scratch mounted, then mount it so // we can process received Mgmt message. Otherwise, stay in this state and keep checking // until we can mount the Raw Rx buffer and get the management message. Once the Raw Rx // is acquired, rx data packets are held off until we finish processing mgmt message. if ( RawGetMgmtRxBuffer(&len) ) { // handle received managment message g_MgmtReadMsgReady = FALSE; ProcessMgmtRxMsg(); // reenable interrupts WF_EintEnable(); } } }