diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2017-11-09 09:15:37 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2017-12-03 12:58:52 +0000 |
commit | a8726d977a67459e7bf314b4b69283f65e45cbf0 (patch) | |
tree | b24ecdf77a199e24d2e9286f8517e59686c67eb7 /src/host/layer23/include/osmocom | |
parent | 04754e88899c58051ef1a0b0602261f033609dce (diff) |
mobile: Begin with a primitive interface on top of the code
We want the script interface to interface through a primitive
interface. This will allow to move it to a different thread or
a process in the future. The script interface will just use the
primitives.
It is not clear how "sap" will be used here. I am keeping it
at 0 right now. The first primitive is starting a timer with a
request and then getting an indication as a response.
Change-Id: Id2456b7fae35546553c4805f12a40c0812d9255c
Diffstat (limited to 'src/host/layer23/include/osmocom')
-rw-r--r-- | src/host/layer23/include/osmocom/bb/common/logging.h | 1 | ||||
-rw-r--r-- | src/host/layer23/include/osmocom/bb/mobile/Makefile.am | 2 | ||||
-rw-r--r-- | src/host/layer23/include/osmocom/bb/mobile/primitives.h | 48 |
3 files changed, 50 insertions, 1 deletions
diff --git a/src/host/layer23/include/osmocom/bb/common/logging.h b/src/host/layer23/include/osmocom/bb/common/logging.h index efe493d0..fb1229ef 100644 --- a/src/host/layer23/include/osmocom/bb/common/logging.h +++ b/src/host/layer23/include/osmocom/bb/common/logging.h @@ -23,6 +23,7 @@ enum { DSIM, DGPS, DMOB, + DPRIM, }; extern const struct log_info log_info; diff --git a/src/host/layer23/include/osmocom/bb/mobile/Makefile.am b/src/host/layer23/include/osmocom/bb/mobile/Makefile.am index b58b9529..12cf24b0 100644 --- a/src/host/layer23/include/osmocom/bb/mobile/Makefile.am +++ b/src/host/layer23/include/osmocom/bb/mobile/Makefile.am @@ -1,3 +1,3 @@ noinst_HEADERS = gsm322.h gsm480_ss.h gsm411_sms.h gsm48_cc.h gsm48_mm.h \ gsm48_rr.h mncc.h settings.h subscriber.h support.h \ - transaction.h vty.h mncc_sock.h + transaction.h vty.h mncc_sock.h primitives.h diff --git a/src/host/layer23/include/osmocom/bb/mobile/primitives.h b/src/host/layer23/include/osmocom/bb/mobile/primitives.h new file mode 100644 index 00000000..a3168b2e --- /dev/null +++ b/src/host/layer23/include/osmocom/bb/mobile/primitives.h @@ -0,0 +1,48 @@ +#pragma once + +#include <osmocom/core/prim.h> + +struct mobile_prim; + +/** + * Mobile Script<->App primitives. Application script will receive + * indications and will send primitives to the lower layers. Here + * we will convert from internal state/events to the primitives. In + * the future the indications might be generated at lower levels + * directly. + */ +enum mobile_prims { + PRIM_MOB_TIMER, + PRIM_MOB_TIMER_CANCEL, +}; + +struct mobile_prim_intf { + struct osmocom_ms *ms; + void (*indication)(struct mobile_prim_intf *, struct mobile_prim *prim); + + /* Internal state */ + struct llist_head timers; +}; + +/** + * Primitive to create timers and get indication once they have + * expired. Currently there is no way to cancel timers. + */ +struct mobile_timer_param { + uint64_t timer_id; /*!< Unique Id identifying the timer */ + int seconds; /*!< Seconds the timer should fire in */ +}; + +struct mobile_prim { + struct osmo_prim_hdr hdr; /*!< Primitive base class */ + union { + struct mobile_timer_param timer; + } u; +}; + + +struct mobile_prim_intf *mobile_prim_intf_alloc(struct osmocom_ms *ms); +int mobile_prim_intf_req(struct mobile_prim_intf *intf, struct mobile_prim *hdr); +void mobile_prim_intf_free(struct mobile_prim_intf *intf); + +struct mobile_prim *mobile_prim_alloc(unsigned int primitive, enum osmo_prim_operation op); |