Merged nuttx/nuttx into master

This commit is contained in:
jjlange
2019-04-07 14:18:39 -05:00
24 changed files with 1176 additions and 92 deletions
+176 -12
View File
@@ -39,6 +39,7 @@
#include <nuttx/config.h>
#if defined(CONFIG_NET) && defined(CONFIG_LPC17_ETHERNET)
#include <sys/ioctl.h>
#include <stdint.h>
#include <stdbool.h>
@@ -72,7 +73,7 @@
#include <arch/board/board.h>
/* Does this chip have and Ethernet controller? */
/* Does this chip have an Ethernet controller? */
#if LPC17_NETHCONTROLLERS > 0
@@ -240,6 +241,40 @@
# endif
#endif
#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT)
# if defined( CONFIG_ETH0_PHY_AM79C874)
# error missing logic
# elif defined( CONFIG_ETH0_PHY_KS8721)
# error missing logic
# elif defined( CONFIG_ETH0_PHY_KSZ8041)
# error missing logic
# elif defined( CONFIG_ETH0_PHY_KSZ8051)
# error missing logic
# elif defined( CONFIG_ETH0_PHY_KSZ8061)
# error missing logic
# elif defined( CONFIG_ETH0_PHY_KSZ8081)
# define MII_INT_REG MII_KSZ8081_INT
# define MII_INT_SETEN MII_KSZ80x1_INT_LDEN | MII_KSZ80x1_INT_LUEN
# define MII_INT_CLREN 0
# elif defined( CONFIG_ETH0_PHY_KSZ90x1)
# error missing logic
# elif defined( CONFIG_ETH0_PHY_DP83848C)
# error missing logic
# elif defined( CONFIG_ETH0_PHY_LAN8720)
# error missing logic
# elif defined( CONFIG_ETH0_PHY_LAN8740)
# error missing logic
# elif defined( CONFIG_ETH0_PHY_LAN8740A)
# error missing logic
# elif defined( CONFIG_ETH0_PHY_LAN8742A)
# error missing logic
# elif defined( CONFIG_ETH0_PHY_DM9161)
# error missing logic
# else
# error unknown PHY
# endif
#endif
/****************************************************************************
* Private Types
****************************************************************************/
@@ -361,6 +396,11 @@ static int lpc17_addmac(struct net_driver_s *dev, const uint8_t *mac);
static int lpc17_rmmac(struct net_driver_s *dev, const uint8_t *mac);
#endif
#ifdef CONFIG_NETDEV_IOCTL
static int lpc17_eth_ioctl(struct net_driver_s *dev, int cmd,
unsigned long arg);
#endif
/* Initialization functions */
#if defined(CONFIG_LPC17_NET_REGDEBUG) && defined(CONFIG_DEBUG_GPIO_INFO)
@@ -378,6 +418,9 @@ static void lpc17_showmii(uint8_t phyaddr, const char *msg);
# define lpc17_showmii(phyaddr,msg)
# endif
#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT)
static int lpc17_phyintenable(FAR struct lpc17_driver_s *priv);
#endif
static void lpc17_phywrite(uint8_t phyaddr, uint8_t regaddr,
uint16_t phydata);
static uint16_t lpc17_phyread(uint8_t phyaddr, uint8_t regaddr);
@@ -2077,6 +2120,124 @@ static int lpc17_rmmac(struct net_driver_s *dev, const uint8_t *mac)
}
#endif
/****************************************************************************
* Name: lpc17_eth_ioctl
*
* Description:
* Handle network IOCTL commands directed to this device.
*
* Input Parameters:
* dev - Reference to the NuttX driver state structure
* cmd - The IOCTL command
* arg - The argument for the IOCTL command
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
* The network is locked.
*
****************************************************************************/
#ifdef CONFIG_NETDEV_IOCTL
static int lpc17_eth_ioctl(struct net_driver_s *dev, int cmd,
unsigned long arg)
{
#ifdef CONFIG_NETDEV_PHY_IOCTL
struct lpc17_driver_s *priv = (struct lpc17_driver_s *)dev->d_private;
#endif
int ret;
/* Decode and dispatch the driver-specific IOCTL command */
switch (cmd)
{
#ifdef CONFIG_NETDEV_PHY_IOCTL
#ifdef CONFIG_ARCH_PHY_INTERRUPT
case SIOCMIINOTIFY: /* Set up for PHY event notifications */
{
struct mii_iotcl_notify_s *req = (struct mii_iotcl_notify_s *)((uintptr_t)arg);
ret = phy_notify_subscribe(dev->d_ifname, req->pid, req->signo, req->arg);
if (ret == OK)
{
/* Enable PHY link up/down interrupts */
ret = lpc17_phyintenable(priv);
}
}
break;
#endif
case SIOCGMIIPHY: /* Get MII PHY address */
{
struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg);
req->phy_id = priv->lp_phyaddr;
ret = OK;
}
break;
case SIOCGMIIREG: /* Get register from MII PHY */
{
struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg);
req->val_out = lpc17_phyread(priv->lp_phyaddr, req->reg_num);
ret = OK;
}
break;
case SIOCSMIIREG: /* Set register in MII PHY */
{
struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg);
lpc17_phywrite(priv->lp_phyaddr, req->reg_num, req->val_in);
ret = OK;
}
break;
#endif /* ifdef CONFIG_NETDEV_PHY_IOCTL */
default:
nerr("ERROR: Unrecognized IOCTL command: %d\n", command);
return -ENOTTY; /* Special return value for this case */
}
return OK;
}
#endif
/****************************************************************************
* Function: lpc17_phyintenable
*
* Description:
* Enable link up/down PHY interrupts. The interrupt protocol is like
* this:
*
* - Interrupt status is cleared when the interrupt is enabled.
* - Interrupt occurs. Interrupt is disabled (at the processor level) when
* is received.
* - Interrupt status is cleared when the interrupt is re-enabled.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno (-ETIMEDOUT) on failure.
*
****************************************************************************/
#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT)
static int lpc17_phyintenable(struct lpc17_driver_s *priv)
{
uint16_t phyval;
phyval = lpc17_phyread(priv->lp_phyaddr, MII_INT_REG);
/* Enable link up/down interrupts */
lpc17_phywrite(priv->lp_phyaddr, MII_INT_REG,
(phyval & ~MII_INT_CLREN) | MII_INT_SETEN);
return OK;
}
#endif
/****************************************************************************
* Name: lpc17_showpins
*
@@ -3051,26 +3212,29 @@ static inline int lpc17_ethinitialize(int intf)
/* Initialize the driver structure */
memset(priv, 0, sizeof(struct lpc17_driver_s));
priv->lp_dev.d_buf = pktbuf; /* Single packet buffer */
priv->lp_dev.d_ifup = lpc17_ifup; /* I/F down callback */
priv->lp_dev.d_ifdown = lpc17_ifdown; /* I/F up (new IP address) callback */
priv->lp_dev.d_txavail = lpc17_txavail; /* New TX data callback */
priv->lp_dev.d_buf = pktbuf; /* Single packet buffer */
priv->lp_dev.d_ifup = lpc17_ifup; /* I/F down callback */
priv->lp_dev.d_ifdown = lpc17_ifdown; /* I/F up (new IP address) callback */
priv->lp_dev.d_txavail = lpc17_txavail; /* New TX data callback */
#ifdef CONFIG_NET_MCASTGROUP
priv->lp_dev.d_addmac = lpc17_addmac; /* Add multicast MAC address */
priv->lp_dev.d_rmmac = lpc17_rmmac; /* Remove multicast MAC address */
priv->lp_dev.d_addmac = lpc17_addmac; /* Add multicast MAC address */
priv->lp_dev.d_rmmac = lpc17_rmmac; /* Remove multicast MAC address */
#endif
priv->lp_dev.d_private = (void *)priv; /* Used to recover private state from dev */
#ifdef CONFIG_NETDEV_IOCTL
priv->lp_dev.d_ioctl = lpc17_eth_ioctl; /* Handle network IOCTL commands */
#endif
priv->lp_dev.d_private = (void *)priv; /* Used to recover private state from dev */
#if CONFIG_LPC17_NINTERFACES > 1
# error "A mechanism to associate base address an IRQ with an interface is needed"
priv->lp_base = ??; /* Ethernet controller base address */
priv->lp_irq = ??; /* Ethernet controller IRQ number */
priv->lp_base = ??; /* Ethernet controller base address */
priv->lp_irq = ??; /* Ethernet controller IRQ number */
#endif
/* Create a watchdog for timing polling for and timing of transmissions */
priv->lp_txpoll = wd_create(); /* Create periodic poll timer */
priv->lp_txtimeout = wd_create(); /* Create TX timeout timer */
priv->lp_txpoll = wd_create(); /* Create periodic poll timer */
priv->lp_txtimeout = wd_create(); /* Create TX timeout timer */
/* Reset the Ethernet controller and leave in the ifdown statue. The
* Ethernet controller will be properly re-initialized each time
+2 -2
View File
@@ -160,12 +160,12 @@ static const struct fb_planeinfo_s g_planeinfo =
/* Current cursor position */
#ifdef CONFIG_FB_HWCURSOR
static struct fb_cursorpos_s g_cpos;
static struct cursor_pos_s g_cpos;
/* Current cursor size */
#ifdef CONFIG_FB_HWCURSORSIZE
static struct fb_cursorsize_s g_csize;
static struct cursor_size_s g_csize;
#endif
#endif
+2 -2
View File
@@ -147,12 +147,12 @@ static const struct fb_planeinfo_s g_planeinfo =
/* Current cursor position */
#ifdef CONFIG_FB_HWCURSOR
static struct fb_cursorpos_s g_cpos;
static struct cursor_pos_s g_cpos;
/* Current cursor size */
#ifdef CONFIG_FB_HWCURSORSIZE
static struct fb_cursorsize_s g_csize;
static struct cursor_size_s g_csize;
#endif
#endif
+2 -2
View File
@@ -645,9 +645,9 @@ struct sam_lcdc_s
struct sam_layer_s layer[LCDC_NLAYERS];
#ifdef CONFIG_FB_HWCURSOR
struct fb_cursorpos_s cpos; /* Current cursor position */
struct cursor_pos_s cpos; /* Current cursor position */
#ifdef CONFIG_FB_HWCURSORSIZE
struct fb_cursorsize_s csize; /* Current cursor size */
struct cursor_size_s csize; /* Current cursor size */
#endif
#endif
+2 -2
View File
@@ -152,12 +152,12 @@ static struct fb_planeinfo_s g_planeinfo;
/* Current cursor position */
#ifdef CONFIG_FB_HWCURSOR
static struct fb_cursorpos_s g_cpos;
static struct cursor_pos_s g_cpos;
/* Current cursor size */
#ifdef CONFIG_FB_HWCURSORSIZE
static struct fb_cursorsize_s g_csize;
static struct cursor_size_s g_csize;
#endif
#endif
+4
View File
@@ -19,6 +19,10 @@ menuconfig LCD
if LCD
config LCD_HWCURSOR
bool
default n
config LCD_PACKEDMSFIRST
bool
default n
+22
View File
@@ -68,6 +68,28 @@ config NX_RAMBACKED
NOTE: A significant amount of RAM, usually external SDRAM, may be
required to use per-window framebuffers.
choice
prompt "Cursor support"
default NX_NOCURSOR
config NX_NOCURSOR
bool "No cursor support"
config NX_SWCURSOR
bool "Software cursor support"
depends on NX_RAMBACKED && EXPERIMENTAL
config NX_HWCURSOR
bool "Software cursor support"
depends on (FB_HWCURSOR || LCD_HWCURSOR) && EXPERIMENTAL
endchoice # Cursor support
config NX_HWCURSORIMAGE
bool "Support cursor images"
default n
depends on NX_HWCURSOR
config NX_BGCOLOR
hex "Initial background color"
default 0x0
+10
View File
@@ -40,6 +40,16 @@ CSRCS += nxbe_fill.c nxbe_filltrapezoid.c nxbe_setpixel.c
CSRCS += nxbe_lower.c nxbe_raise.c nxbe_modal.c
CSRCS += nxbe_setsize.c nxbe_visible.c
ifeq ($(CONFIG_NX_RAMBACKED),y)
CSRCS += nxbe_flush.c
endif
ifeq ($(CONFIG_NX_HWCURSOR),y)
CSRCS += nxbe_cursor.c
else ifeq ($(CONFIG_NX_SWCURSOR),y)
CSRCS += nxbe_cursor.c
endif
DEPPATH += --dep-path nxbe
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxbe}
VPATH += :nxbe
+147 -12
View File
@@ -188,12 +188,25 @@ struct nxbe_clipops_s
struct nxbe_state_s
{
uint8_t flags; /* NXBE_STATE_* flags */
uint8_t flags; /* NXBE_STATE_* flags */
#if defined(CONFIG_NX_SWCURSOR) || defined(CONFIG_NX_HWCURSOR)
/* Cursor support */
struct
{
bool visible; /* True: the cursor is visible */
struct cursor_pos_s pos; /* The current cursor position */
#ifdef CONFIG_NX_SWCURSOR
FAR struct cursor_image_s image; /* Cursor image */
#endif
} cursor;
#endif
/* The window list (with the background window always at the bottom) */
FAR struct nxbe_window_s *topwnd; /* The window at the top of the display */
struct nxbe_window_s bkgd; /* The background window is always at the bottom */
FAR struct nxbe_window_s *topwnd; /* The window at the top of the display */
struct nxbe_window_s bkgd; /* The background window is always at the bottom */
/* At present, only a solid colored background is supported for refills. The
* following provides the background color. It would be nice to support
@@ -254,6 +267,65 @@ int nxbe_colormap(FAR NX_DRIVERTYPE *dev);
int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be);
#if defined(CONFIG_NX_SWCURSOR) || defined(CONFIG_NX_HWCURSOR)
/****************************************************************************
* Name: nxbe_cursor_enable
*
* Description:
* Enable/disable presentation of the cursor
*
* Input Parameters:
* be - The back-end state structure instance
* enable - True: show the cursor, false: hide the cursor.
*
* Returned Value:
* None
*
****************************************************************************/
void nxbe_cursor_enable(FAR struct nxbe_state_s *be, bool enable);
/****************************************************************************
* Name: nxbe_cursor_setimage
*
* Description:
* Set the cursor image
*
* Input Parameters:
* be - The back-end state structure instance
* image - Describes the cursor image in the expected format. For a
* software cursor, this is the format used with the display. The
* format may be different if a hardware cursor is used.
*
* Returned Value:
* None
*
****************************************************************************/
#if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR)
void nxbe_cursor_setimage(FAR struct nxbe_state_s *be,
FAR struct cursor_image_s *image);
#endif
/****************************************************************************
* Name: nxcursor_setposition
*
* Description:
* Move the cursor to the specified position
*
* Input Parameters:
* be - The back-end state structure instance
* pos - The new cursor position
*
* Returned Value:
* None
*
****************************************************************************/
void nxcursor_setposition(FAR struct nxbe_state_s *be,
FAR const struct cursor_pos_s *pos);
#endif /* CONFIG_NX_SWCURSOR || CONFIG_NX_HWCURSOR */
/****************************************************************************
* Name: nxbe_closewindow
*
@@ -443,9 +515,9 @@ void nxbe_move(FAR struct nxbe_window_s *wnd,
* device unconditionally.
*
* Input Parameters:
* wnd - The window that will receive the bitmap image
* dest - Describes the rectangular on the display that will receive the
* the bit map.
* wnd - The window that will receive the bitmap image
* dest - Describes the rectangular region on the display that will
* receive the the bit map.
* src - The start of the source image.
* origin - The origin of the upper, left-most corner of the full bitmap.
* Both dest and origin are in window coordinates, however, origin
@@ -474,9 +546,74 @@ void nxbe_bitmap_dev(FAR struct nxbe_window_s *wnd,
* and shadowed in the per-window framebuffer.
*
* Input Parameters:
* wnd - The window that will receive the bitmap image
* dest - Describes the rectangular on the display that will receive the
* the bit map.
* wnd - The window that will receive the bitmap image
* dest - Describes the rectangular region on the display that will
* receive the the bit map.
* src - The start of the source image.
* origin - The origin of the upper, left-most corner of the full bitmap.
* Both dest and origin are in window coordinates, however, origin
* may lie outside of the display.
* stride - The width of the full source image in bytes.
*
* Returned Value:
* None
*
****************************************************************************/
void nxbe_bitmap(FAR struct nxbe_window_s *wnd,
FAR const struct nxgl_rect_s *dest,
FAR const void *src[CONFIG_NX_NPLANES],
FAR const struct nxgl_point_s *origin,
unsigned int stride);
/****************************************************************************
* Name: nxbe_sprite_refresh
*
* Description:
* Prior to calling nxbe_bitmap_dev(), update any "sprites" tht need to
* be overlaid on the per-window frambuffer. This could include such
* things as OSD functionality, a software cursor, selection boxes, etc.
*
* Input Parameters (same as for nxbe_bitmap_dev):
* wnd - The window that will receive the bitmap image
* dest - Describes the rectangular region on the display that was
* modified (in device coordinates)
*
* Returned Value:
* None
*
****************************************************************************/
#ifdef CONFIG_NX_RAMBACKED
#if 0 /* There are none yet */
void nxbe_sprite_refresh(FAR struct nxbe_window_s *wnd,
FAR const struct nxgl_rect_s *dest);
#else
# define nxbe_sprite_refresh(wnd, dest)
#endif
#endif
/****************************************************************************
* Name: nxbe_flush
*
* Description:
* After per-window frambuffer has been updated, the modified region must
* be written to device graphics memory. That function is managed by this
* simple function. It does the following:
*
* 1) It calls nxbe_sprite_refresh() to update any "sprite" graphics on top
* of the RAM framebuffer. This could include such things as OSD
* functionality, a software cursor, selection boxes, etc.
* 2) Then it calls nxbe_bitmap_dev() to copy the modified per-window
* frambuffer into device memory.
*
* This the "sprite" image is always on top of the device display, this
* supports flicker-free software sprites.
*
* Input Parameters (same as for nxbe_bitmap_dev):
* wnd - The window that will receive the bitmap image
* dest - Describes the rectangular region on the display that will
* receive the the bit map.
* src - The start of the source image.
* origin - The origin of the upper, left-most corner of the full bitmap.
* Both dest and origin are in window coordinates, however, origin
@@ -489,13 +626,11 @@ void nxbe_bitmap_dev(FAR struct nxbe_window_s *wnd,
****************************************************************************/
#ifdef CONFIG_NX_RAMBACKED
void nxbe_bitmap(FAR struct nxbe_window_s *wnd,
void nxbe_flush(FAR struct nxbe_window_s *wnd,
FAR const struct nxgl_rect_s *dest,
FAR const void *src[CONFIG_NX_NPLANES],
FAR const struct nxgl_point_s *origin,
unsigned int stride);
#else
# define nxbe_bitmap(w,d,s,o,n) nxbe_bitmap_dev(w,d,s,o,n)
#endif
/****************************************************************************
+14 -8
View File
@@ -191,9 +191,9 @@ static inline void nxbe_bitmap_pwfb(FAR struct nxbe_window_s *wnd,
* device unconditionally.
*
* Input Parameters:
* wnd - The window that will receive the bitmap image
* dest - Describes the rectangular on the display that will receive the
* the bit map.
* wnd - The window that will receive the bitmap image
* dest - Describes the rectangular region on the display that will
* receive the the bit map.
* src - The start of the source image.
* origin - The origin of the upper, left-most corner of the full bitmap.
* Both dest and origin are in window coordinates, however, origin
@@ -291,9 +291,9 @@ void nxbe_bitmap_dev(FAR struct nxbe_window_s *wnd,
* and shadowed in the per-window framebuffer.
*
* Input Parameters:
* wnd - The window that will receive the bitmap image
* dest - Describes the rectangular on the display that will receive the
* the bit map.
* wnd - The window that will receive the bitmap image
* dest - Describes the rectangular region on the display that will
* receive the the bit map.
* src - The start of the source image.
* origin - The origin of the upper, left-most corner of the full bitmap.
* Both dest and origin are in window coordinates, however, origin
@@ -305,24 +305,30 @@ void nxbe_bitmap_dev(FAR struct nxbe_window_s *wnd,
*
****************************************************************************/
#ifdef CONFIG_NX_RAMBACKED
void nxbe_bitmap(FAR struct nxbe_window_s *wnd,
FAR const struct nxgl_rect_s *dest,
FAR const void *src[CONFIG_NX_NPLANES],
FAR const struct nxgl_point_s *origin,
unsigned int stride)
{
#ifdef CONFIG_NX_RAMBACKED
/* If this window supports a pre-window frame buffer then shadow the full,
* unclipped bitmap in that framebuffer.
*/
if (NXBE_ISRAMBACKED(wnd))
{
/* Update the per-window framebuffer */
nxbe_bitmap_pwfb(wnd, dest, src, origin, stride);
/* Overlay any update any sprites on the per-window frambuffer */
nxbe_sprite_refresh(wnd, dest);
}
#endif
/* Rend the bitmap directly to the graphics device in any case */
nxbe_bitmap_dev(wnd, dest, src, origin, stride);
}
#endif
+117
View File
@@ -0,0 +1,117 @@
/****************************************************************************
* graphics/nxbe/nxbe_cursor.c
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <assert.h>
#include "nxbe.h"
/****************************************************************************
* Public Functions
****************************************************************************/
#if defined(CONFIG_NX_SWCURSOR) || defined(CONFIG_NX_HWCURSOR)
/****************************************************************************
* Name: nxbe_cursor_enable
*
* Description:
* Enable/disable presentation of the cursor
*
* Input Parameters:
* be - The back-end state structure instance
* enable - True: show the cursor, false: hide the cursor.
*
* Returned Value:
* None
*
****************************************************************************/
void nxbe_cursor_enable(FAR struct nxbe_state_s *be, bool enable)
{
#warning Missing logic
}
/****************************************************************************
* Name: nxbe_cursor_setimage
*
* Description:
* Set the cursor image
*
* Input Parameters:
* be - The back-end state structure instance
* image - Describes the cursor image in the expected format. For a
* software cursor, this is the format used with the display. The
* format may be different if a hardware cursor is used.
*
* Returned Value:
* None
*
****************************************************************************/
#if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR)
void nxbe_cursor_setimage(FAR struct nxbe_state_s *be,
FAR struct cursor_image_s *image);
{
#warning Missing logic
}
#endif
/****************************************************************************
* Name: nxcursor_setposition
*
* Description:
* Move the cursor to the specified position
*
* Input Parameters:
* be - The back-end state structure instance
* pos - The new cursor position
*
* Returned Value:
* None
*
****************************************************************************/
void nxcursor_setposition(FAR struct nxbe_state_s *be,
FAR const struct cursor_pos_s *pos)
{
#warning Missing logic
}
#endif /* CONFIG_NX_SWCURSOR || CONFIG_NX_HWCURSOR */
+2 -2
View File
@@ -250,11 +250,11 @@ static inline void nxbe_filltrapezoid_pwfb(FAR struct nxbe_window_s *wnd,
break;
}
/* Copy the portion of the per-window framebuffer in the bounding box
/* Copy the portion of the per-window framebuffer in the bounding box
* to the device graphics memory.
*/
nxbe_bitmap_dev(wnd, &relbounds, src, &origin, wnd->stride);
nxbe_flush(wnd, &relbounds, src, &origin, wnd->stride);
}
#endif
+135
View File
@@ -0,0 +1,135 @@
/****************************************************************************
* graphics/nxbe/nxbe_flush.c
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/nx/nxglib.h>
#include <nuttx/nx/nxbe.h>
#include "nxbe.h"
#ifdef CONFIG_NX_RAMBACKED
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: nxbe_sprite_refresh
*
* Description:
* Prior to calling nxbe_bitmap_dev(), update any "sprites" tht need to
* be overlaid on the per-window frambuffer. This could include such
* things as OSD functionality, a software cursor, selection boxes, etc.
*
* Input Parameters (same as for nxbe_flush):
* wnd - The window that will receive the bitmap image
* dest - Describes the rectangular region on the display that was
* modified (in device coordinates)
*
* Returned Value:
* None
*
****************************************************************************/
#if 0 /* There are none yet */
void nxbe_sprite_refresh(FAR struct nxbe_window_s *wnd,
FAR const struct nxgl_rect_s *dest)
{
/* Sprite support has not yet been implemented */
}
#endif
/****************************************************************************
* Name: nxbe_flush
*
* Description:
* After per-window frambuffer has been updated, the modified region must
* be written to device graphics memory. That function is managed by this
* simple function. It does the following:
*
* 1) It calls nxbe_sprite_refresh() to update any "sprite" graphics on top
* of the RAM framebuffer. This could include such things as OSD
* functionality, a software cursor, selection boxes, etc.
* 2) Then it calls nxbe_bitmap_dev() to copy the modified per-window
* frambuffer into device memory.
*
* This the "sprite" image is always on top of the device display, this
* supports flicker-free software sprites.
*
* Input Parameters (same as for nxbe_flush):
* wnd - The window that will receive the bitmap image
* dest - Describes the rectangular on the display that will receive the
* the bit map.
* src - The start of the source image.
* origin - The origin of the upper, left-most corner of the full bitmap.
* Both dest and origin are in window coordinates, however, origin
* may lie outside of the display.
* stride - The width of the full source image in bytes.
*
* Returned Value:
* None
*
****************************************************************************/
void nxbe_flush(FAR struct nxbe_window_s *wnd,
FAR const struct nxgl_rect_s *dest,
FAR const void *src[CONFIG_NX_NPLANES],
FAR const struct nxgl_point_s *origin,
unsigned int stride)
{
/* Update any "sprite" graphics on top of the display. These may have been
* damaged by the preceding framebuffer update.
*/
nxbe_sprite_refresh(wnd, dest);
/* Copy the modified per-window frambuffer into device memory. Since the
* "sprite" graphics were refreshed after the update, then should be no
* flicker as you see with a direct update of the device graphics memory.
*/
nxbe_bitmap_dev(wnd, dest, src, origin, stride);
}
#endif /* CONFIG_NX_RAMBACKED */
+1 -1
View File
@@ -377,7 +377,7 @@ static inline void nxbe_move_pwfb(FAR struct nxbe_window_s *wnd,
* framebuffer to the destination rectangle device graphics memory.
*/
nxbe_bitmap_dev(wnd, &destrect, src, &origin, wnd->stride);
nxbe_flush(wnd, &destrect, src, &origin, wnd->stride);
}
#endif
+2 -2
View File
@@ -125,9 +125,9 @@ void nxmu_redrawreq(FAR struct nxbe_window_s *wnd,
break;
}
/* And render the bitmap */
/* And render the bitmap into device graphics memory */
nxbe_bitmap_dev(wnd, &wndrect, src, &origin, wnd->stride);
nxbe_flush(wnd, &wndrect, src, &origin, wnd->stride);
}
else
#endif
+24
View File
@@ -376,6 +376,30 @@ int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev)
}
break;
#if defined(CONFIG_NX_SWCURSOR) || defined(CONFIG_NX_HWCURSOR)
case NX_SVRMSG_CURSOR_ENABLE: /* Enable/disable cursor */
{
FAR struct nxsvrmsg_curenable_s *enabmsg = (FAR struct nxsvrmsg_curenable_s *)buffer;
nxbe_cursor_enable(&nxwm.be, enabmsg->enable);
}
break;
#if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR)
case NX_SVRMSG_CURSOR_IMAGE: /* Set cursor image */
{
FAR struct nxsvrmsg_curimage_s *imgmsg = (FAR struct nxsvrmsg_curimage_s *)buffer;
nxbe_cursor_setimage(&nxwm.be, imgmsg->image);
}
break;
#endif
case NX_SVRMSG_CURSOR_SETPOS: /* Set cursor position */
{
FAR struct nxsvrmsg_curpos_s *posmsg = (FAR struct nxsvrmsg_curpos_s *)buffer;
nxbe_cursor_setposition(&nxwm.be, &posmsg->pos);
}
break;
#endif
case NX_SVRMSG_REQUESTBKGD: /* Give access to the background window */
{
FAR struct nxsvrmsg_requestbkgd_s *rqbgmsg = (FAR struct nxsvrmsg_requestbkgd_s *)buffer;
+2 -2
View File
@@ -132,12 +132,12 @@ static int up_setcursor(FAR struct fb_vtable_s *vtable,
/* Current cursor position */
#ifdef CONFIG_FB_HWCURSOR
static struct fb_cursorpos_s g_cpos;
static struct cursor_pos_s g_cpos;
/* Current cursor size */
#ifdef CONFIG_FB_HWCURSORSIZE
static struct fb_cursorsize_s g_csize;
static struct cursor_size_s g_csize;
#endif
#endif
+154
View File
@@ -0,0 +1,154 @@
/****************************************************************************
* include/nuttx/nx/cursor.h
*
* Copyright (C) 2019 Gregory Nutt. All rights
* reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_NX_NXCURSOR_H
#define __INCLUDE_NUTTX_NX_NXCURSOR_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
#include <nuttx/video/cursor.h>
#ifndef defined(CONFIG_NX_SWCURSOR) || defined(CONFIG_NX_HWCURSOR)
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: nxcursor_enable
*
* Description:
* Enable/disable presentation of the cursor
*
* Input Parameters:
* hnd - The server handle returned by nx_connect()
* enable - True: show the cursor, false: hide the cursor.
*
* Returned Value:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
int nxcursor_enable(NXHANDLE hnd, bool enable);
/****************************************************************************
* Name: nxcursor_setimage
*
* Description:
* Set the cursor image.
*
* NOTE: The NX logic will reference the user image buffer repeatedly.
* That image buffer must persist for as long as the NX server connection
* persists.
*
* Input Parameters:
* hnd - The server handle returned by nx_connect()
* image - Describes the cursor image in the expected format. For a
* software cursor, this is the format used with the display. The
* format may be different if a hardware cursor is used.
*
* Returned Value:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
#if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR)
int nxcursor_setimage(NXHANDLE hnd, FAR struct cursor_image_s *image);
#endif
/****************************************************************************
* Name: nxcursor_setposition
*
* Description:
* Move the cursor to the specified position
*
* Input Parameters:
* hnd - The server handle returned by nx_connect()
* pos - The new cursor position
*
* Returned Value:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
int nxcursor_setposition(NXHANDLE hnd, FAR const struct cursor_pos_s *pos);
/****************************************************************************
* Name: nxcursor_get_position
*
* Description:
* Return the current cursor position.
*
* CAUTION: The current cursor position is not updated until the display
* is actually changed. Due to asynchronies caused by queue, the new
* current cursor position may not match the cursor position set until
* the client and server are syncrhonized.
*
* Input Parameters:
* hnd - The server handle returned by nx_connect()
* pos - The location to return the cursor position
*
* Returned Value:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
int nxcursor_get_position(NXHANDLE hnd, FAR struct cursor_pos_s *pos);
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* CONFIG_NX_SWCURSOR || CONFIG_NX_HWCURSOR */
#endif /* __INCLUDE_NUTTX_NX_NXCURSOR_H */
+31
View File
@@ -140,6 +140,9 @@ enum nxmsg_e
NX_SVRMSG_CLOSEWINDOW, /* Close an existing window */
NX_SVRMSG_BLOCKED, /* The window is blocked */
NX_SVRMSG_SYNCH, /* Window syncrhonization request */
NX_SVRMSG_CURSOR_ENABLE, /* Enable/disablel cursor presentation */
NX_SVRMSG_CURSOR_IMAGE, /* Set cursor image */
NX_SVRMSG_CURSOR_SETPOS, /* Set cursor position */
NX_SVRMSG_REQUESTBKGD, /* Open the background window */
NX_SVRMSG_RELEASEBKGD, /* Release the background window */
NX_SVRMSG_SETPOSITION, /* Window position has changed */
@@ -295,6 +298,34 @@ struct nxsvrmsg_synch_s
FAR void *arg; /* User argument */
};
#if defined(CONFIG_NX_SWCURSOR) || defined(CONFIG_NX_HWCURSOR)
/* Enable/disable cursor */
struct nxsvrmsg_curenable_s
{
uint32_t msgid; /* NX_SVRMSG_CURSOR_ENABLE */
bool enable; /* True: show the cursor, false: hide the cursor */
};
#if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR)
/* Set cursor image. */
struct nxsvrmsg_curimage_s
{
uint32_t msgid; /* NX_SVRMSG_CURSOR_IMAGE */
FAR struct cursor_image_s image /* True: show the cursor, false: hide the cursor */
};
#endif
/* Set cursor position. */
struct nxsvrmsg_curpos_s
{
uint32_t msgid; /* NX_SVRMSG_CURSOR_SETPOS */
FAR struct cursor_pos_s pos; /* The new cursor position */
};
#endif
/* This message requests the server to create a new window */
struct nxsvrmsg_requestbkgd_s
+93
View File
@@ -0,0 +1,93 @@
/****************************************************************************
* include/nuttx/video/cursor.h
*
* Copyright (C) 2008-2011, 2013, 2016-2019 Gregory Nutt. All rights
* reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_VIDEO_CURSOR_H
#define __INCLUDE_NUTTX_VIDEO_CURSOR_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
/****************************************************************************
* Pre-processor definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/* If any dimension of the display exceeds 65,536 pixels, then the following
* type will need to change. This should match the types of fb_coord_t and
* nxgl_coord_t.
*/
typedef uint16_t cursor_coord_t;
/* For cursor controllers that support custem cursor images, this structure
* is used to provide the cursor image.
*/
struct cursor_image_s
{
cursor_coord_t width; /* Width of the cursor image in pixels */
cursor_coord_t height; /* Height of the cursor image in pixels */
FAR const uint8_t *image; /* Pointer to bitmap image data */
};
/* The following structure defines the cursor position */
struct cursor_pos_s
{
cursor_coord_t x; /* X position in pixels */
cursor_coord_t y; /* Y position in rows */
};
/* If the hardware supports setting the cursor size, then this structure
* is used to provide the cursor size.
*/
struct cursor_size_s
{
cursor_coord_t h; /* Height in rows */
cursor_coord_t w; /* Width in pixels */
};
#endif /* __INCLUDE_NUTTX_VIDEO_CURSOR_H */
+12 -44
View File
@@ -34,8 +34,8 @@
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_VIDIO_FB_H
#define __INCLUDE_NUTTX_VIDIO_FB_H
#ifndef __INCLUDE_NUTTX_VIDEO_FB_H
#define __INCLUDE_NUTTX_VIDEO_FB_H
/****************************************************************************
* Included Files
@@ -45,7 +45,9 @@
#include <sys/types.h>
#include <stdint.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/video/cursor.h>
/****************************************************************************
* Pre-processor definitions
@@ -409,64 +411,30 @@ struct fb_cmap_s
};
#endif
/* If the video controller hardware supports a hardware cursor and
* that hardware cursor supports user-provided images, then the
* following structure may be used to provide the cursor image
*/
#ifdef CONFIG_FB_HWCURSOR
#ifdef CONFIG_FB_HWCURSORIMAGE
struct fb_cursorimage_s
{
fb_coord_t width; /* Width of the cursor image in pixels */
fb_coord_t height /* Height of the cursor image in pixels */
const uint8_t *image; /* Pointer to image data */
};
#endif
/* The following structure defines the cursor position/size */
struct fb_cursorpos_s
{
fb_coord_t x; /* X position in pixels */
fb_coord_t y; /* Y position in rows */
};
/* If the hardware supports setting the cursor size, then this structure
* is used to provide the size.
*/
#ifdef CONFIG_FB_HWCURSORSIZE
struct fb_cursorsize_s
{
fb_coord_t h; /* Height in rows */
fb_coord_t w; /* Width in pixels */
};
#endif
/* The following is used to get the cursor attributes */
/* The following are used to get/get the cursor attributes via IOCTL command. */
struct fb_cursorattrib_s
{
#ifdef CONFIG_FB_HWCURSORIMAGE
uint8_t fmt; /* Video format of cursor */
#endif
struct fb_cursorpos_s pos; /* Current cursor position */
struct cursor_pos_s pos; /* Current cursor position */
#ifdef CONFIG_FB_HWCURSORSIZE
struct fb_cursorsize_s mxsize; /* Maximum cursor size */
struct fb_cursorsize_s size; /* Current size */
struct cursor_size_s mxsize; /* Maximum cursor size */
struct cursor_size_s size; /* Current size */
#endif
};
struct fb_setcursor_s
{
uint8_t flags; /* See FB_CUR_* definitions */
struct fb_cursorpos_s pos; /* Cursor position */
struct cursor_pos_s pos; /* Cursor position */
#ifdef CONFIG_FB_HWCURSORSIZE
struct fb_cursorsize_s size; /* Cursor size */
struct cursor_size_s size; /* Cursor size */
#endif
#ifdef CONFIG_FB_HWCURSORIMAGE
struct fb_cursorimage_s img; /* Cursor image */
struct cursor_image_s img; /* Cursor image */
#endif
};
#endif
@@ -685,4 +653,4 @@ int fb_register(int display, int plane);
}
#endif
#endif /* __INCLUDE_NUTTX_VIDIO_FB_H */
#endif /* __INCLUDE_NUTTX_VIDEO_FB_H */
+6
View File
@@ -51,6 +51,12 @@ CSRCS += nx_getrectangle.c nx_lower.c nx_modal.c nx_move.c nx_openwindow.c
CSRCS += nx_raise.c nx_redrawreq.c nx_setpixel.c nx_setposition.c
CSRCS += nx_setsize.c
ifeq ($(CONFIG_NX_HWCURSOR),y)
CSRCS += nx_cursor.c
else ifeq ($(CONFIG_NX_SWCURSOR),y)
CSRCS += nx_cursor.c
endif
# Add the nxmu/ directory to the build
DEPPATH += --dep-path nxmu
+215
View File
@@ -0,0 +1,215 @@
/****************************************************************************
* libs/libnx/nxmu/nx_cursor.c
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <errno.h>
#include <nuttx/video/cursor.h>
#include <nuttx/nx/nxcursor.h>
#ifndef defined(CONFIG_NX_SWCURSOR) || defined(CONFIG_NX_HWCURSOR)
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: nxcursor_enable
*
* Description:
* Enable/disable presentation of the cursor
*
* Input Parameters:
* hnd - The server handle returned by nx_connect()
* enable - True: show the cursor, false: hide the cursor.
*
* Returned Value:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
int nxcursor_enable(NXHANDLE hnd, bool enable)
{
FAR struct nxmu_conn_s *conn = (FAR struct nxmu_conn_s *)handle;
struct nxsvrmsg_curenable_s outmsg;
int ret;
/* Send the cursor enable/disable message */
outmsg.msgid = NX_SVRMSG_CURSOR_ENABLE;
outmsg.enable = enable;
ret = nxmu_sendserver(conn, &outmsg, sizeof(struct nxsvrmsg_curenable_s));
if (ret < 0)
{
gerr("ERROR: nxmu_sendserver() returned %d\n", ret);
set_errno(-ret);
return ERROR
}
return OK;
}
/****************************************************************************
* Name: nxcursor_setimage
*
* Description:
* Set the cursor image.
*
* NOTE: The NX logic will reference the user image buffer repeatedly.
* That image buffer must persist for as long as the NX server connection
* persists.
*
* Input Parameters:
* hnd - The server handle returned by nx_connect()
* image - Describes the cursor image in the expected format. For a
* software cursor, this is the format used with the display. The
* format may be different if a hardware cursor is used.
*
* Returned Value:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
#if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR)
int nxcursor_setimage(NXHANDLE hnd, FAR struct cursor_image_s *image)
{
FAR struct nxmu_conn_s *conn = (FAR struct nxmu_conn_s *)handle;
struct nxsvrmsg_curimage_s outmsg;
int ret;
DEBUGASSERT(hnd != NULL && image != NULL);
/* Send the new cursor image to the server */
outmsg.msgid = NX_SVRMSG_CURSOR_IMAGE;
outmsg.image.width = image->width;
outmsg.image.height = image->height;
outmsg.image.image = image->image; /* The user pointer is sent, no data */
/* We will finish the teardown upon receipt of the DISCONNECTED message */
ret = nxmu_sendserver(conn, &outmsg, sizeof(struct nxsvrmsg_curimage_s));
if (ret < 0)
{
gerr("ERROR: nxmu_sendserver() returned %d\n", ret);
set_errno(-ret);
return ERROR
}
return OK;
}
#endif
/****************************************************************************
* Name: nxcursor_setposition
*
* Description:
* Move the cursor to the specified position
*
* Input Parameters:
* hnd - The server handle returned by nx_connect()
* pos - The new cursor position
*
* Returned Value:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
int nxcursor_setposition(NXHANDLE hnd, FAR const struct cursor_pos_s *pos)
{
FAR struct nxmu_conn_s *conn = (FAR struct nxmu_conn_s *)handle;
struct nxsvrmsg_curpos_s outmsg;
int ret;
DEBUGASSERT(hnd != NULL && pos != NULL);
/* Send the new cursor position to the server */
outmsg.msgid = NX_SVRMSG_CURSOR_SETPOS;
outmsg.pos.x = pos->x;
outmsg.pos.y = pos->y;
/* We will finish the teardown upon receipt of the DISCONNECTED message */
ret = nxmu_sendserver(conn, &outmsg, sizeof(struct nxsvrmsg_curpos_s));
if (ret < 0)
{
gerr("ERROR: nxmu_sendserver() returned %d\n", ret);
set_errno(-ret);
return ERROR
}
return OK;
}
/****************************************************************************
* Name: nxcursor_get_position
*
* Description:
* Return the current cursor position.
*
* CAUTION: The current cursor position is not updated until the display
* is actually changed. Due to asynchronies caused by queue, the new
* current cursor position may not match the cursor position set until
* the client and server are syncrhonized.
*
* Input Parameters:
* hnd - The server handle returned by nx_connect()
* pos - The location to return the cursor position
*
* Returned Value:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
int nxcursor_get_position(NXHANDLE hnd, FAR struct cursor_pos_s *pos)
{
/* REVISIT: The cursor position is not accessible from here. It is in hnd,
* be we don't have the definitions exposed to get it.
*/
#warning Missing logic
set_errno(ENOSYS);
return ERROR;
}
#endif /* __INCLUDE_NUTTX_NX_NXCURSOR_H */
+1 -1
View File
@@ -75,7 +75,7 @@ int nx_fill(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
struct nxsvrmsg_fill_s outmsg;
#ifdef CONFIG_DEBUG_FEATURES
if (!wnd || !rect || !color)
if (wnd == NULL || rect == NULL || color == NULL)
{
set_errno(EINVAL);
return ERROR;