add CHOPSTX_THREAD_SIZE
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
2013-06-19 Niibe Yutaka <gniibe@fsij.org>
|
||||
|
||||
* chopstx.h (CHOPSTX_THREAD_SIZE): New.
|
||||
|
||||
* rules.mk (CSRC): Add eventflag.c.
|
||||
* eventflag.h, eventflag.c: New.
|
||||
|
||||
|
||||
@@ -840,6 +840,8 @@ chx_mutex_unlock (chopstx_mutex_t *mutex)
|
||||
|
||||
typedef void *(voidfunc) (void *);
|
||||
|
||||
extern void cause_link_time_error_unexpected_size_of_struct_chx_thread (void);
|
||||
|
||||
/**
|
||||
* chopstx_create - Create a thread
|
||||
* @flags_and_prio: Flags and priority
|
||||
@@ -860,6 +862,9 @@ chopstx_create (uint32_t flags_and_prio,
|
||||
struct chx_stack_regs *p;
|
||||
chopstx_prio_t prio = (flags_and_prio & CHOPSTX_PRIO_MASK);
|
||||
|
||||
if (CHOPSTX_THREAD_SIZE != sizeof(struct chx_thread))
|
||||
cause_link_time_error_unexpected_size_of_struct_chx_thread ();
|
||||
|
||||
if (stack_size < sizeof (struct chx_thread) + 8 * sizeof (uint32_t))
|
||||
chx_fatal (CHOPSTX_ERR_THREAD_CREATE);
|
||||
|
||||
|
||||
@@ -130,3 +130,5 @@ void chopstx_cleanup_pop (int execute);
|
||||
|
||||
|
||||
void chopstx_wakeup_usec_wait (chopstx_t thd);
|
||||
|
||||
#define CHOPSTX_THREAD_SIZE 60
|
||||
|
||||
6
entry.c
6
entry.c
@@ -28,6 +28,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <chopstx.h>
|
||||
|
||||
#ifdef HAVE_SYS_H
|
||||
#define INLINE __attribute__ ((used))
|
||||
@@ -246,6 +247,9 @@ static void none (void)
|
||||
{
|
||||
}
|
||||
|
||||
#define C_S_SUB(arg0, arg1, arg2) arg0 #arg1 arg2
|
||||
#define COMPOSE_STATEMENT(arg0,arg1,arg2) C_S_SUB (arg0, arg1, arg2)
|
||||
|
||||
/*
|
||||
* This routine only changes PSP and not MSP.
|
||||
*/
|
||||
@@ -276,7 +280,7 @@ void entry (void)
|
||||
"3:\n\t"
|
||||
/* Switch to PSP. */
|
||||
"ldr r0, =__process0_stack_end__\n\t"
|
||||
"sub r0, #60\n\t" /* Size of struct chx_thread. */
|
||||
COMPOSE_STATEMENT ("sub r0, #", CHOPSTX_THREAD_SIZE, "\n\t")
|
||||
"msr PSP, r0\n\t" /* Process (main routine) stack. */
|
||||
"mov r1, #2\n\t"
|
||||
"msr CONTROL, r1\n\t"
|
||||
|
||||
Reference in New Issue
Block a user