summaryrefslogtreecommitdiff
path: root/nuttx/include
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-12-16 16:17:34 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-12-16 16:17:34 +0000
commitc41819ee0fa00a0741388d2b02edb370a1360a30 (patch)
tree300bc4957f4a2559432a2f6ae680ee6ccd8f3c7c /nuttx/include
parentb081b723a309bbe18fbbb0f25dbf86c33c2df891 (diff)
downloadpx4-nuttx-c41819ee0fa00a0741388d2b02edb370a1360a30.tar.gz
px4-nuttx-c41819ee0fa00a0741388d2b02edb370a1360a30.tar.bz2
px4-nuttx-c41819ee0fa00a0741388d2b02edb370a1360a30.zip
Add generic, upper-half PWM driver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4191 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include')
-rw-r--r--nuttx/include/nuttx/analog/adc.h46
-rw-r--r--nuttx/include/nuttx/ioctl.h9
2 files changed, 45 insertions, 10 deletions
diff --git a/nuttx/include/nuttx/analog/adc.h b/nuttx/include/nuttx/analog/adc.h
index e09ce2367..3f7db3ee5 100644
--- a/nuttx/include/nuttx/analog/adc.h
+++ b/nuttx/include/nuttx/analog/adc.h
@@ -160,35 +160,63 @@ extern "C" {
#endif
/************************************************************************************
+ * "Upper-Half" ADC Driver Interfaces
+ ************************************************************************************/
+/************************************************************************************
* Name: adc_register
*
* Description:
- * Register a adc driver.
+ * Register a ADC driver. This function binds an instance of a "lower half" ADC
+ * driver with the "upper half" ADC device and registers that device so that can
+ * be used by application code.
+ *
+ * Input parameters:
+ * path - The full path to the driver to be registers in the NuttX pseudo-
+ * filesystem. The recommended convention is to name all PWM drivers
+ * as "/dev/adc", "/dev/adc1", etc. where the driver path differs only
+ * in the "minor" number at the end of the device name.
+ * dev - A pointer to an instance of lower half ADC driver. This instance
+ * is bound to the upper half ADC driver and must persists as long as the
+ * upper half driver driver persists.
+ *
+ * Returned Value:
+ * Zero on success; a negated errno value on failure.
*
************************************************************************************/
int adc_register(FAR const char *path, FAR struct adc_dev_s *dev);
-int adc_receive(FAR struct adc_dev_s *dev, uint8_t ch, int32_t data);
-
/************************************************************************************
- * Name: up_ads1255initialize
+ * Name: adc_receive
*
* Description:
- * Initialize the TI ADS 125X lower half driver
+ * This function is called from the lower half, platform-specific ADC logic when
+ * new ADC sample data is available.
+ *
+ * Input Parameters:
+ * dev - The ADC device structure that was previously registered by adc_register()
+ * ch - And ID for the ADC channel number that generated the data
+ * data - The actualy converted data from the channel.
+ *
+ * Returned Value:
+ * Zero on success; a negated errno value on failure.
*
************************************************************************************/
-FAR struct adc_dev_s *up_ads1255initialize(FAR struct spi_dev_s *spi, unsigned int devno);
+int adc_receive(FAR struct adc_dev_s *dev, uint8_t ch, int32_t data);
/************************************************************************************
- * Name: up_adcinitialize
+ * Platform-Independent "Lower Half" ADC Driver Interfaces
+ ************************************************************************************/
+/************************************************************************************
+ * Name: up_ads1255initialize
*
* Description:
- * Initialize the MCU internal adc driver
+ * Initialize the TI ADS 125X lower half driver
*
************************************************************************************/
-FAR struct adc_dev_s *up_adcinitialize();
+
+FAR struct adc_dev_s *up_ads1255initialize(FAR struct spi_dev_s *spi, unsigned int devno);
#if defined(__cplusplus)
}
diff --git a/nuttx/include/nuttx/ioctl.h b/nuttx/include/nuttx/ioctl.h
index 61fccef88..64ca73e5c 100644
--- a/nuttx/include/nuttx/ioctl.h
+++ b/nuttx/include/nuttx/ioctl.h
@@ -61,7 +61,9 @@
#define _ARPIOCBASE (0x0800) /* ARP ioctl commands */
#define _TSIOCBASE (0x0900) /* Touchscreen ioctl commands */
#define _SNIOCBASE (0x0a00) /* Sensor ioctl commands */
-#define _CAIOCBASE (0x0b00) /* CDC/ACM ioctl commands */
+#define _ANIOCBASE (0x0b00) /* Analog (DAC/ADC) ioctl commands */
+#define _PWMIOCBASE (0x0c00) /* PWM ioctl commands */
+#define _CAIOCBASE (0x0d00) /* CDC/ACM ioctl commands */
/* Macros used to manage ioctl commands */
@@ -173,6 +175,11 @@
#define _SNIOCVALID(c) (_IOC_TYPE(c)==_SNIOCBASE)
#define _SNIOC(nr) _IOC(_SNIOCBASE,nr)
+/* NuttX PWM ioctl definitions (see nuttx/pwm.h) ***************************/
+
+#define _PWMIOCVALID(c) (_IOC_TYPE(c)==_PWMIOCBASE)
+#define _PWMIOC(nr) _IOC(_PWMIOCBASE,nr)
+
/* NuttX USB CDC/ACM serial driver ioctl definitions ************************/
/* (see nuttx/usb/cdc_serial.h) */