drivers/lcd: Add support for creating display lists incrementally.
This commit is contained in:
parent
e4292dced8
commit
885ab75045
@ -104,10 +104,6 @@ static ssize_t ft80x_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
static ssize_t ft80x_write(FAR struct file *filep, FAR const char *buffer,
|
static ssize_t ft80x_write(FAR struct file *filep, FAR const char *buffer,
|
||||||
size_t buflen);
|
size_t buflen);
|
||||||
static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
|
static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
|
||||||
#ifndef CONFIG_DISABLE_POLL
|
|
||||||
static int ft80x_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|
||||||
bool setup);
|
|
||||||
#endif
|
|
||||||
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||||
static int ft80x_unlink(FAR struct inode *inode);
|
static int ft80x_unlink(FAR struct inode *inode);
|
||||||
#endif
|
#endif
|
||||||
@ -129,7 +125,7 @@ static const struct file_operations g_ft80x_fops =
|
|||||||
NULL, /* seek */
|
NULL, /* seek */
|
||||||
ft80x_ioctl /* ioctl */
|
ft80x_ioctl /* ioctl */
|
||||||
#ifndef CONFIG_DISABLE_POLL
|
#ifndef CONFIG_DISABLE_POLL
|
||||||
, ft80x_poll /* poll */
|
, NULL /* poll */
|
||||||
#endif
|
#endif
|
||||||
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||||
, ft80x_unlink /* unlink */
|
, ft80x_unlink /* unlink */
|
||||||
@ -322,7 +318,7 @@ static ssize_t ft80x_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
priv = inode->i_private;
|
priv = inode->i_private;
|
||||||
|
|
||||||
if (buffer == NULL || ((uintptr_t)buffer & 3) != 0 ||
|
if (buffer == NULL || ((uintptr_t)buffer & 3) != 0 ||
|
||||||
len == 0 || (len & 3) != 0 || len > FT80X_RAM_DL_SIZE)
|
len == 0 || (len & 3) != 0 || (len + filep->f_pos) > FT80X_RAM_DL_SIZE)
|
||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@ -339,12 +335,13 @@ static ssize_t ft80x_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
* would be a silly thing to do.
|
* would be a silly thing to do.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* The write method is functionally equivalent to the FT80XIOC_PUTDISPLAYLIST
|
/* The write method is functionally equivalent to the FT80X_IOC_CREATEDL
|
||||||
* IOCTL command: It simply copies the display list in the user buffer to
|
* IOCTL command: It simply copies the display list in the user buffer to
|
||||||
* the FT80x display list memory.
|
* the FT80x display list memory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ft80x_write_memory(priv, FT80X_RAM_DL, buffer, len);
|
ft80x_write_memory(priv, FT80X_RAM_DL + filep->f_pos, buffer, len);
|
||||||
|
filep->f_pos += len;
|
||||||
|
|
||||||
nxsem_post(&priv->exclsem);
|
nxsem_post(&priv->exclsem);
|
||||||
return len;
|
return len;
|
||||||
@ -383,21 +380,47 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
/* FT80XIOC_PUTDISPLAYLIST:
|
/* FT80X_IOC_CREATEDL:
|
||||||
* Description: Write a display list to the FT80x display list memory
|
* Description: Write a display list to the FT80x display list memory
|
||||||
|
* Description: Write a display list to the FT80x display list memory
|
||||||
|
* starting at offset zero. This may or may not be the
|
||||||
|
* entire display list. Display lists may be created
|
||||||
|
* incrementally, starting with FT80X_IOC_CREATEDL and
|
||||||
|
* finishing the display list using FT80XIO_APPENDDL
|
||||||
* Argument: A reference to a display list structure instance.
|
* Argument: A reference to a display list structure instance.
|
||||||
* See struct ft80x_displaylist_s.
|
* See struct ft80x_displaylist_s.
|
||||||
* Returns: None
|
* Returns: None
|
||||||
*/
|
*/
|
||||||
|
|
||||||
case FT80XIOC_PUTDISPLAYLIST:
|
case FT80X_IOC_CREATEDL:
|
||||||
|
|
||||||
|
/* Set the file position to zero and fall through to "append" the new
|
||||||
|
* display list data at offset 0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
filep->f_pos = 0;
|
||||||
|
|
||||||
|
/* FALLTHROUGH */
|
||||||
|
|
||||||
|
/* FT80X_IOC_APPENDDL:
|
||||||
|
* Description: Write additional display list entries to the FT80x
|
||||||
|
* display list memory at the current display list offset.
|
||||||
|
* This IOCTL command permits display lists to be completed
|
||||||
|
* incrementally, starting with FT80X_IOC_CREATEDL and
|
||||||
|
* finishing the display list using FT80XIO_APPENDDL.
|
||||||
|
* Argument: A reference to a display list structure instance. See
|
||||||
|
* struct ft80x_displaylist_s.
|
||||||
|
* Returns: None
|
||||||
|
*/
|
||||||
|
|
||||||
|
case FT80X_IOC_APPENDDL:
|
||||||
{
|
{
|
||||||
FAR struct ft80x_displaylist_s *dl =
|
FAR struct ft80x_displaylist_s *dl =
|
||||||
(FAR struct ft80x_displaylist_s *)((uintptr_t)arg);
|
(FAR struct ft80x_displaylist_s *)((uintptr_t)arg);
|
||||||
|
|
||||||
if (dl == NULL || ((uintptr_t)&dl->cmd & 3) != 0 ||
|
if (dl == NULL || ((uintptr_t)&dl->cmd & 3) != 0 ||
|
||||||
dl->dlsize == 0 || (dl->dlsize & 3) != 0 ||
|
dl->dlsize == 0 || (dl->dlsize & 3) != 0 ||
|
||||||
dl->dlsize > FT80X_RAM_DL_SIZE)
|
dl->dlsize + filep->f_pos > FT80X_RAM_DL_SIZE)
|
||||||
{
|
{
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
}
|
}
|
||||||
@ -407,19 +430,21 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
* provided into the FT80x display list memory.
|
* provided into the FT80x display list memory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ft80x_write_memory(priv, FT80X_RAM_DL, &dl->cmd, dl->dlsize);
|
ft80x_write_memory(priv, FT80X_RAM_DL + filep->f_pos,
|
||||||
|
&dl->cmd, dl->dlsize);
|
||||||
|
filep->f_pos += dl->dlsize;
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* FT80XIOC_GETRESULT32:
|
/* FT80X_IOC_GETRESULT32:
|
||||||
* Description: Read a 32-bit value from the display list.
|
* Description: Read a 32-bit value from the display list.
|
||||||
* Argument: A reference to an instance of struct ft80x_result32_s.
|
* Argument: A reference to an instance of struct ft80x_result32_s.
|
||||||
* Returns: The 32-bit value read from the display list.
|
* Returns: The 32-bit value read from the display list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
case FT80XIOC_GETRESULT32:
|
case FT80X_IOC_GETRESULT32:
|
||||||
{
|
{
|
||||||
FAR struct ft80x_result32_s *result =
|
FAR struct ft80x_result32_s *result =
|
||||||
(FAR struct ft80x_result32_s *)((uintptr_t)arg);
|
(FAR struct ft80x_result32_s *)((uintptr_t)arg);
|
||||||
@ -438,7 +463,7 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* FT80XIOC_GETTRACKER:
|
/* FT80X_IOC_GETTRACKER:
|
||||||
* Description: After CMD_TRACK has been issued, the coprocessor
|
* Description: After CMD_TRACK has been issued, the coprocessor
|
||||||
* will update the TRACKER register with new position
|
* will update the TRACKER register with new position
|
||||||
* data.
|
* data.
|
||||||
@ -446,7 +471,7 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
* Returns: The new content of the tracker register.
|
* Returns: The new content of the tracker register.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
case FT80XIOC_GETTRACKER:
|
case FT80X_IOC_GETTRACKER:
|
||||||
{
|
{
|
||||||
FAR uint32_t *tracker = (FAR uint32_t *)((uintptr_t)arg);
|
FAR uint32_t *tracker = (FAR uint32_t *)((uintptr_t)arg);
|
||||||
|
|
||||||
@ -474,19 +499,6 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: ft80x_poll
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef CONFIG_DISABLE_POLL
|
|
||||||
static int ft80x_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|
||||||
bool setup)
|
|
||||||
{
|
|
||||||
#warning Missing logic
|
|
||||||
return -ENOSYS;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ft80x_unlink
|
* Name: ft80x_unlink
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -97,7 +97,9 @@ off_t file_seek(FAR struct file *filep, off_t offset, int whence)
|
|||||||
{
|
{
|
||||||
case SEEK_CUR:
|
case SEEK_CUR:
|
||||||
offset += filep->f_pos;
|
offset += filep->f_pos;
|
||||||
|
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
|
|
||||||
case SEEK_SET:
|
case SEEK_SET:
|
||||||
if (offset >= 0)
|
if (offset >= 0)
|
||||||
{
|
{
|
||||||
|
@ -65,43 +65,63 @@
|
|||||||
|
|
||||||
/* FT80x IOCTL commands:
|
/* FT80x IOCTL commands:
|
||||||
*
|
*
|
||||||
* FT80XIOC_PUTDISPLAYLIST:
|
* FT80X_IOC_CREATEDL:
|
||||||
* Description: Write a display list to the FT80x display list memory
|
* Description: Write a display list to the FT80x display list memory
|
||||||
|
* starting at offset zero. This may or may not be the
|
||||||
|
* entire display list. Display lists may be created
|
||||||
|
* incrementally, starting with FT80X_IOC_CREATEDL and
|
||||||
|
* finishing the display list using FT80XIO_APPENDDL
|
||||||
* Argument: A reference to a display list structure instance. See
|
* Argument: A reference to a display list structure instance. See
|
||||||
* struct ft80x_displaylist_s below.
|
* struct ft80x_displaylist_s below.
|
||||||
* Returns: None
|
* Returns: None
|
||||||
*
|
*
|
||||||
* This IOCTL command simply copies the display list as provided into the
|
* FT80X_IOC_APPENDDL:
|
||||||
* FT80x display list memory. Display lists should generally be formed as
|
* Description: Write additional display list entries to the FT80x
|
||||||
* follows:
|
* display list memory at the current display list offset.
|
||||||
|
* This IOCTL command permits display lists to be completed
|
||||||
|
* incrementally, starting with FT80X_IOC_CREATEDL and
|
||||||
|
* finishing display list using FT80XIO_APPENDDL.
|
||||||
|
* Argument: A reference to a display list structure instance. See
|
||||||
|
* struct ft80x_displaylist_s below.
|
||||||
|
* Returns: None
|
||||||
|
*
|
||||||
|
* These two IOCTL command simply copies the display list as provided into
|
||||||
|
* the FT80x display list memory. Display lists should generally be formed
|
||||||
|
* as follows:
|
||||||
*
|
*
|
||||||
* struct ft80x_cmd_dlstart_s dlstart; # Mark the start of the display list
|
* struct ft80x_cmd_dlstart_s dlstart; # Mark the start of the display list
|
||||||
* # Various display commands fillow...
|
* # Various display commands follow...
|
||||||
* FT80X_DISPLAY(); # Finish the last display
|
* FT80X_DISPLAY(); # Finish the last display
|
||||||
* struct ft80x_cmd_swap_s swap; # Swap to the new display list
|
* struct ft80x_cmd_swap_s swap; # Swap to the new display list
|
||||||
*
|
*
|
||||||
* NOTE: This is the same functionality as the driver write() method. Either
|
* NOTE: The functionality of FT80X_IOC_CREATEDL is the equivalent to that of
|
||||||
* the write method or the FT80XIOC_PUTDISPLAYLIST IOCTL command can be used to
|
* the driver write() method. Either the write method or the FT80X_IOC_CREATEDL
|
||||||
* write the display list.
|
* IOCTL command can be used to write the display list.
|
||||||
|
*
|
||||||
|
* The difference between appending and create a display list using write()
|
||||||
|
* is that it is necessary to lseek() to the beginning of the display list
|
||||||
|
* to create a new display list. Subsequent writes will behave then append
|
||||||
|
* to the end of the display list.
|
||||||
*
|
*
|
||||||
* Output values from display commands are not automatically written back in
|
* Output values from display commands are not automatically written back in
|
||||||
* either case but must be subsequently obtained using FT80XIOC_GETRESULT32.
|
* either case but must be subsequently obtained using FT80X_IOC_GETRESULT32.
|
||||||
*
|
*
|
||||||
* FT80XIOC_GETRESULT32:
|
* FT80X_IOC_GETRESULT32:
|
||||||
* Description: Read a 32-bit value from the display list.
|
* Description: Read a 32-bit value from the display list.
|
||||||
* Argument: A reference to an instance of struct ft80x_result32_s below.
|
* Argument: A reference to an instance of struct ft80x_result32_s below.
|
||||||
* Returns: The 32-bit value read from the display list.
|
* Returns: The 32-bit value read from the display list.
|
||||||
*
|
*
|
||||||
* FT80XIOC_GETTRACKER:
|
* FT80X_IOC_GETTRACKER:
|
||||||
* Description: After CMD_TRACK has been issued, the coprocessor will update
|
* Description: After CMD_TRACK has been issued, the coprocessor will update
|
||||||
* the TRACKER register with new position data.
|
* the TRACKER register with new position data.
|
||||||
* Argument: A pointer to a writable uint32_t memory location.
|
* Argument: A pointer to a writable uint32_t memory location.
|
||||||
* Returns: The new content of the tracker register.
|
* Returns: The new content of the tracker register.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define FT80XIOC_PUTDISPLAYLIST _LCDIOC(FT80X_NIOCTL_BASE + 0)
|
#define FT80X_IOC_CREATEDL _LCDIOC(FT80X_NIOCTL_BASE + 0)
|
||||||
#define FT80XIOC_GETRESULT32 _LCDIOC(FT80X_NIOCTL_BASE + 1)
|
#define FT80X_IOC_APPENDDL _LCDIOC(FT80X_NIOCTL_BASE + 1)
|
||||||
#define FT80XIOC_GETTRACKER _LCDIOC(FT80X_NIOCTL_BASE + 2)
|
#define FT80X_IOC_GETRESULT32 _LCDIOC(FT80X_NIOCTL_BASE + 2)
|
||||||
|
#define FT80X_IOC_GETTRACKER _LCDIOC(FT80X_NIOCTL_BASE + 3)
|
||||||
|
|
||||||
/* Host commands. 3 word commands. The first word begins with 0b01, the next two are zero */
|
/* Host commands. 3 word commands. The first word begins with 0b01, the next two are zero */
|
||||||
|
|
||||||
@ -993,8 +1013,8 @@ struct ft80x_cmd_translate_s
|
|||||||
int32_t ty; /* 8: Y translate factor (b16) (input) */
|
int32_t ty; /* 8: Y translate factor (b16) (input) */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This container structure is used by FT80XIOC_PUTDISPLAY and defines the
|
/* This container structure is used by FT80X_IOC_CREATEDL and FT80X_IOC_APPENDDL. It
|
||||||
* list of display commands to be written into display list memory.
|
* and defines the list of display commands to be written into display list memory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct ft80x_displaylist_s
|
struct ft80x_displaylist_s
|
||||||
@ -1003,7 +1023,7 @@ struct ft80x_displaylist_s
|
|||||||
struct ft80x_dlcmd_s cmd; /* First command in the display list (input) */
|
struct ft80x_dlcmd_s cmd; /* First command in the display list (input) */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This structure is used with the FT80XIOC_GETRESULT32 IOCTL command to
|
/* This structure is used with the FT80X_IOC_GETRESULT32 IOCTL command to
|
||||||
* retrieve the result of the display list operation from display list memory.
|
* retrieve the result of the display list operation from display list memory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user