FreeNOS
lib
libarch
arm
broadcom
BroadcomGPIO.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2015 Niek Linnenbank
3
*
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef __LIBARCH_ARM_BROADCOMGPIO_H
19
#define __LIBARCH_ARM_BROADCOMGPIO_H
20
21
#include <FreeNOS/System.h>
22
#include <
Types.h
>
23
38
class
BroadcomGPIO
39
{
40
private
:
41
42
static
const
Address
GPIOBase
= 0x200000;
43
47
enum
Registers
48
{
49
FunctionSelect0
= 0
50
};
51
52
public
:
53
57
enum
Mode
58
{
59
Input
= 0,
60
Output
= 1,
61
Function0
= 4,
62
Function1
= 5,
63
Function2
= 6,
64
Function3
= 7,
65
Function4
= 3,
66
Function5
= 2
67
};
68
72
enum
Result
73
{
74
Success
,
75
NotFound
,
76
IOError
77
};
78
79
public
:
80
84
BroadcomGPIO
();
85
91
virtual
Result
initialize
();
92
101
virtual
Result
setAltFunction
(
Size
pin,
uint
function
);
102
103
private
:
104
106
Arch::IO
m_io
;
107
};
108
115
#endif
/* __LIBARCH_ARM_BROADCOMGPIO_H */
BroadcomGPIO::IOError
@ IOError
Definition:
BroadcomGPIO.h:76
BroadcomGPIO::Function1
@ Function1
Definition:
BroadcomGPIO.h:62
Types.h
BroadcomGPIO::GPIOBase
static const Address GPIOBase
Definition:
BroadcomGPIO.h:42
ARMIO
Input/Output operations specific to the ARM architecture.
Definition:
ARMIO.h:39
BroadcomGPIO::Function3
@ Function3
Definition:
BroadcomGPIO.h:64
BroadcomGPIO::Input
@ Input
Definition:
BroadcomGPIO.h:59
Address
unsigned long Address
A memory address.
Definition:
Types.h:131
BroadcomGPIO::BroadcomGPIO
BroadcomGPIO()
Constructor.
Definition:
BroadcomGPIO.cpp:21
BroadcomGPIO::Output
@ Output
Definition:
BroadcomGPIO.h:60
uint
unsigned int uint
Unsigned integer number.
Definition:
Types.h:44
BroadcomGPIO::initialize
virtual Result initialize()
Initialize the Controller.
Definition:
BroadcomGPIO.cpp:25
BroadcomGPIO::Success
@ Success
Definition:
BroadcomGPIO.h:74
Size
unsigned int Size
Any sane size indicator cannot go negative.
Definition:
Types.h:128
BroadcomGPIO::setAltFunction
virtual Result setAltFunction(Size pin, uint function)
Set alternate function.
Definition:
BroadcomGPIO.cpp:35
BroadcomGPIO::Registers
Registers
Hardware registers.
Definition:
BroadcomGPIO.h:47
BroadcomGPIO::FunctionSelect0
@ FunctionSelect0
Definition:
BroadcomGPIO.h:49
BroadcomGPIO::Result
Result
Result code.
Definition:
BroadcomGPIO.h:72
BroadcomGPIO::Function5
@ Function5
Definition:
BroadcomGPIO.h:66
BroadcomGPIO::Function0
@ Function0
Definition:
BroadcomGPIO.h:61
BroadcomGPIO::m_io
Arch::IO m_io
I/O instance.
Definition:
BroadcomGPIO.h:106
BroadcomGPIO::Function4
@ Function4
Definition:
BroadcomGPIO.h:65
BroadcomGPIO::NotFound
@ NotFound
Definition:
BroadcomGPIO.h:75
BroadcomGPIO::Function2
@ Function2
Definition:
BroadcomGPIO.h:63
BroadcomGPIO
Broadcom (2835) GPIO controller implementation.
Definition:
BroadcomGPIO.h:38
BroadcomGPIO::Mode
Mode
Pin modes.
Definition:
BroadcomGPIO.h:57
Generated by
1.8.17