update project file.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1605 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong 2011-07-04 06:29:18 +00:00
parent cbf5ef8fa8
commit f1e3700a93
4 changed files with 5 additions and 2796 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_proj.xsd">
<SchemaVersion>1.0</SchemaVersion>
<SchemaVersion>1.1</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
@ -29,6 +29,7 @@
<SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile></SFDFile>
<UseEnv>0</UseEnv>
<BinPath></BinPath>
<IncludePath></IncludePath>
@ -415,11 +416,6 @@
<FileType>1</FileType>
<FilePath>.\uart.c</FilePath>
</File>
<File>
<FileName>tc_comm.c</FileName>
<FileType>1</FileType>
<FilePath>.\tc_comm.c</FilePath>
</File>
</Files>
</Group>
<Group>

View File

@ -1,171 +0,0 @@
#include "tc_comm.h"
#ifdef RT_USING_TC
#define TC_PRIORITY 25
#define TC_STACK_SIZE 0x400
static rt_uint8_t _tc_stat;
static struct rt_semaphore _tc_sem;
static struct rt_thread _tc_thread;
static rt_uint8_t _tc_stack[TC_STACK_SIZE];
static char _tc_prefix[64];
static const char* _tc_current;
static void (*_tc_cleanup)(void) = RT_NULL;
static rt_uint32_t _tc_scale = 1;
FINSH_VAR_EXPORT(_tc_scale, finsh_type_int, the testcase timer timeout scale)
void tc_thread_entry(void* parameter)
{
struct finsh_syscall* index;
/* create tc semaphore */
rt_sem_init(&_tc_sem, "tc", 0, RT_IPC_FLAG_FIFO);
while (_tc_stat & TC_STAT_RUNNING)
{
for (index = _syscall_table_begin; index < _syscall_table_end; index ++)
{
/* search testcase */
if (rt_strstr(index->name, _tc_prefix) == index->name)
{
long tick;
_tc_current = index->name + 4;
rt_kprintf("Run TestCase: %s\n", _tc_current);
_tc_stat = TC_STAT_PASSED | TC_STAT_RUNNING;
tick = index->func();
if (tick > 0)
{
rt_sem_take(&_tc_sem, tick * _tc_scale);
if (_tc_cleanup != RT_NULL)
{
/* perform testcase cleanup */
_tc_cleanup();
_tc_cleanup = RT_NULL;
}
if (_tc_stat & TC_STAT_FAILED)
rt_kprintf("TestCase[%s] failed\n", _tc_current);
else
rt_kprintf("TestCase[%s] passed\n", _tc_current);
}
else
{
if (_tc_cleanup != RT_NULL)
{
/* perform testcase cleanup */
_tc_cleanup();
_tc_cleanup = RT_NULL;
}
}
}
}
}
/* detach tc semaphore */
rt_sem_detach(&_tc_sem);
}
void tc_stop()
{
_tc_stat &= ~TC_STAT_RUNNING;
rt_thread_delay(RT_TICK_PER_SECOND/2);
if (_tc_thread.stat != RT_THREAD_INIT)
{
/* lock scheduler */
rt_enter_critical();
/* detach old tc thread */
rt_thread_detach(&_tc_thread);
rt_sem_detach(&_tc_sem);
/* unlock scheduler */
rt_exit_critical();
}
rt_thread_delay(RT_TICK_PER_SECOND/2);
}
FINSH_FUNCTION_EXPORT(tc_stop, stop testcase thread);
void tc_done(rt_uint8_t stat)
{
_tc_stat |= stat;
_tc_stat &= ~TC_STAT_RUNNING;
/* release semaphore */
rt_sem_release(&_tc_sem);
}
void tc_stat(rt_uint8_t stat)
{
if (stat & TC_STAT_FAILED)
{
rt_kprintf("TestCases[%s] failed\n", _tc_current);
}
_tc_stat |= stat;
}
void tc_cleanup(void (*cleanup)())
{
_tc_cleanup = cleanup;
}
void tc_start(const char* tc_prefix)
{
rt_err_t result;
/* tesecase prefix is null */
if (tc_prefix == RT_NULL)
{
rt_kprintf("TestCase Usage: tc_start(prefix)\n\n");
rt_kprintf("list_tc() can list all testcases.\n");
return ;
}
/* init tc thread */
if (_tc_stat & TC_STAT_RUNNING)
{
/* stop old tc thread */
tc_stop();
}
rt_memset(_tc_prefix, 0, sizeof(_tc_prefix));
rt_snprintf(_tc_prefix, sizeof(_tc_prefix),
"_tc_%s", tc_prefix);
result = rt_thread_init(&_tc_thread, "tc",
tc_thread_entry, RT_NULL,
&_tc_stack[0], sizeof(_tc_stack),
TC_PRIORITY - 3, 5);
/* set tc stat */
_tc_stat = TC_STAT_RUNNING | TC_STAT_FAILED;
if (result == RT_EOK)
rt_thread_startup(&_tc_thread);
}
FINSH_FUNCTION_EXPORT(tc_start, start testcase with testcase prefix or name);
void list_tc()
{
struct finsh_syscall* index;
rt_kprintf("TestCases List:\n");
for (index = _syscall_table_begin; index < _syscall_table_end; index ++)
{
/* search testcase */
if (rt_strstr(index->name, "_tc_") == index->name)
{
#ifdef FINSH_USING_DESCRIPTION
rt_kprintf("%-16s -- %s\n", index->name + 4, index->desc);
#else
rt_kprintf("%s\n", index->name + 4);
#endif
}
}
}
FINSH_FUNCTION_EXPORT(list_tc, list all testcases);
#endif

View File

@ -1,43 +0,0 @@
#ifndef __TC_COMM_H__
#define __TC_COMM_H__
/*
* RT-Thread TestCase
*
*/
#include <rtthread.h>
#ifdef RT_USING_FINSH
#include <finsh.h>
#endif
#if RT_THREAD_PRIORITY_MAX == 8
#define THREAD_PRIORITY 6
#elif RT_THREAD_PRIORITY_MAX == 32
#define THREAD_PRIORITY 25
#elif RT_THREAD_PRIORITY_MAX == 256
#define THREAD_PRIORITY 200
#endif
#define THREAD_STACK_SIZE 512
#define THREAD_TIMESLICE 5
#define TC_STAT_END 0x00
#define TC_STAT_RUNNING 0x01
#define TC_STAT_FAILED 0x10
#define TC_STAT_PASSED 0x00
#ifdef RT_USING_TC
void tc_start(const char* tc_prefix);
void tc_stop(void);
void tc_done(rt_uint8_t state);
void tc_stat(rt_uint8_t state);
void tc_cleanup(void (*cleanup)(void));
#else
#define tc_start(x)
#define tc_stop()
#define tc_done(s)
#define tc_stat(s)
#define tc_cleanup(c)
#endif
#endif