Lib for FTDI FT800 graphic controller "EVE" The API is changed from the FTDI original names. It use smaller names now. DL() will add something to the display list instead of Ft_App_WrCoCmd_Buffer ... The FTDI programmer Guide is also using this commands.
Dependents: FT800_RGB_demo FT800_RGB_demo2 FT800_demo_for_habr Temp_&_RH_at_TFT-demo ... more
Fork of FT800 by
FT_Gpu_Hal.h
00001 /*! 00002 * \file FT_GPU_HAL.h 00003 * 00004 * \author FTDI 00005 * \date 2013.04.24 00006 * 00007 * Copyright 2013 Future Technology Devices International Limited 00008 * 00009 * Project: FT800 or EVE compatible silicon 00010 * File Description: 00011 * This file defines the generic APIs of host access layer for the FT800 or EVE compatible silicon. 00012 * Application shall access FT800 or EVE resources over these APIs. In addition, there are 00013 * some helper functions defined for FT800 coprocessor engine as well as host commands. 00014 * Rivision History: 00015 * ported to mbed by Peter Drescher, DC2PD 2014 00016 * 00017 */ 00018 00019 #ifndef FT_GPU_HAL_H 00020 #define FT_GPU_HAL_H 00021 00022 #include "mbed.h" 00023 #include "FT_DataTypes.h" 00024 00025 typedef enum { 00026 FT_GPU_I2C_MODE = 0, 00027 FT_GPU_SPI_MODE, 00028 00029 FT_GPU_MODE_COUNT, 00030 FT_GPU_MODE_UNKNOWN = FT_GPU_MODE_COUNT 00031 } FT_GPU_HAL_MODE_E; 00032 00033 typedef enum { 00034 OPENED, 00035 READING, 00036 WRITING, 00037 CLOSED, 00038 STATUS_COUNT, 00039 STATUS_ERROR = STATUS_COUNT 00040 } FT_GPU_HAL_STATUS_E; 00041 00042 typedef struct { 00043 ft_uint8_t reserved; 00044 } Ft_Gpu_App_Context_t; 00045 00046 typedef struct { 00047 /* Total number channels for libmpsse */ 00048 ft_uint32_t TotalChannelNum; 00049 } Ft_Gpu_HalInit_t; 00050 00051 typedef enum { 00052 FT_GPU_READ = 0, 00053 FT_GPU_WRITE, 00054 } FT_GPU_TRANSFERDIR_T; 00055 00056 00057 typedef struct { 00058 ft_uint32_t length; //IN and OUT 00059 ft_uint32_t address; 00060 ft_uint8_t *buffer; 00061 } Ft_Gpu_App_Transfer_t; 00062 00063 class FT800 00064 { 00065 public: 00066 FT800(PinName mosi, 00067 PinName miso, 00068 PinName sck, 00069 PinName ss, 00070 PinName intr, 00071 PinName pd); 00072 00073 private: 00074 SPI _spi; 00075 DigitalOut _ss; 00076 DigitalOut _pd; 00077 InterruptIn _f800_isr; 00078 public: 00079 /* Global used for buffer optimization */ 00080 //Ft_Gpu_Hal_Context_t host,*phost; 00081 Ft_Gpu_App_Context_t app_header; 00082 ft_uint16_t cmd_fifo_wp; //coprocessor fifo write pointer 00083 ft_uint16_t dl_buff_wp; //display command memory write pointer 00084 FT_GPU_HAL_STATUS_E status; //OUT 00085 ft_void_t* hal_handle; //IN/OUT 00086 ft_uint32_t CmdBuffer_Index; 00087 ft_uint32_t DlBuffer_Index; 00088 ft_int16_t DispWidth; 00089 ft_int16_t DispHeight; 00090 ft_int16_t DispHCycle; 00091 ft_int16_t DispHOffset; 00092 ft_int16_t DispHSync0; 00093 ft_int16_t DispHSync1; 00094 ft_int16_t DispVCycle; 00095 ft_int16_t DispVOffset; 00096 ft_int16_t DispVSync0; 00097 ft_int16_t DispVSync1; 00098 ft_uint8_t DispPCLK; 00099 ft_char8_t DispSwizzle; 00100 ft_char8_t DispPCLKPol; 00101 00102 00103 ft_void_t BootupConfig(void); 00104 ft_bool_t Bootup(void); 00105 00106 00107 /*The basic APIs Level 1*/ 00108 ft_bool_t Init( ); 00109 ft_bool_t Open( ); 00110 00111 /*The APIs for reading/writing transfer continuously only with small buffer system*/ 00112 ft_void_t StartTransfer(FT_GPU_TRANSFERDIR_T rw,ft_uint32_t addr); 00113 ft_uint8_t Transfer8(ft_uint8_t value); 00114 ft_uint16_t Transfer16(ft_uint16_t value); 00115 ft_uint32_t Transfer32(ft_uint32_t value); 00116 ft_void_t EndTransfer( ); 00117 00118 /*Read & Write APIs for both burst and single transfer,depending on buffer size*/ 00119 ft_void_t Read(Ft_Gpu_App_Transfer_t *transfer); 00120 ft_void_t Write(Ft_Gpu_App_Transfer_t *transfer); 00121 00122 ft_void_t Close(); 00123 ft_void_t DeInit(); 00124 00125 /*Helper function APIs Read*/ 00126 ft_uint8_t Rd8(ft_uint32_t addr); 00127 ft_uint16_t Rd16(ft_uint32_t addr); 00128 ft_uint32_t Rd32(ft_uint32_t addr); 00129 00130 /*Helper function APIs Write*/ 00131 ft_void_t Wr8(ft_uint32_t addr, ft_uint8_t v); 00132 ft_void_t Wr16(ft_uint32_t addr, ft_uint16_t v); 00133 ft_void_t Wr32(ft_uint32_t addr, ft_uint32_t v); 00134 00135 /*******************************************************************************/ 00136 /*******************************************************************************/ 00137 /*APIs for coprocessor Fifo read/write and space management*/ 00138 ft_void_t Updatecmdfifo(ft_uint16_t count); 00139 ft_void_t WrCmd32(ft_uint32_t cmd); 00140 ft_void_t WrCmdBuf(ft_uint8_t *buffer,ft_uint16_t count); 00141 ft_void_t WaitCmdfifo_empty(); 00142 ft_void_t ResetCmdFifo(); 00143 ft_void_t CheckCmdBuffer(ft_uint16_t count); 00144 ft_void_t ResetDLBuffer(); 00145 00146 ft_void_t StartCmdTransfer(FT_GPU_TRANSFERDIR_T rw, ft_uint16_t count); 00147 ft_void_t Powercycle(ft_bool_t up); 00148 00149 00150 /*******************************************************************************/ 00151 /*******************************************************************************/ 00152 /*APIs for Host Commands*/ 00153 typedef enum { 00154 FT_GPU_INTERNAL_OSC = 0x48, //default 00155 FT_GPU_EXTERNAL_OSC = 0x44, 00156 } FT_GPU_PLL_SOURCE_T; 00157 typedef enum { 00158 FT_GPU_PLL_48M = 0x62, //default 00159 FT_GPU_PLL_36M = 0x61, 00160 FT_GPU_PLL_24M = 0x64, 00161 } FT_GPU_PLL_FREQ_T; 00162 00163 typedef enum { 00164 FT_GPU_ACTIVE_M = 0x00, 00165 FT_GPU_STANDBY_M = 0x41,//default 00166 FT_GPU_SLEEP_M = 0x42, 00167 FT_GPU_POWERDOWN_M = 0x50, 00168 } FT_GPU_POWER_MODE_T; 00169 00170 #define FT_GPU_CORE_RESET (0x68) 00171 00172 ft_int32_t hal_strlen(const ft_char8_t *s); 00173 ft_void_t Sleep(ft_uint16_t ms); 00174 ft_void_t ClockSelect(FT_GPU_PLL_SOURCE_T pllsource); 00175 ft_void_t PLL_FreqSelect(FT_GPU_PLL_FREQ_T freq); 00176 ft_void_t PowerModeSwitch(FT_GPU_POWER_MODE_T pwrmode); 00177 ft_void_t CoreReset(); 00178 //ft_void_t Ft_Gpu_Hal_StartTransfer( ,FT_GPU_TRANSFERDIR_T rw,ft_uint32_t addr); 00179 ft_void_t WrMem(ft_uint32_t addr, const ft_uint8_t *buffer, ft_uint32_t length); 00180 ft_void_t WrMemFromFlash(ft_uint32_t addr,const ft_prog_uchar8_t *buffer, ft_uint32_t length); 00181 ft_void_t WrCmdBufFromFlash(FT_PROGMEM ft_prog_uchar8_t *buffer,ft_uint16_t count); 00182 ft_void_t RdMem(ft_uint32_t addr, ft_uint8_t *buffer, ft_uint32_t length); 00183 ft_void_t WaitLogo_Finish(); 00184 ft_uint8_t TransferString(const ft_char8_t *string); 00185 ft_void_t HostCommand(ft_uint8_t cmd); 00186 ft_int32_t Dec2Ascii(ft_char8_t *pSrc,ft_int32_t value); 00187 00188 ft_void_t Text(ft_int16_t x, ft_int16_t y, ft_int16_t font, ft_uint16_t options, const ft_char8_t* s); 00189 ft_void_t Number(ft_int16_t x, ft_int16_t y, ft_int16_t font, ft_uint16_t options, ft_int32_t n); 00190 ft_void_t LoadIdentity(); 00191 ft_void_t Toggle(ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t font, ft_uint16_t options, ft_uint16_t state, const ft_char8_t* s); 00192 ft_void_t Gauge(ft_int16_t x, ft_int16_t y, ft_int16_t r, ft_uint16_t options, ft_uint16_t major, ft_uint16_t minor, ft_uint16_t val, ft_uint16_t range); 00193 ft_void_t RegRead(ft_uint32_t ptr, ft_uint32_t result); 00194 ft_void_t GetProps(ft_uint32_t ptr, ft_uint32_t w, ft_uint32_t h); 00195 ft_void_t Memcpy(ft_uint32_t dest, ft_uint32_t src, ft_uint32_t num); 00196 ft_void_t Spinner(ft_int16_t x, ft_int16_t y, ft_uint16_t style, ft_uint16_t scale); 00197 ft_void_t BgColor(ft_uint32_t c); 00198 ft_void_t Swap(); 00199 ft_void_t Inflate(ft_uint32_t ptr); 00200 ft_void_t Translate(ft_int32_t tx, ft_int32_t ty); 00201 ft_void_t Stop(); 00202 ft_void_t Slider(ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t h, ft_uint16_t options, ft_uint16_t val, ft_uint16_t range); 00203 ft_void_t Interrupt(ft_uint32_t ms); 00204 ft_void_t FgColor(ft_uint32_t c); 00205 ft_void_t Rotate(ft_int32_t a); 00206 ft_void_t Button(ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t h, ft_int16_t font, ft_uint16_t options, const ft_char8_t* s); 00207 ft_void_t MemWrite(ft_uint32_t ptr, ft_uint32_t num); 00208 ft_void_t Scrollbar(ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t h, ft_uint16_t options, ft_uint16_t val, ft_uint16_t size, ft_uint16_t range); 00209 ft_void_t GetMatrix(ft_int32_t a, ft_int32_t b, ft_int32_t c, ft_int32_t d, ft_int32_t e, ft_int32_t f); 00210 ft_void_t Sketch(ft_int16_t x, ft_int16_t y, ft_uint16_t w, ft_uint16_t h, ft_uint32_t ptr, ft_uint16_t format); 00211 ft_void_t MemSet(ft_uint32_t ptr, ft_uint32_t value, ft_uint32_t num); 00212 ft_void_t Calibrate(ft_uint32_t result); 00213 ft_void_t SetFont(ft_uint32_t font, ft_uint32_t ptr); 00214 ft_void_t Bitmap_Transform(ft_int32_t x0, ft_int32_t y0, ft_int32_t x1, ft_int32_t y1, ft_int32_t x2, ft_int32_t y2, ft_int32_t tx0, ft_int32_t ty0, ft_int32_t tx1, ft_int32_t ty1, ft_int32_t tx2, ft_int32_t ty2, ft_uint16_t result); 00215 ft_void_t GradColor(ft_uint32_t c); 00216 ft_void_t Append(ft_uint32_t ptr, ft_uint32_t num); 00217 ft_void_t MemZero(ft_uint32_t ptr, ft_uint32_t num); 00218 ft_void_t Scale(ft_int32_t sx, ft_int32_t sy); 00219 ft_void_t Clock(ft_int16_t x, ft_int16_t y, ft_int16_t r, ft_uint16_t options, ft_uint16_t h, ft_uint16_t m, ft_uint16_t s, ft_uint16_t ms); 00220 ft_void_t Gradient(ft_int16_t x0, ft_int16_t y0, ft_uint32_t rgb0, ft_int16_t x1, ft_int16_t y1, ft_uint32_t rgb1); 00221 ft_void_t SetMatrix(); 00222 ft_void_t Track(ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t h, ft_int16_t tag); 00223 ft_void_t GetPtr(ft_uint32_t result); 00224 ft_void_t Progress(ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t h, ft_uint16_t options, ft_uint16_t val, ft_uint16_t range); 00225 ft_void_t ColdStart(); 00226 ft_void_t Keys(ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t h, ft_int16_t font, ft_uint16_t options, const ft_char8_t* s); 00227 ft_void_t Dial(ft_int16_t x, ft_int16_t y, ft_int16_t r, ft_uint16_t options, ft_uint16_t val); 00228 ft_void_t LoadImage(ft_uint32_t ptr, ft_uint32_t options); 00229 ft_void_t DLstart(); 00230 ft_void_t Snapshot(ft_uint32_t ptr); 00231 ft_void_t ScreenSaver(); 00232 ft_void_t Memcrc(ft_uint32_t ptr, ft_uint32_t num, ft_uint32_t result); 00233 00234 ft_void_t Logo(); 00235 00236 ft_void_t SendCmd( ft_uint32_t cmd); 00237 ft_void_t SendStr( const ft_char8_t *s); 00238 ft_void_t StartFunc( ft_uint16_t count); 00239 ft_void_t EndFunc( ft_uint16_t count); 00240 ft_void_t TouchTransform( ft_int32_t x0, ft_int32_t y0, ft_int32_t x1, ft_int32_t y1, ft_int32_t x2, ft_int32_t y2, ft_int32_t tx0, ft_int32_t ty0, ft_int32_t tx1, ft_int32_t ty1, ft_int32_t tx2, ft_int32_t ty2, ft_uint16_t result); 00241 ft_void_t BitmapTransform( ft_int32_t x0, ft_int32_t y0, ft_int32_t x1, ft_int32_t y1, ft_int32_t x2, ft_int32_t y2, ft_int32_t tx0, ft_int32_t ty0, ft_int32_t tx1, ft_int32_t ty1, ft_int32_t tx2, ft_int32_t ty2, ft_uint16_t result); 00242 ft_void_t MemCrc( ft_uint32_t ptr, ft_uint32_t num, ft_uint32_t result); 00243 00244 ft_uint16_t fifo_Freespace( ); 00245 00246 ft_void_t DL(ft_uint32_t cmd); 00247 ft_void_t WrDlCmd_Buffer(ft_uint32_t cmd); 00248 ft_void_t Flush_DL_Buffer(); 00249 ft_void_t Flush_Co_Buffer(); 00250 ft_void_t fadeout(); 00251 ft_void_t fadein(); 00252 ft_void_t DLSwap(ft_uint8_t DL_Swap_Type); 00253 00254 ft_void_t Sound_ON(); 00255 ft_void_t Sound_OFF(); 00256 00257 int Load_jpg(char* filename, ft_int16_t* x_size, ft_int16_t* y_size); 00258 ft_void_t Calibrate(); 00259 ft_void_t read_calibrate(ft_uint8_t data[24]); 00260 ft_void_t write_calibrate(ft_uint8_t data[24]); 00261 00262 ft_uint32_t color_rgb(ft_uint8_t red,ft_uint8_t green, ft_uint8_t blue); 00263 ft_uint32_t clear_color_rgb(ft_uint8_t red,ft_uint8_t green, ft_uint8_t blue); 00264 00265 }; // end of class 00266 00267 #endif /*FT_GPU_HAL_H*/
Generated on Tue Jul 12 2022 19:49:40 by 1.7.2