2018-02-18 17:12:53 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* apps/graphics/ft80x/ft80x.h
|
|
|
|
*
|
2022-03-09 15:16:28 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2018-02-18 17:12:53 +01:00
|
|
|
*
|
2022-03-09 15:16:28 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2018-02-18 17:12:53 +01:00
|
|
|
*
|
2022-03-09 15:16:28 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2018-02-18 17:12:53 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __APPS_GRAPHICS_FT80X_FT80X_H
|
|
|
|
#define __APPS_GRAPHICS_FT80X_FT80X_H
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <nuttx/compiler.h>
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2018-02-18 20:36:08 +01:00
|
|
|
#include <stdint.h>
|
2018-02-18 17:12:53 +01:00
|
|
|
#include <debug.h>
|
|
|
|
|
|
|
|
#ifdef CONFIG_GRAPHICS_FT80X
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* NOTE: These rely on internal definitions from compiler.h and debug.h.
|
|
|
|
* Could be a porting issue.
|
|
|
|
*/
|
|
|
|
|
2020-05-04 12:52:59 +02:00
|
|
|
#if !defined(CONFIG_GRAPHICS_FT80X_DEBUG_ERROR)
|
|
|
|
# define ft80x_err _none
|
|
|
|
#elif defined(CONFIG_CPP_HAVE_VARARGS)
|
|
|
|
# define ft80x_err(format, ...) \
|
|
|
|
fprintf(stderr, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
2018-02-18 17:12:53 +01:00
|
|
|
#else
|
2020-05-04 12:52:59 +02:00
|
|
|
# define ft80x_err printf
|
|
|
|
#endif
|
2018-02-18 17:12:53 +01:00
|
|
|
|
2020-05-04 12:52:59 +02:00
|
|
|
#if !defined(CONFIG_GRAPHICS_FT80X_DEBUG_WARN)
|
|
|
|
# define ft80x_warn _none
|
|
|
|
#elif defined(CONFIG_CPP_HAVE_VARARGS)
|
|
|
|
# define ft80x_warn(format, ...) \
|
|
|
|
fprintf(stderr, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
|
|
|
#else
|
|
|
|
# define ft80x_warn printf
|
|
|
|
#endif
|
2018-02-18 17:12:53 +01:00
|
|
|
|
2020-05-04 12:52:59 +02:00
|
|
|
#if !defined(CONFIG_GRAPHICS_FT80X_DEBUG_INFO)
|
|
|
|
# define ft80x_info _none
|
|
|
|
#elif defined(CONFIG_CPP_HAVE_VARARGS)
|
|
|
|
# define ft80x_info(format, ...) \
|
|
|
|
printf(EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
|
|
|
#else
|
|
|
|
# define ft80x_info printf
|
2018-02-18 17:12:53 +01:00
|
|
|
#endif
|
|
|
|
|
2018-02-22 17:01:50 +01:00
|
|
|
#define FT80X_CMDFIFO_MASK (FT80X_CMDFIFO_SIZE - 1)
|
|
|
|
|
2018-02-18 17:12:53 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Types
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define EXTERN extern "C"
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
2018-02-20 22:23:05 +01:00
|
|
|
struct ft80x_dlbuffer_s; /* Forward reference3 */
|
|
|
|
|
2018-02-18 20:36:08 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: ft80x_getreg8/16/32
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Read an 8-, 16-, or 32-bit FT80x register value.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2018-02-26 16:58:52 +01:00
|
|
|
* fd - The file descriptor of the FT80x device. Opened by the caller
|
|
|
|
* with write access.
|
|
|
|
* addr - The 32-bit aligned, 22-bit register value
|
|
|
|
* value - The location to return the register value
|
2018-02-18 20:36:08 +01:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) on success. A negated errno value on failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int ft80x_getreg8(int fd, uint32_t addr, FAR uint8_t *value);
|
|
|
|
int ft80x_getreg16(int fd, uint32_t addr, FAR uint16_t *value);
|
2018-02-25 18:20:39 +01:00
|
|
|
int ft80x_getreg32(int fd, uint32_t addr, FAR uint32_t *value);
|
2018-02-18 20:36:08 +01:00
|
|
|
|
2018-02-21 18:50:06 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: ft80x_getregs
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Read multiple 32-bit FT80x register values.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2018-02-26 16:58:52 +01:00
|
|
|
* fd - The file descriptor of the FT80x device. Opened by the caller
|
|
|
|
* with write access.
|
|
|
|
* addr - The 32-bit aligned, 22-bit start register address
|
|
|
|
* nregs - The number of registers to read.
|
|
|
|
* value - The location to return the register values
|
2018-02-21 18:50:06 +01:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) on success. A negated errno value on failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int ft80x_getregs(int fd, uint32_t addr, uint8_t nregs, FAR uint32_t *value);
|
|
|
|
|
2018-02-18 20:36:08 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: ft80x_putreg8/16/32
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Wtite an 8-, 16-, or 32-bit FT80x register value.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2018-02-26 16:58:52 +01:00
|
|
|
* fd - The file descriptor of the FT80x device. Opened by the caller
|
|
|
|
* with write access.
|
|
|
|
* addr - The 32-bit aligned, 22-bit register value
|
|
|
|
* value - The register value to write.
|
2018-02-18 20:36:08 +01:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) on success. A negated errno value on failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int ft80x_putreg8(int fd, uint32_t addr, uint8_t value);
|
|
|
|
int ft80x_putreg16(int fd, uint32_t addr, uint16_t value);
|
|
|
|
int ft80x_putreg32(int fd, uint32_t addr, uint32_t value);
|
|
|
|
|
2018-02-21 18:50:06 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: ft80x_putregs
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Write multiple 32-bit FT80x register values.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2018-02-26 16:58:52 +01:00
|
|
|
* fd - The file descriptor of the FT80x device. Opened by the caller
|
|
|
|
* with write access.
|
|
|
|
* addr - The 32-bit aligned, 22-bit start register address
|
|
|
|
* nregs - The number of registers to write.
|
|
|
|
* value - The of the register values to be written.
|
2018-02-21 18:50:06 +01:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) on success. A negated errno value on failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int ft80x_putregs(int fd, uint32_t addr, uint8_t nregs,
|
|
|
|
FAR const uint32_t *value);
|
|
|
|
|
2018-02-20 22:23:05 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: ft80x_ramdl_rewind
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Reset to the start of RAM DL memory
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2018-02-26 03:26:24 +01:00
|
|
|
* fd - The file descriptor of the FT80x device. Opened by the caller
|
|
|
|
* with write access.
|
2018-02-20 22:23:05 +01:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) on success. A negated errno value on failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2018-02-26 03:26:24 +01:00
|
|
|
int ft80x_ramdl_rewind(int fd);
|
2018-02-20 22:23:05 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: ft80x_ramdl_append
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Append new display list data to RAM DL
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2018-02-26 16:58:52 +01:00
|
|
|
* fd - The file descriptor of the FT80x device. Opened by the caller
|
|
|
|
* with write access.
|
|
|
|
* data - A pointer to the start of the data to be written.
|
|
|
|
* len - The number of bytes to be written.
|
2018-02-20 22:23:05 +01:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) on success. A negated errno value on failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2018-02-26 03:26:24 +01:00
|
|
|
int ft80x_ramdl_append(int fd, FAR const void *data, size_t len);
|
2018-02-20 22:23:05 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: ft80x_ramcmd_append
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Append new display list data to RAM CMD
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2018-02-26 16:58:52 +01:00
|
|
|
* fd - The file descriptor of the FT80x device. Opened by the caller
|
|
|
|
* with write access.
|
|
|
|
* data - A pointer to the start of the data to be append to RAM CMD.
|
|
|
|
* len - The number of bytes to be appended.
|
2018-02-20 22:23:05 +01:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) on success. A negated errno value on failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2018-02-26 03:26:24 +01:00
|
|
|
int ft80x_ramcmd_append(int fd, FAR const void *data, size_t len);
|
2018-02-20 22:23:05 +01:00
|
|
|
|
2018-02-22 17:01:50 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: ft80x_ramcmd_freespace
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Return the free space in RAM CMD memory
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* fd - The file descriptor of the FT80x device. Opened by the caller
|
|
|
|
* with write access.
|
|
|
|
* offset - Pointer to location to return the write offset to use if the
|
|
|
|
* FIFO is not full.
|
|
|
|
* avail - Pointer to location to return the FIFO free space
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* The (positive) number of free bytes in RAM CMD on success. A negated
|
|
|
|
* errno value is returned on any failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
uint16_t ft80x_ramcmd_freespace(int fd, FAR uint16_t *offset,
|
|
|
|
FAR uint16_t *avail);
|
|
|
|
|
2018-02-20 22:23:05 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: ft80x_ramcmd_waitfifoempty
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Wait until co processor completes the operation and the FIFO is again
|
|
|
|
* empty.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2018-02-26 16:58:52 +01:00
|
|
|
* fd - The file descriptor of the FT80x device. Opened by the caller
|
|
|
|
* with write access.
|
2018-02-20 22:23:05 +01:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) on success. A negated errno value on failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2018-02-22 17:01:50 +01:00
|
|
|
int ft80x_ramcmd_waitfifoempty(int fd);
|
2018-02-20 22:23:05 +01:00
|
|
|
|
2018-02-18 20:36:08 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: ft80x_dl_swap
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Perform the display swap operation.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2018-02-26 16:58:52 +01:00
|
|
|
* fd - The file descriptor of the FT80x device. Opened by the caller
|
|
|
|
* with write access.
|
2018-02-18 20:36:08 +01:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) on success. A negated errno value on failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int ft80x_dl_swap(int fd);
|
|
|
|
|
2018-02-18 17:12:53 +01:00
|
|
|
#undef EXTERN
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* CONFIG_GRAPHICS_FT80X */
|
|
|
|
#endif /* __APPS_GRAPHICS_FT80X_FT80X_H */
|