Pack 生产连接生命周期

以下内容自动抽取自 sdk-headers/HFLinkDriver_pack_lifecycle.h ,含 11 个公开函数及全部公开类型。函数指针回调类型不单独列出,见所属结构体成员说明。

枚举

Values:

Values:

Constraint policy for atomic blocks.

备注

Zero initialization (not explicitly set) means IGNORE: atomic_begin/end become no-ops when the probe has no buffering support, without reporting an error.

Values:

Ignore atomic constraints (default): atomic_begin/end are no-ops

Atomic blocks return unsupported when the probe has no buffering

结构体

User-provided SWD Multidrop physical selector; the Pack PDSC is not a TARGETSEL source.

Sequence runtime returned by the script loader.

备注

Open takes over userdata after the loader returns; Close calls destroy after the last Sequence invocation. If resource ownership has been transferred to the DebugDeviceSession, destroy may be set to NULL.

Pack production connection parameters; except for the Sequence runtime, callback userdata is borrowed by the implementation and must outlive Close.

备注

The caller must provide DEFAULT_HOST Sequences through the host bodies or the resolver returned by load_sequences; the C lifecycle layer does not guess target timing.

Public Members

Must be explicitly selected by the caller or by ConfigTargetSettings.

Must be set to a non-zero value by the caller or ConfigTargetSettings; no fallback to the Pack clock.

UTF-8 user Hook file path; deep-copied by the session.

Optional output and Message/Query host callbacks of the standalone Hook/Sequence Lua runtime.

C host hooks; the Lua runtime's same-named hooks run after these callbacks.

API

Open the full Pack debug lifecycle.

The order is fixed: Query -> load built-in/Pack/Hook -> ConfigTargetSettings -> freeze configuration -> PreparePackTopology (description only) -> set interface/clock -> select the physical transport -> per-port InitTarget -> JTAG physical chain -> BuildPackTopology (create CoreSessions) -> ConnectSequences per (Pname, Punit) -> ValidatePackTopology/examine -> SetupTarget. On any failure, already-connected cores are disconnected in reverse order and everything is released. options is required. DEFAULT_HOST Sequences must be provided by the host bodies or the resolver returned by load_sequences.

参数:
  • device_selector -- The device selector passed to HFLink_PackDevice_Query().

  • options -- Required connection parameters; the struct itself is copied, while callback userdata is borrowed until Close.

  • out_session -- On success receives the lifecycle object; set to NULL on failure.

Disconnect all cores in reverse order and release PackDeviceInfo, DebugDeviceSession and the CoreSession list.

返回:

The first disconnect error; all resources are released regardless. Safe to call repeatedly and returns HFLINK_OK.

Release the lifecycle object after Close; may be passed NULL.

Return the borrowed Pack query result held by the lifecycle; NULL after Close.

Return the borrowed device session held by the lifecycle; NULL after Close.

Return the number of CoreSessions kept in Pack processor/Punit order.

Return the borrowed CoreSession pointer in stable order; NULL when out of range or after Close.

Return the borrowed CoreSession pointer by (Pname, Punit); NULL after Close.

Execute the Pack default reset of the given core using the resolver and reset host callbacks loaded at Open.

Execute the defaultResetSequence of the given core with an explicit scope.

Bind a FlashSession to this Pack Session's core and the C/Lua flash pre/post hooks.

备注

The FlashSession must complete Close before the Pack Session is Closed/Destroyed.