git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5750 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
ec80f9b8a4
commit
141f14c79a
|
@ -283,7 +283,7 @@ static void spi_start_dma_tx8(SPIDriver *spip,
|
|||
spip->dspi->PUSHR.R = spip->tx_intbuf | (uint32_t)*txbuf++;
|
||||
|
||||
/* Setting up TX1 DMA TCD parameters for 8 bits transfers.*/
|
||||
edmaChannelSetupLinkedOnMinor(
|
||||
edmaChannelSetupLinked(
|
||||
spip->tx1_channel, /* channel. */
|
||||
spip->tx2_channel, /* linkch. */
|
||||
txbuf, /* src. */
|
||||
|
@ -293,7 +293,7 @@ static void spi_start_dma_tx8(SPIDriver *spip,
|
|||
0, /* ssize, 8 bits transfers. */
|
||||
0, /* dsize, 8 bits transfers. */
|
||||
1, /* nbytes, always one. */
|
||||
n/* - 1*/, /* iter. */
|
||||
n - 1, /* iter. */
|
||||
0, /* slast, no source adjust. */
|
||||
0, /* dlast, no dest.adjust. */
|
||||
EDMA_TCD_MODE_DREQ); /* mode. */
|
||||
|
@ -691,6 +691,11 @@ void spi_lld_exchange(SPIDriver *spip, size_t n,
|
|||
the whole transmitted data is pushed here and the TX DMA is not
|
||||
activated.*/
|
||||
spi_tx_prefill8(spip, n, txbuf);
|
||||
/* uint8_t *p = rxbuf;
|
||||
*p++ = spip->dspi->POPR.R;
|
||||
*p++ = spip->dspi->POPR.R;
|
||||
*p++ = spip->dspi->POPR.R;
|
||||
*p++ = spip->dspi->POPR.R;*/
|
||||
}
|
||||
else {
|
||||
spi_start_dma_tx8(spip, n, txbuf);
|
||||
|
|
|
@ -743,7 +743,7 @@ typedef struct {
|
|||
|
||||
/**
|
||||
* @brief Sets the word 5 fields into a TCD.
|
||||
* @note Transfers are limited to 511 operations using this modality
|
||||
* @note Transfers are limited to 512 operations using this modality
|
||||
* (citer parameter).
|
||||
*
|
||||
* @param[in] tcdp pointer to an @p edma_tcd_t structure
|
||||
|
@ -753,7 +753,7 @@ typedef struct {
|
|||
*
|
||||
* @api
|
||||
*/
|
||||
#define edmaTCDSetWord5LinkedOnMinor(tcdp, linkch, citer, doff) \
|
||||
#define edmaTCDSetWord5Linked(tcdp, linkch, citer, doff) \
|
||||
((tcdp)->word[5] = (((uint32_t)0x80000000) | \
|
||||
((uint32_t)(linkch) << 25) | \
|
||||
((uint32_t)(citer) << 16) | \
|
||||
|
@ -785,7 +785,7 @@ typedef struct {
|
|||
|
||||
/**
|
||||
* @brief Sets the word 7 fields into a TCD.
|
||||
* @note Transfers are limited to 511 operations using this modality
|
||||
* @note Transfers are limited to 512 operations using this modality
|
||||
* (biter parameter).
|
||||
*
|
||||
* @param[in] tcdp pointer to an @p edma_tcd_t structure
|
||||
|
@ -795,7 +795,7 @@ typedef struct {
|
|||
*
|
||||
* @api
|
||||
*/
|
||||
#define edmaTCDSetWord7LinkedOnMinor(tcdp, linkch, biter, mode) \
|
||||
#define edmaTCDSetWord7Linked(tcdp, linkch, biter, mode) \
|
||||
((tcdp)->word[7] = (((uint32_t)0x80000000) | \
|
||||
((uint32_t)(linkch) << 25) | \
|
||||
((uint32_t)(biter) << 16) | \
|
||||
|
@ -854,8 +854,9 @@ typedef struct {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief EDMA channel setup with linked channel on minor loop counter.
|
||||
* @note Transfers are limited to 511 operations using this modality
|
||||
* @brief EDMA channel setup with linked channel on both minor and major
|
||||
* loop counters.
|
||||
* @note Transfers are limited to 512 operations using this modality
|
||||
* (iter parameter).
|
||||
*
|
||||
* @param[in] channel eDMA channel number
|
||||
|
@ -874,7 +875,7 @@ typedef struct {
|
|||
*
|
||||
* @api
|
||||
*/
|
||||
#define edmaChannelSetupLinkedOnMinor(channel, linkch, src, dst, soff, \
|
||||
#define edmaChannelSetupLinked(channel, linkch, src, dst, soff, \
|
||||
doff, ssize, dsize, nbytes, iter, \
|
||||
slast, dlast, mode) { \
|
||||
edma_tcd_t *tcdp = edmaGetTCD(channel); \
|
||||
|
@ -883,9 +884,11 @@ typedef struct {
|
|||
edmaTCDSetWord2(tcdp, nbytes); \
|
||||
edmaTCDSetWord3(tcdp, slast); \
|
||||
edmaTCDSetWord4(tcdp, dst); \
|
||||
edmaTCDSetWord5LinkedOnMinor(tcdp, linkch, iter, doff); \
|
||||
edmaTCDSetWord5Linked(tcdp, linkch, iter, doff); \
|
||||
edmaTCDSetWord6(tcdp, dlast); \
|
||||
edmaTCDSetWord7LinkedOnMinor(tcdp, linkch, iter, mode); \
|
||||
edmaTCDSetWord7Linked(tcdp, linkch, iter, (mode) | \
|
||||
EDMA_TCD_MODE_MELINK | \
|
||||
EDMA_TCD_MODE_MLINKCH(linkch)); \
|
||||
}
|
||||
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -116,6 +116,11 @@ int main(void) {
|
|||
txbuf[i] = (uint8_t)i;
|
||||
|
||||
spiStart(&SPID2, &hs_spicfg);
|
||||
SIU.PCR[102].R = PAL_MODE_OUTPUT_ALTERNATE(1); /* SCK */
|
||||
SIU.PCR[103].R = PAL_MODE_OUTPUT_ALTERNATE(1); /* SIN */
|
||||
SIU.PCR[104].R = PAL_MODE_OUTPUT_ALTERNATE(1); /* SOUT */
|
||||
SIU.PCR[105].R = PAL_MODE_OUTPUT_ALTERNATE(1); /* PCS[0] */
|
||||
|
||||
spiExchange(&SPID2, 4, txbuf, rxbuf);
|
||||
spiExchange(&SPID2, 4, txbuf, rxbuf);
|
||||
spiExchange(&SPID2, 4, txbuf, rxbuf);
|
||||
|
|
Loading…
Reference in New Issue