LPC17xx: DC updates from Max. Also fixes some syntax errors that I introduced in the last commit.

This commit is contained in:
Gregory Nutt
2014-07-28 07:23:49 -06:00
parent 1da856cca9
commit d450993f2e
2 changed files with 83 additions and 97 deletions
+5 -20
View File
@@ -421,9 +421,7 @@ static int adc_interrupt(int irq, void *context)
FAR struct up_dev_s *priv = (FAR struct up_dev_s *)g_adcdev.ad_priv; FAR struct up_dev_s *priv = (FAR struct up_dev_s *)g_adcdev.ad_priv;
volatile uint32_t regVal, regVal2, regVal3; volatile uint32_t regVal, regVal2, regVal3;
//lpc17_gpiowrite(LPCXPRESSO_GPIO0_21, 1); /* Set pin P0.21 */ /* Verify that an interrupt has actually occured */
/* Teste si une interruption a bien eu lieu */
regVal2 = getreg32(LPC17_ADC_STAT); /* Read ADSTAT will clear the interrupt flag */ regVal2 = getreg32(LPC17_ADC_STAT); /* Read ADSTAT will clear the interrupt flag */
if ((regVal2) & (1<<16)) if ((regVal2) & (1<<16))
@@ -431,6 +429,7 @@ static int adc_interrupt(int irq, void *context)
if ((priv->mask & 0x01) != 0) if ((priv->mask & 0x01) != 0)
{ {
regVal = getreg32(LPC17_ADC_DR0); regVal = getreg32(LPC17_ADC_DR0);
#ifdef CONFIG_ADC_DIRECT_ACCESS #ifdef CONFIG_ADC_DIRECT_ACCESS
/* Store the data value plus the status bits */ /* Store the data value plus the status bits */
@@ -451,14 +450,6 @@ static int adc_interrupt(int irq, void *context)
#endif /* CONFIG_ADC_WORKER_THREAD */ #endif /* CONFIG_ADC_WORKER_THREAD */
#endif /* CONFIG_ADC_DIRECT_ACCESS */ #endif /* CONFIG_ADC_DIRECT_ACCESS */
#ifdef CONFIG_ADC_DEBUG_DAC
/* Adjust the binary value to the lpc1768's register format (plus high
* speed profile in bit 16)
*/
// putreg32(((((regVal >> 4) & 0xFFF) << 6)| 0x10000) & 0xffff, LPC17_DAC_CR);
#endif /*CONFIG_ADC_DEBUG_DAC*/
} }
if ((priv->mask & 0x02) != 0) if ((priv->mask & 0x02) != 0)
@@ -515,13 +506,6 @@ static int adc_interrupt(int irq, void *context)
#endif /*CONFIG_ADC_DIRECT_ACCESS*/ #endif /*CONFIG_ADC_DIRECT_ACCESS*/
} }
#ifdef CONFIG_ADC_WORKER_THREAD
/* Store the data value plus the status bits */
ADC2Buffer0[0] = regVal;
ADC0IntDone = 1;
#else /* CONFIG_ADC_WORKER_THREAD */
if ((priv->mask & 0x08) != 0) if ((priv->mask & 0x08) != 0)
{ {
regVal = getreg32(LPC17_ADC_DR3); regVal = getreg32(LPC17_ADC_DR3);
@@ -567,14 +551,15 @@ static int adc_interrupt(int irq, void *context)
} }
} }
#endif /*CONFIG_ADC_WORKER_THREAD*/
#ifdef CONFIG_ADC_WORKER_THREAD #ifdef CONFIG_ADC_WORKER_THREAD
if (ADC0IntDone == 1) if (ADC0IntDone == 1)
{ {
work_queue(HPWORK, &priv->irqwork, (worker_t)adc_irqworker, (FAR void *)priv, 0); work_queue(HPWORK, &priv->irqwork, (worker_t)adc_irqworker,
(FAR void *)priv, 0);
} }
#endif /*CONFIG_ADC_WORKER_THREAD*/ #endif /*CONFIG_ADC_WORKER_THREAD*/
}
regVal3 = getreg32(LPC17_ADC_GDR); /* Read ADGDR clear the DONE and OVERRUN bits */ regVal3 = getreg32(LPC17_ADC_GDR); /* Read ADGDR clear the DONE and OVERRUN bits */
putreg32((priv->mask) | /* Select channels 0 to 7 on ADC0 */ putreg32((priv->mask) | /* Select channels 0 to 7 on ADC0 */
+1
View File
@@ -1317,6 +1317,7 @@ static void lpc17_polltimer(int argc, uint32_t arg, ...)
lpc17_rxdone(priv); lpc17_rxdone(priv);
#endif /*CONFIG_NET_WORKER_THREAD*/ #endif /*CONFIG_NET_WORKER_THREAD*/
}
/* Setup the watchdog poll timer again */ /* Setup the watchdog poll timer again */