OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 Carlos Pizano-Uribe <cpu@chromium.org> | 2 * Copyright (c) 2015 Carlos Pizano-Uribe <cpu@chromium.org> |
3 * | 3 * |
4 * Permission is hereby granted, free of charge, to any person obtaining | 4 * Permission is hereby granted, free of charge, to any person obtaining |
5 * a copy of this software and associated documentation files | 5 * a copy of this software and associated documentation files |
6 * (the "Software"), to deal in the Software without restriction, | 6 * (the "Software"), to deal in the Software without restriction, |
7 * including without limitation the rights to use, copy, modify, merge, | 7 * including without limitation the rights to use, copy, modify, merge, |
8 * publish, distribute, sublicense, and/or sell copies of the Software, | 8 * publish, distribute, sublicense, and/or sell copies of the Software, |
9 * and to permit persons to whom the Software is furnished to do so, | 9 * and to permit persons to whom the Software is furnished to do so, |
10 * subject to the following conditions: | 10 * subject to the following conditions: |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 * | 47 * |
48 ****************************************************************************** | 48 ****************************************************************************** |
49 */ | 49 */ |
50 | 50 |
51 #include <err.h> | 51 #include <err.h> |
52 #include <debug.h> | 52 #include <debug.h> |
53 #include <trace.h> | 53 #include <trace.h> |
54 #include <target.h> | 54 #include <target.h> |
55 #include <compiler.h> | 55 #include <compiler.h> |
56 #include <string.h> | 56 #include <string.h> |
57 #include <lib/gfx.h> | |
58 #include <dev/gpio.h> | 57 #include <dev/gpio.h> |
59 #include <dev/display.h> | 58 #include <dev/display.h> |
60 #include <kernel/novm.h> | 59 #include <kernel/novm.h> |
61 #include <platform/stm32.h> | 60 #include <platform/stm32.h> |
62 | 61 |
63 /* | 62 /* |
64 * lcd initialization sequence, taken from | 63 * lcd initialization sequence, taken from |
65 * STM32Cube_FW_F7_V1.1.0/Drivers/BSP/STM32746G_Disco/stm32746g_discovery_lcd.[c
h] | 64 * STM32Cube_FW_F7_V1.1.0/Drivers/BSP/STM32746G_Disco/stm32746g_discovery_lcd.[c
h] |
66 * | 65 * |
67 * This code only applies to The RK043FN48H LCD 480x272. | 66 * This code only applies to The RK043FN48H LCD 480x272. |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 /* clear framebuffer */ | 394 /* clear framebuffer */ |
396 memset((void *)ltdc_handle.LayerCfg[active_layer].FBStartAdress, 0, | 395 memset((void *)ltdc_handle.LayerCfg[active_layer].FBStartAdress, 0, |
397 BSP_LCD_GetXSize() * BSP_LCD_GetYSize() * BSP_LCD_PixelSize()); | 396 BSP_LCD_GetXSize() * BSP_LCD_GetYSize() * BSP_LCD_PixelSize()); |
398 | 397 |
399 /* turn the display on */ | 398 /* turn the display on */ |
400 BSP_LCD_DisplayOn(); | 399 BSP_LCD_DisplayOn(); |
401 return LCD_OK; | 400 return LCD_OK; |
402 } | 401 } |
403 | 402 |
404 /* LK display (lib/gfx.h) calls this function */ | 403 /* LK display (lib/gfx.h) calls this function */ |
405 status_t display_get_info(struct display_info *info) | 404 status_t display_get_framebuffer(struct display_framebuffer *fb) |
406 { | 405 { |
407 info->framebuffer = (void *)ltdc_handle.LayerCfg[active_layer].FBStartAdress
; | 406 fb->image.pixels = (void *)ltdc_handle.LayerCfg[active_layer].FBStartAdress; |
408 | 407 |
409 if (ltdc_handle.LayerCfg[active_layer].PixelFormat == LTDC_PIXEL_FORMAT_ARGB
8888) { | 408 if (ltdc_handle.LayerCfg[active_layer].PixelFormat == LTDC_PIXEL_FORMAT_ARGB
8888) { |
410 info->format = GFX_FORMAT_ARGB_8888; | 409 fb->format = DISPLAY_FORMAT_ARGB_8888; |
| 410 fb->image.format = IMAGE_FORMAT_ARGB_8888; |
| 411 fb->image.rowbytes = BSP_LCD_GetXSize() * 4; |
411 } else if (ltdc_handle.LayerCfg[active_layer].PixelFormat == LTDC_PIXEL_FORM
AT_RGB565) { | 412 } else if (ltdc_handle.LayerCfg[active_layer].PixelFormat == LTDC_PIXEL_FORM
AT_RGB565) { |
412 info->format = GFX_FORMAT_RGB_565; | 413 fb->format = DISPLAY_FORMAT_RGB_565; |
| 414 fb->image.format = IMAGE_FORMAT_RGB_565; |
| 415 fb->image.rowbytes = BSP_LCD_GetXSize() * 2; |
413 } else { | 416 } else { |
414 panic("unhandled pixel format\n"); | 417 panic("unhandled pixel format\n"); |
415 return ERR_NOT_FOUND; | 418 return ERR_NOT_FOUND; |
| 419 } |
| 420 |
| 421 fb->image.width = BSP_LCD_GetXSize(); |
| 422 fb->image.height = BSP_LCD_GetYSize(); |
| 423 fb->image.stride = BSP_LCD_GetXSize(); |
| 424 fb->flush = NULL; |
| 425 |
| 426 return NO_ERROR; |
| 427 } |
| 428 |
| 429 status_t display_get_info(struct display_info *info) |
| 430 { |
| 431 if (ltdc_handle.LayerCfg[active_layer].PixelFormat == LTDC_PIXEL_FORMAT_ARGB
8888) { |
| 432 info->format = DISPLAY_FORMAT_ARGB_8888; |
| 433 } else if (ltdc_handle.LayerCfg[active_layer].PixelFormat == LTDC_PIXEL_FORM
AT_RGB565) { |
| 434 info->format = DISPLAY_FORMAT_RGB_565; |
| 435 } else { |
| 436 panic("unhandled pixel format\n"); |
| 437 return ERR_NOT_FOUND; |
416 } | 438 } |
417 | 439 |
418 info->width = BSP_LCD_GetXSize(); | 440 info->width = BSP_LCD_GetXSize(); |
419 info->height = BSP_LCD_GetYSize(); | 441 info->height = BSP_LCD_GetYSize(); |
420 info->stride = BSP_LCD_GetXSize(); | |
421 info->flush = NULL; | |
422 | 442 |
423 return NO_ERROR; | 443 return NO_ERROR; |
424 } | 444 } |
425 | |
OLD | NEW |