[457] | 1 | /*
|
---|
| 2 | * TOPPERS/ASP Kernel
|
---|
| 3 | * Toyohashi Open Platform for Embedded Real-Time Systems/
|
---|
| 4 | * Advanced Standard Profile Kernel
|
---|
| 5 | *
|
---|
| 6 | * Copyright (C) 2008-2011 by Embedded and Real-Time Systems Laboratory
|
---|
| 7 | * Graduate School of Information Science, Nagoya Univ., JAPAN
|
---|
| 8 | * Copyright (C) 2015-2017 by TOPPERS PROJECT Educational Working Group.
|
---|
| 9 | *
|
---|
| 10 | * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
|
---|
| 11 | * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
|
---|
| 12 | * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
|
---|
| 13 | * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
|
---|
| 14 | * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
|
---|
| 15 | * スコード中に含まれていること.
|
---|
| 16 | * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
|
---|
| 17 | * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
|
---|
| 18 | * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
|
---|
| 19 | * の無保証規定を掲載すること.
|
---|
| 20 | * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
|
---|
| 21 | * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
|
---|
| 22 | * と.
|
---|
| 23 | * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
|
---|
| 24 | * 作権表示,この利用条件および下記の無保証規定を掲載すること.
|
---|
| 25 | * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
|
---|
| 26 | * 報告すること.
|
---|
| 27 | * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
|
---|
| 28 | * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
|
---|
| 29 | * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
|
---|
| 30 | * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
|
---|
| 31 | * 免責すること.
|
---|
| 32 | *
|
---|
| 33 | * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
|
---|
| 34 | * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
|
---|
| 35 | * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
|
---|
| 36 | * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
|
---|
| 37 | * の責任を負わない.
|
---|
| 38 | *
|
---|
| 39 | * @(#) $Id$
|
---|
| 40 | */
|
---|
| 41 | /*
|
---|
| 42 | * STM32F746 LTDC用デバイスドライバの外部宣言
|
---|
| 43 | */
|
---|
| 44 |
|
---|
| 45 | #ifndef _LTDC_H_
|
---|
| 46 | #define _LTDC_H_
|
---|
| 47 |
|
---|
| 48 | #ifdef __cplusplus
|
---|
| 49 | extern "C" {
|
---|
| 50 | #endif
|
---|
| 51 |
|
---|
| 52 | #define MAX_LAYER 2
|
---|
| 53 |
|
---|
| 54 | /*
|
---|
| 55 | * LTDC_HS_POLARITY LTDC HS POLARITY
|
---|
| 56 | */
|
---|
| 57 | #define LTDC_HSPOLARITY_AL 0x00000000 /* Horizontal Synchronization is active low. */
|
---|
| 58 | #define LTDC_HSPOLARITY_AH LTDC_GCR_HSPOL /* Horizontal Synchronization is active high. */
|
---|
| 59 |
|
---|
| 60 | /*
|
---|
| 61 | * LTDC_VS_POLARITY LTDC VS POLARITY
|
---|
| 62 | */
|
---|
| 63 | #define LTDC_VSPOLARITY_AL 0x00000000 /* Vertical Synchronization is active low. */
|
---|
| 64 | #define LTDC_VSPOLARITY_AH LTDC_GCR_VSPOL /* Vertical Synchronization is active high. */
|
---|
| 65 |
|
---|
| 66 | /*
|
---|
| 67 | * LTDC_DE_POLARITY LTDC DE POLARITY
|
---|
| 68 | */
|
---|
| 69 | #define LTDC_DEPOLARITY_AL 0x00000000 /* Data Enable, is active low. */
|
---|
| 70 | #define LTDC_DEPOLARITY_AH LTDC_GCR_DEPOL /* Data Enable, is active high. */
|
---|
| 71 |
|
---|
| 72 | /*
|
---|
| 73 | * LTDC_BlendingFactor1 LTDC Blending Factor1
|
---|
| 74 | */
|
---|
| 75 | #define LTDC_BLENDING_FACTOR1_CA 0x00000400 /* Blending factor : Cte Alpha */
|
---|
| 76 | #define LTDC_BLENDING_FACTOR1_PAxCA 0x00000600 /* Blending factor : Cte Alpha x Pixel Alpha*/
|
---|
| 77 |
|
---|
| 78 | /*
|
---|
| 79 | * LTDC_BlendingFactor2 LTDC Blending Factor2
|
---|
| 80 | */
|
---|
| 81 | #define LTDC_BLENDING_FACTOR2_CA 0x00000005 /* Blending factor : Cte Alpha */
|
---|
| 82 | #define LTDC_BLENDING_FACTOR2_PAxCA 0x00000007 /* Blending factor : Cte Alpha x Pixel Alpha*/
|
---|
| 83 |
|
---|
| 84 | /*
|
---|
| 85 | * LTDC_PC_POLARITY LTDC PC POLARITY
|
---|
| 86 | */
|
---|
| 87 | #define LTDC_PCPOLARITY_IPC 0x00000000 /* input pixel clock. */
|
---|
| 88 | #define LTDC_PCPOLARITY_IIPC LTDC_GCR_PCPOL /* inverted input pixel clock. */
|
---|
| 89 |
|
---|
| 90 | /*
|
---|
| 91 | * LTDCピクセルフォーマット定義
|
---|
| 92 | */
|
---|
| 93 | #define LTDC_PIXEL_FORMAT_ARGB8888 0x00000000 /* ARGB8888 LTDC pixel format */
|
---|
| 94 | #define LTDC_PIXEL_FORMAT_RGB888 0x00000001 /* RGB888 LTDC pixel format */
|
---|
| 95 | #define LTDC_PIXEL_FORMAT_RGB565 0x00000002 /* RGB565 LTDC pixel format */
|
---|
| 96 | #define LTDC_PIXEL_FORMAT_ARGB1555 0x00000003 /* ARGB1555 LTDC pixel format */
|
---|
| 97 | #define LTDC_PIXEL_FORMAT_ARGB4444 0x00000004 /* ARGB4444 LTDC pixel format */
|
---|
| 98 | #define LTDC_PIXEL_FORMAT_L8 0x00000005 /* L8 LTDC pixel format */
|
---|
| 99 | #define LTDC_PIXEL_FORMAT_AL44 0x00000006 /* AL44 LTDC pixel format */
|
---|
| 100 | #define LTDC_PIXEL_FORMAT_AL88 0x00000007 /* AL88 LTDC pixel format */
|
---|
| 101 |
|
---|
| 102 | /*
|
---|
| 103 | * LTDC状態定義
|
---|
| 104 | */
|
---|
| 105 | #define LTDC_STATE_RESET 0x00000000 /* LTDC リセット状態 */
|
---|
| 106 | #define LTDC_STATE_READY 0x00000001 /* LTDC レディ状態 */
|
---|
| 107 | #define LTDC_STATE_BUSY 0x00000002 /* LTDC ビジィ状態 */
|
---|
| 108 | #define LTDC_STATE_ERROR 0x00010000 /* LTDC エラー状態 */
|
---|
| 109 |
|
---|
| 110 | /*
|
---|
| 111 | * LTDCエラー定義
|
---|
| 112 | */
|
---|
| 113 | #define LTDC_ERROR_NONE 0x00000000 /* LTDC エラーなし */
|
---|
| 114 | #define LTDC_ERROR_TE 0x00000001 /* LTDC 転送エラー */
|
---|
| 115 | #define LTDC_ERROR_FU 0x00000002 /* LTDC FIFOアンダーラン */
|
---|
| 116 |
|
---|
| 117 |
|
---|
| 118 | /*
|
---|
| 119 | * LTDCカラー構造体定義
|
---|
| 120 | */
|
---|
| 121 | typedef struct
|
---|
| 122 | {
|
---|
| 123 | uint8_t Blue; /* Configures the blue value. */
|
---|
| 124 | uint8_t Green; /* Configures the green value. */
|
---|
| 125 | uint8_t Red; /* Configures the red value. */
|
---|
| 126 | uint8_t Reserved; /* Reserved 0xFF */
|
---|
| 127 | } Color_t;
|
---|
| 128 |
|
---|
| 129 | /*
|
---|
| 130 | * LTDC初期化構造体定義
|
---|
| 131 | */
|
---|
| 132 | typedef struct
|
---|
| 133 | {
|
---|
| 134 | uint32_t HSPolarity; /* configures the horizontal synchronization polarity. */
|
---|
| 135 | uint32_t VSPolarity; /* configures the vertical synchronization polarity. */
|
---|
| 136 | uint32_t DEPolarity; /* configures the data enable polarity. */
|
---|
| 137 | uint32_t PCPolarity; /* configures the pixel clock polarity. */
|
---|
| 138 | uint32_t HorizontalSync; /* configures the number of Horizontal synchronization width. */
|
---|
| 139 | uint32_t VerticalSync; /* configures the number of Vertical synchronization height. */
|
---|
| 140 | uint32_t AccumulatedHBP; /* configures the accumulated horizontal back porch width. */
|
---|
| 141 | uint32_t AccumulatedVBP; /* configures the accumulated vertical back porch height. */
|
---|
| 142 | uint32_t AccumulatedActiveW; /* configures the accumulated active width. */
|
---|
| 143 | uint32_t AccumulatedActiveH; /* configures the accumulated active height. */
|
---|
| 144 | uint32_t TotalWidth; /* configures the total width. */
|
---|
| 145 | uint32_t TotalHeigh; /* configures the total height. */
|
---|
| 146 | Color_t Backcolor; /* configures the background color. */
|
---|
| 147 | uint32_t pllsain; /* configures the PLLSAIN */
|
---|
| 148 | uint32_t pllsair; /* configures the PLLSAIR */
|
---|
| 149 | uint32_t saidivr; /* configures the PLLSAIDIVR */
|
---|
| 150 | } LTDC_Init_t;
|
---|
| 151 |
|
---|
| 152 | /*
|
---|
| 153 | * LTDCレイヤー構造体定義
|
---|
| 154 | */
|
---|
| 155 | typedef struct
|
---|
| 156 | {
|
---|
| 157 | uint32_t WindowX0; /* Configures the Window Horizontal Start Position. */
|
---|
| 158 | uint32_t WindowX1; /* Configures the Window Horizontal Stop Position. */
|
---|
| 159 | uint32_t WindowY0; /* Configures the Window vertical Start Position. */
|
---|
| 160 | uint32_t WindowY1; /* Configures the Window vertical Stop Position. */
|
---|
| 161 | uint32_t PixelFormat; /* Specifies the pixel format. */
|
---|
| 162 | uint32_t Alpha; /* Specifies the constant alpha used for blending. */
|
---|
| 163 | uint32_t Alpha0; /* Configures the default alpha value. */
|
---|
| 164 | uint32_t BlendingFactor1;/* Select the blending factor 1. */
|
---|
| 165 | uint32_t BlendingFactor2;/* Select the blending factor 2. */
|
---|
| 166 | uint32_t FBStartAdress; /* Configures the color frame buffer address */
|
---|
| 167 | uint32_t ImageWidth; /* Configures the color frame buffer line length. */
|
---|
| 168 | uint32_t ImageHeight; /* Specifies the number of line in frame buffer. */
|
---|
| 169 | Color_t Backcolor; /* Configures the layer background color. */
|
---|
| 170 | } LTDC_LayerCfg_t;
|
---|
| 171 |
|
---|
| 172 | /*
|
---|
| 173 | * LTDCハンドラ構造体定義
|
---|
| 174 | */
|
---|
| 175 | typedef struct _LTDC_Handle_t LTDC_Handle_t;
|
---|
| 176 | struct _LTDC_Handle_t {
|
---|
| 177 | uint32_t base; /* LTDC ベースレジスタ */
|
---|
| 178 | LTDC_Init_t Init; /* LTDC parameters */
|
---|
| 179 | LTDC_LayerCfg_t LayerCfg[MAX_LAYER]; /* LTDC Layers parameters */
|
---|
| 180 | void (*linecallback)(LTDC_Handle_t * hltdc); /* ラインコールバック関数 */
|
---|
| 181 | void (*reloadcallback)(LTDC_Handle_t * hltdc);/* リロードコールバック関数 */
|
---|
| 182 | void (*errorcallback)(LTDC_Handle_t * hltdc); /* エラーコールバック関数 */
|
---|
| 183 | volatile uint32_t state; /* LTDC 実行状態 */
|
---|
| 184 | volatile uint32_t errorcode; /* LTDC エラーコード */
|
---|
| 185 | };
|
---|
| 186 |
|
---|
| 187 | extern ER ltdc_init(LTDC_Handle_t *phandle);
|
---|
| 188 | extern ER ltdc_configlayer(LTDC_Handle_t *hltdc, LTDC_LayerCfg_t *pLayerCfg, uint32_t LayerIdx);
|
---|
| 189 | extern ER ltdc_setwindowsize(LTDC_Handle_t *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx);
|
---|
| 190 | extern ER ltdc_setwindowposition(LTDC_Handle_t *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx);
|
---|
| 191 | extern ER ltdc_setalpha(LTDC_Handle_t *hltdc, uint32_t Alpha, uint32_t LayerIdx);
|
---|
| 192 | extern ER ltdc_setaddress(LTDC_Handle_t *hltdc, uint32_t Address, uint32_t LayerIdx);
|
---|
| 193 | extern ER ltdc_configcolorkeying(LTDC_Handle_t *hltdc, uint32_t RGBValue, uint32_t LayerIdx);
|
---|
| 194 | extern ER ltdc_enablecolorkeying(LTDC_Handle_t *hltdc, uint32_t LayerIdx);
|
---|
| 195 | extern ER ltdc_disablecolorkeying(LTDC_Handle_t *hltdc, uint32_t LayerIdx);
|
---|
| 196 | extern ER ltdc_lineevent(LTDC_Handle_t *phandle, uint32_t Line);
|
---|
| 197 | extern ER ltdc_reload(LTDC_Handle_t *phandle, uint32_t ReloadType);
|
---|
| 198 | extern void ltdc_irqhandler(LTDC_Handle_t *phandle);
|
---|
| 199 |
|
---|
| 200 | #ifdef __cplusplus
|
---|
| 201 | }
|
---|
| 202 | #endif
|
---|
| 203 |
|
---|
| 204 | #endif
|
---|
| 205 |
|
---|