fw/l1a: Add a message to safely count the length of a txqueue
[osmocom-bb.git] / src / target / firmware / include / layer1 / async.h
1 #ifndef _L1_ASYNC_H
2 #define _L1_ASYNC_H
3
4 #include <osmocom/core/msgb.h>
5
6 #include <layer1/mframe_sched.h>
7
8 #if 0
9 NOTE: Re-enabling interrupts causes an IRQ while processing the same IRQ.
10       Use local_firq_save and local_irq_restore instead!
11
12 /* When altering data structures used by L1 Sync part, we need to
13  * make sure to temporarily disable IRQ/FIQ to keep data consistent */
14 static inline void l1a_lock_sync(void)
15 {
16         arm_disable_interrupts();
17 }
18
19 static inline void l1a_unlock_sync(void)
20 {
21         arm_enable_interrupts();
22 }
23 #endif
24
25 /* safely enable a message into the L1S TX queue */
26 void l1a_txq_msgb_enq(struct llist_head *queue, struct msgb *msg);
27 void l1a_meas_msgb_set(struct msgb *msg);
28
29 /* safely count messages in the L1S TX queue */
30 int l1a_txq_msgb_count(struct llist_head *queue);
31
32 /* flush all pending msgb */
33 void l1a_txq_msgb_flush(struct llist_head *queue);
34
35 /* request a RACH */
36 void l1a_rach_req(uint16_t offset, uint8_t combined, uint8_t ra);
37
38 /* schedule frequency change */
39 void l1a_freq_req(uint32_t fn_sched);
40
41 /* Enable a repeating multiframe task */
42 void l1a_mftask_enable(enum mframe_task task);
43
44 /* Disable a repeating multiframe task */
45 void l1a_mftask_disable(enum mframe_task task);
46
47 /* Set TCH mode */
48 uint8_t l1a_tch_mode_set(uint8_t mode);
49
50 /* Execute pending L1A completions */
51 void l1a_compl_execute(void);
52
53 /* Initialize asynchronous part of Layer1 */
54 void l1a_init(void);
55
56 #endif