diff --git a/ChangeLog b/ChangeLog index 2e1c0b83034..1aeb41e3f07 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5879,4 +5879,7 @@ (2013-10-24). * configs/sama5d3x-ek/src/sam_adc.c: Integrate support for the apps/examples/adc into the SAMA5D3x-EK configuration (2013-10-24). + * include/nuttx/fs/ioctl.h and arch/arm/src/sama5/sam_adc.c: Add + and ioctl command that can be used to trigger ADC/DAC conversion + (2015-10-25). diff --git a/TODO b/TODO index 4736b88b3b4..c941308755e 100644 --- a/TODO +++ b/TODO @@ -18,7 +18,7 @@ nuttx/ (16) Network (net/, drivers/net) (4) USB (drivers/usbdev, drivers/usbhost) (11) Libraries (libc/, ) - (10) File system/Generic drivers (fs/, drivers/) + (11) File system/Generic drivers (fs/, drivers/) (5) Graphics subystem (graphics/) (1) Pascal add-on (pcode/) (1) Documentation (Documentation/) @@ -1163,6 +1163,21 @@ o File system / Generic drivers (fs/, drivers/) Priority: Low. Nothing is broken. This is an enhancement that would improve the OS design and possible reduce some FLASH usage + Title: UNIFIED DESCRIPTOR REPRESENTATION + Descripton: There are two separate ranges of descriptors for file and + socket descriptors: if a descriptor is in one range then it is + recognized as a file descriptor; if it is in another range + then it is recognized as a socket descriptor. These separate + descriptor ranges can cause problems, for example, they makes + dup'ing descriptors with dup2() problematic. The two groups + of descriptors are really indices into two separate tables: + On an array of file structures and the other an array of + socket structures. There really should be one array that + is a union of file and socket descriptors. Then socket and + file decriptors could lie in the same range. + Status: Open + Priority: Low + o Graphics subystem (graphics/) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/arch/arm/src/sama5/sam_adc.c b/arch/arm/src/sama5/sam_adc.c index cd7ca45fecc..5af5f0d4e0f 100644 --- a/arch/arm/src/sama5/sam_adc.c +++ b/arch/arm/src/sama5/sam_adc.c @@ -50,6 +50,8 @@ #include #include +#include + #include #include #include @@ -1081,18 +1083,29 @@ static void sam_adc_rxint(struct adc_dev_s *dev, bool enable) static int sam_adc_ioctl(struct adc_dev_s *dev, int cmd, unsigned long arg) { + struct sam_adc_s *priv = (struct sam_adc_s *)dev->ad_priv; + int ret = OK; + avdbg("cmd=%d arg=%ld\n", cmd, arg); - /* No ioctl commands supported: - * - * REVISIT: Need to implement a ioctl to support software triggering - */ - + switch (cmd) + { #ifdef CONFIG_SAMA5_ADC_SWTRIG -# error Need an ioctl to perform software triggering + case ANIOC_TRIGGER: /* Software trigger */ + { + sam_adc_putreg(priv, SAM_ADC_CR, ADC_CR_START); /* Start conversion */ + } + break; #endif - return -ENOTTY; + /* Unsupported or invalid command */ + + default: + ret = -ENOTTY; + break; + } + + return ret; } /**************************************************************************** diff --git a/include/nuttx/fs/ioctl.h b/include/nuttx/fs/ioctl.h index 852113a4c0b..5c2fbb67b6b 100644 --- a/include/nuttx/fs/ioctl.h +++ b/include/nuttx/fs/ioctl.h @@ -219,7 +219,16 @@ #define _SNIOCVALID(c) (_IOC_TYPE(c)==_SNIOCBASE) #define _SNIOC(nr) _IOC(_SNIOCBASE,nr) -/* NuttX PWM ioctl definitions (see nuttx/pwm.h) ***************************/ +/* Nuttx Analog (DAC/ADC_ ioctl commands ************************************/ + +#define _ANIOCVALID(c) (_IOC_TYPE(c)==_ANIOCBASE) +#define _ANIOC(nr) _IOC(_ANIOCBASE,nr) + +#define ANIOC_TRIGGER _ANIOC(0x0001) /* Trigger one conversion + * IN: None + * OUT: None */ + +/* NuttX PWM ioctl definitions (see nuttx/pwm.h) ****************************/ #define _PWMIOCVALID(c) (_IOC_TYPE(c)==_PWMIOCBASE) #define _PWMIOC(nr) _IOC(_PWMIOCBASE,nr)