34#if defined(FT9XX_PLATFORM)
38static const uint8_t s_SpimGpioSS[5] = { GPIO30_SPIM_SS0, GPIO_SPIM_SS1, GPIO_SPIM_SS2, GPIO_SPIM_SS3, 29 };
39static const pad_dir_t
s_SpimFuncSS[5] = { pad30_spim_ss0, pad_spim_ss1, pad_spim_ss2, pad_spim_ss3, pad29_spim_ss0 };
42static const pad_dir_t
s_SpimFuncSS[4] = { pad_spim_ss0, pad_spim_ss1, pad_spim_ss2, pad_spim_ss3 };
44#define GPIO_SS_NB (sizeof(s_SpimGpioSS) / sizeof(s_SpimGpioSS[0]))
137 gpio_function(GPIO_SPIM_CLK, pad_spim_sck);
138 gpio_function(spimGpio, spimFunc);
139 gpio_function(GPIO_SPIM_MOSI, pad_spim_mosi);
140 gpio_function(GPIO_SPIM_MISO, pad_spim_miso);
142 gpio_dir(GPIO_SPIM_CLK, pad_dir_output);
143 gpio_dir(spimGpio, pad_dir_output);
144 gpio_dir(GPIO_SPIM_MOSI, pad_dir_output);
145 gpio_dir(GPIO_SPIM_MISO, pad_dir_input);
150 gpio_function(GPIO_SPIM_IO2, pad_spim_io2);
151 gpio_function(GPIO_SPIM_IO3, pad_spim_io3);
152 gpio_dir(GPIO_SPIM_IO2, pad_dir_output);
153 gpio_dir(GPIO_SPIM_IO3, pad_dir_output);
156 gpio_write(spimGpio, 1);
159 eve_assert_do(!spi_init(SPIM, spi_dir_master, spi_mode_0, 4));
162 spi_option(SPIM, spi_option_fifo_size, 64);
163 spi_option(SPIM, spi_option_fifo, 1);
164 spi_option(SPIM, spi_option_fifo_receive_trigger, 1);
169 spi_option(SPIM, spi_option_bus_width, 4);
172 spi_option(SPIM, spi_option_bus_width, 2);
175 spi_option(SPIM, spi_option_bus_width, 1);
198#ifdef EVE_MULTI_GRAPHICS_TARGET
199 phost->GpuDefs = &EVE_GpuDefs_FT80X;
265 spidata[0] = (
addr >> 16);
266 spidata[1] = (
addr >> 8);
267 spidata[2] =
addr & 0xff;
275 spidata[0] = (0x80 | (
addr >> 16));
276 spidata[1] = (
addr >> 8);
280 spi_writen(SPIM, spidata, 3);
319 spi_readn(SPIM,
buffer, size);
331 spi_writen(SPIM,
buffer, size);
345 spi_read(SPIM, value);
350 spi_write(SPIM, value);
413 buffer[1] = (value >> 8) & 0xFF;
414 buffer[2] = (value >> 16) & 0xFF;
510 transferred += (
uint32_t)strnlen(str, size) + 1;
513 if (transferred & padMask)
515 uint32_t pad = 4 - (transferred & padMask);
555 spi_writen(SPIM, hcmd, 3);
570 hcmd[0] =
cmd & 0xff;
571 hcmd[1] = (
cmd >> 8) & 0xff;
572 hcmd[2] = (
cmd >> 16) & 0xff;
576 spi_writen(SPIM, hcmd, 3);
626 writebyte = numchnls;
633 setSPI(phost, numchnls, numdummy);
659 " move.l $r0,%0 \n\t"
660 " mul.l $r0,$r0,100 \n\t"
662 " sub.l $r0,$r0,3 \n\t"
670 return ((t1 - t0) << 6);
690 gpio_function(GPIO_SD_CLK, pad_sd_clk);
691 gpio_pull(GPIO_SD_CLK, pad_pull_none);
692 gpio_function(GPIO_SD_CMD, pad_sd_cmd);
693 gpio_pull(GPIO_SD_CMD, pad_pull_pullup);
694 gpio_function(GPIO_SD_DAT3, pad_sd_data3);
695 gpio_pull(GPIO_SD_DAT3, pad_pull_pullup);
696 gpio_function(GPIO_SD_DAT2, pad_sd_data2);
697 gpio_pull(GPIO_SD_DAT2, pad_pull_pullup);
698 gpio_function(GPIO_SD_DAT1, pad_sd_data1);
699 gpio_pull(GPIO_SD_DAT1, pad_pull_pullup);
700 gpio_function(GPIO_SD_DAT0, pad_sd_data0);
701 gpio_pull(GPIO_SD_DAT0, pad_pull_pullup);
702 gpio_function(GPIO_SD_CD, pad_sd_cd);
703 gpio_pull(GPIO_SD_CD, pad_pull_pullup);
704 gpio_function(GPIO_SD_WP, pad_sd_wp);
705 gpio_pull(GPIO_SD_WP, pad_pull_pullup);
708 sys_enable(sys_device_sd_card);
725 interrupt_enable_globally();
727 sys_enable(sys_device_uart0);
728 gpio_function(GPIO_UART0_TX, pad_uart0_txd);
729 gpio_function(GPIO_UART0_RX, pad_uart0_rxd);
732 UART_DIVIDER_115200_BAUD,
738#if (defined(ENABLE_ILI9488_HVGA_PORTRAIT) || defined(ENABLE_KD2401_HVGA_PORTRAIT))
740 gpio_function(GPIO_ILI9488_DCX, pad_ili9488_dcx);
741 gpio_dir(GPIO_ILI9488_DCX, pad_dir_output);
742 gpio_write(GPIO_ILI9488_DCX, 1);
744 gpio_function(GPIO_SPIM_CLK, pad_spim_sck);
745 gpio_dir(GPIO_SPIM_CLK, pad_dir_output);
746 gpio_write(GPIO_SPIM_CLK, 1);
748 gpio_function(GPIO_SPIM_MOSI, pad_spim_mosi);
749 gpio_dir(GPIO_SPIM_MOSI, pad_dir_output);
750 gpio_write(GPIO_SPIM_MOSI, 1);
752 gpio_function(GPIO_ILI9488_CS1, pad_ili9488_cs1);
753 gpio_dir(GPIO_ILI9488_CS1, pad_dir_output);
754 gpio_write(GPIO_ILI9488_CS1, 1);
756 gpio_function(GPIO_SPIM_MISO, pad_spim_miso);
757 gpio_dir(GPIO_SPIM_MISO, pad_dir_output);
758 gpio_write(GPIO_SPIM_MISO, 1);
760 gpio_function(GPIO_SPIM_SS0, pad_spim_ss0);
761 gpio_dir(GPIO_SPIM_SS0, pad_dir_output);
762 gpio_write(GPIO_SPIM_SS0, 1);
764 gpio_function(GPIO_FT800_PWD, pad_func_0);
765 gpio_dir(GPIO_FT800_PWD, pad_dir_output);
766 gpio_write(GPIO_FT800_PWD, 1);
768 gpio_write(GPIO_ILI9488_DCX, 1);
769 gpio_write(GPIO_SPIM_SS0, 1);
770 gpio_write(GPIO_FT800_PWD, 1);
771 gpio_write(GPIO_ILI9488_CS1, 1);
805#if !defined(PANL_APPLET)
806 sys_enable(sys_device_timer_wdt);
807#if defined(FT900_PLATFORM)
814 interrupt_attach(interrupt_timers, 17,
ticker);
828#if !defined(PANL_APPLET)
844#if defined(PANL_APPLET)
845 uint32_t ms = panl_timer_get_time();
864#if defined(PANL_APPLET)
865 uint32_t ms = panl_timer_get_time();
880#if !defined(PANL_APPLET)
#define EVE_CMD_STRING_MAX
#define strcpy_s(dst, sz, src)
#define eve_progmem_const
@ EVE_SPI_TWO_DUMMY_BYTES
EVE_HalPlatform g_HalPlatform
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_wr8(EVE_HalContext *phost, uint32_t addr, uint8_t v)
Write 8 bits to Coprocessor's memory.
static const pad_dir_t s_SpimFuncSS[4]
static uint32_t s_TotalMilliseconds
static uint64_t s_TotalMilliseconds64
static const uint8_t s_SpimGpioSS[4]
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.
bool EVE_HalImpl_open(EVE_HalContext *phost, const EVE_HalParameters *parameters)
Opens a new HAL context using the specified parameters.
uint8_t EVE_Hal_transfer8(EVE_HalContext *phost, uint8_t value)
Write 8 bits to Coprocessor.
void EVE_Mcu_initialize()
Init FT9x host MCU.
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_info(EVE_DeviceInfo *deviceInfo, size_t deviceIdx)
Get info of the specified device. Devices of type EVE_HOST_UNKNOWN should be ignored.
void EVE_Hal_hostCommandExt3(EVE_HalContext *phost, uint32_t cmd)
This API sends a 3byte command to the phost.
bool EVE_HalImpl_defaults(EVE_HalParameters *parameters, size_t deviceIdx)
Get the default configuration parameters.
void EVE_Millis_release()
Release FT9x timer.
static void initSdHost()
Sdcard initialization.
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.
void EVE_Hal_restoreSPI(EVE_HalContext *phost)
void ticker()
Clear the interrupt and increment the counter.
EVE_HAL_EXPORT size_t EVE_Hal_list()
List the available devices.
static uint8_t transfer8(EVE_HalContext *phost, uint8_t value)
Write 8 bit to Coprocessor.
void EVE_HalImpl_close(EVE_HalContext *phost)
Close a HAL context.
uint32_t EVE_Hal_currentFrequency(EVE_HalContext *phost)
Get current system clock of Coprocessor.
void EVE_Mcu_release()
Release FT9x host MCU.
void EVE_Hal_endTransfer(EVE_HalContext *phost)
End data transfer.
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.
void EVE_Hal_startTransfer(EVE_HalContext *phost, EVE_TRANSFER_T rw, uint32_t addr)
Start data transfer to Coprocessor.
uint32_t EVE_millis()
Get clock in miliseond.
bool EVE_Hal_powerCycle(EVE_HalContext *phost, bool up)
Toggle PD_N pin of FT800 board for a power cycle.
void EVE_HalImpl_initialize()
Initialize HAL platform.
void EVE_Millis_initialize()
Init FT9x timer.
void EVE_Hal_flush(EVE_HalContext *phost)
Flush data to Coprocessor.
void setSPI(EVE_HalContext *phost, EVE_SPI_CHANNELS_T numchnls, uint8_t numdummy)
Set number of SPI channel.
bool EVE_UtilImpl_bootupDisplayGpio(EVE_HalContext *phost)
Display GPIO pins.
uint64_t EVE_millis64()
Get clock in miliseond.
uint16_t EVE_Hal_transfer16(EVE_HalContext *phost, uint16_t value)
Write 2 bytes to Coprocessor.
static void wrBuffer(EVE_HalContext *phost, const uint8_t *buffer, uint32_t size)
Write a block data to Coprocessor.
void EVE_sleep(uint32_t ms)
Sleep in milisecond.
void EVE_Hal_setSPI(EVE_HalContext *phost, EVE_SPI_CHANNELS_T numchnls, uint8_t numdummy)
Set number of SPI channel.
void EVE_HalImpl_idle(EVE_HalContext *phost)
Idle. Call regularly to update frequently changing internal state.
void EVE_HalImpl_release()
Release HAL platform.
static void rdBuffer(EVE_HalContext *phost, uint8_t *buffer, uint32_t size)
Read a block data from Coprocessor.
void EVE_Hal_hostCommand(EVE_HalContext *phost, uint8_t cmd)
Send a host command to Coprocessor.
uint32_t EVE_Hal_transfer32(EVE_HalContext *phost, uint32_t value)
Write 4 bytes to Coprocessor.
unsigned long long uint64_t
static ft_uint32_t ft_uint8_t * buffer
static ft_void_t ft_uint32_t * cmd
EVE_SPI_CHANNELS_T SpiChannels