AUTOSAR OS學習筆記2-錯誤碼

 

  1. 引言

我們知道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. 錯誤碼

序號

錯誤碼

描述

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

更多內容 歡迎關注我的公衆號 任何技術問題一起討論

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章