blob: f864cd5f4bad1dfdd984bb66a8b2c22de82bafa6 [file] [log] [blame]
Jonny Svärd9fc527b2020-11-16 16:18:07 +01001/*
2 * Copyright (c) 2020 Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19#ifndef MHU_JUNO_HPP
20#define MHU_JUNO_HPP
21
22#include <mailbox.hpp>
23
24#include <cstddef>
25#include <cstdint>
26
27namespace Mailbox {
28
29// Doorbell implementation only
30class MHUJuno : public Mailbox {
31public:
32 MHUJuno(const uint32_t baseAddress);
33 virtual ~MHUJuno();
34 virtual bool sendMessage() final;
35 virtual void handleMessage() final;
36 virtual bool verifyHardware() final;
37
38private:
39 /* Offsets */
40 static constexpr uint32_t CPU0_INTR_STAT = 0x00;
41 static constexpr uint32_t CPU0_INTR_SET = 0x04;
42 static constexpr uint32_t CPU0_INTR_CLR = 0x08;
43 static constexpr uint32_t CPU1_INTR_STAT = 0x10;
44 static constexpr uint32_t CPU1_INTR_SET = 0x14;
45 static constexpr uint32_t CPU1_INTR_CLR = 0x18;
46 static constexpr uint32_t OFFSET = 0x10;
47 static constexpr uint32_t PIDR0 = 0xfe0;
48 static constexpr uint32_t PIDR1 = 0xfe4;
49 static constexpr uint32_t PIDR2 = 0xfe8;
50 static constexpr uint32_t PIDR3 = 0xfec;
51 static constexpr uint32_t PIDR4 = 0xfd0;
52 static constexpr uint32_t CIDR0 = 0xff0;
53 static constexpr uint32_t CIDR1 = 0xff4;
54 static constexpr uint32_t CIDR2 = 0xff8;
55 static constexpr uint32_t CIDR3 = 0xffc;
56
57 volatile uint32_t *baseAddr;
58
59 void clearMessage();
60 void write(uint32_t offset, uint32_t val);
61 uint32_t read(uint32_t offset);
62};
63
64} // namespace Mailbox
65
66#endif /* #ifndef MHU_JUNO_HPP */