2020-2021 Sunseeker Telemetry and Lighting System
dma.h
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // dma.h - Driver for the DMA Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_DMA_H__
8 #define __MSP430WARE_DMA_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #if defined(__MSP430_HAS_DMAX_3__) || defined(__MSP430_HAS_DMAX_6__)
13 
14 //*****************************************************************************
15 //
16 // If building with a C++ compiler, make all of the definitions in this header
17 // have a C binding.
18 //
19 //*****************************************************************************
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 #include "inc/hw_memmap.h"
26 //*****************************************************************************
27 //
29 //
30 //*****************************************************************************
31 typedef struct DMA_initParam {
42  uint8_t channelSelect;
57  uint16_t transferModeSelect;
61  uint16_t transferSize;
97  uint8_t triggerSourceSelect;
104  uint8_t transferUnitSelect;
112  uint8_t triggerTypeSelect;
113 } DMA_initParam;
114 
115 
116 
117 //*****************************************************************************
118 //
119 // The following are values that can be passed to the triggerSourceSelect
120 // parameter for functions: DMA_init(); the param parameter for functions:
121 // DMA_init().
122 //
123 //*****************************************************************************
124 #define DMA_TRIGGERSOURCE_0 (0x00)
125 #define DMA_TRIGGERSOURCE_1 (0x01)
126 #define DMA_TRIGGERSOURCE_2 (0x02)
127 #define DMA_TRIGGERSOURCE_3 (0x03)
128 #define DMA_TRIGGERSOURCE_4 (0x04)
129 #define DMA_TRIGGERSOURCE_5 (0x05)
130 #define DMA_TRIGGERSOURCE_6 (0x06)
131 #define DMA_TRIGGERSOURCE_7 (0x07)
132 #define DMA_TRIGGERSOURCE_8 (0x08)
133 #define DMA_TRIGGERSOURCE_9 (0x09)
134 #define DMA_TRIGGERSOURCE_10 (0x0A)
135 #define DMA_TRIGGERSOURCE_11 (0x0B)
136 #define DMA_TRIGGERSOURCE_12 (0x0C)
137 #define DMA_TRIGGERSOURCE_13 (0x0D)
138 #define DMA_TRIGGERSOURCE_14 (0x0E)
139 #define DMA_TRIGGERSOURCE_15 (0x0F)
140 #define DMA_TRIGGERSOURCE_16 (0x10)
141 #define DMA_TRIGGERSOURCE_17 (0x11)
142 #define DMA_TRIGGERSOURCE_18 (0x12)
143 #define DMA_TRIGGERSOURCE_19 (0x13)
144 #define DMA_TRIGGERSOURCE_20 (0x14)
145 #define DMA_TRIGGERSOURCE_21 (0x15)
146 #define DMA_TRIGGERSOURCE_22 (0x16)
147 #define DMA_TRIGGERSOURCE_23 (0x17)
148 #define DMA_TRIGGERSOURCE_24 (0x18)
149 #define DMA_TRIGGERSOURCE_25 (0x19)
150 #define DMA_TRIGGERSOURCE_26 (0x1A)
151 #define DMA_TRIGGERSOURCE_27 (0x1B)
152 #define DMA_TRIGGERSOURCE_28 (0x1C)
153 #define DMA_TRIGGERSOURCE_29 (0x1D)
154 #define DMA_TRIGGERSOURCE_30 (0x1E)
155 #define DMA_TRIGGERSOURCE_31 (0x1F)
156 
157 //*****************************************************************************
158 //
159 // The following are values that can be passed to the param parameter for
160 // functions: DMA_init(); the transferModeSelect parameter for functions:
161 // DMA_init().
162 //
163 //*****************************************************************************
164 #define DMA_TRANSFER_SINGLE (DMADT_0)
165 #define DMA_TRANSFER_BLOCK (DMADT_1)
166 #define DMA_TRANSFER_BURSTBLOCK (DMADT_2)
167 #define DMA_TRANSFER_REPEATED_SINGLE (DMADT_4)
168 #define DMA_TRANSFER_REPEATED_BLOCK (DMADT_5)
169 #define DMA_TRANSFER_REPEATED_BURSTBLOCK (DMADT_6)
170 
171 //*****************************************************************************
172 //
173 // The following are values that can be passed to the channelSelect parameter
174 // for functions: DMA_init(), DMA_setTransferSize(), DMA_getTransferSize(),
175 // DMA_setSrcAddress(), DMA_setDstAddress(), DMA_enableTransfers(),
176 // DMA_disableTransfers(), DMA_startTransfer(), DMA_enableInterrupt(),
177 // DMA_disableInterrupt(), DMA_getInterruptStatus(), DMA_clearInterrupt(),
178 // DMA_getNMIAbortStatus(), and DMA_clearNMIAbort(); the param parameter for
179 // functions: DMA_init().
180 //
181 //*****************************************************************************
182 #define DMA_CHANNEL_0 (0x00)
183 #define DMA_CHANNEL_1 (0x10)
184 #define DMA_CHANNEL_2 (0x20)
185 #define DMA_CHANNEL_3 (0x30)
186 #define DMA_CHANNEL_4 (0x40)
187 #define DMA_CHANNEL_5 (0x50)
188 #define DMA_CHANNEL_6 (0x60)
189 #define DMA_CHANNEL_7 (0x70)
190 
191 //*****************************************************************************
192 //
193 // The following are values that can be passed to the triggerTypeSelect
194 // parameter for functions: DMA_init(); the param parameter for functions:
195 // DMA_init().
196 //
197 //*****************************************************************************
198 #define DMA_TRIGGER_RISINGEDGE (!(DMALEVEL))
199 #define DMA_TRIGGER_HIGH (DMALEVEL)
200 
201 //*****************************************************************************
202 //
203 // The following are values that can be passed to the transferUnitSelect
204 // parameter for functions: DMA_init(); the param parameter for functions:
205 // DMA_init().
206 //
207 //*****************************************************************************
208 #define DMA_SIZE_SRCWORD_DSTWORD (!(DMASRCBYTE + DMADSTBYTE))
209 #define DMA_SIZE_SRCBYTE_DSTWORD (DMASRCBYTE)
210 #define DMA_SIZE_SRCWORD_DSTBYTE (DMADSTBYTE)
211 #define DMA_SIZE_SRCBYTE_DSTBYTE (DMASRCBYTE + DMADSTBYTE)
212 
213 //*****************************************************************************
214 //
215 // The following are values that can be passed to the directionSelect parameter
216 // for functions: DMA_setSrcAddress(), and DMA_setDstAddress().
217 //
218 //*****************************************************************************
219 #define DMA_DIRECTION_UNCHANGED (DMASRCINCR_0)
220 #define DMA_DIRECTION_DECREMENT (DMASRCINCR_2)
221 #define DMA_DIRECTION_INCREMENT (DMASRCINCR_3)
222 
223 //*****************************************************************************
224 //
225 // The following are values that can be passed toThe following are values that
226 // can be returned by the DMA_getInterruptStatus() function.
227 //
228 //*****************************************************************************
229 #define DMA_INT_INACTIVE (0x0)
230 #define DMA_INT_ACTIVE (DMAIFG)
231 
232 //*****************************************************************************
233 //
234 // The following are values that can be passed toThe following are values that
235 // can be returned by the DMA_getNMIAbortStatus() function.
236 //
237 //*****************************************************************************
238 #define DMA_NOTABORTED (0x0)
239 #define DMA_ABORTED (DMAABORT)
240 
241 //*****************************************************************************
242 //
243 // Prototypes for the APIs.
244 //
245 //*****************************************************************************
246 
247 //*****************************************************************************
248 //
263 //
264 //*****************************************************************************
265 extern void DMA_init(DMA_initParam *param);
266 
267 //*****************************************************************************
268 //
292 //
293 //*****************************************************************************
294 extern void DMA_setTransferSize(uint8_t channelSelect,
295  uint16_t transferSize);
296 
297 //*****************************************************************************
298 //
317 //
318 //*****************************************************************************
319 extern uint16_t DMA_getTransferSize(uint8_t channelSelect);
320 
321 //*****************************************************************************
322 //
353 //
354 //*****************************************************************************
355 extern void DMA_setSrcAddress(uint8_t channelSelect,
356  uint32_t srcAddress,
357  uint16_t directionSelect);
358 
359 //*****************************************************************************
360 //
390 //
391 //*****************************************************************************
392 extern void DMA_setDstAddress(uint8_t channelSelect,
393  uint32_t dstAddress,
394  uint16_t directionSelect);
395 
396 //*****************************************************************************
397 //
415 //
416 //*****************************************************************************
417 extern void DMA_enableTransfers(uint8_t channelSelect);
418 
419 //*****************************************************************************
420 //
439 //
440 //*****************************************************************************
441 extern void DMA_disableTransfers(uint8_t channelSelect);
442 
443 //*****************************************************************************
444 //
466 //
467 //*****************************************************************************
468 extern void DMA_startTransfer(uint8_t channelSelect);
469 
470 //*****************************************************************************
471 //
490 //
491 //*****************************************************************************
492 extern void DMA_enableInterrupt(uint8_t channelSelect);
493 
494 //*****************************************************************************
495 //
514 //
515 //*****************************************************************************
516 extern void DMA_disableInterrupt(uint8_t channelSelect);
517 
518 //*****************************************************************************
519 //
540 //
541 //*****************************************************************************
542 extern uint16_t DMA_getInterruptStatus(uint8_t channelSelect);
543 
544 //*****************************************************************************
545 //
564 //
565 //*****************************************************************************
566 extern void DMA_clearInterrupt(uint8_t channelSelect);
567 
568 //*****************************************************************************
569 //
592 //
593 //*****************************************************************************
594 extern uint16_t DMA_getNMIAbortStatus(uint8_t channelSelect);
595 
596 //*****************************************************************************
597 //
617 //
618 //*****************************************************************************
619 extern void DMA_clearNMIAbort(uint8_t channelSelect);
620 
621 //*****************************************************************************
622 //
631 //
632 //*****************************************************************************
633 extern void DMA_disableTransferDuringReadModifyWrite(void);
634 
635 //*****************************************************************************
636 //
645 //
646 //*****************************************************************************
647 extern void DMA_enableTransferDuringReadModifyWrite(void);
648 
649 //*****************************************************************************
650 //
660 //
661 //*****************************************************************************
662 extern void DMA_enableRoundRobinPriority(void);
663 
664 //*****************************************************************************
665 //
675 //
676 //*****************************************************************************
677 extern void DMA_disableRoundRobinPriority(void);
678 
679 //*****************************************************************************
680 //
689 //
690 //*****************************************************************************
691 extern void DMA_enableNMIAbort(void);
692 
693 //*****************************************************************************
694 //
702 //
703 //*****************************************************************************
704 extern void DMA_disableNMIAbort(void);
705 
706 //*****************************************************************************
707 //
708 // Mark the end of the C bindings section for C++ compilers.
709 //
710 //*****************************************************************************
711 #ifdef __cplusplus
712 }
713 #endif
714 
715 #endif
716 #endif // __MSP430WARE_DMA_H__
MPU_initThreeSegmentsParam param