1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

initialize kernel_pid_t correctly

This commit is contained in:
Oleg Hahm 2014-08-06 09:44:31 +02:00
parent c2b0423918
commit aa2ecf6216
28 changed files with 39 additions and 39 deletions

View File

@ -44,7 +44,7 @@
#include "lpc2387.h" #include "lpc2387.h"
kernel_pid_t simple_pid; kernel_pid_t simple_pid = KERNEL_PID_UNDEF;
int16_t simple_buffer[4]; int16_t simple_buffer[4];
volatile int16_t *ringBuff_X = NULL; volatile int16_t *ringBuff_X = NULL;

View File

@ -68,7 +68,7 @@ interrupt(USART1RX_VECTOR) usart0irq(void)
(void) c; (void) c;
} }
#ifdef MODULE_UART0 #ifdef MODULE_UART0
else if (uart0_handler_pid) { else if (uart0_handler_pid != KERNEL_PID_UNDEF) {
volatile int c = U1RXBUF; volatile int c = U1RXBUF;
uart0_handle_incoming(c); uart0_handle_incoming(c);
uart0_notify_thread(); uart0_notify_thread();

View File

@ -128,7 +128,7 @@ void UART0_IRQHandler(void)
case UIIR_CTI_INT: // Character Timeout Indicator case UIIR_CTI_INT: // Character Timeout Indicator
case UIIR_RDA_INT: // Receive Data Available case UIIR_RDA_INT: // Receive Data Available
#ifdef MODULE_UART0 #ifdef MODULE_UART0
if (uart0_handler_pid) { if (uart0_handler_pid != KERNEL_PID_UNDEF) {
do { do {
int c = U0RBR; int c = U0RBR;
uart0_handle_incoming(c); uart0_handle_incoming(c);

View File

@ -17,7 +17,7 @@ void uart1_isr(void)
if (UART1->USTATbits.RXRDY == 1) { if (UART1->USTATbits.RXRDY == 1) {
#ifdef MODULE_UART0 #ifdef MODULE_UART0
if (uart0_handler_pid) { if (uart0_handler_pid != KERNEL_PID_UNDEF) {
uint32_t i = 0; uint32_t i = 0;
while (UART1->RXCON != 0) { while (UART1->RXCON != 0) {
uart0_handle_incoming(UART1->DATA); uart0_handle_incoming(UART1->DATA);

View File

@ -17,7 +17,7 @@ void uart2_isr(void)
if (UART2->USTATbits.RXRDY == 1) { if (UART2->USTATbits.RXRDY == 1) {
#ifdef MODULE_UART0 #ifdef MODULE_UART0
if (uart0_handler_pid) { if (uart0_handler_pid != KERNEL_PID_UNDEF) {
uint32_t i = 0; uint32_t i = 0;
while (UART2->RXCON != 0) { while (UART2->RXCON != 0) {
uart0_handle_incoming(UART2->DATA); uart0_handle_incoming(UART2->DATA);

View File

@ -107,7 +107,7 @@ interrupt(USART1RX_VECTOR) usart1irq(void)
} }
#ifdef MODULE_UART0 #ifdef MODULE_UART0
else if (uart0_handler_pid) { else if (uart0_handler_pid != KERNEL_PID_UNDEF) {
volatile int c = U1RXBUF; volatile int c = U1RXBUF;
uart0_handle_incoming(c); uart0_handle_incoming(c);
uart0_notify_thread(); uart0_notify_thread();

View File

@ -54,7 +54,7 @@ interrupt(USART0RX_VECTOR) usart0irq(void) {
dummy = U0RXBUF; dummy = U0RXBUF;
} }
#ifdef MODULE_UART0 #ifdef MODULE_UART0
else if (uart0_handler_pid) { else if (uart0_handler_pid != KERNEL_PID_UNDEF) {
dummy = U0RXBUF; dummy = U0RXBUF;
uart0_handle_incoming(dummy); uart0_handle_incoming(dummy);
uart0_notify_thread(); uart0_notify_thread();

View File

@ -122,7 +122,7 @@ interrupt(USCIAB0RX_VECTOR) __attribute__ ((naked)) usart1irq(void)
/* Clear error flags by forcing a dummy read. */ /* Clear error flags by forcing a dummy read. */
c = UCA0RXBUF; c = UCA0RXBUF;
#ifdef MODULE_UART0 #ifdef MODULE_UART0
} else if (uart0_handler_pid) { } else if (uart0_handler_pid != KERNEL_PID_UNDEF) {
/* All went well -> let's signal the reception to adequate callbacks */ /* All went well -> let's signal the reception to adequate callbacks */
c = UCA0RXBUF; c = UCA0RXBUF;
uart0_handle_incoming(c); uart0_handle_incoming(c);

View File

@ -26,7 +26,7 @@ directory for more details.
//static volatile time_t epoch; //static volatile time_t epoch;
static struct tm time_to_set; static struct tm time_to_set;
static int set_time = 0; static int set_time = 0;
kernel_pid_t rtc_second_pid = 0; kernel_pid_t rtc_second_pid = KERNEL_PID_UNDEF;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void rtc_init(void) void rtc_init(void)
@ -195,7 +195,7 @@ interrupt(RTC_VECTOR) __attribute__((naked)) rtc_isr(void)
RTCYEARH = (time_to_set.tm_year + 1900) >> 0x08; RTCYEARH = (time_to_set.tm_year + 1900) >> 0x08;
} }
if (rtc_second_pid) { if (rtc_second_pid != KERNEL_PID_UNDEF) {
static msg_t m; static msg_t m;
m.type = RTC_SECOND; m.type = RTC_SECOND;
msg_send_int(&m, rtc_second_pid); msg_send_int(&m, rtc_second_pid);

View File

@ -45,7 +45,7 @@ static volatile uint8_t rx_buffer_next;
uint8_t _native_net_chan; uint8_t _native_net_chan;
uint16_t _native_net_pan; uint16_t _native_net_pan;
uint8_t _native_net_monitor; uint8_t _native_net_monitor;
static int _native_net_tpid; static kernel_pid_t _native_net_tpid = KERNEL_PID_UNDEF;
radio_address_t _native_net_addr; radio_address_t _native_net_addr;
uint64_t _native_net_addr_long; uint64_t _native_net_addr_long;
@ -203,7 +203,7 @@ void _nativenet_handle_packet(radio_packet_t *packet)
_nativenet_rx_buffer[rx_buffer_next].packet.data = (uint8_t *) &_nativenet_rx_buffer[rx_buffer_next].data; _nativenet_rx_buffer[rx_buffer_next].packet.data = (uint8_t *) &_nativenet_rx_buffer[rx_buffer_next].data;
/* notify transceiver thread if any */ /* notify transceiver thread if any */
if (_native_net_tpid) { if (_native_net_tpid != KERNEL_PID_UNDEF) {
DEBUG("_nativenet_handle_packet: notifying transceiver thread!\n"); DEBUG("_nativenet_handle_packet: notifying transceiver thread!\n");
msg_t m; msg_t m;
m.type = (uint16_t) RCV_PKT_NATIVE; m.type = (uint16_t) RCV_PKT_NATIVE;

View File

@ -42,7 +42,7 @@
static bool valid; static bool valid;
static int32_t alarm_msg_content, periodic_msg_content, update_msg_content; static int32_t alarm_msg_content, periodic_msg_content, update_msg_content;
static unsigned alarm_pid = KERNEL_PID_UNDEF, periodic_pid = KERNEL_PID_NULL, update_pid = KERNEL_PID_NULL; static unsigned alarm_pid = KERNEL_PID_UNDEF, periodic_pid = KERNEL_PID_UNDEF, update_pid = KERNEL_PID_UNDEF;
static void alarm_callback_default(uint8_t reg_c) static void alarm_callback_default(uint8_t reg_c)
{ {

View File

@ -47,7 +47,7 @@ char relay_stack[KERNEL_CONF_STACKSIZE_MAIN];
#if RIOT_CCN_APPSERVER #if RIOT_CCN_APPSERVER
char appserver_stack[KERNEL_CONF_STACKSIZE_MAIN]; char appserver_stack[KERNEL_CONF_STACKSIZE_MAIN];
#endif #endif
kernel_pid_t relay_pid, appserver_pid; kernel_pid_t relay_pid = KERNEL_PID_UNDEF, appserver_pid = KERNEL_PID_UNDEF;
#define SHELL_MSG_BUFFER_SIZE (64) #define SHELL_MSG_BUFFER_SIZE (64)
msg_t msg_buffer_shell[SHELL_MSG_BUFFER_SIZE]; msg_t msg_buffer_shell[SHELL_MSG_BUFFER_SIZE];
@ -64,7 +64,7 @@ static void riot_ccn_appserver(int argc, char **argv)
(void) argc; /* the function takes no arguments */ (void) argc; /* the function takes no arguments */
(void) argv; (void) argv;
if (appserver_pid) { if (appserver_pid != KERNEL_PID_UNDEF) {
/* already running */ /* already running */
return; return;
} }
@ -126,7 +126,7 @@ static void riot_ccn_register_prefix(int argc, char **argv)
static void riot_ccn_relay_config(int argc, char **argv) static void riot_ccn_relay_config(int argc, char **argv)
{ {
if (!relay_pid) { if (relay_pid == KERNEL_PID_UNDEF) {
puts("ccnl stack not running"); puts("ccnl stack not running");
return; return;
} }
@ -173,7 +173,7 @@ static void riot_ccn_transceiver_start(int relay_pid)
static void riot_ccn_relay_start(void) static void riot_ccn_relay_start(void)
{ {
if (relay_pid) { if (relay_pid != KERNEL_PID_UNDEF) {
DEBUG("ccn-lite relay on thread_id %d...please stop it first!\n", relay_pid); DEBUG("ccn-lite relay on thread_id %d...please stop it first!\n", relay_pid);
/* already running */ /* already running */
return; return;

View File

@ -31,7 +31,7 @@
// ccn // ccn
#include "ccn_lite/ccnl-riot.h" #include "ccn_lite/ccnl-riot.h"
kernel_pid_t relay_pid; kernel_pid_t relay_pid = KERNEL_PID_UNDEF;
char t2_stack[KERNEL_CONF_STACKSIZE_MAIN]; char t2_stack[KERNEL_CONF_STACKSIZE_MAIN];

View File

@ -37,7 +37,7 @@
/** message buffer */ /** message buffer */
msg_t msg_buffer_appserver[APPSERVER_MSG_BUFFER_SIZE]; msg_t msg_buffer_appserver[APPSERVER_MSG_BUFFER_SIZE];
kernel_pid_t relay_pid; kernel_pid_t relay_pid = KERNEL_PID_UNDEF;
char prefix[] = "/riot/appserver/"; char prefix[] = "/riot/appserver/";
static int appserver_sent_content(uint8_t *buf, int len, kernel_pid_t from) static int appserver_sent_content(uint8_t *buf, int len, kernel_pid_t from)

View File

@ -44,7 +44,7 @@
#define READER_STACK_SIZE (KERNEL_CONF_STACKSIZE_DEFAULT) #define READER_STACK_SIZE (KERNEL_CONF_STACKSIZE_DEFAULT)
char serial_reader_stack[READER_STACK_SIZE]; char serial_reader_stack[READER_STACK_SIZE];
kernel_pid_t serial_reader_pid; kernel_pid_t serial_reader_pid = KERNEL_PID_UNDEF;
uint8_t serial_out_buf[BORDER_BUFFER_SIZE]; uint8_t serial_out_buf[BORDER_BUFFER_SIZE];
uint8_t serial_in_buf[BORDER_BUFFER_SIZE]; uint8_t serial_in_buf[BORDER_BUFFER_SIZE];
@ -138,7 +138,7 @@ int sixlowpan_lowpan_border_init(int if_id)
border_process_lowpan, border_process_lowpan,
"border_process_lowpan"); "border_process_lowpan");
if (ip_process_pid < 0) { if (ip_process_pid != KERNEL_PID_UNDEF) {
return 0; return 0;
} }

View File

@ -32,7 +32,7 @@ static int set_timeout(vtimer_t *timeout, timex_t val, void *args);
static void sending_slot(void); static void sending_slot(void);
char sending_slot_stack[SENDING_SLOT_STACK_SIZE]; char sending_slot_stack[SENDING_SLOT_STACK_SIZE];
kernel_pid_t sending_slot_pid; kernel_pid_t sending_slot_pid = KERNEL_PID_UNDEF;
flowcontrol_stat_t slwin_stat; flowcontrol_stat_t slwin_stat;
sem_t connection_established; sem_t connection_established;

View File

@ -49,7 +49,7 @@ char addr_str[IPV6_MAX_ADDR_STR_LEN];
/* global variables */ /* global variables */
rpl_of_t *rpl_objective_functions[NUMBER_IMPLEMENTED_OFS]; rpl_of_t *rpl_objective_functions[NUMBER_IMPLEMENTED_OFS];
rpl_routing_entry_t rpl_routing_table[RPL_MAX_ROUTING_ENTRIES]; rpl_routing_entry_t rpl_routing_table[RPL_MAX_ROUTING_ENTRIES];
kernel_pid_t rpl_process_pid; kernel_pid_t rpl_process_pid = KERNEL_PID_UNDEF;
mutex_t rpl_recv_mutex = MUTEX_INIT; mutex_t rpl_recv_mutex = MUTEX_INIT;
mutex_t rpl_send_mutex = MUTEX_INIT; mutex_t rpl_send_mutex = MUTEX_INIT;
msg_t rpl_msg_queue[RPL_PKT_RECV_BUF_SIZE]; msg_t rpl_msg_queue[RPL_PKT_RECV_BUF_SIZE];

View File

@ -33,10 +33,10 @@ static char interval_over_buf[TRICKLE_INTERVAL_STACKSIZE];
static char dao_delay_over_buf[DAO_DELAY_STACKSIZE]; static char dao_delay_over_buf[DAO_DELAY_STACKSIZE];
static char routing_table_buf[RT_STACKSIZE]; static char routing_table_buf[RT_STACKSIZE];
kernel_pid_t timer_over_pid; kernel_pid_t timer_over_pid = KERNEL_PID_UNDEF;
kernel_pid_t interval_over_pid; kernel_pid_t interval_over_pid = KERNEL_PID_UNDEF;
kernel_pid_t dao_delay_over_pid; kernel_pid_t dao_delay_over_pid = KERNEL_PID_UNDEF;
kernel_pid_t rt_timer_over_pid; kernel_pid_t rt_timer_over_pid = KERNEL_PID_UNDEF;
bool ack_received; bool ack_received;
uint8_t dao_counter; uint8_t dao_counter;

View File

@ -122,7 +122,7 @@ void handle_tcp_ack_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
socket_internal_t *tcp_socket) socket_internal_t *tcp_socket)
{ {
msg_t m_recv_tcp, m_send_tcp; msg_t m_recv_tcp, m_send_tcp;
kernel_pid_t target_pid; kernel_pid_t target_pid = KERNEL_PID_UNDEF;
if (tcp_socket->socket_values.tcp_control.state == TCP_LAST_ACK) { if (tcp_socket->socket_values.tcp_control.state == TCP_LAST_ACK) {
target_pid = tcp_socket->recv_pid; target_pid = tcp_socket->recv_pid;

View File

@ -54,7 +54,7 @@ enum pthread_thread_status {
}; };
typedef struct pthread_thread { typedef struct pthread_thread {
kernel_pid_t thread_pid; kernel_pid_t thread_pid = KERNEL_PID_UNDEF;
enum pthread_thread_status status; enum pthread_thread_status status;
int joining_thread; int joining_thread;
@ -132,9 +132,9 @@ int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*sta
void *stack = autofree ? malloc(stack_size) : attr->ss_sp; void *stack = autofree ? malloc(stack_size) : attr->ss_sp;
pt->stack = autofree ? stack : NULL; pt->stack = autofree ? stack : NULL;
if (autofree && pthread_reaper_pid < 0) { if (autofree && pthread_reaper_pid != KERNEL_PID_UNDEF) {
mutex_lock(&pthread_mutex); mutex_lock(&pthread_mutex);
if (pthread_reaper_pid < 0) { if (pthread_reaper_pid != KERNEL_PID_UNDEF) {
/* volatile pid to overcome problems with double checking */ /* volatile pid to overcome problems with double checking */
volatile kernel_pid_t pid = thread_create(pthread_reaper_stack, volatile kernel_pid_t pid = thread_create(pthread_reaper_stack,
PTHREAD_REAPER_STACKSIZE, PTHREAD_REAPER_STACKSIZE,

View File

@ -39,7 +39,7 @@
#define UART0_STACKSIZE (KERNEL_CONF_STACKSIZE_DEFAULT) #define UART0_STACKSIZE (KERNEL_CONF_STACKSIZE_DEFAULT)
ringbuffer_t uart0_ringbuffer; ringbuffer_t uart0_ringbuffer;
kernel_pid_t uart0_handler_pid; kernel_pid_t uart0_handler_pid = KERNEL_PID_UNDEF;
static char buffer[UART0_BUFSIZE]; static char buffer[UART0_BUFSIZE];

View File

@ -130,7 +130,7 @@ void sender(void)
int main(void) int main(void)
{ {
#ifndef SENDER #ifndef SENDER
kernel_pid_t radio_pid; kernel_pid_t radio_pid = KERNEL_PID_UNDEF;
#endif #endif
int16_t a; int16_t a;
msg_t mesg; msg_t mesg;

View File

@ -149,7 +149,7 @@ void test2(void)
NULL, NULL,
names[i]); names[i]);
if (pid < 0) { if (pid == KERNEL_PID_UNDEF) {
puts("first: thread create failed"); puts("first: thread create failed");
} }

View File

@ -31,7 +31,7 @@ static char stacks[NUM_CHILDREN][STACK_SIZE];
static kernel_pid_t pids[NUM_CHILDREN]; static kernel_pid_t pids[NUM_CHILDREN];
static char names[NUM_CHILDREN][8]; static char names[NUM_CHILDREN][8];
static kernel_pid_t parent_pid; static kernel_pid_t parent_pid = KERNEL_PID_UNDEF;
static void *child_fun(void *arg) static void *child_fun(void *arg)
{ {

View File

@ -29,7 +29,7 @@
mutex_t mtx = MUTEX_INIT; mutex_t mtx = MUTEX_INIT;
volatile int storage = 1; volatile int storage = 1;
kernel_pid_t main_id; kernel_pid_t main_id = KERNEL_PID_UNDEF;
kernel_pid_t ths[PROBLEM]; kernel_pid_t ths[PROBLEM];
char stacks[PROBLEM][KERNEL_CONF_STACKSIZE_MAIN]; char stacks[PROBLEM][KERNEL_CONF_STACKSIZE_MAIN];

View File

@ -27,7 +27,7 @@
char t1_stack[KERNEL_CONF_STACKSIZE_MAIN]; char t1_stack[KERNEL_CONF_STACKSIZE_MAIN];
kernel_pid_t p1, p_main; kernel_pid_t p1 = KERNEL_PID_UNDEF, p_main = KERNEL_PID_UNDEF;
void *thread1(void *arg) void *thread1(void *arg)
{ {

View File

@ -27,7 +27,7 @@
char t1_stack[KERNEL_CONF_STACKSIZE_MAIN]; char t1_stack[KERNEL_CONF_STACKSIZE_MAIN];
kernel_pid_t p1, p_main; kernel_pid_t p1 = KERNEL_PID_UNDEF, p_main = KERNEL_PID_UNDEF;
void *thread1(void *arg) void *thread1(void *arg)
{ {

View File

@ -29,7 +29,7 @@ char t1_stack[KERNEL_CONF_STACKSIZE_MAIN];
char t2_stack[KERNEL_CONF_STACKSIZE_MAIN]; char t2_stack[KERNEL_CONF_STACKSIZE_MAIN];
char t3_stack[KERNEL_CONF_STACKSIZE_MAIN]; char t3_stack[KERNEL_CONF_STACKSIZE_MAIN];
kernel_pid_t p1, p2, p3; kernel_pid_t p1 = KERNEL_PID_UNDEF, p2 = KERNEL_PID_UNDEF, p3 = KERNEL_PID_UNDEF;
void *sub_thread(void *arg) void *sub_thread(void *arg)
{ {