mirror of
https://github.com/apache/nuttx.git
synced 2026-03-23 22:43:57 +08:00
Add an upper half watchdog timer driver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4604 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -2651,3 +2651,4 @@
|
||||
with OUT SETUP requests.
|
||||
* include/nuttx/watchdog.h: Add the definition of a standard watchdog
|
||||
driver interface.
|
||||
* drivers/watchdog.c: The "upper half" watchdog timer driver.
|
||||
|
||||
@@ -43,19 +43,110 @@ config RAMLOG
|
||||
config CAN
|
||||
bool "CAN support"
|
||||
default n
|
||||
---help---
|
||||
This selection enables building of the "upper-half" CAN driver.
|
||||
See include/nuttx/can.h for further CAN driver information.
|
||||
|
||||
if CAN
|
||||
config CONFIG_CAN_EXTID
|
||||
bool "CAN extended IDs"
|
||||
default n
|
||||
---help---
|
||||
Enables support for the 29-bit extended ID. Default Standard 11-bit IDs.
|
||||
|
||||
config CONFIG_CAN_FIFOSIZE
|
||||
int "CAN driver I/O buffer size"
|
||||
default 8
|
||||
---help---
|
||||
The size of the circular buffer of CAN messages. Default: 8
|
||||
|
||||
config CONFIG_CAN_NPENDINGRTR
|
||||
int "Number of pending RTRs"
|
||||
default 4
|
||||
---help---
|
||||
The size of the list of pending RTR requests. Default: 4
|
||||
|
||||
config CONFIG_CAN_LOOPBACK
|
||||
bool "CAN extended IDs"
|
||||
default n
|
||||
---help---
|
||||
A CAN driver may or may not support a loopback mode for testing. If the
|
||||
driver does support loopback mode, the setting will enable it. (If the
|
||||
driver does not, this setting will have no effect).
|
||||
|
||||
endif
|
||||
|
||||
config PWM
|
||||
bool "PWM support"
|
||||
default n
|
||||
---help---
|
||||
This selection enables building of the "upper-half" PWM driver.
|
||||
See include/nuttx/pwm.h for further PWM driver information.
|
||||
|
||||
if PWM
|
||||
config PWM_PULSECOUNT
|
||||
bool "PWM pulse count support"
|
||||
default n
|
||||
---help---
|
||||
Some hardware will support generation of a fixed number of pulses. This
|
||||
might be used, for example to support a stepper motor. If the hardware
|
||||
will support a fixed pulse count, then this configuration should be set to
|
||||
enable the capability.
|
||||
|
||||
endif
|
||||
|
||||
config I2C
|
||||
bool "I2C support"
|
||||
default y
|
||||
---help---
|
||||
This selection enables building of the "upper-half" I2C driver.
|
||||
See include/nuttx/i2c.h for further I2C driver information.
|
||||
|
||||
if I2C
|
||||
endif
|
||||
|
||||
config SPI
|
||||
bool "SPI support"
|
||||
default y
|
||||
|
||||
---help---
|
||||
This selection enables building of the "upper-half" SPI driver.
|
||||
See include/nuttx/spi.h for further SPI driver information.
|
||||
|
||||
if SPI
|
||||
config SPI_OWNBUS
|
||||
bool "SPI single device"
|
||||
default y
|
||||
---help---
|
||||
Set if there is only one active device on the SPI bus. No locking or SPI
|
||||
configuration will be performed. It is not necessary for clients to lock,
|
||||
re-configure, etc..
|
||||
|
||||
config SPI_EXCHANGE
|
||||
bool "SPI exchange"
|
||||
default y
|
||||
---help---
|
||||
Driver supports a single exchange method (vs a recvblock() and sndblock ()methods).
|
||||
|
||||
config SPI_CMDDATA
|
||||
bool "SPI CMD/DATA"
|
||||
default y
|
||||
---help---
|
||||
Devices on the SPI bus require out-of-band support to distinguish command
|
||||
transfers from data transfers. Such devices will often support either 9-bit
|
||||
SPI (yech) or 8-bit SPI and a GPIO output that selects between command and data.
|
||||
|
||||
endif
|
||||
|
||||
config WATCHDOG
|
||||
bool "Watchdog timer support"
|
||||
default y
|
||||
---help---
|
||||
This selection enables building of the "upper-half" watchdog timer driver.
|
||||
See include/nuttx/watchdog.h for further watchdog timer driver information.
|
||||
|
||||
if WATCHDOG
|
||||
endif
|
||||
|
||||
menuconfig ANALOG
|
||||
bool "Analog Device(adc,dac) support"
|
||||
default n
|
||||
|
||||
@@ -82,6 +82,10 @@ endif
|
||||
ifeq ($(CONFIG_PWM),y)
|
||||
CSRCS += pwm.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_WATCHDOG),y)
|
||||
CSRCS += watchdog.c
|
||||
endif
|
||||
endif
|
||||
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* drivers/pwm.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -85,7 +85,7 @@
|
||||
* Private Type Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* This structure describes the state of the upper half drivere */
|
||||
/* This structure describes the state of the upper half driver */
|
||||
|
||||
struct pwm_upperhalf_s
|
||||
{
|
||||
|
||||
572
drivers/watchdog.c
Normal file
572
drivers/watchdog.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -56,7 +56,7 @@
|
||||
*
|
||||
* WDIOC_START - Start the watchdog timer
|
||||
* Argument: Ignored
|
||||
* WDIOC_START - Stop the watchdog timer
|
||||
* WDIOC_STOP - Stop the watchdog timer
|
||||
* Argument: Ignored
|
||||
* WDIOC_GETSTATUS - Get the status of the watchdog timer.
|
||||
* Argument: A writeable pointer to struct watchdog_status_s.
|
||||
@@ -133,7 +133,7 @@ struct watchdog_ops_s
|
||||
/* Get the current watchdog timer status */
|
||||
|
||||
CODE int (*getstatus)(FAR struct watchdog_lowerhalf_s *lower,
|
||||
FAR watchdog_state_s *status);
|
||||
FAR struct watchdog_status_s *status);
|
||||
|
||||
/* Set a new timeout value (and reset the watchdog timer) */
|
||||
|
||||
@@ -141,14 +141,14 @@ struct watchdog_ops_s
|
||||
uint32_t timeout);
|
||||
|
||||
/* Don't reset on watchdog timer timeout; instead, call this user provider
|
||||
* timeout handler. NOTE: Providing handler==NULL will store the reset
|
||||
* timeout handler. NOTE: Providing handler==NULL will restore the reset
|
||||
* behavior.
|
||||
*/
|
||||
|
||||
CODE xcpt_t (*capture)(FAR struct watchdog_lowerhalf_s *lower,
|
||||
xcpt_t handler);
|
||||
CODE xcpt_t handler);
|
||||
|
||||
/* An ioctl commands that are not recognized by the "upper-half" driver
|
||||
/* Any ioctl commands that are not recognized by the "upper-half" driver
|
||||
* are forwarded to the lower half driver through this method.
|
||||
*/
|
||||
|
||||
@@ -217,8 +217,8 @@ extern "C" {
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR void *watchdog_register(FAR const char *path,
|
||||
FAR struct watchdog_lowerhalf_s *lower);
|
||||
EXTERN FAR void *watchdog_register(FAR const char *path,
|
||||
FAR struct watchdog_lowerhalf_s *lower);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: watchdog_unregister
|
||||
|
||||
Reference in New Issue
Block a user