#include "hal_machperiph.h"
#include "cpu_def.h"
#include "system_def.h"
+
+#include "can/can.h"
#include "can/canmsg.h"
#ifdef __cplusplus
#define CAN1TDB3 (*(uint32_t*)(CAN1_REGS_BASE+CAN_TDB3_o))
+//----------------------------------
+
+//CAN Interrupt and Capture Register bits
+#define CAN_ICR_TI1 (1<<1)
+
+//CAN Status Register bits
+#define CAN_SR_TBS1 (1<<2)
+
+//CAN Command Register bits
+#define CAN_CMR_TR (1<<0)
+#define CAN_CMR_AT (1<<1)
+#define CAN_CMR_RRB (1<<2)
+#define CAN_CMR_CDO (1<<3)
+#define CAN_CMR_STB1 (1<<5)
+
+//CAN Transmit Frame Information register 1 bits
+#define CAN_TFI1_RTR (1<<30)
+#define CAN_TFI1_EXT (1<<31)
+
+//CAN Interrupt Enable Register bits
+#define CAN_IER_TIE1 (1<<1)
+
//----------------------------------
#define PCONP SC->PCONP
void CAN_init(uint32_t baudrate);
void CAN_send(canmsg_t* msg);
+void CAN_IRQHandler(void);
+
+//----------------------------------
+
+struct can_lmc1_chip_data
+{
+ int flags;
+};
+
+// board can-lmc1 specific functions:
+int can_lmc1_register(struct hwspecops_t *hwspecops);
+int can_lmc1_init_hw_data(struct candevice_t *candev);
+int can_lmc1_init_chip_data(struct candevice_t *candev, int chipnr);
+int can_lmc1_init_obj_data(struct canchip_t *chip, int objnr);
+void can_lmc1_write_register(unsigned data, unsigned long address);
+unsigned can_lmc1_read_register(unsigned long address);
+int can_lmc1_request_io(struct candevice_t *candev);
+int can_lmc1_reset(struct candevice_t *candev);
+
+// lpc17xx can chip specific functions:
+int lpc17xx_chip_config(struct canchip_t *chip);
+int lpc17xx_pre_write_config(struct canchip_t *chip, struct msgobj_t *obj,
+ struct canmsg_t *msg);
+int lpc17xx_send_msg(struct canchip_t *chip, struct msgobj_t *obj,
+ struct canmsg_t *msg);
+int lpc17xx_wakeup_tx(struct canchip_t *chip, struct msgobj_t *obj);
+int lpc17xx_irq_handler(int irq, struct canchip_t *chip);
+void lpc17xx_irq_write_handler(struct canchip_t *chip, struct msgobj_t *obj);
+int lpc17xx_fill_chipspecops(struct canchip_t *chip);
+int lpc17xx_register(struct chipspecops_t *chipspecops);
+int lpc17xx_attach_to_chip(struct canchip_t *chip);
+int lpc17xx_pre_read_config(struct canchip_t *chip, struct msgobj_t *obj);
#ifdef __cplusplus
}