image/svg+xml
Brteve's API for EveApps
Version 0.0.1
The reference document for common folder of EveApps project.
 
Loading...
Searching...
No Matches
EVE_HalDefs.h File Reference

Eve_Hal framework APIs. More...

#include "EVE_GpuTypes.h"
#include "ff.h"

Go to the source code of this file.

Data Structures

struct  EVE_DeviceInfo
 
struct  EVE_HalParameters
 
struct  EVE_HalDlState
 
struct  EVE_HalContext
 
struct  EVE_HalPlatform
 

Macros

#define RAM_ERR_REPORT_MAX   128
 
#define EVE_DL_STATE   phost->DlState[phost->DlStateIndex]
 

Typedefs

typedef enum EVE_MODE_T EVE_MODE_T
 
typedef enum EVE_STATUS_T EVE_STATUS_T
 
typedef enum EVE_TRANSFER_T EVE_TRANSFER_T
 
typedef enum EVE_CHIPID_T EVE_CHIPID_T
 
typedef struct EVE_HalContext EVE_HalContext
 
typedef bool(* EVE_Callback) (EVE_HalContext *phost)
 
typedef int(* EVE_CoCmdHook) (EVE_HalContext *phost, uint32_t cmd, uint32_t state)
 
typedef void(* EVE_ResetCallback) (EVE_HalContext *phost, bool fault)
 
typedef enum EVE_HOST_T EVE_HOST_T
 
typedef struct EVE_DeviceInfo EVE_DeviceInfo
 
typedef struct EVE_HalParameters EVE_HalParameters
 
typedef struct EVE_HalDlState EVE_HalDlState
 
typedef struct EVE_HalPlatform EVE_HalPlatform
 

Enumerations

enum  EVE_MODE_T { EVE_MODE_UNKNOWN = 0 , EVE_MODE_I2C , EVE_MODE_SPI }
 
enum  EVE_STATUS_T {
  EVE_STATUS_CLOSED = 0 , EVE_STATUS_OPENED , EVE_STATUS_READING , EVE_STATUS_WRITING ,
  EVE_STATUS_ERROR
}
 
enum  EVE_TRANSFER_T { EVE_TRANSFER_NONE = 0 , EVE_TRANSFER_READ , EVE_TRANSFER_WRITE }
 
enum  EVE_CHIPID_T {
  EVE_CHIPID_FT800 = EVE_FT800 , EVE_CHIPID_FT801 = EVE_FT801 , EVE_CHIPID_FT810 = EVE_FT810 , EVE_CHIPID_FT811 = EVE_FT811 ,
  EVE_CHIPID_FT812 = EVE_FT812 , EVE_CHIPID_FT813 = EVE_FT813 , EVE_CHIPID_BT880 = EVE_BT880 , EVE_CHIPID_BT881 = EVE_BT881 ,
  EVE_CHIPID_BT882 = EVE_BT882 , EVE_CHIPID_BT883 = EVE_BT883 , EVE_CHIPID_BT815 = EVE_BT815 , EVE_CHIPID_BT816 = EVE_BT816 ,
  EVE_CHIPID_BT817 = EVE_BT817 , EVE_CHIPID_BT818 = EVE_BT818
}
 
enum  EVE_HOST_T {
  EVE_HOST_UNKNOWN = 0 , EVE_HOST_BT8XXEMU , EVE_HOST_FT4222 , EVE_HOST_MPSSE ,
  EVE_HOST_EMBEDDED , EVE_HOST_NB
}
 

Functions

INIT
EVE_HAL_EXPORT EVE_HalPlatformEVE_Hal_initialize ()
 Eve_Hal framework initialization.
 
EVE_HAL_EXPORT void EVE_Hal_release ()
 Close Eve_Hal framework.
 
EVE_HAL_EXPORT size_t EVE_Hal_list ()
 List the available devices.
 
EVE_HAL_EXPORT void EVE_Hal_info (EVE_DeviceInfo *deviceInfo, size_t deviceIdx)
 Get info of the specified device. Devices of type EVE_HOST_UNKNOWN should be ignored.
 
EVE_HAL_EXPORT bool EVE_Hal_isDevice (EVE_HalContext *phost, size_t deviceIdx)
 Check whether the context is the specified device.
 
EVE_HAL_EXPORT void EVE_Hal_defaults (EVE_HalParameters *parameters)
 Setup default parameters for Eve_Hal framework.
 
EVE_HAL_EXPORT void EVE_Hal_defaultsEx (EVE_HalParameters *parameters, size_t deviceIdx)
 Setup default parameters for Eve_Hal framework.
 
EVE_HAL_EXPORT bool EVE_Hal_open (EVE_HalContext *phost, const EVE_HalParameters *parameters)
 Open the Eve_Hal framework.
 
EVE_HAL_EXPORT void EVE_Hal_close (EVE_HalContext *phost)
 Close the Eve_Hal framework.
 
EVE_HAL_EXPORT void EVE_Hal_idle (EVE_HalContext *phost)
 Idle handler for Eve_Hal framework.
 
TRANSFER
EVE_HAL_EXPORT void EVE_Hal_startTransfer (EVE_HalContext *phost, EVE_TRANSFER_T rw, uint32_t addr)
 Start data transfer to Coprocessor.
 
EVE_HAL_EXPORT uint8_t EVE_Hal_transfer8 (EVE_HalContext *phost, uint8_t value)
 Write 8 bits to Coprocessor.
 
EVE_HAL_EXPORT uint16_t EVE_Hal_transfer16 (EVE_HalContext *phost, uint16_t value)
 Write 2 bytes to Coprocessor.
 
EVE_HAL_EXPORT uint32_t EVE_Hal_transfer32 (EVE_HalContext *phost, uint32_t value)
 Write 4 bytes to Coprocessor.
 
EVE_HAL_EXPORT void EVE_Hal_transferMem (EVE_HalContext *phost, uint8_t *result, const uint8_t *buffer, uint32_t size)
 Transfer (read/write) a block data to Coprocessor.
 
EVE_HAL_EXPORT void EVE_Hal_transferProgMem (EVE_HalContext *phost, uint8_t *result, eve_progmem_const uint8_t *buffer, uint32_t size)
 Transfer a block data from program memory.
 
EVE_HAL_EXPORT uint32_t EVE_Hal_transferString (EVE_HalContext *phost, const char *str, uint32_t index, uint32_t size, uint32_t padMask)
 Transfer a string to EVE platform.
 
EVE_HAL_EXPORT void EVE_Hal_endTransfer (EVE_HalContext *phost)
 End data transfer.
 
EVE_HAL_EXPORT void EVE_Hal_flush (EVE_HalContext *phost)
 Flush data to Coprocessor.
 
TRANSFER HELPERS
EVE_HAL_EXPORT uint8_t EVE_Hal_rd8 (EVE_HalContext *phost, uint32_t addr)
 Read 8 bits from Coprocessor's memory.
 
EVE_HAL_EXPORT uint16_t EVE_Hal_rd16 (EVE_HalContext *phost, uint32_t addr)
 Read 2 bytes from Coprocessor's memory.
 
EVE_HAL_EXPORT uint32_t EVE_Hal_rd32 (EVE_HalContext *phost, uint32_t addr)
 Read 4 bytes from Coprocessor's memory.
 
EVE_HAL_EXPORT void EVE_Hal_rdMem (EVE_HalContext *phost, uint8_t *result, uint32_t addr, uint32_t size)
 Read a block data from Coprocessor's memory.
 
EVE_HAL_EXPORT void EVE_Hal_wr8 (EVE_HalContext *phost, uint32_t addr, uint8_t v)
 Write 8 bits to Coprocessor's memory.
 
EVE_HAL_EXPORT void EVE_Hal_wr16 (EVE_HalContext *phost, uint32_t addr, uint16_t v)
 Write 2 bytes to Coprocessor's memory.
 
EVE_HAL_EXPORT void EVE_Hal_wr32 (EVE_HalContext *phost, uint32_t addr, uint32_t v)
 Write 4 bytes to Coprocessor's memory.
 
EVE_HAL_EXPORT void EVE_Hal_wrMem (EVE_HalContext *phost, uint32_t addr, const uint8_t *buffer, uint32_t size)
 Write a buffer to Coprocessor's memory.
 
EVE_HAL_EXPORT void EVE_Hal_wrProgMem (EVE_HalContext *phost, uint32_t addr, eve_progmem_const uint8_t *buffer, uint32_t size)
 Write a buffer in ProgMem to Coprocessor's memory.
 
EVE_HAL_EXPORT void EVE_Hal_wrString (EVE_HalContext *phost, uint32_t addr, const char *str, uint32_t index, uint32_t size, uint32_t padMask)
 Write a string to Coprocessor's memory.
 
CAPS
static bool EVE_Hal_isScreenCapacitive (EVE_HalContext *phost)
 
static bool EVE_Hal_isScreenResistive (EVE_HalContext *phost)
 
static bool EVE_Hal_supportHsf (EVE_HalContext *phost)
 
static bool EVE_Hal_supportFlash (EVE_HalContext *phost)
 
static bool EVE_Hal_supportCmdB (EVE_HalContext *phost)
 
static bool EVE_Hal_supportMediaFifo (EVE_HalContext *phost)
 
static bool EVE_Hal_supportVideo (EVE_HalContext *phost)
 
static bool EVE_Hal_supportLargeFont (EVE_HalContext *phost)
 
static EVE_CHIPID_T EVE_extendedChipId (int chipId)
 
static int EVE_shortChipId (EVE_CHIPID_T chipId)
 
static int EVE_gen (EVE_CHIPID_T chipId)
 
UTILITY
EVE_HAL_EXPORT void EVE_Hal_hostCommand (EVE_HalContext *phost, uint8_t cmd)
 Send a host command to Coprocessor.
 
EVE_HAL_EXPORT void EVE_Hal_hostCommandExt3 (EVE_HalContext *phost, uint32_t cmd)
 This API sends a 3byte command to the phost.
 
EVE_HAL_EXPORT bool EVE_Hal_powerCycle (EVE_HalContext *phost, bool up)
 Toggle PD_N pin of FT800 board for a power cycle.
 
EVE_HAL_EXPORT void EVE_Hal_setSPI (EVE_HalContext *phost, EVE_SPI_CHANNELS_T numchnls, uint8_t numdummy)
 Set number of SPI channel.
 
EVE_HAL_EXPORT void EVE_Hal_restoreSPI (EVE_HalContext *phost)
 
EVE_HAL_EXPORT uint32_t EVE_Hal_currentFrequency (EVE_HalContext *phost)
 Get current system clock of Coprocessor.
 
EVE_HAL_EXPORT int32_t EVE_Hal_clockTrimming (EVE_HalContext *phost, uint32_t lowFreq)
 Trim the internal clock till the measured frequency is within the acceptable range.
 
HOST
EVE_HAL_EXPORT void EVE_Host_clockSelect (EVE_HalContext *phost, EVE_PLL_SOURCE_T pllsource)
 Select clock source for Coprocessor.
 
EVE_HAL_EXPORT void EVE_Host_pllFreqSelect (EVE_HalContext *phost, EVE_PLL_FREQ_T freq)
 Select system clock for Coprocessor.
 
EVE_HAL_EXPORT void EVE_Host_powerModeSwitch (EVE_HalContext *phost, EVE_POWER_MODE_T pwrmode)
 Switch power mode for Coprocessor.
 
EVE_HAL_EXPORT void EVE_Host_coreReset (EVE_HalContext *phost)
 Send reset signal to Coprocessor.
 
EVE_HAL_EXPORT void EVE_Host_selectSysClk (EVE_HalContext *phost, EVE_81X_PLL_FREQ_T freq)
 Set system clock for Coprocessor.
 
EVE_HAL_EXPORT void EVE_Host_powerOffComponents (EVE_HalContext *phost, uint8_t val)
 Power off a component.
 
EVE_HAL_EXPORT void EVE_Host_padDriveStrength (EVE_HalContext *phost, EVE_81X_GPIO_DRIVE_STRENGTH_T strength, EVE_81X_GPIO_GROUP_T group)
 Set the drive strength for various pins.
 
EVE_HAL_EXPORT void EVE_Host_resetActive (EVE_HalContext *phost)
 Hold the device in reset state.
 
EVE_HAL_EXPORT void EVE_Host_resetRemoval (EVE_HalContext *phost)
 Exit reset state, Eve will power on and enter into its default state.
 
MISC
EVE_HAL_EXPORT uint32_t EVE_millis ()
 Get clock in miliseond.
 
EVE_HAL_EXPORT uint64_t EVE_millis64 ()
 Get clock in miliseond.
 
EVE_HAL_EXPORT void EVE_sleep (uint32_t ms)
 Sleep in milisecond.
 

DEBUG

#define EVE_Hal_displayMessageZ(phost, str)   EVE_Hal_displayMessage((phost), (str), (uint16_t)strlen((str)))
 
EVE_HAL_EXPORT void EVE_Hal_displayMessage (EVE_HalContext *phost, const char *str, uint16_t size)
 Display a fullscreen debug message using TEXT8X8. Uses the back of RAM_G.
 

Detailed Description

Eve_Hal framework APIs.

This file defines the generic APIs of phost access layer for the FT800 or EVE compatible silicon. Application shall access FT800 or EVE resources over these APIs,regardless of I2C or SPI protocol. In addition, there are some helper functions defined for FT800 coprocessor engine as well as phost commands.

Author
Bridgetek
Date
2018

MIT License

Copyright (c) [2019] [Bridgetek Pte Ltd (BRTChip)]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Definition in file EVE_HalDefs.h.

Macro Definition Documentation

◆ EVE_DL_STATE

#define EVE_DL_STATE   phost->DlState[phost->DlStateIndex]

Definition at line 198 of file EVE_HalDefs.h.

◆ EVE_Hal_displayMessageZ

#define EVE_Hal_displayMessageZ (   phost,
  str 
)    EVE_Hal_displayMessage((phost), (str), (uint16_t)strlen((str)))

Display a fullscreen debug message using TEXT8X8. Uses the back of RAM_G.

Definition at line 676 of file EVE_HalDefs.h.

◆ RAM_ERR_REPORT_MAX

#define RAM_ERR_REPORT_MAX   128

Definition at line 89 of file EVE_HalDefs.h.

Typedef Documentation

◆ EVE_Callback

typedef bool(* EVE_Callback) (EVE_HalContext *phost)

Definition at line 96 of file EVE_HalDefs.h.

◆ EVE_CHIPID_T

typedef enum EVE_CHIPID_T EVE_CHIPID_T

◆ EVE_CoCmdHook

typedef int(* EVE_CoCmdHook) (EVE_HalContext *phost, uint32_t cmd, uint32_t state)

Hook into coprocessor commands. Return 1 to abort the command. Useful for an optimization routine

Definition at line 99 of file EVE_HalDefs.h.

◆ EVE_DeviceInfo

◆ EVE_HalContext

Definition at line 95 of file EVE_HalDefs.h.

◆ EVE_HalDlState

◆ EVE_HalParameters

Hal parameters

◆ EVE_HalPlatform

◆ EVE_HOST_T

typedef enum EVE_HOST_T EVE_HOST_T

◆ EVE_MODE_T

typedef enum EVE_MODE_T EVE_MODE_T

◆ EVE_ResetCallback

typedef void(* EVE_ResetCallback) (EVE_HalContext *phost, bool fault)

Hook into coprocessor reset

Definition at line 101 of file EVE_HalDefs.h.

◆ EVE_STATUS_T

typedef enum EVE_STATUS_T EVE_STATUS_T

◆ EVE_TRANSFER_T

Enumeration Type Documentation

◆ EVE_CHIPID_T

Enumerator
EVE_CHIPID_FT800 

EVE_FT800

EVE_CHIPID_FT801 

EVE_FT801

EVE_CHIPID_FT810 

EVE_FT810

EVE_CHIPID_FT811 

EVE_FT811

EVE_CHIPID_FT812 

EVE_FT812

EVE_CHIPID_FT813 

EVE_FT813

EVE_CHIPID_BT880 

EVE_BT880

EVE_CHIPID_BT881 

EVE_BT881

EVE_CHIPID_BT882 

EVE_BT882

EVE_CHIPID_BT883 

EVE_BT883

EVE_CHIPID_BT815 

EVE_BT815

EVE_CHIPID_BT816 

EVE_BT816

EVE_CHIPID_BT817 

EVE_BT817

EVE_CHIPID_BT818 

EVE_BT818

Definition at line 71 of file EVE_HalDefs.h.

72{
#define EVE_BT818
Definition EVE_Config.h:69
#define EVE_FT811
Definition EVE_Config.h:59
#define EVE_BT882
Definition EVE_Config.h:64
#define EVE_BT817
Definition EVE_Config.h:68
#define EVE_FT812
Definition EVE_Config.h:60
#define EVE_BT883
Definition EVE_Config.h:65
#define EVE_FT800
Definition EVE_Config.h:56
#define EVE_BT881
Definition EVE_Config.h:63
#define EVE_FT813
Definition EVE_Config.h:61
#define EVE_BT815
Definition EVE_Config.h:66
#define EVE_BT880
Definition EVE_Config.h:62
#define EVE_BT816
Definition EVE_Config.h:67
#define EVE_FT810
Definition EVE_Config.h:58
#define EVE_FT801
Definition EVE_Config.h:57
EVE_CHIPID_T
Definition EVE_HalDefs.h:72
@ EVE_CHIPID_BT817
Definition EVE_HalDefs.h:85
@ EVE_CHIPID_BT880
Definition EVE_HalDefs.h:79
@ EVE_CHIPID_FT812
Definition EVE_HalDefs.h:77
@ EVE_CHIPID_BT816
Definition EVE_HalDefs.h:84
@ EVE_CHIPID_FT810
Definition EVE_HalDefs.h:75
@ EVE_CHIPID_BT882
Definition EVE_HalDefs.h:81
@ EVE_CHIPID_FT813
Definition EVE_HalDefs.h:78
@ EVE_CHIPID_FT801
Definition EVE_HalDefs.h:74
@ EVE_CHIPID_BT818
Definition EVE_HalDefs.h:86
@ EVE_CHIPID_BT881
Definition EVE_HalDefs.h:80
@ EVE_CHIPID_BT883
Definition EVE_HalDefs.h:82
@ EVE_CHIPID_BT815
Definition EVE_HalDefs.h:83
@ EVE_CHIPID_FT811
Definition EVE_HalDefs.h:76
@ EVE_CHIPID_FT800
Definition EVE_HalDefs.h:73

◆ EVE_HOST_T

enum EVE_HOST_T
Enumerator
EVE_HOST_UNKNOWN 

0

EVE_HOST_BT8XXEMU 
EVE_HOST_FT4222 
EVE_HOST_MPSSE 
EVE_HOST_EMBEDDED 
EVE_HOST_NB 

Definition at line 131 of file EVE_HalDefs.h.

132{
133 EVE_HOST_UNKNOWN = 0,
138
140} EVE_HOST_T;
EVE_HOST_T
@ EVE_HOST_NB
@ EVE_HOST_UNKNOWN
@ EVE_HOST_EMBEDDED
@ EVE_HOST_FT4222
@ EVE_HOST_MPSSE
@ EVE_HOST_BT8XXEMU

◆ EVE_MODE_T

enum EVE_MODE_T
Enumerator
EVE_MODE_UNKNOWN 

0

EVE_MODE_I2C 
EVE_MODE_SPI 

Definition at line 48 of file EVE_HalDefs.h.

49{
EVE_MODE_T
Definition EVE_HalDefs.h:49
@ EVE_MODE_SPI
Definition EVE_HalDefs.h:52
@ EVE_MODE_UNKNOWN
Definition EVE_HalDefs.h:50
@ EVE_MODE_I2C
Definition EVE_HalDefs.h:51

◆ EVE_STATUS_T

Enumerator
EVE_STATUS_CLOSED 

0

EVE_STATUS_OPENED 
EVE_STATUS_READING 
EVE_STATUS_WRITING 
EVE_STATUS_ERROR 

Definition at line 55 of file EVE_HalDefs.h.

56{
EVE_STATUS_T
Definition EVE_HalDefs.h:56
@ EVE_STATUS_READING
Definition EVE_HalDefs.h:59
@ EVE_STATUS_CLOSED
Definition EVE_HalDefs.h:57
@ EVE_STATUS_OPENED
Definition EVE_HalDefs.h:58
@ EVE_STATUS_ERROR
Definition EVE_HalDefs.h:61
@ EVE_STATUS_WRITING
Definition EVE_HalDefs.h:60

◆ EVE_TRANSFER_T

Enumerator
EVE_TRANSFER_NONE 

0

EVE_TRANSFER_READ 
EVE_TRANSFER_WRITE 

Definition at line 64 of file EVE_HalDefs.h.

65{
EVE_TRANSFER_T
Definition EVE_HalDefs.h:65
@ EVE_TRANSFER_WRITE
Definition EVE_HalDefs.h:68
@ EVE_TRANSFER_NONE
Definition EVE_HalDefs.h:66
@ EVE_TRANSFER_READ
Definition EVE_HalDefs.h:67

Function Documentation

◆ EVE_extendedChipId()

static EVE_CHIPID_T EVE_extendedChipId ( int  chipId)
inlinestatic

Include the EVE generation in the chip ID value to simplify feature set comparisons(BT880 support)

Definition at line 540 of file EVE_HalDefs.h.

541{
542 switch (chipId & 0xFFFF)
543 {
544 case EVE_FT800 & 0xFFFF:
545 case EVE_FT801 & 0xFFFF:
546 return (EVE_CHIPID_T)((chipId & 0xFFFF) | 0x10000);
547 case EVE_FT810 & 0xFFFF:
548 case EVE_FT811 & 0xFFFF:
549 case EVE_FT812 & 0xFFFF:
550 case EVE_FT813 & 0xFFFF:
551 case EVE_BT880 & 0xFFFF:
552 case EVE_BT881 & 0xFFFF:
553 case EVE_BT882 & 0xFFFF:
554 case EVE_BT883 & 0xFFFF:
555 return (EVE_CHIPID_T)((chipId & 0xFFFF) | 0x20000);
556 case EVE_BT815 & 0xFFFF:
557 case EVE_BT816 & 0xFFFF:
558 return (EVE_CHIPID_T)((chipId & 0xFFFF) | 0x30000);
559 case EVE_BT817 & 0xFFFF:
560 case EVE_BT818 & 0xFFFF:
561 return (EVE_CHIPID_T)((chipId & 0xFFFF) | 0x40000);
562 default:
563 break;
564 }
565 return (EVE_CHIPID_T)(chipId & 0xFFFF);
566}

◆ EVE_gen()

static int EVE_gen ( EVE_CHIPID_T  chipId)
inlinestatic

Definition at line 574 of file EVE_HalDefs.h.

575{
576 switch (chipId)
577 {
578 case EVE_FT800:
579 case EVE_FT801:
580 return EVE1;
581 case EVE_FT810:
582 case EVE_FT811:
583 case EVE_FT812:
584 case EVE_FT813:
585 case EVE_BT880:
586 case EVE_BT881:
587 case EVE_BT882:
588 case EVE_BT883:
589 return EVE2;
590 case EVE_BT815:
591 case EVE_BT816:
592 return EVE3;
593 case EVE_BT817:
594 case EVE_BT818:
595 return EVE4;
596 default:
597 break;
598 }
599 return 0;
600}
#define EVE4
Definition EVE_Config.h:77
#define EVE1
Definition EVE_Config.h:74
#define EVE3
Definition EVE_Config.h:76
#define EVE2
Definition EVE_Config.h:75

◆ EVE_Hal_clockTrimming()

EVE_HAL_EXPORT int32_t EVE_Hal_clockTrimming ( EVE_HalContext phost,
uint32_t  lowFreq 
)

Trim the internal clock till the measured frequency is within the acceptable range.

Parameters
phostPointer to Hal context
lowFreqLow frequency target to trim
Returns
int32_t frequency after trim

Definition at line 317 of file EVE_Hal.c.

318{
319 uint32_t f;
320
321 /* Trim the internal clock by increase the REG_TRIM register till the measured frequency is within the acceptable range.*/
323 for (uint8_t i = 0; i < 31 && f < lowFreq; i++)
324 {
325 EVE_Hal_wr8(phost, REG_TRIM, i); /* increase the REG_TRIM register value automatically increases the internal clock */
327 }
328 EVE_Hal_wr32(phost, REG_FREQUENCY, f); /* Set the final frequency to be used for internal operations */
329
330 return f;
331}
static uint32_t f
Definition Common.c:41
#define REG_TRIM
#define REG_FREQUENCY
EVE_HAL_EXPORT void EVE_Hal_wr8(EVE_HalContext *phost, uint32_t addr, uint8_t v)
Write 8 bits to Coprocessor's memory.
Definition EVE_Hal.c:220
EVE_HAL_EXPORT void EVE_Hal_wr32(EVE_HalContext *phost, uint32_t addr, uint32_t v)
Write 4 bytes to Coprocessor's memory.
Definition EVE_Hal.c:248
EVE_HAL_EXPORT uint32_t EVE_Hal_currentFrequency(EVE_HalContext *phost)
Get current system clock of Coprocessor.
unsigned int uint32_t
unsigned char uint8_t

◆ EVE_Hal_close()

EVE_HAL_EXPORT void EVE_Hal_close ( EVE_HalContext phost)

Close the Eve_Hal framework.

Close a HAL context

Parameters
phostPointer to Hal context

Definition at line 116 of file EVE_Hal.c.

117{
118 if (phost->Status == EVE_STATUS_CLOSED)
119 {
120 eve_printf_debug("Attempt to close HAL context that is already closed\n");
121 return;
122 }
123
124#ifdef EVE_SUPPORT_MEDIAFIFO
125 EVE_Util_closeFile(phost);
126#endif
127 EVE_HalImpl_close(phost);
128 memset(phost, 0, sizeof(EVE_HalContext));
129}
void EVE_HalImpl_close(EVE_HalContext *phost)
Close a HAL context.
EVE_HAL_EXPORT void EVE_Util_closeFile(EVE_HalContext *phost)
#define eve_printf_debug(fmt,...)
EVE_STATUS_T Status

◆ EVE_Hal_currentFrequency()

EVE_HAL_EXPORT uint32_t EVE_Hal_currentFrequency ( EVE_HalContext phost)

Get current system clock of Coprocessor.

Parameters
phostPointer to Hal context
Returns
uint32_t Frequency of Coprocessor

Definition at line 650 of file EVE_HalImpl_FT9XX.c.

651{
652 uint32_t t0;
653 uint32_t t1;
654 int32_t r = 15625;
655
656 t0 = EVE_Hal_rd32(phost, REG_CLOCK); /* t0 read */
657
658 __asm__(
659 " move.l $r0,%0 \n\t"
660 " mul.l $r0,$r0,100 \n\t"
661 "1: \n\t"
662 " sub.l $r0,$r0,3 \n\t" /* Subtract the loop time = 4 cycles */
663 " cmp.l $r0,0 \n\t" /* Check that the counter is equal to 0 */
664 " jmpc gt, 1b \n\t"
665 : /* Outputs */
666 : "r"(r) /* Inputs */
667 : "$r0"); /* Using */
668
669 t1 = EVE_Hal_rd32(phost, REG_CLOCK); /* t1 read */
670 return ((t1 - t0) << 6); /* bitshift 6 places is the same as multiplying 64 */
671}
#define REG_CLOCK
EVE_HAL_EXPORT uint32_t EVE_Hal_rd32(EVE_HalContext *phost, uint32_t addr)
Read 4 bytes from Coprocessor's memory.
Definition EVE_Hal.c:189
int int32_t

◆ EVE_Hal_defaults()

EVE_HAL_EXPORT void EVE_Hal_defaults ( EVE_HalParameters parameters)

Setup default parameters for Eve_Hal framework.

Get the default configuration parameters

Parameters
parametersPointer to EVE_HalParameters

Definition at line 78 of file EVE_Hal.c.

79{
80 EVE_Hal_defaultsEx(parameters, -1);
81}
EVE_HAL_EXPORT void EVE_Hal_defaultsEx(EVE_HalParameters *parameters, size_t deviceIdx)
Setup default parameters for Eve_Hal framework.
Definition EVE_Hal.c:89

◆ EVE_Hal_defaultsEx()

EVE_HAL_EXPORT void EVE_Hal_defaultsEx ( EVE_HalParameters parameters,
size_t  deviceIdx 
)

Setup default parameters for Eve_Hal framework.

Get the default configuration parameters. Use deviceIdx to choose the connected device, or set to -1 to get the first available device.

Parameters
parametersPointer to EVE_HalParameters
deviceIdx

Definition at line 89 of file EVE_Hal.c.

90{
91 memset(parameters, 0, sizeof(EVE_HalParameters));
92 eve_assert_do(EVE_HalImpl_defaults(parameters, deviceIdx));
93}
bool EVE_HalImpl_defaults(EVE_HalParameters *parameters, size_t deviceIdx)
Get the default configuration parameters.
#define eve_assert_do(cond)

◆ EVE_Hal_displayMessage()

EVE_HAL_EXPORT void EVE_Hal_displayMessage ( EVE_HalContext phost,
const char *  str,
uint16_t  size 
)

Display a fullscreen debug message using TEXT8X8. Uses the back of RAM_G.

Display a fullscreen debug message using TEXT8X8. Uses the back of RAM_G.

Parameters
phostPointer to Hal context
strError message to show
sizeSize of the message

Definition at line 486 of file EVE_Hal.c.

487{
488 uint32_t round = ((size + 31U) & ~31U);
489 uint32_t addr = RAM_G + RAM_G_SIZE - round;
490 uint32_t dl = 0;
491
492 /* Abuse back of RAM_G to store error */
493 /* May invalidate user data... */
494 EVE_Hal_wrMem(phost, addr, (uint8_t *)str, size);
495
496 /* Empty remaining space after text */
498 for (uint32_t i = size; i < round; ++i)
499 EVE_Hal_transfer8(phost, 0);
500 EVE_Hal_endTransfer(phost);
501
502 /* Generate bluescreen */
503 EVE_Hal_wr32(phost, RAM_DL + ((dl++) << 2), CLEAR_COLOR_RGB(0x00, 0x20, 0x40));
504 EVE_Hal_wr32(phost, RAM_DL + ((dl++) << 2), CLEAR(1, 1, 1));
505 EVE_Hal_wr32(phost, RAM_DL + ((dl++) << 2), BITMAP_HANDLE(15)); /* Scratch handle will reset anyway after reset */
506 EVE_Hal_wr32(phost, RAM_DL + ((dl++) << 2), BITMAP_SOURCE(addr));
507 EVE_Hal_wr32(phost, RAM_DL + ((dl++) << 2), BITMAP_SIZE_H(0, 0));
508 EVE_Hal_wr32(phost, RAM_DL + ((dl++) << 2), BITMAP_SIZE(NEAREST, BORDER, BORDER, 256, (round >> 2)));
509 EVE_Hal_wr32(phost, RAM_DL + ((dl++) << 2), BITMAP_LAYOUT_H(0, 0));
510 EVE_Hal_wr32(phost, RAM_DL + ((dl++) << 2), BITMAP_LAYOUT(TEXT8X8, 32, (round >> 2)));
511 EVE_Hal_wr32(phost, RAM_DL + ((dl++) << 2), BEGIN(BITMAPS));
512 EVE_Hal_wr32(phost, RAM_DL + ((dl++) << 2), VERTEX2II(32, 32, 15, 0));
513#if ENABLE_ERR_REPORT
514 EVE_Hal_wr32(phost, RAM_DL + ((dl++) << 2), BITMAP_SOURCE(RAM_ERR_REPORT));
515 EVE_Hal_wr32(phost, RAM_DL + ((dl++) << 2), VERTEX2II(32, 96, 15, 0));
516#endif
517 EVE_Hal_wr32(phost, RAM_DL + ((dl++) << 2), DISPLAY());
519}
#define TEXT8X8
#define RAM_ERR_REPORT
Definition EVE_GpuDefs.h:79
#define NEAREST
#define CLEAR(c, s, t)
#define BITMAP_LAYOUT(format, linestride, height)
#define REG_DLSWAP
#define BEGIN(prim)
#define BITMAPS
#define BITMAP_HANDLE(handle)
#define BITMAP_SIZE_H(width, height)
#define DISPLAY()
#define BITMAP_SOURCE(addr)
#define BORDER
#define RAM_DL
Definition EVE_GpuDefs.h:95
#define DLSWAP_FRAME
#define BITMAP_LAYOUT_H(linestride, height)
#define RAM_G_SIZE
Definition EVE_GpuDefs.h:98
#define BITMAP_SIZE(filter, wrapx, wrapy, width, height)
#define RAM_G
Definition EVE_GpuDefs.h:77
#define CLEAR_COLOR_RGB(red, green, blue)
#define VERTEX2II(x, y, handle, cell)
EVE_HAL_EXPORT void EVE_Hal_wrMem(EVE_HalContext *phost, uint32_t addr, const uint8_t *buffer, uint32_t size)
Write a buffer to Coprocessor's memory.
Definition EVE_Hal.c:263
EVE_HAL_EXPORT uint8_t EVE_Hal_transfer8(EVE_HalContext *phost, uint8_t value)
Write 8 bits to Coprocessor.
EVE_HAL_EXPORT void EVE_Hal_startTransfer(EVE_HalContext *phost, EVE_TRANSFER_T rw, uint32_t addr)
Start data transfer to Coprocessor.
EVE_HAL_EXPORT void EVE_Hal_endTransfer(EVE_HalContext *phost)
End data transfer.
static ft_uint32_t addr
Definition FT_Gpu_Hal.h:139

◆ EVE_Hal_endTransfer()

EVE_HAL_EXPORT void EVE_Hal_endTransfer ( EVE_HalContext phost)

End data transfer.

Parameters
phostPointer to Hal context

Definition at line 291 of file EVE_HalImpl_FT9XX.c.

292{
294
295 spi_close(SPIM, phost->SpiCsPin);
296 phost->Status = EVE_STATUS_OPENED;
297}
#define eve_assert(cond)

◆ EVE_Hal_flush()

EVE_HAL_EXPORT void EVE_Hal_flush ( EVE_HalContext phost)

Flush data to Coprocessor.

Flush any pending write transfers

Parameters
phostPointer to Hal context

Definition at line 304 of file EVE_HalImpl_FT9XX.c.

305{
307 /* no-op */
308}

◆ EVE_Hal_hostCommand()

EVE_HAL_EXPORT void EVE_Hal_hostCommand ( EVE_HalContext phost,
uint8_t  cmd 
)

Send a host command to Coprocessor.

Parameters
phostPointer to Hal context
cmdCommand to send

Definition at line 544 of file EVE_HalImpl_FT9XX.c.

545{
547
548 uint8_t hcmd[4] = { 0 };
549 hcmd[0] = cmd;
550 hcmd[1] = 0;
551 hcmd[2] = 0;
552 hcmd[3] = 0;
553
554 spi_open(SPIM, phost->SpiCsPin);
555 spi_writen(SPIM, hcmd, 3);
556 spi_close(SPIM, phost->SpiCsPin);
557}
static ft_void_t ft_uint32_t * cmd
Definition FT_Gpu_Hal.h:184

◆ EVE_Hal_hostCommandExt3()

EVE_HAL_EXPORT void EVE_Hal_hostCommandExt3 ( EVE_HalContext phost,
uint32_t  cmd 
)

This API sends a 3byte command to the phost.

This API sends a 3byte command to the phost

Parameters
phostPointer to Hal context
cmdCommand to send

Definition at line 565 of file EVE_HalImpl_FT9XX.c.

566{
568
569 uint8_t hcmd[4] = { 0 };
570 hcmd[0] = cmd & 0xff;
571 hcmd[1] = (cmd >> 8) & 0xff;
572 hcmd[2] = (cmd >> 16) & 0xff;
573 hcmd[3] = 0;
574
575 spi_open(SPIM, phost->SpiCsPin);
576 spi_writen(SPIM, hcmd, 3);
577 spi_close(SPIM, phost->SpiCsPin);
578}

◆ EVE_Hal_idle()

EVE_HAL_EXPORT void EVE_Hal_idle ( EVE_HalContext phost)

Idle handler for Eve_Hal framework.

Idle. Call regularly to update frequently changing internal state. This is also called while waiting for cmd, in addition to the user idle callback

Parameters
phostPointer to Hal context

Definition at line 136 of file EVE_Hal.c.

137{
138 EVE_HalImpl_idle(phost);
139}
void EVE_HalImpl_idle(EVE_HalContext *phost)
Idle. Call regularly to update frequently changing internal state.

◆ EVE_Hal_info()

EVE_HAL_EXPORT void EVE_Hal_info ( EVE_DeviceInfo deviceInfo,
size_t  deviceIdx 
)

Get info of the specified device. Devices of type EVE_HOST_UNKNOWN should be ignored.

Get info of the specified device. Devices of type EVE_HOST_UNKNOWN should be ignored

Parameters
deviceInfo
deviceIdx

Definition at line 87 of file EVE_HalImpl_FT9XX.c.

88{
89 memset(deviceInfo, 0, sizeof(EVE_DeviceInfo));
90 strcpy_s(deviceInfo->DisplayName, sizeof(deviceInfo->DisplayName), "FT9XX");
91 strcpy_s(deviceInfo->SerialNumber, sizeof(deviceInfo->SerialNumber), "FT9XX");
92 deviceInfo->Host = EVE_HOST_EMBEDDED;
93}
#define strcpy_s(dst, sz, src)
char DisplayName[256]
char SerialNumber[16]
EVE_HOST_T Host

◆ EVE_Hal_initialize()

EVE_HAL_EXPORT EVE_HalPlatform * EVE_Hal_initialize ( )

Eve_Hal framework initialization.

Initialize HAL platform

Returns
EVE_HalPlatform* Poniter to EVE_HalPlatform struct

Definition at line 52 of file EVE_Hal.c.

53{
57 return &g_HalPlatform;
58}
EVE_HalPlatform g_HalPlatform
Definition EVE_Hal.c:43
void EVE_Mcu_initialize()
Init FT9x host MCU.
void EVE_HalImpl_initialize()
Initialize HAL platform.
void EVE_Millis_initialize()
Init FT9x timer.

◆ EVE_Hal_isDevice()

EVE_HAL_EXPORT bool EVE_Hal_isDevice ( EVE_HalContext phost,
size_t  deviceIdx 
)

Check whether the context is the specified device.

Check whether the context is the specified device

Parameters
phostPointer to Hal context
deviceIdx
Returns
true True if ok
false False if error

Definition at line 103 of file EVE_HalImpl_FT9XX.c.

104{
105 return true;
106}

◆ EVE_Hal_isScreenCapacitive()

static bool EVE_Hal_isScreenCapacitive ( EVE_HalContext phost)
inlinestatic

Screen based on chip id. This function compiles as a constant on single supported chipid target

Definition at line 473 of file EVE_HalDefs.h.

474{
475 return (EVE_CHIPID & 0x01) == 0x01;
476}
#define EVE_CHIPID

◆ EVE_Hal_isScreenResistive()

static bool EVE_Hal_isScreenResistive ( EVE_HalContext phost)
inlinestatic

Screen based on chip id. This function compiles as a constant on single supported chipid target

Definition at line 479 of file EVE_HalDefs.h.

480{
481 return !EVE_Hal_isScreenCapacitive(phost);
482}
static bool EVE_Hal_isScreenCapacitive(EVE_HalContext *phost)

◆ EVE_Hal_list()

EVE_HAL_EXPORT size_t EVE_Hal_list ( )

List the available devices.

List the available devices

Definition at line 76 of file EVE_HalImpl_FT9XX.c.

77{
78 return 1;
79}

◆ EVE_Hal_open()

EVE_HAL_EXPORT bool EVE_Hal_open ( EVE_HalContext phost,
const EVE_HalParameters parameters 
)

Open the Eve_Hal framework.

Opens a new HAL context using the specified parameters

Parameters
phostPointer to Hal context
parametersPointer to EVE_HalParameters
Returns
true True if ok
false False if error

Definition at line 103 of file EVE_Hal.c.

104{
105 memset(phost, 0, sizeof(EVE_HalContext));
106 phost->UserContext = parameters->UserContext;
107 phost->CbCmdWait = parameters->CbCmdWait;
108 return EVE_HalImpl_open(phost, parameters);
109}
bool EVE_HalImpl_open(EVE_HalContext *phost, const EVE_HalParameters *parameters)
Opens a new HAL context using the specified parameters.
EVE_Callback CbCmdWait
EVE_Callback CbCmdWait

◆ EVE_Hal_powerCycle()

EVE_HAL_EXPORT bool EVE_Hal_powerCycle ( EVE_HalContext phost,
bool  up 
)

Toggle PD_N pin of FT800 board for a power cycle.

Toggle PD_N pin of FT800 board for a power cycle. Returns false on failure

Parameters
phostPointer to Hal context
upUp or Down
Returns
true True if ok
false False if error

Definition at line 588 of file EVE_HalImpl_FT9XX.c.

589{
590 if (up)
591 {
592 gpio_write(phost->PowerDownPin, 0);
593 EVE_sleep(20);
595 gpio_write(phost->PowerDownPin, 1);
596 EVE_sleep(20);
597 }
598 else
599 {
600 gpio_write(phost->PowerDownPin, 1);
601 EVE_sleep(20);
602 gpio_write(phost->PowerDownPin, 0);
603 EVE_sleep(20);
604 }
605 return true;
606}
@ EVE_SPI_SINGLE_CHANNEL
void setSPI(EVE_HalContext *phost, EVE_SPI_CHANNELS_T numchnls, uint8_t numdummy)
Set number of SPI channel.
void EVE_sleep(uint32_t ms)
Sleep in milisecond.
uint8_t PowerDownPin

◆ EVE_Hal_rd16()

EVE_HAL_EXPORT uint16_t EVE_Hal_rd16 ( EVE_HalContext phost,
uint32_t  addr 
)

Read 2 bytes from Coprocessor's memory.

Parameters
phostPointer to Hal context
addrAddress to be read
Returns
uint16_t Data from Coprocessor

Definition at line 173 of file EVE_Hal.c.

174{
175 uint16_t value;
177 value = EVE_Hal_transfer16(phost, 0);
178 EVE_Hal_endTransfer(phost);
179 return value;
180}
EVE_HAL_EXPORT uint16_t EVE_Hal_transfer16(EVE_HalContext *phost, uint16_t value)
Write 2 bytes to Coprocessor.
unsigned short uint16_t

◆ EVE_Hal_rd32()

EVE_HAL_EXPORT uint32_t EVE_Hal_rd32 ( EVE_HalContext phost,
uint32_t  addr 
)

Read 4 bytes from Coprocessor's memory.

Parameters
phostPointer to Hal context
addrAddress to be read
Returns
uint16_t Data from Coprocessor

Definition at line 189 of file EVE_Hal.c.

190{
191 uint32_t value;
193 value = EVE_Hal_transfer32(phost, 0);
194 EVE_Hal_endTransfer(phost);
195 return value;
196}
EVE_HAL_EXPORT uint32_t EVE_Hal_transfer32(EVE_HalContext *phost, uint32_t value)
Write 4 bytes to Coprocessor.

◆ EVE_Hal_rd8()

EVE_HAL_EXPORT uint8_t EVE_Hal_rd8 ( EVE_HalContext phost,
uint32_t  addr 
)

Read 8 bits from Coprocessor's memory.

Parameters
phostPointer to Hal context
addrAddress to be read
Returns
uint8_t Data from Coprocessor

Definition at line 157 of file EVE_Hal.c.

158{
159 uint8_t value;
161 value = EVE_Hal_transfer8(phost, 0);
162 EVE_Hal_endTransfer(phost);
163 return value;
164}

◆ EVE_Hal_rdMem()

EVE_HAL_EXPORT void EVE_Hal_rdMem ( EVE_HalContext phost,
uint8_t result,
uint32_t  addr,
uint32_t  size 
)

Read a block data from Coprocessor's memory.

Parameters
phostPointer to Hal context
resultBuffer where data write to
addrAddress to bbe read
sizeSize to be read

Definition at line 206 of file EVE_Hal.c.

207{
209 EVE_Hal_transferMem(phost, result, NULL, size);
210 EVE_Hal_endTransfer(phost);
211}
EVE_HAL_EXPORT void EVE_Hal_transferMem(EVE_HalContext *phost, uint8_t *result, const uint8_t *buffer, uint32_t size)
Transfer (read/write) a block data to Coprocessor.

◆ EVE_Hal_release()

EVE_HAL_EXPORT void EVE_Hal_release ( )

Close Eve_Hal framework.

Release HAL platform

Definition at line 64 of file EVE_Hal.c.

65{
66 eve_assert_ex(g_HalPlatform.OpenedDevices == 0, "HAL context still open\n");
70 memset(&g_HalPlatform, 0, sizeof(EVE_HalPlatform));
71}
void EVE_Millis_release()
Release FT9x timer.
void EVE_Mcu_release()
Release FT9x host MCU.
void EVE_HalImpl_release()
Release HAL platform.
#define eve_assert_ex(cond, ex)
uint32_t OpenedDevices

◆ EVE_Hal_restoreSPI()

EVE_HAL_EXPORT void EVE_Hal_restoreSPI ( EVE_HalContext phost)

Restore platform to previously configured EVE SPI channel mode

Definition at line 636 of file EVE_HalImpl_FT9XX.c.

637{
638 if (EVE_CHIPID < EVE_FT810)
639 return;
640
641 setSPI(phost, phost->SpiChannels, phost->SpiDummyBytes);
642}
EVE_SPI_CHANNELS_T SpiChannels
uint8_t SpiDummyBytes

◆ EVE_Hal_setSPI()

EVE_HAL_EXPORT void EVE_Hal_setSPI ( EVE_HalContext phost,
EVE_SPI_CHANNELS_T  numchnls,
uint8_t  numdummy 
)

Set number of SPI channel.

Switch EVE to different SPI channel mode

Parameters
phostPointer to Hal context
numchnlsNumber of channel
numdummyNumber of dummy bytes

Definition at line 615 of file EVE_HalImpl_FT9XX.c.

616{
617 if (EVE_CHIPID < EVE_FT810)
618 return;
619
620 uint8_t writebyte = 0;
621
622 if ((numchnls > EVE_SPI_QUAD_CHANNEL) || (numdummy > 2) || (numdummy < 1))
623 return; // error
624
625 // Switch EVE to multi channel SPI mode
626 writebyte = numchnls;
627 if (numdummy == 2)
628 writebyte |= EVE_SPI_TWO_DUMMY_BYTES;
629 EVE_Hal_wr8(phost, REG_SPI_WIDTH, writebyte);
630 EVE_Hal_flush(phost);
631
632 // Switch FT9XX to multi channel SPI mode
633 setSPI(phost, numchnls, numdummy);
634}
#define REG_SPI_WIDTH
@ EVE_SPI_TWO_DUMMY_BYTES
@ EVE_SPI_QUAD_CHANNEL
void EVE_Hal_flush(EVE_HalContext *phost)
Flush data to Coprocessor.

◆ EVE_Hal_startTransfer()

EVE_HAL_EXPORT void EVE_Hal_startTransfer ( EVE_HalContext phost,
EVE_TRANSFER_T  rw,
uint32_t  addr 
)

Start data transfer to Coprocessor.

Parameters
phostPointer to Hal context
rwRead or Write
addrAddress to read/write

Definition at line 257 of file EVE_HalImpl_FT9XX.c.

258{
260
261 if (rw == EVE_TRANSFER_READ)
262 {
263 eve_assert(3 + phost->SpiDummyBytes <= 5);
264 uint8_t spidata[5]; // FIXME: phost->SpiDummyBytes // ?
265 spidata[0] = (addr >> 16);
266 spidata[1] = (addr >> 8);
267 spidata[2] = addr & 0xff;
268 spi_open(SPIM, phost->SpiCsPin);
269 spi_writen(SPIM, spidata, 3 + phost->SpiDummyBytes);
270 phost->Status = EVE_STATUS_READING;
271 }
272 else
273 {
274 uint8_t spidata[4];
275 spidata[0] = (0x80 | (addr >> 16));
276 spidata[1] = (addr >> 8);
277 spidata[2] = addr;
278
279 spi_open(SPIM, phost->SpiCsPin);
280 spi_writen(SPIM, spidata, 3);
281
282 phost->Status = EVE_STATUS_WRITING;
283 }
284}

◆ EVE_Hal_supportCmdB()

static bool EVE_Hal_supportCmdB ( EVE_HalContext phost)
inlinestatic

Definition at line 502 of file EVE_HalDefs.h.

503{
504#ifdef EVE_SUPPORT_CMDB
505 return EVE_CHIPID >= EVE_FT810;
506#else
507 return false;
508#endif
509}

◆ EVE_Hal_supportFlash()

static bool EVE_Hal_supportFlash ( EVE_HalContext phost)
inlinestatic

Definition at line 493 of file EVE_HalDefs.h.

494{
495#ifdef EVE_SUPPORT_FLASH
496 return EVE_CHIPID >= EVE_BT815;
497#else
498 return false;
499#endif
500}

◆ EVE_Hal_supportHsf()

static bool EVE_Hal_supportHsf ( EVE_HalContext phost)
inlinestatic

Definition at line 484 of file EVE_HalDefs.h.

485{
486#ifdef EVE_SUPPORT_HSF
487 return EVE_CHIPID >= EVE_BT817;
488#else
489 return false;
490#endif
491}

◆ EVE_Hal_supportLargeFont()

static bool EVE_Hal_supportLargeFont ( EVE_HalContext phost)
inlinestatic

Definition at line 529 of file EVE_HalDefs.h.

530{
531#ifdef EVE_SUPPORT_LARGEFONT
532 return EVE_CHIPID >= EVE_FT810 // FT810 and up, except BT88X range
534#else
535 return false;
536#endif
537}

◆ EVE_Hal_supportMediaFifo()

static bool EVE_Hal_supportMediaFifo ( EVE_HalContext phost)
inlinestatic

Definition at line 511 of file EVE_HalDefs.h.

512{
513#ifdef EVE_SUPPORT_MEDIAFIFO
514 return EVE_CHIPID >= EVE_FT810;
515#else
516 return false;
517#endif
518}

◆ EVE_Hal_supportVideo()

static bool EVE_Hal_supportVideo ( EVE_HalContext phost)
inlinestatic

Definition at line 520 of file EVE_HalDefs.h.

521{
522#ifdef EVE_SUPPORT_VIDEO
523 return EVE_CHIPID >= EVE_FT810;
524#else
525 return false;
526#endif
527}

◆ EVE_Hal_transfer16()

EVE_HAL_EXPORT uint16_t EVE_Hal_transfer16 ( EVE_HalContext phost,
uint16_t  value 
)

Write 2 bytes to Coprocessor.

Parameters
phostPointer to Hal context
valueValue to write
Returns
uint16_t Number of bytes transfered

Definition at line 374 of file EVE_HalImpl_FT9XX.c.

375{
376 uint8_t buffer[2];
377 if (phost->Status == EVE_STATUS_READING)
378 {
379 rdBuffer(phost, buffer, 2);
380 return (uint16_t)buffer[0]
381 | (uint16_t)buffer[1] << 8;
382 }
383 else
384 {
385 buffer[0] = value & 0xFF;
386 buffer[1] = value >> 8;
387 wrBuffer(phost, buffer, 2);
388 return 0;
389 }
390}
static void wrBuffer(EVE_HalContext *phost, const uint8_t *buffer, uint32_t size)
Write a block data to Coprocessor.
static void rdBuffer(EVE_HalContext *phost, uint8_t *buffer, uint32_t size)
Read a block data from Coprocessor.
static ft_uint32_t ft_uint8_t * buffer
Definition FT_Gpu_Hal.h:139

◆ EVE_Hal_transfer32()

EVE_HAL_EXPORT uint32_t EVE_Hal_transfer32 ( EVE_HalContext phost,
uint32_t  value 
)

Write 4 bytes to Coprocessor.

Parameters
phostPointer to Hal context
valueValue to write
Returns
uint32_t Number of bytes transfered

Definition at line 399 of file EVE_HalImpl_FT9XX.c.

400{
401 uint8_t buffer[4];
402 if (phost->Status == EVE_STATUS_READING)
403 {
404 rdBuffer(phost, buffer, 4);
405 return (uint32_t)buffer[0]
406 | (uint32_t)buffer[1] << 8
407 | (uint32_t)buffer[2] << 16
408 | (uint32_t)buffer[3] << 24;
409 }
410 else
411 {
412 buffer[0] = value & 0xFF;
413 buffer[1] = (value >> 8) & 0xFF;
414 buffer[2] = (value >> 16) & 0xFF;
415 buffer[3] = value >> 24;
416 wrBuffer(phost, buffer, 4);
417 return 0;
418 }
419}

◆ EVE_Hal_transfer8()

EVE_HAL_EXPORT uint8_t EVE_Hal_transfer8 ( EVE_HalContext phost,
uint8_t  value 
)

Write 8 bits to Coprocessor.

Parameters
phostPointer to Hal context
valueValue to write
Returns
uint8_t Number of bytes transfered

Definition at line 362 of file EVE_HalImpl_FT9XX.c.

363{
364 return transfer8(phost, value);
365}
static uint8_t transfer8(EVE_HalContext *phost, uint8_t value)
Write 8 bit to Coprocessor.

◆ EVE_Hal_transferMem()

EVE_HAL_EXPORT void EVE_Hal_transferMem ( EVE_HalContext phost,
uint8_t result,
const uint8_t buffer,
uint32_t  size 
)

Transfer (read/write) a block data to Coprocessor.

Parameters
phostPointer to Hal context
resultBuffer to get data transfered, NULL when write
bufferBuffer where data is transfered, NULL when read
sizeSize of buffer

Definition at line 429 of file EVE_HalImpl_FT9XX.c.

430{
431 if (!size)
432 return;
433
434 if (result && buffer)
435 {
436 /* not implemented */
438 }
439 else if (result)
440 {
441 rdBuffer(phost, result, size);
442 }
443 else if (buffer)
444 {
445 wrBuffer(phost, buffer, size);
446 }
447}
#define eve_debug_break()

◆ EVE_Hal_transferProgMem()

EVE_HAL_EXPORT void EVE_Hal_transferProgMem ( EVE_HalContext phost,
uint8_t result,
eve_progmem_const uint8_t buffer,
uint32_t  size 
)

Transfer a block data from program memory.

Parameters
phostPointer to Hal context
resultBuffer to get data transfered, NULL when write
bufferBuffer where data is transfered, NULL when read
sizeSize of buffer

Definition at line 457 of file EVE_HalImpl_FT9XX.c.

458{
459 if (!size)
460 return;
461
462 if (result && buffer)
463 {
464 /* not implemented */
466 }
467 else if (result)
468 {
469 /* not implemented */
471 }
472 else if (buffer)
473 {
474 eve_assert(!((uintptr_t)buffer & 0x3)); // must be 32-bit aligned
475 eve_assert(!(size & 0x3)); // must be 32-bit aligned
477 size >>= 2;
478 while (size--)
479 {
480 uint32_t value = *(buf32++);
481 wrBuffer(phost, (uint8_t *)(&value), 4);
482 }
483 }
484}
#define eve_progmem_const

◆ EVE_Hal_transferString()

EVE_HAL_EXPORT uint32_t EVE_Hal_transferString ( EVE_HalContext phost,
const char *  str,
uint32_t  index,
uint32_t  size,
uint32_t  padMask 
)

Transfer a string to EVE platform.

Parameters
phostPointer to Hal context
strString to transfer
indexStart position in the string
sizeSize of string
padMaskPadding mask
Returns
uint32_t Numer of bytes transfered

Definition at line 496 of file EVE_HalImpl_FT9XX.c.

497{
498 if (!size)
499 {
500 /* TODO: Support different padding options */
501 eve_assert(padMask == 0x3);
502 EVE_Hal_transfer32(phost, 0);
503 return 4;
504 }
505
507 uint32_t transferred = 0;
508 if (phost->Status == EVE_STATUS_WRITING)
509 {
510 transferred += (uint32_t)strnlen(str, size) + 1;
511 eve_assert(str[transferred - 1] == '\0');
512 wrBuffer(phost, (uint8_t *)str, transferred);
513 if (transferred & padMask)
514 {
515 uint32_t pad = 4 - (transferred & padMask);
516 uint8_t padding[4] = { 0 };
517 wrBuffer(phost, padding, pad);
518 transferred += pad;
519 eve_assert(!(transferred & 0x3));
520 }
521 }
522 else
523 {
524 /* not implemented */
526 }
527 return transferred;
528}
#define EVE_CMD_STRING_MAX
Definition EVE_Cmd.h:44
uint32_t EVE_Hal_transfer32(EVE_HalContext *phost, uint32_t value)
Write 4 bytes to Coprocessor.

◆ EVE_Hal_wr16()

EVE_HAL_EXPORT void EVE_Hal_wr16 ( EVE_HalContext phost,
uint32_t  addr,
uint16_t  v 
)

Write 2 bytes to Coprocessor's memory.

Parameters
phostPointer to Hal context
addrAddress to be write
vValue to write

Definition at line 234 of file EVE_Hal.c.

235{
237 EVE_Hal_transfer16(phost, v);
238 EVE_Hal_endTransfer(phost);
239}

◆ EVE_Hal_wr32()

EVE_HAL_EXPORT void EVE_Hal_wr32 ( EVE_HalContext phost,
uint32_t  addr,
uint32_t  v 
)

Write 4 bytes to Coprocessor's memory.

Parameters
phostPointer to Hal context
addrAddress to be write
vValue to write

Definition at line 248 of file EVE_Hal.c.

249{
251 EVE_Hal_transfer32(phost, v);
252 EVE_Hal_endTransfer(phost);
253}

◆ EVE_Hal_wr8()

EVE_HAL_EXPORT void EVE_Hal_wr8 ( EVE_HalContext phost,
uint32_t  addr,
uint8_t  v 
)

Write 8 bits to Coprocessor's memory.

Parameters
phostPointer to Hal context
addrAddress to be write
vValue to write

Definition at line 220 of file EVE_Hal.c.

221{
223 EVE_Hal_transfer8(phost, v);
224 EVE_Hal_endTransfer(phost);
225}

◆ EVE_Hal_wrMem()

EVE_HAL_EXPORT void EVE_Hal_wrMem ( EVE_HalContext phost,
uint32_t  addr,
const uint8_t buffer,
uint32_t  size 
)

Write a buffer to Coprocessor's memory.

Parameters
phostPointer to Hal context
addrAddress to be write
bufferData to be write
sizeSize of buffer

Definition at line 263 of file EVE_Hal.c.

264{
266 EVE_Hal_transferMem(phost, NULL, buffer, size);
267 EVE_Hal_endTransfer(phost);
268}

◆ EVE_Hal_wrProgMem()

EVE_HAL_EXPORT void EVE_Hal_wrProgMem ( EVE_HalContext phost,
uint32_t  addr,
eve_progmem_const uint8_t buffer,
uint32_t  size 
)

Write a buffer in ProgMem to Coprocessor's memory.

Parameters
phostPointer to Hal context
addrAddress to be write
bufferData to be write
sizeSize of buffer

Definition at line 278 of file EVE_Hal.c.

279{
281 EVE_Hal_transferProgMem(phost, NULL, buffer, size);
282 EVE_Hal_endTransfer(phost);
283}
EVE_HAL_EXPORT void EVE_Hal_transferProgMem(EVE_HalContext *phost, uint8_t *result, eve_progmem_const uint8_t *buffer, uint32_t size)
Transfer a block data from program memory.

◆ EVE_Hal_wrString()

EVE_HAL_EXPORT void EVE_Hal_wrString ( EVE_HalContext phost,
uint32_t  addr,
const char *  str,
uint32_t  index,
uint32_t  size,
uint32_t  padMask 
)

Write a string to Coprocessor's memory.

Parameters
phostPointer to Hal context
addrAddress to be write
strString to be write
indexStart postion in the string
sizeSize of the string
padMaskPadding mask

Definition at line 295 of file EVE_Hal.c.

296{
298 EVE_Hal_transferString(phost, str, index, size, padMask);
299 EVE_Hal_endTransfer(phost);
300}
EVE_HAL_EXPORT uint32_t EVE_Hal_transferString(EVE_HalContext *phost, const char *str, uint32_t index, uint32_t size, uint32_t padMask)
Transfer a string to EVE platform.

◆ EVE_Host_clockSelect()

EVE_HAL_EXPORT void EVE_Host_clockSelect ( EVE_HalContext phost,
EVE_PLL_SOURCE_T  pllsource 
)

Select clock source for Coprocessor.

Parameters
phostPointer to Hal context
pllsourceClock source

Definition at line 347 of file EVE_Hal.c.

348{
349 EVE_Hal_hostCommand(phost, (uint8_t)pllsource);
350}
EVE_HAL_EXPORT void EVE_Hal_hostCommand(EVE_HalContext *phost, uint8_t cmd)
Send a host command to Coprocessor.

◆ EVE_Host_coreReset()

EVE_HAL_EXPORT void EVE_Host_coreReset ( EVE_HalContext phost)

Send reset signal to Coprocessor.

Parameters
phostPointer to Hal context

Definition at line 379 of file EVE_Hal.c.

380{
382}
#define EVE_CORE_RESET

◆ EVE_Host_padDriveStrength()

EVE_HAL_EXPORT void EVE_Host_padDriveStrength ( EVE_HalContext phost,
EVE_81X_GPIO_DRIVE_STRENGTH_T  strength,
EVE_81X_GPIO_GROUP_T  group 
)

Set the drive strength for various pins.

Parameters
phostPointer to Hal context
strengthDrive strength
groupPin group to set

Definition at line 453 of file EVE_Hal.c.

454{
455 EVE_Hal_hostCommandExt3(phost, (uint32_t)0x70 | (group << 8) | (strength << 8));
456}
EVE_HAL_EXPORT void EVE_Hal_hostCommandExt3(EVE_HalContext *phost, uint32_t cmd)
This API sends a 3byte command to the phost.

◆ EVE_Host_pllFreqSelect()

EVE_HAL_EXPORT void EVE_Host_pllFreqSelect ( EVE_HalContext phost,
EVE_PLL_FREQ_T  freq 
)

Select system clock for Coprocessor.

Parameters
phostPointer to Hal context
freqFrequency to set

Definition at line 358 of file EVE_Hal.c.

359{
360 EVE_Hal_hostCommand(phost, (uint8_t)freq);
361}

◆ EVE_Host_powerModeSwitch()

EVE_HAL_EXPORT void EVE_Host_powerModeSwitch ( EVE_HalContext phost,
EVE_POWER_MODE_T  pwrmode 
)

Switch power mode for Coprocessor.

Parameters
phostPointer to Hal context
pwrmodePower mode

Definition at line 369 of file EVE_Hal.c.

370{
371 EVE_Hal_hostCommand(phost, (uint8_t)pwrmode);
372}

◆ EVE_Host_powerOffComponents()

EVE_HAL_EXPORT void EVE_Host_powerOffComponents ( EVE_HalContext phost,
uint8_t  val 
)

Power off a component.

Parameters
phostPointer to Hal context
valComponent number

Definition at line 441 of file EVE_Hal.c.

442{
443 EVE_Hal_hostCommandExt3(phost, (uint32_t)0x49 | (val << 8));
444}

◆ EVE_Host_resetActive()

EVE_HAL_EXPORT void EVE_Host_resetActive ( EVE_HalContext phost)

Hold the device in reset state.

Parameters
phostPointer to Hal context

Definition at line 463 of file EVE_Hal.c.

464{
466}
#define EVE_81X_RESET_ACTIVE

◆ EVE_Host_resetRemoval()

EVE_HAL_EXPORT void EVE_Host_resetRemoval ( EVE_HalContext phost)

Exit reset state, Eve will power on and enter into its default state.

Parameters
phostPointer to Hal context

Definition at line 473 of file EVE_Hal.c.

474{
476}
#define EVE_81X_RESET_REMOVAL

◆ EVE_Host_selectSysClk()

EVE_HAL_EXPORT void EVE_Host_selectSysClk ( EVE_HalContext phost,
EVE_81X_PLL_FREQ_T  freq 
)

Set system clock for Coprocessor.

This API can only be called when PLL is stopped(SLEEP mode). For compatibility, set frequency to the EVE_GPU_12MHZ option in the EVE_SETPLLSP1_T table.

Parameters
phostPointer to Hal context
freqFrequency to set

Definition at line 390 of file EVE_Hal.c.

391{
392#if (EVE_SUPPORT_CHIPID >= EVE_FT810)
393 if (EVE_CHIPID >= EVE_FT810)
394 {
395#if (EVE_SUPPORT_CHIPID >= EVE_BT815)
396 if (EVE_SYSCLK_84M == freq)
397 EVE_Hal_hostCommandExt3(phost, (uint32_t)0x61 | (0x80 << 8) | (0x07 << 8));
398 else
399#endif
400 if (EVE_SYSCLK_72M == freq)
401 EVE_Hal_hostCommandExt3(phost, (uint32_t)0x61 | (0x40 << 8) | (0x06 << 8));
402 else if (EVE_SYSCLK_60M == freq)
403 EVE_Hal_hostCommandExt3(phost, (uint32_t)0x61 | (0x40 << 8) | (0x05 << 8));
404 else if (EVE_SYSCLK_48M == freq)
405 EVE_Hal_hostCommandExt3(phost, (uint32_t)0x61 | (0x40 << 8) | (0x04 << 8));
406 else if (EVE_SYSCLK_36M == freq)
407 EVE_Hal_hostCommandExt3(phost, (uint32_t)0x61 | (0x03 << 8));
408 else if (EVE_SYSCLK_24M == freq)
409 EVE_Hal_hostCommandExt3(phost, (uint32_t)0x61 | (0x02 << 8));
410 else if (EVE_SYSCLK_DEFAULT == freq) //default clock
411 EVE_Hal_hostCommandExt3(phost, 0x61);
412 }
413 else
414#endif
415 {
416 switch (freq)
417 {
418 case EVE_SYSCLK_24M:
420 break;
421 case EVE_SYSCLK_36M:
423 break;
424 default:
425 eve_printf_debug("Invalid sys clk frequency selected (%i)\n", (int)freq);
426 /* no break */
427 case EVE_SYSCLK_48M:
429 break;
430 }
431 }
432}
@ EVE_PLL_36M
@ EVE_PLL_24M
@ EVE_PLL_48M
@ EVE_SYSCLK_84M
@ EVE_SYSCLK_36M
@ EVE_SYSCLK_60M
@ EVE_SYSCLK_DEFAULT
@ EVE_SYSCLK_48M
@ EVE_SYSCLK_24M
@ EVE_SYSCLK_72M
EVE_HAL_EXPORT void EVE_Host_pllFreqSelect(EVE_HalContext *phost, EVE_PLL_FREQ_T freq)
Select system clock for Coprocessor.
Definition EVE_Hal.c:358

◆ EVE_millis()

EVE_HAL_EXPORT uint32_t EVE_millis ( )

Get clock in miliseond.

Need to ensure that below api is called at least once in 6.5 seconds duration for FT900 platform as this module doesnt use timer for context update global counter to loopback after ~49.71 days

Returns
uint32_t Clock number

Definition at line 842 of file EVE_HalImpl_FT9XX.c.

843{
844#if defined(PANL_APPLET)
845 uint32_t ms = panl_timer_get_time();
847 s_TotalMilliseconds64 += (1 << 32);
849 s_TotalMilliseconds64 = (s_TotalMilliseconds64 & ~0xFFFFFFFFULL) | (uint64_t)ms;
850#endif
851 return s_TotalMilliseconds;
852}
static uint32_t s_TotalMilliseconds
static uint64_t s_TotalMilliseconds64
unsigned long long uint64_t

◆ EVE_millis64()

EVE_HAL_EXPORT uint64_t EVE_millis64 ( )

Get clock in miliseond.

Need to ensure that below api is called at least once in 6.5 seconds duration for FT900 platform as this module doesnt use timer for context update global counter to loopback after ~49.71 days

Returns
uint32_t Clock number

Definition at line 862 of file EVE_HalImpl_FT9XX.c.

863{
864#if defined(PANL_APPLET)
865 uint32_t ms = panl_timer_get_time();
867 s_TotalMilliseconds64 += (1 << 32);
869 s_TotalMilliseconds64 = (s_TotalMilliseconds64 & ~0xFFFFFFFFULL) | (uint64_t)ms;
870#endif
872}

◆ EVE_shortChipId()

static int EVE_shortChipId ( EVE_CHIPID_T  chipId)
inlinestatic

Remove EVE generation from the chip ID

Definition at line 569 of file EVE_HalDefs.h.

570{
571 return chipId & 0xFFFF;
572}

◆ EVE_sleep()

EVE_HAL_EXPORT void EVE_sleep ( uint32_t  ms)

Sleep in milisecond.

Parameters
msMilisecond

Definition at line 895 of file EVE_HalImpl_FT9XX.c.

896{
897 delayms(ms);
898}