pid_t: unify usage of special task IDs

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko
2022-03-21 23:47:09 +01:00
committed by Xiang Xiao
parent 2ee12b2c5d
commit 68902d8732
150 changed files with 359 additions and 456 deletions
+1 -1
View File
@@ -104,7 +104,7 @@ typedef struct
fault_flags_t flags; /* What is in the dump */ fault_flags_t flags; /* What is in the dump */
uintptr_t current_regs; /* Used to validate the dump */ uintptr_t current_regs; /* Used to validate the dump */
int lineno; /* __LINE__ to up_assert */ int lineno; /* __LINE__ to up_assert */
int pid; /* Process ID */ pid_t pid; /* Process ID */
uint32_t regs[XCPTCONTEXT_REGS]; /* Interrupt register save area */ uint32_t regs[XCPTCONTEXT_REGS]; /* Interrupt register save area */
stack_t stacks; /* Stack info */ stack_t stacks; /* Stack info */
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
+1 -1
View File
@@ -61,7 +61,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
tcb->stack_alloc_ptr = (void *)(g_idle_topstack - tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
+1 -1
View File
@@ -62,7 +62,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
tcb->stack_alloc_ptr = (void *)(g_idle_topstack - tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
+1 -1
View File
@@ -61,7 +61,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
tcb->stack_alloc_ptr = (void *)(g_idle_topstack - tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
+1 -1
View File
@@ -63,7 +63,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
tcb->stack_alloc_ptr = (void *)(g_idle_topstack - tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
+1 -1
View File
@@ -61,7 +61,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
tcb->stack_alloc_ptr = (void *)(g_idle_topstack - tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
+1 -1
View File
@@ -63,7 +63,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
tcb->stack_alloc_ptr = (void *)(g_idle_topstack - tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
+12 -7
View File
@@ -26,6 +26,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <sched.h> #include <sched.h>
#include <nuttx/sched.h>
#include <nuttx/kthread.h> #include <nuttx/kthread.h>
#include <debug.h> #include <debug.h>
@@ -59,7 +60,7 @@ struct cxd56_sigtype_s
struct cxd56cpu1_info_s struct cxd56cpu1_info_s
{ {
int workerpid; pid_t workerpid;
int ndev; int ndev;
struct cxd56_sigtype_s sigtype[CXD56_CPU1_DATA_TYPE_MAX]; struct cxd56_sigtype_s sigtype[CXD56_CPU1_DATA_TYPE_MAX];
}; };
@@ -70,7 +71,11 @@ struct cxd56cpu1_info_s
static struct cxd56cpu1_info_s g_cpu1_info = static struct cxd56cpu1_info_s g_cpu1_info =
{ {
0 INVALID_PROCESS_ID,
0,
{
0
}
}; };
/**************************************************************************** /****************************************************************************
@@ -193,9 +198,9 @@ int cxd56_cpu1siginit(uint8_t sigtype, FAR void *data)
} }
pid = kthread_create("gnss_receiver", pid = kthread_create("gnss_receiver",
CONFIG_CXD56CPU1_WORKER_THREAD_PRIORITY, CONFIG_CXD56CPU1_WORKER_THREAD_PRIORITY,
CONFIG_CXD56CPU1_WORKER_STACKSIZE, cxd56cpu1_worker, CONFIG_CXD56CPU1_WORKER_STACKSIZE, cxd56cpu1_worker,
(FAR char * const *) NULL); (FAR char * const *) NULL);
if (pid < 0) if (pid < 0)
{ {
@@ -221,7 +226,7 @@ err1:
int cxd56_cpu1siguninit(uint8_t sigtype) int cxd56_cpu1siguninit(uint8_t sigtype)
{ {
struct cxd56cpu1_info_s *priv = &g_cpu1_info; struct cxd56cpu1_info_s *priv = &g_cpu1_info;
int pid; pid_t pid;
int ret; int ret;
if (sigtype >= CXD56_CPU1_DATA_TYPE_MAX) if (sigtype >= CXD56_CPU1_DATA_TYPE_MAX)
@@ -249,7 +254,7 @@ int cxd56_cpu1siguninit(uint8_t sigtype)
} }
pid = priv->workerpid; pid = priv->workerpid;
priv->workerpid = 0; priv->workerpid = INVALID_PROCESS_ID;
sched_unlock(); sched_unlock();
+2 -2
View File
@@ -135,7 +135,7 @@ extern int fw_pm_sleepcpu(int cpuid, int mode);
struct cxd56_gnss_sig_s struct cxd56_gnss_sig_s
{ {
uint8_t enable; uint8_t enable;
int pid; pid_t pid;
FAR struct cxd56_gnss_signal_info_s info; FAR struct cxd56_gnss_signal_info_s info;
}; };
@@ -1466,7 +1466,7 @@ static int cxd56_gnss_set_signal(FAR struct file *filep, unsigned long arg)
FAR struct cxd56_gnss_signal_setting_s *setting; FAR struct cxd56_gnss_signal_setting_s *setting;
FAR struct cxd56_gnss_sig_s *sig; FAR struct cxd56_gnss_sig_s *sig;
FAR struct cxd56_gnss_sig_s *checksig; FAR struct cxd56_gnss_sig_s *checksig;
int pid; pid_t pid;
int i; int i;
if (!arg) if (!arg)
+1 -1
View File
@@ -116,7 +116,7 @@ struct iccdev_s
/* for POSIX signal */ /* for POSIX signal */
int signo; int signo;
int pid; pid_t pid;
FAR void *sigdata; FAR void *sigdata;
struct sq_queue_s recvq; struct sq_queue_s recvq;
+2 -2
View File
@@ -113,7 +113,7 @@
struct ev_notify_s struct ev_notify_s
{ {
int signo; /* Signal number */ int signo; /* Signal number */
int pid; /* Target PID */ pid_t pid; /* Target PID */
struct scuev_arg_s *arg; /* Event argument */ struct scuev_arg_s *arg; /* Event argument */
struct scufifo_s *fifo; /* Reverse reference to FIFO */ struct scufifo_s *fifo; /* Reverse reference to FIFO */
}; };
@@ -121,7 +121,7 @@ struct ev_notify_s
struct wm_notify_s struct wm_notify_s
{ {
int signo; /* Signal number */ int signo; /* Signal number */
int pid; /* Target PID */ pid_t pid; /* Target PID */
struct scutimestamp_s *ts; /* Event argument */ struct scutimestamp_s *ts; /* Event argument */
struct scufifo_s *fifo; /* Reverse reference to FIFO */ struct scufifo_s *fifo; /* Reverse reference to FIFO */
}; };
+1 -1
View File
@@ -380,7 +380,7 @@ struct cxd56_usbdev_s
/* signal */ /* signal */
int signo; int signo;
int pid; pid_t pid;
}; };
/* For maintaining tables of endpoint info */ /* For maintaining tables of endpoint info */
+1 -1
View File
@@ -661,7 +661,7 @@ int rtw_create_task(struct task_struct *task, const char *name,
return pid; return pid;
} }
wrap->pid = pid; wrap->pid = (pid_t)pid;
return 1; return 1;
} }
+1 -1
View File
@@ -66,7 +66,7 @@ struct task_struct
}; };
struct nthread_wrapper struct nthread_wrapper
{ {
int pid; pid_t pid;
thread_func_t func; thread_func_t func;
void *thctx; void *thctx;
}; };
+2 -2
View File
@@ -141,7 +141,7 @@ struct tiva_canmod_s
/* kthread message handler thread ID */ /* kthread message handler thread ID */
int kthd_id; pid_t kthd_id;
#ifdef CONFIG_CAN_ERRORS #ifdef CONFIG_CAN_ERRORS
/* Asynchronously report errors when status interrupts are disabled */ /* Asynchronously report errors when status interrupts are disabled */
@@ -438,7 +438,7 @@ static int tivacan_setup(FAR struct can_dev_s *dev)
} }
else else
{ {
canmod->kthd_id = ret; canmod->kthd_id = (pid_t)ret;
} }
#ifdef CONFIG_CAN_EXTID #ifdef CONFIG_CAN_EXTID
+1 -1
View File
@@ -58,7 +58,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
char *stack_ptr = (char *)(g_idle_topstack - char *stack_ptr = (char *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
+1 -1
View File
@@ -55,7 +55,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
char *stack_ptr = (char *)(g_idle_topstack - char *stack_ptr = (char *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
+1 -1
View File
@@ -296,7 +296,7 @@ static void _up_assert(int errorcode)
/* Are we in an interrupt handler or the idle task? */ /* Are we in an interrupt handler or the idle task? */
if (CURRENT_REGS || running_task()->pid == 0) if (up_interrupt_context() || sched_idletask())
{ {
up_irq_save(); up_irq_save();
for (; ; ) for (; ; )
+1 -1
View File
@@ -55,7 +55,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
tcb->stack_alloc_ptr = g_idle_basestack; tcb->stack_alloc_ptr = g_idle_basestack;
tcb->stack_base_ptr = tcb->stack_alloc_ptr; tcb->stack_base_ptr = tcb->stack_alloc_ptr;
+1 -1
View File
@@ -61,7 +61,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
tcb->stack_alloc_ptr = g_idle_basestack; tcb->stack_alloc_ptr = g_idle_basestack;
tcb->stack_base_ptr = tcb->stack_alloc_ptr; tcb->stack_base_ptr = tcb->stack_alloc_ptr;
+1 -1
View File
@@ -56,7 +56,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
char *stack_ptr = (char *)(g_idle_topstack - char *stack_ptr = (char *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
+1 -1
View File
@@ -59,7 +59,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
char *stack_ptr = (char *)(g_idle_topstack - char *stack_ptr = (char *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
+1 -1
View File
@@ -57,7 +57,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
char *stack_ptr = (char *)(g_idle_topstack - char *stack_ptr = (char *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
@@ -61,7 +61,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
char *stack_ptr = (char *)(g_idle_topstack - char *stack_ptr = (char *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
+1 -1
View File
@@ -74,7 +74,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
tcb->stack_alloc_ptr = (void *)(g_idle_topstack - tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
+1 -1
View File
@@ -57,7 +57,7 @@ void up_initial_state(FAR struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
char *stack_ptr = (char *)(g_idle_topstack - char *stack_ptr = (char *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
+1 -1
View File
@@ -62,7 +62,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
char *stack_ptr = (char *)(g_idle_topstack - char *stack_ptr = (char *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
+1 -1
View File
@@ -74,7 +74,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
char *stack_ptr = (char *)(g_idle_topstack - char *stack_ptr = (char *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
+5 -3
View File
@@ -340,9 +340,9 @@ int bl_os_task_create(const char *name,
void bl_os_task_delete(void *task_handle) void bl_os_task_delete(void *task_handle)
{ {
pid_t task = (int)task_handle; pid_t pid = (pid_t)((uintptr_t)task_handle);
task_delete((pid_t)task); task_delete(pid);
} }
/**************************************************************************** /****************************************************************************
@@ -358,7 +358,9 @@ void bl_os_task_delete(void *task_handle)
void *bl_os_task_get_current_task(void) void *bl_os_task_get_current_task(void)
{ {
return (void *)0; pid_t pid = getpid();
return (void *)((uintptr_t)pid);
} }
/**************************************************************************** /****************************************************************************
+1 -1
View File
@@ -57,7 +57,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
tcb->stack_alloc_ptr = (void *)(g_idle_topstack - tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
@@ -553,7 +553,7 @@ static int32_t esp_task_create_pinned_to_core(void *entry,
wlerr("Failed to create task\n"); wlerr("Failed to create task\n");
} }
return pid > 0 ? true : false; return pid > 0;
} }
/**************************************************************************** /****************************************************************************
+5 -5
View File
@@ -68,7 +68,7 @@
struct esp32c3_rt_priv_s struct esp32c3_rt_priv_s
{ {
int pid; pid_t pid;
sem_t toutsem; sem_t toutsem;
struct list_node runlist; struct list_node runlist;
struct list_node toutlist; struct list_node toutlist;
@@ -81,7 +81,7 @@ struct esp32c3_rt_priv_s
static struct esp32c3_rt_priv_s g_rt_priv = static struct esp32c3_rt_priv_s g_rt_priv =
{ {
.pid = -EINVAL, .pid = INVALID_PROCESS_ID,
}; };
/**************************************************************************** /****************************************************************************
@@ -736,7 +736,7 @@ int esp32c3_rt_timer_init(void)
list_initialize(&priv->runlist); list_initialize(&priv->runlist);
list_initialize(&priv->toutlist); list_initialize(&priv->toutlist);
priv->pid = pid; priv->pid = (pid_t)pid;
flags = enter_critical_section(); flags = enter_critical_section();
@@ -789,10 +789,10 @@ void esp32c3_rt_timer_deinit(void)
leave_critical_section(flags); leave_critical_section(flags);
if (priv->pid != -EINVAL) if (priv->pid != INVALID_PROCESS_ID)
{ {
kthread_delete(priv->pid); kthread_delete(priv->pid);
priv->pid = -EINVAL; priv->pid = INVALID_PROCESS_ID;
} }
nxsem_destroy(&priv->toutsem); nxsem_destroy(&priv->toutsem);
@@ -1997,7 +1997,7 @@ static int32_t esp_task_create_pinned_to_core(void *entry,
wlerr("ERROR: Failed to create task\n"); wlerr("ERROR: Failed to create task\n");
} }
return pid > 0 ? true : false; return pid > 0;
} }
/**************************************************************************** /****************************************************************************
+1 -1
View File
@@ -54,7 +54,7 @@
void up_initial_state(struct tcb_s *tcb) void up_initial_state(struct tcb_s *tcb)
{ {
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
tcb->stack_alloc_ptr = (void *)(up_getsp() - tcb->stack_alloc_ptr = (void *)(up_getsp() -
CONFIG_IDLETHREAD_STACKSIZE - CONFIG_IDLETHREAD_STACKSIZE -
+1 -1
View File
@@ -108,7 +108,7 @@ void up_dumpstate(void)
/* Get the limits on the user stack memory */ /* Get the limits on the user stack memory */
if (rtcb->pid == 0) /* Check for CPU0 IDLE thread */ if (rtcb->pid == IDLE_PROCESS_ID) /* Check for CPU0 IDLE thread */
{ {
ustackbase = g_idle_topstack - 4; ustackbase = g_idle_topstack - 4;
ustacksize = CONFIG_IDLETHREAD_STACKSIZE; ustacksize = CONFIG_IDLETHREAD_STACKSIZE;
+1 -1
View File
@@ -68,7 +68,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
tcb->stack_alloc_ptr = (void *)(g_idle_topstack - tcb->stack_alloc_ptr = (void *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
+1 -1
View File
@@ -55,7 +55,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
char *stack_ptr = (char *)(g_idle_topstack - char *stack_ptr = (char *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
+1 -1
View File
@@ -56,7 +56,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
char *stack_ptr = (char *)(g_idle_topstack - char *stack_ptr = (char *)(g_idle_topstack -
CONFIG_IDLETHREAD_STACKSIZE); CONFIG_IDLETHREAD_STACKSIZE);
+1 -1
View File
@@ -60,7 +60,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
tcb->stack_alloc_ptr = g_idlestack; tcb->stack_alloc_ptr = g_idlestack;
tcb->stack_base_ptr = tcb->stack_alloc_ptr; tcb->stack_base_ptr = tcb->stack_alloc_ptr;
+1 -1
View File
@@ -802,7 +802,7 @@ static int32_t esp_task_create_pinned_to_core(void *entry,
wlerr("Failed to create task, error %d\n", pid); wlerr("Failed to create task, error %d\n", pid);
} }
return pid > 0 ? true : false; return pid > 0;
} }
/**************************************************************************** /****************************************************************************
+12 -4
View File
@@ -66,7 +66,7 @@
struct esp32_rt_priv_s struct esp32_rt_priv_s
{ {
int pid; pid_t pid;
sem_t toutsem; sem_t toutsem;
@@ -81,7 +81,10 @@ struct esp32_rt_priv_s
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
static struct esp32_rt_priv_s g_rt_priv; static struct esp32_rt_priv_s g_rt_priv =
{
.pid = INVALID_PROCESS_ID
};
/**************************************************************************** /****************************************************************************
* Private Function Prototypes * Private Function Prototypes
@@ -705,7 +708,7 @@ int esp32_rt_timer_init(void)
list_initialize(&priv->toutlist); list_initialize(&priv->toutlist);
priv->timer = tim; priv->timer = tim;
priv->pid = pid; priv->pid = (pid_t)pid;
flags = spin_lock_irqsave(&priv->lock); flags = spin_lock_irqsave(&priv->lock);
@@ -757,7 +760,12 @@ void esp32_rt_timer_deinit(void)
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
kthread_delete(priv->pid); if (priv->pid != INVALID_PROCESS_ID)
{
kthread_delete(priv->pid);
priv->pid = INVALID_PROCESS_ID;
}
nxsem_destroy(&priv->toutsem); nxsem_destroy(&priv->toutsem);
} }
+1 -1
View File
@@ -1933,7 +1933,7 @@ static int32_t esp_task_create_pinned_to_core(void *entry,
wlerr("Failed to create task\n"); wlerr("Failed to create task\n");
} }
return pid > 0 ? true : false; return pid > 0;
} }
/**************************************************************************** /****************************************************************************
+5 -5
View File
@@ -74,7 +74,7 @@
struct esp32s2_rt_priv_s struct esp32s2_rt_priv_s
{ {
int pid; pid_t pid;
sem_t toutsem; sem_t toutsem;
struct list_node runlist; struct list_node runlist;
struct list_node toutlist; struct list_node toutlist;
@@ -87,7 +87,7 @@ struct esp32s2_rt_priv_s
static struct esp32s2_rt_priv_s g_rt_priv = static struct esp32s2_rt_priv_s g_rt_priv =
{ {
.pid = -EINVAL, .pid = INVALID_PROCESS_ID,
}; };
/**************************************************************************** /****************************************************************************
@@ -752,7 +752,7 @@ int esp32s2_rt_timer_init(void)
list_initialize(&priv->runlist); list_initialize(&priv->runlist);
list_initialize(&priv->toutlist); list_initialize(&priv->toutlist);
priv->pid = pid; priv->pid = (pid_t)pid;
priv->timer = tim; priv->timer = tim;
flags = enter_critical_section(); flags = enter_critical_section();
@@ -832,10 +832,10 @@ void esp32s2_rt_timer_deinit(void)
leave_critical_section(flags); leave_critical_section(flags);
if (priv->pid != -EINVAL) if (priv->pid != INVALID_PROCESS_ID)
{ {
kthread_delete(priv->pid); kthread_delete(priv->pid);
priv->pid = -EINVAL; priv->pid = INVALID_PROCESS_ID;
} }
nxsem_destroy(&priv->toutsem); nxsem_destroy(&priv->toutsem);
+5 -5
View File
@@ -72,7 +72,7 @@ static_assert(RT_TIMER_TASK_PRIORITY < CONFIG_SCHED_HPWORKPRIORITY,
struct esp32s3_rt_priv_s struct esp32s3_rt_priv_s
{ {
int pid; /* PID of RT Timer kernel thread */ pid_t pid; /* PID of RT Timer kernel thread */
int cpuint; /* CPU interrupt assigned to this timer */ int cpuint; /* CPU interrupt assigned to this timer */
int core; /* Core that is taking care of the timer int core; /* Core that is taking care of the timer
* interrupts * interrupts
@@ -91,7 +91,7 @@ struct esp32s3_rt_priv_s
static struct esp32s3_rt_priv_s g_rt_priv = static struct esp32s3_rt_priv_s g_rt_priv =
{ {
.pid = -EINVAL, .pid = INVALID_PROCESS_ID,
.cpuint = -ENOMEM, .cpuint = -ENOMEM,
.core = -ENODEV .core = -ENODEV
}; };
@@ -961,7 +961,7 @@ int esp32s3_rt_timer_init(void)
list_initialize(&priv->runlist); list_initialize(&priv->runlist);
list_initialize(&priv->toutlist); list_initialize(&priv->toutlist);
priv->pid = pid; priv->pid = (pid_t)pid;
flags = spin_lock_irqsave(&priv->lock); flags = spin_lock_irqsave(&priv->lock);
@@ -1044,10 +1044,10 @@ void esp32s3_rt_timer_deinit(void)
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
if (priv->pid != -EINVAL) if (priv->pid != INVALID_PROCESS_ID)
{ {
kthread_delete(priv->pid); kthread_delete(priv->pid);
priv->pid = -EINVAL; priv->pid = INVALID_PROCESS_ID;
} }
nxsem_destroy(&priv->toutsem); nxsem_destroy(&priv->toutsem);
+1 -1
View File
@@ -54,7 +54,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
char *stack_ptr = (char *)CONFIG_STACK_BASE; char *stack_ptr = (char *)CONFIG_STACK_BASE;
#ifdef CONFIG_STACK_COLORATION #ifdef CONFIG_STACK_COLORATION
+1 -1
View File
@@ -54,7 +54,7 @@ void up_initial_state(struct tcb_s *tcb)
/* Initialize the idle thread stack */ /* Initialize the idle thread stack */
if (tcb->pid == 0) if (tcb->pid == IDLE_PROCESS_ID)
{ {
char *stack_ptr = (char *)CONFIG_STACK_BASE; char *stack_ptr = (char *)CONFIG_STACK_BASE;
#ifdef CONFIG_STACK_COLORATION #ifdef CONFIG_STACK_COLORATION
@@ -131,7 +131,6 @@ static int ehci_waiter(int argc, char *argv[])
int imxrt_usbhost_initialize(void) int imxrt_usbhost_initialize(void)
{ {
pid_t pid;
int ret; int ret;
imxrt_clockall_usboh3(); imxrt_clockall_usboh3();
@@ -205,10 +204,10 @@ int imxrt_usbhost_initialize(void)
/* Start a thread to handle device connection. */ /* Start a thread to handle device connection. */
pid = kthread_create("EHCI Monitor", CONFIG_USBHOST_DEFPRIO, ret = kthread_create("EHCI Monitor", CONFIG_USBHOST_DEFPRIO,
CONFIG_USBHOST_STACKSIZE, CONFIG_USBHOST_STACKSIZE,
(main_t)ehci_waiter, (FAR char * const *)NULL); (main_t)ehci_waiter, (FAR char * const *)NULL);
if (pid < 0) if (ret < 0)
{ {
uerr("ERROR: Failed to create ehci_waiter task: %d\n", ret); uerr("ERROR: Failed to create ehci_waiter task: %d\n", ret);
return -ENODEV; return -ENODEV;
@@ -131,7 +131,6 @@ static int ehci_waiter(int argc, char *argv[])
int imxrt_usbhost_initialize(void) int imxrt_usbhost_initialize(void)
{ {
pid_t pid;
int ret; int ret;
imxrt_clockall_usboh3(); imxrt_clockall_usboh3();
@@ -203,10 +202,10 @@ int imxrt_usbhost_initialize(void)
/* Start a thread to handle device connection. */ /* Start a thread to handle device connection. */
pid = kthread_create("EHCI Monitor", CONFIG_USBHOST_DEFPRIO, ret = kthread_create("EHCI Monitor", CONFIG_USBHOST_DEFPRIO,
CONFIG_USBHOST_STACKSIZE, CONFIG_USBHOST_STACKSIZE,
(main_t)ehci_waiter, (FAR char * const *)NULL); (main_t)ehci_waiter, (FAR char * const *)NULL);
if (pid < 0) if (ret < 0)
{ {
uerr("ERROR: Failed to create ehci_waiter task: %d\n", ret); uerr("ERROR: Failed to create ehci_waiter task: %d\n", ret);
return -ENODEV; return -ENODEV;
@@ -131,7 +131,6 @@ static int ehci_waiter(int argc, char *argv[])
int imxrt_usbhost_initialize(void) int imxrt_usbhost_initialize(void)
{ {
pid_t pid;
int ret; int ret;
imxrt_clockall_usboh3(); imxrt_clockall_usboh3();
@@ -203,10 +202,10 @@ int imxrt_usbhost_initialize(void)
/* Start a thread to handle device connection. */ /* Start a thread to handle device connection. */
pid = kthread_create("EHCI Monitor", CONFIG_USBHOST_DEFPRIO, ret = kthread_create("EHCI Monitor", CONFIG_USBHOST_DEFPRIO,
CONFIG_USBHOST_STACKSIZE, CONFIG_USBHOST_STACKSIZE,
(main_t)ehci_waiter, (FAR char * const *)NULL); (main_t)ehci_waiter, (FAR char * const *)NULL);
if (pid < 0) if (ret < 0)
{ {
uerr("ERROR: Failed to create ehci_waiter task: %d\n", ret); uerr("ERROR: Failed to create ehci_waiter task: %d\n", ret);
return -ENODEV; return -ENODEV;
@@ -398,7 +398,6 @@ static void usb_msc_disconnect(FAR void *arg)
int k28_usbhost_initialize(void) int k28_usbhost_initialize(void)
{ {
pid_t pid;
int ret; int ret;
# ifdef HAVE_USB_AUTOMOUNTER # ifdef HAVE_USB_AUTOMOUNTER
int index; int index;
@@ -479,10 +478,10 @@ int k28_usbhost_initialize(void)
/* Start a thread to handle device connection. */ /* Start a thread to handle device connection. */
pid = kthread_create("EHCI Monitor", CONFIG_USBHOST_DEFPRIO, ret = kthread_create("EHCI Monitor", CONFIG_USBHOST_DEFPRIO,
CONFIG_USBHOST_STACKSIZE, CONFIG_USBHOST_STACKSIZE,
(main_t)ehci_waiter, (FAR char * const *)NULL); (main_t)ehci_waiter, (FAR char * const *)NULL);
if (pid < 0) if (ret < 0)
{ {
uerr("ERROR: Failed to create ehci_waiter task: %d\n", ret); uerr("ERROR: Failed to create ehci_waiter task: %d\n", ret);
return -ENODEV; return -ENODEV;

Some files were not shown because too many files have changed in this diff Show More