4 Commits

Author SHA1 Message Date
Harald Welte
774330d413 WIP: introduce support for new ngff_cardem board
This adds support for the new ngff_cardem board, a board that
basically combines a ngff breakout board with a built-in SIMtrace2.

The firmware support added by this ptach is currently untested,
and serves as a basis for testing the ngff_cardem prototypes.

Change-Id: I9649c853271c22d5403cdf3a7ec9029c9cecfa32
2021-07-07 11:34:41 +02:00
Harald Welte
9d0d20c253 contrib/flash.py: Add OCTSIMTEST support
Change-Id: Id906d955f45a204ac0b00f56d8f5149c64c62f32
2021-07-07 11:34:26 +02:00
Harald Welte
f7b7f41d2f 99-simtrace2.rules: Add OCTSIMTEST
Change-Id: I226ee21e0937f851428578578f81075fa703dd54
2021-07-07 11:34:26 +02:00
Harald Welte
07f94342be Introduce simtrace2-tool
The simtrace-tool isa command line tool which can be used to e.g.
manually request a modem reset.

Change-Id: I3a8896ac2b3caef7590b51118359e5caed820a40
2021-07-01 23:28:52 +02:00
37 changed files with 160 additions and 1222 deletions

View File

@@ -1,563 +0,0 @@
# SPDX-License-Identifier: GPL-2.0
#
# clang-format configuration file. Intended for clang-format >= 4.
#
# For more information, see:
#
# Documentation/process/clang-format.rst
# https://clang.llvm.org/docs/ClangFormat.html
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
#
---
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
#AlignEscapedNewlines: Left # Unknown to clang-format-4.0
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
#AfterExternBlock: false # Unknown to clang-format-5.0
BeforeCatch: false
BeforeElse: false
IndentBraces: false
#SplitEmptyFunction: true # Unknown to clang-format-4.0
#SplitEmptyRecord: true # Unknown to clang-format-4.0
#SplitEmptyNamespace: true # Unknown to clang-format-4.0
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
#BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
#BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
#CompactNamespaces: false # Unknown to clang-format-4.0
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
#FixNamespaceComments: false # Unknown to clang-format-4.0
# Taken from:
# git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ \
# | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$, - '\1'," \
# | sort | uniq
ForEachMacros:
- 'apei_estatus_for_each_section'
- 'ata_for_each_dev'
- 'ata_for_each_link'
- '__ata_qc_for_each'
- 'ata_qc_for_each'
- 'ata_qc_for_each_raw'
- 'ata_qc_for_each_with_internal'
- 'ax25_for_each'
- 'ax25_uid_for_each'
- '__bio_for_each_bvec'
- 'bio_for_each_bvec'
- 'bio_for_each_bvec_all'
- 'bio_for_each_integrity_vec'
- '__bio_for_each_segment'
- 'bio_for_each_segment'
- 'bio_for_each_segment_all'
- 'bio_list_for_each'
- 'bip_for_each_vec'
- 'bitmap_for_each_clear_region'
- 'bitmap_for_each_set_region'
- 'blkg_for_each_descendant_post'
- 'blkg_for_each_descendant_pre'
- 'blk_queue_for_each_rl'
- 'bond_for_each_slave'
- 'bond_for_each_slave_rcu'
- 'bpf_for_each_spilled_reg'
- 'btree_for_each_safe128'
- 'btree_for_each_safe32'
- 'btree_for_each_safe64'
- 'btree_for_each_safel'
- 'card_for_each_dev'
- 'cgroup_taskset_for_each'
- 'cgroup_taskset_for_each_leader'
- 'cpufreq_for_each_entry'
- 'cpufreq_for_each_entry_idx'
- 'cpufreq_for_each_valid_entry'
- 'cpufreq_for_each_valid_entry_idx'
- 'css_for_each_child'
- 'css_for_each_descendant_post'
- 'css_for_each_descendant_pre'
- 'device_for_each_child_node'
- 'displayid_iter_for_each'
- 'dma_fence_chain_for_each'
- 'do_for_each_ftrace_op'
- 'drm_atomic_crtc_for_each_plane'
- 'drm_atomic_crtc_state_for_each_plane'
- 'drm_atomic_crtc_state_for_each_plane_state'
- 'drm_atomic_for_each_plane_damage'
- 'drm_client_for_each_connector_iter'
- 'drm_client_for_each_modeset'
- 'drm_connector_for_each_possible_encoder'
- 'drm_for_each_bridge_in_chain'
- 'drm_for_each_connector_iter'
- 'drm_for_each_crtc'
- 'drm_for_each_crtc_reverse'
- 'drm_for_each_encoder'
- 'drm_for_each_encoder_mask'
- 'drm_for_each_fb'
- 'drm_for_each_legacy_plane'
- 'drm_for_each_plane'
- 'drm_for_each_plane_mask'
- 'drm_for_each_privobj'
- 'drm_mm_for_each_hole'
- 'drm_mm_for_each_node'
- 'drm_mm_for_each_node_in_range'
- 'drm_mm_for_each_node_safe'
- 'flow_action_for_each'
- 'for_each_acpi_dev_match'
- 'for_each_active_dev_scope'
- 'for_each_active_drhd_unit'
- 'for_each_active_iommu'
- 'for_each_aggr_pgid'
- 'for_each_available_child_of_node'
- 'for_each_bio'
- 'for_each_board_func_rsrc'
- 'for_each_bvec'
- 'for_each_card_auxs'
- 'for_each_card_auxs_safe'
- 'for_each_card_components'
- 'for_each_card_dapms'
- 'for_each_card_pre_auxs'
- 'for_each_card_prelinks'
- 'for_each_card_rtds'
- 'for_each_card_rtds_safe'
- 'for_each_card_widgets'
- 'for_each_card_widgets_safe'
- 'for_each_cgroup_storage_type'
- 'for_each_child_of_node'
- 'for_each_clear_bit'
- 'for_each_clear_bit_from'
- 'for_each_cmsghdr'
- 'for_each_compatible_node'
- 'for_each_component_dais'
- 'for_each_component_dais_safe'
- 'for_each_comp_order'
- 'for_each_console'
- 'for_each_cpu'
- 'for_each_cpu_and'
- 'for_each_cpu_not'
- 'for_each_cpu_wrap'
- 'for_each_dapm_widgets'
- 'for_each_dev_addr'
- 'for_each_dev_scope'
- 'for_each_dma_cap_mask'
- 'for_each_dpcm_be'
- 'for_each_dpcm_be_rollback'
- 'for_each_dpcm_be_safe'
- 'for_each_dpcm_fe'
- 'for_each_drhd_unit'
- 'for_each_dss_dev'
- 'for_each_dtpm_table'
- 'for_each_efi_memory_desc'
- 'for_each_efi_memory_desc_in_map'
- 'for_each_element'
- 'for_each_element_extid'
- 'for_each_element_id'
- 'for_each_endpoint_of_node'
- 'for_each_evictable_lru'
- 'for_each_fib6_node_rt_rcu'
- 'for_each_fib6_walker_rt'
- 'for_each_free_mem_pfn_range_in_zone'
- 'for_each_free_mem_pfn_range_in_zone_from'
- 'for_each_free_mem_range'
- 'for_each_free_mem_range_reverse'
- 'for_each_func_rsrc'
- 'for_each_hstate'
- 'for_each_if'
- 'for_each_iommu'
- 'for_each_ip_tunnel_rcu'
- 'for_each_irq_nr'
- 'for_each_link_codecs'
- 'for_each_link_cpus'
- 'for_each_link_platforms'
- 'for_each_lru'
- 'for_each_matching_node'
- 'for_each_matching_node_and_match'
- 'for_each_member'
- 'for_each_memcg_cache_index'
- 'for_each_mem_pfn_range'
- '__for_each_mem_range'
- 'for_each_mem_range'
- '__for_each_mem_range_rev'
- 'for_each_mem_range_rev'
- 'for_each_mem_region'
- 'for_each_migratetype_order'
- 'for_each_msi_entry'
- 'for_each_msi_entry_safe'
- 'for_each_msi_vector'
- 'for_each_net'
- 'for_each_net_continue_reverse'
- 'for_each_netdev'
- 'for_each_netdev_continue'
- 'for_each_netdev_continue_rcu'
- 'for_each_netdev_continue_reverse'
- 'for_each_netdev_feature'
- 'for_each_netdev_in_bond_rcu'
- 'for_each_netdev_rcu'
- 'for_each_netdev_reverse'
- 'for_each_netdev_safe'
- 'for_each_net_rcu'
- 'for_each_new_connector_in_state'
- 'for_each_new_crtc_in_state'
- 'for_each_new_mst_mgr_in_state'
- 'for_each_new_plane_in_state'
- 'for_each_new_private_obj_in_state'
- 'for_each_node'
- 'for_each_node_by_name'
- 'for_each_node_by_type'
- 'for_each_node_mask'
- 'for_each_node_state'
- 'for_each_node_with_cpus'
- 'for_each_node_with_property'
- 'for_each_nonreserved_multicast_dest_pgid'
- 'for_each_of_allnodes'
- 'for_each_of_allnodes_from'
- 'for_each_of_cpu_node'
- 'for_each_of_pci_range'
- 'for_each_old_connector_in_state'
- 'for_each_old_crtc_in_state'
- 'for_each_old_mst_mgr_in_state'
- 'for_each_oldnew_connector_in_state'
- 'for_each_oldnew_crtc_in_state'
- 'for_each_oldnew_mst_mgr_in_state'
- 'for_each_oldnew_plane_in_state'
- 'for_each_oldnew_plane_in_state_reverse'
- 'for_each_oldnew_private_obj_in_state'
- 'for_each_old_plane_in_state'
- 'for_each_old_private_obj_in_state'
- 'for_each_online_cpu'
- 'for_each_online_node'
- 'for_each_online_pgdat'
- 'for_each_pci_bridge'
- 'for_each_pci_dev'
- 'for_each_pci_msi_entry'
- 'for_each_pcm_streams'
- 'for_each_physmem_range'
- 'for_each_populated_zone'
- 'for_each_possible_cpu'
- 'for_each_present_cpu'
- 'for_each_prime_number'
- 'for_each_prime_number_from'
- 'for_each_process'
- 'for_each_process_thread'
- 'for_each_prop_codec_conf'
- 'for_each_prop_dai_codec'
- 'for_each_prop_dai_cpu'
- 'for_each_prop_dlc_codecs'
- 'for_each_prop_dlc_cpus'
- 'for_each_prop_dlc_platforms'
- 'for_each_property_of_node'
- 'for_each_registered_fb'
- 'for_each_requested_gpio'
- 'for_each_requested_gpio_in_range'
- 'for_each_reserved_mem_range'
- 'for_each_reserved_mem_region'
- 'for_each_rtd_codec_dais'
- 'for_each_rtd_components'
- 'for_each_rtd_cpu_dais'
- 'for_each_rtd_dais'
- 'for_each_set_bit'
- 'for_each_set_bit_from'
- 'for_each_set_clump8'
- 'for_each_sg'
- 'for_each_sg_dma_page'
- 'for_each_sg_page'
- 'for_each_sgtable_dma_page'
- 'for_each_sgtable_dma_sg'
- 'for_each_sgtable_page'
- 'for_each_sgtable_sg'
- 'for_each_sibling_event'
- 'for_each_subelement'
- 'for_each_subelement_extid'
- 'for_each_subelement_id'
- '__for_each_thread'
- 'for_each_thread'
- 'for_each_unicast_dest_pgid'
- 'for_each_vsi'
- 'for_each_wakeup_source'
- 'for_each_zone'
- 'for_each_zone_zonelist'
- 'for_each_zone_zonelist_nodemask'
- 'fwnode_for_each_available_child_node'
- 'fwnode_for_each_child_node'
- 'fwnode_graph_for_each_endpoint'
- 'gadget_for_each_ep'
- 'genradix_for_each'
- 'genradix_for_each_from'
- 'hash_for_each'
- 'hash_for_each_possible'
- 'hash_for_each_possible_rcu'
- 'hash_for_each_possible_rcu_notrace'
- 'hash_for_each_possible_safe'
- 'hash_for_each_rcu'
- 'hash_for_each_safe'
- 'hctx_for_each_ctx'
- 'hlist_bl_for_each_entry'
- 'hlist_bl_for_each_entry_rcu'
- 'hlist_bl_for_each_entry_safe'
- 'hlist_for_each'
- 'hlist_for_each_entry'
- 'hlist_for_each_entry_continue'
- 'hlist_for_each_entry_continue_rcu'
- 'hlist_for_each_entry_continue_rcu_bh'
- 'hlist_for_each_entry_from'
- 'hlist_for_each_entry_from_rcu'
- 'hlist_for_each_entry_rcu'
- 'hlist_for_each_entry_rcu_bh'
- 'hlist_for_each_entry_rcu_notrace'
- 'hlist_for_each_entry_safe'
- 'hlist_for_each_entry_srcu'
- '__hlist_for_each_rcu'
- 'hlist_for_each_safe'
- 'hlist_nulls_for_each_entry'
- 'hlist_nulls_for_each_entry_from'
- 'hlist_nulls_for_each_entry_rcu'
- 'hlist_nulls_for_each_entry_safe'
- 'i3c_bus_for_each_i2cdev'
- 'i3c_bus_for_each_i3cdev'
- 'ide_host_for_each_port'
- 'ide_port_for_each_dev'
- 'ide_port_for_each_present_dev'
- 'idr_for_each_entry'
- 'idr_for_each_entry_continue'
- 'idr_for_each_entry_continue_ul'
- 'idr_for_each_entry_ul'
- 'in_dev_for_each_ifa_rcu'
- 'in_dev_for_each_ifa_rtnl'
- 'inet_bind_bucket_for_each'
- 'inet_lhash2_for_each_icsk_rcu'
- 'key_for_each'
- 'key_for_each_safe'
- 'klp_for_each_func'
- 'klp_for_each_func_safe'
- 'klp_for_each_func_static'
- 'klp_for_each_object'
- 'klp_for_each_object_safe'
- 'klp_for_each_object_static'
- 'kunit_suite_for_each_test_case'
- 'kvm_for_each_memslot'
- 'kvm_for_each_vcpu'
- 'list_for_each'
- 'list_for_each_codec'
- 'list_for_each_codec_safe'
- 'list_for_each_continue'
- 'list_for_each_entry'
- 'list_for_each_entry_continue'
- 'list_for_each_entry_continue_rcu'
- 'list_for_each_entry_continue_reverse'
- 'list_for_each_entry_from'
- 'list_for_each_entry_from_rcu'
- 'list_for_each_entry_from_reverse'
- 'list_for_each_entry_lockless'
- 'list_for_each_entry_rcu'
- 'list_for_each_entry_reverse'
- 'list_for_each_entry_safe'
- 'list_for_each_entry_safe_continue'
- 'list_for_each_entry_safe_from'
- 'list_for_each_entry_safe_reverse'
- 'list_for_each_entry_srcu'
- 'list_for_each_prev'
- 'list_for_each_prev_safe'
- 'list_for_each_safe'
- 'llist_for_each'
- 'llist_for_each_entry'
- 'llist_for_each_entry_safe'
- 'llist_for_each_safe'
- 'mci_for_each_dimm'
- 'media_device_for_each_entity'
- 'media_device_for_each_intf'
- 'media_device_for_each_link'
- 'media_device_for_each_pad'
- 'nanddev_io_for_each_page'
- 'netdev_for_each_lower_dev'
- 'netdev_for_each_lower_private'
- 'netdev_for_each_lower_private_rcu'
- 'netdev_for_each_mc_addr'
- 'netdev_for_each_uc_addr'
- 'netdev_for_each_upper_dev_rcu'
- 'netdev_hw_addr_list_for_each'
- 'nft_rule_for_each_expr'
- 'nla_for_each_attr'
- 'nla_for_each_nested'
- 'nlmsg_for_each_attr'
- 'nlmsg_for_each_msg'
- 'nr_neigh_for_each'
- 'nr_neigh_for_each_safe'
- 'nr_node_for_each'
- 'nr_node_for_each_safe'
- 'of_for_each_phandle'
- 'of_property_for_each_string'
- 'of_property_for_each_u32'
- 'pci_bus_for_each_resource'
- 'pcl_for_each_chunk'
- 'pcl_for_each_segment'
- 'pcm_for_each_format'
- 'ping_portaddr_for_each_entry'
- 'plist_for_each'
- 'plist_for_each_continue'
- 'plist_for_each_entry'
- 'plist_for_each_entry_continue'
- 'plist_for_each_entry_safe'
- 'plist_for_each_safe'
- 'pnp_for_each_card'
- 'pnp_for_each_dev'
- 'protocol_for_each_card'
- 'protocol_for_each_dev'
- 'queue_for_each_hw_ctx'
- 'radix_tree_for_each_slot'
- 'radix_tree_for_each_tagged'
- 'rb_for_each'
- 'rbtree_postorder_for_each_entry_safe'
- 'rdma_for_each_block'
- 'rdma_for_each_port'
- 'rdma_umem_for_each_dma_block'
- 'resource_list_for_each_entry'
- 'resource_list_for_each_entry_safe'
- 'rhl_for_each_entry_rcu'
- 'rhl_for_each_rcu'
- 'rht_for_each'
- 'rht_for_each_entry'
- 'rht_for_each_entry_from'
- 'rht_for_each_entry_rcu'
- 'rht_for_each_entry_rcu_from'
- 'rht_for_each_entry_safe'
- 'rht_for_each_from'
- 'rht_for_each_rcu'
- 'rht_for_each_rcu_from'
- '__rq_for_each_bio'
- 'rq_for_each_bvec'
- 'rq_for_each_segment'
- 'scsi_for_each_prot_sg'
- 'scsi_for_each_sg'
- 'sctp_for_each_hentry'
- 'sctp_skb_for_each'
- 'shdma_for_each_chan'
- '__shost_for_each_device'
- 'shost_for_each_device'
- 'sk_for_each'
- 'sk_for_each_bound'
- 'sk_for_each_entry_offset_rcu'
- 'sk_for_each_from'
- 'sk_for_each_rcu'
- 'sk_for_each_safe'
- 'sk_nulls_for_each'
- 'sk_nulls_for_each_from'
- 'sk_nulls_for_each_rcu'
- 'snd_array_for_each'
- 'snd_pcm_group_for_each_entry'
- 'snd_soc_dapm_widget_for_each_path'
- 'snd_soc_dapm_widget_for_each_path_safe'
- 'snd_soc_dapm_widget_for_each_sink_path'
- 'snd_soc_dapm_widget_for_each_source_path'
- 'tb_property_for_each'
- 'tcf_exts_for_each_action'
- 'udp_portaddr_for_each_entry'
- 'udp_portaddr_for_each_entry_rcu'
- 'usb_hub_for_each_child'
- 'v4l2_device_for_each_subdev'
- 'v4l2_m2m_for_each_dst_buf'
- 'v4l2_m2m_for_each_dst_buf_safe'
- 'v4l2_m2m_for_each_src_buf'
- 'v4l2_m2m_for_each_src_buf_safe'
- 'virtio_device_for_each_vq'
- 'while_for_each_ftrace_op'
- 'xa_for_each'
- 'xa_for_each_marked'
- 'xa_for_each_range'
- 'xa_for_each_start'
- 'xas_for_each'
- 'xas_for_each_conflict'
- 'xas_for_each_marked'
- 'xbc_array_for_each_value'
- 'xbc_for_each_key_value'
- 'xbc_node_for_each_array_value'
- 'xbc_node_for_each_child'
- 'xbc_node_for_each_key_value'
- 'zorro_for_each_dev'
- 'for_each_line'
- 'for_each_non_empty_line'
#IncludeBlocks: Preserve # Unknown to clang-format-5.0
IncludeCategories:
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
#IndentPPDirectives: None # Unknown to clang-format-5.0
IndentWidth: 8
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
#ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
ObjCBlockIndentWidth: 8
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
# Taken from git's rules
#PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0
PenaltyBreakBeforeFirstCallParameter: 30
PenaltyBreakComment: 10
PenaltyBreakFirstLessLess: 0
PenaltyBreakString: 10
PenaltyExcessCharacter: 100
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: false
SortIncludes: false
#SortUsingDeclarations: false # Unknown to clang-format-4.0
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
#SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0
#SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0
SpaceBeforeParens: ControlStatements
#SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp03
TabWidth: 8
UseTab: Always
...

View File

@@ -1,3 +0,0 @@
[gerrit]
host=gerrit.osmocom.org
project=simtrace2

View File

@@ -8,23 +8,13 @@ fw-$(1)-$(2)-clean:
endef endef
$(eval $(call RULES,simtrace,dfu)) $(eval $(call RULES,simtrace,dfu))
$(eval $(call RULES,simtrace,blupdate))
$(eval $(call RULES,simtrace,trace)) $(eval $(call RULES,simtrace,trace))
$(eval $(call RULES,simtrace,cardem)) $(eval $(call RULES,simtrace,cardem))
$(eval $(call RULES,qmod,dfu)) $(eval $(call RULES,qmod,dfu))
$(eval $(call RULES,qmod,blupdate))
$(eval $(call RULES,qmod,cardem)) $(eval $(call RULES,qmod,cardem))
$(eval $(call RULES,ngff_cardem,dfu))
$(eval $(call RULES,ngff_cardem,blupdate))
$(eval $(call RULES,ngff_cardem,trace))
$(eval $(call RULES,ngff_cardem,cardem))
fw-clean: fw-simtrace-dfu-clean fw-simtrace-blupdate-clean fw-simtrace-trace-clean fw-simtrace-cardem-clean \ fw-clean: fw-simtrace-dfu-clean fw-simtrace-trace-clean fw-simtrace-cardem-clean fw-qmod-dfu-clean fw-qmod-cardem-clean
fw-qmod-dfu-clean fw-qmod-blupdate-clean fw-qmod-cardem-clean \ fw: fw-simtrace-dfu fw-simtrace-trace fw-simtrace-cardem fw-qmod-dfu fw-qmod-cardem
fw-ngff_cardem-dfu-clean fw-ngff_cardem-blupdate-clean fw-ngff_cardem-trace-clean fw-ngff_cardem-cardem-clean
fw: fw-simtrace-dfu fw-simtrace-blupdate fw-simtrace-trace fw-simtrace-cardem \
fw-qmod-dfu fw-qmod-blupdate fw-qmod-cardem \
fw-ngff_cardem-dfu fw-ngff_cardem-blupdate fw-ngff_cardem-trace fw-ngff_cardem-cardem
utils: utils:
(cd host && \ (cd host && \

View File

@@ -28,11 +28,10 @@ export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="$inst/lib" export LD_LIBRARY_PATH="$inst/lib"
BUILDS="" BUILDS=""
BUILDS+="simtrace/dfu simtrace/blupdate simtrace/trace simtrace/cardem " BUILDS+="simtrace/dfu simtrace/trace simtrace/cardem "
BUILDS+="qmod/dfu qmod/blupdate qmod/cardem " BUILDS+="qmod/dfu qmod/cardem "
BUILDS+="owhw/dfu owhw/blupdate owhw/cardem " BUILDS+="owhw/dfu owhw/cardem "
BUILDS+="octsimtest/cardem " BUILDS+="octsimtest/cardem "
BUILDS+="ngff_cardem/dfu ngff_cardem/blupdate ngff_cardem/cardem ngff_cardem/trace "
cd $TOPDIR/firmware cd $TOPDIR/firmware
for build in $BUILDS; do for build in $BUILDS; do

View File

@@ -36,29 +36,9 @@ local reserved = ProtoField.uint16("usb_simtrace.reserved", "reserved", base.HE
local payloadlen = ProtoField.uint16("usb_simtrace.length", "length", base.HEX_DEC) local payloadlen = ProtoField.uint16("usb_simtrace.length", "length", base.HEX_DEC)
local payload = ProtoField.bytes("usb_simtrace.payload", "Data") 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 rxtxdata = ProtoField.bytes("usb_simtrace.rxtxdata", "rx/tx (data)")
usb_simtrace_protocol.fields = { usb_simtrace_protocol.fields = {
msgtype, seqnr, slotnr, reserved, payloadlen, payload, pb_and_rx, pb_and_tx, final, tpdu_hdr, rxtxdatalen, rxtxdata msgtype, seqnr, slotnr, reserved, payloadlen, payload
} }
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();
headerSubtree:add(pb_and_rx, cmd32)
headerSubtree:add(pb_and_tx, cmd32)
headerSubtree:add(final, cmd32)
headerSubtree:add(tpdu_hdr, cmd32)
headerSubtree:add(rxtxdatalen, len)
headerSubtree:add_le(rxtxdata, payload_data(8+6,len))
end
function usb_simtrace_protocol.dissector(buffer, pinfo, tree) function usb_simtrace_protocol.dissector(buffer, pinfo, tree)
length = buffer:len() length = buffer:len()
@@ -74,12 +54,7 @@ function usb_simtrace_protocol.dissector(buffer, pinfo, tree)
subtree:add(slotnr, buffer(3,1)) subtree:add(slotnr, buffer(3,1))
subtree:add_le(payloadlen, buffer(6,2)) subtree:add_le(payloadlen, buffer(6,2))
pinfo.cols.info = string.format("Cmd 0x%04X : %s", command, control_commands[command]) pinfo.cols.info = string.format("Cmd 0x%04X : %s", command, control_commands[command])
local payload_data = buffer(8,length-8) subtree:add(payload, buffer(8,length-8))
if(command == 0x0101 or command == 0x0106) then
return dissect_rxtx(buffer(),pinfo,subtree)
else
subtree:add(payload, payload_data)
end
end end
@@ -88,5 +63,6 @@ function usb_simtrace_protocol.init()
local usb_product_dissectors = DissectorTable.get("usb.product") local usb_product_dissectors = DissectorTable.get("usb.product")
usb_product_dissectors:add(0x1d50616d, usb_simtrace_protocol) usb_product_dissectors:add(0x1d50616d, usb_simtrace_protocol)
usb_product_dissectors:add(0x1d50616e, usb_simtrace_protocol) usb_product_dissectors:add(0x1d50616e, usb_simtrace_protocol)
DissectorTable.get("usb.bulk"):add(0xffff, usb_simtrace_protocol)
-- DissectorTable.get("usb.bulk"):add(0xffff, usb_simtrace_protocol)
end end

213
debian/changelog vendored
View File

@@ -1,217 +1,8 @@
simtrace2 (0.8.2) unstable; urgency=medium simtrace2 (0.5.2) UNRELEASED; urgency=medium
* firmware/Makefile: don't use distribution's CFLAGS
-- Oliver Smith <osmith@sysmocom.de> Fri, 15 Sep 2023 11:17:37 +0200
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 ]
* adapt to host tools in autotools * adapt to host tools in autotools
* simtrace2_api: Remove dead code
* fix baudrate of 'make log'
* qmod DFU: Don't overwrite memory beyond end of usb_strings[]
* usb_strings.txt: s/SIMtrace Phone/SIMtrace Card Emulation/
* Patch actual board name into the USB iProduct string descriptor
* Build only 'reasonable' combinations of APP/MEMORY
* stdio: Add support for %p format string (pointer address)
* Fix format string related warnings (int vs. long)
* Add missing CR to achieve CRLF at end of log lines
* more comments in host_communication.c.
* usb_buf: count number of elements in queue
* usb_buf: Limit the maximum queue length to 3 elements
* qmod: Don't print EEPROM operations in help when not supported
* cosmetic: board_qmod: Annotate #endif with comments
* qmod: Document '!' and '@' commands on UART
* implement minimalistic talloc_report(); add 't' command on UART
* update copyright statement
* cardem: Fix memory leak on unsupported SIMTRACE_MSGT_DT_CEMU_CARDINSERT
* usb_buf: Actually limit queue to 3 elements, not 4
* USBD_HAL: Don't disable UDP peripheral clock on suspend
* usb_buf: Properly initialize buffered_endpoint->ep number
* pseudo_talloc: Increment number of buffers from 10 to 20
* card_emu: Factor out card_handle_reset() from card_emu_init()
* cardem: Move card_emu_io_statechg() calls out of interrupt context
* cardem: RST resets all state (including release of buffers)
* host_communication: Send zero-length-packet on wMaxPacketSize
* card_emu: Initialize PTSS state every time we start PTS
* card_emu: Avoid recursive calls to card_set_state()
* card_emu: Always print state names in string representation
* card_emu: Remove extraneous code
* card_emu: Remove extraneous initialization of ch->pts.state
* cardem: Make card_emu_report_status() optionally use IRQ endpoint
* cardem: Add SIMTRACE_MSGT_BD_CEMU_CONFIG
* cardem: Implement support for CEMU_FEAT_F_STATUS_IRQ
* simtrace2-sniff: Reformat value_string to pass our validation scripts
* firmware: Reformat value_string to pass our validation scripts
* jenkins.sh: Add verify_value_string_arrays_are_terminated.py
* [lib] apdu_dispatch: Use DLGLOBAL and don't printf() directly
* [lib] apdu_dispatch: Don't print APDU state to stdout
* OSMO_ASSERT() on double-free or invalid pointer
* Update .gitignore file for host
* migrate to libosmousb
* library: Add osmo_st2_compatible_dev_idsp[]
* firmware: move printing of welcome banner to common function print_banner()
* firmware: apps/cardem/main.c: Synchronize with apps/trace/main.c
* host: Add COPYING file for host software (GPLv2)
* host/lib/gsmtap.c: Add GPLv2 disclaimer
* increase ringbuffer size from 512 to 1024 bytes
* simtrace2_api: Add osmo_st2_cardem_request_config()
* Disable interrupts during EEFC_ReadUniqueID()
* cardem: Fix infinite loop + watchdog reset on long OUT message
* extend osmo_st2_cardem_inst with fields required by osmo-remsim
* cosmetic: Add missing CR to LF in dispatch_received_usb_msg()
* USBD.c: Don't reset EP0 on SetConfiguration(0)
* pio_it.c: Permit repeated calls to PIO_ConfigureIt()
* simtrace2_siff: getopt_long() returns int, not char
* Introduce support for asynchronous USB transmission
* firmware: fix builds with gcc stack smashing protection enabled
* dfu: Shrink code by 144 bytes (by not calling PIO_InitializeInterrupts)
* dfu: Save another 60 bytes by changing the way we print horizontal lines
* migrate from BSC_FD_* to OSMO_FD_*
* remove usb2udp
* rename simtrace2-remsim to simtrace2-cardem-pcsc
* Update README
* remove old pre-autoconf makefile
* simtrace2-cardem-pcsc: Make it work again
* Revert "add ISO 7816-3 library to remsim project"
* Revert "add library providing ISO 7816-3 utilities"
* card_emu: waiting_time is stored in etu, not clocks.
* card_emu: Rename fi to Fi and di to Di
* card_emu: Clarify and differentiate F/Fi/F_index/Fi_index
* iso7816_fidi: Add iso7816_3_ prefix to symbols; fix terminology
* card_emu: improve reset detection conditions
* card_emu: explicitly initialize PTS and TPDU states
* card_emu: Use USART timeout for waiting time
* card_emu: Fix USART timer, particularly in re-start situations
* card_emu: Fix computation of waiting time
* contrib/jenkins.sh: Switch from rita -> ftp.osmocom.org
* st2-cardem-pcsc: Fix goto-in-while mess
* st2-cardem-pcsc: Use ATR of real card by default
* simtrace board.h: Enable HAVE_CARDEM if we build the cardem firmware
* jenkins.sh: build 'cardem' firmware also for simtrace board
* Revert "cardem: disable upload for simtrace2"
* simtrace2-cardem-pcsc: Decode STATUS flags to strings
* simtrace2-cardem-pcsc: Reset the real card if reader resets cardem
* assert: Use printf_sync() to ensure printing of assert / panic
* Add usb product ID of sysmoOCTSIMTEST
* octsimtest: remove lots of unused #defines
* octsimtest: most code for support of this new board
* octsimtest: Switch direction of I/O level shifter depending on uart tx / rx
* cardem-pcsc: initialize libosmocore logging
* octsimtest: Adjust VCC voltage thresholds (resistive VCC divider)
* contrib/jenkins.sh: Build 'cardem' app for 'octsimtest' board
* firmware: octsimtest: Fix IO_DIR pin definition
* firmware: octsimtest: Make slot mux configurable via USB
* firmware: octsimtest: mcp23017 initializaiton
* firmware: cardem: re-factor CARDINSERT command processing
* firmware: octsimtest: Support SIMTRACE_MSGT_DT_CEMU_CARDINSERT
* firmware: octsimtest: use TRACE_* macros instead of direct printf
* firmware: octsimtest: Fix disabling the card_insert signal
* firmware: octsimtest: Add i/I command for setting card-insert via I2C GPIO
* firmware: octsimtest: ensure all card_insert GPIO are 0 after reset
* don't printf() directly from library code, go via libosmocore logging
* simtrace2-list: Use osmo_st2_compatible_dev_ids[]
* board_gpio.gnumeric: Add ngff-cardem pin-out
* 99-simtrace2.rules: Add OCTSIMTEST
* contrib/flash.py: Add OCTSIMTEST support
* Introduce simtrace2-tool
* introduce support for new ngff_cardem board
* simtrace2.spec: Add simtrace2-tool binary to package
* contrib/jenkins.sh: Build APP=cardem for BOARD=ngff_cardem
* jenkins.sh: Build 'trace' firmware for ngff_cardem
* Use osmo_libusb_{init,exit}() instead of libusb_{init,exit}()
* simtrace2-cardem-pcsc: Remove double libusb initialization
* simtrace2-tool: Initialize logging to avoid error on first log output
* cardem-pcsc: Fix return of uninitialized variable
* host: Upgrade libosmocore dependency to 1.4.0
[ Kévin Redon ] -- Harald Welte <lafore@gnumonks.org> Thu, 28 Nov 2019 00:44:57 +0100
* minor: fix spacing
* minor: updated copyright years
* dfu: minor: make debug output only verbose in info level
* minor: move USB debug output from info to debug level
* minor: improve debug output
* minor : fix typo in comment
* better detect VCC and nRST changes on simtrace2 board
* minor: ignore usbstring binary
* simtrace2-remsim: Use simplest ATR
* cardem: use simplest ATR as default ATR
* minor: fix typo
* DFU: increase USB reset duration to 50 ms
* DFU: restart bootloader when USB conf failed
* Makefile: add linker option showing memory usage
* improve shared bootloader/application memory
* minor: improve trace output
* DFU: add DFU application
* add script to flash latest firmware
* minor: use same LED pattern for cardem as other applications
* cardem: currently simtrace does not support cardem
* add library providing ISO 7816-3 utilities
* add ISO 7816-3 library to remsim project
* rename PIN_PHONE_{CLK,IO} to PIN_USIM1_{CLK,IO}
* minor add comments
* make sim switch board specific
[ Eric Wild ]
* remsim: allow selecting pcsc reader number
* cardem: disable upload for simtrace2
* firmware: do not allow undefined symbols
* firmware: allow verbose builds
* cardem: choose a more reasonable default ATR
* contrib: add a basic simtrace lua dissector for wireshark
* cardem: free the buf
* cardemu: support 1v8 for the tester
* firmware: data sections
* firmware: proper makefile deps
* firmware: make the ngff beakout blink
* simtrace2-cardem: use local sim on exit
* contrib: more cardem dissection
* firmware: trace for ngff
* cardem: fix spurious NULL bytes during transfers
* contrib/jenkins.sh: build ngff_Cardem dfu bootloader
* contrib: allow manually forcing bulk simtrace dissection
* contrib/jenkins.sh: lower trace to make bl fit
* Revert "firmware: data sections"
* add the ngff cardem to default build targets
* drop unused exidx sections when linking
* clang build support
* fix bootloader led config crash
* firmware: add bootloader update "app"
* firmware: remove usb pullup that dates back to simtrace1
* firmware: increase reset delay before usb reattach
* firmware: drop cref printing
* add our default clang-format file
* firmware: add missing usb strings to blupdate that prevented building it
* jenkins: build bootloader updater
* firmware: remove dfu-dfu default target
[ Oliver Smith ]
* contrib: import RPM spec
* contrib: integrate RPM spec
* d/source/format: new file
* firmware/Makefile: fix UNKNOWN in OBS packages
* host: use git-version-gen/tarball-v. from topdir
* gitignore: add firmware/apps/*/usb_strings.txt.patched
* firmware: create duplicate files for upload only
* contrib/prepare_upload.sh: fix cd problems
* firmware: qmod-dfu: disable stack protector
* firmware: disable stack protector by default
* gitreview: new file
[ Leonard Hübner ]
* remsim: adding cli argument to set the atr
[ Eric ]
* dfu: let the device reset itself
-- Harald Welte <laforge@osmocom.org> Thu, 09 Dec 2021 08:12:56 +0100
simtrace2 (0.5.1) unstable; urgency=medium simtrace2 (0.5.1) unstable; urgency=medium

8
debian/control vendored
View File

@@ -10,7 +10,7 @@ Build-Depends: debhelper (>= 9),
pkg-config, pkg-config,
git, git,
dh-autoreconf, dh-autoreconf,
libosmocore-dev (>= 1.4.0), libosmocore-dev,
libpcsclite-dev, libpcsclite-dev,
libnewlib-arm-none-eabi, libnewlib-arm-none-eabi,
libusb-1.0-0-dev, libusb-1.0-0-dev,
@@ -33,11 +33,11 @@ Package: simtrace2-utils
Section: devel Section: devel
Architecture: any Architecture: any
Multi-Arch: same Multi-Arch: same
Depends: ${shlibs:Depends}, ${misc:Depends}, libosmo-simtrace2-1 Depends: ${shlibs:Depends}, ${misc:Depends}, libosmo-simtrace2-0
Recommends: simtrace2-firmware Recommends: simtrace2-firmware
Description: Host utilities to communicate with SIMtrace2 USB Devices. Description: Host utilities to communicate with SIMtrace2 USB Devices.
Package: libosmo-simtrace2-1 Package: libosmo-simtrace2-0
Section: libs Section: libs
Architecture: any Architecture: any
Multi-Arch: same Multi-Arch: same
@@ -52,7 +52,7 @@ Package: libosmo-simtrace2-dev
Section: libdevel Section: libdevel
Architecture: any Architecture: any
Multi-Arch: same Multi-Arch: same
Depends: libosmo-simtrace2-1, ${misc:Depends} Depends: libosmo-simtrace2-0, ${misc:Depends}
Description: Development headers for Osmocom SIMtrace2 library Description: Development headers for Osmocom SIMtrace2 library
This library contains core "driver" functionality to interface with the This library contains core "driver" functionality to interface with the
Osmocom SIMtrace2 (and compatible) USB device firmware. It enables Osmocom SIMtrace2 (and compatible) USB device firmware. It enables

View File

@@ -29,13 +29,6 @@
# Makefile for compiling the Getting Started with SAM3S Microcontrollers project # Makefile for compiling the Getting Started with SAM3S Microcontrollers project
GIT_VERSION=$(shell $(TOP)/git-version-gen $(TOP)/.tarball-version) GIT_VERSION=$(shell $(TOP)/git-version-gen $(TOP)/.tarball-version)
CFLAGS = \
-Werror=format-security \
-Wformat \
-g \
$(NULL)
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# User-modifiable options # User-modifiable options
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@@ -56,8 +49,7 @@ APP ?= dfu
# Defines which are the available memory targets for the SAM3S-EK board. # Defines which are the available memory targets for the SAM3S-EK board.
ifeq ($(APP), dfu) ifeq ($(APP), dfu)
MEMORIES ?= flash MEMORIES ?= flash dfu
TRACE_LEVEL ?= 0
else else
MEMORIES ?= dfu MEMORIES ?= dfu
endif endif
@@ -80,20 +72,12 @@ AT91LIB_USB_DFU_PATH = $(AT91LIB)/usb/device/dfu
# Tool suffix when cross-compiling # Tool suffix when cross-compiling
CROSS_COMPILE = arm-none-eabi- CROSS_COMPILE = arm-none-eabi-
USE_CLANG ?= 0 LIBS = -Wl,--start-group -lgcc -Wl,--end-group -nostdlib
ifneq ("$(USE_CLANG)","0")
# --target=thumbv7m-none-eabi # Compilation tools
CC = clang
LD = ld.lld
SIZE = llvm-size
LIBS = -nostdlib
else
CC = $(CROSS_COMPILE)gcc CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld LD = $(CROSS_COMPILE)ld
SIZE = $(CROSS_COMPILE)size SIZE = $(CROSS_COMPILE)size
LIBS = -Wl,--start-group -lgcc -Wl,--end-group -nostdlib
endif
STRIP = $(CROSS_COMPILE)strip STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy OBJCOPY = $(CROSS_COMPILE)objcopy
GDB = $(CROSS_COMPILE)gdb GDB = $(CROSS_COMPILE)gdb
@@ -154,11 +138,7 @@ ALLOW_PEER_ERASE?=0
#CFLAGS+=-DUSB_NO_DEBUG=1 #CFLAGS+=-DUSB_NO_DEBUG=1
# Optimization level, put in comment for debugging # Optimization level, put in comment for debugging
ifneq ("$(USE_CLANG)","0")
OPTIMIZATION ?= -Oz
else
OPTIMIZATION ?= -Os OPTIMIZATION ?= -Os
endif
# Flags # Flags
INCLUDES_USB = -I$(AT91LIB)/usb/include -I$(AT91LIB) INCLUDES_USB = -I$(AT91LIB)/usb/include -I$(AT91LIB)
@@ -172,11 +152,6 @@ INCLUDES += -Ilibosmocore/include
INCLUDES += -Isrc_simtrace -Iinclude INCLUDES += -Isrc_simtrace -Iinclude
INCLUDES += -Iapps/$(APP) INCLUDES += -Iapps/$(APP)
ifneq ("$(USE_CLANG)","0")
CFLAGS += -Wno-unknown-warning-option -Wno-empty-body -fno-exceptions -fno-unwind-tables --config armv7em_soft_nofp_nosys
else
CFLAGS += -Wno-suggest-attribute=noreturn --param max-inline-insns-single=500
endif
CFLAGS += -Wall -Wchar-subscripts -Wcomment -Wimplicit-int -Wformat=2 CFLAGS += -Wall -Wchar-subscripts -Wcomment -Wimplicit-int -Wformat=2
CFLAGS += -Werror-implicit-function-declaration -Wmain -Wparentheses CFLAGS += -Werror-implicit-function-declaration -Wmain -Wparentheses
CFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs #-Wunused CFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs #-Wunused
@@ -189,16 +164,16 @@ CFLAGS += -Wredundant-decls -Wnested-externs #-Winline -Wlong-long
CFLAGS += -Wunreachable-code CFLAGS += -Wunreachable-code
#CFLAGS += -Wcast-align #CFLAGS += -Wcast-align
#CFLAGS += -std=c11 #CFLAGS += -std=c11
#CFLAGS += -Wmissing-noreturn CFLAGS += -Wmissing-noreturn
#CFLAGS += -Wconversion #CFLAGS += -Wconversion
CFLAGS += -Wno-unused-but-set-variable -Wno-unused-variable CFLAGS += -Wno-unused-but-set-variable -Wno-unused-variable
CFLAGS += -Wno-suggest-attribute=noreturn
# -mlong-calls -Wall # -mlong-calls -Wall
#CFLAGS += -save-temps -fverbose-asm #CFLAGS += -save-temps -fverbose-asm
#CFLAGS += -Wa,-a,-ad #CFLAGS += -Wa,-a,-ad
CFLAGS += -D__ARM -fno-builtin CFLAGS += -D__ARM -fno-builtin
CFLAGS += -mcpu=cortex-m3 -mthumb # -mfix-cortex-m3-ldrd CFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb # -mfix-cortex-m3-ldrd
CFLAGS += -ffunction-sections -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -DTRACE_LEVEL=$(TRACE_LEVEL) -DALLOW_PEER_ERASE=$(ALLOW_PEER_ERASE) CFLAGS += -ffunction-sections -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -DTRACE_LEVEL=$(TRACE_LEVEL) -DALLOW_PEER_ERASE=$(ALLOW_PEER_ERASE)
CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
CFLAGS += -DBOARD=\"$(BOARD)\" -DBOARD_$(BOARD) CFLAGS += -DBOARD=\"$(BOARD)\" -DBOARD_$(BOARD)
@@ -212,10 +187,7 @@ CFLAGS += -fno-stack-protector
endif endif
ASFLAGS = -mcpu=cortex-m3 -mthumb -Wall -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D__ASSEMBLY__ ASFLAGS = -mcpu=cortex-m3 -mthumb -Wall -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D__ASSEMBLY__
LDFLAGS = -mcpu=cortex-m3 -mthumb -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=ResetException -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--no-undefined $(LIB) LDFLAGS = -mcpu=cortex-m3 -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=ResetException -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--print-memory-usage -Wl,--no-undefined $(LIB)
ifeq ("$(USE_CLANG)","0")
LDFLAGS += -Wl,--warn-section-align -Wl,--print-memory-usage
endif
#LD_OPTIONAL=-Wl,--print-gc-sections -Wl,--stats #LD_OPTIONAL=-Wl,--print-gc-sections -Wl,--stats
# Append BIN directories to output filename # Append BIN directories to output filename
@@ -225,7 +197,7 @@ OUTPUT := $(BIN)/$(OUTPUT)
# Rules # Rules
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
all: $(BIN) $(OBJ) $(MEMORIES) all: apps/$(APP)/usb_strings_generated.h $(BIN) $(OBJ) $(MEMORIES)
combined: $(OUTPUT)-combined.bin combined: $(OUTPUT)-combined.bin
@@ -236,7 +208,7 @@ $(BIN)/$(BOARD)-dfu-flash-padded.bin: $(BIN)/$(BOARD)-dfu-flash.bin
$(OUTPUT)-combined.bin: $(BIN)/$(BOARD)-dfu-flash-padded.bin $(OUTPUT)-dfu.bin $(OUTPUT)-combined.bin: $(BIN)/$(BOARD)-dfu-flash-padded.bin $(OUTPUT)-dfu.bin
cat $^ > $@ cat $^ > $@
$(BIN) $(OBJ): apps/$(APP)/usb_strings_generated.h $(BIN) $(OBJ):
mkdir -p $@ mkdir -p $@
usbstring/usbstring: usbstring/usbstring.c usbstring/usbstring: usbstring/usbstring.c
@@ -252,48 +224,26 @@ apps/$(APP)/usb_strings_generated.h: apps/$(APP)/usb_strings.txt.patched usbstri
define RULES define RULES
C_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(C_OBJECTS)) C_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(C_OBJECTS))
ASM_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(ASM_OBJECTS)) ASM_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(ASM_OBJECTS))
EXTRA_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(EXTRA_OBJECTS))
build_$(1): $$(ASM_OBJECTS_$(1)) $$(C_OBJECTS_$(1)) $$(EXTRA_OBJECTS_$(1)) $(1): $$(ASM_OBJECTS_$(1)) $$(C_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)$(CC) $(LDFLAGS) $(LD_OPTIONAL) -T"libboard/common/resources/$(CHIP)/$$@.ld" -Wl,-Map,$(OUTPUT)-$$@.map -o $(OUTPUT)-$$@.elf $$^ $(LIBS)
$(SILENT)$(NM) $(OUTPUT)-$(1).elf >$(OUTPUT)-$(1).elf.txt $(SILENT)$(NM) $(OUTPUT)-$$@.elf >$(OUTPUT)-$$@.elf.txt
$(SILENT)$(OBJCOPY) -O binary $(OUTPUT)-$(1).elf $(OUTPUT)-$(1).bin $(SILENT)$(OBJCOPY) -O binary $(OUTPUT)-$$@.elf $(OUTPUT)-$$@.bin
$(SILENT)$(SIZE) $$^ $(OUTPUT)-$(1).elf $(SILENT)$(SIZE) $$^ $(OUTPUT)-$$@.elf
$$(C_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.c Makefile $(OBJ) $(BIN) $$(C_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.c Makefile $(OBJ) $(BIN)
@echo [COMPILING $$<] @echo [COMPILING $$<]
$(SILENT)$(CC) $(CFLAGS) -DENVIRONMENT_$(1) -DENVIRONMENT=\"$(1)\" -c -o $$@ $$< $(SILENT)$(CC) $(CFLAGS) -DENVIRONMENT_$(1) -DENVIRONMENT=\"$(1)\" -Wa,-ahlms=$(BIN)/$$*.lst -c -o $$@ $$<
$$(ASM_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.S Makefile $(OBJ) $(BIN) $$(ASM_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.S Makefile $(OBJ) $(BIN)
@echo [ASSEMBLING $$@] @echo [ASSEMBLING $$@]
$(SILENT)$(CC) $(ASFLAGS) -DENVIRONMENT_$(1) -DENVIRONMENT=\"$(1)\" -c -o $$@ $$< $(SILENT)@$(CC) $(ASFLAGS) -DENVIRONMENT_$(1) -DENVIRONMENT=\"$(1)\" -c -o $$@ $$<
debug_$(1): $(1) debug_$(1): $(1)
$(GDB) -x "$(BOARD_LIB)/resources/gcc/$(BOARD)_$(1).gdb" -ex "reset" -readnow -se $(OUTPUT)-$(1).elf $(GDB) -x "$(BOARD_LIB)/resources/gcc/$(BOARD)_$(1).gdb" -ex "reset" -readnow -se $(OUTPUT)-$(1).elf
endef endef
ALL_MEMORIES = dfu flash ram $(foreach MEMORY, $(MEMORIES), $(eval $(call RULES,$(MEMORY))))
$(foreach MEMORY, $(ALL_MEMORIES), $(eval $(call RULES,$(MEMORY))))
# files with those names do exist..
.PHONY: ram
.PHONY: dfu
.PHONY: flash
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
flash: build_flash
#alternate way of embedding: obj file
#ifeq ($(APP), dfu)
# $(info bootloader bin file to obj..)
# $(SILENT)$(OBJCOPY) --rename-section .data=.fwupdate -I binary -O elf32-littlearm bin/$(BOARD)-dfu-flash.bin $(OBJ)/flash_fwupdate.o
#endif
program: program:
openocd -f openocd/openocd.cfg -c "init" -c "halt" -c "flash write_bank 0 ./bin/project-flash.bin 0" -c "reset" -c "shutdown" openocd -f openocd/openocd.cfg -c "init" -c "halt" -c "flash write_bank 0 ./bin/project-flash.bin 0" -c "reset" -c "shutdown"

View File

@@ -1,12 +0,0 @@
C_FILES += $(C_LIBUSB_DFU)
# Trace level used for compilation
# (can be overridden by adding TRACE_LEVEL=#number to the command-line)
# TRACE_LEVEL_DEBUG 5
# TRACE_LEVEL_INFO 4
# TRACE_LEVEL_WARNING 3
# TRACE_LEVEL_ERROR 2
# TRACE_LEVEL_FATAL 1
# TRACE_LEVEL_NO_TRACE 0
TRACE_LEVEL ?= 3

View File

@@ -1,134 +0,0 @@
/* SIMtrace 2 firmware USB DFU bootloader
*
* (C) 2015-2017 by Harald Welte <hwelte@hmw-consulting.de>
* (C) 2018-2019 by sysmocom -s.f.m.c. GmbH, Author: Kevin Redon <kredon@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.
*
* 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"
#include "flashd.h"
#include "utils.h"
#include "usb/device/dfu/dfu.h"
#include "usb/common/dfu/usb_dfu.h"
#include "manifest.h"
#include "USBD_HAL.h"
#include <osmocom/core/timer.h>
/* actual section content must be replaced with the padded bootloader by running objcopy! */
const uint32_t bl_update_data[BOARD_DFU_BOOT_SIZE / sizeof(uint32_t)] __attribute__((section(".fwupdate"))) = { 0xFF };
unsigned int g_unique_id[4];
/* remember if the watchdog has been configured in the main loop so we can kick it in the ISR */
static bool watchdog_configured = false;
extern uint32_t _end;
extern uint32_t _srelocate;
extern uint32_t _etext;
void DFURT_SwitchToDFU(void)
{
}
void USBDFU_Runtime_RequestHandler(const USBGenericRequest *request)
{
}
int USBDFU_handle_dnload(uint8_t altif, unsigned int offset, uint8_t *data, unsigned int len)
{
return 0;
}
int USBDFU_handle_upload(uint8_t altif, unsigned int offset, uint8_t *data, unsigned int req_len)
{
return 0;
}
int USBDFU_OverrideEnterDFU(void)
{
return 0;
}
__attribute__((section(".ramfunc"), noinline)) static uint32_t flash_wait_ready()
{
Efc *efc = EFC;
uint32_t dwStatus;
do {
dwStatus = efc->EEFC_FSR;
} while ((dwStatus & EEFC_FSR_FRDY) != EEFC_FSR_FRDY);
return (dwStatus & (EEFC_FSR_FLOCKE | EEFC_FSR_FCMDE));
}
__attribute__((section(".ramfunc"), noinline)) static void flash_cmd(uint32_t dwCommand, uint32_t dwArgument)
{
Efc *efc = EFC;
uint32_t dwStatus;
efc->EEFC_FCR = EEFC_FCR_FKEY(0x5A) | EEFC_FCR_FARG(dwArgument) | EEFC_FCR_FCMD(dwCommand);
}
__attribute__((section(".ramfunc"), noinline, noreturn)) static void erase_first_app_sector()
{
/* page 64 */
uint32_t first_app_page = (BOARD_DFU_BOOT_SIZE / IFLASH_PAGE_SIZE);
uint32_t *first_app_address = (uint32_t *)(IFLASH_ADDR + first_app_page * IFLASH_PAGE_SIZE + 0);
#if 1
/* overwrite first app sector so we don't keep booting this */
for (int i = 0; i < IFLASH_PAGE_SIZE / 4; i++)
first_app_address[i] = 0xffffffff;
flash_cmd(EFC_FCMD_EWP, first_app_page);
#else
/* why does erasing the whole flash with a protected bootloader not work at all? */
flash_cmd(EFC_FCMD_EA, 0);
#endif
flash_wait_ready();
for (;;)
NVIC_SystemReset();
}
#define MAX_USB_ITER BOARD_MCK / 72 // This should be around a second
extern int main(void)
{
uint8_t isUsbConnected = 0;
unsigned int i = 0;
uint32_t reset_cause = (RSTC->RSTC_SR & RSTC_SR_RSTTYP_Msk) >> RSTC_SR_RSTTYP_Pos;
/* 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));
watchdog_configured = true;
EEFC_ReadUniqueID(g_unique_id);
printf("\n\r\n\r");
printf("bootloader updater %s for board %s\n\r"
"(C) 2010-2017 by Harald Welte, 2018-2019 by Kevin Redon\n\r",
manifest_revision, manifest_board);
/* clear g_dfu on power-up reset */
memset(g_dfu, 0, sizeof(*g_dfu));
TRACE_INFO("USB init...\n\r");
/* Signal USB reset by disabling the pull-up on USB D+ for at least 10 ms */
USBD_Disconnect();
/* Initialize the flash to be able to write it, using the IAP ROM code */
FLASHD_Initialize(BOARD_MCK, 1);
__disable_irq();
FLASHD_Unlock(IFLASH_ADDR, IFLASH_ADDR + IFLASH_SIZE - 1, 0, 0);
FLASHD_Write(IFLASH_ADDR, bl_update_data, BOARD_DFU_BOOT_SIZE);
erase_first_app_sector();
}

View File

@@ -1,6 +0,0 @@
sysmocom - s.f.m.c. GmbH
PRODUCT_STRING
bootloader updater
RAM
Flash (Application Partition)
Flash (Bootloader Partition)

View File

@@ -71,13 +71,8 @@ static const conf_func config_func_ptrs[] = {
.init = mode_cardemu_init, .init = mode_cardemu_init,
.exit = mode_cardemu_exit, .exit = mode_cardemu_exit,
.run = mode_cardemu_run, .run = mode_cardemu_run,
#if defined (ngff_cardem)
.usart0_irq = mode_cardemu_usart1_irq,
.usart1_irq = mode_cardemu_usart0_irq,
#else
.usart0_irq = mode_cardemu_usart0_irq, .usart0_irq = mode_cardemu_usart0_irq,
.usart1_irq = mode_cardemu_usart1_irq, .usart1_irq = mode_cardemu_usart1_irq,
#endif
}, },
#endif #endif
#ifdef HAVE_MITM #ifdef HAVE_MITM

View File

@@ -271,7 +271,7 @@ extern int main(void)
#ifdef PINS_LEDS #ifdef PINS_LEDS
/* Configure LED */ /* Configure LED */
PIO_Configure(pinsLeds, PIO_LISTSIZE(pinsLeds)); PIO_Configure(pinsLeds, sizeof(pinsLeds));
PIO_Set(&pinsLeds[LED_NUM_RED]); PIO_Set(&pinsLeds[LED_NUM_RED]);
PIO_Clear(&pinsLeds[LED_NUM_GREEN]); PIO_Clear(&pinsLeds[LED_NUM_GREEN]);
#endif #endif
@@ -342,7 +342,16 @@ extern int main(void)
TRACE_INFO("USB init...\n\r"); TRACE_INFO("USB init...\n\r");
/* Signal USB reset by disabling the pull-up on USB D+ for at least 10 ms */ /* Signal USB reset by disabling the pull-up on USB D+ for at least 10 ms */
USBD_Disconnect(); USBD_Disconnect();
mdelay(500); #ifdef PIN_USB_PULLUP
const Pin usb_dp_pullup = PIN_USB_PULLUP;
PIO_Configure(&usb_dp_pullup, 1);
PIO_Set(&usb_dp_pullup);
#endif
mdelay(50);
#ifdef PIN_USB_PULLUP
PIO_Clear(&usb_dp_pullup);
#endif
USBDFU_Initialize(&dfu_descriptors); USBDFU_Initialize(&dfu_descriptors);
while (USBD_GetState() < USBD_STATE_CONFIGURED) { while (USBD_GetState() < USBD_STATE_CONFIGURED) {

View File

@@ -151,7 +151,8 @@ WEAK void HardFault_Handler( void )
" mrseq r0, msp \n" " mrseq r0, msp \n"
" mrsne r0, psp \n" " mrsne r0, psp \n"
//" ldr r1, [r0, #24] \n" //" ldr r1, [r0, #24] \n"
" b hard_fault_handler_c\n"); " b hard_fault_handler_c\n"
".syntax divided \n");
} }
/** /**

View File

@@ -31,8 +31,7 @@ enum led_pattern {
BLINK_200O_F = 7, BLINK_200O_F = 7,
BLINK_600O_F = 8, BLINK_600O_F = 8,
BLINK_CUSTOM = 9, BLINK_CUSTOM = 9,
BLINK_2F_O = 10, BLINK_2F_O,
BLINK_5O_5F = 11,
_NUM_LED_BLINK _NUM_LED_BLINK
}; };

View File

@@ -96,18 +96,13 @@ SECTIONS
_efixed = .; /* End of text section */ _efixed = .; /* End of text section */
} > rom } > rom
/DISCARD/ : /* .ARM.exidx is sorted, so has to go in its own output section. */
PROVIDE_HIDDEN (__exidx_start = .);
.ARM.exidx :
{ {
*(.ARM.exidx) *(.ARM.exidx* .gnu.linkonce.armexidx.*)
}
.blupdate :
{
. = ALIGN(4);
_blupdate_start = .;
KEEP(*(.fwupdate .fwupdate.*));
_blupdate_end = .;
} > rom } > rom
PROVIDE_HIDDEN (__exidx_end = .);
. = ALIGN(4); . = ALIGN(4);
_etext = .; _etext = .;

View File

@@ -94,10 +94,13 @@ SECTIONS
_efixed = .; /* End of text section */ _efixed = .; /* End of text section */
} > rom } > rom
/DISCARD/ : /* .ARM.exidx is sorted, so has to go in its own output section. */
PROVIDE_HIDDEN (__exidx_start = .);
.ARM.exidx :
{ {
*(.ARM.exidx) *(.ARM.exidx* .gnu.linkonce.armexidx.*)
} } > rom
PROVIDE_HIDDEN (__exidx_end = .);
. = ALIGN(4); . = ALIGN(4);
_etext = .; _etext = .;

View File

@@ -58,10 +58,6 @@ static const struct blink_state bs_on[] = {
{ 0, 1 } { 0, 1 }
}; };
static const struct blink_state bs_5on_5off[] = {
{ 500, 1 }, { 500, 0 }
};
static const struct blink_state bs_3on_5off[] = { static const struct blink_state bs_3on_5off[] = {
{ 300, 1 }, { 500, 0 } { 300, 1 }, { 500, 0 }
}; };
@@ -111,10 +107,6 @@ static const struct blink_pattern patterns[] = {
.states = bs_on, .states = bs_on,
.size = ARRAY_SIZE(bs_on), .size = ARRAY_SIZE(bs_on),
}, },
[BLINK_5O_5F] = {
.states = bs_5on_5off,
.size = ARRAY_SIZE(bs_5on_5off),
},
[BLINK_3O_5F] = { [BLINK_3O_5F] = {
.states = bs_3on_5off, .states = bs_3on_5off,
.size = ARRAY_SIZE(bs_3on_5off), .size = ARRAY_SIZE(bs_3on_5off),

View File

@@ -68,7 +68,7 @@
#define PINS_TC_USIM1 PIN_USIM1_IO_TC, PIN_USIM1_CLK_TC #define PINS_TC_USIM1 PIN_USIM1_IO_TC, PIN_USIM1_CLK_TC
#define PIN_USIM1_nRST {PIO_PA24, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT} #define PIN_USIM1_nRST {PIO_PA24, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT}
#define PIN_USIM1_VCC {PIO_PB3, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT} #define PIN_USIM1_VCC {PIO_PB2, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT}
#define PIN_USIM2_nRST {PIO_PA7, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT} #define PIN_USIM2_nRST {PIO_PA7, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT}
//#define PIN_USIM2_VCC {PIO_PB2, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT} //#define PIN_USIM2_VCC {PIO_PB2, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT}
@@ -77,17 +77,14 @@
#define PINS_USIM2 PINS_TC_USIM2, PINS_ISO7816_USIM2, PIN_USIM2_nRST #define PINS_USIM2 PINS_TC_USIM2, PINS_ISO7816_USIM2, PIN_USIM2_nRST
/* from v3 and onwards only (!) */ /* from v3 and onwards only (!) */
#define PIN_DET_USIM1_PRES {PIO_PA8, PIOA, ID_PIOA, PIO_INPUT, PIO_DEGLITCH | PIO_IT_EDGE} #define PIN_DET_USIM1_PRES {PIO_PA8, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP | PIO_DEGLITCH | PIO_IT_EDGE}
/* inputs reading the WWAN LED level */ /* inputs reading the WWAN LED level */
#define PIN_WWAN1 {PIO_PA15, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP | PIO_DEGLITCH | PIO_IT_EDGE} #define PIN_WWAN1 {PIO_PA15, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP | PIO_DEGLITCH | PIO_IT_EDGE}
#define PINS_WWAN_IN { PIN_WWAN1 } #define PINS_WWAN_IN { PIN_WWAN1 }
#define PIN_MODEM_EN {PIO_PA11, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
#define PIN_N_MODEM_PWR_ON {PIO_PA26, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
/* outputs controlling RESET input of modems */ /* outputs controlling RESET input of modems */
#define PIN_PERST1 {PIO_PA25, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT} #define PIN_PERST1 {PIO_PA25, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_PULLUP}
#define PINS_PERST { PIN_PERST1 } #define PINS_PERST { PIN_PERST1 }
#define PIN_VERSION_DET {PIO_PA19, PIOA, ID_PIOA, PIO_PERIPH_D, PIO_DEFAULT} #define PIN_VERSION_DET {PIO_PA19, PIOA, ID_PIOA, PIO_PERIPH_D, PIO_DEFAULT}
@@ -105,62 +102,6 @@
#define DETECT_VCC_BY_ADC #define DETECT_VCC_BY_ADC
#define VCC_UV_THRESH_1V8 1500000 #define VCC_UV_THRESH_1V8 1500000
#define VCC_UV_THRESH_3V VCC_UV_THRESH_1V8 #define VCC_UV_THRESH_3V 2500000
#ifdef APPLICATION_cardem
#define HAVE_CARDEM #define HAVE_CARDEM
#define HAVE_BOARD_CARDINSERT
struct cardem_inst;
void board_set_card_insert(struct cardem_inst *ci, bool card_insert);
#endif
#ifdef APPLICATION_trace
#define HAVE_SNIFFER
#endif
/* Card I/O data signal input/output (I/O_SIM in schematic) */
#define PIN_SIM_IO {PIO_PA6A_TXD0, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/* Card CLK clock input (CLK_SIM in schematic) */
#define PIN_SIM_CLK {PIO_PA2B_SCK0, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT}
/* Card RST reset signal input (use as input since the phone will drive it) */
#define PIN_SIM_RST_SNIFF {PIO_PA7, PIOA, ID_PIOA, PIO_INPUT, PIO_DEGLITCH | PIO_IT_EDGE}
/* Pins used to sniff phone-card communication */
#define PINS_SIM_SNIFF PIN_SIM_IO, PIN_SIM_CLK, PIN_SIM_RST_SNIFF
/* Pin to measure card I/O timing (to start measuring the ETU on I/O activity; connected I/O_SIM in schematic) */
#define PIN_SIM_IO_INPUT {PIO_PA1B_TIOB0, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT}
/* Pin used as clock input (to measure the ETU duration; connected to CLK_SIM in schematic) */
#define PIN_SIM_CLK_INPUT {PIO_PA4B_TCLK0, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT}
/* Pins used to measure ETU timing (using timer counter) */
#define PINS_TC PIN_SIM_IO_INPUT, PIN_SIM_CLK_INPUT
//default state: NO uart connected, modem connected to physical sim, NO sim presence override, modem powers sim slot
#define pin_conn_usim1_default {PIO_PA20, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
#define pin_conn_usim2_default {PIO_PA28, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
#define pin_conn_mdm_sim_default {PIO_PA0, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
#define pin_conn_set_sim_det_default {PIO_PA13, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
#define pin_en_st_sim_vdd_default {PIO_PB2, PIOB, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT}
#define pin_en_mdm_sim_vdd_default {PIO_PA16, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
//cardem state: uart2 (!) connected, NO modem connected to physical sim, sim presence override, NOTHING powers sim slot
#define pin_conn_usim1_cem {PIO_PA20, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
#define pin_conn_usim2_cem {PIO_PA28, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
#define pin_conn_mdm_sim_cem {PIO_PA0, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
#define pin_en_st_sim_vdd_cem {PIO_PB2, PIOB, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT}
#define pin_en_mdm_sim_vdd_cem {PIO_PA16, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
//trace state: uart2 (!) connected, modem connected to physical sim, st powers sim slot
#define pin_conn_usim1_trace {PIO_PA20, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
#define pin_conn_usim2_trace {PIO_PA28, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
#define pin_conn_mdm_sim_trace {PIO_PA0, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
#define pin_conn_set_sim_det_trace {PIO_PA13, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
#define pin_en_st_sim_vdd_trace {PIO_PB2, PIOB, ID_PIOB, PIO_OUTPUT_1, PIO_DEFAULT}
#define pin_en_mdm_sim_vdd_trace {PIO_PA16, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
#define PIN_MODEM_EN_off {PIO_PA11, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
#define PINS_SIM_DEFAULT pin_conn_usim1_default, pin_conn_usim2_default, pin_conn_mdm_sim_default, pin_conn_set_sim_det_default, PIN_N_MODEM_PWR_ON, PIN_MODEM_EN, pin_en_st_sim_vdd_default, pin_en_mdm_sim_vdd_default
#define PINS_SIM_CARDEM pin_conn_usim1_cem, pin_conn_usim2_cem, pin_conn_mdm_sim_cem, pin_en_mdm_sim_vdd_cem, pin_en_st_sim_vdd_cem// , pin_conn_set_sim_det_cem
#define PINS_BUS_SNIFF pin_conn_usim1_trace, pin_conn_usim2_trace, pin_conn_mdm_sim_trace, pin_conn_set_sim_det_trace,PIN_MODEM_EN_off
#define PINS_PWR_SNIFF PIN_N_MODEM_PWR_ON, PIN_MODEM_EN, pin_en_st_sim_vdd_trace, pin_en_mdm_sim_vdd_trace

View File

@@ -1,4 +1,4 @@
/* sysmocom ngff-cardem application code /* sysmocom quad-modem sysmoQMOD application code
* *
* (C) 2021 Harald Welte <laforge@osmocom.org> * (C) 2021 Harald Welte <laforge@osmocom.org>
* *
@@ -42,8 +42,10 @@ void board_exec_dbg_cmd(int ch)
printf("\tL\tswitch on LED 1\n\r"); printf("\tL\tswitch on LED 1\n\r");
printf("\tg\tswitch off LED 2\n\r"); printf("\tg\tswitch off LED 2\n\r");
printf("\tG\tswitch on LED 2\n\r"); printf("\tG\tswitch on LED 2\n\r");
printf("\tU\tProceed to USB Initialization\n\r");
printf("\t1\tGenerate 1ms reset pulse on WWAN1\n\r"); printf("\t1\tGenerate 1ms reset pulse on WWAN1\n\r");
printf("\t!\tSwitch Channel A from physical -> remote\n\r"); printf("\t!\tSwitch Channel A from physical -> remote\n\r");
printf("\t@\tSwitch Channel B from physical -> remote\n\r");
printf("\tt\t(pseudo)talloc report\n\r"); printf("\tt\t(pseudo)talloc report\n\r");
break; break;
case 'R': case 'R':
@@ -93,13 +95,12 @@ void board_main_top(void)
sim_switch_init(); sim_switch_init();
#endif #endif
/* Obtain the circuit board version (currently just prints voltage) */ /* Obtain the circuit board version (currently just prints voltage */
get_board_version_adc(); get_board_version_adc();
#ifndef APPLICATION_dfu #ifndef APPLICATION_dfu
/* Initialize checking for card insert/remove events */ /* Initialize checking for card insert/remove events */
card_present_init(); card_present_init();
#endif #endif
wwan_perst_set(0, 0);
} }
static int uart_has_loopback_jumper(void) static int uart_has_loopback_jumper(void)
@@ -149,11 +150,3 @@ int board_override_enter_dfu(void)
return 0; return 0;
} }
static const Pin deton = {PIO_PA13, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT};
static const Pin detoff = {PIO_PA13, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT};
void board_set_card_insert(struct cardem_inst *ci, bool card_insert)
{
PIO_Configure(card_insert ? &deton : &detoff, 1);
}

View File

@@ -39,9 +39,9 @@ int is_card_present(int port)
return -1; return -1;
pin = &pin_cardpres[port]; pin = &pin_cardpres[port];
/* Card present signals are low-active, as we have a switch
/* high active here */ * against GND and an internal-pull-up in the SAM3 */
present = PIO_Get(pin); present = PIO_Get(pin) ? 0 : 1;
return present; return present;
} }

View File

@@ -21,19 +21,18 @@
#include "led.h" #include "led.h"
#include "sim_switch.h" #include "sim_switch.h"
//uart12bus 2-20e pa20 #ifdef PIN_SIM_SWITCH1
//uart22bus 1-20e pa28 static const Pin pin_conn_usim1 = {PIO_PA20, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT};
//usim2bus 1-10e pa0 pivot #endif
//sim det 2-10e pa13 #ifdef PIN_SIM_SWITCH2
static const Pin pin_conn_usim2 = {PIO_PA28, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT};
static const Pin pins_default[] = {PINS_SIM_DEFAULT}; #endif
static const Pin pins_cem[] = {PINS_SIM_CARDEM};
static int initialized = 0; static int initialized = 0;
int sim_switch_use_physical(unsigned int nr, int physical) int sim_switch_use_physical(unsigned int nr, int physical)
{ {
const Pin pin = PIN_MODEM_EN;// PIN_N_MODEM_PWR_ON; const Pin *pin;
enum led led; enum led led;
if (!initialized) { if (!initialized) {
@@ -45,10 +44,18 @@ int sim_switch_use_physical(unsigned int nr, int physical)
physical ? "physical" : "virtual"); physical ? "physical" : "virtual");
switch (nr) { switch (nr) {
#ifdef PIN_SIM_SWITCH1
case 0: case 0:
pin = &pin_conn_usim1;
led = LED_USIM1; led = LED_USIM1;
break; break;
#endif
#ifdef PIN_SIM_SWITCH2
case 1:
pin = &pin_conn_usim2;
led = LED_USIM2;
break;
#endif
default: default:
TRACE_ERROR("Invalid SIM%u\n\r", nr); TRACE_ERROR("Invalid SIM%u\n\r", nr);
return -1; return -1;
@@ -56,26 +63,28 @@ int sim_switch_use_physical(unsigned int nr, int physical)
if (physical) { if (physical) {
TRACE_INFO("%u: Use local/physical SIM\r\n", nr); TRACE_INFO("%u: Use local/physical SIM\r\n", nr);
PIO_Configure(pins_default, PIO_LISTSIZE(pins_default)); PIO_Clear(pin);
led_blink(led, BLINK_ALWAYS_ON); led_blink(led, BLINK_ALWAYS_ON);
} else { } else {
TRACE_INFO("%u: Use remote/emulated SIM\r\n", nr); TRACE_INFO("%u: Use remote/emulated SIM\r\n", nr);
PIO_Configure(pins_cem, PIO_LISTSIZE(pins_cem)); PIO_Set(pin);
led_blink(led, BLINK_5O_5F); led_blink(led, BLINK_ALWAYS_OFF);
} }
/* just power cycle the modem because this circumvents weird issues with unreliable signals */
PIO_Clear(&pin);
mdelay(200);
PIO_Set(&pin);
return 0; return 0;
} }
int sim_switch_init(void) int sim_switch_init(void)
{ {
PIO_Configure(pins_default, PIO_LISTSIZE(pins_default)); int num_switch = 0;
#ifdef PIN_SIM_SWITCH1
PIO_Configure(&pin_conn_usim1, 1);
num_switch++;
#endif
#ifdef PIN_SIM_SWITCH2
PIO_Configure(&pin_conn_usim2, 1);
num_switch++;
#endif
initialized = 1; initialized = 1;
return 1; return num_switch;
} }

View File

@@ -47,7 +47,7 @@ static void wwan2_irqhandler(const Pin *pPin)
} }
#endif #endif
/* determine if a given WWAN led is currently active or not */ /* determine if a tiven WWAN led is currently active or not */
int wwan_led_active(int wwan) int wwan_led_active(int wwan)
{ {
const Pin *pin; const Pin *pin;

View File

@@ -87,6 +87,11 @@
/* SPI flash write protect pin (active low, pulled low) */ /* SPI flash write protect pin (active low, pulled low) */
#define PIN_SPI_WP {PA15, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT} #define PIN_SPI_WP {PA15, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
/** Pin configuration to control USB pull-up on D+
* @details the USB pull-up on D+ is enable by default on the board but can be disabled by setting PA16 high
*/
#define PIN_USB_PULLUP {PIO_PA16, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
/** USB definitions */ /** USB definitions */
/* OpenMoko SIMtrace 2 USB vendor ID */ /* OpenMoko SIMtrace 2 USB vendor ID */
#define BOARD_USB_VENDOR_ID USB_VENDOR_OPENMOKO #define BOARD_USB_VENDOR_ID USB_VENDOR_OPENMOKO

View File

@@ -135,6 +135,11 @@
#define PIN_SPI_WP {PA15, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT} #define PIN_SPI_WP {PA15, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
#endif #endif
/** Pin configuration to control USB pull-up on D+
* @details the USB pull-up on D+ is enable by default on the board but can be disabled by setting PA16 high
*/
#define PIN_USB_PULLUP {PIO_PA16, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
/** USB definitions */ /** USB definitions */
/* OpenMoko SIMtrace 2 USB vendor ID */ /* OpenMoko SIMtrace 2 USB vendor ID */
#define BOARD_USB_VENDOR_ID USB_VENDOR_OPENMOKO #define BOARD_USB_VENDOR_ID USB_VENDOR_OPENMOKO

View File

@@ -40,7 +40,7 @@
/** green LED pin definition */ /** green LED pin definition */
#define PIN_LED_GREEN {PIO_LED_GREEN, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT} #define PIN_LED_GREEN {PIO_LED_GREEN, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
/** LEDs pin definition */ /** 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 */ /** index for red LED in LEDs pin definition array */
#define LED_NUM_RED 0 #define LED_NUM_RED 0
/** index for green LED in LEDs pin definition array */ /** index for green LED in LEDs pin definition array */
@@ -134,6 +134,11 @@
/* SPI flash write protect pin (active low, pulled low) */ /* SPI flash write protect pin (active low, pulled low) */
#define PIN_SPI_WP {PA15, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT} #define PIN_SPI_WP {PA15, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
/** Pin configuration to control USB pull-up on D+
* @details the USB pull-up on D+ is enable by default on the board but can be disabled by setting PA16 high
*/
#define PIN_USB_PULLUP {PIO_PA16, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
/** USB definitions */ /** USB definitions */
/* OpenMoko SIMtrace 2 USB vendor ID */ /* OpenMoko SIMtrace 2 USB vendor ID */
#define BOARD_USB_VENDOR_ID USB_VENDOR_OPENMOKO #define BOARD_USB_VENDOR_ID USB_VENDOR_OPENMOKO

View File

@@ -922,7 +922,6 @@ static int tx_byte_tpdu(struct card_handle *ch)
byte = msgb_pull_u8(msg); byte = msgb_pull_u8(msg);
card_emu_uart_tx(ch->uart_chan, byte); card_emu_uart_tx(ch->uart_chan, byte);
card_emu_uart_reset_wt(ch->uart_chan);
/* this must happen _after_ the byte has been transmitted */ /* this must happen _after_ the byte has been transmitted */
switch (ch->tpdu.state) { switch (ch->tpdu.state) {

View File

@@ -39,21 +39,9 @@ static const Pin pins_cardsim[] = PINS_CARDSIM;
#endif #endif
/* UART pins */ /* UART pins */
#if defined(ngff_cardem)
static const Pin pins_usim1[] = {PINS_USIM2};
static const Pin pin_usim1_rst = PIN_USIM2_nRST;
#define FIRST_USART_BASE USART0
#define FIRST_USART_ID ID_USART0
#define FIRST_USART_IRQ USART0_IRQn
#else
static const Pin pins_usim1[] = {PINS_USIM1}; static const Pin pins_usim1[] = {PINS_USIM1};
static const Pin pin_usim1_rst = PIN_USIM1_nRST; static const Pin pin_usim1_rst = PIN_USIM1_nRST;
#define FIRST_USART_BASE USART1
#define FIRST_USART_ID ID_USART1
#define FIRST_USART_IRQ USART1_IRQn
#endif
static const Pin pin_usim1_vcc = PIN_USIM1_VCC; static const Pin pin_usim1_vcc = PIN_USIM1_VCC;
#ifdef PIN_USIM1_IO_DIR #ifdef PIN_USIM1_IO_DIR
static const Pin pin_io_dir = PIN_USIM1_IO_DIR; static const Pin pin_io_dir = PIN_USIM1_IO_DIR;
#endif #endif
@@ -97,8 +85,8 @@ struct cardem_inst cardem_inst[] = {
{ {
.num = 0, .num = 0,
.usart_info = { .usart_info = {
.base = FIRST_USART_BASE, .base = USART1,
.id = FIRST_USART_ID, .id = ID_USART1,
.state = USART_RCV .state = USART_RCV
}, },
.ep_out = SIMTRACE_CARDEM_USB_EP_USIM1_DATAOUT, .ep_out = SIMTRACE_CARDEM_USB_EP_USIM1_DATAOUT,
@@ -581,7 +569,7 @@ void mode_cardemu_init(void)
/* configure USART as ISO-7816 slave (e.g. card) */ /* configure USART as ISO-7816 slave (e.g. card) */
ISO7816_Init(&cardem_inst[0].usart_info, CLK_SLAVE); ISO7816_Init(&cardem_inst[0].usart_info, CLK_SLAVE);
NVIC_EnableIRQ(FIRST_USART_IRQ); NVIC_EnableIRQ(USART1_IRQn);
PIO_ConfigureIt(&pin_usim1_rst, usim1_rst_irqhandler); PIO_ConfigureIt(&pin_usim1_rst, usim1_rst_irqhandler);
PIO_EnableIt(&pin_usim1_rst); PIO_EnableIt(&pin_usim1_rst);
@@ -639,9 +627,9 @@ void mode_cardemu_exit(void)
PIO_DisableIt(&pin_usim1_rst); PIO_DisableIt(&pin_usim1_rst);
PIO_DisableIt(&pin_usim1_vcc); PIO_DisableIt(&pin_usim1_vcc);
NVIC_DisableIRQ(FIRST_USART_IRQ); NVIC_DisableIRQ(USART1_IRQn);
USART_SetTransmitterEnabled(FIRST_USART_BASE, 0); USART_SetTransmitterEnabled(USART1, 0);
USART_SetReceiverEnabled(FIRST_USART_BASE, 0); USART_SetReceiverEnabled(USART1, 0);
#ifdef CARDEMU_SECOND_UART #ifdef CARDEMU_SECOND_UART
PIO_DisableIt(&pin_usim2_rst); PIO_DisableIt(&pin_usim2_rst);

View File

@@ -689,8 +689,16 @@ void SIMtrace_USB_Initialize(void)
{ {
unsigned int i; unsigned int i;
/* Signal USB reset by disabling the pull-up on USB D+ for at least 10 ms */ /* Signal USB reset by disabling the pull-up on USB D+ for at least 10 ms */
#ifdef PIN_USB_PULLUP
const Pin usb_dp_pullup = PIN_USB_PULLUP;
PIO_Configure(&usb_dp_pullup, 1);
PIO_Set(&usb_dp_pullup);
#endif
USBD_HAL_Suspend(); USBD_HAL_Suspend();
mdelay(500); mdelay(20);
#ifdef PIN_USB_PULLUP
PIO_Clear(&usb_dp_pullup);
#endif
USBD_HAL_Activate(); USBD_HAL_Activate();
// Get std USB driver // Get std USB driver

View File

@@ -56,9 +56,9 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
CFLAGS="$saved_CFLAGS" CFLAGS="$saved_CFLAGS"
AC_SUBST(SYMBOL_VISIBILITY) AC_SUBST(SYMBOL_VISIBILITY)
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.4.0) PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.0.0)
PKG_CHECK_MODULES(LIBOSMOSIM, libosmosim >= 1.4.0) PKG_CHECK_MODULES(LIBOSMOSIM, libosmosim >= 1.0.0)
PKG_CHECK_MODULES(LIBOSMOUSB, libosmousb >= 1.4.0) PKG_CHECK_MODULES(LIBOSMOUSB, libosmousb >= 0.0.0)
PKG_CHECK_MODULES(LIBUSB, libusb-1.0) PKG_CHECK_MODULES(LIBUSB, libusb-1.0)
AC_ARG_ENABLE(sanitize, AC_ARG_ENABLE(sanitize,

View File

@@ -38,11 +38,11 @@ and remote SIM operation.
This package contains SIMtrace 2 host utility. This package contains SIMtrace 2 host utility.
%package -n libosmo-simtrace2-1 %package -n libosmo-simtrace2-0
Summary: Shared Library part of libosmo-simtrace2 Summary: Shared Library part of libosmo-simtrace2
Group: System/Libraries Group: System/Libraries
%description -n libosmo-simtrace2-1 %description -n libosmo-simtrace2-0
This library contains core "driver" functionality to interface with the This library contains core "driver" functionality to interface with the
Osmocom SIMtrace2 (and compatible) USB device firmware. It enables Osmocom SIMtrace2 (and compatible) USB device firmware. It enables
applications to implement SIM card / smart card tracing as well as applications to implement SIM card / smart card tracing as well as
@@ -51,7 +51,7 @@ SIM / smart card emulation functions.
%package -n libosmo-simtrace2-devel %package -n libosmo-simtrace2-devel
Summary: Development files for the Osmocom SIMtrace2 library Summary: Development files for the Osmocom SIMtrace2 library
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
Requires: libosmo-simtrace2-1 = %{version} Requires: libosmo-simtrace2-0 = %{version}
%description -n libosmo-simtrace2-devel %description -n libosmo-simtrace2-devel
Osmocom SIMtrace2 (and compatible) USB device firmware. It enables Osmocom SIMtrace2 (and compatible) USB device firmware. It enables
@@ -76,19 +76,18 @@ make %{?_smp_mflags}
install -Dm0644 host/contrib/99-simtrace2.rules %{buildroot}/%{_udevrulesdir}/99-simtrace2.rules install -Dm0644 host/contrib/99-simtrace2.rules %{buildroot}/%{_udevrulesdir}/99-simtrace2.rules
find %{buildroot} -type f -name "*.la" -delete -print find %{buildroot} -type f -name "*.la" -delete -print
%post -n libosmo-simtrace2-1 -p /sbin/ldconfig %post -n libosmo-simtrace2-0 -p /sbin/ldconfig
%postun -n libosmo-simtrace2-1 -p /sbin/ldconfig %postun -n libosmo-simtrace2-0 -p /sbin/ldconfig
%files %files
%doc README.md %doc README.md
%{_bindir}/simtrace2-cardem-pcsc %{_bindir}/simtrace2-cardem-pcsc
%{_bindir}/simtrace2-list %{_bindir}/simtrace2-list
%{_bindir}/simtrace2-sniff %{_bindir}/simtrace2-sniff
%{_bindir}/simtrace2-tool
%{_udevrulesdir}/99-simtrace2.rules %{_udevrulesdir}/99-simtrace2.rules
%files -n libosmo-simtrace2-1 %files -n libosmo-simtrace2-0
%{_libdir}/libosmo-simtrace2.so.1* %{_libdir}/libosmo-simtrace2.so.0*
%files -n libosmo-simtrace2-devel %files -n libosmo-simtrace2-devel
%dir %{_includedir}/osmocom/ %dir %{_includedir}/osmocom/

View File

@@ -1,7 +1,7 @@
# This is _NOT_ the library release version, it's an API version. # This is _NOT_ the library release version, it's an API version.
# Please read chapter "Library interface versions" of the libtool documentation # Please read chapter "Library interface versions" of the libtool documentation
# before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html # before making any modifications: https://www.gnu.org/software/libtool/manual/html_node/Versioning.html
ST2_LIBVERSION=1:0:0 ST2_LIBVERSION=0:0:0
AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir) AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)
AM_CFLAGS= -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOSIM_CFLAGS) $(LIBUSB_CFLAGS) $(COVERAGE_CFLAGS) AM_CFLAGS= -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOSIM_CFLAGS) $(LIBUSB_CFLAGS) $(COVERAGE_CFLAGS)

View File

@@ -199,7 +199,6 @@ static int process_usb_msg(struct osmo_st2_cardem_inst *ci, uint8_t *buf, int le
break; break;
case SIMTRACE_MSGT_BD_CEMU_CONFIG: case SIMTRACE_MSGT_BD_CEMU_CONFIG:
/* firmware confirms configuration change; ignore */ /* firmware confirms configuration change; ignore */
rc = 0;
break; break;
default: default:
printf("unknown simtrace msg type 0x%02x\n", sh->msg_type); printf("unknown simtrace msg type 0x%02x\n", sh->msg_type);
@@ -421,7 +420,6 @@ static void signal_handler(int signal)
switch (signal) { switch (signal) {
case SIGINT: case SIGINT:
osmo_st2_cardem_request_card_insert(ci, false); osmo_st2_cardem_request_card_insert(ci, false);
osmo_st2_modem_sim_select_local(ci->slot);
exit(0); exit(0);
break; break;
default: default:
@@ -525,6 +523,12 @@ int main(int argc, char **argv)
ci->card_prof = &osim_uicc_sim_cic_profile; ci->card_prof = &osim_uicc_sim_cic_profile;
rc = libusb_init(NULL);
if (rc < 0) {
fprintf(stderr, "libusb initialization failed\n");
goto do_exit;
}
rc = osmo_st2_gsmtap_init(gsmtap_host); rc = osmo_st2_gsmtap_init(gsmtap_host);
if (rc < 0) { if (rc < 0) {
perror("unable to open GSMTAP"); perror("unable to open GSMTAP");
@@ -628,7 +632,7 @@ close_exit:
if (transp->usb_devh) if (transp->usb_devh)
libusb_close(transp->usb_devh); libusb_close(transp->usb_devh);
osmo_libusb_exit(NULL); libusb_exit(NULL);
do_exit: do_exit:
return ret; return ret;
} }

View File

@@ -315,7 +315,6 @@ static const struct option opts[] = {
/* Known USB device with SIMtrace firmware supporting sniffer */ /* Known USB device with SIMtrace firmware supporting sniffer */
static const struct dev_id compatible_dev_ids[] = { static const struct dev_id compatible_dev_ids[] = {
{ USB_VENDOR_OPENMOKO, USB_PRODUCT_SIMTRACE2 }, { USB_VENDOR_OPENMOKO, USB_PRODUCT_SIMTRACE2 },
{ USB_VENDOR_OPENMOKO, USB_PRODUCT_NGFF_CARDEM },
{ 0, 0 } { 0, 0 }
}; };
@@ -379,7 +378,7 @@ int main(int argc, char **argv)
} }
/* Scan for available SIMtrace USB devices supporting sniffing */ /* Scan for available SIMtrace USB devices supporting sniffing */
rc = osmo_libusb_init(NULL); rc = libusb_init(NULL);
if (rc < 0) { if (rc < 0) {
fprintf(stderr, "libusb initialization failed\n"); fprintf(stderr, "libusb initialization failed\n");
goto do_exit; goto do_exit;
@@ -505,7 +504,7 @@ close_exit:
sleep(1); sleep(1);
} while (keep_running); } while (keep_running);
osmo_libusb_exit(NULL); libusb_exit(NULL);
do_exit: do_exit:
return ret; return ret;
} }

View File

@@ -39,8 +39,6 @@
#include <osmocom/core/utils.h> #include <osmocom/core/utils.h>
#include <osmocom/core/msgb.h> #include <osmocom/core/msgb.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/application.h>
/*********************************************************************** /***********************************************************************
* Incoming Messages * Incoming Messages
@@ -215,7 +213,6 @@ static int do_command(int argc, char **argv)
return rc; return rc;
} }
static struct log_info log_info = {};
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
@@ -261,16 +258,14 @@ int main(int argc, char **argv)
} }
} }
if (vendor_id < 0 || product_id < 0) { if ((vendor_id < 0 || product_id < 0)) {
fprintf(stderr, "You have to specify the vendor and product ID\n"); fprintf(stderr, "You have to specify the vendor and product ID\n");
goto do_exit; goto do_exit;
} }
transp->udp_fd = -1; transp->udp_fd = -1;
osmo_init_logging2(NULL, &log_info); rc = libusb_init(NULL);
rc = osmo_libusb_init(NULL);
if (rc < 0) { if (rc < 0) {
fprintf(stderr, "libusb initialization failed\n"); fprintf(stderr, "libusb initialization failed\n");
goto do_exit; goto do_exit;
@@ -295,6 +290,12 @@ int main(int argc, char **argv)
goto close_exit; goto close_exit;
} }
rc = libusb_claim_interface(transp->usb_devh, if_num);
if (rc < 0) {
fprintf(stderr, "can't claim interface %d; rc=%d\n", if_num, rc);
goto close_exit;
}
rc = osmo_libusb_get_ep_addrs(transp->usb_devh, if_num, &transp->usb_ep.out, rc = osmo_libusb_get_ep_addrs(transp->usb_devh, if_num, &transp->usb_ep.out,
&transp->usb_ep.in, &transp->usb_ep.irq_in); &transp->usb_ep.in, &transp->usb_ep.irq_in);
if (rc < 0) { if (rc < 0) {
@@ -331,7 +332,7 @@ close_exit:
libusb_close(transp->usb_devh); libusb_close(transp->usb_devh);
} while (0); } while (0);
osmo_libusb_exit(NULL); libusb_exit(NULL);
do_exit: do_exit:
return ret; return ret;
} }

View File

@@ -77,7 +77,7 @@ static int find_devices(void)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
osmo_libusb_init(NULL); libusb_init(NULL);
find_devices(); find_devices();
return 0; return 0;
} }