Changeset f22f679 in mainline
- Timestamp:
- 2013-04-04T21:01:11Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 44186b01
- Parents:
- 409a996
- Location:
- kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/src/mach/raspberrypi/raspberrypi.c
r409a996 rf22f679 173 173 static void raspberrypi_output_init(void) 174 174 { 175 #ifdef CONFIG_FB 176 fb_properties_t prop; 177 if (bcm2835_fb_init(&prop)) { 178 outdev_t *fb_dev = fb_init(&prop); 179 if (fb_dev) 180 stdout_wire(fb_dev); 181 } 182 #endif 183 175 184 #ifdef CONFIG_PL011_UART 176 185 if (pl011_uart_init(&raspi.uart, BCM2835_UART_IRQ, -
kernel/genarch/include/genarch/drivers/bcm2835/mbox.h
r409a996 rf22f679 37 37 #define _BCM2835_MBOX_H_ 38 38 39 #include <genarch/fb/fb.h> 39 40 #include <arch/mm/page.h> 40 41 #include <align.h> … … 79 80 #define MBOX_MSG_VALUE(msg) ((msg) & ~0xf) 80 81 81 #define KA2VC (addr) (KA2PA(addr) + 0x40000000)82 #define KA2VCA(addr) (KA2PA(addr) + 0x40000000) 82 83 83 84 #define MBOX_ADDR_ALIGN 16 … … 120 121 } mbox_getmem_buf_t; 121 122 123 typedef struct { 124 ioport32_t width; 125 ioport32_t height; 126 ioport32_t virt_width; 127 ioport32_t virt_height; 128 ioport32_t pitch; 129 ioport32_t bpp; 130 ioport32_t x_offset; 131 ioport32_t y_offset; 132 ioport32_t addr; 133 ioport32_t size; 134 } bcm2835_fb_desc_t; 135 122 136 bool bcm2835_prop_get_memory(uint32_t *base, uint32_t *size); 137 bool bcm2835_fb_init(fb_properties_t *prop); 123 138 124 139 #endif -
kernel/genarch/src/drivers/bcm2835/mbox.c
r409a996 rf22f679 34 34 */ 35 35 36 #include <mm/km.h> 37 #include <mm/slab.h> 36 38 #include <typedefs.h> 37 39 #include <genarch/drivers/bcm2835/mbox.h> … … 39 41 static void mbox_write(bcm2835_mbox_t *mbox, uint8_t chan, uint32_t value) 40 42 { 41 if (!mbox)42 mbox = (bcm2835_mbox_t *)BCM2835_MBOX0_ADDR;43 44 43 while (mbox->status & MBOX_STATUS_FULL) ; 45 44 mbox->write = MBOX_COMPOSE(chan, value); … … 49 48 { 50 49 uint32_t msg; 51 52 if (!mbox)53 mbox = (bcm2835_mbox_t *)BCM2835_MBOX0_ADDR;54 50 55 51 do { … … 73 69 req->zero = 0; 74 70 75 mbox_write(NULL, MBOX_CHAN_PROP_A2V, KA2VC((uint32_t)req)); 76 mbox_read(NULL, MBOX_CHAN_PROP_A2V); 71 mbox_write((bcm2835_mbox_t *)BCM2835_MBOX0_ADDR, 72 MBOX_CHAN_PROP_A2V, KA2VCA((uint32_t)req)); 73 mbox_read((bcm2835_mbox_t *)BCM2835_MBOX0_ADDR, 74 MBOX_CHAN_PROP_A2V); 77 75 78 76 if (req->buf_hdr.code == MBOX_PROP_CODE_RESP_OK) { … … 87 85 } 88 86 87 bool bcm2835_fb_init(fb_properties_t *prop) 88 { 89 bcm2835_mbox_t *fb_mbox; 90 bcm2835_fb_desc_t *fb_desc; 91 void *fb_desc_buf; 92 bool ret = false; 93 94 fb_desc_buf = malloc(sizeof(bcm2835_fb_desc_t) + MBOX_ADDR_ALIGN, 0); 95 if (!fb_desc_buf) 96 return false; 97 98 fb_mbox = (void *) km_map(BCM2835_MBOX0_ADDR, sizeof(bcm2835_mbox_t), 99 PAGE_NOT_CACHEABLE); 100 fb_desc = (bcm2835_fb_desc_t *) ALIGN_UP((uintptr_t)fb_desc_buf, 101 MBOX_ADDR_ALIGN); 102 103 fb_desc->width = 640; 104 fb_desc->height = 480; 105 fb_desc->virt_width = fb_desc->width; 106 fb_desc->virt_height = fb_desc->height; 107 fb_desc->pitch = 0; /* Set by VC */ 108 fb_desc->bpp = 16; 109 fb_desc->x_offset = 0; 110 fb_desc->y_offset = 0; 111 fb_desc->addr = 0; /* Set by VC */ 112 fb_desc->size = 0; /* Set by VC */ 113 114 mbox_write(fb_mbox, MBOX_CHAN_FB, KA2VCA(fb_desc)); 115 116 if (mbox_read(fb_mbox, MBOX_CHAN_FB)) { 117 printf("BCM2835 framebuffer initialization failed\n"); 118 goto out; 119 } 120 121 prop->addr = fb_desc->addr; 122 prop->offset = 0; 123 prop->x = fb_desc->width; 124 prop->y = fb_desc->height; 125 prop->scan = fb_desc->pitch; 126 prop->visual = VISUAL_RGB_5_6_5_LE; 127 128 printf("BCM2835 framebuffer at 0x%08x (%dx%d)\n", prop->addr, 129 prop->x, prop->y); 130 ret = true; 131 out: 132 km_unmap((uintptr_t)fb_mbox, sizeof(bcm2835_mbox_t)); 133 free(fb_desc_buf); 134 return ret; 135 } 136 89 137 /** 90 138 * @}
Note:
See TracChangeset
for help on using the changeset viewer.