ENC28J60: Allow either HP or LP work queue to be used.

This commit is contained in:
Gregory Nutt 2016-11-18 08:41:27 -06:00
parent 78fd358023
commit 52560bba37
2 changed files with 30 additions and 4 deletions

View File

@ -218,6 +218,24 @@ config ENC28J60_FREQUENCY
---help---
Define to use a different bus frequency
choice
prompt "Work queue"
default ENC28J60_LPWORK if SCHED_LPWORK
default ENC28J60_HPWORK if !SCHED_LPWORK && SCHED_HPWORK
depends on SCHED_WORKQUEUE
---help---
Work queue support is required to use the ENC28J60 driver. If the low priority work queue is available, then it should be used by the ENC28J60.
config ENC28J60_HPWORK
bool "High priority"
depends on SCHED_HPWORK
config ENC28J60_LPWORK
bool "Low priority"
depends on SCHED_LPWORK
endchoice # Work queue
config ENC28J60_HALFDUPPLEX
bool "Enable half dupplex"
default n

View File

@ -115,8 +115,16 @@
/* We need to have the work queue to handle SPI interrupts */
#ifndef CONFIG_SCHED_WORKQUEUE
#if !defined(CONFIG_SCHED_WORKQUEUE)
# error "Worker thread support is required (CONFIG_SCHED_WORKQUEUE)"
#else
# if defined(CONFIG_ENC28J60_HPWORK)
# define ENCWORK HPWORK
# elif defined(CONFIG_ENC28J60_LPWORK)
# define ENCWORK LPWORK
# else
# error "Neither CONFIG_ENC28J60_HPWORK nor CONFIG_ENC28J60_LPWORK defined"
# endif
#endif
/* CONFIG_ENC28J60_DUMPPACKET will dump the contents of each packet to the console. */
@ -1852,7 +1860,7 @@ static int enc_interrupt(int irq, FAR void *context)
*/
priv->lower->disable(priv->lower);
return work_queue(HPWORK, &priv->irqwork, enc_irqworker, (FAR void *)priv, 0);
return work_queue(ENCWORK, &priv->irqwork, enc_irqworker, (FAR void *)priv, 0);
}
/****************************************************************************
@ -1944,7 +1952,7 @@ static void enc_txtimeout(int argc, uint32_t arg, ...)
* can occur until we restart the Tx timeout watchdog.
*/
ret = work_queue(HPWORK, &priv->towork, enc_toworker, (FAR void *)priv, 0);
ret = work_queue(ENCWORK, &priv->towork, enc_toworker, (FAR void *)priv, 0);
DEBUGASSERT(ret == OK);
UNUSED(ret);
}
@ -2040,7 +2048,7 @@ static void enc_polltimer(int argc, uint32_t arg, ...)
* occur until we restart the poll timeout watchdog.
*/
ret = work_queue(HPWORK, &priv->pollwork, enc_pollworker, (FAR void *)priv, 0);
ret = work_queue(ENCWORK, &priv->pollwork, enc_pollworker, (FAR void *)priv, 0);
DEBUGASSERT(ret == OK);
UNUSED(ret);
}