drivers/ft80x: Now supports reading/writing multiple regisers with single ioctl command.
This commit is contained in:
parent
02df81bc5f
commit
38a258bf3b
@ -643,7 +643,7 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR struct ft80x_relmem_s *ramdl =
|
||||
(FAR struct ft80x_relmem_s *)((uintptr_t)arg);
|
||||
|
||||
if (ramdl == NULL || ((uintptr_t)&ramdl->offset & 3) != 0 ||
|
||||
if (ramdl == NULL || ((uintptr_t)ramdl->offset & 3) != 0 ||
|
||||
ramdl->offset >= FT80X_RAM_DL_SIZE)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
@ -693,7 +693,7 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR struct ft80x_relmem_s *ramcmd =
|
||||
(FAR struct ft80x_relmem_s *)((uintptr_t)arg);
|
||||
|
||||
if (ramcmd == NULL || ((uintptr_t)&ramcmd->offset & 3) != 0 /* ||
|
||||
if (ramcmd == NULL || ((uintptr_t)ramcmd->offset & 3) != 0 /* ||
|
||||
ramcmd->offset >= FT80X_CMDFIFO_SIZE */ )
|
||||
{
|
||||
ret = -EINVAL;
|
||||
@ -710,7 +710,7 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
/* FT80X_IOC_GETREG8:
|
||||
* Description: Read an 8-bit register value from the FT80x.
|
||||
* Argument: A reference to an instance of struct ft80x_register_s.
|
||||
* Returns: The 8-bit value read from the display list.
|
||||
* Returns: The 8-bit value read from the register.
|
||||
*/
|
||||
|
||||
case FT80X_IOC_GETREG8:
|
||||
@ -718,7 +718,7 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR struct ft80x_register_s *reg =
|
||||
(FAR struct ft80x_register_s *)((uintptr_t)arg);
|
||||
|
||||
if (reg == NULL || ((uintptr_t)®->addr & 3) != 0)
|
||||
if (reg == NULL || ((uintptr_t)reg->addr & 3) != 0)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
}
|
||||
@ -733,7 +733,7 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
/* FT80X_IOC_GETREG16:
|
||||
* Description: Read a 16-bit register value from the FT80x.
|
||||
* Argument: A reference to an instance of struct ft80x_register_s.
|
||||
* Returns: The 16-bit value read from the display list.
|
||||
* Returns: The 16-bit value read from the register.
|
||||
*/
|
||||
|
||||
case FT80X_IOC_GETREG16:
|
||||
@ -741,7 +741,7 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR struct ft80x_register_s *reg =
|
||||
(FAR struct ft80x_register_s *)((uintptr_t)arg);
|
||||
|
||||
if (reg == NULL || ((uintptr_t)®->addr & 3) != 0)
|
||||
if (reg == NULL || ((uintptr_t)reg->addr & 3) != 0)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
}
|
||||
@ -756,7 +756,7 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
/* FT80X_IOC_GETREG32:
|
||||
* Description: Read a 32-bit register value from the FT80x.
|
||||
* Argument: A reference to an instance of struct ft80x_register_s.
|
||||
* Returns: The 32-bit value read from the display list.
|
||||
* Returns: The 32-bit value read from the register.
|
||||
*/
|
||||
|
||||
case FT80X_IOC_GETREG32:
|
||||
@ -764,7 +764,7 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR struct ft80x_register_s *reg =
|
||||
(FAR struct ft80x_register_s *)((uintptr_t)arg);
|
||||
|
||||
if (reg == NULL || ((uintptr_t)®->addr & 3) != 0)
|
||||
if (reg == NULL || ((uintptr_t)reg->addr & 3) != 0)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
}
|
||||
@ -776,6 +776,30 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
}
|
||||
break;
|
||||
|
||||
/* FT80X_IOC_GETREGS:
|
||||
* Description: Read multiple 32-bit register values from the FT80x.
|
||||
* Argument: A reference to an instance of struct ft80x_registers_s.
|
||||
* Returns: The 32-bit values read from the consecutive registers .
|
||||
*/
|
||||
|
||||
case FT80X_IOC_GETREGS:
|
||||
{
|
||||
FAR struct ft80x_registers_s *regs =
|
||||
(FAR struct ft80x_registers_s *)((uintptr_t)arg);
|
||||
|
||||
if (regs == NULL || ((uintptr_t)regs->addr & 3) != 0)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ft80x_read_memory(priv, regs->addr, regs->value,
|
||||
(size_t)regs->nregs << 2);
|
||||
ret = OK;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* FT80X_IOC_PUTREG8:
|
||||
* Description: Write an 8-bit register value to the FT80x.
|
||||
* Argument: A reference to an instance of struct ft80x_register_s.
|
||||
@ -787,7 +811,7 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR struct ft80x_register_s *reg =
|
||||
(FAR struct ft80x_register_s *)((uintptr_t)arg);
|
||||
|
||||
if (reg == NULL || ((uintptr_t)®->addr & 3) != 0)
|
||||
if (reg == NULL || ((uintptr_t)reg->addr & 3) != 0)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
}
|
||||
@ -810,7 +834,7 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR struct ft80x_register_s *reg =
|
||||
(FAR struct ft80x_register_s *)((uintptr_t)arg);
|
||||
|
||||
if (reg == NULL || ((uintptr_t)®->addr & 3) != 0)
|
||||
if (reg == NULL || ((uintptr_t)reg->addr & 3) != 0)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
}
|
||||
@ -833,7 +857,7 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR struct ft80x_register_s *reg =
|
||||
(FAR struct ft80x_register_s *)((uintptr_t)arg);
|
||||
|
||||
if (reg == NULL || ((uintptr_t)®->addr & 3) != 0)
|
||||
if (reg == NULL || ((uintptr_t)reg->addr & 3) != 0)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
}
|
||||
@ -845,6 +869,30 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
}
|
||||
break;
|
||||
|
||||
/* FT80X_IOC_PUTREGS:
|
||||
* Description: Write multiple 32-bit register values to the FT80x.
|
||||
* Argument: A reference to an instance of struct ft80x_registers_s.
|
||||
* Returns: None.
|
||||
*/
|
||||
|
||||
case FT80X_IOC_PUTREGS:
|
||||
{
|
||||
FAR struct ft80x_registers_s *regs =
|
||||
(FAR struct ft80x_registers_s *)((uintptr_t)arg);
|
||||
|
||||
if (regs == NULL || ((uintptr_t)regs->addr & 3) != 0)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ft80x_write_memory(priv, regs->addr, regs->value,
|
||||
(size_t)regs->nregs << 2);
|
||||
ret = OK;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* FT80X_IOC_EVENTNOTIFY:
|
||||
* Description: Setup to receive a signal when an event occurs.
|
||||
* Argument: A reference to an instance of struct ft80x_notify_s.
|
||||
|
@ -144,17 +144,22 @@
|
||||
* FT80X_IOC_GETREG8:
|
||||
* Description: Read an 8-bit register value from the FT80x.
|
||||
* Argument: A reference to an instance of struct ft80x_register_s below.
|
||||
* Returns: The 8-bit value read from the display list.
|
||||
* Returns: The 8-bit value read from the register.
|
||||
*
|
||||
* FT80X_IOC_GETREG16:
|
||||
* Description: Read a 16-bit register value from the FT80x.
|
||||
* Argument: A reference to an instance of struct ft80x_register_s below.
|
||||
* Returns: The 16-bit value read from the display list.
|
||||
* Returns: The 16-bit value read from the register.
|
||||
*
|
||||
* FT80X_IOC_GETREG32:
|
||||
* Description: Read a 32-bit register value from the FT80x.
|
||||
* Argument: A reference to an instance of struct ft80x_register_s below.
|
||||
* Returns: The 32-bit value read from the display list.
|
||||
* Returns: The 32-bit value read from the register.
|
||||
*
|
||||
* FT80X_IOC_GETREGS:
|
||||
* Description: Read multiple 32-bit register values from the FT80x.
|
||||
* Argument: A reference to an instance of struct ft80x_registers_s below.
|
||||
* Returns: The 32-bit values read from the consecutive registers .
|
||||
*
|
||||
* FT80X_IOC_PUTREG8:
|
||||
* Description: Write an 8-bit register value to the FT80x.
|
||||
@ -162,15 +167,20 @@
|
||||
* Returns: None.
|
||||
*
|
||||
* FT80X_IOC_PUTREG16:
|
||||
* Description: Write a 16-bit register value to the FT80x.
|
||||
* Description: Write a 16-bit register value to the FT80x.
|
||||
* Argument: A reference to an instance of struct ft80x_register_s below.
|
||||
* Returns: None.
|
||||
*
|
||||
* FT80X_IOC_PUTREG32:
|
||||
* Description: Write a 32-bit register value to the FT80x.
|
||||
* Description: Write a 32-bit register value to the FT80x.
|
||||
* Argument: A reference to an instance of struct ft80x_register_s below.
|
||||
* Returns: None.
|
||||
*
|
||||
* FT80X_IOC_PUTREGS:
|
||||
* Description: Write multiple 32-bit register values to the FT80x.
|
||||
* Argument: A reference to an instance of struct ft80x_registers_s below.
|
||||
* Returns: None.
|
||||
*
|
||||
* FT80X_IOC_EVENTNOTIFY:
|
||||
* Description: Setup to receive a signal when there is a change in any
|
||||
* touch tag value. Additional information may be provided in
|
||||
@ -191,10 +201,12 @@
|
||||
#define FT80X_IOC_GETREG8 _LCDIOC(FT80X_NIOCTL_BASE + 5)
|
||||
#define FT80X_IOC_GETREG16 _LCDIOC(FT80X_NIOCTL_BASE + 6)
|
||||
#define FT80X_IOC_GETREG32 _LCDIOC(FT80X_NIOCTL_BASE + 7)
|
||||
#define FT80X_IOC_PUTREG8 _LCDIOC(FT80X_NIOCTL_BASE + 8)
|
||||
#define FT80X_IOC_PUTREG16 _LCDIOC(FT80X_NIOCTL_BASE + 9)
|
||||
#define FT80X_IOC_PUTREG32 _LCDIOC(FT80X_NIOCTL_BASE + 10)
|
||||
#define FT80X_IOC_EVENTNOTIFY _LCDIOC(FT80X_NIOCTL_BASE + 11)
|
||||
#define FT80X_IOC_GETREGS _LCDIOC(FT80X_NIOCTL_BASE + 8)
|
||||
#define FT80X_IOC_PUTREG8 _LCDIOC(FT80X_NIOCTL_BASE + 9)
|
||||
#define FT80X_IOC_PUTREG16 _LCDIOC(FT80X_NIOCTL_BASE + 10)
|
||||
#define FT80X_IOC_PUTREG32 _LCDIOC(FT80X_NIOCTL_BASE + 11)
|
||||
#define FT80X_IOC_PUTREGS _LCDIOC(FT80X_NIOCTL_BASE + 12)
|
||||
#define FT80X_IOC_EVENTNOTIFY _LCDIOC(FT80X_NIOCTL_BASE + 13)
|
||||
|
||||
/* FT80x Memory Map *************************************************************************/
|
||||
|
||||
@ -1419,6 +1431,13 @@ struct ft80x_register_s
|
||||
} value;
|
||||
};
|
||||
|
||||
struct ft80x_registers_s
|
||||
{
|
||||
uint32_t addr; /* 32-bit aligned start register address */
|
||||
uint8_t nregs; /* Number of 32-bit registers to be accessed */
|
||||
FAR uint32_t *value; /* A pointer to an array of 32-bit register values */
|
||||
};
|
||||
|
||||
/********************************************************************************************
|
||||
* Public Function Prototypes
|
||||
********************************************************************************************/
|
||||
|
@ -50,7 +50,7 @@
|
||||
|
||||
/* IOCTL commands set aside for FT80x character driver */
|
||||
|
||||
#define FT80X_NIOCTL_CMDS 12
|
||||
#define FT80X_NIOCTL_CMDS 14
|
||||
#define FT80X_NIOCTL_BASE 0x0001
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_INPUT_LCD_IOCTL_H */
|
||||
|
Loading…
Reference in New Issue
Block a user