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_Hal.c File Reference

Eve_Hal framework APIs. More...

#include "EVE_HalDefs.h"
#include "EVE_Platform.h"
#include "EVE_HalImpl.h"
#include <string.h>

Go to the source code of this file.

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 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 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.
 
UTILITY
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.
 
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.
 

Variables

EVE_HalPlatform g_HalPlatform
 

Detailed Description

Eve_Hal framework APIs.

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_Hal.c.

Function Documentation

◆ 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.

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}
@ EVE_STATUS_CLOSED
Definition EVE_HalDefs.h:57
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_defaults()

EVE_HAL_EXPORT void EVE_Hal_defaults ( EVE_HalParameters parameters)

Setup default parameters for Eve_Hal framework.

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.

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()

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.

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_TRANSFER_WRITE
Definition EVE_HalDefs.h:68
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_idle()

EVE_HAL_EXPORT void EVE_Hal_idle ( EVE_HalContext phost)

Idle handler for Eve_Hal framework.

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_initialize()

EVE_HAL_EXPORT EVE_HalPlatform * EVE_Hal_initialize ( )

Eve_Hal framework initialization.

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_open()

EVE_HAL_EXPORT bool EVE_Hal_open ( EVE_HalContext phost,
const EVE_HalParameters parameters 
)

Open the Eve_Hal framework.

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_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.
@ EVE_TRANSFER_READ
Definition EVE_HalDefs.h:67
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_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}
static ft_uint32_t ft_uint8_t * buffer
Definition FT_Gpu_Hal.h:139

◆ 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.

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}
#define EVE_CHIPID
#define EVE_FT810
Definition EVE_Config.h:58
@ 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

Variable Documentation

◆ g_HalPlatform

EVE_HalPlatform g_HalPlatform

Definition at line 43 of file EVE_Hal.c.