Browse Source

changed types irq_callback, hashtable, posix_io, s_display_flags, seq_buffer_entry, tcb, toprint to type_t"

dev/timer
Stephan Zeisberg 12 years ago
parent
commit
5abef6daf2
  1. 2
      board/chronos/drivers/display.c
  2. 4
      board/chronos/drivers/include/display.h
  3. 8
      board/msba2-common/drivers/msba2-uart0.c
  4. 6
      core/include/sched.h
  5. 4
      core/include/tcb.h
  6. 4
      core/kernel_init.c
  7. 20
      core/msg.c
  8. 4
      core/mutex.c
  9. 14
      core/sched.c
  10. 8
      core/thread.c
  11. 10
      cpu/lpc2387/lpc2387-gpioint.c
  12. 6
      drivers/cc110x/cc1100_phy.c
  13. 4
      sys/chardev_thread.c
  14. 2
      sys/include/posix_io.h
  15. 2
      sys/posix_io.c
  16. 2
      sys/shell/ps.c

2
board/chronos/drivers/display.c

@ -57,7 +57,7 @@ void display_symbol(uint8_t symbol, uint8_t mode);
* Global Variable section */
/* Display flags */
volatile s_display_flags display;
volatile s_display_flags_t display;
/* Global return string for itoa function */
char itoa_str[8];

4
board/chronos/drivers/include/display.h

@ -67,9 +67,9 @@ typedef union {
uint16_t update_acceleration : 1; // 1 = Acceleration data was updated
} flag;
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
extern const uint8_t lcd_font[];

8
board/msba2-common/drivers/msba2-uart0.c

@ -49,13 +49,13 @@ and the mailinglist (subscription via web site)
* @note $Id$
*/
typedef struct toprint {
typedef struct toprint_t {
unsigned int len;
char content[];
}toprint;
}toprint_t;
#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_tail = 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 fifo = 0;
static volatile toprint* actual = NULL;
static volatile toprint_t* actual = NULL;
static inline void enqueue(void) {
queue_items++;

6
core/include/sched.h

@ -24,13 +24,13 @@
void sched_init();
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);
volatile unsigned int sched_context_switch_request;
volatile tcb *sched_threads[MAXTHREADS];
volatile tcb *active_thread;
volatile tcb_t *sched_threads[MAXTHREADS];
volatile tcb_t *active_thread;
extern volatile int num_tasks;
volatile int thread_pid;

4
core/include/tcb.h

@ -35,7 +35,7 @@
#define STATUS_REPLY_BLOCKED (0x0100)
#define STATUS_TIMER_WAITING (0x0200)
typedef struct tcb {
typedef struct tcb_t {
char* sp;
uint16_t status;
@ -53,7 +53,7 @@ typedef struct tcb {
const char* name;
char* stack_start;
int stack_size;
} tcb;
} tcb_t;
/** @} */
#endif /* TCB_H_ */

4
core/kernel_init.c

@ -33,8 +33,8 @@
#define ENABLE_DEBUG
#include <debug.h>
volatile tcb *sched_threads[MAXTHREADS];
volatile tcb *active_thread;
volatile tcb_t *sched_threads[MAXTHREADS];
volatile tcb_t *active_thread;
volatile int lpm_prevent_sleep = 0;
extern void main(void);

20
core/msg.c

@ -27,7 +27,7 @@
//#define ENABLE_DEBUG
#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));
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);
}
tcb *target = (tcb*)sched_threads[target_pid];
tcb_t *target = (tcb_t*)sched_threads[target_pid];
m->sender_pid = thread_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;
}
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);
} 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) {
tcb *target = (tcb*)sched_threads[target_pid];
tcb_t *target = (tcb_t*)sched_threads[target_pid];
if (target->status == STATUS_RECEIVE_BLOCKED) {
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) {
dINT();
tcb *me = (tcb*) sched_threads[thread_pid];
tcb_t *me = (tcb_t*) sched_threads[thread_pid];
sched_set_status(me, STATUS_REPLY_BLOCKED);
me->wait_data = (void*) reply;
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 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) {
DEBUG("%s: msg_reply(): target \"%s\" not waiting for reply.", active_thread->name, target->name);
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) {
tcb *target = (tcb*)sched_threads[m->sender_pid];
tcb_t *target = (tcb_t*)sched_threads[m->sender_pid];
if (target->status != STATUS_REPLY_BLOCKED) {
DEBUG("%s: msg_reply_int(): target \"%s\" not waiting for reply.", active_thread->name, target->name);
return -1;
@ -172,7 +172,7 @@ int msg_receive(msg_t* m) {
dINT();
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;
if (me->msg_array) {
@ -202,7 +202,7 @@ int msg_receive(msg_t* m) {
return 1;
} else {
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) {
/* 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) {
/* make sure brainfuck condition is met */
if (num && (num & (num - 1)) == 0) {
tcb *me = (tcb*)active_thread;
tcb_t *me = (tcb_t*)active_thread;
me->msg_array = array;
cib_init(&(me->msg_queue), num);
return 0;

4
core/mutex.c

@ -61,7 +61,7 @@ void mutex_wait(struct mutex_t *mutex) {
return;
}
sched_set_status((tcb*)active_thread, STATUS_MUTEX_BLOCKED);
sched_set_status((tcb_t*)active_thread, STATUS_MUTEX_BLOCKED);
queue_node_t n;
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->queue.next) {
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);
sched_set_status(process, STATUS_PENDING);

14
core/sched.c

@ -56,7 +56,7 @@ void sched_init() {
void sched_run() {
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->status == STATUS_RUNNING) {
@ -94,9 +94,9 @@ void sched_run() {
// if (runqueues[i]) {
int nextrq = number_of_lowest_bit(runqueue_bitcache);
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]));
my_active_thread = (tcb*)next.data;
my_active_thread = (tcb_t*)next.data;
thread_pid = (volatile int) my_active_thread->pid;
#if SCHEDSTATISTICS
pidlist[my_active_thread->pid].laststart = time;
@ -115,16 +115,16 @@ void sched_run() {
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");
}
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 (! (process->status & STATUS_ON_RUNQUEUE)) {
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;
num_tasks--;
sched_set_status((tcb*)active_thread, STATUS_STOPPED);
sched_set_status((tcb_t*)active_thread, STATUS_STOPPED);
active_thread = NULL;
cpu_switch_context_exit();

8
core/thread.c

@ -39,7 +39,7 @@ unsigned int thread_getstatus(int pid) {
void thread_sleep() {
if ( inISR()) return;
dINT();
sched_set_status((tcb*)active_thread, STATUS_SLEEPING);
sched_set_status((tcb_t*)active_thread, STATUS_SLEEPING);
thread_yield();
}
@ -54,7 +54,7 @@ int thread_wakeup(int pid) {
int result = sched_threads[pid]->status;
if (result == STATUS_SLEEPING) {
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) {
eINT();
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 */
int total_stacksize = stacksize;
stacksize -= sizeof(tcb);
stacksize -= sizeof(tcb_t);
/* align tcb address on 32bit boundary */
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;
stacksize-=2;
}
tcb *cb = (tcb*) tcb_address;
tcb_t *cb = (tcb_t*) tcb_address;
if (priority >= SCHED_PRIO_LEVELS) {
return -EINVAL;

10
cpu/lpc2387/lpc2387-gpioint.c

@ -48,12 +48,12 @@ and the mailinglist (subscription via web site)
#include "cpu.h"
#include <irq.h>
struct irq_callback {
struct irq_callback_t {
fp_irqcb callback;
};
static struct irq_callback gpioint0[32];
static struct irq_callback gpioint2[32];
static struct irq_callback_t gpioint0[32];
static struct irq_callback_t gpioint2[32];
void gpioint_init(void) {
@ -68,7 +68,7 @@ void gpioint_init(void) {
bool
gpioint_set(int port, uint32_t bitmask, int flags, fp_irqcb callback)
{
struct irq_callback* cbdata;
struct irq_callback_t* cbdata;
unsigned long bit;
volatile unsigned long* en_f;
volatile unsigned long* en_r;
@ -123,7 +123,7 @@ gpioint_set(int port, uint32_t bitmask, int flags, fp_irqcb callback)
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
* on corresponding device */

6
drivers/cc110x/cc1100_phy.c

@ -119,10 +119,10 @@ typedef struct
uint64_t m_ticks; ///< 64-bit timestamp
uint8_t source; ///< Source address
uint8_t identification; ///< Identification (1-bit)
} seq_buffer_entry;
} seq_buffer_entry_t;
/// 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
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);
// 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
cc1100_mutex_pid = -1;

4
sys/chardev_thread.c

@ -22,7 +22,7 @@ void chardev_loop(ringbuffer_t *rb) {
int pid = thread_getpid();
int reader_pid = -1;
struct posix_iop *r = NULL;
struct posix_iop_t *r = NULL;
puts("UART0 thread started.");
@ -46,7 +46,7 @@ void chardev_loop(ringbuffer_t *rb) {
m.content.value = -EINVAL;
msg_reply(&m, &m);
} else {
r = (struct posix_iop *)m.content.ptr;
r = (struct posix_iop_t *)m.content.ptr;
}
break;
case CLOSE:

2
sys/include/posix_io.h

@ -6,7 +6,7 @@
#define READ 2
#define WRITE 3
struct posix_iop {
struct posix_iop_t {
int nbytes;
char *buffer;
};

2
sys/posix_io.c

@ -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) {
struct posix_iop r;
struct posix_iop_t r;
r.nbytes = nbytes;
r.buffer = buffer;

2
sys/shell/ps.c

@ -27,7 +27,7 @@ void thread_print_all(void)
printf("\tpid | %-21s| %-9sQ | pri | stack ( used) location | runtime | switches \n", "name", "state");
for( i = 0; i < MAXTHREADS; i++ ) {
tcb* p = (tcb*)sched_threads[i];
tcb_t* p = (tcb_t*)sched_threads[i];
if( p != NULL ) {
int state = p->status; // copy state

Loading…
Cancel
Save