git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@650 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
22e22db016
commit
4d2e568b56
|
@ -77,7 +77,7 @@ ULIBDIR =
|
||||||
ULIBS =
|
ULIBS =
|
||||||
|
|
||||||
# Define optimisation level here
|
# Define optimisation level here
|
||||||
OPT = -ggdb -Os -fomit-frame-pointer
|
OPT = -ggdb -O2 -fomit-frame-pointer
|
||||||
|
|
||||||
#
|
#
|
||||||
# End of user defines
|
# End of user defines
|
||||||
|
|
|
@ -98,7 +98,7 @@ void ChkIntSources(void) {
|
||||||
* @param msg pointer to the message
|
* @param msg pointer to the message
|
||||||
*/
|
*/
|
||||||
__attribute__((fastcall))
|
__attribute__((fastcall))
|
||||||
void sys_puts(char *msg) {
|
void port_puts(char *msg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -107,7 +107,7 @@ void sys_puts(char *msg) {
|
||||||
* @param ntp the thread to be switched in
|
* @param ntp the thread to be switched in
|
||||||
*/
|
*/
|
||||||
__attribute__((fastcall))
|
__attribute__((fastcall))
|
||||||
void sys_switch(Thread *otp, Thread *ntp) {
|
void port_switch(Thread *otp, Thread *ntp) {
|
||||||
register struct intctx volatile *esp asm("esp");
|
register struct intctx volatile *esp asm("esp");
|
||||||
|
|
||||||
asm volatile ("push %ebp \n\t" \
|
asm volatile ("push %ebp \n\t" \
|
||||||
|
@ -126,7 +126,7 @@ void sys_switch(Thread *otp, Thread *ntp) {
|
||||||
* Halts the system. In this implementation it just exits the simulation.
|
* Halts the system. In this implementation it just exits the simulation.
|
||||||
*/
|
*/
|
||||||
__attribute__((fastcall))
|
__attribute__((fastcall))
|
||||||
void sys_halt(void) {
|
void port_halt(void) {
|
||||||
|
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,9 +65,9 @@ struct intctx {
|
||||||
* This structure usually contains just the saved stack pointer defined as a
|
* This structure usually contains just the saved stack pointer defined as a
|
||||||
* pointer to a @p intctx structure.
|
* pointer to a @p intctx structure.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
struct context {
|
||||||
struct intctx volatile *esp;
|
struct intctx volatile *esp;
|
||||||
} Context;
|
};
|
||||||
|
|
||||||
#define APUSH(p, a) (p) -= sizeof(void *), *(void **)(p) = (void*)(a)
|
#define APUSH(p, a) (p) -= sizeof(void *), *(void **)(p) = (void*)(a)
|
||||||
|
|
||||||
|
@ -130,71 +130,71 @@ typedef struct {
|
||||||
* IRQ prologue code, inserted at the start of all IRQ handlers enabled to
|
* IRQ prologue code, inserted at the start of all IRQ handlers enabled to
|
||||||
* invoke system APIs.
|
* invoke system APIs.
|
||||||
*/
|
*/
|
||||||
#define SYS_IRQ_PROLOGUE()
|
#define PORT_IRQ_PROLOGUE()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IRQ epilogue code, inserted at the end of all IRQ handlers enabled to
|
* IRQ epilogue code, inserted at the end of all IRQ handlers enabled to
|
||||||
* invoke system APIs.
|
* invoke system APIs.
|
||||||
*/
|
*/
|
||||||
#define SYS_IRQ_EPILOGUE()
|
#define PORT_IRQ_EPILOGUE()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IRQ handler function modifier.
|
* IRQ handler function declaration.
|
||||||
*/
|
*/
|
||||||
#define SYS_IRQ_HANDLER
|
#define PORT_IRQ_HANDLER(id) void id(void)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simulator initialization.
|
* Simulator initialization.
|
||||||
*/
|
*/
|
||||||
#define sys_init() InitCore()
|
#define port_init() InitCore()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does nothing in this simulator.
|
* Does nothing in this simulator.
|
||||||
*/
|
*/
|
||||||
#define sys_disable_all()
|
#define port_lock()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does nothing in this simulator.
|
* Does nothing in this simulator.
|
||||||
*/
|
*/
|
||||||
#define sys_disable()
|
#define port_unlock()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does nothing in this simulator.
|
* Does nothing in this simulator.
|
||||||
*/
|
*/
|
||||||
#define sys_enable()
|
#define port_lock_from_isr()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does nothing in this simulator.
|
* Does nothing in this simulator.
|
||||||
*/
|
*/
|
||||||
#define sys_lock()
|
#define port_unlock_from_isr()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does nothing in this simulator.
|
* Does nothing in this simulator.
|
||||||
*/
|
*/
|
||||||
#define sys_unlock()
|
#define port_disable()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does nothing in this simulator.
|
* Does nothing in this simulator.
|
||||||
*/
|
*/
|
||||||
#define sys_lock_from_isr()
|
#define port_suspend()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does nothing in this simulator.
|
* Does nothing in this simulator.
|
||||||
*/
|
*/
|
||||||
#define sys_unlock_from_isr()
|
#define port_enable()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In the simulator this does a polling pass on the simulated interrupt
|
* In the simulator this does a polling pass on the simulated interrupt
|
||||||
* sources.
|
* sources.
|
||||||
*/
|
*/
|
||||||
#define sys_wait_for_interrupt() ChkIntSources()
|
#define port_wait_for_interrupt() ChkIntSources()
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
__attribute__((fastcall)) void sys_puts(char *msg);
|
__attribute__((fastcall)) void port_puts(char *msg);
|
||||||
__attribute__((fastcall)) void sys_switch(Thread *otp, Thread *ntp);
|
__attribute__((fastcall)) void port_switch(Thread *otp, Thread *ntp);
|
||||||
__attribute__((fastcall)) void sys_halt(void);
|
__attribute__((fastcall)) void port_halt(void);
|
||||||
void InitCore(void);
|
void InitCore(void);
|
||||||
void ChkIntSources(void);
|
void ChkIntSources(void);
|
||||||
void threadexit(void);
|
void threadexit(void);
|
||||||
|
|
|
@ -92,6 +92,7 @@ static void sem2_execute(void) {
|
||||||
test_emit_token('A' + i);
|
test_emit_token('A' + i);
|
||||||
chSemWaitTimeout(&sem1, MS2ST(500));
|
chSemWaitTimeout(&sem1, MS2ST(500));
|
||||||
}
|
}
|
||||||
|
test_assert(chSemGetCounter(&sem1) == 0, "non zero counter");
|
||||||
test_assert_sequence("ABCDE");
|
test_assert_sequence("ABCDE");
|
||||||
test_assert_time_window(target_time, target_time + ALLOWED_DELAY);
|
test_assert_time_window(target_time, target_time + ALLOWED_DELAY);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue