1 /* 2 * Copyright (c) 2016-2017 Nordic Semiconductor ASA 3 * Copyright (c) 2016 Vinayak Kariappa Chettimada 4 * 5 * SPDX-License-Identifier: Apache-2.0 6 */ 7 8 #define MAYFLY_CALL_ID_0 0 9 #define MAYFLY_CALL_ID_1 1 10 #define MAYFLY_CALL_ID_2 2 11 #define MAYFLY_CALL_ID_PROGRAM 3 12 #define MAYFLY_CALLER_COUNT 4 13 #define MAYFLY_CALLEE_COUNT 4 14 15 struct mayfly { 16 uint8_t volatile _req; 17 uint8_t _ack; 18 memq_link_t *_link; 19 void *param; 20 void (*fp)(void *); 21 }; 22 23 void mayfly_init(void); 24 void mayfly_enable(uint8_t caller_id, uint8_t callee_id, uint8_t enable); 25 uint32_t mayfly_enqueue(uint8_t caller_id, uint8_t callee_id, uint8_t chain, 26 struct mayfly *m); 27 void mayfly_run(uint8_t callee_id); 28 29 extern void mayfly_enable_cb(uint8_t caller_id, uint8_t callee_id, uint8_t enable); 30 extern uint32_t mayfly_is_enabled(uint8_t caller_id, uint8_t callee_id); 31 extern uint32_t mayfly_prio_is_equal(uint8_t caller_id, uint8_t callee_id); 32 extern void mayfly_pend(uint8_t caller_id, uint8_t callee_id); 33