Esempio n. 1
0
void LOGIC_Run(void) {
  TMR_Init();
  InitDMA();
  //TransferDMA();
  for (;;) {
    //WAIT1_Waitms(100);
    Run();
  }
}
Esempio n. 2
0
int main(void)
{
    char arg[50];
    char tstr[200];
    int ret;
    
    TMR_Init();
    gettimeofday(&nowtime, NULL);
    hdl[0] = TMR_SetTimer(100, 1, pfnCallback1, NULL );
    //printf("hdl[0]=%d\n", hdl[0]);
    hdl[1] = TMR_SetTimer(100, 1, pfnCallback2,  NULL);
    // printf("hdl[1]=%d\n", hdl[1]);
    hdl[2] = TMR_SetTimer(100, 1, pfnCallback2, NULL );
    // printf("hdl[2]=%d\n", hdl[2]);
    // hdl[3] = TMR_SetTimer(10, pfnCallback1, NULL, );
    // hdl[4] = TMR_SetTimer(10, pfnCallback1, NULL,);
    // hdl[5] = TMR_SetTimer(10, pfnCallback1, NULL,);
    // hdl[6] = TMR_SetTimer(10, pfnCallback1, NULL,);
    // hdl[7] = TMR_SetTimer(10, pfnCallback1, NULL, 0);
    // hdl[8] = TMR_SetTimer(10, pfnCallback1, NULL, 0);
    // hdl[9] = TMR_SetTimer(10, pfnCallback1, NULL, 0);
    // hdl[10] = TMR_SetTimer(10, pfnCallback1, NULL, 0);
    // hdl[11] = TMR_SetTimer(10, pfnCallback1, NULL, 0);
    // hdl[12] = TMR_SetTimer(10, pfnCallback1, NULL, 0);
    // hdl[13] = TMR_SetTimer(10, pfnCallback1, NULL, 0);
    while(1)
    {
        if (call_cnt[1] >= 50)
        {               
            //TMR_PauseTimer(hdl[0]);
            //TMR_CancleTimer(hdl[0]);
            TMR_Shutdown();
            printf("p1 count :  %d\n", call_cnt[1]);
            printf("p2 count :  %d\n", call_cnt[2]);
            break;
        }
        if(call_cnt[0] >= 200)
        {
            // get_format_time(tstr);
            // ret = TMR_Shutdown();
            // printf("main: %s TMR_Shutdown, ret=%d\n", tstr, ret);
            // call_cnt++;
            printf("p1 count :  %d\n", call_cnt[1]);
            printf("p2 count :  %d\n", call_cnt[2]);
            break;
        }

    }
    uint32_t errornum = TMR_ReturnErrorNum();
    printf("%d, %ld\n", call_cnt[0], errornum, (float)errornum / call_cnt[0] *100);
    
    return 0;
}
Esempio n. 3
0
void Main(void)
 {
  InterruptInit();
  IntDisableAll();
  Platform_Init();
  

  TS_Init();                            /* Init the kernel. */
  TMR_Init();                           /* Init the TMR module */							
  NvModuleInit();
  Uart_ModuleInit();
  /* This only creates the MAC TS thread. */
  MacInit();
  /* Use TS for MAC  - the MAC TS ID must be known at this step. */
  Init_802_15_4(TRUE);

  #if gZtcIncluded_d
  Ztc_TaskInit();
  #endif /* gZtcIncluded_d */ 

  /*initialize the application*/ 
  gAppTaskID_c = TS_CreateTask(gTsAppTaskPriority_c, AppTask);
 
  MApp_init();
  #if (gLpmIncluded_d == 1)
    /*do not allow the device to enter sleep mode*/
    PWR_DisallowDeviceToSleep();
  #endif /* gLpmIncluded_d == 1 */
 
  /*All LED's are switched OFF*/
  Led1Off();
  Led2Off();
  Led3Off();
  Led4Off();
  
  /* Start the task scheduler. Does not return. */
  TS_Scheduler(); 
 
}
Esempio n. 4
0
void InitDevice(void)
{
    IntDisableAll();
    WDT_INIT();
    Digitals_Init();  
    ItcInit();
    NVM_FlashInit();
    CRM_Init();  
    TMR_Init();
    ASM_Init();
    UART1_Init();
    UART2_Init();
    SPI_Init();
    MACA_Init(); 
    
///    DMAP_ResetStack(0);
  // WirelessHART Stack Initialisation
    NVM_ReadRecords(); // persistent data reading
    APP_Init();
    DLL_Init();   // reset the modem inside
    TL_Init();
    NET_Init();
    HART_DLL_Init(HART_ROLE_DECIDED);
  
  #if ( SHT1X_MODE != 0 )
    SHT1x_INIT();
  #endif
 
  #if ( (BOARD_TYPE == BOARD_TYPE_HART_DEV_KIT) )
    #if (!defined (IS_VN220))
      ADC_Extern_Init();
    #endif
  #endif
    
    IntEnableAll(); 
}    
Esempio n. 5
0
void PL_Init(void) {
#if PL_CONFIG_HAS_LED
    LED_Init();
#endif
#if PL_CONFIG_HAS_EVENTS
    EVNT_Init();
#endif
#if PL_CONFIG_HAS_TIMER
    TMR_Init();
#endif
#if PL_CONFIG_HAS_TRIGGER
    TRG_Init();
#endif
#if PL_CONFIG_HAS_BUZZER
    BUZ_Init();
#endif
#if PL_CONFIG_HAS_RTOS
    RTOS_Init();
#endif
#if PL_CONFIG_HAS_SHELL
    SHELL_Init();
#endif
#if PL_CONFIG_HAS_SHELL_QUEUE
    SQUEUE_Init();
#endif
#if PL_CONFIG_HAS_MOTOR
    MOT_Init();
#endif
#if PL_CONFIG_HAS_LINE_SENSOR
    REF_Init();
#endif
#if PL_CONFIG_HAS_MOTOR_TACHO
    TACHO_Init();
#endif
#if PL_CONFIG_HAS_MCP4728
    MCP4728_Init();
#endif
#if PL_CONFIG_HAS_ULTRASONIC
    US_Init();
#endif
#if PL_CONFIG_HAS_PID
    PID_Init();
#endif
#if PL_CONFIG_HAS_DRIVE
    DRV_Init();
#endif
#if PL_CONFIG_HAS_TURN
    TURN_Init();
#endif
#if PL_CONFIG_HAS_LINE_FOLLOW
    LF_Init();
#endif
#if PL_CONFIG_HAS_RADIO
    RNETA_Init();
#endif
#if PL_CONFIG_HAS_REMOTE
    REMOTE_Init();
#endif
#if PL_CONFIG_HAS_IDENTIFY
    ID_Init();
#endif
#if PL_CONFIG_HAS_LINE_MAZE
    MAZE_Init();
#endif
}
Esempio n. 6
0
///////////////////////////////////////////////////////////////////////////////////
// Name: MAIN Function
///////////////////////////////////////////////////////////////////////////////////
  void main(void)
  {
    IntDisableAll();
  
    WDT_INIT();  
             
    Digitals_Init();
   
    ItcInit();
    
    NVM_FlashInit();
    
    CRM_Init();  
        
    TMR_Init();
    ASM_Init();
    UART1_Init();
    UART2_Init();
    SPI_Init();
    
    PROVISION_Init();
        
    MACA_Init(); 
    
    DAQ_Init();
        
    DMAP_ResetStack(0);
    
    IntEnableAll();
    
    //--------------------------------------------------------------------
    // Main Loop
    //--------------------------------------------------------------------
    for (;;)
    {           
        NLDE_Task();        // as fast as possible, keep this task first on loop
  
        DMAP_Task();        //
        ASLDE_ASLTask();    //
 
        UART_LINK_Task();   //
        UART2_CommControl();
        
        DAQ_RxHandler();
        
        if( g_uc250msFlag ) // 250ms Tasks
        {
            g_uc250msFlag = 0;
            
            // Handle DAQ after all other stack related tasks.
            DAQ_TxHandler();            
            UAP_MainTask();     
            
            ARMO_Task();
            
            if( !g_stTAI.m_uc250msStep ) // first 250ms slot from each second -> 1sec Tasks
            {
                ASLDE_PerformOneSecondOperations();
                DMAP_DMO_CheckNewDevInfoTTL();
    
                DMAP_CheckSecondCounter();
                
                ARMO_OneSecondTask();
    
                SLME_KeyUpdateTask();
                
                DMO_PerformOneSecondTasks();  
                
                MACA_WachDog();
            }
        }

        FEED_WDT();
    }
  }