Moved remotely
git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@113 9fe90eed-be63-e94b-8204-d34ff4c2ff93
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* can.h (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description:
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Feb 11, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef CAN_H_
|
||||
#define CAN_H_
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/* Hardware Includes */
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Constant and macro definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
// Maximum number of total FullCAN Filters for ALL CAN interfaces
|
||||
#define MAX_FILTERS 20
|
||||
|
||||
// Define CAN SFR address bases
|
||||
#define CAN_REG_BASE (0xE0000000)
|
||||
#define ACCEPTANCE_FILTER_RAM_BASE (CAN_REG_BASE + 0x00038000)
|
||||
#define ACCEPTANCE_FILTER_REGISTER_BASE (CAN_REG_BASE + 0x0003C000)
|
||||
#define CENTRAL_CAN_REGISTER_BASE (CAN_REG_BASE + 0x00040000)
|
||||
|
||||
// Common CAN bit rates
|
||||
#define CANBitrate50_12MHz 0x001C000E
|
||||
#define CANBitrate125k_12MHz 0x001C0005
|
||||
#define CANBitrate250k_12MHz 0x001C0002
|
||||
|
||||
// CAN Interrupt Service Routines
|
||||
void CAN_IRS_Handler (void) __attribute__ ((naked, interrupt("IRQ")));
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Type definitions.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
// Type definition to hold a FullCAN message
|
||||
// Compatible to FullCAN Mode Stored Messages in LPC User Manual
|
||||
typedef struct
|
||||
{
|
||||
UINT32 Dat1; // Bits 0..10: CAN Message ID
|
||||
// Bits 13..15: CAN interface number (1..4)
|
||||
// Bits 16..19: DLC - Data Length Counter
|
||||
// Bits 24..25: Semaphore bits
|
||||
UINT32 DatA; // CAN Message Data Bytes 0-3
|
||||
UINT32 DatB; // CAN Message Data Bytes 4-7
|
||||
} CAN_MSG;
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Variable declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Function declarations.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
UINT16 CANInit (
|
||||
UINT32 can_btr /* CAN Baud Rate setting */
|
||||
);
|
||||
|
||||
|
||||
UINT16 CANSetFilter
|
||||
(
|
||||
UINT32 CANID // 11-bit CAN message identifier
|
||||
);
|
||||
|
||||
|
||||
|
||||
UINT16 CANPushMessage (
|
||||
CAN_MSG *pTransmitBuf // Source pointer to a CAN message
|
||||
);
|
||||
|
||||
|
||||
UINT16 CANPullMessage (
|
||||
CAN_MSG *pReceiveBuf // Destination pointer to a CAN message
|
||||
);
|
||||
|
||||
|
||||
void CAN_CANISR_Rx1 (void);
|
||||
void CAN_CANISR_Rx2 (void);
|
||||
void CAN_CANISR_Err (void);
|
||||
void CAN_ERRORBUS (void);
|
||||
|
||||
|
||||
|
||||
#endif /*CAN_H_*/
|
||||
Reference in New Issue
Block a user