Compare commits

...

15 Commits

Author SHA1 Message Date
Bernard Xiong
dd7abc2a08 [Kernel] Change the version number to v2.0.1. 2015-05-05 10:21:33 +08:00
Bernard Xiong
c1d2e97c78 [Kernel] Add magic checking in rt_memheap_free routine. 2015-05-05 10:21:10 +08:00
Bernard Xiong
1bd91f8b05 [libc] Add THREAD_SUPPORT and FILE_DESCRIPTOR in dlib. 2015-05-05 10:20:36 +08:00
Bernard Xiong
7da82cbf31 [finsh] Fix the echo mode issue in finsh. 2015-05-05 10:20:10 +08:00
Bernard Xiong
f8c82b05bb [finsh] Fix compiling issue in finsh. 2015-05-05 10:19:47 +08:00
Bernard Xiong
ccc89001e5 [finsh] Remove list_mod_detail command in msh. 2015-05-05 10:19:09 +08:00
Bernard Xiong
40570b92ac [DeviceDriver] Fix the compiling error in USB host. 2015-05-05 10:18:34 +08:00
Bernard Xiong
52e43eae9b [DeviceDriver] Add extern C for cplusplus in rtdevice.h 2015-05-05 10:18:11 +08:00
Bernard Xiong
bd2d62a1df [DeviceDriver] Fix the flag clean issue in completion IPC. 2015-05-05 10:17:48 +08:00
Bernard Xiong
8cd254b08f [DeviceDriver] Remove dataqueue.c/pipe.c comnpile if the heap is not enable. 2015-05-05 10:17:08 +08:00
Bernard Xiong
1c7f33c151 [Sensor] Fix the event handler issue in sensor. 2015-05-05 10:16:12 +08:00
Bernard Xiong
cb1654de75 [DeviceDriver] Fix device name issue in pin_device. 2015-05-05 10:15:38 +08:00
Bernard Xiong
80eedb8963 [DFS] Update DFS code.
1. Add extern "C" for cplusplus in DFS.
2. Export more symbol in DFS.
2015-05-05 10:14:59 +08:00
Bernard Xiong
7962a5c46c [BSP] Update bsp code
1. Use RT_USING_LIBC instead of RT_USING_NEWLIB in the beagonebone.
2. Enable LIBC in default in LPC4088.
3. Remove the unnecessary interrupt clean in STM32 UART;
4. Use HSE_VALUE to calculate PLL_M in STM32F2/F4;
2015-05-05 10:13:52 +08:00
Bernard Xiong
677d5323e8 Update application.c 2015-03-04 10:32:01 +08:00
27 changed files with 87 additions and 58 deletions

View File

@@ -122,8 +122,8 @@
// </section>
// <section name="LIBC" description="C Runtime library setting" default="always" >
// <bool name="RT_USING_NEWLIB" description="Using newlib library, only available under GNU GCC" default="true" />
//#define RT_USING_NEWLIB
// <bool name="RT_USING_LIBC" description="Using C library" default="true" />
#define RT_USING_LIBC
// <bool name="RT_USING_PTHREADS" description="Using POSIX threads library" default="true" />
#define RT_USING_PTHREADS
// </section>

View File

@@ -14,7 +14,11 @@
#include <rtthread.h>
#include <board.h>
#ifdef RT_USING_FINSH
#include <shell.h>
#include <finsh.h>
#endif
#ifdef RT_USING_COMPONENTS_INIT
#include <components.h>
#endif
@@ -25,12 +29,8 @@ void rt_init_thread_entry(void *parameter)
/* Initialization RT-Thread Components */
#ifdef RT_USING_COMPONENTS_INIT
rt_components_init();
#endif
#ifdef RT_USING_FINSH
/* initialize finsh */
#elif defined(RT_USING_FINSH)
finsh_system_init();
finsh_set_device(FINSH_DEVICE_NAME);
#endif
}

View File

@@ -105,7 +105,7 @@
// <section name="LIBC" description="C Runtime library setting" default="always" >
// <bool name="RT_USING_LIBC" description="Using C library" default="true" />
// #define RT_USING_LIBC
#define RT_USING_LIBC
// <bool name="RT_USING_PTHREADS" description="Using POSIX threads library" default="true" />
#define RT_USING_PTHREADS
// </section>

View File

@@ -152,8 +152,6 @@ void USART1_IRQHandler(void)
if(USART_GetITStatus(uart->uart_device, USART_IT_RXNE) != RESET)
{
rt_hw_serial_isr(&serial1, RT_SERIAL_EVENT_RX_IND);
/* clear interrupt */
USART_ClearITPendingBit(uart->uart_device, USART_IT_RXNE);
}
if (USART_GetITStatus(uart->uart_device, USART_IT_TC) != RESET)
{
@@ -186,8 +184,6 @@ void USART2_IRQHandler(void)
if(USART_GetITStatus(uart->uart_device, USART_IT_RXNE) != RESET)
{
rt_hw_serial_isr(&serial2, RT_SERIAL_EVENT_RX_IND);
/* clear interrupt */
USART_ClearITPendingBit(uart->uart_device, USART_IT_RXNE);
}
if (USART_GetITStatus(uart->uart_device, USART_IT_TC) != RESET)
{

View File

@@ -142,7 +142,7 @@
/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */
#define PLL_M 25
#define PLL_M (HSE_VALUE / 1000000)
#define PLL_N 240
/* SYSCLK = PLL_VCO / PLL_P */

View File

@@ -146,7 +146,7 @@
/************************* PLL Parameters *************************************/
/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */
#define PLL_M 25
#define PLL_M (HSE_VALUE / 1000000)
#define PLL_N 336
/* SYSCLK = PLL_VCO / PLL_P */

View File

@@ -177,8 +177,6 @@ void USART1_IRQHandler(void)
if (USART_GetITStatus(uart->uart_device, USART_IT_RXNE) != RESET)
{
rt_hw_serial_isr(&serial1, RT_SERIAL_EVENT_RX_IND);
/* clear interrupt */
USART_ClearITPendingBit(uart->uart_device, USART_IT_RXNE);
}
if (USART_GetITStatus(uart->uart_device, USART_IT_TC) != RESET)
{
@@ -211,8 +209,6 @@ void USART2_IRQHandler(void)
if (USART_GetITStatus(uart->uart_device, USART_IT_RXNE) != RESET)
{
rt_hw_serial_isr(&serial2, RT_SERIAL_EVENT_RX_IND);
/* clear interrupt */
USART_ClearITPendingBit(uart->uart_device, USART_IT_RXNE);
}
if (USART_GetITStatus(uart->uart_device, USART_IT_TC) != RESET)
{
@@ -245,8 +241,6 @@ void USART3_IRQHandler(void)
if (USART_GetITStatus(uart->uart_device, USART_IT_RXNE) != RESET)
{
rt_hw_serial_isr(&serial3, RT_SERIAL_EVENT_RX_IND);
/* clear interrupt */
USART_ClearITPendingBit(uart->uart_device, USART_IT_RXNE);
}
if (USART_GetITStatus(uart->uart_device, USART_IT_TC) != RESET)
{

View File

@@ -16,6 +16,10 @@
#include <i386.h>
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************************************/
/* Timer Register */
/*******************************************************************/

View File

@@ -105,4 +105,8 @@ struct Pseudodesc {
#define STS_IG32 0xe // 32-bit Interrupt Gate
#define STS_TG32 0xf // 32-bit Trap Gate
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -30,6 +30,10 @@
#include <dfs_file.h>
#include <dfs_def.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef RT_USING_NEWLIB
#define O_RDONLY DFS_O_RDONLY
#define O_WRONLY DFS_O_WRONLY
@@ -79,6 +83,7 @@
#if defined(__CC_ARM)
#include <stdio.h>
#include <stdlib.h>
#elif defined(_MSC_VER)
#include <stdio.h>
#else
@@ -126,5 +131,8 @@ int rmdir(const char *path);
int chdir(const char *path);
char *getcwd(char *buf, size_t size);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -284,6 +284,7 @@ const char *dfs_subdir(const char *directory, const char *filename)
return dir;
}
RTM_EXPORT(dfs_subdir);
/**
* this function will normalize a path according to specified parent directory
@@ -410,5 +411,7 @@ up_one:
return fullpath;
}
RTM_EXPORT(dfs_normalize_path);
/*@}*/

View File

@@ -28,6 +28,10 @@
#include <rtthread.h>
#ifdef __cplusplus
extern "C" {
#endif
#define RT_DEVICE(device) ((rt_device_t)device)
/* completion flag */
@@ -362,5 +366,9 @@ rt_inline void rt_work_init(struct rt_work* work, void (*work_func)(struct rt_wo
#include "drivers/pin.h"
#endif
#ifdef __cplusplus
}
#endif
#endif /* __RT_DEVICE_H__ */

View File

@@ -93,7 +93,7 @@ int rt_device_pin_register(const char *name, const struct rt_pin_ops *ops, void
_hw_pin.parent.user_data = user_data;
/* register a character device */
rt_device_register(&_hw_pin.parent, "pin", RT_DEVICE_FLAG_RDWR);
rt_device_register(&_hw_pin.parent, name, RT_DEVICE_FLAG_RDWR);
return 0;
}

View File

@@ -58,7 +58,7 @@ int SensorBase::getConfig(SensorConfig *config)
return 0;
}
int SensorBase::subscribe(SensorEventHandler_t *handler, void *user_data)
int SensorBase::subscribe(SensorEventHandler_t handler, void *user_data)
{
this->evtHandler = handler;
this->userData = user_data;
@@ -66,12 +66,12 @@ int SensorBase::subscribe(SensorEventHandler_t *handler, void *user_data)
return 0;
}
int SensorBase::publish(sensors_event_t *event)
int SensorBase::publish(void)
{
if (this->evtHandler != NULL)
{
/* invoke subscribed handler */
(*evtHandler)(event, this->userData);
(*evtHandler)(this->userData);
}
return 0;
@@ -151,7 +151,7 @@ SensorBase *SensorManager::getDefaultSensor(int type)
return NULL;
}
int SensorManager::subscribe(int type, SensorEventHandler_t *handler, void *user_data)
int SensorManager::subscribe(int type, SensorEventHandler_t handler, void *user_data)
{
SensorBase *sensor;
@@ -194,7 +194,7 @@ rt_sensor_t rt_sensor_get_default(int type)
return (rt_sensor_t)SensorManager::getDefaultSensor(type);
}
int rt_sensor_subscribe(rt_sensor_t sensor, SensorEventHandler_t *handler, void *user_data)
int rt_sensor_subscribe(rt_sensor_t sensor, SensorEventHandler_t handler, void *user_data)
{
SensorBase *sensor_base;
if (sensor == NULL) return -1;

View File

@@ -992,10 +992,10 @@ enum SensorAccelRange
SENSOR_ACCEL_RANGE_8G,
SENSOR_ACCEL_RANGE_16G,
};
#define SENSOR_ACCEL_SENSITIVITY_2G (0.001F)
#define SENSOR_ACCEL_SENSITIVITY_4G (0.002F)
#define SENSOR_ACCEL_SENSITIVITY_8G (0.004F)
#define SENSOR_ACCEL_SENSITIVITY_16G (0.012F)
#define SENSOR_ACCEL_SENSITIVITY_2G ((float)2/32768)
#define SENSOR_ACCEL_SENSITIVITY_4G ((float)4/32768)
#define SENSOR_ACCEL_SENSITIVITY_8G ((float)8/32768)
#define SENSOR_ACCEL_SENSITIVITY_16G ((float)16/32768)
enum SensorGyroRange
{
@@ -1040,12 +1040,13 @@ typedef struct SensorConfig
union range
{
int range;
enum SensorAccelRange accel_range;
enum SensorGyroRange gyro_range;
} range;
}SensorConfig;
typedef void (*SensorEventHandler_t)(sensors_event_t *event, void *user_data);
typedef void (*SensorEventHandler_t)(void *user_data);
#ifdef __cplusplus
class SensorBase;
@@ -1074,8 +1075,8 @@ public:
int setConfig(SensorConfig *config);
int getConfig(SensorConfig *config);
int subscribe(SensorEventHandler_t *handler, void *user_data);
int publish(sensors_event_t *event);
int subscribe(SensorEventHandler_t handler, void *user_data);
int publish(void);
protected:
SensorBase *next;
@@ -1084,7 +1085,7 @@ protected:
/* sensor configuration */
SensorConfig config;
SensorEventHandler_t *evtHandler;
SensorEventHandler_t evtHandler;
void *userData;
friend class SensorManager;
@@ -1103,7 +1104,7 @@ public:
static int unregisterSensor(SensorBase *sensor);
static SensorBase *getDefaultSensor(int type);
static int subscribe(int type, SensorEventHandler_t *handler, void *user_data);
static int subscribe(int type, SensorEventHandler_t handler, void *user_data);
static int sensorEventReady(SensorBase *sensor);
static int pollSensor(SensorBase *sensor, sensors_event_t *events, int number, int duration);
@@ -1120,7 +1121,7 @@ extern "C" {
rt_sensor_t rt_sensor_get_default(int type);
int rt_sensor_subscribe(rt_sensor_t sensor, SensorEventHandler_t *handler, void *user_data);
int rt_sensor_subscribe(rt_sensor_t sensor, SensorEventHandler_t handler, void *user_data);
int rt_sensor_activate (rt_sensor_t sensor, int enable);
int rt_sensor_configure(rt_sensor_t sensor, SensorConfig *config);
int rt_sensor_poll(rt_sensor_t sensor, sensors_event_t *event);

View File

@@ -3,6 +3,11 @@ from building import *
cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = [cwd + '/../include']
if not GetDepend('RT_USING_HEAP'):
SrcRemove(src, 'dataqueue.c')
SrcRemove(src, 'pipe.c')
group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_DEVICE_IPC'], CPPPATH = CPPPATH)
Return('group')

View File

@@ -95,10 +95,10 @@ rt_err_t rt_completion_wait(struct rt_completion *completion,
result = thread->error;
level = rt_hw_interrupt_disable();
}
}
/* clean completed flag */
completion->flag = RT_UNCOMPLETED;
}
}
__exit:
rt_hw_interrupt_enable(level);

View File

@@ -67,7 +67,7 @@ RTM_EXPORT(rt_usbh_adk_set_string);
*/
static rt_err_t rt_usbh_adk_get_protocol(struct uintf* intf, rt_uint16_t *protocol)
{
struct ureqest setup;
struct urequest setup;
uinst_t device;
int timeout = 100;
@@ -101,7 +101,7 @@ static rt_err_t rt_usbh_adk_get_protocol(struct uintf* intf, rt_uint16_t *protoc
static rt_err_t rt_usbh_adk_send_string(struct uintf* intf, rt_uint16_t index,
const char* str)
{
struct ureqest setup;
struct urequest setup;
uinst_t device;
int timeout = 100;
@@ -134,7 +134,7 @@ static rt_err_t rt_usbh_adk_send_string(struct uintf* intf, rt_uint16_t index,
*/
static rt_err_t rt_usbh_adk_start(struct uintf* intf)
{
struct ureqest setup;
struct urequest setup;
uinst_t device;
int timeout = 100;

View File

@@ -246,7 +246,7 @@ rt_err_t rt_usbh_detach_instance(uinst_t device)
rt_err_t rt_usbh_get_descriptor(uinst_t device, rt_uint8_t type, void* buffer,
int nbytes)
{
struct ureqest setup;
struct urequest setup;
int timeout = 100;
RT_ASSERT(device != RT_NULL);
@@ -272,7 +272,7 @@ rt_err_t rt_usbh_get_descriptor(uinst_t device, rt_uint8_t type, void* buffer,
*/
rt_err_t rt_usbh_set_address(uinst_t device)
{
struct ureqest setup;
struct urequest setup;
int timeout = 100;
RT_ASSERT(device != RT_NULL);
@@ -306,7 +306,7 @@ rt_err_t rt_usbh_set_address(uinst_t device)
*/
rt_err_t rt_usbh_set_configure(uinst_t device, int config)
{
struct ureqest setup;
struct urequest setup;
int timeout = 100;
/* check parameter */
@@ -335,7 +335,7 @@ rt_err_t rt_usbh_set_configure(uinst_t device, int config)
*/
rt_err_t rt_usbh_set_interface(uinst_t device, int intf)
{
struct ureqest setup;
struct urequest setup;
int timeout = 100;
/* check parameter */
@@ -364,7 +364,7 @@ rt_err_t rt_usbh_set_interface(uinst_t device, int intf)
*/
rt_err_t rt_usbh_clear_feature(uinst_t device, int endpoint, int feature)
{
struct ureqest setup;
struct urequest setup;
int timeout = 100;
/* check parameter */

View File

@@ -43,7 +43,7 @@ static struct uclass_driver hub_driver;
rt_err_t rt_usbh_hub_get_descriptor(struct uinstance* device, rt_uint8_t *buffer,
rt_size_t nbytes)
{
struct ureqest setup;
struct urequest setup;
int timeout = 100;
/* parameter check */
@@ -72,7 +72,7 @@ rt_err_t rt_usbh_hub_get_descriptor(struct uinstance* device, rt_uint8_t *buffer
*/
rt_err_t rt_usbh_hub_get_status(struct uinstance* device, rt_uint8_t* buffer)
{
struct ureqest setup;
struct urequest setup;
int timeout = 100;
int length = 4;
@@ -104,7 +104,7 @@ rt_err_t rt_usbh_hub_get_status(struct uinstance* device, rt_uint8_t* buffer)
rt_err_t rt_usbh_hub_get_port_status(uhub_t hub, rt_uint16_t port,
rt_uint8_t* buffer)
{
struct ureqest setup;
struct urequest setup;
int timeout = 100;
int length = 4;
@@ -144,7 +144,7 @@ rt_err_t rt_usbh_hub_get_port_status(uhub_t hub, rt_uint16_t port,
rt_err_t rt_usbh_hub_clear_port_feature(uhub_t hub, rt_uint16_t port,
rt_uint16_t feature)
{
struct ureqest setup;
struct urequest setup;
int timeout = 100;
/* parameter check */
@@ -183,7 +183,7 @@ rt_err_t rt_usbh_hub_clear_port_feature(uhub_t hub, rt_uint16_t port,
rt_err_t rt_usbh_hub_set_port_feature(uhub_t hub, rt_uint16_t port,
rt_uint16_t feature)
{
struct ureqest setup;
struct urequest setup;
int timeout = 100;
/* parameter check */

View File

@@ -28,10 +28,10 @@ msh.c
CPPPATH = [cwd]
if rtconfig.CROSS_TOOL == 'keil':
LINKFLAGS = ' --keep __fsym_*'
LINKFLAGS = ' --keep *.o(FSymTab)'
if not GetDepend('FINSH_USING_MSH_ONLY'):
LINKFLAGS = LINKFLAGS + ' --keep __vsym_* '
LINKFLAGS = LINKFLAGS + ' --keep *.o(VSymTab) '
else:
LINKFLAGS = ''

View File

@@ -623,7 +623,6 @@ int list_mod_detail(const char *name)
return 0;
}
FINSH_FUNCTION_EXPORT(list_mod_detail, list module objects in system)
MSH_CMD_EXPORT(list_mod_detail, list module objects in system)
#endif
long list(void)

View File

@@ -280,6 +280,7 @@ FINSH_FUNCTION_EXPORT_ALIAS(cmd_time, __cmd_time, Execute command with time.);
int cmd_free(int argc, char** argv)
{
extern void list_mem(void);
extern void list_memheap(void);
#ifdef RT_USING_MEMHEAP_AS_HEAP
list_memheap();

View File

@@ -526,6 +526,7 @@ void finsh_thread_entry(void* parameter)
else
{
shell->line[shell->line_position] = ch;
if (shell->echo_mode)
rt_kprintf("%c", ch);
}

View File

@@ -9,6 +9,10 @@ CPPPATH = [cwd]
CPPDEFINES = ['RT_USING_DLIBC']
if rtconfig.PLATFORM == 'iar':
if GetDepend('RT_USING_DFS'):
CPPDEFINES = CPPDEFINES + ['_DLIB_FILE_DESCRIPTOR', '_DLIB_THREAD_SUPPORT']
group = DefineGroup('dlib', src, depend = ['RT_USING_LIBC'],
CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)

View File

@@ -1,7 +1,7 @@
/*
* File : rtdef.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ extern "C" {
/* RT-Thread version information */
#define RT_VERSION 2L /**< major version number */
#define RT_SUBVERSION 0L /**< minor version number */
#define RT_REVISION 0L /**< revise version number */
#define RT_REVISION 1L /**< revise version number */
/* RT-Thread version */
#define RTTHREAD_VERSION ((RT_VERSION * 10000) + \

View File

@@ -517,6 +517,7 @@ void rt_memheap_free(void *ptr)
/* check magic */
RT_ASSERT((header_ptr->magic & RT_MEMHEAP_MASK) == RT_MEMHEAP_MAGIC);
RT_ASSERT(header_ptr->magic & RT_MEMHEAP_USED);
/* check whether this block of memory has been over-written. */
RT_ASSERT((header_ptr->next->magic & RT_MEMHEAP_MASK) == RT_MEMHEAP_MAGIC);