diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-09-27 15:29:53 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-09-27 15:29:53 +0000 |
commit | a9445ee1dde0305c7ea03ff1c74447a6e4f53a98 (patch) | |
tree | ef6f6626dbdbf7939d763ff9c2b6bf019b85126f /nuttx/drivers/input | |
parent | 71edd43b4ed83fbb8b5d6cf84e6ce1bd3ea289ad (diff) | |
download | px4-nuttx-a9445ee1dde0305c7ea03ff1c74447a6e4f53a98.tar.gz px4-nuttx-a9445ee1dde0305c7ea03ff1c74447a6e4f53a98.tar.bz2 px4-nuttx-a9445ee1dde0305c7ea03ff1c74447a6e4f53a98.zip |
Definitions for ARMv7-M AIRCR register, Fixes for ADS7843 and SSD1289 driver, Missing build logic for examples/watchdog
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5198 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/input')
-rw-r--r-- | nuttx/drivers/input/ads7843e.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/nuttx/drivers/input/ads7843e.c b/nuttx/drivers/input/ads7843e.c index 07e5e515d..679c25113 100644 --- a/nuttx/drivers/input/ads7843e.c +++ b/nuttx/drivers/input/ads7843e.c @@ -555,6 +555,7 @@ static void ads7843e_worker(FAR void *arg) FAR struct ads7843e_dev_s *priv = (FAR struct ads7843e_dev_s *)arg; FAR struct ads7843e_config_s *config; bool pendown; + int ret; ASSERT(priv != NULL); @@ -565,10 +566,26 @@ static void ads7843e_worker(FAR void *arg) config = priv->config; DEBUGASSERT(config != NULL); - /* Disable the watchdog timer */ + /* Disable the watchdog timer. This is safe because it is started only + * by this function and this function is serialized on the worker thread. + */ wd_cancel(priv->wdog); + /* Get exclusive access to the driver data structure */ + + do + { + ret = sem_wait(&priv->devsem); + + /* This should only fail if the wait was canceled by an signal + * (and the worker thread will receive a lot of signals). + */ + + DEBUGASSERT(ret == OK || errno == EINTR); + } + while (ret < 0); + /* Check for pen up or down by reading the PENIRQ GPIO. */ pendown = config->pendown(config); @@ -645,6 +662,10 @@ static void ads7843e_worker(FAR void *arg) errout: (void)ads7843e_sendcmd(priv, ADS7843_CMD_ENABPINIRQ); config->enable(config, true); + + /* Release our lock on the state structure */ + + sem_post(&priv->devsem); } /**************************************************************************** |