- 引言
我们知道AUTOSAR OS规范是在OSEK OS基础上补充完善实现的,在OSEK OS规范中对带状态返回值的API进行了约束,类型为StatusType,正常情况下返回值为E_OK,定义E_OK为0,其他若干非正常情况进行了归类并分别统一了错误码形式,AUTOSAR OS在其基础上进行了补充,也就是说在每个API中什么情况下该回什么样的错误码是已规定的,本文将所有错误码进行总结。
其中 OSEK OS相关内容如下:
StatusType
This data type is used for all status information the API services offer. Naming convention:
all errors for API services start with E_. Those reserved for the operating system will begin
with E_OS_.
The normal return value is E_OK which is associated with the value 0.
The following error values are defined:
All errors of API services:
• E_OS_ACCESS = 1,
• E_OS_CALLEVEL = 2,
• E_OS_ID = 3,
• E_OS_LIMIT = 4,
• E_OS_NOFUNC = 5,
• E_OS_RESOURCE = 6,
• E_OS_STATE = 7,
• E_OS_VALUE = 8
If the only possible return status is E_OK, the implementation is free not to return a status;
this is not separately stated in the description of the individual services.
Internal errors of the operating system:
These errors are implementation specific and not part of the portable section. The error names
reside in the same name-space as the errors for API services mentioned above. The
implementations has to ensure that the range of numbers does not overlap.
To show the difference in use, the names internal errors shall start with E_OS_SYS_
- 错误码
序号 | 错误码 | 描述 |
1 | E_OS_ACCESS | Access to the service/object denied |
2 | E_OS_CALLEVEL | Access to the service from the ISR is not permitted |
3 | E_OS_ID | Object ID is invalid |
4 | E_OS_LIMIT | Limit of services/objects exceeded |
5 | E_OS_NOFUNC | The object is not used, service rejected |
6 | E_OS_RESOURCE | Task still occupies resource |
7 | E_OS_STATE | The state of the object is not correct for the required service |
8 | E_OS_VALUE | Value outside of the admissible limit |
9 | E_OS_STACKFAULT | A stack fault detected via stack monitoring by the OS |
10 | E_OS_PARAM_POINTER | A pointer argument OS an API is null |
11 | E_OS_DISABLEDINT | A service of the OS is called inside an interrupt disable/enable pair |
12 | E_OS_SERVICEID | Service can not be called |
13 | E_OS_ILLEGAL_ADDRESS | An invalid address is given as a parameter to a service |
14 | E_OS_MISSINGEND | Tasks terminates without a TerminateTask() or ChainTask() call |
15 | E_OS_PROTECTION_MEMORY | A memory access violation occurred |
16 | E_OS_PROTECTION_TIME | A Task/Category 2 ISR exceeds its execution time budget |
17 | E_OS_PROTECTION_ARRIVAL | A Task/Category 2 ISR arrives before its timeframe has expired |
18 | E_OS_PROTECTION_LOCKED | A Task/Category 2 ISR blocks for too long |
19 | E_OS_PROTECTION_EXCEPTION | A trap occurred |
20 | E_OS_CORE | Core is not available |
21 | E_OS_SPINLOCK | De-scheduling with occupied spinlock |
22 | E_OS_INTERFERENCE_DEADLOCK | Deadlock situation due to interference |
23 | E_OS_NESTING_DEADLOCK | Potential deadlock due to wrong nesting |
更多内容 欢迎关注我的公众号 任何技术问题一起讨论