static void print_boot_info(void)
{
    if (LPC_SC->RSID & boot_power_on) {
        uart0_puts("System Power-on: Booting ...");
        g_sys_boot_type = boot_power_on;
        LPC_SC->RSID |= boot_power_on; // Clear POR bit
    }
    else if(LPC_SC->RSID & boot_reset) {
        uart0_puts("System Reset: Booting ...");
        g_sys_boot_type = boot_reset;
        LPC_SC->RSID |= boot_reset; // Clear RESET bit
    }
    else if(LPC_SC->RSID & boot_watchdog) {
        if(FAULT_PRESENT_VAL == FAULT_EXISTS) {
            g_sys_boot_type = boot_watchdog_recover;
            uart0_puts("System Crash: Re-booting ...");
        }
        else {
            g_sys_boot_type = boot_watchdog;
            uart0_puts("Watchdog System Reset: Booting ...");
            LPC_SC->RSID |= boot_watchdog; // Clear WDTR bit
        }
        FAULT_EXISTS = 0;
    }
    else {
        g_sys_boot_type = boot_unknown;
    }
}
Exemple #2
0
void main(void){
    uart0_init();
    led_init();
    nand_init();
    irq_init();

    int i = 0;
    for(i = 0;i < 10;i++){
        uart0_puts("\nShell #");
        uart0_gets(buf,MAX_LEN);

        const cmd_t *ptr;
        ptr = find_cmd(buf);
        if(ptr != 0){
            ptr->call_back();
        }else{
            uart0_puts("\nNot find Cmd");
        }

        /*if(!my_strcmp(buf,"ledon")){
            uart0_puts(buf);
            led_on();
            continue;
        }else if(!my_strcmp(buf,"ledoff")){
            uart0_puts(buf);
            led_off();
            continue;
        }else{
            uart0_puts("\nNot command!!!");
            continue;
        }*/
    }
}
void orientProducer(void* p)
{
    orientation_t orient = invalid;
    Acceleration_Sensor& accel = Acceleration_Sensor::getInstance();
    accel.init();
    int16_t xAccel = 0;
    int16_t yAccel = 0;
    int16_t zAccel = 0;

    uint8_t cheatCode = 0;
    while(1)
    {
        xAccel = accel.getX();
        yAccel = accel.getY();
        zAccel = accel.getZ();

        orient = calcOrient(xAccel, yAccel, zAccel);

        cheatCode = LOL(orient, cheatCode);
        if(cheatCode == 5)
        {
            cheatCode = 0;
            dancingLights(); //in another file
        }

        uart0_puts("Sending");
        xQueueSend(q, &orient, portMAX_DELAY);
        uart0_puts("Sent");
        vTaskDelay(1000);
    }
}
static void print_boot_info(void)
{
    if (LPC_SC->RSID & 1) {
        uart0_puts("System Power-on: Booting ...");
        m_sys_boot_type = SysBootType_power_on;
        LPC_SC->RSID |= 1; // Clear POR bit
    }
    else if(LPC_SC->RSID & 2) {
        uart0_puts("System Reset: Booting ...");
        m_sys_boot_type = SysBootType_reset;
        LPC_SC->RSID |= 2; // Clear RESET bit
    }
    else if(LPC_SC->RSID & 4) {
        if(FAULT_EXISTS == 0xDEADBEEF) {
            m_sys_boot_type = SysBootType_watchdog_recover;
            uart0_puts("System Crash: Re-booting ...");
        }
        else {
            m_sys_boot_type = SysBootType_watchdog;
            uart0_puts("Watchdog System Reset: Booting ...");
            LPC_SC->RSID |= 4; // Clear WDTR bit
        }
        FAULT_EXISTS = 0;
    }
    else {
        m_sys_boot_type = SysBootType_unknown;
    }
}
Exemple #5
0
void cmd_boot_linux(void){
    //1.从nand flash 0x600000读取内核到内存0x20008000,读取大小0xC00000
    //特殊情况:板子的nand flash有坏块
    //nand_page_read(test_buf,0);
    uart0_puts("\nloading kernel...");
    unsigned int *ptr = (unsigned int *)0x20008000;
    unsigned int page = 0x600000/NF_PAGE_SIZE;
    int i ;
    for(i = 0;i < 6000;i++){
        uart0_putc('.');
        uart0_puts("^_^");
        nand_page_read(ptr,page);
        ptr += NF_PAGE_SIZE/4;//偏移NF_PAGE_SIZE
        page++;//加1页
    }
    uart0_puts("\nrun linux ...");
    //2.调用0x20008000处的程序(函数指针)
    func_t  kernel_start;
    kernel_start = (func_t)0x20008000;
    kernel_start(0,2456,0);
    //第一个参数0,内核已经不使用了
    //第二个参数,当编译内核时为开发板指定的一个号,
    //内核启动时会判断引导程序传给内核的参数和编译内核时指定的值是否一样;
    //如果一样内核继续执行,如果不一样,内核停止执行;
    //第三个参数,引导程序和内核传递参数 的 内存地址;内核根据给定地址找参数;该内存地址是引导和内核共享的内存;
    //给0是因为Image是使用默认参数的,不需要引导程序传递;
    //uart0_puts("\nkernel run end");
}
Exemple #6
0
void c_irq_handler(void)
{
    uart0_puts("\n c_irq_handler \n");
    irq_func_t func;
    func = (irq_func_t)VIC0ADDRESS ;
    if(func){
        uart0_puts("\nbegin func\n");
        func();
    }
    VIC0ADDRESS = 0;
}
Exemple #7
0
bool Bluetooth::run(void *p)
{
    char buff[64] ={"AT+BAUD"};
    char data[] = {0};
    uart0_puts("Running..");

    ble->putline(buff);
    vTaskDelay(100);
    ble->gets(data,sizeof(data));
    uart0_puts(data);

    return true;
}
Exemple #8
0
void cmd_nread(void){
    char itoa_buf[16];
    uart0_puts("\nnand read ...");
    nand_page_read(test_buf,0);
    uart0_puts("\ndata:");
    int i = 0;
    for(i = 0 ;i < 64 ; i++){
        if(!(i%4)){
            uart0_puts("\n");
        }
        itoa(itoa_buf,test_buf[i]);
        uart0_puts(itoa_buf);
        uart0_puts(" ");
    }
}
Exemple #9
0
void exint1_func(void)
{
    uart0_puts("\nexint1_func \n");
    led_off();
    EXINT0PEND |= 2;

}
void wlan_puts(const char *s )
{
	#if defined( WLAN_UART_NR )	// WLAN_UART_NR = 1
		uart1_puts(s);
	#else // WLAN_UART_NR = 0
		uart0_puts(s);
	#endif	// WLAN_UART_NR
}
Exemple #11
0
void c_swi_handler(unsigned int num, int *param)
{
    uart0_puts("\n c_swi_handler \n");
    switch (num)
    {
        case 1:
            uart0_puts("\n c_swi_handler 1 \n");
            break;
        case 2:
            uart0_puts("\n c_swi_handler 2 \n");
            break;
        default:
            uart0_puts("\nnum error!!!");
            break;
    }

}
Exemple #12
0
void c_dabt_handler(void)
{
    uart0_puts("\nc_dabt_handler\n");
    while(1)
    {
        ;
    }
}
Exemple #13
0
void c_swi_handler(unsigned int num, int *param)
{
    uart0_puts("\n c_swi_handler \n");
    switch(num){
        case 1:
            uart0_puts("\n ledon");
            led_on();
            break;
        case 2:
            uart0_puts("\n ledoff");
            led_off();
            break;
        default:
            uart0_puts("\n num error");
            break;
    }
    return ;
}
void orientConsumer(void* p)
{
    orientation_t orientGet = invalid;

    while(1)
    {
        xQueueReceive(q, &orientGet, portMAX_DELAY);
        uart0_puts(printOrient(orientGet));
    }
}
Exemple #15
0
int main(void)
{
	char *s = "Bonjour tout le monde!";
	
	uart0_init();
	
	uart0_puts(s);
	
	return 0;
}
void beggingForSemaphore(void* p)
{
    SoftTimer myTimer(50);
    while(1)
    {
        if(xSemaphoreTake(buttonSemaphore, portMAX_DELAY))
        {
            uart0_puts("TASK HAS SEMAPHORE!");
            xSemaphoreGive(buttonSemaphore);
            myTimer.reset();
            while(!myTimer.expired())
            {

            }
        }
    }
}
Exemple #17
0
void c_fiq_handler(void)
{
    uart0_puts("\n c_fiq_handler \n");
}
Exemple #18
0
void exint0_func(void)
{   
    uart0_puts("\n exint0_func \n");
    led_on();
    EXINT0PEND |= 1;
}
Exemple #19
0
void exint1_func(void)
{
    uart0_puts("\nexint1_func \n");

}
Exemple #20
0
int fw_puts(char *astring, int length)
{
    return uart0_puts(astring, length);
}