mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
s32k3xx:LPSPI Check for TX complete before RX
Co-authored-by: David Sidrane <david.sidrane@nscdg.com>
This commit is contained in:
committed by
Xiang Xiao
parent
e7449cf97a
commit
9c27d96b8a
@@ -102,6 +102,10 @@
|
|||||||
#define EDMA_ALIGN_MASK (EDMA_ALIGN - 1)
|
#define EDMA_ALIGN_MASK (EDMA_ALIGN - 1)
|
||||||
#define EDMA_ALIGN_UP(n) (((n) + EDMA_ALIGN_MASK) & ~EDMA_ALIGN_MASK)
|
#define EDMA_ALIGN_UP(n) (((n) + EDMA_ALIGN_MASK) & ~EDMA_ALIGN_MASK)
|
||||||
|
|
||||||
|
#ifdef CONFIG_S32K3XX_DTCM_HEAP
|
||||||
|
# define DTCM_BACKDOOR_OFFSET 0x1000000
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -154,12 +158,6 @@ struct s32k3xx_edma_s
|
|||||||
struct s32k3xx_dmach_s dmach[S32K3XX_EDMA_NCHANNELS];
|
struct s32k3xx_dmach_s dmach[S32K3XX_EDMA_NCHANNELS];
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_S32K3XX_DTCM_HEAP
|
|
||||||
extern uint8_t DTCM_BASE_ADDR[];
|
|
||||||
extern uint8_t DTCM_END_ADDR[];
|
|
||||||
#define DTCM_BACKDOOR_OFFSET 0x1000000
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -417,6 +415,15 @@ const struct peripheral_clock_config_s edma_clockconfig[] =
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_S32K3XX_DTCM_HEAP
|
||||||
|
extern uint8_t DTCM_BASE_ADDR[];
|
||||||
|
extern uint8_t DTCM_END_ADDR[];
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -623,14 +630,14 @@ static inline void s32k3xx_tcd_configure(struct s32k3xx_edmatcd_s *tcd,
|
|||||||
#ifdef CONFIG_S32K3XX_DTCM_HEAP
|
#ifdef CONFIG_S32K3XX_DTCM_HEAP
|
||||||
/* Remap address to backdoor address for eDMA */
|
/* Remap address to backdoor address for eDMA */
|
||||||
|
|
||||||
if (tcd->saddr >= (uint32_t)DTCM_BASE_ADDR
|
if (tcd->saddr >= (uint32_t)DTCM_BASE_ADDR &&
|
||||||
&& tcd->saddr < (uint32_t)DTCM_END_ADDR)
|
tcd->saddr < (uint32_t)DTCM_END_ADDR)
|
||||||
{
|
{
|
||||||
tcd->saddr += DTCM_BACKDOOR_OFFSET;
|
tcd->saddr += DTCM_BACKDOOR_OFFSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tcd->daddr >= (uint32_t)DTCM_BASE_ADDR
|
if (tcd->daddr >= (uint32_t)DTCM_BASE_ADDR &&
|
||||||
&& tcd->daddr < (uint32_t)DTCM_END_ADDR)
|
tcd->daddr < (uint32_t)DTCM_END_ADDR)
|
||||||
{
|
{
|
||||||
tcd->daddr += DTCM_BACKDOOR_OFFSET;
|
tcd->daddr += DTCM_BACKDOOR_OFFSET;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1826,11 +1826,11 @@ static void s32k3xx_lpspi_exchange(struct spi_dev_s *dev,
|
|||||||
|
|
||||||
/* Then wait for each to complete */
|
/* Then wait for each to complete */
|
||||||
|
|
||||||
ret = spi_dmarxwait(priv);
|
ret = spi_dmatxwait(priv);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
ret = spi_dmatxwait(priv);
|
ret = spi_dmarxwait(priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset any status */
|
/* Reset any status */
|
||||||
|
|||||||
Reference in New Issue
Block a user