@@ -31,9 +31,10 @@ namespace platform
31
31
*
32
32
* TODO: say something about the nature of implementation
33
33
*
34
- * @tparam DmaChannelTX DMA channel for sending
34
+ * @tparam DmaChannelTX DMA channel for sending
35
35
*
36
- * @author Marton Ledneczki, Raphael Lehmann
36
+ * @author Marton Ledneczki
37
+ * @author Raphael Lehmann
37
38
* @ingroup modm_platform_i2s modm_platform_i2s_{{id}}
38
39
*/
39
40
template <class DmaChannelTx>
@@ -46,10 +47,11 @@ class I2sMaster{{ id }} : public modm::I2sMaster
46
47
Peripheral::Spi{{ id }}, DmaBase::Signal::Tx>::Request;
47
48
};
48
49
49
- public:
50
+ public: // TBD: private?
50
51
using Hal = I2sHal{{ id }};
51
52
52
53
54
+ public:
53
55
template< class... Signals >
54
56
static void
55
57
connect()
@@ -83,11 +85,12 @@ public:
83
85
Hal::initialize(odd_factor ? Hal::OddFactor::Enabled : Hal::OddFactor::Disabled,
84
86
i2s_div);
85
87
88
+ dmaError = false;
86
89
Dma::TxChannel::configure(
87
90
DmaBase::DataTransferDirection::MemoryToPeripheral, DmaBase::MemoryDataSize::Bit16,
88
91
DmaBase::PeripheralDataSize::Bit16, DmaBase::MemoryIncrementMode::Increment,
89
92
DmaBase::PeripheralIncrementMode::Fixed, dmaPriority,
90
- DmaBase::CircularMode::Disabled, DmaBase::DoubleBufferMode::Enabled );
93
+ DmaBase::CircularMode::Disabled);
91
94
Dma::TxChannel::setPeripheralAddress(SPI{{ id }}_BASE + 0x0c);
92
95
Dma::TxChannel::setTransferErrorIrqHandler(handleDmaTransferError);
93
96
Dma::TxChannel::enableInterruptVector();
@@ -97,40 +100,29 @@ public:
97
100
}
98
101
99
102
static inline void
100
- setTxBufferAddresses(uintptr_t first_address, uintptr_t second_address , std::size_t length)
103
+ setTxBufferAddresses(uintptr_t address , std::size_t length)
101
104
{
102
- Dma::TxChannel::setMemoryAddress(first_address);
103
- Dma::TxChannel::setMemoryAddress2(second_address);
105
+ Dma::TxChannel::setMemoryAddress(address);
104
106
Dma::TxChannel::setDataLength(length);
105
107
}
106
108
107
109
static inline void
108
- setTxBufferAddress1(uintptr_t first_address)
109
- {
110
- Dma::TxChannel::setMemoryAddress(first_address);
111
- }
112
-
113
- static inline void
114
- setTxBufferAddress2( uintptr_t second_address)
115
- {
116
- Dma::TxChannel::setMemoryAddress2(second_address);
117
- }
118
-
119
- static inline bool
120
- isBuffer1Active()
110
+ setTransferCompleteIrqHandler(DmaBase::IrqHandler handleDmaTransferComplete)
121
111
{
122
- return Dma::TxChannel::isPrimaryBufferActive( );
112
+ Dma::TxChannel::setTransferCompleteIrqHandler(handleDmaTransferComplete );
123
113
}
124
114
125
115
static inline void
126
116
start()
127
117
{
128
118
Dma::TxChannel::start();
119
+ Hal::start();
129
120
}
130
121
131
122
static inline void
132
123
stop()
133
124
{
125
+ //Hal::stop();
134
126
Dma::TxChannel::stop();
135
127
}
136
128
0 commit comments