Changeset ee685630 in mainline


Ignore:
Timestamp:
2012-04-11T17:43:37Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0747468
Parents:
179f6f2
Message:

Add framebuffer support for bbmx (amdm37x/omap37).

Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • HelenOS.config

    r179f6f2 ree685630  
    537537@ "1920x1080"
    538538@ "1920x1200"
    539 ! [(PLATFORM=ia32|PLATFORM=amd64)&CONFIG_HID_OUT!=none&CONFIG_FB=y] CONFIG_BFB_MODE (choice)
     539! [(PLATFORM=ia32|PLATFORM=amd64|MACHINE=beagleboardxm)&CONFIG_HID_OUT!=none&CONFIG_FB=y] CONFIG_BFB_MODE (choice)
    540540
    541541% Default framebuffer depth
     
    543543@ "16"
    544544@ "24"
    545 ! [(PLATFORM=ia32|PLATFORM=amd64)&CONFIG_HID_OUT!=none&CONFIG_FB=y] CONFIG_BFB_BPP (choice)
     545! [(PLATFORM=ia32|PLATFORM=amd64|MACHINE=beagleboardxm)&CONFIG_HID_OUT!=none&CONFIG_FB=y] CONFIG_BFB_BPP (choice)
    546546
    547547% Start AP processors by the loader
  • defaults/arm32/beagleboardxm/Makefile.config

    r179f6f2 ree685630  
    66
    77#framebuffer
    8 CONFIG_FB = n
     8CONFIG_FB = y
     9
     10CONFIG_BFB_MODE = 1024x768
     11CONFIG_BFB_BPP = 24
  • kernel/arch/arm32/src/mach/beagleboardxm/beagleboardxm.c

    r179f6f2 ree685630  
    3838#include <genarch/drivers/amdm37x_uart/amdm37x_uart.h>
    3939#include <genarch/drivers/amdm37x_gpt/amdm37x_gpt.h>
     40#include <genarch/drivers/amdm37x_dispc/amdm37x_dispc.h>
     41#include <genarch/fb/fb.h>
    4042#include <genarch/srln/srln.h>
    4143#include <interrupt.h>
     
    5961
    6062static struct beagleboard {
     63        amdm37x_dispc_regs_t *dispc;
    6164        amdm37x_irc_regs_t *irc_addr;
    6265        amdm37x_uart_t uart;
     
    8285}
    8386
     87static void bbxm_setup_fb(unsigned width, unsigned height, unsigned bpp)
     88{
     89        const unsigned pixel_bytes = (bpp / 8);
     90        const size_t size = ALIGN_UP(width * height * pixel_bytes, FRAME_SIZE);
     91        const unsigned frames = size / FRAME_SIZE;
     92        unsigned order = 0;
     93        unsigned frame = 1;
     94        while (frame < frames) {
     95                frame *= 2;
     96                ++order;
     97        }
     98        printf("Allocating %d (2^%d) frames.\n", size, order);
     99        /* prefer highmem as we don't care about virtual mapping. */
     100        void *buffer = frame_alloc(order, FRAME_LOWMEM);
     101        ASSERT(buffer);
     102
     103        amdm37x_dispc_setup_fb(beagleboard.dispc, width, height, bpp,
     104            (uintptr_t) buffer);
     105
     106        fb_properties_t prop = {
     107                .addr = (uintptr_t)buffer,
     108                .offset = 0,
     109                .x = width,
     110                .y = height,
     111                .scan = width * pixel_bytes,
     112                .visual = VISUAL_RGB_5_6_5_LE
     113        };
     114        switch (bpp)
     115        {
     116        case 8:
     117                prop.visual = VISUAL_INDIRECT_8; break;
     118        case 16:
     119                prop.visual = VISUAL_RGB_5_6_5_LE; break;
     120        case 24:
     121                prop.visual = VISUAL_RGB_8_8_8; break;
     122        case 32:
     123                prop.visual = VISUAL_RGB_8_8_8_0; break;
     124        default:
     125                printf("Invalid framebuffer bit depth: bailing out.\n");
     126                return;
     127        }
     128        outdev_t *fb_dev = fb_init(&prop);
     129        if (fb_dev)
     130                stdout_wire(fb_dev);
     131
     132}
     133
    84134static void bb_timer_irq_handler(irq_t *irq)
    85135{
     
    100150            (void *) km_map(AMDM37x_IRC_BASE_ADDRESS, AMDM37x_IRC_SIZE,
    101151            PAGE_NOT_CACHEABLE);
     152        ASSERT(beagleboard.irc_addr);
    102153        amdm37x_irc_init(beagleboard.irc_addr);
    103154
     155        /* Map display controller */
     156        beagleboard.dispc = (void*) km_map(AMDM37x_DISPC_BASE_ADDRESS,
     157            AMDM37x_DISPC_SIZE, PAGE_NOT_CACHEABLE);
     158        ASSERT(beagleboard.dispc);
    104159
    105160        /* Initialize timer, pick timer1, because it is in always-power domain
     
    167222{
    168223#ifdef CONFIG_FB
    169 #error "Frame buffer is not yet supported!"
     224        bbxm_setup_fb(CONFIG_BFB_WIDTH, CONFIG_BFB_HEIGHT, CONFIG_BFB_BPP);
     225#else
     226        (void)bbxm_setup_fb;
    170227#endif
    171228        /* UART3 is wired to external RS232 connector */
Note: See TracChangeset for help on using the changeset viewer.