Files
autosar_standard_spec_v4.4/SystemServices/AUTOSAR_SRS_TimeService.md
T

16 KiB
Raw Blame History

AUTOSAR 时间服务需求规范 (SRS TimeService)

文档元信息

项目 内容
文档标题 Requirements on Time Service(时间服务需求)
文档所有者 AUTOSAR
文档责任方 AUTOSAR
文档标识号 623
文档状态 Final(最终版)
AUTOSAR 标准分类 Classic Platform(经典平台)
标准发布版本 4.4.0
原文文档号 AUTOSAR_SRS_TimeService

文档变更历史

日期 发布版本 变更人 变更说明
2018-10-31 4.4.0 AUTOSAR Release Management 编辑性修改
2017-12-08 4.3.1 AUTOSAR Release Management 编辑性修改
2016-11-30 4.3.0 AUTOSAR Release Management 新增第 5 章 需求追溯
2015-07-31 4.2.2 AUTOSAR Release Management 编辑性修改
2014-10-31 4.2.1 AUTOSAR Release Management 链接到所有需求的新 RS_BRF_ 特性
2013-10-31 4.1.2 AUTOSAR Release Management 编辑性修改
2013-03-15 4.1.1 AUTOSAR Administration 初始发布

目录

  1. 本文档范围
  2. 使用的约定
  3. 功能概述
  4. 缩略语、缩写和术语
  5. 需求追溯
  6. 需求规范
    • 6.1 功能需求
  7. 参考文献

免责声明

本节保留原文,不进行翻译。


1. 本文档范围

本规范定义了 BSW 模块 Time Service 的需求。

约束

基础软件模块需求规范的首要范围是非安全相关的系统。对于安全相关系统中的基础软件模块的实现,应检查是否需要额外需求。


2. 使用的约定

  • AUTOSAR 文档中需求的表示遵循 [1] 指定的表格。

  • 在需求中,应使用以下特定语义(基于 IETF 的语义):

    关键字 "MUST"、"MUST NOT"、"REQUIRED"、"SHALL"、"SHALL NOT"、"SHOULD"、"SHOULD NOT"、"RECOMMENDED"、"MAY" 和 "OPTIONAL" 的解释如下:

    • SHALL(应当):该词表示相关定义是规范的绝对要求。
    • SHALL NOT(不得):该短语表示相关定义是规范的绝对禁止。
    • MUST(必须):该词表示相关定义是出于法律问题的绝对要求。
    • MUST NOT(不应):该短语表示相关定义是出于法律约束的绝对禁止。
    • SHOULD(建议):该词或形容词 "RECOMMENDED" 表示在特定环境下可能存在忽略某一项目的有效理由。
    • SHOULD NOT(不建议):该短语或短语 "NOT RECOMMENDED" 表示在特定环境下某种行为可能是可接受的或甚至有用。
    • MAY(可以):该词或形容词 "OPTIONAL" 表示该项目是真正可选的。

3. 功能概述

Time Service 模块是服务层的一部分。该模块提供基于时间的功能服务。用例包括:

  • 时间测量
  • 基于时间的状态机
  • 超时监督
  • 忙等待

如果硬件支持且配置启用,则有几种 "定时器类型" — 即所谓的 "Time Service Predef Timers" — 可用。

每个 Predef Timer 具有预定义的 tick 持续时间(物理时间单位)和预定义的位数(物理范围)。通过这种方式,可确保对所有支持所需 Time Service Predef Timers 的平台的时间相关功能的兼容性。

Time Service Predef Timers 基于所谓的 "GPT Predef Timers",后者是由 GPT 驱动程序提供的自由运行的硬件定时器。

所有服务都由用户调用("轮询模式")。不支持通知。

Time Service 模块不使用和分发 GPT 驱动程序的所有功能。Time Service 模块不是 "定时器栈" 的顶部。


4. 缩略语、缩写和术语

下表中定义的缩略语和缩写具有本文档的局部范围。

缩写 描述
(参见下文) -

下表中定义的术语具有本文档的局部范围。

术语 描述
GPT Predef Timer GPT Predef Timer 是由 GPT 驱动程序提供的自由运行的向上计数器。可用的 GPT Predef Timer 取决于硬件(时钟、硬件定时器、预分频器、定时器寄存器宽度等)和配置。GPT Predef Timer 具有预定义的物理时间单位和范围。
Time Service Predef Timer Time Service Predef Timer 是具有预定义物理时间单位和范围的自由运行的向上计数器。硬件定时器功能基于相应的 GPT Predef Timer。对于每个 Predef TimerTime Service 模块提供一组 API 服务。用户可以实例化任何定时器(仅受可用内存限制),并可以完全独立地使用各个实例。
Timer instance(定时器实例) 定时器实例是 API 数据类型的数据对象。
Reference time(参考时间) 参考时间为每个定时器实例存储的时间值。

5. 需求追溯

需求 描述 满足于
RS_BRF_01056 AUTOSAR BSW 模块应提供标准化接口 SRS_Tm_00004, SRS_Tm_00005, SRS_Tm_00006, SRS_Tm_00007, SRS_Tm_00008
RS_BRF_01408 AUTOSAR 应提供可从每个基础软件层访问的服务层 SRS_Tm_00001, SRS_Tm_00002, SRS_Tm_00003, SRS_Tm_00004, SRS_Tm_00005, SRS_Tm_00006, SRS_Tm_00007, SRS_Tm_00008
RS_BRF_01468 AUTOSAR 服务应支持用于相对时间测量的时间服务 SRS_Tm_00001, SRS_Tm_00002, SRS_Tm_00003, SRS_Tm_00004, SRS_Tm_00005, SRS_Tm_00006, SRS_Tm_00007, SRS_Tm_00008

6. 需求规范

6.1 功能需求

6.1.1 总体

6.1.1.1 [SRS_Tm_00001] Time Service 模块应支持不同类型的 Predef Timer
Type:                  Valid
Description:           The following types of Predef Timers shall be supported by the
                        Time Service module:
                            • Timer 1µs16bit
                            • Timer 1µs24bit
                            • Timer 1µs32bit
                            • Timer 100µs32bit
Rationale:             1µs: high resolution timer.
                        16bit timer: To support 16bit hardware timers.
                        24bit timer: To support 24bit hardware timers.
                        32bit timer: To support 32bit hardware timers.
                        100µs32bit timer: covers automotive use cases (time span
                        4.9 days)
Use Case:              Time measurement, time based state machine, timeout
                        supervision, busy waiting
Dependencies:          [SRS_BSW_00343] Specification and configuration of time
Supporting Material:   --
⌋(RS_BRF_01408, RS_BRF_01468)
6.1.1.2 [SRS_Tm_00002] GPT Predef Timer 应用作 Time Service 模块的 Predef Timer 的时基
Type:                  Valid
Description:           The GPT Predef Timers shall be used as time base for the
                        Predef Timers of the Time Service module.
Rationale:             The Time Service module has to use a driver module for
                        hardware access
Use Case:              Read current timer value
Dependencies:          --
Supporting Material:   --
⌋(RS_BRF_01408, RS_BRF_01468)

6.1.2 配置

6.1.2.1 [SRS_Tm_00003] Time Service 模块应能配置启用哪些 Predef Timer
Type:                  Valid
Description:           The Time Service module shall make it possible to configure
                        which Predef Timers are enabled.
                        For each enabled Predef Timer a set of API services shall be
                        available:
                            • Reset timer
                            • Get time span
                            • Shift timer
                            • Synchronize timer
                            • Busy waiting, only for 1µs timers
Rationale:             To disable Predef Timers if not needed or related GPT
                        Predef Timers not available.
Use Case:              --
Dependencies:          --
Supporting Material:   --
⌋(RS_BRF_01408, RS_BRF_01468)

6.1.3 初始化

(无具体需求)

6.1.4 正常运行

6.1.4.1 [SRS_Tm_00004] Time Service 模块应提供用于重置定时器实例的同步服务
Type:                  Valid
Description:           The Time Service module shall provide a synchronous
                        service for each enabled Predef Timer, to reset a timer
                        instance. By this service a reference time is set, which is
                        needed for further services. The service shall have the
                        following parameter:
                            • Pointer to a timer instance defined by the user
Rationale:             Basic functionality.
                        Due to performance reasons, this service is required for
                        each Predef Timer. A pointer is used (instead of an
                        identifier) for referencing a timer instance to avoid user
                        dependent configuration of module Time Service. So, the
                        service can be used flexibly just like a library service.
Use Case:              Time measurement, time based state machine, timeout
                        supervision, busy waiting
Dependencies:          --
Supporting Material:   --
⌋(RS_BRF_01408, RS_BRF_01056, RS_BRF_01468)
6.1.4.2 [SRS_Tm_00005] Time Service 模块应提供用于获取时间跨度的同步服务
Type:                  Valid
Description:           The Time Service module shall provide a synchronous
                        service for each enabled Predefined Timer, to get the time
                        span. The time span is the time difference between the
                        reference time and the current point in time.
                        The service shall have the following parameter:
                            • Pointer to a timer instance defined by the user
Rationale:             Basic functionality.
                        Due to performance reasons, this service is required for
                        each Predef Timer. A pointer is used (instead of an
                        identifier) for referencing a timer instance to avoid user
                        dependent configuration of module Time Service. So, the
                        service can be used flexibly just like a library service.
Use Case:              Time measurement, time based state machine, timeout
                        supervision, busy waiting
Dependencies:          --
Supporting Material:   --
⌋(RS_BRF_01408, RS_BRF_01056, RS_BRF_01468)
6.1.4.3 [SRS_Tm_00006] Time Service 模块应提供用于移动定时器实例参考时间的同步服务
Type:                  Valid
Description:           The Time Service module shall provide a synchronous
                        service for each enabled Predef Timer, to shift the
                        reference time of a timer instance. Shifting means to add a
                        time value to the reference time to get a new reference
                        time.
                        The service shall have the following parameters:
                            • Pointer to a timer instance defined by the user
                            • Time value which has to be added to the reference
                              time
Rationale:             Extended functionality.
                        Due to performance reasons, this service is required for
                        each Predef Timer. A pointer is used (instead of an
                        identifier) for referencing a timer instance to avoid user
                        dependent configuration of module Time Service. So, the
                        service can be used flexibly just like a library service.
Use Case:              Measurement of the cycle time of a runnable piece of
                        software without loss of accuracy
Dependencies:          --
Supporting Material:   --
⌋(RS_BRF_01408, RS_BRF_01056, RS_BRF_01468)
6.1.4.4 [SRS_Tm_00007] Time Service 模块应提供用于同步两个定时器实例的同步服务
Type:                  Valid
Description:           The Time Service module shall provide a synchronous
                        service for each enabled Predef Timer, to synchronize
                        two timer instances. Synchronization means to set the
                        reference time of a timer instance "Destination" to the
                        reference time of a timer instance "Source". The service
                        shall have the following parameters:
                            • Pointer to a destination timer instance defined by
                              the user
                            • Pointer to a source timer instance defined by the
                              user
Rationale:             Extended functionality.
                        Due to performance reasons, this service is required for
                        each Predef Timer. A pointer is used (instead of an
                        identifier) for referencing a timer instance to avoid user
                        dependent configuration of module Time Service. So, the
                        service can be used flexibly just like a library service.
Use Case:              Measurement of different time stamps (e.g. first call of
                        some tasks) related to the same reference time.
Dependencies:          --
Supporting Material:   --
⌋(RS_BRF_01408, RS_BRF_01056, RS_BRF_01468)
6.1.4.5 [SRS_Tm_00008] Time Service 模块应提供 tick 持续时间为 1µs 的同步服务以通过轮询执行忙等待
Type:                  Valid
Description:           The Time Service module shall provide a synchronous
                        service for each enabled Predef Timer with tick duration
                        1µs to perform busy waiting (active waiting) by polling.
                        The waiting time shall be restricted to 8 bits (255µs) to
                        prevent long time blocking of code execution. The
                        interrupts shall not be disabled, this means the real
                        waiting time may be greater than the desired waiting
                        time.

                        The service shall have the following parameter:
                            • Minimum waiting time
Rationale:             Extended functionality.
                        Due to performance reasons, this service is required for
                        each 1µs Predef Timer. The service can be used flexibly
                        just like a library service.
                        To reduce risk of bad implementation of busy waiting on
                        user software level. To ensure correct waiting time
                        independent of:
                            • CPU speed
                            • Pipeline effects
                            • Cache effects
                            • Access time to memory (bus width, wait states, ...)
                            • Compiler version, compiler options, compiler
                              optimizations
Use Case:              Implementation of drivers (hardware dependant waiting
                        times)
Dependencies:          --
Supporting Material:   --
⌋(RS_BRF_01408, RS_BRF_01056, RS_BRF_01468)

7. 参考文献

7.1 AUTOSAR 交付物

  • [1] Software Standardization Template, AUTOSAR_TPS_StandardizationTemplate.pdf

翻译说明

  • 文档类型AUTOSAR SRSSoftware Requirements Specification,软件需求规范)
  • 翻译策略:本 SRS 文档(13 页)规模较小,已进行完整翻译,包括所有配置、初始化、运行各阶段的需求。
  • 摘要标记位置
    • 第 5 章需求追溯:表格已完整翻译(3 行)
    • 文档较小,未使用"完整表见原文 PDF"摘要标记
  • 保留内容
    • 需求 ID(如 SRS_Tm_00001SRS_Tm_00008 等)
    • AUTOSAR 方框符 ⌈⌋
    • 所有 API 标识符、模块缩写(GPT、Tm)
    • 文档间交叉引用
  • 术语对照表
    • Time Service → 时间服务
    • Predef Timer → 预定义定时器
    • Reference Time → 参考时间
    • Timer Instance → 定时器实例
    • Tick Duration → 刻度持续时间
    • Time Span → 时间跨度
    • Busy Waiting → 忙等待
    • Polling Mode → 轮询模式
    • Synchronous Service → 同步服务
    • Shift Timer → 移动定时器
    • Synchronize Timer → 同步定时器
    • Reset Timer → 重置定时器
    • GPT Predef Timer → GPT 预定义定时器