/** * 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 }
/** This function will initial STM32 board**/ void rt_hw_board_init() { BSP_Init(); //add for finsh rt_hw_usart_init(); rt_console_set_device(RT_CONSOLE_DEVICE_NAME); }
/** * This function will initial board. */ void rt_hw_board_init() { // Configure the device for maximum performance, but do not change the PBDIV clock divisor. // Given the options, this function will change the program Flash wait states, // RAM wait state and enable prefetch cache, but will not change the PBDIV. // The PBDIV value is already set via the pragma FPBDIV option above. SYSTEMConfig(SYS_FREQ, SYS_CFG_WAIT_STATES | SYS_CFG_PCACHE); /* use DBPRINTF */ /* rt_hw_console_init(); */ rt_hw_usart_init(); rt_console_set_device("uart1"); rt_hw_show_info(); // enable multi-vector interrupts INTEnableSystemMultiVectoredInt(); rt_hw_interrupt_disable(); // // STEP 2. configure the core timer // OpenCoreTimer(CORE_TICK_RATE); // // // set up the core timer interrupt with a prioirty of 2 and zero sub-priority // mConfigIntCoreTimer((CT_INT_ON | CT_INT_PRIOR_2 | CT_INT_SUB_PRIOR_0)); // STEP 2. configure Timer 1 using internal clock, 1:256 prescale OpenTimer1(T1_ON | T1_SOURCE_INT | T1_PS_1_256, T1_TICK); // set up the timer interrupt with a priority of 2 ConfigIntTimer1(T1_INT_ON | T1_INT_PRIOR_2); /* Setup the software interrupt. */ mConfigIntCoreSW0( CSW_INT_ON | CSW_INT_PRIOR_1 | CSW_INT_SUB_PRIOR_0 ); }
/** * This function will initial STM32 board. */ void rt_hw_board_init(void) { /* NVIC Configuration */ NVIC_Configuration(); /* Configure the SysTick */ SysTick_Config( SystemCoreClock / RT_TICK_PER_SECOND ); //SysTick_Configuration(); #if STM32_EXT_SRAM EXT_SRAM_Configuration(); #endif rt_hw_usart_init(); #ifdef RT_USING_CONSOLE rt_console_set_device(RT_CONSOLE_DEVICE_NAME); #endif #ifdef RT_USING_COMPONENTS_INIT rt_components_board_init(); #endif stm32_hw_pin_init(); ports_initial(); }
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); }
/** * This function will initial STM32 board. */ void rt_hw_board_init() { RCC_Configuration(); GPIO_Configuration(); exti_config(); /* mark by David */ Exti_Pvd_Init(); NVIC_Configuration(); /* Configure the SysTick */ SysTick_Config( SystemCoreClock / RT_TICK_PER_SECOND ); #if STM32_EXT_SRAM EXT_SRAM_Configuration(); #endif rt_hw_usart_init(); rt_console_set_device(CONSOLE_DEVICE); spi_config(); #if 1==USE_TO_7INCH_LCD FSMC_LCD_Init(); #elif 1==STM32_USE_FSMC_NOR_MUX //sys_fsmc_nor_mux_config(); #elif 1==STM32_USE_FSMC_NOR_MUX2LCD lcd_fsmc_nor_mux_config(); #endif #if USE_STM32_IWDG iwdg_init(); #endif // led_on(LED_PORTX, LED3_PIN); }
/** * 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 }
/** * This function will initial board. */ void rt_hw_board_init(void) { /* must call first to configure gpio Alternate functions according the hardware design */ wm_gpio_config(); wm_sys_clk_config(); #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_console_set_device(RT_CONSOLE_DEVICE_NAME); #endif #if TLS_CONFIG_HARD_CRYPTO tls_crypto_init(); #endif NVIC_SystemLPConfig(NVIC_LP_SLEEPDEEP, ENABLE); rt_thread_idle_sethook(_idle_hook_callback); }
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); }
void set_finsh_dev(char *device) { #ifdef RT_USING_CONSOLE rt_console_set_device(device); finsh_set_device( device ); #endif }
/** * 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 }
/** * This function will initial LPC40xx board. */ void rt_hw_board_init() { //init low level drivers. e.g. cpu uart etc. rt_components_board_init(); //redirect RTT stdio to CONSOLE device rt_console_set_device(RT_CONSOLE_DEVICE_NAME); }
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 }
/** * This function will initial STM32 Radio board. */ void rt_hw_board_init(void) { /* Configure the system clocks */ SystemInit(); all_device_reset(); /* NVIC Configuration */ NVIC_Configuration(); /* Configure the SysTick */ SysTick_Config( SystemCoreClock / RT_TICK_PER_SECOND ); /* Console Initialization*/ rt_hw_usart_init(); rt_console_set_device("uart1"); rt_kprintf("\r\n\r\nSystemInit......\r\n"); /* SPI1 config */ { GPIO_InitTypeDef GPIO_InitStructure; SPI_InitTypeDef SPI_InitStructure; /* Enable SPI1 Periph clock */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_AFIO | RCC_APB2Periph_SPI1, ENABLE); /* Configure SPI1 pins: PA5-SCK, PA6-MISO and PA7-MOSI */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOA, &GPIO_InitStructure); /*------------------------ SPI1 configuration ------------------------*/ SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;//SPI_Direction_1Line_Tx; SPI_InitStructure.SPI_Mode = SPI_Mode_Master; SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low; SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge; SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_16;/* 72M/64=1.125M */ SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; SPI_InitStructure.SPI_CRCPolynomial = 7; SPI_I2S_DeInit(SPI1); SPI_Init(SPI1, &SPI_InitStructure); /* Enable SPI_MASTER */ SPI_Cmd(SPI1, ENABLE); SPI_CalculateCRC(SPI1, DISABLE); if (rt_sem_init(&spi1_lock, "spi1lock", 1, RT_IPC_FLAG_FIFO) != RT_EOK) { rt_kprintf("init spi1 lock semaphore failed\n"); } } }
/** * This function will initialize beaglebone board */ void rt_hw_board_init(void) { enable_neon_fpu(); disable_strict_align_check(); rt_components_board_init(); rt_console_set_device(RT_CONSOLE_DEVICE_NAME); }
void rt_hw_board_init() { emsk_mux_init(); rt_hw_uart_init(); rt_components_board_init(); rt_console_set_device(RT_CONSOLE_DEVICE_NAME); }
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"); }
/** * @brief This function when the Telnet connection is established * @param arg user supplied argument * @param pcb the tcp_pcb which accepted the connection * @param err error value * @retval ERR_OK */ static err_t telnetd_accept(void *arg, struct tcp_pcb *pcb, err_t err) { struct telnetio_dev *p; rt_err_t ret; TELNETD_DEBUG(("line:%d, %s()\n", __LINE__, __FUNCTION__)); p = telnetio_dev_creat(); if (NULL == p) { TELNETD_DEBUG(("line:%d, %s()\n", __LINE__, __FUNCTION__)); ret = ERR_MEM; goto ret_entry; } else { /* Tell LwIP to associate this structure with this connection. */ tcp_arg(pcb, p); /* p所指向的区域已清零, 这里只是简单的处理 */ p->dev_name[0] = 't'; p->dev_name[1] = 'e'; p->dev_name[2] = 'l'; p->dev_name[3] = 'n'; p->dev_name[4] = '0' + telnetio_dev_no_get(); p->dev_name[5] = '\0'; ret = rt_telnetio_register(&p->dev, p->dev_name, 0, pcb); TELNETD_DEBUG(("line:%d, %s() dev-%s register %s\n", __LINE__, __FUNCTION__, p->dev_name, ret==RT_EOK ? "succ" : "fail")); #if 1 //rt_device_open(&p->dev, 0); finsh_set_device(p->dev_name); rt_console_set_device(p->dev_name); #endif } /* Configure LwIP to use our call back functions. */ tcp_err(pcb, telnetd_conn_err); tcp_recv(pcb, telnetd_recv); /* !!!! 发送telnet选项命令 */ /* Send out the first message */ /* tcp_write(pcb, GREETING, strlen(GREETING), 1); */ /* send out the login message */ #if (!RT_NEED_FINSH_PROC_LOGIN) tcp_write(pcb, LOGIN_NAME, strlen(LOGIN_NAME), TCP_WRITE_FLAG_COPY); p->state = TELS_LOGIN_NAME; #else /* 登录处理已由finsh处理 */ //p->state = TELS_NORMAL; p->state = TELS_LOGIN_NAME; #endif ret = ERR_OK; ret_entry: return ret; }
/** * This function will initial STM32 board. */ void rt_hw_board_init(void) { /* NVIC Configuration */ NVIC_Configuration(); /* Configure the SysTick */ SysTick_Config( SystemCoreClock / RT_TICK_PER_SECOND ); rt_hw_usart_init(); rt_console_set_device(RT_CONSOLE_DEVICE_NAME); }
/** * @brief This function is called when an error occurs on the connection * @param arg * @parm err * @retval None */ static void telnetd_conn_err(void *arg, err_t err) { struct telnetio_dev *teldev = arg; finsh_set_device(CONSOLE_DEVICE); rt_console_set_device(CONSOLE_DEVICE); rt_device_unregister(&teldev->dev); telnetio_dev_delete(teldev); return; }
/* * Setup system tick for OS required. */ void bsp_init(void) { /* disable interrupt first */ rt_hw_interrupt_disable(); // drv_uart_init(); rt_hw_usart_init(); rt_console_set_device(RT_CONSOLE_DEVICE_NAME); /* System tick init */ BSP_Tmr_TickInit(0x1, (MB_PCLK / RT_TICK_PER_SECOND), IRQ_SYS_TICK_VECTOR, SysTick_Handler); }
/** * This function will initial STM32 board. */ void rt_hw_board_init() { RCC_Configuration(); GPIO_Configuration(); #if STM32_EXT_SRAM EXT_SRAM_Configuration(); #endif NVIC_Configuration(); /* Configure the SysTick */ SysTick_Config( SystemCoreClock / RT_TICK_PER_SECOND ); /* rand */ #if ENABLE_RAND ADC_Configration(); ADC_Channel_Config(); #endif rt_hw_usart_init(); rt_console_set_device(CONSOLE_DEVICE); board_debug(("func:%s(), line:%d\n", __FUNCTION__, __LINE__)); exti_config(); /* mark by David */ spi_config(); board_debug(("func:%s(), line:%d\n", __FUNCTION__, __LINE__)); #if RT_USING_ADE7880 #if ADE7880_USE_SPI ade7880_spi_cfg(); #else ade7880_i2c_cfg(); start_7880_i2c(); ade7880_spi_withdma_hsdccfg(); dma_configuration_spi1_rx(); #endif #endif board_debug(("func:%s(), line:%d\n", __FUNCTION__, __LINE__)); #if USE_STM32_IWDG iwdg_init(); #endif board_debug(("func:%s(), line:%d\n", __FUNCTION__, __LINE__)); return; }
/** * This function will initial win32 */ void rt_hw_board_init() { /* init system memory */ heap = rt_hw_sram_init(); //#if defined(RT_USING_USART) rt_hw_usart_init(); //#endif #if defined(RT_USING_CONSOLE) rt_console_set_device(RT_CONSOLE_DEVICE_NAME); #endif }
/** * This function will initial STM32 board. */ void rt_hw_board_init() { /* NVIC Configuration */ NVIC_Configuration(); /* Configure the SysTick */ SysTick_Configuration(); rt_hw_usart_init(); #ifdef RT_USING_CONSOLE rt_console_set_device(CONSOLE_DEVICE); #endif }
void board_init(void) { clock_init(); uart_init(); uart_register(); rt_console_set_device("uart"); led_init(); timer_init(); rt_hw_mmu_init(); }
/***************************************************************************//** * @brief * Initialize the hardware drivers. * * @details * * @note * ******************************************************************************/ void rt_hw_driver_init(void) { /* Initialize USART */ #if (defined(BSP_USING_USART1) || defined(BSP_USING_USART2) || \ defined(BSP_USING_USART3)) bsp_hw_usart_init(); #endif /* Setup Console */ rt_console_set_device(CONSOLE_DEVICE); #if defined(RT_USING_COMPONENTS_INIT) rt_components_board_init(); #else /* Initialize SPI */ # if (defined(BSP_USING_SPI1) || defined(BSP_USING_SPI2) || \ defined(BSP_USING_SPI3)) bsp_hw_spi_init(); # endif /* Initialize LED */ # if (defined(BSP_USING_LED1) || defined(BSP_USING_LED2)) board_hw_led_init(); # endif /* Initialize OLED */ # if defined(BSP_USING_OLED) # if (OLED_DEVICE_INTERFACE == INTERFACE_8BIT_80XX) bsp_hw_oled_init(); # endif # endif /* Initialize RTC */ # if defined(BSP_USING_RTC) bsp_hw_rtc_init(); # endif /* Initialize USB */ # if defined(BSP_USING_USB) bsp_hw_usb_core_init(); # if defined(BSP_USING_USB_VIRTUAL_COM) board_hw_usb_com_init(); # endif # if defined(BSP_USING_USB_HID_MOUSE) bsp_hw_usb_mouse_init(); # endif # endif #endif }
/** * This function will initial STM32 board. */ void rt_hw_board_init() { /* NVIC Configuration */ NVIC_Configuration(); /* Configure the SysTick */ SysTick_Config( SystemCoreClock / RT_TICK_PER_SECOND ); #if STM32_EXT_SRAM EXT_SRAM_Configuration(); #endif rt_hw_usart_init(); rt_console_set_device(CONSOLE_DEVICE); }
/* process netconn close */ void telnet_process_close(struct telnet_session* telnet, struct netconn *conn) { /* set console */ rt_console_set_device("uart1"); /* set finsh device */ finsh_set_device("uart1"); /* close connection */ netconn_close(conn); /* restore shell option */ finsh_set_echo(telnet->echo_mode); rt_kprintf("resume console to uart0\n"); }
/* client close */ static void client_close(struct telnet_session* telnet) { /* set console */ rt_console_set_device(RT_CONSOLE_DEVICE_NAME); /* set finsh device */ finsh_set_device(RT_CONSOLE_DEVICE_NAME); /* close connection */ closesocket(telnet->client_fd); /* restore shell option */ finsh_set_echo(telnet->echo_mode); rt_kprintf("resume console to %s\n", RT_CONSOLE_DEVICE_NAME); }
/** * This function will initial STM32 board. */ void rt_hw_board_init() { /* 配置系统时钟并启动PLL,让系统工作在72M,此函数由库中提供 */ SystemInit(); /* 配置systick分频器 */ /* SystemCoreClock为系统主时钟 由库中提供,在system_stm32f10x.c中 */ /* RT_TICK_PER_SECOND 为系统节拍,由rtconfig.h中定义 */ SysTick_Config( SystemCoreClock / RT_TICK_PER_SECOND ); // /* 初始化串口 */ // rt_hw_console_init(); rt_hw_usart_init(); rt_console_set_device("uart4"); }