mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-17 21:58:33 +03:00
Compare commits
38 Commits
0.8.0
...
laforge/20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
050b9dde68 | ||
|
|
f1a0ed905b | ||
|
|
874a1a2d64 | ||
|
|
b07131f2a5 | ||
|
|
7783cd7a28 | ||
|
|
09c279874e | ||
|
|
755387ee31 | ||
|
|
c3f366b55e | ||
|
|
b01dc91c0b | ||
|
|
5cc3add0b0 | ||
|
|
ca62121c19 | ||
|
|
8b52b44f1b | ||
|
|
71ac54d7bf | ||
|
|
ab5b2ffe1d | ||
|
|
ee9ddb8da1 | ||
|
|
039680a8d4 | ||
|
|
8680677256 | ||
|
|
20bc014b82 | ||
|
|
3a6f1adc2e | ||
|
|
70e60aa1de | ||
|
|
4775a94959 | ||
|
|
d3b9d95b34 | ||
|
|
408889d8b2 | ||
|
|
7b160b5ed7 | ||
|
|
15a3ef25a2 | ||
|
|
5820eacf57 | ||
|
|
94cc319b8e | ||
|
|
7a450041bf | ||
|
|
3f0d92f282 | ||
|
|
ea9a91f5ce | ||
|
|
91a93bc5de | ||
|
|
aeaf12853e | ||
|
|
7fde63b7c6 | ||
|
|
cb655f9774 | ||
|
|
f721e69bc1 | ||
|
|
8dada9b454 | ||
|
|
afd23660b3 | ||
|
|
24a9ee8ae6 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -20,6 +20,9 @@ tags
|
||||
host/simtrace2-list
|
||||
host/simtrace2-cardem-pcsc
|
||||
host/contrib/simtrace2.spec
|
||||
host/src/simtrace2-tool
|
||||
host/tests
|
||||
usb_strings_generated.h
|
||||
firmware/usbstring/usbstring
|
||||
firmware/apps/*/usb_strings.txt.patched
|
||||
firmware/misc/crctool
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh -e
|
||||
#!/bin/bash -e
|
||||
# Create copies of binaries with -latest, -$GIT_VERSION (OS#4413, OS#3452)
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
@@ -9,8 +9,10 @@ echo "Copying binaries with "-latest" and "-$GIT_VERSION" appended..."
|
||||
cd firmware/bin
|
||||
for ext in bin elf; do
|
||||
for file in *."$ext"; do
|
||||
without_ext="${file%.*}"
|
||||
cp -v "$file" "$without_ext-latest.$ext"
|
||||
cp -v "$file" "$without_ext-$GIT_VERSION.$ext"
|
||||
if ! [[ "$file" =~ ^(.*padded.*|.*nocrcstub.*)$ ]];then
|
||||
without_ext="${file%.*}"
|
||||
cp -v "$file" "$without_ext-latest.$ext"
|
||||
cp -v "$file" "$without_ext-$GIT_VERSION.$ext"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
-- wireshark LUA dissector for the SIMtrace USB protocol
|
||||
-- (C) 2021 by sysmocom - s.f.m.c. GmbH, Author: Eric Wild
|
||||
-- SPDX-License-Identifier: GPL-2.0+
|
||||
--
|
||||
-- Usage: Move this file to your "personal lua plugins" folder that
|
||||
-- can be found in the Wireshark Help->About Wireshark->Folders tab
|
||||
-- Windows: %APPDATA%\Wireshark\plugins.
|
||||
-- Unix-like systems: ~/.local/lib/wireshark/plugins.
|
||||
|
||||
usb_simtrace_protocol = Proto("USB_simtrace", "USB simtrace protocol")
|
||||
|
||||
|
||||
@@ -7,49 +16,95 @@ local control_commands = {
|
||||
[0x0001] = "SIMTRACE_CMD_BD_BOARD_INFO",
|
||||
|
||||
-- /* SIMTRACE_MSGC_CARDEM */
|
||||
[0x0101] = "SIMTRACE_MSGT_DT_CEMU_TX_DATA",
|
||||
[0x0102] = "SIMTRACE_MSGT_DT_CEMU_SET_ATR",
|
||||
[0x0103] = "SIMTRACE_MSGT_BD_CEMU_STATS",
|
||||
[0x0104] = "SIMTRACE_MSGT_BD_CEMU_STATUS",
|
||||
[0x0105] = "SIMTRACE_MSGT_DT_CEMU_CARDINSERT",
|
||||
[0x0106] = "SIMTRACE_MSGT_DO_CEMU_RX_DATA",
|
||||
[0x0107] = "SIMTRACE_MSGT_DO_CEMU_PTS",
|
||||
[0x0108] = "SIMTRACE_MSGT_BD_CEMU_CONFIG",
|
||||
[0x0101] = "DT_CEMU_TX_DATA",
|
||||
[0x0102] = "DT_CEMU_SET_ATR",
|
||||
[0x0103] = "BD_CEMU_STATS",
|
||||
[0x0104] = "BD_CEMU_STATUS",
|
||||
[0x0105] = "DT_CEMU_CARDINSERT",
|
||||
[0x0106] = "DO_CEMU_RX_DATA",
|
||||
[0x0107] = "DO_CEMU_PTS",
|
||||
[0x0108] = "BD_CEMU_CONFIG",
|
||||
|
||||
-- /* SIMTRACE_MSGC_MODEM */
|
||||
[0x0201] = "SIMTRACE_MSGT_DT_MODEM_RESET",
|
||||
[0x0202] = "SIMTRACE_MSGT_DT_MODEM_SIM_SELECT",
|
||||
[0x0203] = "SIMTRACE_MSGT_BD_MODEM_STATUS",
|
||||
[0x0201] = "DT_MODEM_RESET",
|
||||
[0x0202] = "DT_MODEM_SIM_SELECT",
|
||||
[0x0203] = "BD_MODEM_STATUS",
|
||||
|
||||
-- /* SIMTRACE_MSGC_SNIFF */
|
||||
[0x0300] = "SIMTRACE_MSGT_SNIFF_CHANGE",
|
||||
[0x0301] = "SIMTRACE_MSGT_SNIFF_FIDI",
|
||||
[0x0302] = "SIMTRACE_MSGT_SNIFF_ATR",
|
||||
[0x0304] = "SIMTRACE_MSGT_SNIFF_TPDU",
|
||||
[0x0303] = "SIMTRACE_MSGT_SNIFF_PPS"
|
||||
[0x0300] = "SNIFF_CHANGE",
|
||||
[0x0301] = "SNIFF_FIDI",
|
||||
[0x0302] = "SNIFF_ATR",
|
||||
[0x0304] = "SNIFF_TPDU",
|
||||
[0x0303] = "SNIFF_PPS"
|
||||
}
|
||||
|
||||
local msgtype = ProtoField.uint16("usb_simtrace.msgtype", "Message Type", base.HEX_DEC, control_commands)
|
||||
local seqnr = ProtoField.uint8("usb_simtrace.seqnr", "Sequence Number", base.HEX_DEC)
|
||||
local slotnr = ProtoField.uint8("usb_simtrace.slotnr", "Slot Number", base.HEX_DEC)
|
||||
local seqnr = ProtoField.uint8("usb_simtrace.seqnr", "Sequence Number", base.DEC)
|
||||
local slotnr = ProtoField.uint8("usb_simtrace.slotnr", "Slot Number", base.DEC)
|
||||
local reserved = ProtoField.uint16("usb_simtrace.reserved", "reserved", base.HEX_DEC)
|
||||
local payloadlen = ProtoField.uint16("usb_simtrace.length", "length", base.HEX_DEC)
|
||||
local payloadlen = ProtoField.uint16("usb_simtrace.length", "length", base.DEC)
|
||||
local payload = ProtoField.bytes("usb_simtrace.payload", "Data")
|
||||
|
||||
local pb_and_rx = ProtoField.uint32("usb_simtrace.pb_and_rx", "pb_and_rx", base.HEX_DEC, NULL, 0x8)
|
||||
local pb_and_tx = ProtoField.uint32("usb_simtrace.pb_and_tx", "pb_and_tx", base.HEX_DEC, NULL, 0x4)
|
||||
local final = ProtoField.uint32("usb_simtrace.final", "final", base.HEX_DEC, NULL, 0x2)
|
||||
local tpdu_hdr = ProtoField.uint32("usb_simtrace.tpdu_hdr", "tpdu_hdr", base.HEX_DEC, NULL, 0x1)
|
||||
local rxtxdatalen = ProtoField.uint16("usb_simtrace.rxtxdatalen", "rx/tx data length", base.HEX_DEC)
|
||||
local rxtxdatalen = ProtoField.uint16("usb_simtrace.rxtxdatalen", "rx/tx data length", base.DEC)
|
||||
local rxtxdata = ProtoField.bytes("usb_simtrace.rxtxdata", "rx/tx (data)")
|
||||
usb_simtrace_protocol.fields = {
|
||||
msgtype, seqnr, slotnr, reserved, payloadlen, payload, pb_and_rx, pb_and_tx, final, tpdu_hdr, rxtxdatalen, rxtxdata
|
||||
|
||||
local hf_pts_len = ProtoField.uint8("usb_simtrace.pts_len", "PTS length", base.DEC)
|
||||
local hf_pts_req = ProtoField.bytes("usb_simtrace.pts_req", "PTS request")
|
||||
local hf_pts_resp = ProtoField.bytes("usb_simtrace.pts_resp", "PTS response")
|
||||
|
||||
local hf_cemu_cfg_features = ProtoField.uint32("usb_simtrace.cemu_cfg.features.status_irq", "CardEm Features", base.HEX)
|
||||
local hf_cemu_cfg_slot_mux_nr = ProtoField.uint32("usb_simtrace.cemu_cfg.features.slot_mux_nr", "CardEm Slot Mux Nr", base.DEC)
|
||||
|
||||
local card_insert_types = {
|
||||
[0x00] = "not inserted",
|
||||
[0x01] = "inserted",
|
||||
}
|
||||
local hf_cemu_cardinsert = ProtoField.uint8("usb_simtrace.cardinsert", "Card Insert", base.DEC, card_insert_types, 0xff)
|
||||
|
||||
local CEMU_STATUS_F_VCC_PRESENT = ProtoField.uint32("usb_simtrace.CEMU_STATUS.F_VCC_PRESENT", "VCC_PRESENT", base.HEX_DEC, NULL, 0x00000001)
|
||||
local CEMU_STATUS_F_CLK_ACTIVE = ProtoField.uint32("usb_simtrace.CEMU_STATUS.F_CLK_ACTIVE", "CLK_ACTIVE", base.HEX_DEC, NULL, 0x00000002)
|
||||
local CEMU_STATUS_F_RCEMU_ACTIVE = ProtoField.uint32("usb_simtrace.CEMU_STATUS.F_RCEMU_ACTIVE", "CEMU_ACTIVE", base.HEX_DEC, NULL, 0x00000004)
|
||||
local CEMU_STATUS_F_CARD_INSERT = ProtoField.uint32("usb_simtrace.CEMU_STATUS.F_CARD_INSERT", "CARD_INSERT", base.HEX_DEC, NULL, 0x00000008)
|
||||
local CEMU_STATUS_F_RESET_ACTIVE = ProtoField.uint32("usb_simtrace.CEMU_STATUS.F_RESET_ACTIVE", "RESET_ACTIVE", base.HEX_DEC, NULL, 0x00000010)
|
||||
|
||||
local modem_reset_types = {
|
||||
[0x00] = "de-assert",
|
||||
[0x01] = "assert",
|
||||
[0x02] = "pulse"
|
||||
}
|
||||
local modem_reset_status = ProtoField.uint8("usb_simtrace.modem.reset_type", "modem reset type", base.HEX, modem_reset_types, 0xf)
|
||||
local modem_reset_len = ProtoField.uint8("usb_simtrace.modem.reset_len", "modem reset length (ms)", base.DEC)
|
||||
|
||||
local modem_sim_select_types = {
|
||||
[0x00] = "local",
|
||||
[0x01] = "remote",
|
||||
}
|
||||
local hf_modem_sim_select = ProtoField.uint8("usb_simtrace.modem.sim_select", "SIM card selection", base.DEC, modem_sim_select_types, 0xff)
|
||||
|
||||
usb_simtrace_protocol.fields = {
|
||||
msgtype, seqnr, slotnr, reserved, payloadlen, payload,
|
||||
pb_and_rx, pb_and_tx, final, tpdu_hdr, rxtxdatalen, rxtxdata,
|
||||
CEMU_STATUS_F_VCC_PRESENT, CEMU_STATUS_F_CLK_ACTIVE, CEMU_STATUS_F_RCEMU_ACTIVE, CEMU_STATUS_F_CARD_INSERT, CEMU_STATUS_F_RESET_ACTIVE,
|
||||
modem_reset_status, modem_reset_len,
|
||||
hf_pts_len, hf_pts_req, hf_pts_resp,
|
||||
hf_cemu_cfg_features, hf_cemu_cfg_slot_mux_nr,
|
||||
hf_cemu_cardinsert, hf_modem_sim_select,
|
||||
}
|
||||
|
||||
local is_hdr = Field.new("usb_simtrace.tpdu_hdr")
|
||||
local is_pbrx = Field.new("usb_simtrace.pb_and_rx")
|
||||
local is_pbtx = Field.new("usb_simtrace.pb_and_tx")
|
||||
local is_final= Field.new("usb_simtrace.final")
|
||||
|
||||
function dissect_rxtx(payload_data,pinfo,tree)
|
||||
|
||||
local headerSubtree = tree:add(usb_simtrace_protocol, payload_data, "rx/tx data")
|
||||
local len = payload_data(8+4,2):le_uint();
|
||||
local cmd32 = payload_data(8+0,4):le_uint();
|
||||
local len = payload_data(4,2):le_uint();
|
||||
local cmd32 = payload_data(0,4):le_uint();
|
||||
|
||||
headerSubtree:add(pb_and_rx, cmd32)
|
||||
headerSubtree:add(pb_and_tx, cmd32)
|
||||
@@ -57,9 +112,129 @@ function dissect_rxtx(payload_data,pinfo,tree)
|
||||
headerSubtree:add(tpdu_hdr, cmd32)
|
||||
|
||||
headerSubtree:add(rxtxdatalen, len)
|
||||
headerSubtree:add_le(rxtxdata, payload_data(8+6,len))
|
||||
headerSubtree:add_le(rxtxdata, payload_data(6,len))
|
||||
|
||||
local flagstr = " "
|
||||
if is_pbrx().value == 1 then
|
||||
flagstr = flagstr .. "R"
|
||||
else
|
||||
flagstr = flagstr .. "."
|
||||
end
|
||||
if is_pbtx().value == 1 then
|
||||
flagstr = flagstr .. "T"
|
||||
else
|
||||
flagstr = flagstr .. "."
|
||||
end
|
||||
if is_final().value == 1 then
|
||||
flagstr = flagstr .. "F"
|
||||
else
|
||||
flagstr = flagstr .. "."
|
||||
end
|
||||
if is_hdr().value == 1 then
|
||||
flagstr = flagstr .. "H"
|
||||
else
|
||||
flagstr = flagstr .. "."
|
||||
end
|
||||
flagstr = flagstr .. " "
|
||||
pinfo.cols.info:append(flagstr .. payload_data(6,len))
|
||||
|
||||
-- ghetto dissection does not work due to mixed in procedure bytes
|
||||
--if pinfo.visited == false then
|
||||
-- Dissector.get("iso7816"):call(payload_data(6):tvb(), pinfo, tree)
|
||||
|
||||
-- local offs = 0
|
||||
-- if (is_pbrx().value == 1 or is_pbtx().value == 1) and is_final().value == 0 then
|
||||
-- offs = 1
|
||||
-- else
|
||||
-- offs = 0
|
||||
-- end
|
||||
--
|
||||
-- if is_hdr().value == 1 then
|
||||
-- Dissector.get("gsm_sim"):call(concatss:tvb(), pinfo, tree)
|
||||
-- concatss = payload_data(6):bytes()
|
||||
-- else
|
||||
-- concatss = concatss .. payload_data(6+offs):bytes()
|
||||
-- end
|
||||
|
||||
--end
|
||||
|
||||
end
|
||||
|
||||
function dissect_status(payload_data,pinfo,tree)
|
||||
|
||||
local headerSubtree = tree:add(usb_simtrace_protocol, payload_data, "status message")
|
||||
local cmd32 = payload_data(0,4):le_uint();
|
||||
|
||||
headerSubtree:add(CEMU_STATUS_F_VCC_PRESENT, cmd32)
|
||||
headerSubtree:add(CEMU_STATUS_F_CLK_ACTIVE, cmd32)
|
||||
headerSubtree:add(CEMU_STATUS_F_RCEMU_ACTIVE, cmd32)
|
||||
headerSubtree:add(CEMU_STATUS_F_CARD_INSERT, cmd32)
|
||||
headerSubtree:add(CEMU_STATUS_F_RESET_ACTIVE, cmd32)
|
||||
|
||||
pinfo.cols.info:append(" VCC:" .. payload_data(0,1):bitfield(7, 1) .. " CLK:" .. payload_data(0,1):bitfield(6, 1) .. " RESET:" .. payload_data(0,1):bitfield(3, 1))
|
||||
end
|
||||
|
||||
function dissect_atr(payload_data,pinfo,tree)
|
||||
|
||||
local len = payload_data(0,1):le_uint()
|
||||
Dissector.get("iso7816.atr"):call(payload_data(1):tvb(), pinfo, tree)
|
||||
end
|
||||
|
||||
function dissect_modem_reset(payload_data,pinfo,tree)
|
||||
|
||||
local headerSubtree = tree:add(usb_simtrace_protocol, payload_data, "modem reset")
|
||||
local cmd8 = payload_data(0,1):le_uint();
|
||||
|
||||
headerSubtree:add(modem_reset_status, cmd8)
|
||||
pinfo.cols.info:append(" reset type:" .. modem_reset_types[cmd8]);
|
||||
|
||||
if(cmd8 == 2) then
|
||||
local duration = payload_data(1,2):le_uint()
|
||||
headerSubtree:add(modem_reset_len, duration)
|
||||
pinfo.cols.info:append(" duration:" .. duration .. "ms")
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
function dissect_pts(payload_data, pinfo, tree)
|
||||
local subtree = tree:add(usb_simtrace_protocol, payload_data, "PTS")
|
||||
local pts_len = payload_data(0,1):le_uint()
|
||||
local pts_req = payload_data(1, pts_len);
|
||||
local pts_resp = payload_data(7, pts_len);
|
||||
|
||||
subtree:add(hf_pts_len, pts_len);
|
||||
subtree:add(hf_pts_req, pts_req);
|
||||
subtree:add(hf_pts_resp, pts_resp);
|
||||
|
||||
pinfo.cols.info:append(" Req: " .. pts_req .. ", Resp: " .. pts_resp);
|
||||
end
|
||||
|
||||
function dissect_cemu_config(payload_data, pinfo, tree)
|
||||
local subtree = tree:add(usb_simtrace_protocol, payload_data, "Card Emu Config")
|
||||
|
||||
subtree:add(hf_cemu_cfg_features, payload_data(0,4));
|
||||
subtree:add(hf_cemu_cfg_slot_mux_nr, payload_data(4,1));
|
||||
end
|
||||
|
||||
function dissect_modem_sim_sel(payload_data, pinfo, tree)
|
||||
local subtree = tree:add(usb_simtrace_protocol, payload_data, "Modem SIM Select")
|
||||
local sim_select = payload_data(0,1):le_uint();
|
||||
|
||||
subtree:add(hf_modem_sim_select, sim_select);
|
||||
pinfo.cols.info:append(" " .. modem_sim_select_types[sim_select]);
|
||||
end
|
||||
|
||||
function dissect_cemu_cardinsert(payload_data, pinfo, tree)
|
||||
local subtree = tree:add(usb_simtrace_protocol, payload_data, "Card Insert")
|
||||
local cins_type = payload_data(0,1):le_uint()
|
||||
|
||||
subtree:add(hf_cemu_cardinsert, cins_type);
|
||||
pinfo.cols.info:append(" " .. card_insert_types[cins_type]);
|
||||
end
|
||||
|
||||
|
||||
|
||||
function usb_simtrace_protocol.dissector(buffer, pinfo, tree)
|
||||
length = buffer:len()
|
||||
if length == 0 then return end
|
||||
@@ -76,7 +251,21 @@ function usb_simtrace_protocol.dissector(buffer, pinfo, tree)
|
||||
pinfo.cols.info = string.format("Cmd 0x%04X : %s", command, control_commands[command])
|
||||
local payload_data = buffer(8,length-8)
|
||||
if(command == 0x0101 or command == 0x0106) then
|
||||
return dissect_rxtx(buffer(),pinfo,subtree)
|
||||
return dissect_rxtx(payload_data(),pinfo,subtree)
|
||||
elseif(command == 0x0104) then
|
||||
return dissect_status(payload_data(),pinfo,subtree)
|
||||
elseif(command == 0x0102) then
|
||||
return dissect_atr(payload_data(),pinfo,subtree)
|
||||
elseif(command == 0x0105) then
|
||||
return dissect_cemu_cardinsert(payload_data(),pinfo,subtree)
|
||||
elseif(command == 0x0107) then
|
||||
return dissect_pts(payload_data(),pinfo,subtree)
|
||||
elseif(command == 0x0108) then
|
||||
return dissect_cemu_config(payload_data(),pinfo,subtree)
|
||||
elseif(command == 0x0201) then
|
||||
return dissect_modem_reset(payload_data(),pinfo,subtree)
|
||||
elseif(command == 0x0202) then
|
||||
return dissect_modem_sim_sel(payload_data(),pinfo,subtree)
|
||||
else
|
||||
subtree:add(payload, payload_data)
|
||||
end
|
||||
@@ -85,8 +274,13 @@ end
|
||||
|
||||
|
||||
function usb_simtrace_protocol.init()
|
||||
local usb_product_dissectors = DissectorTable.get("usb.product")
|
||||
usb_product_dissectors:add(0x1d50616d, usb_simtrace_protocol)
|
||||
usb_product_dissectors:add(0x1d50616e, usb_simtrace_protocol)
|
||||
DissectorTable.get("usb.bulk"):add(0xffff, usb_simtrace_protocol)
|
||||
local usb_product_dissectors = DissectorTable.get("usb.product")
|
||||
usb_product_dissectors:add(0x1d50616d, usb_simtrace_protocol) -- OCTSIMTEST
|
||||
usb_product_dissectors:add(0x1d50616e, usb_simtrace_protocol) -- NGFF_CARDEM
|
||||
usb_product_dissectors:add(0x1d5060e3, usb_simtrace_protocol) -- SIMTRACE2
|
||||
usb_product_dissectors:add(0x1d504004, usb_simtrace_protocol) -- QMOD
|
||||
usb_product_dissectors:add(0x1d504001, usb_simtrace_protocol) -- OWHW
|
||||
DissectorTable.get("usb.device"):add_for_decode_as(usb_simtrace_protocol)
|
||||
DissectorTable.get("usb.bulk"):add(0xffff, usb_simtrace_protocol)
|
||||
DissectorTable.get("usb.interrupt"):add(0xffff, usb_simtrace_protocol)
|
||||
end
|
||||
|
||||
6
debian/changelog
vendored
6
debian/changelog
vendored
@@ -1,3 +1,9 @@
|
||||
simtrace2 (0.8.1) unstable; urgency=medium
|
||||
|
||||
* host/contrib/simtrace2.spec.in: fix soname
|
||||
|
||||
-- Oliver Smith <osmith@sysmocom.de> Fri, 10 Dec 2021 10:04:28 +0100
|
||||
|
||||
simtrace2 (0.8.0) unstable; urgency=medium
|
||||
|
||||
[ Harald Welte ]
|
||||
|
||||
@@ -117,7 +117,7 @@ C_LIBUSB = USBDescriptors.c USBRequests.c USBD.c USBDCallbacks.c USBDDriver.
|
||||
C_LIBUSB_RT = dfu.c dfu_runtime.c
|
||||
C_LIBUSB_DFU = dfu.c dfu_desc.c dfu_driver.c
|
||||
C_LIBCOMMON = string.c stdio.c fputs.c usb_buf.c ringbuffer.c pseudo_talloc.c host_communication.c \
|
||||
main_common.c stack_check.c
|
||||
main_common.c stack_check.c crcstub.c
|
||||
|
||||
C_BOARD = $(notdir $(wildcard libboard/common/source/*.c))
|
||||
C_BOARD += $(notdir $(wildcard libboard/$(BOARD)/source/*.c))
|
||||
@@ -229,12 +229,15 @@ $(BIN)/$(BOARD)-dfu-flash-padded.bin: $(BIN)/$(BOARD)-dfu-flash.bin
|
||||
$(OUTPUT)-combined.bin: $(BIN)/$(BOARD)-dfu-flash-padded.bin $(OUTPUT)-dfu.bin
|
||||
cat $^ > $@
|
||||
|
||||
$(BIN) $(OBJ): apps/$(APP)/usb_strings_generated.h
|
||||
$(BIN) $(OBJ): apps/$(APP)/usb_strings_generated.h misc/crctool
|
||||
mkdir -p $@
|
||||
|
||||
usbstring/usbstring: usbstring/usbstring.c
|
||||
gcc $^ -o $@
|
||||
|
||||
misc/crctool: misc/crctool.c
|
||||
gcc $^ -o $@
|
||||
|
||||
.PHONY: apps/$(APP)/usb_strings.txt.patched
|
||||
apps/$(APP)/usb_strings.txt.patched: apps/$(APP)/usb_strings.txt
|
||||
sed "s/PRODUCT_STRING/$(shell cat libboard/$(BOARD)/product_string.txt)/" $< > $@
|
||||
@@ -251,7 +254,6 @@ build_$(1): $$(ASM_OBJECTS_$(1)) $$(C_OBJECTS_$(1)) $$(EXTRA_OBJECTS_$(1))
|
||||
$(SILENT)$(CC) $(CFLAGS) $(LDFLAGS) $(LD_OPTIONAL) -T"libboard/common/resources/$(CHIP)/$(1).ld" -Wl,-Map,$(OUTPUT)-$(1).map -o $(OUTPUT)-$(1).elf $$^ $(LIBS)
|
||||
$(SILENT)$(NM) $(OUTPUT)-$(1).elf >$(OUTPUT)-$(1).elf.txt
|
||||
$(SILENT)$(OBJCOPY) -O binary $(OUTPUT)-$(1).elf $(OUTPUT)-$(1).bin
|
||||
$(SILENT)$(SIZE) $$^ $(OUTPUT)-$(1).elf
|
||||
|
||||
$$(C_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.c Makefile $(OBJ) $(BIN)
|
||||
@echo [COMPILING $$<]
|
||||
@@ -261,26 +263,17 @@ $$(ASM_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.S Makefile $(OBJ) $(BIN)
|
||||
@echo [ASSEMBLING $$@]
|
||||
$(SILENT)$(CC) $(ASFLAGS) -DENVIRONMENT_$(1) -DENVIRONMENT=\"$(1)\" -c -o $$@ $$<
|
||||
|
||||
debug_$(1): $(1)
|
||||
$(GDB) -x "$(BOARD_LIB)/resources/gcc/$(BOARD)_$(1).gdb" -ex "reset" -readnow -se $(OUTPUT)-$(1).elf
|
||||
endef
|
||||
|
||||
ALL_MEMORIES = dfu flash ram
|
||||
ALL_MEMORIES = flash ram
|
||||
$(foreach MEMORY, $(ALL_MEMORIES), $(eval $(call RULES,$(MEMORY))))
|
||||
|
||||
# files with those names do exist..
|
||||
.PHONY: ram
|
||||
.PHONY: dfu
|
||||
.PHONY: flash
|
||||
dfu: $(OUTPUT)-dfu.bin
|
||||
.PHONY: ram
|
||||
ram: build_ram
|
||||
dfu: build_dfu
|
||||
ifeq ($(APP), blupdate)
|
||||
$(info updating updater section with padded bootloader file..)
|
||||
$(SILENT)dd if=/dev/zero bs=16384 count=1 of=$(BIN)/$(BOARD)-dfu-flash-padded.bin
|
||||
$(SILENT)dd if=$(BIN)/$(BOARD)-dfu-flash.bin conv=notrunc of=$(BIN)/$(BOARD)-dfu-flash-padded.bin
|
||||
$(SILENT)$(OBJCOPY) --update-section .blupdate=bin/$(BOARD)-dfu-flash-padded.bin bin/$(BOARD)-blupdate-dfu.elf
|
||||
$(SILENT)$(OBJCOPY) -O binary bin/$(BOARD)-blupdate-dfu.elf bin/$(BOARD)-blupdate-dfu.bin
|
||||
endif
|
||||
.PHONY: flash
|
||||
flash: build_flash
|
||||
#alternate way of embedding: obj file
|
||||
#ifeq ($(APP), dfu)
|
||||
@@ -288,8 +281,37 @@ flash: build_flash
|
||||
# $(SILENT)$(OBJCOPY) --rename-section .data=.fwupdate -I binary -O elf32-littlearm bin/$(BOARD)-dfu-flash.bin $(OBJ)/flash_fwupdate.o
|
||||
#endif
|
||||
|
||||
program:
|
||||
openocd -f openocd/openocd.cfg -c "init" -c "halt" -c "flash write_bank 0 ./bin/project-flash.bin 0" -c "reset" -c "shutdown"
|
||||
C_OBJECTS_dfu = $(addprefix $(OBJ)/dfu_, $(C_OBJECTS))
|
||||
ASM_OBJECTS_dfu = $(addprefix $(OBJ)/dfu_, $(ASM_OBJECTS))
|
||||
EXTRA_OBJECTS_dfu = $(addprefix $(OBJ)/dfu_, $(EXTRA_OBJECTS))
|
||||
|
||||
$(OUTPUT)-dfu.bin: $(OUTPUT)-dfu_nocrcstub.bin
|
||||
$(info updating app with crc..)
|
||||
$(SILENT)cp $< $@.temp
|
||||
$(SILENT)misc/crctool 512 $@.temp
|
||||
$(SILENT)mv $@.temp $@
|
||||
|
||||
$(OUTPUT)-dfu_nocrcstub.bin: $(OUTPUT)-dfu_nocrcstub.elf
|
||||
ifeq ($(APP), blupdate)
|
||||
$(info updating updater section with padded bootloader file..)
|
||||
$(SILENT)dd status=none if=/dev/zero bs=16384 count=1 of=$(BIN)/$(BOARD)-dfu-flash-padded.bin
|
||||
$(SILENT)dd status=none if=$(BIN)/$(BOARD)-dfu-flash.bin conv=notrunc of=$(BIN)/$(BOARD)-dfu-flash-padded.bin
|
||||
$(SILENT)$(OBJCOPY) --update-section .blupdate=bin/$(BOARD)-dfu-flash-padded.bin $<
|
||||
endif
|
||||
$(SILENT)$(OBJCOPY) -O binary $< $@
|
||||
|
||||
$(OUTPUT)-dfu_nocrcstub.elf: $(ASM_OBJECTS_dfu) $(C_OBJECTS_dfu) $(EXTRA_OBJECTS_dfu)
|
||||
$(SILENT)$(CC) $(CFLAGS) $(LDFLAGS) $(LD_OPTIONAL) -T"libboard/common/resources/$(CHIP)/dfu.ld" -Wl,-Map,$(OUTPUT)-dfu_nocrcstub.map -o $@ $^ $(LIBS)
|
||||
$(SILENT)$(NM) $@ >$@.txt
|
||||
|
||||
$(C_OBJECTS_dfu): $(OBJ)/dfu_%.o: %.c Makefile $(OBJ) $(BIN)
|
||||
@echo [COMPILING $<]
|
||||
$(SILENT)$(CC) $(CFLAGS) -DENVIRONMENT_dfu -DENVIRONMENT=\"dfu\" -c -o $@ $<
|
||||
|
||||
$(ASM_OBJECTS_dfu): $(OBJ)/dfu_%.o: %.S Makefile $(OBJ) $(BIN)
|
||||
@echo [ASSEMBLING $@]
|
||||
$(SILENT)$(CC) $(ASFLAGS) -DENVIRONMENT_dfu -DENVIRONMENT=\"dfu\" -c -o$@ $<
|
||||
|
||||
|
||||
SERIAL ?= /dev/ttyUSB0
|
||||
log:
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#include "board.h"
|
||||
#include "core_cm3.h"
|
||||
@@ -93,8 +89,14 @@ __attribute__((section(".ramfunc"), noinline, noreturn)) static void erase_first
|
||||
flash_cmd(EFC_FCMD_EA, 0);
|
||||
#endif
|
||||
flash_wait_ready();
|
||||
for (;;)
|
||||
NVIC_SystemReset();
|
||||
for (;;) {
|
||||
/* no functon call, since NVIC_SystemReset() might not be inlined! */
|
||||
SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) | (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
|
||||
SCB_AIRCR_SYSRESETREQ_Msk);
|
||||
__DSB();
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
#define MAX_USB_ITER BOARD_MCK / 72 // This should be around a second
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/*------------------------------------------------------------------------------
|
||||
* Headers
|
||||
@@ -141,6 +137,12 @@ static void check_exec_dbg_cmd(void)
|
||||
board_exec_dbg_cmd(ch);
|
||||
}
|
||||
|
||||
#include <osmocom/core/panic.h>
|
||||
void WDT_IrqHandler(void)
|
||||
{
|
||||
osmo_panic("WDT");
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Main
|
||||
*------------------------------------------------------------------------------*/
|
||||
@@ -156,10 +158,11 @@ extern int main(void)
|
||||
led_blink(LED_GREEN, BLINK_ALWAYS_ON);
|
||||
|
||||
/* Enable watchdog for 2000ms, with no window */
|
||||
WDT_Enable(WDT, WDT_MR_WDRSTEN | WDT_MR_WDDBGHLT | WDT_MR_WDIDLEHLT |
|
||||
(WDT_GetPeriod(2000) << 16) | WDT_GetPeriod(2000));
|
||||
WDT_Enable(WDT, WDT_MR_WDFIEN | WDT_MR_WDDBGHLT | WDT_MR_WDIDLEHLT |
|
||||
(WDT_GetPeriod(1000) << 16) | WDT_GetPeriod(1000));
|
||||
NVIC_EnableIRQ(WDT_IRQn);
|
||||
|
||||
PIO_InitializeInterrupts(0);
|
||||
PIO_InitializeInterrupts(10);
|
||||
|
||||
print_banner();
|
||||
board_main_top();
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#include "board.h"
|
||||
#include "utils.h"
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
/*------------------------------------------------------------------------------
|
||||
* Headers
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/*------------------------------------------------------------------------------
|
||||
* Headers
|
||||
|
||||
@@ -1672,6 +1672,10 @@ uint8_t USBD_HAL_Halt(uint8_t bEndpoint, uint8_t ctl)
|
||||
UDP->UDP_RST_EP |= 1 << bEndpoint;
|
||||
UDP->UDP_RST_EP &= ~(1 << bEndpoint);
|
||||
}
|
||||
|
||||
/* This fixes a weird bug with regard to ping-pong OUT endpoints */
|
||||
UDP->UDP_RST_EP |= 1 << bEndpoint;
|
||||
UDP->UDP_RST_EP &= ~(1 << bEndpoint);
|
||||
}
|
||||
|
||||
/* Return Halt status */
|
||||
|
||||
@@ -14,10 +14,6 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -15,10 +15,6 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include <board.h>
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifndef _BOARD_
|
||||
#define _BOARD_
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifndef _MANIFEST_H
|
||||
#define _MANIFEST_H
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -39,7 +39,8 @@ SEARCH_DIR(.)
|
||||
MEMORY
|
||||
{
|
||||
/* reserve the first 16k (= 0x4000) for the DFU bootloader */
|
||||
rom (rx) : ORIGIN = 0x00400000 + 16K, LENGTH = 256K - 16K /* flash, 256K */
|
||||
crcstub (rx) : ORIGIN = 0x00400000 + 16K, LENGTH = 512 /* crcstub part */
|
||||
rom (rx) : ORIGIN = 0x00400000 + 16K + 512, LENGTH = 256K - 16K - 512 /* flash, 256K */
|
||||
/* note: dfudata will be at the start */
|
||||
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K /* SRAM, 48K */
|
||||
}
|
||||
@@ -47,9 +48,17 @@ MEMORY
|
||||
/* Section Definitions */
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
.crcstub :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.crcstub_table))
|
||||
KEEP(*(.crcstub_code))
|
||||
} > crcstub = 0xff
|
||||
|
||||
.text :
|
||||
{
|
||||
|
||||
. = ALIGN(512);
|
||||
_sfixed = .;
|
||||
KEEP(*(.vectors .vectors.*))
|
||||
*(.text .text.* .gnu.linkonce.t.*)
|
||||
@@ -94,7 +103,7 @@ SECTIONS
|
||||
|
||||
. = ALIGN(4);
|
||||
_efixed = .; /* End of text section */
|
||||
} > rom
|
||||
} > rom = 0xff
|
||||
|
||||
/DISCARD/ :
|
||||
{
|
||||
|
||||
@@ -97,6 +97,8 @@ SECTIONS
|
||||
/DISCARD/ :
|
||||
{
|
||||
*(.ARM.exidx)
|
||||
*(.crcstub_table)
|
||||
*(.crcstub_code)
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
|
||||
@@ -147,7 +147,7 @@ extern WEAK void LowLevelInit( void )
|
||||
}
|
||||
*/
|
||||
|
||||
#ifndef qmod
|
||||
#ifndef BOARD_MAINOSC_BYPASS
|
||||
/* Initialize main oscillator */
|
||||
if ( !(PMC->CKGR_MOR & CKGR_MOR_MOSCSEL) )
|
||||
{
|
||||
@@ -165,11 +165,11 @@ extern WEAK void LowLevelInit( void )
|
||||
timeout = 0;
|
||||
while (!(PMC->PMC_SR & PMC_SR_MOSCSELS) && (timeout++ < CLOCK_TIMEOUT));
|
||||
#else
|
||||
/* QMOD has external 12MHz clock source */
|
||||
/* Board has external clock, not a crystal oscillator */
|
||||
PIOB->PIO_PDR = (1 << 9);
|
||||
PIOB->PIO_PUDR = (1 << 9);
|
||||
PIOB->PIO_PPDDR = (1 << 9);
|
||||
PMC->CKGR_MOR = CKGR_MOR_KEY(0x37) | CKGR_MOR_MOSCRCEN | CKGR_MOR_MOSCXTBY| CKGR_MOR_MOSCSEL;
|
||||
PMC->CKGR_MOR = CKGR_MOR_KEY(0x37) | CKGR_MOR_MOSCRCEN | CKGR_MOR_MOSCXTBY | CKGR_MOR_MOSCSEL;
|
||||
#endif
|
||||
|
||||
/* disable the red LED after main clock initialization */
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include "board.h"
|
||||
#include "boardver_adc.h"
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include "manifest.h"
|
||||
|
||||
|
||||
@@ -100,6 +100,7 @@ extern void UART_Configure( uint32_t baudrate, uint32_t masterClock)
|
||||
|
||||
/* Enable TX interrupts */
|
||||
pUart->UART_IER = UART_IER_TXRDY;
|
||||
NVIC_SetPriority(CONSOLE_IRQ, 15); /* lowest priority */
|
||||
NVIC_EnableIRQ(CONSOLE_IRQ);
|
||||
|
||||
/* Enable receiver and transmitter */
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
#include "board_common.h"
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include "board.h"
|
||||
#include "simtrace.h"
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include <osmocom/core/timer.h>
|
||||
#include "board.h"
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include "board.h"
|
||||
#include "trace.h"
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
/* Depending on the board this is running on, it might be possible
|
||||
* for the controller to read the status of the WWAN LED output lines of
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
/* Depending on the board this is running on, it might be possible
|
||||
* for the controller to set the status of the PERST input line of
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
#include "board_common.h"
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include <stdbool.h>
|
||||
#include "board.h"
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include "board.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include "board.h"
|
||||
#include "trace.h"
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
#include "board_common.h"
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#include "chip.h"
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include "board.h"
|
||||
#include "trace.h"
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
#include "board_common.h"
|
||||
@@ -29,6 +25,8 @@
|
||||
#define BOARD_MAINOSC 12000000
|
||||
/** desired main clock frequency (in Hz, based on BOARD_MAINOSC) */
|
||||
#define BOARD_MCK 58000000 // 18.432 * 29 / 6
|
||||
/** board has external clock, not crystal */
|
||||
#define BOARD_MAINOSC_BYPASS
|
||||
|
||||
/** MCU pin connected to red LED */
|
||||
#define PIO_LED_RED PIO_PA17
|
||||
@@ -39,7 +37,7 @@
|
||||
/** green LED pin definition */
|
||||
#define PIN_LED_GREEN {PIO_LED_GREEN, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
|
||||
/** LEDs pin definition */
|
||||
#define PINS_LEDS PIN_LED_RED, PIN_LED_GREEN
|
||||
#define PINS_LEDS PIN_LED_RED, PIN_LED_GREEN
|
||||
/** index for red LED in LEDs pin definition array */
|
||||
#define LED_NUM_RED 0
|
||||
/** index for green LED in LEDs pin definition array */
|
||||
@@ -91,8 +89,8 @@
|
||||
#define PINS_WWAN_IN { PIN_WWAN1, PIN_WWAN2 }
|
||||
|
||||
/* outputs controlling RESET input of modems */
|
||||
#define PIN_PERST1 {PIO_PA25, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_PULLUP}
|
||||
#define PIN_PERST2 {PIO_PA26, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_PULLUP}
|
||||
#define PIN_PERST1 {PIO_PA25, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_PULLUP}
|
||||
#define PIN_PERST2 {PIO_PA26, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_PULLUP}
|
||||
#define PINS_PERST { PIN_PERST1, PIN_PERST2 }
|
||||
|
||||
#define PIN_VERSION_DET {PIO_PA19, PIOA, ID_PIOA, PIO_PERIPH_D, PIO_DEFAULT}
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include "board.h"
|
||||
#include "simtrace.h"
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include <osmocom/core/timer.h>
|
||||
#include "board.h"
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include "board.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include "board.h"
|
||||
#include "trace.h"
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
/* Depending on the board this is running on, it might be possible
|
||||
* for the controller to read the status of the WWAN LED output lines of
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
/* Depending on the board this is running on, it might be possible
|
||||
* for the controller to set the status of the PERST input line of
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
#include "board_common.h"
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include "board.h"
|
||||
#include "simtrace.h"
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
#include "board_common.h"
|
||||
@@ -159,3 +155,7 @@
|
||||
#endif
|
||||
/* SIMtrace board supports man-in-the-middle mode */
|
||||
//#define HAVE_MITM
|
||||
|
||||
#define DETECT_VCC_BY_ADC
|
||||
#define VCC_UV_THRESH_1V8 (1500000/2) /* 10k/10k resistive divider halves voltage */
|
||||
#define VCC_UV_THRESH_3V (2500000/2) /* 10k/10k resistive divider halves voltage */
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include "board.h"
|
||||
#include "simtrace.h"
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include "board.h"
|
||||
#include "trace.h"
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
@@ -73,6 +69,8 @@ void card_emu_uart_enable(uint8_t uart_chan, uint8_t rxtx);
|
||||
void card_emu_uart_wait_tx_idle(uint8_t uart_chan);
|
||||
void card_emu_uart_interrupt(uint8_t uart_chan);
|
||||
|
||||
int card_emu_get_vcc(uint8_t uart_chan);
|
||||
|
||||
struct cardemu_usb_msg_config;
|
||||
int card_emu_set_config(struct card_handle *ch, const struct cardemu_usb_msg_config *scfg,
|
||||
unsigned int scfg_len);
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifndef SIMTRACE_RINGBUF_H
|
||||
#define SIMTRACE_RINGBUF_H
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifndef SIMTRACE_H
|
||||
#define SIMTRACE_H
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
/* SIMtrace USB IDs */
|
||||
#define USB_VENDOR_OPENMOKO 0x1d50
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
@@ -1062,7 +1058,10 @@ void card_emu_report_status(struct card_handle *ch, bool report_on_irq)
|
||||
sts->flags |= CEMU_STATUS_F_CLK_ACTIVE;
|
||||
if (ch->in_reset)
|
||||
sts->flags |= CEMU_STATUS_F_RESET_ACTIVE;
|
||||
/* FIXME: voltage + card insert */
|
||||
#ifdef DETECT_VCC_BY_ADC
|
||||
sts->voltage_mv = card_emu_get_vcc(ch->num);
|
||||
#endif
|
||||
/* FIXME: card insert */
|
||||
sts->F_index = ch->F_index;
|
||||
sts->D_index = ch->D_index;
|
||||
sts->wi = ch->wi;
|
||||
@@ -1106,7 +1105,12 @@ void card_emu_io_statechg(struct card_handle *ch, enum card_io io, int active)
|
||||
card_set_state(ch, ISO_S_WAIT_POWER);
|
||||
chg_mask |= CEMU_STATUS_F_VCC_PRESENT;
|
||||
} else if (active == 1 && ch->vcc_active == 0) {
|
||||
#ifdef DETECT_VCC_BY_ADC
|
||||
TRACE_INFO("%u: VCC activated (%d mV)\r\n", ch->num,
|
||||
card_emu_get_vcc(ch->num));
|
||||
#else
|
||||
TRACE_INFO("%u: VCC activated\r\n", ch->num);
|
||||
#endif
|
||||
card_set_state(ch, ISO_S_WAIT_CLK);
|
||||
chg_mask |= CEMU_STATUS_F_VCC_PRESENT;
|
||||
}
|
||||
|
||||
86
firmware/libcommon/source/crcstub.c
Normal file
86
firmware/libcommon/source/crcstub.c
Normal file
@@ -0,0 +1,86 @@
|
||||
/* SIMtrace 2 firmware crc stub
|
||||
*
|
||||
* (C) 2021 by sysmocom -s.f.m.c. GmbH, Author: Eric Wild <ewild@sysmocom.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "board.h"
|
||||
#include "core_cm3.h"
|
||||
#include "usb/device/dfu/dfu.h"
|
||||
|
||||
/*
|
||||
* This file is a bit special, everything has to go to specific sections, and no globals are available.
|
||||
* No external functions may be called, unless inlining is enforced!
|
||||
*/
|
||||
|
||||
static void crc_check_stub();
|
||||
__attribute__((section(".crcstub_table"))) volatile uint32_t crcstub_dummy_table[] = {
|
||||
(uint32_t)0xdeadc0de, /* deliberately choose invalid value so unpatched image will not be started */
|
||||
(uint32_t)crc_check_stub, /* must be valid flash addr */
|
||||
(uint32_t)0xf1, /* crc value calculated by the host */
|
||||
(uint32_t)0xf2, /* crc calc start address */
|
||||
(uint32_t)0xf3 /* crc calc length (byte) */
|
||||
};
|
||||
|
||||
__attribute__((section(".crcstub_code"))) static void do_crc32(int8_t c, uint32_t *crc_reg)
|
||||
{
|
||||
int32_t i, mask;
|
||||
*crc_reg ^= c;
|
||||
|
||||
for (unsigned int j = 0; j < 8; j++)
|
||||
if (*crc_reg & 1)
|
||||
*crc_reg = (*crc_reg >> 1) ^ 0xEDB88320;
|
||||
else
|
||||
*crc_reg = *crc_reg >> 1;
|
||||
}
|
||||
|
||||
__attribute__((section(".crcstub_code"), noinline)) static void crc_check_stub()
|
||||
{
|
||||
uint32_t crc_reg = 0xffffffff;
|
||||
uint32_t expected_crc_val = crcstub_dummy_table[2];
|
||||
uint8_t *crc_calc_startaddr = (uint8_t *)crcstub_dummy_table[3];
|
||||
volatile uint32_t *actual_exc_tbl = (volatile uint32_t *)crc_calc_startaddr;
|
||||
uint32_t crc_len = crcstub_dummy_table[4];
|
||||
|
||||
/* 4000ms wdt tickling */
|
||||
WDT->WDT_MR = WDT_MR_WDRSTEN | WDT_MR_WDDBGHLT | WDT_MR_WDIDLEHLT | (((4000UL << 8) / 1000) << 16) |
|
||||
((4000UL << 8) / 1000);
|
||||
|
||||
for (uint8_t *i = crc_calc_startaddr; i < crc_calc_startaddr + crc_len; i++)
|
||||
do_crc32(*i, &crc_reg);
|
||||
|
||||
crc_reg = ~crc_reg;
|
||||
|
||||
if (crc_reg == expected_crc_val) {
|
||||
/* this looks a bit awkward because we have to ensure the bx does not require a sp-relative load */
|
||||
__asm__ volatile("\
|
||||
mov r0, %0;\n\
|
||||
mov r1, %1;\n\
|
||||
MSR msp,r0;\n\
|
||||
bx r1;"
|
||||
:
|
||||
: "r"(actual_exc_tbl[0]), "r"(actual_exc_tbl[1]));
|
||||
} else {
|
||||
/* no globals ! */
|
||||
((struct dfudata *)0x20000000)->magic = USB_DFU_MAGIC;
|
||||
__DSB();
|
||||
for (;;) {
|
||||
/* no functon call, since NVIC_SystemReset() might not be inlined! */
|
||||
SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) | (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
|
||||
SCB_AIRCR_SYSRESETREQ_Msk);
|
||||
__DSB();
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "uart_console.h"
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include "board.h"
|
||||
#include "llist_irqsafe.h"
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include "board.h"
|
||||
#include "boardver_adc.h"
|
||||
@@ -172,6 +168,16 @@ static void card_emu_uart_set_direction(uint8_t uart_chan, bool tx)
|
||||
#endif
|
||||
}
|
||||
|
||||
int card_emu_get_vcc(uint8_t uart_chan)
|
||||
{
|
||||
struct cardem_inst *ci = &cardem_inst[uart_chan];
|
||||
#ifdef DETECT_VCC_BY_ADC
|
||||
return ci->vcc_uv / 1000;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* call-back from card_emu.c to enable/disable transmit and/or receive */
|
||||
void card_emu_uart_enable(uint8_t uart_chan, uint8_t rxtx)
|
||||
{
|
||||
@@ -404,10 +410,9 @@ void card_emu_uart_reset_wt(uint8_t uart_chan)
|
||||
/* call-back from card_emu.c to force a USART interrupt */
|
||||
void card_emu_uart_interrupt(uint8_t uart_chan)
|
||||
{
|
||||
OSMO_ASSERT(uart_chan < ARRAY_SIZE(cardem_inst));
|
||||
Usart *usart = get_usart_by_chan(uart_chan);
|
||||
if (!usart) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (USART0 == usart) {
|
||||
NVIC_SetPendingIRQ(USART0_IRQn);
|
||||
} else if (USART1 == usart) {
|
||||
@@ -465,6 +470,7 @@ static int card_vcc_adc_init(void)
|
||||
ADC->ADC_CHER |= ADC_CHER_CH6;
|
||||
ADC->ADC_IER |= ADC_IER_EOC6;
|
||||
#endif
|
||||
NVIC_SetPriority(ADC_IRQn, 13);
|
||||
NVIC_EnableIRQ(ADC_IRQn);
|
||||
ADC->ADC_CR |= ADC_CR_START;
|
||||
|
||||
@@ -561,6 +567,35 @@ void mode_cardemu_configure(void)
|
||||
TRACE_ENTRY();
|
||||
}
|
||||
|
||||
struct relevant_irq {
|
||||
uint32_t irq;
|
||||
uint32_t prio;
|
||||
const char *name;
|
||||
};
|
||||
static const struct relevant_irq relevant_irqs[] = {
|
||||
{ UDP_IRQn, 14, "USB" },
|
||||
{ CONSOLE_IRQ, 15, "CONSOLE" },
|
||||
{ FIRST_USART_IRQ, 0, "7816_0" },
|
||||
#ifdef CARDEMU_SECOND_UART
|
||||
{ USART0_IRQn, 0, "7816_1" },
|
||||
#endif
|
||||
#ifdef DETECT_VCC_BY_ADC
|
||||
{ ADC_IRQn, 13, "ADC" },
|
||||
#endif
|
||||
{ PIOA_IRQn, 10, "PIOA" },
|
||||
{ PIOB_IRQn, 10, "PIOB" },
|
||||
{ PIOC_IRQn, 10, "PIOC" },
|
||||
};
|
||||
void dump_irq_prios(void)
|
||||
{
|
||||
printf("Interrupt Enable Mask (ISER): %08x%08x\n\r", NVIC->ISER[1], NVIC->ISER[0]);
|
||||
for (unsigned int i = 0; i < ARRAY_SIZE(relevant_irqs); i++) {
|
||||
const struct relevant_irq *ri = &relevant_irqs[i];
|
||||
printf("IRQ prio %02u (%s): current=%u, expected=%u\r\n", ri->irq, ri->name,
|
||||
NVIC_GetPriority(ri->irq), ri->prio);
|
||||
}
|
||||
}
|
||||
|
||||
/* called if config is activated */
|
||||
void mode_cardemu_init(void)
|
||||
{
|
||||
@@ -568,6 +603,8 @@ void mode_cardemu_init(void)
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
NVIC_SetPriority(UDP_IRQn, 14);
|
||||
|
||||
#ifdef PINS_CARDSIM
|
||||
PIO_Configure(pins_cardsim, PIO_LISTSIZE(pins_cardsim));
|
||||
#endif
|
||||
@@ -581,6 +618,7 @@ void mode_cardemu_init(void)
|
||||
|
||||
/* configure USART as ISO-7816 slave (e.g. card) */
|
||||
ISO7816_Init(&cardem_inst[0].usart_info, CLK_SLAVE);
|
||||
NVIC_SetPriority(FIRST_USART_IRQ, 0);
|
||||
NVIC_EnableIRQ(FIRST_USART_IRQ);
|
||||
PIO_ConfigureIt(&pin_usim1_rst, usim1_rst_irqhandler);
|
||||
PIO_EnableIt(&pin_usim1_rst);
|
||||
@@ -608,6 +646,7 @@ void mode_cardemu_init(void)
|
||||
PIO_Configure(pins_usim2, PIO_LISTSIZE(pins_usim2));
|
||||
ISO7816_Init(&cardem_inst[1].usart_info, CLK_SLAVE);
|
||||
/* TODO enable timeout */
|
||||
NVIC_SetPriority(USART0_IRQn, 0);
|
||||
NVIC_EnableIRQ(USART0_IRQn);
|
||||
PIO_ConfigureIt(&pin_usim2_rst, usim2_rst_irqhandler);
|
||||
PIO_EnableIt(&pin_usim2_rst);
|
||||
@@ -626,6 +665,9 @@ void mode_cardemu_init(void)
|
||||
sim_switch_use_physical(1, 1);
|
||||
/* TODO check RST and VCC */
|
||||
#endif /* CARDEMU_SECOND_UART */
|
||||
|
||||
dump_irq_prios();
|
||||
|
||||
}
|
||||
|
||||
/* called if config is deactivated */
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include "ringbuffer.h"
|
||||
#include "trace.h"
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
/* This code implement the Sniffer mode to sniff the communication between a
|
||||
* SIM card (or any ISO 7816 smart card) and a phone (or any ISO 7816 card
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ static const SIMTraceDriverConfigurationDescriptorSniffer
|
||||
SIMTRACE_USB_EP_CARD_INT),
|
||||
.bmAttributes = USBEndpointDescriptor_INTERRUPT,
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXINTERRUPTSIZE_FS,
|
||||
.bInterval = 0x10,
|
||||
.bInterval = 1,
|
||||
},
|
||||
DFURT_IF_DESCRIPTOR(1, 0),
|
||||
};
|
||||
@@ -382,7 +382,7 @@ static const SIMTraceDriverConfigurationDescriptorPhone
|
||||
SIMTRACE_CARDEM_USB_EP_USIM1_INT),
|
||||
.bmAttributes = USBEndpointDescriptor_INTERRUPT,
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXINTERRUPTSIZE_FS,
|
||||
.bInterval = 0x10
|
||||
.bInterval = 1
|
||||
},
|
||||
#ifdef CARDEMU_SECOND_UART
|
||||
/* Communication class interface standard descriptor */
|
||||
@@ -429,7 +429,7 @@ static const SIMTraceDriverConfigurationDescriptorPhone
|
||||
SIMTRACE_CARDEM_USB_EP_USIM2_INT),
|
||||
.bmAttributes = USBEndpointDescriptor_INTERRUPT,
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXINTERRUPTSIZE_FS,
|
||||
.bInterval = 0x10,
|
||||
.bInterval = 1,
|
||||
},
|
||||
DFURT_IF_DESCRIPTOR(2, 0),
|
||||
#else
|
||||
@@ -547,7 +547,7 @@ static const SIMTraceDriverConfigurationDescriptorMITM
|
||||
CCID_EPT_NOTIFICATION),
|
||||
.bmAttributes = USBEndpointDescriptor_INTERRUPT,
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXINTERRUPTSIZE_FS,
|
||||
.bInterval = 0x10,
|
||||
.bInterval = 1,
|
||||
},
|
||||
|
||||
/* Communication class interface standard descriptor */
|
||||
@@ -593,7 +593,7 @@ static const SIMTraceDriverConfigurationDescriptorMITM
|
||||
SIMTRACE_USB_EP_PHONE_INT),
|
||||
.bmAttributes = USBEndpointDescriptor_INTERRUPT,
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXINTERRUPTSIZE_FS,
|
||||
.bInterval = 0x10
|
||||
.bInterval = 1
|
||||
},
|
||||
DFURT_IF_DESCRIPTOR(2, 0),
|
||||
};
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#include "board.h"
|
||||
#include "trace.h"
|
||||
|
||||
@@ -14,10 +14,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -14,10 +14,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -14,10 +14,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
|
||||
linux/include/linux/rbtree.h
|
||||
|
||||
@@ -13,10 +13,6 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/*! \defgroup timer Osmocom timers
|
||||
|
||||
@@ -14,10 +14,6 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/*! \file backtrace.c
|
||||
|
||||
@@ -14,10 +14,6 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/*! \addtogroup msgb
|
||||
|
||||
@@ -14,10 +14,6 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/*! \addtogroup utils
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA
|
||||
|
||||
linux/lib/rbtree.c
|
||||
|
||||
@@ -17,10 +17,6 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -17,10 +17,6 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
91
firmware/misc/crctool.c
Normal file
91
firmware/misc/crctool.c
Normal file
@@ -0,0 +1,91 @@
|
||||
/* SIMtrace 2 firmware crc tool
|
||||
*
|
||||
* (C) 2021 by sysmocom -s.f.m.c. GmbH, Author: Eric Wild <ewild@sysmocom.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static void do_crc32(int8_t c, uint32_t *crc_reg)
|
||||
{
|
||||
int32_t i, mask;
|
||||
*crc_reg ^= c;
|
||||
|
||||
for (unsigned int j = 0; j < 8; j++)
|
||||
if (*crc_reg & 1)
|
||||
*crc_reg = (*crc_reg >> 1) ^ 0xEDB88320;
|
||||
else
|
||||
*crc_reg = *crc_reg >> 1;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
uint32_t crc_reg = 0xffffffff;
|
||||
long fsize;
|
||||
uint8_t *buffer;
|
||||
uint32_t crc_start_offset;
|
||||
|
||||
if (argc < 3) {
|
||||
perror("usage: crctool startoffset blupdate.bin");
|
||||
return -1;
|
||||
}
|
||||
|
||||
crc_start_offset = strtoull(argv[1], 0, 10);
|
||||
|
||||
FILE *blfile = fopen(argv[2], "rb+");
|
||||
if (blfile == NULL) {
|
||||
perror("error opening file!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
fseek(blfile, 0, SEEK_END);
|
||||
fsize = ftell(blfile);
|
||||
|
||||
if (fsize <= crc_start_offset) {
|
||||
perror("file size?!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
fseek(blfile, 0, SEEK_SET);
|
||||
|
||||
buffer = malloc(fsize);
|
||||
fread(buffer, 1, fsize, blfile);
|
||||
|
||||
if (*(uint32_t *)buffer != 0xdeadc0de) {
|
||||
perror("weird magic, not a valid blupdate file?");
|
||||
free(buffer);
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint8_t *startaddr = buffer + crc_start_offset;
|
||||
uint8_t *endaddr = buffer + fsize;
|
||||
for (uint8_t *i = startaddr; i < endaddr; i++) {
|
||||
do_crc32(*i, &crc_reg);
|
||||
}
|
||||
crc_reg = ~crc_reg;
|
||||
|
||||
fprintf(stderr, "len: %ld crc: %.8x\n", fsize - crc_start_offset, crc_reg);
|
||||
|
||||
((uint32_t *)buffer)[0] = 0x2000baa0; /* fix magic to valid stack address, checked by BL */
|
||||
((uint32_t *)buffer)[2] = crc_reg;
|
||||
((uint32_t *)buffer)[3] = 0x00400000 + 0x4000 + crc_start_offset;
|
||||
((uint32_t *)buffer)[4] = fsize - crc_start_offset;
|
||||
|
||||
fseek(blfile, 0, SEEK_SET);
|
||||
fwrite(buffer, 4, 5, blfile);
|
||||
|
||||
fclose(blfile);
|
||||
free(buffer);
|
||||
return 0;
|
||||
}
|
||||
@@ -10,10 +10,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* Based on existing utf8_to_utf16le() function,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#
|
||||
# spec file for package simtrace2
|
||||
#
|
||||
# Copyright (c) 2018, Martin Hauke <mardnh@gmx.de>
|
||||
# Copyright (c) 2021 SUSE LLC
|
||||
# Copyright (c) 2018-2021, Martin Hauke <mardnh@gmx.de>
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@@ -12,6 +13,7 @@
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
%define sover 1
|
||||
Name: simtrace2
|
||||
Version: @VERSION@
|
||||
Release: 0
|
||||
@@ -24,12 +26,11 @@ BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
BuildRequires: libtool
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: pkgconfig(libosmocore)
|
||||
BuildRequires: pkgconfig(libosmosim)
|
||||
BuildRequires: pkgconfig(libosmocore) >= 1.4.0
|
||||
BuildRequires: pkgconfig(libosmosim) >= 1.4.0
|
||||
BuildRequires: pkgconfig(libosmousb) >= 1.4.0
|
||||
BuildRequires: pkgconfig(libpcsclite)
|
||||
BuildRequires: pkgconfig(libusb-1.0)
|
||||
BuildRequires: pkgconfig(libosmousb) >= 0.0.0
|
||||
BuildRequires: pkgconfig(udev)
|
||||
|
||||
%description
|
||||
Osmocom SIMtrace 2 is a software and hardware system for passively
|
||||
@@ -38,11 +39,11 @@ and remote SIM operation.
|
||||
|
||||
This package contains SIMtrace 2 host utility.
|
||||
|
||||
%package -n libosmo-simtrace2-0
|
||||
Summary: Shared Library part of libosmo-simtrace2
|
||||
%package -n libosmo-simtrace2-%{sover}
|
||||
Summary: Driver functions for Osmocom SIMtrace2 and compatible firmware
|
||||
Group: System/Libraries
|
||||
|
||||
%description -n libosmo-simtrace2-0
|
||||
%description -n libosmo-simtrace2-%{sover}
|
||||
This library contains core "driver" functionality to interface with the
|
||||
Osmocom SIMtrace2 (and compatible) USB device firmware. It enables
|
||||
applications to implement SIM card / smart card tracing as well as
|
||||
@@ -51,7 +52,7 @@ SIM / smart card emulation functions.
|
||||
%package -n libosmo-simtrace2-devel
|
||||
Summary: Development files for the Osmocom SIMtrace2 library
|
||||
Group: Development/Libraries/C and C++
|
||||
Requires: libosmo-simtrace2-0 = %{version}
|
||||
Requires: libosmo-simtrace2-%{sover} = %{version}
|
||||
|
||||
%description -n libosmo-simtrace2-devel
|
||||
Osmocom SIMtrace2 (and compatible) USB device firmware. It enables
|
||||
@@ -69,17 +70,18 @@ cd host
|
||||
echo "%{version}" >.tarball-version
|
||||
autoreconf -fiv
|
||||
%configure --disable-static
|
||||
make %{?_smp_mflags}
|
||||
%make_build
|
||||
|
||||
%install
|
||||
%make_install -C host
|
||||
install -Dm0644 host/contrib/99-simtrace2.rules %{buildroot}/%{_udevrulesdir}/99-simtrace2.rules
|
||||
find %{buildroot} -type f -name "*.la" -delete -print
|
||||
|
||||
%post -n libosmo-simtrace2-0 -p /sbin/ldconfig
|
||||
%postun -n libosmo-simtrace2-0 -p /sbin/ldconfig
|
||||
%post -n libosmo-simtrace2-%{sover} -p /sbin/ldconfig
|
||||
%postun -n libosmo-simtrace2-%{sover} -p /sbin/ldconfig
|
||||
|
||||
%files
|
||||
%license host/COPYING
|
||||
%doc README.md
|
||||
%{_bindir}/simtrace2-cardem-pcsc
|
||||
%{_bindir}/simtrace2-list
|
||||
@@ -87,8 +89,8 @@ find %{buildroot} -type f -name "*.la" -delete -print
|
||||
%{_bindir}/simtrace2-tool
|
||||
%{_udevrulesdir}/99-simtrace2.rules
|
||||
|
||||
%files -n libosmo-simtrace2-0
|
||||
%{_libdir}/libosmo-simtrace2.so.0*
|
||||
%files -n libosmo-simtrace2-%{sover}
|
||||
%{_libdir}/libosmo-simtrace2.so.%{sover}*
|
||||
|
||||
%files -n libosmo-simtrace2-devel
|
||||
%dir %{_includedir}/osmocom/
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user