source: rtems/bsps/arm/raspberrypi/include/bsp/vc.h

Last change on this file was f1f6cd95, checked in by Christian Mauderer <christian.mauderer@…>, on 12/27/19 at 21:08:12

bsp/raspberrypi: Fix size of work area.

The BSP tried to get the size of the SDRAM based on the revision code.
Unfortunately the code had some bugs so that the default size has been
used. Beneath that the MMU table hasn't been adapted.

This patch queries the SDRAM size via a special VC Mailbox call instead.
For the MMU adaption a simmilar method to the one in the imx BSP is
used.

  • Property mode set to 100644
File size: 4.4 KB
RevLine 
[54c197a]1/**
2 * @file
3 *
4 * @ingroup raspberrypi_vc
5 *
6 * @brief video core support.
7 *
8 */
9
10/*
11 * Copyright (c) 2015 Yang Qiao
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *
16 *  http://www.rtems.org/license/LICENSE
17 *
18 */
19
20#ifndef LIBBSP_ARM_RASPBERRYPI_VC_H
21#define LIBBSP_ARM_RASPBERRYPI_VC_H
22
23/**
24 * @defgroup raspberrypi_vc Register Definitions
25 *
[c991eeec]26 * @ingroup RTEMSBSPsARMRaspberryPi
[54c197a]27 *
28 * @brief Register Definitions
29 *
30 * @{
31 */
32
[68565b0]33typedef struct {
[54c197a]34  uint32_t width;
35  uint32_t height;
36} bcm2835_get_display_size_entries;
37
[68565b0]38int bcm2835_mailbox_get_display_size(
39  bcm2835_get_display_size_entries *_entries );
[54c197a]40
[68565b0]41typedef enum {
[54c197a]42  bcm2835_mailbox_pixel_order_bgr = 0,
43  bcm2835_mailbox_pixel_order_rgb = 1
44} bcm2835_pixel_order;
45
[68565b0]46typedef enum {
[54c197a]47  bcm2835_mailbox_alpha_mode_0_opaque       = 0,
48  bcm2835_mailbox_alpha_mode_0_transparent  = 1,
49  bcm2835_mailbox_alpha_mode_ignored        = 2
50} bcm2835_alpha_mode;
51
[68565b0]52typedef struct {
[54c197a]53  uint32_t xres;
54  uint32_t yres;
55  uint32_t xvirt;
56  uint32_t yvirt;
57  uint32_t depth;
58  bcm2835_pixel_order pixel_order;
59  bcm2835_alpha_mode alpha_mode;
60  uint32_t voffset_x;
61  uint32_t voffset_y;
62  uint32_t overscan_left;
63  uint32_t overscan_right;
64  uint32_t overscan_top;
65  uint32_t overscan_bottom;
66  uint32_t base;
67  size_t size;
68  uint32_t pitch;
69} bcm2835_init_frame_buffer_entries;
70
[68565b0]71int bcm2835_mailbox_init_frame_buffer(
72  bcm2835_init_frame_buffer_entries *_entries );
[54c197a]73
[68565b0]74typedef struct {
[54c197a]75  uint32_t pitch;
[68565b0]76} bcm2835_get_pitch_entries;
[54c197a]77
[68565b0]78int bcm2835_mailbox_get_pitch( bcm2835_get_pitch_entries *_entries );
[54c197a]79
[68565b0]80typedef struct {
81  char cmdline[ 1024 ];
[54c197a]82} bcm2835_get_cmdline_entries;
83
[68565b0]84int bcm2835_mailbox_get_cmdline( bcm2835_get_cmdline_entries *_entries );
[54c197a]85
[68565b0]86typedef enum {
[54c197a]87  bcm2835_mailbox_power_udid_sd_card = 0x00000000u,
88  bcm2835_mailbox_power_udid_uart0 = 0x00000001u,
89  bcm2835_mailbox_power_udid_uart1 = 0x00000002u,
90  bcm2835_mailbox_power_udid_usb_hcd = 0x00000003u,
91  bcm2835_mailbox_power_udid_i2c0 = 0x00000004u,
92  bcm2835_mailbox_power_udid_i2c1 = 0x00000005u,
93  bcm2835_mailbox_power_udid_i2c2 = 0x00000006u,
94  bcm2835_mailbox_power_udid_spi = 0x00000007u,
95  bcm2835_mailbox_power_udid_ccp2tx = 0x00000008u,
96} bcm2835_power_device_id;
97
[68565b0]98typedef struct {
[54c197a]99  bcm2835_power_device_id dev_id;
100  uint32_t state;
101} bcm2835_set_power_state_entries;
102
[68565b0]103#define BCM2835_MAILBOX_SET_POWER_STATE_REQ_ON ( 1 << 0 )
104#define BCM2835_MAILBOX_SET_POWER_STATE_REQ_WAIT ( 1 << 1 )
105#define BCM2835_MAILBOX_POWER_STATE_ON ( 1 << 0 )
106#define BCM2835_MAILBOX_POWER_STATE_NODEV ( 1 << 1 )
107int bcm2835_mailbox_set_power_state( bcm2835_set_power_state_entries *_entries );
[54c197a]108
[3c74f4aa]109int bcm2835_mailbox_get_power_state( bcm2835_set_power_state_entries *_entries );
110
[68565b0]111typedef struct {
[54c197a]112  uint32_t base;
[68565b0]113  size_t size;
114} bcm2835_get_arm_memory_entries;
[54c197a]115
[68565b0]116int bcm2835_mailbox_get_arm_memory( bcm2835_get_arm_memory_entries *_entries );
[54c197a]117
[68565b0]118typedef struct {
[54c197a]119  uint32_t base;
[68565b0]120  size_t size;
121} bcm2835_get_vc_memory_entries;
[54c197a]122
[68565b0]123int bcm2835_mailbox_get_vc_memory( bcm2835_get_vc_memory_entries *_entries );
[48704cde]124
[68565b0]125typedef struct {
[48704cde]126  uint32_t fw_rev;
127} bcm2835_mailbox_get_fw_rev_entries;
128
[68565b0]129int bcm2835_mailbox_get_firmware_revision(
130  bcm2835_mailbox_get_fw_rev_entries *_entries );
[48704cde]131
[68565b0]132typedef struct {
[48704cde]133  uint32_t spec;
134} bcm2835_get_board_spec_entries;
135
[68565b0]136int bcm2835_mailbox_get_board_model( bcm2835_get_board_spec_entries *_entries );
[48704cde]137
[68565b0]138int bcm2835_mailbox_get_board_revision(
139  bcm2835_get_board_spec_entries *_entries );
[3c74f4aa]140
[f1f6cd95]141/*
142 * See the official documentation for the format of the revision codes:
143 * https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
144 */
145#define BCM2835_REVISION_IS_NEW_STYLE(revision) ((revision & (1 << 23)) != 0)
146#define BCM2835_REVISION_MEMORY_SIZE(revision) ((revision >> 20) & 0x7)
147#define BCM2835_REVISION_MANUFACTURER(revision) ((revision >> 16) & 0xf)
148#define BCM2835_REVISION_PROCESSOR(revision) ((revision >> 12) & 0xf)
149#define BCM2835_REVISION_TYPE(revision) ((revision >> 4) & 0xff)
150#define BCM2835_REVISION_REVISION(revision) ((revision >> 0) & 0xf)
151
[3c74f4aa]152typedef struct {
153  uint64_t board_serial;
154} bcm2835_get_board_serial_entries;
155
156int bcm2835_mailbox_get_board_serial(
157  bcm2835_get_board_serial_entries *_entries );
158
159typedef struct {
160  uint32_t clock_id;
161  uint32_t clock_rate;
162} bcm2835_get_clock_rate_entries;
163
164int bcm2835_mailbox_get_clock_rate(
165  bcm2835_get_clock_rate_entries *_entries );
[54c197a]166/** @} */
167
168#endif /* LIBBSP_ARM_RASPBERRYPI_VC_H */
Note: See TracBrowser for help on using the repository browser.