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

Broadcom System-on-Chip Mailbox interface. More...

#include <BroadcomMailbox.h>

Public Types

enum  Result { Success, IOError }
 Result codes. More...
 
enum  Channel {
  PowerManagement = 0, FrameBuffer = 1, VirtualUART = 2, VCHIQ = 3,
  LED = 4, Button = 5, TouchScreen = 6, VCProperty = 8,
  ARMProperty = 9
}
 Mailbox channels. More...
 

Public Member Functions

 BroadcomMailbox ()
 Constructor. More...
 
Result initialize ()
 Initialize the Mailbox. More...
 
Result read (Channel channel, u32 *message) const
 Read 28-bit message. More...
 
Result write (Channel channel, u32 message)
 Write 28-bit message. More...
 

Private Types

enum  Register { Read = 0x0880, Status = 0x0898, Config = 0x089c, Write = 0x08a0 }
 Hardware registers. More...
 
enum  StatusFlags { Full = 0x80000000, Empty = 0x40000000 }
 Status register flags. More...
 

Private Attributes

ARMIO m_io
 I/O object. More...
 

Static Private Attributes

static const Address Base = 0xb000
 Register base offset for the Mailbox. More...
 
static const uint ChannelMask = 0xf
 Channel Mask when reading or writing (lowest 4-bits). More...
 

Detailed Description

Broadcom System-on-Chip Mailbox interface.

The Mailbox on the BCM2835 is a message-based interface between the ARM and the GPU. It provides channels for sending and receiving messages.

See also
https://github.com/raspberrypi/firmware/wiki/Mailboxes
https://github.com/raspberrypi/firmware/wiki/Accessing-mailboxes
https://github.com/torvalds/linux/blob/master/drivers/mailbox/bcm2835-mailbox.c

Definition at line 47 of file BroadcomMailbox.h.

Member Enumeration Documentation

◆ Channel

Mailbox channels.

Enumerator
PowerManagement 
FrameBuffer 
VirtualUART 
VCHIQ 
LED 
Button 
TouchScreen 
VCProperty 
ARMProperty 

Definition at line 91 of file BroadcomMailbox.h.

◆ Register

Hardware registers.

Enumerator
Read 
Status 
Config 
Write 

Definition at line 60 of file BroadcomMailbox.h.

◆ Result

Result codes.

Enumerator
Success 
IOError 

Definition at line 82 of file BroadcomMailbox.h.

◆ StatusFlags

Status register flags.

Enumerator
Full 
Empty 

Definition at line 71 of file BroadcomMailbox.h.

Constructor & Destructor Documentation

◆ BroadcomMailbox()

BroadcomMailbox::BroadcomMailbox ( )

Constructor.

Definition at line 21 of file BroadcomMailbox.cpp.

Member Function Documentation

◆ initialize()

BroadcomMailbox::Result BroadcomMailbox::initialize ( )

Initialize the Mailbox.

Returns
Result code.

Definition at line 25 of file BroadcomMailbox.cpp.

References Base, Config, Memory::Device, IOError, m_io, IO::map(), PAGESIZE, Memory::Readable, IO::Success, Success, Memory::User, Memory::Writable, and ARMIO::write().

Referenced by BroadcomPower::initialize().

◆ read()

BroadcomMailbox::Result BroadcomMailbox::read ( Channel  channel,
u32 message 
) const

Read 28-bit message.

Parameters
channel
message28-bit message on output
Returns
Result code.

Definition at line 37 of file BroadcomMailbox.cpp.

References ChannelMask, Empty, m_io, Read, ARMIO::read(), Status, and Success.

Referenced by BroadcomPower::enable().

◆ write()

BroadcomMailbox::Result BroadcomMailbox::write ( Channel  channel,
u32  message 
)

Write 28-bit message.

Parameters
channelChannel to write to.
message28-bit message to write.
Returns
Result code.

Definition at line 54 of file BroadcomMailbox.cpp.

References Full, m_io, ARMIO::read(), Status, Success, ARMIO::write(), and Write.

Referenced by BroadcomPower::enable(), and BroadcomPower::initialize().

Field Documentation

◆ Base

const Address BroadcomMailbox::Base = 0xb000
staticprivate

Register base offset for the Mailbox.

Definition at line 52 of file BroadcomMailbox.h.

Referenced by initialize().

◆ ChannelMask

const uint BroadcomMailbox::ChannelMask = 0xf
staticprivate

Channel Mask when reading or writing (lowest 4-bits).

Definition at line 55 of file BroadcomMailbox.h.

Referenced by read().

◆ m_io

ARMIO BroadcomMailbox::m_io
private

I/O object.

Definition at line 141 of file BroadcomMailbox.h.

Referenced by initialize(), read(), and write().


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