SH7263/SH7203 Group
Data Transfer to On-chip Peripheral Modules with DMAC
REJ06B0734-0100/Rev.1.00 April 2008 Page 10 of 17
2. Sample Program Listing "main.c" (2)
54 /* ---- Values for baud rate specification ---- */
55 enum{
56 CBR_1200,
57 CBR_2400,
58 CBR_4800,
59 CBR_9600,
60 CBR_19200,
61 CBR_31250,
62 CBR_38400,
63 CBR_57600,
64 CBR_115200
65 };
66
67 /* ==== Table of register setting values ==== */
68 static SH7203_BAUD_SET scif_baud[] = {
69 {214, 1}, /* 1200bps (-0.07%) */
70 {106, 1}, /* 2400bps ( 0.39%) */
71 {214, 0}, /* 4800bps (-0.07%) */
72 {106, 0}, /* 9600bps ( 0.39%) */
73 { 53, 0}, /* 19200bps (-0.54%) */
74 { 32, 0}, /* 31250bps ( 0.00%) */
75 { 26, 0}, /* 38400bps (-0.54%) */
76 { 17, 0}, /* 57600bps (-0.54%) */
77 { 8, 0} /*115200bps (-0.54%) */
78 };
79 /* Character string to be transmitted */
80 const signed char data[] = "SCIF request DMAC Sample Software SH7203.¥r¥n";
81
82 /*""FUNC COMMENT""*******************************************************
83 * Outline : Sample Program Main (UART transmission with use of DMAC)
84 *-----------------------------------------------------------------------
85 * Include : #include <string.h>
86 *-----------------------------------------------------------------------
87 * Declaration : void main(void);
88 *-----------------------------------------------------------------------
89 * Function : The character string data stored in external memory is DMA transferred
90 * : to the SCIF transmit FIFO data register. The DMAC is activated
91 * : by an SCIF transmit interrupt request.
92 *-----------------------------------------------------------------------
93 * Argument : void
94 *-----------------------------------------------------------------------
95 * Return Value : void
96 *-----------------------------------------------------------------------
97 * Notice :
98 *""FUNC COMMENT END""***************************************************/
99 void main(void)
100 {
101 /* ==== Enabling DMAC initialization/transfer ==== */
102 io_init_dma1(data, (void *)&SCIF0.SCFTDR.BYTE ,sizeof(data),
103 DMA_SIZE_BYTE | DMA_INT_DISABLE);
104 /* On-chip peripheral module request (SCIF transmit interrupt request) */
105 /* Data transfer from external memory to SCIF transmit */
106 /* Data transfer to data registers */