Exemplo n.º 1
0
int main() {

    SystemInit();
    SER_Init() ;
#if !defined(NO_FILESYSTEM)
    init_card () ;                                    /* initializing SD card */
#endif

    init_time() ;


#if defined(DEBUG_CYASSL)
    printf("Turning ON Debug message\n") ;
    CyaSSL_Debugging_ON() ;
#endif

#ifdef   HAVE_KEIL_RTX
    os_sys_init (main_task) ;
#else
    main_task() ;
#endif

    return 0 ; /* There should be no return here */

}
Exemplo n.º 2
0
int
main(int argc, char *argv[])
{
    /* Initialize board-specific hardware */
    BSP_Init();
    led1_off();
    led2_off();

#if 1
    /* Initialize TimerA and oscillator */
    BCSCTL3 |= LFXT1S_2;                      // LFXT1 = VLO
    TACCTL0 = CCIE;                           // TACCR0 interrupt enabled
    TACCR0 = 12000;                           // ~1 second
    TACTL = TASSEL_1 + MC_1;                  // ACLK, upmode
#endif

    while (1)
    {
        main_init();

        while (1)
        {
            main_task();
        }
    }

    return 0;
}
Exemplo n.º 3
0
int main(void)
{
	Disp_Init(DISP_INIT_ON);		//初始化 LCD
	Disp_Clear();				
	
	KEY_Init(KEY_BEEP_KEY|KEY_AUTO_EL_ON);	//初始化 Keyborad
	KEY_Beep_Mask_Set(0xffffffff);			
	KEY_EL_Mask_Set(0xffffffff);
	EL_Set_Timeout(20);			//定时关闭背光灯
	Sys_Auto_Poweroff_Set(60*2);		//定时待机
	
	//Meanless for 0218/0318/0518
	Disp_Icon_Battery_Time_Set(1,ICON_AT_TAIL);
	Disp_Icon_Battery_Time_Refresh();
	Disp_Set_Color(SET_FONT_COLOR, 0x0000);		//黑
	Disp_Set_Color(SET_BACK_COLOR, 0xFFFF);		//白
	Disp_Set_Color(SET_SELECT_COLOR, 0x07E0);	//绿
	Disp_Set_Color(SET_CLEAR_COLOR, 0xFFFF);	//白

	adminPsd_init();	//一次性初始化,数据初置
	db_check();	//数据库检查
	//wifiInit_open();	//wifi初始化
	main_task();
	return 0;
}
Exemplo n.º 4
0
CCL_NAMESPACE_BEGIN

static void shade_background_pixels(Device *device, DeviceScene *dscene, int res, vector<float3>& pixels, Progress& progress)
{
	/* create input */
	int width = res;
	int height = res;

	device_vector<uint4> d_input;
	device_vector<float4> d_output;

	uint4 *d_input_data = d_input.resize(width*height);

	for(int y = 0; y < height; y++) {
		for(int x = 0; x < width; x++) {
			float u = x/(float)width;
			float v = y/(float)height;

			uint4 in = make_uint4(__float_as_int(u), __float_as_int(v), 0, 0);
			d_input_data[x + y*width] = in;
		}
	}

	/* compute on device */
	d_output.resize(width*height);
	memset((void*)d_output.data_pointer, 0, d_output.memory_size());

	device->const_copy_to("__data", &dscene->data, sizeof(dscene->data));

	device->mem_alloc(d_input, MEM_READ_ONLY);
	device->mem_copy_to(d_input);
	device->mem_alloc(d_output, MEM_WRITE_ONLY);

	DeviceTask main_task(DeviceTask::SHADER);
	main_task.shader_input = d_input.device_pointer;
	main_task.shader_output = d_output.device_pointer;
	main_task.shader_eval_type = SHADER_EVAL_BACKGROUND;
	main_task.shader_x = 0;
	main_task.shader_w = width*height;
	main_task.num_samples = 1;
	main_task.get_cancel = function_bind(&Progress::get_cancel, &progress);

	/* disabled splitting for now, there's an issue with multi-GPU mem_copy_from */
	list<DeviceTask> split_tasks;
	main_task.split(split_tasks, 1, 128*128);

	foreach(DeviceTask& task, split_tasks) {
		device->task_add(task);
		device->task_wait();
		device->mem_copy_from(d_output, task.shader_x, 1, task.shader_w, sizeof(float4));
	}
Exemplo n.º 5
0
/*FUNCTION**********************************************************************
 *
 * Function Name : startup_task
 * Description   : Wrapper over main_task..
 *
 *END**************************************************************************/
void startup_task(void* argument)
{
    main_task(argument);
    while(1);
}
Exemplo n.º 6
0
int main()
{
   // Initialize the LIN interface
    if (l_sys_init())
        return -1;

    // Initialize the interface
    if (l_ifc_init_UART1())
        return -1;

    // Set UART TX to interrupt level 5
    // Set UART RX to interrupt level 5
    struct l_irqmask irqmask = { 6, 6 };
    l_sys_irq_restore(irqmask);
    
    l_bool configuration_ok = false;
    l_u16 configuration_timeout = 1000;
    do {
        if (l_ifc_read_status_UART1() & (1 << 6)) {
            configuration_ok = true;
            break;
        }
        __delay_ms(5);
        configuration_timeout--;
    } while (configuration_timeout || !configuration_ok);
    
    if (!configuration_ok) {
        // Master did not configure this node.
        return -1;
    }
    
    TRISBbits.TRISB8 = 1;
    __builtin_write_OSCCONL(OSCCON & ~(1<<6));
    RPINR7bits.IC1R = 8;
    __builtin_write_OSCCONL(OSCCON | (1<<6));
    
     // Setup a 125ms timer
    T1CONbits.TON = 1;
    T1CONbits.TSIDL = 0;
    T1CONbits.TGATE = 0;
    T1CONbits.TCKPS = 2;
    T1CONbits.TSYNC = 0;
    T1CONbits.TCS = 0;
    PR1 = FCY / 64ul / 8ul;
    
    IEC0bits.T1IE = 1;
    IPC0bits.T1IP = 4;
    
    IC1CON2bits.SYNCSEL = 0b10100;
    IC1CON1bits.ICTSEL  = 0b111;
    IC1CON1bits.ICI     = 0x00;
    IC1CON2bits.ICTRIG  = 0x00;
    IC1CON1bits.ICM     = 0x03;
    IEC0bits.IC1IE = 1;
    IPC0bits.IC1IP = 3;
    
    while (1) {
        main_task();
    }

    return -1;
}