dma.c
Go to the documentation of this file.
1 /*
2  * dma.c
3  *
4  * Copyright (c) 2014 Jeremy Garff <jer @ jers.net>
5  *
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without modification, are permitted
9  * provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice, this list of
12  * conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright notice, this list
14  * of conditions and the following disclaimer in the documentation and/or other materials
15  * provided with the distribution.
16  * 3. Neither the name of the owner nor the names of its contributors may be used to endorse
17  * or promote products derived from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  */
29 
30 
31 #include <stdint.h>
32 #include <stdio.h>
33 #include <string.h>
34 #include <stdlib.h>
35 #include <unistd.h>
36 
37 #include <sys/types.h>
38 #include <sys/stat.h>
39 #include <sys/mman.h>
40 
41 #include "dma.h"
42 
43 
44 // DMA address mapping by DMA number index
45 static const uint32_t dma_offset[] =
46 {
63 };
64 
65 
66 uint32_t dmanum_to_offset(int dmanum)
67 {
68  int array_size = sizeof(dma_offset) / sizeof(dma_offset[0]);
69 
70  if (dmanum >= array_size)
71  {
72  return 0;
73  }
74 
75  return dma_offset[dmanum];
76 }
77 
78 
#define DMA7_OFFSET
Definition: dma.h:109
#define DMA10_OFFSET
Definition: dma.h:112
#define DMA13_OFFSET
Definition: dma.h:115
static const uint32_t dma_offset[]
Definition: dma.c:45
#define DMA5_OFFSET
Definition: dma.h:107
#define DMA6_OFFSET
Definition: dma.h:108
uint32_t dmanum_to_offset(int dmanum)
Definition: dma.c:66
#define DMA2_OFFSET
Definition: dma.h:104
#define DMA8_OFFSET
Definition: dma.h:110
#define DMA12_OFFSET
Definition: dma.h:114
#define DMA1_OFFSET
Definition: dma.h:103
#define DMA0_OFFSET
Definition: dma.h:102
#define DMA9_OFFSET
Definition: dma.h:111
#define DMA14_OFFSET
Definition: dma.h:116
#define DMA4_OFFSET
Definition: dma.h:106
#define DMA3_OFFSET
Definition: dma.h:105
#define DMA11_OFFSET
Definition: dma.h:113
#define DMA15_OFFSET
Definition: dma.h:117


ws281x
Author(s): Alexey Rogachevskiy , Oleg Kalachev
autogenerated on Wed Jun 15 2022 02:46:00