Microchip® Advanced Software Framework

process.h File Reference

Header file for the Contiki process interface.

Author
Adam Dunkels adam@.nosp@m.sics.nosp@m..se
#include "sys/pt.h"
#include "sys/cc.h"

Data Structures

struct  process
 

Macros

#define PROCESS_BROADCAST   NULL
 
#define PROCESS_CONF_NUMEVENTS   32
 
#define PROCESS_EVENT_COM   0x89
 
#define PROCESS_EVENT_CONTINUE   0x85
 
#define PROCESS_EVENT_EXIT   0x83
 
#define PROCESS_EVENT_EXITED   0x87
 
#define PROCESS_EVENT_INIT   0x81
 
#define PROCESS_EVENT_MAX   0x8a
 
#define PROCESS_EVENT_MSG   0x86
 
#define PROCESS_EVENT_NONE   0x80
 
#define PROCESS_EVENT_POLL   0x82
 
#define PROCESS_EVENT_SERVICE_REMOVED   0x84
 
#define PROCESS_EVENT_TIMER   0x88
 
#define PROCESS_LIST()   process_list
 
#define PROCESS_NAME_STRING(process)   (process)->name
 
#define PROCESS_NONE   NULL
 
#define PROCESS_ZOMBIE   ((struct process *)0x1)
 
Return values
#define PROCESS_ERR_OK   0
 Return value indicating that an operation was successful. More...
 
#define PROCESS_ERR_FULL   1
 Return value indicating that the event queue was full. More...
 
Process protothread functions
#define PROCESS_BEGIN()
 Define the beginning of a process. More...
 
#define PROCESS_END()
 Define the end of a process. More...
 
#define PROCESS_WAIT_EVENT()
 Wait for an event to be posted to the process. More...
 
#define PROCESS_WAIT_EVENT_UNTIL(c)
 Wait for an event to be posted to the process, with an extra condition. More...
 
#define PROCESS_YIELD()
 Yield the currently running process. More...
 
#define PROCESS_YIELD_UNTIL(c)
 Yield the currently running process until a condition occurs. More...
 
#define PROCESS_WAIT_UNTIL(c)
 Wait for a condition to occur. More...
 
#define PROCESS_WAIT_WHILE(c)   PT_WAIT_WHILE(process_pt, c)
 
#define PROCESS_EXIT()
 Exit the currently running process. More...
 
#define PROCESS_PT_SPAWN(pt, thread)
 Spawn a protothread from the process. More...
 
#define PROCESS_PAUSE()
 Yield the process for a short while. More...
 
Poll and exit handlers
#define PROCESS_POLLHANDLER(handler)
 Specify an action when a process is polled. More...
 
#define PROCESS_EXITHANDLER(handler)
 Specify an action when a process exits. More...
 
Process declaration and definition
#define PROCESS_THREAD(name, ev, data)
 Define the body of a process. More...
 
#define PROCESS_NAME(name)
 Declare the name of a process. More...
 
#define PROCESS(name, strname)
 Declare a process. More...
 

Typedefs

typedef void * process_data_t
 
typedef unsigned char process_event_t
 
typedef unsigned char process_num_events_t
 

Functions

Functions called from device drivers
void process_poll (struct process *p)
 Request a process to be polled. More...
 
Functions called by the system and boot-up code
void process_init (void)
 Initialize the process module. More...
 
int process_run (void)
 Run the system once - call poll handlers and process one event. More...
 
int process_is_running (struct process *p)
 Check if a process is running. More...
 
int process_nevents (void)
 Number of events waiting to be processed. More...
 

Variables

CCIF struct processprocess_list
 

Functions called from application programs

#define PROCESS_CURRENT()
 Get a pointer to the currently running process. More...
 
#define PROCESS_CONTEXT_BEGIN(p)
 Switch context to another process. More...
 
#define PROCESS_CONTEXT_END(p)   process_current = tmp_current; }
 End a context switch. More...
 
CCIF struct processprocess_current
 
void process_start (struct process *p, const char *arg)
 Start a process. More...
 
int process_post (struct process *p, process_event_t ev, void *data)
 Post an asynchronous event. More...
 
void process_post_synch (struct process *p, process_event_t ev, void *data)
 Post a synchronous event to a process. More...
 
void process_exit (struct process *p)
 Cause a process to exit. More...
 
process_event_t process_alloc_event (void)
 Allocate a global event number. More...
 

#define PROCESS_NAME_STRING (   process)    (process)->name