├── src ├── shared │ ├── libosmocore │ │ ├── doc │ │ │ └── .empty │ │ ├── debian │ │ │ ├── docs │ │ │ ├── compat │ │ │ ├── source │ │ │ │ └── format │ │ │ ├── libosmocore-dbg.dirs │ │ │ ├── libosmocore.install │ │ │ ├── patches │ │ │ │ ├── series │ │ │ │ └── debian-changes-0.1.17-1 │ │ │ ├── libosmocore-dbg.install │ │ │ ├── libosmocore-dev.install │ │ │ ├── libosmocore-dbg.debhelper.log │ │ │ ├── libosmocore.dirs │ │ │ ├── libosmocore-dev.dirs │ │ │ ├── changelog │ │ │ ├── rules │ │ │ └── control │ │ ├── m4 │ │ │ └── DUMMY │ │ ├── include │ │ │ ├── Makefile.am │ │ │ └── osmocom │ │ │ │ ├── codec │ │ │ │ ├── Makefile.am │ │ │ │ └── codec.h │ │ │ │ ├── crypt │ │ │ │ ├── Makefile.am │ │ │ │ └── gprs_cipher.h │ │ │ │ ├── Makefile.am │ │ │ │ ├── core │ │ │ │ ├── backtrace.h │ │ │ │ ├── process.h │ │ │ │ ├── plugin.h │ │ │ │ ├── panic.h │ │ │ │ ├── application.h │ │ │ │ ├── Makefile.am │ │ │ │ ├── crc16.h │ │ │ │ ├── socket.h │ │ │ │ ├── crcgen.h │ │ │ │ ├── signal.h │ │ │ │ ├── select.h │ │ │ │ ├── msgfile.h │ │ │ │ ├── serial.h │ │ │ │ ├── statistics.h │ │ │ │ └── utils.h │ │ │ │ ├── vty │ │ │ │ ├── Makefile.am │ │ │ │ ├── misc.h │ │ │ │ └── logging.h │ │ │ │ └── gsm │ │ │ │ ├── protocol │ │ │ │ ├── Makefile.am │ │ │ │ ├── gsm_04_12.h │ │ │ │ └── gsm_03_41.h │ │ │ │ ├── prim.h │ │ │ │ ├── Makefile.am │ │ │ │ ├── comp128.h │ │ │ │ ├── rxlev_stat.h │ │ │ │ ├── gsm0480.h │ │ │ │ ├── gsm0411_utils.h │ │ │ │ ├── sysinfo.h │ │ │ │ ├── gsm0502.h │ │ │ │ ├── abis_nm.h │ │ │ │ ├── gsm48.h │ │ │ │ ├── gsm0411_smr.h │ │ │ │ ├── mncc.h │ │ │ │ └── a5.h │ │ ├── tests │ │ │ ├── msgfile │ │ │ │ ├── msgconfig.cfg │ │ │ │ ├── Makefile.am │ │ │ │ └── msgfile_test.c │ │ │ ├── Makefile.am │ │ │ ├── bits │ │ │ │ ├── Makefile.am │ │ │ │ └── bitrev_test.c │ │ │ ├── timer │ │ │ │ └── Makefile.am │ │ │ ├── sms │ │ │ │ └── Makefile.am │ │ │ ├── ussd │ │ │ │ └── Makefile.am │ │ │ └── smscb │ │ │ │ ├── Makefile.am │ │ │ │ └── smscb_test.c │ │ ├── utils │ │ │ ├── Makefile.am │ │ │ └── gen_website_doc_tree.sh │ │ ├── libosmocore.pc.in │ │ ├── libosmogsm.pc.in │ │ ├── libosmovty.pc.in │ │ ├── libosmocodec.pc.in │ │ ├── src │ │ │ ├── codec │ │ │ │ └── Makefile.am │ │ │ ├── vty │ │ │ │ └── Makefile.am │ │ │ ├── gsm │ │ │ │ ├── Makefile.am │ │ │ │ └── gsm0502.c │ │ │ ├── Makefile.am │ │ │ └── plugin.c │ │ └── .gitignore │ ├── update-libosmocore.sh │ └── .gitignore ├── host │ ├── layer23 │ │ ├── include │ │ │ ├── osmocom │ │ │ │ ├── Makefile.am │ │ │ │ └── bb │ │ │ │ │ ├── Makefile.am │ │ │ │ │ ├── misc │ │ │ │ │ ├── Makefile.am │ │ │ │ │ ├── xcch.h │ │ │ │ │ ├── layer3.h │ │ │ │ │ ├── rslms.h │ │ │ │ │ └── cell_log.h │ │ │ │ │ ├── common │ │ │ │ │ ├── Makefile.am │ │ │ │ │ ├── l1l2_interface.h │ │ │ │ │ ├── logging.h │ │ │ │ │ ├── sap_interface.h │ │ │ │ │ ├── networks.h │ │ │ │ │ ├── l23_app.h │ │ │ │ │ └── gps.h │ │ │ │ │ └── mobile │ │ │ │ │ ├── Makefile.am │ │ │ │ │ ├── voice.h │ │ │ │ │ ├── gsm480_ss.h │ │ │ │ │ ├── gsm48_cc.h │ │ │ │ │ ├── app_mobile.h │ │ │ │ │ ├── vty.h │ │ │ │ │ ├── mncc_sock.h │ │ │ │ │ └── gsm411_sms.h │ │ │ ├── l1ctl_proto.h │ │ │ └── Makefile.am │ │ ├── src │ │ │ ├── Makefile.am │ │ │ ├── misc │ │ │ │ ├── sms_capture.sh │ │ │ │ ├── card │ │ │ │ │ ├── FS.pyc │ │ │ │ │ ├── ICC.pyc │ │ │ │ │ ├── SIM.pyc │ │ │ │ │ ├── utils.pyc │ │ │ │ │ ├── __init__.pyc │ │ │ │ │ └── __init__.py │ │ │ │ ├── smspdu │ │ │ │ │ ├── pdu.pyc │ │ │ │ │ ├── gsm0338.pyc │ │ │ │ │ ├── __init__.pyc │ │ │ │ │ └── __main__.py │ │ │ │ ├── prediction_methods │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── predictionMethod.py │ │ │ │ │ ├── offset.py │ │ │ │ │ └── sysinfo.py │ │ │ │ ├── captures │ │ │ │ │ ├── bigfish_samsung │ │ │ │ │ ├── bigfish_samsung2 │ │ │ │ │ ├── bigfish_siemens │ │ │ │ │ ├── bigfish_encription │ │ │ │ │ ├── bigfish_sonnyj100i │ │ │ │ │ ├── wireshark_filters │ │ │ │ │ └── imsi_detach │ │ │ │ ├── get_paging_responses │ │ │ │ ├── get_location_updates │ │ │ │ └── Makefile.am │ │ │ ├── common │ │ │ │ └── Makefile.am │ │ │ └── mobile │ │ │ │ └── Makefile.am │ │ ├── Makefile.am │ │ ├── .gitignore │ │ ├── configure.ac │ │ └── README │ ├── env │ │ ├── start_kraken │ │ ├── c110_start │ │ ├── c110_start_mobile │ │ ├── j100i_start │ │ └── screenrc │ ├── gsmmap │ │ ├── locate.h │ │ ├── geo.h │ │ ├── .gitignore │ │ ├── Makefile.am │ │ ├── configure.ac │ │ ├── geo.c │ │ └── log.h │ ├── calypso_pll │ │ └── pll.pl │ ├── osmocon │ │ ├── .gitignore │ │ ├── configure.ac │ │ ├── Makefile.am │ │ └── memdump_convert.pl │ ├── rita_pll │ │ └── rita_pll_notes.txt │ └── gsm48-andreas │ │ └── issues.txt ├── target_dsp │ ├── .gitignore │ └── calypso │ │ ├── dsp_dump.lds │ │ ├── dsp_patch.lds │ │ ├── Makefile │ │ └── bin2cfile.py ├── target │ ├── firmware │ │ ├── .gitignore │ │ ├── comm │ │ │ └── Makefile │ │ ├── include │ │ │ ├── arpa │ │ │ │ └── inet.h │ │ │ ├── calypso │ │ │ │ ├── dma.h │ │ │ │ ├── rtc.h │ │ │ │ ├── misc.h │ │ │ │ ├── backlight.h │ │ │ │ ├── timer.h │ │ │ │ ├── buzzer.h │ │ │ │ ├── tsp.h │ │ │ │ ├── du.h │ │ │ │ ├── irq.h │ │ │ │ └── dsp.h │ │ │ ├── arm.h │ │ │ ├── delay.h │ │ │ ├── board.h │ │ │ ├── layer1 │ │ │ │ ├── agc.h │ │ │ │ ├── rfch.h │ │ │ │ ├── toa.h │ │ │ │ ├── apc.h │ │ │ │ ├── l23_api.h │ │ │ │ ├── afc.h │ │ │ │ ├── tpu_window.h │ │ │ │ ├── sched_gsmtime.h │ │ │ │ ├── avg.h │ │ │ │ ├── prim.h │ │ │ │ ├── mframe_sched.h │ │ │ │ └── async.h │ │ │ ├── spi.h │ │ │ ├── uwire.h │ │ │ ├── i2c.h │ │ │ ├── comm │ │ │ │ ├── sercomm_cons.h │ │ │ │ └── sercomm.h │ │ │ ├── manifest.h │ │ │ ├── string.h │ │ │ ├── asm │ │ │ │ ├── linkage.h │ │ │ │ ├── div64.h │ │ │ │ └── swab.h │ │ │ ├── mtk │ │ │ │ ├── bpi.h │ │ │ │ ├── mt6235_sciphone_g2.h │ │ │ │ ├── bsi.h │ │ │ │ ├── tdma_timer.h │ │ │ │ └── emi.h │ │ │ ├── ctors.h │ │ │ ├── defines.h │ │ │ ├── console.h │ │ │ ├── debug.h │ │ │ ├── uart.h │ │ │ ├── rffe.h │ │ │ ├── memory.h │ │ │ ├── flash │ │ │ │ └── cfi_flash.h │ │ │ ├── stdint.h │ │ │ ├── display.h │ │ │ ├── stdio.h │ │ │ ├── keypad.h │ │ │ ├── ctype.h │ │ │ └── rf │ │ │ │ └── trf6151.h │ │ ├── calypso │ │ │ ├── Makefile │ │ │ ├── dsp_bootcode.c │ │ │ ├── arm.c │ │ │ ├── dsp_sniffcode.c │ │ │ ├── dsp_dumpcode.c │ │ │ ├── du.c │ │ │ ├── dma.c │ │ │ └── misc.c │ │ ├── board │ │ │ ├── manifest.c │ │ │ ├── compal │ │ │ │ ├── header.S │ │ │ │ ├── start.ram.S │ │ │ │ ├── LINKAGE.txt │ │ │ │ ├── exceptions_redirected.S │ │ │ │ ├── start.rom.S │ │ │ │ ├── exceptions_redirect.S │ │ │ │ ├── macros.S │ │ │ │ └── handlers.S │ │ │ ├── mediatek │ │ │ │ ├── start.ram.S │ │ │ │ └── macros.S │ │ │ ├── common │ │ │ │ ├── calypso_pwl.S │ │ │ │ └── calypso_uart.S │ │ │ └── compal_e88 │ │ │ │ ├── MEMORY_MAP.txt │ │ │ │ └── LINKAGE.txt │ │ ├── lib │ │ │ ├── Makefile │ │ │ ├── delay.c │ │ │ ├── printf.c │ │ │ ├── ctors.c │ │ │ ├── testsetbit.S │ │ │ ├── testchangebit.S │ │ │ ├── testclearbit.S │ │ │ ├── setbit.S │ │ │ ├── changebit.S │ │ │ ├── clearbit.S │ │ │ ├── bitops.h │ │ │ ├── string.c │ │ │ ├── ctype.c │ │ │ └── memcpy.S │ │ ├── display │ │ │ └── display.c │ │ ├── layer1 │ │ │ ├── Makefile │ │ │ ├── avg.c │ │ │ └── apc.c │ │ ├── apps │ │ │ ├── loader │ │ │ │ └── protocol.h │ │ │ └── chainload │ │ │ │ └── main.c │ │ └── Makefile.mtk │ └── ui-experiment │ │ ├── font.h │ │ ├── sdl.h │ │ ├── README │ │ ├── menu.h │ │ ├── screen.h │ │ ├── png2tiny.c │ │ ├── display.h │ │ └── ui.h └── README.building ├── doc └── calypso-gsm-notes.txt ├── include └── osmocore │ ├── utils.h │ └── rsl.h └── README.md /src/shared/libosmocore/doc/.empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/shared/libosmocore/debian/docs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/shared/libosmocore/debian/compat: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /src/shared/libosmocore/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (git) 2 | -------------------------------------------------------------------------------- /src/shared/libosmocore/m4/DUMMY: -------------------------------------------------------------------------------- 1 | Dummply placeholder. 2 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = bb 2 | -------------------------------------------------------------------------------- /src/target_dsp/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a 3 | *.coff 4 | *.bin 5 | -------------------------------------------------------------------------------- /src/host/layer23/src/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = common misc mobile 2 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = osmocom 2 | -------------------------------------------------------------------------------- /src/host/layer23/include/l1ctl_proto.h: -------------------------------------------------------------------------------- 1 | ../../../../include/l1ctl_proto.h -------------------------------------------------------------------------------- /src/shared/libosmocore/debian/libosmocore-dbg.dirs: -------------------------------------------------------------------------------- 1 | usr/lib/debug/lib 2 | -------------------------------------------------------------------------------- /src/shared/libosmocore/debian/libosmocore.install: -------------------------------------------------------------------------------- 1 | usr/lib/lib*.so.* 2 | -------------------------------------------------------------------------------- /src/shared/libosmocore/debian/patches/series: -------------------------------------------------------------------------------- 1 | debian-changes-0.1.17-1 2 | -------------------------------------------------------------------------------- /src/shared/libosmocore/debian/libosmocore-dbg.install: -------------------------------------------------------------------------------- 1 | usr/lib/debug/lib/* 2 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = common misc mobile 2 | -------------------------------------------------------------------------------- /src/host/layer23/include/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_HEADERS = l1ctl_proto.h 2 | SUBDIRS = osmocom 3 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/misc/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_HEADERS = layer3.h rslms.h 2 | -------------------------------------------------------------------------------- /doc/calypso-gsm-notes.txt: -------------------------------------------------------------------------------- 1 | GSM burst duration: 577uS 2 | RITA synthesizer retuning max: 170uS 3 | -------------------------------------------------------------------------------- /src/shared/libosmocore/tests/msgfile/msgconfig.cfg: -------------------------------------------------------------------------------- 1 | # This is a comment 2 | *:*::Hello Welt 3 | -------------------------------------------------------------------------------- /src/host/layer23/src/misc/sms_capture.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | tshark -Tfields -e gsm_sms.sms_text -i lo 3 | -------------------------------------------------------------------------------- /src/host/layer23/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6 2 | 3 | SUBDIRS = include src 4 | -------------------------------------------------------------------------------- /src/host/env/start_kraken: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd ~/kraken-win32/Kraken/ 3 | ./kraken ../../kraken/indexes/ 6666 4 | -------------------------------------------------------------------------------- /src/target/firmware/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.p 3 | *.a 4 | *.lst 5 | *.bin 6 | *.elf 7 | *.map 8 | *.size 9 | *~ 10 | -------------------------------------------------------------------------------- /src/target/ui-experiment/font.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/offlinehacker/osmocombb/HEAD/src/target/ui-experiment/font.h -------------------------------------------------------------------------------- /src/host/layer23/src/misc/card/FS.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/offlinehacker/osmocombb/HEAD/src/host/layer23/src/misc/card/FS.pyc -------------------------------------------------------------------------------- /src/host/layer23/src/misc/card/ICC.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/offlinehacker/osmocombb/HEAD/src/host/layer23/src/misc/card/ICC.pyc -------------------------------------------------------------------------------- /src/host/layer23/src/misc/card/SIM.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/offlinehacker/osmocombb/HEAD/src/host/layer23/src/misc/card/SIM.pyc -------------------------------------------------------------------------------- /src/target/firmware/comm/Makefile: -------------------------------------------------------------------------------- 1 | 2 | LIBRARIES+=comm 3 | comm_DIR=comm 4 | comm_SRCS=msgb.c sercomm.c sercomm_cons.c timer.c 5 | 6 | -------------------------------------------------------------------------------- /src/host/layer23/src/misc/card/utils.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/offlinehacker/osmocombb/HEAD/src/host/layer23/src/misc/card/utils.pyc -------------------------------------------------------------------------------- /src/host/layer23/src/misc/smspdu/pdu.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/offlinehacker/osmocombb/HEAD/src/host/layer23/src/misc/smspdu/pdu.pyc -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/codec/Makefile.am: -------------------------------------------------------------------------------- 1 | osmocodec_HEADERS = codec.h 2 | 3 | osmocodecdir = $(includedir)/osmocom/codec 4 | -------------------------------------------------------------------------------- /src/host/layer23/src/misc/card/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/offlinehacker/osmocombb/HEAD/src/host/layer23/src/misc/card/__init__.pyc -------------------------------------------------------------------------------- /src/host/layer23/src/misc/smspdu/gsm0338.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/offlinehacker/osmocombb/HEAD/src/host/layer23/src/misc/smspdu/gsm0338.pyc -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/crypt/Makefile.am: -------------------------------------------------------------------------------- 1 | osmocrypt_HEADERS = gprs_cipher.h 2 | 3 | osmocryptdir = $(includedir)/osmocom/crypt 4 | -------------------------------------------------------------------------------- /src/target/firmware/include/arpa/inet.h: -------------------------------------------------------------------------------- 1 | /* we have this to make sure libosmocore uses our version of ntohl/htons */ 2 | #include 3 | -------------------------------------------------------------------------------- /src/host/layer23/src/misc/smspdu/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/offlinehacker/osmocombb/HEAD/src/host/layer23/src/misc/smspdu/__init__.pyc -------------------------------------------------------------------------------- /src/host/layer23/src/misc/prediction_methods/__init__.py: -------------------------------------------------------------------------------- 1 | from sysinfo import SysInfo 2 | from offset import offset 3 | from optimizer import optimizer 4 | -------------------------------------------------------------------------------- /src/shared/libosmocore/debian/libosmocore-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/* 2 | usr/lib/lib*.a 3 | usr/lib/lib*.so 4 | usr/lib/lib*.la 5 | usr/lib/pkgconfig/* 6 | -------------------------------------------------------------------------------- /src/host/layer23/src/misc/captures/bigfish_samsung: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/offlinehacker/osmocombb/HEAD/src/host/layer23/src/misc/captures/bigfish_samsung -------------------------------------------------------------------------------- /src/host/layer23/src/misc/captures/bigfish_samsung2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/offlinehacker/osmocombb/HEAD/src/host/layer23/src/misc/captures/bigfish_samsung2 -------------------------------------------------------------------------------- /src/host/layer23/src/misc/captures/bigfish_siemens: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/offlinehacker/osmocombb/HEAD/src/host/layer23/src/misc/captures/bigfish_siemens -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/Makefile.am: -------------------------------------------------------------------------------- 1 | if ENABLE_VTY 2 | SUBDIRS = vty codec crypt gsm core 3 | else 4 | SUBDIRS = codec crypt gsm core 5 | endif 6 | -------------------------------------------------------------------------------- /src/shared/update-libosmocore.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | (cd ../.. && git subtree pull --prefix=src/shared/libosmocore git://git.osmocom.org/libosmocore.git master) 4 | -------------------------------------------------------------------------------- /src/target/firmware/include/calypso/dma.h: -------------------------------------------------------------------------------- 1 | #ifndef _CALYPSO_DMA_H 2 | #define _CALYPSO_DMA_H 3 | 4 | void dma_init(void); 5 | 6 | #endif /* _CALYPSO_DMA_H */ 7 | -------------------------------------------------------------------------------- /src/target/firmware/include/calypso/rtc.h: -------------------------------------------------------------------------------- 1 | #ifndef _CALYPSO_RTC_H 2 | #define _CALYPSO_RTC_H 3 | 4 | void rtc_init(void); 5 | 6 | #endif /* _CALYPSO_RTC_H */ 7 | -------------------------------------------------------------------------------- /src/host/layer23/src/misc/captures/bigfish_encription: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/offlinehacker/osmocombb/HEAD/src/host/layer23/src/misc/captures/bigfish_encription -------------------------------------------------------------------------------- /src/host/layer23/src/misc/captures/bigfish_sonnyj100i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/offlinehacker/osmocombb/HEAD/src/host/layer23/src/misc/captures/bigfish_sonnyj100i -------------------------------------------------------------------------------- /src/shared/libosmocore/debian/libosmocore-dbg.debhelper.log: -------------------------------------------------------------------------------- 1 | dh_auto_configure 2 | dh_auto_build 3 | dh_auto_test 4 | dh_prep 5 | dh_installdirs 6 | dh_auto_install 7 | -------------------------------------------------------------------------------- /src/shared/libosmocore/tests/Makefile.am: -------------------------------------------------------------------------------- 1 | if ENABLE_TESTS 2 | SUBDIRS = timer sms ussd smscb bits 3 | if ENABLE_MSGFILE 4 | SUBDIRS += msgfile 5 | endif 6 | endif 7 | -------------------------------------------------------------------------------- /src/target/firmware/include/arm.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARM_H 2 | #define _ARM_H 3 | 4 | void arm_enable_interrupts(void); 5 | int arm_disable_interrupts(void); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /src/target/firmware/include/delay.h: -------------------------------------------------------------------------------- 1 | #ifndef delay_h 2 | #define delay_h 3 | 4 | void delay_ms(unsigned int ms); 5 | void delay_us(unsigned int us); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/common/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_HEADERS = l1ctl.h l1l2_interface.h l23_app.h logging.h \ 2 | networks.h gps.h sysinfo.h osmocom_data.h 3 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/core/backtrace.h: -------------------------------------------------------------------------------- 1 | #ifndef _OSMO_BACKTRACE_H_ 2 | #define _OSMO_BACKTRACE_H_ 3 | 4 | void osmo_generate_backtrace(void); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/core/process.h: -------------------------------------------------------------------------------- 1 | #warning "Update from osmocom/core/process.h to osmocom/core/application.h" 2 | #include 3 | -------------------------------------------------------------------------------- /src/host/env/c110_start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd ~/osmocom-bb/src/host/osmocon/ 3 | ./osmocon -p /dev/ttyUSB0 -f 1 -m c123xor ../../target/firmware/board/compal_e88/layer1.compalram.bin 4 | -------------------------------------------------------------------------------- /src/host/layer23/src/misc/captures/wireshark_filters: -------------------------------------------------------------------------------- 1 | Filter paging responses and service requests: 2 | gsmtap && (gsm_a.dtap_msg_rr_type==0x27 || gsm_a.dtap_msg_mm_type==0x24) 3 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/core/plugin.h: -------------------------------------------------------------------------------- 1 | #ifndef _OSMO_PLUGIN_H 2 | #define _OSMO_PLUGIN_H 3 | 4 | int osmo_plugin_load_all(const char *directory); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /src/target/firmware/include/board.h: -------------------------------------------------------------------------------- 1 | #ifndef _BOARD_H 2 | #define _BOARD_H 3 | 4 | extern const char *target_board; 5 | 6 | void board_init(void); 7 | 8 | #endif /* _BOARD_H */ 9 | -------------------------------------------------------------------------------- /src/target/ui-experiment/sdl.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _UI_SDL_H 3 | #define _UI_SDL_H 4 | 5 | #include 6 | 7 | extern struct display display_sdl; 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/host/gsmmap/locate.h: -------------------------------------------------------------------------------- 1 | 2 | struct probe { 3 | struct probe *next; 4 | double x, y, dist; 5 | }; 6 | 7 | int locate_cell(struct probe *probe_first, double *min_x, double *min_y); 8 | 9 | -------------------------------------------------------------------------------- /src/host/layer23/src/misc/captures/imsi_detach: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | tshark -Tfields -e frame.time -e gsmtap.frame_nr -e gsm_a.dtap.rand -e gsm_a.tmsi -R "gsm_a.dtap_msg_mm_type == 0x01" -r $@ 3 | -------------------------------------------------------------------------------- /src/host/env/c110_start_mobile: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd ~/osmocom-bb-identity/src/host/osmocon/ 3 | ./osmocon -p /dev/ttyUSB0 -m c123xor ../../target/firmware/board/compal_e88/layer1.compalram.bin 4 | -------------------------------------------------------------------------------- /src/target/firmware/include/layer1/agc.h: -------------------------------------------------------------------------------- 1 | #ifndef _L1_AGC_H 2 | #define _L1_AGC_H 3 | 4 | #define to_dbm8(x) ((x)*8) 5 | int16_t agc_inp_dbm8_by_pm(int16_t pm); 6 | 7 | #endif /* _L1_AGC_H */ 8 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/vty/Makefile.am: -------------------------------------------------------------------------------- 1 | osmovty_HEADERS = buffer.h command.h vector.h vty.h \ 2 | telnet_interface.h logging.h misc.h 3 | 4 | osmovtydir = $(includedir)/osmocom/vty 5 | -------------------------------------------------------------------------------- /src/host/layer23/src/misc/get_paging_responses: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | tshark -Tfields -e frame.time -e gsmtap.frame_nr -e gsm_a.tmsi \ 3 | -R "gsm_a.dtap_msg_rr_type == 0x27 && lapdm.control_field==0x73" -r $@ 4 | -------------------------------------------------------------------------------- /src/target/firmware/include/spi.h: -------------------------------------------------------------------------------- 1 | #ifndef _SPI_H 2 | #define _SPI_H 3 | 4 | void spi_init(void); 5 | int spi_xfer(uint8_t dev_idx, uint8_t bitlen, const void *dout, void *din); 6 | 7 | #endif /* _SPI_H */ 8 | -------------------------------------------------------------------------------- /src/target/firmware/include/uwire.h: -------------------------------------------------------------------------------- 1 | #ifndef _UWIRE_H 2 | #define _UWIRE_H 3 | 4 | void uwire_init(void); 5 | int uwire_xfer(int cs, int bitlen, const void *dout, void *din); 6 | 7 | #endif /* _UWIRE_H */ 8 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/mobile/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_HEADERS = gsm322.h gsm480_ss.h gsm411_sms.h gsm48_cc.h gsm48_mm.h \ 2 | gsm48_rr.h mncc.h settings.h subscriber.h support.h \ 3 | transaction.h vty.h mncc_sock.h 4 | -------------------------------------------------------------------------------- /src/host/layer23/src/misc/get_location_updates: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | tshark -Tfields -e frame.time -e gsmtap.frame_nr -e gsm_a.dtap.rand -e gsm_a.tmsi \ 3 | -R "gsm_a.dtap_msg_mm_type == 0x08 or gsm_a.dtap_msg_mm_type == 0x12" -r $@ 4 | -------------------------------------------------------------------------------- /src/target/firmware/calypso/Makefile: -------------------------------------------------------------------------------- 1 | 2 | LIBRARIES+=calypso 3 | calypso_DIR=calypso 4 | calypso_SRCS=arm.c buzzer.c clock.c dma.c dsp.c du.c i2c.c irq.c rtc.c sim.c spi.c tpu.c tsp.c keypad.c misc.c timer.c backlight.c uart.c uwire.c 5 | -------------------------------------------------------------------------------- /src/target/firmware/include/i2c.h: -------------------------------------------------------------------------------- 1 | #ifndef _I2C_H 2 | #define _I2C_H 3 | 4 | int i2c_write(uint8_t chip, uint32_t addr, int alen, const uint8_t *buffer, int len); 5 | void i2c_init(int speed, int slaveadd); 6 | 7 | #endif /* I2C_H */ 8 | -------------------------------------------------------------------------------- /src/shared/libosmocore/debian/libosmocore.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | usr/include 3 | usr/include/osmocom 4 | usr/include/osmocom/codec 5 | usr/include/osmocom/core 6 | usr/include/osmocom/crypt 7 | usr/include/osmocom/gsm 8 | usr/include/osmocom/vty 9 | -------------------------------------------------------------------------------- /src/shared/libosmocore/tests/bits/Makefile.am: -------------------------------------------------------------------------------- 1 | INCLUDES = $(all_includes) -I$(top_srcdir)/include 2 | noinst_PROGRAMS = bitrev_test 3 | 4 | bitrev_test_SOURCES = bitrev_test.c 5 | bitrev_test_LDADD = $(top_builddir)/src/libosmocore.la 6 | 7 | -------------------------------------------------------------------------------- /src/shared/libosmocore/tests/timer/Makefile.am: -------------------------------------------------------------------------------- 1 | INCLUDES = $(all_includes) -I$(top_srcdir)/include 2 | noinst_PROGRAMS = timer_test 3 | 4 | timer_test_SOURCES = timer_test.c 5 | timer_test_LDADD = $(top_builddir)/src/libosmocore.la 6 | 7 | -------------------------------------------------------------------------------- /src/target/firmware/include/calypso/misc.h: -------------------------------------------------------------------------------- 1 | #ifndef _CAL_MISC_H 2 | #define _CAL_MISC_H 3 | 4 | void memdump_range(unsigned int *ptr, unsigned int len); 5 | void dump_mem(void); 6 | void dump_dev_id(void); 7 | 8 | #endif /* _CAL_MISC_H */ 9 | -------------------------------------------------------------------------------- /src/shared/libosmocore/debian/libosmocore-dev.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | usr/include 3 | usr/include/osmocom 4 | usr/include/osmocom/codec 5 | usr/include/osmocom/core 6 | usr/include/osmocom/crypt 7 | usr/include/osmocom/gsm 8 | usr/include/osmocom/vty 9 | -------------------------------------------------------------------------------- /src/shared/libosmocore/tests/msgfile/Makefile.am: -------------------------------------------------------------------------------- 1 | INCLUDES = $(all_includes) -I$(top_srcdir)/include 2 | noinst_PROGRAMS = msgfile_test 3 | 4 | msgfile_test_SOURCES = msgfile_test.c 5 | msgfile_test_LDADD = $(top_builddir)/src/libosmocore.la 6 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/mobile/voice.h: -------------------------------------------------------------------------------- 1 | #ifndef _voice_h 2 | #define _voice_h 3 | 4 | int gsm_voice_init(struct osmocom_ms *ms); 5 | int gsm_send_voice(struct osmocom_ms *ms, struct gsm_data_frame *data); 6 | 7 | #endif /* _voice_h */ 8 | -------------------------------------------------------------------------------- /src/shared/libosmocore/tests/sms/Makefile.am: -------------------------------------------------------------------------------- 1 | INCLUDES = $(all_includes) -I$(top_srcdir)/include 2 | noinst_PROGRAMS = sms_test 3 | 4 | sms_test_SOURCES = sms_test.c 5 | sms_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la 6 | -------------------------------------------------------------------------------- /src/host/env/j100i_start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd ~/osmocom-bb-identity/src/host/osmocon 3 | ./osmocon -p /dev/ttyUSB1 -s /tmp/osmocom_l2_1 -m c140xor -c ../../target/firmware/board/se_j100/layer1.highram.bin ../../target/firmware/board/se_j100/chainload.compalram.bin 4 | -------------------------------------------------------------------------------- /src/shared/libosmocore/tests/ussd/Makefile.am: -------------------------------------------------------------------------------- 1 | INCLUDES = $(all_includes) -I$(top_srcdir)/include 2 | noinst_PROGRAMS = ussd_test 3 | 4 | ussd_test_SOURCES = ussd_test.c 5 | ussd_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la 6 | -------------------------------------------------------------------------------- /src/target/firmware/board/manifest.c: -------------------------------------------------------------------------------- 1 | 2 | #include "manifest.h" 3 | 4 | const char *manifest_application = APPLICATION; 5 | const char *manifest_revision = GIT_REVISION; 6 | const char *manifest_board = BOARD; 7 | const char *manifest_environment = ENVIRONMENT; 8 | -------------------------------------------------------------------------------- /src/shared/.gitignore: -------------------------------------------------------------------------------- 1 | libosmocore/build-host/tests/msgfile/msgfile_test 2 | libosmocore/build-host/tests/smscb/smscb_test 3 | libosmocore/build-host/tests/sms/sms_test 4 | libosmocore/build-host/tests/timer/timer_test 5 | libosmocore/build-host/tests/ussd/ussd_test 6 | -------------------------------------------------------------------------------- /src/shared/libosmocore/tests/smscb/Makefile.am: -------------------------------------------------------------------------------- 1 | INCLUDES = $(all_includes) -I$(top_srcdir)/include 2 | noinst_PROGRAMS = smscb_test 3 | 4 | smscb_test_SOURCES = smscb_test.c 5 | smscb_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la 6 | -------------------------------------------------------------------------------- /src/target/firmware/include/layer1/rfch.h: -------------------------------------------------------------------------------- 1 | #ifndef _L1_RFCH_H 2 | #define _L1_RFCH_H 3 | 4 | struct gsm_time; 5 | 6 | void rfch_get_params(struct gsm_time *t, 7 | uint16_t *arfcn_p, uint8_t *tsc_p, uint8_t *tn_p); 8 | 9 | #endif /* _L1_RFCH_H */ 10 | -------------------------------------------------------------------------------- /src/target/firmware/lib/Makefile: -------------------------------------------------------------------------------- 1 | 2 | LIBRARIES+=mini 3 | mini_DIR=lib 4 | mini_SRCS=vsprintf.c string.c ctype.c printf.c console.c ctors.c \ 5 | changebit.S clearbit.S delay.c div64.S lib1funcs.S memcpy.S memset.S setbit.S testchangebit.S testclearbit.S testsetbit.S 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/target/firmware/include/layer1/toa.h: -------------------------------------------------------------------------------- 1 | #ifndef _L1_TOA_H 2 | #define _L1_TOA_H 3 | 4 | /* Input a qbits error sample into the TOA averaging */ 5 | void toa_input(int32_t offset, uint32_t snr); 6 | 7 | /* Reset the TOA counters */ 8 | void toa_reset(void); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/gsm/protocol/Makefile.am: -------------------------------------------------------------------------------- 1 | osmogsm_proto_HEADERS = gsm_03_41.h \ 2 | gsm_04_08.h gsm_04_11.h gsm_04_12.h gsm_04_80.h \ 3 | gsm_08_08.h gsm_08_58.h gsm_44_318.h \ 4 | gsm_12_21.h ipaccess.h 5 | 6 | osmogsm_protodir = $(includedir)/osmocom/gsm/protocol 7 | -------------------------------------------------------------------------------- /src/shared/libosmocore/utils/Makefile.am: -------------------------------------------------------------------------------- 1 | if ENABLE_UTILITIES 2 | INCLUDES = $(all_includes) -I$(top_srcdir)/include 3 | noinst_PROGRAMS = osmo-arfcn 4 | 5 | osmo_arfcn_SOURCES = osmo-arfcn.c 6 | osmo_arfcn_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la 7 | endif 8 | -------------------------------------------------------------------------------- /src/shared/libosmocore/libosmocore.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: Osmocom Core Library 7 | Description: C Utility Library 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -losmocore 10 | Cflags: -I${includedir}/ 11 | 12 | -------------------------------------------------------------------------------- /src/shared/libosmocore/libosmogsm.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: Osmocom GSM Core Library 7 | Description: GSM Core Library 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -losmogsm 10 | Cflags: -I${includedir}/ 11 | 12 | -------------------------------------------------------------------------------- /src/target/firmware/include/calypso/backlight.h: -------------------------------------------------------------------------------- 1 | #ifndef _CAL_BACKLIGHT_H 2 | #define _CAL_BACKLIGHT_H 3 | 4 | /* Switch backlight to PWL mode (or back) */ 5 | void bl_mode_pwl(int on); 6 | 7 | /* Set the backlight level */ 8 | void bl_level(uint8_t level); 9 | 10 | #endif /* CAL_BACKLIGHT_H */ 11 | -------------------------------------------------------------------------------- /src/target/firmware/include/comm/sercomm_cons.h: -------------------------------------------------------------------------------- 1 | #ifndef _SERCOMM_CONS_H 2 | #define _SERCOMM_CONS_H 3 | 4 | /* how large buffers do we allocate? */ 5 | #define SERCOMM_CONS_ALLOC 256 6 | 7 | int sercomm_puts(const char *s); 8 | int sercomm_putchar(int c); 9 | 10 | #endif /* _SERCOMM_CONS_H */ 11 | -------------------------------------------------------------------------------- /src/target/firmware/include/manifest.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _MANIFEST_H 3 | #define _MANIFEST_H 4 | 5 | extern const char *manifest_application; 6 | extern const char *manifest_revision; 7 | extern const char *manifest_board; 8 | extern const char *manifest_environment; 9 | 10 | #endif /* !_MANIFEST_H */ 11 | -------------------------------------------------------------------------------- /src/shared/libosmocore/libosmovty.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: Osmocom VTY Interface Library 7 | Description: C Utility Library 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -losmovty 10 | Cflags: -I${includedir}/ 11 | 12 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/gsm/prim.h: -------------------------------------------------------------------------------- 1 | #ifndef OSMO_GSM_PRIM_H 2 | #define OSMO_GSM_PRIM_H 3 | 4 | #include 5 | 6 | /* enumeration of GSM related SAPs */ 7 | enum osmo_gsm_sap { 8 | SAP_GSM_PH = _SAP_GSM_BASE, 9 | SAP_GSM_DL, 10 | SAP_GSM_MDL, 11 | }; 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /src/host/calypso_pll/pll.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | my $f_in = 26*1000*1000; 4 | 5 | for (my $mult = 1; $mult < 31; $mult++) { 6 | for (my $div = 0; $div < 3; $div++) { 7 | my $fout = $f_in * ($mult / ($div+1)); 8 | printf("%03.1f MHz (mult=%2u, div=%1u)\n", $fout/(1000*1000), $mult, $div); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/shared/libosmocore/libosmocodec.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: Osmocom Codec related utilities Library 7 | Description: C Utility Library 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -losmocodec 10 | Cflags: -I${includedir}/ 11 | 12 | -------------------------------------------------------------------------------- /src/host/layer23/src/common/Makefile.am: -------------------------------------------------------------------------------- 1 | INCLUDES = $(all_includes) -I$(top_srcdir)/include 2 | AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) 3 | 4 | noinst_LIBRARIES = liblayer23.a 5 | liblayer23_a_SOURCES = l1ctl.c l1l2_interface.c sap_interface.c \ 6 | logging.c networks.c sim.c sysinfo.c gps.c l1ctl_lapdm_glue.c 7 | -------------------------------------------------------------------------------- /src/target/firmware/calypso/dsp_bootcode.c: -------------------------------------------------------------------------------- 1 | /* Calypso integrated DSP boot code */ 2 | 3 | #define _SA_DECL (const uint16_t *)&(const uint16_t []) 4 | 5 | /* We don't really need any DSP boot code, it happily works with its own ROM */ 6 | static const struct dsp_section *dsp_bootcode = NULL; 7 | 8 | #undef _SA_DECL 9 | 10 | -------------------------------------------------------------------------------- /src/target/firmware/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRING_H 2 | #define _STRING_H 3 | 4 | #include 5 | 6 | size_t strnlen(const char *s, size_t count); 7 | size_t strlen(const char *s); 8 | 9 | void *memset(void *s, int c, size_t n); 10 | void *memcpy(void *dest, const void *src, size_t n); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/common/l1l2_interface.h: -------------------------------------------------------------------------------- 1 | #ifndef _L1L2_INTERFACE_H 2 | #define _L1L2_INTERFACE_H 3 | 4 | int layer2_open(struct osmocom_ms *ms, const char *socket_path); 5 | int layer2_close(struct osmocom_ms *ms); 6 | int osmo_send_l1(struct osmocom_ms *ms, struct msgb *msg); 7 | 8 | #endif /* _L1L2_INTERFACE_H */ 9 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/vty/misc.h: -------------------------------------------------------------------------------- 1 | #ifndef OSMO_VTY_MISC_H 2 | #define OSMO_VTY_MISC_H 3 | 4 | #include 5 | #include 6 | 7 | void vty_out_rate_ctr_group(struct vty *vty, const char *prefix, 8 | struct rate_ctr_group *ctrg); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/misc/xcch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xcch.h 3 | * 4 | * Copyright (c) 2011 Sylvain Munaut 5 | */ 6 | 7 | #ifndef __XCCH_H__ 8 | #define __XCCH_H__ 9 | 10 | #include 11 | #include 12 | 13 | int xcch_decode(uint8_t *l2_data, sbit_t *bursts); 14 | 15 | #endif /* __XCCH_H__ */ 16 | -------------------------------------------------------------------------------- /src/target/firmware/include/layer1/apc.h: -------------------------------------------------------------------------------- 1 | #ifndef _L1_APC_H 2 | #define _L1_APC_H 3 | 4 | /* determine the AUXAPC value by the Tx Power Level */ 5 | int16_t apc_tx_dbm2auxapc(enum gsm_band band, int8_t dbm); 6 | 7 | /* determine the AUXAPC value by the Tx Power Level */ 8 | int16_t apc_tx_pwrlvl2auxapc(enum gsm_band band, uint8_t lvl); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/target/firmware/display/display.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | struct display_driver *display; 7 | 8 | int display_puts(const char *str) 9 | { 10 | char c; 11 | 12 | if (display->puts) 13 | display->puts(str); 14 | else { 15 | while ((c = *str++)) 16 | display_putchar(c); 17 | } 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /src/target/firmware/include/asm/linkage.h: -------------------------------------------------------------------------------- 1 | #ifndef __ASM_LINKAGE_H 2 | #define __ASM_LINKAGE_H 3 | 4 | /* asm-arm/linkage.h */ 5 | 6 | #define __ALIGN .align 0 7 | #define __ALIGN_STR ".align 0" 8 | 9 | /* linux/linkage.h */ 10 | 11 | #define ALIGN __ALIGN 12 | 13 | #define ENTRY(name) \ 14 | .globl name; \ 15 | ALIGN; \ 16 | name: 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/gsm/Makefile.am: -------------------------------------------------------------------------------- 1 | osmogsm_HEADERS = a5.h comp128.h gsm0808.h gsm48_ie.h mncc.h rxlev_stat.h \ 2 | gsm0480.h gsm48.h gsm_utils.h rsl.h tlv.h abis_nm.h \ 3 | sysinfo.h prim.h gsm0502.h lapd_core.h lapdm.h \ 4 | gsm0411_utils.h gsm0411_smc.h gsm0411_smr.h 5 | 6 | SUBDIRS = protocol 7 | 8 | osmogsmdir = $(includedir)/osmocom/gsm 9 | -------------------------------------------------------------------------------- /src/target_dsp/calypso/dsp_dump.lds: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT("coff1-c54x") 2 | OUTPUT_ARCH("") 3 | MEMORY 4 | { 5 | apiram (RWXI) : ORIGIN = 0x0800, LENGTH = 0x2000 6 | } 7 | SECTIONS 8 | { 9 | . = 0x0800; 10 | 11 | .apiram : 12 | { 13 | PROVIDE(_api_ram = .); 14 | *(.apiram) 15 | } > apiram 16 | 17 | .text : 18 | { 19 | *(.text) 20 | } > apiram 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/mobile/gsm480_ss.h: -------------------------------------------------------------------------------- 1 | #ifndef _GSM480_SS_H 2 | #define _GSM480_SS_H 3 | 4 | int gsm480_ss_init(struct osmocom_ms *ms); 5 | int gsm480_ss_exit(struct osmocom_ms *ms); 6 | int gsm480_rcv_ss(struct osmocom_ms *ms, struct msgb *msg); 7 | int ss_send(struct osmocom_ms *ms, const char *code, int new_trans); 8 | 9 | #endif /* _GSM480_SS_H */ 10 | -------------------------------------------------------------------------------- /src/target/firmware/layer1/Makefile: -------------------------------------------------------------------------------- 1 | 2 | LIBRARIES+=layer1 3 | layer1_DIR=layer1 4 | layer1_SRCS=avg.c agc.c afc.c toa.c sync.c tdma_sched.c tpu_window.c init.c \ 5 | l23_api.c mframe_sched.c sched_gsmtime.c async.c rfch.c apc.c 6 | 7 | layer1_SRCS += prim_pm.c prim_rach.c prim_tx_nb.c prim_rx_nb.c prim_fbsb.c \ 8 | prim_freq.c prim_utils.c prim_tch.c prim_sniff.c 9 | 10 | -------------------------------------------------------------------------------- /src/target/firmware/lib/delay.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* FIXME: We need properly calibrated delay loops at some point! */ 4 | void delay_us(unsigned int us) 5 | { 6 | volatile unsigned int i; 7 | 8 | for (i= 0; i < us*4; i++) { i; } 9 | } 10 | 11 | void delay_ms(unsigned int ms) 12 | { 13 | volatile unsigned int i; 14 | 15 | for (i= 0; i < ms*1300; i++) { i; } 16 | } 17 | -------------------------------------------------------------------------------- /src/shared/libosmocore/utils/gen_website_doc_tree.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TOPDIR=`pwd` 4 | INDIR="$TOPDIR/doc" 5 | OUTDIR=/tmp/doxywww 6 | GITREV=`./git-version-gen .tarball-version` 7 | 8 | [ -f "$OUTDIR" ] || mkdir "$OUTDIR" 9 | 10 | for MOD in core gsm vty codec; do 11 | TGTDIR="$OUTDIR/libosmo$MOD/$GITREV" 12 | mkdir -p "$TGTDIR" 13 | cp -R "$INDIR/$MOD/"* "$TGTDIR/" 14 | done 15 | -------------------------------------------------------------------------------- /src/target/firmware/board/compal/header.S: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a textual header that is prepended to images where appropriate. 3 | * 4 | * It is meant to ease identification of our firmwares in dumps as well 5 | * as filling some space that is used for the same purpose by the vendor. 6 | * 7 | */ 8 | .section .compal.header 9 | .ascii "OSMOCOM" 10 | . = 0x20 11 | .ascii GIT_REVISION 12 | -------------------------------------------------------------------------------- /src/target/firmware/lib/printf.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | static char printf_buffer[1024]; 6 | 7 | int printf(const char *fmt, ...) 8 | { 9 | va_list args; 10 | int r; 11 | 12 | va_start(args, fmt); 13 | r = vsnprintf(printf_buffer, sizeof(printf_buffer), fmt, args); 14 | va_end(args); 15 | 16 | puts(printf_buffer); 17 | 18 | return r; 19 | } 20 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/vty/logging.h: -------------------------------------------------------------------------------- 1 | #ifndef _VTY_LOGGING_H 2 | #define _VTY_LOGGING_H 3 | 4 | #define LOGGING_STR "Configure log message to this terminal\n" 5 | #define FILTER_STR "Filter log messages\n" 6 | 7 | struct log_info; 8 | void logging_vty_add_cmds(const struct log_info *cat); 9 | struct vty; 10 | struct log_target *osmo_log_vty2tgt(struct vty *vty); 11 | 12 | #endif /* _VTY_LOGGING_H */ 13 | -------------------------------------------------------------------------------- /include/osmocore/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef OSMOCORE_UTIL_H 2 | #define OSMOCORE_UTIL_H 3 | 4 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 5 | 6 | #include 7 | 8 | struct value_string { 9 | unsigned int value; 10 | const char *str; 11 | }; 12 | 13 | const char *get_value_string(const struct value_string *vs, uint32_t val); 14 | int get_string_value(const struct value_string *vs, const char *str); 15 | 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/target/ui-experiment/README: -------------------------------------------------------------------------------- 1 | 2 | This is some exploratory and experimental code related 3 | to the development of a proper lcd-based ui. 4 | 5 | It has been written by Ingo Albrecht 6 | and, lacking further arrangements, should be considered to 7 | be licensed under the GNU GPL v2 or later. 8 | 9 | I have placed this here due to general interest. All of it 10 | can safely be removed once we have a proper ui. 11 | 12 | -------------------------------------------------------------------------------- /src/target_dsp/calypso/dsp_patch.lds: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT("coff1-c54x") 2 | OUTPUT_ARCH("") 3 | MEMORY 4 | { 5 | dram (RWXI) : ORIGIN = 0x015C, LENGTH = 0x0600 6 | apiram (RWXI) : ORIGIN = 0x2000, LENGTH = 0x1000 7 | } 8 | SECTIONS 9 | { 10 | . = 0x015C; 11 | 12 | .text : 13 | { 14 | *(.text) 15 | } > dram 16 | 17 | 18 | . = 0x2000; 19 | 20 | .apiram : 21 | { 22 | PROVIDE(_api_ram = .); 23 | *(.apiram) 24 | } > apiram 25 | } 26 | -------------------------------------------------------------------------------- /src/target/firmware/include/mtk/bpi.h: -------------------------------------------------------------------------------- 1 | #ifndef _MTK_BPI_H 2 | #define _MTK_BPI_H 3 | 4 | /* MTK Baseband Parallel Interface */ 5 | 6 | /* Chapter 9.2 of MT6235 Data Sheet */ 7 | 8 | #define BPI_BUF(n) (BPI_BUF0 + ((n) * 4)) 9 | 10 | #define MTK_BPI(n) (n) 11 | 12 | enum mtk_bpi_reg { 13 | BPI_CON = 0x0000, 14 | BPI_BUF0 = 0x0004, 15 | BPI_ENA0 = 0x00b0, 16 | BPI_ENA1 = 0x00b4, 17 | BPI_ENA2 = 0x00b8, 18 | }; 19 | 20 | #endif /* _MTK_BPI_H */ 21 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/common/logging.h: -------------------------------------------------------------------------------- 1 | #ifndef _LOGGING_H 2 | #define _LOGGING_H 3 | 4 | #define DEBUG 5 | #include 6 | 7 | enum { 8 | DRSL, 9 | DRR, 10 | DPLMN, 11 | DCS, 12 | DNB, 13 | DMM, 14 | DCC, 15 | DSS, 16 | DSMS, 17 | DMNCC, 18 | DMEAS, 19 | DPAG, 20 | DL1C, 21 | DSAP, 22 | DSUM, 23 | DSIM, 24 | DGPS, 25 | }; 26 | 27 | extern const struct log_info log_info; 28 | 29 | #endif /* _LOGGING_H */ 30 | -------------------------------------------------------------------------------- /src/target_dsp/calypso/Makefile: -------------------------------------------------------------------------------- 1 | all: dsp_dump.bin dsp_sniff.bin 2 | 3 | CROSS=tic54x-coff- 4 | 5 | %.o: %.S 6 | $(CROSS)as $< -o $@ 7 | 8 | %.bin: %.coff 9 | $(CROSS)objcopy -j .text -O binary $< $@ 10 | 11 | dsp_dump.coff: bl_stage3.o dsp_dump.lds 12 | $(CROSS)ld --script dsp_dump.lds bl_stage3.o -o $@ 13 | 14 | dsp_sniff.coff: dsp_sniff.o dsp_patch.lds 15 | $(CROSS)ld --script dsp_patch.lds dsp_sniff.o -o $@ 16 | 17 | clean: 18 | rm -f *.o *.bin *.coff 19 | -------------------------------------------------------------------------------- /src/host/gsmmap/geo.h: -------------------------------------------------------------------------------- 1 | /* WGS 84 */ 2 | #define EQUATOR_RADIUS 6378137.0 3 | #define POLE_RADIUS 6356752.314 4 | 5 | #define PI 3.1415926536 6 | 7 | void geo2space(double *x, double *y, double *z, double lat, double lon); 8 | void space2geo(double *lat, double *lon, double x, double y, double z); 9 | double distinspace(double x1, double y1, double z1, double x2, double y2, 10 | double z2); 11 | double distonplane(double x1, double y1, double x2, double y2); 12 | 13 | -------------------------------------------------------------------------------- /src/target/firmware/board/compal/start.ram.S: -------------------------------------------------------------------------------- 1 | 2 | .section .text.start 3 | 4 | #include "macros.S" 5 | 6 | .globl _start 7 | _start: 8 | /* clear bss section */ 9 | clear_bss 10 | 11 | /* initialize all stacks */ 12 | init_stacks 13 | 14 | /* call constructors */ 15 | call_ctors 16 | 17 | /* jump to main */ 18 | ldr pc, _jump_main 19 | 20 | /* endless loop at end of program */ 21 | _loop: 22 | b _loop 23 | b _start 24 | 25 | _jump_main: 26 | .word main 27 | -------------------------------------------------------------------------------- /src/target/firmware/board/mediatek/start.ram.S: -------------------------------------------------------------------------------- 1 | 2 | .section .text.start 3 | 4 | #include "macros.S" 5 | 6 | .globl _start 7 | _start: 8 | /* clear bss section */ 9 | clear_bss 10 | 11 | /* initialize all stacks */ 12 | init_stacks 13 | 14 | /* call constructors */ 15 | call_ctors 16 | 17 | /* jump to main */ 18 | ldr pc, _jump_main 19 | 20 | /* endless loop at end of program */ 21 | _loop: 22 | b _loop 23 | b _start 24 | 25 | _jump_main: 26 | .word main 27 | -------------------------------------------------------------------------------- /src/host/env/screenrc: -------------------------------------------------------------------------------- 1 | source ~/.screenrc 2 | setenv PATH $PATH:~/osmocom-bb/src/host/layer23/src/misc/:~/osmocom-bb-identity/src/host/layer23/src/mobile/ 3 | setenv PATH $PATH:~/osmocom-bb/src/host/env/ 4 | setenv PATH $PATH:~/kraken-win32/Kraken/ 5 | screen -t notes nano crack1 6 | screen -t wireshark wireshark 7 | screen -t kraken 8 | screen -t l1_sniffer 9 | screen -t capture_crack 10 | screen -t mon 11 | screen -t l1_mobile 12 | screen -t mobile 13 | screen -t mobile_control 14 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/common/sap_interface.h: -------------------------------------------------------------------------------- 1 | #ifndef _SAP_INTERFACE_H 2 | #define _SAP_INTERFACE_H 3 | 4 | typedef int (*osmosap_cb_t)(struct msgb *msg, struct osmocom_ms *ms); 5 | 6 | int sap_open(struct osmocom_ms *ms, const char *socket_path); 7 | int sap_close(struct osmocom_ms *ms); 8 | int osmosap_send(struct osmocom_ms *ms, struct msgb *msg); 9 | int osmosap_register_handler(struct osmocom_ms *ms, osmosap_cb_t cb); 10 | 11 | #endif /* _SAP_INTERFACE_H */ 12 | -------------------------------------------------------------------------------- /src/host/gsmmap/.gitignore: -------------------------------------------------------------------------------- 1 | # autoreconf by-products 2 | *.in 3 | 4 | aclocal.m4 5 | autom4te.cache/ 6 | configure 7 | depcomp 8 | install-sh 9 | missing 10 | 11 | # configure by-products 12 | .deps/ 13 | Makefile 14 | 15 | config.status 16 | version.h 17 | 18 | # build by-products 19 | *.o 20 | 21 | gsmmap 22 | 23 | # various 24 | .version 25 | .tarball-version 26 | 27 | # IDA file 28 | *.id* 29 | *.nam 30 | *.til 31 | 32 | # Other test files 33 | *.dump 34 | *.bin 35 | *.log 36 | -------------------------------------------------------------------------------- /src/target/firmware/board/compal/LINKAGE.txt: -------------------------------------------------------------------------------- 1 | 2 | We provide the following common RAM linkages for all Compal phones: 3 | 4 | (both use the Calypso ROM loader for interrupt redirect, if required) 5 | 6 | compalram: 7 | Image for the Compal ramloader. Starts at a weird address and 8 | contains various ramloader specifics. 9 | 10 | highram: 11 | Image linked to 0x820000, used for various special purposes. 12 | This image is completely independent of the compal loader. 13 | -------------------------------------------------------------------------------- /src/host/osmocon/.gitignore: -------------------------------------------------------------------------------- 1 | # autoreconf by-products 2 | *.in 3 | 4 | aclocal.m4 5 | autom4te.cache/ 6 | configure 7 | depcomp 8 | install-sh 9 | missing 10 | 11 | # configure by-products 12 | .deps/ 13 | Makefile 14 | 15 | config.status 16 | version.h 17 | 18 | # build by-products 19 | *.o 20 | 21 | osmocon 22 | osmoload 23 | 24 | # various 25 | .version 26 | .tarball-version 27 | 28 | # IDA file 29 | *.id* 30 | *.nam 31 | *.til 32 | 33 | # Other test files 34 | *.dump 35 | *.bin 36 | *.log 37 | -------------------------------------------------------------------------------- /src/shared/libosmocore/src/codec/Makefile.am: -------------------------------------------------------------------------------- 1 | # This is _NOT_ the library release version, it's an API version. 2 | # Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification 3 | LIBVERSION=0:0:0 4 | 5 | INCLUDES = $(all_includes) -I$(top_srcdir)/include 6 | AM_CFLAGS = -fPIC -Wall 7 | 8 | lib_LTLIBRARIES = libosmocodec.la 9 | 10 | libosmocodec_la_SOURCES = gsm610.c gsm620.c gsm660.c gsm690.c 11 | libosmocodec_la_LDFALGS = -version-info $(LIBVERSION) 12 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/gsm/comp128.h: -------------------------------------------------------------------------------- 1 | /* 2 | * COMP128 header 3 | * 4 | * See comp128.c for details 5 | */ 6 | 7 | #ifndef __COMP128_H__ 8 | #define __COMP128_H__ 9 | 10 | #include 11 | 12 | /* 13 | * Performs the COMP128 algorithm (used as A3/A8) 14 | * ki : uint8_t [16] 15 | * srand : uint8_t [16] 16 | * sres : uint8_t [4] 17 | * kc : uint8_t [8] 18 | */ 19 | void comp128(uint8_t *ki, uint8_t *srand, uint8_t *sres, uint8_t *kc); 20 | 21 | #endif /* __COMP128_H__ */ 22 | 23 | -------------------------------------------------------------------------------- /src/target/firmware/board/compal/exceptions_redirected.S: -------------------------------------------------------------------------------- 1 | 2 | /* Exception Vectors like they are needed for the exception vector 3 | indirection of the internal boot ROM. The following section must be liked 4 | to appear at 0x80001c */ 5 | .section .text.exceptions 6 | _undef_instr: 7 | b handle_abort 8 | _sw_interr: 9 | b _sw_interr 10 | _prefetch_abort: 11 | b handle_abort 12 | _data_abort: 13 | b handle_abort 14 | _reserved: 15 | b _reserved 16 | _irq: 17 | b irq_entry 18 | _fiq: 19 | b fiq_entry 20 | 21 | -------------------------------------------------------------------------------- /src/target/firmware/include/layer1/l23_api.h: -------------------------------------------------------------------------------- 1 | #ifndef _L1_L23_API_H 2 | #define _L1_L23_API_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | void l1a_l23api_init(void); 9 | void l1_queue_for_l2(struct msgb *msg); 10 | struct msgb *l1ctl_msgb_alloc(uint8_t msg_type); 11 | struct msgb *l1_create_l2_msg(int msg_type, uint32_t fn, uint16_t snr, uint16_t arfcn); 12 | 13 | void l1ctl_tx_reset(uint8_t msg_type, uint8_t reset_type); 14 | 15 | #endif /* _L1_L23_API_H */ 16 | -------------------------------------------------------------------------------- /src/target/firmware/board/common/calypso_pwl.S: -------------------------------------------------------------------------------- 1 | 2 | /* Calypso PWL driver */ 3 | 4 | #define ASIC_CONF_REG 0xfffef008 5 | #define BA_PWL 0xfffe8000 6 | 7 | .globl pwl_init 8 | pwl_init: ldr r1, =ASIC_CONF_REG 9 | ldr r2, [r1] 10 | orr r2, r2, #0x10 @ set light output to PWL 11 | str r2, [r1] 12 | ldr r1, =BA_PWL 13 | mov r0, #1 14 | strb r0, [r1, #1] @ enable clock of PWL unut 15 | mov pc, lr 16 | 17 | .globl pwl_set_level 18 | pwl_set_level: ldr r1, =BA_PWL 19 | strb r0, [r1] 20 | mov pc, lr 21 | 22 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/core/panic.h: -------------------------------------------------------------------------------- 1 | #ifndef OSMOCORE_PANIC_H 2 | #define OSMOCORE_PANIC_H 3 | 4 | /*! \addtogroup utils 5 | * @{ 6 | */ 7 | 8 | /*! \file panic.h */ 9 | 10 | #include 11 | 12 | /*! \brief panic handler callback function type */ 13 | typedef void (*osmo_panic_handler_t)(const char *fmt, va_list args); 14 | 15 | extern void osmo_panic(const char *fmt, ...); 16 | extern void osmo_set_panic_handler(osmo_panic_handler_t h); 17 | 18 | /*! @} */ 19 | 20 | #endif /* OSMOCORE_PANIC_H */ 21 | -------------------------------------------------------------------------------- /src/target/firmware/lib/ctors.c: -------------------------------------------------------------------------------- 1 | 2 | /* iterate over list of constructor functions and call each element */ 3 | void do_global_ctors(const char *_ctors_start, const char *ctors_end) 4 | { 5 | typedef void (*func_ptr)(void); 6 | func_ptr *func, *ctors_start = (func_ptr *) _ctors_start; 7 | 8 | /* skip the first entry, as it contains the number of 9 | * constructors which we don't use */ 10 | ctors_start++; 11 | 12 | for (func = ctors_start; 13 | *func && (func != (func_ptr *) ctors_end); func++) 14 | (*func)(); 15 | } 16 | -------------------------------------------------------------------------------- /src/target/firmware/include/ctors.h: -------------------------------------------------------------------------------- 1 | #ifndef _CTORS_H 2 | #define _CTORS_H 3 | 4 | #if 0 5 | /* only supported by gcc 3.4 or later */ 6 | #define __ctor_data __attribute__ ((constructor) (100)) 7 | #define __ctor_board __attribute__ ((constructor) (200)) 8 | #else 9 | #define __ctor_data __attribute__ ((constructor)) 10 | #define __ctor_board __attribute__ ((constructor)) 11 | #endif 12 | 13 | /* iterate over list of constructor functions and call each element */ 14 | void do_global_ctors(const char *ctors_start, const char *ctors_end); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /src/target/firmware/include/defines.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _DEFINES_H 3 | #define _DEFINES_H 4 | 5 | #define __attribute_const__ __attribute__((__const__)) 6 | 7 | /* type properties */ 8 | #define __packed __attribute__((packed)) 9 | #define __aligned(alignment) __attribute__((aligned(alignment))) 10 | #define __unused __attribute__((unused)) 11 | 12 | /* linkage */ 13 | #define __section(name) __attribute__((section(name))) 14 | 15 | /* force placement in zero-waitstate memory */ 16 | #define __ramtext __section(".ramtext") 17 | 18 | #endif /* !_DEFINES_H */ 19 | -------------------------------------------------------------------------------- /src/target/ui-experiment/menu.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Menus - menus and menu items 4 | * 5 | * We represent both menus and menu items in a single structure. 6 | * 7 | * They share the properties of having a title as well as having 8 | * interaction callbacks such as on_select. 9 | * 10 | * Menus have a child item array that is indexed by menu position. 11 | * The position of items in this array is used for numeric menu navigation. 12 | * 13 | */ 14 | struct menu { 15 | const char *title; 16 | void (*on_select)(void); 17 | struct menu *children[10]; 18 | }; 19 | -------------------------------------------------------------------------------- /src/host/rita_pll/rita_pll_notes.txt: -------------------------------------------------------------------------------- 1 | 2 | Regular Operation as per DS GSM SPEC 3 | 4 | GSM900 Tx: 870.4 ... 921.4 MHz 880.0 ... 914.8 5 | GSM900 Rx: 864.4 ... 966.2 MHz 925.0 ... 959.8 6 | 7 | GSM1800 Tx: 1702.4 ... 1919.8 MHz 1710.2 ... 1784.8 8 | GSM1800 Rx: 1804.8 ... 1996.4 MHz 1805.2 ... 1879.8 9 | 10 | GSM850 Tx: 11 | 12 | [824.2 ~ 837.0 MHz] 13 | [837.2 ~ 848.8 MHz] 14 | 15 | 16 | GSM810 Tx: 806.0 ... 821.0 17 | * modify B value to go down to 125 (A = 60) 18 | GSM810 Rx: 851.0 ... 866.0 19 | * modify B value to go down to 132 (A = 62) 20 | -------------------------------------------------------------------------------- /src/host/layer23/src/misc/prediction_methods/predictionMethod.py: -------------------------------------------------------------------------------- 1 | class PredictionMethod(object): 2 | def _splitCount(self, s, count): 3 | return [''.join(x) for x in zip(*[list(s[z::count]) for z in range(count)])] 4 | 5 | def _alterByte(self, data, offset, byte): 6 | t= self._splitCount(data,2) 7 | t[offset]= "%02x" % (int(t[offset],16)+byte) 8 | return "".join(t) 9 | 10 | def Predict(self, frames, args): 11 | pass 12 | 13 | def __init__(self, name, group): 14 | self.name= name 15 | self.group= group 16 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/misc/layer3.h: -------------------------------------------------------------------------------- 1 | #ifndef _OSMOCOM_L3_H 2 | #define _OSMOCOM_L3_H 3 | 4 | #include 5 | #include 6 | 7 | int gsm48_rx_ccch(struct msgb *msg, struct osmocom_ms *ms); 8 | int gsm48_rx_dcch(struct msgb *msg, struct osmocom_ms *ms); 9 | int gsm48_rx_bcch(struct msgb *msg, struct osmocom_ms *ms); 10 | 11 | /* Initialize layer3 for the MS, hook it to L2 */ 12 | int layer3_init(struct osmocom_ms *ms); 13 | 14 | /* Reset the 'aplication' state */ 15 | void layer3_app_reset(void); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/mobile/gsm48_cc.h: -------------------------------------------------------------------------------- 1 | #ifndef _GSM48_CC_H 2 | #define _GSM48_CC_H 3 | 4 | struct gsm48_cclayer { 5 | struct osmocom_ms *ms; 6 | 7 | struct llist_head mncc_upqueue; 8 | }; 9 | 10 | int gsm48_cc_init(struct osmocom_ms *ms); 11 | int gsm48_cc_exit(struct osmocom_ms *ms); 12 | int gsm48_rcv_cc(struct osmocom_ms *ms, struct msgb *msg); 13 | int mncc_dequeue(struct osmocom_ms *ms); 14 | int mncc_tx_to_cc(void *inst, int msg_type, void *arg); 15 | int mncc_clear_trans(void *inst, uint8_t protocol); 16 | 17 | #endif /* _GSM48_CC_H */ 18 | 19 | -------------------------------------------------------------------------------- /src/target/firmware/board/compal/start.rom.S: -------------------------------------------------------------------------------- 1 | 2 | .section .text.start 3 | 4 | #include "macros.S" 5 | 6 | .globl _start 7 | _start: 8 | /* clear bss section */ 9 | clear_bss 10 | 11 | /* copy data to ram */ 12 | copy_data 13 | 14 | /* copy alway-in-ram code */ 15 | copy_ramtext 16 | 17 | /* initialize all stacks */ 18 | init_stacks 19 | 20 | /* call constructors */ 21 | call_ctors 22 | 23 | /* jump to main */ 24 | ldr pc, _jump_main 25 | 26 | /* endless loop at end of program */ 27 | _loop: 28 | b _loop 29 | b _start 30 | 31 | _jump_main: 32 | .word main 33 | -------------------------------------------------------------------------------- /src/target/ui-experiment/screen.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Screens - full-screen dialogs 4 | * 5 | * These compose the first level of interaction in the UI. 6 | * 7 | * There is always exactly one active screen, which is in 8 | * control of the entire display on which it is displayed. 9 | * 10 | * Screen activations are stacked, providing interaction depth. 11 | * 12 | */ 13 | struct screen { 14 | const char *name; 15 | void (*on_enter)(void); 16 | void (*on_leave)(void); 17 | void (*on_render)(void); 18 | void (*on_key_press)(void); 19 | void (*on_key_release)(void); 20 | }; 21 | 22 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/mobile/app_mobile.h: -------------------------------------------------------------------------------- 1 | #ifndef APP_MOBILE_H 2 | #define APP_MOBILE_H 3 | 4 | char *config_dir; 5 | 6 | int l23_app_init(int (*mncc_recv)(struct osmocom_ms *ms, int, void *), 7 | const char *config_file, uint16_t vty_port); 8 | int l23_app_exit(void); 9 | int l23_app_work(int *quit); 10 | int mobile_delete(struct osmocom_ms *ms, int force); 11 | struct osmocom_ms *mobile_new(char *name); 12 | int mobile_init(struct osmocom_ms *ms); 13 | int mobile_exit(struct osmocom_ms *ms, int force); 14 | int mobile_work(struct osmocom_ms *ms); 15 | 16 | #endif 17 | 18 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/mobile/vty.h: -------------------------------------------------------------------------------- 1 | #ifndef OSMOCOM_VTY_H 2 | #define OSMOCOM_VTY_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | enum ms_vty_node { 10 | MS_NODE = _LAST_OSMOVTY_NODE + 1, 11 | TESTSIM_NODE, 12 | SUPPORT_NODE, 13 | }; 14 | 15 | enum node_type ms_vty_go_parent(struct vty *vty); 16 | int ms_vty_init(void); 17 | extern void vty_notify(struct osmocom_ms *ms, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /src/target/firmware/lib/testsetbit.S: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/arch/arm/lib/testsetbit.S 3 | * 4 | * Copyright (C) 1995-1996 Russell King 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation. 9 | */ 10 | #include 11 | #include 12 | #include "bitops.h" 13 | .text 14 | 15 | ENTRY(_test_and_set_bit_be) 16 | eor r0, r0, #0x18 @ big endian byte ordering 17 | ENTRY(_test_and_set_bit_le) 18 | testop orreq, streqb 19 | -------------------------------------------------------------------------------- /src/target/firmware/lib/testchangebit.S: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/arch/arm/lib/testchangebit.S 3 | * 4 | * Copyright (C) 1995-1996 Russell King 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation. 9 | */ 10 | #include 11 | #include 12 | #include "bitops.h" 13 | .text 14 | 15 | ENTRY(_test_and_change_bit_be) 16 | eor r0, r0, #0x18 @ big endian byte ordering 17 | ENTRY(_test_and_change_bit_le) 18 | testop eor, strb 19 | -------------------------------------------------------------------------------- /src/target/firmware/lib/testclearbit.S: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/arch/arm/lib/testclearbit.S 3 | * 4 | * Copyright (C) 1995-1996 Russell King 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation. 9 | */ 10 | #include 11 | #include 12 | #include "bitops.h" 13 | .text 14 | 15 | ENTRY(_test_and_clear_bit_be) 16 | eor r0, r0, #0x18 @ big endian byte ordering 17 | ENTRY(_test_and_clear_bit_le) 18 | testop bicne, strneb 19 | -------------------------------------------------------------------------------- /src/host/gsm48-andreas/issues.txt: -------------------------------------------------------------------------------- 1 | Location updating procedure: 2 | 3 | OpenBSC: 4 | If tx_setup fails during process, the msg must be freed to avoid memory leak. 5 | 6 | OpenBSC: 7 | Must use *_LOC_PRN_S_LU on protocol side. 8 | Or it uses *_LOC_PUN_S_LU to hide private network type (maybe some cfg option) 9 | 10 | OpenBSC: 11 | Wrong channel is assigned when mobile supports TCH only. 12 | 13 | LCR: 14 | Also LCR must use correct location. 15 | For MS support, it must use *_LOC_USER 16 | 17 | mncc.h of openbsc / layer23: 18 | What about putting all (except call structure) to osmocore? 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/shared/libosmocore/debian/changelog: -------------------------------------------------------------------------------- 1 | libosmocore (0.3.0) natty; urgency=low 2 | 3 | * New upstream version of libosmocore 4 | 5 | -- Harald Welte Tue, 10 May 2011 17:28:24 +0200 6 | 7 | libosmocore (0.1.27) natty; urgency=low 8 | 9 | * New upstream version of libosmocore. 10 | 11 | -- Holger Hans Peter Freyther Thu, 13 Jan 2011 18:07:36 +0800 12 | 13 | libosmocore (0.1.17-1) unstable; urgency=low 14 | 15 | * Initial release (Closes: #nnnn) 16 | 17 | -- Harald Welte Tue, 24 Aug 2010 10:55:04 +0200 18 | -------------------------------------------------------------------------------- /src/target/firmware/include/layer1/afc.h: -------------------------------------------------------------------------------- 1 | #ifndef _L1_AFC_H 2 | #define _L1_AFC_H 3 | 4 | #define AFC_SNR_THRESHOLD 2560 /* 2.5 dB in fx6.10 */ 5 | 6 | /* Input a frequency error sample into the AFC averaging */ 7 | void afc_input(int32_t freq_error, uint16_t arfcn, int valid); 8 | 9 | /* Update the AFC with a frequency error, bypassing averaging */ 10 | void afc_correct(int16_t freq_error, uint16_t arfcn); 11 | 12 | /* Update DSP with new AFC DAC value to be used for next TDMA frame */ 13 | void afc_load_dsp(void); 14 | 15 | /* Reset the AFC to its initial DAC value */ 16 | void afc_reset(void); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/host/layer23/src/mobile/Makefile.am: -------------------------------------------------------------------------------- 1 | INCLUDES = $(all_includes) -I$(top_srcdir)/include 2 | AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) 3 | LDADD = ../common/liblayer23.a $(LIBOSMOCORE_LIBS) $(LIBOSMOVTY_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOCODEC_LIBS) 4 | 5 | noinst_LIBRARIES = libmobile.a 6 | libmobile_a_SOURCES = gsm322.c gsm480_ss.c gsm411_sms.c gsm48_cc.c gsm48_mm.c \ 7 | gsm48_rr.c mnccms.c settings.c subscriber.c support.c \ 8 | transaction.c vty_interface.c voice.c mncc_sock.c 9 | 10 | bin_PROGRAMS = mobile 11 | 12 | mobile_SOURCES = main.c app_mobile.c 13 | mobile_LDADD = libmobile.a $(LDADD) 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/shared/libosmocore/src/vty/Makefile.am: -------------------------------------------------------------------------------- 1 | # This is _NOT_ the library release version, it's an API version. 2 | # Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification 3 | LIBVERSION=0:0:0 4 | 5 | INCLUDES = $(all_includes) -I$(top_srcdir)/include 6 | AM_CFLAGS = -fPIC -Wall 7 | 8 | if ENABLE_VTY 9 | lib_LTLIBRARIES = libosmovty.la 10 | 11 | libosmovty_la_SOURCES = buffer.c command.c vty.c vector.c utils.c \ 12 | telnet_interface.c logging_vty.c 13 | libosmovty_la_LDFLAGS = -version-info $(LIBVERSION) 14 | libosmovty_la_LIBADD = $(top_builddir)/src/libosmocore.la 15 | endif 16 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/mobile/mncc_sock.h: -------------------------------------------------------------------------------- 1 | #ifndef _MNCC_SOCK_H 2 | #define _MNCC_SOCK_H 3 | 4 | struct mncc_sock_state { 5 | void *inst; 6 | struct osmo_fd listen_bfd; /* fd for listen socket */ 7 | struct osmo_fd conn_bfd; /* fd for connection to lcr */ 8 | struct llist_head upqueue; 9 | }; 10 | 11 | int mncc_sock_from_cc(struct mncc_sock_state *state, struct msgb *msg); 12 | void mncc_sock_write_pending(struct mncc_sock_state *state); 13 | struct mncc_sock_state *mncc_sock_init(void *inst, const char *name, void *tall_ctx); 14 | void mncc_sock_exit(struct mncc_sock_state *state); 15 | 16 | #endif /* _MNCC_SOCK_H */ 17 | -------------------------------------------------------------------------------- /src/shared/libosmocore/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | # Sample debian/rules that uses debhelper. 4 | # This file was originally written by Joey Hess and Craig Small. 5 | # As a special exception, when this file is copied by dh-make into a 6 | # dh-make output file, you may use that output file without restriction. 7 | # This special exception was added by Craig Small in version 0.37 of dh-make. 8 | 9 | # Uncomment this to turn on verbose mode. 10 | #export DH_VERBOSE=1 11 | 12 | CFLAGS = -Wall -g 13 | 14 | %: 15 | dh --with autoreconf $@ 16 | 17 | #override_dh_strip: 18 | # dh_strip --dbg-package=libosmocore-dbg 19 | 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ========================== 2 | OSMOCOM GSM security tools 3 | ========================== 4 | 5 | These tools allows you to analize gsm security, crack and decript raw GSM 6 | bursts. 7 | 8 | It consists of several additional tools i wrote for analyzing GSM: 9 | 10 | - gsmcrack.py: allows you to crack raw gsm data using predictions. Has also 11 | several automatic tools for deciphering gsm data from phones from which we 12 | can't get KC directly. 13 | - decocde_burst: allows you to decode raw bursts using key or not. 14 | - encode_burst: allows you to encode raw frame data and get raw bursts. 15 | 16 | Usage examples: 17 | --------------- 18 | -------------------------------------------------------------------------------- /src/target/firmware/board/compal/exceptions_redirect.S: -------------------------------------------------------------------------------- 1 | 2 | .section .text.exceptions 3 | _undef_instr: 4 | ldr pc, _vec_undef_instr 5 | _sw_interr: 6 | ldr pc, _vec_sw_interr 7 | _prefetch_abort: 8 | ldr pc, _vec_prefetch_abort 9 | _data_abort: 10 | ldr pc, _vec_data_abort 11 | _reserved: 12 | ldr pc, _vec_reserved 13 | _irq: 14 | ldr pc, _vec_irq 15 | _fiq: 16 | ldr pc, _vec_fiq 17 | 18 | _vec_undef_instr: .word(0x80001c) 19 | _vec_sw_interr: .word(0x800020) 20 | _vec_prefetch_abort: .word(0x800024) 21 | _vec_data_abort: .word(0x800028) 22 | _vec_reserved: .word(0x80002c) 23 | _vec_irq: .word(0x800030) 24 | _vec_fiq: .word(0x800034) 25 | -------------------------------------------------------------------------------- /src/host/gsmmap/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6 2 | 3 | # versioning magic 4 | BUILT_SOURCES = $(top_srcdir)/.version 5 | $(top_srcdir)/.version: 6 | echo $(VERSION) > $@-t && mv $@-t $@ 7 | dist-hook: 8 | echo $(VERSION) > $(distdir)/.tarball-version 9 | 10 | INCLUDES = $(all_includes) -I../layer23/include -DHOST_BUILD 11 | AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) 12 | 13 | sbin_PROGRAMS = gsmmap 14 | 15 | gsmmap_SOURCES = gsmmap.c geo.c locate.c log.c ../layer23/src/common/sysinfo.c ../layer23/src/common/networks.c ../layer23/src/common/logging.c 16 | gsmmap_LDADD = $(LIBOSMOGSM_LIBS) $(LIBOSMOCORE_LIBS) -lm 17 | 18 | -------------------------------------------------------------------------------- /src/target/firmware/lib/setbit.S: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/arch/arm/lib/setbit.S 3 | * 4 | * Copyright (C) 1995-1996 Russell King 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation. 9 | */ 10 | #include 11 | #include 12 | #include "bitops.h" 13 | .text 14 | 15 | /* 16 | * Purpose : Function to set a bit 17 | * Prototype: int set_bit(int bit, void *addr) 18 | */ 19 | ENTRY(_set_bit_be) 20 | eor r0, r0, #0x18 @ big endian byte ordering 21 | ENTRY(_set_bit_le) 22 | bitop orr 23 | -------------------------------------------------------------------------------- /src/target/firmware/lib/changebit.S: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/arch/arm/lib/changebit.S 3 | * 4 | * Copyright (C) 1995-1996 Russell King 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation. 9 | */ 10 | #include 11 | #include 12 | #include "bitops.h" 13 | .text 14 | 15 | /* Purpose : Function to change a bit 16 | * Prototype: int change_bit(int bit, void *addr) 17 | */ 18 | ENTRY(_change_bit_be) 19 | eor r0, r0, #0x18 @ big endian byte ordering 20 | ENTRY(_change_bit_le) 21 | bitop eor 22 | -------------------------------------------------------------------------------- /src/target/firmware/lib/clearbit.S: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/arch/arm/lib/clearbit.S 3 | * 4 | * Copyright (C) 1995-1996 Russell King 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation. 9 | */ 10 | #include 11 | #include 12 | #include "bitops.h" 13 | .text 14 | 15 | /* 16 | * Purpose : Function to clear a bit 17 | * Prototype: int clear_bit(int bit, void *addr) 18 | */ 19 | ENTRY(_clear_bit_be) 20 | eor r0, r0, #0x18 @ big endian byte ordering 21 | ENTRY(_clear_bit_le) 22 | bitop bic 23 | -------------------------------------------------------------------------------- /src/host/osmocon/configure.ac: -------------------------------------------------------------------------------- 1 | dnl Process this file with autoconf to produce a configure script 2 | AC_INIT([osmocon], 3 | m4_esyscmd([./git-version-gen .tarball-version]), 4 | [baseband-devel@lists.osmocom.org]) 5 | 6 | AM_INIT_AUTOMAKE([dist-bzip2]) 7 | 8 | dnl kernel style compile messages 9 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 10 | 11 | dnl checks for programs 12 | AC_PROG_MAKE_SET 13 | AC_PROG_CC 14 | AC_PROG_INSTALL 15 | 16 | dnl checks for libraries 17 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore) 18 | 19 | dnl checks for header files 20 | AC_HEADER_STDC 21 | 22 | dnl Checks for typedefs, structures and compiler characteristics 23 | 24 | AC_OUTPUT( 25 | Makefile) 26 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/core/application.h: -------------------------------------------------------------------------------- 1 | #ifndef OSMO_APPLICATION_H 2 | #define OSMO_APPLICATION_H 3 | 4 | /*! 5 | * \file application.h 6 | * \brief Routines for helping with the osmocom application setup. 7 | */ 8 | 9 | /*! \brief information containing the available logging subsystems */ 10 | struct log_info; 11 | 12 | /*! \brief one instance of a logging target (file, stderr, ...) */ 13 | struct log_target; 14 | 15 | /*! \brief the default logging target, logging to stderr */ 16 | extern struct log_target *osmo_stderr_target; 17 | 18 | void osmo_init_ignore_signals(void); 19 | int osmo_init_logging(const struct log_info *); 20 | 21 | int osmo_daemonize(void); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/target/firmware/include/console.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONSOLE_H 2 | #define _CONSOLE_H 3 | 4 | /* This is the direct (IRQ driven) UART console, bypassing the HDLC layer. 5 | * You should not need to call those functions unless you've decided to 6 | * not use the HLDC layer or have a device with two UARTs */ 7 | 8 | int cons_rb_append(const char *data, int len); 9 | int cons_puts(const char *s); 10 | int cons_putchar(char c); 11 | int cons_rb_flush(void); 12 | void cons_init(void); 13 | 14 | /* We want the console on UART 0 (IRDA UART) */ 15 | #define CONS_UART_NR 0 16 | 17 | /* Size of the static ring-buffer that we keep for console print messages */ 18 | #define CONS_RB_SIZE 4096 19 | 20 | #endif /* _CONSOLE_H */ 21 | -------------------------------------------------------------------------------- /src/target/firmware/include/calypso/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _CAL_TIMER_H 2 | #define _CAL_TIMER_H 3 | 4 | /* Enable or Disable a timer */ 5 | void hwtimer_enable(int num, int on); 6 | 7 | /* Configure pre-scaler and if timer is auto-reload */ 8 | void hwtimer_config(int num, uint8_t pre_scale, int auto_reload); 9 | 10 | /* Load a timer with the given value */ 11 | void hwtimer_load(int num, uint16_t val); 12 | 13 | /* Read the current timer value */ 14 | uint16_t hwtimer_read(int num); 15 | 16 | /* Enable or disable the watchdog */ 17 | void wdog_enable(int on); 18 | 19 | /* Reset cpu using watchdog */ 20 | void wdog_reset(void); 21 | 22 | /* power up the timers */ 23 | void hwtimer_init(void); 24 | 25 | #endif /* _CAL_TIMER_H */ 26 | -------------------------------------------------------------------------------- /src/target/firmware/calypso/arm.c: -------------------------------------------------------------------------------- 1 | 2 | /* enable IRQ+FIQ interrupts */ 3 | void arm_enable_interrupts (void) 4 | { 5 | unsigned long temp; 6 | __asm__ __volatile__("mrs %0, cpsr\n" 7 | "bic %0, %0, #0xc0\n" 8 | "msr cpsr_c, %0" 9 | : "=r" (temp) 10 | : 11 | : "memory"); 12 | } 13 | 14 | /* disable IRQ/FIQ interrupts 15 | * returns true if interrupts had been enabled before we disabled them */ 16 | int arm_disable_interrupts(void) 17 | { 18 | unsigned long old,temp; 19 | __asm__ __volatile__("mrs %0, cpsr\n" 20 | "orr %1, %0, #0xc0\n" 21 | "msr cpsr_c, %1" 22 | : "=r" (old), "=r" (temp) 23 | : 24 | : "memory"); 25 | return (old & 0x80) == 0; 26 | } 27 | -------------------------------------------------------------------------------- /src/host/gsmmap/configure.ac: -------------------------------------------------------------------------------- 1 | dnl Process this file with autoconf to produce a configure script 2 | AC_INIT([gsmmap], 3 | m4_esyscmd([./git-version-gen .tarball-version]), 4 | [baseband-devel@lists.osmocom.org]) 5 | 6 | AM_INIT_AUTOMAKE([dist-bzip2]) 7 | 8 | dnl kernel style compile messages 9 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 10 | 11 | dnl checks for programs 12 | AC_PROG_MAKE_SET 13 | AC_PROG_CC 14 | AC_PROG_INSTALL 15 | 16 | dnl checks for libraries 17 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore) 18 | PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm) 19 | 20 | dnl checks for header files 21 | AC_HEADER_STDC 22 | 23 | dnl Checks for typedefs, structures and compiler characteristics 24 | 25 | AC_OUTPUT( 26 | Makefile) 27 | -------------------------------------------------------------------------------- /src/host/layer23/src/misc/prediction_methods/offset.py: -------------------------------------------------------------------------------- 1 | from predictionMethod import PredictionMethod 2 | 3 | class offset(PredictionMethod): 4 | def Predict(self, frames, args): 5 | 6 | if "offset" not in args: 7 | return (None, None) 8 | 9 | cframe= frames.xpath("/scan/frame[@cipher='1']")[args["offset"]] 10 | print "Start of cipher is at frame", frames.xpath("/scan/frame[@cipher='1']")[0].xpath("burst")[-1].attrib["fn"] 11 | if not cframe: 12 | return (None,None) 13 | 14 | if "prediction" not in args: 15 | return (None,None) 16 | 17 | return (args["prediction"], cframe) 18 | 19 | def __init__(self): 20 | PredictionMethod.__init__(self, "offset", "all") 21 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/common/networks.h: -------------------------------------------------------------------------------- 1 | #ifndef _NETWORKS_H 2 | #define _NETWORKS_H 3 | 4 | #define GSM_INPUT_INVALID 0xffff 5 | 6 | struct gsm_networks { 7 | uint16_t mcc; 8 | int16_t mnc; 9 | const char *name; 10 | }; 11 | 12 | int gsm_match_mcc(uint16_t mcc, char *imsi); 13 | int gsm_match_mnc(uint16_t mcc, uint8_t mnc, char *imsi); 14 | const char *gsm_print_mcc(uint16_t mcc); 15 | const char *gsm_print_mnc(uint16_t mcc); 16 | const char *gsm_get_mcc(uint16_t mcc); 17 | const char *gsm_get_mnc(uint16_t mcc, uint16_t mnc); 18 | const char *gsm_imsi_mcc(char *imsi); 19 | const char *gsm_imsi_mnc(char *imsi); 20 | const uint16_t gsm_input_mcc(char *string); 21 | const uint16_t gsm_input_mnc(char *string); 22 | 23 | #endif /* _NETWORKS_H */ 24 | 25 | -------------------------------------------------------------------------------- /src/target/firmware/include/layer1/tpu_window.h: -------------------------------------------------------------------------------- 1 | #ifndef _L1_TPU_CTRL_H 2 | #define _L1_TPU_CTRL_H 3 | 4 | enum l1_rxwin_type { 5 | L1_RXWIN_PW, /* power measurement */ 6 | L1_RXWIN_FB, /* FCCH burst detection */ 7 | L1_RXWIN_SB, /* SCH burst detection */ 8 | L1_RXWIN_NB, /* Normal burst decoding */ 9 | _NUM_L1_RXWIN 10 | }; 11 | 12 | enum l1_txwin_type { 13 | L1_TXWIN_NB, /* Normal burst sending */ 14 | L1_TXWIN_AB, /* RACH burst sending */ 15 | _NUM_L1_TXWIN 16 | }; 17 | 18 | void l1s_win_init(void); 19 | void l1s_rx_win_ctrl(uint16_t arfcn, enum l1_rxwin_type wtype, uint8_t tn_ofs); 20 | void l1s_tx_win_ctrl(uint16_t arfcn, enum l1_txwin_type wtype, uint8_t pwr, uint8_t tn_ofs); 21 | 22 | void tpu_end_scenario(void); 23 | 24 | #endif /* _L1_TPU_CTRL_H */ 25 | -------------------------------------------------------------------------------- /src/host/layer23/.gitignore: -------------------------------------------------------------------------------- 1 | # autoreconf by-products 2 | *.in 3 | 4 | aclocal.m4 5 | autom4te.cache/ 6 | config.h.in 7 | configure 8 | depcomp 9 | install-sh 10 | missing 11 | 12 | # configure by-products 13 | .deps 14 | Makefile 15 | 16 | config.h 17 | config.log 18 | config.status 19 | 20 | # build by-products 21 | *.o 22 | *.a 23 | 24 | # various 25 | *.sw? 26 | *.deps 27 | *.pyc 28 | 29 | # final executables 30 | src/misc/bcch_scan 31 | src/misc/cbch_sniff 32 | src/misc/cell_log 33 | src/misc/echo_test 34 | src/misc/cbch_sniff 35 | src/misc/ccch_scan 36 | src/misc/layer23 37 | src/misc/burst_decode 38 | src/misc/burst_encode 39 | src/misc/*.dat 40 | src/misc/cell_log_* 41 | src/misc/*.pyc 42 | src/misc/tags 43 | src/misc/KC 44 | src/misc/find_kc 45 | src/mobile/mobile 46 | -------------------------------------------------------------------------------- /src/target/firmware/include/layer1/sched_gsmtime.h: -------------------------------------------------------------------------------- 1 | #ifndef _L1_SCHED_GSMTIME_H 2 | #define _L1_SCHED_GSMTIME_H 3 | 4 | #include 5 | #include 6 | 7 | struct sched_gsmtime_event { 8 | struct llist_head list; 9 | const struct tdma_sched_item *si; 10 | uint32_t fn; 11 | uint16_t p3; /* parameter for TDMA scheduler */ 12 | }; 13 | 14 | /* initialize the GSMTIME scheduler */ 15 | void sched_gsmtime_init(void); 16 | 17 | /* Scheduling of a single event at a givnen GSM time */ 18 | int sched_gsmtime(const struct tdma_sched_item *si, uint32_t fn, uint16_t p3); 19 | 20 | /* execute all GSMTIME one-shot events pending for 'current_fn' */ 21 | int sched_gsmtime_execute(uint32_t current_fn); 22 | 23 | void sched_gsmtime_reset(void); 24 | #endif 25 | -------------------------------------------------------------------------------- /src/target/firmware/include/layer1/avg.h: -------------------------------------------------------------------------------- 1 | #ifndef _L1_AVG_H 2 | #define _L1_AVG_H 3 | 4 | struct running_avg { 5 | /* configuration */ 6 | uint16_t period; /* over how many samples to average */ 7 | uint16_t min_valid; 8 | 9 | int32_t acc_val; 10 | uint16_t num_samples; /* how often did we try to sample? */ 11 | uint16_t num_samples_valid; /* how often did we receive valid samples? */ 12 | 13 | void (*outfn)(struct running_avg *, int32_t avg); 14 | void *priv; 15 | }; 16 | 17 | /* input a new sample into the averaging process */ 18 | void runavg_input(struct running_avg *ravg, int32_t val, int valid); 19 | 20 | /* check if sufficient samples have been obtained, and call outfn() */ 21 | int runavg_check_output(struct running_avg *ravg); 22 | 23 | #endif /* _AVG_H */ 24 | -------------------------------------------------------------------------------- /src/shared/libosmocore/src/gsm/Makefile.am: -------------------------------------------------------------------------------- 1 | # This is _NOT_ the library release version, it's an API version. 2 | # Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification 3 | LIBVERSION=1:1:0 4 | 5 | INCLUDES = $(all_includes) -I$(top_srcdir)/include 6 | AM_CFLAGS = -fPIC -Wall 7 | 8 | lib_LTLIBRARIES = libosmogsm.la 9 | 10 | libosmogsm_la_SOURCES = a5.c rxlev_stat.c tlv_parser.c comp128.c gsm_utils.c \ 11 | rsl.c gsm48.c gsm48_ie.c gsm0808.c sysinfo.c \ 12 | gprs_cipher_core.c gsm0480.c abis_nm.c gsm0502.c \ 13 | gsm0411_utils.c gsm0411_smc.c gsm0411_smr.c \ 14 | lapd_core.c lapdm.c 15 | 16 | libosmogsm_la_LDFLAGS = -version-info $(LIBVERSION) 17 | libosmogsm_la_LIBADD = $(top_builddir)/src/libosmocore.la 18 | -------------------------------------------------------------------------------- /src/target/firmware/include/debug.h: -------------------------------------------------------------------------------- 1 | #ifndef _DEBUG_H 2 | #define _DEBUG_H 3 | 4 | #ifndef ARRAY_SIZE 5 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 6 | #endif 7 | 8 | /* 9 | * Check at compile time that something is of a particular type. 10 | * Always evaluates to 1 so you may use it easily in comparisons. 11 | */ 12 | #define typecheck(type,x) \ 13 | ({ type __dummy; \ 14 | typeof(x) __dummy2; \ 15 | (void)(&__dummy == &__dummy2); \ 16 | 1; \ 17 | }) 18 | 19 | #ifdef DEBUG 20 | #define dputchar(x) putchar(x) 21 | #define dputs(x) puts(x) 22 | #define dphex(x,y) phex(x,y) 23 | #define printd(x, args ...) printf(x, ## args) 24 | #else 25 | #define dputchar(x) 26 | #define dputs(x) 27 | #define dphex(x,y) 28 | #define printd(x, args ...) 29 | #endif 30 | 31 | #endif /* _DEBUG_H */ 32 | -------------------------------------------------------------------------------- /src/target/firmware/include/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef _UART_H 2 | #define _UART_H 3 | 4 | #include 5 | 6 | enum uart_baudrate { 7 | UART_38400, 8 | UART_57600, 9 | UART_115200, 10 | UART_230400, 11 | UART_460800, 12 | UART_614400, 13 | UART_921600, 14 | }; 15 | 16 | void uart_init(uint8_t uart, uint8_t interrupts); 17 | void uart_putchar_wait(uint8_t uart, int c); 18 | int uart_putchar_nb(uint8_t uart, int c); 19 | int uart_getchar_nb(uint8_t uart, uint8_t *ch); 20 | int uart_tx_busy(uint8_t uart); 21 | int uart_baudrate(uint8_t uart, enum uart_baudrate bdrt); 22 | 23 | enum uart_irq { 24 | UART_IRQ_TX_EMPTY, 25 | UART_IRQ_RX_CHAR, 26 | }; 27 | 28 | void uart_irq_enable(uint8_t uart, enum uart_irq irq, int on); 29 | 30 | void uart_poll(uint8_t uart); 31 | 32 | #endif /* _UART_H */ 33 | -------------------------------------------------------------------------------- /src/target/firmware/apps/loader/protocol.h: -------------------------------------------------------------------------------- 1 | 2 | enum loader_command { 3 | /* init message from loader */ 4 | LOADER_INIT, 5 | 6 | /* ping / pong */ 7 | LOADER_PING, 8 | 9 | /* lifecycle requests */ 10 | LOADER_RESET, 11 | LOADER_POWEROFF, 12 | 13 | /* jumps */ 14 | LOADER_JUMP, 15 | LOADER_ENTER_ROM_LOADER, 16 | LOADER_ENTER_FLASH_LOADER, 17 | 18 | /* generic memory ops */ 19 | LOADER_MEM_READ, 20 | LOADER_MEM_WRITE, 21 | 22 | /* flash operations */ 23 | LOADER_FLASH_INFO, 24 | LOADER_FLASH_ERASE, 25 | LOADER_FLASH_UNLOCK, 26 | LOADER_FLASH_LOCK, 27 | LOADER_FLASH_LOCKDOWN, 28 | LOADER_FLASH_GETLOCK, 29 | LOADER_FLASH_PROGRAM, 30 | 31 | }; 32 | 33 | enum loader_flash_lock { 34 | LOADER_FLASH_UNLOCKED = 0, 35 | LOADER_FLASH_LOCKED, 36 | LOADER_FLASH_LOCKED_DOWN, 37 | }; 38 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/gsm/rxlev_stat.h: -------------------------------------------------------------------------------- 1 | #ifndef _OSMOCORE_RXLEV_STATS_H 2 | #define _OSMOCORE_RXLEV_STATS_H 3 | 4 | #define NUM_RXLEVS 32 5 | #define NUM_ARFCNS 1024 6 | 7 | struct rxlev_stats { 8 | /* the maximum number of ARFCN's is 1024, and there are 32 RxLevels, 9 | * so in we keep one 1024bit-bitvec for each RxLev */ 10 | uint8_t rxlev_buckets[NUM_RXLEVS][NUM_ARFCNS/8]; 11 | }; 12 | 13 | void rxlev_stat_input(struct rxlev_stats *st, uint16_t arfcn, uint8_t rxlev); 14 | 15 | /* get the next ARFCN that has the specified Rxlev */ 16 | int16_t rxlev_stat_get_next(const struct rxlev_stats *st, uint8_t rxlev, int16_t arfcn); 17 | 18 | void rxlev_stat_reset(struct rxlev_stats *st); 19 | 20 | void rxlev_stat_dump(const struct rxlev_stats *st); 21 | 22 | #endif /* _OSMOCORE_RXLEV_STATS_H */ 23 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/misc/rslms.h: -------------------------------------------------------------------------------- 1 | #ifndef _OSMOCOM_RSLMS_H 2 | #define _OSMOCOM_RSLMS_H 3 | 4 | #include 5 | #include 6 | 7 | /* From L3 into RSLMS (direction -> L2) */ 8 | 9 | /* Send a 'simple' RLL request to L2 */ 10 | int rslms_tx_rll_req(struct osmocom_ms *ms, uint8_t msg_type, 11 | uint8_t chan_nr, uint8_t link_id); 12 | 13 | /* Send a RLL request (including L3 info) to L2 */ 14 | int rslms_tx_rll_req_l3(struct osmocom_ms *ms, uint8_t msg_type, 15 | uint8_t chan_nr, uint8_t link_id, struct msgb *msg); 16 | 17 | 18 | /* From L2 into RSLMS (direction -> L3) */ 19 | 20 | /* input function that L2 calls when sending messages up to L3 */ 21 | //int rslms_sendmsg(struct msgb *msg, struct osmocom_ms *ms); 22 | 23 | #endif /* _OSMOCOM_RSLMS_H */ 24 | -------------------------------------------------------------------------------- /src/host/osmocon/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6 2 | 3 | # versioning magic 4 | BUILT_SOURCES = $(top_srcdir)/.version 5 | $(top_srcdir)/.version: 6 | echo $(VERSION) > $@-t && mv $@-t $@ 7 | dist-hook: 8 | echo $(VERSION) > $(distdir)/.tarball-version 9 | 10 | INCLUDES = $(all_includes) -I$(top_srcdir)/include 11 | AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) 12 | 13 | sbin_PROGRAMS = osmocon osmoload 14 | 15 | # FIXME: sercomm needs to move into libosmocore or another shared lib 16 | INCLUDES += -I../../target/firmware/include/comm -I../../target/firmware/apps -DHOST_BUILD 17 | osmocon_SOURCES = osmocon.c tpu_debug.c ../../target/firmware/comm/sercomm.c 18 | osmocon_LDADD = $(LIBOSMOCORE_LIBS) 19 | 20 | osmoload_SOURCE = osmoload.c ../../target/firmware/comm/sercomm.c 21 | osmoload_LDADD = $(LIBOSMOCORE_LIBS) 22 | -------------------------------------------------------------------------------- /include/osmocore/rsl.h: -------------------------------------------------------------------------------- 1 | #ifndef _OSMOCORE_RSL_H 2 | #define _OSMOCORE_RSL_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | void rsl_init_rll_hdr(struct abis_rsl_rll_hdr *dh, uint8_t msg_type); 9 | 10 | extern const struct tlv_definition rsl_att_tlvdef; 11 | #define rsl_tlv_parse(dec, buf, len) \ 12 | tlv_parse(dec, &rsl_att_tlvdef, buf, len, 0, 0) 13 | 14 | /* encode channel number as per Section 9.3.1 */ 15 | uint8_t rsl_enc_chan_nr(uint8_t type, uint8_t subch, uint8_t timeslot); 16 | 17 | const struct value_string rsl_rlm_cause_strs[]; 18 | 19 | const char *rsl_err_name(uint8_t err); 20 | 21 | /* Section 3.3.2.3 TS 05.02. I think this looks like a table */ 22 | int rsl_ccch_conf_to_bs_cc_chans(int ccch_conf); 23 | 24 | #endif /* _OSMOCORE_RSL_H */ 25 | -------------------------------------------------------------------------------- /src/target/firmware/lib/bitops.h: -------------------------------------------------------------------------------- 1 | .macro bitop, instr 2 | and r2, r0, #7 3 | mov r3, #1 4 | mov r3, r3, lsl r2 5 | save_and_disable_irqs ip 6 | ldrb r2, [r1, r0, lsr #3] 7 | \instr r2, r2, r3 8 | strb r2, [r1, r0, lsr #3] 9 | restore_irqs ip 10 | mov pc, lr 11 | .endm 12 | 13 | /** 14 | * testop - implement a test_and_xxx_bit operation. 15 | * @instr: operational instruction 16 | * @store: store instruction 17 | * 18 | * Note: we can trivially conditionalise the store instruction 19 | * to avoid dirting the data cache. 20 | */ 21 | .macro testop, instr, store 22 | add r1, r1, r0, lsr #3 23 | and r3, r0, #7 24 | mov r0, #1 25 | save_and_disable_irqs ip 26 | ldrb r2, [r1] 27 | tst r2, r0, lsl r3 28 | \instr r2, r2, r0, lsl r3 29 | \store r2, [r1] 30 | restore_irqs ip 31 | moveq r0, #0 32 | mov pc, lr 33 | .endm 34 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_12.h: -------------------------------------------------------------------------------- 1 | #ifndef PROTO_GSM_04_12_H 2 | #define PROTO_GSM_04_12_H 3 | 4 | #include 5 | 6 | /* GSM TS 04.12 definitions for Short Message Service Cell Broadcast */ 7 | 8 | #define GSM412_SEQ_FST_BLOCK 0x0 9 | #define GSM412_SEQ_SND_BLOCK 0x1 10 | #define GSM412_SEQ_TRD_BLOCK 0x2 11 | #define GSM412_SEQ_FTH_BLOCK 0x3 12 | #define GSM412_SEQ_FST_SCHED_BLOCK 0x8 13 | #define GSM412_SEQ_NULL_MSG 0xf 14 | 15 | struct gsm412_block_type { 16 | uint8_t seq_nr : 4, 17 | lb : 1, 18 | lpd : 2, 19 | spare : 1; 20 | } __attribute__((packed)); 21 | 22 | struct gsm412_sched_msg { 23 | uint8_t beg_slot_nr : 6, 24 | type : 2; 25 | uint8_t end_slot_nr : 6, 26 | spare1 : 1, spare2: 1; 27 | uint8_t cbsms_msg_map[6]; 28 | uint8_t data[0]; 29 | } __attribute__((packed)); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/target/firmware/board/compal_e88/MEMORY_MAP.txt: -------------------------------------------------------------------------------- 1 | The Compal E88 has the following physical memory map: 2 | 3 | /* 2 MBytes of external flash memory */ 4 | FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x200000 5 | /* 256 kBytes of internal zero-waitstate sram */ 6 | IRAM (rw) : ORIGIN = 0x00800000, LENGTH = 0x040000 7 | /* 256 kBytes of external slow sram */ 8 | ERAM (rw) : ORIGIN = 0x01000000, LENGTH = 0x040000 9 | 10 | The flash layout, as distributed, is: 11 | 12 | 0x00000000 0x2000 Compal loader 13 | 0x00002000 >>>>>> Compal application and storage 14 | 15 | Our flash layout is: 16 | 17 | 0x00000000 0x2000 Compal loader 18 | 0x00002000 0xE000 OSMOCOM loader (see LINKAGE.txt for reasoning) 19 | 0x00010000 >>>>>> OSMOCOM application and storage 20 | 21 | (XXX: determine storage location / storage descriptor location) 22 | -------------------------------------------------------------------------------- /src/host/layer23/src/misc/Makefile.am: -------------------------------------------------------------------------------- 1 | INCLUDES = $(all_includes) -I$(top_srcdir)/include 2 | AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) 3 | LDADD = ../common/liblayer23.a $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOCODEC_LIBS) 4 | 5 | bin_PROGRAMS = bcch_scan ccch_scan echo_test cell_log cbch_sniff burst_decode burst_encode 6 | 7 | bcch_scan_SOURCES = ../common/main.c app_bcch_scan.c bcch_scan.c 8 | ccch_scan_SOURCES = ../common/main.c app_ccch_scan.c rslms.c xcch.c 9 | echo_test_SOURCES = ../common/main.c app_echo_test.c 10 | cell_log_LDADD = $(LDADD) -lm 11 | cell_log_SOURCES = ../common/main.c app_cell_log.c cell_log.c \ 12 | ../../../gsmmap/geo.c 13 | cbch_sniff_SOURCES = ../common/main.c app_cbch_sniff.c 14 | burst_decode_SOURCES = burst_decode_main.c burst_decode.c xcch.c 15 | burst_encode_SOURCES = burst_decode_main.c burst_encode.c xcch.c 16 | -------------------------------------------------------------------------------- /src/shared/libosmocore/.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | .deps 4 | .libs 5 | *.o 6 | *.lo 7 | *.la 8 | *.pc 9 | aclocal.m4 10 | acinclude.m4 11 | aminclude.am 12 | m4/*.m4 13 | autom4te.cache 14 | config.h* 15 | config.sub 16 | config.log 17 | config.status 18 | config.guess 19 | configure 20 | depcomp 21 | missing 22 | ltmain.sh 23 | install-sh 24 | stamp-h1 25 | libtool 26 | libosmocore-*.tar.* 27 | 28 | Doxyfile.core 29 | Doxyfile.gsm 30 | Doxyfile.vty 31 | Doxyfile.codec 32 | 33 | .tarball-version 34 | .version 35 | 36 | tests/sms/sms_test 37 | tests/timer/timer_test 38 | tests/msgfile/msgfile_test 39 | tests/ussd/ussd_test 40 | tests/smscb/smscb_test 41 | tests/bits/bitrev_test 42 | 43 | utils/osmo-arfcn 44 | 45 | doc/codec 46 | doc/core 47 | doc/vty 48 | doc/gsm 49 | doc/html.tar 50 | 51 | src/crc*gen.c 52 | include/osmocom/core/crc*gen.h 53 | 54 | build-host 55 | build-target 56 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/core/Makefile.am: -------------------------------------------------------------------------------- 1 | osmocore_HEADERS = signal.h linuxlist.h timer.h select.h msgb.h bits.h \ 2 | bitvec.h statistics.h utils.h socket.h \ 3 | gsmtap.h write_queue.h prim.h \ 4 | logging.h rate_ctr.h gsmtap_util.h \ 5 | crc16.h panic.h process.h linuxrbtree.h \ 6 | backtrace.h conv.h application.h \ 7 | crcgen.h crc8gen.h crc16gen.h crc32gen.h crc64gen.h 8 | 9 | noinst_HEADERS = timer_compat.h 10 | 11 | if ENABLE_PLUGIN 12 | osmocore_HEADERS += plugin.h 13 | endif 14 | 15 | if ENABLE_TALLOC 16 | osmocore_HEADERS += talloc.h 17 | endif 18 | 19 | if ENABLE_MSGFILE 20 | osmocore_HEADERS += msgfile.h 21 | endif 22 | 23 | if ENABLE_SERIAL 24 | osmocore_HEADERS += serial.h 25 | endif 26 | 27 | osmocoredir = $(includedir)/osmocom/core 28 | 29 | crc%gen.h: crcXXgen.h.tpl 30 | @echo " SED $< -> $@" 31 | @sed -e's/XX/$*/g' $< > $@ 32 | -------------------------------------------------------------------------------- /src/target/firmware/include/rffe.h: -------------------------------------------------------------------------------- 1 | #ifndef _RFFE_H 2 | #define _RFFE_H 3 | 4 | #include 5 | 6 | extern const uint8_t system_inherent_gain; 7 | 8 | /* initialize RF Frontend */ 9 | void rffe_init(void); 10 | 11 | /* switch RF Frontend Mode */ 12 | void rffe_mode(enum gsm_band band, int tx); 13 | 14 | /* query RF wiring */ 15 | enum rffe_port 16 | { 17 | PORT_LO = 0, /* Combined 850/900 port */ 18 | PORT_HI = 1, /* Combined 1800/1900 port */ 19 | PORT_GSM850 = 2, 20 | PORT_GSM900 = 3, 21 | PORT_DCS1800 = 4, 22 | PORT_PCS1900 = 5, 23 | }; 24 | 25 | uint32_t rffe_get_rx_ports(void); 26 | uint32_t rffe_get_tx_ports(void); 27 | 28 | /* get current gain of RF frontend (anything between antenna and baseband in dBm */ 29 | uint8_t rffe_get_gain(void); 30 | 31 | void rffe_set_gain(uint8_t dbm); 32 | 33 | void rffe_compute_gain(int16_t exp_inp, int16_t target_bb); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/host/osmocon/memdump_convert.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | my $num_line = 0; 4 | my $num_hex = 0; 5 | my $oldaddr; 6 | 7 | while (my $line = ) { 8 | chomp($line); 9 | $num_line++; 10 | my (@hex) = $line =~ /(\w{8}): (\w{8}) (\w{8}) (\w{8}) (\w{8}) (\w{8}) (\w{8}) (\w{8}) (\w{8})/; 11 | my $addr = hex(shift @hex); 12 | if ($addr != 0 && $addr != $oldaddr + 0x20) { 13 | printf(STDERR "gap of %u between 0x%08x and 0x%08x\n%s\n", 14 | $addr - $oldaddr, $addr, $oldaddr, $line); 15 | } 16 | foreach my $h (@hex) { 17 | $num_hex++; 18 | # poor mans endian conversion 19 | my ($a, $b, $c, $d) = $h =~/(\w\w)(\w\w)(\w\w)(\w\w)/; 20 | my $h_reorder = $d . $c . $b . $a; 21 | # convert into actual binary number 22 | my $tmp = pack('H8', $h_reorder); 23 | syswrite(STDOUT, $tmp, 4); 24 | } 25 | $oldaddr = $addr; 26 | } 27 | 28 | printf(STDERR "num lines/num hex: %u/%u\n", $num_line, $num_hex); 29 | 30 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/gsm/gsm0480.h: -------------------------------------------------------------------------------- 1 | #ifndef gsm0480_h 2 | #define gsm0480_h 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #define MAX_LEN_USSD_STRING 31 9 | 10 | struct ussd_request { 11 | uint8_t text[MAX_LEN_USSD_STRING + 1]; 12 | uint8_t transaction_id; 13 | uint8_t invoke_id; 14 | }; 15 | 16 | int gsm0480_decode_ussd_request(const struct gsm48_hdr *hdr, uint16_t len, 17 | struct ussd_request *request); 18 | 19 | struct msgb *gsm0480_create_ussd_resp(uint8_t invoke_id, uint8_t trans_id, const char *text); 20 | struct msgb *gsm0480_create_unstructuredSS_Notify(int alertPattern, const char *text); 21 | struct msgb *gsm0480_create_notifySS(const char *text); 22 | 23 | int gsm0480_wrap_invoke(struct msgb *msg, int op, int link_id); 24 | int gsm0480_wrap_facility(struct msgb *msg); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/codec/codec.h: -------------------------------------------------------------------------------- 1 | #ifndef _OSMOCOM_CODEC_H 2 | #define _OSMOCOM_CODEC_H 3 | 4 | #include 5 | 6 | extern uint16_t gsm610_bitorder[]; /* FR */ 7 | extern uint16_t gsm620_unvoiced_bitorder[]; /* HR unvoiced */ 8 | extern uint16_t gsm620_voiced_bitorder[]; /* HR voiced */ 9 | extern uint16_t gsm660_bitorder[]; /* EFR */ 10 | 11 | extern uint16_t gsm690_12_2_bitorder[]; /* AMR 12.2 kbits */ 12 | extern uint16_t gsm690_10_2_bitorder[]; /* AMR 10.2 kbits */ 13 | extern uint16_t gsm690_7_95_bitorder[]; /* AMR 7.95 kbits */ 14 | extern uint16_t gsm690_7_4_bitorder[]; /* AMR 7.4 kbits */ 15 | extern uint16_t gsm690_6_7_bitorder[]; /* AMR 6.7 kbits */ 16 | extern uint16_t gsm690_5_9_bitorder[]; /* AMR 5.9 kbits */ 17 | extern uint16_t gsm690_5_15_bitorder[]; /* AMR 5.15 kbits */ 18 | extern uint16_t gsm690_4_75_bitorder[]; /* AMR 4.75 kbits */ 19 | 20 | #endif /* _OSMOCOM_CODEC_H */ 21 | -------------------------------------------------------------------------------- /src/target/firmware/include/calypso/buzzer.h: -------------------------------------------------------------------------------- 1 | #ifndef _CAL_BUZZER_H 2 | #define _CAL_BUZZER_H 3 | 4 | #define NOTE(n,oct) (n<<2 | (oct & 0x03)) 5 | 6 | #define NOTE_E 0x00 7 | #define NOTE_DIS 0x01 8 | #define NOTE_D 0x02 9 | #define NOTE_CIS 0x03 10 | #define NOTE_C 0x04 11 | #define NOTE_H 0x05 12 | #define NOTE_AIS 0x06 13 | #define NOTE_A 0x07 14 | #define NOTE_GIS 0x08 15 | #define NOTE_G 0x09 16 | #define NOTE_FIS 0x0A 17 | #define NOTE_F 0x0B 18 | 19 | #define OCTAVE_5 OCTAVE(0x00) 20 | #define OCTAVE_4 OCTAVE(0x01) 21 | #define OCTAVE_3 OCTAVE(0x02) 22 | #define OCTAVE_2 OCTAVE(0x03) 23 | #define OCTAVE_1 OCTAVE(0x04) 24 | 25 | #define OCTAVE(m) (m>NOTE_C?m+1:m) 26 | 27 | /* Switch buzzer to PWT mode (or back) */ 28 | void buzzer_mode_pwt(int on); 29 | /* Set the buzzer level */ 30 | void buzzer_volume(uint8_t level); 31 | /* Set the buzzer note */ 32 | void buzzer_note(uint8_t note); 33 | 34 | #endif /* _CAL_BUZZER_H */ 35 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/core/crc16.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This was copied from the linux kernel and adjusted for our types. 3 | */ 4 | /* 5 | * crc16.h - CRC-16 routine 6 | * 7 | * Implements the standard CRC-16: 8 | * Width 16 9 | * Poly 0x8005 (x^16 + x^15 + x^2 + 1) 10 | * Init 0 11 | * 12 | * Copyright (c) 2005 Ben Gardner 13 | * 14 | * This source code is licensed under the GNU General Public License, 15 | * Version 2. See the file COPYING for more details. 16 | */ 17 | 18 | #ifndef __CRC16_H 19 | #define __CRC16_H 20 | 21 | #include 22 | 23 | #include 24 | 25 | extern uint16_t const osmo_crc16_table[256]; 26 | 27 | extern uint16_t osmo_crc16(uint16_t crc, const uint8_t *buffer, size_t len); 28 | 29 | static inline uint16_t osmo_crc16_byte(uint16_t crc, const uint8_t data) 30 | { 31 | return (crc >> 8) ^ osmo_crc16_table[(crc ^ data) & 0xff]; 32 | } 33 | 34 | #endif /* __CRC16_H */ 35 | -------------------------------------------------------------------------------- /src/target/ui-experiment/png2tiny.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | enum { 7 | FORMAT_NONE, 8 | FORMAT_C 9 | }; 10 | 11 | void 12 | version(const char *name) { 13 | puts(name); 14 | //printf("%s rev %s\n", name, REVISION); 15 | exit(2); 16 | } 17 | 18 | void 19 | usage(const char *name) { 20 | printf("Usage: %s [-hv] [-f outfmt] [-s outsym] \n"); 21 | exit(2); 22 | } 23 | 24 | int 25 | main(int argc, char **argv) { 26 | int opt, outfmt; 27 | const char *outsym = NULL; 28 | SDL_Surface *img; 29 | 30 | while((opt = getopt(argc, argv, "f:s:hv")) != -1) { 31 | switch(opt) { 32 | case 'f': 33 | if(!strcmp(optarg, "c")) { 34 | outfmt = FORMAT_C; 35 | } 36 | break; 37 | case 's': 38 | outsym = optarg; 39 | break; 40 | case 'v': 41 | version(argv[0]); 42 | break; 43 | case 'h': 44 | default: 45 | usage(argv[0]); 46 | break; 47 | } 48 | } 49 | 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/common/l23_app.h: -------------------------------------------------------------------------------- 1 | #ifndef _L23_APP_H 2 | #define _L23_APP_H 3 | 4 | struct option; 5 | 6 | /* Options supported by the l23 app */ 7 | enum { 8 | L23_OPT_SAP = 1, 9 | L23_OPT_ARFCN = 2, 10 | L23_OPT_TAP = 4, 11 | L23_OPT_VTY = 8, 12 | L23_OPT_DBG = 16, 13 | }; 14 | 15 | /* initialization, called once when starting the app, before entering 16 | * select loop */ 17 | extern int l23_app_init(struct osmocom_ms *ms); 18 | extern int (*l23_app_work) (struct osmocom_ms *ms); 19 | extern int (*l23_app_exit) (struct osmocom_ms *ms); 20 | 21 | /* configuration options */ 22 | struct l23_app_info { 23 | const char *copyright; 24 | const char *contribution; 25 | 26 | char *getopt_string; 27 | int (*cfg_supported)(); 28 | int (*cfg_print_help)(); 29 | int (*cfg_getopt_opt)(struct option **options); 30 | int (*cfg_handle_opt)(int c,const char *optarg); 31 | }; 32 | 33 | extern struct l23_app_info *l23_app_info(); 34 | 35 | #endif /* _L23_APP_H */ 36 | -------------------------------------------------------------------------------- /src/target/firmware/include/calypso/tsp.h: -------------------------------------------------------------------------------- 1 | #ifndef _CALYPSO_TSP_H 2 | #define _CALYPSO_TSP_H 3 | 4 | #define TSPACT(x) (1 << x) 5 | #define TSPEN(x) (x) 6 | 7 | /* initiate a TSP write through the TPU */ 8 | void tsp_write(uint8_t dev_idx, uint8_t bitlen, uint32_t dout); 9 | 10 | /* Configure clock edge and chip enable polarity for a device */ 11 | void tsp_setup(uint8_t dev_idx, int clk_rising, int en_positive, int en_edge); 12 | 13 | /* Obtain the current tspact state */ 14 | uint16_t tsp_act_state(void); 15 | 16 | /* Update the TSPACT state, including enable and disable */ 17 | void tsp_act_update(uint16_t new_act); 18 | 19 | /* Enable one or multiple TSPACT signals */ 20 | void tsp_act_enable(uint16_t bitmask); 21 | 22 | /* Disable one or multiple TSPACT signals */ 23 | void tsp_act_disable(uint16_t bitmask); 24 | 25 | /* Toggle one or multiple TSPACT signals */ 26 | void tsp_act_toggle(uint16_t bitmask); 27 | 28 | /* Initialize TSP driver */ 29 | void tsp_init(void); 30 | 31 | #endif /* _CALYPSO_TSP_H */ 32 | -------------------------------------------------------------------------------- /src/target/ui-experiment/display.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _UI_DISPLAY_H 3 | #define _UI_DISPLAY_H 4 | 5 | #include 6 | #include 7 | 8 | /** 9 | * Displays - physical display devices 10 | * 11 | * This layer is introduced tentatively, expecting use 12 | * of OSMOCOM on multi-display phones, most likely 13 | * with a main screen and a cover screen. 14 | * 15 | */ 16 | struct display { 17 | const char *name; 18 | 19 | pxtype_t pixeltype; 20 | pxsize_t width; 21 | pxsize_t height; 22 | 23 | /* We always operate on an in-memory frame buffer that 24 | * can be put on display using damage functions provided 25 | * by the image class. 26 | */ 27 | struct image *fbuf; 28 | 29 | /* 30 | * We display a top-level widget. 31 | */ 32 | struct widget *widget; 33 | 34 | /* 35 | * We hold a graphics context, configured for the target 36 | * pixel format. 37 | */ 38 | struct graphics *graphics; 39 | 40 | 41 | void (*draw) (struct display *display); 42 | 43 | void *priv; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/core/socket.h: -------------------------------------------------------------------------------- 1 | #ifndef _OSMOCORE_SOCKET_H 2 | #define _OSMOCORE_SOCKET_H 3 | 4 | /*! \defgroup socket Socket convenience functions 5 | * @{ 6 | */ 7 | 8 | /*! \file socket.h 9 | * \brief Osmocom socket convenience functions 10 | */ 11 | 12 | #include 13 | 14 | struct sockaddr; 15 | 16 | /* flags for osmo_sock_init. */ 17 | #define OSMO_SOCK_F_CONNECT (1 << 0) 18 | #define OSMO_SOCK_F_BIND (1 << 1) 19 | #define OSMO_SOCK_F_NONBLOCK (1 << 2) 20 | 21 | int osmo_sock_init(uint16_t family, uint16_t type, uint8_t proto, 22 | const char *host, uint16_t port, unsigned int flags); 23 | 24 | int osmo_sock_init_ofd(struct osmo_fd *ofd, int family, int type, int proto, 25 | const char *host, uint16_t port, unsigned int flags); 26 | 27 | int osmo_sock_init_sa(struct sockaddr *ss, uint16_t type, 28 | uint8_t proto, unsigned int flags); 29 | 30 | int osmo_sockaddr_is_local(struct sockaddr *addr, unsigned int addrlen); 31 | 32 | /*! }@ */ 33 | 34 | #endif /* _OSMOCORE_SOCKET_H */ 35 | -------------------------------------------------------------------------------- /src/target/firmware/Makefile.mtk: -------------------------------------------------------------------------------- 1 | # List of all supported boards (meant to be overridden on command line) 2 | BOARDS?=mt62xx 3 | 4 | # List of all applications (meant to be overridden on command line) 5 | APPLICATIONS?=loader_mtk 6 | 7 | mtkram_LDS=board/mediatek/ram.lds 8 | mtkram_OBJS=board/mediatek/start.ram.o 9 | 10 | mtk_COMMON_OBJS=board/mediatek/uart.o 11 | 12 | # Mediatek MT62xx 13 | mt62xx_OBJS=$(mtk_COMMON_OBJS) board/mt62xx/init.o 14 | mt62xx_ENVIRONMENTS=mtkram 15 | 16 | # Global include path 17 | INCLUDES=-Iinclude/ -I../../../include -I../../shared/libosmocore/include 18 | 19 | FLASH_OBJS=flash/cfi_flash.o 20 | 21 | # Objects that go in all applications 22 | ANY_APP_OBJS+=$(FLASH_OBJS) 23 | 24 | # Various objects that are currently linked into all applications 25 | ANY_APP_LIBS+=lib/libmini.a comm/libcomm.a ../../shared/libosmocore/build-target/src/.libs/libosmocore.a 26 | 27 | # Libraries are defined in subdirectories 28 | -include comm/Makefile 29 | -include lib/Makefile 30 | 31 | # Include rules 32 | -include Makefile.inc 33 | -------------------------------------------------------------------------------- /src/target/firmware/include/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef _MEMORY_H 2 | #define _MEMORY_H 3 | 4 | #define __arch_getb(a) (*(volatile unsigned char *)(a)) 5 | #define __arch_getw(a) (*(volatile unsigned short *)(a)) 6 | #define __arch_getl(a) (*(volatile unsigned int *)(a)) 7 | 8 | #define __arch_putb(v,a) (*(volatile unsigned char *)(a) = (v)) 9 | #define __arch_putw(v,a) (*(volatile unsigned short *)(a) = (v)) 10 | #define __arch_putl(v,a) (*(volatile unsigned int *)(a) = (v)) 11 | 12 | #define __raw_writeb(v,a) __arch_putb(v,a) 13 | #define __raw_writew(v,a) __arch_putw(v,a) 14 | #define __raw_writel(v,a) __arch_putl(v,a) 15 | 16 | #define __raw_readb(a) __arch_getb(a) 17 | #define __raw_readw(a) __arch_getw(a) 18 | #define __raw_readl(a) __arch_getl(a) 19 | 20 | #define writeb(v,a) __arch_putb(v,a) 21 | #define writew(v,a) __arch_putw(v,a) 22 | #define writel(v,a) __arch_putl(v,a) 23 | 24 | #define readb(a) __arch_getb(a) 25 | #define readw(a) __arch_getw(a) 26 | #define readl(a) __arch_getl(a) 27 | 28 | #endif /* _MEMORY_H */ 29 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/misc/cell_log.h: -------------------------------------------------------------------------------- 1 | /* Cell Scanning code for OsmocomBB */ 2 | 3 | /* (C) 2010 by Andreas Eversberg 4 | * 5 | * All Rights Reserved 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | */ 22 | 23 | int scan_init(struct osmocom_ms *_ms); 24 | int scan_exit(void); 25 | 26 | -------------------------------------------------------------------------------- /src/shared/libosmocore/debian/control: -------------------------------------------------------------------------------- 1 | Source: libosmocore 2 | Section: libs 3 | Priority: optional 4 | Maintainer: Harald Welte 5 | Build-Depends: debhelper (>= 7.0.50~), autotools-dev, autoconf, automake, libtool, dh-autoreconf 6 | Standards-Version: 3.8.4 7 | Homepage: http://bb.osmocom.org/trac/wiki/libosmocore 8 | Vcs-Git: git://git.osmocom.org/libosmocore.git 9 | Vcs-Browser: http://git.osmocom.org/gitweb?p=libosmocore.git;a=summary 10 | 11 | Package: libosmocore 12 | Section: libs 13 | Architecture: any 14 | Depends: ${shlibs:Depends}, ${misc:Depends} 15 | Description: Open Source MObile COMmunications CORE library 16 | 17 | Package: libosmocore-dev 18 | Section: libdevel 19 | Architecture: any 20 | Depends: ${shlibs:Depends}, ${misc:Depends}, libosmocore 21 | Description: Development headers for Open Source MObile COMmunications CORE library 22 | 23 | #Package: libosmocore-dbg 24 | #Section: libdevel 25 | #Architecture: any 26 | #Depends: ${shlibs:Depends}, ${misc:Depends} 27 | #Description: Debug symbols for Open Source MObile COMmunications CORE library 28 | -------------------------------------------------------------------------------- /src/target/firmware/include/flash/cfi_flash.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _CFI_FLASH_H 3 | #define _CFI_FLASH_H 4 | 5 | #include 6 | 7 | #define FLASH_MAX_REGIONS 4 8 | 9 | typedef struct { 10 | void *fr_base; 11 | size_t fr_bnum; 12 | size_t fr_bsize; 13 | } flash_region_t; 14 | 15 | typedef struct { 16 | void *f_base; 17 | size_t f_size; 18 | 19 | size_t f_nregions; 20 | flash_region_t f_regions[FLASH_MAX_REGIONS]; 21 | } flash_t; 22 | 23 | typedef enum { 24 | FLASH_UNLOCKED = 0, 25 | FLASH_LOCKED, 26 | FLASH_LOCKED_DOWN 27 | } flash_lock_t; 28 | 29 | int flash_init(flash_t *flash, void *base_addr); 30 | 31 | flash_lock_t flash_block_getlock(flash_t *flash, uint32_t block_offset); 32 | 33 | int flash_block_unlock(flash_t *flash, uint32_t block_offset); 34 | int flash_block_lock(flash_t *flash, uint32_t block_offset); 35 | int flash_block_lockdown(flash_t *flash, uint32_t block_offset); 36 | 37 | int flash_block_erase(flash_t *flash, uint32_t block_offset); 38 | 39 | int flash_program(flash_t *flash, uint32_t dst_offset, void *src, uint32_t nbytes); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/shared/libosmocore/tests/bits/bitrev_test.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | static const uint8_t input[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; 11 | static const uint8_t exp_out[] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; 12 | 13 | int main(int argc, char **argv) 14 | { 15 | uint8_t out[ARRAY_SIZE(input)]; 16 | unsigned int offs; 17 | 18 | for (offs = 0; offs < sizeof(out); offs++) { 19 | uint8_t *start = out + offs; 20 | uint8_t len = sizeof(out) - offs; 21 | 22 | memcpy(out, input, sizeof(out)); 23 | 24 | printf("INORDER: %s\n", osmo_hexdump(start, len)); 25 | osmo_revbytebits_buf(start, len); 26 | printf("REVERSED: %s\n", osmo_hexdump(start, len)); 27 | if (memcmp(start, exp_out + offs, len)) { 28 | printf("EXPECTED: %s\n", osmo_hexdump(exp_out+offs, len)); 29 | fprintf(stderr, "REVERSED != EXPECTED!\n"); 30 | exit(1); 31 | } 32 | printf("\n"); 33 | } 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/mobile/gsm411_sms.h: -------------------------------------------------------------------------------- 1 | #ifndef _GSM411_SMS_H 2 | #define _GSM411_SMS_H 3 | 4 | #define SMS_HDR_SIZE 128 5 | #define SMS_TEXT_SIZE 256 6 | 7 | struct gsm_sms { 8 | unsigned long validity_minutes; 9 | uint8_t reply_path_req; 10 | uint8_t status_rep_req; 11 | uint8_t ud_hdr_ind; 12 | uint8_t protocol_id; 13 | uint8_t data_coding_scheme; 14 | uint8_t msg_ref; 15 | char address[20+1]; /* DA LV is 12 bytes max, i.e. 10 bytes 16 | * BCD == 20 bytes string */ 17 | time_t time; 18 | uint8_t user_data_len; 19 | uint8_t user_data[SMS_TEXT_SIZE]; 20 | 21 | char text[SMS_TEXT_SIZE]; 22 | }; 23 | 24 | int gsm411_sms_init(struct osmocom_ms *ms); 25 | int gsm411_sms_exit(struct osmocom_ms *ms); 26 | struct gsm_sms *sms_alloc(void); 27 | void sms_free(struct gsm_sms *sms); 28 | struct gsm_sms *sms_from_text(const char *receiver, int dcs, const char *text); 29 | int gsm411_rcv_sms(struct osmocom_ms *ms, struct msgb *msg); 30 | int sms_send(struct osmocom_ms *ms, const char *sms_sca, const char *number, 31 | const char *text); 32 | 33 | #endif /* _GSM411_SMS_H */ 34 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/gsm/gsm0411_utils.h: -------------------------------------------------------------------------------- 1 | #ifndef _GSM0411_UTILS_H 2 | #define _GSM0411_UTILS_H 3 | 4 | struct msgb *gsm411_msgb_alloc(void); 5 | 6 | /* Generate 03.40 TP-SCTS */ 7 | void gsm340_gen_scts(uint8_t *scts, time_t time); 8 | 9 | /* Decode 03.40 TP-SCTS (into utc/gmt timestamp) */ 10 | time_t gsm340_scts(uint8_t *scts); 11 | 12 | /* decode validity period. return minutes */ 13 | unsigned long gsm340_validity_period(uint8_t sms_vpf, uint8_t *sms_vp); 14 | 15 | /* determine coding alphabet dependent on GSM 03.38 Section 4 DCS */ 16 | enum sms_alphabet gsm338_get_sms_alphabet(uint8_t dcs); 17 | 18 | /* generate a TPDU address field compliant with 03.40 sec. 9.1.2.5 */ 19 | int gsm340_gen_oa(uint8_t *oa, unsigned int oa_len, uint8_t type, 20 | uint8_t plan, const char *number); 21 | 22 | /* Prefix msg with a RP header */ 23 | int gsm411_push_rp_header(struct msgb *msg, uint8_t rp_msg_type, 24 | uint8_t rp_msg_ref); 25 | 26 | /* Prefix msg with a 04.08/04.11 CP header */ 27 | int gsm411_push_cp_header(struct msgb *msg, uint8_t proto, uint8_t trans, 28 | uint8_t msg_type); 29 | 30 | #endif /* _GSM0411_UTILS_H */ 31 | -------------------------------------------------------------------------------- /src/host/layer23/configure.ac: -------------------------------------------------------------------------------- 1 | dnl Process this file with autoconf to produce a configure script 2 | AC_INIT 3 | 4 | AM_INIT_AUTOMAKE(layer23, 0.0.0) 5 | 6 | dnl kernel style compile messages 7 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 8 | 9 | dnl checks for programs 10 | AC_PROG_MAKE_SET 11 | AC_PROG_CC 12 | AC_PROG_INSTALL 13 | AC_PROG_RANLIB 14 | 15 | dnl checks for libraries 16 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore) 17 | PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty) 18 | PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm) 19 | PKG_CHECK_MODULES(LIBOSMOCODEC, libosmocodec) 20 | AC_CHECK_LIB(gps, gps_waiting, CFLAGS+=" -D_HAVE_GPSD" LDFLAGS+=" -lgps",,) 21 | 22 | dnl checks for header files 23 | AC_HEADER_STDC 24 | 25 | dnl Checks for typedefs, structures and compiler characteristics 26 | 27 | AC_OUTPUT( 28 | src/Makefile 29 | src/common/Makefile 30 | src/misc/Makefile 31 | src/mobile/Makefile 32 | include/Makefile 33 | include/osmocom/Makefile 34 | include/osmocom/bb/Makefile 35 | include/osmocom/bb/common/Makefile 36 | include/osmocom/bb/misc/Makefile 37 | include/osmocom/bb/mobile/Makefile 38 | Makefile) 39 | -------------------------------------------------------------------------------- /src/target_dsp/calypso/bin2cfile.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import struct 4 | import sys 5 | 6 | def group_by_n(s, n, do_join=True): 7 | return ( ''.join(x) for x in zip(*[s[i::n] for i in range(n)]) ) 8 | 9 | 10 | def main(pn, filename): 11 | # Get all bytes 12 | f = open(filename, 'r') 13 | d = f.read() 14 | f.close() 15 | 16 | # Get the data 17 | ops = ''.join([ 18 | '0x%04x,%s' % ( 19 | struct.unpack('=H', x)[0], 20 | '\n\t\t\t' if (i&3==3) else ' ' 21 | ) 22 | for i, x 23 | in enumerate(group_by_n(d, 2)) 24 | ])[:-1] 25 | 26 | ops = '\t\t\t' + ops 27 | if ops[-1] == '\t': 28 | ops = ops[:-4] 29 | 30 | # Name 31 | name = filename.split('.',1)[0] 32 | 33 | # Header / footer 34 | print """ 35 | #define _SA_DECL (const uint16_t *)&(const uint16_t []) 36 | 37 | static const struct dsp_section %s[] = { 38 | { 39 | .addr = 0x, 40 | .size = 0x%04x, 41 | .data = _SA_DECL { 42 | %s 43 | }, 44 | }, 45 | { /* Guard */ 46 | .addr = 0, 47 | .size = 0, 48 | .data = NULL, 49 | }, 50 | }; 51 | 52 | #undef _SA_DECL 53 | """ % (name, len(d)/2, ops) 54 | 55 | 56 | if __name__ == "__main__": 57 | main(*sys.argv) 58 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/gsm/sysinfo.h: -------------------------------------------------------------------------------- 1 | #ifndef _OSMO_GSM_SYSINFO_H 2 | #define _OSMO_GSM_SYSINFO_H 3 | 4 | #include 5 | #include 6 | 7 | enum osmo_sysinfo_type { 8 | SYSINFO_TYPE_NONE, 9 | SYSINFO_TYPE_1, 10 | SYSINFO_TYPE_2, 11 | SYSINFO_TYPE_3, 12 | SYSINFO_TYPE_4, 13 | SYSINFO_TYPE_5, 14 | SYSINFO_TYPE_6, 15 | SYSINFO_TYPE_7, 16 | SYSINFO_TYPE_8, 17 | SYSINFO_TYPE_9, 18 | SYSINFO_TYPE_10, 19 | SYSINFO_TYPE_13, 20 | SYSINFO_TYPE_16, 21 | SYSINFO_TYPE_17, 22 | SYSINFO_TYPE_18, 23 | SYSINFO_TYPE_19, 24 | SYSINFO_TYPE_20, 25 | SYSINFO_TYPE_2bis, 26 | SYSINFO_TYPE_2ter, 27 | SYSINFO_TYPE_2quater, 28 | SYSINFO_TYPE_5bis, 29 | SYSINFO_TYPE_5ter, 30 | SYSINFO_TYPE_EMO, 31 | SYSINFO_TYPE_MEAS_INFO, 32 | /* FIXME all the various bis and ter */ 33 | _MAX_SYSINFO_TYPE 34 | }; 35 | 36 | typedef uint8_t sysinfo_buf_t[GSM_MACBLOCK_LEN]; 37 | 38 | extern const struct value_string osmo_sitype_strs[_MAX_SYSINFO_TYPE]; 39 | 40 | uint8_t osmo_sitype2rsl(enum osmo_sysinfo_type si_type); 41 | enum osmo_sysinfo_type osmo_rsl2sitype(uint8_t rsl_si); 42 | 43 | #endif /* _OSMO_GSM_SYSINFO_H */ 44 | -------------------------------------------------------------------------------- /src/target/firmware/include/calypso/du.h: -------------------------------------------------------------------------------- 1 | /* Calypso DU (Debug Unit) Driver */ 2 | 3 | /* (C) 2010 by Ingo Albrecht 4 | * 5 | * All Rights Reserved 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | */ 22 | 23 | #ifndef _CALYPSO_DU_H 24 | #define _CALYPSO_DU_H 25 | 26 | #include 27 | 28 | void calypso_du_init(); 29 | void calypso_du_stop(); 30 | void calypsu_du_dump(); 31 | 32 | #endif /* _CALYPSO_DU_H */ 33 | -------------------------------------------------------------------------------- /src/host/gsmmap/geo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "geo.h" 3 | 4 | void geo2space(double *x, double *y, double *z, double lon, double lat) 5 | { 6 | *z = sin(lat / 180.0 * PI) * POLE_RADIUS; 7 | *x = sin(lon / 180.0 * PI) * cos(lat / 180.0 * PI) * EQUATOR_RADIUS; 8 | *y = -cos(lon / 180.0 * PI) * cos(lat / 180.0 * PI) * EQUATOR_RADIUS; 9 | } 10 | 11 | void space2geo(double *lon, double *lat, double x, double y, double z) 12 | { 13 | double r; 14 | 15 | /* bring geoid to 1m radius */ 16 | z = z / POLE_RADIUS; 17 | x = x / EQUATOR_RADIUS; 18 | y = y / EQUATOR_RADIUS; 19 | 20 | /* normalize */ 21 | r = sqrt(x * x + y * y + z * z); 22 | z = z / r; 23 | x = x / r; 24 | y = y / r; 25 | 26 | *lat = asin(z) / PI * 180; 27 | *lon = atan2(x, -y) / PI * 180; 28 | } 29 | 30 | double distinspace(double x1, double y1, double z1, double x2, double y2, 31 | double z2) 32 | { 33 | double x = x1 - x2; 34 | double y = y1 - y2; 35 | double z = z1 - z2; 36 | 37 | return sqrt(x * x + y * y + z * z); 38 | } 39 | 40 | double distonplane(double x1, double y1, double x2, double y2) 41 | { 42 | double x = x1 - x2; 43 | double y = y1 - y2; 44 | 45 | return sqrt(x * x + y * y); 46 | } 47 | 48 | -------------------------------------------------------------------------------- /src/host/layer23/src/misc/card/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | card: Library adapted to request (U)SIM cards and other types of telco cards. 3 | Copyright (C) 2010 Benoit Michau 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | """ 19 | 20 | # smartcard Integrated Circuit Card library 21 | # based on Laurent Rousseau pcsclite daemon and Jean-Daniel Aussel pyscard binding 22 | # specificities of SIM and USIM card available 23 | 24 | 25 | __all__ = ['utils', 'ICC', 'SIM', 'USIM', 'FS'] 26 | __version__ = '0.1.0' 27 | 28 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/gsm/gsm0502.h: -------------------------------------------------------------------------------- 1 | #ifndef OSMOCOM_GSM_0502_H 2 | #define OSMOCOM_GSM_0502_H 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | /* Table 5 Clause 7 TS 05.02 */ 10 | static inline unsigned int 11 | gsm0502_get_n_pag_blocks(struct gsm48_control_channel_descr *chan_desc) 12 | { 13 | if (chan_desc->ccch_conf == RSL_BCCH_CCCH_CONF_1_C) 14 | return 3 - chan_desc->bs_ag_blks_res; 15 | else 16 | return 9 - chan_desc->bs_ag_blks_res; 17 | } 18 | 19 | /* Chapter 6.5.2 of TS 05.02 */ 20 | static inline unsigned int 21 | gsm0502_get_ccch_group(uint64_t imsi, unsigned int bs_cc_chans, 22 | unsigned int n_pag_blocks) 23 | { 24 | return (imsi % 1000) % (bs_cc_chans * n_pag_blocks) / n_pag_blocks; 25 | } 26 | 27 | /* Chapter 6.5.2 of TS 05.02 */ 28 | static inline unsigned int 29 | gsm0502_get_paging_group(uint64_t imsi, unsigned int bs_cc_chans, 30 | int n_pag_blocks) 31 | { 32 | return (imsi % 1000) % (bs_cc_chans * n_pag_blocks) % n_pag_blocks; 33 | } 34 | 35 | unsigned int 36 | gsm0502_calc_paging_group(struct gsm48_control_channel_descr *chan_desc, uint64_t imsi); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/target/firmware/include/mtk/mt6235_sciphone_g2.h: -------------------------------------------------------------------------------- 1 | #ifndef _SCIPHONE_G2_H 2 | #define _SCIPHONE_G2_H 3 | /* Bluelans Sciphone G2 support */ 4 | 5 | /* Use of the Baseband Parallel Interface by the G2 board */ 6 | #define HB_TX MTK_BPI(0) 7 | #define PCS_RX MTK_BPI(1) 8 | #define LB_TX MTK_BPI(2) 9 | #define PA_EN MTK_BPI(4) 10 | #define BAND_SW MTK_BPI(5) 11 | #define MODE_PA MTK_BPI(7) 12 | #define RF_VCO_EN MTK_BPI(9) 13 | 14 | #define GPIO_GPS_PWR_EN MTK_GPIO(19) 15 | #define GPIO_WIFI_EN MTK_GPIO(20) 16 | #define GPIO_OP1_EN MTK_GPIO(22) 17 | #define GPIO_BT_PWR_EN MTK_GPIO(39) 18 | #define GPIO_BT_RST MTK_GPIO(62) 19 | #define GPIO_USB_CHR_ID MTK_GPIO(73) 20 | #define GPIO_FM_SCL MTK_GPIO(46) 21 | #define GPIO_FM_SDA MTK_GPIO(47) 22 | #define GPIO_GS_SCL MTK_GPIO(48) 23 | #define GPIO_GS_SDA MTK_GPIO(58) 24 | #define GPIO_GS_EN MTK_GPIO(26) 25 | 26 | #define GPIO_GPS_EINT MTK_GPIO(42) 27 | 28 | #define EINT_HEADSET MTK_EINT(0) 29 | #define EINT_BT MTK_EINT(1) 30 | #define EINT_GPS2GSM MTK_EINT(2) 31 | #define EINT_WIFI MTK_EINT(3) 32 | 33 | #define CLKM_BT_32k MTK_CLKM(2) 34 | #define CLKM_WIFI_32k MTK_CLKM(3) 35 | #define CLKM_FM_32k MTK_CLKM(4) 36 | 37 | 38 | #endif /* _SCIPHONE_G2_H */ 39 | -------------------------------------------------------------------------------- /src/target/firmware/include/stdint.h: -------------------------------------------------------------------------------- 1 | #ifndef OSMO_STDINT_H 2 | #define OSMO_STDINT_H 3 | 4 | /* some older toolchains (like gnuarm-3.x) don't provide a C99 5 | compliant stdint.h yet, so we define our own here */ 6 | 7 | /* to make matters worse newer gcc with glibc headers have 8 | a incompatible definition of these types. We will use the 9 | gcc'ism of #include_next to include the compiler's libc 10 | header file and then check if it has defined int8_t and 11 | if not we will use our own typedefs */ 12 | 13 | /* another bad criteria. We can not detect __NEWLIB_H__ or 14 | _NEWLIB_VERSION. Assume that older GCCs have a older C library 15 | that did not include a stdint.h yet. This is for gnuarm-3.x 16 | one of the compilers producing working code right now. */ 17 | 18 | #if __GNUC__ > 3 19 | #include_next 20 | #endif 21 | 22 | #ifndef __int8_t_defined 23 | typedef signed char int8_t; 24 | typedef unsigned char uint8_t; 25 | 26 | typedef signed short int16_t; 27 | typedef unsigned short uint16_t; 28 | 29 | typedef signed int int32_t; 30 | typedef unsigned int uint32_t; 31 | 32 | typedef long long int int64_t; 33 | typedef unsigned long long int uint64_t; 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/README.building: -------------------------------------------------------------------------------- 1 | == How to build OsmocomBB? == 2 | 3 | === Prerequisites === 4 | 5 | We assume you are building on a GNU/Linux host system such as Debian 6 | GNU/Linux. Successful builds have also been reported using MacOS X 7 | and the Cygwin environment for MS Windows, but we do not officially support 8 | this. 9 | 10 | # Get a GNU toolchain (gcc/binutils) for ARM (e.g. from http://gnuarm.com/) 11 | # Set your path to include the arm-elf-* executables of your toolchain 12 | # call 'make' in this (the src) subdirectory 13 | 14 | === Details === 15 | 16 | The master Makefile will build: 17 | 18 | * libosmocore for the host (x86 or whatever you use) 19 | * libosmocore for the target (ARM) 20 | * osmocon and layer23 executables for the host (linking libosmocore) 21 | * the actual target firmware images (in src/target/firmware/board/*/*.bin) 22 | 23 | == Transmitting == 24 | 25 | For safety reasons, all code that can enable the transmitter on the phone is 26 | disabled in the default builds. Plese check the src/target/firmware/Makefile 27 | for the "#CFLAGS += -DCONFIG_TX_ENABLE" line. 28 | 29 | Please notice that GSM operates in licensed spectrum and in most jurisdictions 30 | you will need a license from a regulatory authority to transmit. 31 | -------------------------------------------------------------------------------- /src/target/firmware/calypso/dsp_sniffcode.c: -------------------------------------------------------------------------------- 1 | /* Generated from src/target_dsp/calypso/dsp_sniff.bin */ 2 | 3 | #define _SA_DECL (const uint16_t *)&(const uint16_t []) 4 | 5 | static const struct dsp_section dsp_sniffcode[] = { 6 | { 7 | .addr = 0x015c, 8 | .size = 0x0051, 9 | .data = _SA_DECL { 10 | 0x76f8, 0x3f6b, 0x0160, 0xfc00, 11 | 0x76f8, 0x439e, 0x0164, 0xfc00, 12 | 0x7711, 0x2000, 0x61f8, 0x3fb0, 13 | 0x0001, 0xf820, 0x016d, 0x7711, 14 | 0x208a, 0x7311, 0x2114, 0x7699, 15 | 0x0000, 0x6d91, 0x7311, 0x2115, 16 | 0xf020, 0xb12c, 0xf074, 0xaac3, 17 | 0x7211, 0x2114, 0xf495, 0xf495, 18 | 0x1281, 0xf845, 0x018a, 0xf010, 19 | 0x0001, 0x8081, 0xf074, 0xb74c, 20 | 0xf020, 0x018b, 0xf074, 0xaa9f, 21 | 0xf073, 0x0178, 0xfc00, 0xe834, 22 | 0xf074, 0xa9ea, 0x7213, 0x2115, 23 | 0xf495, 0xf495, 0x7093, 0x3fa4, 24 | 0x7093, 0x3fa5, 0x7093, 0x3fa7, 25 | 0x7093, 0x3fa6, 0x7093, 0x0cce, 26 | 0x7712, 0x0ccf, 0x7711, 0x001c, 27 | 0x47f8, 0x0011, 0xe589, 0x7313, 28 | 0x2115, 0x7211, 0x2114, 0xf495, 29 | 0xf495, 0x6be1, 0x0001, 0x0001, 30 | 0xfc00, 31 | }, 32 | }, 33 | { /* Guard */ 34 | .addr = 0, 35 | .size = 0, 36 | .data = NULL, 37 | }, 38 | }; 39 | 40 | #undef _SA_DECL 41 | 42 | #define DSP_SNIFF_PATCH_START 0x015c 43 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_03_41.h: -------------------------------------------------------------------------------- 1 | #ifndef PROTO_GSM_03_41_H 2 | #define PROTO_GSM_03_41_H 3 | 4 | #include 5 | 6 | /* GSM TS 03.41 definitions also TS 23.041*/ 7 | 8 | /* Chapter 9.3.2 */ 9 | struct gsm341_ms_message { 10 | struct { 11 | uint8_t code_hi:6; 12 | uint8_t gs:2; 13 | uint8_t update:4; 14 | uint8_t code_lo:4; 15 | } serial; 16 | uint16_t msg_id; 17 | struct { 18 | uint8_t language:4; 19 | uint8_t group:4; 20 | } dcs; 21 | struct { 22 | uint8_t total:4; 23 | uint8_t current:4; 24 | } page; 25 | uint8_t data[0]; 26 | } __attribute__((packed)); 27 | 28 | /* Chapter 9.4.1.3 */ 29 | struct gsm341_etws_message { 30 | struct { 31 | uint8_t code_hi:4; 32 | uint8_t popup:1; 33 | uint8_t alert:1; 34 | uint8_t gs:2; 35 | uint8_t update:4; 36 | uint8_t code_lo:4; 37 | } serial; 38 | uint16_t msg_id; 39 | uint16_t warning_type; 40 | uint8_t data[0]; 41 | } __attribute__((packed)); 42 | 43 | #define GSM341_MSG_CODE(ms) ((ms)->serial.code_lo | ((ms)->serial.code_hi << 4)) 44 | 45 | /* Section 9.3.2.1 - Geographical Scope */ 46 | #define GSM341_GS_CELL_WIDE_IMMED 0 47 | #define GSM341_GS_PLMN_WIDE 1 48 | #define GSM341_GS_LA_WIDE 2 49 | #define GSM341_GS_CELL_WIDE 3 50 | 51 | #endif /* PROTO_GSM_03_41_H */ 52 | -------------------------------------------------------------------------------- /src/target/firmware/include/mtk/bsi.h: -------------------------------------------------------------------------------- 1 | #ifndef _MTK_BSI_H 2 | #define _MTK_BSI_H 3 | 4 | /* MTK Baseband Serial Interface */ 5 | 6 | enum bsi_reg { 7 | BSI_CON = 0x0000, 8 | BSI_D0_CON = 0x0004, 9 | BSI_D0_DAT = 0x0008, 10 | 11 | BSI_ENA_0 = 0x0190, 12 | BSI_ENA_1 = 0x0194, 13 | BSI_IO_CON = 0x0198, 14 | BSI_DOUT = 0x019c, 15 | BSI_DIN = 0x01a0, 16 | BSI_PAIR_NUM = 0x01a4, 17 | 18 | }; 19 | 20 | /* Compute offset of BSI_D0_CON / BSI_D0_DAT registers */ 21 | #define BSI_Dn_CON(x) (BSI_D0_CON + (x * 8)) 22 | #define BSI_Dn_CON(x) (BSI_D0_DAT + (x * 8)) 23 | 24 | /* MT6235 Section 9.1.1 */ 25 | #define BSI_CON_CLK_POL_INV (1 << 0) 26 | #define BSI_CON_CLK_SPD_52_2 (0 << 1) /* 26 MHz */ 27 | #define BSI_CON_CLK_SPD_52_4 (1 << 1) /* 13 MHz */ 28 | #define BSI_CON_CLK_SPD_52_6 (2 << 1) /* 8.67 MHz */ 29 | #define BSI_CON_CLK_SPD_52_8 (3 << 1) /* 6.50 MHz */ 30 | #define BSI_CON_IMOD (1 << 3) 31 | #define BSI_CON_EN0_LEN_SHORT (1 << 4) 32 | #define BSI_CON_EN0_POL_INV (1 << 5) 33 | #define BSI_CON_EN0_LEN_SHORT (1 << 6) 34 | #define BSI_CON_EN0_POL_INV (1 << 7) 35 | #define BSI_CON_SETENV (1 << 8) 36 | 37 | /* how the length is encoded in BSI_Dx_CON */ 38 | #define BSI_Dx_LEN(n) ((n & 0x7f) << 8) 39 | #define BSI_Dx_ISB 0x8000 /* select device 1 */ 40 | 41 | #endif /* _MTK_BSI_H */ 42 | -------------------------------------------------------------------------------- /src/target/firmware/include/display.h: -------------------------------------------------------------------------------- 1 | #ifndef _DISPLAY_DRIVER_H 2 | #define _DISPLAY_DRIVER_H 3 | 4 | enum display_attr { 5 | DISP_ATTR_INVERT = 0x0001, 6 | }; 7 | 8 | struct display_driver { 9 | char *name; 10 | void (*init)(void); 11 | void (*set_attr)(unsigned long attr); 12 | void (*unset_attr)(unsigned long attr); 13 | void (*clrscr)(void); 14 | void (*goto_xy)(int xpos, int ypos); 15 | void (*set_color)(int fgcolor, int bgcolor); 16 | int (*putc)(unsigned char c); 17 | int (*puts)(const char *str); 18 | }; 19 | 20 | extern struct display_driver *display; 21 | 22 | static inline void display_init(void) 23 | { 24 | display->init(); 25 | } 26 | static inline void display_set_attr(unsigned long attr) 27 | { 28 | display->set_attr(attr); 29 | } 30 | static inline void display_unset_attr(unsigned long attr) 31 | { 32 | display->unset_attr(attr); 33 | } 34 | static inline void display_clrscr(void) 35 | { 36 | display->clrscr(); 37 | } 38 | static inline int display_putchar(unsigned char c) 39 | { 40 | return display->putc(c); 41 | } 42 | int display_puts(const char *s); 43 | 44 | extern const struct display_driver st7558_display; 45 | extern const struct display_driver ssd1783_display; 46 | extern const struct display_driver ssd1963_display; 47 | extern const struct display_driver td014_display; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/host/layer23/src/misc/smspdu/__main__.py: -------------------------------------------------------------------------------- 1 | from .pdu import dump 2 | 3 | if __name__ == '__main__': 4 | import sys 5 | dump(sys.argv[1]) 6 | 7 | # Copyright (c) 2011 eKit.com Inc (http://www.ekit.com/) 8 | # 9 | # Permission is hereby granted, free of charge, to any person obtaining a copy 10 | # of this software and associated documentation files (the "Software"), to deal 11 | # in the Software without restriction, including without limitation the rights 12 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | # copies of the Software, and to permit persons to whom the Software is 14 | # furnished to do so, subject to the following conditions: 15 | # 16 | # The above copyright notice and this permission notice shall be included in 17 | # all copies or substantial portions of the Software. 18 | # 19 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | # SOFTWARE. 26 | -------------------------------------------------------------------------------- /src/target/firmware/include/stdio.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDIO_H 2 | #define _STDIO_H 3 | 4 | #ifndef NULL 5 | #define NULL 0 6 | #endif /* NULL */ 7 | 8 | #include 9 | 10 | int printf(const char *format, ...); 11 | int sprintf(char *str, const char *format, ...); 12 | int snprintf(char *str, size_t size, const char *format, ...); 13 | 14 | #include 15 | 16 | int vprintf(const char *format, va_list ap); 17 | int vsprintf(char *str, const char *format, va_list ap); 18 | int vsnprintf(char *str, size_t size, const char *format, va_list ap); 19 | int puts(const char *s); 20 | 21 | #if 0 22 | /* start.S based uart console */ 23 | #include 24 | #define putchar(c) uart_putchar_wait(1, c) 25 | int puts(const char *s); 26 | #endif 27 | 28 | #if 0 29 | /* regular UART console */ 30 | #include 31 | #define putchar(c) cons_putchar(c) 32 | #define _puts(s) cons_puts(s) 33 | #define ARCH_HAS_CONSOLE 34 | #endif 35 | 36 | #if 1 37 | /* sercomm based console */ 38 | #include 39 | #define putchar(c) sercomm_putchar(c) 40 | #define _puts(s) sercomm_puts(s) 41 | #define ARCH_HAS_CONSOLE 42 | #endif 43 | 44 | struct __file { 45 | }; 46 | 47 | typedef struct __file FILE; 48 | 49 | /* non-standard */ 50 | extern void phex(unsigned int c, unsigned int len); 51 | 52 | #endif /* _STDIO_H */ 53 | -------------------------------------------------------------------------------- /src/target/firmware/include/calypso/irq.h: -------------------------------------------------------------------------------- 1 | #ifndef _CALYPSO_IRQ_H 2 | #define _CALYPSO_IRQ_H 3 | 4 | enum irq_nr { 5 | IRQ_WATCHDOG = 0, 6 | IRQ_TIMER1 = 1, 7 | IRQ_TIMER2 = 2, 8 | IRQ_TSP_RX = 3, 9 | IRQ_TPU_FRAME = 4, 10 | IRQ_TPU_PAGE = 5, 11 | IRQ_SIMCARD = 6, 12 | IRQ_UART_MODEM = 7, 13 | IRQ_KEYPAD_GPIO = 8, 14 | IRQ_RTC_TIMER = 9, 15 | IRQ_RTC_ALARM_I2C = 10, 16 | IRQ_ULPD_GAUGING = 11, 17 | IRQ_EXTERNAL = 12, 18 | IRQ_SPI = 13, 19 | IRQ_DMA = 14, 20 | IRQ_API = 15, 21 | IRQ_SIM_DETECT = 16, 22 | IRQ_EXTERNAL_FIQ = 17, 23 | IRQ_UART_IRDA = 18, 24 | IRQ_ULPD_GSM_TIMER = 19, 25 | IRQ_GEA = 20, 26 | _NR_IRQ 27 | }; 28 | 29 | typedef void irq_handler(enum irq_nr nr); 30 | 31 | /* initialize IRQ driver and enable interrupts */ 32 | void irq_init(void); 33 | 34 | /* enable a certain interrupt */ 35 | void irq_enable(enum irq_nr nr); 36 | 37 | /* disable a certain interrupt */ 38 | void irq_disable(enum irq_nr nr); 39 | 40 | /* configure a certain interrupt */ 41 | void irq_config(enum irq_nr nr, int fiq, int edge, int8_t prio); 42 | 43 | /* register an interrupt handler */ 44 | void irq_register_handler(enum irq_nr nr, irq_handler *handler); 45 | 46 | /* Install the exception handlers to where the ROM loader jumps */ 47 | void calypso_exceptions_install(void); 48 | 49 | #endif /* _CALYPSO_IRQ_H */ 50 | -------------------------------------------------------------------------------- /src/target/firmware/lib/string.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/string.c 3 | * 4 | * Copyright (C) 1991, 1992 Linus Torvalds 5 | */ 6 | 7 | /* 8 | * stupid library routines.. The optimized versions should generally be found 9 | * as inline code in 10 | * 11 | * These are buggy as well.. 12 | * 13 | * * Fri Jun 25 1999, Ingo Oeser 14 | * - Added strsep() which will replace strtok() soon (because strsep() is 15 | * reentrant and should be faster). Use only strsep() in new code, please. 16 | * 17 | * * Sat Feb 09 2002, Jason Thomas , 18 | * Matthew Hawkins 19 | * - Kissed strtok() goodbye 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | 27 | #ifndef __HAVE_ARCH_STRNLEN 28 | /** 29 | * strnlen - Find the length of a length-limited string 30 | * @s: The string to be sized 31 | * @count: The maximum number of bytes to search 32 | */ 33 | size_t strnlen(const char *s, size_t count) 34 | { 35 | const char *sc; 36 | 37 | for (sc = s; count-- && *sc != '\0'; ++sc) 38 | /* nothing */; 39 | return sc - s; 40 | } 41 | #endif 42 | 43 | size_t strlen(const char *s) 44 | { 45 | const char *sc; 46 | 47 | for (sc = s; *sc != '\0'; ++sc) 48 | /* nothing */; 49 | return sc - s; 50 | } 51 | -------------------------------------------------------------------------------- /src/shared/libosmocore/src/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS=. vty codec gsm 2 | 3 | # This is _NOT_ the library release version, it's an API version. 4 | # Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification 5 | LIBVERSION=3:0:0 6 | 7 | INCLUDES = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)/include 8 | AM_CFLAGS = -fPIC -Wall 9 | 10 | lib_LTLIBRARIES = libosmocore.la 11 | 12 | libosmocore_la_SOURCES = timer.c select.c signal.c msgb.c bits.c \ 13 | bitvec.c statistics.c \ 14 | write_queue.c utils.c socket.c \ 15 | logging.c logging_syslog.c rate_ctr.c \ 16 | gsmtap_util.c crc16.c panic.c backtrace.c \ 17 | conv.c application.c rbtree.c \ 18 | crc8gen.c crc16gen.c crc32gen.c crc64gen.c 19 | 20 | if ENABLE_PLUGIN 21 | libosmocore_la_SOURCES += plugin.c 22 | libosmocore_la_LDFLAGS = -version-info $(LIBVERSION) $(LIBRARY_DL) 23 | else 24 | libosmocore_la_LDFLAGS = -version-info $(LIBVERSION) 25 | endif 26 | 27 | if ENABLE_TALLOC 28 | libosmocore_la_SOURCES += talloc.c 29 | else 30 | libosmocore_la_LIBADD = -ltalloc 31 | endif 32 | 33 | if ENABLE_MSGFILE 34 | libosmocore_la_SOURCES += msgfile.c 35 | endif 36 | 37 | if ENABLE_SERIAL 38 | libosmocore_la_SOURCES += serial.c 39 | endif 40 | 41 | crc%gen.c: crcXXgen.c.tpl 42 | @echo " SED $< -> $@" 43 | @sed -e's/XX/$*/g' $< > $@ 44 | -------------------------------------------------------------------------------- /src/target/firmware/calypso/dsp_dumpcode.c: -------------------------------------------------------------------------------- 1 | /* Generated from src/target_dsp/calypso/dsp_dump.bin */ 2 | 3 | #define _SA_DECL (const uint16_t *)&(const uint16_t []) 4 | 5 | static const struct dsp_section dsp_dumpcode[] = { 6 | { 7 | .addr = 0x1000, 8 | .size = 0x005b, 9 | .data = _SA_DECL { 10 | 0x69f8, 0x0029, 0x0002, 0xea1f, 11 | 0x7718, 0x1100, 0x7714, 0x0000, 12 | 0x7712, 0x0800, 0x767f, 0x0001, 13 | 0x607f, 0xffff, 0xf820, 0x1014, 14 | 0xf273, 0x1008, 0x7682, 0x0100, 15 | 0x607f, 0x0004, 0xf820, 0x101c, 16 | 0xf273, 0x1008, 0x7214, 0x0800, 17 | 0x607f, 0x0002, 0xf820, 0x100c, 18 | 0x127e, 0x8813, 0x3c7c, 0x137d, 19 | 0x8911, 0xf84c, 0x1028, 0xf4e2, 20 | 0x7715, 0x0014, 0x963d, 0xfa30, 21 | 0x104b, 0x6d89, 0x963f, 0xfa30, 22 | 0x103f, 0x963e, 0xf495, 0xf830, 23 | 0x103a, 0x47f8, 0x0011, 0x7f92, 24 | 0xf073, 0x1008, 0x47f8, 0x0011, 25 | 0x7e92, 0xf073, 0x1008, 0xf830, 26 | 0x1046, 0x47f8, 0x0011, 0xe589, 27 | 0xf073, 0x1008, 0x47f8, 0x0011, 28 | 0xe598, 0xf073, 0x1008, 0x4911, 29 | 0x891a, 0xf830, 0x1055, 0xf072, 30 | 0x1052, 0xf074, 0x7213, 0xf073, 31 | 0x1008, 0xf072, 0x1058, 0xf074, 32 | 0xe4b8, 0xf073, 0x1008, 33 | }, 34 | }, 35 | { /* Guard */ 36 | .addr = 0, 37 | .size = 0, 38 | .data = NULL, 39 | }, 40 | }; 41 | 42 | #define DSP_DUMPCODE_START 0x1000 43 | 44 | #undef _SA_DECL 45 | 46 | -------------------------------------------------------------------------------- /src/target/firmware/include/calypso/dsp.h: -------------------------------------------------------------------------------- 1 | #ifndef _CALYPSO_DSP_H 2 | #define _CALYPSO_DSP_H 3 | 4 | #include 5 | 6 | #define CAL_DSP_TGT_BB_LVL 80 7 | 8 | struct gsm_time; 9 | 10 | struct dsp_api { 11 | T_NDB_MCU_DSP *ndb; 12 | T_DB_DSP_TO_MCU *db_r; 13 | T_DB_MCU_TO_DSP *db_w; 14 | T_PARAM_MCU_DSP *param; 15 | int r_page; 16 | int w_page; 17 | int r_page_used; 18 | int frame_ctr; 19 | }; 20 | 21 | extern struct dsp_api dsp_api; 22 | 23 | void dsp_power_on(void); 24 | void dsp_dump_version(void); 25 | void dsp_dump(void); 26 | void dsp_checksum_task(void); 27 | void dsp_api_memset(uint16_t *ptr, int octets); 28 | void dsp_memcpy_to_api(volatile uint16_t *dsp_buf, const uint8_t *mcu_buf, int n, int be); 29 | void dsp_memcpy_from_api(uint8_t *mcu_buf, const volatile uint16_t *dsp_buf, int n, int be); 30 | void dsp_load_afc_dac(uint16_t afc); 31 | void dsp_load_apc_dac(uint16_t apc); 32 | void dsp_load_tch_param(struct gsm_time *next_time, 33 | uint8_t chan_mode, uint8_t chan_type, uint8_t chan_sub, 34 | uint8_t tch_loop, uint8_t sync_tch, uint8_t tn); 35 | void dsp_load_ciph_param(int mode, uint8_t *key); 36 | void dsp_end_scenario(void); 37 | 38 | void dsp_load_rx_task(uint16_t task, uint8_t burst_id, uint8_t tsc); 39 | void dsp_load_tx_task(uint16_t task, uint8_t burst_id, uint8_t tsc); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/target/firmware/include/asm/div64.h: -------------------------------------------------------------------------------- 1 | #ifndef __ASM_ARM_DIV64 2 | #define __ASM_ARM_DIV64 3 | 4 | #include 5 | 6 | /* 7 | * The semantics of do_div() are: 8 | * 9 | * uint32_t do_div(uint64_t *n, uint32_t base) 10 | * { 11 | * uint32_t remainder = *n % base; 12 | * *n = *n / base; 13 | * return remainder; 14 | * } 15 | * 16 | * In other words, a 64-bit dividend with a 32-bit divisor producing 17 | * a 64-bit result and a 32-bit remainder. To accomplish this optimally 18 | * we call a special __do_div64 helper with completely non standard 19 | * calling convention for arguments and results (beware). 20 | */ 21 | 22 | #ifdef __ARMEB__ 23 | #define __xh "r0" 24 | #define __xl "r1" 25 | #else 26 | #define __xl "r0" 27 | #define __xh "r1" 28 | #endif 29 | 30 | #define do_div(n,base) \ 31 | ({ \ 32 | register unsigned int __base asm("r4") = base; \ 33 | register unsigned long long __n asm("r0") = n; \ 34 | register unsigned long long __res asm("r2"); \ 35 | register unsigned int __rem asm(__xh); \ 36 | asm( __asmeq("%0", __xh) \ 37 | __asmeq("%1", "r2") \ 38 | __asmeq("%2", "r0") \ 39 | __asmeq("%3", "r4") \ 40 | "bl __do_div64" \ 41 | : "=r" (__rem), "=r" (__res) \ 42 | : "r" (__n), "r" (__base) \ 43 | : "ip", "lr", "cc"); \ 44 | n = __res; \ 45 | __rem; \ 46 | }) 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/target/firmware/include/layer1/prim.h: -------------------------------------------------------------------------------- 1 | #ifndef _L1_PRIM_H 2 | #define _L1_PRIM_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | struct l1ctl_fbsb_req; 9 | 10 | /* Utils */ 11 | const uint8_t *pu_get_idle_frame(void); 12 | void pu_update_rx_level(uint8_t rx_level); 13 | const uint8_t *pu_get_meas_frame(void); 14 | 15 | /* Primitives tests/requests */ 16 | void l1s_fb_test(uint8_t base_fn, uint8_t fb_mode); 17 | void l1s_sb_test(uint8_t base_fn); 18 | void l1s_pm_test(uint8_t base_fn, uint16_t arfcn); 19 | void l1s_nb_test(uint8_t base_fn); 20 | 21 | void l1s_fbsb_req(uint8_t base_fn, struct l1ctl_fbsb_req *req); 22 | void l1a_freq_req(uint32_t fn_sched); 23 | void l1a_rach_req(uint16_t offset, uint8_t combined, uint8_t ra); 24 | 25 | /* Primitives raw scheduling sets */ 26 | extern const struct tdma_sched_item nb_sched_set[]; 27 | extern const struct tdma_sched_item nb_sched_set_ul[]; 28 | 29 | extern const struct tdma_sched_item tch_sched_set[]; 30 | extern const struct tdma_sched_item tch_a_sched_set[]; 31 | extern const struct tdma_sched_item tch_d_sched_set[]; 32 | extern const struct tdma_sched_item neigh_pm_sched_set[]; 33 | 34 | extern const struct tdma_sched_item sniff_xcch_dl_sched_set[]; 35 | extern const struct tdma_sched_item sniff_xcch_ul_sched_set[]; 36 | extern const struct tdma_sched_item sniff_tch_sched_set[]; 37 | 38 | #endif /* _L1_PRIM_H */ 39 | -------------------------------------------------------------------------------- /src/target/firmware/include/asm/swab.h: -------------------------------------------------------------------------------- 1 | /* 2 | * arch/arm/include/asm/byteorder.h 3 | * 4 | * ARM Endian-ness. In little endian mode, the data bus is connected such 5 | * that byte accesses appear as: 6 | * 0 = d0...d7, 1 = d8...d15, 2 = d16...d23, 3 = d24...d31 7 | * and word accesses (data or instruction) appear as: 8 | * d0...d31 9 | * 10 | * When in big endian mode, byte accesses appear as: 11 | * 0 = d24...d31, 1 = d16...d23, 2 = d8...d15, 3 = d0...d7 12 | * and word accesses (data or instruction) appear as: 13 | * d0...d31 14 | */ 15 | #ifndef __ASM_ARM_SWAB_H 16 | #define __ASM_ARM_SWAB_H 17 | 18 | #include 19 | #include 20 | 21 | static inline uint32_t __arch_swab32(uint32_t x) 22 | { 23 | uint32_t t; 24 | 25 | #ifndef __thumb__ 26 | if (!__builtin_constant_p(x)) { 27 | /* 28 | * The compiler needs a bit of a hint here to always do the 29 | * right thing and not screw it up to different degrees 30 | * depending on the gcc version. 31 | */ 32 | asm ("eor\t%0, %1, %1, ror #16" : "=r" (t) : "r" (x)); 33 | } else 34 | #endif 35 | t = x ^ ((x << 16) | (x >> 16)); /* eor r1,r0,r0,ror #16 */ 36 | 37 | x = (x << 24) | (x >> 8); /* mov r0,r0,ror #8 */ 38 | t &= ~0x00FF0000; /* bic r1,r1,#0x00FF0000 */ 39 | x ^= (t >> 8); /* eor r0,r0,r1,lsr #8 */ 40 | 41 | return x; 42 | } 43 | #define __arch_swab32 __arch_swab32 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/core/crcgen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * crcgen.h 3 | * 4 | * Copyright (C) 2011 Sylvain Munaut 5 | * 6 | * All Rights Reserved 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along 19 | * with this program; if not, write to the Free Software Foundation, Inc., 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 21 | */ 22 | 23 | #ifndef __OSMO_CRCGEN_H__ 24 | #define __OSMO_CRCGEN_H__ 25 | 26 | /*! \defgroup crcgen Osmocom generic CRC routines 27 | * @{ 28 | */ 29 | 30 | /*! \file crcgen.h 31 | * \file Osmocom generic CRC routines global header 32 | */ 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | /*! }@ */ 40 | 41 | #endif /* __OSMO_CRCGEN_H__ */ 42 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/gsm/abis_nm.h: -------------------------------------------------------------------------------- 1 | #ifndef _OSMO_GSM_ABIS_NM_H 2 | #define _OSMO_GSM_ABIS_NM_H 3 | 4 | /*! \defgroup oml A-bis OML 5 | * @{ 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | /*! \file abis_nm.h */ 13 | 14 | enum abis_nm_msgtype; 15 | enum gsm_phys_chan_config; 16 | 17 | const enum abis_nm_msgtype abis_nm_reports[4]; 18 | const enum abis_nm_msgtype abis_nm_no_ack_nack[3]; 19 | const enum abis_nm_msgtype abis_nm_sw_load_msgs[9]; 20 | const enum abis_nm_msgtype abis_nm_nacks[33]; 21 | 22 | extern const struct value_string abis_nm_obj_class_names[]; 23 | extern const struct value_string abis_nm_adm_state_names[]; 24 | 25 | const char *abis_nm_nack_cause_name(uint8_t cause); 26 | const char *abis_nm_nack_name(uint8_t nack); 27 | const char *abis_nm_event_type_name(uint8_t cause); 28 | const char *abis_nm_severity_name(uint8_t cause); 29 | const struct tlv_definition abis_nm_att_tlvdef; 30 | const char *abis_nm_opstate_name(uint8_t os); 31 | const char *abis_nm_avail_name(uint8_t avail); 32 | const char *abis_nm_test_name(uint8_t test); 33 | void abis_nm_debugp_foh(int ss, struct abis_om_fom_hdr *foh); 34 | 35 | int abis_nm_chcomb4pchan(enum gsm_phys_chan_config pchan); 36 | enum abis_nm_chan_comb abis_nm_pchan4chcomb(uint8_t chcomb); 37 | 38 | /*! }@ */ 39 | 40 | #endif /* _OSMO_GSM_ABIS_NM_H */ 41 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/gsm/gsm48.h: -------------------------------------------------------------------------------- 1 | #ifndef _OSMOCORE_GSM48_H 2 | #define _OSMOCORE_GSM48_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | /* A parsed GPRS routing area */ 9 | struct gprs_ra_id { 10 | uint16_t mnc; 11 | uint16_t mcc; 12 | uint16_t lac; 13 | uint8_t rac; 14 | }; 15 | 16 | extern const struct tlv_definition gsm48_att_tlvdef; 17 | extern const struct tlv_definition gsm48_rr_att_tlvdef; 18 | extern const struct tlv_definition gsm48_mm_att_tlvdef; 19 | const char *gsm48_cc_state_name(uint8_t state); 20 | const char *gsm48_cc_msg_name(uint8_t msgtype); 21 | const char *rr_cause_name(uint8_t cause); 22 | 23 | void gsm48_generate_lai(struct gsm48_loc_area_id *lai48, uint16_t mcc, 24 | uint16_t mnc, uint16_t lac); 25 | int gsm48_generate_mid_from_tmsi(uint8_t *buf, uint32_t tmsi); 26 | int gsm48_generate_mid_from_imsi(uint8_t *buf, const char *imsi); 27 | 28 | /* Convert Mobile Identity (10.5.1.4) to string */ 29 | int gsm48_mi_to_string(char *string, const int str_len, 30 | const uint8_t *mi, const int mi_len); 31 | 32 | /* Parse Routeing Area Identifier */ 33 | void gsm48_parse_ra(struct gprs_ra_id *raid, const uint8_t *buf); 34 | int gsm48_construct_ra(uint8_t *buf, const struct gprs_ra_id *raid); 35 | 36 | int gsm48_number_of_paging_subchannels(struct gsm48_control_channel_descr *chan_desc); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/core/signal.h: -------------------------------------------------------------------------------- 1 | #ifndef OSMO_SIGNAL_H 2 | #define OSMO_SIGNAL_H 3 | 4 | #include 5 | 6 | /*! \defgroup signal Intra-application signals 7 | * @{ 8 | */ 9 | /*! \file signal.h */ 10 | 11 | /* subsystem signaling numbers: we split the numberspace for applications and 12 | * libraries: from 0 to UINT_MAX/2 for applications, from UINT_MAX/2 to 13 | * UINT_MAX for libraries. */ 14 | #define OSMO_SIGNAL_SS_APPS 0 15 | #define OSMO_SIGNAL_SS_RESERVED 2147483648u 16 | 17 | /*! \brief signal subsystems */ 18 | enum { 19 | SS_L_GLOBAL = OSMO_SIGNAL_SS_RESERVED, 20 | SS_L_INPUT, 21 | }; 22 | 23 | /* application-defined signal types. */ 24 | #define OSMO_SIGNAL_T_APPS 0 25 | #define OSMO_SIGNAL_T_RESERVED 2147483648u 26 | 27 | /*! \brief signal types. */ 28 | enum { 29 | S_L_GLOBAL_SHUTDOWN = OSMO_SIGNAL_T_RESERVED, 30 | }; 31 | 32 | /*! signal callback function type */ 33 | typedef int osmo_signal_cbfn(unsigned int subsys, unsigned int signal, void *handler_data, void *signal_data); 34 | 35 | 36 | /* Management */ 37 | int osmo_signal_register_handler(unsigned int subsys, osmo_signal_cbfn *cbfn, void *data); 38 | void osmo_signal_unregister_handler(unsigned int subsys, osmo_signal_cbfn *cbfn, void *data); 39 | 40 | /* Dispatch */ 41 | void osmo_signal_dispatch(unsigned int subsys, unsigned int signal, void *signal_data); 42 | 43 | /*! }@ */ 44 | 45 | #endif /* OSMO_SIGNAL_H */ 46 | -------------------------------------------------------------------------------- /src/host/layer23/README: -------------------------------------------------------------------------------- 1 | = OsmocomBB layer23 architecture = 2 | 3 | layer23 is an (incomplete) MS-side implementation of the L2 and L3 GSM 4 | protocols as described in GSM TS 04.06, 04.08 and others. 5 | 6 | == Interfaces == 7 | 8 | L1 (on the phone) uses the L1CTL protocol to talk with layer23 (on the PC). 9 | 10 | L2 (inside layer23) uses the RSLms protocol to talk with the L3 (inside layer23) 11 | 12 | 13 | === RSLms === 14 | 15 | RSLms is modeled after the GSM TS 08.58 Radio Subsystem Link protocol. Despite 16 | being designed for the network side, RSL seems a good match for the L2/L3 17 | interface inside a MS, too. 18 | 19 | At least the RLL (Radio Link Layer) part of RSL is 100% as applicable to the MS 20 | side as it is for the ntwork side. 21 | 22 | ==== Lower interface (L2 to RSLms) ==== 23 | 24 | Layer2 calls rslms_sendmsg() with a msgb that has the msgb->l2h pointing to a 25 | RSL header (struct abis_rsl_common_hdr). 26 | 27 | ==== Upper interface (L3 to RSLms) ==== 28 | 29 | Layer3 calls rslms_recvmsg() with a msgb that has the msgb->l2h pointing to a 30 | RSL header (struct abis_rsl_common_hdr). 31 | 32 | There are utility functions like rslms_tx_rll_req() and rslms_tx_rsll_req_l3() 33 | for creating msgb's with the apropriate RSL/RLL headers. 34 | 35 | 36 | === LAPDm === 37 | 38 | LAPDm is the GSM TS 04.06 protocol 39 | 40 | The lower interface (to L1) is using L1CTL 41 | 42 | The upper interface (to L3) is using RSLms 43 | -------------------------------------------------------------------------------- /src/target/firmware/include/keypad.h: -------------------------------------------------------------------------------- 1 | #ifndef _KEYPAD_H 2 | #define _KEYPAD_H 3 | 4 | enum buttons { 5 | BTN_0 = 0x00002000, 6 | BTN_1 = 0x00008000, 7 | BTN_2 = 0x00000400, 8 | BTN_3 = 0x00000020, 9 | BTN_4 = 0x00010000, 10 | BTN_5 = 0x00000800, 11 | BTN_6 = 0x00000040, 12 | BTN_7 = 0x00020000, 13 | BTN_8 = 0x00001000, 14 | BTN_9 = 0x00000080, 15 | BTN_STAR = 0x00040000, 16 | BTN_HASH = 0x00000100, 17 | BTN_MENU = 0x00004000, 18 | BTN_LEFT_SB = 0x00080000, 19 | BTN_RIGHT_SB = 0x00000200, 20 | BTN_UP = 0x00000002, 21 | BTN_DOWN = 0x00000004, 22 | BTN_LEFT = 0x00000008, 23 | BTN_RIGHT = 0x00000010, 24 | BTN_OK = 0x00000001, 25 | BTN_POWER = 0x01000000, 26 | }; 27 | 28 | enum key_codes { 29 | KEY_0 = 0, 30 | KEY_1, 31 | KEY_2, 32 | KEY_3, 33 | KEY_4, 34 | KEY_5, 35 | KEY_6, 36 | KEY_7, 37 | KEY_8, 38 | KEY_9, 39 | KEY_STAR, //* 40 | KEY_HASH, //# 41 | KEY_MENU, //center of directional keys 42 | KEY_LEFT_SB, //softbutton 43 | KEY_RIGHT_SB, //softbutton 44 | KEY_UP, 45 | KEY_DOWN, 46 | KEY_LEFT, 47 | KEY_RIGHT, 48 | KEY_OK, //green off-hook 49 | KEY_POWER, //red on-hook 50 | KEY_INV = 0xFF 51 | }; 52 | 53 | enum key_states { 54 | PRESSED, 55 | RELEASED, 56 | }; 57 | 58 | void keypad_init(uint8_t interrupts); 59 | 60 | void keypad_poll(); 61 | 62 | typedef void (*key_handler_t)(enum key_codes code, enum key_states state); 63 | 64 | void keypad_set_handler(key_handler_t handler); 65 | 66 | #endif /* KEYPAD_H */ 67 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/core/select.h: -------------------------------------------------------------------------------- 1 | #ifndef _BSC_SELECT_H 2 | #define _BSC_SELECT_H 3 | 4 | #include 5 | 6 | /*! \defgroup select Select loop abstraction 7 | * @{ 8 | */ 9 | 10 | /*! \file select.h 11 | * \brief select loop abstraction 12 | */ 13 | 14 | /*! \brief Indicate interest in reading from the file descriptor */ 15 | #define BSC_FD_READ 0x0001 16 | /*! \brief Indicate interest in writing to the file descriptor */ 17 | #define BSC_FD_WRITE 0x0002 18 | /*! \brief Indicate interest in exceptions from the file descriptor */ 19 | #define BSC_FD_EXCEPT 0x0004 20 | 21 | /*! \brief Structure representing a file dsecriptor */ 22 | struct osmo_fd { 23 | /*! linked list for internal management */ 24 | struct llist_head list; 25 | /*! actual operating-system level file decriptor */ 26 | int fd; 27 | /*! bit-mask or of \ref BSC_FD_READ, \ref BSC_FD_WRITE and/or 28 | * \ref BSC_FD_EXCEPT */ 29 | unsigned int when; 30 | /*! call-back function to be called once file descriptor becomes 31 | * available */ 32 | int (*cb)(struct osmo_fd *fd, unsigned int what); 33 | /*! data pointer passed through to call-back function */ 34 | void *data; 35 | /*! private number, extending \a data */ 36 | unsigned int priv_nr; 37 | }; 38 | 39 | int osmo_fd_register(struct osmo_fd *fd); 40 | void osmo_fd_unregister(struct osmo_fd *fd); 41 | int osmo_select_main(int polling); 42 | 43 | /*! }@ */ 44 | 45 | #endif /* _BSC_SELECT_H */ 46 | -------------------------------------------------------------------------------- /src/target/firmware/lib/ctype.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/ctype.c 3 | * 4 | * Copyright (C) 1991, 1992 Linus Torvalds 5 | */ 6 | 7 | #include 8 | 9 | unsigned char _ctype[] = { 10 | _C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ 11 | _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ 12 | _C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */ 13 | _C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */ 14 | _S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */ 15 | _P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */ 16 | _D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */ 17 | _D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */ 18 | _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */ 19 | _U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */ 20 | _U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */ 21 | _U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */ 22 | _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */ 23 | _L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */ 24 | _L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */ 25 | _L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */ 26 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */ 27 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */ 28 | _S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 160-175 */ 29 | _P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 176-191 */ 30 | _U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U, /* 192-207 */ 31 | _U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L, /* 208-223 */ 32 | _L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L, /* 224-239 */ 33 | _L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L}; /* 240-255 */ 34 | 35 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/core/msgfile.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) 2010 by Holger Hans Peter Freyther 3 | * (C) 2010 by On-Waves 4 | * All Rights Reserved 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | */ 21 | 22 | #ifndef MSG_FILE_H 23 | #define MSG_FILE_H 24 | 25 | #include 26 | 27 | /** 28 | * One message in the list. 29 | */ 30 | struct osmo_config_entry { 31 | struct llist_head list; 32 | 33 | /* number for everyone to use */ 34 | int nr; 35 | 36 | /* data from the file */ 37 | char *mcc; 38 | char *mnc; 39 | char *option; 40 | char *text; 41 | }; 42 | 43 | struct osmo_config_list { 44 | struct llist_head entry; 45 | }; 46 | 47 | struct osmo_config_list* osmo_config_list_parse(void *ctx, const char *filename); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/core/serial.h: -------------------------------------------------------------------------------- 1 | /* 2 | * serial.h 3 | * 4 | * Copyright (C) 2011 Sylvain Munaut 5 | * 6 | * All Rights Reserved 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along 19 | * with this program; if not, write to the Free Software Foundation, Inc., 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 21 | */ 22 | 23 | /*! \defgroup serial Utility functions to deal with serial ports 24 | * @{ 25 | */ 26 | 27 | /*! \file serial.h 28 | * \file Osmocom serial port helpers 29 | */ 30 | 31 | #ifndef __OSMO_SERIAL_H__ 32 | #define __OSMO_SERIAL_H__ 33 | 34 | #include 35 | 36 | int osmo_serial_init(const char *dev, speed_t baudrate); 37 | int osmo_serial_set_baudrate(int fd, speed_t baudrate); 38 | int osmo_serial_set_custom_baudrate(int fd, int baudrate); 39 | int osmo_serial_clear_custom_baudrate(int fd); 40 | 41 | /*! }@ */ 42 | 43 | #endif /* __OSMO_SERIAL_H__ */ 44 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/gsm/gsm0411_smr.h: -------------------------------------------------------------------------------- 1 | #ifndef _GSM0411_SMR_H 2 | #define _GSM0411_SMR_H 3 | 4 | #include 5 | 6 | #define GSM411_SM_RL_DATA_REQ 0x401 7 | #define GSM411_SM_RL_DATA_IND 0x402 8 | #define GSM411_SM_RL_MEM_AVAIL_REQ 0x403 9 | #define GSM411_SM_RL_MEM_AVAIL_IND 0x404 10 | #define GSM411_SM_RL_REPORT_REQ 0x405 11 | #define GSM411_SM_RL_REPORT_IND 0x406 12 | 13 | struct gsm411_smr_inst { 14 | int network; /* is this a MO (0) or MT (1) transfer */ 15 | int (*rl_recv) (struct gsm411_smr_inst *inst, int msg_type, 16 | struct msgb *msg); 17 | int (*mn_send) (struct gsm411_smr_inst *inst, int msg_type, 18 | struct msgb *msg); 19 | 20 | enum gsm411_rp_state rp_state; 21 | struct osmo_timer_list rp_timer; 22 | }; 23 | 24 | extern const struct value_string gsm411_rp_cause_strs[]; 25 | 26 | /* init a new instance */ 27 | void gsm411_smr_init(struct gsm411_smr_inst *inst, int network, 28 | int (*rl_recv) (struct gsm411_smr_inst *inst, int msg_type, 29 | struct msgb *msg), 30 | int (*mn_send) (struct gsm411_smr_inst *inst, int msg_type, 31 | struct msgb *msg)); 32 | 33 | /* clear instance */ 34 | void gsm411_smr_clear(struct gsm411_smr_inst *inst); 35 | 36 | /* message from upper layer */ 37 | int gsm411_smr_send(struct gsm411_smr_inst *inst, int msg_type, 38 | struct msgb *msg); 39 | 40 | /* message from lower layer */ 41 | int gsm411_smr_recv(struct gsm411_smr_inst *inst, int msg_type, 42 | struct msgb *msg); 43 | 44 | #endif /* _GSM0411_SMR_H */ 45 | 46 | -------------------------------------------------------------------------------- /src/target/firmware/lib/memcpy.S: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/arch/arm/lib/memcpy.S 3 | * 4 | * Author: Nicolas Pitre 5 | * Created: Sep 28, 2005 6 | * Copyright: MontaVista Software, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License version 2 as 10 | * published by the Free Software Foundation. 11 | */ 12 | 13 | #include 14 | #include 15 | 16 | .macro ldr1w ptr reg abort 17 | ldr \reg, [\ptr], #4 18 | .endm 19 | 20 | .macro ldr4w ptr reg1 reg2 reg3 reg4 abort 21 | ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4} 22 | .endm 23 | 24 | .macro ldr8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort 25 | ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8} 26 | .endm 27 | 28 | .macro ldr1b ptr reg cond=al abort 29 | ldr\cond\()b \reg, [\ptr], #1 30 | .endm 31 | 32 | .macro str1w ptr reg abort 33 | str \reg, [\ptr], #4 34 | .endm 35 | 36 | .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort 37 | stmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8} 38 | .endm 39 | 40 | .macro str1b ptr reg cond=al abort 41 | str\cond\()b \reg, [\ptr], #1 42 | .endm 43 | 44 | .macro enter reg1 reg2 45 | stmdb sp!, {r0, \reg1, \reg2} 46 | .endm 47 | 48 | .macro exit reg1 reg2 49 | ldmfd sp!, {r0, \reg1, \reg2} 50 | .endm 51 | 52 | .text 53 | 54 | /* Prototype: void *memcpy(void *dest, const void *src, size_t n); */ 55 | 56 | ENTRY(memcpy) 57 | 58 | #include "copy_template.S" 59 | 60 | -------------------------------------------------------------------------------- /src/host/layer23/include/osmocom/bb/common/gps.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) 2010 by Andreas Eversberg 3 | * 4 | * All Rights Reserved 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | */ 21 | 22 | enum { 23 | GPS_TYPE_UNDEF, 24 | GPS_TYPE_GPSD, 25 | GPS_TYPE_SERIAL 26 | }; 27 | 28 | struct osmo_gps { 29 | /* GPS device */ 30 | uint8_t enable; 31 | uint8_t gps_type; 32 | 33 | #ifdef _HAVE_GPSD 34 | char gpsd_host[32]; 35 | char gpsd_port[6]; 36 | #endif 37 | 38 | char device[32]; 39 | uint32_t baud; 40 | 41 | /* current data */ 42 | uint8_t valid; /* we have a fix */ 43 | time_t gmt; /* GMT time when position was received */ 44 | double latitude, longitude; 45 | }; 46 | 47 | extern struct osmo_gps g; 48 | 49 | int osmo_gps_open(void); 50 | void osmo_gps_close(void); 51 | void osmo_gps_init(void); 52 | 53 | 54 | -------------------------------------------------------------------------------- /src/shared/libosmocore/src/gsm/gsm0502.c: -------------------------------------------------------------------------------- 1 | /* Paging helper code */ 2 | 3 | /* (C) 2009 by Holger Hans Peter Freyther 4 | * All Rights Reserved 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | */ 20 | 21 | #include 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | unsigned int 29 | gsm0502_calc_paging_group(struct gsm48_control_channel_descr *chan_desc, uint64_t imsi) 30 | { 31 | int ccch_conf; 32 | int bs_cc_chans; 33 | int blocks; 34 | unsigned int group; 35 | 36 | ccch_conf = chan_desc->ccch_conf; 37 | bs_cc_chans = rsl_ccch_conf_to_bs_cc_chans(ccch_conf); 38 | /* code word + 2, as 2 channels equals 0x0 */ 39 | blocks = gsm48_number_of_paging_subchannels(chan_desc); 40 | group = gsm0502_get_paging_group(imsi, bs_cc_chans, blocks); 41 | 42 | return group; 43 | } 44 | -------------------------------------------------------------------------------- /src/shared/libosmocore/tests/smscb/smscb_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) 2010 Holger Hans Peter Freyther 3 | * All Rights Reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along 16 | * with this program; if not, write to the Free Software Foundation, Inc., 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | */ 20 | 21 | #include 22 | 23 | #include 24 | 25 | static uint8_t smscb_msg[] = { 0x40, 0x10, 0x05, 0x0d, 0x01, 0x11 }; 26 | 27 | int main(int argc, char **argv) 28 | { 29 | struct gsm341_ms_message *msg; 30 | 31 | msg = (struct gsm341_ms_message *) smscb_msg; 32 | printf("(srl) GS: %d MSG_CODE: %d UPDATE: %d\n", 33 | msg->serial.gs, GSM341_MSG_CODE(msg), msg->serial.update); 34 | printf("(msg) msg_id: %d\n", htons(msg->msg_id)); 35 | printf("(dcs) group: %d language: %d\n", 36 | msg->dcs.language, msg->dcs.group); 37 | printf("(pge) page total: %d current: %d\n", 38 | msg->page.total, msg->page.current); 39 | 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /src/target/firmware/include/mtk/tdma_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef _MTK_TDMA_H 2 | #define _MTK_TDMA_H 3 | 4 | /* MTK TDMA Timer */ 5 | 6 | /* MT6235 Section 11 */ 7 | 8 | enum mtk_tdma_reg { 9 | /* Read current quarter bit count */ 10 | TDMA_TQCNT = 0x0000, 11 | /* Latched Qbit counter reset position */ 12 | TDMA_WRAP = 0x0004, 13 | /* Direct Qbit counter reset position */ 14 | TDMA_WRAPIMD = 0x0008, 15 | /* Event latch position */ 16 | TDMA_EVTVAL = 0x000c, 17 | /* DSP software control */ 18 | TDMA_DTIRQ = 0x0010, 19 | /* MCU software control */ 20 | TDMA_CTIRQ1 = 0x0014, 21 | TDMA_CTIRQ2 = 0x0018, 22 | /* AFC control */ 23 | TDMA_AFC0 = 0x0020, 24 | TDMA_AFC1 = 0x0024, 25 | TDMA_AFC2 = 0x0028, 26 | TDMA_AFC3 = 0x002c, 27 | 28 | /* BSI event */ 29 | TDMA_BSI0 = 0x00b0, 30 | /* BPI event */ 31 | TDMA_BPI0 = 0x0100, 32 | /* Auxiliary ADC event */ 33 | TDMA_AUXEV0 = 0x0400, 34 | TDMA_AUXEV1 = 0x0404, 35 | /* Event Control */ 36 | TDMA_EVTENA0 = 0x0150, 37 | TDMA_EVTENA1 = 0x0154, 38 | TDMA_EVTENA2 = 0x0158, 39 | TDMA_EVTENA3 = 0x015c, 40 | TDMA_EVTENA4 = 0x0160, 41 | TDMA_EVTENA5 = 0x0164, 42 | TDMA_EVTENA6 = 0x0168, 43 | TDMA_EVTENA6 = 0x016c, 44 | TDMA_WRAPOFS = 0x0170, 45 | TDMA_REGBIAS = 0x0174, 46 | TDMA_DTXCON = 0x0180, 47 | TDMA_RXCON = 0x0184, 48 | TDMA_BDLCON = 0x0188, 49 | TDMA_BULCON1 = 0x018c, 50 | TDMA_BULCON2 = 0x0190, 51 | TDMA_FB_FLAG = 0x0194, 52 | TDMA_FB_CLRI = 0x0198, 53 | }; 54 | 55 | #define TDMA_BSI(n) (TDMA_BSI0 + (n)*4) 56 | #define TDMA_BPI(n) (TDMA_BPI0 + (n)*4) 57 | 58 | 59 | 60 | #endif /* _MTK_TDMA_H */ 61 | -------------------------------------------------------------------------------- /src/target/firmware/calypso/du.c: -------------------------------------------------------------------------------- 1 | /* Calypso DU (Debug Unit) Driver */ 2 | 3 | /* (C) 2010 by Ingo Albrecht 4 | * 5 | * All Rights Reserved 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | #define BASE_ADDR_DU 0x03c00000 30 | #define DU_REG(m) (BASE_ADDR_DU+(m)) 31 | 32 | void calypso_du_init() { 33 | unsigned char c; 34 | calypso_debugunit(1); 35 | for(c = 0; c < 64; c++) { 36 | writew(DU_REG(c), 0x00000000); 37 | } 38 | } 39 | 40 | void calypso_du_stop() { 41 | calypso_debugunit(0); 42 | } 43 | 44 | void calypso_du_dump() { 45 | unsigned char c; 46 | puts("Debug unit traceback:\n"); 47 | for(c = 0; c < 64; c++) { 48 | uint32_t w = readw(DU_REG(c)); 49 | printf("t-%2x: 0x%8x\n", c, (unsigned int)w); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/target/firmware/calypso/dma.c: -------------------------------------------------------------------------------- 1 | /* Driver for Calypso DMA controller */ 2 | 3 | /* (C) 2010 by Harald Welte 4 | * 5 | * All Rights Reserved 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | */ 22 | 23 | #include 24 | 25 | #define BASE_ADDR_DMA 0xfffffc00 26 | 27 | enum dma_reg { 28 | CONTROLLER_CONF = 0x00, 29 | ALLOC_CONFIG = 0x02, 30 | }; 31 | #define DMA_REG(m) (BASE_ADDR_DMA + (m)) 32 | 33 | #define DMA_RAD(x) DMA_REG((x)*0x10 + 0x0) 34 | #define DMA_RDPATH(x) DMA_REG((x)*0x10 + 0x2) 35 | #define DMA_AAD(x) DMA_REG((x)*0x10 + 0x4) 36 | #define DMA_ALGTH(x) DMA_REG((x)*0x10 + 0x6) 37 | #define DMA_CTRL(x) DMA_REG((x)*0x10 + 0x8) 38 | #define DMA_CUR_OFF_API(x) DMA_REG((x)*0x10 + 0xa) 39 | 40 | void dma_init(void) 41 | { 42 | /* DMA 1 (RIF Tx), 2 (RIF Rx) allocated to DSP, all others to ARM */ 43 | writew(0x000c, DMA_REG(ALLOC_CONFIG)); 44 | } 45 | -------------------------------------------------------------------------------- /src/target/firmware/include/layer1/mframe_sched.h: -------------------------------------------------------------------------------- 1 | #ifndef _L1_MFRAME_SCHED_H 2 | #define _L1_MFRAME_SCHED_H 3 | 4 | #include 5 | 6 | enum mframe_task { 7 | MF_TASK_BCCH_NORM, 8 | MF_TASK_BCCH_EXT, 9 | MF_TASK_CCCH, 10 | MF_TASK_CCCH_COMB, 11 | 12 | MF_TASK_SDCCH4_0, 13 | MF_TASK_SDCCH4_1, 14 | MF_TASK_SDCCH4_2, 15 | MF_TASK_SDCCH4_3, 16 | 17 | MF_TASK_SDCCH8_0, 18 | MF_TASK_SDCCH8_1, 19 | MF_TASK_SDCCH8_2, 20 | MF_TASK_SDCCH8_3, 21 | MF_TASK_SDCCH8_4, 22 | MF_TASK_SDCCH8_5, 23 | MF_TASK_SDCCH8_6, 24 | MF_TASK_SDCCH8_7, 25 | 26 | MF_TASK_TCH_F_EVEN, 27 | MF_TASK_TCH_F_ODD, 28 | MF_TASK_TCH_H_0, 29 | MF_TASK_TCH_H_1, 30 | 31 | MF_TASK_NEIGH_PM51, 32 | MF_TASK_NEIGH_PM26E, 33 | MF_TASK_NEIGH_PM26O, 34 | 35 | /* Test task: send Normal Burst in all timeslots */ 36 | MF_TASK_UL_ALL_NB, 37 | }; 38 | 39 | enum mf_sched_item_flag { 40 | MF_F_SACCH = (1 << 0), 41 | }; 42 | 43 | /* The scheduler itself */ 44 | struct mframe_scheduler { 45 | uint32_t tasks; 46 | uint32_t tasks_tgt; 47 | uint32_t safe_fn; 48 | }; 49 | 50 | uint8_t mframe_task2chan_nr(enum mframe_task mft, uint8_t ts); 51 | 52 | /* Enable a specific task */ 53 | void mframe_enable(enum mframe_task task_id); 54 | 55 | /* Disable a specific task */ 56 | void mframe_disable(enum mframe_task task_id); 57 | 58 | /* Replace the current active set by the new one */ 59 | void mframe_set(uint32_t tasks); 60 | 61 | /* Schedule mframe_sched_items according to current MF TASK list */ 62 | void mframe_schedule(void); 63 | 64 | /* reset the scheduler, disabling all tasks */ 65 | void mframe_reset(void); 66 | 67 | #endif /* _MFRAME_SCHED_H */ 68 | -------------------------------------------------------------------------------- /src/target/firmware/include/ctype.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_CTYPE_H 2 | #define _LINUX_CTYPE_H 3 | 4 | /* 5 | * NOTE! This ctype does not handle EOF like the standard C 6 | * library is required to. 7 | */ 8 | 9 | #define _U 0x01 /* upper */ 10 | #define _L 0x02 /* lower */ 11 | #define _D 0x04 /* digit */ 12 | #define _C 0x08 /* cntrl */ 13 | #define _P 0x10 /* punct */ 14 | #define _S 0x20 /* white space (space/lf/tab) */ 15 | #define _X 0x40 /* hex digit */ 16 | #define _SP 0x80 /* hard space (0x20) */ 17 | 18 | extern unsigned char _ctype[]; 19 | 20 | #define __ismask(x) (_ctype[(int)(unsigned char)(x)]) 21 | 22 | #define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0) 23 | #define isalpha(c) ((__ismask(c)&(_U|_L)) != 0) 24 | #define iscntrl(c) ((__ismask(c)&(_C)) != 0) 25 | #define isdigit(c) ((__ismask(c)&(_D)) != 0) 26 | #define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0) 27 | #define islower(c) ((__ismask(c)&(_L)) != 0) 28 | #define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0) 29 | #define ispunct(c) ((__ismask(c)&(_P)) != 0) 30 | #define isspace(c) ((__ismask(c)&(_S)) != 0) 31 | #define isupper(c) ((__ismask(c)&(_U)) != 0) 32 | #define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0) 33 | 34 | #define isascii(c) (((unsigned char)(c))<=0x7f) 35 | #define toascii(c) (((unsigned char)(c))&0x7f) 36 | 37 | static inline unsigned char __tolower(unsigned char c) 38 | { 39 | if (isupper(c)) 40 | c -= 'A'-'a'; 41 | return c; 42 | } 43 | 44 | static inline unsigned char __toupper(unsigned char c) 45 | { 46 | if (islower(c)) 47 | c -= 'a'-'A'; 48 | return c; 49 | } 50 | 51 | #define tolower(c) __tolower(c) 52 | #define toupper(c) __toupper(c) 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/target/firmware/apps/chainload/main.c: -------------------------------------------------------------------------------- 1 | /* Compal ramloader -> Calypso romloader Chainloading application */ 2 | 3 | /* (C) 2010 by Steve Markgraf 4 | * 5 | * All Rights Reserved 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | /* Main Program */ 34 | 35 | static void device_enter_loader(unsigned char bootrom) { 36 | calypso_bootrom(bootrom); 37 | void (*entry)( void ) = (void (*)(void))0; 38 | entry(); 39 | } 40 | 41 | int main(void) 42 | { 43 | /* Always disable wdt (some platforms enable it on boot) */ 44 | wdog_enable(0); 45 | 46 | /* enable Calypso romloader mapping and jump there */ 47 | delay_ms(200); 48 | device_enter_loader(1); 49 | 50 | /* Not reached */ 51 | while(1) { 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/gsm/mncc.h: -------------------------------------------------------------------------------- 1 | #ifndef _OSMOCORE_MNCC_H 2 | #define _OSMOCORE_MNCC_H 3 | 4 | #define GSM_MAX_FACILITY 128 5 | #define GSM_MAX_SSVERSION 128 6 | #define GSM_MAX_USERUSER 128 7 | 8 | /* Expanded fields from GSM TS 04.08, Table 10.5.102 */ 9 | struct gsm_mncc_bearer_cap { 10 | int transfer; /* Information Transfer Capability */ 11 | int mode; /* Transfer Mode */ 12 | int coding; /* Coding Standard */ 13 | int radio; /* Radio Channel Requirement */ 14 | int speech_ctm; /* CTM text telephony indication */ 15 | int speech_ver[8]; /* Speech version indication */ 16 | }; 17 | 18 | struct gsm_mncc_number { 19 | int type; 20 | int plan; 21 | int present; 22 | int screen; 23 | char number[33]; 24 | }; 25 | 26 | struct gsm_mncc_cause { 27 | int location; 28 | int coding; 29 | int rec; 30 | int rec_val; 31 | int value; 32 | int diag_len; 33 | char diag[32]; 34 | }; 35 | 36 | struct gsm_mncc_useruser { 37 | int proto; 38 | char info[GSM_MAX_USERUSER + 1]; /* + termination char */ 39 | }; 40 | 41 | struct gsm_mncc_progress { 42 | int coding; 43 | int location; 44 | int descr; 45 | }; 46 | 47 | struct gsm_mncc_facility { 48 | int len; 49 | char info[GSM_MAX_FACILITY]; 50 | }; 51 | 52 | struct gsm_mncc_ssversion { 53 | int len; 54 | char info[GSM_MAX_SSVERSION]; 55 | }; 56 | 57 | struct gsm_mncc_cccap { 58 | int dtmf; 59 | int pcp; 60 | }; 61 | 62 | enum { 63 | GSM_MNCC_BCAP_SPEECH = 0, 64 | GSM_MNCC_BCAP_UNR_DIG = 1, 65 | GSM_MNCC_BCAP_AUDIO = 2, 66 | GSM_MNCC_BCAP_FAX_G3 = 3, 67 | GSM_MNCC_BCAP_OTHER_ITC = 5, 68 | GSM_MNCC_BCAP_RESERVED = 7, 69 | }; 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /src/shared/libosmocore/tests/msgfile/msgfile_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) 2010 by Holger Hans Peter Freyther 3 | * (C) 2010 by On-Waves 4 | * All Rights Reserved 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | */ 21 | 22 | #include 23 | 24 | #include 25 | 26 | static void dump_entries(struct osmo_config_list *entries) 27 | { 28 | struct osmo_config_entry *entry; 29 | 30 | if (!entries) { 31 | fprintf(stderr, "Failed to parse the file\n"); 32 | return; 33 | } 34 | 35 | llist_for_each_entry(entry, &entries->entry, list) { 36 | printf("Entry '%s:%s:%s:%s'\n", 37 | entry->mcc, entry->mnc, entry->option, entry->text); 38 | } 39 | } 40 | 41 | int main(int argc, char **argv) 42 | { 43 | struct osmo_config_list *entries; 44 | 45 | /* todo use msgfile_test.c.in and replace the path */ 46 | entries = osmo_config_list_parse(NULL, "msgconfig.cfg"); 47 | dump_entries(entries); 48 | 49 | return 0; 50 | } 51 | -------------------------------------------------------------------------------- /src/target/firmware/calypso/misc.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | 6 | /* dump a memory range */ 7 | void memdump_range(unsigned int *ptr, unsigned int len) 8 | { 9 | unsigned int *end = ptr + (len/4); 10 | unsigned int *tmp; 11 | 12 | for (tmp = ptr; tmp < end; tmp += 8) { 13 | int i; 14 | printf("%08X: ", (unsigned int) tmp); 15 | 16 | for (i = 0; i < 8; i++) 17 | printf("%08X %s", *(tmp+i), i == 3 ? " " : ""); 18 | 19 | putchar('\n'); 20 | } 21 | } 22 | 23 | #define KBIT 1024 24 | #define MBIT (1024*KBIT) 25 | void dump_mem(void) 26 | { 27 | puts("Dump 64kBits of internal ROM\n"); 28 | memdump_range((void *)0x03800000, 64*KBIT/8); 29 | 30 | puts("Dump 8Mbits of external flash\n"); 31 | memdump_range((void *)0x00000000, 8*MBIT/8); 32 | 33 | puts("Dump 2Mbits of internal RAM\n"); 34 | memdump_range((void *)0x00800000, 2*MBIT/8); 35 | 36 | puts("Dump 2Mbits of external RAM\n"); 37 | memdump_range((void *)0x01000000, 2*MBIT/8); 38 | } 39 | 40 | #define REG_DEV_ID_CODE 0xfffef000 41 | #define REG_DEV_VER_CODE 0xfffef002 42 | #define REG_DEV_ARMVER_CODE 0xfffffe00 43 | #define REG_cDSP_ID_CODE 0xfffffe02 44 | #define REG_DIE_ID_CODE 0xfffef010 45 | 46 | void dump_dev_id(void) 47 | { 48 | int i; 49 | 50 | printf("Device ID code: 0x%04x\n", readw(REG_DEV_ID_CODE)); 51 | printf("Device Version code: 0x%04x\n", readw(REG_DEV_VER_CODE)); 52 | printf("ARM ID code: 0x%04x\n", readw(REG_DEV_ARMVER_CODE)); 53 | printf("cDSP ID code: 0x%04x\n", readw(REG_cDSP_ID_CODE)); 54 | puts("Die ID code: "); 55 | for (i = 0; i < 64/8; i += 4) 56 | printf("%08x", readl(REG_DIE_ID_CODE+i)); 57 | putchar('\n'); 58 | } 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/target/firmware/board/compal_e88/LINKAGE.txt: -------------------------------------------------------------------------------- 1 | 2 | The Compal E88 supports the common Compal RAM linkages. 3 | These operate entirely from the Calypso internal RAM. 4 | 5 | Flash linkages are structured as follows: 6 | 7 | e88loader: 8 | Linked at address of original compal application (0x2000). 9 | Provides interrupt vectors as expected by compal loader. 10 | Allows interrupt redirection (XXX to where?). 11 | 12 | We introduce this for the following reasons: 13 | 1. We want to start our app at 0x10000, because that 14 | is the first flash page after the loader page, allowing 15 | us a higher degree of "unbrickability" by never reflashing 16 | the bootloader. 17 | 2. We want to keep the compal loader so we do not need even 18 | more boot options and to allow recovery of original firmware. 19 | 3. When there is a custom app in flash at 0xFFFF, just turning 20 | the phone on with the compal loader would jump into an incomplete 21 | motorola app. That might not even allow turning the phone off. 22 | The loader provides this functionality. 23 | 4. We do not want to patch the compal loader for interrupt 24 | redirect and entry vectors. So we need to place something between 25 | 0x2000 and 0x10000 anyway. And since there is space, why not put 26 | the whole loader in there. 27 | 5. This loader has a good chance of being able to read crash buffers. 28 | and examining RAM without it being clobbered by a ram upload. 29 | 30 | e88flash: 31 | Our main application linkage, starting at 0x10000 and going through 32 | all of flash. Data storage locations are still to be determined. 33 | 34 | -------------------------------------------------------------------------------- /src/host/layer23/src/misc/prediction_methods/sysinfo.py: -------------------------------------------------------------------------------- 1 | from predictionMethod import PredictionMethod 2 | 3 | class SysInfo(PredictionMethod): 4 | def Predict(self, frames, args): 5 | select= 0 6 | if "select" in args: 7 | if args["select"]=="last": 8 | select=-1 9 | 10 | sys_info= frames.xpath("/scan/frame/system_information")[select].getparent() 11 | if "filter" in args: 12 | sys_info= frames.xpath("/scan/frame[system_information="+str(args["filter"])+"]")[select] 13 | if not sys_info: 14 | return (None,None) 15 | 16 | offset= 102 17 | if "offset" in args: offset=int(args["offset"]) 18 | 19 | cfn= int(sys_info.xpath("burst")[-1].attrib["fn"])+int(offset) 20 | print("SysInfo ", sys_info.xpath("system_information")[0].text," is at frame", 21 | sys_info.xpath("burst")[-1].attrib["fn"], "with count", 22 | len(frames.xpath("/scan/frame/system_information"))) 23 | 24 | prediction_data= sys_info.xpath("data")[0].text.strip() 25 | if "data" in args: prediction_data= args["data"] 26 | 27 | #should we change timing advance 28 | if "ta" in args: 29 | prediction_data= self._alterByte( prediction_data, 1, int(args["ta"]) ) 30 | 31 | #should we change power level 32 | if "pl" in args: 33 | prediction_data= self._alterByte( prediction_data, 0, int(args["pl"]) ) 34 | 35 | cframe= frames.xpath("/scan/frame/burst[@fn="+str(cfn)+"]")[0].getparent() 36 | 37 | return (prediction_data, cframe) 38 | 39 | def __init__(self): 40 | PredictionMethod.__init__(self, "sysinfo", "all") 41 | -------------------------------------------------------------------------------- /src/target/firmware/board/compal/macros.S: -------------------------------------------------------------------------------- 1 | 2 | .macro clear_bss 3 | mov r0, #0 4 | ldr r1, =__bss_start 5 | ldr r2, =__bss_end 6 | loop_bss: 7 | cmp r1, r2 8 | strlo r0, [r1], #4 9 | blo loop_bss 10 | .endm 11 | 12 | .macro copy_data 13 | ldr r0, =__data_start 14 | ldr r1, =_data_start 15 | ldr r2, =__data_end 16 | cmp r0, r2 17 | beq done_data 18 | loop_data: 19 | ldrb r4, [r0], #1 20 | strb r4, [r1], #1 21 | cmp r0, r2 22 | bne loop_data 23 | done_data: 24 | .endm 25 | 26 | .macro copy_ramtext 27 | ldr r0, =__ramtext_start 28 | ldr r1, =_ramtext_start 29 | ldr r2, =__ramtext_end 30 | cmp r0, r2 31 | beq done_ramtext 32 | loop_ramtext: 33 | ldrb r4, [r0], #1 34 | strb r4, [r1], #1 35 | cmp r0, r2 36 | bne loop_ramtext 37 | done_ramtext: 38 | .endm 39 | 40 | .EQU ARM_MODE_FIQ, 0x11 41 | .EQU ARM_MODE_IRQ, 0x12 42 | .EQU ARM_MODE_SVC, 0x13 43 | 44 | .EQU I_BIT, 0x80 45 | .EQU F_BIT, 0x40 46 | 47 | #define TOP_OF_RAM 0x083fff0 48 | #define FIQ_STACK_SIZE 1024 49 | #define IRQ_STACK_SIZE 1024 50 | 51 | .macro init_stacks 52 | /* initialize stacks, starting at TOP_OF_RAM */ 53 | ldr r0, =TOP_OF_RAM 54 | 55 | /* initialize FIQ stack */ 56 | msr CPSR_c, #ARM_MODE_FIQ | I_BIT | F_BIT 57 | mov r13, r0 58 | sub r0, r0, #FIQ_STACK_SIZE 59 | 60 | /* initialize IRQ stack */ 61 | msr CPSR_c, #ARM_MODE_IRQ | I_BIT | F_BIT 62 | mov r13, r0 63 | sub r0, r0, #IRQ_STACK_SIZE 64 | 65 | /* initialize supervisor stack */ 66 | msr CPSR_c, #ARM_MODE_SVC | I_BIT | F_BIT 67 | mov r13, r0 68 | .endm 69 | 70 | .macro call_ctors 71 | /* call constructor functions */ 72 | ldr r0, =_ctor_start 73 | ldr r1, =_ctor_end 74 | bl do_global_ctors 75 | .endm 76 | 77 | -------------------------------------------------------------------------------- /src/target/firmware/include/comm/sercomm.h: -------------------------------------------------------------------------------- 1 | #ifndef _SERCOMM_H 2 | #define _SERCOMM_H 3 | 4 | /* SERCOMM layer on UART1 (modem UART) */ 5 | 6 | #include 7 | 8 | #define SERCOMM_UART_NR 1 9 | 10 | #define HDLC_FLAG 0x7E 11 | #define HDLC_ESCAPE 0x7D 12 | 13 | #define HDLC_C_UI 0x03 14 | #define HDLC_C_P_BIT (1 << 4) 15 | #define HDLC_C_F_BIT (1 << 4) 16 | 17 | /* a low sercomm_dlci means high priority. A high DLCI means low priority */ 18 | enum sercomm_dlci { 19 | SC_DLCI_HIGHEST = 0, 20 | SC_DLCI_DEBUG = 4, 21 | SC_DLCI_L1A_L23 = 5, 22 | SC_DLCI_LOADER = 9, 23 | SC_DLCI_CONSOLE = 10, 24 | SC_DLCI_ECHO = 128, 25 | _SC_DLCI_MAX 26 | }; 27 | 28 | void sercomm_init(void); 29 | int sercomm_initialized(void); 30 | 31 | /* User Interface: Tx */ 32 | 33 | /* user interface for transmitting messages for a given DLCI */ 34 | void sercomm_sendmsg(uint8_t dlci, struct msgb *msg); 35 | /* how deep is the Tx queue for a given DLCI */ 36 | unsigned int sercomm_tx_queue_depth(uint8_t dlci); 37 | 38 | /* User Interface: Rx */ 39 | 40 | /* receiving messages for a given DLCI */ 41 | typedef void (*dlci_cb_t)(uint8_t dlci, struct msgb *msg); 42 | int sercomm_register_rx_cb(uint8_t dlci, dlci_cb_t cb); 43 | 44 | /* Driver Interface */ 45 | 46 | /* fetch one octet of to-be-transmitted serial data. returns 0 if no more data */ 47 | int sercomm_drv_pull(uint8_t *ch); 48 | /* the driver has received one byte, pass it into sercomm layer. 49 | returns 1 in case of success, 0 in case of unrecognized char */ 50 | int sercomm_drv_rx_char(uint8_t ch); 51 | 52 | static inline struct msgb *sercomm_alloc_msgb(unsigned int len) 53 | { 54 | return msgb_alloc_headroom(len+4, 4, "sercomm_tx"); 55 | } 56 | 57 | #endif /* _SERCOMM_H */ 58 | -------------------------------------------------------------------------------- /src/target/firmware/board/mediatek/macros.S: -------------------------------------------------------------------------------- 1 | 2 | .macro clear_bss 3 | mov r0, #0 4 | ldr r1, =__bss_start 5 | ldr r2, =__bss_end 6 | loop_bss: 7 | cmp r1, r2 8 | strlo r0, [r1], #4 9 | blo loop_bss 10 | .endm 11 | 12 | .macro copy_data 13 | ldr r0, =__data_start 14 | ldr r1, =_data_start 15 | ldr r2, =__data_end 16 | cmp r0, r2 17 | beq done_data 18 | loop_data: 19 | ldrb r4, [r0], #1 20 | strb r4, [r1], #1 21 | cmp r0, r2 22 | bne loop_data 23 | done_data: 24 | .endm 25 | 26 | .macro copy_ramtext 27 | ldr r0, =__ramtext_start 28 | ldr r1, =_ramtext_start 29 | ldr r2, =__ramtext_end 30 | cmp r0, r2 31 | beq done_ramtext 32 | loop_ramtext: 33 | ldrb r4, [r0], #1 34 | strb r4, [r1], #1 35 | cmp r0, r2 36 | bne loop_ramtext 37 | done_ramtext: 38 | .endm 39 | 40 | .EQU ARM_MODE_FIQ, 0x11 41 | .EQU ARM_MODE_IRQ, 0x12 42 | .EQU ARM_MODE_SVC, 0x13 43 | 44 | .EQU I_BIT, 0x80 45 | .EQU F_BIT, 0x40 46 | 47 | #define TOP_OF_RAM 0x4000a000 48 | #define FIQ_STACK_SIZE 1024 49 | #define IRQ_STACK_SIZE 1024 50 | 51 | .macro init_stacks 52 | /* initialize stacks, starting at TOP_OF_RAM */ 53 | ldr r0, =TOP_OF_RAM 54 | 55 | /* initialize FIQ stack */ 56 | msr CPSR_c, #ARM_MODE_FIQ | I_BIT | F_BIT 57 | mov r13, r0 58 | sub r0, r0, #FIQ_STACK_SIZE 59 | 60 | /* initialize IRQ stack */ 61 | msr CPSR_c, #ARM_MODE_IRQ | I_BIT | F_BIT 62 | mov r13, r0 63 | sub r0, r0, #IRQ_STACK_SIZE 64 | 65 | /* initialize supervisor stack */ 66 | msr CPSR_c, #ARM_MODE_SVC | I_BIT | F_BIT 67 | mov r13, r0 68 | .endm 69 | 70 | .macro call_ctors 71 | /* call constructor functions */ 72 | ldr r0, =_ctor_start 73 | ldr r1, =_ctor_end 74 | bl do_global_ctors 75 | .endm 76 | 77 | -------------------------------------------------------------------------------- /src/target/ui-experiment/ui.h: -------------------------------------------------------------------------------- 1 | 2 | /****** MESSAGING MENU ******/ 3 | 4 | struct menu menu_message_compose = { 5 | .title = "Compose", 6 | .help = "Write a new text message." 7 | }; 8 | 9 | struct menu menu_message_inbox = { 10 | .title = "Inbox", 11 | .help = "Incoming text messages" 12 | }; 13 | 14 | struct menu menu_message_outbox = { 15 | .title = "Outbox", 16 | .help = "Outgoing text messages" 17 | }; 18 | 19 | struct menu menu_message_sent = { 20 | .title = "Sent", 21 | .help = "Previously sent text messages" 22 | }; 23 | 24 | struct menu menu_messages = { 25 | .title = "Messages", 26 | .help = "Short message service options", 27 | .children = { 28 | [0] = &menu_message_compose, 29 | [1] = &menu_message_inbox, 30 | [2] = &menu_message_outbox, 31 | [3] = &menu_message_sent 32 | } 33 | }; 34 | 35 | /****** NETWORK MENU ******/ 36 | 37 | struct menu menu_network_about = { 38 | .title = "About this network", 39 | .help = "Information about your current network", 40 | }; 41 | 42 | struct menu menu_network = { 43 | .title = "Network", 44 | .help = "Network interaction options", 45 | .children = { 46 | } 47 | }; 48 | 49 | /****** SETTINGS MENU ******/ 50 | 51 | struct menu menu_settings = { 52 | .title = "Settings", 53 | .help = "Configure your phone", 54 | .children = { 55 | } 56 | }; 57 | 58 | /****** MAIN MENU ******/ 59 | 60 | struct menu menu_about = { 61 | .title = "About", 62 | .help = "Information about this phone", 63 | }; 64 | 65 | struct menu menu_main = { 66 | .title = "Main Menu", 67 | .children = { 68 | [0] = &menu_messages, 69 | [7] = &menu_network, 70 | [8] = &menu_settings, 71 | [9] = &menu_about, 72 | }, 73 | }; 74 | 75 | 76 | 77 | int 78 | main(void) { 79 | &menu_main; 80 | return 0; 81 | }; 82 | -------------------------------------------------------------------------------- /src/target/firmware/include/mtk/emi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) 2010 by Tieto 3 | * Marcin Mielczarczyk 4 | * 5 | * All Rights Reserved 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | */ 22 | 23 | #ifndef __MTK_EMI_H_ 24 | #define __MTK_EMI_H_ 25 | 26 | /* External Memory Interface register definitions */ 27 | #define MTK_EMI_CONA (MTK_EMI_BASE + 0x00) 28 | #define MTK_EMI_CONB (MTK_EMI_BASE + 0x08) 29 | #define MTK_EMI_CONC (MTK_EMI_BASE + 0x10) 30 | #define MTK_EMI_COND (MTK_EMI_BASE + 0x18) 31 | #define MTK_EMI_CONI (MTK_EMI_BASE + 0x40) 32 | #define MTK_EMI_CONJ (MTK_EMI_BASE + 0x48) 33 | #define MTK_EMI_CONK (MTK_EMI_BASE + 0x50) 34 | #define MTK_EMI_CONL (MTK_EMI_BASE + 0x58) 35 | #define MTK_EMI_CONM (MTK_EMI_BASE + 0x60) 36 | #define MTK_EMI_CONN (MTK_EMI_BASE + 0x68) 37 | #define MTK_EMI_GENA (MTK_EMI_BASE + 0x70) 38 | #define MTK_EMI_GENB (MTK_EMI_BASE + 0x78) 39 | #define MTK_EMI_GENC (MTK_EMI_BASE + 0x80) 40 | #define MTK_EMI_GEND (MTK_EMI_BASE + 0x88) 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/gsm/a5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * a5.h 3 | * 4 | * Copyright (C) 2011 Sylvain Munaut 5 | * 6 | * All Rights Reserved 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along 19 | * with this program; if not, write to the Free Software Foundation, Inc., 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 21 | */ 22 | 23 | #ifndef __OSMO_A5_H__ 24 | #define __OSMO_A5_H__ 25 | 26 | #include 27 | 28 | #include 29 | 30 | static inline uint32_t 31 | osmo_a5_fn_count(uint32_t fn) 32 | { 33 | int t1 = fn / (26 * 51); 34 | int t2 = fn % 26; 35 | int t3 = fn % 51; 36 | return (t1 << 11) | (t3 << 5) | t2; 37 | } 38 | 39 | /* Notes: 40 | * - key must be 8 bytes long (or NULL for A5/0) 41 | * - the dl and ul pointer must be either NULL or 114 bits long 42 | * - fn is the _real_ GSM frame number. 43 | * (converted internally to fn_count) 44 | */ 45 | void osmo_a5(int n, uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul); 46 | void osmo_a5_1(uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul); 47 | void osmo_a5_2(uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul); 48 | 49 | #endif /* __OSMO_A5_H__ */ 50 | -------------------------------------------------------------------------------- /src/shared/libosmocore/src/plugin.c: -------------------------------------------------------------------------------- 1 | /* plugin infrastructure */ 2 | 3 | /* (C) 2010 by Harald Welte 4 | * 5 | * All Rights Reserved 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | */ 22 | 23 | #include "../config.h" 24 | 25 | #if HAVE_DLFCN_H 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include 34 | 35 | int osmo_plugin_load_all(const char *directory) 36 | { 37 | unsigned int num = 0; 38 | char fname[PATH_MAX]; 39 | DIR *dir; 40 | struct dirent *entry; 41 | 42 | dir = opendir(directory); 43 | if (!dir) 44 | return -errno; 45 | 46 | while ((entry = readdir(dir))) { 47 | snprintf(fname, sizeof(fname), "%s/%s", directory, 48 | entry->d_name); 49 | if (dlopen(fname, RTLD_NOW)) 50 | num++; 51 | } 52 | 53 | closedir(dir); 54 | 55 | return num; 56 | } 57 | #else 58 | int osmo_plugin_load_all(const char *directory) 59 | { 60 | return 0; 61 | } 62 | #endif /* HAVE_DLFCN_H */ 63 | -------------------------------------------------------------------------------- /src/target/firmware/include/layer1/async.h: -------------------------------------------------------------------------------- 1 | #ifndef _L1_ASYNC_H 2 | #define _L1_ASYNC_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | #if 0 9 | NOTE: Re-enabling interrupts causes an IRQ while processing the same IRQ. 10 | Use local_firq_save and local_irq_restore instead! 11 | 12 | /* When altering data structures used by L1 Sync part, we need to 13 | * make sure to temporarily disable IRQ/FIQ to keep data consistent */ 14 | static inline void l1a_lock_sync(void) 15 | { 16 | arm_disable_interrupts(); 17 | } 18 | 19 | static inline void l1a_unlock_sync(void) 20 | { 21 | arm_enable_interrupts(); 22 | } 23 | #endif 24 | 25 | /* safely enable a message into the L1S TX queue */ 26 | void l1a_txq_msgb_enq(struct llist_head *queue, struct msgb *msg); 27 | void l1a_meas_msgb_set(struct msgb *msg); 28 | 29 | /* safely count messages in the L1S TX queue */ 30 | int l1a_txq_msgb_count(struct llist_head *queue); 31 | 32 | /* flush all pending msgb */ 33 | void l1a_txq_msgb_flush(struct llist_head *queue); 34 | 35 | /* request a RACH */ 36 | void l1a_rach_req(uint16_t offset, uint8_t combined, uint8_t ra); 37 | 38 | /* schedule frequency change */ 39 | void l1a_freq_req(uint32_t fn_sched); 40 | 41 | /* Enable a repeating multiframe task */ 42 | void l1a_mftask_enable(enum mframe_task task); 43 | 44 | /* Disable a repeating multiframe task */ 45 | void l1a_mftask_disable(enum mframe_task task); 46 | 47 | /* Set TCH mode */ 48 | uint8_t l1a_tch_mode_set(uint8_t mode); 49 | 50 | /* Set Audio routing mode */ 51 | uint8_t l1a_audio_mode_set(uint8_t mode); 52 | 53 | /* Execute pending L1A completions */ 54 | void l1a_compl_execute(void); 55 | 56 | /* Initialize asynchronous part of Layer1 */ 57 | void l1a_init(void); 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/target/firmware/include/rf/trf6151.h: -------------------------------------------------------------------------------- 1 | #ifndef _TRF6151_H 2 | #define _TRF6151_H 3 | 4 | #include 5 | 6 | /* initialize (reset + power up) */ 7 | void trf6151_init(uint8_t tsp_uid, uint16_t tsp_reset_id); 8 | 9 | /* switch power off or on */ 10 | void trf6151_power(int on); 11 | 12 | /* obtain the current total gain of the TRF6151 */ 13 | uint8_t trf6151_get_gain_reg(void); 14 | 15 | /* put current set (or computed) gain to register */ 16 | int trf6151_set_gain_reg(uint8_t dbm, int high); 17 | 18 | /* set the global gain to use */ 19 | int trf6151_set_gain(uint8_t dbm); 20 | 21 | /* obtain the global gain set */ 22 | uint8_t trf6151_get_gain(void); 23 | 24 | /* Request the PLL to be tuned to the given frequency */ 25 | /* arfcn must have ARFCN_UPLINK flag set if you want uplink ! */ 26 | /* tx selects the TX path only and doesn't set UL band ! */ 27 | void trf6151_set_arfcn(uint16_t arfcn, int tx); 28 | 29 | enum trf6151_mode { 30 | TRF6151_IDLE, 31 | TRF6151_RX, 32 | TRF6151_TX, 33 | }; 34 | 35 | /* Set the operational mode of the TRF6151 chip */ 36 | void trf6151_set_mode(enum trf6151_mode mode); 37 | 38 | void trf6151_test(uint16_t arfcn); 39 | void trf6151_tx_test(uint16_t arfcn); 40 | 41 | /* prepare a Rx window with the TRF6151 finished at time 'start' (in qbits) */ 42 | void trf6151_rx_window(int16_t start_qbits, uint16_t arfcn); 43 | 44 | /* prepare a Tx window with the TRF6151 finished at time 'start' (in qbits) */ 45 | void trf6151_tx_window(int16_t start_qbits, uint16_t arfcn); 46 | 47 | /* Given the expected input level of exp_inp dBm and the target of target_bb 48 | * dBm, configure the RF Frontend with the respective gain */ 49 | void trf6151_compute_gain(int16_t exp_inp, int16_t target_bb); 50 | 51 | #endif /* TRF6151_H */ 52 | -------------------------------------------------------------------------------- /src/target/firmware/layer1/avg.c: -------------------------------------------------------------------------------- 1 | /* Averaging Implementation */ 2 | 3 | /* (C) 2010 by Harald Welte 4 | * 5 | * All Rights Reserved 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | 27 | /* input a new sample into the averaging process */ 28 | void runavg_input(struct running_avg *ravg, int32_t val, int valid) 29 | { 30 | ravg->num_samples++; 31 | if (valid) { 32 | ravg->acc_val += val; 33 | ravg->num_samples_valid++; 34 | } 35 | } 36 | 37 | /* check if sufficient samples have been obtained, and call outfn() */ 38 | int runavg_check_output(struct running_avg *ravg) 39 | { 40 | if (ravg->num_samples < ravg->period) 41 | return 0; 42 | 43 | if (ravg->num_samples_valid >= ravg->min_valid) { 44 | int32_t avg = ravg->acc_val / ravg->num_samples_valid; 45 | 46 | ravg->outfn(ravg, avg); 47 | 48 | ravg->num_samples = ravg->num_samples_valid = 0; 49 | ravg->acc_val = 0; 50 | 51 | return 1; 52 | } 53 | 54 | return 0; 55 | } 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/core/statistics.h: -------------------------------------------------------------------------------- 1 | #ifndef _STATISTICS_H 2 | #define _STATISTICS_H 3 | 4 | /*! \file statistics.h 5 | * \brief Common routines regarding statistics */ 6 | 7 | /*! structure representing a single counter */ 8 | struct osmo_counter { 9 | struct llist_head list; /*!< \brief internal list head */ 10 | const char *name; /*!< \brief human-readable name */ 11 | const char *description; /*!< \brief humn-readable description */ 12 | unsigned long value; /*!< \brief current value */ 13 | }; 14 | 15 | /*! \brief Increment counter */ 16 | static inline void osmo_counter_inc(struct osmo_counter *ctr) 17 | { 18 | ctr->value++; 19 | } 20 | 21 | /*! \brief Get current value of counter */ 22 | static inline unsigned long osmo_counter_get(struct osmo_counter *ctr) 23 | { 24 | return ctr->value; 25 | } 26 | 27 | /*! \brief Reset current value of counter to 0 */ 28 | static inline void osmo_counter_reset(struct osmo_counter *ctr) 29 | { 30 | ctr->value = 0; 31 | } 32 | 33 | /*! \brief Allocate a new counter */ 34 | struct osmo_counter *osmo_counter_alloc(const char *name); 35 | 36 | /*! \brief Free the specified counter 37 | * \param[ctr] Counter 38 | */ 39 | void osmo_counter_free(struct osmo_counter *ctr); 40 | 41 | /*! \brief Iteate over all counters 42 | * \param[in] handle_counter Call-back function 43 | * \param[in] data Private dtata handed through to \a handle_counter 44 | */ 45 | int osmo_counters_for_each(int (*handle_counter)(struct osmo_counter *, void *), void *data); 46 | 47 | /*! \brief Resolve counter by human-readable name 48 | * \param[in] name human-readable name of counter 49 | * \returns pointer to counter (\ref osmo_counter) or NULL otherwise 50 | */ 51 | struct osmo_counter *osmo_counter_get_by_name(const char *name); 52 | 53 | #endif /* _STATISTICS_H */ 54 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/core/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef OSMOCORE_UTIL_H 2 | #define OSMOCORE_UTIL_H 3 | 4 | /*! \defgroup utils General-purpose utility functions 5 | * @{ 6 | */ 7 | 8 | /*! \file utils.h */ 9 | 10 | /*! \brief Determine number of elements in an array of static size */ 11 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 12 | /*! \brief Return the maximum of two specified values */ 13 | #define OSMO_MAX(a, b) (a) >= (b) ? (a) : (b) 14 | /*! \brief Return the minimum of two specified values */ 15 | #define OSMO_MIN(a, b) (a) >= (b) ? (b) : (a) 16 | 17 | #include 18 | 19 | /*! \brief A mapping between human-readable string and numeric value */ 20 | struct value_string { 21 | unsigned int value; /*!< \brief numeric value */ 22 | const char *str; /*!< \brief human-readable string */ 23 | }; 24 | 25 | const char *get_value_string(const struct value_string *vs, uint32_t val); 26 | 27 | int get_string_value(const struct value_string *vs, const char *str); 28 | 29 | char osmo_bcd2char(uint8_t bcd); 30 | /* only works for numbers in ascci */ 31 | uint8_t osmo_char2bcd(char c); 32 | 33 | int osmo_hexparse(const char *str, uint8_t *b, int max_len); 34 | 35 | char *osmo_ubit_dump(const uint8_t *bits, unsigned int len); 36 | char *osmo_hexdump(const unsigned char *buf, int len); 37 | char *osmo_hexdump_nospc(const unsigned char *buf, int len); 38 | 39 | #define osmo_static_assert(exp, name) typedef int dummy##name [(exp) ? 1 : -1]; 40 | 41 | void osmo_str2lower(char *out, const char *in); 42 | void osmo_str2upper(char *out, const char *in); 43 | 44 | #define OSMO_SNPRINTF_RET(ret, rem, offset, len) \ 45 | do { \ 46 | len += ret; \ 47 | if (ret > rem) \ 48 | ret = rem; \ 49 | offset += ret; \ 50 | rem -= ret; \ 51 | } while (0) 52 | 53 | /*! }@ */ 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/shared/libosmocore/debian/patches/debian-changes-0.1.17-1: -------------------------------------------------------------------------------- 1 | Description: Upstream changes introduced in version 0.1.17-1 2 | This patch has been created by dpkg-source during the package build. 3 | Here's the last changelog entry, hopefully it gives details on why 4 | those changes were made: 5 | . 6 | libosmocore (0.1.17-1) unstable; urgency=low 7 | . 8 | * Initial release (Closes: #nnnn) 9 | . 10 | The person named in the Author field signed this changelog entry. 11 | Author: Harald Welte 12 | 13 | --- 14 | The information above should follow the Patch Tagging Guidelines, please 15 | checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here 16 | are templates for supplementary fields that you might want to add: 17 | 18 | Origin: , 19 | Bug: 20 | Bug-Debian: http://bugs.debian.org/ 21 | Bug-Ubuntu: https://launchpad.net/bugs/ 22 | Forwarded: 23 | Reviewed-By: 24 | Last-Update: 25 | 26 | --- /dev/null 27 | +++ libosmocore-0.1.17/.version 28 | @@ -0,0 +1 @@ 29 | +0.1.17 30 | --- /dev/null 31 | +++ libosmocore-0.1.17/copyright 32 | @@ -0,0 +1,14 @@ 33 | +Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135 34 | +Name: libosmocore 35 | +Maintainer: Harald Welte 36 | +Source: git://git.osmocom.org/libosmocore.git 37 | + 38 | +Copyright: 2008-2010 Harald Welte 39 | +License: GPL-2+ 40 | + 41 | +Files: src/talloc.c include/osmocore/talloc.h 42 | +Copyright: 2004 Andrew Tridgell 43 | +License: LGPL-3+ 44 | + 45 | +Files: include/osmocore/linuxlist.h 46 | +License: GPL-2 47 | -------------------------------------------------------------------------------- /src/host/gsmmap/log.h: -------------------------------------------------------------------------------- 1 | 2 | enum { 3 | LOG_TYPE_NONE = 0, 4 | LOG_TYPE_SYSINFO, 5 | LOG_TYPE_POWER, 6 | }; 7 | 8 | struct power { 9 | uint8_t gps_valid; 10 | double longitude, latitude; 11 | time_t gmt; 12 | int8_t rxlev[1024]; 13 | }; 14 | 15 | struct node_power { 16 | struct node_power *next; 17 | struct power power; 18 | }; 19 | 20 | struct node_mcc { 21 | struct node_mcc *next; 22 | uint16_t mcc; 23 | struct node_mnc *mnc; 24 | }; 25 | 26 | struct node_mnc { 27 | struct node_mnc *next; 28 | uint16_t mnc; 29 | struct node_lac *lac; 30 | }; 31 | 32 | struct node_lac { 33 | struct node_lac *next; 34 | uint16_t lac; 35 | struct node_cell *cell; 36 | }; 37 | 38 | struct sysinfo { 39 | uint16_t arfcn; 40 | int8_t rxlev; 41 | uint8_t bsic; 42 | uint8_t gps_valid; 43 | double longitude, latitude; 44 | time_t gmt; 45 | uint8_t si1[23]; 46 | uint8_t si2[23]; 47 | uint8_t si2bis[23]; 48 | uint8_t si2ter[23]; 49 | uint8_t si3[23]; 50 | uint8_t si4[23]; 51 | uint8_t ta_valid; 52 | uint8_t ta; 53 | }; 54 | 55 | struct node_cell { 56 | struct node_cell *next; 57 | uint16_t cellid; 58 | uint8_t content; /* indicates, if sysinfo is already applied */ 59 | struct node_meas *meas, **meas_last_p; 60 | struct sysinfo sysinfo; 61 | struct gsm48_sysinfo s; 62 | }; 63 | 64 | struct node_meas { 65 | struct node_meas *next; 66 | time_t gmt; 67 | int8_t rxlev; 68 | uint8_t gps_valid; 69 | double longitude, latitude; 70 | uint8_t ta_valid; 71 | uint8_t ta; 72 | }; 73 | 74 | struct node_mcc *get_node_mcc(uint16_t mcc); 75 | struct node_mnc *get_node_mnc(struct node_mcc *mcc, uint16_t mnc); 76 | struct node_lac *get_node_lac(struct node_mnc *mnc, uint16_t lac); 77 | struct node_cell *get_node_cell(struct node_lac *lac, uint16_t cellid); 78 | struct node_meas *add_node_meas(struct node_cell *cell); 79 | int read_log(FILE *infp); 80 | 81 | -------------------------------------------------------------------------------- /src/shared/libosmocore/include/osmocom/crypt/gprs_cipher.h: -------------------------------------------------------------------------------- 1 | #ifndef _GPRS_CIPHER_H 2 | #define _GPRS_CIPHER_H 3 | 4 | #include 5 | 6 | #define GSM0464_CIPH_MAX_BLOCK 1523 7 | 8 | enum gprs_ciph_algo { 9 | GPRS_ALGO_GEA0, 10 | GPRS_ALGO_GEA1, 11 | GPRS_ALGO_GEA2, 12 | GPRS_ALGO_GEA3, 13 | _GPRS_ALGO_NUM 14 | }; 15 | 16 | enum gprs_cipher_direction { 17 | GPRS_CIPH_MS2SGSN, 18 | GPRS_CIPH_SGSN2MS, 19 | }; 20 | 21 | /* An implementation of a GPRS cipher */ 22 | struct gprs_cipher_impl { 23 | struct llist_head list; 24 | enum gprs_ciph_algo algo; 25 | const char *name; 26 | unsigned int priority; 27 | 28 | /* As specified in 04.64 Annex A. Uses Kc, IV and direction 29 | * to generate the 1523 bytes cipher stream that need to be 30 | * XORed wit the plaintext for encrypt / ciphertext for decrypt */ 31 | int (*run)(uint8_t *out, uint16_t len, uint64_t kc, uint32_t iv, 32 | enum gprs_cipher_direction direction); 33 | }; 34 | 35 | /* register a cipher with the core (from a plugin) */ 36 | int gprs_cipher_register(struct gprs_cipher_impl *ciph); 37 | 38 | /* load all available GPRS cipher plugins */ 39 | int gprs_cipher_load(const char *path); 40 | 41 | /* function to be called by core code */ 42 | int gprs_cipher_run(uint8_t *out, uint16_t len, enum gprs_ciph_algo algo, 43 | uint64_t kc, uint32_t iv, enum gprs_cipher_direction dir); 44 | 45 | /* Do we have an implementation for this cipher? */ 46 | int gprs_cipher_supported(enum gprs_ciph_algo algo); 47 | 48 | /* GSM TS 04.64 / Section A.2.1 : Generation of 'input' */ 49 | uint32_t gprs_cipher_gen_input_ui(uint32_t iov_ui, uint8_t sapi, uint32_t lfn, uint32_t oc); 50 | 51 | /* GSM TS 04.64 / Section A.2.1 : Generation of 'input' */ 52 | uint32_t gprs_cipher_gen_input_i(uint32_t iov_i, uint32_t lfn, uint32_t oc); 53 | 54 | #endif /* _GPRS_CIPHER_H */ 55 | -------------------------------------------------------------------------------- /src/target/firmware/board/common/calypso_uart.S: -------------------------------------------------------------------------------- 1 | /* uart routines for early assembly code */ 2 | 3 | #define BA_UART_MODEM 0xFFFF5800 4 | 5 | .macro senduart, rd, rx 6 | strb \rd, [\rx, #0] 7 | .endm 8 | 9 | .macro busyuart, rd, rx 10 | 1001: 11 | @busy waiting until THR is empty 12 | ldrb \rd, [\rx, #5] @ read LSR register 13 | mov \rd, \rd, lsr #6 14 | tst \rd, #1 15 | beq 1001b 16 | .endm 17 | 18 | .macro loadsp, rd 19 | ldr \rd, =BA_UART_MODEM 20 | .endm 21 | 22 | .section .text 23 | 24 | .align 2 25 | .type phexbuf, #object 26 | phexbuf: .space 12 27 | .size phexubf, . - phexbuf 28 | 29 | .globl phex 30 | phex: adr r3, phexbuf 31 | mov r2, #0 32 | strb r2, [r3, r1] 33 | 1: subs r1, r1, #1 34 | movmi r0, r3 35 | bmi puts_asm 36 | and r2, r0, #15 37 | mov r0, r0, lsr #4 38 | cmp r2, #10 39 | addge r2, r2, #7 40 | add r2, r2, #'0' 41 | strb r2, [r3, r1] 42 | b 1b 43 | 44 | .globl puts_asm 45 | puts_asm: loadsp r3 46 | 1: ldrb r2, [r0], #1 47 | teq r2, #0 48 | moveq pc, lr 49 | 2: senduart r2, r3 50 | busyuart r1, r3 51 | teq r2, #'\n' 52 | moveq r2, #'\r' 53 | beq 2b 54 | teq r0, #0 55 | bne 1b 56 | mov pc, lr 57 | 58 | .globl putchar_asm 59 | putchar_asm: 60 | mov r2, r0 61 | mov r0, #0 62 | loadsp r3 63 | b 2b 64 | 65 | .globl memdump_asm 66 | memdump_asm: mov r12, r0 67 | mov r10, lr 68 | mov r11, #0 69 | 2: mov r0, r11, lsl #2 70 | add r0, r0, r12 71 | mov r1, #8 72 | bl phex 73 | mov r0, #':' 74 | bl putchar_asm 75 | 1: mov r0, #' ' 76 | bl putchar_asm 77 | ldr r0, [r12, r11, lsl #2] 78 | mov r1, #8 79 | bl phex 80 | and r0, r11, #7 81 | teq r0, #3 82 | moveq r0, #' ' 83 | bleq putchar_asm 84 | and r0, r11, #7 85 | add r11, r11, #1 86 | teq r0, #7 87 | bne 1b 88 | mov r0, #'\n' 89 | bl putchar_asm 90 | cmp r11, #64 91 | blt 2b 92 | mov pc, r10 93 | -------------------------------------------------------------------------------- /src/target/firmware/board/compal/handlers.S: -------------------------------------------------------------------------------- 1 | 2 | .EQU I_BIT, 0x80 3 | .EQU F_BIT, 0x40 4 | 5 | .section .text 6 | 7 | /* handler for all kinds of aborts */ 8 | .global handle_abort 9 | handle_abort: 10 | @ print the PC we would jump back to... 11 | sub lr, lr, #4 @ we assume to be ARM32 12 | 13 | mov r0, lr 14 | mov r1, #8 15 | bl phex 16 | 17 | @ print abort message 18 | mov r0, #'A' 19 | bl putchar_asm 20 | mov r0, #'B' 21 | bl putchar_asm 22 | mov r0, #'O' 23 | bl putchar_asm 24 | mov r0, #'R' 25 | bl putchar_asm 26 | mov r0, #'T' 27 | bl putchar_asm 28 | 29 | @ disable IRQ and FIQ 30 | msr CPSR_c, #I_BIT | F_BIT 31 | 32 | 0: @ dead 33 | b 0b 34 | 35 | /* entry point for IRQs */ 36 | .global irq_entry 37 | irq_entry: 38 | /* Adjust and save LR_irq in IRQ stack */ 39 | sub lr, lr, #4 40 | stmfd sp!, {lr} 41 | 42 | /* Save SPSR for nested interrupt */ 43 | mrs r14, SPSR 44 | stmfd sp!, {r14} 45 | 46 | /* Call the interrupt handler C function */ 47 | stmfd sp!, {r0-r4, r12} 48 | bl irq 49 | ldmfd sp!, {r0-r4, r12} 50 | 51 | /* Restore SPSR_irq from IRQ stack */ 52 | ldmia sp!, {r14} 53 | msr SPSR_cxsf, r14 54 | 55 | /* Restore adjusted LR_irq from IRQ stack directly in the PC */ 56 | ldmia sp!, {pc}^ 57 | 58 | /* entry point for FIQs */ 59 | .global fiq_entry 60 | fiq_entry: 61 | /* Adjust and save LR_irq in IRQ stack */ 62 | sub lr, lr, #4 63 | stmfd sp!, {lr} 64 | 65 | /* Save SPSR for nested interrupt */ 66 | mrs r14, SPSR 67 | stmfd sp!, {r14} 68 | 69 | /* Call the interrupt handler C function */ 70 | stmfd sp!, {r0-r4, r12} 71 | bl fiq 72 | ldmfd sp!, {r0-r4, r12} 73 | 74 | /* Restore SPSR_irq from IRQ stack */ 75 | ldmia sp!, {r14} 76 | msr SPSR_cxsf, r14 77 | 78 | /* Restore adjusted LR_irq from IRQ stack directly in the PC */ 79 | ldmia sp!, {pc}^ 80 | -------------------------------------------------------------------------------- /src/target/firmware/layer1/apc.c: -------------------------------------------------------------------------------- 1 | /* APC (Automatic Power Control) Implementation */ 2 | 3 | /* (C) 2010 by Harald Welte 4 | * 5 | * All Rights Reserved 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | * 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | /* calibration table defined in board file */ 31 | extern const int16_t dbm2apc_gsm900[]; 32 | extern const int dbm2apc_gsm900_max; 33 | 34 | 35 | /* determine the AUXAPC value by the Tx Power Level */ 36 | int16_t apc_tx_dbm2auxapc(enum gsm_band band, int8_t dbm) 37 | { 38 | if (dbm < 0) 39 | return -ERANGE; 40 | 41 | /* FIXME: offsets for different bands! */ 42 | if (dbm > dbm2apc_gsm900_max) 43 | dbm = dbm2apc_gsm900_max; 44 | 45 | return dbm2apc_gsm900[dbm]; 46 | } 47 | 48 | /* determine the AUXAPC value by the Tx Power Level */ 49 | int16_t apc_tx_pwrlvl2auxapc(enum gsm_band band, uint8_t lvl) 50 | { 51 | /* convert tx power level to dBm */ 52 | int dbm = ms_pwr_dbm(band, lvl); 53 | if (dbm < 0) 54 | return dbm; 55 | 56 | return apc_tx_dbm2auxapc(band, dbm); 57 | } 58 | --------------------------------------------------------------------------------