file can.h to make can.h fit for a kernel integration path.
Therefore i added the 'hack' to the Makefiles which now contain the missing
defines. Maybe there will be a better solution in the future (when CAN is
part of the kernel). But currently it helps to maintain sourcecode to be
copied right into the kernel source tree.
Additionally added address structures for isotp and bap in sockaddr_can.
Cleanups. Cosmetics.
git-svn-id: svn://svn.berlios.de//socketcan/trunk@165
030b6a49-0b11-0410-94ab-
b0dab22257f2
#CFLAGS += -Idrivers/net -Inet
ifneq ($(KBUILD_EXTMOD),)
-EXTRA_CFLAGS += -I$(KBUILD_EXTMOD)/../../../include
+EXTRA_CFLAGS += -I$(KBUILD_EXTMOD)/../../../include \
+ -DETH_P_CAN=0x000C \
+ -DARPHRD_CAN=804
endif
obj-$(CONFIG_CAN_VCAN) += vcan.o
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/netdevice.h>
+#include <linux/if_arp.h>
+#include <linux/if_ether.h>
#include <linux/can.h>
#include <linux/list.h>
#include <asm/io.h>
priv = can->priv;
ndev->watchdog_timeo = MSCAN_WATCHDOG_TIMEOUT;
- ndev->open = mscan_open;
- ndev->stop = mscan_close;
+ ndev->open = mscan_open;
+ ndev->stop = mscan_close;
ndev->hard_start_xmit = mscan_hard_start_xmit;
ndev->tx_timeout = mscan_tx_timeout;
+ ndev->type = ARPHRD_CAN;
+ ndev->hard_header_len = 0;
+ ndev->mtu = sizeof(struct can_frame);
+ ndev->addr_len = 0;
+ ndev->tx_queue_len = 10;
+
+ ndev->flags = IFF_NOARP;
+ ndev->features = NETIF_F_NO_CSUM;
+
ndev->poll = mscan_rx_poll;
ndev->weight = 8;
else
ifneq ($(KBUILD_EXTMOD),)
-EXTRA_CFLAGS += -I$(KBUILD_EXTMOD)/../../../include
+EXTRA_CFLAGS += -I$(KBUILD_EXTMOD)/../../../include \
+ -DETH_P_CAN=0x000C \
+ -DARPHRD_CAN=804
endif
obj-m := sja1000-isa.o sja1000-gw2.o sja1000-mem.o
#include <linux/ioport.h>
#include <linux/slab.h>
#include <linux/netdevice.h>
+#include <linux/if_arp.h>
+#include <linux/if_ether.h>
#include <linux/skbuff.h>
#include <asm/io.h>
#include <linux/skbuff.h>
#include <linux/rtnetlink.h>
#include <linux/if_arp.h>
+#include <linux/if_ether.h>
#include <linux/if_slip.h>
#include <linux/delay.h>
#include <linux/init.h>
*
* Increment NR_LDICS in include/linux/tty.h from 16 to 17
*
+ * NEW: Since Kernel 2.6.21 you only have to change include/linux/tty.h
+ *
*/
#define SLC_CHECK_TRANSMIT
#include <linux/init.h>
#include <linux/netdevice.h>
#include <linux/if_arp.h>
+#include <linux/if_ether.h>
#include <linux/can.h>
#include <linux/can/version.h>
#include <linux/types.h>
#include <linux/socket.h>
-#include <linux/can/error.h>
-#include <linux/can/ioctl.h>
-
/* controller area network (CAN) kernel definitions */
-/* CAN socket protocol family definition */
-#define PF_CAN 29 /* to be moved to include/linux/socket.h */
-#define AF_CAN PF_CAN
-
-/* ethernet protocol identifier */
-#define ETH_P_CAN 0x000C /* to be moved to include/linux/if_ether.h */
-
-/* ARP protocol identifier (dummy type for non ARP hardware) */
-#define ARPHRD_CAN 804 /* to be moved to include/linux/if_arp.h */
-
-
-
-
/* special address description flags for the CAN_ID */
#define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */
#define CAN_RTR_FLAG 0x40000000U /* remote transmission request */
__u8 data[8] __attribute__ ((aligned(8)));
};
-
-
/* particular protocols of the protocol family PF_CAN */
#define CAN_RAW 1 /* RAW sockets */
#define CAN_BCM 2 /* Broadcast Manager */
sa_family_t can_family;
int can_ifindex;
union {
- struct { canid_t rx_id, tx_id; } tp16;
- struct { canid_t rx_id, tx_id; } tp20;
- struct { canid_t rx_id, tx_id; } mcnet;
+ struct { canid_t rx_id, tx_id; } tp16;
+ struct { canid_t rx_id, tx_id; } tp20;
+ struct { canid_t rx_id, tx_id; } mcnet;
+ struct { canid_t rx_id, tx_id; } isotp;
+ struct { int sg_id, sg_type; } bap;
} can_addr;
};
else
ifneq ($(KBUILD_EXTMOD),)
-EXTRA_CFLAGS += -I$(KBUILD_EXTMOD)/../../include
+EXTRA_CFLAGS += -I$(KBUILD_EXTMOD)/../../include \
+ -DETH_P_CAN=0x000C \
+ -DPF_CAN=29 \
+ -DAF_CAN=PF_CAN \
+ -DARPHRD_CAN=804
endif
obj-$(CONFIG_CAN) += can.o