michallenc commented on code in PR #11595:
URL: https://github.com/apache/nuttx/pull/11595#discussion_r1465590158


##########
arch/arm/src/samv7/sam_dac.c:
##########
@@ -226,15 +226,46 @@ static int dac_interrupt(int irq, void *context, void 
*arg)
 
 static void dac_reset(struct dac_dev_s *dev)
 {
+  struct sam_chan_s *chan = dev->ad_priv;
+#ifdef CONFIG_SAMV7_DAC_TRIGGER
+  uint32_t regval;
+#endif
   irqstate_t flags;
 
   /* Reset only the selected DAC channel; the other DAC channel must remain
-   * functional.
+   * functional. The controller however does not have an option to reset
+   * single channel, therefore we have to do this manually by writing zeroes
+   * to all important registers.
+   */
+
+  /* This should be called only before dac_setup(), therefore the channel
+   * should not be in use. Skip reset if it is.
    */
 
-  flags   = enter_critical_section();
+  if (chan->inuse)

Review Comment:
   I have changed it to `bool`, it is probably clearier. Bud what do you mean 
by changing `intf` to bitfield, channel enable and channel disable are both 
write only, so we just need to write `1 << offset`, where offset is interface 
number.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to