Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //this is Coto's spinlock , requires spinlock_sched() to be glued to some kind of irq trigger so it runs regardless the main program core.
- #ifndef SPINLOCK_COTO
- #define SPINLOCK_COTO
- #define spinlock_elements (10)
- #define spinlock_linearelements (spinlock_elements-1)
- #define NULL_VAR 0
- //spinlock example
- typedef volatile struct{
- u8 spinlock_id;
- u8 status; //0 unlocked | 1 locked
- u32 func_ptr;
- } spinlock_table;
- typedef u32 (*u32cback_ptr)();
- #endif
- #ifdef __cplusplus
- extern "C" {
- #endif
- extern u32 __attribute__ ((hot)) spinlock_sched();
- extern u32 spinlock_perm(u8 process_id,u8 status);
- extern u32 spinlock_createproc(u8 process_id,u8 status,u32cback_ptr new_callback);
- extern u32 spinlock_modifyproc(u8 process_id,u8 status,u32cback_ptr new_callback);
- extern u32 spinlock_deleteproc(u8 process_id);
- extern volatile spinlock_table spinlock_handler[spinlock_elements];
- #ifdef __cplusplus
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement