From bfac169862856611eeb16af24c8943f005f88e12 Mon Sep 17 00:00:00 2001 From: ppisa Date: Sun, 21 Mar 2004 18:48:04 +0000 Subject: [PATCH] Added glue required for RTL hardware filters updates. --- lincan/src/can_devrtl.c | 13 +++++++++---- lincan/src/devcommon.c | 37 ++++++++++++++++++++++++------------- lincan/src/i82527.c | 11 +++++++++++ lincan/src/sja1000p.c | 3 +++ lincan/src/virtual.c | 5 +++++ 5 files changed, 52 insertions(+), 17 deletions(-) diff --git a/lincan/src/can_devrtl.c b/lincan/src/can_devrtl.c index 37bbbf1..559c2db 100644 --- a/lincan/src/can_devrtl.c +++ b/lincan/src/can_devrtl.c @@ -111,10 +111,15 @@ void * can_chip_worker_thread(void *arg) for(i=0;imax_objects;i++){ if((obj=chip->msgobj[i])==NULL) continue; - if(!can_msgobj_test_and_clear_fl(obj,TX_REQUEST)) - continue; - DEBUGMSG("Calling wakeup_tx\n"); - chip->chipspecops->wakeup_tx(chip, obj); + if(can_msgobj_test_fl(obj,TX_REQUEST)) { + DEBUGMSG("Calling wakeup_tx\n"); + chip->chipspecops->wakeup_tx(chip, obj); + } + if(can_msgobj_test_fl(obj,FILTCH_REQUEST)) { + DEBUGMSG("Calling filtch_rq\n"); + if(chip->chipspecops->filtch_rq) + chip->chipspecops->filtch_rq(chip, obj); + } } continue; } diff --git a/lincan/src/devcommon.c b/lincan/src/devcommon.c index 16d21db..bf6585a 100644 --- a/lincan/src/devcommon.c +++ b/lincan/src/devcommon.c @@ -12,6 +12,27 @@ #include "../include/main.h" #include "../include/devcommon.h" +#ifdef CAN_WITH_RTL +static inline +void canqueue_wake_chip_worker(struct canque_ends_t *qends, struct chip_t *chip, struct msgobj_t *obj) +{ + if(qends->endinfo.chipinfo.worker_thread){ + can_msgobj_set_fl(obj,WORKER_WAKE); + pthread_kill(qends->endinfo.chipinfo.worker_thread,RTL_SIGNAL_WAKEUP); + rtl_schedule(); + } else { + set_bit(MSGOBJ_TX_REQUEST_b,&chip->pend_flags); + if(chip->worker_thread) { + set_bit(MSGOBJ_WORKER_WAKE_b,&chip->pend_flags); + pthread_kill(chip->worker_thread,RTL_SIGNAL_WAKEUP); + rtl_schedule(); + } + } +} + +#endif /*CAN_WITH_RTL*/ + + /** * canqueue_notify_chip - notification callback handler for CAN chips ends of queues * @qends: pointer to the callback side ends structure @@ -41,19 +62,7 @@ void canqueue_notify_chip(struct canque_ends_t *qends, struct canque_edge_t *qed chip->chipspecops->wakeup_tx(chip, obj); #else /*CAN_WITH_RTL*/ can_msgobj_set_fl(obj,TX_REQUEST); - if(qends->endinfo.chipinfo.worker_thread){ - can_msgobj_set_fl(obj,WORKER_WAKE); - pthread_kill(qends->endinfo.chipinfo.worker_thread,RTL_SIGNAL_WAKEUP); - rtl_schedule(); - } else { - set_bit(MSGOBJ_TX_REQUEST_b,&chip->pend_flags); - - if(chip->worker_thread) { - set_bit(MSGOBJ_WORKER_WAKE_b,&chip->pend_flags); - pthread_kill(chip->worker_thread,RTL_SIGNAL_WAKEUP); - rtl_schedule(); - } - } + canqueue_wake_chip_worker(qends, chip, obj); #endif /*CAN_WITH_RTL*/ break; case CANQUEUE_NOTIFY_DEAD_WANTED: @@ -69,6 +78,8 @@ void canqueue_notify_chip(struct canque_ends_t *qends, struct canque_edge_t *qed #ifndef CAN_WITH_RTL chip->chipspecops->filtch_rq(chip, obj); #else /*CAN_WITH_RTL*/ + can_msgobj_set_fl(obj,FILTCH_REQUEST); + canqueue_wake_chip_worker(qends, chip, obj); #endif /*CAN_WITH_RTL*/ break; diff --git a/lincan/src/i82527.c b/lincan/src/i82527.c index 68feef7..6897948 100644 --- a/lincan/src/i82527.c +++ b/lincan/src/i82527.c @@ -681,6 +681,17 @@ void i82527_irq_rtr_handler(struct chip_t *chip, struct msgobj_t *obj, wake_up(&rtr_search->rtr_wq); } +/** + * i82527_wakeup_tx: - wakeups TX processing + * @chip: pointer to chip state structure + * @obj: pointer to message object structure + * + * Function is responsible for initiating message transmition. + * It is responsible for clearing of object TX_REQUEST flag + * + * Return Value: negative value reports error. + * File: src/i82527.c + */ int i82527_wakeup_tx(struct chip_t *chip, struct msgobj_t *obj) { can_preempt_disable(); diff --git a/lincan/src/sja1000p.c b/lincan/src/sja1000p.c index eafed8a..57b33c8 100644 --- a/lincan/src/sja1000p.c +++ b/lincan/src/sja1000p.c @@ -685,6 +685,9 @@ can_irqreturn_t sja1000p_irq_handler(int irq, void *dev_id, struct pt_regs *regs * @chip: pointer to chip state structure * @obj: pointer to message object structure * + * Function is responsible for initiating message transmition. + * It is responsible for clearing of object TX_REQUEST flag + * * Return Value: negative value reports error. * File: src/sja1000p.c */ diff --git a/lincan/src/virtual.c b/lincan/src/virtual.c index d8818ab..05a12f9 100644 --- a/lincan/src/virtual.c +++ b/lincan/src/virtual.c @@ -337,6 +337,9 @@ void virtual_do_tx_timeout(unsigned long data) * @chip: pointer to chip state structure * @obj: pointer to message object structure * + * Function is responsible for initiating message transmition. + * It is responsible for clearing of object TX_REQUEST flag + * * Return Value: negative value reports error. * File: src/virtual.c */ @@ -348,6 +351,8 @@ int virtual_wakeup_tx(struct chip_t *chip, struct msgobj_t *obj) struct canque_slot_t *slot; int cmd; + can_msgobj_clear_fl(obj,TX_REQUEST); + #ifndef CAN_WITH_RTL if(!virtual_bus_latency(obj)) { #endif /*CAN_WITH_RTL*/ -- 2.39.2