2016-08-15 18:16:30 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Nordic Semiconductor ASA
|
|
|
|
* Copyright (c) 2016 Vinayak Kariappa Chettimada
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2016-08-15 18:16:30 +08:00
|
|
|
*/
|
|
|
|
|
2016-12-21 13:21:13 +08:00
|
|
|
#ifndef _MAYFLY_H_
|
|
|
|
#define _MAYFLY_H_
|
2016-08-15 18:16:30 +08:00
|
|
|
|
2016-12-21 13:21:13 +08:00
|
|
|
struct mayfly {
|
|
|
|
uint8_t volatile _req;
|
|
|
|
uint8_t _ack;
|
|
|
|
void *_link;
|
|
|
|
void *param;
|
|
|
|
void (*fp)(void *);
|
2016-08-15 18:16:30 +08:00
|
|
|
};
|
|
|
|
|
2016-12-21 13:21:13 +08:00
|
|
|
void mayfly_init(void);
|
2017-03-04 11:58:22 +08:00
|
|
|
void mayfly_enable(uint8_t caller_id, uint8_t callee_id, uint8_t enable);
|
2016-12-21 13:21:13 +08:00
|
|
|
uint32_t mayfly_enqueue(uint8_t caller_id, uint8_t callee_id, uint8_t chain,
|
|
|
|
struct mayfly *m);
|
|
|
|
void mayfly_run(uint8_t callee_id);
|
|
|
|
|
2017-03-04 11:58:22 +08:00
|
|
|
extern void mayfly_enable_cb(uint8_t caller_id, uint8_t callee_id,
|
|
|
|
uint8_t enable);
|
2016-12-21 13:21:13 +08:00
|
|
|
extern uint32_t mayfly_is_enabled(uint8_t caller_id, uint8_t callee_id);
|
|
|
|
extern uint32_t mayfly_prio_is_equal(uint8_t caller_id, uint8_t callee_id);
|
|
|
|
extern void mayfly_pend(uint8_t caller_id, uint8_t callee_id);
|
2016-08-15 18:16:30 +08:00
|
|
|
|
2016-12-21 13:21:13 +08:00
|
|
|
#endif /* _MAYFLY_H_ */
|