Subversion Repositories HomeAutomation

Rev

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

  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.  * @brief Return values.
  21.  *
  22.  * CAN Return Type. Most CAN functions return one of these.
  23.  */
  24. typedef enum {
  25.     CAN_FAIL = -1,              /**< The function failed. */
  26.     CAN_OK = 1,                 /**< The function succeeded. */
  27.    
  28.     CAN_MSG_AVAILABLE = 2,      /**< Messsages are available. */
  29.     CAN_NO_MSG_AVAILABLE = -2,  /**< Messages are NOT available. */
  30.    
  31. } Can_Return_t;
  32.  
  33. /**
  34.  * @brief Message structure.
  35.  *
  36.  * CAN Message Type. Stores a complete CAN frame.
  37.  */
  38. typedef struct {
  39.     uint32_t Id;                /**< ID section. Contains either 29bit ID or 11bit ID (depending on ExtendedFlag). */
  40.     uint8_t DataLength;         /**< DLC section. Contains the data length expressed in number of bytes. Range [0,8]. */
  41.     uint8_t ExtendedFlag;       /**< Extended frame flag. Set to 1 if the ID is 29bit, or 0 if it is 11bit. */
  42.     uint8_t RemoteFlag;         /**< Remote frame flag. Set to 1 if the frame is a remote frame. 0 otherwise. */
  43.    
  44.     /**
  45.      * DATA section. Contains the 8 data bytes.
  46.      */
  47.     union {
  48.         uint8_t bytes[8];       /**< read as 8bit unsigned data */
  49.         uint16_t words[4];      /**< read as 16bit unsigned data */
  50.         uint32_t dwords[2];     /**< read as 32bit unsigned data */
  51.     } Data;
  52. } Can_Message_t;
  53.  
  54. #endif /*CAN_H_*/
  55. //---------------------------------------------------------------------------
  56. // Public declarations for the exported interface
  57.  
  58. void BIOS_Reset(void);
  59. Can_Return_t BIOS_CanSend(Can_Message_t* msg);
  60. void (*BIOS_CanCallback)(Can_Message_t *msg);
  61.  
  62. #endif /*BIOS_H_*/
  63.