changed types irq_callback, hashtable, posix_io, s_display_flags, seq_buffer_entry, tcb, toprint to type_t"
This commit is contained in:
parent
e9d351da8d
commit
5abef6daf2
@ -57,7 +57,7 @@ void display_symbol(uint8_t symbol, uint8_t mode);
|
|||||||
* Global Variable section */
|
* Global Variable section */
|
||||||
|
|
||||||
/* Display flags */
|
/* Display flags */
|
||||||
volatile s_display_flags display;
|
volatile s_display_flags_t display;
|
||||||
|
|
||||||
/* Global return string for itoa function */
|
/* Global return string for itoa function */
|
||||||
char itoa_str[8];
|
char itoa_str[8];
|
||||||
|
|||||||
@ -67,9 +67,9 @@ typedef union {
|
|||||||
uint16_t update_acceleration : 1; // 1 = Acceleration data was updated
|
uint16_t update_acceleration : 1; // 1 = Acceleration data was updated
|
||||||
} flag;
|
} flag;
|
||||||
uint16_t all_flags; // Shortcut to all display flags (for reset)
|
uint16_t all_flags; // Shortcut to all display flags (for reset)
|
||||||
} s_display_flags;
|
} s_display_flags_t;
|
||||||
|
|
||||||
extern volatile s_display_flags display;
|
extern volatile s_display_flags_t display;
|
||||||
|
|
||||||
// Constants defined in library
|
// Constants defined in library
|
||||||
extern const uint8_t lcd_font[];
|
extern const uint8_t lcd_font[];
|
||||||
|
|||||||
@ -49,13 +49,13 @@ and the mailinglist (subscription via web site)
|
|||||||
* @note $Id$
|
* @note $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct toprint {
|
typedef struct toprint_t {
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
char content[];
|
char content[];
|
||||||
}toprint;
|
}toprint_t;
|
||||||
|
|
||||||
#define QUEUESIZE 255
|
#define QUEUESIZE 255
|
||||||
static volatile toprint* queue[QUEUESIZE];
|
static volatile toprint_t* queue[QUEUESIZE];
|
||||||
static volatile unsigned char queue_head = 0;
|
static volatile unsigned char queue_head = 0;
|
||||||
static volatile unsigned char queue_tail = 0;
|
static volatile unsigned char queue_tail = 0;
|
||||||
static volatile unsigned char queue_items = 0;
|
static volatile unsigned char queue_items = 0;
|
||||||
@ -64,7 +64,7 @@ static volatile unsigned int actual_pos = 0;
|
|||||||
static volatile unsigned int running = 0;
|
static volatile unsigned int running = 0;
|
||||||
static volatile unsigned int fifo = 0;
|
static volatile unsigned int fifo = 0;
|
||||||
|
|
||||||
static volatile toprint* actual = NULL;
|
static volatile toprint_t* actual = NULL;
|
||||||
|
|
||||||
static inline void enqueue(void) {
|
static inline void enqueue(void) {
|
||||||
queue_items++;
|
queue_items++;
|
||||||
|
|||||||
@ -24,13 +24,13 @@
|
|||||||
void sched_init();
|
void sched_init();
|
||||||
void sched_run();
|
void sched_run();
|
||||||
|
|
||||||
void sched_set_status(tcb *process, unsigned int status);
|
void sched_set_status(tcb_t *process, unsigned int status);
|
||||||
void sched_switch(uint16_t current_prio, uint16_t other_prio, int in_isr);
|
void sched_switch(uint16_t current_prio, uint16_t other_prio, int in_isr);
|
||||||
|
|
||||||
volatile unsigned int sched_context_switch_request;
|
volatile unsigned int sched_context_switch_request;
|
||||||
|
|
||||||
volatile tcb *sched_threads[MAXTHREADS];
|
volatile tcb_t *sched_threads[MAXTHREADS];
|
||||||
volatile tcb *active_thread;
|
volatile tcb_t *active_thread;
|
||||||
|
|
||||||
extern volatile int num_tasks;
|
extern volatile int num_tasks;
|
||||||
volatile int thread_pid;
|
volatile int thread_pid;
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
#define STATUS_REPLY_BLOCKED (0x0100)
|
#define STATUS_REPLY_BLOCKED (0x0100)
|
||||||
#define STATUS_TIMER_WAITING (0x0200)
|
#define STATUS_TIMER_WAITING (0x0200)
|
||||||
|
|
||||||
typedef struct tcb {
|
typedef struct tcb_t {
|
||||||
char* sp;
|
char* sp;
|
||||||
uint16_t status;
|
uint16_t status;
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ typedef struct tcb {
|
|||||||
const char* name;
|
const char* name;
|
||||||
char* stack_start;
|
char* stack_start;
|
||||||
int stack_size;
|
int stack_size;
|
||||||
} tcb;
|
} tcb_t;
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
#endif /* TCB_H_ */
|
#endif /* TCB_H_ */
|
||||||
|
|||||||
@ -33,8 +33,8 @@
|
|||||||
#define ENABLE_DEBUG
|
#define ENABLE_DEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
volatile tcb *sched_threads[MAXTHREADS];
|
volatile tcb_t *sched_threads[MAXTHREADS];
|
||||||
volatile tcb *active_thread;
|
volatile tcb_t *active_thread;
|
||||||
volatile int lpm_prevent_sleep = 0;
|
volatile int lpm_prevent_sleep = 0;
|
||||||
|
|
||||||
extern void main(void);
|
extern void main(void);
|
||||||
|
|||||||
20
core/msg.c
20
core/msg.c
@ -27,7 +27,7 @@
|
|||||||
//#define ENABLE_DEBUG
|
//#define ENABLE_DEBUG
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
static int queue_msg(tcb *target, msg_t *m) {
|
static int queue_msg(tcb_t *target, msg_t *m) {
|
||||||
int n = cib_put(&(target->msg_queue));
|
int n = cib_put(&(target->msg_queue));
|
||||||
|
|
||||||
if (n != -1) {
|
if (n != -1) {
|
||||||
@ -43,7 +43,7 @@ int msg_send(msg_t* m, unsigned int target_pid, bool block) {
|
|||||||
return msg_send_int(m, target_pid);
|
return msg_send_int(m, target_pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
tcb *target = (tcb*)sched_threads[target_pid];
|
tcb_t *target = (tcb_t*)sched_threads[target_pid];
|
||||||
|
|
||||||
m->sender_pid = thread_pid;
|
m->sender_pid = thread_pid;
|
||||||
if (m->sender_pid == target_pid) {
|
if (m->sender_pid == target_pid) {
|
||||||
@ -84,7 +84,7 @@ int msg_send(msg_t* m, unsigned int target_pid, bool block) {
|
|||||||
newstatus = STATUS_SEND_BLOCKED;
|
newstatus = STATUS_SEND_BLOCKED;
|
||||||
}
|
}
|
||||||
|
|
||||||
sched_set_status((tcb*)active_thread, newstatus);
|
sched_set_status((tcb_t*)active_thread, newstatus);
|
||||||
|
|
||||||
DEBUG("%s: back from send block.\n", active_thread->name);
|
DEBUG("%s: back from send block.\n", active_thread->name);
|
||||||
} else {
|
} else {
|
||||||
@ -102,7 +102,7 @@ int msg_send(msg_t* m, unsigned int target_pid, bool block) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int msg_send_int(msg_t* m, unsigned int target_pid) {
|
int msg_send_int(msg_t* m, unsigned int target_pid) {
|
||||||
tcb *target = (tcb*)sched_threads[target_pid];
|
tcb_t *target = (tcb_t*)sched_threads[target_pid];
|
||||||
|
|
||||||
if (target->status == STATUS_RECEIVE_BLOCKED) {
|
if (target->status == STATUS_RECEIVE_BLOCKED) {
|
||||||
DEBUG("msg_send_int: direct msg copy.\n");
|
DEBUG("msg_send_int: direct msg copy.\n");
|
||||||
@ -124,7 +124,7 @@ int msg_send_int(msg_t* m, unsigned int target_pid) {
|
|||||||
|
|
||||||
int msg_send_receive(msg_t *m, msg_t *reply, unsigned int target_pid) {
|
int msg_send_receive(msg_t *m, msg_t *reply, unsigned int target_pid) {
|
||||||
dINT();
|
dINT();
|
||||||
tcb *me = (tcb*) sched_threads[thread_pid];
|
tcb_t *me = (tcb_t*) sched_threads[thread_pid];
|
||||||
sched_set_status(me, STATUS_REPLY_BLOCKED);
|
sched_set_status(me, STATUS_REPLY_BLOCKED);
|
||||||
me->wait_data = (void*) reply;
|
me->wait_data = (void*) reply;
|
||||||
msg_send(m, target_pid, true);
|
msg_send(m, target_pid, true);
|
||||||
@ -137,7 +137,7 @@ int msg_send_receive(msg_t *m, msg_t *reply, unsigned int target_pid) {
|
|||||||
int msg_reply(msg_t *m, msg_t *reply) {
|
int msg_reply(msg_t *m, msg_t *reply) {
|
||||||
int state = disableIRQ();
|
int state = disableIRQ();
|
||||||
|
|
||||||
tcb *target = (tcb*)sched_threads[m->sender_pid];
|
tcb_t *target = (tcb_t*)sched_threads[m->sender_pid];
|
||||||
if (target->status != STATUS_REPLY_BLOCKED) {
|
if (target->status != STATUS_REPLY_BLOCKED) {
|
||||||
DEBUG("%s: msg_reply(): target \"%s\" not waiting for reply.", active_thread->name, target->name);
|
DEBUG("%s: msg_reply(): target \"%s\" not waiting for reply.", active_thread->name, target->name);
|
||||||
restoreIRQ(state);
|
restoreIRQ(state);
|
||||||
@ -156,7 +156,7 @@ int msg_reply(msg_t *m, msg_t *reply) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int msg_reply_int(msg_t *m, msg_t *reply) {
|
int msg_reply_int(msg_t *m, msg_t *reply) {
|
||||||
tcb *target = (tcb*)sched_threads[m->sender_pid];
|
tcb_t *target = (tcb_t*)sched_threads[m->sender_pid];
|
||||||
if (target->status != STATUS_REPLY_BLOCKED) {
|
if (target->status != STATUS_REPLY_BLOCKED) {
|
||||||
DEBUG("%s: msg_reply_int(): target \"%s\" not waiting for reply.", active_thread->name, target->name);
|
DEBUG("%s: msg_reply_int(): target \"%s\" not waiting for reply.", active_thread->name, target->name);
|
||||||
return -1;
|
return -1;
|
||||||
@ -172,7 +172,7 @@ int msg_receive(msg_t* m) {
|
|||||||
dINT();
|
dINT();
|
||||||
DEBUG("%s: msg_receive.\n", active_thread->name);
|
DEBUG("%s: msg_receive.\n", active_thread->name);
|
||||||
|
|
||||||
tcb *me = (tcb*) sched_threads[thread_pid];
|
tcb_t *me = (tcb_t*) sched_threads[thread_pid];
|
||||||
|
|
||||||
int n = -1;
|
int n = -1;
|
||||||
if (me->msg_array) {
|
if (me->msg_array) {
|
||||||
@ -202,7 +202,7 @@ int msg_receive(msg_t* m) {
|
|||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
DEBUG("%s: msg_receive(): Wakeing up waiting thread.\n", active_thread->name);
|
DEBUG("%s: msg_receive(): Wakeing up waiting thread.\n", active_thread->name);
|
||||||
tcb *sender = (tcb*)node->data;
|
tcb_t *sender = (tcb_t*)node->data;
|
||||||
|
|
||||||
if (n >= 0) {
|
if (n >= 0) {
|
||||||
/* we've already got a messgage from the queue. as there is a
|
/* we've already got a messgage from the queue. as there is a
|
||||||
@ -227,7 +227,7 @@ int msg_receive(msg_t* m) {
|
|||||||
int msg_init_queue(msg_t* array, int num) {
|
int msg_init_queue(msg_t* array, int num) {
|
||||||
/* make sure brainfuck condition is met */
|
/* make sure brainfuck condition is met */
|
||||||
if (num && (num & (num - 1)) == 0) {
|
if (num && (num & (num - 1)) == 0) {
|
||||||
tcb *me = (tcb*)active_thread;
|
tcb_t *me = (tcb_t*)active_thread;
|
||||||
me->msg_array = array;
|
me->msg_array = array;
|
||||||
cib_init(&(me->msg_queue), num);
|
cib_init(&(me->msg_queue), num);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -61,7 +61,7 @@ void mutex_wait(struct mutex_t *mutex) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sched_set_status((tcb*)active_thread, STATUS_MUTEX_BLOCKED);
|
sched_set_status((tcb_t*)active_thread, STATUS_MUTEX_BLOCKED);
|
||||||
|
|
||||||
queue_node_t n;
|
queue_node_t n;
|
||||||
n.priority = (unsigned int) active_thread->priority;
|
n.priority = (unsigned int) active_thread->priority;
|
||||||
@ -86,7 +86,7 @@ void mutex_unlock(struct mutex_t* mutex, int yield) {
|
|||||||
if (mutex->val != 0) {
|
if (mutex->val != 0) {
|
||||||
if (mutex->queue.next) {
|
if (mutex->queue.next) {
|
||||||
queue_node_t *next = queue_remove_head(&(mutex->queue));
|
queue_node_t *next = queue_remove_head(&(mutex->queue));
|
||||||
tcb* process = (tcb*)next->data;
|
tcb_t* process = (tcb_t*)next->data;
|
||||||
DEBUG("%s: waking up waiter %s.\n", process->name);
|
DEBUG("%s: waking up waiter %s.\n", process->name);
|
||||||
sched_set_status(process, STATUS_PENDING);
|
sched_set_status(process, STATUS_PENDING);
|
||||||
|
|
||||||
|
|||||||
14
core/sched.c
14
core/sched.c
@ -56,7 +56,7 @@ void sched_init() {
|
|||||||
void sched_run() {
|
void sched_run() {
|
||||||
sched_context_switch_request = 0;
|
sched_context_switch_request = 0;
|
||||||
|
|
||||||
tcb *my_active_thread = (tcb*)active_thread;
|
tcb_t *my_active_thread = (tcb_t*)active_thread;
|
||||||
|
|
||||||
if (my_active_thread) {
|
if (my_active_thread) {
|
||||||
if( my_active_thread->status == STATUS_RUNNING) {
|
if( my_active_thread->status == STATUS_RUNNING) {
|
||||||
@ -94,9 +94,9 @@ void sched_run() {
|
|||||||
// if (runqueues[i]) {
|
// if (runqueues[i]) {
|
||||||
int nextrq = number_of_lowest_bit(runqueue_bitcache);
|
int nextrq = number_of_lowest_bit(runqueue_bitcache);
|
||||||
clist_node_t next = *(runqueues[nextrq]);
|
clist_node_t next = *(runqueues[nextrq]);
|
||||||
DEBUG("scheduler: first in queue: %s\n", ((tcb*)next.data)->name);
|
DEBUG("scheduler: first in queue: %s\n", ((tcb_t*)next.data)->name);
|
||||||
clist_advance(&(runqueues[nextrq]));
|
clist_advance(&(runqueues[nextrq]));
|
||||||
my_active_thread = (tcb*)next.data;
|
my_active_thread = (tcb_t*)next.data;
|
||||||
thread_pid = (volatile int) my_active_thread->pid;
|
thread_pid = (volatile int) my_active_thread->pid;
|
||||||
#if SCHEDSTATISTICS
|
#if SCHEDSTATISTICS
|
||||||
pidlist[my_active_thread->pid].laststart = time;
|
pidlist[my_active_thread->pid].laststart = time;
|
||||||
@ -115,16 +115,16 @@ void sched_run() {
|
|||||||
active_thread->status = STATUS_PENDING ;
|
active_thread->status = STATUS_PENDING ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sched_set_status((tcb*)my_active_thread, STATUS_RUNNING);
|
sched_set_status((tcb_t*)my_active_thread, STATUS_RUNNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
active_thread = (volatile tcb*) my_active_thread;
|
active_thread = (volatile tcb_t*) my_active_thread;
|
||||||
|
|
||||||
DEBUG("scheduler: done.\n");
|
DEBUG("scheduler: done.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void sched_set_status(tcb *process, unsigned int status) {
|
void sched_set_status(tcb_t *process, unsigned int status) {
|
||||||
if (status & STATUS_ON_RUNQUEUE) {
|
if (status & STATUS_ON_RUNQUEUE) {
|
||||||
if (! (process->status & STATUS_ON_RUNQUEUE)) {
|
if (! (process->status & STATUS_ON_RUNQUEUE)) {
|
||||||
DEBUG("adding process %s to runqueue %u.\n", process->name, process->priority);
|
DEBUG("adding process %s to runqueue %u.\n", process->name, process->priority);
|
||||||
@ -163,7 +163,7 @@ void sched_task_exit(void) {
|
|||||||
sched_threads[active_thread->pid] = NULL;
|
sched_threads[active_thread->pid] = NULL;
|
||||||
num_tasks--;
|
num_tasks--;
|
||||||
|
|
||||||
sched_set_status((tcb*)active_thread, STATUS_STOPPED);
|
sched_set_status((tcb_t*)active_thread, STATUS_STOPPED);
|
||||||
|
|
||||||
active_thread = NULL;
|
active_thread = NULL;
|
||||||
cpu_switch_context_exit();
|
cpu_switch_context_exit();
|
||||||
|
|||||||
@ -39,7 +39,7 @@ unsigned int thread_getstatus(int pid) {
|
|||||||
void thread_sleep() {
|
void thread_sleep() {
|
||||||
if ( inISR()) return;
|
if ( inISR()) return;
|
||||||
dINT();
|
dINT();
|
||||||
sched_set_status((tcb*)active_thread, STATUS_SLEEPING);
|
sched_set_status((tcb_t*)active_thread, STATUS_SLEEPING);
|
||||||
thread_yield();
|
thread_yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ int thread_wakeup(int pid) {
|
|||||||
int result = sched_threads[pid]->status;
|
int result = sched_threads[pid]->status;
|
||||||
if (result == STATUS_SLEEPING) {
|
if (result == STATUS_SLEEPING) {
|
||||||
DEBUG("thread_wakeup: Thread is sleeping.\n");
|
DEBUG("thread_wakeup: Thread is sleeping.\n");
|
||||||
sched_set_status((tcb*)sched_threads[pid], STATUS_RUNNING);
|
sched_set_status((tcb_t*)sched_threads[pid], STATUS_RUNNING);
|
||||||
if (!isr) {
|
if (!isr) {
|
||||||
eINT();
|
eINT();
|
||||||
thread_yield();
|
thread_yield();
|
||||||
@ -83,7 +83,7 @@ int thread_create(char *stack, int stacksize, char priority, int flags, void (*f
|
|||||||
{
|
{
|
||||||
/* allocate our thread control block at the top of our stackspace */
|
/* allocate our thread control block at the top of our stackspace */
|
||||||
int total_stacksize = stacksize;
|
int total_stacksize = stacksize;
|
||||||
stacksize -= sizeof(tcb);
|
stacksize -= sizeof(tcb_t);
|
||||||
|
|
||||||
/* align tcb address on 32bit boundary */
|
/* align tcb address on 32bit boundary */
|
||||||
unsigned int tcb_address = (unsigned int) stack + stacksize;
|
unsigned int tcb_address = (unsigned int) stack + stacksize;
|
||||||
@ -95,7 +95,7 @@ int thread_create(char *stack, int stacksize, char priority, int flags, void (*f
|
|||||||
tcb_address-=2;
|
tcb_address-=2;
|
||||||
stacksize-=2;
|
stacksize-=2;
|
||||||
}
|
}
|
||||||
tcb *cb = (tcb*) tcb_address;
|
tcb_t *cb = (tcb_t*) tcb_address;
|
||||||
|
|
||||||
if (priority >= SCHED_PRIO_LEVELS) {
|
if (priority >= SCHED_PRIO_LEVELS) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|||||||
@ -48,12 +48,12 @@ and the mailinglist (subscription via web site)
|
|||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include <irq.h>
|
#include <irq.h>
|
||||||
|
|
||||||
struct irq_callback {
|
struct irq_callback_t {
|
||||||
fp_irqcb callback;
|
fp_irqcb callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct irq_callback gpioint0[32];
|
static struct irq_callback_t gpioint0[32];
|
||||||
static struct irq_callback gpioint2[32];
|
static struct irq_callback_t gpioint2[32];
|
||||||
|
|
||||||
|
|
||||||
void gpioint_init(void) {
|
void gpioint_init(void) {
|
||||||
@ -68,7 +68,7 @@ void gpioint_init(void) {
|
|||||||
bool
|
bool
|
||||||
gpioint_set(int port, uint32_t bitmask, int flags, fp_irqcb callback)
|
gpioint_set(int port, uint32_t bitmask, int flags, fp_irqcb callback)
|
||||||
{
|
{
|
||||||
struct irq_callback* cbdata;
|
struct irq_callback_t* cbdata;
|
||||||
unsigned long bit;
|
unsigned long bit;
|
||||||
volatile unsigned long* en_f;
|
volatile unsigned long* en_f;
|
||||||
volatile unsigned long* en_r;
|
volatile unsigned long* en_r;
|
||||||
@ -123,7 +123,7 @@ gpioint_set(int port, uint32_t bitmask, int flags, fp_irqcb callback)
|
|||||||
return true; // success
|
return true; // success
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void __attribute__ ((__no_instrument_function__)) test_irq(int port, unsigned long f_mask, unsigned long r_mask, struct irq_callback* pcb)
|
static void __attribute__ ((__no_instrument_function__)) test_irq(int port, unsigned long f_mask, unsigned long r_mask, struct irq_callback_t* pcb)
|
||||||
{
|
{
|
||||||
/* Test each bit of rising and falling masks, if set trigger interrupt
|
/* Test each bit of rising and falling masks, if set trigger interrupt
|
||||||
* on corresponding device */
|
* on corresponding device */
|
||||||
|
|||||||
@ -119,10 +119,10 @@ typedef struct
|
|||||||
uint64_t m_ticks; ///< 64-bit timestamp
|
uint64_t m_ticks; ///< 64-bit timestamp
|
||||||
uint8_t source; ///< Source address
|
uint8_t source; ///< Source address
|
||||||
uint8_t identification; ///< Identification (1-bit)
|
uint8_t identification; ///< Identification (1-bit)
|
||||||
} seq_buffer_entry;
|
} seq_buffer_entry_t;
|
||||||
|
|
||||||
/// Sequence number buffer for this layer
|
/// Sequence number buffer for this layer
|
||||||
static seq_buffer_entry seq_buffer[MAX_SEQ_BUFFER_SIZE];
|
static seq_buffer_entry_t seq_buffer[MAX_SEQ_BUFFER_SIZE];
|
||||||
|
|
||||||
/// Next position to enter a new value into ::seqBuffer
|
/// Next position to enter a new value into ::seqBuffer
|
||||||
static uint8_t seq_buffer_pos = 0;
|
static uint8_t seq_buffer_pos = 0;
|
||||||
@ -186,7 +186,7 @@ void cc1100_phy_init()
|
|||||||
pm_init_table((pm_table_t*)&handler_table, MAX_PACKET_HANDLERS, handlers);
|
pm_init_table((pm_table_t*)&handler_table, MAX_PACKET_HANDLERS, handlers);
|
||||||
|
|
||||||
// Clear sequence number buffer
|
// Clear sequence number buffer
|
||||||
memset(seq_buffer, 0, sizeof(seq_buffer_entry) * MAX_SEQ_BUFFER_SIZE);
|
memset(seq_buffer, 0, sizeof(seq_buffer_entry_t) * MAX_SEQ_BUFFER_SIZE);
|
||||||
|
|
||||||
// Initialize mutex
|
// Initialize mutex
|
||||||
cc1100_mutex_pid = -1;
|
cc1100_mutex_pid = -1;
|
||||||
|
|||||||
@ -22,7 +22,7 @@ void chardev_loop(ringbuffer_t *rb) {
|
|||||||
int pid = thread_getpid();
|
int pid = thread_getpid();
|
||||||
|
|
||||||
int reader_pid = -1;
|
int reader_pid = -1;
|
||||||
struct posix_iop *r = NULL;
|
struct posix_iop_t *r = NULL;
|
||||||
|
|
||||||
puts("UART0 thread started.");
|
puts("UART0 thread started.");
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ void chardev_loop(ringbuffer_t *rb) {
|
|||||||
m.content.value = -EINVAL;
|
m.content.value = -EINVAL;
|
||||||
msg_reply(&m, &m);
|
msg_reply(&m, &m);
|
||||||
} else {
|
} else {
|
||||||
r = (struct posix_iop *)m.content.ptr;
|
r = (struct posix_iop_t *)m.content.ptr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CLOSE:
|
case CLOSE:
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
#define READ 2
|
#define READ 2
|
||||||
#define WRITE 3
|
#define WRITE 3
|
||||||
|
|
||||||
struct posix_iop {
|
struct posix_iop_t {
|
||||||
int nbytes;
|
int nbytes;
|
||||||
char *buffer;
|
char *buffer;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -12,7 +12,7 @@ static int _posix_fileop(int pid, int op, int flags) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int _posix_fileop_data(int pid, int op, char* buffer, int nbytes) {
|
static int _posix_fileop_data(int pid, int op, char* buffer, int nbytes) {
|
||||||
struct posix_iop r;
|
struct posix_iop_t r;
|
||||||
r.nbytes = nbytes;
|
r.nbytes = nbytes;
|
||||||
r.buffer = buffer;
|
r.buffer = buffer;
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ void thread_print_all(void)
|
|||||||
|
|
||||||
printf("\tpid | %-21s| %-9sQ | pri | stack ( used) location | runtime | switches \n", "name", "state");
|
printf("\tpid | %-21s| %-9sQ | pri | stack ( used) location | runtime | switches \n", "name", "state");
|
||||||
for( i = 0; i < MAXTHREADS; i++ ) {
|
for( i = 0; i < MAXTHREADS; i++ ) {
|
||||||
tcb* p = (tcb*)sched_threads[i];
|
tcb_t* p = (tcb_t*)sched_threads[i];
|
||||||
|
|
||||||
if( p != NULL ) {
|
if( p != NULL ) {
|
||||||
int state = p->status; // copy state
|
int state = p->status; // copy state
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user