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:
parent
c2b0423918
commit
aa2ecf6216
@ -44,7 +44,7 @@
|
||||
#include "lpc2387.h"
|
||||
|
||||
|
||||
kernel_pid_t simple_pid;
|
||||
kernel_pid_t simple_pid = KERNEL_PID_UNDEF;
|
||||
int16_t simple_buffer[4];
|
||||
|
||||
volatile int16_t *ringBuff_X = NULL;
|
||||
|
@ -68,7 +68,7 @@ interrupt(USART1RX_VECTOR) usart0irq(void)
|
||||
(void) c;
|
||||
}
|
||||
#ifdef MODULE_UART0
|
||||
else if (uart0_handler_pid) {
|
||||
else if (uart0_handler_pid != KERNEL_PID_UNDEF) {
|
||||
volatile int c = U1RXBUF;
|
||||
uart0_handle_incoming(c);
|
||||
uart0_notify_thread();
|
||||
|
@ -128,7 +128,7 @@ void UART0_IRQHandler(void)
|
||||
case UIIR_CTI_INT: // Character Timeout Indicator
|
||||
case UIIR_RDA_INT: // Receive Data Available
|
||||
#ifdef MODULE_UART0
|
||||
if (uart0_handler_pid) {
|
||||
if (uart0_handler_pid != KERNEL_PID_UNDEF) {
|
||||
do {
|
||||
int c = U0RBR;
|
||||
uart0_handle_incoming(c);
|
||||
|
@ -17,7 +17,7 @@ void uart1_isr(void)
|
||||
if (UART1->USTATbits.RXRDY == 1) {
|
||||
#ifdef MODULE_UART0
|
||||
|
||||
if (uart0_handler_pid) {
|
||||
if (uart0_handler_pid != KERNEL_PID_UNDEF) {
|
||||
uint32_t i = 0;
|
||||
while (UART1->RXCON != 0) {
|
||||
uart0_handle_incoming(UART1->DATA);
|
||||
|
@ -17,7 +17,7 @@ void uart2_isr(void)
|
||||
if (UART2->USTATbits.RXRDY == 1) {
|
||||
#ifdef MODULE_UART0
|
||||
|
||||
if (uart0_handler_pid) {
|
||||
if (uart0_handler_pid != KERNEL_PID_UNDEF) {
|
||||
uint32_t i = 0;
|
||||
while (UART2->RXCON != 0) {
|
||||
uart0_handle_incoming(UART2->DATA);
|
||||
|
@ -107,7 +107,7 @@ interrupt(USART1RX_VECTOR) usart1irq(void)
|
||||
}
|
||||
|
||||
#ifdef MODULE_UART0
|
||||
else if (uart0_handler_pid) {
|
||||
else if (uart0_handler_pid != KERNEL_PID_UNDEF) {
|
||||
volatile int c = U1RXBUF;
|
||||
uart0_handle_incoming(c);
|
||||
uart0_notify_thread();
|
||||
|
@ -54,7 +54,7 @@ interrupt(USART0RX_VECTOR) usart0irq(void) {
|
||||
dummy = U0RXBUF;
|
||||
}
|
||||
#ifdef MODULE_UART0
|
||||
else if (uart0_handler_pid) {
|
||||
else if (uart0_handler_pid != KERNEL_PID_UNDEF) {
|
||||
dummy = U0RXBUF;
|
||||
uart0_handle_incoming(dummy);
|
||||
uart0_notify_thread();
|
||||
|
@ -122,7 +122,7 @@ interrupt(USCIAB0RX_VECTOR) __attribute__ ((naked)) usart1irq(void)
|
||||
/* Clear error flags by forcing a dummy read. */
|
||||
c = UCA0RXBUF;
|
||||
#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 */
|
||||
c = UCA0RXBUF;
|
||||
uart0_handle_incoming(c);
|
||||
|
@ -26,7 +26,7 @@ directory for more details.
|
||||
//static volatile time_t epoch;
|
||||
static struct tm time_to_set;
|
||||
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)
|
||||
@ -195,7 +195,7 @@ interrupt(RTC_VECTOR) __attribute__((naked)) rtc_isr(void)
|
||||
RTCYEARH = (time_to_set.tm_year + 1900) >> 0x08;
|
||||
}
|
||||
|
||||
if (rtc_second_pid) {
|
||||
if (rtc_second_pid != KERNEL_PID_UNDEF) {
|
||||
static msg_t m;
|
||||
m.type = RTC_SECOND;
|
||||
msg_send_int(&m, rtc_second_pid);
|
||||
|
@ -45,7 +45,7 @@ static volatile uint8_t rx_buffer_next;
|
||||
uint8_t _native_net_chan;
|
||||
uint16_t _native_net_pan;
|
||||
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;
|
||||
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;
|
||||
|
||||
/* notify transceiver thread if any */
|
||||
if (_native_net_tpid) {
|
||||
if (_native_net_tpid != KERNEL_PID_UNDEF) {
|
||||
DEBUG("_nativenet_handle_packet: notifying transceiver thread!\n");
|
||||
msg_t m;
|
||||
m.type = (uint16_t) RCV_PKT_NATIVE;
|
||||
|
@ -42,7 +42,7 @@
|
||||
static bool valid;
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ char relay_stack[KERNEL_CONF_STACKSIZE_MAIN];
|
||||
#if RIOT_CCN_APPSERVER
|
||||
char appserver_stack[KERNEL_CONF_STACKSIZE_MAIN];
|
||||
#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)
|
||||
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) argv;
|
||||
|
||||
if (appserver_pid) {
|
||||
if (appserver_pid != KERNEL_PID_UNDEF) {
|
||||
/* already running */
|
||||
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)
|
||||
{
|
||||
if (!relay_pid) {
|
||||
if (relay_pid == KERNEL_PID_UNDEF) {
|
||||
puts("ccnl stack not running");
|
||||
return;
|
||||
}
|
||||
@ -173,7 +173,7 @@ static void riot_ccn_transceiver_start(int relay_pid)
|
||||
|
||||
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);
|
||||
/* already running */
|
||||
return;
|
||||
|
@ -31,7 +31,7 @@
|
||||
// ccn
|
||||
#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];
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
/** message buffer */
|
||||
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/";
|
||||
|
||||
static int appserver_sent_content(uint8_t *buf, int len, kernel_pid_t from)
|
||||
|
@ -44,7 +44,7 @@
|
||||
#define READER_STACK_SIZE (KERNEL_CONF_STACKSIZE_DEFAULT)
|
||||
|
||||
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_in_buf[BORDER_BUFFER_SIZE];
|
||||
@ -138,7 +138,7 @@ int sixlowpan_lowpan_border_init(int if_id)
|
||||
border_process_lowpan,
|
||||
"border_process_lowpan");
|
||||
|
||||
if (ip_process_pid < 0) {
|
||||
if (ip_process_pid != KERNEL_PID_UNDEF) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ static int set_timeout(vtimer_t *timeout, timex_t val, void *args);
|
||||
static void sending_slot(void);
|
||||
|
||||
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;
|
||||
sem_t connection_established;
|
||||
|
@ -49,7 +49,7 @@ char addr_str[IPV6_MAX_ADDR_STR_LEN];
|
||||
/* global variables */
|
||||
rpl_of_t *rpl_objective_functions[NUMBER_IMPLEMENTED_OFS];
|
||||
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_send_mutex = MUTEX_INIT;
|
||||
msg_t rpl_msg_queue[RPL_PKT_RECV_BUF_SIZE];
|
||||
|
@ -33,10 +33,10 @@ static char interval_over_buf[TRICKLE_INTERVAL_STACKSIZE];
|
||||
static char dao_delay_over_buf[DAO_DELAY_STACKSIZE];
|
||||
static char routing_table_buf[RT_STACKSIZE];
|
||||
|
||||
kernel_pid_t timer_over_pid;
|
||||
kernel_pid_t interval_over_pid;
|
||||
kernel_pid_t dao_delay_over_pid;
|
||||
kernel_pid_t rt_timer_over_pid;
|
||||
kernel_pid_t timer_over_pid = KERNEL_PID_UNDEF;
|
||||
kernel_pid_t interval_over_pid = KERNEL_PID_UNDEF;
|
||||
kernel_pid_t dao_delay_over_pid = KERNEL_PID_UNDEF;
|
||||
kernel_pid_t rt_timer_over_pid = KERNEL_PID_UNDEF;
|
||||
|
||||
bool ack_received;
|
||||
uint8_t dao_counter;
|
||||
|
@ -122,7 +122,7 @@ void handle_tcp_ack_packet(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
|
||||
socket_internal_t *tcp_socket)
|
||||
{
|
||||
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) {
|
||||
target_pid = tcp_socket->recv_pid;
|
||||
|
@ -54,7 +54,7 @@ enum pthread_thread_status {
|
||||
};
|
||||
|
||||
typedef struct pthread_thread {
|
||||
kernel_pid_t thread_pid;
|
||||
kernel_pid_t thread_pid = KERNEL_PID_UNDEF;
|
||||
|
||||
enum pthread_thread_status status;
|
||||
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;
|
||||
pt->stack = autofree ? stack : NULL;
|
||||
|
||||
if (autofree && pthread_reaper_pid < 0) {
|
||||
if (autofree && pthread_reaper_pid != KERNEL_PID_UNDEF) {
|
||||
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 kernel_pid_t pid = thread_create(pthread_reaper_stack,
|
||||
PTHREAD_REAPER_STACKSIZE,
|
||||
|
@ -39,7 +39,7 @@
|
||||
#define UART0_STACKSIZE (KERNEL_CONF_STACKSIZE_DEFAULT)
|
||||
|
||||
ringbuffer_t uart0_ringbuffer;
|
||||
kernel_pid_t uart0_handler_pid;
|
||||
kernel_pid_t uart0_handler_pid = KERNEL_PID_UNDEF;
|
||||
|
||||
static char buffer[UART0_BUFSIZE];
|
||||
|
||||
|
@ -130,7 +130,7 @@ void sender(void)
|
||||
int main(void)
|
||||
{
|
||||
#ifndef SENDER
|
||||
kernel_pid_t radio_pid;
|
||||
kernel_pid_t radio_pid = KERNEL_PID_UNDEF;
|
||||
#endif
|
||||
int16_t a;
|
||||
msg_t mesg;
|
||||
|
@ -149,7 +149,7 @@ void test2(void)
|
||||
NULL,
|
||||
names[i]);
|
||||
|
||||
if (pid < 0) {
|
||||
if (pid == KERNEL_PID_UNDEF) {
|
||||
puts("first: thread create failed");
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ static char stacks[NUM_CHILDREN][STACK_SIZE];
|
||||
static kernel_pid_t pids[NUM_CHILDREN];
|
||||
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)
|
||||
{
|
||||
|
@ -29,7 +29,7 @@
|
||||
mutex_t mtx = MUTEX_INIT;
|
||||
|
||||
volatile int storage = 1;
|
||||
kernel_pid_t main_id;
|
||||
kernel_pid_t main_id = KERNEL_PID_UNDEF;
|
||||
kernel_pid_t ths[PROBLEM];
|
||||
char stacks[PROBLEM][KERNEL_CONF_STACKSIZE_MAIN];
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ char t1_stack[KERNEL_CONF_STACKSIZE_MAIN];
|
||||
char t2_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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user