X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/a4c9ead4b64bd4de307f375c2ff313a7a07a06e0..9c8ab08d7e8fca3916a7f91a3c001d151989137c:/lincan/include/sja1000p.h diff --git a/lincan/include/sja1000p.h b/lincan/include/sja1000p.h index 1d57aa8..24e2357 100644 --- a/lincan/include/sja1000p.h +++ b/lincan/include/sja1000p.h @@ -1,23 +1,50 @@ -/* sja1000p.h - * Header file for the Linux CAN-bus driver. - * Written by Arnaud Westenberg email:arnaud@wanadoo.nl - * Added by T.Motylewski@bfad.de - * See app. note an97076.pdf from Philips Semiconductors - * and SJA1000 data sheet - * PELICAN mode - * This software is released under the GPL-License. - * Version lincan-0.3 17 Jun 2004 - */ - -int sja1000p_chip_config(struct chip_t *chip); -int sja1000p_extended_mask(struct chip_t *chip, unsigned long code, unsigned long mask); -int sja1000p_baud_rate(struct chip_t *chip, int rate, int clock, int sjw, +/**************************************************************************/ +/* File: sja1000p.h - Philips/NXP SJA1000 chip PeliCanCAN mode support */ +/* */ +/* LinCAN - (Not only) Linux CAN bus driver */ +/* Copyright (C) 2002-2009 DCE FEE CTU Prague */ +/* Copyright (C) 2002-2009 Pavel Pisa */ +/* Copyright (C) 2004-2005 Tomasz Motylewski (BFAD GmbH) */ +/* Funded by OCERA and FRESCOR IST projects */ +/* Based on CAN driver code by Arnaud Westenberg */ +/* */ +/* LinCAN is free software; you can redistribute it and/or modify it */ +/* under terms of the GNU General Public License as published by the */ +/* Free Software Foundation; either version 2, or (at your option) any */ +/* later version. LinCAN is distributed in the hope that it will be */ +/* useful, but WITHOUT ANY WARRANTY; without even the implied warranty */ +/* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* General Public License for more details. You should have received a */ +/* copy of the GNU General Public License along with LinCAN; see file */ +/* COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, */ +/* Cambridge, MA 02139, USA. */ +/* */ +/* To allow use of LinCAN in the compact embedded systems firmware */ +/* and RT-executives (RTEMS for example), main authors agree with next */ +/* special exception: */ +/* */ +/* Including LinCAN header files in a file, instantiating LinCAN generics */ +/* or templates, or linking other files with LinCAN objects to produce */ +/* an application image/executable, does not by itself cause the */ +/* resulting application image/executable to be covered by */ +/* the GNU General Public License. */ +/* This exception does not however invalidate any other reasons */ +/* why the executable file might be covered by the GNU Public License. */ +/* Publication of enhanced or derived LinCAN files is required although. */ +/**************************************************************************/ + +int sja1000p_chip_config(struct canchip_t *chip); +int sja1000p_extended_mask(struct canchip_t *chip, unsigned long code, unsigned long mask); +int sja1000p_baud_rate(struct canchip_t *chip, int rate, int clock, int sjw, int sampl_pt, int flags); -int sja1000p_pre_read_config(struct chip_t *chip, struct msgobj_t *obj); -int sja1000p_pre_write_config(struct chip_t *chip, struct msgobj_t *obj, +int sja1000p_pre_read_config(struct canchip_t *chip, struct msgobj_t *obj); +int sja1000p_pre_write_config(struct canchip_t *chip, struct msgobj_t *obj, struct canmsg_t *msg); -int sja1000p_send_msg(struct chip_t *chip, struct msgobj_t *obj, +int sja1000p_send_msg(struct canchip_t *chip, struct msgobj_t *obj, struct canmsg_t *msg); +int sja1000p_fill_chipspecops(struct canchip_t *chip); +int sja1000p_irq_handler(int irq, struct canchip_t *chip); + /* PeliCAN mode */ enum SJA1000_PeliCAN_regs { @@ -182,6 +209,14 @@ enum sja1000_CDR { sjaCDR_RXINPEN = 1<<5, sjaCDR_CLK_OFF = 1<<3, /// f_out = f_osc/(2*(CDR[2:0]+1)) or f_osc if CDR[2:0]==7 + sjaCDR_CLKOUT_DIV1 = 7, + sjaCDR_CLKOUT_DIV2 = 0, + sjaCDR_CLKOUT_DIV4 = 1, + sjaCDR_CLKOUT_DIV6 = 2, + sjaCDR_CLKOUT_DIV8 = 3, + sjaCDR_CLKOUT_DIV10 = 4, + sjaCDR_CLKOUT_DIV12 = 5, + sjaCDR_CLKOUT_DIV14 = 6, sjaCDR_CLKOUT_MASK = 7 };