summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/include
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/include
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/include')
-rw-r--r--src/target/firmware/include/comm/msgb.h2
-rw-r--r--src/target/firmware/include/comm/sercomm.h5
-rw-r--r--src/target/firmware/include/comm/timer.h2
-rw-r--r--src/target/firmware/include/ctype.h (renamed from src/target/firmware/include/asm/ctype.h)0
-rw-r--r--src/target/firmware/include/gsm.h30
-rw-r--r--src/target/firmware/include/layer1/async.h2
-rw-r--r--src/target/firmware/include/layer1/l23_api.h2
-rw-r--r--src/target/firmware/include/layer1/sched_gsmtime.h2
-rw-r--r--src/target/firmware/include/layer1/sync.h3
-rw-r--r--src/target/firmware/include/linuxlist.h361
-rw-r--r--src/target/firmware/include/rf/trf6151.h2
-rw-r--r--src/target/firmware/include/rffe.h2
-rw-r--r--src/target/firmware/include/stdio.h5
13 files changed, 15 insertions, 403 deletions
diff --git a/src/target/firmware/include/comm/msgb.h b/src/target/firmware/include/comm/msgb.h
index 07fdebd2..83e6540c 100644
--- a/src/target/firmware/include/comm/msgb.h
+++ b/src/target/firmware/include/comm/msgb.h
@@ -20,7 +20,7 @@
*
*/
-#include <linuxlist.h>
+#include <osmocore/linuxlist.h>
struct msgb {
struct llist_head list;
diff --git a/src/target/firmware/include/comm/sercomm.h b/src/target/firmware/include/comm/sercomm.h
index e9f560e2..45a1e995 100644
--- a/src/target/firmware/include/comm/sercomm.h
+++ b/src/target/firmware/include/comm/sercomm.h
@@ -3,12 +3,9 @@
/* SERCOMM layer on UART1 (modem UART) */
-#ifdef HOST_BUILD
#include <osmocore/msgb.h>
-#else
-#include <comm/msgb.h>
+
#define SERCOMM_UART_NR 1
-#endif
#define HDLC_FLAG 0x7E
#define HDLC_ESCAPE 0x7D
diff --git a/src/target/firmware/include/comm/timer.h b/src/target/firmware/include/comm/timer.h
index 184a6240..814d2c60 100644
--- a/src/target/firmware/include/comm/timer.h
+++ b/src/target/firmware/include/comm/timer.h
@@ -23,7 +23,7 @@
#include <sys/time.h>
-#include <linuxlist.h>
+#include <osmocore/linuxlist.h>
/**
* Timer management:
diff --git a/src/target/firmware/include/asm/ctype.h b/src/target/firmware/include/ctype.h
index afa36392..afa36392 100644
--- a/src/target/firmware/include/asm/ctype.h
+++ b/src/target/firmware/include/ctype.h
diff --git a/src/target/firmware/include/gsm.h b/src/target/firmware/include/gsm.h
deleted file mode 100644
index 59b2b1e4..00000000
--- a/src/target/firmware/include/gsm.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef _GSM_H
-#define _GSM_H
-
-#include <l1a_l23_interface.h>
-
-enum gsm_band {
- GSM_850 = 1,
- GSM_900 = 2,
- GSM_1800 = 4,
- GSM_1900 = 8,
- GSM_450 = 0x10,
- GSM_480 = 0x20,
- GSM_750 = 0x40,
- GSM_810 = 0x80,
-};
-
-#define ARFCN_PCS 0x8000
-#define ARFCN_UPLINK 0x4000
-
-enum gsm_band gsm_arfcn2band(uint16_t arfcn);
-
-/* Convert an ARFCN to the frequency in MHz * 10 */
-uint16_t gsm_arfcn2freq10(uint16_t arfcn, int uplink);
-
-/* Convert from frame number to GSM time */
-void gsm_fn2gsmtime(struct gsm_time *time, uint32_t fn);
-
-/* Convert from GSM time to frame number */
-uint32_t gsm_gsmtime2fn(struct gsm_time *time);
-#endif
diff --git a/src/target/firmware/include/layer1/async.h b/src/target/firmware/include/layer1/async.h
index 898a4179..fde63e84 100644
--- a/src/target/firmware/include/layer1/async.h
+++ b/src/target/firmware/include/layer1/async.h
@@ -1,7 +1,7 @@
#ifndef _L1_ASYNC_H
#define _L1_ASYNC_H
-#include <comm/msgb.h>
+#include <osmocore/msgb.h>
#include <layer1/mframe_sched.h>
diff --git a/src/target/firmware/include/layer1/l23_api.h b/src/target/firmware/include/layer1/l23_api.h
index f7723852..69d4203a 100644
--- a/src/target/firmware/include/layer1/l23_api.h
+++ b/src/target/firmware/include/layer1/l23_api.h
@@ -2,7 +2,7 @@
#define _L1_L23_API_H
#include <stdint.h>
-#include <comm/msgb.h>
+#include <osmocore/msgb.h>
#include <l1a_l23_interface.h>
void l1a_l23api_init(void);
diff --git a/src/target/firmware/include/layer1/sched_gsmtime.h b/src/target/firmware/include/layer1/sched_gsmtime.h
index eb537281..c45054cf 100644
--- a/src/target/firmware/include/layer1/sched_gsmtime.h
+++ b/src/target/firmware/include/layer1/sched_gsmtime.h
@@ -2,7 +2,7 @@
#define _L1_SCHED_GSMTIME_H
#include <stdint.h>
-#include <linuxlist.h>
+#include <osmocore/linuxlist.h>
struct sched_gsmtime_event {
struct llist_head list;
diff --git a/src/target/firmware/include/layer1/sync.h b/src/target/firmware/include/layer1/sync.h
index 392ef69d..e448cf1a 100644
--- a/src/target/firmware/include/layer1/sync.h
+++ b/src/target/firmware/include/layer1/sync.h
@@ -1,7 +1,8 @@
#ifndef _L1_SYNC_H
#define _L1_SYNC_H
-#include <linuxlist.h>
+#include <osmocore/linuxlist.h>
+#include <osmocore/gsm_utils.h>
#include <layer1/tdma_sched.h>
#include <l1a_l23_interface.h>
diff --git a/src/target/firmware/include/linuxlist.h b/src/target/firmware/include/linuxlist.h
deleted file mode 100644
index 1bc8b60d..00000000
--- a/src/target/firmware/include/linuxlist.h
+++ /dev/null
@@ -1,361 +0,0 @@
-#ifndef _LINUX_LLIST_H
-#define _LINUX_LLIST_H
-
-#include <stddef.h>
-#include <defines.h>
-
-#ifndef inline
-#define inline __inline__
-#endif
-
-static inline void prefetch(__unused const void *x) {;}
-
-/**
- * container_of - cast a member of a structure out to the containing structure
- *
- * @ptr: the pointer to the member.
- * @type: the type of the container struct this is embedded in.
- * @member: the name of the member within the struct.
- *
- */
-#define container_of(ptr, type, member) ({ \
- const typeof( ((type *)0)->member ) *__mptr = (typeof( ((type *)0)->member ) *)(ptr); \
- (type *)( (char *)__mptr - offsetof(type, member) );})
-
-
-/*
- * These are non-NULL pointers that will result in page faults
- * under normal circumstances, used to verify that nobody uses
- * non-initialized llist entries.
- */
-#define LLIST_POISON1 ((void *) 0x00100100)
-#define LLIST_POISON2 ((void *) 0x00200200)
-
-/*
- * Simple doubly linked llist implementation.
- *
- * Some of the internal functions ("__xxx") are useful when
- * manipulating whole llists rather than single entries, as
- * sometimes we already know the next/prev entries and we can
- * generate better code by using them directly rather than
- * using the generic single-entry routines.
- */
-
-struct llist_head {
- struct llist_head *next, *prev;
-};
-
-#define LLIST_HEAD_INIT(name) { &(name), &(name) }
-
-#define LLIST_HEAD(name) \
- struct llist_head name = LLIST_HEAD_INIT(name)
-
-#define INIT_LLIST_HEAD(ptr) do { \
- (ptr)->next = (ptr); (ptr)->prev = (ptr); \
-} while (0)
-
-/*
- * Insert a new entry between two known consecutive entries.
- *
- * This is only for internal llist manipulation where we know
- * the prev/next entries already!
- */
-static inline void __llist_add(struct llist_head *_new,
- struct llist_head *prev,
- struct llist_head *next)
-{
- next->prev = _new;
- _new->next = next;
- _new->prev = prev;
- prev->next = _new;
-}
-
-/**
- * llist_add - add a new entry
- * @new: new entry to be added
- * @head: llist head to add it after
- *
- * Insert a new entry after the specified head.
- * This is good for implementing stacks.
- */
-static inline void llist_add(struct llist_head *_new, struct llist_head *head)
-{
- __llist_add(_new, head, head->next);
-}
-
-/**
- * llist_add_tail - add a new entry
- * @new: new entry to be added
- * @head: llist head to add it before
- *
- * Insert a new entry before the specified head.
- * This is useful for implementing queues.
- */
-static inline void llist_add_tail(struct llist_head *_new, struct llist_head *head)
-{
- __llist_add(_new, head->prev, head);
-}
-
-/*
- * Delete a llist entry by making the prev/next entries
- * point to each other.
- *
- * This is only for internal llist manipulation where we know
- * the prev/next entries already!
- */
-static inline void __llist_del(struct llist_head * prev, struct llist_head * next)
-{
- next->prev = prev;
- prev->next = next;
-}
-
-/**
- * llist_del - deletes entry from llist.
- * @entry: the element to delete from the llist.
- * Note: llist_empty on entry does not return true after this, the entry is
- * in an undefined state.
- */
-static inline void llist_del(struct llist_head *entry)
-{
- __llist_del(entry->prev, entry->next);
- entry->next = (struct llist_head *)LLIST_POISON1;
- entry->prev = (struct llist_head *)LLIST_POISON2;
-}
-
-/**
- * llist_del_init - deletes entry from llist and reinitialize it.
- * @entry: the element to delete from the llist.
- */
-static inline void llist_del_init(struct llist_head *entry)
-{
- __llist_del(entry->prev, entry->next);
- INIT_LLIST_HEAD(entry);
-}
-
-/**
- * llist_move - delete from one llist and add as another's head
- * @llist: the entry to move
- * @head: the head that will precede our entry
- */
-static inline void llist_move(struct llist_head *llist, struct llist_head *head)
-{
- __llist_del(llist->prev, llist->next);
- llist_add(llist, head);
-}
-
-/**
- * llist_move_tail - delete from one llist and add as another's tail
- * @llist: the entry to move
- * @head: the head that will follow our entry
- */
-static inline void llist_move_tail(struct llist_head *llist,
- struct llist_head *head)
-{
- __llist_del(llist->prev, llist->next);
- llist_add_tail(llist, head);
-}
-
-/**
- * llist_empty - tests whether a llist is empty
- * @head: the llist to test.
- */
-static inline int llist_empty(const struct llist_head *head)
-{
- return head->next == head;
-}
-
-static inline void __llist_splice(struct llist_head *llist,
- struct llist_head *head)
-{
- struct llist_head *first = llist->next;
- struct llist_head *last = llist->prev;
- struct llist_head *at = head->next;
-
- first->prev = head;
- head->next = first;
-
- last->next = at;
- at->prev = last;
-}
-
-/**
- * llist_splice - join two llists
- * @llist: the new llist to add.
- * @head: the place to add it in the first llist.
- */
-static inline void llist_splice(struct llist_head *llist, struct llist_head *head)
-{
- if (!llist_empty(llist))
- __llist_splice(llist, head);
-}
-
-/**
- * llist_splice_init - join two llists and reinitialise the emptied llist.
- * @llist: the new llist to add.
- * @head: the place to add it in the first llist.
- *
- * The llist at @llist is reinitialised
- */
-static inline void llist_splice_init(struct llist_head *llist,
- struct llist_head *head)
-{
- if (!llist_empty(llist)) {
- __llist_splice(llist, head);
- INIT_LLIST_HEAD(llist);
- }
-}
-
-/**
- * llist_entry - get the struct for this entry
- * @ptr: the &struct llist_head pointer.
- * @type: the type of the struct this is embedded in.
- * @member: the name of the llist_struct within the struct.
- */
-#define llist_entry(ptr, type, member) \
- container_of(ptr, type, member)
-
-/**
- * llist_for_each - iterate over a llist
- * @pos: the &struct llist_head to use as a loop counter.
- * @head: the head for your llist.
- */
-#define llist_for_each(pos, head) \
- for (pos = (head)->next, prefetch(pos->next); pos != (head); \
- pos = pos->next, prefetch(pos->next))
-
-/**
- * __llist_for_each - iterate over a llist
- * @pos: the &struct llist_head to use as a loop counter.
- * @head: the head for your llist.
- *
- * This variant differs from llist_for_each() in that it's the
- * simplest possible llist iteration code, no prefetching is done.
- * Use this for code that knows the llist to be very short (empty
- * or 1 entry) most of the time.
- */
-#define __llist_for_each(pos, head) \
- for (pos = (head)->next; pos != (head); pos = pos->next)
-
-/**
- * llist_for_each_prev - iterate over a llist backwards
- * @pos: the &struct llist_head to use as a loop counter.
- * @head: the head for your llist.
- */
-#define llist_for_each_prev(pos, head) \
- for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \
- pos = pos->prev, prefetch(pos->prev))
-
-/**
- * llist_for_each_safe - iterate over a llist safe against removal of llist entry
- * @pos: the &struct llist_head to use as a loop counter.
- * @n: another &struct llist_head to use as temporary storage
- * @head: the head for your llist.
- */
-#define llist_for_each_safe(pos, n, head) \
- for (pos = (head)->next, n = pos->next; pos != (head); \
- pos = n, n = pos->next)
-
-/**
- * llist_for_each_entry - iterate over llist of given type
- * @pos: the type * to use as a loop counter.
- * @head: the head for your llist.
- * @member: the name of the llist_struct within the struct.
- */
-#define llist_for_each_entry(pos, head, member) \
- for (pos = llist_entry((head)->next, typeof(*pos), member), \
- prefetch(pos->member.next); \
- &pos->member != (head); \
- pos = llist_entry(pos->member.next, typeof(*pos), member), \
- prefetch(pos->member.next))
-
-/**
- * llist_for_each_entry_reverse - iterate backwards over llist of given type.
- * @pos: the type * to use as a loop counter.
- * @head: the head for your llist.
- * @member: the name of the llist_struct within the struct.
- */
-#define llist_for_each_entry_reverse(pos, head, member) \
- for (pos = llist_entry((head)->prev, typeof(*pos), member), \
- prefetch(pos->member.prev); \
- &pos->member != (head); \
- pos = llist_entry(pos->member.prev, typeof(*pos), member), \
- prefetch(pos->member.prev))
-
-/**
- * llist_for_each_entry_continue - iterate over llist of given type
- * continuing after existing point
- * @pos: the type * to use as a loop counter.
- * @head: the head for your llist.
- * @member: the name of the llist_struct within the struct.
- */
-#define llist_for_each_entry_continue(pos, head, member) \
- for (pos = llist_entry(pos->member.next, typeof(*pos), member), \
- prefetch(pos->member.next); \
- &pos->member != (head); \
- pos = llist_entry(pos->member.next, typeof(*pos), member), \
- prefetch(pos->member.next))
-
-/**
- * llist_for_each_entry_safe - iterate over llist of given type safe against removal of llist entry
- * @pos: the type * to use as a loop counter.
- * @n: another type * to use as temporary storage
- * @head: the head for your llist.
- * @member: the name of the llist_struct within the struct.
- */
-#define llist_for_each_entry_safe(pos, n, head, member) \
- for (pos = llist_entry((head)->next, typeof(*pos), member), \
- n = llist_entry(pos->member.next, typeof(*pos), member); \
- &pos->member != (head); \
- pos = n, n = llist_entry(n->member.next, typeof(*n), member))
-
-/**
- * llist_for_each_rcu - iterate over an rcu-protected llist
- * @pos: the &struct llist_head to use as a loop counter.
- * @head: the head for your llist.
- */
-#define llist_for_each_rcu(pos, head) \
- for (pos = (head)->next, prefetch(pos->next); pos != (head); \
- pos = pos->next, ({ smp_read_barrier_depends(); 0;}), prefetch(pos->next))
-
-#define __llist_for_each_rcu(pos, head) \
- for (pos = (head)->next; pos != (head); \
- pos = pos->next, ({ smp_read_barrier_depends(); 0;}))
-
-/**
- * llist_for_each_safe_rcu - iterate over an rcu-protected llist safe
- * against removal of llist entry
- * @pos: the &struct llist_head to use as a loop counter.
- * @n: another &struct llist_head to use as temporary storage
- * @head: the head for your llist.
- */
-#define llist_for_each_safe_rcu(pos, n, head) \
- for (pos = (head)->next, n = pos->next; pos != (head); \
- pos = n, ({ smp_read_barrier_depends(); 0;}), n = pos->next)
-
-/**
- * llist_for_each_entry_rcu - iterate over rcu llist of given type
- * @pos: the type * to use as a loop counter.
- * @head: the head for your llist.
- * @member: the name of the llist_struct within the struct.
- */
-#define llist_for_each_entry_rcu(pos, head, member) \
- for (pos = llist_entry((head)->next, typeof(*pos), member), \
- prefetch(pos->member.next); \
- &pos->member != (head); \
- pos = llist_entry(pos->member.next, typeof(*pos), member), \
- ({ smp_read_barrier_depends(); 0;}), \
- prefetch(pos->member.next))
-
-
-/**
- * llist_for_each_continue_rcu - iterate over an rcu-protected llist
- * continuing after existing point.
- * @pos: the &struct llist_head to use as a loop counter.
- * @head: the head for your llist.
- */
-#define llist_for_each_continue_rcu(pos, head) \
- for ((pos) = (pos)->next, prefetch((pos)->next); (pos) != (head); \
- (pos) = (pos)->next, ({ smp_read_barrier_depends(); 0;}), prefetch((pos)->next))
-
-
-#endif
diff --git a/src/target/firmware/include/rf/trf6151.h b/src/target/firmware/include/rf/trf6151.h
index 77855d06..889baaa7 100644
--- a/src/target/firmware/include/rf/trf6151.h
+++ b/src/target/firmware/include/rf/trf6151.h
@@ -1,7 +1,7 @@
#ifndef _TRF6151_H
#define _TRF6151_H
-#include <gsm.h>
+#include <osmocore/gsm_utils.h>
/* initialize (reset + power up) */
void trf6151_init(void);
diff --git a/src/target/firmware/include/rffe.h b/src/target/firmware/include/rffe.h
index 2e0c8ca4..e397f9c9 100644
--- a/src/target/firmware/include/rffe.h
+++ b/src/target/firmware/include/rffe.h
@@ -1,7 +1,7 @@
#ifndef _RFFE_H
#define _RFFE_H
-#include <gsm.h>
+#include <osmocore/gsm_utils.h>
/* initialize RF Frontend */
void rffe_init(void);
diff --git a/src/target/firmware/include/stdio.h b/src/target/firmware/include/stdio.h
index c1f86371..15ed6688 100644
--- a/src/target/firmware/include/stdio.h
+++ b/src/target/firmware/include/stdio.h
@@ -41,6 +41,11 @@ int puts(const char *s);
#define ARCH_HAS_CONSOLE
#endif
+struct __file {
+};
+
+typedef struct __file FILE;
+
/* non-standard */
extern void phex(unsigned int c, unsigned int len);