//*****************************************************************************
//
// CAN.h - Stellaris development board Peripheral Device Controller definitions
//         and prototypes.
//
// Copyright (c) 2005-2008 Luminary Micro, Inc.  All rights reserved.
// 
// Software License Agreement
// 
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
// exclusively on LMI's microcontroller products.
// 
// The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws.  All rights are reserved.  You may not combine
// this software with "viral" open-source software in order to form a larger
// program.  Any use in violation of the foregoing restrictions may subject
// the user to criminal sanctions under applicable laws, as well as to civil
// liability for the breach of the terms and conditions of this license.
// 
// THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
// 
// This is part of revision 3416 of the Stellaris Peripheral Driver Library.
//
//*****************************************************************************

#ifndef __CANdriver_H__
#define __CANdriver_H__



//****************************************************************************
//
// These are the message identifiers
//
//**************************************************************************** 
#define CAN_MSGOBJ_STATUS      0x01	// This is the status message
#define CAN_MSGOBJ_SETTINGS    0x02	// This is the settings message
#define CAN_MSGOBJ_DATA        0x03	// This is the data message 
#define CAN_MSGOBJ_RESET_REQ   0xA1	// This is the message for reset request
#define CAN_MSGOBJ_STATUS_REQ  0xA2	// This is the status message

#define CURRENT_VERSION         0x00000001  // These is the valid 4 byte response to a ping request.


//*****************************************************************************
//
// The set of GPIO pins that will be used for the CAN peripherial
//
//*****************************************************************************
#define CAN_PINS  (GPIO_PIN_4 | GPIO_PIN_5)


//*****************************************************************************
//
// The index into CANBitClkSettings to use to get the baud clock
// settings.
//
//*****************************************************************************
#define CANBAUD_125K            0
#define CANBAUD_250K            1
#define CANBAUD_500K            2
#define CANBAUD_1M              3

  
//*****************************************************************************
//
//  Public function prototypes
//
//*****************************************************************************
extern void CANInitialize(void);
extern void CANSendMessage(char const *data);
extern void CANProcessCmd(void);

//*****************************************************************************
//
//  Private function prototypes
//
//*****************************************************************************
void CANIntHandler(void);
void CANConfigureNetwork();




#endif // __CANdriver_H__
