Exemplo n.º 1
0
//-------------------------------------------------------------------------
void StandardSocketSend(uint16_t port, uint16_t address, uint8_t msglength,
                        uint8_t * msg)
{
//    #ifdef PLATFORM_AVR_IRIS
//     sleepThread(20);
//    #endif

    radiosocketdata.socket_port = port;
    radiosocketdata.socket_addr = address;
    radiosocketdata.socket_msg_len = msglength;
    radiosocketdata.socket_msg = msg;
    postTask(send_task, 9);
    sleepThread(20);
    restoreRadioState();
    return;
}
Exemplo n.º 2
0
//This function is called from the particular implementation!
//This function also contains platform related defintions 
//0, 1, 2, AND 10, 11 are reserved. User is suggested to start with id 20. 
inline result_t GenericTimerFired(uint8_t id)
{


    unsigned char result;
    
    //0, 1, 2 for threads
    switch (id)
    {
    case 0:
        ServiceTimerFired(0);
        break;
    case 1:
        ServiceTimerFired(1);
         break;
    case 2:
        ServiceTimerFired(2);
        break;
    case 3:
        ServiceTimerFired(3);
        break;
    case 4:
        ServiceTimerFired(4);
        break;
    case 5:
        ServiceTimerFired(5);
        break;
    case 6:
        ServiceTimerFired(6);
        break;
    case 7:
        ServiceTimerFired(7);
        break;
    case 9:

#ifdef PLATFORM_CPU_MEASURE
        
		cpucounter_history[loop++] = cpucounter; 
		cpucounter = 0; 
		if (loop == 20)
		loop = 0; 
             
        
#endif


        break;
#if defined(PLATFORM_AVR) && defined(RADIO_CC2420)
    case 10:
        hplcc2420interruptm_FIFOTimer_fired();
        break;
    case 11:
        hplcc2420interruptm_CCATimer_fired();
        break;
#endif
   case 12:
        #ifdef ENERGY_SHARE_SCHEDULING
        
         {energy_manager_increase_round();   
		  postTask(thread_task, 9);  
           
         }  
        #endif 		
			
		
	   break;  	  
    
	case 13:
        #ifdef TRACE_MEMORY_CONTENTS
          memoryReportTimerFired();
        #endif 
		
	    break; 
		
	case 14:
	    #ifdef TRACE_ENABLE
		 reportTrace();
		#endif 
		
		#ifdef BASE_MODE		
		restoreRadioState();
		#endif
	    
		break; 
		
	case 15:
	
		
		break; 	
		
	case 16:
	    
		#ifdef TRACE_MEMORY_CONTENTS
		  AMStandard_releaseLock();
		  lib_radio_set_channel(21); 
		 #endif 
		break;
		
		
    default:
        timercallbackinvoke(id);
        result = SUCCESS;
    }
    return SUCCESS;
}