summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/comm
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-03-07 20:42:17 +0100
committerHarald Welte <laforge@gnumonks.org>2010-03-07 20:56:12 +0100
commit97c8b6f33b1a00ed1c138070ca14faaa6f71cfc6 (patch)
treeb8951a27ae92d4924e8cca7599eafb777143e2af /src/target/firmware/comm
parent5f3ead20158d059d022a11e121861e14bd0674df (diff)
start to use libosmocore within the firmware
* remove linuxlist.h copy and use osmocore * don't put 'struct gsm_time' into l1ctl packets * include rx_level and snr for each burst in l1ctl * properly build libosmocore.a for target * move gsmtime functions into libosmocore * move ctype.h to standard location
Diffstat (limited to 'src/target/firmware/comm')
-rw-r--r--src/target/firmware/comm/msgb.c61
-rw-r--r--src/target/firmware/comm/sercomm.c6
-rw-r--r--src/target/firmware/comm/sercomm_cons.c2
-rw-r--r--src/target/firmware/comm/timer.c2
4 files changed, 8 insertions, 63 deletions
diff --git a/src/target/firmware/comm/msgb.c b/src/target/firmware/comm/msgb.c
index 866fd3c5..d96d0980 100644
--- a/src/target/firmware/comm/msgb.c
+++ b/src/target/firmware/comm/msgb.c
@@ -25,7 +25,7 @@
#include <debug.h>
-#include <comm/msgb.h>
+#include <osmocore/msgb.h>
#include <calypso/backlight.h>
@@ -43,7 +43,7 @@ struct supermsg {
uint8_t buf[MSGB_DATA_SIZE];
};
static struct supermsg msgs[MSGB_NUM];
-static void *_talloc_zero(void *ctx, unsigned int size, const char *name)
+void *_talloc_zero(void *ctx, unsigned int size, const char *name)
{
unsigned int i;
if (size > sizeof(struct msgb) + MSGB_DATA_SIZE)
@@ -65,64 +65,9 @@ static void *_talloc_zero(void *ctx, unsigned int size, const char *name)
panic:
return NULL;
}
-static void talloc_free(void *msg)
+void talloc_free(void *msg)
{
struct supermsg *smsg = container_of(msg, struct supermsg, msg);
smsg->allocated = 0;
}
#endif
-
-struct msgb *msgb_alloc(uint16_t size, const char *name)
-{
- struct msgb *msg;
-
- msg = _talloc_zero(tall_msgb_ctx, sizeof(*msg) + size, name);
-
- if (!msg) {
- return NULL;
- }
-
- msg->data_len = size;
- msg->len = 0;
-
- msg->data = msg->_data;
- msg->head = msg->_data;
- msg->tail = msg->_data;
-
- return msg;
-}
-
-void msgb_free(struct msgb *m)
-{
- talloc_free(m);
-}
-
-void msgb_enqueue(struct llist_head *queue, struct msgb *msg)
-{
- llist_add_tail(&msg->list, queue);
-}
-
-struct msgb *msgb_dequeue(struct llist_head *queue)
-{
- struct llist_head *lh;
-
- if (llist_empty(queue))
- return NULL;
-
- lh = queue->next;
- llist_del(lh);
-
- return llist_entry(lh, struct msgb, list);
-}
-
-void msgb_reset(struct msgb *msg)
-{
- msg->len = 0;
-
- msg->data = msg->_data;
- msg->head = msg->_data;
- msg->tail = msg->_data;
-
- msg->l2h = NULL;
- msg->l3h = NULL;
-}
diff --git a/src/target/firmware/comm/sercomm.c b/src/target/firmware/comm/sercomm.c
index ddc53df3..e433e4d6 100644
--- a/src/target/firmware/comm/sercomm.c
+++ b/src/target/firmware/comm/sercomm.c
@@ -24,11 +24,12 @@
#include <stdio.h>
#include <errno.h>
+#include <osmocore/msgb.h>
+
#ifdef HOST_BUILD
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#endif
-#include <osmocore/msgb.h>
#include <sercomm.h>
#define local_irq_save(x)
#define local_fiq_disable()
@@ -36,10 +37,9 @@
#else
#include <debug.h>
-#include <linuxlist.h>
+#include <osmocore/linuxlist.h>
#include <asm/system.h>
-#include <comm/msgb.h>
#include <comm/sercomm.h>
#include <calypso/uart.h>
#endif
diff --git a/src/target/firmware/comm/sercomm_cons.c b/src/target/firmware/comm/sercomm_cons.c
index d34764bd..5d7842fb 100644
--- a/src/target/firmware/comm/sercomm_cons.c
+++ b/src/target/firmware/comm/sercomm_cons.c
@@ -29,7 +29,7 @@
#include <calypso/uart.h>
#include <console.h>
-#include <comm/msgb.h>
+#include <osmocore/msgb.h>
#include <comm/sercomm.h>
#include <comm/sercomm_cons.h>
diff --git a/src/target/firmware/comm/timer.c b/src/target/firmware/comm/timer.c
index 55656f00..d69ef542 100644
--- a/src/target/firmware/comm/timer.c
+++ b/src/target/firmware/comm/timer.c
@@ -20,7 +20,7 @@
#include <stdint.h>
#include <debug.h>
-#include <linuxlist.h>
+#include <osmocore/linuxlist.h>
#include <comm/timer.h>