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