72 lines
2.5 KiB
C
Executable file
72 lines
2.5 KiB
C
Executable file
#pragma once
|
|
|
|
/*
|
|
* unierror.h
|
|
*
|
|
* Universelle sprechende Fehlercodes
|
|
*
|
|
*
|
|
*
|
|
*/
|
|
#include <stdint.h>
|
|
|
|
/* Definition des 32Bit Fehlermodell */
|
|
union _ue_code {
|
|
int32_t code32;
|
|
struct {
|
|
union {
|
|
uint16_t code16;
|
|
struct {
|
|
uint32_t code15:15; // Fehlercode
|
|
uint32_t knowncode:1; // 1=Definierter Standardfehlercode, 0=Benutzerdefinierter Fehlercode
|
|
};
|
|
};
|
|
uint32_t locator:9; // Lokalisation der Ursache
|
|
uint32_t location:3; // Art der Lokalisationsangabe
|
|
|
|
uint32_t family:4; // Error Family
|
|
};
|
|
};
|
|
typedef union _ue_code UECODE;
|
|
|
|
#define UNIERROR(fam,loc,loc2,k,c15) ((UECODE){family: fam, location: loc, locator: loc2, knowncode: k, code15: c15})
|
|
|
|
|
|
/* Fehlerfamilien */
|
|
#define UEF_NONE 0x00 // Keine bekannte Familie
|
|
#define UEF_ELECTRICAL 0x01 // Elektrischer Fehler
|
|
#define UEF_MECHANICAL 0x02 // Mechanischer Fehler
|
|
#define UEF_LOGICAL 0x03 // Logischer Fehler
|
|
#define UEF_SOFTWARE 0x04 // Software Fehler (z.B. Prüfsummenfehler, Crash, etc.)
|
|
#define UEF_API 0x05 // API Fehlercode (E...)
|
|
|
|
#define UEF_WARNING 0x08 // Fehler ist nicht Fatal, Fehler beschreibt eine Warnung, Es wurde keine Fehlerreaktion ausgeführt
|
|
|
|
/* Fehler Locationcodes */
|
|
#define UEL_UNKNOWN 0x00 // unbekannter Auslöser
|
|
#define UEL_INTERNAL 0x01 // der Fehler wurde in Software ausgelöst (z.B. Exception, Prüfsummencheck)
|
|
#define UEL_ASSEMBLY 0x02 // der Fehler wurde durch eine Komponente innerhalb der Baugruppe/Elektronik ausgelöst
|
|
#define UEL_EXTERNAL 0x03 // der Fehler wurde von Aussen ausgelöst (Sensor, Signal)
|
|
|
|
/* Fehlercodes der Familie UEF_ELECTRICAL */
|
|
#define UE_SHORT_GROUND 0x0001 // Kurzschluss nach Masse
|
|
#define UE_SHORT_VPLUS 0x0002 // Kurzschluss zu V+
|
|
|
|
#define UE_LIMIT_LOW 0x0010 // Grenzwertunterschreitung nach "unten"
|
|
#define UE_LIMIT_HIGH 0x0011 // Grenzwertüberschreitung nach "oben"
|
|
|
|
/* Fehlercodes der Familie UEF_MECHANICAL */
|
|
#define UE_BLOCKED 0x0001 // Bewegliches Teil ist mechanisch blockiert
|
|
#define UE_FRICTION 0x0002 // Erhöhter (Reibungs-)widerstand wurde festgestellt
|
|
|
|
#define UE_CONNECTION_LOST 0x0010 // Mechanische Verbindung ist gelöst
|
|
#define UE_BODY_OPEN 0x0011 // Gehäuse ist offen / nicht betriebsicher geschlossen
|
|
|
|
/* Fehlercodes der Familie UEF_LOGICAL */
|
|
#define UE_TIMEOUT 0x0001 // Maximale Wartezeit wurde überschritten
|
|
#define UE_PLAUSIBILITY 0x0002 // Signale / Eingabewerte sind nicht plausibel bzw. sind widersprüchlich
|
|
|
|
/* Fehlercodes der Familie UEF_SOFTWARE */
|
|
#define UE_CHECKSUM 0x0001 // Prüfsummenfehler
|
|
|