summaryrefslogtreecommitdiffstats
path: root/Src
diff options
context:
space:
mode:
authorTom2012-02-28 14:42:05 +0100
committerTom2012-02-28 14:42:05 +0100
commit4337a923907a736c3feaf934edc5421d7cd45136 (patch)
treef51a69e580391e59b7c5c6c5fd8599c65f19aad1 /Src
parentupdated codebase to latest version of osmocombb (diff)
downloadimsi-catcher-detection-4337a923907a736c3feaf934edc5421d7cd45136.tar.gz
imsi-catcher-detection-4337a923907a736c3feaf934edc5421d7cd45136.tar.xz
imsi-catcher-detection-4337a923907a736c3feaf934edc5421d7cd45136.zip
deleted old framework files
Diffstat (limited to 'Src')
-rw-r--r--Src/osmolib/src/host/gsm48-andreas/issues.txt23
-rw-r--r--Src/osmolib/src/host/layer23/include/osmocom/bb/common/lapdm.h186
-rw-r--r--Src/osmolib/src/host/layer23/src/common/lapdm.c2510
-rw-r--r--Src/osmolib/src/target/firmware/apps/l1test/main.c249
-rw-r--r--Src/osmolib/src/target/firmware/display/display.c20
-rw-r--r--Src/osmolib/src/target/firmware/display/font_r8x8.c261
-rw-r--r--Src/osmolib/src/target/firmware/display/font_r8x8_horiz.c261
-rw-r--r--Src/osmolib/src/target/firmware/display/ssd1783.c257
-rw-r--r--Src/osmolib/src/target/firmware/display/ssd1963.c210
-rw-r--r--Src/osmolib/src/target/firmware/display/st7558.c121
-rw-r--r--Src/osmolib/src/target/firmware/display/td014.c185
-rw-r--r--Src/osmolib/src/target/firmware/include/display.h49
-rw-r--r--Src/osmolib/src/target/firmware/include/display/ssd1783.h56
13 files changed, 0 insertions, 4388 deletions
diff --git a/Src/osmolib/src/host/gsm48-andreas/issues.txt b/Src/osmolib/src/host/gsm48-andreas/issues.txt
deleted file mode 100644
index 49a796b..0000000
--- a/Src/osmolib/src/host/gsm48-andreas/issues.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-Location updating procedure:
-
-OpenBSC:
-If tx_setup fails during process, the msg must be freed to avoid memory leak.
-
-OpenBSC:
-Must use *_LOC_PRN_S_LU on protocol side.
-Or it uses *_LOC_PUN_S_LU to hide private network type (maybe some cfg option)
-
-OpenBSC:
-Wrong channel is assigned when mobile supports TCH only.
-
-LCR:
-Also LCR must use correct location.
-For MS support, it must use *_LOC_USER
-
-mncc.h of openbsc / layer23:
-What about putting all (except call structure) to osmocore?
-
-
-
-
-
diff --git a/Src/osmolib/src/host/layer23/include/osmocom/bb/common/lapdm.h b/Src/osmolib/src/host/layer23/include/osmocom/bb/common/lapdm.h
deleted file mode 100644
index 2e78aee..0000000
--- a/Src/osmolib/src/host/layer23/include/osmocom/bb/common/lapdm.h
+++ /dev/null
@@ -1,186 +0,0 @@
-#ifndef _OSMOCOM_LAPDM_H
-#define _OSMOCOM_LAPDM_H
-
-#include <stdint.h>
-
-#include <osmocom/core/timer.h>
-#include <osmocom/core/msgb.h>
-#include <osmocom/gsm/prim.h>
-
-/* primitive related sutff */
-
-enum osmo_ph_prim {
- PRIM_PH_DATA, /* PH-DATA */
- PRIM_PH_RACH, /* PH-RANDOM_ACCESS */
- PRIM_PH_CONN, /* PH-CONNECT */
- PRIM_PH_EMPTY_FRAME, /* PH-EMPTY_FRAME */
- PRIM_PH_RTS, /* PH-RTS */
-};
-
-/* for PH-RANDOM_ACCESS.req */
-struct ph_rach_req_param {
- uint8_t ra;
- uint8_t ta;
- uint8_t tx_power;
- uint8_t is_combined_ccch;
- uint16_t offset;
-};
-
-/* for PH-RANDOM_ACCESS.ind */
-struct ph_rach_ind_param {
- uint8_t ra;
- uint8_t acc_delay;
- uint32_t fn;
-};
-
-/* for PH-[UNIT]DATA.{req,ind} */
-struct ph_data_param {
- uint8_t link_id;
- uint8_t chan_nr;
-};
-
-struct ph_conn_ind_param {
- uint32_t fn;
-};
-
-struct osmo_phsap_prim {
- struct osmo_prim_hdr oph;
- union {
- struct ph_data_param data;
- struct ph_rach_req_param rach_req;
- struct ph_rach_ind_param rach_ind;
- struct ph_conn_ind_param conn_ind;
- } u;
-};
-
-enum lapdm_mode {
- LAPDM_MODE_MS,
- LAPDM_MODE_BTS,
-};
-
-enum lapdm_state {
- LAPDm_STATE_NULL = 0,
- LAPDm_STATE_IDLE,
- LAPDm_STATE_SABM_SENT,
- LAPDm_STATE_MF_EST,
- LAPDm_STATE_TIMER_RECOV,
- LAPDm_STATE_DISC_SENT,
-};
-
-struct lapdm_entity;
-
-struct lapdm_msg_ctx {
- struct lapdm_datalink *dl;
- int lapdm_fmt;
- uint8_t n201;
- uint8_t chan_nr;
- uint8_t link_id;
- uint8_t addr;
- uint8_t ctrl;
- uint8_t ta_ind;
- uint8_t tx_power_ind;
-};
-
-/* TS 04.06 / Section 3.5.2 */
-struct lapdm_datalink {
- uint8_t V_send; /* seq nr of next I frame to be transmitted */
- uint8_t V_ack; /* last frame ACKed by peer */
- uint8_t N_send; /* ? set to V_send at Tx time*/
- uint8_t V_recv; /* seq nr of next I frame expected to be received */
- uint8_t N_recv; /* expected send seq nr of the next received I frame */
- uint32_t state;
- int seq_err_cond; /* condition of sequence error */
- uint8_t own_busy, peer_busy;
- struct osmo_timer_list t200;
- uint8_t retrans_ctr;
- struct llist_head send_queue; /* frames from L3 */
- struct msgb *send_buffer; /* current frame transmitting */
- int send_out; /* how much was sent from send_buffer */
- uint8_t tx_hist[8][200]; /* tx history buffer */
- int tx_length[8]; /* length in history buffer */
- struct llist_head tx_queue; /* frames to L1 */
- struct lapdm_msg_ctx mctx; /* context of established connection */
- struct msgb *rcv_buffer; /* buffer to assemble the received message */
-
- struct lapdm_entity *entity;
-};
-
-enum lapdm_dl_sapi {
- DL_SAPI0 = 0,
- DL_SAPI3 = 1,
- _NR_DL_SAPI
-};
-
-typedef int (*lapdm_cb_t)(struct msgb *msg, struct lapdm_entity *le, void *ctx);
-
-struct lapdm_cr_ent {
- uint8_t cmd;
- uint8_t resp;
-};
-
-#define LAPDM_ENT_F_EMPTY_FRAME 0x0001
-#define LAPDM_ENT_F_POLLING_ONLY 0x0002
-
-/* register message handler for messages that are sent from L2->L3 */
-struct lapdm_entity {
- struct lapdm_datalink datalink[_NR_DL_SAPI];
- int last_tx_dequeue; /* last entity that was dequeued */
- int tx_pending; /* currently a pending frame not confirmed by L1 */
- enum lapdm_mode mode; /* are we in BTS mode or MS mode */
- unsigned int flags;
-
- struct {
- /* filled-in once we set the lapdm_mode above */
- struct lapdm_cr_ent loc2rem;
- struct lapdm_cr_ent rem2loc;
- } cr;
-
- void *l1_ctx; /* context for layer1 instance */
- void *l3_ctx; /* context for layer3 instance */
-
- osmo_prim_cb l1_prim_cb;
- lapdm_cb_t l3_cb; /* callback for sending stuff to L3 */
-
- struct lapdm_channel *lapdm_ch;
-};
-
-/* the two lapdm_entities that form a GSM logical channel (ACCH + DCCH) */
-struct lapdm_channel {
- struct llist_head list;
- char *name;
- struct lapdm_entity lapdm_acch;
- struct lapdm_entity lapdm_dcch;
-};
-
-const char *get_rsl_name(int value);
-extern const char *lapdm_state_names[];
-
-/* initialize a LAPDm entity */
-void lapdm_entity_init(struct lapdm_entity *le, enum lapdm_mode mode);
-void lapdm_channel_init(struct lapdm_channel *lc, enum lapdm_mode mode);
-
-/* deinitialize a LAPDm entity */
-void lapdm_entity_exit(struct lapdm_entity *le);
-void lapdm_channel_exit(struct lapdm_channel *lc);
-
-/* input into layer2 (from layer 1) */
-int lapdm_phsap_up(struct osmo_prim_hdr *oph, struct lapdm_entity *le);
-
-/* input into layer2 (from layer 3) */
-int lapdm_rslms_recvmsg(struct msgb *msg, struct lapdm_channel *lc);
-
-void lapdm_channel_set_l3(struct lapdm_channel *lc, lapdm_cb_t cb, void *ctx);
-void lapdm_channel_set_l1(struct lapdm_channel *lc, osmo_prim_cb cb, void *ctx);
-
-int lapdm_entity_set_mode(struct lapdm_entity *le, enum lapdm_mode mode);
-int lapdm_channel_set_mode(struct lapdm_channel *lc, enum lapdm_mode mode);
-
-void lapdm_entity_reset(struct lapdm_entity *le);
-void lapdm_channel_reset(struct lapdm_channel *lc);
-
-void lapdm_entity_set_flags(struct lapdm_entity *le, unsigned int flags);
-void lapdm_channel_set_flags(struct lapdm_channel *lc, unsigned int flags);
-
-int lapdm_phsap_dequeue_prim(struct lapdm_entity *le, struct osmo_phsap_prim *pp);
-
-#endif /* _OSMOCOM_LAPDM_H */
diff --git a/Src/osmolib/src/host/layer23/src/common/lapdm.c b/Src/osmolib/src/host/layer23/src/common/lapdm.c
deleted file mode 100644
index 1fbebe6..0000000
--- a/Src/osmolib/src/host/layer23/src/common/lapdm.c
+++ /dev/null
@@ -1,2510 +0,0 @@
-/* GSM LAPDm (TS 04.06) implementation */
-
-/* (C) 2010-2011 by Harald Welte <laforge@gnumonks.org>
- * (C) 2010 by Andreas Eversberg <jolly@eversberg.eu>
- *
- * 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.
- *
- */
-
-/* Notes on Buffering: rcv_buffer, tx_queue, tx_hist, send_buffer, send_queue
- *
- * RX data is stored in the rcv_buffer (pointer). If the message is complete, it
- * is removed from rcv_buffer pointer and forwarded to L3. If the RX data is
- * received while there is an incomplete rcv_buffer, it is appended to it.
- *
- * TX data is stored in the send_queue first. When transmitting a frame,
- * the first message in the send_queue is moved to the send_buffer. There it
- * resides until all fragments are acknowledged. Fragments to be sent by I
- * frames are stored in the tx_hist buffer for resend, if required. Also the
- * current fragment is copied into the tx_queue. There it resides until it is
- * forwarded to layer 1.
- *
- * In case we have SAPI 0, we only have a window size of 1, so the unack-
- * nowledged message resides always in the send_buffer. In case of a suspend,
- * it can be written back to the first position of the send_queue.
- *
- * The layer 1 normally sends a PH-READY-TO-SEND. But because we use
- * asynchronous transfer between layer 1 and layer 2 (serial link), we must
- * send a frame before layer 1 reaches the right timeslot to send it. So we
- * move the tx_queue to layer 1 when there is not already a pending frame, and
- * wait until acknowledge after the frame has been sent. If we receive an
- * acknowledge, we can send the next frame from the buffer, if any.
- *
- * The moving of tx_queue to layer 1 may also trigger T200, if desired. Also it
- * will trigger next I frame, if possible.
- *
- */
-
-#include <stdio.h>
-#include <stdint.h>
-#include <string.h>
-#include <errno.h>
-#include <arpa/inet.h>
-
-#include <osmocom/core/logging.h>
-#include <osmocom/core/timer.h>
-#include <osmocom/core/msgb.h>
-#include <osmocom/gsm/tlv.h>
-#include <osmocom/core/utils.h>
-#include <osmocom/gsm/rsl.h>
-#include <osmocom/gsm/prim.h>
-#include <osmocom/gsm/gsm_utils.h>
-#include <osmocom/gsm/protocol/gsm_04_08.h>
-#include <osmocom/gsm/protocol/gsm_08_58.h>
-
-#include <osmocom/bb/common/lapdm.h>
-#include <osmocom/bb/common/logging.h>
-
-/* TS 04.06 Figure 4 / Section 3.2 */
-#define LAPDm_LPD_NORMAL 0
-#define LAPDm_LPD_SMSCB 1
-#define LAPDm_SAPI_NORMAL 0
-#define LAPDm_SAPI_SMS 3
-#define LAPDm_ADDR(lpd, sapi, cr) ((((lpd) & 0x3) << 5) | (((sapi) & 0x7) << 2) | (((cr) & 0x1) << 1) | 0x1)
-
-#define LAPDm_ADDR_SAPI(addr) (((addr) >> 2) & 0x7)
-#define LAPDm_ADDR_CR(addr) (((addr) >> 1) & 0x1)
-#define LAPDm_ADDR_EA(addr) ((addr) & 0x1)
-
-/* TS 04.06 Table 3 / Section 3.4.3 */
-#define LAPDm_CTRL_I(nr, ns, p) ((((nr) & 0x7) << 5) | (((p) & 0x1) << 4) | (((ns) & 0x7) << 1))
-#define LAPDm_CTRL_S(nr, s, p) ((((nr) & 0x7) << 5) | (((p) & 0x1) << 4) | (((s) & 0x3) << 2) | 0x1)
-#define LAPDm_CTRL_U(u, p) ((((u) & 0x1c) << (5-2)) | (((p) & 0x1) << 4) | (((u) & 0x3) << 2) | 0x3)
-
-#define LAPDm_CTRL_is_I(ctrl) (((ctrl) & 0x1) == 0)
-#define LAPDm_CTRL_is_S(ctrl) (((ctrl) & 0x3) == 1)
-#define LAPDm_CTRL_is_U(ctrl) (((ctrl) & 0x3) == 3)
-
-#define LAPDm_CTRL_U_BITS(ctrl) ((((ctrl) & 0xC) >> 2) | ((ctrl) & 0xE0) >> 3)
-#define LAPDm_CTRL_PF_BIT(ctrl) (((ctrl) >> 4) & 0x1)
-
-#define LAPDm_CTRL_S_BITS(ctrl) (((ctrl) & 0xC) >> 2)
-
-#define LAPDm_CTRL_I_Ns(ctrl) (((ctrl) & 0xE) >> 1)
-#define LAPDm_CTRL_Nr(ctrl) (((ctrl) & 0xE0) >> 5)
-
-/* TS 04.06 Table 4 / Section 3.8.1 */
-#define LAPDm_U_SABM 0x7
-#define LAPDm_U_DM 0x3
-#define LAPDm_U_UI 0x0
-#define LAPDm_U_DISC 0x8
-#define LAPDm_U_UA 0xC
-
-#define LAPDm_S_RR 0x0
-#define LAPDm_S_RNR 0x1
-#define LAPDm_S_REJ 0x2
-
-#define LAPDm_LEN(len) ((len << 2) | 0x1)
-#define LAPDm_MORE 0x2
-
-/* TS 04.06 Section 5.8.3 */
-#define N201_AB_SACCH 18
-#define N201_AB_SDCCH 20
-#define N201_AB_FACCH 20
-#define N201_Bbis 23
-#define N201_Bter_SACCH 21
-#define N201_Bter_SDCCH 23
-#define N201_Bter_FACCH 23
-#define N201_B4 19
-
-/* 5.8.2.1 N200 during establish and release */
-#define N200_EST_REL 5
-/* 5.8.2.1 N200 during timer recovery state */
-#define N200_TR_SACCH 5
-#define N200_TR_SDCCH 23
-#define N200_TR_FACCH_FR 34
-#define N200_TR_EFACCH_FR 48
-#define N200_TR_FACCH_HR 29
-/* FIXME: this depends on chan type */
-#define N200 N200_TR_SACCH
-
-#define CR_MS2BS_CMD 0
-#define CR_MS2BS_RESP 1
-#define CR_BS2MS_CMD 1
-#define CR_BS2MS_RESP 0
-
-/* Set T200 to 1 Second (OpenBTS uses 900ms) */
-#define T200 1, 0
-
-/* k value for each SAPI */
-static uint8_t k_sapi[] = {1, 1, 1, 1, 1, 1, 1, 1};
-
-enum lapdm_format {
- LAPDm_FMT_A,
- LAPDm_FMT_B,
- LAPDm_FMT_Bbis,
- LAPDm_FMT_Bter,
- LAPDm_FMT_B4,
-};
-
-static void lapdm_t200_cb(void *data);
-static int rslms_send_i(struct lapdm_msg_ctx *mctx, int line);
-
-/* UTILITY FUNCTIONS */
-
-static inline uint8_t inc_mod8(uint8_t x)
-{
- return (x + 1) & 7;
-}
-
-static inline uint8_t add_mod8(uint8_t x, uint8_t y)
-{
- return (x + y) & 7;
-}
-
-static inline uint8_t sub_mod8(uint8_t x, uint8_t y)
-{
- return (x - y) & 7; /* handle negative results correctly */
-}
-
-static void lapdm_dl_init(struct lapdm_datalink *dl,
- struct lapdm_entity *entity)
-{
- memset(dl, 0, sizeof(*dl));
- INIT_LLIST_HEAD(&dl->send_queue);
- INIT_LLIST_HEAD(&dl->tx_queue);
- dl->state = LAPDm_STATE_IDLE;
- dl->t200.data = dl;
- dl->t200.cb = &lapdm_t200_cb;
- dl->entity = entity;
-}
-
-void lapdm_entity_init(struct lapdm_entity *le, enum lapdm_mode mode)
-{
- unsigned int i;
-
- for (i = 0; i < ARRAY_SIZE(le->datalink); i++)
- lapdm_dl_init(&le->datalink[i], le);
-
- lapdm_entity_set_mode(le, mode);
-}
-
-void lapdm_channel_init(struct lapdm_channel *lc, enum lapdm_mode mode)
-{
- lapdm_entity_init(&lc->lapdm_acch, mode);
- lapdm_entity_init(&lc->lapdm_dcch, mode);
-}
-
-
-static void lapdm_dl_flush_send(struct lapdm_datalink *dl)
-{
- struct msgb *msg;
-
- /* Flush send-queue */
- while ((msg = msgb_dequeue(&dl->send_queue)))
- msgb_free(msg);
-
- /* Clear send-buffer */
- if (dl->send_buffer) {
- msgb_free(dl->send_buffer);
- dl->send_buffer = NULL;
- }
-}
-
-static void lapdm_dl_flush_tx(struct lapdm_datalink *dl)
-{
- struct msgb *msg;
- unsigned int i;
-
- while ((msg = msgb_dequeue(&dl->tx_queue)))
- msgb_free(msg);
- for (i = 0; i < 8; i++)
- dl->tx_length[i] = 0;
-}
-
-void lapdm_entity_exit(struct lapdm_entity *le)
-{
- unsigned int i;
- struct lapdm_datalink *dl;
-
- for (i = 0; i < ARRAY_SIZE(le->datalink); i++) {
- dl = &le->datalink[i];
- lapdm_dl_flush_tx(dl);
- lapdm_dl_flush_send(dl);
- if (dl->rcv_buffer)
- msgb_free(dl->rcv_buffer);
- }
-}
-
-void lapdm_channel_exit(struct lapdm_channel *lc)
-{
- lapdm_entity_exit(&lc->lapdm_acch);
- lapdm_entity_exit(&lc->lapdm_dcch);
-}
-
-static void lapdm_dl_newstate(struct lapdm_datalink *dl, uint32_t state)
-{
- LOGP(DLAPDM, LOGL_INFO, "new state %s -> %s\n",
- lapdm_state_names[dl->state], lapdm_state_names[state]);
-
- dl->state = state;
-}
-
-static struct lapdm_datalink *datalink_for_sapi(struct lapdm_entity *le, uint8_t sapi)
-{
- switch (sapi) {
- case LAPDm_SAPI_NORMAL:
- return &le->datalink[0];
- case LAPDm_SAPI_SMS:
- return &le->datalink[1];
- default:
- return NULL;
- }
-}
-
-/* remove the L2 header from a MSGB */
-static inline unsigned char *msgb_pull_l2h(struct msgb *msg)
-{
- unsigned char *ret = msgb_pull(msg, msg->l3h - msg->l2h);
- msg->l2h = NULL;
- return ret;
-}
-
-/* Append padding (if required) */
-static void lapdm_pad_msgb(struct msgb *msg, uint8_t n201)
-{
- int pad_len = n201 - msgb_l2len(msg);
- uint8_t *data;
-
- if (pad_len < 0) {
- LOGP(DLAPDM, LOGL_ERROR,
- "cannot pad message that is already too big!\n");
- return;
- }
-
- data = msgb_put(msg, pad_len);
- memset(data, 0x2B, pad_len);
-}
-
-/* input function that L2 calls when sending messages up to L3 */
-static int rslms_sendmsg(struct msgb *msg, struct lapdm_entity *le)
-{
- if (!le->l3_cb) {
- msgb_free(msg);
- return -EIO;
- }
-
- /* call the layer2 message handler that is registered */
- return le->l3_cb(msg, le, le->l3_ctx);
-}
-
-/* write a frame into the tx queue */
-static int tx_ph_data_enqueue(struct lapdm_datalink *dl, struct msgb *msg,
- uint8_t chan_nr, uint8_t link_id, uint8_t n201)
-{
- struct lapdm_entity *le = dl->entity;
- struct osmo_phsap_prim pp;
-
- /* if there is a pending message, queue it */
- if (le->tx_pending || le->flags & LAPDM_ENT_F_POLLING_ONLY) {
- *msgb_push(msg, 1) = n201;
- *msgb_push(msg, 1) = link_id;
- *msgb_push(msg, 1) = chan_nr;
- msgb_enqueue(&dl->tx_queue, msg);
- return -EBUSY;
- }
-
- osmo_prim_init(&pp.oph, SAP_GSM_PH, PRIM_PH_DATA,
- PRIM_OP_REQUEST, msg);
- pp.u.data.chan_nr = chan_nr;
- pp.u.data.link_id = link_id;
-
- /* send the frame now */
- le->tx_pending = 0; /* disabled flow control */
- lapdm_pad_msgb(msg, n201);
-
- return le->l1_prim_cb(&pp.oph, le->l1_ctx);
-}
-
-static struct msgb *tx_dequeue_msgb(struct lapdm_entity *le)
-{
- struct lapdm_datalink *dl;
- int last = le->last_tx_dequeue;
- int i = last, n = ARRAY_SIZE(le->datalink);
- struct msgb *msg = NULL;
-
- /* round-robin dequeue */
- do {
- /* next */
- i = (i + 1) % n;
- dl = &le->datalink[i];
- if ((msg = msgb_dequeue(&dl->tx_queue)))
- break;
- } while (i != last);
-
- if (msg) {
- /* Set last dequeue position */
- le->last_tx_dequeue = i;
- }
-
- return msg;
-}
-
-/* dequeue a msg that's pending transmission via L1 and wrap it into
- * a osmo_phsap_prim */
-int lapdm_phsap_dequeue_prim(struct lapdm_entity *le, struct osmo_phsap_prim *pp)
-{
- struct msgb *msg;
- uint8_t n201;
-
- msg = tx_dequeue_msgb(le);
- if (!msg)
- return -ENODEV;
-
- /* if we have a message, send PH-DATA.req */
- osmo_prim_init(&pp->oph, SAP_GSM_PH, PRIM_PH_DATA,
- PRIM_OP_REQUEST, msg);
-
- /* Pull chan_nr and link_id */
- pp->u.data.chan_nr = *msg->data;
- msgb_pull(msg, 1);
- pp->u.data.link_id = *msg->data;
- msgb_pull(msg, 1);
- n201 = *msg->data;
- msgb_pull(msg, 1);
-
- /* Pad the frame, we can transmit now */
- lapdm_pad_msgb(msg, n201);
-
- return 0;
-}
-
-/* get next frame from the tx queue. because the ms has multiple datalinks,
- * each datalink's queue is read round-robin.
- */
-static int l2_ph_data_conf(struct msgb *msg, struct lapdm_entity *le)
-{
- struct osmo_phsap_prim pp;
-
- /* we may send again */
- le->tx_pending = 0;
-
- /* free confirm message */
- if (msg)
- msgb_free(msg);
-
- if (lapdm_phsap_dequeue_prim(le, &pp) < 0) {
- /* no message in all queues */
-
- /* If user didn't request PH-EMPTY_FRAME.req, abort */
- if (!(le->flags & LAPDM_ENT_F_EMPTY_FRAME))
- return 0;
-
- /* otherwise, send PH-EMPTY_FRAME.req */
- osmo_prim_init(&pp.oph, SAP_GSM_PH,
- PRIM_PH_EMPTY_FRAME,
- PRIM_OP_REQUEST, NULL);
- } else {
- le->tx_pending = 1;
- }
-
- return le->l1_prim_cb(&pp.oph, le->l1_ctx);
-}
-
-/* Create RSLms various RSLms messages */
-static int send_rslms_rll_l3(uint8_t msg_type, struct lapdm_msg_ctx *mctx,
- struct msgb *msg)
-{
- /* Add the RSL + RLL header */
- rsl_rll_push_l3(msg, msg_type, mctx->chan_nr, mctx->link_id, 1);
-
- /* send off the RSLms message to L3 */
- return rslms_sendmsg(msg, mctx->dl->entity);
-}
-
-/* Take a B4 format message from L1 and create RSLms UNIT DATA IND */
-static int send_rslms_rll_l3_ui(struct lapdm_msg_ctx *mctx, struct msgb *msg)
-{
- uint8_t l3_len = msg->tail - (uint8_t *)msgb_l3(msg);
- struct abis_rsl_rll_hdr *rllh;
-
- /* Add the RSL + RLL header */
- msgb_tv16_push(msg, RSL_IE_L3_INFO, l3_len);
- msgb_push(msg, 2 + 2);
- rsl_rll_push_hdr(msg, RSL_MT_UNIT_DATA_IND, mctx->chan_nr,
- mctx->link_id, 1);
- rllh = (struct abis_rsl_rll_hdr *)msgb_l2(msg);
-
- rllh->data[0] = RSL_IE_TIMING_ADVANCE;
- rllh->data[1] = mctx->ta_ind;
-
- rllh->data[2] = RSL_IE_MS_POWER;
- rllh->data[3] = mctx->tx_power_ind;
-
- return rslms_sendmsg(msg, mctx->dl->entity);
-}
-
-static int send_rll_simple(uint8_t msg_type, struct lapdm_msg_ctx *mctx)
-{
- struct msgb *msg;
-
- msg = rsl_rll_simple(msg_type, mctx->chan_nr, mctx->link_id, 1);
-
- /* send off the RSLms message to L3 */
- return rslms_sendmsg(msg, mctx->dl->entity);
-}
-
-static int rsl_rll_error(uint8_t cause, struct lapdm_msg_ctx *mctx)
-{
- struct msgb *msg;
-
- LOGP(DLAPDM, LOGL_NOTICE, "sending MDL-ERROR-IND %d\n", cause);
- msg = rsl_rll_simple(RSL_MT_ERROR_IND, mctx->chan_nr, mctx->link_id, 1);
- msg->l2h = msgb_put(msg, sizeof(struct abis_rsl_rll_hdr));
- msgb_tlv_put(msg, RSL_IE_RLM_CAUSE, 1, &cause);
- return rslms_sendmsg(msg, mctx->dl->entity);
-}
-
-static int check_length_ind(struct lapdm_msg_ctx *mctx, uint8_t length_ind)
-{
- if (!(length_ind & 0x01)) {
- /* G.4.1 If the EL bit is set to "0", an MDL-ERROR-INDICATION
- * primitive with cause "frame not implemented" is sent to the
- * mobile management entity. */
- LOGP(DLAPDM, LOGL_NOTICE,
- "we don't support multi-octet length\n");
- rsl_rll_error(RLL_CAUSE_FRM_UNIMPL, mctx);
- return -EINVAL;
- }
- return 0;
-}
-
-static int lapdm_send_resend(struct lapdm_datalink *dl)
-{
- struct msgb *msg = msgb_alloc_headroom(23+10, 10, "LAPDm resend");
- int length;
-
- /* Resend SABM/DISC from tx_hist */
- length = dl->tx_length[0];
- msg->l2h = msgb_put(msg, length);
- memcpy(msg->l2h, dl->tx_hist[dl->V_send], length);
-
- return tx_ph_data_enqueue(dl, msg, dl->mctx.chan_nr, dl->mctx.link_id,
- dl->mctx.n201);
-}
-
-static int lapdm_send_ua(struct lapdm_msg_ctx *mctx, uint8_t len, uint8_t *data)
-{
- uint8_t sapi = mctx->link_id & 7;
- uint8_t f_bit = LAPDm_CTRL_PF_BIT(mctx->ctrl);
- struct msgb *msg = msgb_alloc_headroom(23+10, 10, "LAPDm UA");
- struct lapdm_entity *le = mctx->dl->entity;
-
- msg->l2h = msgb_put(msg, 3 + len);
- msg->l2h[0] = LAPDm_ADDR(LAPDm_LPD_NORMAL, sapi, le->cr.loc2rem.resp);
- msg->l2h[1] = LAPDm_CTRL_U(LAPDm_U_UA, f_bit);
- msg->l2h[2] = LAPDm_LEN(len);
- if (len)
- memcpy(msg->l2h + 3, data, len);
-
- return tx_ph_data_enqueue(mctx->dl, msg, mctx->chan_nr, mctx->link_id,
- mctx->n201);
-}
-
-static int lapdm_send_dm(struct lapdm_msg_ctx *mctx)
-{
- uint8_t sapi = mctx->link_id & 7;
- uint8_t f_bit = LAPDm_CTRL_PF_BIT(mctx->ctrl);
- struct msgb *msg = msgb_alloc_headroom(23+10, 10, "LAPDm DM");
- struct lapdm_entity *le = mctx->dl->entity;
-
- msg->l2h = msgb_put(msg, 3);
- msg->l2h[0] = LAPDm_ADDR(LAPDm_LPD_NORMAL, sapi, le->cr.loc2rem.resp);
- msg->l2h[1] = LAPDm_CTRL_U(LAPDm_U_DM, f_bit);
- msg->l2h[2] = 0;
-
- return tx_ph_data_enqueue(mctx->dl, msg, mctx->chan_nr, mctx->link_id,
- mctx->n201);
-}
-
-static int lapdm_send_rr(struct lapdm_msg_ctx *mctx, uint8_t f_bit)
-{
- uint8_t sapi = mctx->link_id & 7;
- struct msgb *msg = msgb_alloc_headroom(23+10, 10, "LAPDm RR");
- struct lapdm_entity *le = mctx->dl->entity;
-
- msg->l2h = msgb_put(msg, 3);
- msg->l2h[0] = LAPDm_ADDR(LAPDm_LPD_NORMAL, sapi, le->cr.loc2rem.resp);
- msg->l2h[1] = LAPDm_CTRL_S(mctx->dl->V_recv, LAPDm_S_RR, f_bit);
- msg->l2h[2] = LAPDm_LEN(0);
-
- return tx_ph_data_enqueue(mctx->dl, msg, mctx->chan_nr, mctx->link_id,
- mctx->n201);
-}
-
-static int lapdm_send_rnr(struct lapdm_msg_ctx *mctx, uint8_t f_bit)
-{
- uint8_t sapi = mctx->link_id & 7;
- struct msgb *msg = msgb_alloc_headroom(23+10, 10, "LAPDm RNR");
- struct lapdm_entity *le = mctx->dl->entity;
-
- msg->l2h = msgb_put(msg, 3);
- msg->l2h[0] = LAPDm_ADDR(LAPDm_LPD_NORMAL, sapi, le->cr.loc2rem.resp);
- msg->l2h[1] = LAPDm_CTRL_S(mctx->dl->V_recv, LAPDm_S_RNR, f_bit);
- msg->l2h[2] = LAPDm_LEN(0);
-
- return tx_ph_data_enqueue(mctx->dl, msg, mctx->chan_nr, mctx->link_id,
- mctx->n201);
-}
-
-static int lapdm_send_rej(struct lapdm_msg_ctx *mctx, uint8_t f_bit)
-{
- uint8_t sapi = mctx->link_id & 7;
- struct msgb *msg = msgb_alloc_headroom(23+10, 10, "LAPDm REJ");
- struct lapdm_entity *le = mctx->dl->entity;
-
- msg->l2h = msgb_put(msg, 3);
- msg->l2h[0] = LAPDm_ADDR(LAPDm_LPD_NORMAL, sapi, le->cr.loc2rem.resp);
- msg->l2h[1] = LAPDm_CTRL_S(mctx->dl->V_recv, LAPDm_S_REJ, f_bit);
- msg->l2h[2] = LAPDm_LEN(0);
-
- return tx_ph_data_enqueue(mctx->dl, msg, mctx->chan_nr, mctx->link_id,
- mctx->n201);
-}
-
-/* Timer callback on T200 expiry */
-static void lapdm_t200_cb(void *data)
-{
- struct lapdm_datalink *dl = data;
-
- LOGP(DLAPDM, LOGL_INFO, "lapdm_t200_cb(%p) state=%u\n", dl, dl->state);
-
- switch (dl->state) {
- case LAPDm_STATE_SABM_SENT:
- /* 5.4.1.3 */
- if (dl->retrans_ctr + 1 >= N200_EST_REL + 1) {
- /* send RELEASE INDICATION to L3 */
- send_rll_simple(RSL_MT_REL_IND, &dl->mctx);
- /* send MDL ERROR INIDCATION to L3 */
- rsl_rll_error(RLL_CAUSE_T200_EXPIRED, &dl->mctx);
- /* flush tx buffers */
- lapdm_dl_flush_tx(dl);
- /* go back to idle state */
- lapdm_dl_newstate(dl, LAPDm_STATE_IDLE);
- /* NOTE: we must not change any other states or buffers
- * and queues, since we may reconnect after handover
- * failure. the buffered messages is replaced there */
- break;
- }
- /* retransmit SABM command */
- lapdm_send_resend(dl);
- /* increment re-transmission counter */
- dl->retrans_ctr++;
- /* restart T200 (PH-READY-TO-SEND) */
- osmo_timer_schedule(&dl->t200, T200);
- break;
- case LAPDm_STATE_DISC_SENT:
- /* 5.4.4.3 */
- if (dl->retrans_ctr + 1 >= N200_EST_REL + 1) {
- /* send RELEASE INDICATION to L3 */
- send_rll_simple(RSL_MT_REL_CONF, &dl->mctx);
- /* send MDL ERROR INIDCATION to L3 */
- rsl_rll_error(RLL_CAUSE_T200_EXPIRED, &dl->mctx);
- /* flush buffers */
- lapdm_dl_flush_tx(dl);
- lapdm_dl_flush_send(dl);
- /* go back to idle state */
- lapdm_dl_newstate(dl, LAPDm_STATE_IDLE);
- /* NOTE: we must not change any other states or buffers
- * and queues, since we may reconnect after handover
- * failure. the buffered messages is replaced there */
- break;
- }
- /* retransmit DISC command */
- lapdm_send_resend(dl);
- /* increment re-transmission counter */
- dl->retrans_ctr++;
- /* restart T200 (PH-READY-TO-SEND) */
- osmo_timer_schedule(&dl->t200, T200);
- break;
- case LAPDm_STATE_MF_EST:
- /* 5.5.7 */
- dl->retrans_ctr = 0;
- lapdm_dl_newstate(dl, LAPDm_STATE_TIMER_RECOV);
- /* fall through */
- case LAPDm_STATE_TIMER_RECOV:
- dl->retrans_ctr++;
- if (dl->retrans_ctr < N200) {
- /* retransmit I frame (V_s-1) with P=1, if any */
- if (dl->tx_length[sub_mod8(dl->V_send, 1)]) {
- struct msgb *msg;
- int length;
-
- LOGP(DLAPDM, LOGL_INFO, "retransmit last frame "
- "V(S)=%d\n", sub_mod8(dl->V_send, 1));
- /* Create I frame (segment) from tx_hist */
- length = dl->tx_length[sub_mod8(dl->V_send, 1)];
- msg = msgb_alloc_headroom(23+10, 10, "LAPDm I");
- msg->l2h = msgb_put(msg, length);
- memcpy(msg->l2h,
- dl->tx_hist[sub_mod8(dl->V_send, 1)],
- length);
- msg->l2h[1] = LAPDm_CTRL_I(dl->V_recv,
- sub_mod8(dl->V_send, 1), 1); /* P=1 */
- tx_ph_data_enqueue(dl, msg, dl->mctx.chan_nr,
- dl->mctx.link_id, dl->mctx.n201);
- } else {
- /* OR send appropriate supervision frame with P=1 */
- if (!dl->own_busy && !dl->seq_err_cond) {
- lapdm_send_rr(&dl->mctx, 1);
- /* NOTE: In case of sequence error
- * condition, the REJ frame has been
- * transmitted when entering the
- * condition, so it has not be done
- * here
- */
- } else if (dl->own_busy) {
- lapdm_send_rnr(&dl->mctx, 1);
- } else {
- LOGP(DLAPDM, LOGL_INFO, "unhandled, "
- "pls. fix\n");
- }
- }
- /* restart T200 (PH-READY-TO-SEND) */
- osmo_timer_schedule(&dl->t200, T200);
- } else {
- /* send MDL ERROR INIDCATION to L3 */
- rsl_rll_error(RLL_CAUSE_T200_EXPIRED, &dl->mctx);
- }
- break;
- default:
- LOGP(DLAPDM, LOGL_INFO, "T200 expired in unexpected "
- "dl->state %u\n", dl->state);
- }
-}
-
-/* 5.5.3.1: Common function to acknowlege frames up to the given N(R) value */
-static void lapdm_acknowledge(struct lapdm_msg_ctx *mctx)
-{
- struct lapdm_datalink *dl = mctx->dl;
- uint8_t nr = LAPDm_CTRL_Nr(mctx->ctrl);
- int s = 0, rej = 0, t200_reset = 0;
- int i;
-
- /* supervisory frame ? */
- if (LAPDm_CTRL_is_S(mctx->ctrl))
- s = 1;
- /* REJ frame ? */
- if (s && LAPDm_CTRL_S_BITS(mctx->ctrl) == LAPDm_S_REJ)
- rej = 1;
-
- /* Flush all transmit buffers of acknowledged frames */
- for (i = dl->V_ack; i != nr; i = inc_mod8(i)) {
- if (dl->tx_length[i]) {
- dl->tx_length[i] = 0;
- LOGP(DLAPDM, LOGL_INFO, "ack frame %d\n", i);
- }
- }
-
- if (dl->state != LAPDm_STATE_TIMER_RECOV) {
- /* When not in the timer recovery condition, the data
- * link layer entity shall reset the timer T200 on
- * receipt of a valid I frame with N(R) higher than V(A),
- * or an REJ with an N(R) equal to V(A). */
- if ((!rej && nr != dl->V_ack)
- || (rej && nr == dl->V_ack)) {
- LOGP(DLAPDM, LOGL_INFO, "reset t200\n");
- t200_reset = 1;
- osmo_timer_del(&dl->t200);
- /* 5.5.3.1 Note 1 + 2 imply timer recovery cond. */
- }
- /* 5.7.4: N(R) sequence error
- * N(R) is called valid, if and only if
- * (N(R)-V(A)) mod 8 <= (V(S)-V(A)) mod 8.
- */
- if (sub_mod8(nr, dl->V_ack) > sub_mod8(dl->V_send, dl->V_ack)) {
- LOGP(DLAPDM, LOGL_NOTICE, "N(R) sequence error\n");
- rsl_rll_error(RLL_CAUSE_SEQ_ERR, mctx);
- }
- }
-
- /* V(A) shall be set to the value of N(R) */
- dl->V_ack = nr;
-
- /* If T200 has been reset by the receipt of an I, RR or RNR frame,
- * and if there are outstanding I frames, restart T200 */
- if (t200_reset && !rej) {
- if (dl->tx_length[dl->V_send - 1]) {
- LOGP(DLAPDM, LOGL_INFO, "start T200, due to unacked I "
- "frame(s)\n");
- osmo_timer_schedule(&dl->t200, T200);
- }
- }
-}
-
-/* L1 -> L2 */
-
-/* Receive a LAPDm U (Unnumbered) message from L1 */
-static int lapdm_rx_u(struct msgb *msg, struct lapdm_msg_ctx *mctx)
-{
- struct lapdm_datalink *dl = mctx->dl;
- struct lapdm_entity *le = dl->entity;
- uint8_t length;
- int rc;
- int rsl_msg;
-
- switch (LAPDm_CTRL_U_BITS(mctx->ctrl)) {
- case LAPDm_U_SABM:
- rsl_msg = RSL_MT_EST_IND;
-
- LOGP(DLAPDM, LOGL_INFO, "SABM received\n");
- /* 5.7.1 */
- dl->seq_err_cond = 0;
- /* G.2.2 Wrong value of the C/R bit */
- if (LAPDm_ADDR_CR(mctx->addr) == le->cr.rem2loc.resp) {
- LOGP(DLAPDM, LOGL_NOTICE, "SABM response error\n");
- msgb_free(msg);
- rsl_rll_error(RLL_CAUSE_FRM_UNIMPL, mctx);
- return -EINVAL;
- }
-
- length = msg->l2h[2] >> 2;
- /* G.4.5 If SABM is received with L>N201 or with M bit
- * set, AN MDL-ERROR-INDICATION is sent to MM.
- */
- if ((msg->l2h[2] & LAPDm_MORE) || length + 3 > mctx->n201) {
- LOGP(DLAPDM, LOGL_NOTICE, "SABM too large error\n");
- msgb_free(msg);
- rsl_rll_error(RLL_CAUSE_UFRM_INC_PARAM, mctx);
- return -EIO;
- }
-
- /* Must be Format B */
- rc = check_length_ind(mctx, msg->l2h[2]);
- if (rc < 0) {
- msgb_free(msg);
- return rc;
- }
- switch (dl->state) {
- case LAPDm_STATE_IDLE:
- /* Set chan_nr and link_id for established connection */
- memset(&dl->mctx, 0, sizeof(dl->mctx));
- dl->mctx.dl = dl;
- dl->mctx.chan_nr = mctx->chan_nr;
- dl->mctx.link_id = mctx->link_id;
- dl->mctx.n201 = mctx->n201;
- break;
- case LAPDm_STATE_MF_EST:
- if (length == 0) {
- rsl_msg = RSL_MT_EST_CONF;
- break;
- }
- LOGP(DLAPDM, LOGL_INFO, "SABM command, multiple "
- "frame established state\n");
- /* check for contention resoultion */
- if (dl->tx_hist[0][2] >> 2) {
- LOGP(DLAPDM, LOGL_NOTICE, "SABM not allowed "
- "during contention resolution\n");
- rsl_rll_error(RLL_CAUSE_SABM_INFO_NOTALL, mctx);
- }
- msgb_free(msg);
- return 0;
- case LAPDm_STATE_DISC_SENT:
- /* 5.4.6.2 send DM with F=P */
- lapdm_send_dm(mctx);
- /* reset Timer T200 */
- osmo_timer_del(&dl->t200);
- msgb_free(msg);
- return send_rll_simple(RSL_MT_REL_CONF, mctx);
- default:
- lapdm_send_ua(mctx, length, msg->l2h + 3);
- msgb_free(msg);
- return 0;
- }
- /* send UA response */
- lapdm_send_ua(mctx, length, msg->l2h + 3);
- /* set Vs, Vr and Va to 0 */
- dl->V_send = dl->V_recv = dl->V_ack = 0;
- /* clear tx_hist */
- dl->tx_length[0] = 0;
- /* enter multiple-frame-established state */
- lapdm_dl_newstate(dl, LAPDm_STATE_MF_EST);
- /* send notification to L3 */
- if (length == 0) {
- /* 5.4.1.2 Normal establishment procedures */
- rc = send_rll_simple(rsl_msg, mctx);
- msgb_free(msg);
- } else {
- /* 5.4.1.4 Contention resolution establishment */
- msg->l3h = msg->l2h + 3;
- msgb_pull_l2h(msg);
- rc = send_rslms_rll_l3(rsl_msg, mctx, msg);
- }
- break;
- case LAPDm_U_DM:
- LOGP(DLAPDM, LOGL_INFO, "DM received\n");
- /* G.2.2 Wrong value of the C/R bit */
- if (LAPDm_ADDR_CR(mctx->addr) == le->cr.rem2loc.cmd) {
- LOGP(DLAPDM, LOGL_NOTICE, "DM command error\n");
- msgb_free(msg);
- rsl_rll_error(RLL_CAUSE_FRM_UNIMPL, mctx);
- return -EINVAL;
- }
- if (!LAPDm_CTRL_PF_BIT(mctx->ctrl)) {
- /* 5.4.1.2 DM responses with the F bit set to "0"
- * shall be ignored.
- */
- msgb_free(msg);
- return 0;
- }
- switch (dl->state) {
- case LAPDm_STATE_SABM_SENT:
- break;
- case LAPDm_STATE_MF_EST:
- if (LAPDm_CTRL_PF_BIT(mctx->ctrl) == 1) {
- LOGP(DLAPDM, LOGL_INFO, "unsolicited DM "
- "response\n");
- rsl_rll_error(RLL_CAUSE_UNSOL_DM_RESP, mctx);
- } else {
- LOGP(DLAPDM, LOGL_INFO, "unsolicited DM "
- "response, multiple frame established "
- "state\n");
- rsl_rll_error(RLL_CAUSE_UNSOL_DM_RESP_MF, mctx);
- }
- msgb_free(msg);
- return 0;
- case LAPDm_STATE_TIMER_RECOV:
- /* DM is normal in case PF = 1 */
- if (LAPDm_CTRL_PF_BIT(mctx->ctrl) == 0) {
- LOGP(DLAPDM, LOGL_INFO, "unsolicited DM "
- "response, multiple frame established "
- "state\n");
- rsl_rll_error(RLL_CAUSE_UNSOL_DM_RESP_MF, mctx);
- msgb_free(msg);
- return 0;
- }
- break;
- case LAPDm_STATE_DISC_SENT:
- /* reset Timer T200 */
- osmo_timer_del(&dl->t200);
- /* go to idle state */
- lapdm_dl_newstate(dl, LAPDm_STATE_IDLE);
- rc = send_rll_simple(RSL_MT_REL_CONF, mctx);
- msgb_free(msg);
- return 0;
- case LAPDm_STATE_IDLE:
- /* 5.4.5 all other frame types shall be discarded */
- default:
- LOGP(DLAPDM, LOGL_INFO, "unsolicited DM response! "
- "(discarding)\n");
- msgb_free(msg);
- return 0;
- }
- /* reset T200 */
- osmo_timer_del(&dl->t200);
- rc = send_rll_simple(RSL_MT_REL_IND, mctx);
- msgb_free(msg);
- break;
- case LAPDm_U_UI:
- LOGP(DLAPDM, LOGL_INFO, "UI received\n");
- /* G.2.2 Wrong value of the C/R bit */
- if (LAPDm_ADDR_CR(mctx->addr) == le->cr.rem2loc.resp) {
- LOGP(DLAPDM, LOGL_NOTICE, "UI indicates response "
- "error\n");
- msgb_free(msg);
- rsl_rll_error(RLL_CAUSE_FRM_UNIMPL, mctx);
- return -EINVAL;
- }
-
- length = msg->l2h[2] >> 2;
- /* FIXME: G.4.5 If UI is received with L>N201 or with M bit
- * set, AN MDL-ERROR-INDICATION is sent to MM.
- */
-
- if (mctx->lapdm_fmt == LAPDm_FMT_B4) {
- length = N201_B4;
- msg->l3h = msg->l2h + 2;
- } else {
- rc = check_length_ind(mctx, msg->l2h[2]);
- if (rc < 0) {
- msgb_free(msg);
- return rc;
- }
- length = msg->l2h[2] >> 2;
- msg->l3h = msg->l2h + 3;
- }
- /* do some length checks */
- if (length == 0) {
- /* 5.3.3 UI frames received with the length indicator
- * set to "0" shall be ignored
- */
- LOGP(DLAPDM, LOGL_INFO, "length=0 (discarding)\n");
- msgb_free(msg);
- return 0;
- }
- switch (LAPDm_ADDR_SAPI(mctx->addr)) {
- case LAPDm_SAPI_NORMAL:
- case LAPDm_SAPI_SMS:
- break;
- default:
- /* 5.3.3 UI frames with invalid SAPI values shall be
- * discarded
- */
- LOGP(DLAPDM, LOGL_INFO, "sapi=%u (discarding)\n",
- LAPDm_ADDR_SAPI(mctx->addr));
- msgb_free(msg);
- return 0;
- }
- msgb_pull_l2h(msg);
- rc = send_rslms_rll_l3_ui(mctx, msg);
- break;
- case LAPDm_U_DISC:
- rsl_msg = RSL_MT_REL_IND;
-
- LOGP(DLAPDM, LOGL_INFO, "DISC received\n");
- /* flush buffers */
- lapdm_dl_flush_tx(dl);
- lapdm_dl_flush_send(dl);
- /* 5.7.1 */
- dl->seq_err_cond = 0;
- /* G.2.2 Wrong value of the C/R bit */
- if (LAPDm_ADDR_CR(mctx->addr) == le->cr.rem2loc.resp) {
- LOGP(DLAPDM, LOGL_NOTICE, "DISC response error\n");
- msgb_free(msg);
- rsl_rll_error(RLL_CAUSE_FRM_UNIMPL, mctx);
- return -EINVAL;
- }
- length = msg->l2h[2] >> 2;
- if (length > 0 || msg->l2h[2] & 0x02) {
- /* G.4.4 If a DISC or DM frame is received with L>0 or
- * with the M bit set to "1", an MDL-ERROR-INDICATION
- * primitive with cause "U frame with incorrect
- * parameters" is sent to the mobile management entity.
- */
- LOGP(DLAPDM, LOGL_NOTICE,
- "U frame iwth incorrect parameters ");
- msgb_free(msg);
- rsl_rll_error(RLL_CAUSE_UFRM_INC_PARAM, mctx);
- return -EIO;
- }
- switch (dl->state) {
- case LAPDm_STATE_IDLE:
- LOGP(DLAPDM, LOGL_INFO, "DISC in idle state\n");
- /* send DM with F=P */
- msgb_free(msg);
- return lapdm_send_dm(mctx);
- case LAPDm_STATE_SABM_SENT:
- LOGP(DLAPDM, LOGL_INFO, "DISC in SABM state\n");
- /* 5.4.6.2 send DM with F=P */
- lapdm_send_dm(mctx);
- /* reset Timer T200 */
- osmo_timer_del(&dl->t200);
- msgb_free(msg);
- return send_rll_simple(RSL_MT_REL_IND, mctx);
- case LAPDm_STATE_MF_EST:
- case LAPDm_STATE_TIMER_RECOV:
- LOGP(DLAPDM, LOGL_INFO, "DISC in est state\n");
- break;
- case LAPDm_STATE_DISC_SENT:
- LOGP(DLAPDM, LOGL_INFO, "DISC in disc state\n");
- rsl_msg = RSL_MT_REL_CONF;
- break;
- default:
- lapdm_send_ua(mctx, length, msg->l2h + 3);
- msgb_free(msg);
- return 0;
- }
- /* send UA response */
- lapdm_send_ua(mctx, length, msg->l2h + 3);
- /* reset Timer T200 */
- osmo_timer_del(&dl->t200);
- /* enter idle state */
- lapdm_dl_newstate(dl, LAPDm_STATE_IDLE);
- /* send notification to L3 */
- rc = send_rll_simple(rsl_msg, mctx);
- msgb_free(msg);
- break;
- case LAPDm_U_UA:
- LOGP(DLAPDM, LOGL_INFO, "UA received\n");
- /* G.2.2 Wrong value of the C/R bit */
- if (LAPDm_ADDR_CR(mctx->addr) == le->cr.rem2loc.cmd) {
- LOGP(DLAPDM, LOGL_NOTICE, "UA indicates command "
- "error\n");
- msgb_free(msg);
- rsl_rll_error(RLL_CAUSE_FRM_UNIMPL, mctx);
- return -EINVAL;
- }
-
- length = msg->l2h[2] >> 2;
- /* G.4.5 If UA is received with L>N201 or with M bit
- * set, AN MDL-ERROR-INDICATION is sent to MM.
- */
- if ((msg->l2h[2] & LAPDm_MORE) || length + 3 > mctx->n201) {
- LOGP(DLAPDM, LOGL_NOTICE, "UA too large error\n");
- msgb_free(msg);
- rsl_rll_error(RLL_CAUSE_UFRM_INC_PARAM, mctx);
- return -EIO;
- }
-
- if (!LAPDm_CTRL_PF_BIT(mctx->ctrl)) {
- /* 5.4.1.2 A UA response with the F bit set to "0"
- * shall be ignored.
- */
- LOGP(DLAPDM, LOGL_INFO, "F=0 (discarding)\n");
- msgb_free(msg);
- return 0;
- }
- switch (dl->state) {
- case LAPDm_STATE_SABM_SENT:
- break;
- case LAPDm_STATE_MF_EST:
- case LAPDm_STATE_TIMER_RECOV:
- LOGP(DLAPDM, LOGL_INFO, "unsolicited UA response! "
- "(discarding)\n");
- rsl_rll_error(RLL_CAUSE_UNSOL_UA_RESP, mctx);
- msgb_free(msg);
- return 0;
- case LAPDm_STATE_DISC_SENT:
- LOGP(DLAPDM, LOGL_INFO, "UA in disconnect state\n");
- /* reset Timer T200 */
- osmo_timer_del(&dl->t200);
- /* go to idle state */
- lapdm_dl_newstate(dl, LAPDm_STATE_IDLE);
- rc = send_rll_simple(RSL_MT_REL_CONF, mctx);
- msgb_free(msg);
- return 0;
- case LAPDm_STATE_IDLE:
- /* 5.4.5 all other frame types shall be discarded */
- default:
- LOGP(DLAPDM, LOGL_INFO, "unsolicited UA response! "
- "(discarding)\n");
- msgb_free(msg);
- return 0;
- }
- LOGP(DLAPDM, LOGL_INFO, "UA in SABM state\n");
- /* reset Timer T200 */
- osmo_timer_del(&dl->t200);
- /* compare UA with SABME if contention resolution is applied */
- if (dl->tx_hist[0][2] >> 2) {
- rc = check_length_ind(mctx, msg->l2h[2]);
- if (rc < 0) {
- rc = send_rll_simple(RSL_MT_REL_IND, mctx);
- msgb_free(msg);
- /* go to idle state */
- lapdm_dl_newstate(dl, LAPDm_STATE_IDLE);
- return 0;
- }
- length = msg->l2h[2] >> 2;
- if (length != (dl->tx_hist[0][2] >> 2)
- || !!memcmp(dl->tx_hist[0] + 3, msg->l2h + 3,
- length)) {
- LOGP(DLAPDM, LOGL_INFO, "**** UA response "
- "mismatches ****\n");
- rc = send_rll_simple(RSL_MT_REL_IND, mctx);
- msgb_free(msg);
- /* go to idle state */
- lapdm_dl_newstate(dl, LAPDm_STATE_IDLE);
- return 0;
- }
- }
- /* set Vs, Vr and Va to 0 */
- dl->V_send = dl->V_recv = dl->V_ack = 0;
- /* clear tx_hist */
- dl->tx_length[0] = 0;
- /* enter multiple-frame-established state */
- lapdm_dl_newstate(dl, LAPDm_STATE_MF_EST);
- /* send outstanding frames, if any (resume / reconnect) */
- rslms_send_i(mctx, __LINE__);
- /* send notification to L3 */
- rc = send_rll_simple(RSL_MT_EST_CONF, mctx);
- msgb_free(msg);
- break;
- default:
- /* G.3.1 */
- LOGP(DLAPDM, LOGL_NOTICE, "Unnumbered frame not allowed.\n");
- msgb_free(msg);
- rsl_rll_error(RLL_CAUSE_FRM_UNIMPL, mctx);
- return -EINVAL;
- }
- return rc;
-}
-
-/* Receive a LAPDm S (Supervisory) message from L1 */
-static int lapdm_rx_s(struct msgb *msg, struct lapdm_msg_ctx *mctx)
-{
- struct lapdm_datalink *dl = mctx->dl;
- struct lapdm_entity *le = dl->entity;
- uint8_t length;
-
- length = msg->l2h[2] >> 2;
- if (length > 0 || msg->l2h[2] & 0x02) {
- /* G.4.3 If a supervisory frame is received with L>0 or
- * with the M bit set to "1", an MDL-ERROR-INDICATION
- * primitive with cause "S frame with incorrect
- * parameters" is sent to the mobile management entity. */
- LOGP(DLAPDM, LOGL_NOTICE,
- "S frame with incorrect parameters\n");
- msgb_free(msg);
- rsl_rll_error(RLL_CAUSE_SFRM_INC_PARAM, mctx);
- return -EIO;
- }
-
- if (LAPDm_ADDR_CR(mctx->addr) == le->cr.rem2loc.resp
- && LAPDm_CTRL_PF_BIT(mctx->ctrl)
- && dl->state != LAPDm_STATE_TIMER_RECOV) {
- /* 5.4.2.2: Inidcate error on supervisory reponse F=1 */
- LOGP(DLAPDM, LOGL_NOTICE, "S frame response with F=1 error\n");
- rsl_rll_error(RLL_CAUSE_UNSOL_SPRV_RESP, mctx);
- }
-
- switch (dl->state) {
- case LAPDm_STATE_IDLE:
- /* if P=1, respond DM with F=1 (5.2.2) */
- /* 5.4.5 all other frame types shall be discarded */
- if (LAPDm_CTRL_PF_BIT(mctx->ctrl))
- lapdm_send_dm(mctx); /* F=P */
- /* fall though */
- case LAPDm_STATE_SABM_SENT:
- case LAPDm_STATE_DISC_SENT:
- LOGP(DLAPDM, LOGL_NOTICE, "S frame ignored in this state\n");
- msgb_free(msg);
- return 0;
- }
- switch (LAPDm_CTRL_S_BITS(mctx->ctrl)) {
- case LAPDm_S_RR:
- LOGP(DLAPDM, LOGL_INFO, "RR received\n");
- /* 5.5.3.1: Acknowlege all tx frames up the the N(R)-1 */
- lapdm_acknowledge(mctx);
-
- /* 5.5.3.2 */
- if (LAPDm_ADDR_CR(mctx->addr) == le->cr.rem2loc.cmd
- && LAPDm_CTRL_PF_BIT(mctx->ctrl)) {
- if (!dl->own_busy && !dl->seq_err_cond) {
- LOGP(DLAPDM, LOGL_NOTICE, "RR frame command "
- "with polling bit set and we are not "
- "busy, so we reply with RR frame\n");
- lapdm_send_rr(mctx, 1);
- /* NOTE: In case of sequence error condition,
- * the REJ frame has been transmitted when
- * entering the condition, so it has not be
- * done here
- */
- } else if (dl->own_busy) {
- LOGP(DLAPDM, LOGL_NOTICE, "RR frame command "
- "with polling bit set and we are busy, "
- "so we reply with RR frame\n");
- lapdm_send_rnr(mctx, 1);
- }
- } else if (LAPDm_ADDR_CR(mctx->addr) == le->cr.rem2loc.resp
- && LAPDm_CTRL_PF_BIT(mctx->ctrl)
- && dl->state == LAPDm_STATE_TIMER_RECOV) {
- LOGP(DLAPDM, LOGL_INFO, "RR response with F==1, "
- "and we are in timer recovery state, so "
- "we leave that state\n");
- /* V(S) to the N(R) in the RR frame */
- dl->V_send = LAPDm_CTRL_Nr(mctx->ctrl);
- /* reset Timer T200 */
- osmo_timer_del(&dl->t200);
- /* 5.5.7 Clear timer recovery condition */
- lapdm_dl_newstate(dl, LAPDm_STATE_MF_EST);
- }
- /* Send message, if possible due to acknowledged data */
- rslms_send_i(mctx, __LINE__);
-
- break;
- case LAPDm_S_RNR:
- LOGP(DLAPDM, LOGL_INFO, "RNR received\n");
- /* 5.5.3.1: Acknowlege all tx frames up the the N(R)-1 */
- lapdm_acknowledge(mctx);
-
- /* 5.5.5 */
- /* Set peer receiver busy condition */
- dl->peer_busy = 1;
-
- if (LAPDm_CTRL_PF_BIT(mctx->ctrl)) {
- if (LAPDm_ADDR_CR(mctx->addr) == le->cr.rem2loc.cmd) {
- if (!dl->own_busy) {
- LOGP(DLAPDM, LOGL_INFO, "RNR poll "
- "command and we are not busy, "
- "so we reply with RR final "
- "response\n");
- /* Send RR with F=1 */
- lapdm_send_rr(mctx, 1);
- } else {
- LOGP(DLAPDM, LOGL_INFO, "RNR poll "
- "command and we are busy, so "
- "we reply with RNR final "
- "response\n");
- /* Send RNR with F=1 */
- lapdm_send_rnr(mctx, 1);
- }
- } else if (dl->state == LAPDm_STATE_TIMER_RECOV) {
- LOGP(DLAPDM, LOGL_INFO, "RNR poll response "
- "and we in timer recovery state, so "
- "we leave that state\n");
- /* 5.5.7 Clear timer recovery condition */
- lapdm_dl_newstate(dl, LAPDm_STATE_MF_EST);
- /* V(S) to the N(R) in the RNR frame */
- dl->V_send = LAPDm_CTRL_Nr(mctx->ctrl);
- }
- } else
- LOGP(DLAPDM, LOGL_INFO, "RNR not polling/final state "
- "received\n");
-
- /* Send message, if possible due to acknowledged data */
- rslms_send_i(mctx, __LINE__);
-
- break;
- case LAPDm_S_REJ:
- LOGP(DLAPDM, LOGL_INFO, "REJ received\n");
- /* 5.5.3.1: Acknowlege all tx frames up the the N(R)-1 */
- lapdm_acknowledge(mctx);
-
- /* 5.5.4.1 */
- if (dl->state != LAPDm_STATE_TIMER_RECOV) {
- /* Clear an existing peer receiver busy condition */
- dl->peer_busy = 0;
- /* V(S) and V(A) to the N(R) in the REJ frame */
- dl->V_send = dl->V_ack = LAPDm_CTRL_Nr(mctx->ctrl);
- /* reset Timer T200 */
- osmo_timer_del(&dl->t200);
- /* 5.5.3.2 */
- if (LAPDm_ADDR_CR(mctx->addr) == le->cr.rem2loc.cmd
- && LAPDm_CTRL_PF_BIT(mctx->ctrl)) {
- if (!dl->own_busy && !dl->seq_err_cond) {
- LOGP(DLAPDM, LOGL_INFO, "REJ poll "
- "command not in timer recovery "
- "state and not in own busy "
- "condition received, so we "
- "respond with RR final "
- "response\n");
- lapdm_send_rr(mctx, 1);
- /* NOTE: In case of sequence error
- * condition, the REJ frame has been
- * transmitted when entering the
- * condition, so it has not be done
- * here
- */
- } else if (dl->own_busy) {
- LOGP(DLAPDM, LOGL_INFO, "REJ poll "
- "command not in timer recovery "
- "state and in own busy "
- "condition received, so we "
- "respond with RNR final "
- "response\n");
- lapdm_send_rnr(mctx, 1);
- }
- } else
- LOGP(DLAPDM, LOGL_INFO, "REJ response or not "
- "polling command not in timer recovery "
- "state received\n");
- /* send MDL ERROR INIDCATION to L3 */
- if (LAPDm_ADDR_CR(mctx->addr) == le->cr.rem2loc.resp
- && LAPDm_CTRL_PF_BIT(mctx->ctrl)) {
- rsl_rll_error(RLL_CAUSE_UNSOL_SPRV_RESP, mctx);
- }
-
- } else if (LAPDm_ADDR_CR(mctx->addr) == le->cr.rem2loc.resp
- && LAPDm_CTRL_PF_BIT(mctx->ctrl)) {
- LOGP(DLAPDM, LOGL_INFO, "REJ poll response in timer "
- "recovery state received\n");
- /* Clear an existing peer receiver busy condition */
- dl->peer_busy = 0;
- /* 5.5.7 Clear timer recovery condition */
- lapdm_dl_newstate(dl, LAPDm_STATE_MF_EST);
- /* V(S) and V(A) to the N(R) in the REJ frame */
- dl->V_send = dl->V_ack = LAPDm_CTRL_Nr(mctx->ctrl);
- /* reset Timer T200 */
- osmo_timer_del(&dl->t200);
- } else {
- /* Clear an existing peer receiver busy condition */
- dl->peer_busy = 0;
- /* V(S) and V(A) to the N(R) in the REJ frame */
- dl->V_send = dl->V_ack = LAPDm_CTRL_Nr(mctx->ctrl);
- /* 5.5.3.2 */
- if (LAPDm_ADDR_CR(mctx->addr) == le->cr.rem2loc.cmd
- && LAPDm_CTRL_PF_BIT(mctx->ctrl)) {
- if (!dl->own_busy && !dl->seq_err_cond) {
- LOGP(DLAPDM, LOGL_INFO, "REJ poll "
- "command in timer recovery "
- "state and not in own busy "
- "condition received, so we "
- "respond with RR final "
- "response\n");
- lapdm_send_rr(mctx, 1);
- /* NOTE: In case of sequence error
- * condition, the REJ frame has been
- * transmitted when entering the
- * condition, so it has not be done
- * here
- */
- } else if (dl->own_busy) {
- LOGP(DLAPDM, LOGL_INFO, "REJ poll "
- "command in timer recovery "
- "state and in own busy "
- "condition received, so we "
- "respond with RNR final "
- "response\n");
- lapdm_send_rnr(mctx, 1);
- }
- } else
- LOGP(DLAPDM, LOGL_INFO, "REJ response or not "
- "polling command in timer recovery "
- "state received\n");
- }
-
- /* FIXME: 5.5.4.2 2) */
-
- /* Send message, if possible due to acknowledged data */
- rslms_send_i(mctx, __LINE__);
-
- break;
- default:
- /* G.3.1 */
- LOGP(DLAPDM, LOGL_NOTICE, "Supervisory frame not allowed.\n");
- msgb_free(msg);
- rsl_rll_error(RLL_CAUSE_FRM_UNIMPL, mctx);
- return -EINVAL;
- }
- msgb_free(msg);
- return 0;
-}
-
-/* Receive a LAPDm I (Information) message from L1 */
-static int lapdm_rx_i(struct msgb *msg, struct lapdm_msg_ctx *mctx)
-{
- struct lapdm_datalink *dl = mctx->dl;
- struct lapdm_entity *le = dl->entity;
- //uint8_t nr = LAPDm_CTRL_Nr(mctx->ctrl);
- uint8_t ns = LAPDm_CTRL_I_Ns(mctx->ctrl);
- uint8_t length;
- int rc;
-
- LOGP(DLAPDM, LOGL_NOTICE, "I received\n");
-
- /* G.2.2 Wrong value of the C/R bit */
- if (LAPDm_ADDR_CR(mctx->addr) == le->cr.rem2loc.resp) {
- LOGP(DLAPDM, LOGL_NOTICE, "I frame response not allowed\n");
- msgb_free(msg);
- rsl_rll_error(RLL_CAUSE_FRM_UNIMPL, mctx);
- return -EINVAL;
- }
-
- length = msg->l2h[2] >> 2;
- if (length == 0 || length + 3 > mctx->n201) {
- /* G.4.2 If the length indicator of an I frame is set
- * to a numerical value L>N201 or L=0, an MDL-ERROR-INDICATION
- * primitive with cause "I frame with incorrect length"
- * is sent to the mobile management entity. */
- LOGP(DLAPDM, LOGL_NOTICE, "I frame length not allowed\n");
- msgb_free(msg);
- rsl_rll_error(RLL_CAUSE_IFRM_INC_LEN, mctx);
- return -EIO;
- }
-
- /* G.4.2 If the numerical value of L is L<N201 and the M
- * bit is set to "1", then an MDL-ERROR-INDICATION primitive with
- * cause "I frame with incorrect use of M bit" is sent to the
- * mobile management entity. */
- if ((msg->l2h[2] & LAPDm_MORE) && length + 3 < mctx->n201) {
- LOGP(DLAPDM, LOGL_NOTICE, "I frame with M bit too short\n");
- msgb_free(msg);
- rsl_rll_error(RLL_CAUSE_IFRM_INC_MBITS, mctx);
- return -EIO;
- }
-
- switch (dl->state) {
- case LAPDm_STATE_IDLE:
- /* if P=1, respond DM with F=1 (5.2.2) */
- /* 5.4.5 all other frame types shall be discarded */
- if (LAPDm_CTRL_PF_BIT(mctx->ctrl))
- lapdm_send_dm(mctx); /* F=P */
- /* fall though */
- case LAPDm_STATE_SABM_SENT:
- case LAPDm_STATE_DISC_SENT:
- LOGP(DLAPDM, LOGL_NOTICE, "I frame ignored in this state\n");
- msgb_free(msg);
- return 0;
- }
-
- /* 5.7.1: N(s) sequence error */
- if (ns != dl->V_recv) {
- LOGP(DLAPDM, LOGL_NOTICE, "N(S) sequence error: N(S)=%u, "
- "V(R)=%u\n", ns, dl->V_recv);
- /* discard data */
- msgb_free(msg);
- if (!dl->seq_err_cond) {
- /* FIXME: help me understand what exactly todo here
- dl->seq_err_cond = 1;
- */
- lapdm_send_rej(mctx, LAPDm_CTRL_PF_BIT(mctx->ctrl));
- } else {
- }
- return -EIO;
- }
- dl->seq_err_cond = 0;
-
- /* Increment receiver state */
- dl->V_recv = inc_mod8(dl->V_recv);
- LOGP(DLAPDM, LOGL_NOTICE, "incrementing V(R) to %u\n", dl->V_recv);
-
- /* 5.5.3.1: Acknowlege all transmitted frames up the the N(R)-1 */
- lapdm_acknowledge(mctx); /* V(A) is also set here */
-
- /* Only if we are not in own receiver busy condition */
- if (!dl->own_busy) {
- /* if the frame carries a complete segment */
- if (!(msg->l2h[2] & LAPDm_MORE)
- && !dl->rcv_buffer) {
- LOGP(DLAPDM, LOGL_INFO, "message in single I frame\n");
- /* send a DATA INDICATION to L3 */
- msg->l3h = msg->l2h + 3;
- msgb_pull_l2h(msg);
- msg->len = length;
- msg->tail = msg->data + length;
- rc = send_rslms_rll_l3(RSL_MT_DATA_IND, mctx, msg);
- } else {
- /* create rcv_buffer */
- if (!dl->rcv_buffer) {
- LOGP(DLAPDM, LOGL_INFO, "message in multiple I "
- "frames (first message)\n");
- dl->rcv_buffer = msgb_alloc_headroom(200+56, 56,
- "LAPDm RX");
- dl->rcv_buffer->l3h = dl->rcv_buffer->data;
- }
- /* concat. rcv_buffer */
- if (msgb_l3len(dl->rcv_buffer) + length > 200) {
- LOGP(DLAPDM, LOGL_NOTICE, "Received frame "
- "overflow!\n");
- } else {
- memcpy(msgb_put(dl->rcv_buffer, length),
- msg->l2h + 3, length);
- }
- /* if the last segment was received */
- if (!(msg->l2h[2] & LAPDm_MORE)) {
- LOGP(DLAPDM, LOGL_INFO, "message in multiple I "
- "frames (last message)\n");
- rc = send_rslms_rll_l3(RSL_MT_DATA_IND, mctx,
- dl->rcv_buffer);
- dl->rcv_buffer = NULL;
- } else
- LOGP(DLAPDM, LOGL_INFO, "message in multiple I "
- "frames (next message)\n");
- msgb_free(msg);
-
- }
- } else
- LOGP(DLAPDM, LOGL_INFO, "I frame ignored during own receiver "
- "busy condition\n");
-
- /* Check for P bit */
- if (LAPDm_CTRL_PF_BIT(mctx->ctrl)) {
- /* 5.5.2.1 */
- /* check if we are not in own receiver busy */
- if (!dl->own_busy) {
- LOGP(DLAPDM, LOGL_INFO, "we are not busy, send RR\n");
- /* Send RR with F=1 */
- rc = lapdm_send_rr(mctx, 1);
- } else {
- LOGP(DLAPDM, LOGL_INFO, "we are busy, send RNR\n");
- /* Send RNR with F=1 */
- rc = lapdm_send_rnr(mctx, 1);
- }
- } else {
- /* 5.5.2.2 */
- /* check if we are not in own receiver busy */
- if (!dl->own_busy) {
- /* NOTE: V(R) is already set above */
- rc = rslms_send_i(mctx, __LINE__);
- if (rc) {
- LOGP(DLAPDM, LOGL_INFO, "we are not busy and "
- "have no pending data, send RR\n");
- /* Send RR with F=0 */
- return lapdm_send_rr(mctx, 0);
- }
- /* all I or one RR is sent, we are done */
- return 0;
- } else {
- LOGP(DLAPDM, LOGL_INFO, "we are busy, send RNR\n");
- /* Send RNR with F=0 */
- rc = lapdm_send_rnr(mctx, 0);
- }
- }
-
- /* Send message, if possible due to acknowledged data */
- rslms_send_i(mctx, __LINE__);
-
- return rc;
-}
-
-/* Receive a LAPDm message from L1 */
-static int lapdm_ph_data_ind(struct msgb *msg, struct lapdm_msg_ctx *mctx)
-{
- int rc;
-
- /* G.2.3 EA bit set to "0" is not allowed in GSM */
- if (!LAPDm_ADDR_EA(mctx->addr)) {
- LOGP(DLAPDM, LOGL_NOTICE, "EA bit 0 is not allowed in GSM\n");
- msgb_free(msg);
- rsl_rll_error(RLL_CAUSE_FRM_UNIMPL, mctx);
- return -EINVAL;
- }
-
- if (LAPDm_CTRL_is_U(mctx->ctrl))
- rc = lapdm_rx_u(msg, mctx);
- else if (LAPDm_CTRL_is_S(mctx->ctrl))
- rc = lapdm_rx_s(msg, mctx);
- else if (LAPDm_CTRL_is_I(mctx->ctrl))
- rc = lapdm_rx_i(msg, mctx);
- else {
- LOGP(DLAPDM, LOGL_NOTICE, "unknown LAPDm format\n");
- msgb_free(msg);
- rc = -EINVAL;
- }
- return rc;
-}
-
-/* input into layer2 (from layer 1) */
-static int l2_ph_data_ind(struct msgb *msg, struct lapdm_entity *le, uint8_t chan_nr, uint8_t link_id)
-{
- uint8_t cbits = chan_nr >> 3;
- uint8_t sapi = link_id & 7;
- struct lapdm_msg_ctx mctx;
- int rc = 0;
-
- /* when we reach here, we have a msgb with l2h pointing to the raw
- * 23byte mac block. The l1h has already been purged. */
-
- mctx.dl = datalink_for_sapi(le, sapi);
- mctx.chan_nr = chan_nr;
- mctx.link_id = link_id;
- mctx.addr = mctx.ctrl = 0;
-
- /* G.2.1 No action schall be taken on frames containing an unallocated
- * SAPI.
- */
- if (!mctx.dl) {
- LOGP(DLAPDM, LOGL_NOTICE, "Received frame for unsupported "
- "SAPI %d!\n", sapi);
- return -EINVAL;
- msgb_free(msg);
- return -EIO;
- }
-
- /* check for L1 chan_nr/link_id and determine LAPDm hdr format */
- if (cbits == 0x10 || cbits == 0x12) {
- /* Format Bbis is used on BCCH and CCCH(PCH, NCH and AGCH) */
- mctx.lapdm_fmt = LAPDm_FMT_Bbis;
- mctx.n201 = N201_Bbis;
- } else {
- if (mctx.link_id & 0x40) {
- /* It was received from network on SACCH, thus
- * lapdm_fmt must be B4 */
- mctx.lapdm_fmt = LAPDm_FMT_B4;
- mctx.n201 = N201_B4;
- LOGP(DLAPDM, LOGL_INFO, "fmt=B4\n");
- /* SACCH frames have a two-byte L1 header that
- * OsmocomBB L1 doesn't strip */
- mctx.tx_power_ind = msg->l2h[0] & 0x1f;
- mctx.ta_ind = msg->l2h[1];
- msgb_pull(msg, 2);
- msg->l2h += 2;
- } else {
- mctx.lapdm_fmt = LAPDm_FMT_B;
- LOGP(DLAPDM, LOGL_INFO, "fmt=B\n");
- mctx.n201 = 23; // FIXME: select correct size by chan.
- }
- }
-
- switch (mctx.lapdm_fmt) {
- case LAPDm_FMT_A:
- case LAPDm_FMT_B:
- case LAPDm_FMT_B4:
- mctx.addr = msg->l2h[0];
- if (!(mctx.addr & 0x01)) {
- LOGP(DLAPDM, LOGL_ERROR, "we don't support "
- "multibyte addresses (discarding)\n");
- msgb_free(msg);
- return -EINVAL;
- }
- mctx.ctrl = msg->l2h[1];
- /* obtain SAPI from address field */
- mctx.link_id |= LAPDm_ADDR_SAPI(mctx.addr);
- rc = lapdm_ph_data_ind(msg, &mctx);
- break;
- case LAPDm_FMT_Bter:
- /* FIXME */
- msgb_free(msg);
- break;
- case LAPDm_FMT_Bbis:
- /* directly pass up to layer3 */
- LOGP(DLAPDM, LOGL_INFO, "fmt=Bbis UI\n");
- msg->l3h = msg->l2h;
- msgb_pull_l2h(msg);
- rc = send_rslms_rll_l3(RSL_MT_UNIT_DATA_IND, &mctx, msg);
- break;
- default:
- msgb_free(msg);
- }
-
- return rc;
-}
-
-/* input into layer2 (from layer 1) */
-static int l2_ph_rach_ind(struct lapdm_entity *le, uint8_t ra, uint32_t fn, uint8_t acc_delay)
-{
- struct abis_rsl_cchan_hdr *ch;
- struct gsm48_req_ref req_ref;
- struct gsm_time gt;
- struct msgb *msg = msgb_alloc_headroom(512, 64, "RSL CHAN RQD");
-
- msg->l2h = msgb_push(msg, sizeof(*ch));
- ch = (struct abis_rsl_cchan_hdr *)msg->l2h;
- rsl_init_cchan_hdr(ch, RSL_MT_CHAN_RQD);
- ch->chan_nr = RSL_CHAN_RACH;
-
- /* generate a RSL CHANNEL REQUIRED message */
- gsm_fn2gsmtime(&gt, fn);
- req_ref.ra = ra;
- req_ref.t1 = gt.t1; /* FIXME: modulo? */
- req_ref.t2 = gt.t2;
- req_ref.t3_low = gt.t3 & 7;
- req_ref.t3_high = gt.t3 >> 3;
-
- msgb_tv_fixed_put(msg, RSL_IE_REQ_REFERENCE, 3, (uint8_t *) &req_ref);
- msgb_tv_put(msg, RSL_IE_ACCESS_DELAY, acc_delay);
-
- return rslms_sendmsg(msg, le);
-}
-
-static int l2_ph_chan_conf(struct msgb *msg, struct lapdm_entity *le, uint32_t frame_nr);
-
-int lapdm_phsap_up(struct osmo_prim_hdr *oph, struct lapdm_entity *le)
-{
- struct osmo_phsap_prim *pp = (struct osmo_phsap_prim *) oph;
- int rc = 0;
-
- if (oph->sap != SAP_GSM_PH) {
- LOGP(DLAPDM, LOGL_ERROR, "primitive for unknown SAP %u\n",
- oph->sap);
- return -ENODEV;
- }
-
- switch (oph->primitive) {
- case PRIM_PH_DATA:
- if (oph->operation != PRIM_OP_INDICATION) {
- LOGP(DLAPDM, LOGL_ERROR, "PH_DATA is not INDICATION %u\n",
- oph->operation);
- return -ENODEV;
- }
- rc = l2_ph_data_ind(oph->msg, le, pp->u.data.chan_nr,
- pp->u.data.link_id);
- break;
- case PRIM_PH_RTS:
- if (oph->operation != PRIM_OP_INDICATION) {
- LOGP(DLAPDM, LOGL_ERROR, "PH_RTS is not INDICATION %u\n",
- oph->operation);
- return -ENODEV;
- }
- rc = l2_ph_data_conf(oph->msg, le);
- break;
- case PRIM_PH_RACH:
- switch (oph->operation) {
- case PRIM_OP_INDICATION:
- rc = l2_ph_rach_ind(le, pp->u.rach_ind.ra, pp->u.rach_ind.fn,
- pp->u.rach_ind.acc_delay);
- break;
- case PRIM_OP_CONFIRM:
- rc = l2_ph_chan_conf(oph->msg, le, pp->u.rach_ind.fn);
- break;
- default:
- return -EIO;
- }
- break;
- }
-
- return rc;
-}
-
-
-/* L3 -> L2 / RSLMS -> LAPDm */
-
-/* L3 requests establishment of data link */
-static int rslms_rx_rll_est_req(struct msgb *msg, struct lapdm_datalink *dl)
-{
- struct lapdm_entity *le = dl->entity;
- struct abis_rsl_rll_hdr *rllh = msgb_l2(msg);
- uint8_t chan_nr = rllh->chan_nr;
- uint8_t link_id = rllh->link_id;
- uint8_t sapi = rllh->link_id & 7;
- struct tlv_parsed tv;
- uint8_t length;
- uint8_t n201 = 23; //FIXME
-
- /* Set chan_nr and link_id for established connection */
- memset(&dl->mctx, 0, sizeof(dl->mctx));
- dl->mctx.dl = dl;
- dl->mctx.n201 = n201;
- dl->mctx.chan_nr = chan_nr;
- dl->mctx.link_id = link_id;
-
- rsl_tlv_parse(&tv, rllh->data, msgb_l2len(msg)-sizeof(*rllh));
- if (TLVP_PRESENT(&tv, RSL_IE_L3_INFO)) {
- msg->l3h = TLVP_VAL(&tv, RSL_IE_L3_INFO);
- /* contention resolution establishment procedure */
- if (sapi != 0) {
- /* According to clause 6, the contention resolution
- * procedure is only permitted with SAPI value 0 */
- LOGP(DLAPDM, LOGL_ERROR, "SAPI != 0 but contention"
- "resolution (discarding)\n");
- msgb_free(msg);
- return send_rll_simple(RSL_MT_REL_IND, &dl->mctx);
- }
- /* transmit a SABM command with the P bit set to "1". The SABM
- * command shall contain the layer 3 message unit */
- length = TLVP_LEN(&tv, RSL_IE_L3_INFO);
- LOGP(DLAPDM, LOGL_INFO, "perform establishment with content "
- "(SABM)\n");
- } else {
- /* normal establishment procedure */
- length = 0;
- LOGP(DLAPDM, LOGL_INFO, "perform normal establishm. (SABM)\n");
- }
-
- /* check if the layer3 message length exceeds N201 */
- if (length + 3 > 21) { /* FIXME: do we know the channel N201? */
- LOGP(DLAPDM, LOGL_ERROR, "frame too large: %d > N201(%d) "
- "(discarding)\n", length + 3, 21);
- msgb_free(msg);
- return send_rll_simple(RSL_MT_REL_IND, &dl->mctx);
- }
-
- /* Flush send-queue */
- /* Clear send-buffer */
- lapdm_dl_flush_send(dl);
-
- /* Discard partly received L3 message */
- if (dl->rcv_buffer) {
- msgb_free(dl->rcv_buffer);
- dl->rcv_buffer = NULL;
- }
-
- /* Remove RLL header from msgb */
- msgb_pull_l2h(msg);
-
- /* Push LAPDm header on msgb */
- msg->l2h = msgb_push(msg, 3);
- msg->l2h[0] = LAPDm_ADDR(LAPDm_LPD_NORMAL, sapi, le->cr.loc2rem.cmd);
- msg->l2h[1] = LAPDm_CTRL_U(LAPDm_U_SABM, 1);
- msg->l2h[2] = LAPDm_LEN(length);
- /* Transmit-buffer carries exactly one segment */
- memcpy(dl->tx_hist[0], msg->l2h, 3 + length);
- dl->tx_length[0] = 3 + length;
- /* set Vs to 0, because it is used as index when resending SABM */
- dl->V_send = 0;
-
- /* Set states */
- dl->own_busy = dl->peer_busy = 0;
- dl->retrans_ctr = 0;
- lapdm_dl_newstate(dl, LAPDm_STATE_SABM_SENT);
-
- /* Tramsmit and start T200 */
- osmo_timer_schedule(&dl->t200, T200);
- return tx_ph_data_enqueue(dl, msg, chan_nr, link_id, n201);
-}
-
-/* L3 requests transfer of unnumbered information */
-static int rslms_rx_rll_udata_req(struct msgb *msg, struct lapdm_datalink *dl)
-{
- struct lapdm_entity *le = dl->entity;
- struct abis_rsl_rll_hdr *rllh = msgb_l2(msg);
- uint8_t chan_nr = rllh->chan_nr;
- uint8_t link_id = rllh->link_id;
- uint8_t sapi = link_id & 7;
- struct tlv_parsed tv;
- int length;
- uint8_t n201 = 23; //FIXME
- uint8_t ta = 0, tx_power = 0;
-
- /* check if the layer3 message length exceeds N201 */
-
- rsl_tlv_parse(&tv, rllh->data, msgb_l2len(msg)-sizeof(*rllh));
-
- if (TLVP_PRESENT(&tv, RSL_IE_TIMING_ADVANCE)) {
- ta = *TLVP_VAL(&tv, RSL_IE_TIMING_ADVANCE);
- }
- if (TLVP_PRESENT(&tv, RSL_IE_MS_POWER)) {
- tx_power = *TLVP_VAL(&tv, RSL_IE_MS_POWER);
- }
- if (!TLVP_PRESENT(&tv, RSL_IE_L3_INFO)) {
- LOGP(DLAPDM, LOGL_ERROR, "unit data request without message "
- "error\n");
- msgb_free(msg);
- return -EINVAL;
- }
- msg->l3h = TLVP_VAL(&tv, RSL_IE_L3_INFO);
- length = TLVP_LEN(&tv, RSL_IE_L3_INFO);
- /* check if the layer3 message length exceeds N201 */
- if (length + 5 > 23) { /* FIXME: do we know the channel N201? */
- LOGP(DLAPDM, LOGL_ERROR, "frame too large: %d > N201(%d) "
- "(discarding)\n", length + 5, 23);
- msgb_free(msg);
- return -EIO;
- }
-
- LOGP(DLAPDM, LOGL_INFO, "sending unit data (tx_power=%d, ta=%d)\n",
- tx_power, ta);
-
- /* Remove RLL header from msgb */
- msgb_pull_l2h(msg);
-
- /* Push L1 + LAPDm header on msgb */
- msg->l2h = msgb_push(msg, 2 + 3);
- msg->l2h[0] = tx_power;
- msg->l2h[1] = ta;
- msg->l2h[2] = LAPDm_ADDR(LAPDm_LPD_NORMAL, sapi, le->cr.loc2rem.cmd);
- msg->l2h[3] = LAPDm_CTRL_U(LAPDm_U_UI, 0);
- msg->l2h[4] = LAPDm_LEN(length);
- // FIXME: short L2 header support
-
- /* Tramsmit */
- return tx_ph_data_enqueue(dl, msg, chan_nr, link_id, n201);
-}
-
-/* L3 requests transfer of acknowledged information */
-static int rslms_rx_rll_data_req(struct msgb *msg, struct lapdm_datalink *dl)
-{
- struct abis_rsl_rll_hdr *rllh = msgb_l2(msg);
- struct tlv_parsed tv;
-
- rsl_tlv_parse(&tv, rllh->data, msgb_l2len(msg)-sizeof(*rllh));
- if (!TLVP_PRESENT(&tv, RSL_IE_L3_INFO)) {
- LOGP(DLAPDM, LOGL_ERROR, "data request without message "
- "error\n");
- msgb_free(msg);
- return -EINVAL;
- }
- msg->l3h = TLVP_VAL(&tv, RSL_IE_L3_INFO);
-
- LOGP(DLAPDM, LOGL_INFO, "writing message to send-queue\n");
-
- /* Remove the RSL/RLL header */
- msgb_pull_l2h(msg);
-
- /* Write data into the send queue */
- msgb_enqueue(&dl->send_queue, msg);
-
- /* Send message, if possible */
- rslms_send_i(&dl->mctx, __LINE__);
- return 0;
-}
-
-/* Send next I frame from queued/buffered data */
-static int rslms_send_i(struct lapdm_msg_ctx *mctx, int line)
-{
- struct lapdm_datalink *dl = mctx->dl;
- struct lapdm_entity *le = dl->entity;
- uint8_t chan_nr = mctx->chan_nr;
- uint8_t link_id = mctx->link_id;
- uint8_t sapi = link_id & 7;
- int k = k_sapi[sapi];
- struct msgb *msg;
- int length, left;
- int rc = - 1; /* we sent nothing */
-
- LOGP(DLAPDM, LOGL_INFO, "%s() called from line %d\n", __func__, line);
-
- next_frame:
-
- if (dl->peer_busy) {
- LOGP(DLAPDM, LOGL_INFO, "peer busy, not sending\n");
- return rc;
- }
-
- if (dl->state == LAPDm_STATE_TIMER_RECOV) {
- LOGP(DLAPDM, LOGL_INFO, "timer recovery, not sending\n");
- return rc;
- }
-
- /* If the send state variable V(S) is equal to V(A) plus k
- * (where k is the maximum number of outstanding I frames - see
- * subclause 5.8.4), the data link layer entity shall not transmit any
- * new I frames, but shall retransmit an I frame as a result
- * of the error recovery procedures as described in subclauses 5.5.4 and
- * 5.5.7. */
- if (dl->V_send == add_mod8(dl->V_ack, k)) {
- LOGP(DLAPDM, LOGL_INFO, "k frames outstanding, not sending "
- "more (k=%u V(S)=%u V(A)=%u)\n", k, dl->V_send,
- dl->V_ack);
- return rc;
- }
-
- /* if we have no tx_hist yet, we create it */
- if (!dl->tx_length[dl->V_send]) {
- /* Get next message into send-buffer, if any */
- if (!dl->send_buffer) {
- next_message:
- dl->send_out = 0;
- dl->send_buffer = msgb_dequeue(&dl->send_queue);
- /* No more data to be sent */
- if (!dl->send_buffer)
- return rc;
- LOGP(DLAPDM, LOGL_INFO, "get message from "
- "send-queue\n");
- }
-
- /* How much is left in the send-buffer? */
- left = msgb_l3len(dl->send_buffer) - dl->send_out;
- /* Segment, if data exceeds N201 */
- length = left;
- if (length > mctx->n201 - 3)
- length = mctx->n201 - 3;
- LOGP(DLAPDM, LOGL_INFO, "msg-len %d sent %d left %d N201 %d "
- "length %d first byte %02x\n",
- msgb_l3len(dl->send_buffer), dl->send_out, left,
- mctx->n201, length, dl->send_buffer->l3h[0]);
- /* If message in send-buffer is completely sent */
- if (left == 0) {
- msgb_free(dl->send_buffer);
- dl->send_buffer = NULL;
- goto next_message;
- }
-
- LOGP(DLAPDM, LOGL_INFO, "send I frame %sV(S)=%d\n",
- (left > length) ? "segment " : "", dl->V_send);
-
- /* Create I frame (segment) and transmit-buffer content */
- msg = msgb_alloc_headroom(23+10, 10, "LAPDm I");
- msg->l2h = msgb_put(msg, 3 + length);
- msg->l2h[0] = LAPDm_ADDR(LAPDm_LPD_NORMAL, sapi, le->cr.loc2rem.cmd);
- msg->l2h[1] = LAPDm_CTRL_I(dl->V_recv, dl->V_send, 0);
- msg->l2h[2] = LAPDm_LEN(length);
- if (left > length)
- msg->l2h[2] |= LAPDm_MORE;
- memcpy(msg->l2h + 3, dl->send_buffer->l3h + dl->send_out,
- length);
- memcpy(dl->tx_hist[dl->V_send], msg->l2h, 3 + length);
- dl->tx_length[dl->V_send] = 3 + length;
- /* Add length to track how much is already in the tx buffer */
- dl->send_out += length;
- } else {
- LOGP(DLAPDM, LOGL_INFO, "resend I frame from tx buffer "
- "V(S)=%d\n", dl->V_send);
-
- /* Create I frame (segment) from tx_hist */
- length = dl->tx_length[dl->V_send];
- msg = msgb_alloc_headroom(23+10, 10, "LAPDm I");
- msg->l2h = msgb_put(msg, length);
- memcpy(msg->l2h, dl->tx_hist[dl->V_send], length);
- msg->l2h[1] = LAPDm_CTRL_I(dl->V_recv, dl->V_send, 0);
- }
-
- /* The value of the send state variable V(S) shall be incremented by 1
- * at the end of the transmission of the I frame */
- dl->V_send = inc_mod8(dl->V_send);
-
- /* If timer T200 is not running at the time right before transmitting a
- * frame, when the PH-READY-TO-SEND primitive is received from the
- * physical layer., it shall be set. */
- if (!osmo_timer_pending(&dl->t200))
- osmo_timer_schedule(&dl->t200, T200);
-
- tx_ph_data_enqueue(dl, msg, chan_nr, link_id, mctx->n201);
-
- rc = 0; /* we sent something */
- goto next_frame;
-}
-
-/* L3 requests suspension of data link */
-static int rslms_rx_rll_susp_req(struct msgb *msg, struct lapdm_datalink *dl)
-{
- struct abis_rsl_rll_hdr *rllh = msgb_l2(msg);
- uint8_t sapi = rllh->link_id & 7;
-
- if (sapi != 0) {
- LOGP(DLAPDM, LOGL_ERROR, "SAPI != 0 while suspending\n");
- msgb_free(msg);
- return -EINVAL;
- }
-
- LOGP(DLAPDM, LOGL_INFO, "perform suspension\n");
-
- /* put back the send-buffer to the send-queue (first position) */
- if (dl->send_buffer) {
- LOGP(DLAPDM, LOGL_INFO, "put frame in sendbuffer back to "
- "queue\n");
- llist_add(&dl->send_buffer->list, &dl->send_queue);
- dl->send_buffer = NULL;
- } else
- LOGP(DLAPDM, LOGL_INFO, "no frame in sendbuffer\n");
-
- /* Clear transmit buffer, but keep send buffer */
- lapdm_dl_flush_tx(dl);
-
- msgb_free(msg);
-
- return send_rll_simple(RSL_MT_SUSP_CONF, &dl->mctx);
-}
-
-/* L3 requests resume of data link */
-static int rslms_rx_rll_res_req(struct msgb *msg, struct lapdm_datalink *dl)
-{
- struct lapdm_entity *le = dl->entity;
- struct abis_rsl_rll_hdr *rllh = msgb_l2(msg);
- uint8_t chan_nr = rllh->chan_nr;
- uint8_t link_id = rllh->link_id;
- uint8_t sapi = rllh->link_id & 7;
- struct tlv_parsed tv;
- uint8_t length;
- uint8_t n201 = 23; //FIXME
-
- /* Set chan_nr and link_id for established connection */
- memset(&dl->mctx, 0, sizeof(dl->mctx));
- dl->mctx.dl = dl;
- dl->mctx.n201 = n201;
- dl->mctx.chan_nr = chan_nr;
- dl->mctx.link_id = link_id;
-
- rsl_tlv_parse(&tv, rllh->data, msgb_l2len(msg)-sizeof(*rllh));
- if (!TLVP_PRESENT(&tv, RSL_IE_L3_INFO)) {
- LOGP(DLAPDM, LOGL_ERROR, "resume without message error\n");
- msgb_free(msg);
- return send_rll_simple(RSL_MT_REL_IND, &dl->mctx);
- }
- length = TLVP_LEN(&tv, RSL_IE_L3_INFO);
-
- LOGP(DLAPDM, LOGL_INFO, "perform re-establishment (SABM) length=%d\n",
- length);
-
- /* Replace message in the send-buffer (reconnect) */
- if (dl->send_buffer)
- msgb_free(dl->send_buffer);
- dl->send_out = 0;
- if (length) {
- /* Remove the RSL/RLL header */
- msgb_pull_l2h(msg);
- /* Write data into the send buffer, to be sent first */
- dl->send_buffer = msg;
- }
-
- /* Discard partly received L3 message */
- if (dl->rcv_buffer) {
- msgb_free(dl->rcv_buffer);
- dl->rcv_buffer = NULL;
- }
-
- /* Create new msgb (old one is now free) */
- msg = msgb_alloc_headroom(23+10, 10, "LAPDm SABM");
- msg->l2h = msgb_put(msg, 3);
- msg->l2h[0] = LAPDm_ADDR(LAPDm_LPD_NORMAL, sapi, le->cr.loc2rem.cmd);
- msg->l2h[1] = LAPDm_CTRL_U(LAPDm_U_SABM, 1);
- msg->l2h[2] = LAPDm_LEN(0);
- /* Transmit-buffer carries exactly one segment */
- memcpy(dl->tx_hist[0], msg->l2h, 3);
- dl->tx_length[0] = 3;
- /* set Vs to 0, because it is used as index when resending SABM */
- dl->V_send = 0;
-
- /* Set states */
- dl->own_busy = dl->peer_busy = 0;
- dl->retrans_ctr = 0;
- lapdm_dl_newstate(dl, LAPDm_STATE_SABM_SENT);
-
- /* Tramsmit and start T200 */
- osmo_timer_schedule(&dl->t200, T200);
- return tx_ph_data_enqueue(dl, msg, chan_nr, link_id, n201);
-}
-
-/* L3 requests release of data link */
-static int rslms_rx_rll_rel_req(struct msgb *msg, struct lapdm_datalink *dl)
-{
- struct lapdm_entity *le = dl->entity;
- struct abis_rsl_rll_hdr *rllh = msgb_l2(msg);
- uint8_t chan_nr = rllh->chan_nr;
- uint8_t link_id = rllh->link_id;
- uint8_t sapi = rllh->link_id & 7;
- uint8_t mode = 0;
-
- /* get release mode */
- if (rllh->data[0] == RSL_IE_RELEASE_MODE)
- mode = rllh->data[1] & 1;
-
- /* local release */
- if (mode) {
- LOGP(DLAPDM, LOGL_INFO, "perform local release\n");
- msgb_free(msg);
- /* reset Timer T200 */
- osmo_timer_del(&dl->t200);
- /* enter idle state */
- lapdm_dl_newstate(dl, LAPDm_STATE_IDLE);
- /* flush buffers */
- lapdm_dl_flush_tx(dl);
- lapdm_dl_flush_send(dl);
- /* send notification to L3 */
- return send_rll_simple(RSL_MT_REL_CONF, &dl->mctx);
- }
-
- /* in case we are already disconnecting */
- if (dl->state == LAPDm_STATE_DISC_SENT)
- return -EBUSY;
-
- LOGP(DLAPDM, LOGL_INFO, "perform normal release (DISC)\n");
-
- /* Pull rllh */
- msgb_pull(msg, msg->tail - msg->l2h);
-
- /* Push LAPDm header on msgb */
- msg->l2h = msgb_push(msg, 3);
- msg->l2h[0] = LAPDm_ADDR(LAPDm_LPD_NORMAL, sapi, le->cr.loc2rem.cmd);
- msg->l2h[1] = LAPDm_CTRL_U(LAPDm_U_DISC, 1);
- msg->l2h[2] = LAPDm_LEN(0);
- /* Transmit-buffer carries exactly one segment */
- memcpy(dl->tx_hist[0], msg->l2h, 3);
- dl->tx_length[0] = 3;
-
- /* Set states */
- dl->own_busy = dl->peer_busy = 0;
- dl->retrans_ctr = 0;
- lapdm_dl_newstate(dl, LAPDm_STATE_DISC_SENT);
-
- /* Tramsmit and start T200 */
- osmo_timer_schedule(&dl->t200, T200);
- return tx_ph_data_enqueue(dl, msg, chan_nr, link_id, dl->mctx.n201);
-}
-
-/* L3 requests release in idle state */
-static int rslms_rx_rll_rel_req_idle(struct msgb *msg, struct lapdm_datalink *dl)
-{
- msgb_free(msg);
-
- /* send notification to L3 */
- return send_rll_simple(RSL_MT_REL_CONF, &dl->mctx);
-}
-
-/* L3 requests channel in idle state */
-static int rslms_rx_chan_rqd(struct lapdm_channel *lc, struct msgb *msg)
-{
- struct abis_rsl_cchan_hdr *cch = msgb_l2(msg);
- void *l1ctx = lc->lapdm_dcch.l1_ctx;
- struct osmo_phsap_prim pp;
-
- osmo_prim_init(&pp.oph, SAP_GSM_PH, PRIM_PH_RACH,
- PRIM_OP_REQUEST, NULL);
-
- if (msgb_l2len(msg) < sizeof(*cch) + 4 + 2 + 2) {
- LOGP(DRSL, LOGL_ERROR, "Message too short for CHAN RQD!\n");
- return -EINVAL;
- }
- if (cch->data[0] != RSL_IE_REQ_REFERENCE) {
- LOGP(DRSL, LOGL_ERROR, "Missing REQ REFERENCE IE\n");
- return -EINVAL;
- }
- pp.u.rach_req.ra = cch->data[1];
- pp.u.rach_req.offset = ((cch->data[2] & 0x7f) << 8) | cch->data[3];
- pp.u.rach_req.is_combined_ccch = cch->data[2] >> 7;
-
- if (cch->data[4] != RSL_IE_ACCESS_DELAY) {
- LOGP(DRSL, LOGL_ERROR, "Missing ACCESS_DELAY IE\n");
- return -EINVAL;
- }
- /* TA = 0 - delay */
- pp.u.rach_req.ta = 0 - cch->data[5];
-
- if (cch->data[6] != RSL_IE_MS_POWER) {
- LOGP(DRSL, LOGL_ERROR, "Missing MS POWER IE\n");
- return -EINVAL;
- }
- pp.u.rach_req.tx_power = cch->data[7];
-
- msgb_free(msg);
-
- return lc->lapdm_dcch.l1_prim_cb(&pp.oph, l1ctx);
-}
-
-/* L1 confirms channel request */
-static int l2_ph_chan_conf(struct msgb *msg, struct lapdm_entity *le, uint32_t frame_nr)
-{
- struct abis_rsl_cchan_hdr *ch;
- struct gsm_time tm;
- struct gsm48_req_ref *ref;
-
- gsm_fn2gsmtime(&tm, frame_nr);
-
- msgb_pull_l2h(msg);
- msg->l2h = msgb_push(msg, sizeof(*ch) + sizeof(*ref));
- ch = (struct abis_rsl_cchan_hdr *)msg->l2h;
- rsl_init_cchan_hdr(ch, RSL_MT_CHAN_CONF);
- ch->chan_nr = RSL_CHAN_RACH;
- ch->data[0] = RSL_IE_REQ_REFERENCE;
- ref = (struct gsm48_req_ref *) (ch->data + 1);
- ref->t1 = tm.t1;
- ref->t2 = tm.t2;
- ref->t3_low = tm.t3 & 0x7;
- ref->t3_high = tm.t3 >> 3;
-
- return rslms_sendmsg(msg, le);
-}
-
-const char *lapdm_state_names[] = {
- "LAPDm_STATE_NULL",
- "LAPDm_STATE_IDLE",
- "LAPDm_STATE_SABM_SENT",
- "LAPDm_STATE_MF_EST",
- "LAPDm_STATE_TIMER_RECOV",
- "LAPDm_STATE_DISC_SENT",
-};
-
-/* statefull handling for RSLms RLL messages from L3 */
-static struct l2downstate {
- uint32_t states;
- int type;
- int (*rout) (struct msgb *msg, struct lapdm_datalink *dl);
-} l2downstatelist[] = {
- /* create and send UI command */
- {ALL_STATES,
- RSL_MT_UNIT_DATA_REQ, rslms_rx_rll_udata_req},
-
- /* create and send SABM command */
- {SBIT(LAPDm_STATE_IDLE),
- RSL_MT_EST_REQ, rslms_rx_rll_est_req},
-
- /* create and send I command */
- {SBIT(LAPDm_STATE_MF_EST) |
- SBIT(LAPDm_STATE_TIMER_RECOV),
- RSL_MT_DATA_REQ, rslms_rx_rll_data_req},
-
- /* suspend datalink */
- {SBIT(LAPDm_STATE_MF_EST) |
- SBIT(LAPDm_STATE_TIMER_RECOV),
- RSL_MT_SUSP_REQ, rslms_rx_rll_susp_req},
-
- /* create and send SABM command (resume) */
- {SBIT(LAPDm_STATE_MF_EST) |
- SBIT(LAPDm_STATE_TIMER_RECOV),
- RSL_MT_RES_REQ, rslms_rx_rll_res_req},
-
- /* create and send SABM command (reconnect) */
- {SBIT(LAPDm_STATE_IDLE) |
- SBIT(LAPDm_STATE_MF_EST) |
- SBIT(LAPDm_STATE_TIMER_RECOV),
- RSL_MT_RECON_REQ, rslms_rx_rll_res_req},
-
- /* create and send DISC command */
- {SBIT(LAPDm_STATE_SABM_SENT) |
- SBIT(LAPDm_STATE_MF_EST) |
- SBIT(LAPDm_STATE_TIMER_RECOV) |
- SBIT(LAPDm_STATE_DISC_SENT),
- RSL_MT_REL_REQ, rslms_rx_rll_rel_req},
-
- /* release in idle state */
- {SBIT(LAPDm_STATE_IDLE),
- RSL_MT_REL_REQ, rslms_rx_rll_rel_req_idle},
-};
-
-#define L2DOWNSLLEN \
- (sizeof(l2downstatelist) / sizeof(struct l2downstate))
-
-/* incoming RSLms RLL message from L3 */
-static int rslms_rx_rll(struct msgb *msg, struct lapdm_channel *lc)
-{
- struct abis_rsl_rll_hdr *rllh = msgb_l2(msg);
- int msg_type = rllh->c.msg_type;
- uint8_t sapi = rllh->link_id & 7;
- struct lapdm_entity *le;
- struct lapdm_datalink *dl;
- int i, supported = 0;
- int rc = 0;
-
- if (msgb_l2len(msg) < sizeof(*rllh)) {
- LOGP(DRSL, LOGL_ERROR, "Message too short for RLL hdr!\n");
- return -EINVAL;
- }
-
- if (rllh->link_id & 0x40)
- le = &lc->lapdm_acch;
- else
- le = &lc->lapdm_dcch;
-
- /* G.2.1 No action schall be taken on frames containing an unallocated
- * SAPI.
- */
- dl = datalink_for_sapi(le, sapi);
- if (!dl) {
- LOGP(DRSL, LOGL_ERROR, "No instance for SAPI %d!\n", sapi);
- return -EINVAL;
- }
-
- LOGP(DRSL, LOGL_INFO, "(%p) RLL Message '%s' received in state %s\n",
- lc->name, rsl_msg_name(msg_type), lapdm_state_names[dl->state]);
-
- /* find function for current state and message */
- for (i = 0; i < L2DOWNSLLEN; i++) {
- if (msg_type == l2downstatelist[i].type)
- supported = 1;
- if ((msg_type == l2downstatelist[i].type)
- && ((1 << dl->state) & l2downstatelist[i].states))
- break;
- }
- if (!supported) {
- LOGP(DRSL, LOGL_NOTICE, "Message unsupported.\n");
- msgb_free(msg);
- return 0;
- }
- if (i == L2DOWNSLLEN) {
- LOGP(DRSL, LOGL_NOTICE, "Message unhandled at this state.\n");
- msgb_free(msg);
- return 0;
- }
-
- rc = l2downstatelist[i].rout(msg, dl);
-
- return rc;
-}
-
-/* incoming RSLms COMMON CHANNEL message from L3 */
-static int rslms_rx_com_chan(struct msgb *msg, struct lapdm_channel *lc)
-{
- struct abis_rsl_cchan_hdr *cch = msgb_l2(msg);
- int msg_type = cch->c.msg_type;
- int rc = 0;
-
- if (msgb_l2len(msg) < sizeof(*cch)) {
- LOGP(DRSL, LOGL_ERROR, "Message too short for COM CHAN hdr!\n");
- return -EINVAL;
- }
-
- switch (msg_type) {
- case RSL_MT_CHAN_RQD:
- /* create and send RACH request */
- rc = rslms_rx_chan_rqd(lc, msg);
- break;
- default:
- LOGP(DRSL, LOGL_NOTICE, "Unknown COMMON CHANNEL msg %d!\n",
- msg_type);
- msgb_free(msg);
- return 0;
- }
-
- return rc;
-}
-
-/* input into layer2 (from layer 3) */
-int lapdm_rslms_recvmsg(struct msgb *msg, struct lapdm_channel *lc)
-{
- struct abis_rsl_common_hdr *rslh = msgb_l2(msg);
- int rc = 0;
-
- if (msgb_l2len(msg) < sizeof(*rslh)) {
- LOGP(DRSL, LOGL_ERROR, "Message too short RSL hdr!\n");
- return -EINVAL;
- }
-
- switch (rslh->msg_discr & 0xfe) {
- case ABIS_RSL_MDISC_RLL:
- rc = rslms_rx_rll(msg, lc);
- break;
- case ABIS_RSL_MDISC_COM_CHAN:
- rc = rslms_rx_com_chan(msg, lc);
- break;
- default:
- LOGP(DRSL, LOGL_ERROR, "unknown RSLms message "
- "discriminator 0x%02x", rslh->msg_discr);
- msgb_free(msg);
- return -EINVAL;
- }
-
- return rc;
-}
-
-int lapdm_entity_set_mode(struct lapdm_entity *le, enum lapdm_mode mode)
-{
- switch (mode) {
- case LAPDM_MODE_MS:
- le->cr.loc2rem.cmd = CR_MS2BS_CMD;
- le->cr.loc2rem.resp = CR_MS2BS_RESP;
- le->cr.rem2loc.cmd = CR_BS2MS_CMD;
- le->cr.rem2loc.resp = CR_BS2MS_RESP;
- break;
- case LAPDM_MODE_BTS:
- le->cr.loc2rem.cmd = CR_BS2MS_CMD;
- le->cr.loc2rem.resp = CR_BS2MS_RESP;
- le->cr.rem2loc.cmd = CR_MS2BS_CMD;
- le->cr.rem2loc.resp = CR_MS2BS_RESP;
- break;
- default:
- return -EINVAL;
- }
-
- le->mode = mode;
-
- return 0;
-}
-
-int lapdm_channel_set_mode(struct lapdm_channel *lc, enum lapdm_mode mode)
-{
- int rc;
-
- rc = lapdm_entity_set_mode(&lc->lapdm_dcch, mode);
- if (rc < 0)
- return rc;
-
- return lapdm_entity_set_mode(&lc->lapdm_acch, mode);
-}
-
-void lapdm_channel_set_l1(struct lapdm_channel *lc, osmo_prim_cb cb, void *ctx)
-{
- lc->lapdm_dcch.l1_prim_cb = cb;
- lc->lapdm_acch.l1_prim_cb = cb;
- lc->lapdm_dcch.l1_ctx = ctx;
- lc->lapdm_acch.l1_ctx = ctx;
-}
-
-void lapdm_channel_set_l3(struct lapdm_channel *lc, lapdm_cb_t cb, void *ctx)
-{
- lc->lapdm_dcch.l3_cb = cb;
- lc->lapdm_acch.l3_cb = cb;
- lc->lapdm_dcch.l3_ctx = ctx;
- lc->lapdm_acch.l3_ctx = ctx;
-}
-
-void lapdm_entity_reset(struct lapdm_entity *le)
-{
- struct lapdm_datalink *dl;
- int i;
-
- for (i = 0; i < ARRAY_SIZE(le->datalink); i++) {
- dl = &le->datalink[i];
- if (dl->state == LAPDm_STATE_IDLE)
- continue;
- LOGP(DLAPDM, LOGL_INFO, "Resetting LAPDm instance\n");
- /* reset Timer T200 */
- osmo_timer_del(&dl->t200);
- /* enter idle state */
- dl->state = LAPDm_STATE_IDLE;
- /* flush buffer */
- lapdm_dl_flush_tx(dl);
- lapdm_dl_flush_send(dl);
- }
-}
-
-void lapdm_channel_reset(struct lapdm_channel *lc)
-{
- lapdm_entity_reset(&lc->lapdm_dcch);
- lapdm_entity_reset(&lc->lapdm_acch);
-}
-
-void lapdm_entity_set_flags(struct lapdm_entity *le, unsigned int flags)
-{
- le->flags = flags;
-}
-
-void lapdm_channel_set_flags(struct lapdm_channel *lc, unsigned int flags)
-{
- lapdm_entity_set_flags(&lc->lapdm_dcch, flags);
- lapdm_entity_set_flags(&lc->lapdm_acch, flags);
-}
diff --git a/Src/osmolib/src/target/firmware/apps/l1test/main.c b/Src/osmolib/src/target/firmware/apps/l1test/main.c
deleted file mode 100644
index d1ca3d6..0000000
--- a/Src/osmolib/src/target/firmware/apps/l1test/main.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/* main program of Free Software for Calypso Phone */
-
-/* (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 <stdio.h>
-
-#include <debug.h>
-#include <memory.h>
-#include <delay.h>
-#include <rffe.h>
-#include <keypad.h>
-#include <board.h>
-
-#include <abb/twl3025.h>
-#include <display.h>
-#include <rf/trf6151.h>
-
-#include <comm/sercomm.h>
-#include <comm/timer.h>
-
-#include <calypso/clock.h>
-#include <calypso/tpu.h>
-#include <calypso/tsp.h>
-#include <calypso/irq.h>
-#include <calypso/misc.h>
-
-#include <layer1/sync.h>
-#include <layer1/tpu_window.h>
-
-#define SCAN
-
-#ifdef SCAN
-/* if scanning is enabled, scan from 0 ... 124 */
-#define BASE_ARFCN 0
-#else
-/* fixed ARFCN in GSM1800 at which Harald has his GSM test license */
-#define BASE_ARFCN 871
-#endif
-
-/* Main Program */
-const char *hr = "======================================================================\n";
-
-/* Best ARFCN MAP ************************************************************/
-
-struct arfcn_map {
- uint16_t arfcn;
- int16_t dbm8;
-};
-
-static struct arfcn_map best_arfcn_map[10];
-static void best_arfcn_update(uint16_t arfcn, int16_t dbm8)
-{
- unsigned int i;
- for (i = 0; i < ARRAY_SIZE(best_arfcn_map); i++) {
- if (best_arfcn_map[i].dbm8 < dbm8 ||
- best_arfcn_map[i].dbm8 == 0) {
- best_arfcn_map[i].dbm8 = dbm8;
- best_arfcn_map[i].arfcn = arfcn;
- return;
- }
- }
-}
-
-static void best_arfcn_dump(void)
-{
- unsigned int i;
-
- for (i = 0; i < ARRAY_SIZE(best_arfcn_map); i++) {
- if (best_arfcn_map[i].dbm8 == 0)
- continue;
- printf("ARFCN %3d: %d dBm\n",
- best_arfcn_map[i].arfcn,
- best_arfcn_map[i].dbm8/8);
- }
-}
-
-
-/* MAIN program **************************************************************/
-
-enum l1test_state {
- STATE_NONE,
- STATE_PM,
- STATE_FB,
-};
-
-static void l1test_state_change(enum l1test_state new_state)
-{
- switch (new_state) {
- case STATE_PM:
- puts("Performing power measurement over GSM900\n");
- l1s_pm_test(1, BASE_ARFCN);
- break;
- case STATE_FB:
- puts("Starting FCCH Recognition\n");
- l1s_fb_test(1, 0);
- break;
- case STATE_NONE:
- /* disable frame interrupts */
- tpu_frame_irq_en(0, 0);
- break;
- }
-}
-
-/* completion call-back for the L1 Sync Power Measurement */
-static void l1s_signal_cb(struct l1_signal *sig)
-{
- uint16_t i, next_arfcn;
-
- switch (sig->signum) {
- case L1_SIG_PM:
- best_arfcn_update(sig->arfcn, sig->pm.dbm8[0]);
- next_arfcn = sig->arfcn + 1;
-
- if (next_arfcn >= 124) {
- puts("ARFCN Top 10 Rx Level\n");
- best_arfcn_dump();
-
- trf6151_rx_window(0, best_arfcn_map[0].arfcn, 40, 0);
- tpu_end_scenario();
-
- /* PM phase completed, do FB det */
- l1test_state_change(STATE_FB);
-
- break;
- }
-
- /* restart Power Measurement */
- l1s_pm_test(1, next_arfcn);
- break;
- case L1_SIG_NB:
- puts("NB SNR ");
- for (i = 0; i < 4; i++) {
- uint16_t snr = sig->nb.meas[i].snr;
- printf("%d.%03u ", l1s_snr_int(snr), l1s_snr_fract(snr));
- }
- putchar('\n');
- printf("--> Frame %d %d 0x%04X ", sig->nb.fire, sig->nb.crc, sig->nb.num_biterr);
- for (i = 0; i < ARRAY_SIZE(sig->nb.frame); i++)
- printf("%02X ", sig->nb.frame[i]);
- putchar('\n');
- break;
- }
-}
-
-static void key_handler(enum key_codes code, enum key_states state);
-
-int main(void)
-{
- board_init();
-
- puts("\n\nHello World from " __FILE__ " program code\n");
-
- puts(hr);
- /* Dump device identification */
- dump_dev_id();
- puts(hr);
-
- keypad_set_handler(&key_handler);
-
- /* Dump clock config after PLL set */
- calypso_clk_dump();
- puts(hr);
-
- display_set_attr(DISP_ATTR_INVERT);
- display_puts("l1test.bin");
-
- layer1_init();
- l1s_set_handler(&l1s_signal_cb);
-
- //dsp_checksum_task();
-#ifdef SCAN
- l1test_state_change(STATE_PM);
-#else
- l1test_state_change(STATE_FB);
-#endif
- tpu_frame_irq_en(1, 1);
-
- while (1) {
- update_timers();
- }
-
- /* NOT REACHED */
-
- twl3025_power_off();
-}
-
-static int afcout = 0;
-
-static void tspact_toggle(uint8_t num)
-{
- printf("TSPACT%u toggle\n", num);
- tsp_act_toggle((1 << num));
- tpu_enq_sleep();
- tpu_enable(1);
- tpu_wait_idle();
-}
-
-static void key_handler(enum key_codes code, enum key_states state)
-{
- if (state != PRESSED)
- return;
-
- switch (code) {
- case KEY_4:
- tspact_toggle(6); /* TRENA (RFFE) */
- break;
- case KEY_5:
- tspact_toggle(8); /* GSM_TXEN (RFFE) */
- break;
- case KEY_6:
- tspact_toggle(1); /* PAENA (RFFE) */
- break;
- case KEY_7: /* decrement AFC OUT */
- afcout -= 100;
- if (afcout < -4096)
- afcout = -4096;
- twl3025_afc_set(afcout);
- printf("AFC OUT: %u\n", twl3025_afcout_get());
- break;
- case KEY_9: /* increase AFC OUT */
- afcout += 100;
- if (afcout > 4095)
- afcout = 4095;
- twl3025_afc_set(afcout);
- printf("AFC OUT: %u\n", twl3025_afcout_get());
- break;
- default:
- break;
- }
-}
diff --git a/Src/osmolib/src/target/firmware/display/display.c b/Src/osmolib/src/target/firmware/display/display.c
deleted file mode 100644
index 1c8f1fb..0000000
--- a/Src/osmolib/src/target/firmware/display/display.c
+++ /dev/null
@@ -1,20 +0,0 @@
-
-#include <stdint.h>
-
-#include <display.h>
-
-struct display_driver *display;
-
-int display_puts(const char *str)
-{
- char c;
-
- if (display->puts)
- display->puts(str);
- else {
- while ((c = *str++))
- display_putchar(c);
- }
-
- return 0;
-}
diff --git a/Src/osmolib/src/target/firmware/display/font_r8x8.c b/Src/osmolib/src/target/firmware/display/font_r8x8.c
deleted file mode 100644
index 6f8315d..0000000
--- a/Src/osmolib/src/target/firmware/display/font_r8x8.c
+++ /dev/null
@@ -1,261 +0,0 @@
-/* 8x8 font, vertical scanning */
-
-const unsigned char fontdata_r8x8[] ={
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x7e, 0x81, 0x95, 0xb1, 0xb1, 0x95, 0x81, 0x7e,
- 0x7e, 0xff, 0xeb, 0xcf, 0xcf, 0xeb, 0xff, 0x7e,
- 0x0e, 0x1f, 0x3f, 0x7e, 0x3f, 0x1f, 0x0e, 0x00,
- 0x00, 0x08, 0x1c, 0x3e, 0x7f, 0x3e, 0x1c, 0x08,
- 0x00, 0x38, 0x38, 0x9f, 0xff, 0x9f, 0x38, 0x38,
- 0x10, 0x38, 0xbc, 0xff, 0xbc, 0x38, 0x10, 0x00,
- 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00,
- 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff,
- 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00,
- 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff,
- 0x70, 0xf8, 0x88, 0x88, 0xfd, 0x7f, 0x07, 0x0f,
- 0x00, 0x4e, 0x5f, 0xf1, 0xf1, 0x5f, 0x4e, 0x00,
- 0xc0, 0xe0, 0xff, 0x7f, 0x05, 0x05, 0x07, 0x07,
- 0xc0, 0xff, 0x7f, 0x05, 0x05, 0x65, 0x7f, 0x3f,
- 0x5a, 0x5a, 0x3c, 0xe7, 0xe7, 0x3c, 0x5a, 0x5a,
- 0x7f, 0x3e, 0x3e, 0x1c, 0x1c, 0x08, 0x08, 0x00,
- 0x08, 0x08, 0x1c, 0x1c, 0x3e, 0x3e, 0x7f, 0x00,
- 0x00, 0x24, 0x66, 0xff, 0xff, 0x66, 0x24, 0x00,
- 0x00, 0x5f, 0x5f, 0x00, 0x00, 0x5f, 0x5f, 0x00,
- 0x06, 0x0f, 0x09, 0x7f, 0x7f, 0x01, 0x7f, 0x7f,
- 0x40, 0xda, 0xbf, 0xa5, 0xfd, 0x59, 0x03, 0x02,
- 0x00, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x00,
- 0x80, 0x94, 0xb6, 0xff, 0xff, 0xb6, 0x94, 0x80,
- 0x00, 0x04, 0x06, 0x7f, 0x7f, 0x06, 0x04, 0x00,
- 0x00, 0x10, 0x30, 0x7f, 0x7f, 0x30, 0x10, 0x00,
- 0x08, 0x08, 0x08, 0x2a, 0x3e, 0x1c, 0x08, 0x00,
- 0x08, 0x1c, 0x3e, 0x2a, 0x08, 0x08, 0x08, 0x00,
- 0x3c, 0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
- 0x08, 0x1c, 0x3e, 0x08, 0x08, 0x3e, 0x1c, 0x08,
- 0x30, 0x38, 0x3c, 0x3e, 0x3e, 0x3c, 0x38, 0x30,
- 0x06, 0x0e, 0x1e, 0x3e, 0x3e, 0x1e, 0x0e, 0x06,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x06, 0x5f, 0x5f, 0x06, 0x00, 0x00, 0x00,
- 0x00, 0x07, 0x07, 0x00, 0x07, 0x07, 0x00, 0x00,
- 0x14, 0x7f, 0x7f, 0x14, 0x7f, 0x7f, 0x14, 0x00,
- 0x00, 0x24, 0x2e, 0x6b, 0x6b, 0x3a, 0x12, 0x00,
- 0x00, 0x46, 0x66, 0x30, 0x18, 0x0c, 0x66, 0x62,
- 0x00, 0x30, 0x7a, 0x4f, 0x5d, 0x37, 0x7a, 0x48,
- 0x00, 0x04, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x1c, 0x3e, 0x63, 0x41, 0x00, 0x00,
- 0x00, 0x00, 0x41, 0x63, 0x3e, 0x1c, 0x00, 0x00,
- 0x08, 0x2a, 0x3e, 0x1c, 0x1c, 0x3e, 0x2a, 0x08,
- 0x08, 0x08, 0x3e, 0x3e, 0x08, 0x08, 0x00, 0x00,
- 0x00, 0x00, 0x80, 0xe0, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x03, 0x01,
- 0x00, 0x3e, 0x7f, 0x71, 0x59, 0x4d, 0x7f, 0x3e,
- 0x00, 0x44, 0x42, 0x7f, 0x7f, 0x40, 0x40, 0x00,
- 0x00, 0x62, 0x73, 0x59, 0x49, 0x6f, 0x66, 0x00,
- 0x00, 0x22, 0x63, 0x49, 0x49, 0x7f, 0x36, 0x00,
- 0x00, 0x18, 0x1c, 0x16, 0x53, 0x7f, 0x7f, 0x50,
- 0x00, 0x27, 0x67, 0x45, 0x45, 0x7d, 0x39, 0x00,
- 0x00, 0x3c, 0x7e, 0x4b, 0x49, 0x79, 0x30, 0x00,
- 0x00, 0x03, 0x03, 0x71, 0x79, 0x0f, 0x07, 0x00,
- 0x00, 0x36, 0x7f, 0x49, 0x49, 0x7f, 0x36, 0x00,
- 0x00, 0x06, 0x4f, 0x49, 0x69, 0x3f, 0x1e, 0x00,
- 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x80, 0xe6, 0x66, 0x00, 0x00, 0x00,
- 0x00, 0x08, 0x1c, 0x36, 0x63, 0x41, 0x00, 0x00,
- 0x00, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x00,
- 0x00, 0x00, 0x41, 0x63, 0x36, 0x1c, 0x08, 0x00,
- 0x00, 0x02, 0x03, 0x51, 0x59, 0x0f, 0x06, 0x00,
- 0x00, 0x3e, 0x7f, 0x41, 0x5d, 0x55, 0x57, 0x1e,
- 0x00, 0x7c, 0x7e, 0x13, 0x13, 0x7e, 0x7c, 0x00,
- 0x00, 0x41, 0x7f, 0x7f, 0x49, 0x49, 0x7f, 0x36,
- 0x00, 0x1c, 0x3e, 0x63, 0x41, 0x41, 0x63, 0x22,
- 0x00, 0x41, 0x7f, 0x7f, 0x41, 0x63, 0x3e, 0x1c,
- 0x00, 0x41, 0x7f, 0x7f, 0x49, 0x5d, 0x41, 0x63,
- 0x00, 0x41, 0x7f, 0x7f, 0x49, 0x1d, 0x01, 0x03,
- 0x00, 0x1c, 0x3e, 0x63, 0x41, 0x51, 0x73, 0x72,
- 0x00, 0x7f, 0x7f, 0x08, 0x08, 0x7f, 0x7f, 0x00,
- 0x00, 0x00, 0x41, 0x7f, 0x7f, 0x41, 0x00, 0x00,
- 0x00, 0x30, 0x70, 0x40, 0x41, 0x7f, 0x3f, 0x01,
- 0x00, 0x41, 0x7f, 0x7f, 0x08, 0x1c, 0x77, 0x63,
- 0x00, 0x41, 0x7f, 0x7f, 0x41, 0x40, 0x60, 0x70,
- 0x00, 0x7f, 0x7f, 0x0e, 0x1c, 0x0e, 0x7f, 0x7f,
- 0x00, 0x7f, 0x7f, 0x06, 0x0c, 0x18, 0x7f, 0x7f,
- 0x00, 0x3e, 0x7f, 0x41, 0x41, 0x41, 0x7f, 0x3e,
- 0x00, 0x41, 0x7f, 0x7f, 0x49, 0x09, 0x0f, 0x06,
- 0x00, 0x1e, 0x3f, 0x21, 0x71, 0x7f, 0x5e, 0x00,
- 0x00, 0x41, 0x7f, 0x7f, 0x09, 0x19, 0x7f, 0x66,
- 0x00, 0x22, 0x67, 0x4d, 0x59, 0x73, 0x22, 0x00,
- 0x00, 0x03, 0x41, 0x7f, 0x7f, 0x41, 0x03, 0x00,
- 0x00, 0x7f, 0x7f, 0x40, 0x40, 0x7f, 0x7f, 0x00,
- 0x00, 0x1f, 0x3f, 0x60, 0x60, 0x3f, 0x1f, 0x00,
- 0x00, 0x7f, 0x7f, 0x30, 0x18, 0x30, 0x7f, 0x7f,
- 0x00, 0x43, 0x67, 0x3c, 0x18, 0x3c, 0x67, 0x43,
- 0x00, 0x07, 0x4f, 0x78, 0x78, 0x4f, 0x07, 0x00,
- 0x00, 0x47, 0x63, 0x71, 0x59, 0x4d, 0x67, 0x73,
- 0x00, 0x00, 0x7f, 0x7f, 0x41, 0x41, 0x00, 0x00,
- 0x00, 0x01, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60,
- 0x00, 0x00, 0x41, 0x41, 0x7f, 0x7f, 0x00, 0x00,
- 0x00, 0x08, 0x0c, 0x06, 0x03, 0x06, 0x0c, 0x08,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
- 0x00, 0x00, 0x00, 0x03, 0x07, 0x04, 0x00, 0x00,
- 0x00, 0x20, 0x74, 0x54, 0x54, 0x3c, 0x78, 0x40,
- 0x00, 0x41, 0x7f, 0x3f, 0x48, 0x48, 0x78, 0x30,
- 0x00, 0x38, 0x7c, 0x44, 0x44, 0x6c, 0x28, 0x00,
- 0x00, 0x30, 0x78, 0x48, 0x49, 0x3f, 0x7f, 0x40,
- 0x00, 0x38, 0x7c, 0x54, 0x54, 0x5c, 0x18, 0x00,
- 0x00, 0x48, 0x7e, 0x7f, 0x49, 0x03, 0x02, 0x00,
- 0x00, 0x98, 0xbc, 0xa4, 0xa4, 0xf8, 0x7c, 0x04,
- 0x00, 0x41, 0x7f, 0x7f, 0x08, 0x04, 0x7c, 0x78,
- 0x00, 0x00, 0x44, 0x7d, 0x7d, 0x40, 0x00, 0x00,
- 0x00, 0x60, 0xe0, 0x80, 0x80, 0xfd, 0x7d, 0x00,
- 0x00, 0x41, 0x7f, 0x7f, 0x10, 0x38, 0x6c, 0x44,
- 0x00, 0x00, 0x41, 0x7f, 0x7f, 0x40, 0x00, 0x00,
- 0x00, 0x7c, 0x7c, 0x18, 0x38, 0x1c, 0x7c, 0x78,
- 0x00, 0x7c, 0x7c, 0x04, 0x04, 0x7c, 0x78, 0x00,
- 0x00, 0x38, 0x7c, 0x44, 0x44, 0x7c, 0x38, 0x00,
- 0x00, 0x84, 0xfc, 0xf8, 0xa4, 0x24, 0x3c, 0x18,
- 0x00, 0x18, 0x3c, 0x24, 0xa4, 0xf8, 0xfc, 0x84,
- 0x00, 0x44, 0x7c, 0x78, 0x4c, 0x04, 0x1c, 0x18,
- 0x00, 0x48, 0x5c, 0x54, 0x54, 0x74, 0x24, 0x00,
- 0x00, 0x00, 0x04, 0x3e, 0x7f, 0x44, 0x24, 0x00,
- 0x00, 0x3c, 0x7c, 0x40, 0x40, 0x3c, 0x7c, 0x40,
- 0x00, 0x1c, 0x3c, 0x60, 0x60, 0x3c, 0x1c, 0x00,
- 0x00, 0x3c, 0x7c, 0x70, 0x38, 0x70, 0x7c, 0x3c,
- 0x00, 0x44, 0x6c, 0x38, 0x10, 0x38, 0x6c, 0x44,
- 0x00, 0x9c, 0xbc, 0xa0, 0xa0, 0xfc, 0x7c, 0x00,
- 0x00, 0x4c, 0x64, 0x74, 0x5c, 0x4c, 0x64, 0x00,
- 0x00, 0x08, 0x08, 0x3e, 0x77, 0x41, 0x41, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x77, 0x77, 0x00, 0x00,
- 0x00, 0x41, 0x41, 0x77, 0x3e, 0x08, 0x08, 0x00,
- 0x00, 0x02, 0x03, 0x01, 0x03, 0x02, 0x03, 0x01,
- 0x00, 0x70, 0x78, 0x4c, 0x46, 0x4c, 0x78, 0x70,
- 0x00, 0x0e, 0x9f, 0x91, 0xb1, 0xfb, 0x4a, 0x00,
- 0x00, 0x3a, 0x7a, 0x40, 0x40, 0x7a, 0x7a, 0x40,
- 0x38, 0x7c, 0x54, 0x55, 0x5d, 0x19, 0x00, 0x00,
- 0x02, 0x23, 0x75, 0x55, 0x55, 0x7d, 0x7b, 0x42,
- 0x00, 0x21, 0x75, 0x54, 0x54, 0x7d, 0x79, 0x40,
- 0x00, 0x21, 0x75, 0x55, 0x54, 0x7c, 0x78, 0x40,
- 0x00, 0x20, 0x74, 0x57, 0x57, 0x7c, 0x78, 0x40,
- 0x00, 0x18, 0x3c, 0xa4, 0xa4, 0xe4, 0x40, 0x00,
- 0x02, 0x3b, 0x7d, 0x55, 0x55, 0x5d, 0x1b, 0x02,
- 0x39, 0x7d, 0x54, 0x54, 0x5d, 0x19, 0x00, 0x00,
- 0x00, 0x39, 0x7d, 0x55, 0x54, 0x5c, 0x18, 0x00,
- 0x00, 0x01, 0x45, 0x7c, 0x7c, 0x41, 0x01, 0x00,
- 0x00, 0x02, 0x03, 0x45, 0x7d, 0x7d, 0x43, 0x02,
- 0x00, 0x01, 0x45, 0x7d, 0x7c, 0x40, 0x00, 0x00,
- 0x00, 0x79, 0x7d, 0x16, 0x12, 0x16, 0x7d, 0x79,
- 0x00, 0x70, 0x78, 0x2b, 0x2b, 0x78, 0x70, 0x00,
- 0x44, 0x7c, 0x7c, 0x55, 0x55, 0x45, 0x00, 0x00,
- 0x20, 0x74, 0x54, 0x54, 0x7c, 0x7c, 0x54, 0x54,
- 0x00, 0x7c, 0x7e, 0x0b, 0x09, 0x7f, 0x7f, 0x49,
- 0x00, 0x32, 0x7b, 0x49, 0x49, 0x7b, 0x32, 0x00,
- 0x00, 0x32, 0x7a, 0x48, 0x48, 0x7a, 0x32, 0x00,
- 0x00, 0x32, 0x7a, 0x4a, 0x48, 0x78, 0x30, 0x00,
- 0x00, 0x3a, 0x7b, 0x41, 0x41, 0x7b, 0x7a, 0x40,
- 0x00, 0x3a, 0x7a, 0x42, 0x40, 0x78, 0x78, 0x40,
- 0x9a, 0xba, 0xa0, 0xa0, 0xfa, 0x7a, 0x00, 0x00,
- 0x01, 0x19, 0x3c, 0x66, 0x66, 0x3c, 0x19, 0x01,
- 0x00, 0x3d, 0x7d, 0x40, 0x40, 0x7d, 0x3d, 0x00,
- 0x00, 0x18, 0x3c, 0x24, 0xe7, 0xe7, 0x24, 0x24,
- 0x00, 0x68, 0x7e, 0x7f, 0x49, 0x43, 0x66, 0x20,
- 0x00, 0x2b, 0x2f, 0xfc, 0xfc, 0x2f, 0x2b, 0x00,
- 0xff, 0xff, 0x09, 0x09, 0x2f, 0xf6, 0xf8, 0xa0,
- 0x40, 0xc0, 0x88, 0xfe, 0x7f, 0x09, 0x03, 0x02,
- 0x00, 0x20, 0x74, 0x54, 0x55, 0x7d, 0x79, 0x40,
- 0x00, 0x00, 0x44, 0x7d, 0x7d, 0x41, 0x00, 0x00,
- 0x00, 0x30, 0x78, 0x48, 0x4a, 0x7a, 0x32, 0x00,
- 0x00, 0x38, 0x78, 0x40, 0x42, 0x7a, 0x7a, 0x40,
- 0x00, 0x7a, 0x7a, 0x0a, 0x0a, 0x7a, 0x70, 0x00,
- 0x00, 0x7d, 0x7d, 0x19, 0x31, 0x7d, 0x7d, 0x00,
- 0x00, 0x00, 0x26, 0x2f, 0x29, 0x2f, 0x2f, 0x28,
- 0x00, 0x00, 0x26, 0x2f, 0x29, 0x2f, 0x26, 0x00,
- 0x00, 0x30, 0x78, 0x4d, 0x45, 0x60, 0x20, 0x00,
- 0x00, 0x38, 0x38, 0x08, 0x08, 0x08, 0x08, 0x00,
- 0x08, 0x08, 0x08, 0x08, 0x38, 0x38, 0x00, 0x00,
- 0x4f, 0x6f, 0x30, 0x18, 0xcc, 0xee, 0xbb, 0x91,
- 0x4f, 0x6f, 0x30, 0x18, 0x6c, 0x76, 0xfb, 0xf9,
- 0x00, 0x00, 0x00, 0x7b, 0x7b, 0x00, 0x00, 0x00,
- 0x08, 0x1c, 0x36, 0x22, 0x08, 0x1c, 0x36, 0x22,
- 0x22, 0x36, 0x1c, 0x08, 0x22, 0x36, 0x1c, 0x08,
- 0xaa, 0x00, 0x55, 0x00, 0xaa, 0x00, 0x55, 0x00,
- 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55,
- 0xdd, 0xff, 0xaa, 0x77, 0xdd, 0xaa, 0xff, 0x77,
- 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00,
- 0x10, 0x10, 0x10, 0xff, 0xff, 0x00, 0x00, 0x00,
- 0x14, 0x14, 0x14, 0xff, 0xff, 0x00, 0x00, 0x00,
- 0x10, 0x10, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00,
- 0x10, 0x10, 0xf0, 0xf0, 0x10, 0xf0, 0xf0, 0x00,
- 0x14, 0x14, 0x14, 0xfc, 0xfc, 0x00, 0x00, 0x00,
- 0x14, 0x14, 0xf7, 0xf7, 0x00, 0xff, 0xff, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00,
- 0x14, 0x14, 0xf4, 0xf4, 0x04, 0xfc, 0xfc, 0x00,
- 0x14, 0x14, 0x17, 0x17, 0x10, 0x1f, 0x1f, 0x00,
- 0x10, 0x10, 0x1f, 0x1f, 0x10, 0x1f, 0x1f, 0x00,
- 0x14, 0x14, 0x14, 0x1f, 0x1f, 0x00, 0x00, 0x00,
- 0x10, 0x10, 0x10, 0xf0, 0xf0, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x10, 0x10, 0x10,
- 0x10, 0x10, 0x10, 0x1f, 0x1f, 0x10, 0x10, 0x10,
- 0x10, 0x10, 0x10, 0xf0, 0xf0, 0x10, 0x10, 0x10,
- 0x00, 0x00, 0x00, 0xff, 0xff, 0x10, 0x10, 0x10,
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
- 0x10, 0x10, 0x10, 0xff, 0xff, 0x10, 0x10, 0x10,
- 0x00, 0x00, 0x00, 0xff, 0xff, 0x14, 0x14, 0x14,
- 0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x10,
- 0x00, 0x00, 0x1f, 0x1f, 0x10, 0x17, 0x17, 0x14,
- 0x00, 0x00, 0xfc, 0xfc, 0x04, 0xf4, 0xf4, 0x14,
- 0x14, 0x14, 0x17, 0x17, 0x10, 0x17, 0x17, 0x14,
- 0x14, 0x14, 0xf4, 0xf4, 0x04, 0xf4, 0xf4, 0x14,
- 0x00, 0x00, 0xff, 0xff, 0x00, 0xf7, 0xf7, 0x14,
- 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,
- 0x14, 0x14, 0xf7, 0xf7, 0x00, 0xf7, 0xf7, 0x14,
- 0x14, 0x14, 0x14, 0x17, 0x17, 0x14, 0x14, 0x14,
- 0x10, 0x10, 0x1f, 0x1f, 0x10, 0x1f, 0x1f, 0x10,
- 0x14, 0x14, 0x14, 0xf4, 0xf4, 0x14, 0x14, 0x14,
- 0x10, 0x10, 0xf0, 0xf0, 0x10, 0xf0, 0xf0, 0x10,
- 0x00, 0x00, 0x1f, 0x1f, 0x10, 0x1f, 0x1f, 0x10,
- 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x14, 0x14, 0x14,
- 0x00, 0x00, 0x00, 0xfc, 0xfc, 0x14, 0x14, 0x14,
- 0x00, 0x00, 0xf0, 0xf0, 0x10, 0xf0, 0xf0, 0x10,
- 0x10, 0x10, 0xff, 0xff, 0x10, 0xff, 0xff, 0x10,
- 0x14, 0x14, 0x14, 0xff, 0xff, 0x14, 0x14, 0x14,
- 0x10, 0x10, 0x10, 0x1f, 0x1f, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xf0, 0xf0, 0x10, 0x10, 0x10,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
- 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
- 0x00, 0x38, 0x7c, 0x44, 0x6c, 0x38, 0x6c, 0x44,
- 0x00, 0xfc, 0xfe, 0x2a, 0x2a, 0x3e, 0x14, 0x00,
- 0x00, 0x7e, 0x7e, 0x02, 0x02, 0x06, 0x06, 0x00,
- 0x00, 0x02, 0x7e, 0x7e, 0x02, 0x7e, 0x7e, 0x02,
- 0x00, 0x63, 0x77, 0x5d, 0x49, 0x63, 0x63, 0x00,
- 0x00, 0x38, 0x7c, 0x44, 0x7c, 0x3c, 0x04, 0x04,
- 0x00, 0x80, 0xfe, 0x7e, 0x20, 0x20, 0x3e, 0x1e,
- 0x00, 0x04, 0x06, 0x02, 0x7e, 0x7c, 0x06, 0x02,
- 0x00, 0x99, 0xbd, 0xe7, 0xe7, 0xbd, 0x99, 0x00,
- 0x00, 0x1c, 0x3e, 0x6b, 0x49, 0x6b, 0x3e, 0x1c,
- 0x00, 0x4c, 0x7e, 0x73, 0x01, 0x73, 0x7e, 0x4c,
- 0x00, 0x30, 0x78, 0x4a, 0x4f, 0x7d, 0x39, 0x00,
- 0x18, 0x3c, 0x24, 0x3c, 0x3c, 0x24, 0x3c, 0x18,
- 0x98, 0xfc, 0x64, 0x3c, 0x3e, 0x27, 0x3d, 0x18,
- 0x00, 0x1c, 0x3e, 0x6b, 0x49, 0x49, 0x00, 0x00,
- 0x00, 0x7e, 0x7f, 0x01, 0x01, 0x7f, 0x7e, 0x00,
- 0x00, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x00,
- 0x00, 0x44, 0x44, 0x5f, 0x5f, 0x44, 0x44, 0x00,
- 0x00, 0x40, 0x51, 0x5b, 0x4e, 0x44, 0x40, 0x00,
- 0x00, 0x40, 0x44, 0x4e, 0x5b, 0x51, 0x40, 0x00,
- 0x00, 0x00, 0x00, 0xfe, 0xff, 0x01, 0x07, 0x06,
- 0x60, 0xe0, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00,
- 0x00, 0x08, 0x08, 0x6b, 0x6b, 0x08, 0x08, 0x00,
- 0x00, 0x24, 0x36, 0x12, 0x36, 0x24, 0x36, 0x12,
- 0x00, 0x00, 0x06, 0x0f, 0x09, 0x0f, 0x06, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x30, 0x70, 0xc0, 0xff, 0xff, 0x01, 0x01,
- 0x00, 0x1f, 0x1f, 0x01, 0x1f, 0x1e, 0x00, 0x00,
- 0x00, 0x19, 0x1d, 0x17, 0x12, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
diff --git a/Src/osmolib/src/target/firmware/display/font_r8x8_horiz.c b/Src/osmolib/src/target/firmware/display/font_r8x8_horiz.c
deleted file mode 100644
index 046d09b..0000000
--- a/Src/osmolib/src/target/firmware/display/font_r8x8_horiz.c
+++ /dev/null
@@ -1,261 +0,0 @@
-/* 8x8 font, right aligned, horizontal scanning */
-
-const unsigned char fontdata_r8x8_horiz[] ={
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x7e,0x81,0xa5,0x81,0xbd,0x99,0x81,0x7e,
- 0x7e,0xff,0xdb,0xff,0xc3,0xe7,0xff,0x7e,
- 0x6c,0xfe,0xfe,0xfe,0x7c,0x38,0x10,0x00,
- 0x08,0x1c,0x3e,0x7f,0x3e,0x1c,0x08,0x00,
- 0x1c,0x1c,0x1c,0x7f,0x7f,0x6b,0x08,0x1c,
- 0x10,0x10,0x38,0x7c,0xfe,0x7c,0x10,0x38,
- 0x00,0x00,0x18,0x3c,0x3c,0x18,0x00,0x00,
- 0xff,0xff,0xe7,0xc3,0xc3,0xe7,0xff,0xff,
- 0x00,0x3c,0x66,0x42,0x42,0x66,0x3c,0x00,
- 0xff,0xc3,0x99,0xbd,0xbd,0x99,0xc3,0xff,
- 0x0f,0x07,0x0f,0x7d,0xcc,0xcc,0xcc,0x78,
- 0x3c,0x66,0x66,0x66,0x3c,0x18,0x7e,0x18,
- 0x3f,0x33,0x3f,0x30,0x30,0x70,0xf0,0xe0,
- 0x7f,0x63,0x7f,0x63,0x63,0x67,0xe6,0xc0,
- 0x18,0xdb,0x3c,0xe7,0xe7,0x3c,0xdb,0x18,
- 0x80,0xe0,0xf8,0xfe,0xf8,0xe0,0x80,0x00,
- 0x02,0x0e,0x3e,0xfe,0x3e,0x0e,0x02,0x00,
- 0x18,0x3c,0x7e,0x18,0x18,0x7e,0x3c,0x18,
- 0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x00,
- 0x7f,0xdb,0xdb,0x7b,0x1b,0x1b,0x1b,0x00,
- 0x3e,0x63,0x38,0x6c,0x6c,0x38,0xcc,0x78,
- 0x00,0x00,0x00,0x00,0x7e,0x7e,0x7e,0x00,
- 0x18,0x3c,0x7e,0x18,0x7e,0x3c,0x18,0xff,
- 0x18,0x3c,0x7e,0x18,0x18,0x18,0x18,0x00,
- 0x18,0x18,0x18,0x18,0x7e,0x3c,0x18,0x00,
- 0x00,0x18,0x0c,0xfe,0x0c,0x18,0x00,0x00,
- 0x00,0x30,0x60,0xfe,0x60,0x30,0x00,0x00,
- 0x00,0x00,0xc0,0xc0,0xc0,0xfe,0x00,0x00,
- 0x00,0x24,0x66,0xff,0x66,0x24,0x00,0x00,
- 0x00,0x18,0x3c,0x7e,0xff,0xff,0x00,0x00,
- 0x00,0xff,0xff,0x7e,0x3c,0x18,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x30,0x78,0x78,0x30,0x30,0x00,0x30,0x00,
- 0x6c,0x6c,0x6c,0x00,0x00,0x00,0x00,0x00,
- 0x6c,0x6c,0xfe,0x6c,0xfe,0x6c,0x6c,0x00,
- 0x18,0x3e,0x60,0x3c,0x06,0x7c,0x18,0x00,
- 0x00,0x63,0x66,0x0c,0x18,0x33,0x63,0x00,
- 0x1c,0x36,0x1c,0x3b,0x6e,0x66,0x3b,0x00,
- 0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,
- 0x0c,0x18,0x30,0x30,0x30,0x18,0x0c,0x00,
- 0x30,0x18,0x0c,0x0c,0x0c,0x18,0x30,0x00,
- 0x00,0x66,0x3c,0xff,0x3c,0x66,0x00,0x00,
- 0x00,0x30,0x30,0xfc,0x30,0x30,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x30,
- 0x00,0x00,0x00,0x7e,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,
- 0x03,0x06,0x0c,0x18,0x30,0x60,0x40,0x00,
- 0x3e,0x63,0x67,0x6f,0x7b,0x73,0x3e,0x00,
- 0x18,0x38,0x58,0x18,0x18,0x18,0x7e,0x00,
- 0x3c,0x66,0x06,0x1c,0x30,0x66,0x7e,0x00,
- 0x3c,0x66,0x06,0x1c,0x06,0x66,0x3c,0x00,
- 0x0e,0x1e,0x36,0x66,0x7f,0x06,0x0f,0x00,
- 0x7e,0x60,0x7c,0x06,0x06,0x66,0x3c,0x00,
- 0x1c,0x30,0x60,0x7c,0x66,0x66,0x3c,0x00,
- 0x7e,0x66,0x06,0x0c,0x18,0x18,0x18,0x00,
- 0x3c,0x66,0x66,0x3c,0x66,0x66,0x3c,0x00,
- 0x3c,0x66,0x66,0x3e,0x06,0x0c,0x38,0x00,
- 0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x00,
- 0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x30,
- 0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x00,
- 0x00,0x00,0x7e,0x00,0x00,0x7e,0x00,0x00,
- 0x30,0x18,0x0c,0x06,0x0c,0x18,0x30,0x00,
- 0x3c,0x66,0x06,0x0c,0x18,0x00,0x18,0x00,
- 0x3e,0x63,0x6f,0x69,0x6f,0x60,0x3e,0x00,
- 0x18,0x3c,0x66,0x66,0x7e,0x66,0x66,0x00,
- 0x7e,0x33,0x33,0x3e,0x33,0x33,0x7e,0x00,
- 0x1e,0x33,0x60,0x60,0x60,0x33,0x1e,0x00,
- 0x7c,0x36,0x33,0x33,0x33,0x36,0x7c,0x00,
- 0x7f,0x31,0x34,0x3c,0x34,0x31,0x7f,0x00,
- 0x7f,0x31,0x34,0x3c,0x34,0x30,0x78,0x00,
- 0x1e,0x33,0x60,0x60,0x67,0x33,0x1f,0x00,
- 0x66,0x66,0x66,0x7e,0x66,0x66,0x66,0x00,
- 0x3c,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,
- 0x0f,0x06,0x06,0x06,0x66,0x66,0x3c,0x00,
- 0x73,0x33,0x36,0x3c,0x36,0x33,0x73,0x00,
- 0x78,0x30,0x30,0x30,0x31,0x33,0x7f,0x00,
- 0x63,0x77,0x7f,0x7f,0x6b,0x63,0x63,0x00,
- 0x63,0x73,0x7b,0x6f,0x67,0x63,0x63,0x00,
- 0x3e,0x63,0x63,0x63,0x63,0x63,0x3e,0x00,
- 0x7e,0x33,0x33,0x3e,0x30,0x30,0x78,0x00,
- 0x3c,0x66,0x66,0x66,0x6e,0x3c,0x0e,0x00,
- 0x7e,0x33,0x33,0x3e,0x36,0x33,0x73,0x00,
- 0x3c,0x66,0x30,0x18,0x0c,0x66,0x3c,0x00,
- 0x7e,0x5a,0x18,0x18,0x18,0x18,0x3c,0x00,
- 0x66,0x66,0x66,0x66,0x66,0x66,0x7e,0x00,
- 0x66,0x66,0x66,0x66,0x66,0x3c,0x18,0x00,
- 0x63,0x63,0x63,0x6b,0x7f,0x77,0x63,0x00,
- 0x63,0x63,0x36,0x1c,0x1c,0x36,0x63,0x00,
- 0x66,0x66,0x66,0x3c,0x18,0x18,0x3c,0x00,
- 0x7f,0x63,0x46,0x0c,0x19,0x33,0x7f,0x00,
- 0x3c,0x30,0x30,0x30,0x30,0x30,0x3c,0x00,
- 0x60,0x30,0x18,0x0c,0x06,0x03,0x01,0x00,
- 0x3c,0x0c,0x0c,0x0c,0x0c,0x0c,0x3c,0x00,
- 0x08,0x1c,0x36,0x63,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,
- 0x18,0x18,0x0c,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x3c,0x06,0x3e,0x66,0x3b,0x00,
- 0x70,0x30,0x30,0x3e,0x33,0x33,0x6e,0x00,
- 0x00,0x00,0x3c,0x66,0x60,0x66,0x3c,0x00,
- 0x0e,0x06,0x06,0x3e,0x66,0x66,0x3b,0x00,
- 0x00,0x00,0x3c,0x66,0x7e,0x60,0x3c,0x00,
- 0x1c,0x36,0x30,0x78,0x30,0x30,0x78,0x00,
- 0x00,0x00,0x3b,0x66,0x66,0x3e,0x06,0x7c,
- 0x70,0x30,0x36,0x3b,0x33,0x33,0x73,0x00,
- 0x18,0x00,0x38,0x18,0x18,0x18,0x3c,0x00,
- 0x06,0x00,0x06,0x06,0x06,0x66,0x66,0x3c,
- 0x70,0x30,0x33,0x36,0x3c,0x36,0x73,0x00,
- 0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,
- 0x00,0x00,0x66,0x7f,0x7f,0x6b,0x63,0x00,
- 0x00,0x00,0x7c,0x66,0x66,0x66,0x66,0x00,
- 0x00,0x00,0x3c,0x66,0x66,0x66,0x3c,0x00,
- 0x00,0x00,0x6e,0x33,0x33,0x3e,0x30,0x78,
- 0x00,0x00,0x3b,0x66,0x66,0x3e,0x06,0x0f,
- 0x00,0x00,0x6e,0x3b,0x33,0x30,0x78,0x00,
- 0x00,0x00,0x3e,0x60,0x3c,0x06,0x7c,0x00,
- 0x08,0x18,0x3e,0x18,0x18,0x1a,0x0c,0x00,
- 0x00,0x00,0x66,0x66,0x66,0x66,0x3b,0x00,
- 0x00,0x00,0x66,0x66,0x66,0x3c,0x18,0x00,
- 0x00,0x00,0x63,0x6b,0x7f,0x7f,0x36,0x00,
- 0x00,0x00,0x63,0x36,0x1c,0x36,0x63,0x00,
- 0x00,0x00,0x66,0x66,0x66,0x3e,0x06,0x7c,
- 0x00,0x00,0x7e,0x4c,0x18,0x32,0x7e,0x00,
- 0x0e,0x18,0x18,0x70,0x18,0x18,0x0e,0x00,
- 0x0c,0x0c,0x0c,0x00,0x0c,0x0c,0x0c,0x00,
- 0x70,0x18,0x18,0x0e,0x18,0x18,0x70,0x00,
- 0x3b,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x08,0x1c,0x36,0x63,0x63,0x7f,0x00,
- 0x3c,0x66,0x60,0x66,0x3c,0x0c,0x06,0x3c,
- 0x00,0x66,0x00,0x66,0x66,0x66,0x3f,0x00,
- 0x1c,0x00,0x78,0xcc,0xfc,0xc0,0x78,0x00,
- 0x7e,0xc3,0x3c,0x06,0x3e,0x66,0x3f,0x00,
- 0x66,0x00,0x3c,0x06,0x3e,0x66,0x3f,0x00,
- 0x70,0x00,0x3c,0x06,0x3e,0x66,0x3f,0x00,
- 0x18,0x18,0x3c,0x06,0x3e,0x66,0x3f,0x00,
- 0x00,0x00,0x3c,0x60,0x60,0x3c,0x06,0x1c,
- 0x7e,0xc3,0x3c,0x66,0x7e,0x60,0x3c,0x00,
- 0xcc,0x00,0x78,0xcc,0xfc,0xc0,0x78,0x00,
- 0x70,0x00,0x3c,0x66,0x7e,0x60,0x3c,0x00,
- 0x66,0x00,0x38,0x18,0x18,0x18,0x3c,0x00,
- 0x3e,0x63,0x1c,0x0c,0x0c,0x0c,0x1e,0x00,
- 0x70,0x00,0x38,0x18,0x18,0x18,0x3c,0x00,
- 0x63,0x1c,0x36,0x63,0x7f,0x63,0x63,0x00,
- 0x18,0x18,0x00,0x3c,0x66,0x7e,0x66,0x00,
- 0x1c,0x00,0xfc,0x60,0x78,0x60,0xfc,0x00,
- 0x00,0x00,0x7f,0x0c,0x7f,0xcc,0x7f,0x00,
- 0x1f,0x36,0x66,0x7f,0x66,0x66,0x67,0x00,
- 0x3c,0x66,0x00,0x3c,0x66,0x66,0x3c,0x00,
- 0x00,0x66,0x00,0x3c,0x66,0x66,0x3c,0x00,
- 0x00,0x70,0x00,0x3c,0x66,0x66,0x3c,0x00,
- 0x3c,0x66,0x00,0x66,0x66,0x66,0x3f,0x00,
- 0x00,0x70,0x00,0x66,0x66,0x66,0x3f,0x00,
- 0x00,0xcc,0x00,0xcc,0xcc,0x7c,0x0c,0xf8,
- 0xc3,0x18,0x3c,0x66,0x66,0x3c,0x18,0x00,
- 0x66,0x00,0x66,0x66,0x66,0x66,0x3c,0x00,
- 0x0c,0x0c,0x3f,0x60,0x60,0x3f,0x0c,0x0c,
- 0x1c,0x36,0x32,0x78,0x30,0x73,0x7e,0x00,
- 0x66,0x66,0x3c,0x7e,0x18,0x7e,0x18,0x18,
- 0xf8,0xcc,0xcc,0xfa,0xc6,0xcf,0xc6,0xc7,
- 0x0e,0x1b,0x18,0x3c,0x18,0x18,0xd8,0x70,
- 0x0e,0x00,0x3c,0x06,0x3e,0x66,0x3f,0x00,
- 0x1c,0x00,0x38,0x18,0x18,0x18,0x3c,0x00,
- 0x00,0x0e,0x00,0x3c,0x66,0x66,0x3c,0x00,
- 0x00,0x0e,0x00,0x66,0x66,0x66,0x3f,0x00,
- 0x00,0x7c,0x00,0x7c,0x66,0x66,0x66,0x00,
- 0x7e,0x00,0x66,0x76,0x7e,0x6e,0x66,0x00,
- 0x1e,0x36,0x36,0x1f,0x00,0x3f,0x00,0x00,
- 0x1c,0x36,0x36,0x1c,0x00,0x3e,0x00,0x00,
- 0x18,0x00,0x18,0x30,0x60,0x66,0x3c,0x00,
- 0x00,0x00,0x00,0x7e,0x60,0x60,0x00,0x00,
- 0x00,0x00,0x00,0xfc,0x0c,0x0c,0x00,0x00,
- 0xc3,0xc6,0xcc,0xde,0x33,0x66,0xcc,0x0f,
- 0xc3,0xc6,0xcc,0xdb,0x37,0x6f,0xcf,0x03,
- 0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x00,
- 0x00,0x33,0x66,0xcc,0x66,0x33,0x00,0x00,
- 0x00,0xcc,0x66,0x33,0x66,0xcc,0x00,0x00,
- 0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,
- 0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,
- 0xdb,0x77,0xdb,0xee,0xdb,0x77,0xdb,0xee,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0xf8,0x18,0x18,0x18,
- 0x18,0x18,0xf8,0x18,0xf8,0x18,0x18,0x18,
- 0x36,0x36,0x36,0x36,0xf6,0x36,0x36,0x36,
- 0x00,0x00,0x00,0x00,0xfe,0x36,0x36,0x36,
- 0x00,0x00,0xf8,0x18,0xf8,0x18,0x18,0x18,
- 0x36,0x36,0xf6,0x06,0xf6,0x36,0x36,0x36,
- 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
- 0x00,0x00,0xfe,0x06,0xf6,0x36,0x36,0x36,
- 0x36,0x36,0xf6,0x06,0xfe,0x00,0x00,0x00,
- 0x36,0x36,0x36,0x36,0xfe,0x00,0x00,0x00,
- 0x18,0x18,0xf8,0x18,0xf8,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0xf8,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x1f,0x00,0x00,0x00,
- 0x18,0x18,0x18,0x18,0xff,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0xff,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x1f,0x18,0x18,0x18,
- 0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,
- 0x18,0x18,0x18,0x18,0xff,0x18,0x18,0x18,
- 0x18,0x18,0x1f,0x18,0x1f,0x18,0x18,0x18,
- 0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,
- 0x36,0x36,0x37,0x30,0x3f,0x00,0x00,0x00,
- 0x00,0x00,0x3f,0x30,0x37,0x36,0x36,0x36,
- 0x36,0x36,0xf7,0x00,0xff,0x00,0x00,0x00,
- 0x00,0x00,0xff,0x00,0xf7,0x36,0x36,0x36,
- 0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36,
- 0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,
- 0x36,0x36,0xf7,0x00,0xf7,0x36,0x36,0x36,
- 0x18,0x18,0xff,0x00,0xff,0x00,0x00,0x00,
- 0x36,0x36,0x36,0x36,0xff,0x00,0x00,0x00,
- 0x00,0x00,0xff,0x00,0xff,0x18,0x18,0x18,
- 0x00,0x00,0x00,0x00,0xff,0x36,0x36,0x36,
- 0x36,0x36,0x36,0x36,0x3f,0x00,0x00,0x00,
- 0x18,0x18,0x1f,0x18,0x1f,0x00,0x00,0x00,
- 0x00,0x00,0x1f,0x18,0x1f,0x18,0x18,0x18,
- 0x00,0x00,0x00,0x00,0x3f,0x36,0x36,0x36,
- 0x36,0x36,0x36,0x36,0xff,0x36,0x36,0x36,
- 0x18,0x18,0xff,0x18,0xff,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0xf8,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x1f,0x18,0x18,0x18,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,
- 0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,
- 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,
- 0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x3b,0x6e,0x64,0x6e,0x3b,0x00,
- 0x00,0x3c,0x66,0x7c,0x66,0x7c,0x60,0x60,
- 0x00,0x7e,0x66,0x60,0x60,0x60,0x60,0x00,
- 0x00,0x7f,0x36,0x36,0x36,0x36,0x36,0x00,
- 0x7e,0x66,0x30,0x18,0x30,0x66,0x7e,0x00,
- 0x00,0x00,0x3f,0x6c,0x6c,0x6c,0x38,0x00,
- 0x00,0x33,0x33,0x33,0x33,0x3e,0x30,0x60,
- 0x00,0x3b,0x6e,0x0c,0x0c,0x0c,0x0c,0x00,
- 0x7e,0x18,0x3c,0x66,0x66,0x3c,0x18,0x7e,
- 0x1c,0x36,0x63,0x7f,0x63,0x36,0x1c,0x00,
- 0x1c,0x36,0x63,0x63,0x36,0x36,0x77,0x00,
- 0x0e,0x18,0x0c,0x3e,0x66,0x66,0x3c,0x00,
- 0x00,0x00,0x7e,0xdb,0xdb,0x7e,0x00,0x00,
- 0x06,0x0c,0x7e,0xdb,0xdb,0x7e,0x60,0xc0,
- 0x1c,0x30,0x60,0x7c,0x60,0x30,0x1c,0x00,
- 0x3c,0x66,0x66,0x66,0x66,0x66,0x66,0x00,
- 0x00,0x7e,0x00,0x7e,0x00,0x7e,0x00,0x00,
- 0x18,0x18,0x7e,0x18,0x18,0x00,0x7e,0x00,
- 0x30,0x18,0x0c,0x18,0x30,0x00,0x7e,0x00,
- 0x0c,0x18,0x30,0x18,0x0c,0x00,0x7e,0x00,
- 0x0e,0x1b,0x1b,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0xd8,0xd8,0x70,
- 0x18,0x18,0x00,0x7e,0x00,0x18,0x18,0x00,
- 0x00,0x3b,0x6e,0x00,0x3b,0x6e,0x00,0x00,
- 0x1c,0x36,0x36,0x1c,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x0c,0x0c,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,
- 0x0f,0x0c,0x0c,0x0c,0xec,0x6c,0x3c,0x1c,
- 0x78,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x00,
- 0x70,0x18,0x30,0x60,0x78,0x00,0x00,0x00,
- 0x00,0x00,0x3c,0x3c,0x3c,0x3c,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-};
-
diff --git a/Src/osmolib/src/target/firmware/display/ssd1783.c b/Src/osmolib/src/target/firmware/display/ssd1783.c
deleted file mode 100644
index 5696b48..0000000
--- a/Src/osmolib/src/target/firmware/display/ssd1783.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/* Solomon SSD1783 LCD Driver (Epson S1D15G10D08B000 clone) */
-
-/* (C) 2010 by Steve Markgraf <steve@steve-m.de>
- * (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 <stdio.h>
-//#define DEBUG
-#include <debug.h>
-#include <delay.h>
-#include <uwire.h>
-#include <display.h>
-#include <display/ssd1783.h>
-#include <calypso/clock.h>
-
-#define LCD_COLUMNS 98
-#define LCD_ROWS 67
-#define LCD_TOP_FREE_ROWS 3
-#define LCD_LEFT_FREE_COLS 0
-#define PIXEL_BYTES 3
-#define SSD1783_UWIRE_BITLEN 9
-#define SSD1783_DEV_ID 0
-#define FONT_HEIGHT 8
-#define FONT_WIDTH 8
-
-static const uint8_t rgb8_palette[] ={
- 0x00, //P01 Intermediate red tone 000
- 0x03, //P02 Intermediate red tone 001
- 0x05, //P03 Intermediate red tone 010
- 0x07, //P04 Intermediate red tone 011
- 0x09, //P05 Intermediate red tone 100
- 0x0b, //P06 Intermediate red tone 101
- 0x0d, //P07 Intermediate red tone 110
- 0x0f, //P08 Intermediate red tone 111
- 0x00, //P09 Intermediate green tone 000
- 0x03, //P10 Intermediate green tone 001
- 0x05, //P11 Intermediate green tone 010
- 0x07, //P12 Intermediate green tone 011
- 0x09, //P13 Intermediate green tone 100
- 0x0b, //P14 Intermediate green tone 101
- 0x0d, //P15 Intermediate green tone 110
- 0x0f, //P16 Intermediate green tone 111
- 0x00, //P17 Intermediate blue tone 00
- 0x05, //P18 Intermediate blue tone 01
- 0x0a, //P19 Intermediate blue tone 10
- 0x0f, //P20 Intermediate blue tone 11
-};
-
-static void ssd1783_cmd_write(const uint8_t cmd)
-{
- uint16_t cmd_out = cmd;
- uwire_xfer(SSD1783_DEV_ID, SSD1783_UWIRE_BITLEN, &cmd_out, NULL);
-}
-
-static void ssd1783_data_write(const uint8_t data)
-{
- uint16_t data_out = ((0x01 << 8) + data);
- uwire_xfer(SSD1783_DEV_ID, SSD1783_UWIRE_BITLEN, &data_out, NULL);
-}
-
-static void ssd1783_clrscr(void)
-{
- uint16_t i;
-
- /* Select the whole display area for clearing */
- ssd1783_cmd_write(CMD_PASET); /* Page address set [2] */
- ssd1783_data_write(0x00); /* Start page: 0x00 */
- ssd1783_data_write(LCD_ROWS-1); /* End page */
- ssd1783_cmd_write(CMD_CASET); /* Column address set [2] */
- ssd1783_data_write(0x00); /* Start column: 0x00 */
- ssd1783_data_write((LCD_COLUMNS/2)-1); /* End column (2 pixels per column) */
- ssd1783_cmd_write(CMD_RAMWR); /* Write to memory */
-
- /* Fill the display with white */
- for(i=0; i < (LCD_ROWS * (LCD_COLUMNS/2) * PIXEL_BYTES); i++){
- ssd1783_data_write(0xff);
- }
- ssd1783_cmd_write(CMD_NOP); /* Terminate RAMWR with NOP */
-}
-
-static void ssd1783_init(void)
-{
- unsigned int i;
-
- calypso_reset_set(RESET_EXT, 0);
- uwire_init();
- delay_ms(3);
-
- /* Begin SSD1783 initialization sequence */
- ssd1783_cmd_write(CMD_OSCON); /* Internal OSC on */
- ssd1783_cmd_write(CMD_SLPOUT); /* Sleep out (Leave sleep mode) */
-
- ssd1783_cmd_write(CMD_COMSCN); /* Common scan direction [1] */
- ssd1783_data_write(0x01); /* Scan 1 -> 68, 132 <- 69 */
- ssd1783_cmd_write(CMD_DATCTL); /* Data Scan Direction [3] */
- ssd1783_data_write(0x00); /* Normal page address, normal rotation,
- * scan direction in column direction */
- ssd1783_data_write(0x00); /* RGB arrangement: RGB-RGB */
- ssd1783_data_write(0x02); /* Gray-scale setup: 16 gray-scale Type A, 8-bit mode */
-
- /* Initialize RGB8 palette for 8-Bit color mode */
- ssd1783_cmd_write(CMD_RGBSET8); /* 256-color position set [20] */
- for(i=0; i < sizeof(rgb8_palette); i++){
- ssd1783_data_write(rgb8_palette[i]);
- }
-
- ssd1783_cmd_write(CMD_DISCTL); /* Display control [3] */
- ssd1783_data_write(0xff); /* no clock division, F1, F2 switching period = field */
- ssd1783_data_write(0x10); /* Drive duty, P24 = 1 */
- ssd1783_data_write(0x01); /* FR inverse set, P30=1 */
- ssd1783_cmd_write(CMD_SCSTART); /* Scroll start set [1] */
- ssd1783_data_write(0x00); /* Start block address 0x00 */
-
- /* Turn on the power regulator which generates VLCD */
- ssd1783_cmd_write(CMD_PWRCTR); /* Power Control [1] */
- ssd1783_data_write(0x0b); /* Booster, follower and regulator circuit on */
-
- /* FIXME: put this in a separate function (ssd1783_set_contrast) */
- ssd1783_cmd_write(CMD_VOLCTR); /* Electronic Volume Control [2] */
- ssd1783_data_write(0x29); /* Set contrast */
- ssd1783_data_write(0x05); /* Set contrast */
-
- ssd1783_cmd_write(CMD_DISINV); /* Invert Display */
- ssd1783_cmd_write(CMD_TMPGRD); /* Temperature gradient set */
- ssd1783_data_write(0x00); /* default temperature gradient (-0.05% / °C) */
- ssd1783_cmd_write(CMD_BIASSET); /* Set biasing ratio [1] */
- ssd1783_data_write(0x03); /* 1/10 bias */
- ssd1783_cmd_write(CMD_FREQSET); /* Set frequency and n-line inversion [2] */
- ssd1783_data_write(0x08); /* frequency: 75Hz (POR) */
- ssd1783_data_write(0x06); /* n-line inversion: 6 lines */
- ssd1783_cmd_write(CMD_RESCMD); /* reserved command in datasheet? */
- ssd1783_cmd_write(CMD_PWMSEL); /* Select PWM/FRC, Full/8 color mode [3] */
- ssd1783_data_write(0x28); /* fixed */
- ssd1783_data_write(0x2c); /* 5 bits PWM + 1 bit FRC (POR) */
- ssd1783_data_write(0x05); /* Full color mode (0x45 would be 8 color powersaving) */
-
- ssd1783_cmd_write(CMD_DISON); /* Display ON */
- ssd1783_clrscr(); /* Clear the display */
-}
-
-extern const unsigned char fontdata_r8x8_horiz[];
-
-/*
- * Pixel format for 8-bit mode, 12-bit color, 2 Pixel per 3 byte
- * D7, D6, D5, D4, D3, D2, D1, D0: RRRRGGGG (8 bits) 1st write
- * D7, D6, D5, D4, D3, D2, D1, D0: BBBBRRRR (8 bits) 2nd write
- * D7, D6, D5, D4, D3, D2, D1, D0: GGGGBBBB (8 bits) 3rd write
-*/
-
-static void ssd1783_goto_xy(int xpos, int ypos)
-{
- ssd1783_cmd_write(CMD_PASET);
- ssd1783_data_write(xpos);
- ssd1783_data_write(xpos + (FONT_HEIGHT-1));
-
- ssd1783_cmd_write(CMD_CASET);
- ssd1783_data_write(ypos);
- ssd1783_data_write(ypos + ((FONT_WIDTH/2)-1));
-
- ssd1783_cmd_write(CMD_NOP);
-}
-
-static int ssd1783_putc_col(unsigned char c, int fColor, int bColor)
-{
- int i, j;
- uint8_t cols = FONT_WIDTH;
- uint8_t rows = FONT_HEIGHT;
- uint8_t row_slice;
- uint8_t rowmask;
- uint16_t pixel0; /* left pixel */
- uint16_t pixel1; /* right pixel */
-
- ssd1783_cmd_write(CMD_RAMWR);
-
- for (i = 0; i < rows; i++) {
- row_slice = fontdata_r8x8_horiz[(FONT_WIDTH * c)+i];
- printd("\nSSD1783 FontData=0x%02hx", row_slice);
- rowmask = 0x80;
- for (j = 0; j < cols; j += 2) {
- if (!(row_slice & rowmask))
- pixel0 = bColor;
- else
- pixel0 = fColor;
- rowmask = rowmask >> 1;
- if (!(row_slice & rowmask))
- pixel1 = bColor;
- else
- pixel1 = fColor;
- rowmask = rowmask >> 1;
- /* Write the RGB-RGB pixel data */
- ssd1783_data_write((pixel0 >> 4) & 0xff);
- ssd1783_data_write(((pixel0 & 0x00f) << 4) | ((pixel1 >> 8) & 0x00f));
- ssd1783_data_write(pixel1 & 0xff);
- }
- }
- ssd1783_cmd_write(CMD_NOP);
-
- return c;
-}
-
-static int ssd1783_puts_col(const char *str, int txtline, int fColor, int bColor)
-{
- int i;
- for (i = 0; *str != 0x00; i += (FONT_WIDTH/2)) {
- ssd1783_goto_xy(((txtline*FONT_HEIGHT)+LCD_TOP_FREE_ROWS),
- (i + LCD_LEFT_FREE_COLS));
- ssd1783_putc_col(*str++, fColor, bColor);
- }
-
- return 0;
-}
-
-/* interface to display driver core */
-
-static void ssd1783_set_attr(unsigned long attr)
-{
- /* FIXME */
-}
-
-static int ssd1783_putc(unsigned int c)
-{
- return ssd1783_putc_col(c, BLACK, WHITE);
-}
-
-static int ssd1783_puts(const char *str)
-{
- return ssd1783_puts_col(str, 0, BLACK, WHITE);
-}
-
-const struct display_driver ssd1783_display = {
- .name = "ssd1783",
- .init = &ssd1783_init,
- .set_attr = &ssd1783_set_attr,
- .unset_attr = &ssd1783_set_attr,
- .clrscr = &ssd1783_clrscr,
- .goto_xy = &ssd1783_goto_xy,
- .putc = &ssd1783_putc,
- .puts = &ssd1783_puts,
-};
diff --git a/Src/osmolib/src/target/firmware/display/ssd1963.c b/Src/osmolib/src/target/firmware/display/ssd1963.c
deleted file mode 100644
index 49d5275..0000000
--- a/Src/osmolib/src/target/firmware/display/ssd1963.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/* Solomon SSD1963 LCD Driver (probably not exactly the SSD1963)
- * as used in the Sony Ericsson J100i */
-
-/* (C) 2010-11 by Steve Markgraf <steve@steve-m.de>
- * (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 <stdio.h>
-#include <debug.h>
-#include <delay.h>
-#include <uwire.h>
-#include <display.h>
-#include <calypso/clock.h>
-
-#define LCD_COLUMNS 96
-#define LCD_ROWS 64
-#define LCD_TOP_FREE_ROWS 3
-#define LCD_LEFT_FREE_COLS 0
-#define PIXEL_BYTES 3
-#define SSD1963_UWIRE_BITLEN 9
-#define SSD1963_DEV_ID 0
-#define FONT_HEIGHT 8
-#define FONT_WIDTH 8
-
-#define BLACK 0x0000
-#define WHITE 0x0fff
-
-static void ssd1963_cmd_write(const uint8_t cmd)
-{
- uint16_t cmd_out = cmd;
- uwire_xfer(SSD1963_DEV_ID, SSD1963_UWIRE_BITLEN, &cmd_out, NULL);
-}
-
-static void ssd1963_data_write(const uint8_t data)
-{
- uint16_t data_out = ((0x01 << 8) + data);
- uwire_xfer(SSD1963_DEV_ID, SSD1963_UWIRE_BITLEN, &data_out, NULL);
-}
-
-static void ssd1963_clrscr(void)
-{
- uint16_t i;
-
- /* Select the whole display area for clearing */
- ssd1963_cmd_write(0x2b);
- ssd1963_data_write(0x00);
- ssd1963_data_write(LCD_ROWS-1);
-
- ssd1963_cmd_write(0x2a);
- ssd1963_data_write(0x00);
- ssd1963_data_write(LCD_COLUMNS-1);
-
- ssd1963_cmd_write(0x2c);
-
- /* Fill the display with white */
- for(i=0; i < (LCD_ROWS * (LCD_COLUMNS/2) * PIXEL_BYTES); i++){
- ssd1963_data_write(0xff);
- }
-}
-
-static void ssd1963_init(void)
-{
- unsigned int i;
-
- calypso_reset_set(RESET_EXT, 0);
- uwire_init();
- delay_ms(3);
-
- /* Begin SSD1963 initialization sequence */
- ssd1963_cmd_write(0xb6); /* Set vertical period */
- ssd1963_data_write(0x4b);
- ssd1963_data_write(0xf1);
- ssd1963_data_write(0x40);
- ssd1963_data_write(0x40);
- ssd1963_data_write(0x00);
- ssd1963_data_write(0x8c);
- ssd1963_data_write(0x00);
-
- ssd1963_cmd_write(0x3a); /* Set pixel format */
- ssd1963_data_write(0x03); /* 0x03: 12 bit, 0x05: 16 Bit / pixel */
- ssd1963_cmd_write(0x11);
-
- /* Contrast/Electronic Volume Control */
- ssd1963_cmd_write(0xba);
- ssd1963_data_write(0x5b);
- ssd1963_data_write(0x84);
-
- ssd1963_cmd_write(0x36);
- ssd1963_data_write(0x00);
-
- ssd1963_cmd_write(0x13); /* Enter normal mode */
- ssd1963_clrscr();
-
- ssd1963_cmd_write(0x29); /* Display ON */
-}
-
-extern const unsigned char fontdata_r8x8_horiz[];
-
-/*
- * Pixel format for 8-bit mode, 12-bit color, 2 Pixel per 3 byte
- * D7, D6, D5, D4, D3, D2, D1, D0: RRRRGGGG (8 bits) 1st write
- * D7, D6, D5, D4, D3, D2, D1, D0: BBBBRRRR (8 bits) 2nd write
- * D7, D6, D5, D4, D3, D2, D1, D0: GGGGBBBB (8 bits) 3rd write
-*/
-
-static void ssd1963_goto_xy(int xpos, int ypos)
-{
- ssd1963_cmd_write(0x2b);
- ssd1963_data_write(xpos);
- ssd1963_data_write(xpos + FONT_HEIGHT-1);
-
- ssd1963_cmd_write(0x2a);
- ssd1963_data_write(ypos);
- ssd1963_data_write(ypos + FONT_WIDTH-1);
-}
-
-static int ssd1963_putc_col(unsigned char c, int fColor, int bColor)
-{
- int i, j;
- uint8_t cols = FONT_WIDTH;
- uint8_t rows = FONT_HEIGHT;
- uint8_t row_slice;
- uint8_t rowmask;
- uint16_t pixel0; /* left pixel */
- uint16_t pixel1; /* right pixel */
-
- ssd1963_cmd_write(0x2c);
-
- for (i = 0; i < rows; i++) {
- row_slice = fontdata_r8x8_horiz[(FONT_WIDTH * c)+i];
- rowmask = 0x80;
- for (j = 0; j < cols; j += 2) {
- if (!(row_slice & rowmask))
- pixel0 = bColor;
- else
- pixel0 = fColor;
- rowmask = rowmask >> 1;
- if (!(row_slice & rowmask))
- pixel1 = bColor;
- else
- pixel1 = fColor;
- rowmask = rowmask >> 1;
- /* Write the RGB-RGB pixel data */
- ssd1963_data_write((pixel0 >> 4) & 0xff);
- ssd1963_data_write(((pixel0 & 0x00f) << 4) | ((pixel1 >> 8) & 0x00f));
- ssd1963_data_write(pixel1 & 0xff);
- }
- }
- ssd1963_cmd_write(0x00);
-
- return c;
-}
-
-static int ssd1963_puts_col(const char *str, int txtline, int fColor, int bColor)
-{
- int i;
- for (i = 0; *str != 0x00; i += FONT_WIDTH) {
- ssd1963_goto_xy(((txtline*FONT_HEIGHT)+LCD_TOP_FREE_ROWS),
- (i + LCD_LEFT_FREE_COLS));
- ssd1963_putc_col(*str++, fColor, bColor);
- }
-
- return 0;
-}
-
-/* interface to display driver core */
-
-static void ssd1963_set_attr(unsigned long attr)
-{
- /* FIXME */
-}
-
-static int ssd1963_putc(unsigned int c)
-{
- return ssd1963_putc_col(c, BLACK, WHITE);
-}
-
-static int ssd1963_puts(const char *str)
-{
- return ssd1963_puts_col(str, 0, BLACK, WHITE);
-}
-
-const struct display_driver ssd1963_display = {
- .name = "ssd1963",
- .init = &ssd1963_init,
- .set_attr = &ssd1963_set_attr,
- .unset_attr = &ssd1963_set_attr,
- .clrscr = &ssd1963_clrscr,
- .goto_xy = &ssd1963_goto_xy,
- .putc = &ssd1963_putc,
- .puts = &ssd1963_puts,
-};
diff --git a/Src/osmolib/src/target/firmware/display/st7558.c b/Src/osmolib/src/target/firmware/display/st7558.c
deleted file mode 100644
index b92c2de..0000000
--- a/Src/osmolib/src/target/firmware/display/st7558.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Sitronix ST7558 LCD Driver */
-
-/* (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 <stdio.h>
-
-#include <debug.h>
-#include <delay.h>
-#include <memory.h>
-#include <i2c.h>
-#include <display.h>
-#include <calypso/clock.h>
-
-#define MORE_CONTROL 0x80
-#define CONTROL_RS_RAM 0x40
-#define CONTROL_RS_CMD 0x00
-#define Y_ADDR(n) (0x40|((n)&0xf))
-#define X_ADDR(n) (0x80|((n)&0x3f))
-
-static const uint8_t setup[] = { CONTROL_RS_CMD, 0x2e, 0x21, 0x12, 0xc0, 0x0b,
- 0x20, 0x11, 0x00, 0x40, 0x80 };
-static const uint8_t home[] = { CONTROL_RS_CMD, Y_ADDR(0), X_ADDR(0) };
-
-/* video modes */
-static const uint8_t invert[] = { CONTROL_RS_CMD, 0x20, 0x0d };
-static const uint8_t normal[] = { CONTROL_RS_CMD, 0x20, 0x0c };
-static const uint8_t off[] = { CONTROL_RS_CMD, 0x20, 0x08 };
-
-#define ST7558_SLAVE_ADDR 0x3c
-static int st7558_write(const uint8_t *data, int len)
-{
- int rc = i2c_write(ST7558_SLAVE_ADDR, data[0], 1, data+1, len-1);
- return rc;
-}
-
-static const uint8_t zero16[] = { CONTROL_RS_RAM,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0 };
-static void st7558_clrscr(void)
-{
- int i;
-
- st7558_write(home, sizeof(home));
-
- for (i = 0; i < 102*9; i += 16)
- st7558_write(zero16, sizeof(zero16));
-
- st7558_write(home, sizeof(home));
-}
-
-static void st7558_init(void)
-{
- /* Release nRESET */
- calypso_reset_set(RESET_EXT, 0);
-
- i2c_init(0,0);
-
- st7558_write(setup, sizeof(setup));
- st7558_clrscr();
-}
-
-static void st7558_set_attr(unsigned long attr)
-{
- if (attr & DISP_ATTR_INVERT)
- st7558_write(invert, sizeof(invert));
-}
-
-static void st7558_unset_attr(unsigned long attr)
-{
- if (attr & DISP_ATTR_INVERT)
- st7558_write(normal, sizeof(normal));
-}
-
-/* FIXME: we need a mini-libc */
-static void *mcpy(uint8_t *dst, const uint8_t *src, int len)
-{
- while (len--)
- *dst++ = *src++;
-
- return dst;
-}
-
-extern const unsigned char fontdata_r8x8[];
-
-static void st7558_putc(unsigned char c)
-{
- uint8_t putc_buf[16];
- uint8_t bytes_per_char = 8;
-
- putc_buf[0] = CONTROL_RS_RAM;
- mcpy(putc_buf+1, fontdata_r8x8+(c*bytes_per_char), bytes_per_char);
- st7558_write(putc_buf, 1+bytes_per_char);
-}
-
-const struct display_driver st7558_display = {
- .name = "st7558",
- .init = &st7558_init,
- .clrscr = &st7558_clrscr,
- .set_attr = &st7558_set_attr,
- .unset_attr = &st7558_unset_attr,
- .putc = &st7558_putc,
-};
diff --git a/Src/osmolib/src/target/firmware/display/td014.c b/Src/osmolib/src/target/firmware/display/td014.c
deleted file mode 100644
index 11ef3ea..0000000
--- a/Src/osmolib/src/target/firmware/display/td014.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/* Toppoly TD014 LCD Driver, as used in the Motorola C139/C140 */
-
-/* (C) 2010 by Steve Markgraf <steve@steve-m.de>
- * (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 <stdio.h>
-
-#include <debug.h>
-#include <delay.h>
-#include <uwire.h>
-#include <display.h>
-#include <calypso/clock.h>
-
-#define LCD_COLUMNS 96
-#define LCD_ROWS 64
-#define LCD_TOP_FREE_ROWS 3
-#define LCD_LEFT_FREE_COLS 0
-#define PIXEL_BYTES 2
-#define TD014_UWIRE_BITLEN 9
-#define TD014_DEV_ID 0
-#define FONT_HEIGHT 8
-#define FONT_WIDTH 8
-
-#define BLACK 0x0000
-#define WHITE 0xffff
-
-static void td014_cmd_write(const uint8_t cmd)
-{
- uint16_t cmd_out = cmd;
- uwire_xfer(TD014_DEV_ID, TD014_UWIRE_BITLEN, &cmd_out, NULL);
-}
-
-static void td014_data_write(const uint8_t data)
-{
- uint16_t data_out = ((0x01 << 8) + data);
- uwire_xfer(TD014_DEV_ID, TD014_UWIRE_BITLEN, &data_out, NULL);
-}
-
-static void td014_clrscr(void)
-{
- uint16_t i;
-
- /* Select the whole display area for clearing */
- td014_cmd_write(0x10);
- td014_data_write(0x00);
- td014_cmd_write(0x11);
- td014_data_write(0x00);
- td014_cmd_write(0x12);
- td014_data_write(LCD_COLUMNS-1);
- td014_cmd_write(0x13);
- td014_data_write(LCD_ROWS-1);
- td014_cmd_write(0x14);
- td014_data_write(0x00);
- td014_cmd_write(0x15);
- td014_data_write(0x00);
-
- /* Fill the display with white */
- for(i=0; i < (LCD_ROWS * LCD_COLUMNS * PIXEL_BYTES); i++) {
- td014_data_write(0xff);
- }
-}
-
-static void td014_init(void)
-{
- calypso_reset_set(RESET_EXT, 0);
- uwire_init();
- delay_ms(3);
-
- td014_cmd_write(0x3f);
- td014_data_write(0x01);
- td014_cmd_write(0x20);
- td014_data_write(0x03);
- td014_cmd_write(0x31);
- td014_data_write(0x03);
-
- td014_clrscr();
-
-}
-
-extern const unsigned char fontdata_r8x8_horiz[];
-
-static void td014_goto_xy(int xpos, int ypos)
-{
- td014_cmd_write(0x10);
- td014_data_write(ypos);
- td014_cmd_write(0x11);
- td014_data_write(xpos);
- td014_cmd_write(0x12);
- td014_data_write(ypos + FONT_HEIGHT-1);
- td014_cmd_write(0x13);
- td014_data_write(xpos + FONT_WIDTH-1);
- td014_cmd_write(0x14);
- td014_data_write(ypos);
- td014_cmd_write(0x15);
- td014_data_write(xpos);
-
-}
-
- /* RGB 556 Byte 1 | Byte 2 *
- * Pixel format: RRRRRGGG|GGBBBBBB */
-
-static int td014_putc_col(unsigned char c, int fColor, int bColor)
-{
- int i, j;
- uint8_t cols = FONT_WIDTH;
- uint8_t rows = FONT_HEIGHT;
- uint8_t row_slice;
- uint8_t rowmask;
- uint16_t pixel;
-
- for (i = 0; i < rows; i++) {
- row_slice = fontdata_r8x8_horiz[(FONT_WIDTH * c)+i];
- rowmask = 0x80;
- for (j = 0; j < cols; j++) {
- if (!(row_slice & rowmask))
- pixel = bColor;
- else
- pixel = fColor;
- rowmask = rowmask >> 1;
- /* Write the pixel data */
- td014_data_write((pixel >> 8) & 0xff);
- td014_data_write(pixel & 0xff);
- }
- }
- return c;
-}
-
-static int td014_puts_col(const char *str, int txtline, int fColor, int bColor)
-{
- int i;
- for (i = 0; *str != 0x00; i += FONT_WIDTH) {
- td014_goto_xy(((txtline*FONT_HEIGHT)+LCD_TOP_FREE_ROWS),
- (i + LCD_LEFT_FREE_COLS));
- td014_putc_col(*str++, fColor, bColor);
- }
-
- return 0;
-}
-
-/* interface to display driver core */
-
-static void td014_set_attr(unsigned long attr)
-{
- /* FIXME */
-}
-
-static int td014_putc(unsigned int c)
-{
- return td014_putc_col(c, BLACK, WHITE);
-}
-
-static int td014_puts(const char *str)
-{
- return td014_puts_col(str, 0, BLACK, WHITE);
-}
-
-const struct display_driver td014_display = {
- .name = "td014",
- .init = &td014_init,
- .set_attr = &td014_set_attr,
- .unset_attr = &td014_set_attr,
- .clrscr = &td014_clrscr,
- .goto_xy = &td014_goto_xy,
- .putc = &td014_putc,
- .puts = &td014_puts,
-};
diff --git a/Src/osmolib/src/target/firmware/include/display.h b/Src/osmolib/src/target/firmware/include/display.h
deleted file mode 100644
index 3941b8c..0000000
--- a/Src/osmolib/src/target/firmware/include/display.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef _DISPLAY_DRIVER_H
-#define _DISPLAY_DRIVER_H
-
-enum display_attr {
- DISP_ATTR_INVERT = 0x0001,
-};
-
-struct display_driver {
- char *name;
- void (*init)(void);
- void (*set_attr)(unsigned long attr);
- void (*unset_attr)(unsigned long attr);
- void (*clrscr)(void);
- void (*goto_xy)(int xpos, int ypos);
- void (*set_color)(int fgcolor, int bgcolor);
- int (*putc)(unsigned char c);
- int (*puts)(const char *str);
-};
-
-extern struct display_driver *display;
-
-static inline void display_init(void)
-{
- display->init();
-}
-static inline void display_set_attr(unsigned long attr)
-{
- display->set_attr(attr);
-}
-static inline void display_unset_attr(unsigned long attr)
-{
- display->unset_attr(attr);
-}
-static inline void display_clrscr(void)
-{
- display->clrscr();
-}
-static inline int display_putchar(unsigned char c)
-{
- return display->putc(c);
-}
-int display_puts(const char *s);
-
-extern const struct display_driver st7558_display;
-extern const struct display_driver ssd1783_display;
-extern const struct display_driver ssd1963_display;
-extern const struct display_driver td014_display;
-
-#endif
diff --git a/Src/osmolib/src/target/firmware/include/display/ssd1783.h b/Src/osmolib/src/target/firmware/include/display/ssd1783.h
deleted file mode 100644
index c72eeba..0000000
--- a/Src/osmolib/src/target/firmware/include/display/ssd1783.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef _SSD1783_H
-#define _SSD1783_H
-
-/* Some basic colors */
-#define RED 0x0f00
-#define GREEN 0x00f0
-#define BLUE 0x000f
-#define YELLOW 0x0ff0
-#define MAGENTA 0x0f0f
-#define CYAN 0x00ff
-#define BLACK 0x0000
-#define WHITE 0x0fff
-
-/* Epson S1D15G10D08B000 commandset */
-#define CMD_DISON 0xaf // Display on
-#define CMD_DISOFF 0xae // Display off
-#define CMD_DISNOR 0xa6 // Normal display
-#define CMD_DISINV 0xa7 // Inverse display
-#define CMD_COMSCN 0xbb // Common scan direction
-#define CMD_DISCTL 0xca // Display control
-#define CMD_SLPIN 0x95 // Sleep in
-#define CMD_SLPOUT 0x94 // Sleep out
-#define CMD_PASET 0x75 // Page address set
-#define CMD_CASET 0x15 // Column address set
-#define CMD_DATCTL 0xbc // Data scan direction, etc.
-#define CMD_RGBSET8 0xce // 256-color position set
-#define CMD_RAMWR 0x5c // Writing to memory
-#define CMD_RAMRD 0x5d // Reading from memory
-#define CMD_PTLIN 0xa8 // Partial display in
-#define CMD_PTLOUT 0xa9 // Partial display out
-#define CMD_RMWIN 0xe0 // Read and modify write
-#define CMD_RMWOUT 0xee // End
-#define CMD_ASCSE 0xaa // Area scroll set
-#define CMD_SCSTART 0xab // Scroll start set
-#define CMD_OSCON 0xd1 // Internal oscillation on
-#define CMD_OSCOFF 0xd2 // Internal oscillation off
-#define CMD_PWRCTR 0x20 // Power control
-#define CMD_VOLCTR 0x81 // Electronic volume control
-#define CMD_VOLUP 0xd6 // Increment electronic control by 1
-#define CMD_VOLDOWN 0xd7 // Decrement electronic control by 1
-#define CMD_TMPGRD 0x82 // Temperature gradient set
-#define CMD_EPCTIN 0xcd // Control EEPROM
-#define CMD_EPCOUT 0xcc // Cancel EEPROM control
-#define CMD_EPMWR 0xfc // Write into EEPROM
-#define CMD_EPMRD 0xfd // Read from EEPROM
-#define CMD_EPSRRD1 0x7c // Read register 1
-#define CMD_EPSRRD2 0x7d // Read register 2
-#define CMD_NOP 0x25 // NOP instruction
-
-/* Extended SSD1783 commandset, partly (also has HW graphic functionalities) */
-#define CMD_BIASSET 0xfb // Set bias ratio
-#define CMD_FREQSET 0xf2 // Set frequency and n-line inversion
-#define CMD_RESCMD 0xa2 // reserved command
-#define CMD_PWMSEL 0xf7 // Select PWM/FRC, Full/8 color mode
-
-#endif