libdragon
|
00001 00006 #ifndef __LIBDRAGON_RSP_H 00007 #define __LIBDRAGON_RSP_H 00008 00017 typedef struct ijob { 00018 struct ijob *prev; 00019 struct ijob *next; 00020 00021 void (*cb)(struct ijob *); 00022 00023 volatile uint32_t state; 00024 uint32_t fn; 00025 uint32_t args[16]; 00026 00027 } job_t; 00028 00032 #define JOB_STATE_IDLE 0 00033 #define JOB_STATE_QUEUED 1 00034 #define JOB_STATE_RUNNING 2 00035 #define JOB_STATE_FINISHED 3 00036 00040 typedef struct { 00041 job_t *head; 00042 job_t *tail; 00043 00044 } job_queue_t; 00045 00048 #ifdef __cplusplus 00049 extern "C" { 00050 #endif 00051 00052 void rsp_init( void ); 00053 void rsp_close( void ); 00054 void rsp_load_lib( uint8_t *lib ); 00055 uint32_t rsp_lib_fn( char *mod, uint32_t fn ); 00056 void rsp_queue_job( job_t *job ); 00057 void rsp_do_job( job_t *job ); 00058 void rsp_wait_job( job_t *job ); 00059 void rsp_abort_job( job_t *job ); 00060 job_t *rsp_new_job( uint32_t fn, void (*cb)(job_t *), uint32_t count, ... ); 00061 void rsp_dispose_job( job_t *job ); 00062 00063 #ifdef __cplusplus 00064 } 00065 #endif 00066 00067 #endif