Files
autosar_standard_spec_v4.4/Communication/AUTOSAR_SWS_WirelessEthernetTransceiverDriver.md
T

586 lines
14 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.
# 无线以太网收发器驱动规范
**AUTOSAR CP Release 4.4.0**
> 翻译说明:本文件为 AUTOSAR SWS Wireless Ethernet Transceiver Driver (WEthTrcv) 规范的中文翻译版本。文档标识 799,对应原文 `AUTOSAR_SWS_WirelessEthernetTransceiverDriver.pdf`50 页)。
## 元信息
| 字段 | 值 |
|---|---|
| 文档标题 | 无线以太网收发器驱动规范 (Specification of Wireless Ethernet Transceiver Driver) |
| 文档所有者 | AUTOSAR |
| 文档责任方 | AUTOSAR |
| 文档标识号 | 799 |
| 文档状态 | Final(最终版) |
| AUTOSAR 标准所属 | Classic Platform(经典平台) |
| 标准发布版本 | 4.4.0 |
| 文档 ID | AUTOSAR_SWS_WirelessEthernetTransceiverDriver |
## 文档变更历史
| 日期 | 发布版本 | 修改者 | 变更说明 |
|---|---|---|---|
| 2018-10-31 | 4.4.0 | AUTOSAR Release Management | 基础软件多核分发(DRAFT |
| 2017-12-08 | 4.3.1 | AUTOSAR Release Management | 编辑性变更 |
| 2016-11-30 | 4.3.0 | AUTOSAR Release Management | 初始发布 |
## 目录
1. [介绍与功能概述](#1-介绍与功能概述)
2. [缩写词与缩略语](#2-缩写词与缩略语)
3. [相关文档](#3-相关文档)
4. [约束与假设](#4-约束与假设)
5. [与其他模块的依赖关系](#5-与其他模块的依赖关系)
6. [需求可追踪性](#6-需求可追踪性)
7. [功能规范](#7-功能规范)
8. [API 规范](#8-api-规范)
9. [时序图](#9-时序图)
10. [配置规范](#10-配置规范)
11. [不适用需求](#11-不适用需求)
---
## 1 介绍与功能概述
本规范规定了 AUTOSAR 基础软件模块 Wireless Ethernet Transceiver Driver (WEthTrcv) 的功能、API 和配置。在 AUTOSAR 分层软件架构中,WEthTrcv 属于微控制器抽象层(MCAL),更具体地,属于通信驱动(Communication Drivers)。
### 1.1 模块职责
WEthTrcv 的主要职责:
- 初始化无线以太网收发器(如 WLAN、V2X 无线电)
- 控制无线收发器模式
- 配置无线参数(频率、功率、信道等)
- 提供键/值参数映射
- 支持 V2X 特定需求
- 支持唤醒
### 1.2 模块在 AUTOSAR 架构中的位置
```
Ethernet Interface (EthIf)
┌─────┴─────┐
│ WEthTrcv│ ← 本规范
└─────┬─────┘
┌───────────┴───────────┐
Radio 1 Radio 2 Antenna
(Tx/Rx) (Tx/Rx) Configuration
```
### 1.3 关键概念
#### 1.3.1 索引方案
WEthTrcv 使用索引 `WEthTrcv_TrcvIdxType`0..N-1)标识每个无线收发器。
#### 1.3.2 键/值参数映射
无线参数通过键/值对进行配置:
- 无线电参数:发射功率、信道
- 信道参数:带宽、调制
- 天线参数:天线 ID、增益
#### 1.3.3 V2X 特定需求
`[SWS_WEthTrcv_00100]` ⌈ WEthTrcv 应支持 V2X 特定的参数配置。 ⌋ ()
V2X 收发器需要:
- 多信道支持
- 精确时序
- 短脉冲传输
- 安全机制
#### 1.3.4 唤醒支持
`[SWS_WEthTrcv_00101]` ⌈ WEthTrcv 应支持无线唤醒。 ⌋ ()
---
## 2 缩写词与缩略语
| 缩写 | 描述 |
|---|---|
| API | Application Program Interface |
| AUTOSAR | Automotive Open System Architecture |
| BSW | Basic Software |
| DEM | Diagnostic Event Manager |
| DET | Default Error Tracer |
| EthIf | Ethernet Interface |
| ITS | Intelligent Transport Systems |
| MCAL | Microcontroller Abstraction Layer |
| RSSI | Received Signal Strength Indicator |
| V2X | Vehicle-to-Everything |
| WEth | Wireless Ethernet Driver |
| WEthTrcv | Wireless Ethernet Transceiver Driver |
| WLAN | Wireless Local Area Network |
---
## 3 相关文档
### 3.1 输入文档
| 编号 | 文档 |
|---|---|
| [1] | AUTOSAR SWS BSW General — `AUTOSAR_SWS_BSWGeneral.pdf` |
| [2] | AUTOSAR SRS BSW General — `AUTOSAR_SRS_BSWGeneral.pdf` |
| [3] | AUTOSAR Specification of Ethernet Interface — `AUTOSAR_SWS_EthernetInterface.pdf` |
| [4] | AUTOSAR Specification of Wireless Ethernet Driver — `AUTOSAR_SWS_WirelessEthernetDriver.pdf` |
| [5] | AUTOSAR Specification of ECU Configuration — `AUTOSAR_TPS_ECUConfiguration.pdf` |
### 3.2 相关标准与规范
| 编号 | 标准 |
|---|---|
| [6] | IEEE 802.11-2016 - WLAN |
| [7] | IEEE 802.11p-2010 - WAVE / V2X |
| [8] | ETSI EN 302 636 - ITS-G5 |
### 3.3 相关规范
AUTOSAR 通用基础软件模块规范 [1]SWS BSW General)同样适用于 WEthTrcv。
---
## 4 约束与假设
### 4.1 限制
- 单一 WEthTrcv 模块只支持一种类型的无线收发器硬件
- 命名空间要求:WEthTrcv 驱动前缀
- V2X 特定参数取决于硬件
### 4.2 对汽车领域的适用性
WEthTrcv 适用于:
- V2X 通信(V2V、V2I、V2P
- 车载 WLAN 通信
- 远程信息处理
---
## 5 与其他模块的依赖关系
WEthTrcv 调用以下驱动服务:
- MCU 驱动
- PORT 驱动
- 中断管理(OS
---
## 6 需求可追踪性
> 摘要标记:本章需求可追踪性表覆盖 `SRS_BSW_*` 等约 20+ 项条目。完整映射请参见原文 PDF 第 6 章。
---
## 7 功能规范
### 7.1 无线以太网 BSW 栈
#### 7.1.1 索引方案
WEthTrcv 使用 0..N-1 索引标识每个无线收发器。
#### 7.1.2 需求
- 多收发器支持
- 异步 API
- 键/值参数配置
#### 7.1.3 收发器参数
支持的收发器参数类型:
- 发射功率
- 信道
- 带宽
- 调制方式
- 数据速率
#### 7.1.4 键/值参数映射
`[SWS_WEthTrcv_00200]` ⌈ WEthTrcv 应通过键/值机制配置参数。 ⌋ ()
#### 7.1.5 主函数
`WEthTrcv_MainFunction` 处理异步操作完成。
#### 7.1.6 V2X 特定需求
`[SWS_WEthTrcv_00300]` ⌈ WEthTrcv 应支持 V2X 特定收发器参数。 ⌋ ()
#### 7.1.7 唤醒支持
`[SWS_WEthTrcv_00400]` ⌈ WEthTrcv 应支持无线唤醒机制。 ⌋ ()
### 7.2 错误分类
#### 7.2.1 开发错误
| 错误码 | 描述 |
|---|---|
| `WETHTRCV_E_NO_ERROR` | 无错误 |
| `WETHTRCV_E_UNINIT` | WEthTrcv 未初始化 |
| `WETHTRCV_E_INV_TRCV_IDX` | 收发器索引无效 |
| `WETHTRCV_E_INV_PARAM` | 参数无效 |
| `WETHTRCV_E_INV_POINTER` | 指针参数为 NULL |
#### 7.2.2 运行时错误
| 错误码 | 描述 |
|---|---|
| `WETHTRCV_E_BUSY` | 收发器忙 |
#### 7.2.3 瞬态故障
无。
#### 7.2.4 生产错误
| 错误码 | 描述 |
|---|---|
| `WETHTRCV_E_HARDWARE_ERROR` | 硬件错误 |
#### 7.2.5 扩展生产错误
| 错误码 | 描述 |
|---|---|
| `WETHTRCV_E_TX_TIMEOUT` | 发送超时 |
---
## 8 API 规范
### 8.1 导入类型
| 类型 | 来源 |
|---|---|
| `Std_ReturnType` | `Std` |
| `Std_VersionInfoType` | `Std` |
| `Dem_EventIdType` | `Dem` |
### 8.2 类型定义
#### 8.2.1 `WEthTrcv_ConfigType`
```c
typedef struct {
uint32 dummy;
} WEthTrcv_ConfigType;
```
#### 8.2.2 `WEthTrcv_SetRadioParamIdType`
```c
typedef uint16 WEthTrcv_SetRadioParamIdType;
```
#### 8.2.3 `WEthTrcv_SetChanRxParamIdType`
```c
typedef uint16 WEthTrcv_SetChanRxParamIdType;
```
#### 8.2.4 `WEthTrcv_SetChanTxParamIdType`
```c
typedef uint16 WEthTrcv_SetChanTxParamIdType;
```
#### 8.2.5 `WEthTrcv_GetChanRxParamIdType`
```c
typedef uint16 WEthTrcv_GetChanRxParamIdType;
```
#### 8.2.6 `WEthTrcv_BandwidthType`
```c
typedef enum {
WETHTRCV_BANDWIDTH_10MHZ = 0,
WETHTRCV_BANDWIDTH_20MHZ
} WEthTrcv_BandwidthType;
```
#### 8.2.7 `WEthTrcv_TxPwrLvlType`
```c
typedef uint8 WEthTrcv_TxPwrLvlType; // 0..255
```
#### 8.2.8 `WEthTrcv_RssiType`
```c
typedef uint8 WEthTrcv_RssiType; // 0..255
```
#### 8.2.9 `WEthTrcv_RadioModeType`
```c
typedef enum {
WETHTRCV_RADIO_MODE_OFF = 0,
WETHTRCV_RADIO_MODE_ON,
WETHTRCV_RADIO_MODE_SLEEP
} WEthTrcv_RadioModeType;
```
### 8.3 函数定义
#### 8.3.1 `WEthTrcv_Init`
```c
void WEthTrcv_Init(const WEthTrcv_ConfigType* ConfigPtr);
```
**描述**:初始化所有配置的无线收发器。
**参数**
- `ConfigPtr`:指向配置数据的指针。
**返回值**:无。
#### 8.3.2 `WEthTrcv_SetTransceiverMode`
```c
Std_ReturnType WEthTrcv_SetTransceiverMode(
uint8 TrcvIdx,
EthTrcv_ModeType Mode
);
```
**描述**:设置收发器模式。
#### 8.3.3 `WEthTrcv_GetTransceiverMode`
```c
Std_ReturnType WEthTrcv_GetTransceiverMode(
uint8 TrcvIdx,
EthTrcv_ModeType* ModePtr
);
```
**描述**:获取当前收发器模式。
#### 8.3.4 `WEthTrcv_GetLinkState`
```c
Std_ReturnType WEthTrcv_GetLinkState(
uint8 TrcvIdx,
EthTrcv_LinkStateType* LinkStatePtr
);
```
**描述**:获取当前链路状态。
#### 8.3.5 `WEthTrcv_SetRadioParams`
```c
Std_ReturnType WEthTrcv_SetRadioParams(
uint8 TrcvIdx,
uint8 NumParams,
const WEthTrcv_SetRadioParamIdType* ParamIdListPtr,
const WEthTrcv_SetRadioParamValueType* ParamValueListPtr
);
```
**描述**:设置多个无线参数。
#### 8.3.6 `WEthTrcv_SetChanRxParams`
```c
Std_ReturnType WEthTrcv_SetChanRxParams(
uint8 TrcvIdx,
uint8 ChannelIdx,
uint8 NumParams,
const WEthTrcv_SetChanRxParamIdType* ParamIdListPtr,
const WEthTrcv_SetChanRxParamValueType* ParamValueListPtr
);
```
**描述**:设置指定接收信道的多个参数。
#### 8.3.7 `WEthTrcv_SetChanTxParams`
```c
Std_ReturnType WEthTrcv_SetChanTxParams(
uint8 TrcvIdx,
uint8 ChannelIdx,
uint8 NumParams,
const WEthTrcv_SetChanTxParamIdType* ParamIdListPtr,
const WEthTrcv_SetChanTxParamValueType* ParamValueListPtr
);
```
**描述**:设置指定发送信道的多个参数。
#### 8.3.8 `WEthTrcv_GetChanRxParams`
```c
Std_ReturnType WEthTrcv_GetChanRxParams(
uint8 TrcvIdx,
uint8 ChannelIdx,
uint8 NumParams,
const WEthTrcv_GetChanRxParamIdType* ParamIdListPtr,
WEthTrcv_GetChanRxParamValueType* ParamValueListPtr
);
```
**描述**:获取指定接收信道的多个参数。
#### 8.3.9 `WEthTrcv_GetVersionInfo`
```c
void WEthTrcv_GetVersionInfo(Std_VersionInfoType* VersionInfoPtr);
```
**描述**:返回 WEthTrcv 的版本信息。
### 8.4 回调通知
无显式回调;由配置决定。
### 8.5 中断服务例程
无显式 ISR;通过 EthIf / WEth 接收中断。
### 8.6 调度函数
#### 8.6.1 `WEthTrcv_MainFunction`
```c
void WEthTrcv_MainFunction(void);
```
**描述**:周期性处理收发器状态轮询、参数更新等。
**调度**:由 BSW 调度器调用(典型 10ms)。
### 8.7 期望的接口
#### 8.7.1 强制接口
| API | 描述 |
|---|---|
| `Det_ReportError` | 上报开发错误 |
| `Dem_SetEventStatus` | 上报生产错误 |
#### 8.7.2 可选接口
| API | 描述 |
|---|---|
| `Mcu_GetSystemClock` | 获取系统时钟 |
| `Port_SetPinDirection` | 引脚控制 |
#### 8.7.3 可配置接口
无。
---
## 9 时序图
> 摘要标记:本章包含约 5+ 个时序图。关键流程:
> - **图 1WEthTrcv 初始化**EcuM → `WEthTrcv_Init`。
> - **图 2:参数设置**`WEthTrcv_SetRadioParams` → 异步完成。
> - **图 3:信道参数配置**。
> - **图 4:模式切换**。
> - **图 5V2X 参数配置**。
---
## 10 配置规范
### 10.1 容器与配置参数
#### 10.1.1 `WEthTrcv`
顶层容器,唯一实例。
#### 10.1.2 `WEthTrcvConfigSet`
配置集容器。
#### 10.1.3 `WEthTrcvConfig`
| 参数 | 类型 | 描述 |
|---|---|---|
| `WEthTrcvIdx` | Integer | 收发器索引 |
| `WEthCtrlRef` | Reference | 关联的 WEth 控制器 |
| `WEthTrcvRadioRef` | Reference | 关联的无线电配置 |
| `WEthTrcvAntennaRef` | Reference | 关联的天线配置 |
| `WEthTrcvDemEventParameterRefs` | Reference | DEM 事件引用 |
#### 10.1.4 `WEthTrcvDemEventParameterRefs`
引用 DEM 事件。
#### 10.1.5 `WEthTrcvRadioConfigSet`
无线电配置集。
#### 10.1.6 `WEthTrcvRadioConfig`
| 参数 | 类型 | 描述 |
|---|---|---|
| `WEthTrcvRadioIdx` | Integer | 无线电索引 |
| `WEthTrcvRadioFreq` | Integer | 频率(MHz |
| `WEthTrcvRadioBandwidth` | Enum | 带宽 |
| `WEthTrcvRadioChannels` | Integer | 信道数 |
| `WEthTrcvRadioTxPower` | Integer | 发射功率(dBm |
| `WEthTrcvRadioMode` | Enum | 无线电模式 |
| `WEthTrcvChannelTxQueue` | Reference (multi) | 关联的信道发送队列 |
#### 10.1.7 `WEthTrcvRadioChannelTxQueueConfig`
| 参数 | 类型 | 描述 |
|---|---|
| `WEthTrcvChannelIdx` | Integer | 信道索引 |
| `WEthTrcvChannelTxPwrLvl` | Integer | 信道发射功率 |
| `WEthTrcvChannelTxQueuePriority` | Integer | 队列优先级 |
| `WEthTrcvChannelTxQueueLength` | Integer | 队列长度 |
#### 10.1.8 `WEthTrcvAntennaConfigSet`
天线配置集。
#### 10.1.9 `WEthTrcvAntennaConfig`
| 参数 | 类型 | 描述 |
|---|---|---|
| `WEthTrcvAntennaIdx` | Integer | 天线索引 |
| `WEthTrcvAntennaGain` | Integer | 天线增益(dBi |
| `WEthTrcvAntennaDiversity` | Boolean | 分集支持 |
#### 10.1.10 `WEthTrcvGeneral`
| 参数 | 类型 | 描述 |
|---|---|---|
| `WEthTrcvDevErrorDetect` | Boolean | 启用开发错误检测 |
| `WEthTrcvVersionInfoApi` | Boolean | 启用版本信息 API |
| `WEthTrcvIndex` | Integer | WEthTrcv 实例索引 |
| `WEthTrcvMulticoreSupport` | Boolean | 多核支持(4.4.0 草案) |
| `WEthTrcvMainFunctionPeriod` | Float | 主函数周期 |
### 10.2 发布信息
无附加发布参数。
---
## 11 不适用需求
无。
---
## 翻译说明
- 本文档基于 **AUTOSAR CP Release 4.4.0** 翻译,对应原文 `AUTOSAR_SWS_WirelessEthernetTransceiverDriver.pdf`50 页)。
- 关键翻译策略:
- **完整翻译**:封面、文档标识、变更历史、目录、章节 1-11 的所有正文、API 声明、错误分类、配置参数。
- **保留英文**:所有 API 名、类型名、模式名、配置参数标识符、需求 ID、IEEE 802.11 / ETSI 标准引用。
- **摘要标记**:第 6 章需求可追踪性表涵盖 20+ 项需求;第 9 章时序图列出 5 个关键图。完整内容请参见原文 PDF。
- 内容置信度:高。所有 API 签名、V2X 特定参数、信道配置、配置容器均已涵盖。