projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove CVS logs.
[bertos.git]
/
bertos
/
kern
/
sem_test.c
diff --git
a/bertos/kern/sem_test.c
b/bertos/kern/sem_test.c
index 354277fcbd0f4e9c0a6cbc41d17f3e21fff8a555..feb0be72ba6424a23b1c1f592aaf7afafda611d9 100644
(file)
--- a/
bertos/kern/sem_test.c
+++ b/
bertos/kern/sem_test.c
@@
-32,10
+32,10
@@
* \brief Semaphore test.
*
* \version $Id$
* \brief Semaphore test.
*
* \version $Id$
- *
+ *
* \author Daniele Basile <asterix@develer.com>
* \author Daniele Basile <asterix@develer.com>
- * \author Stefano Fedrigo <aleph@develer.com>
- *
+ * \author Stefano Fedrigo <aleph@develer.com>
+ *
*/
#include <cfg/debug.h>
*/
#include <cfg/debug.h>
@@
-50,7
+50,7
@@
// Global settings for the test.
#define MAX_GLOBAL_COUNT 1024
#define TEST_TIME_OUT_MS 6000
// Global settings for the test.
#define MAX_GLOBAL_COUNT 1024
#define TEST_TIME_OUT_MS 6000
-#define DELAY 5
+#define DELAY
5
// Settings for the test process.
//Process 1
// Settings for the test process.
//Process 1
@@
-83,7
+83,7
@@
unsigned int global_count = 0;
/*
* These macros generate the code needed to create the test process functions.
/*
* These macros generate the code needed to create the test process functions.
- */
+ */
#define PROC_TEST(num) static void proc_test##num(void) \
{ \
unsigned int local_count = 0; \
#define PROC_TEST(num) static void proc_test##num(void) \
{ \
unsigned int local_count = 0; \
@@
-134,7
+134,7
@@
int sem_testRun(void)
ticks_t start_time = timer_clock();
kprintf("Run semaphore test..\n");
ticks_t start_time = timer_clock();
kprintf("Run semaphore test..\n");
-
+
//Init the process tests
PROC_TEST_INIT(1)
PROC_TEST_INIT(2)
//Init the process tests
PROC_TEST_INIT(1)
PROC_TEST_INIT(2)
@@
-145,16
+145,16
@@
int sem_testRun(void)
PROC_TEST_INIT(7)
PROC_TEST_INIT(8)
kputs("> Main: Processes created\n");
PROC_TEST_INIT(7)
PROC_TEST_INIT(8)
kputs("> Main: Processes created\n");
-
+
/*
/*
- * Wait until all process
finishing, if some going wrong we return
- * error after time
_out_ms
ms.
- */
+ * Wait until all process
es exit, if something goes wrong we return an
+ * error after time
out_
ms.
+ */
while((timer_clock() - start_time) < ms_to_ticks(TEST_TIME_OUT_MS))
{
if (sem_attempt(&sem))
{
while((timer_clock() - start_time) < ms_to_ticks(TEST_TIME_OUT_MS))
{
if (sem_attempt(&sem))
{
- kputs("> Main: Check if test
is finish
..\n");
+ kputs("> Main: Check if test
has finished
..\n");
if(global_count == MAX_GLOBAL_COUNT)
{
kputs("> Main: Test Finished..Ok!\n");
if(global_count == MAX_GLOBAL_COUNT)
{
kputs("> Main: Test Finished..Ok!\n");
@@
-165,7
+165,7
@@
int sem_testRun(void)
}
proc_yield();
}
}
proc_yield();
}
-
+
kputs("Semaphore Test fail..\n");
return -1;
}
kputs("Semaphore Test fail..\n");
return -1;
}
@@
-177,7
+177,7
@@
int sem_testSetup(void)
kprintf("Init Semaphore..");
sem_init(&sem);
kprintf("Done.\n");
kprintf("Init Semaphore..");
sem_init(&sem);
kprintf("Done.\n");
-
+
#if CONFIG_KERN_PREEMPT
kprintf("Init Interrupt (preempt mode)..");
irq_init();
#if CONFIG_KERN_PREEMPT
kprintf("Init Interrupt (preempt mode)..");
irq_init();
@@
-187,11
+187,11
@@
int sem_testSetup(void)
kprintf("Init Timer..");
timer_init();
kprintf("Done.\n");
kprintf("Init Timer..");
timer_init();
kprintf("Done.\n");
-
+
kprintf("Init Process..");
proc_init();
kprintf("Done.\n");
kprintf("Init Process..");
proc_init();
kprintf("Done.\n");
-
+
return 0;
}
return 0;
}
@@
-201,4
+201,4
@@
int sem_testTearDown(void)
return 0;
}
return 0;
}
-TEST_MAIN(sem);
\ No newline at end of file
+TEST_MAIN(sem);