I applied the 4 patches ( I had to use the “patch” command, I could not get
“git apply” to work for some reason )
It runs on the Raspberry Pi A+ ( 256MB RAM, single core ) , but it did not boot
on the Raspberry Pi 2. I commented out the calls to rpi_init_cmdline() and it
booted on the Pi 2 again.
I will try to troubleshoot more as soon as I can.
Alan
> On Apr 28, 2016, at 7:29 AM, Pavel Pisa wrote:
>
> From: YANG Qiao
> Date: Thu, 13 Aug 2015 00:06:10 +0200
>
> ---
> c/src/lib/libbsp/arm/raspberrypi/Makefile.am | 1 +
> c/src/lib/libbsp/arm/raspberrypi/console/fb.c | 331 ++
> 2 files changed, 332 insertions(+)
> create mode 100644 c/src/lib/libbsp/arm/raspberrypi/console/fb.c
>
> diff --git a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
> b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
> index 258f8a0..77935dc 100644
> --- a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
> +++ b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
> @@ -114,6 +114,7 @@ libbsp_a_SOURCES += ../../shared/console_select.c
> libbsp_a_SOURCES += ../../shared/console_write.c
> libbsp_a_SOURCES += console/console-config.c
> libbsp_a_SOURCES += console/usart.c
> +libbsp_a_SOURCES += console/fb.c
>
> # Mailbox
> libbsp_a_SOURCES += misc/mailbox.c
> diff --git a/c/src/lib/libbsp/arm/raspberrypi/console/fb.c
> b/c/src/lib/libbsp/arm/raspberrypi/console/fb.c
> new file mode 100644
> index 000..a83d560
> --- /dev/null
> +++ b/c/src/lib/libbsp/arm/raspberrypi/console/fb.c
> @@ -0,0 +1,331 @@
> +/**
> + * @file
> + *
> + * @ingroup raspberrypi
> + *
> + * @brief framebuffer support.
> + */
> +
> +/*
> + * Copyright (c) 2015 Yang Qiao
> + *
> + * The license and distribution terms for this file may be
> + * found in the file LICENSE in this distribution or at
> + *
> + * http://www.rtems.org/license/LICENSE
> + *
> + */
> +
> +#include
> +#include
> +#include
> +#include
> +
> +#include
> +#include
> +#include
> +#include
> +
> +#include
> +#include
> +#include
> +#include
> +#include
> +
> +#define SCREEN_WIDTH 1024
> +#define SCREEN_HEIGHT 768
> +#define BPP 32
> +#define BUFFER_SIZE (SCREEN_WIDTH*SCREEN_HEIGHT*BPP/8)
> +
> +/* flag to limit driver to protect against multiple opens */
> +static Atomic_Flag driver_mutex;
> +
> +/*
> + * screen information for the driver (fb0).
> + */
> +
> +static struct fb_var_screeninfo fb_var_info = {
> + .xres= SCREEN_WIDTH,
> + .yres= SCREEN_HEIGHT,
> + .bits_per_pixel = BPP
> +};
> +
> +static struct fb_fix_screeninfo fb_fix_info = {
> + .smem_start = (void *) NULL,
> + .smem_len= 0,
> + .type= FB_TYPE_PACKED_PIXELS,
> + .visual = FB_VISUAL_TRUECOLOR,
> + .line_length = 0
> +};
> +
> +int raspberrypi_get_fix_screen_info( struct fb_fix_screeninfo *info )
> +{
> + *info = fb_fix_info;
> + return 0;
> +}
> +
> +int raspberrypi_get_var_screen_info( struct fb_var_screeninfo *info )
> +{
> + *info = fb_var_info;
> + return 0;
> +}
> +
> +static int
> +find_mode_from_cmdline(void)
> +{
> + const char* opt;
> + char* endptr;
> + uint32_t width;
> + uint32_t height;
> + uint32_t bpp;
> + opt = rpi_cmdline_arg("--video=");
> + if (opt)
> + {
> + opt += sizeof("--video=")-1;
> + width = strtol(opt, &endptr, 10);
> + if (*endptr != 'x')
> + {
> + return -2;
> + }
> + opt = endptr+1;
> + height = strtol(opt, &endptr, 10);
> + switch (*endptr)
> + {
> + case '-':
> + opt = endptr+1;
> + if (strlen(opt) <= 2)
> + bpp = strtol(opt, &endptr, 10);
> + else
> + {
> + bpp = strtol(opt, &endptr, 10);
> + if (*endptr != ' ')
> + {
> + return -4;
> + }
> + }
> + case ' ':
> + case 0:
> + break;
> + default:
> + return -3;
> + }
> + }
> + else
> +return -1;
> +
> + fb_var_info.xres= width;
> + fb_var_info.yres= height;
> +
> + return 0;
> +}
> +
> +static int
> +find_mode_from_vc(void)
> +{
> + bcm2835_get_display_size_entries entries;
> + bcm2835_mailbox_get_display_size(&entries);
> + unsigned int width = entries.width;
> + unsigned int height = entries.height;
> +
> + if (width == 0 || height == 0)
> + {
> +fb_var_info.xres= SCREEN_WIDTH;
> +fb_var_info.yres= SCREEN_HEIGHT;
> + }
> + else
> + {
> +fb_var_info.xres = width;
> +fb_var_info.yres = height;
> + }
> +
> + return 0;
> +}
> +
> +static bool
> +hdmi_is_present(void)
> +{
> + bcm2835_get_display_size_entries entries;
> + bcm2835_mailbox_get_display_size(&entries);
> + if(entries.width == 0x290 && entries.height ==0x1A0 )
> + {
> +return false;
> + }
> + else
> + {
> +return true;
> + }
> +}
> +
> +int
> +fb_init(void)
> +{
> + if (fb_fix_i