172 lines
6.4 KiB
C
172 lines
6.4 KiB
C
/*
|
|
************************************************************************
|
|
**
|
|
** Copyright (c) 2009 by
|
|
** Core|Vision B.V.
|
|
** Cereslaan 10b
|
|
** 5384 VT Heesch
|
|
** The Netherlands
|
|
**
|
|
** All Rights Reserved
|
|
**
|
|
************************************************************************
|
|
*/
|
|
/*
|
|
************************************************************************
|
|
**
|
|
** Project name: Dual Inventive: Zelfsignalerende Kortsluit Lans
|
|
** Filename: i2c-errno.h
|
|
** Author: Jack Weeland
|
|
** Date: May 13, 2009
|
|
** File version: 1.00 of May 13, 2009
|
|
**
|
|
************************************************************************
|
|
*/
|
|
/*
|
|
************************************************************************
|
|
**
|
|
** I2C and SPI errors
|
|
** Historically named I2CERROR_xxx
|
|
**
|
|
************************************************************************
|
|
*/
|
|
|
|
#ifndef _I2C_ERRNO_H
|
|
#define _I2C_ERRNO_H
|
|
|
|
// I2C, SPI or SD-card errors
|
|
#define I2CERROR_NO_ERROR 0
|
|
#define I2CSTAT_OK 0
|
|
#define I2CSTAT_BUSY -1 // (not a real error)
|
|
#define I2CERROR_BUS -2 // generic bus error
|
|
#define I2CERROR_BUS_TIMEOUT -3 // time-out while accessing the I2C bus
|
|
#define I2CERROR_MASTER -4 // generic failure of the master
|
|
#define I2CERROR_MASTER_TIMEOUT -5 // master s/m or transfer timed out
|
|
#define I2CERROR_SLAVE -6 // generic failure of the slave or SD-card
|
|
#define I2CERROR_SLAVE_TIMEOUT -7 // time-out accessing or waiting for a slave
|
|
#define I2CERROR_DATA -8 // generic data error (not enough bytes)
|
|
#define I2CERROR_CRC -9 // parity or CRC error (SD-card access)
|
|
#define I2CERROR_PARITY (I2CERROR_CRC)
|
|
|
|
// software errors
|
|
#define I2CERROR_BUSY -12 // (software) busy while this was not expected
|
|
#define I2CERROR_BUFFER_OVERRUN -13 // (software) buffer overrun
|
|
#define I2CERROR_BUFFER_UNDERRUN -14 // (software) buffer contains too little data
|
|
#define I2CERROR_WRONG_STATE -15 // (software) state machine is not idle or in the
|
|
// wrong state in general (e.g. hibernating)
|
|
|
|
#define I2CERROR_RETRY -30 // action is retried
|
|
#define I2CERROR_INIT_TIMEOUT -31 // initialization timed out
|
|
#define I2CERROR_ERROR -32 // unspecified error
|
|
#define I2CERROR_STATE -33 // invalid/unknown/unexpected state
|
|
#define I2CERROR_INVAL -34 // invalid parameter
|
|
#define I2CERROR_NOSUPP -35 // operation not supported
|
|
#define I2CERROR_NO_DEVICE -36 // slave does not respond and is probably not
|
|
// present or defective
|
|
#define I2CERROR_WRONG_VERSION -37 // wrong software or log version
|
|
#define I2CERROR_BAD_TIME -38 // date/time is invalid
|
|
|
|
// SPI or SD-card errors
|
|
#define SDSTAT_OK (I2CSTAT_OK)
|
|
#define SDSTAT_BUSY (I2CSTAT_BUSY)
|
|
#define SDERROR_BUS (I2CERROR_BUS)
|
|
#define SDERROR_BUS_TIMEOUT (I2CERROR_BUS_TIMEOUT)
|
|
#define SDERROR_SLAVE (I2CERROR_SLAVE)
|
|
#define SDERROR_SLAVE_TIMEOUT (I2CERROR_SLAVE_TIMEOUT)
|
|
#define SDERROR_DATA (I2CERROR_DATA)
|
|
#define SDERROR_CRC (I2CERROR_CRC)
|
|
#define SDERROR_BUS_BUSY -10 // SPI bus or SPI state machine is busy
|
|
#define SDERROR_WRITE -11 // SD-card write error
|
|
|
|
// SD-card specific errors
|
|
#define SDERROR_NO_CARD -16 // No card detected
|
|
#define SDERROR_INVALID_CARD -17 // Card is not usable (wrong voltage range or other error)
|
|
#define SDERROR_INVALID_CMD -18 // invalid command
|
|
|
|
// Config file errors
|
|
#define FILEERROR_INVAL -64 // Invalid argument
|
|
#define FILEERROR_PARAM -65 // Invalid parameter name
|
|
#define FILEERROR_SECTION -66 // Invalid section name
|
|
#define FILEERROR_EOF -67 // Unexpected end of file
|
|
#define FILEERROR_INCORRECT_FORMAT -68 // File has incorrect format or is invalid
|
|
|
|
/*
|
|
** String table with the errors as strings, if so enabled; indexed by '-error_code'
|
|
*/
|
|
#ifdef _I2C_ERRNO_DEFINE_STRINGTABLE
|
|
|
|
#define I2C_ERRSZ 256
|
|
|
|
static const char *I2C_ERRSTR[I2C_ERRSZ] =
|
|
{
|
|
"I2CERROR_NO_ERROR", // 0
|
|
"I2CERROR", // -1 - old style error
|
|
"I2CERROR_BUS", // -2
|
|
"I2CERROR_BUS_TIMEOUT", // -3
|
|
"I2CERROR_MASTER", // -4
|
|
"I2CERROR_MASTER_TIMEOUT", // -5
|
|
"I2CERROR_SLAVE", // -6
|
|
"I2CERROR_SLAVE_TIMEOUT", // -7
|
|
"I2CERROR_DATA", // -8
|
|
"I2CERROR_CRC", // -9
|
|
"SDERROR_BUS_BUSY", // -10
|
|
"SDERROR_WRITE", // -11
|
|
"I2CERROR_BUSY", // -12
|
|
"I2CERROR_BUFFER_OVERRUN", // -13
|
|
"I2CERROR_BUFFER_UNDERRUN", // -14
|
|
"I2CERROR_WRONG_STATE", // -15
|
|
"SDERROR_NO_CARD", // -16
|
|
"SDERROR_INVALID_CARD", // -17
|
|
"SDERROR_INVALID_CMD", // -18
|
|
"", // -19
|
|
"", "", "", "", // -20 .. -23
|
|
"", "", "", "", "", "", // -24 .. -29
|
|
"I2CERROR_RETRY", // -30
|
|
"I2CERROR_INIT_TIMEOUT", // -31
|
|
"I2CERROR_ERROR", // -32
|
|
"I2CERROR_STATE", // -33
|
|
"I2CERROR_INVAL", // -34
|
|
"I2CERROR_NOSUPP", // -35
|
|
"I2CERROR_NO_DEVICE", // -36
|
|
"I2CERROR_WRONG_VERSION", // -37
|
|
"I2CERROR_BAD_TIME", // -38
|
|
"", // -39..
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", // .. -63
|
|
"FILEERROR_INVAL", // -64
|
|
"FILEERROR_PARAM", // -65
|
|
"FILEERROR_SECTION", // -66
|
|
"FILEERROR_EOF", // -67
|
|
"FILEERROR_INCORRECT_FORMAT", // -68
|
|
"", // -69
|
|
"", // -70
|
|
"", // -71
|
|
"", "", "", "", "", "", "", "", // -72 ..
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", // .. -127
|
|
"", "", "", "", "", "", "", "", // -128 ..
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "", //
|
|
"", "", "", "", "", "", "", "" // .. -255
|
|
};
|
|
|
|
#endif /* _I2C_ERRNO_DEFINE_STRINGTABLE */
|
|
#endif /* _I2C_ERRNO_H */
|