You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2021/05/20 05:24:07 UTC
[incubator-nuttx] 10/21: arch: cxd56xx: Support execution error by
SCU sequencer
This is an automated email from the ASF dual-hosted git repository.
jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit f548ffa7a7dd4ac8cb018f47d1a1410e5e1f30ee
Author: SPRESENSE <41...@users.noreply.github.com>
AuthorDate: Wed May 19 17:04:18 2021 +0900
arch: cxd56xx: Support execution error by SCU sequencer
Enable interrupt by SCU sequencer execution error. If the interrupt
occurs, then it stops the sequencer and returns the error code.
---
arch/arm/src/cxd56xx/cxd56_scu.c | 36 +++++++++++++++++++++++++++++++-----
1 file changed, 31 insertions(+), 5 deletions(-)
diff --git a/arch/arm/src/cxd56xx/cxd56_scu.c b/arch/arm/src/cxd56xx/cxd56_scu.c
index 0e9cc31..dde3001 100644
--- a/arch/arm/src/cxd56xx/cxd56_scu.c
+++ b/arch/arm/src/cxd56xx/cxd56_scu.c
@@ -196,6 +196,7 @@ struct cxd56_scudev_s
uint8_t oneshot; /* Bitmap for Oneshots */
sem_t oneshotwait[3]; /* Semaphore for wait oneshot sequence is done */
+ int oneshoterr[3]; /* error code for oneshot sequencer */
struct ev_notify_s event[3]; /* MATHFUNC event notify */
struct wm_notify_s wm[14]; /* Watermark notify */
@@ -1066,6 +1067,7 @@ static int seq_oneshot(int bustype, int slave, FAR uint16_t *inst,
putreg32(1 << (tid + 24), SCU_INT_ENABLE_MAIN);
scuinfo("Sequencer start.\n");
+ priv->oneshoterr[tid] = 0;
/* Start sequencer as one shot mode */
@@ -1082,7 +1084,11 @@ static int seq_oneshot(int bustype, int slave, FAR uint16_t *inst,
scuinfo("Sequencer done.\n");
- if (buffer)
+ if (priv->oneshoterr[tid] < 0)
+ {
+ ret = ERROR;
+ }
+ else
{
/* Copy sequencer output results to user buffer.
* XXX: Sequencer output RAM offset is differ from document.
@@ -1661,6 +1667,8 @@ static int seq_scuirqhandler(int irq, FAR void *context, FAR void *arg)
uint32_t ierr0;
uint32_t ierr1;
uint32_t ierr2;
+ uint32_t out;
+ int tid;
int i;
intr = getreg32(SCU_INT_MASKED_STT_MAIN);
@@ -1721,16 +1729,30 @@ static int seq_scuirqhandler(int irq, FAR void *context, FAR void *arg)
if (ierr2 != 0)
{
scuerr("err2: %08x\n", ierr2);
- ierr2 &= 0x03ff;
+
for (i = 0; i < 10; i++)
{
- if (ierr2 & (1 << i))
+ if (ierr2 & (0x00010001 << i))
{
seq_stopseq(i);
+
+ /* Get sequencer output selector */
+
+ out = (getreg32(SCUSEQ_PROPERTY(i)) >> 12) & 0x3;
+
+ if (0 < out)
+ {
+ /* Set error code to oneshot sequencer id */
+
+ tid = out - 1;
+
+ priv->oneshoterr[tid] = -EIO;
+ seq_semgive(&priv->oneshotwait[tid]);
+ }
}
}
- putreg32(0x03ff, SCU_INT_CLEAR_ERR_2);
+ putreg32(ierr2, SCU_INT_CLEAR_ERR_2);
}
return 0;
@@ -3461,7 +3483,11 @@ void scu_initialize(void)
/* Enable error interrupt */
putreg32(0x007ffe00, SCU_INT_ENABLE_ERR_0);
- putreg32(0x03ff, SCU_INT_ENABLE_ERR_2);
+ putreg32(0x03ff03ff, SCU_INT_ENABLE_ERR_2);
+
+ /* Set the number of TxAbort repeat times */
+
+ putreg32(5, SCUSEQ_REPEAT_TXABORT);
/* Enable SCU IRQ */