mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-09 20:45:41 +08:00
clean code in bsp/simulator
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2533 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
1 parent
2bae33a381
commit
10892ce762
9 files changed
+45
-278
No files matched your search
@@ -21,7 +21,7 @@
|
||||
void rt_init_thread_entry(void *parameter)
|
||||
{
|
||||
#ifdef RT_USING_LWIP
|
||||
extern void pcap_netif_hw_init(void);
|
||||
|
||||
pcap_netif_hw_init();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ void rt_platform_init(void)
|
||||
#endif /* RT_USING_DFS */
|
||||
|
||||
#ifdef RT_USING_RTGUI
|
||||
/* initilize sdl */
|
||||
sdl_start();
|
||||
/* start sdl thread to simulate an LCD */
|
||||
rt_hw_sdl_start();
|
||||
#endif /* RT_USING_RTGUI */
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
@@ -20,15 +20,7 @@
|
||||
/**
|
||||
* @addtogroup win32
|
||||
*/
|
||||
#define HEAP_SIZE (1024*1024*10)
|
||||
static rt_uint8_t * heap;
|
||||
|
||||
void vs_heap_init(void)
|
||||
{
|
||||
heap = malloc(HEAP_SIZE);
|
||||
if (heap == RT_NULL)
|
||||
rt_kprintf("there is no memory in pc.");
|
||||
}
|
||||
/*@{*/
|
||||
|
||||
extern int rt_application_init(void);
|
||||
@@ -37,6 +29,7 @@ extern void finsh_system_init(void);
|
||||
extern void finsh_set_device(const char* device);
|
||||
#endif
|
||||
|
||||
extern rt_uint8_t * heap;
|
||||
/**
|
||||
* This function will startup RT-Thread RTOS.
|
||||
*/
|
||||
@@ -59,9 +52,6 @@ void rtthread_startup(void)
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
/* init memory system */
|
||||
#if (MSVC)
|
||||
vs_heap_init();
|
||||
#endif
|
||||
rt_system_heap_init((void*)heap, (void*)&heap[HEAP_SIZE-1]);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -14,28 +14,27 @@
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#include "board.h"
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
|
||||
/**
|
||||
* @addtogroup simulator on win32
|
||||
*/
|
||||
rt_uint8_t * heap;
|
||||
|
||||
/**
|
||||
* This function will initial win32
|
||||
*/
|
||||
void rt_hw_board_init()
|
||||
rt_uint8_t * rt_hw_sram_init(void)
|
||||
{
|
||||
#if defined(RT_USING_CONSOLE)
|
||||
rt_hw_usart_init();
|
||||
rt_hw_serial_init();
|
||||
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||
#endif
|
||||
rt_uint8_t * heap;
|
||||
heap = malloc(HEAP_SIZE);
|
||||
if (heap == RT_NULL)
|
||||
{
|
||||
rt_kprintf("there is no memory in pc.");
|
||||
_exit(1);
|
||||
}
|
||||
return heap;
|
||||
}
|
||||
|
||||
/* fix the compile errors for redefiniton of lwip_htonl in win socket */
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
void rt_hw_win32_low_cpu(void)
|
||||
{
|
||||
Sleep(1000);
|
||||
@@ -57,8 +56,20 @@ void rt_hw_exit(void)
|
||||
exit(0);
|
||||
}
|
||||
FINSH_FUNCTION_EXPORT_ALIAS(rt_hw_exit, exit, exit rt-thread);
|
||||
|
||||
#endif /* RT_USING_FINSH */
|
||||
|
||||
#endif /* WIN32 */
|
||||
/**
|
||||
* This function will initial win32
|
||||
*/
|
||||
void rt_hw_board_init()
|
||||
{
|
||||
/* init system memory */
|
||||
heap = rt_hw_sram_init();
|
||||
|
||||
#if defined(RT_USING_CONSOLE)
|
||||
rt_hw_usart_init();
|
||||
rt_hw_serial_init();
|
||||
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||
#endif
|
||||
}
|
||||
/*@}*/
|
||||
@@ -14,21 +14,20 @@
|
||||
|
||||
#ifndef __BOARD_H__
|
||||
#define __BOARD_H__
|
||||
|
||||
void rt_hw_board_led_on(int n);
|
||||
void rt_hw_board_led_off(int n);
|
||||
void rt_hw_board_init(void);
|
||||
|
||||
void rt_hw_serial_init(void);
|
||||
rt_uint8_t * rt_hw_sram_init(void);
|
||||
|
||||
/* SD Card init function */
|
||||
void rt_hw_sdcard_init(void);
|
||||
|
||||
int rt_hw_mtd_nand_init(void);
|
||||
|
||||
int sst25vfxx_mtd_init(const char * nor_name, unsigned int block_start, unsigned int block_end);
|
||||
|
||||
int sst25vfxx_mtd_init(const char *, unsigned int , unsigned int);
|
||||
void pcap_netif_hw_init(void);
|
||||
void rt_platform_init(void);
|
||||
|
||||
void rt_hw_usart_init(void);
|
||||
void rt_hw_serial_init(void);
|
||||
void rt_hw_sdl_start(void);
|
||||
void rt_hw_win32_low_cpu(void);
|
||||
|
||||
void rt_hw_exit(void);
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -281,7 +281,8 @@ static DWORD WINAPI sdl_loop(LPVOID lpParam)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sdl_start(void)
|
||||
/* start sdl thread */
|
||||
void rt_hw_sdl_start(void)
|
||||
{
|
||||
HANDLE thread;
|
||||
DWORD thread_id;
|
||||
|
||||
@@ -155,7 +155,6 @@ static rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_u
|
||||
|
||||
rt_err_t rt_hw_serial_init(void)
|
||||
{
|
||||
return rt_hw_serial_register(&serial_device,"sci0",
|
||||
return rt_hw_serial_register(&serial_device,RT_CONSOLE_DEVICE_NAME,
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,8 @@
|
||||
#undef RT_USING_MINILIBC
|
||||
#define NORESOURCE //RT_VESRION in winuser.h
|
||||
#define _CRT_ERRNO_DEFINED //errno macro redefinition
|
||||
|
||||
#define HEAP_SIZE (1024*1024*2)
|
||||
#endif
|
||||
|
||||
/* SECTION: basic kernel options */
|
||||
@@ -69,7 +71,6 @@
|
||||
/* SECTION: Device System */
|
||||
/* Using Device System */
|
||||
#define RT_USING_DEVICE
|
||||
/* #define RT_USING_SERIAL */
|
||||
/* #define RT_USING_UART1 */
|
||||
|
||||
/* SECTION: Console options */
|
||||
@@ -132,7 +133,7 @@
|
||||
#define DFS_FD_MAX 4
|
||||
|
||||
/* SECTION: lwip, a lighwight TCP/IP protocol stack */
|
||||
#define RT_USING_LWIP
|
||||
/* #define RT_USING_LWIP */
|
||||
/* LwIP uses RT-Thread Memory Management */
|
||||
#define RT_LWIP_USING_RT_MEM
|
||||
/* Enable ICMP protocol*/
|
||||
|
||||
Reference in new issue
Block a user