diff options
Diffstat (limited to 'nuttx/arch/arm/src/lpc17xx')
-rw-r--r-- | nuttx/arch/arm/src/lpc17xx/lpc17_dac.c | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_dac.c b/nuttx/arch/arm/src/lpc17xx/lpc17_dac.c index 1fbac13e7..4f9a9332c 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_dac.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_dac.c @@ -38,6 +38,10 @@ * ************************************************************************************/ +/**************************************************************************** + * Included Files + ****************************************************************************/ + #include <nuttx/config.h> #include <stdio.h> @@ -64,11 +68,11 @@ #if defined(CONFIG_LPC17_DAC) /**************************************************************************** - * ad_private Types + * Private Types ****************************************************************************/ /**************************************************************************** - * ad_private Function Prototypes + * Private Function Prototypes ****************************************************************************/ /* DAC methods */ @@ -82,7 +86,7 @@ static int dac_ioctl(FAR struct dac_dev_s *dev, int cmd, unsigned long arg); static int dac_interrupt(int irq, void *context); /**************************************************************************** - * ad_private Data + * Private Data ****************************************************************************/ static const struct dac_ops_s g_dacops = @@ -101,12 +105,13 @@ static struct dac_dev_s g_dacdev = }; /**************************************************************************** - * ad_private Functions + * Private Functions ****************************************************************************/ /* Reset the DAC device. Called early to initialize the hardware. This -* is called, before ao_setup() and on error conditions. -*/ + * is called, before ao_setup() and on error conditions. + */ + static void dac_reset(FAR struct dac_dev_s *dev) { irqstate_t flags; @@ -114,49 +119,53 @@ static void dac_reset(FAR struct dac_dev_s *dev) flags = irqsave(); - regval = getreg32(LPC17_SYSCON_PCLKSEL0); - regval &= ~SYSCON_PCLKSEL0_DAC_MASK; - regval |= (SYSCON_PCLKSEL_CCLK8 << SYSCON_PCLKSEL0_DAC_SHIFT); - putreg32(regval, LPC17_SYSCON_PCLKSEL0); + regval = getreg32(LPC17_SYSCON_PCLKSEL0); + regval &= ~SYSCON_PCLKSEL0_DAC_MASK; + regval |= (SYSCON_PCLKSEL_CCLK8 << SYSCON_PCLKSEL0_DAC_SHIFT); + putreg32(regval, LPC17_SYSCON_PCLKSEL0); - //putreg32(DAC_CTRL_DBLBUFEN,LPC17_DAC_CTRL); ? + //putreg32(DAC_CTRL_DBLBUFEN,LPC17_DAC_CTRL); ? - lpc17_configgpio(GPIO_AOUT); - + lpc17_configgpio(GPIO_AOUT); + irqrestore(flags); } /* Configure the DAC. This method is called the first time that the DAC -* device is opened. This will occur when the port is first opened. -* This setup includes configuring and attaching DAC interrupts. Interrupts -* are all disabled upon return. -*/ + * device is opened. This will occur when the port is first opened. + * This setup includes configuring and attaching DAC interrupts. Interrupts + * are all disabled upon return. + */ + static int dac_setup(FAR struct dac_dev_s *dev) { - return OK; + return OK; } /* Disable the DAC. This method is called when the DAC device is closed. -* This method reverses the operation the setup method. -*/ + * This method reverses the operation the setup method. + */ + static void dac_shutdown(FAR struct dac_dev_s *dev) { } /* Call to enable or disable TX interrupts */ + static void dac_txint(FAR struct dac_dev_s *dev, bool enable) { } static int dac_send(FAR struct dac_dev_s *dev, FAR struct dac_msg_s *msg) { - putreg32((msg->am_data>>16)&0xfffff,LPC17_DAC_CR); - dac_txdone(&g_dacdev); - return 0; + putreg32((msg->am_data>>16)&0xfffff,LPC17_DAC_CR); + dac_txdone(&g_dacdev); + return 0; } /* All ioctl calls will be routed through this method */ + static int dac_ioctl(FAR struct dac_dev_s *dev, int cmd, unsigned long arg) { dbg("Fix me:Not Implemented\n"); @@ -184,7 +193,7 @@ static int dac_interrupt(int irq, void *context) FAR struct dac_dev_s *up_dacinitialize() { - return &g_dacdev; + return &g_dacdev; } #endif |