Exemplo n.º 1
0
void rt_hw_board_init(void)
{
    sysctl_pll_set_freq(SYSCTL_PLL0, 800000000UL);
    sysctl_pll_set_freq(SYSCTL_PLL1, 400000000UL);
    /* Init FPIOA */
    fpioa_init();
    /* Dmac init */
    dmac_init();

    /* initalize interrupt */
    rt_hw_interrupt_init();
    /* initialize hardware interrupt */
    rt_hw_uart_init();

    rt_hw_tick_init();

#ifdef RT_USING_SMP
    rt_hw_clint_ipi_enable();
#endif

#ifdef RT_USING_CONSOLE
    /* set console device */
    rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif /* RT_USING_CONSOLE */

#ifdef RT_USING_HEAP
    rt_kprintf("heap: [0x%08x - 0x%08x]\n", (rt_ubase_t) RT_HW_HEAP_BEGIN, (rt_ubase_t) RT_HW_HEAP_END);
    /* initialize memory system */
    rt_system_heap_init(RT_HW_HEAP_BEGIN, RT_HW_HEAP_END);
#endif

#ifdef RT_USING_COMPONENTS_INIT
    rt_components_board_init();
#endif
}
Exemplo n.º 2
0
void init_thread(void* parameter)
{
    rt_thread_t tid;

    rt_system_comonent_init();
    rt_hw_uart_init("uart0", 0);
    rt_console_set_device("uart0");
    rt_hw_sd_init("sd0");
    rt_hw_rtc_init();
    rt_hw_spi_init();
    rt_hw_pin_init("gpio");
    rt_hw_i2c_bit_ops_bus_init("i2c0");
    at24cxx_init("at24c02", "i2c0");
    rt_hw_ads7843_init("ads7843", "spi20");
    w25qxx_init("sf0", "spi21");
    rt_hw_lcd_init("lcd0");
    
    finsh_system_init();
 //   tid = rt_thread_create("usb", usb_thread_entry, RT_NULL, 1024, 9, 20);
   // rt_thread_startup(tid);
    
    if((*(uint32_t*)0x60000) != 0xFFFFFFFF)
    {
        tid = rt_thread_create("init", (void*)(0x60000), RT_NULL, 1024, 8, 20);
        rt_thread_startup(tid);
    }
    else
    {
        printf("addr:0x%X has no application\r\n", 0x60000);
    }
    rt_hw_enet_phy_init();

    tid = rt_thread_self();
    rt_thread_delete(tid); 
}
Exemplo n.º 3
0
/**
 * This function will initial M487 board.
 */
void rt_hw_board_init(void)
{
    clock_init();

#ifdef RT_USING_HEAP
#ifdef __CC_ARM
    rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)SRAM_END);
#elif __ICCARM__
    rt_system_heap_init(__segment_end("HEAP"), (void*)SRAM_END);
#else
    /* init memory system */
    rt_system_heap_init((void*)&__bss_end, (void*)&__ram_top);
#endif
#endif /* RT_USING_HEAP */

    rt_hw_uart_init();

#ifdef RT_USING_CONSOLE
    rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif

    SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
	
	NVIC_SetPriorityGrouping(7);
	
#ifdef RT_USING_COMPONENTS_INIT
    rt_components_board_init();
#endif
}
Exemplo n.º 4
0
void init_thread(void* parameter)
{
	eth_system_device_init();
	lwip_system_init();
    
    dfs_init();
    elm_init();
    
    rt_hw_uart_init("uart0", 0);
    rt_console_set_device("uart0");
    rt_kprintf("rt-thread system start!\r\n");
    
    finsh_system_init();
    
    rt_hw_dflash_init("dflash0");
    dfs_mount("dflash0", "/", "elm", 0, 0);
    rt_hw_enet_phy_init();
    
    rt_kprintf("waitting for connection...");
    
    /* tcp server demo */
    extern void tcpserv(void* parameter);
    tcpserv(RT_NULL);
    
}
Exemplo n.º 5
0
/**
 * This function will initial LPC17xx board.
 */
void rt_hw_board_init()
{
    /* NVIC Configuration */
#define NVIC_VTOR_MASK              0x3FFFFF80
#ifdef  VECT_TAB_RAM
    /* Set the Vector Table base location at 0x10000000 */
    SCB->VTOR  = (0x10000000 & NVIC_VTOR_MASK);
#else  /* VECT_TAB_FLASH  */
    /* Set the Vector Table base location at 0x00000000 */
    SCB->VTOR  = (0x00000000 & NVIC_VTOR_MASK);
#endif

    /* init systick */
    SysTick_Config( SystemCoreClock/RT_TICK_PER_SECOND - 1);
    /* set pend exception priority */
    NVIC_SetPriority(PendSV_IRQn, (1<<__NVIC_PRIO_BITS) - 1);

    rt_hw_uart_init();
    rt_console_set_device(RT_CONSOLE_DEVICE_NAME);

#if LPC_EXT_SDRAM == 1
    {
        SDRAM_Init();
    }
#endif
}
Exemplo n.º 6
0
int main(void)
{
	unsigned int SystemCoreClock = 48000000UL;
	
	// Set system frequency to 48MHz
	SystemFrequency = ConfigurePLL(12000000UL, SystemCoreClock);
		
	// Enable clock to IO Configuration block.  Needed for UART, SPI, I2C, etc...
	SYSCON_SYSAHBCLKCTRL_IOCON(SYSAHBCLKCTRL_ENABLE);

	rt_hw_uart_init();
	rt_uart_init();
	rt_uart_open();
	
	char buffer[256];
	char str[] = "hi.\r\n";
	rt_uart_write(str, 5);
	
	while (1)
	{
		// echo back what was read
		int sz = rt_uart_read(buffer, 256);
		rt_uart_write(buffer, sz);
	}
}
Exemplo n.º 7
0
/**
 * This function will initial LPC17xx board.
 */
void rt_hw_board_init()
{
    /* NVIC Configuration */
#define NVIC_VTOR_MASK              0x3FFFFF80
#ifdef  VECT_TAB_RAM
    /* Set the Vector Table base location at 0x10000000 */
    SCB->VTOR  = (0x10000000 & NVIC_VTOR_MASK);
#else  /* VECT_TAB_FLASH  */
    /* Set the Vector Table base location at 0x00000000 */
    SCB->VTOR  = (0x00000000 & NVIC_VTOR_MASK);
#endif

    /* init systick */
    SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND - 1);
    /* set pend exception priority */
    NVIC_SetPriority(PendSV_IRQn, (1 << __NVIC_PRIO_BITS) - 1);

    /*init uart device*/
    rt_hw_uart_init();
    rt_console_set_device(RT_CONSOLE_DEVICE_NAME);

#if LPC_EXT_SDRAM == 1
    lpc_sdram_hw_init();
    mpu_init();
#endif

#ifdef RT_USING_COMPONENTS_INIT
    /* initialization board with RT-Thread Components */
    rt_components_board_init();
#endif
}
Exemplo n.º 8
0
void rt_hw_board_init()
{
    emsk_mux_init();

    rt_hw_uart_init();
    rt_components_board_init();
    rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
}
Exemplo n.º 9
0
void rt_hw_board_init(void)
{
#ifdef RT_USING_UART0
    rt_hw_uart_init();
    rt_console_set_device("uart0");
#endif

    rt_kprintf("\r\n\r\nSystemInit......\r\n");
}
Exemplo n.º 10
0
/**
 * This function will initial Tower board.
 */
void rt_hw_board_init()
{
    /* NVIC Configuration */
    NVIC_Configuration();

    /* Configure the SysTick */
    SysTick_Configuration();

    rt_hw_uart_init();

#ifdef RT_USING_CONSOLE
    rt_console_set_device(CONSOLE_DEVICE);
#endif
}
Exemplo n.º 11
0
/**
 * This function will init at91sam9260 board
 */
void rt_hw_board_init()
{
	/* initialize the system clock */
	rt_hw_clock_init();

	/* initialize uart */
	rt_hw_uart_init();

	/* initialize mmu */
	//rt_hw_mmu_init();

	/* initialize timer0 */
	rt_hw_timer_init();

}
Exemplo n.º 12
0
/**
 * This function will initial sam7s64 board.
 */
void rt_hw_board_init()
{
#ifdef RT_USING_UART
	/* init hardware UART device */
	rt_hw_uart_init();
#endif

#ifdef RT_USING_CONSOLE
	/* set console device */
	rt_console_set_device("uart");
#endif

	/* init operating system timer */
	rt_hw_timer_init();

	rt_kprintf("current sr: 0x%08x\n", read_c0_status());
}
Exemplo n.º 13
0
/**
 * This function will initial LPC15xx board.
 */
void rt_hw_board_init()
{

    /* init systick */
    SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
    /* set pend exception priority */
    NVIC_SetPriority(PendSV_IRQn, (1 << __NVIC_PRIO_BITS) - 1);

    /*init uart device*/
    rt_hw_uart_init();
    rt_console_set_device(RT_CONSOLE_DEVICE_NAME);

#ifdef RT_USING_COMPONENTS_INIT
    /* initialization board with RT-Thread Components */
    rt_components_board_init();
#endif
}
Exemplo n.º 14
0
/**
 * This function will initial board.
 */
void rt_hw_board_init(void)
{
    extern uint32_t SystemCoreClock;
    SysTick_Config(SystemCoreClock/RT_TICK_PER_SECOND);

#ifdef RT_USING_HEAP
        rt_system_heap_init((void*)HEAP_BEGIN, (void*)HEAP_END);
#endif
    
#ifdef RT_USING_COMPONENTS_INIT
    rt_components_board_init();
#endif
    
#ifdef RT_USING_CONSOLE
    rt_hw_uart_init();
    rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
}
Exemplo n.º 15
0
/**
 * This function will initial sam7s64 board.
 */
void rt_hw_board_init()
{
	SystemInit();

	/* init systick */
	SysTick_Config(SystemCoreClock);

	/* set pend exception priority */
	NVIC_SetPriority(PendSV_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
	
#ifdef RT_USING_UART
	/* init hardware UART device */
	rt_hw_uart_init();
#endif
#ifdef RT_USING_CONSOLE
	/* set console device */
	rt_console_set_device("uart");
#endif
}
Exemplo n.º 16
0
/**
 * This function will init dm365 board
 */
void rt_hw_board_init()
{
	psc_change_state(DAVINCI_DM365_LPSC_TIMER0, 3);
	psc_change_state(DAVINCI_DM365_LPSC_TIMER1, 3);
	/* initialize the system clock */
	//rt_hw_clock_init();
	davinci_clk_init();

	/* initialize uart */
	rt_hw_uart_init();
#ifdef RT_USING_CONSOLE
	rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif

	/* initialize mmu */
	rt_hw_mmu_init(dm365_mem_desc, sizeof(dm365_mem_desc)/sizeof(dm365_mem_desc[0]));

	/* initialize timer0 */
	rt_hw_timer_init();

}
Exemplo n.º 17
0
/**
 * This function will initial LPC40xx board.
 */
void rt_hw_board_init()
{
  MAP_IntMasterDisable();
    IntRegister(FAULT_HARD, HardFault_Handler);	
    IntRegister(FAULT_PENDSV, PendSV_Handler);
    IntRegister(FAULT_SYSTICK, SysTick_Handler);
    
	  //
    // Enable lazy stacking for interrupt handlers.  This allows floating-point
    // instructions to be used within interrupt handlers, but at the expense of
    // extra stack usage.
    //
    MAP_FPULazyStackingEnable();

    //
    // Set the clocking to run directly from the external crystal/oscillator.
    // TODO: The SYSCTL_XTAL_ value must be changed to match the value of the
    // crystal on your board.
    //
    SysClock = MAP_SysCtlClockFreqSet(
                (SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480),
                SYS_CLOCK_DEFAULT);

    MAP_SysTickDisable();
    MAP_SysTickPeriodSet(SysClock/ RT_TICK_PER_SECOND - 1);
    MAP_SysTickIntEnable();
    MAP_SysTickEnable();	

    /* set pend exception priority */
    //IntPrioritySet(FAULT_PENDSV, (1 << 5) - 1);
    
    /*init uart device*/		
    rt_hw_uart_init();
    //redirect RTT stdio to CONSOLE device
    rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
    //
    // Enable interrupts to the processor.
    //
	  MAP_IntMasterEnable();
}
Exemplo n.º 18
0
void rt_hw_board_init(void)
{
    rt_hw_cache_init();
    /* init hardware interrupt */
    rt_hw_interrupt_init();
    rt_hw_uart_init();
#ifdef RT_USING_CONSOLE
    /* set console device */
    rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif /* RT_USING_CONSOLE */

#ifdef RT_USING_HEAP
    /* init memory system */
    rt_system_heap_init(RT_HW_HEAP_BEGIN, RT_HW_HEAP_END);
#endif

#ifdef RT_USING_COMPONENTS_INIT
    rt_components_board_init();
#endif

    rt_hw_ost_init();
}