Code for an autonomous plane I'm building. Includes process scheduling, process communication, and hardware sensor interfacing (via I2C). NOTE: currently in development, source code will be updated frequently.
Diff: control.h
- Revision:
- 4:44a5b1e8fd27
- Parent:
- 2:452dd766d212
--- a/control.h Fri Nov 01 01:23:04 2013 +0000 +++ b/control.h Sat Nov 02 08:47:14 2013 +0000 @@ -1,15 +1,13 @@ #ifndef CONTROL_H #define CONTROL_H -void schedule(); -void init(); +#define OUTPUT_SIZE 512 +#define MAX_SID_LEN 32 -typedef struct -{ - unsigned int status; - unsigned int block_pid; - void (*start)(void); -} process; +char* get_output(int); +void init(); +void schedule(); +int schedule_proc(char *sid, int (*funcptr)(int)); typedef enum { @@ -19,4 +17,16 @@ EMPTY } proc_stat; +typedef struct +{ + // process status + unsigned int status; + // if status == BLOCKED, wait till block_pid's status is ZOMBIE + unsigned int block_pid; + // function. each "process" is a function with a number of properties and storage space + int (*start)(int); + char sid[MAX_SID_LEN]; + char output[OUTPUT_SIZE]; +} process; + #endif //CONTROL_H \ No newline at end of file