]> Pileus Git - ~andy/csm213a-hw/blob - hw2/timer_dma.h
Fix whitespace error
[~andy/csm213a-hw] / hw2 / timer_dma.h
1 #ifndef TIMER_DMA_H
2 #define TIMER_DMA_H
3
4 #include <stdarg.h>
5 #include <MKL46Z4.h>
6 #include <PinNames.h>
7
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 /* Sizes */
13 #define TDMA_NUM_CHAN  4
14
15 /* DMA Channels */
16 typedef enum {
17         TDMA_CHAN0,
18         TDMA_CHAN1,
19         TDMA_CHAN2,
20         TDMA_CHAN3,
21 } tdma_chan_t;
22
23 /* Port */
24 typedef struct tdma_t tdma_t;
25
26 /* Open */
27 tdma_t *tdma_open(tdma_chan_t chan, int alt, PinName pin, PinMode mode);
28
29 /* Flush/Wait */
30 void tdma_start(tdma_t *port);
31 void tdma_stop(tdma_t *port, int wait);
32 int  tdma_stamp(tdma_t *port, uint64_t *time);
33
34 /* Time */
35 uint64_t tdma_time(void);
36
37 /* Debug print */
38 void tdma_debug(tdma_t *port);
39
40 #ifdef __cplusplus
41 }
42 #endif
43
44 #endif