]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/Library/HdLcd/HdLcd.c
ArmPlatformPkg: Redefine LcdPlatformGetTimings function
[mirror_edk2.git] / ArmPlatformPkg / Library / HdLcd / HdLcd.c
index 039048398c531ec944bc4b43a5551a554a368481..f5886848ce582b475b597ccca015c816707ade0e 100644 (file)
@@ -98,34 +98,25 @@ LcdSetMode (
   )\r
 {\r
   EFI_STATUS        Status;\r
-  UINT32            HRes;\r
-  UINT32            HSync;\r
-  UINT32            HBackPorch;\r
-  UINT32            HFrontPorch;\r
-  UINT32            VRes;\r
-  UINT32            VSync;\r
-  UINT32            VBackPorch;\r
-  UINT32            VFrontPorch;\r
+  SCAN_TIMINGS      *Horizontal;\r
+  SCAN_TIMINGS      *Vertical;\r
   UINT32            BytesPerPixel;\r
   LCD_BPP           LcdBpp;\r
 \r
   // Set the video mode timings and other relevant information\r
   Status = LcdPlatformGetTimings (\r
              ModeNumber,\r
-             &HRes,\r
-             &HSync,\r
-             &HBackPorch,\r
-             &HFrontPorch,\r
-             &VRes,\r
-             &VSync,\r
-             &VBackPorch,\r
-             &VFrontPorch\r
+             &Horizontal,\r
+             &Vertical\r
              );\r
   if (EFI_ERROR (Status)) {\r
     ASSERT_EFI_ERROR (Status);\r
     return Status;\r
   }\r
 \r
+  ASSERT (Horizontal != NULL);\r
+  ASSERT (Vertical != NULL);\r
+\r
   Status = LcdPlatformGetBpp (ModeNumber, &LcdBpp);\r
   if (EFI_ERROR (Status)) {\r
     ASSERT_EFI_ERROR (Status);\r
@@ -138,21 +129,26 @@ LcdSetMode (
   MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_DISABLE);\r
 \r
   // Update the frame buffer information with the new settings\r
-  MmioWrite32 (HDLCD_REG_FB_LINE_LENGTH, HRes * BytesPerPixel);\r
-  MmioWrite32 (HDLCD_REG_FB_LINE_PITCH,  HRes * BytesPerPixel);\r
-  MmioWrite32 (HDLCD_REG_FB_LINE_COUNT,  VRes - 1);\r
+  MmioWrite32 (\r
+    HDLCD_REG_FB_LINE_LENGTH,\r
+    Horizontal->Resolution * BytesPerPixel\r
+    );\r
+\r
+  MmioWrite32 (HDLCD_REG_FB_LINE_PITCH, Horizontal->Resolution * BytesPerPixel);\r
+\r
+  MmioWrite32 (HDLCD_REG_FB_LINE_COUNT, Vertical->Resolution - 1);\r
 \r
   // Set the vertical timing information\r
-  MmioWrite32 (HDLCD_REG_V_SYNC,         VSync);\r
-  MmioWrite32 (HDLCD_REG_V_BACK_PORCH,   VBackPorch);\r
-  MmioWrite32 (HDLCD_REG_V_DATA,         VRes - 1);\r
-  MmioWrite32 (HDLCD_REG_V_FRONT_PORCH,  VFrontPorch);\r
+  MmioWrite32 (HDLCD_REG_V_SYNC,        Vertical->Sync);\r
+  MmioWrite32 (HDLCD_REG_V_BACK_PORCH,  Vertical->BackPorch);\r
+  MmioWrite32 (HDLCD_REG_V_DATA,        Vertical->Resolution - 1);\r
+  MmioWrite32 (HDLCD_REG_V_FRONT_PORCH, Vertical->FrontPorch);\r
 \r
   // Set the horizontal timing information\r
-  MmioWrite32 (HDLCD_REG_H_SYNC,         HSync);\r
-  MmioWrite32 (HDLCD_REG_H_BACK_PORCH,   HBackPorch);\r
-  MmioWrite32 (HDLCD_REG_H_DATA,         HRes - 1);\r
-  MmioWrite32 (HDLCD_REG_H_FRONT_PORCH,  HFrontPorch);\r
+  MmioWrite32 (HDLCD_REG_H_SYNC,        Horizontal->Sync);\r
+  MmioWrite32 (HDLCD_REG_H_BACK_PORCH,  Horizontal->BackPorch);\r
+  MmioWrite32 (HDLCD_REG_H_DATA,        Horizontal->Resolution - 1);\r
+  MmioWrite32 (HDLCD_REG_H_FRONT_PORCH, Horizontal->FrontPorch);\r
 \r
   // Enable the controller\r
   MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_ENABLE);\r