The UNICENS library distinguishes between synchronous and asynchronous returned results.
If a UNICENS API function detects an error the error is returned synchronously. For this purpose enumeration Ucs_Return_t is used. If no error has occurred UCS_RET_SUCCESS is returned.
Example:
The communication between the EHC and the INIC is an asynchronous process. If the EHC calls an INIC function the returned result is received asynchronously. Thus, most of the UNICENS API functions provide callback function pointers to receive INIC results/errors.
If the INIC returns an error, this information is mapped to a UNICENS standard result structure Ucs_StdResult_t.
The result codes are based on the INIC error codes and UNICENS specific result codes. The mapping of the INIC and the UNICENS codes are shown in the table below.
UNICENS Result Code | INIC Error Code | Description |
---|---|---|
UCS_RES_SUCCESS | - | Operation succeed, no error occurred |
UCS_RES_ERR_MOST_STANDARD | 0x01 | FBlock ID not available |
0x02 | Instance ID not available | |
0x03 | Function ID not available | |
0x04 | OP-Type not available | |
0x05 | Invalid length | |
0x06 | Parameter wrong/out of range | |
0x0C | Segmentation error | |
UCS_RES_ERR_BUSY | 0x20 | INIC function specific error with error class "Busy (0x01)". Process in INIC is currently busy. Retries are possible in a reasonable time. |
UCS_RES_ERR_PROCESSING | INIC function specific error with error class "Processing (0x02)". Process could not be finished. Retries are possible. | |
UCS_RES_ERR_CONFIGURATION | INIC function specific error with error class "Configuration (0x03)". Wrong configuration (values are temporarily out of range). Retries are not useful. | |
UCS_RES_ERR_SYSTEM | INIC function specific error with error class "System (0x04)". Current state of INIC or network prevents a successful execution of the process and retries are not possible. Retries are only possible when the state changes, but it is not clear when or if this happens (dynamic error). | |
UCS_RES_ERR_TIMEOUT | - | Timeout during operation |
UCS_RES_ERR_TRANSMISSION | - | Transmission error occurred on the MOST network |
If one of the errors above occurs, the raw INIC error data is stored in a byte stream referenced by pointer info_ptr
. Parameter size
represents the size of the INIC error data in bytes.
Example:
The INIC returns the following error:
The information is stored in variable my_result
which is from type Ucs_StdResult_t:
my_result.code: UCS_RES_ERR_CONFIGURATION
my_result.info_ptr[0]: 0x20
my_result.info_ptr[1]: 0x03
my_result.info_ptr[2]: 0x32
my_result.info_ptr[3]: 0x47
my_result.info_ptr[4]: 0x11
my_result.size: 5