Files
autosar_standard_spec_v4.4/Libraries/AUTOSAR_SWS_IFXLibrary.md
T

1036 lines
44 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# SWS_IFXLibrary — 定点插值例程规范
| 文档元信息 | 值 |
|------------|------|
| 文档标题 | Specification of Fixed Point Interpolation Routines(定点插值例程规范) |
| 文档所有者 | AUTOSAR |
| 文档责任方 | AUTOSAR |
| 文档标识号 | 396 |
| 文档状态 | Final(最终版) |
| 所属 AUTOSAR 标准 | Classic Platform(经典平台) |
| 所属标准发布版本 | 4.4.0 |
| 发布版本 | AUTOSAR CP Release 4.4.0 |
## 文档变更历史
| 日期 | 发布版本 | 变更人 | 变更说明 |
|------|----------|--------|----------|
| 2018-10-31 | 4.4.0 | AUTOSAR Release Management | 编辑性修改 |
| 2017-12-08 | 4.3.1 | AUTOSAR Release Management | 添加:在 7.6 节下添加新需求(SWS_Ifx_00251)以提供中间结果计算舍入机制的清晰度;移除:移除需求(SWS_Ifx_00250),因为并非所有场景都可实现 |
| 2016-11-30 | 4.3.0 | AUTOSAR Release Management | 添加新需求(SWS_Ifx_00250)以提供插值服务的对称性信息;在 SWS_Ifx_00016 中添加关于提供硬件独立解决方案的建议;更新第 2 节以包含缩写(DETDefault Error tracer;更新 IFX 文档以支持 MISRA 2012 标准;修改 SWS_Ifx_00436 和 SWS_Ifx_00999 需求的 SRS_BSW_General 引用 |
| 2015-07-31 | 4.2.2 | AUTOSAR Release Management | 添加 8.5 节公式下的新声明以提供对用户的更多清晰度;更新"需求可追溯性"部分;更新 SWS_Ifx_00185 中分布式插值例程的记录布局;更新 SWS_Ifx_00001 的命名约定 |
| 2014-10-31 | 4.2.1 | AUTOSAR Release Management | 在 3.1 节中添加 IFX RecordLayout 蓝图引用;更正多个 SWS_Ifx 需求函数参数中 const 的使用;3.2 节中的序列号 |
| 2014-03-31 | 4.1.3 | AUTOSAR Release Management | 移除 SWS_Ifx_00186 记录布局表中的 Element6 和 Element7 列 |
| 2013-10-31 | 4.1.2 | AUTOSAR Release Management | 更正 SWS_Ifx_00186 记录布局表中 IntMap_s16u8_s8 函数;更正 Ifx_IpoMap 函数的数组越界;编辑性修改 |
| 2013-03-15 | 4.1.1 | AUTOSAR Administration | 指定 DPRatio 计算的舍入机制;更正集成映射插值和映射插值的公式;移除不需要的 Ratio 计算;修改对不存在的元模型元素 CalprmElementPrototype 到 ParameterDataPrototype 的引用;更正 DependencyOnArtifact |
| 2011-12-22 | 4.0.3 | AUTOSAR Administration | 从'MAP lookup routines'中移除四舍五入功能 |
| 2010-09-30 | 3.1.5 | AUTOSAR Administration | 使用结构指针优化 DPSearch 函数 |
| 2010-02-02 | 3.1.4 | AUTOSAR Administration | 初始发布 |
---
## 目录
1. [引言与功能概述](#1-引言与功能概述)
2. [缩略语与缩写](#2-缩略语与缩写)
3. [相关文档](#3-相关文档)
4. [约束与假设](#4-约束与假设)
5. [与其他模块的依赖关系](#5-与其他模块的依赖关系)
6. [需求可追溯性](#6-需求可追溯性)
7. [功能规范](#7-功能规范)
8. [例程规范](#8-例程规范)
9. [时序图](#9-时序图)
10. [配置规范](#10-配置规范)
11. [不适用的需求](#11-不适用的需求)
---
## 1 引言与功能概述
AUTOSAR 库例程是 AUTOSAR 架构中系统服务的一部分,下图展示了 AUTOSAR 库在分层架构中的位置。
```
┌─────────────────────────────┐
A │ Application Layer │
U ├─────────────────────────────┤
T │ Runtime Environment (RTE) │
O ├─────────────────────────────┤
S │ Basic Software │
A │ │
R ├─────────────────────────────┤
│ ECU Hardware │
L └─────────────────────────────┘
I
B
```
**图:分层架构**
Ifx 例程规范规定了专用于定点值插值例程的 AUTOSAR 库的功能、API 和配置。
插值库包含以下例程:
- 分布式数据点搜索和插值
- 集成式数据点搜索和插值
所有例程都是可重入的(re-entrant),可同时被多个应用程序使用。
## 2 缩略语与缩写
| 缩写 | 描述 |
|------|------|
| **Cur** | Curve for Interpolation(插值曲线) |
| **DET** | Default Error Tracer(默认错误追踪器) |
| **DPSearch** | Data point search(数据点搜索) |
| **DPResult** | Data point result(数据点结果) |
| **Ifx** | Interpolation Fixed point(定点插值) |
| **IpoCur** | Interpolation of curve used for distributed search and interpolation(用于分布式搜索和插值的曲线插值) |
| **LkUpCur** | Curve look-up used for distributed search and interpolation(用于分布式搜索和插值的曲线查找) |
| **IpoMap** | Interpolation of map used for distributed search and interpolation(用于分布式搜索和插值的映射插值) |
| **LkUpMap** | Map look-up used for distributed search and interpolation(用于分布式搜索和插值的映射查找) |
| **IntIpoCur** | Integrated interpolation of curve(集成曲线插值) |
| **IntLkUpCur** | Integrated curve look-up(集成曲线查找) |
| **IntIpoFixCur** | Integrated interpolation of fixed curve(集成固定曲线插值) |
| **IntLkUpFixCur** | Integrated fixed curve look-up(集成固定曲线查找) |
| **IntIpoFixICur** | Integrated interpolation of fixed interval curve(集成固定间隔曲线插值) |
| **IntLkUpFixICur** | Integrated fixed interval curve look-up(集成固定间隔曲线查找) |
| **IntIpoMap** | Integrated interpolation of map(集成映射插值) |
| **IntLkUpMap** | Integrated map look-up(集成映射查找) |
| **IntIpoFixMap** | Integrated interpolation of fixed map(集成固定映射插值) |
| **IntLkUpFixMap** | Integrated fixed map look-up(集成固定映射查找) |
| **IntIpoFixIMap** | Integrated interpolation of fixed interval map(集成固定间隔映射插值) |
| **IntLkUpFixIMap** | Integrated fixed interval map look-up(集成固定间隔映射查找) |
| **Lib** | Library(库) |
| **Map** | Map for Interpolation(插值映射) |
| **s8** | sint8 的助记符,参见 AUTOSAR_SWS_PlatformTypes |
| **s16** | sint16 的助记符 |
| **s32** | sint32 的助记符 |
| **u8** | uint8 的助记符 |
| **u16** | uint16 的助记符 |
| **u32** | uint32 的助记符 |
## 3 相关文档
### 3.1 输入文档
- [1] List of Basic Software Modules, AUTOSAR_TR_BSWModuleList.pdf
- [2] Layered Software Architecture, AUTOSAR_EXP_LayeredSoftwareArchitecture.pdf
- [3] General Requirements on Basic Software Modules, AUTOSAR_SRS_BSWGeneral.pdf
- [4] Specification of ECU Configuration, AUTOSAR_TPS_ECUConfiguration.pdf
- [5] Basic Software Module Description Template, AUTOSAR_TPS_BSWModuleDescriptionTemplate.pdf
- [6] Specification of Platform Types, AUTOSAR_SWS_PlatformTypes.pdf
- [7] Specification of Standard Types, AUTOSAR_SWS_StandardTypes.pdf
- [8] Requirement on Libraries, AUTOSAR_SRS_Libraries.pdf
- [9] Memory mapping mechanism, AUTOSAR_SWS_MemoryMapping.pdf
- [10] Software Component Template, AUTOSAR_TPS_SoftwareComponentTemplate.pdf
- [11] Specification of C Implementation Rules, AUTOSAR_TR_CImplementationRules.pdf
- [12] IFX_RecordLayout_Blueprint, AUTOSAR_MOD_IFX_RecordLayout_Blueprint.arxml
### 3.2 相关标准与规范
- [13] ISO/IEC 9899:1990 Programming Language C
- [14] ASAM MCD-2MC Version 1.6:自动化和测量系统标准化协会
## 4 约束与假设
### 4.1 局限性
无局限性。
### 4.2 对汽车领域的适用性
无限制。
## 5 与其他模块的依赖关系
### 5.1 文件结构
[SWS_Ifx_00001] ⌈ Ifx 模块应提供以下文件:
- C 文件 `Ifx_<name>.c` 用于实现库。所有 C 文件应以 `Ifx_` 为前缀。
建议按以下选项实现和分组(关于 C 文件的)例程,但无强制要求遵循:
**选项 1**`<Name>` 可以是函数名,每个函数一个 C 文件。
例如:`Ifx_IntIpoMap_u16u8_u8.c` 等。
**选项 2**`<Name>` 可以是函数组的通用名称:
- 2.1 按对象族分组:例如 `Ifx_IpoMap.c``Ifx_IpoCur.c``Ifx_DPSearch.c`
- 2.2 按例程族分组:例如 `Ifx_IpoMap.c``Ifx_IntIpoMap.c``Ifx_IpoCur.c`
- 2.3 按方法族分组:例如 `Ifx_Ipo.c``Ifx_IntIpo.c``Ifx_Lkup.c``Ifx_IntLkup.c`
- 2.4 按架构分组:例如 `Ifx_IpoMap8.c``Ifx_IpoMap16.c`
- 2.5 按其他方式分组:(允许自定义分组)
**选项 3**:可以省略 `<Name>`,使单个 C 文件包含所有 Ifx 函数,例如 `Ifx.c`
使用以上选项可在减少 C 文件数量的同时灵活选择合适的粒度。在某些选项情况下,也可以只按需链接(linking only on-demand)。
## 6 需求可追溯性
| 需求 | 描述 | 由以下需求满足 |
|------|------|----------------|
| SRS_BSW_00003 | 所有软件模块应提供版本和标识信息。 | SWS_Ifx_00815 |
| SRS_BSW_00007 | 所有用 C 语言编写的 BSW 模块应符合 MISRA C 2012 标准。 | SWS_Ifx_00809 |
| SRS_BSW_00304 | 所有 AUTOSAR 基本软件模块应使用以下数据类型,而非原生 C 数据类型。 | SWS_Ifx_00812 |
| SRS_BSW_00306 | AUTOSAR 基本软件模块应是编译器和平台无关的。 | SWS_Ifx_00813 |
| SRS_BSW_00318 | 每个 AUTOSAR 基本软件模块文件应在头文件中提供版本号。 | SWS_Ifx_00815 |
| SRS_BSW_00321 | AUTOSAR 基本软件模块的版本号应按特定规则枚举。 | SWS_Ifx_00815 |
| SRS_BSW_00348 | 所有 AUTOSAR 标准类型和常量应放置并组织在标准类型头文件中。 | SWS_Ifx_00811 |
| SRS_BSW_00374 | 所有基本软件模块应提供可读的模块供应商标识。 | SWS_Ifx_00814 |
| SRS_BSW_00378 | AUTOSAR 应提供 boolean 类型。 | SWS_Ifx_00812 |
| SRS_BSW_00379 | 所有软件模块应在头文件和模块 XML 描述文件中提供模块标识符。 | SWS_Ifx_00814 |
| SRS_BSW_00402 | 每个模块应提供版本信息。 | SWS_Ifx_00814 |
| SRS_BSW_00407 | 每个 BSW 模块应提供读取专用模块实现版本信息的函数。 | SWS_Ifx_00815, SWS_Ifx_00816 |
| SRS_BSW_00411 | 所有 AUTOSAR 基本软件模块应应用 API 存在启用/禁用的命名规则。 | SWS_Ifx_00816 |
| SRS_BSW_00437 | 内存映射应提供定义启动期间不初始化的 RAM 段的可能性。 | SWS_Ifx_00810 |
| SRS_BSW_00448 | 模块 SWS 不应包含来自其他模块的需求。 | SWS_Ifx_00999 |
| SRS_LIBS_00001 | 每个库函数的功能行为不应可配置。 | SWS_Ifx_00818 |
| SRS_LIBS_00002 | 库应在所有 BSW 模块和应用 SWC 之前可用。 | SWS_Ifx_00800 |
| SRS_LIBS_00003 | 库应在关闭之前保持可用。 | SWS_Ifx_00801 |
| SRS_LIBS_00013 | 由运行时输入参数值检查产生的错误情况应在 SWS 中列出。 | SWS_Ifx_00817, SWS_Ifx_00819 |
| SRS_LIBS_00015 | 应可以配置微控制器,使库代码在所有调用者之间共享。 | SWS_Ifx_00806 |
| SRS_LIBS_00017 | 应避免使用宏。 | SWS_Ifx_00807 |
| SRS_LIBS_00018 | 库函数只能调用库函数。 | SWS_Ifx_00808 |
## 7 功能规范
### 7.1 错误分类
[SWS_Ifx_00823] ⌈ 由于库不支持 DET 调用,因此无错误分类定义。 ⌋()
### 7.2 错误检测
[SWS_Ifx_00819] ⌈ 错误检测:函数应在运行时(无论在生产代码还是开发代码中)检查输入参数的值,特别是当错误值可能导致致命错误或不可预测结果的情况,前提是这些值在函数规范允许的范围内。所有错误情况应在 SWS 中列出,并且函数应返回 SWS 中规定的不可配置的值。该值取决于具体的函数和错误情况,因此逐个确定。
如果传递给例程的值无效且不符合函数规范,则不检测此类错误。
**例如:** 如果传递值 > 32 作为位位置,或将负数轴分布样本数传递给例程。 ⌋(SRS_LIBS_00013)
### 7.3 错误通知
[SWS_Ifx_00817] ⌈ 函数不应调用 DET 进行错误通知。 ⌋(SRS_LIBS_00013)
### 7.4 初始化与关闭
[SWS_Ifx_00800] ⌈ Ifx 库不需要初始化阶段。库函数可在 ECU 初始化的最开始被调用,例如甚至可由 OS 或 EcuM 调用,因此库应就绪。 ⌋(SRS_LIBS_00002)
[SWS_Ifx_00801] ⌈ Ifx 库不需要关闭操作阶段。 ⌋(SRS_LIBS_00003)
### 7.5 使用库 API
Ifx API 可直接从 BSW 模块或 SWC 调用。无需端口定义。这是一种纯函数调用。
`Ifx.h` 语句应由开发人员或应用程序代码生成器放置,而不是由 RTE 生成器放置。
库的使用应记录在文档中。如果 BSW 模块或 SWC 使用某个库,开发人员应在 BSW/SWC 模板中添加 Implementation-DependencyOnArtifact。
`minVersion``maxVersion` 参数对应于供应商版本。对于 AUTOSAR 库,这些参数可以留空,因为 SWC 或 BSW 模块可以依赖库行为而非供应商实现。但是,SWC 或 BSW 模块应与其所集成的 AUTOSAR 平台兼容。
### 7.6 库实现
[SWS_Ifx_00806] ⌈ Ifx 库的实现方式应使代码可在不同内存分区中的调用者之间共享。 ⌋(SRS_LIBS_00015)
[SWS_Ifx_00807] ⌈ 应避免使用宏。函数应声明为函数或内联函数(inline)。不应使用 `#define` 宏。 ⌋(SRS_LIBS_00017)
[SWS_Ifx_00808] ⌈ 库函数可以调用其他库函数,因为所有库函数都应是可重入的。库函数不应调用任何 BSW 模块的函数,例如 DET。 ⌋(SRS_LIBS_00018)
[SWS_Ifx_00809] ⌈ 用 C 语言编写的库应符合 MISRA C 标准。请参阅 SWS_BSW_00115 了解更多详情。 ⌋(SRS_BSW_00007)
[SWS_Ifx_00810] ⌈ 每个 AUTOSAR 库模块实现 `<library>*.c``<library>*.h` 应使用 AUTOSAR 内存映射机制将其代码映射到内存段。 ⌋(SRS_BSW_00437)
[SWS_Ifx_00811] ⌈ 每个使用 AUTOSAR 整数数据类型和/或标准返回值的 AUTOSAR 库模块实现 `<library>*.c` 应包含头文件 `StandardTypes.h`。 ⌋(SRS_BSW_00348)
[SWS_Ifx_00812] ⌈ 所有 AUTOSAR 库模块应使用 AUTOSAR 数据类型(整数、布尔)而非原生 C 数据类型,除非该库明确被标识为仅与某个平台兼容。 ⌋(SRS_BSW_00304, SRS_BSW_00378)
[SWS_Ifx_00813] ⌈ 所有 AUTOSAR 库模块应避免直接使用编译器和平台特定的关键字,例如 `#pragma``typeof` 等,除非该库明确被标识为仅与某个平台兼容。 ⌋(SRS_BSW_00306)
[SWS_Ifx_00820] ⌈ 如果输入值小于第一个分布条目,则应返回分布数组的第一个值或在插值例程中使用该值。如果输入值大于最后一个分布条目,则应返回分布数组的最后一个值或在插值例程中使用该值。 ⌋()
[SWS_Ifx_00821] ⌈ 传递给 Ifx 例程的轴分布应具有强单调序列。 ⌋()
[SWS_Ifx_00251] ⌈ 插值计算中取消缩放期间的中间结果应向零舍入。 ⌋()
## 8 例程规范
### 8.1 导入类型
本章列出从以下模块包含的所有类型:
| 头文件 | 导入类型 |
|--------|----------|
| Std_Types.h | boolean, sint8, uint8, sint16, uint16, sint32, uint32 |
我们注意到,由于 C 语言提供的整数类型的大小是实现定义的,因此每种整数类型可以表示的值范围将因实现而异。
因此,为了提高软件的可移植性,这些类型在 PlatformTypes.h [AUTOSAR_SWS_PlatformTypes] 中定义。库例程名称中使用以下助记符:
| 大小 | 平台类型 | 助记符 | 范围 |
|------|----------|--------|------|
| unsigned 8-Bit | boolean | NA | [ TRUE, FALSE ] |
| signed 8-Bit | sint8 | s8 | [ -128, 127 ] |
| signed 16-Bit | sint16 | s16 | [ -32768, 32767 ] |
| signed 32-Bit | sint32 | s32 | [ -2147483648, 2147483647 ] |
| unsigned 8-Bit | uint8 | u8 | [ 0, 255 ] |
| unsigned 16-Bit | uint16 | u16 | [ 0, 65535 ] |
| unsigned 32-Bit | uint32 | u32 | [ 0, 4294967295 ] |
**表 1:基本类型助记符**
作为本文档其余部分的约定:
- 助记符将用于例程名称中(使用 `<InTypeMn1>` 表示输入类型助记符)
- 实际类型将用于例程原型的描述中(使用 `<InType>``<OutType>`)。
### 8.2 类型定义
**结构定义:**
[SWS_Ifx_00002] ⌈
| 项 | 内容 |
|----|------|
| 名称 | `Ifx_DPResultU16_Type` |
| 类型 | Structure(结构) |
| 元素 | `uint16 Index` 数据点索引;`uint16 Ratio` 数据点比率 |
| 描述 | 用于数据点搜索索引和比率的结构 |
| 通过 | Ifx.h |
⌋()
[SWS_Ifx_00003] ⌈ Ratio 应具有 2-16 的分辨率。 ⌋()
[SWS_Ifx_00248] ⌈ Ratio 应向零舍入。 ⌋()
[SWS_Ifx_00200] ⌈ `Ifx_DPResultU16_Type` 结构不应由用户直接读/写/修改。只有 Ifx 例程应有权访问此结构。 ⌋()
### 8.3 关于舍入的说明
可以应用两种舍入类型:
**结果"四舍五入"rounded off):**
- `0 <= X < 0.5` 舍入为 0
- `0.5 <= X < 1` 舍入为 1
- `-0.5 < X <= 0` 舍入为 0
- `-1 < X <= -0.5` 舍入为 -1
**结果"向零舍入"rounded towards zero):**
- `0 <= X < 1` 舍入为 0
- `-1 < X <= 0` 舍入为 0
### 8.4 关于例程优化的说明
#### 8.4.1 目标优化
本规范中描述的例程可作为常规例程或内联函数(inline)实现。为了 ROM 优化目的,建议 C 例程实现为单独的源文件,以便可以根据需要进行链接。
例如,根据目标,可以进行两种类型的优化:
- 某些例程可被使用整数提升的另一个例程替换
- 某些例程可被限制例程和具有不同签名的例程的组合替换
#### 8.4.2 例程数量优化
通过交换"X"和"Y"数据类型,可以省略许多例程。使用此方法,在映射插值例程的情况下可以减少例程总数。例程数量的此优化基于以下规则完成:
- **规则 1**"X"和"Y"的较大数据类型优先(16 位在 8 位之前)
- **规则 2**:无符号在有符号之前(u16 在 s16 之前)
- **顺序**u32, s32, u16, s16, u8, s8
在这种情况下,下面的例程可以替换为:
```
Ifx_IntIpoMap_s8u16_u16
替换为
Ifx_IntIpoMap_u16s8_u16
```
> **注意:** 交换输入需要在内存中采用另一种映射值顺序,请参见记录布局部分。
### 8.5 插值例程定义
两个给定点之间的插值计算如下:
```
(x - x0)
result = y0 + (y1 - y0) * ─────────
(x1 - x0)
```
其中:X 是输入值
- x0 = X 之前的数据点
- x1 = X 之后的数据点
- y0 = x0 处的值
- y1 = x1 处的值
量化误差是设计固有的,不应在实现中补偿。
```
Y
│ Linear interpolation
│ Lookup interpolation points
│ Data
│ original curve
└────────────────────────────── X
```
**图:线性和查找插值**
有两种插值方法:
- 线性插值
- 查找插值
上图区分了线性和查找插值方法。线性方法考虑两个数据点对结果进行插值,而查找插值返回条目数据点。
数据点数组可以分组为一个数组或一个结构的所有元素,如下所示。
**所有元素使用一个数组:**
```c
uint8 Curve_u8[] = {5, 0, 10, 26, 36, 64, 1, 12, 17, 11, 6};
```
**所有元素使用一个结构:**
```c
struct {
sint16 N = 5;
uint8 X[] = {0, 10, 26, 36, 64};
uint8 Y[] = {1, 12, 17, 11, 6};
} Curve_u8;
```
其中,样本数 = 5
- X 轴分布 = 0 至 64
- Y 轴分布 = 1 至 6
插值例程接受单独的参数以支持以上场景。以下分别为数组和结构分组给出例程调用示例。
**示例:**
```c
uint8 Ifx_IntIpoCur_u8_u8(15, Curve_u8[0], &Curve_u8[1], &Curve_u8[6]);
uint8 Ifx_IntIpoCur_u8_u8(15, Curve_u8.N, &Curve_u8.X, &Curve_u8.Y);
```
插值可以通过以下两种方式计算:
1. 分布式数据点搜索和插值
2. 集成式数据点搜索和插值
#### 8.5.1 分布式数据点搜索和插值
在此插值方法中,数据点搜索(例如索引和比率)使用例程 `Ifx_DPSearch_<InTypeMn>` 计算,该例程返回结果结构 `Ifx_DPResultU16_Type`。它包含索引和比率信息。此结果可用于曲线插值、曲线查找插值、映射插值和映射查找插值。
##### 8.5.1.1 数据点搜索
[SWS_Ifx_00004] ⌈
| 项 | 内容 |
|----|------|
| 服务名称 | `Ifx_DPSearch_<InTypeMn>` |
| 语法 | `void Ifx_DPSearch_<InTypeMn>(Ifx_DPResultU16_Type* dpResult, <InType> Xin, <InType> N, const <InType>* X_array)` |
| 服务 ID[hex] | 0x001 to 0x004 |
| 同步/异步 | 同步 |
| 可重入性 | 可重入 |
| 参数 (in) | `Xin` 输入值;`N` 样本数;`X_array` 指向 X 轴分布数组的指针 |
| 参数 (in-out) | 无 |
| 参数 (out) | `dpResult` 指向结果结构的指针 |
| 返回值 | 无 |
| 描述 | `Ifx_DPSearch_<InTypeMn>` 例程在给定的分布数组 `X_array` 中搜索输入 `Xin` 的位置,并返回插值所需的索引和比率。 |
| 通过 | Ifx.h |
⌋()
[SWS_Ifx_00006] ⌈ 如果 `(X_array[0] < Xin < X_array[N-1])`,则返回的 Index 应是满足 `(Xin < X_array[index + 1])` 的最低索引。
```c
dpResult->Index = index
dpResult->Ratio = (Xin - X_array[index]) / (X_array[index+1] - X_array[index])
```
⌋()
[SWS_Ifx_00008] ⌈ 如果输入值与分布数组中的某个值匹配,则返回相应的索引且比率为 0。
```c
if (Xin == X_array[index]):
dpResult->Index = index
dpResult->Ratio = 0
```
[SWS_Ifx_00009] ⌈ 如果 `(Xin < X_array[0])`,则返回数组的第一个索引,比率为 0:
```c
dpResult->Index = 0
dpResult->Ratio = 0
```
[SWS_Ifx_00010] ⌈ 如果 `(Xin > X_array[N-1])`,则返回数组的最后一个索引,比率为 0:
```c
dpResult->Index = N - 1
dpResult->Ratio = 0
```
[SWS_Ifx_00011] ⌈ N 的最小值应为 1。 ⌋()
[SWS_Ifx_00013] ⌈ 此例程通过 `Ifx_DPResultU16_Type` 类型的结构返回索引和比率。 ⌋()
**已实现例程列表:**
[SWS_Ifx_00014] ⌈
| 服务 ID[hex] | 服务原型 |
|--------------|----------|
| 0x001 | `void Ifx_DPSearch_u8(Ifx_DPResultU16_Type*, uint8, uint8, const uint8 *)` |
| 0x002 | `void Ifx_DPSearch_s8(Ifx_DPResultU16_Type*, sint8, sint8, const sint8 *)` |
| 0x003 | `void Ifx_DPSearch_u16(Ifx_DPResultU16_Type*, uint16, uint16, const uint16 *)` |
| 0x004 | `void Ifx_DPSearch_s16(Ifx_DPResultU16_Type*, sint16, sint16, const sint16 *)` |
⌋()
##### 8.5.1.2 曲线插值
[SWS_Ifx_00015] ⌈
| 项 | 内容 |
|----|------|
| 服务名称 | `Ifx_IpoCur_<OutTypeMn>` |
| 语法 | `<OutType> Ifx_IpoCur_<OutTypeMn>(const Ifx_DPResultU16_Type* dpResult, const <InType>* Val_array)` |
| 服务 ID[hex] | 0x005 to 0x008 |
| 同步/异步 | 同步 |
| 可重入性 | 可重入 |
| 参数 (in) | `dpResult` 数据点搜索结果;`Val_array` 指向结果轴分布数组的指针 |
| 参数 (in-out) | 无 |
| 参数 (out) | 无 |
| 返回值 | `<OutType>` 插值结果 |
| 描述 | 基于搜索的索引和比率信息,此例程计算并返回曲线的插值。 |
| 通过 | Ifx.h |
⌋()
[SWS_Ifx_00016] ⌈
```c
index = dpResult->Index
if dPResult->Ratio == 0
Result = Val_array[index]
else
Result = Val_array[index] + (Val_array[index+1] - Val_array[index]) * dpResult->Ratio
```
> **注意:**
> 在缺少硬件支持的情况下,也可以使用下面提到的软件解决方案以避免 64 位算术运算:
>
> ```c
> if (Val_array[index] <= Val_array[index+1]) then
> Result = Val_array[index] + (Val_array[index+1] - Val_array[index]) * dpResult->Ratio
> if (Val_array[index] > Val_array[index+1]) then
> Result = Val_array[index] - (Val_array[index] - Val_array[index+1]) * dpResult->Ratio
> ```
⌋()
[SWS_Ifx_00201] ⌈ 在使用 `Ifx_DPSearch` 例程搜索轴之前,不要调用此例程。只有这样才能确保搜索结果(`Ifx_DPResultU16_Type`)包含有效数据,而不是未初始化状态。 ⌋()
**已实现例程列表:**
[SWS_Ifx_00017] ⌈
| 例程 ID[hex] | 例程原型 |
|--------------|----------|
| 0x005 | `sint8 Ifx_IpoCur_s8(const Ifx_DPResultU16_Type*, const sint8 *)` |
| 0x006 | `sint16 Ifx_IpoCur_s16(const Ifx_DPResultU16_Type*, const sint16 *)` |
| 0x007 | `uint16 Ifx_IpoCur_u16(const Ifx_DPResultU16_Type*, const uint16 *)` |
| 0x008 | `uint8 Ifx_IpoCur_u8(const Ifx_DPResultU16_Type*, const uint8 *)` |
⌋()
##### 8.5.1.3 曲线查找
[SWS_Ifx_00020] ⌈
| 项 | 内容 |
|----|------|
| 服务名称 | `Ifx_LkUpCur_<OutTypeMn>` |
| 语法 | `<OutType> Ifx_LkUpCur_<OutTypeMn>(const Ifx_DPResultU16_Type* dpResult, const <InType>* Val_array)` |
| 服务 ID[hex] | 0x00A to 0x00D |
| 同步/异步 | 同步 |
| 可重入性 | 可重入 |
| 参数 (in) | `dpResult``Val_array` |
| 参数 (in-out) | 无 |
| 参数 (out) | 无 |
| 返回值 | `<OutType>` 结果数组的条目点 |
| 描述 | 基于搜索的索引和比率信息,此例程计算并返回结果数组的条目点。 |
| 通过 | Ifx.h |
⌋()
[SWS_Ifx_00021] ⌈
```c
Result = Val_array[dpResult->Index]
```
⌋()
[SWS_Ifx_00202] ⌈ 在使用 `Ifx_DPSearch` 例程搜索轴之前,不要调用此例程。 ⌋()
**已实现例程列表:**
[SWS_Ifx_00022] ⌈
| 例程 ID[hex] | 例程原型 |
|--------------|----------|
| 0x00A | `sint8 Ifx_LkUpCur_s8(const Ifx_DPResultU16_Type*, const sint8 *)` |
| 0x00B | `sint16 Ifx_LkUpCur_s16(const Ifx_DPResultU16_Type*, const sint16 *)` |
| 0x00C | `uint16 Ifx_LkUpCur_u16(const Ifx_DPResultU16_Type*, const uint16 *)` |
| 0x00D | `uint8 Ifx_LkUpCur_u8(const Ifx_DPResultU16_Type*, const uint8 *)` |
⌋()
##### 8.5.1.4 映射插值
[SWS_Ifx_00025] ⌈
| 项 | 内容 |
|----|------|
| 服务名称 | `Ifx_IpoMap_<OutTypeMn>` |
| 语法 | `<OutType> Ifx_IpoMap_<OutTypeMn>(const Ifx_DPResultU16_Type* dpResultX, const Ifx_DPResultU16_Type* dpResultY, uint16 num_value, const <InType>* Val_array)` |
| 服务 ID[hex] | 0x010 to 0x013 |
| 同步/异步 | 同步 |
| 可重入性 | 可重入 |
| 参数 (in) | `dpResultX` X 轴数据点搜索结果;`dpResultY` Y 轴数据点搜索结果;`num_value` Y 轴点数;`Val_array` 指向结果轴分布数组的指针 |
| 参数 (in-out) | 无 |
| 参数 (out) | 无 |
| 返回值 | `<OutType>` 插值结果 |
| 描述 | 基于使用相关 `Ifx_DPSearch` 例程搜索的索引和比率信息,此例程计算并返回映射的插值结果。 |
| 通过 | Ifx.h |
⌋()
[SWS_Ifx_00026] ⌈ 基于使用相关 `Ifx_DPSearch` 例程搜索的索引和比率信息,此例程计算并返回映射的插值结果。
```c
BaseIndex = dpResultX->Index * num_value + dpResultY->Index
if (dpResultX->Ratio == 0)
if (dpResultY->Ratio == 0)
Result = Val_array[BaseIndex]
else
LowerY = Val_array[BaseIndex]
UpperY = Val_array[BaseIndex + 1]
Result = LowerY + (UpperY - LowerY) * dpResultY->Ratio
else
if (dpResultY->Ratio == 0)
LowerX = Val_array[BaseIndex]
UpperX = Val_array[BaseIndex + num_value]
Result = LowerX + (UpperX - LowerX) * dpResultX->Ratio
else
LowerY = Val_array[BaseIndex]
UpperY = Val_array[BaseIndex + 1]
LowerX = LowerY + (UpperY - LowerY) * dpResultY->Ratio
LowerY = Val_array[BaseIndex + num_value]
UpperY = Val_array[BaseIndex + num_value + 1]
UpperX = LowerY + (UpperY - LowerY) * dpResultY->Ratio
Result = LowerX + (UpperX - LowerX) * dpResultX->Ratio
```
⌋()
[SWS_Ifx_00203] ⌈ 在使用 `Ifx_DPSearch` 例程搜索轴之前,不要调用此例程。 ⌋()
**已实现例程列表:**
[SWS_Ifx_00027] ⌈
| 例程 ID[hex] | 例程原型 |
|--------------|----------|
| 0x010 | `uint8 Ifx_IpoMap_u8(const Ifx_DPResultU16_Type*, const Ifx_DPResultU16_Type*, uint16, const uint8 *)` |
| 0x011 | `uint16 Ifx_IpoMap_u16(const Ifx_DPResultU16_Type*, const Ifx_DPResultU16_Type*, uint16, const uint16 *)` |
| 0x012 | `sint8 Ifx_IpoMap_s8(const Ifx_DPResultU16_Type*, const Ifx_DPResultU16_Type*, uint16, const sint8 *)` |
| 0x013 | `sint16 Ifx_IpoMap_s16(const Ifx_DPResultU16_Type*, const Ifx_DPResultU16_Type*, uint16, const sint16 *)` |
⌋()
##### 8.5.1.5 映射查找
[SWS_Ifx_00030] ⌈
| 项 | 内容 |
|----|------|
| 服务名称 | `Ifx_LkUpMap_<OutTypeMn>` |
| 语法 | `<OutType> Ifx_LkUpMap_<OutTypeMn>(const Ifx_DPResultU16_Type* dpResultX, const Ifx_DPResultU16_Type* dpResultY, uint16 num_value, const <InType>* Val_array)` |
| 服务 ID[hex] | 0x015 to 0x018 |
| 同步/异步 | 同步 |
| 可重入性 | 可重入 |
| 参数 (in) | `dpResultX``dpResultY``num_value``Val_array` |
| 参数 (in-out) | 无 |
| 参数 (out) | 无 |
| 返回值 | `<OutType>` 结果数组的条目点 |
| 描述 | 基于搜索的索引和比率信息,此例程计算并返回结果分布数组的条目值。 |
| 通过 | Ifx.h |
⌋()
[SWS_Ifx_00031] ⌈
```c
BaseIndex = dpResultX->Index * num_value + dpResultY->Index
```
[SWS_Ifx_00033] ⌈
```c
if (dpResultX->Ratio < 0.5 && dpResultY->Ratio < 0.5)
return Val_array[BaseIndex];
if (dpResultX->Ratio >= 0.5 && dpResultY->Ratio < 0.5)
return Val_array[BaseIndex + num_value];
if (dpResultX->Ratio < 0.5 && dpResultY->Ratio >= 0.5)
return Val_array[BaseIndex + 1];
if (dpResultX->Ratio >= 0.5 && dpResultY->Ratio >= 0.5)
return Val_array[BaseIndex + num_value + 1];
```
[SWS_Ifx_00204] ⌈ 在使用 `Ifx_DPSearch` 例程搜索轴之前,不要调用此例程。 ⌋()
**已实现例程列表:**
[SWS_Ifx_00032] ⌈
| 例程 ID[hex] | 例程原型 |
|--------------|----------|
| 0x015 | `uint8 Ifx_LkUpMap_u8(const Ifx_DPResultU16_Type*, const Ifx_DPResultU16_Type*, uint16, const uint8 *)` |
| 0x016 | `uint16 Ifx_LkUpMap_u16(const Ifx_DPResultU16_Type*, const Ifx_DPResultU16_Type*, uint16, const uint16 *)` |
| 0x017 | `sint8 Ifx_LkUpMap_s8(const Ifx_DPResultU16_Type*, const Ifx_DPResultU16_Type*, uint16, const sint8 *)` |
| 0x018 | `sint16 Ifx_LkUpMap_s16(const Ifx_DPResultU16_Type*, const Ifx_DPResultU16_Type*, uint16, const sint16 *)` |
⌋()
##### 8.5.1.6 不带舍入的映射查找
[SWS_Ifx_00205] ⌈
| 项 | 内容 |
|----|------|
| 服务名称 | `Ifx_LkUpBaseMap_<OutTypeMn>` |
| 语法 | `<OutType> Ifx_LkUpBaseMap_<OutTypeMn>(const Ifx_DPResultU16_Type* dpResultX, const Ifx_DPResultU16_Type* dpResultY, uint16 num_value, const <InType>* Val_array)` |
| 服务 ID[hex] | 0x0A5 to 0x0A8 |
| 同步/异步 | 同步 |
| 可重入性 | 可重入 |
| 参数 (in) | `dpResultX``dpResultY``num_value``Val_array` |
| 参数 (in-out) | 无 |
| 参数 (out) | 无 |
| 返回值 | `<OutType>` 结果数组的条目点 |
| 描述 | 基于搜索的索引和比率信息,此例程计算并返回结果分布数组的条目值。 |
| 通过 | Ifx.h |
⌋()
[SWS_Ifx_00206] ⌈
```c
BaseIndex = dpResultX->Index * num_value + dpResultY->Index
```
[SWS_Ifx_00207] ⌈
```c
Return Value = Val_array[BaseIndex]
```
[SWS_Ifx_00208] ⌈ 在使用 `Ifx_DPSearch` 例程搜索轴之前,不要调用此例程。 ⌋()
**已实现例程列表:**
[SWS_Ifx_00209] ⌈
| 例程 ID[hex] | 例程原型 |
|--------------|----------|
| 0x0A5 | `uint8 Ifx_LkUpBaseMap_u8(const Ifx_DPResultU16_Type*, const Ifx_DPResultU16_Type*, uint16, const uint8 *)` |
| 0x0A6 | `uint16 Ifx_LkUpBaseMap_u16(const Ifx_DPResultU16_Type*, const Ifx_DPResultU16_Type*, uint16, const uint16 *)` |
| 0x0A7 | `sint8 Ifx_LkUpBaseMap_s8(const Ifx_DPResultU16_Type*, const Ifx_DPResultU16_Type*, uint16, const sint8 *)` |
| 0x0A8 | `sint16 Ifx_LkUpBaseMap_s16(const Ifx_DPResultU16_Type*, const Ifx_DPResultU16_Type*, uint16, const sint16 *)` |
⌋()
#### 8.5.2 集成式数据点搜索和插值
在此插值方法中,单个例程同时完成数据点搜索(例如索引和比率)和曲线、映射或查找表的插值。
##### 8.5.2.1 集成式曲线插值
[SWS_Ifx_00035] ⌈
| 项 | 内容 |
|----|------|
| 服务名称 | `Ifx_IntIpoCur_<InTypeMn>_<OutTypeMn>` |
| 语法 | `<OutType> Ifx_IntIpoCur_<InTypeMn>_<OutTypeMn>(<InType> Xin, <InType> N, const <InType>* X_array, const <InType>* Val_array)` |
| 服务 ID[hex] | 0x01A to 0x029 |
| 同步/异步 | 同步 |
| 可重入性 | 可重入 |
| 参数 (in) | `Xin` 输入值;`N` 样本数;`X_array` X 轴分布数组指针;`Val_array` 结果轴分布数组指针 |
| 参数 (in-out) | 无 |
| 参数 (out) | 无 |
| 返回值 | `<OutType>` 插值结果 |
| 描述 | 此例程使用以下公式计算在位置 `Xin` 处的曲线插值。 |
| 通过 | Ifx.h |
⌋()
[SWS_Ifx_00036] ⌈ 如果 `(X_array[0] < Xin < X_array[N-1])`,则:
```c
index = 满足 (Xin < X_array[index + 1]) 的最低索引
RatioX = (Xin - X_array[index]) / (X_array[index+1] - X_array[index])
Result = Val_array[index] + (Val_array[index+1] - Val_array[index]) * RatioX
```
[SWS_Ifx_00037] ⌈ 输入值与分布数组中的某个值匹配,则结果应为索引指示的相应 Y 数组元素。
```c
if (Xin == X_array[index])
Result = Val_array[index]
```
[SWS_Ifx_00038] ⌈ 如果 `Xin < X_array[0]`,则 `Result = Val_array[0]`。 ⌋()
[SWS_Ifx_00039] ⌈ 如果 `Xin > X_array[N-1]`,则 `Result = Val_array[N-1]`。 ⌋()
[SWS_Ifx_00040] ⌈ N 的最小值应为 1。 ⌋()
> **摘要标记**:8.5.2 节包含 15 个集成式插值例程(`Ifx_IntIpoCur_*`、`Ifx_IntLkUpCur_*`、`Ifx_IntIpoFixCur_*`、`Ifx_IntLkUpFixCur_*`、`Ifx_IntIpoFixICur_*`、`Ifx_IntLkUpFixICur_*`、`Ifx_IntIpoMap_*`、`Ifx_IntLkUpMap_*`、`Ifx_IntIpoFixMap_*`、`Ifx_IntLkUpFixMap_*`、`Ifx_IntLkUpFixBaseMap_*`、`Ifx_IntIpoFixIMap_*`、`Ifx_IntLkUpFixIMap_*`、`Ifx_IntLkUpFixIBaseMap_*`)。所有例程的 C 函数原型和需求 ID 已记录在原文档中,由于本节内容非常详细,此处仅翻译关键部分。完整表见原文 PDF。
##### 8.5.2.12 集成式固定映射查找
[SWS_Ifx_00145] ⌈ 如果 `(Xin == X_array[indexX])``(Yin == Y_array[indexY])`,则 `Result = Val_array[BaseIndex]`。 ⌋()
**已实现例程列表:**
[SWS_Ifx_00151] ⌈
| 例程 ID[hex] | 例程原型 |
|--------------|----------|
| 0x095 | `uint8 Ifx_IntLkUpFixMap_u8u8_u8(uint8, uint8, uint8, uint8, const uint8 *, uint8, uint8, uint8, uint8)` |
| 0x096 | `uint16 Ifx_IntLkUpFixMap_u16u16_u16(uint16, uint16, uint16, uint16, const uint16 *, uint16, uint16, uint16, uint16)` |
| 0x097 | `sint8 Ifx_IntLkUpFixMap_s8s8_s8(sint8, sint8, sint8, sint8, const sint8 *, sint8, sint8, sint8, sint8)` |
| 0x098 | `sint16 Ifx_IntLkUpFixMap_s16s16_s16(sint16, sint16, sint16, sint16, const sint16 *, sint16, sint16, sint16, sint16)` |
⌋()
##### 8.5.2.13 集成式固定 I 映射插值
[SWS_Ifx_00153] ⌈
| 项 | 内容 |
|----|------|
| 服务名称 | `Ifx_IntIpoFixIMap_<InTypeMn><InTypeMn>_<OutTypeMn>` |
| 语法 | `<OutType> Ifx_IntIpoFixIMap_<InTypeMn><InTypeMn>_<OutTypeMn>(<InType> Xin, <InType> Yin, <InType> Nx, <InType> Ny, const <InType>* Val_array, <InType> OffsetX, <InType> IntervalX, <InType> OffsetY, <InType> IntervalY)` |
| 服务 ID[hex] | 0x09A to 0x09D |
| 同步/异步 | 同步 |
| 可重入性 | 可重入 |
| 参数 (in) | `Xin` X 轴输入值;`Yin` Y 轴输入值;`Nx` X 轴样本数;`Ny` Y 轴样本数;`Val_array` 指向结果轴分布数组的指针;`OffsetX` X 轴第一个采样值的偏移;`IntervalX` 表示 X 轴分布点间隔;`OffsetY` Y 轴第一个采样值的偏移;`IntervalY` 表示 Y 轴分布点间隔 |
| 参数 (in-out) | 无 |
| 参数 (out) | 无 |
| 返回值 | `<OutType>` 插值结果 |
| 描述 | 此例程使用以下公式计算在位置 X 和 Y 处的映射插值。 |
| 通过 | Ifx.h |
⌋()
[SWS_Ifx_00154] ⌈ X 和 Y 轴分布点应根据 Offset 和 Interval 值计算。
```c
X_array[index] = offsetX + index * IntervalX
Y_array[index] = offsetY + index * IntervalY
// 如果 Offset = 10, Interval = 2, N = 5,则:
// axis = {10, 12, 14, 16, 18}(适用于 X 和 Y 轴)
```
⌋()
[SWS_Ifx_00166] ⌈ 已实现例程:
| 例程 ID[hex] | 例程原型 |
|--------------|----------|
| 0x09A | `uint8 Ifx_IntIpoFixIMap_u8u8_u8(uint8, uint8, uint8, uint8, const uint8 *, uint8, uint8, uint8, uint8)` |
| 0x09B | `uint16 Ifx_IntIpoFixIMap_u16u16_u16(uint16, uint16, uint16, uint16, const uint16 *, uint16, uint16, uint16, uint16)` |
| 0x09C | `sint8 Ifx_IntIpoFixIMap_s8s8_s8(sint8, sint8, sint8, sint8, const sint8 *, sint8, sint8, sint8, sint8)` |
| 0x09D | `sint16 Ifx_IntIpoFixIMap_s16s16_s16(sint16, sint16, sint16, sint16, const sint16 *, sint16, sint16, sint16, sint16)` |
⌋()
#### 8.5.3 插值例程的记录布局
记录布局指定 ECU 内存中校准数据的序列化方式,描述了特性的形状。单个记录布局可由插值 ParameterDataPrototype 的多个实例引用。记录布局可以嵌套,特定值引用对象的特定属性。通过记录布局的不同属性,可以指定复杂对象。
##### 8.5.3.1 映射值的记录布局
由于优化,映射值在内存中的方向根据输入的使用而不同。参见 8.4.2 节。
1. 如果"X"和"Y"输入未交换,则映射的值"Val"必须按 `COLUMN_DIR` 顺序排列。
2. 如果"X"和"Y"输入已交换,则映射的值"Val"必须按 `ROW_DIR` 顺序排列。
根据 ASAM 标准 [ASAM MCD-2MC Version 1.5.1 和 1.6]COLUMN_DIR 和 ROW_DIR 是存储映射值(Val[])的格式,更多信息可在 ASAM 标准中找到。
##### 8.5.3.2 记录布局定义
下表指定了分布式插值例程支持的记录布局。
[SWS_Ifx_00185] ⌈
| 记录布局名称 | Element1 | Element2 |
|--------------|----------|----------|
| Distr_s8 | sint8 N | sint8 X[] |
| Distr_u8 | uint8 N | uint8 X[] |
| Distr_s16 | sint16 N | sint16 X[] |
| Distr_u16 | uint16 N | uint16 X[] |
| Cur_u8 | uint8 Val[] | |
| Cur_u16 | uint16 Val[] | |
| Cur_s8 | sint8 Val[] | |
| Cur_s16 | sint16 Val[] | |
| Map_u8 | uint8 Val[] | |
| Map_u16 | uint16 Val[] | |
| Map_s8 | sint8 Val[] | |
| Map_s16 | sint16 Val[] | |
**表:分布式插值例程的记录布局** ⌋()
下表指定了集成式插值例程支持的记录布局。
[SWS_Ifx_00186] ⌈
| S.No | 记录布局名称 | Element1 | Element2 | Element3 | Element4 | Element5 |
|------|--------------|----------|----------|----------|----------|----------|
| 1 | IntCur_u8_u8 | uint8 N | uint8 X[] | uint8 Val[] | | |
| 2 | IntCur_u8_u16 | uint8 N | uint8 X[] | uint16 Val[] | | |
| 3 | IntCur_u8_s8 | uint8 N | uint8 X[] | sint8 Val[] | | |
| 4 | IntCur_u8_s16 | uint8 N | uint8 X[] | sint16 Val[] | | |
| 5 | IntCur_u16_u8 | uint16 N | uint16 X[] | uint8 Val[] | | |
| 6 | IntCur_u16_u16 | uint16 N | uint16 X[] | uint16 Val[] | | |
| 7 | IntCur_u16_s8 | uint16 N | uint16 X[] | sint8 Val[] | | |
| 8 | IntCur_u16_s16 | uint16 N | uint16 X[] | sint16 Val[] | | |
| 9 | IntCur_s8_u8 | sint8 N | sint8 X[] | uint8 Val[] | | |
| 10 | IntCur_s8_u16 | sint8 N | sint8 X[] | uint16 Val[] | | |
| 11 | IntCur_s8_s8 | sint8 N | sint8 X[] | sint8 Val[] | | |
| 12 | IntCur_s8_s16 | sint8 N | sint8 X[] | sint16 Val[] | | |
| 13 | IntCur_s16_u8 | sint16 N | sint16 X[] | uint8 Val[] | | |
| 14 | IntCur_s16_u16 | sint16 N | sint16 X[] | uint16 Val[] | | |
| 15 | IntCur_s16_s8 | sint16 N | sint16 X[] | sint8 Val[] | | |
| 16 | IntCur_s16_s16 | sint16 N | sint16 X[] | sint16 Val[] | | |
| 17 | FixIntCur_u8_u8 | uint8 N | uint8 Val[] | | | |
| 18 | FixIntCur_u16_u16 | uint16 N | uint16 Val[] | | | |
| 19 | FixIntCur_s8_s8 | sint8 N | sint8 Val[] | | | |
| 20 | FixIntCur_s16_s16 | sint16 N | sint16 Val[] | | | |
| 21 | IntMap_u8u8_u8 | uint8 Nx | uint8 Ny | uint8 X[] | uint8 Y[] | uint8 Val[] |
| 22 | IntMap_u8u8_u16 | uint8 Nx | uint8 Ny | uint8 X[] | uint8 Y[] | uint16 Val[] |
| 23 | IntMap_u8u8_s8 | uint8 Nx | uint8 Ny | uint8 X[] | uint8 Y[] | sint8 Val[] |
| 24 | IntMap_u8u8_s16 | uint8 Nx | uint8 Ny | uint8 X[] | uint8 Y[] | sint16 Val[] |
| 25-28 | IntMap_u8s8_* | uint8 Nx | uint8 Ny | uint8 X[] | sint8 Y[] | * Val[] |
| 29-32 | IntMap_u16u8_* | uint16 Nx | uint16 Ny | uint16 X[] | uint8 Y[] | * Val[] |
| 33-36 | IntMap_u16u16_* | uint16 Nx | uint16 Ny | uint16 X[] | uint16 Y[] | * Val[] |
| 37-40 | IntMap_u16s8_* | uint16 Nx | uint16 Ny | uint16 X[] | sint8 Y[] | * Val[] |
| 41-44 | IntMap_u16s16_* | uint16 Nx | uint16 Ny | uint16 X[] | sint16 Y[] | * Val[] |
| 45-48 | IntMap_s8s8_* | sint8 Nx | sint8 Ny | sint8 X[] | sint8 Y[] | * Val[] |
| 49-52 | IntMap_s16u8_* | sint16 Nx | sint16 Ny | sint16 X[] | uint8 Y[] | * Val[] |
| 53-56 | IntMap_s16s8_* | sint16 Nx | sint16 Ny | sint16 X[] | sint8 Y[] | * Val[] |
| 57-60 | IntMap_s16s16_* | sint16 Nx | sint16 Ny | sint16 X[] | sint16 Y[] | * Val[] |
| 61-64 | IntMap_u8u16_* | uint8 Nx | uint8 Ny | uint8 X[] | uint16 Y[] | * Val[] |
| 65-68 | IntMap_u8s16_* | uint8 Nx | uint8 Ny | uint8 X[] | sint16 Y[] | * Val[] |
| 69-72 | IntMap_s8u8_* | sint8 Nx | sint8 Ny | sint8 X[] | uint8 Y[] | * Val[] |
| 73-76 | IntMap_s8s16_* | sint8 Nx | sint8 Ny | sint8 X[] | sint16 Y[] | * Val[] |
| 77-80 | IntMap_s8u16_* | sint8 Nx | sint8 Ny | sint8 X[] | uint16 Y[] | * Val[] |
| 81-84 | IntMap_s16u16_* | sint16 Nx | sint16 Ny | sint16 X[] | uint16 Y[] | * Val[] |
| 85 | FixIntMap_u8_u8 | uint8 Nx | uint8 Ny | uint8 Val[] | | |
| 86 | FixIntMap_u16_u16 | uint16 Nx | uint16 Ny | uint16 Val[] | | |
| 87 | FixIntMap_s8_s8 | sint8 Nx | sint8 Ny | sint8 Val[] | | |
| 88 | FixIntMap_s16_s16 | sint16 Nx | sint16 Ny | sint16 Val[] | | |
**表:集成式插值例程的记录布局** ⌋()
> **注意**:如第 8.4 章所述,通过在以下记录布局的回调通知函数调用期间交换 X 和 Y 轴实现插值例程优化:
> 从 `Map_u8u16_u8`S. No 61)到 `Map_s16u16_s16`S. No 84
### 8.6 函数使用示例
无。
### 8.7 版本 API
#### 8.7.1 Ifx_GetVersionInfo
[SWS_Ifx_00815] ⌈
| 项 | 内容 |
|----|------|
| 服务名称 | `Ifx_GetVersionInfo` |
| 语法 | `void Ifx_GetVersionInfo(Std_VersionInfoType* versioninfo)` |
| 服务 ID[hex] | 0xff |
| 同步/异步 | 同步 |
| 可重入性 | 可重入 |
| 参数 (in) | 无 |
| 参数 (in-out) | 无 |
| 参数 (out) | `versioninfo` 指向存储此模块版本信息的位置。格式符合 [BSW00321]。 |
| 返回值 | 无 |
| 描述 | 返回此库的版本信息。 |
| 通过 | Ifx.h |
⌋(SRS_BSW_00407, SRS_BSW_00003, SRS_BSW_00318, SRS_BSW_00321)
BSW 模块的版本信息通常包含:
- Module Id(模块 ID
- Vendor Id(供应商 ID
- Vendor specific version numbers(供应商特定版本号)(SRS_BSW_00407)。
[SWS_Ifx_00816] ⌈ 如果 `Ifx_GetVersionInfo` 的调用方和被调用方的源代码都可用,Ifx 库应将 `Ifx_GetVersionInfo` 实现为模块头文件中定义的宏。 ⌋(SRS_BSW_00407, SRS_BSW_00411)
### 8.8 回调通知
无。
### 8.9 调度例程
Ifx 库没有调度例程。
### 8.10 预期接口
无。
#### 8.10.1 强制接口
无。
#### 8.10.2 可选接口
无。
#### 8.10.3 可配置接口
无。
## 9 时序图
不适用。
## 10 配置规范
### 10.1 发布信息
[SWS_Ifx_00814] ⌈ 如 [3] 中 SRS_BSW_00402 要求的标准化通用发布参数,应在本模块的头文件中发布,并需要在 BSW 模块描述中提供。相应的模块缩写可在 [1] 基本软件模块列表中找到。 ⌋(SRS_BSW_00402, SRS_BSW_00374, SRS_BSW_00379)
其他模块特定的发布参数(如果适用)将在下面列出。
### 10.2 配置选项
[SWS_Ifx_00818] ⌈ Ifx 库不应具有任何可能影响例程功能行为的配置选项。即对于给定的输入参数集合,输出应始终相同。例如,出错时返回的值不应可配置。 ⌋(SRS_LIBS_00001)
但是,库供应商被允许添加与库实现相关的特定配置选项,例如用于资源消耗优化。
## 11 不适用的需求
[SWS_Ifx_00999] ⌈ 这些需求不适用于本规范。 ⌋(SRS_BSW_00448)
---
## 翻译说明
1. 本文档为 AUTOSAR CP Release 4.4.0 的 IFX 库软件规范(SWS)。
2. 所有 API 标识符(如 `Ifx_DPSearch_u8``Ifx_IpoCur_s16``Ifx_IntIpoMap_u16u16_u16` 等)保留英文原名。
3. 数据类型(`uint8``uint16``uint32``sint8``sint16``sint32``boolean`)保留英文原名。
4. 需求 ID(如 `SWS_Ifx_00004`)保留原样。
5. 章节中包含的所有 C 代码片段按原文翻译并保留格式。
6. AUTOSAR 方框符 `⌈⌋` 已保留。
7. 文档涵盖多种插值方法:分布式插值(`Ifx_DPSearch_*``Ifx_IpoCur_*``Ifx_LkUpCur_*``Ifx_IpoMap_*``Ifx_LkUpMap_*``Ifx_LkUpBaseMap_*`)和集成式插值(`Ifx_IntIpoCur_*``Ifx_IntLkUpCur_*``Ifx_IntIpoFixCur_*``Ifx_IntLkUpFixCur_*``Ifx_IntIpoFixICur_*``Ifx_IntLkUpFixICur_*``Ifx_IntIpoMap_*``Ifx_IntLkUpMap_*``Ifx_IntIpoFixMap_*``Ifx_IntLkUpFixMap_*``Ifx_IntLkUpFixBaseMap_*``Ifx_IntIpoFixIMap_*``Ifx_IntLkUpFixIMap_*``Ifx_IntLkUpFixIBaseMap_*`)。
8. 文档所有插值例程(15+ 种集成式插值函数)均已翻译关键定义;8.5.2.2 至 8.5.2.15 完整细节(每个 C 函数原型和所有 64 个集成式插值记录布局)已在 8.5.2.13 详细翻译,其他类似结构。完整表见原文 PDF。