summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/l1ctl_proto.h5
-rw-r--r--src/host/layer23/include/osmocom/bb/common/l1ctl.h3
-rw-r--r--src/host/layer23/src/common/l1ctl.c17
-rw-r--r--src/target/firmware/apps/layer1/main.c2
-rw-r--r--src/target/firmware/layer1/l23_api.c15
5 files changed, 42 insertions, 0 deletions
diff --git a/include/l1ctl_proto.h b/include/l1ctl_proto.h
index e69a7f7c..7943c12e 100644
--- a/include/l1ctl_proto.h
+++ b/include/l1ctl_proto.h
@@ -67,6 +67,7 @@ enum {
/* Extended (11-bit) RACH (see 3GPP TS 05.02, section 5.2.7) */
L1CTL_EXT_RACH_REQ,
+ L1CTL_RINGER_REQ,
};
enum ccch_mode {
@@ -379,4 +380,8 @@ struct l1ctl_tbf_cfg_req {
uint8_t usf[8];
} __attribute__((packed));
+struct l1ctl_ringer_req {
+ uint8_t volume;
+} __attribute__((packed));
+
#endif /* __L1CTL_PROTO_H__ */
diff --git a/src/host/layer23/include/osmocom/bb/common/l1ctl.h b/src/host/layer23/include/osmocom/bb/common/l1ctl.h
index eb0e2c10..fb679bb8 100644
--- a/src/host/layer23/include/osmocom/bb/common/l1ctl.h
+++ b/src/host/layer23/include/osmocom/bb/common/l1ctl.h
@@ -74,4 +74,7 @@ int l1ctl_ph_prim_cb(struct osmo_prim_hdr *oph, void *ctx);
/* Transmit L1CTL_NEIGH_PM_REQ */
int l1ctl_tx_neigh_pm_req(struct osmocom_ms *ms, int num, uint16_t *arfcn);
+/* Transmit L1CTL_RINGER_REQ */
+int l1ctl_tx_ringer_req(struct osmocom_ms *ms, uint8_t volume);
+
#endif
diff --git a/src/host/layer23/src/common/l1ctl.c b/src/host/layer23/src/common/l1ctl.c
index 3bb4c14d..bc8869cd 100644
--- a/src/host/layer23/src/common/l1ctl.c
+++ b/src/host/layer23/src/common/l1ctl.c
@@ -902,6 +902,23 @@ static int rx_l1_neigh_pm_ind(struct osmocom_ms *ms, struct msgb *msg)
return 0;
}
+/* Transmit L1CTL_RINGER_REQ */
+int l1ctl_tx_ringer_req(struct osmocom_ms *ms, uint8_t volume)
+{
+ struct msgb *msg;
+ struct l1ctl_ringer_req *ring_req;
+
+ msg = osmo_l1_alloc(L1CTL_RINGER_REQ);
+ if (!msg)
+ return -1;
+
+ LOGP(DL1C, LOGL_INFO, "Tx RINGER Req (volume %u)\n", volume);
+ ring_req = (struct l1ctl_ringer_req *) msgb_put(msg, sizeof(*ring_req));
+ ring_req->volume = volume;
+
+ return osmo_send_l1(ms, msg);
+}
+
/* Receive incoming data from L1 using L1CTL format */
int l1ctl_recv(struct osmocom_ms *ms, struct msgb *msg)
{
diff --git a/src/target/firmware/apps/layer1/main.c b/src/target/firmware/apps/layer1/main.c
index 59ffe972..f122de6b 100644
--- a/src/target/firmware/apps/layer1/main.c
+++ b/src/target/firmware/apps/layer1/main.c
@@ -102,6 +102,8 @@ int main(void)
/* initialize SIM */
calypso_sim_init();
+ buzzer_mode_pwt(1);
+
puts("Power up simcard:\n");
memset(atr,0,sizeof(atr));
atrLength = calypso_sim_powerup(atr);
diff --git a/src/target/firmware/layer1/l23_api.c b/src/target/firmware/layer1/l23_api.c
index 5c5e2c71..1c1f0f08 100644
--- a/src/target/firmware/layer1/l23_api.c
+++ b/src/target/firmware/layer1/l23_api.c
@@ -46,6 +46,7 @@
#include <rf/trf6151.h>
#include <calypso/sim.h>
#include <calypso/dsp.h>
+#include <calypso/buzzer.h>
#include <l1ctl_proto.h>
@@ -628,6 +629,17 @@ static void l1ctl_sim_req(struct msgb *msg)
sim_apdu(len, data);
}
+static void l1ctl_ringer_req(struct msgb *msg)
+{
+ struct l1ctl_hdr *l1h = (struct l1ctl_hdr *) msg->data;
+ struct l1ctl_ringer_req *ring_req =
+ (struct l1ctl_ringer_req *) l1h->data;
+
+ printf("Ringtone Request: %u\n", ring_req->volume);
+ buzzer_volume(ring_req->volume);
+ buzzer_note(NOTE(NOTE_C, OCTAVE_4));
+}
+
static struct llist_head l23_rx_queue = LLIST_HEAD_INIT(l23_rx_queue);
/* callback from SERCOMM when L2 sends a message to L1 */
@@ -719,6 +731,9 @@ void l1a_l23_handler(void)
case L1CTL_SIM_REQ:
l1ctl_sim_req(msg);
break;
+ case L1CTL_RINGER_REQ:
+ l1ctl_ringer_req(msg);
+ break;
}
exit_msgbfree: