808

Dependents:   Chromatograph_Mobile

Revision:
10:6a81aeca25e3
Parent:
7:3b4d59de6398
Child:
12:f0980f7a75ae
diff -r ca6a7c6a2f4b -r 6a81aeca25e3 inc/FT_Gpu_Hal.h
--- a/inc/FT_Gpu_Hal.h	Thu Dec 22 20:19:22 2016 +0000
+++ b/inc/FT_Gpu_Hal.h	Mon Jul 23 12:22:23 2018 +0000
@@ -11,11 +11,11 @@
  *
  * Copyright 2013 Future Technology Devices International Limited
  *
- * Project: FT800 or EVE compatible silicon
+ * Project: FT813 or EVE compatible silicon
  * File Description:
- *    This file defines the generic APIs of host access layer for the FT800 or EVE compatible silicon.
- *    Application shall access FT800 or EVE resources over these APIs. In addition, there are
- *    some helper functions defined for FT800 coprocessor engine as well as host commands.
+ *    This file defines the generic APIs of host access layer for the FT813 or EVE compatible silicon.
+ *    Application shall access FT813 or EVE resources over these APIs. In addition, there are
+ *    some helper functions defined for FT813 coprocessor engine as well as host commands.
  * Rivision History:
  * ported to mbed by Peter Drescher, DC2PD 2014
  *
@@ -64,11 +64,20 @@
     ft_uint32_t address;
     ft_uint8_t  *buffer;
 } Ft_Gpu_App_Transfer_t;
- 
-class FT800
+
+typedef struct {
+    char name[50];
+    uint32_t addr;
+    uint32_t size;
+    uint16_t fmt;
+    uint16_t w;
+    uint16_t h;
+} Ft_Gpu_App_Bitmap_t;
+
+class FT813
 {
 public:
-    FT800(PinName mosi,
+    FT813(PinName mosi,
           PinName miso,
           PinName sck,
           PinName ss,
@@ -80,6 +89,19 @@
     DigitalOut  _ss;
     DigitalOut  _pd;
     InterruptIn _f800_isr;
+    ft_uint16_t _count;
+    ft_uint32_t _address;
+    ft_uint32_t _addresses[64];
+    ft_uint16_t _bitmap_count;
+    ft_uint32_t _orientation;
+    ft_uint16_t _bitmapCount;
+    ft_uint32_t _bitmapAddress;
+
+Ft_Gpu_App_Bitmap_t _bitmaps[64];
+
+//uint32_t screenshot[800*480];
+
+    
 public:
     /* Global used for buffer optimization */
     //Ft_Gpu_Hal_Context_t host,*phost;
@@ -110,15 +132,15 @@
  
  
     /*The basic APIs Level 1*/
-    ft_bool_t              Init( );
-    ft_bool_t              Open( );
+    ft_bool_t              Init();
+    ft_bool_t              Open();
  
     /*The APIs for reading/writing transfer continuously only with small buffer system*/
     ft_void_t              StartTransfer(FT_GPU_TRANSFERDIR_T rw,ft_uint32_t addr);
     ft_uint8_t             Transfer8(ft_uint8_t value);
     ft_uint16_t            Transfer16(ft_uint16_t value);
     ft_uint32_t            Transfer32(ft_uint32_t value);
-    ft_void_t              EndTransfer( );
+    ft_void_t              EndTransfer();
  
     /*Read & Write APIs for both burst and single transfer,depending on buffer size*/
     ft_void_t              Read(Ft_Gpu_App_Transfer_t *transfer);
@@ -190,64 +212,78 @@
     ft_void_t HostCommand(ft_uint8_t cmd);
     ft_int32_t Dec2Ascii(ft_char8_t *pSrc,ft_int32_t value);
  
+
+    ft_void_t DLstart();
+    ft_void_t Swap();
+    ft_void_t ColdStart();
+    ft_void_t Interrupt(ft_uint32_t ms);
+    ft_void_t Append(ft_uint32_t ptr, ft_uint32_t num);
+    ft_void_t RegRead(ft_uint32_t ptr, ft_uint32_t result);
+    ft_void_t MemWrite(ft_uint32_t ptr, ft_uint32_t num);
+    ft_void_t Inflate(ft_uint32_t ptr);
+    ft_void_t LoadImage(ft_uint32_t ptr, ft_uint32_t options);
+    ft_void_t MediaFifo(ft_uint32_t ptr, ft_uint32_t size);
+    ft_void_t PlayVideo(ft_uint32_t opts);
+    ft_void_t VideoStart();
+    ft_void_t VideoFrame(ft_uint32_t dst, ft_uint32_t ptr);
+    ft_void_t Memcrc(ft_uint32_t ptr, ft_uint32_t num, ft_uint32_t result);
+    ft_void_t MemZero(ft_uint32_t ptr, ft_uint32_t num);
+    ft_void_t MemSet(ft_uint32_t ptr, ft_uint32_t value, ft_uint32_t num);
+    ft_void_t Memcpy(ft_uint32_t dest, ft_uint32_t src, ft_uint32_t num);
+    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);
+    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);
+    ft_void_t FgColor(ft_uint32_t c);
+    ft_void_t BgColor(ft_uint32_t c);
+    ft_void_t GradColor(ft_uint32_t c);
+    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);
+    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);
+    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);
+    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);
+    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);
+    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);
+    ft_void_t Dial(ft_int16_t x, ft_int16_t y, ft_int16_t r, ft_uint16_t options, ft_uint16_t val);
+    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);
     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);
+    ft_void_t SetBase(ft_uint32_t base);
     ft_void_t Number(ft_int16_t x, ft_int16_t y, ft_int16_t font, ft_uint16_t options, ft_int32_t n);
     ft_void_t LoadIdentity();
-    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);
-    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);
-    ft_void_t RegRead(ft_uint32_t ptr, ft_uint32_t result);
+    ft_void_t SetMatrix();
+    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);
+    ft_void_t GetPtr(ft_uint32_t result);
     ft_void_t GetProps(ft_uint32_t ptr, ft_uint32_t w, ft_uint32_t h);
-    ft_void_t Memcpy(ft_uint32_t dest, ft_uint32_t src, ft_uint32_t num);
+    ft_void_t Scale(ft_int32_t sx, ft_int32_t sy);
+    ft_void_t Rotate(ft_int32_t a);
+    ft_void_t Translate(ft_int32_t tx, ft_int32_t ty);
+    ft_void_t Calibrate(ft_uint32_t result);
+    ft_void_t SetRotate(ft_uint32_t r);
     ft_void_t Spinner(ft_int16_t x, ft_int16_t y, ft_uint16_t style, ft_uint16_t scale);
-    ft_void_t BgColor(ft_uint32_t c);
-    ft_void_t Swap();
-    ft_void_t Inflate(ft_uint32_t ptr);
-    ft_void_t Translate(ft_int32_t tx, ft_int32_t ty);
+    ft_void_t ScreenSaver();
+    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);
     ft_void_t Stop();
-    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);
-    ft_void_t Interrupt(ft_uint32_t ms);
-    ft_void_t FgColor(ft_uint32_t c);
-    ft_void_t Rotate(ft_int32_t a);
-    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);
-    ft_void_t MemWrite(ft_uint32_t ptr, ft_uint32_t num);
-    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);
-    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);
-    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);
-    ft_void_t MemSet(ft_uint32_t ptr, ft_uint32_t value, ft_uint32_t num);
-    ft_void_t Calibrate(ft_uint32_t result);
     ft_void_t SetFont(ft_uint32_t font, ft_uint32_t ptr);
-    ft_void_t RomFont( ft_uint32_t font, ft_uint32_t rom_slot);
+    ft_void_t SetFont2(ft_uint32_t font, ft_uint32_t ptr, ft_uint32_t firstchar);
+    ft_void_t SetScratch(ft_uint32_t handle);
+    ft_void_t RomFont(ft_uint32_t font, ft_uint32_t rom_slot);
+    ft_void_t Track(ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t h, ft_int16_t tag);
+    ft_void_t Snapshot(ft_uint32_t ptr);
+    ft_void_t Snapshot2(ft_uint32_t fmt, ft_uint32_t ptr, ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t h);
+    ft_void_t SetBitmap(ft_int32_t addr, ft_int16_t fmt, ft_uint16_t width, ft_uint16_t height);
+    ft_void_t Logo();
+
     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);
-    ft_void_t GradColor(ft_uint32_t c);
-    ft_void_t Append(ft_uint32_t ptr, ft_uint32_t num);
-    ft_void_t MemZero(ft_uint32_t ptr, ft_uint32_t num);
-    ft_void_t Scale(ft_int32_t sx, ft_int32_t sy);
-    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);
-    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);
-    ft_void_t SetMatrix();
-    ft_void_t Track(ft_int16_t x, ft_int16_t y, ft_int16_t w, ft_int16_t h, ft_int16_t tag);
-    ft_void_t GetPtr(ft_uint32_t result);
-    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);
-    ft_void_t ColdStart();
-    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);
-    ft_void_t Dial(ft_int16_t x, ft_int16_t y, ft_int16_t r, ft_uint16_t options, ft_uint16_t val);
-    ft_void_t LoadImage(ft_uint32_t ptr, ft_uint32_t options);
-    ft_void_t DLstart();
-    ft_void_t Snapshot(ft_uint32_t ptr);
-    ft_void_t ScreenSaver();
-    ft_void_t Memcrc(ft_uint32_t ptr, ft_uint32_t num, ft_uint32_t result);
+ 
  
-    ft_void_t Logo();
+    ft_void_t SendCmd(ft_uint32_t cmd);
+    ft_void_t SendStr(const ft_char8_t *s);
+    ft_void_t StartFunc(ft_uint16_t count);
+//    ft_void_t EndFunc(ft_uint16_t count);
+    ft_void_t EndFunc();
+    
+    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);
+    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);
+    ft_void_t MemCrc(ft_uint32_t ptr, ft_uint32_t num, ft_uint32_t result);
  
-    ft_void_t SendCmd( ft_uint32_t cmd);
-    ft_void_t SendStr( const ft_char8_t *s);
-    ft_void_t StartFunc( ft_uint16_t count);
-    ft_void_t EndFunc( ft_uint16_t count);
-    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);
-    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);
-    ft_void_t MemCrc( ft_uint32_t ptr, ft_uint32_t num, ft_uint32_t result);
- 
-    ft_uint16_t fifo_Freespace( );
+    ft_uint16_t fifo_Freespace();
  
     ft_void_t DL(ft_uint32_t cmd);
     ft_void_t WrDlCmd_Buffer(ft_uint32_t cmd);
@@ -257,21 +293,91 @@
     ft_void_t fadein();
     ft_void_t DLSwap(ft_uint8_t DL_Swap_Type);
  
+    ft_void_t Point(ft_int16_t x, ft_int16_t y, ft_uint16_t size);
+    ft_void_t Line(ft_int16_t x0, ft_int16_t y0, ft_int16_t x1, ft_int16_t y1, ft_int16_t width);
+    ft_void_t Rect(ft_int16_t x0, ft_int16_t y0, ft_int16_t x1, ft_int16_t y1, ft_int16_t corner);
+    ft_void_t RectWH(ft_int16_t x0, ft_int16_t y0, ft_int16_t w, ft_int16_t h, ft_int16_t corner);
+    ft_uint8_t LoadJpg(char* filename, ft_int16_t* x_size, ft_int16_t* y_size);
+    ft_uint8_t LoadPng(char* filename, ft_int16_t* x_size, ft_int16_t* y_size);
+    //Curt added Load_raw 7/22/16
+    int LoadRaw(char* filename);
+    int LoadRawFile(ft_uint32_t address, char* filename);
+
+    void FillBitmap(ft_int16_t bitmap_number);
+    void ClearBitmapCount(void);
+    ft_uint32_t ReadBigInt32(unsigned char* data, ft_uint32_t offset);
+
+    ft_uint8_t Jpg(char *jpg_filename, int x, int y);
+    ft_uint8_t Png(char *png_filename, int x, int y);
+    ft_uint8_t Png(char *png_filename, int x, int y, ft_int32_t address);
+
+    ft_uint8_t JpgSplash(char *jpg_filename, ft_uint8_t r, ft_uint8_t g, ft_uint8_t b);
+
+    ft_uint16_t CoProFIFO_FreeSpace(void);
+    void Wait4CoProFIFO(ft_uint32_t room);
+    void Wait4CoProFIFOEmpty(void);
+    ft_uint8_t CheckIfCoProFIFOEmpty(void);
+    ft_uint32_t WriteBlockRAM(ft_uint32_t Add, const ft_uint8_t *buff, ft_uint32_t count);
+
+
     ft_void_t Sound_ON();
     ft_void_t Sound_OFF();
     
-    int Load_jpg(char* filename, ft_int16_t* x_size, ft_int16_t* y_size,ft_uint32_t address);
-    
-    //Curt added Load_raw 7/22/16
-    int Load_raw(char* filename);
-    
+//    int Load_jpg(char* filename, ft_int16_t* x_size, ft_int16_t* y_size,ft_uint32_t address);
+        
     ft_void_t Calibrate();
+    ft_uint8_t read_calibrate_reg(ft_uint8_t i);
+    ft_uint32_t read_calibrate_reg32(ft_uint8_t i);
     ft_void_t read_calibrate(ft_uint8_t data[24]);
     ft_void_t write_calibrate(ft_uint8_t data[24]);
+    ft_void_t write_calibrate32(ft_uint32_t data[6]);
     
     ft_uint32_t color_rgb(ft_uint8_t red,ft_uint8_t green, ft_uint8_t blue);
     ft_uint32_t clear_color_rgb(ft_uint8_t red,ft_uint8_t green, ft_uint8_t blue);
- 
+
+    void SetBacklight(ft_uint16_t brightness);
+
+    void Tag(ft_uint8_t s);
+    void ClearTag(ft_uint8_t s);
+    void TagMask(ft_uint8_t mask);
+    void BitmapLayoutH(ft_uint8_t linestride, ft_uint8_t height);
+    void BitmapSizeH(ft_uint8_t width, ft_uint8_t height);
+
+    ft_void_t SetLoadAddress(ft_uint32_t address);
+    ft_void_t SetBitmapCount(ft_uint8_t count);
+    ft_uint32_t GetBitmapAddress(ft_uint8_t count);
+    void SetThemeDefaultColor(void);
+    void SetThemeColor(ft_uint32_t c);
+    void ShowCalibrationInCode(void);
+    void SetOrientation(ft_uint8_t orientation);
+    void ShowBitmap(ft_uint8_t bitmap, ft_int16_t fmt, ft_uint16_t x, ft_uint16_t y, ft_uint16_t width, ft_uint16_t height);
+    void ShowBitmapAtAddress(ft_uint32_t addr, ft_int16_t fmt, ft_uint16_t x, ft_uint16_t y, ft_uint16_t width, ft_uint16_t height);
+    int GetImageIndexFromName(char *name);
+    int ResetInflateFileBitmap(void);
+    uint32_t GetRamUsage(void);
+    uint16_t GetRamNoOfBitmaps(void);
+    int LoadInflateFileBitmap(char *name, uint16_t fmt, uint16_t w, uint16_t h);
+    int ShowBitmapByName(char *name, uint16_t w, uint16_t h);
+    uint16_t GetTouchedTag(void);
+    uint16_t GetTouchedTag(uint8_t point_number);
+    uint8_t GetTag(void);
+    uint16_t GetTagX(void);
+    uint16_t GetTagY(void);
+    uint8_t GetTouchTag(void);
+    uint16_t GetTouchTagX(void);
+    uint16_t GetTouchTagY(void);
+    uint16_t GetTouchConfig(void);
+    void SetTouchConfig(uint16_t TouchConfigVal);
+    
+    void screenShot(void);
+    
+    int LoadRawFile(ft_uint32_t address, const char *filename);
+    int LoadInflateFile(ft_uint32_t address, const char *filename);
+    int LoadImageFile(ft_uint32_t address, const char *filename);
+    ft_void_t SetEndAddressForSize(ft_uint32_t addr);
+
+    ft_void_t Wr8s(ft_uint32_t addr, ft_uint8_t *buffer, ft_uint8_t length);
+
 };  // end of class
  
-#endif  /*FT_GPU_HAL_H*/
\ No newline at end of file
+#endif  /*FT_GPU_HAL_H*/