Changes in kernel/arch/arm32/src/mach/beagleboardxm/beagleboardxm.c [69483af:1466a8f] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/src/mach/beagleboardxm/beagleboardxm.c
r69483af r1466a8f 35 35 #include <arch/exception.h> 36 36 #include <arch/mach/beagleboardxm/beagleboardxm.h> 37 #include <genarch/drivers/amdm37x/uart.h> 38 #include <genarch/drivers/amdm37x/irc.h> 39 #include <genarch/drivers/amdm37x/gpt.h> 37 #include <genarch/drivers/amdm37x_irc/amdm37x_irc.h> 38 #include <genarch/drivers/amdm37x_uart/amdm37x_uart.h> 39 #include <genarch/drivers/amdm37x_gpt/amdm37x_gpt.h> 40 #include <genarch/drivers/amdm37x_dispc/amdm37x_dispc.h> 40 41 #include <genarch/fb/fb.h> 41 42 #include <genarch/srln/srln.h> … … 60 61 61 62 static struct beagleboard { 63 amdm37x_dispc_regs_t *dispc; 62 64 amdm37x_irc_regs_t *irc_addr; 63 omap_uart_t uart;65 amdm37x_uart_t uart; 64 66 amdm37x_gpt_t timer; 65 67 } beagleboard; … … 83 85 } 84 86 87 static 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 /* prefer highmem as we don't care about virtual mapping. */ 99 void *buffer = frame_alloc(order, FRAME_LOWMEM); 100 if (!buffer) { 101 printf("Failed to allocate framebuffer.\n"); 102 return; 103 } 104 105 amdm37x_dispc_setup_fb(beagleboard.dispc, width, height, bpp, 106 (uintptr_t) buffer); 107 108 fb_properties_t prop = { 109 .addr = (uintptr_t)buffer, 110 .offset = 0, 111 .x = width, 112 .y = height, 113 .scan = width * pixel_bytes, 114 .visual = VISUAL_RGB_5_6_5_LE 115 }; 116 switch (bpp) 117 { 118 case 8: 119 prop.visual = VISUAL_INDIRECT_8; break; 120 case 16: 121 prop.visual = VISUAL_RGB_5_6_5_LE; break; 122 case 24: 123 prop.visual = VISUAL_BGR_8_8_8; break; 124 case 32: 125 prop.visual = VISUAL_RGB_8_8_8_0; break; 126 default: 127 printf("Invalid framebuffer bit depth: bailing out.\n"); 128 return; 129 } 130 outdev_t *fb_dev = fb_init(&prop); 131 if (fb_dev) 132 stdout_wire(fb_dev); 133 134 } 135 85 136 static void bb_timer_irq_handler(irq_t *irq) 86 137 { … … 103 154 ASSERT(beagleboard.irc_addr); 104 155 amdm37x_irc_init(beagleboard.irc_addr); 156 157 /* Map display controller */ 158 beagleboard.dispc = (void*) km_map(AMDM37x_DISPC_BASE_ADDRESS, 159 AMDM37x_DISPC_SIZE, PAGE_NOT_CACHEABLE); 160 ASSERT(beagleboard.dispc); 105 161 106 162 /* Initialize timer. Use timer1, because it is in WKUP power domain … … 167 223 static void bbxm_output_init(void) 168 224 { 169 #ifdef CONFIG_OMAP_UART 225 #ifdef CONFIG_FB 226 bbxm_setup_fb(CONFIG_BFB_WIDTH, CONFIG_BFB_HEIGHT, CONFIG_BFB_BPP); 227 #else 228 (void)bbxm_setup_fb; 229 #endif 170 230 /* UART3 is wired to external RS232 connector */ 171 const bool ok = omap_uart_init(&beagleboard.uart,231 const bool ok = amdm37x_uart_init(&beagleboard.uart, 172 232 AMDM37x_UART3_IRQ, AMDM37x_UART3_BASE_ADDRESS, AMDM37x_UART3_SIZE); 173 233 if (ok) { 174 234 stdout_wire(&beagleboard.uart.outdev); 175 235 } 176 #endif177 236 } 178 237 179 238 static void bbxm_input_init(void) 180 239 { 181 #ifdef CONFIG_OMAP_UART182 240 srln_instance_t *srln_instance = srln_init(); 183 241 if (srln_instance) { 184 242 indev_t *sink = stdin_wire(); 185 243 indev_t *srln = srln_wire(srln_instance, sink); 186 omap_uart_input_wire(&beagleboard.uart, srln);244 amdm37x_uart_input_wire(&beagleboard.uart, srln); 187 245 amdm37x_irc_enable(beagleboard.irc_addr, AMDM37x_UART3_IRQ); 188 246 } 189 #endif190 247 } 191 248
Note:
See TracChangeset
for help on using the changeset viewer.
