vcan_errcodes ============= Here is the definition:: typedef enum { VCAN_NO_ERROR = 0, VCAN_PORT_ERR = 1, /* port-number out of range */ VCAN_ID_ERR = 2, /* (message-) id out of range */ VCAN_NOT_OWNER_ERR = 3, /* thread is not owner of the object */ VCAN_INUSE_ERR = 4, /* the CAN object is "in use by the same thread"*/ VCAN_TID_ERR = 5, /* invalid thread-id (tid) */ VCAN_TX_TM_OUT = 6, /* timeout during transmission or remote- transfers */ VCAN_UNKNOWN_TX_ERR = 7, /* unknown transmission error */ VCAN_OFF_BUS_ERR = 8, /* can card is off-bus */ VCAN_BUSY_ERR = 9, /* the mysterious "busy" error */ VCAN_NO_NET_ERR =10, /* tried to access a non-existing net */ VCAN_SIZE_ERR =11, /* datasize>8 or datasize <0 in call to a write-function */ VCAN_WRONG_MODE_ERR =12, /* read on a write-object, write on a read-object and so on ... */ VCAN_WRONG_SIGNAL_ERR=13, /* only SIGUSR1 and SIGUSR2 are allowed as signals */ VCAN_OBJECT_OWNED_ERR=14, /* tried an operation on an owned object that is only allowed on unowned objects */ VCAN_COMMAND_ERR =15, /* general command error (signaled from hardware, no special reason known) */ VCAN_UNKNOWN_MODE_ERR=16, /* tried to set an unknown mode for an object */ VCAN_BITRATE_ERR =17, /* tried to set an unsupported bitrate */ VCAN_AUTHORIZE_ERR =18, /* authorization error, tried to initialize the card with the tid!=0 */ VCAN_STATUS_TAG_ERR =19, /* unknown status-tag */ VCAN_SET_IRQ_ERR =20, /* internal error, returned by set_interrupt() */ VCAN_R_OFFSET_ERR =21, /* offset error during pbuffer-dump (see VCAN_READ_PBUFFER) */ VCAN_R_SIZE_ERR =22, /* size-error during pbuffer-dump (see VCAN_READ_PBUFFER) */ VCAN_CHK_STATUS_ERR =23, /* internal error in the check_status- function */ VCAN_CANCMD_ERR =24, /* internal error in the can_command- function */ VCAN_TOO_MANY_IDS_ERR=25, /* too many object-id's given in vcan_read_many() */ VCAN_WRONG_TMOUT_ERR =26, /* timeout-value is out of range (0..32767) */ VCAN_RESET_ERR =27, /* reset of the VME-CAN2 card failed */ /* error codes from other modules follow: */ VCAN_TAG_ERR =28, /* in module UI: wrong tag has been used for reading or writing */ VCAN_SEM_POOL_ERR =29, /* internal semaphore-pool is exhausted */ VCAN_Q_EMPTY_ERR =30, /* internal event-queue is empty (vcan_queue_read)*/ VCAN_LAST_ERRCODE =30 /* !!Attention!! this should be the last used errorcode, this is needed by applications that create an array for all error-codes */ } vcan_errcodes; This is the data type of the driver's error-codes. Driver calls usually return flags, if the ``VCAN_ACCESS_ERR`` - flag is set, there is also an error-code. Both, the ``vcan_request`` - structure and the ``vcan_status_data`` - structure contain a field of the type ``vcan_errcodes``. Short explanation of the error-codes: VCAN_NO_ERROR no error occurred VCAN_PORT_ERR the given port-number was out of range. Port-numbers begin with 0 and may range to 7. During initialization, the VCAN driver searches for up to 4 cards and creates an internal list of valid ports. Each VME-CAN2 card in a system is jumpered for a unique card-number that ranges from 0 to 3. The port-numbers for a specific card are *(card_number)\*2* and *(card_number)\*2+1*. A port-number is invalid if it is outside the range of 0 to 7 or of the corresponding card was not found during driver-initialization. VCAN_ID_ERR The CAN object ID was out of range, only numbers between 0 and 2047 are valid. VCAN_NOT_OWNER_ERR An attempt was made to access a CAN object which is not owned by the thread. VCAN_INUSE_ERR There was an access to a remote-read object although this object is currently accessed by another task. This can only happen when 2 tasks use the same driver-handle since vcan distinguishes tasks by their driver-handles. Accessing vcan by 2 tasks which use the same driver-handle is done by the LowCAL CAN-bus protocol (a BESSY development). Note that the driver currently makes the in-use-check only for remote-read objects due to performance considerations. VCAN_TID_ERR The thread-Id is invalid. The thread-Id is an internal number that identifies a user-thread. It is stored within the file-handle that the ``open`` function returns. This error should only happens when an invalid file-handle was used or when the file-handle structure was patched. VCAN_TX_TM_OUT A timeout occured while writing to the CAN bus. This error can also occur with remote-transfers (remote-read) since there is a *sending* of a remote-frame involved. VCAN_UNKNOWN_TX_ERR unknown transmission error (shouldn't happen) VCAN_OFF_BUS_ERR the CAN controller is in the off-bus state. VCAN_BUSY_ERR the CAN chip on the card is busy. This usually happens when a CAN-write failed and an attempt is made to write a second time. The CAN chip is then busy trying to finish the first writing. VCAN_NO_NET_ERR an attempt was made to write to a non-existent net VCAN_SIZE_ERR the size of the data (length) was not within the range of 0 to 8. VCAN_WRONG_MODE_ERR An object was used with a function that is incompatible to it's type, e.g a CAN-write was applied to a read-object. VCAN_WRONG_SIGNAL_ERR A wrong signal-number (this concerns only event-objects) was given. The signal-number must be 0 or 1. VCAN_OBJECT_OWNED_ERR An attempt was made to perform a function on an owned object that is only allowed on unowned object, e.g ``VCAN_INIT`` was tried with an object that is already initialized. VCAN_COMMAND_ERR A command to the VME-CAN2 could not be performed, this is an error detected by the VME-CAN2 card. VCAN_UNKNOWN_MODE_ERR An attempt was made to define an object with an unknown mode. VCAN_BITRATE_ERR An attempt was made to set a bitrate for the CAN bus that is not supported by the VME-CAN2 card. VCAN_AUTHORIZE_ERR A thread tried to initialize or reset the CAN card whose (driver-)thread id is unequal to 0. Only the first thread that opened the vcan-driver has thread id 0 and is authorized to initialize or reset the card. VCAN_STATUS_TAG_ERR The status-tag is of an unknown value. VCAN_SET_IRQ_ERR This is an internal error, the internal function ``set_interrupt`` failed. VCAN_R_OFFSET_ERR The offset for the p-buffer dump was wrong. VCAN_R_SIZE_ERR The size for the p-buffer dump was wrong. VCAN_CHK_STATUS_ERR This is an internal error in the internal check-status function. VCAN_CANCMD_ERR This is an internal error in the internal can-command function. VCAN_TOO_MANY_IDS_ERR Too many object-id's were given to the ``VCAN_READ_MANY`` - function. VCAN_WRONG_TMOUT_ERR The given timeout is out of range, valid timeouts are between 0 and 32767. VCAN_RESET_ERR The reset of the VME-CAN2 card failed. VCAN_TAG_ERR A wrong tag has been used for reading or writing. VCAN_SEM_POOL_ERR The internal semaphore-pool is exhausted, this happens when many threads (more than 32) access the driver at a time. VCAN_Q_EMPTY_ERR The internal event queue is empty, this is an internal error and should not happen. VCAN_LAST_ERRCODE This is no error but the last element of the ``vcan_errcodes`` - type. This is needed by applications that need to know how what the number of the last error-code of the vcan driver is.