Overview

This group defines additional CSI specific function return and error codes for the CSI API functions.

All common error codes are defined in err_codes.h

Note
Please remember that all error codes will be returned as negative values. I.e. the error code CSI_ERR_ACC_TOGGLE_BIT will be returned as -CSI_ERR_ACC_TOGGLE_BIT (0xFAFD0000)
+ Collaboration diagram for Error Handling:

Modules

 CANopen-specific error codes
 
 maxon specific error codes
 

Functions

CSI_API const char * CsiErrorToString (long ErrCode)
 This function converts error code into error string. More...
 

Function Documentation

CSI_API const char* CsiErrorToString ( long  ErrCode)

This function converts error code into error string.

Parameters
[in]ErrCodeNumeric error code to convert into error message string
Returns
Error string
84 {
85  int32_t middle;
86  int32_t left = 0;
87  int32_t right = (sizeof(CsiErrMsgTbl) / sizeof(TCsiErrTblEntry)) - 1;
88 
89  //
90  // we need absolute value
91  //
92  if (ErrNum < 0)
93  {
94  ErrNum = 0 - ErrNum;
95  }
96 
97  //
98  // We do a binary search here to be fast
99  //
100  while (left <= right)
101  {
102  middle = (left + right) / 2;
103  if (CsiErrMsgTbl[middle].ErrId < ErrNum)
104  {
105  left = middle + 1;
106  }
107  else if (CsiErrMsgTbl[middle].ErrId > ErrNum)
108  {
109  right = middle - 1;
110  }
111  else
112  {
113  return CsiErrMsgTbl[middle].ErrMsg;
114  }
115  }
116 
117  return ErrorToString(ErrNum);
118 }
static const TCsiErrTblEntry CsiErrMsgTbl[CSI_ERR_MSG_TBL_SIZE]
Table of error messages.
Definition: csi_err.c:39
const char * ErrorToString(TErrCode ErrNum)
This function converts error code into error string.
Definition: err_codes.c:22
Single entry in error message table.
Definition: csi_err.c:29
char * ErrMsg
error message
Definition: csi_err.c:32

+ Here is the call graph for this function: