pkarashchenko commented on code in PR #11595:
URL: https://github.com/apache/nuttx/pull/11595#discussion_r1465914203
##########
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've read a comment around `intf` and it states that it can be either 0 or
1, so in theory it could be defined as `uint8_t intf : 1;` (if it had to care
more values obviously `uint8_t intf : 7;` also could work) so it would share
memory with `inuse` bit field.
--
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]