FreeNOS
Public Types | Public Member Functions | Private Types | Private Attributes | Static Private Attributes
BroadcomGPIO Class Reference

Broadcom (2835) GPIO controller implementation. More...

#include <BroadcomGPIO.h>

Public Types

enum  Mode {
  Input = 0, Output = 1, Function0 = 4, Function1 = 5,
  Function2 = 6, Function3 = 7, Function4 = 3, Function5 = 2
}
 Pin modes. More...
 
enum  Result { Success, NotFound, IOError }
 Result code. More...
 

Public Member Functions

 BroadcomGPIO ()
 Constructor. More...
 
virtual Result initialize ()
 Initialize the Controller. More...
 
virtual Result setAltFunction (Size pin, uint function)
 Set alternate function. More...
 

Private Types

enum  Registers { FunctionSelect0 = 0 }
 Hardware registers. More...
 

Private Attributes

Arch::IO m_io
 I/O instance. More...
 

Static Private Attributes

static const Address GPIOBase = 0x200000
 

Detailed Description

Broadcom (2835) GPIO controller implementation.

Definition at line 38 of file BroadcomGPIO.h.

Member Enumeration Documentation

◆ Mode

Pin modes.

Enumerator
Input 
Output 
Function0 
Function1 
Function2 
Function3 
Function4 
Function5 

Definition at line 57 of file BroadcomGPIO.h.

◆ Registers

Hardware registers.

Enumerator
FunctionSelect0 

Definition at line 47 of file BroadcomGPIO.h.

◆ Result

Result code.

Enumerator
Success 
NotFound 
IOError 

Definition at line 72 of file BroadcomGPIO.h.

Constructor & Destructor Documentation

◆ BroadcomGPIO()

BroadcomGPIO::BroadcomGPIO ( )

Constructor.

Definition at line 21 of file BroadcomGPIO.cpp.

Member Function Documentation

◆ initialize()

BroadcomGPIO::Result BroadcomGPIO::initialize ( )
virtual

Initialize the Controller.

Returns
Result code

Definition at line 25 of file BroadcomGPIO.cpp.

References Memory::Device, GPIOBase, IOError, m_io, IO::map(), PAGESIZE, Memory::Readable, IO::Success, Success, Memory::User, and Memory::Writable.

◆ setAltFunction()

BroadcomGPIO::Result BroadcomGPIO::setAltFunction ( Size  pin,
uint  function 
)
virtual

Set alternate function.

Parameters
pinPin number to set.
functionAlternate function number to set.
Returns
Result code.

Definition at line 35 of file BroadcomGPIO.cpp.

References FunctionSelect0, m_io, ARMIO::set(), and Success.

Field Documentation

◆ GPIOBase

const Address BroadcomGPIO::GPIOBase = 0x200000
staticprivate

Definition at line 42 of file BroadcomGPIO.h.

Referenced by initialize().

◆ m_io

Arch::IO BroadcomGPIO::m_io
private

I/O instance.

Definition at line 106 of file BroadcomGPIO.h.

Referenced by initialize(), and setAltFunction().


The documentation for this class was generated from the following files: