summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/include/layer1/async.h
blob: 221ffcf9009ce9a66b0803f9391e5161242ce0b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef _L1_ASYNC_H
#define _L1_ASYNC_H

#include <osmocom/core/msgb.h>

#include <layer1/mframe_sched.h>

#if 0
NOTE: Re-enabling interrupts causes an IRQ while processing the same IRQ.
      Use local_firq_save and local_irq_restore instead!

/* When altering data structures used by L1 Sync part, we need to
 * make sure to temporarily disable IRQ/FIQ to keep data consistent */
static inline void l1a_lock_sync(void)
{
	arm_disable_interrupts();
}

static inline void l1a_unlock_sync(void)
{
	arm_enable_interrupts();
}
#endif

/* safely enable a message into the L1S TX queue */
void l1a_txq_msgb_enq(struct llist_head *queue, struct msgb *msg);
void l1a_meas_msgb_set(struct msgb *msg);

/* safely count messages in the L1S TX queue */
int l1a_txq_msgb_count(struct llist_head *queue);

/* flush all pending msgb */
void l1a_txq_msgb_flush(struct llist_head *queue);

/* Enable a repeating multiframe task */
void l1a_mftask_enable(enum mframe_task task);

/* Disable a repeating multiframe task */
void l1a_mftask_disable(enum mframe_task task);

/* Set the mask for repeating multiframe tasks */
void l1a_mftask_set(uint32_t tasks);

/* Set TCH mode */
uint8_t l1a_tch_mode_set(uint8_t mode);

/* Set Audio routing mode */
uint8_t l1a_audio_mode_set(uint8_t mode);

/* Execute pending L1A completions */
void l1a_compl_execute(void);

/* Initialize asynchronous part of Layer1 */
void l1a_init(void);

#endif