SH7263/SH7203 Group
Data Transfer to On-chip Peripheral Modules with DMAC
REJ06B0734-0100/Rev.1.00 April 2008 Page 13 of 17 5. Sample Program Listing "main.c" (5)
217 bit6 : DS : DREQ select :0 Low level Unused
218 bit5 : TB : cycle :0--------------- Cycle-stealing mode
219 bit4-3 : TS : transfer size:B'00--- Byte transfer
220 bit2 : IE : interrupt enable:0--- Disable interrupt
221 bit1 : TE : transfer end----------
222 bit0 : DE : DMA enable bit:0----- DMA
223 */
224
225 /* ----Setting DMA extension resource selector 0---- */
226 DMAC.DMARS0.BIT.CH1MID = 0x20; /* MID = SCIF0 */
227 DMAC.DMARS0.BIT.CH1RID = 0x01; /* RID = Transmission */
228
229 /* ----Setting DMA operation register---- */
230 DMAC.DMAOR.WORD &= 0xfff9u; /* Clear AE,NMI bits */
231
232 if(DMAC.DMAOR.BIT.DME == 0ul){ /* Enable DMA transfer on all channels */
233 DMAC.DMAOR.BIT.DME = 1ul;
234 }
235
236 /* ----DMA transfer execution---- */
237 DMAC.CHCR1.BIT.DE = 1ul; /* Enable DMA transfer */
238 }
239 /*""FUNC COMMENT""*******************************************************
240 * Outline : DMAC stop
241 *-----------------------------------------------------------------------
242 * Include : #include "iodefine.h"
243 *-----------------------------------------------------------------------
244 * Declaration : void io_dma1_stop(void);
245 *-----------------------------------------------------------------------
246 * Function : Detects the end of DMA transfer and disables DMA transfer
247 *-----------------------------------------------------------------------
248 * Argument : void
249 *-----------------------------------------------------------------------
250 * Return Value: void
251 *-----------------------------------------------------------------------
252 * Notice :
253 *""FUNC COMMENT END""***************************************************/
254 void io_dma1_stop(void)
255 {
256 /* Detecting end of transfer */
257 while(DMAC.CHCR1.BIT.TE == 0ul){
258 /* Wait until the TE bit is set*/
259 }
260
261 /* ----Stopping DMA transfer---- */
262 DMAC.CHCR1.BIT.DE = 0ul; /* Disable DMA1 transfer */
263 }
264
265 /*""FUNC COMMENT""*******************************************************
266 * Outline : Initial setting of SCIF0 as an asynchronous (UART) transmit module
267 *-----------------------------------------------------------------------
268 * Include : #include "iodefine.h"
269 *-----------------------------------------------------------------------
270 * Declaration : void io_init_scif0(int bps);
271 *-----------------------------------------------------------------------