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
This commit is contained in:
parent
5f3ead2015
commit
97c8b6f33b
|
@ -37,14 +37,6 @@
|
|||
* that it will avoid some unaligned access.
|
||||
*/
|
||||
|
||||
struct gsm_time {
|
||||
uint32_t fn; /* FN count */
|
||||
uint16_t t1; /* FN div (26*51) */
|
||||
uint8_t t2; /* FN modulo 26 */
|
||||
uint8_t t3; /* FN modulo 51 */
|
||||
uint8_t tc;
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* downlink info ... down from the BTS..
|
||||
*/
|
||||
|
@ -58,12 +50,13 @@ struct l1ctl_info_dl {
|
|||
/* GSM 08.58 link identifier (9.3.2) */
|
||||
uint8_t link_id;
|
||||
|
||||
uint32_t frame_nr;
|
||||
|
||||
/* the ARFCN and the band. FIXME: what about MAIO? */
|
||||
uint16_t band_arfcn;
|
||||
|
||||
struct gsm_time time;
|
||||
uint8_t rx_level;
|
||||
uint16_t snr[4];
|
||||
uint8_t rx_level; /* 0 .. 63 in typical GSM notation (dBm+110) */
|
||||
uint8_t snr; /* Signal/Noise Ration (dB) */
|
||||
} __attribute__((packed));
|
||||
|
||||
/* new CCCH was found. This is following the header */
|
||||
|
|
|
@ -33,8 +33,9 @@ shared/libosmocore/build-target:
|
|||
mkdir $@
|
||||
|
||||
shared/libosmocore/build-target/Makefile: shared/libosmocore/configure shared/libosmocore/build-target
|
||||
cd shared/libosmocore/build-target && ../configure --host=arm-elf-linux --disable-shared \
|
||||
CFLAGS="-Os -ffunction-sections"
|
||||
cd shared/libosmocore/build-target && ../configure \
|
||||
--host=arm-elf-linux --disable-shared --disable-talloc --disable-tests \
|
||||
CC="$(CROSS_TOOL_PREFIX)gcc" CFLAGS="-Os -ffunction-sections -I../../../../target/firmware/include"
|
||||
|
||||
shared/libosmocore/build-target/src/.libs/libosmocore.a: shared/libosmocore/build-target/Makefile
|
||||
cd shared/libosmocore/build-target && make
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <osmocore/timer.h>
|
||||
#include <osmocore/msgb.h>
|
||||
#include <osmocore/tlv.h>
|
||||
#include <osmocore/gsm_utils.h>
|
||||
#include <osmocore/protocol/gsm_04_08.h>
|
||||
#include <osmocore/protocol/gsm_08_58.h>
|
||||
#include <osmocore/rsl.h>
|
||||
|
@ -68,6 +69,7 @@ static int rx_l1_ccch_resp(struct osmocom_ms *ms, struct msgb *msg)
|
|||
{
|
||||
struct l1ctl_info_dl *dl;
|
||||
struct l1ctl_sync_new_ccch_resp *sb;
|
||||
struct gsm_time tm;
|
||||
|
||||
if (msgb_l3len(msg) < sizeof(*sb)) {
|
||||
fprintf(stderr, "MSG too short for CCCH RESP: %u\n", msgb_l3len(msg));
|
||||
|
@ -77,8 +79,9 @@ static int rx_l1_ccch_resp(struct osmocom_ms *ms, struct msgb *msg)
|
|||
dl = (struct l1ctl_info_dl *) msg->l1h;
|
||||
sb = (struct l1ctl_sync_new_ccch_resp *) msg->l2h;
|
||||
|
||||
gsm_fn2gsmtime(&tm, ntohl(dl->frame_nr));
|
||||
printf("SCH: SNR: %u TDMA: (%.4u/%.2u/%.2u) bsic: %d\n",
|
||||
dl->snr[0], dl->time.t1, dl->time.t2, dl->time.t3, sb->bsic);
|
||||
dl->snr, tm.t1, tm.t2, tm.t3, sb->bsic);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -118,6 +121,7 @@ static int rx_ph_data_ind(struct osmocom_ms *ms, struct msgb *msg)
|
|||
struct lapdm_entity *le;
|
||||
uint8_t chan_type, chan_ts, chan_ss;
|
||||
uint8_t gsmtap_chan_type;
|
||||
struct gsm_time tm;
|
||||
|
||||
if (msgb_l3len(msg) < sizeof(*ccch)) {
|
||||
fprintf(stderr, "MSG too short Data Ind: %u\n", msgb_l3len(msg));
|
||||
|
@ -127,15 +131,16 @@ static int rx_ph_data_ind(struct osmocom_ms *ms, struct msgb *msg)
|
|||
dl = (struct l1ctl_info_dl *) msg->l1h;
|
||||
ccch = (struct l1ctl_data_ind *) msg->l2h;
|
||||
|
||||
gsm_fn2gsmtime(&tm, ntohl(dl->frame_nr));
|
||||
rsl_dec_chan_nr(dl->chan_nr, &chan_type, &chan_ss, &chan_ts);
|
||||
printf("%s (%.4u/%.2u/%.2u) %s\n",
|
||||
chan_nr2string(dl->chan_nr), dl->time.t1, dl->time.t2,
|
||||
dl->time.t3, hexdump(ccch->data, sizeof(ccch->data)));
|
||||
chan_nr2string(dl->chan_nr), tm.t1, tm.t2, tm.t3,
|
||||
hexdump(ccch->data, sizeof(ccch->data)));
|
||||
|
||||
/* send CCCH data via GSMTAP */
|
||||
gsmtap_chan_type = chantype_rsl2gsmtap(chan_type, dl->link_id);
|
||||
gsmtap_sendmsg(dl->band_arfcn, chan_ts, gsmtap_chan_type, chan_ss,
|
||||
dl->time.fn, ccch->data, sizeof(ccch->data));
|
||||
tm.fn, ccch->data, sizeof(ccch->data));
|
||||
|
||||
/* determine LAPDm entity based on SACCH or not */
|
||||
if (dl->link_id & 0x40)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
# Global include path
|
||||
INCLUDES=-Iinclude/ -I../../../include -I../../shared/libosmocore/build-target/include
|
||||
INCLUDES=-Iinclude/ -I../../../include -I../../shared/libosmocore/include
|
||||
|
||||
# Various objects that are currently linked into all applications
|
||||
FLASH_OBJS=flash/cfi_flash.o
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gsm.h>
|
||||
#include <debug.h>
|
||||
#include <memory.h>
|
||||
#include <rffe.h>
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gsm.h>
|
||||
#include <debug.h>
|
||||
#include <memory.h>
|
||||
#include <rffe.h>
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <gsm.h>
|
||||
#include <debug.h>
|
||||
#include <memory.h>
|
||||
#include <rffe.h>
|
||||
|
|
|
@ -30,7 +30,7 @@ void rffe_mode(enum gsm_band band, int tx)
|
|||
/* Then we selectively set the bits on, if required */
|
||||
if (tx) {
|
||||
tspact &= ~TRENA;
|
||||
if (band == GSM_900)
|
||||
if (band == GSM_BAND_900)
|
||||
tspact &= ~GSM_TXEN;
|
||||
tspact |= PA_ENABLE; /* Dieter: TODO */
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <defines.h>
|
||||
#include <console.h>
|
||||
#include <comm/sercomm.h>
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#include <debug.h>
|
||||
#include <linuxlist.h>
|
||||
#include <osmocore/linuxlist.h>
|
||||
|
||||
#include <comm/timer.h>
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <linuxlist.h>
|
||||
#include <osmocore/linuxlist.h>
|
||||
|
||||
struct msgb {
|
||||
struct llist_head list;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <linuxlist.h>
|
||||
#include <osmocore/linuxlist.h>
|
||||
|
||||
/**
|
||||
* Timer management:
|
||||
|
|
|
@ -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
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
LIBRARIES+=layer1
|
||||
layer1_DIR=layer1
|
||||
layer1_SRCS=avg.c agc.c afc.c sync.c gsm.c tdma_sched.c tpu_window.c init.c l23_api.c \
|
||||
layer1_SRCS=avg.c agc.c afc.c sync.c tdma_sched.c tpu_window.c init.c l23_api.c \
|
||||
mframe_sched.c sched_gsmtime.c async.c
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include <debug.h>
|
||||
#include <gsm.h>
|
||||
#include <osmocore/gsm_utils.h>
|
||||
|
||||
#include <layer1/afc.h>
|
||||
#include <layer1/avg.h>
|
||||
|
@ -82,8 +82,8 @@ void afc_correct(int16_t freq_error, uint16_t arfcn)
|
|||
int16_t delta;
|
||||
|
||||
switch (gsm_arfcn2band(arfcn)) {
|
||||
case GSM_900:
|
||||
case GSM_850:
|
||||
case GSM_BAND_900:
|
||||
case GSM_BAND_850:
|
||||
afc_norm_factor = AFC_NORM_FACTOR_GSM;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <osmocore/gsm_utils.h>
|
||||
#include <debug.h>
|
||||
#include <gsm.h>
|
||||
#include <rffe.h>
|
||||
|
||||
#include <layer1/agc.h>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <debug.h>
|
||||
#include <arm.h>
|
||||
|
||||
#include <comm/msgb.h>
|
||||
#include <osmocore/msgb.h>
|
||||
|
||||
#include <layer1/sync.h>
|
||||
#include <layer1/mframe_sched.h>
|
||||
|
|
|
@ -1,117 +0,0 @@
|
|||
/* Generic GSM utility routines */
|
||||
|
||||
/* (C) 2010 by Harald Welte <laforge@gnumonks.org>
|
||||
*
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <gsm.h>
|
||||
|
||||
enum gsm_band gsm_arfcn2band(uint16_t arfcn)
|
||||
{
|
||||
if (arfcn & ARFCN_PCS)
|
||||
return GSM_1900;
|
||||
else if (arfcn <= 124)
|
||||
return GSM_900;
|
||||
else if (arfcn >= 955 && arfcn <= 1023)
|
||||
return GSM_900;
|
||||
else if (arfcn >= 128 && arfcn <= 251)
|
||||
return GSM_850;
|
||||
else if (arfcn >= 512 && arfcn <= 885)
|
||||
return GSM_1800;
|
||||
else if (arfcn >= 259 && arfcn <= 293)
|
||||
return GSM_450;
|
||||
else if (arfcn >= 306 && arfcn <= 340)
|
||||
return GSM_480;
|
||||
else if (arfcn >= 350 && arfcn <= 425)
|
||||
return GSM_810;
|
||||
else if (arfcn >= 438 && arfcn <= 511)
|
||||
return GSM_750;
|
||||
else
|
||||
return GSM_1800;
|
||||
}
|
||||
|
||||
/* Convert an ARFCN to the frequency in MHz * 10 */
|
||||
uint16_t gsm_arfcn2freq10(uint16_t arfcn, int uplink)
|
||||
{
|
||||
uint16_t freq10_ul;
|
||||
uint16_t freq10_dl;
|
||||
|
||||
if (arfcn & ARFCN_PCS) {
|
||||
/* DCS 1900 */
|
||||
arfcn &= ~ARFCN_PCS;
|
||||
freq10_ul = 18502 + 2 * (arfcn-512);
|
||||
freq10_dl = freq10_ul + 800;
|
||||
} else if (arfcn <= 124) {
|
||||
/* Primary GSM + ARFCN 0 of E-GSM */
|
||||
freq10_ul = 8900 + 2 * arfcn;
|
||||
freq10_dl = freq10_ul + 450;
|
||||
} else if (arfcn >= 955 && arfcn <= 1023) {
|
||||
/* E-GSM and R-GSM */
|
||||
freq10_ul = 8900 + 2 * (arfcn - 1024);
|
||||
freq10_dl = freq10_ul + 450;
|
||||
} else if (arfcn >= 128 && arfcn <= 251) {
|
||||
/* GSM 850 */
|
||||
freq10_ul = 8242 + 2 * (arfcn - 128);
|
||||
freq10_dl = freq10_ul + 450;
|
||||
} else if (arfcn >= 512 && arfcn <= 885) {
|
||||
/* DCS 1800 */
|
||||
freq10_ul = 17102 + 2 * (arfcn - 512);
|
||||
freq10_dl = freq10_ul + 950;
|
||||
} else if (arfcn >= 259 && arfcn <= 293) {
|
||||
/* GSM 450 */
|
||||
freq10_ul = 4506 + 2 * (arfcn - 259);
|
||||
freq10_dl = freq10_ul + 100;
|
||||
} else if (arfcn >= 306 && arfcn <= 340) {
|
||||
/* GSM 480 */
|
||||
freq10_ul = 4790 + 2 * (arfcn - 306);
|
||||
freq10_dl = freq10_ul + 100;
|
||||
} else if (arfcn >= 350 && arfcn <= 425) {
|
||||
/* GSM 810 */
|
||||
freq10_ul = 8060 + 2 * (arfcn - 350);
|
||||
freq10_dl = freq10_ul + 450;
|
||||
} else if (arfcn >= 438 && arfcn <= 511) {
|
||||
/* GSM 750 */
|
||||
freq10_ul = 7472 + 2 * (arfcn - 438);
|
||||
freq10_dl = freq10_ul + 300;
|
||||
} else
|
||||
return 0xffff;
|
||||
|
||||
if (uplink)
|
||||
return freq10_ul;
|
||||
else
|
||||
return freq10_dl;
|
||||
}
|
||||
|
||||
void gsm_fn2gsmtime(struct gsm_time *time, uint32_t fn)
|
||||
{
|
||||
time->fn = fn;
|
||||
time->t1 = time->fn / (26*51);
|
||||
time->t2 = time->fn % 26;
|
||||
time->t3 = time->fn % 51;
|
||||
time->tc = (time->fn / 51) % 8;
|
||||
}
|
||||
|
||||
uint32_t gsm_gsmtime2fn(struct gsm_time *time)
|
||||
{
|
||||
/* TS 05.02 Chapter 4.3.3 TDMA frame number */
|
||||
return (51 * ((time->t3 - time->t2 + 26) % 26) + time->t3 + (26 * 51 * time->t1));
|
||||
}
|
|
@ -26,7 +26,7 @@
|
|||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <comm/msgb.h>
|
||||
#include <osmocore/msgb.h>
|
||||
#include <comm/sercomm.h>
|
||||
|
||||
#include <layer1/sync.h>
|
||||
|
@ -94,9 +94,8 @@ struct msgb *l1_create_l2_msg(int msg_type, uint32_t fn, uint16_t snr,
|
|||
|
||||
dl = (struct l1ctl_info_dl *) msgb_put(msg, sizeof(*dl));
|
||||
dl->msg_type = msg_type;
|
||||
/* FIXME: we may want to compute T1/T2/T3 in L23 */
|
||||
gsm_fn2gsmtime(&dl->time, fn);
|
||||
dl->snr[0] = snr;
|
||||
dl->frame_nr = fn;
|
||||
dl->snr = snr;
|
||||
dl->band_arfcn = arfcn;
|
||||
|
||||
return msg;
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
#include <string.h>
|
||||
|
||||
#include <debug.h>
|
||||
#include <gsm.h>
|
||||
|
||||
#include <osmocore/gsm_utils.h>
|
||||
|
||||
#include <layer1/sync.h>
|
||||
#include <layer1/tdma_sched.h>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <errno.h>
|
||||
|
||||
#include <debug.h>
|
||||
#include <linuxlist.h>
|
||||
#include <osmocore/linuxlist.h>
|
||||
|
||||
#include <layer1/tdma_sched.h>
|
||||
#include <layer1/sched_gsmtime.h>
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
#include <defines.h>
|
||||
#include <debug.h>
|
||||
#include <memory.h>
|
||||
#include <gsm.h>
|
||||
#include <osmocore/gsm_utils.h>
|
||||
#include <osmocore/msgb.h>
|
||||
#include <calypso/dsp_api.h>
|
||||
#include <calypso/irq.h>
|
||||
#include <calypso/tpu.h>
|
||||
|
@ -38,7 +39,6 @@
|
|||
#include <calypso/dsp.h>
|
||||
#include <calypso/timer.h>
|
||||
#include <comm/sercomm.h>
|
||||
#include <comm/msgb.h>
|
||||
|
||||
#include <abb/twl3025.h>
|
||||
|
||||
|
@ -846,6 +846,8 @@ static int l1s_nb_resp(__unused uint8_t p1, uint8_t burst_id, uint16_t p3)
|
|||
if (dsp_api.db_r->d_burst_d == 3) {
|
||||
struct l1ctl_info_dl *dl;
|
||||
struct l1ctl_data_ind *l1;
|
||||
uint32_t avg_snr = 0;
|
||||
int32_t avg_dbm8 = 0;
|
||||
uint8_t i, j;
|
||||
|
||||
sig->signum = L1_SIG_NB;
|
||||
|
@ -877,9 +879,15 @@ static int l1s_nb_resp(__unused uint8_t p1, uint8_t burst_id, uint16_t p3)
|
|||
else
|
||||
dl->link_id = 0x00;
|
||||
|
||||
/* copy the snr and data */
|
||||
for (i = 0; i < 3; ++i)
|
||||
dl->snr[i] = sig->nb.meas[i].snr;
|
||||
/* compute average snr and rx level */
|
||||
for (i = 0; i < 4; ++i) {
|
||||
avg_snr += sig->nb.meas[i].snr;
|
||||
avg_dbm8 += sig->nb.meas[i].pm_dbm8;
|
||||
}
|
||||
dl->snr = avg_snr / 4;
|
||||
dl->rx_level = (avg_dbm8 / (8*4)) + 110;
|
||||
|
||||
/* copy the actual payload data */
|
||||
for (i = 0; i < 23; ++i)
|
||||
l1->data[i] = sig->nb.frame[i];
|
||||
l1_queue_for_l2(msg);
|
||||
|
|
|
@ -24,8 +24,9 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <defines.h>
|
||||
#include <debug.h>
|
||||
#include <gsm.h>
|
||||
#include <osmocore/gsm_utils.h>
|
||||
|
||||
#include <layer1/tdma_sched.h>
|
||||
#include <layer1/sync.h>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 1991, 1992 Linus Torvalds
|
||||
*/
|
||||
|
||||
#include <asm/ctype.h>
|
||||
#include <ctype.h>
|
||||
|
||||
unsigned char _ctype[] = {
|
||||
_C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <asm/ctype.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
#ifndef __HAVE_ARCH_STRNLEN
|
||||
|
|
|
@ -21,17 +21,17 @@
|
|||
#include <stdarg.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <asm/ctype.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <asm/div64.h>
|
||||
|
||||
/**
|
||||
* simple_strtoul - convert a string to an unsigned long
|
||||
* strtoul - convert a string to an unsigned long
|
||||
* @cp: The start of the string
|
||||
* @endp: A pointer to the end of the parsed string will be placed here
|
||||
* @base: The number base to use
|
||||
*/
|
||||
unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
|
||||
unsigned long strtoul(const char *cp,char **endp,unsigned int base)
|
||||
{
|
||||
unsigned long result = 0,value;
|
||||
|
||||
|
@ -61,26 +61,26 @@ unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
|
|||
|
||||
|
||||
/**
|
||||
* simple_strtol - convert a string to a signed long
|
||||
* strtol - convert a string to a signed long
|
||||
* @cp: The start of the string
|
||||
* @endp: A pointer to the end of the parsed string will be placed here
|
||||
* @base: The number base to use
|
||||
*/
|
||||
long simple_strtol(const char *cp,char **endp,unsigned int base)
|
||||
long strtol(const char *cp,char **endp,unsigned int base)
|
||||
{
|
||||
if(*cp=='-')
|
||||
return -simple_strtoul(cp+1,endp,base);
|
||||
return simple_strtoul(cp,endp,base);
|
||||
return -strtoul(cp+1,endp,base);
|
||||
return strtoul(cp,endp,base);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* simple_strtoull - convert a string to an unsigned long long
|
||||
* strtoull - convert a string to an unsigned long long
|
||||
* @cp: The start of the string
|
||||
* @endp: A pointer to the end of the parsed string will be placed here
|
||||
* @base: The number base to use
|
||||
*/
|
||||
unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base)
|
||||
unsigned long long strtoull(const char *cp,char **endp,unsigned int base)
|
||||
{
|
||||
unsigned long long result = 0,value;
|
||||
|
||||
|
@ -110,16 +110,16 @@ unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base)
|
|||
|
||||
|
||||
/**
|
||||
* simple_strtoll - convert a string to a signed long long
|
||||
* strtoll - convert a string to a signed long long
|
||||
* @cp: The start of the string
|
||||
* @endp: A pointer to the end of the parsed string will be placed here
|
||||
* @base: The number base to use
|
||||
*/
|
||||
long long simple_strtoll(const char *cp,char **endp,unsigned int base)
|
||||
long long strtoll(const char *cp,char **endp,unsigned int base)
|
||||
{
|
||||
if(*cp=='-')
|
||||
return -simple_strtoull(cp+1,endp,base);
|
||||
return simple_strtoull(cp,endp,base);
|
||||
return -strtoull(cp+1,endp,base);
|
||||
return strtoull(cp,endp,base);
|
||||
}
|
||||
|
||||
static int skip_atoi(const char **s)
|
||||
|
@ -753,53 +753,53 @@ int vsscanf(const char * buf, const char * fmt, va_list args)
|
|||
case 'H': /* that's 'hh' in format */
|
||||
if (is_sign) {
|
||||
signed char *s = (signed char *) va_arg(args,signed char *);
|
||||
*s = (signed char) simple_strtol(str,&next,base);
|
||||
*s = (signed char) strtol(str,&next,base);
|
||||
} else {
|
||||
unsigned char *s = (unsigned char *) va_arg(args, unsigned char *);
|
||||
*s = (unsigned char) simple_strtoul(str, &next, base);
|
||||
*s = (unsigned char) strtoul(str, &next, base);
|
||||
}
|
||||
break;
|
||||
case 'h':
|
||||
if (is_sign) {
|
||||
short *s = (short *) va_arg(args,short *);
|
||||
*s = (short) simple_strtol(str,&next,base);
|
||||
*s = (short) strtol(str,&next,base);
|
||||
} else {
|
||||
unsigned short *s = (unsigned short *) va_arg(args, unsigned short *);
|
||||
*s = (unsigned short) simple_strtoul(str, &next, base);
|
||||
*s = (unsigned short) strtoul(str, &next, base);
|
||||
}
|
||||
break;
|
||||
case 'l':
|
||||
if (is_sign) {
|
||||
long *l = (long *) va_arg(args,long *);
|
||||
*l = simple_strtol(str,&next,base);
|
||||
*l = strtol(str,&next,base);
|
||||
} else {
|
||||
unsigned long *l = (unsigned long*) va_arg(args,unsigned long*);
|
||||
*l = simple_strtoul(str,&next,base);
|
||||
*l = strtoul(str,&next,base);
|
||||
}
|
||||
break;
|
||||
case 'L':
|
||||
if (is_sign) {
|
||||
long long *l = (long long*) va_arg(args,long long *);
|
||||
*l = simple_strtoll(str,&next,base);
|
||||
*l = strtoll(str,&next,base);
|
||||
} else {
|
||||
unsigned long long *l = (unsigned long long*) va_arg(args,unsigned long long*);
|
||||
*l = simple_strtoull(str,&next,base);
|
||||
*l = strtoull(str,&next,base);
|
||||
}
|
||||
break;
|
||||
case 'Z':
|
||||
case 'z':
|
||||
{
|
||||
size_t *s = (size_t*) va_arg(args,size_t*);
|
||||
*s = (size_t) simple_strtoul(str,&next,base);
|
||||
*s = (size_t) strtoul(str,&next,base);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (is_sign) {
|
||||
int *i = (int *) va_arg(args, int*);
|
||||
*i = (int) simple_strtol(str,&next,base);
|
||||
*i = (int) strtol(str,&next,base);
|
||||
} else {
|
||||
unsigned int *i = (unsigned int*) va_arg(args, unsigned int*);
|
||||
*i = (unsigned int) simple_strtoul(str,&next,base);
|
||||
*i = (unsigned int) strtoul(str,&next,base);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <debug.h>
|
||||
#include <memory.h>
|
||||
#include <keypad.h>
|
||||
#include <gsm.h>
|
||||
#include <osmocore/gsm_utils.h>
|
||||
|
||||
#include <calypso/tpu.h>
|
||||
#include <calypso/tsp.h>
|
||||
|
@ -306,22 +306,22 @@ void trf6151_set_arfcn(uint16_t arfcn, int uplink)
|
|||
uint32_t freq_khz;
|
||||
|
||||
switch (gsm_arfcn2band(arfcn)) {
|
||||
case GSM_850:
|
||||
case GSM_BAND_850:
|
||||
rf_band = GSM850_LOW; /* FIXME: what about HIGH */
|
||||
break;
|
||||
case GSM_900:
|
||||
case GSM_BAND_900:
|
||||
rf_band = GSM900;
|
||||
break;
|
||||
case GSM_1800:
|
||||
case GSM_BAND_1800:
|
||||
rf_band = GSM1800;
|
||||
break;
|
||||
case GSM_1900:
|
||||
case GSM_BAND_1900:
|
||||
rf_band = GSM1900;
|
||||
break;
|
||||
case GSM_450:
|
||||
case GSM_480:
|
||||
case GSM_750:
|
||||
case GSM_810:
|
||||
case GSM_BAND_450:
|
||||
case GSM_BAND_480:
|
||||
case GSM_BAND_750:
|
||||
case GSM_BAND_810:
|
||||
printf("Unsupported rf_band.\n");
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue