FreeNOS
BroadcomMailbox.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_BROADCOM_MAILBOX_H
19 #define __LIBARCH_ARM_BROADCOM_MAILBOX_H
20 
21 #include <Types.h>
22 #include <Macros.h>
23 #include <arm/ARMIO.h>
24 
48 {
49  private:
50 
52  static const Address Base = 0xb000;
53 
55  static const uint ChannelMask = 0xf;
56 
60  enum Register
61  {
62  Read = 0x0880,
63  Status = 0x0898,
64  Config = 0x089c,
65  Write = 0x08a0
66  };
67 
72  {
73  Full = 0x80000000,
74  Empty = 0x40000000
75  };
76 
77  public:
78 
82  enum Result
83  {
86  };
87 
91  enum Channel
92  {
96  VCHIQ = 3,
97  LED = 4,
98  Button = 5,
102  };
103 
104  public:
105 
109  BroadcomMailbox();
110 
116  Result initialize();
117 
126  Result read(Channel channel, u32 *message) const;
127 
136  Result write(Channel channel, u32 message);
137 
138  private:
139 
142 };
143 
150 #endif /* __LIBARCH_ARM_BROADCOM_MAILBOX_H */
Channel
Unidirectional point-to-point messaging channel.
Definition: Channel.h:34
BroadcomMailbox::IOError
@ IOError
Definition: BroadcomMailbox.h:85
Macros.h
BroadcomMailbox::VCHIQ
@ VCHIQ
Definition: BroadcomMailbox.h:96
Types.h
BroadcomMailbox::Empty
@ Empty
Definition: BroadcomMailbox.h:74
BroadcomMailbox::Config
@ Config
Definition: BroadcomMailbox.h:64
BroadcomMailbox::Write
@ Write
Definition: BroadcomMailbox.h:65
ARMIO
Input/Output operations specific to the ARM architecture.
Definition: ARMIO.h:39
Address
unsigned long Address
A memory address.
Definition: Types.h:131
BroadcomMailbox::Success
@ Success
Definition: BroadcomMailbox.h:84
BroadcomMailbox::VCProperty
@ VCProperty
Definition: BroadcomMailbox.h:100
BroadcomMailbox
Broadcom System-on-Chip Mailbox interface.
Definition: BroadcomMailbox.h:47
uint
unsigned int uint
Unsigned integer number.
Definition: Types.h:44
BroadcomMailbox::LED
@ LED
Definition: BroadcomMailbox.h:97
BroadcomMailbox::Button
@ Button
Definition: BroadcomMailbox.h:98
BroadcomMailbox::Full
@ Full
Definition: BroadcomMailbox.h:73
BroadcomMailbox::BroadcomMailbox
BroadcomMailbox()
Constructor.
Definition: BroadcomMailbox.cpp:21
BroadcomMailbox::Result
Result
Result codes.
Definition: BroadcomMailbox.h:82
u32
unsigned int u32
Unsigned 32-bit number.
Definition: Types.h:53
BroadcomMailbox::VirtualUART
@ VirtualUART
Definition: BroadcomMailbox.h:95
BroadcomMailbox::PowerManagement
@ PowerManagement
Definition: BroadcomMailbox.h:93
BroadcomMailbox::read
Result read(Channel channel, u32 *message) const
Read 28-bit message.
Definition: BroadcomMailbox.cpp:37
BroadcomMailbox::ChannelMask
static const uint ChannelMask
Channel Mask when reading or writing (lowest 4-bits).
Definition: BroadcomMailbox.h:55
BroadcomMailbox::TouchScreen
@ TouchScreen
Definition: BroadcomMailbox.h:99
BroadcomMailbox::m_io
ARMIO m_io
I/O object.
Definition: BroadcomMailbox.h:141
BroadcomMailbox::Status
@ Status
Definition: BroadcomMailbox.h:63
BroadcomMailbox::write
Result write(Channel channel, u32 message)
Write 28-bit message.
Definition: BroadcomMailbox.cpp:54
BroadcomMailbox::Register
Register
Hardware registers.
Definition: BroadcomMailbox.h:60
BroadcomMailbox::ARMProperty
@ ARMProperty
Definition: BroadcomMailbox.h:101
BroadcomMailbox::FrameBuffer
@ FrameBuffer
Definition: BroadcomMailbox.h:94
ARMIO.h
BroadcomMailbox::Base
static const Address Base
Register base offset for the Mailbox.
Definition: BroadcomMailbox.h:52
BroadcomMailbox::Read
@ Read
Definition: BroadcomMailbox.h:62
BroadcomMailbox::initialize
Result initialize()
Initialize the Mailbox.
Definition: BroadcomMailbox.cpp:25
BroadcomMailbox::StatusFlags
StatusFlags
Status register flags.
Definition: BroadcomMailbox.h:71