static void nxhello_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, FAR const struct nxgl_point_s *pos, FAR const struct nxgl_rect_s *bounds, FAR void *arg) { /* Report the position */ gvdbg("hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n", hwnd, size->w, size->h, pos->x, pos->y, bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y); /* Have we picked off the window bounds yet? */ if (!g_nxhello.havepos) { /* Save the background window handle */ g_nxhello.hbkgd = hwnd; /* Save the window limits */ g_nxhello.xres = bounds->pt2.x + 1; g_nxhello.yres = bounds->pt2.y + 1; g_nxhello.havepos = true; sem_post(&g_nxhello.sem); gvdbg("Have xres=%d yres=%d\n", g_nxhello.xres, g_nxhello.yres); } }
static void dm320_disable(void) { /* Disable all planes */ gvdbg("Inactivate OSD:\n"); putreg16(0, DM320_OSD_OSDWIN0MD); /* Win0 mode = 0 (1:active) */ putreg16(0, DM320_OSD_OSDWIN1MD); /* Win1 mode = 0 (1:active) */ putreg16(0, DM320_OSD_RECTCUR); /* Rectangular cursor mode = 0 (1:active) */ gvdbg("DM320_OSD_OSDWIN0MD: %04x\n", getreg16(DM320_OSD_OSDWIN0MD)); gvdbg("DM320_OSD_OSDWIN1MD: %04x\n", getreg16(DM320_OSD_OSDWIN1MD)); gvdbg("DM320_OSD_RECTCUR: %04x\n", getreg16(DM320_OSD_RECTCUR)); }
int vnc_start_updater(FAR struct vnc_session_s *session) { pthread_attr_t attr; struct sched_param param; int status; gvdbg("Starting updater for Display %d\n", session->display); /* Create thread that is gonna send rectangles to the client */ session->state = VNCSERVER_RUNNING; DEBUGVERIFY(pthread_attr_init(&attr)); DEBUGVERIFY(pthread_attr_setstacksize(&attr, CONFIG_VNCSERVER_UPDATER_STACKSIZE)); param.sched_priority = CONFIG_VNCSERVER_UPDATER_PRIO; DEBUGVERIFY(pthread_attr_setschedparam(&attr, ¶m)); status = pthread_create(&session->updater, &attr, vnc_updater, (pthread_addr_t)session); if (status != 0) { return -status; } return OK; }
static int ssd1351_setpower(FAR struct lcd_dev_s *dev, int power) { FAR struct ssd1351_dev_s *priv = (FAR struct ssd1351_dev_s *)dev; /* Sanity check */ DEBUGASSERT(priv != NULL && (unsigned int)power <= LCD_FULL_ON); gvdbg("power: %d\n", power); /* Select and lock the device */ ssd1351_select(priv); if (power > LCD_FULL_OFF) { /* Turn the display on */ ssd1351_write(priv, SSD1351_CMD_DISPON, NULL, 0); priv->power = LCD_FULL_ON; } else { /* Turn the display off */ ssd1351_write(priv, SSD1351_CMD_DISPOFF, NULL, 0); priv->power = LCD_FULL_OFF; } /* Unlock and de-select the device */ ssd1351_deselect(priv); return OK; }
int nxtk_getwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect, unsigned int plane, FAR uint8_t *dest, unsigned int deststride) { FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd; struct nxgl_rect_s getrect; #ifdef CONFIG_DEBUG if (!hfwnd || !rect || !dest) { gvdbg("Invalid parameters\n"); set_errno(EINVAL); return ERROR; } #endif /* Move the rectangle to that it is relative to the containing * window. If part of the rectangle lies outside the window, * it will contain garbage data, but the contained area will be * valid. */ nxgl_rectoffset(&getrect, rect, fwnd->fwrect.pt1.x - fwnd->wnd.bounds.pt1.x, fwnd->fwrect.pt1.y - fwnd->wnd.bounds.pt1.y); /* Then get it */ return nx_getrectangle((NXWINDOW)hfwnd, &getrect, plane, dest, deststride); }
static int lcd_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno, FAR struct lcd_planeinfo_s *pinfo) { DEBUGASSERT(dev && pinfo && planeno == 0);gvdbg("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); return OK; }
static void nxhello_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, bool more, FAR void *arg) { gvdbg("hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n", hwnd, rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, more ? "true" : "false"); }
static void nxtk_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, FAR const struct nxgl_point_s *pos, FAR const struct nxgl_rect_s *bounds, FAR void *arg) { FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hwnd; struct nxgl_size_s subwindowsize; gvdbg("hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n", hwnd, size->w, size->h, pos->x, pos->y, bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y); /* Recalculate the dimensions of the toolbar and client windows */ nxtk_setsubwindows(fwnd); /* Report the size / position of the client sub-window */ if (fwnd->fwcb->position) { nxgl_rectsize(&subwindowsize, &fwnd->fwrect); fwnd->fwcb->position((NXTKWINDOW)fwnd, &subwindowsize, &fwnd->fwrect.pt1, bounds, fwnd->fwarg); } /* Report the size / position of the toolbar sub-window */ if (fwnd->tbcb && fwnd->tbcb->position) { nxgl_rectsize(&subwindowsize, &fwnd->tbrect); fwnd->tbcb->position((NXTKWINDOW)fwnd, &subwindowsize, &fwnd->tbrect.pt1, bounds, fwnd->tbarg); } }
int nx_start(void) { pid_t server; /* Start the server kernel thread */ gvdbg("Starting server task\n"); server = kernel_thread("NX Server", CONFIG_NXSTART_SERVERPRIO, CONFIG_NXSTART_SERVERSTACK, nx_server, NULL); if (server < 0) { int errcode = errno; DEBUGASSERT(errcode > 0); gdbg("ERROR: Failed to create nx_server kernel thread: %d\n", errcode); return -errcode; } /* Wait a bit to make sure that the server get started. NOTE that this * operation cannot be done from the IDLE thread! */ usleep(50*1000); return OK; }
static int lcd_setpower(struct lcd_dev_s *dev, int power) { uint16_t reg; if (g_lcddev.power == power) { return OK; } gvdbg("power: %d\n", power); DEBUGASSERT(power <= CONFIG_LCD_MAXPOWER); /* Set new power level */ reg = getreg16(ASIC_CONF_REG); if (power) { reg = getreg16(ASIC_CONF_REG); /* LCD Set I/O(3) / SA0 to I/O(3) mode */ reg &= ~( (1 << 12) | (1 << 10) | (1 << 7) | (1 << 1)) ; /* don't set function pins to I2C Mode, C155 uses UWire */ /* TWL3025: Set SPI+RIF RX clock to rising edge */ reg |= (1 << 13) | (1 << 14); putreg16(reg, ASIC_CONF_REG); /* LCD Set I/O(3) to output mode and enable C155 backlight (IO1) */ /* FIXME: Put the display backlight control to backlight.c */ reg = getreg16(IO_CNTL_REG); reg &= ~( (1 << 3) | (1 << 1)); putreg16(reg, IO_CNTL_REG); /* LCD Set I/O(3) output low */ reg = getreg16(ARMIO_LATCH_OUT); reg &= ~(1 << 3); reg |= (1 << 1); putreg16(reg, ARMIO_LATCH_OUT); } else { gvdbg("powering LCD off...\n"); /* Switch pin from PWL to LT */ reg &= ~ASCONF_PWL_ENA; putreg8(reg, ASIC_CONF_REG); /* Disable pwl */ putreg8(0x00, PWL_REG(PWL_CTRL)); } return OK; }
static int lcd_getvideoinfo(FAR struct lcd_dev_s *dev, FAR struct fb_videoinfo_s *vinfo) { DEBUGASSERT(dev && vinfo);gvdbg("fmt: %d xres: %d yres: %d nplanes: %d\n", g_videoinfo.fmt, g_videoinfo.xres, g_videoinfo.yres, g_videoinfo.nplanes); memcpy(vinfo, &g_videoinfo, sizeof(struct fb_videoinfo_s)); return OK; }
static int dm320_getcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_cursorattrib_s *attrib) { irqstate_t flags; #ifdef CONFIG_DEBUG if (!vtable || !attrib) { return -EINVAL; } #endif flags = enter_critical_section(); attrib->pos.x = getreg16(DM320_OSD_CURXP); attrib->pos.y = getreg16(DM320_OSD_CURYP); #ifdef CONFIG_FB_HWCURSORSIZE attrib->size.w = getreg16(DM320_OSD_CURXL); attrib->size.h = getreg16(DM320_OSD_CURYL); #endif leave_critical_section(flags); attrib->mxsize.w = MAX_XRES; attrib->mxsize.h = MAX_YRES; gvdbg("DM320_OSD_CURXP: %04x\n", attrib->pos.x); gvdbg("DM320_OSD_CURYP: %04x\n", attrib->pos.y); #ifdef CONFIG_FB_HWCURSORSIZE gvdbg("DM320_OSD_CURXL: %04x\n", attrib->size.w); gvdbg("DM320_OSD_CURYL: %04x\n", attrib->size.h); #else gvdbg("DM320_OSD_CURXL: %04x\n", getreg16(DM320_OSD_CURXL)); gvdbg("DM320_OSD_CURYL: %04x\n", getreg16(DM320_OSD_CURYL)); #endif gvdbg("DM320_OSD_RECTCUR: %04x\n", getreg16(DM320_OSD_RECTCUR)); }
/************************************************************************************** * Name: lcd_lcdinitialize * * Description: * Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST). * **************************************************************************************/ static inline void lcd_initialize(void) { gvdbg("%s: initializing LCD.\n",__FUNCTION__); calypso_reset_set(RESET_EXT, 0); usleep(5000); uwire_init(); usleep(5000); fb_ssd1783_send_cmdlist(ssd1783_initdata); }
int up_fbinitialize(void) { int ret; gvdbg("Allocating framebuffers\n"); ret = dm320_allocvideomemory(); if (ret != 0) { gdbg("Failed to allocate video buffers\n"); return ret; } /* Initialize the hardware */ gvdbg("Initializing hardware\n"); dm320_hwinitialize(); return 0; }
static void nxtool_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, FAR const struct nxgl_point_s *pos, FAR const struct nxgl_rect_s *bounds, FAR void *arg) { gvdbg("hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n", hwnd, size->w, size->h, pos->x, pos->y, bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y); }
static void nxhello_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, FAR void *arg) { gvdbg("hwnd=%p nch=%d\n", hwnd, nch); /* In this example, there is no keyboard so a keyboard event is not * expected. */ message("nxhello_kbdin: Unexpected keyboard callback\n"); }
int up_lcdinitialize(void) { gvdbg("Initializing\n"); lcd_initialize(); /* Clear the display */ lcd_clear(); return OK; }
static FAR void *vnc_updater(FAR void *arg) { FAR struct vnc_session_s *session = (FAR struct vnc_session_s *)arg; FAR struct vnc_fbupdate_s *srcrect; int ret; DEBUGASSERT(session != NULL); gvdbg("Updater running for Display %d\n", session->display); /* Loop, processing updates until we are asked to stop. * REVISIT: Probably need some kind of signal mechanism to wake up * vnc_remove_queue() in order to stop. Or perhaps a special STOP * message in the queue? */ while (session->state == VNCSERVER_RUNNING) { /* Get the next queued rectangle update. This call will block until an * upate is available for the case where the update queue is empty. */ srcrect = vnc_remove_queue(session); DEBUGASSERT(srcrect != NULL); updvdbg("Dequeued {(%d, %d),(%d, %d)}\n", srcrect->rect.pt1.x, srcrect->rect.pt1.y, srcrect->rect.pt2.x, srcrect->rect.pt2.y); /* Attempt to use RRE encoding */ ret = vnc_rre(session, &srcrect->rect); if (ret == 0) { /* Perform the framebuffer update using the default RAW encoding */ ret = vnc_raw(session, &srcrect->rect); } /* Release the update structure */ vnc_free_update(session, srcrect); /* Break out and terminate the server if the encoding failed */ if (ret < 0) { gdbg("ERROR: Encoding failed: %d\n", ret); break; } } session->state = VNCSERVER_STOPPED; return NULL; }
static int ssd1351_getpower(FAR struct lcd_dev_s *dev) { FAR struct ssd1351_dev_s *priv = (FAR struct ssd1351_dev_s *)dev; /* Sanity check */ DEBUGASSERT(priv != NULL); gvdbg("power: %d\n", priv->power); return priv->power; }
static void nxsu_bkgdredraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, bool more, FAR void *arg) { FAR struct nxbe_window_s *wnd = (FAR struct nxbe_window_s *)hwnd; FAR struct nxbe_state_s *be = wnd->be; gvdbg("BG redraw rect={(%d,%d),(%d,%d)}\n", rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y); nxbe_fill(wnd, &wnd->bounds, be->bgcolor); }
void nxcon_redraw(NXCONSOLE handle, FAR const struct nxgl_rect_s *rect, bool more) { FAR struct nxcon_state_s *priv; int ret; int i; DEBUGASSERT(handle && rect); gvdbg("rect={(%d,%d),(%d,%d)} more=%s\n", rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, more ? "true" : "false"); /* Recover our private state structure */ priv = (FAR struct nxcon_state_s *)handle; /* Get exclusive access to the state structure */ do { ret = nxcon_semwait(priv); /* Check for errors */ if (ret < 0) { /* The only expected error is if the wait failed because of it * was interrupted by a signal. */ DEBUGASSERT(errno == EINTR); } } while (ret < 0); /* Fill the rectangular region with the window background color */ ret = priv->ops->fill(priv, rect, priv->wndo.wcolor); if (ret < 0) { gdbg("fill failed: %d\n", errno); } /* Then redraw each character on the display (Only the characters within * the rectangle will actually be redrawn). */ for (i = 0; i < priv->nchars; i++) { nxcon_fillchar(priv, rect, &priv->bm[i]); } (void)nxcon_sempost(priv); }
static int ssd1351_getvideoinfo(FAR struct lcd_dev_s *dev, FAR struct fb_videoinfo_s *vinfo) { DEBUGASSERT(dev != NULL && vinfo != NULL); vinfo->fmt = SSD1351_COLORFMT; vinfo->xres = SSD1351_XRES; vinfo->yres = SSD1351_YRES; vinfo->nplanes = 1; gvdbg("fmt: %u xres: %u yres: %u nplanes: %u\n", vinfo->fmt, vinfo->xres, vinfo->yres, vinfo->nplanes); return OK; }
static int ssd1351_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno, FAR struct lcd_planeinfo_s *pinfo) { FAR struct ssd1351_dev_s *priv = (FAR struct ssd1351_dev_s *)dev; DEBUGASSERT(dev != NULL && pinfo != NULL && planeno == 0); pinfo->putrun = ssd1351_putrun; pinfo->getrun = ssd1351_getrun; pinfo->buffer = (uint8_t *)priv->runbuffer; pinfo->bpp = SSD1351_BPP; gvdbg("planeno: %u bpp: %u\n", planeno, pinfo->bpp); return OK; }
static void nxtool_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, bool more, FAR void *arg) { nxgl_mxpixel_t color[CONFIG_NX_NPLANES]; int ret; gvdbg("hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n", hwnd, rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, more ? "true" : "false"); color[0] = CONFIG_EXAMPLES_NXCON_TBCOLOR; ret = nxtk_filltoolbar(hwnd, rect, color); if (ret < 0) { gdbg("nxtk_filltoolbar failed: %d\n", errno); } }
static int ovr2640_chipid(FAR struct i2c_dev_s *i2c) { uint8_t pidl; uint8_t pidh; #ifdef CONFIG_DEBUG_GRAPHICS uint8_t midh; uint8_t midl; #endif int ret; /* Check and show product ID and manufacturer ID */ ret = ov2640_putreg(i2c, 0xff, 0x01); /* Select the sensor address bank */ if (ret < 0) { gdbg("ERROR: ov2640_putreg failed: %d\n", ret); return ret; } pidl = ov2640_getreg(i2c, 0x0a); /* Product ID (MS) */ pidh = ov2640_getreg(i2c, 0x0b); /* Product ID (LS) */ #ifdef CONFIG_DEBUG_GRAPHICS midh = ov2640_getreg(i2c, 0x1c); /* Manufacturer ID (high) = 0x7f */ midl = ov2640_getreg(i2c, 0x1d); /* Manufacturer ID (low) = 0xa2 */ #endif if (pidl != OVR2640_PRODUCT_IDL || pidh != OVR2640_PRODUCT_IDH) { gdbg("ERROR: Unsupported PID=%02x$02x MID=%02x%02x\n", pidh, pidl, midh, midl); return -ENOSYS; } gvdbg("PID=%02x$02x MID=%02x%02x\n", pidh, pidl, midh, midl); return OK; }
static void nxtk_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, bool more, FAR void *arg) { FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hwnd; struct nxgl_rect_s intersection; DEBUGASSERT(hwnd && rect && fwnd->fwcb); gvdbg("hwnd=%p rect={(%d,%d),(%d,%d)} more=%d\n", hwnd, rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, more); /* The incoming rectangle (rect) is relative to the containing window * (i.e., (0,0) is the top left corner of the outer, containing window). * If any part of the rectangle overlaps the client sub-window region, then * forward the redraw callback. */ if (fwnd->fwcb->redraw) { /* Clip the redraw rectangle so that it lies within the client sub-window * bounds and move the rectangle to that it is relative to the client * sub-window (i.e., (0,0) is the top left corner of the client sub-window). */ nxtk_containerclip(fwnd, &intersection, rect, &fwnd->fwrect); gvdbg("fwrect intersection={(%d,%d),(%d,%d)}\n", intersection.pt1.x, intersection.pt1.y, intersection.pt2.x, intersection.pt2.y); if (!nxgl_nullrect(&intersection)) { fwnd->fwcb->redraw((NXTKWINDOW)fwnd, &intersection, false, fwnd->fwarg); } } /* If any part of the rectangle overlaps the client toolbar region, then * forward the redraw callback. */ if (fwnd->tbcb && fwnd->tbcb->redraw) { /* Clip the redraw rectangle so that it lies within the toolbar sub-window * bounds and move the rectangle to that it is relative to the toolbar * sub-window (i.e., (0,0) is the top left corner of the client sub-window). */ nxtk_containerclip(fwnd, &intersection, rect, &fwnd->tbrect); gvdbg("tbrect intersection={(%d,%d),(%d,%d)}\n", intersection.pt1.x, intersection.pt1.y, intersection.pt2.x, intersection.pt2.y); if (!nxgl_nullrect(&intersection)) { fwnd->tbcb->redraw((NXTKWINDOW)fwnd, &intersection, false, fwnd->tbarg); } } /* Then draw the frame */ nxtk_drawframe(fwnd, rect); }
static inline int ov2640_camera_initialize(void) { FAR struct i2c_dev_s *i2c; uint32_t actual; int ret; /* Get the I2C driver that interfaces with the camers (OV2640_BUS)*/ i2c = up_i2cinitialize(OV2640_BUS); if (!i2c) { gdbg("ERROR: Failed to initialize TWI%d\n", OV2640_BUS); return EXIT_FAILURE; } /* Enable clocking to the ISI peripheral */ sam_isi_enableclk(); /* Configure OV2640 pins * * ISI: * - HSYNC, VSYNC, PCK * - 8 data bits for 8-bit color * PCK * - PCK1 provides OV2640 system clock */ sam_configpio(PIO_ISI_HSYNC); sam_configpio(PIO_ISI_VSYNC); sam_configpio(PIO_ISI_PCK); sam_configpio(PIO_ISI_D0); sam_configpio(PIO_ISI_D1); sam_configpio(PIO_ISI_D2); sam_configpio(PIO_ISI_D3); sam_configpio(PIO_ISI_D4); sam_configpio(PIO_ISI_D5); sam_configpio(PIO_ISI_D6); sam_configpio(PIO_ISI_D7); sam_configpio(PIO_PMC_PCK1); /* Configure and enable the PCK1 output */ actual = sam_pck_configure(PCK1, OV2640_FREQUENCY); gvdbg("Desired PCK1 frequency: %ld Actual: %ld\n", (long)OV2640_FREQUENCY, (long)actual); sam_pck_enable(PCK1, true); /* Configure the ISI peripheral */ #warning Missing Logic /* Initialize the OV2640 camera */ ret = ov2640_initialize(i2c); if (ret < 0) { gdbg("ERROR: Failed to initialize the OV2640: %d\n", ret); return EXIT_FAILURE; } return EXIT_FAILURE; }
static int dm320_setcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_setcursor_s *settings) { irqstate_t flags; uint16_t regval; #ifdef CONFIG_DEBUG if (!vtable || !settings) { return -EINVAL; } #endif /* Set cursor position */ flags = enter_critical_section(); if ((settings->flags & FB_CUR_SETPOSITION) != 0) { gvdbg("x=%d y=%d\n", settings->pos.x, settings->pos.y); if (settings->pos.x > MAX_YRES) { settings->pos.x = MAX_YRES; } if (settings->pos.y > MAX_YRES) { settings->pos.y = MAX_YRES; } putreg16(settings->pos.x, DM320_OSD_CURXP); putreg16(settings->pos.y, DM320_OSD_CURYP); } #ifdef CONFIG_FB_HWCURSORSIZE if ((settings->flags & FB_CUR_SETSIZE) != 0) { gvdbg("h=%d w=%d\n", settings->size.h, settings->size.w); if (settings->size.w > MAX_YRES) { settings->size.w = MAX_YRES; } if (settings->size.h > MAX_YRES) { settings->size.h = MAX_YRES; } putreg16(settings->size.w, DM320_OSD_CURXL); putreg16(settings->size.h, DM320_OSD_CURYL); } #endif regval = getreg16(DM320_OSD_RECTCUR); if ((settings->flags & FB_CUR_ENABLE) != 0) { regval |= 1; } else { regval &= ~1; } putreg16(regval, DM320_OSD_RECTCUR); leave_critical_section(flags); gvdbg("DM320_OSD_CURXP: %04x\n", getreg16(DM320_OSD_CURXP)); gvdbg("DM320_OSD_CURYP: %04x\n", getreg16(DM320_OSD_CURYP)); gvdbg("DM320_OSD_CURXL: %04x\n", getreg16(DM320_OSD_CURXL)); gvdbg("DM320_OSD_CURYL: %04x\n", getreg16(DM320_OSD_CURYL)); gvdbg("DM320_OSD_RECTCUR: %04x\n", getreg16(DM320_OSD_RECTCUR)); }
int nxcon_server(int argc, char *argv[]) { FAR NX_DRIVERTYPE *dev; int ret; #if defined(CONFIG_EXAMPLES_NXCON_EXTERNINIT) /* Use external graphics driver initialization */ message("nxcon_server: Initializing external graphics device\n"); dev = up_nxdrvinit(CONFIG_EXAMPLES_NXCON_DEVNO); if (!dev) { message("nxcon_server: up_nxdrvinit failed, devno=%d\n", CONFIG_EXAMPLES_NXCON_DEVNO); return ERROR; } #elif defined(CONFIG_NX_LCDDRIVER) /* Initialize the LCD device */ message("nxcon_server: Initializing LCD\n"); ret = up_lcdinitialize(); if (ret < 0) { message("nxcon_server: up_lcdinitialize failed: %d\n", -ret); return 1; } /* Get the device instance */ dev = up_lcdgetdev(CONFIG_EXAMPLES_NXCON_DEVNO); if (!dev) { message("nxcon_server: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NXCON_DEVNO); return 2; } /* Turn the LCD on at 75% power */ (void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4)); #else /* Initialize the frame buffer device */ message("nxcon_server: Initializing framebuffer\n"); ret = up_fbinitialize(); if (ret < 0) { message("nxcon_server: up_fbinitialize failed: %d\n", -ret); return 1; } dev = up_fbgetvplane(CONFIG_EXAMPLES_NXCON_VPLANE); if (!dev) { message("nxcon_server: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXCON_VPLANE); return 2; } #endif /* Then start the server */ ret = nx_run(dev); gvdbg("nx_run returned: %d\n", errno); return 3; }
static void dm320_hwinitialize(void) { /* Disable all planes */ dm320_disable(); /* Initialize the main video to correct the origin */ gvdbg("Setup main video origin:\n"); putreg16(CONFIG_DM320_BASEX, DM320_OSD_BASEPX); putreg16(CONFIG_DM320_BASEY, DM320_OSD_BASEPY); gvdbg("DM320_OSD_BASEPX: %04x\n", getreg16(DM320_OSD_BASEPX)); gvdbg("DM320_OSD_BASEPY: %04x\n", getreg16(DM320_OSD_BASEPY)); /* Set up the frame buffer address registers */ gvdbg("Setup framebuffer addresses:\n"); putreg16(((dm320_osd1upperoffset() << 8) | dm320_osd0upperoffset()), DM320_OSD_OSDWINADH); putreg16(dm320_osd0loweroffset(), DM320_OSD_OSDWIN0ADL); putreg16(dm320_osd1loweroffset(), DM320_OSD_OSDWIN1ADL); gvdbg("DM320_OSD_OSDWINADH: %04x\n", getreg16(DM320_OSD_OSDWINADH)); gvdbg("DM320_OSD_OSDWIN0ADL: %04x\n", getreg16(DM320_OSD_OSDWIN0ADL)); gvdbg("DM320_OSD_OSDWIN1ADL: %04x\n", getreg16(DM320_OSD_OSDWIN1ADL)); /* Set up VID WIN0 */ #if defined(CONFIG_DM320_VID0_DISABLE) || defined(CONFIG_DM320_VID1_DISABLE) putreg16(((dm320_vid1upperoffset() << 8) | dm320_vid0upperoffset()), DM320_OSD_VIDWINADH); #endif #ifndef CONFIG_DM320_VID0_DISABLE gvdbg("Initialize video win0:\n"); putreg16(dm320_vid0loweroffset(), DM320_OSD_VIDWIN0ADL); gvdbg("DM320_OSD_VIDWINADH: %04x\n", getreg16(DM320_OSD_VIDWINADH)); gvdbg("DM320_OSD_VIDWIN0ADL: %04x\n", getreg16(DM320_OSD_VIDWIN0ADL)); dm320_blankscreen((uint8_t *)g_vid0base, DM320_VID0_FBLEN); #ifndef CONFIG_DM320_DISABLE_PINGPONG putreg16(dm320_vid0ppupperoffset(), DM320_OSD_PPVWIN0ADH); putreg16(dm320_vid0pploweroffset(), DM320_OSD_PPVWIN0ADL); gvdbg("DM320_OSD_PPVWIN0ADH: %04x\n", getreg16(DM320_OSD_PPVWIN0ADH)); gvdbg("DM320_OSD_PPVWIN0ADL: %04x\n", getreg16(DM320_OSD_PPVWIN0ADL)); dm320_blankscreen((uint8_t *)g_vid0ppbase, DM320_VID0_FBLEN); #endif putreg16(CONFIG_DM320_VID0_XPOS, DM320_OSD_VIDWIN0XP); putreg16(CONFIG_DM320_VID0_YPOS, DM320_OSD_VIDWIN0YP); putreg16((CONFIG_DM320_VID0_XRES >> 4), DM320_OSD_VIDWIN0OFST); putreg16(CONFIG_DM320_VID0_XRES, DM320_OSD_VIDWIN0XL); putreg16(CONFIG_DM320_VID0_YRES, DM320_OSD_VIDWIN0YL); gvdbg("DM320_OSD_VIDWIN0XP: %04x\n", getreg16(DM320_OSD_VIDWIN0XP)); gvdbg("DM320_OSD_VIDWIN0YP: %04x\n", getreg16(DM320_OSD_VIDWIN0YP)); gvdbg("DM320_OSD_VIDWIN0OFST: %04x\n", getreg16(DM320_OSD_VIDWIN0OFST)); gvdbg("DM320_OSD_VIDWIN0XL: %04x\n", getreg16(DM320_OSD_VIDWIN0XL)); gvdbg("DM320_OSD_VIDWIN0YL: %04x\n", getreg16(DM320_OSD_VIDWIN0YL)); #endif /* Set up VID WIN1 */ #ifndef CONFIG_DM320_VID1_DISABLE gvdbg("Initialize video win1:\n"); putreg16(dm320_vid1loweroffset(), DM320_OSD_VIDWIN1ADL); gvdbg("DM320_OSD_VIDWINADH: %04x\n", getreg16(DM320_OSD_VIDWINADH)); gvdbg("DM320_OSD_VIDWIN1ADL: %04x\n", getreg16(DM320_OSD_VIDWIN1ADL)); dm320_blankscreen((uint8_t *)g_vid1base, DM320_VID1_FBLEN); putreg16(CONFIG_DM320_VID1_XPOS, DM320_OSD_VIDWIN1XP); putreg16(CONFIG_DM320_VID1_XPOS, DM320_OSD_VIDWIN1YP); putreg16((CONFIG_DM320_VID1_XRES >> 4), DM320_OSD_VIDWIN1OFST); putreg16(CONFIG_DM320_VID1_XRES, DM320_OSD_VIDWIN1XL); putreg16(CONFIG_DM320_VID1_YRES, DM320_OSD_VIDWIN1YL); gvdbg("DM320_OSD_VIDWIN1XP: %04x\n", getreg16(DM320_OSD_VIDWIN1XP)); gvdbg("DM320_OSD_VIDWIN1YP: %04x\n", getreg16(DM320_OSD_VIDWIN1YP)); gvdbg("DM320_OSD_VIDWIN1OFST: %04x\n", getreg16(DM320_OSD_VIDWIN1OFST)); gvdbg("DM320_OSD_VIDWIN1XL: %04x\n", getreg16(DM320_OSD_VIDWIN1XL)); gvdbg("DM320_OSD_VIDWIN1YL: %04x\n", getreg16(DM320_OSD_VIDWIN1YL)); #endif putreg16(DM320_VIDMODE, DM320_OSD_VIDWINMD); gvdbg("DM320_OSD_VIDWINMD: %04x\n", getreg16(DM320_OSD_VIDWINMD)); /* Set up OSD WIN0 */ #ifndef CONFIG_DM320_OSD0_DISABLE gvdbg("Initialize OSD win0:\n"); dm320_blankscreen((uint8_t *)g_osd0base, DM320_OSD0_FBLEN); putreg16(CONFIG_DM320_OSD0_XPOS, DM320_OSD_OSDWIN0XP); putreg16(CONFIG_DM320_OSD0_YPOS, DM320_OSD_OSDWIN0YP); #ifdef CONFIG_DM320_OSD1_RGB16 putreg16((CONFIG_DM320_OSD0_XRES >> 4), DM320_OSD_OSDWIN0OFST); #else putreg16((CONFIG_DM320_OSD0_XRES >> 5), DM320_OSD_OSDWIN0OFST); #endif putreg16(CONFIG_DM320_OSD0_XRES, DM320_OSD_OSDWIN0XL); putreg16(CONFIG_DM320_OSD0_YRES, DM320_OSD_OSDWIN0YL); putreg16(INITIAL_OSD0MODE, DM320_OSD_OSDWIN0MD); gvdbg("DM320_OSD_OSDWIN0XP: %04x\n", getreg16(DM320_OSD_OSDWIN0XP)); gvdbg("DM320_OSD_OSDWIN0YP: %04x\n", getreg16(DM320_OSD_OSDWIN0YP)); gvdbg("DM320_OSD_OSDWIN0OFST: %04x\n", getreg16(DM320_OSD_OSDWIN0OFST)); gvdbg("DM320_OSD_OSDWIN0XL: %04x\n", getreg16(DM320_OSD_OSDWIN0XL)); gvdbg("DM320_OSD_OSDWIN0YL: %04x\n", getreg16(DM320_OSD_OSDWIN0YL)); gvdbg("DM320_OSD_OSDWIN0MD: %04x\n", getreg16(DM320_OSD_OSDWIN0MD)); #endif /* Set up OSD WIN1 */ #ifndef CONFIG_DM320_OSD1_DISABLE gvdbg("Initialize OSD win1\n"); dm320_blankscreen((uint8_t *)g_osd1base, DM320_OSD1_FBLEN); putreg16(CONFIG_DM320_OSD1_XPOS, DM320_OSD_OSDWIN1XP); putreg16(CONFIG_DM320_OSD1_YPOS, DM320_OSD_OSDWIN1YP); #ifdef CONFIG_DM320_OSD1_RGB16 putreg16((CONFIG_DM320_OSD1_XRES >> 4), DM320_OSD_OSDWIN1OFST); #else putreg16((CONFIG_DM320_OSD1_XRES >> 5), DM320_OSD_OSDWIN1OFST); #endif putreg16(CONFIG_DM320_OSD1_XRES, DM320_OSD_OSDWIN1XL); putreg16(CONFIG_DM320_OSD1_YRES, DM320_OSD_OSDWIN1YL); putreg16(INITIAL_OSD1MODE, DM320_OSD_OSDWIN1MD); gvdbg("DM320_OSD_OSDWIN1XP: %04x\n", getreg16(DM320_OSD_OSDWIN1XP)); gvdbg("DM320_OSD_OSDWIN1YP: %04x\n", getreg16(DM320_OSD_OSDWIN1YP)); gvdbg("DM320_OSD_OSDWIN1OFST: %04x\n", getreg16(DM320_OSD_OSDWIN1OFST)); gvdbg("DM320_OSD_OSDWIN1XL: %04x\n", getreg16(DM320_OSD_OSDWIN1XL)); gvdbg("DM320_OSD_OSDWIN1YL: %04x\n", getreg16(DM320_OSD_OSDWIN1YL)); gvdbg("DM320_OSD_OSDWIN1MD: %04x\n", getreg16(DM320_OSD_OSDWIN1MD)); #endif /* Set up the rectangular cursor with defaults */ #ifdef CONFIG_FB_HWCURSOR gdbg("Initialize rectangular cursor\n"); putreg16(0, DM320_OSD_CURXP); putreg16(0, DM320_OSD_CURYP); putreg16(CONFIG_DM320_RECTCURSOR_WIDTH, DM320_OSD_CURXL); putreg16(CONFIG_DM320_RECTCURSOR_HEIGHT, DM320_OSD_CURYL); /* DM320_RECTCURSOR_SETUP: * * Bit 0: 0=rectangular cursor inactive 1=on 0 * Bits 113: Vertical line height: {1,2,4,6,8,10,12,14} CONFIG_DM320_CURSORLINEHEIGHT * 4:6: Horizontal line width: {1,4,8,16,20,24,28} CONFIG_DM320_CURSORLINEWIDTH * 7: 0=ROM lookup table, 1=RAM lookup table 0 * 8:15: Rectangular cursor color pallette address CONFIG_DM320_CURSORCLUT */ putreg16(DM320_RECTCURSOR_SETUP, DM320_OSD_RECTCUR); gvdbg("DM320_OSD_CURXP: %04x\n", getreg16(DM320_OSD_CURXP)); gvdbg("DM320_OSD_CURYP: %04x\n", getreg16(DM320_OSD_CURYP)); gvdbg("DM320_OSD_CURXL: %04x\n", getreg16(DM320_OSD_CURXL)); gvdbg("DM320_OSD_CURYL: %04x\n", getreg16(DM320_OSD_CURYL)); gvdbg("DM320_OSD_RECTCUR: %04x\n", getreg16(DM320_OSD_RECTCUR)); #endif /* Set main window to the hardware default state. That initial * state is: * * FIELD SETTING * Bits 0-7: background color clut CONFIG_DM320_BKGDCLUT * Bit 8: background clut 0=ROM 1=RAM 0 * Bit 9: field signal 0=normal 1=inverted 0 * Bit 10: vid window H expansion: 1=x9/8 0 * Bit 11: vid window V expansion: 1=x6/5 0 * Bit 12: expansion filter 0=off 1=on 0 * Bit 13: osd window H expansion: 1=x9/8 0 * Bit 14: osd window V expansion: 1=x6/5 0 * Bit 1515: 0=offset binary, 1=complement of 2 0 */ putreg16(CONFIG_DM320_BKGDCLUT, DM320_OSD_OSDMODE); gvdbg("DM320_OSD_OSDMODE: %04x\n", getreg16(DM320_OSD_OSDMODE)); }