]> Pileus Git - ~andy/csm213a-hw/blob - hw2/timer_dma.h
c6d276307581c77a473137cb63527e2dce42aa8d
[~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 void tdma_init(void);
28
29 /* Open */
30 tdma_t *tdma_open(tdma_chan_t chan, int alt, PinName pin, PinMode mode);
31
32 /* Flush/Wait */
33 void tdma_reset(tdma_t *port);
34 int  tdma_stamp(tdma_t *port, uint64_t *time);
35
36 /* Time */
37 uint64_t tdma_time(void);
38
39 /* Debug print */
40 void tdma_debug(tdma_t *port);
41
42 #ifdef __cplusplus
43 }
44 #endif
45
46 #endif