Subversion Repositories HomeAutomation

Rev

Details | Last modification | View Log | SVN | RSS feed

Rev Author Line No. Line
391 eqlazer 1
/* This file is automatically generated. Do not edit. */
2
 
3
#ifndef BIOS_H_
4
#define BIOS_H_
5
 
6
#ifndef CAN_H_
7
#define CAN_H_
8
 
9
/*-----------------------------------------------------------------------------
10
 * Includes
11
 *---------------------------------------------------------------------------*/
12
#include <inttypes.h>
13
#include <drivers/can/canid.h>
14
 
15
/*-----------------------------------------------------------------------------
16
 * Type Definitions
17
 *---------------------------------------------------------------------------*/
18
 
19
/**
20
 * CAN Return Type. Most CAN functions return one of these.
21
 */
22
typedef enum {
23
    CAN_FAIL = -1,                  /* The function failed */
24
    CAN_OK = 1,                     /* The function succeeded */
25
 
26
    CAN_MSG_AVAILABLE = 2,          /* Messsages are available */
27
    CAN_NO_MSG_AVAILABLE = -2,      /* Messages are NOT available */
28
 
29
    //CAN_CTRLERROR = -4
30
} Can_Return_t;
31
 
32
/**
33
 * CAN Message Type. Stores a complete CAN frame.
34
 */
35
typedef struct {
36
    /*
37
     * ID section. Contains either 29bit ID or 11bit ID (depending on ExtendedFlag).
38
     */
39
    uint32_t Id;
40
 
41
    /*
42
     * DLC section. Contains the data length expressed in number of bytes. Range [0,8].
43
     */
44
    uint8_t DataLength;
45
 
46
    /**
47
     * Extended frame flag. Set to 1 if the ID is 29bit, or 0 if it is 11bit.
48
     */
49
    uint8_t ExtendedFlag;
50
 
51
    /**
52
     * Remote frame flag. Set to 1 if the frame is a remote frame. 0 otherwise.
53
     */
54
    uint8_t RemoteFlag;
55
 
56
    /*
57
     * DATA section. Contains the 8 data bytes.
58
     */
59
    union {
60
        /* read as 8bit unsigned data */
61
        uint8_t bytes[8];
62
 
63
        /* read as 16bit unsigned data */
64
        uint16_t words[4];
65
 
66
        /* read as 32bit unsigned data */
67
        uint32_t dwords[2];
68
    } Data;
69
} Can_Message_t;
70
 
71
#endif /*CAN_H_*/
72
//---------------------------------------------------------------------------
73
// Public declarations for the exported interface
74
 
75
void BIOS_Reset(void);
76
Can_Return_t BIOS_CanSend(Can_Message_t* msg);
77
void (*BIOS_CanCallback)(Can_Message_t *msg);
78
 
79
#endif /*BIOS_H_*/