-/* can_quertl.c - CAN message queues functions for the RT-Linux
- * Linux CAN-bus device driver.
- * New CAN queues by Pavel Pisa - OCERA team member
- * email:pisa@cmp.felk.cvut.cz
- * This software is released under the GPL-License.
- * Version lincan-0.2 9 Jul 2003
- */
+/**************************************************************************/
+/* File: can_quertl.c - CAN message queues functions for the RT-Linux */
+/* */
+/* LinCAN - (Not only) Linux CAN bus driver */
+/* Copyright (C) 2002-2009 DCE FEE CTU Prague <http://dce.felk.cvut.cz> */
+/* Copyright (C) 2002-2009 Pavel Pisa <pisa@cmp.felk.cvut.cz> */
+/* Funded by OCERA and FRESCOR IST projects */
+/* */
+/* 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. */
+/**************************************************************************/
#ifdef CAN_WITH_RTL
#include <rtl_malloc.h>
-/*
- * Modifies Tx message processing
+/*
+ * Modifies Tx message processing
* 0 .. local message processing disabled
* 1 .. local messages disabled by default but can be enabled by canque_set_filt
* 2 .. local messages enabled by default, can be disabled by canque_set_filt
unsigned pending_inops;
unsigned pending_outops;
int i;
-
+
can_spin_lock_irqsave (&canque_pending_edges_lock, flags);
while(!list_empty(&canque_pending_edges_list)){
if(pending_inops&1)
canque_notify_inends(qedge,i);
}
-
+
canque_edge_decref(qedge);
can_spin_lock_irqsave (&canque_pending_edges_lock, flags);
}
/**
- * canqueue_rtl2lin_check_and_pend - postpones edge notification if called from RT-Linux
+ * canqueue_rtl2lin_check_and_pend - postpones edge notification if called from RT-Linux
* @qends: notification target ends
* @qedge: edge delivering notification
* @what: notification type
if(rtl_rt_system_is_idle()) return 0;
can_spin_lock_irqsave (&canque_pending_edges_lock, flags);
-
+
if(what>CANQUE_PENDOPS_LIMIT) what=CANQUE_PENDOPS_LIMIT;
if(qends == qedge->inends) {
}
can_spin_unlock_irqrestore (&canque_pending_edges_lock, flags);
-
+
return 1;
}
int ret;
unsigned old_age;
rtl_sigset_t sigset;
-
+
old_age=atomic_read(&qends->endinfo.rtlinfo.rtl_writeq_age);
while((ret=canque_get_inslot4id(qends,qedgep,slotp,cmd,id,prio))==-1){
rtl_sigemptyset(&sigset);
return -1;
old_age=atomic_read(&qends->endinfo.rtlinfo.rtl_writeq_age);
}
-
+
return ret;
}
int ret;
unsigned old_age;
rtl_sigset_t sigset;
-
+
old_age=atomic_read(&qends->endinfo.rtlinfo.rtl_readq_age);
while((ret=canque_test_outslot(qends,qedgep,slotp))==-1){
rtl_sigemptyset(&sigset);
int ret;
unsigned old_age;
rtl_sigset_t sigset;
-
+
old_age=atomic_read(&qends->endinfo.rtlinfo.rtl_emptyq_age);
while(!(ret=canque_fifo_test_fl(&qedge->fifo,EMPTY)?1:0)){
rtl_sigemptyset(&sigset);
return -1;
old_age=atomic_read(&qends->endinfo.rtlinfo.rtl_emptyq_age);
}
-
+
return ret;
}
/**
* canqueue_notify_rtl - notification callback handler for Linux userspace clients
* @qends: pointer to the callback side ends structure
- * @qedge: edge which invoked notification
+ * @qedge: edge which invoked notification
* @what: notification type
*/
void canqueue_notify_rtl(struct canque_ends_t *qends, struct canque_edge_t *qedge, int what)
{
rtl_irqstate_t flags;
-
+
switch(what){
case CANQUEUE_NOTIFY_EMPTY:
rtl_spin_lock_irqsave(&qends->endinfo.rtlinfo.rtl_lock, flags);
rtl_wait_init(&(qends->endinfo.rtlinfo.rtl_readq));
rtl_wait_init(&(qends->endinfo.rtlinfo.rtl_writeq));
rtl_wait_init(&(qends->endinfo.rtlinfo.rtl_emptyq));
-
+
qends->notify=canqueue_notify_rtl;
qends->endinfo.rtlinfo.pend_flags=0;
return 0;
/*Wait for sending of all pending messages in the output FIFOs*/
/*if(sync)
canqueue_ends_sync_all_rtl(qends);*/
-
+
/* Finish or kill all outgoing edges listed in inends */
delayed=canqueue_ends_kill_inlist(qends, 1);
/* Kill all incoming edges listed in outends */
+/**
+ * canqueue_rtl_initialize - initialization of global RT-Linux specific features
+ */
void canqueue_rtl_initialize(void)
{
INIT_LIST_HEAD(&canque_pending_edges_list);
}
+/**
+ * canqueue_rtl_done - finalization of glopal RT-Linux specific features
+ */
void canqueue_rtl_done(void)
{
rtl_free_soft_irq (canqueue_rtl_irq);