Main Page
+
Namespaces
Namespace List
+
Namespace Members
All
Functions
Variables
+
Classes
Class List
+
Class Members
+
All
a
b
c
d
e
f
g
h
i
l
m
n
p
r
s
t
v
w
+
Variables
a
b
c
d
e
f
g
h
i
l
m
n
p
r
s
t
v
w
+
Files
File List
+
File Members
+
All
a
b
c
d
e
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
+
Functions
a
c
d
e
g
m
p
q
r
s
u
w
+
Variables
c
d
h
l
m
p
r
s
v
w
Typedefs
Enumerations
Enumerator
+
Macros
a
b
c
d
g
h
i
l
m
n
o
p
r
s
t
v
w
vendor
rpi_ws281x
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
{
47
DMA0_OFFSET
,
48
DMA1_OFFSET
,
49
DMA2_OFFSET
,
50
DMA3_OFFSET
,
51
DMA4_OFFSET
,
52
DMA5_OFFSET
,
53
DMA6_OFFSET
,
54
DMA7_OFFSET
,
55
DMA8_OFFSET
,
56
DMA9_OFFSET
,
57
DMA10_OFFSET
,
58
DMA11_OFFSET
,
59
DMA12_OFFSET
,
60
DMA13_OFFSET
,
61
DMA14_OFFSET
,
62
DMA15_OFFSET
,
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
dma.h
DMA7_OFFSET
#define DMA7_OFFSET
Definition:
dma.h:109
DMA10_OFFSET
#define DMA10_OFFSET
Definition:
dma.h:112
DMA13_OFFSET
#define DMA13_OFFSET
Definition:
dma.h:115
dma_offset
static const uint32_t dma_offset[]
Definition:
dma.c:45
DMA5_OFFSET
#define DMA5_OFFSET
Definition:
dma.h:107
DMA6_OFFSET
#define DMA6_OFFSET
Definition:
dma.h:108
dmanum_to_offset
uint32_t dmanum_to_offset(int dmanum)
Definition:
dma.c:66
DMA2_OFFSET
#define DMA2_OFFSET
Definition:
dma.h:104
DMA8_OFFSET
#define DMA8_OFFSET
Definition:
dma.h:110
DMA12_OFFSET
#define DMA12_OFFSET
Definition:
dma.h:114
DMA1_OFFSET
#define DMA1_OFFSET
Definition:
dma.h:103
DMA0_OFFSET
#define DMA0_OFFSET
Definition:
dma.h:102
DMA9_OFFSET
#define DMA9_OFFSET
Definition:
dma.h:111
DMA14_OFFSET
#define DMA14_OFFSET
Definition:
dma.h:116
DMA4_OFFSET
#define DMA4_OFFSET
Definition:
dma.h:106
DMA3_OFFSET
#define DMA3_OFFSET
Definition:
dma.h:105
DMA11_OFFSET
#define DMA11_OFFSET
Definition:
dma.h:113
DMA15_OFFSET
#define DMA15_OFFSET
Definition:
dma.h:117
ws281x
Author(s): Alexey Rogachevskiy
, Oleg Kalachev
autogenerated on Wed Jun 15 2022 02:46:00