OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 Travis Geiselbrecht | 2 * Copyright (c) 2015 Travis Geiselbrecht |
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 <arch/ops.h> | 59 #include <arch/ops.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/STM32756G_EVAL/stm32756g_eval_lcd.[ch] | 64 * STM32Cube_FW_F7_V1.1.0/Drivers/BSP/STM32756G_EVAL/stm32756g_eval_lcd.[ch] |
66 */ | 65 */ |
67 | 66 |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 /* clear it out */ | 381 /* clear it out */ |
383 memset((void *)hLtdcEval.LayerCfg[ActiveLayer].FBStartAdress, 0, BSP_LCD_Get
XSize() * BSP_LCD_GetYSize() * BSP_LCD_PixelSize()); | 382 memset((void *)hLtdcEval.LayerCfg[ActiveLayer].FBStartAdress, 0, BSP_LCD_Get
XSize() * BSP_LCD_GetYSize() * BSP_LCD_PixelSize()); |
384 | 383 |
385 /* turn the display on */ | 384 /* turn the display on */ |
386 BSP_LCD_DisplayOn(); | 385 BSP_LCD_DisplayOn(); |
387 | 386 |
388 return LCD_OK; | 387 return LCD_OK; |
389 } | 388 } |
390 | 389 |
391 /* LK display api here */ | 390 /* LK display api here */ |
392 status_t display_get_info(struct display_info *info) | 391 status_t display_get_framebuffer(struct display_framebuffer *fb) |
393 { | 392 { |
394 info->framebuffer = (void *)hLtdcEval.LayerCfg[ActiveLayer].FBStartAdress; | 393 fb->image.pixels = (void *)hLtdcEval.LayerCfg[ActiveLayer].FBStartAdress; |
395 | 394 |
396 if (hLtdcEval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_ARGB888
8) { | 395 if (hLtdcEval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_ARGB888
8) { |
397 info->format = GFX_FORMAT_ARGB_8888; | 396 fb->format = DISPLAY_FORMAT_ARGB_8888; |
| 397 fb->image.format = IMAGE_FORMAT_ARGB_8888; |
| 398 fb->image.rowbytes = BSP_LCD_GetXSize() * 4; |
398 } else if (hLtdcEval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_
RGB565) { | 399 } else if (hLtdcEval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_
RGB565) { |
399 info->format = GFX_FORMAT_RGB_565; | 400 fb->format = DISPLAY_FORMAT_RGB_565; |
| 401 fb->image.format = IMAGE_FORMAT_RGB_565; |
| 402 fb->image.rowbytes = BSP_LCD_GetXSize() * 2; |
400 } else { | 403 } else { |
401 panic("unhandled pixel format\n"); | 404 panic("unhandled pixel format\n"); |
402 return ERR_NOT_FOUND; | 405 return ERR_NOT_FOUND; |
| 406 } |
| 407 |
| 408 fb->image.width = BSP_LCD_GetXSize(); |
| 409 fb->image.height = BSP_LCD_GetYSize(); |
| 410 fb->image.stride = BSP_LCD_GetXSize(); |
| 411 fb->flush = NULL; |
| 412 |
| 413 return NO_ERROR; |
| 414 } |
| 415 |
| 416 status_t display_get_info(struct display_info *info) |
| 417 { |
| 418 if (hLtdcEval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_ARGB888
8) { |
| 419 info->format = DISPLAY_FORMAT_ARGB_8888; |
| 420 } else if (hLtdcEval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_
RGB565) { |
| 421 info->format = DISPLAY_FORMAT_RGB_565; |
| 422 } else { |
| 423 panic("unhandled pixel format\n"); |
| 424 return ERR_NOT_FOUND; |
403 } | 425 } |
404 | 426 |
405 info->width = BSP_LCD_GetXSize(); | 427 info->width = BSP_LCD_GetXSize(); |
406 info->height = BSP_LCD_GetYSize(); | 428 info->height = BSP_LCD_GetYSize(); |
407 info->stride = BSP_LCD_GetXSize(); | |
408 info->flush = NULL; | |
409 | 429 |
410 return NO_ERROR; | 430 return NO_ERROR; |
411 } | 431 } |
412 | |
OLD | NEW |