1117N/A/*
1385N/A * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
1117N/A *
1117N/A * Permission is hereby granted, free of charge, to any person obtaining a
1117N/A * copy of this software and associated documentation files (the "Software"),
1117N/A * to deal in the Software without restriction, including without limitation
1117N/A * the rights to use, copy, modify, merge, publish, distribute, sublicense,
1117N/A * and/or sell copies of the Software, and to permit persons to whom the
1117N/A * Software is furnished to do so, subject to the following conditions:
1117N/A *
1117N/A * The above copyright notice and this permission notice (including the next
1117N/A * paragraph) shall be included in all copies or substantial portions of the
1117N/A * Software.
1117N/A *
1117N/A * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1117N/A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1117N/A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
1117N/A * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1117N/A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1117N/A * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1117N/A * DEALINGS IN THE SOFTWARE.
1117N/A */
1117N/A
1117N/A#ifndef _LIBVTSSUNWAST_H
1117N/A#define _LIBVTSSUNWAST_H
1117N/A
1385N/A#include <sys/types.h>
1385N/A#include <sys/param.h> /* MAXPATHLEN */
1385N/A#include <errno.h>
1385N/A#include <memory.h>
1385N/A#include <signal.h>
1385N/A#include <stdio.h>
1385N/A#include <stdlib.h>
1385N/A#include <string.h>
1385N/A#include <unistd.h>
1385N/A#include <setjmp.h>
1385N/A#include <stropts.h> /* ioctl() */
1385N/A#include <sys/fbio.h>
1385N/A#include <sys/mman.h>
1385N/A#include <sys/systeminfo.h> /* sysinfo() */
1385N/A#include <sys/pci.h>
1385N/A#include <sys/time.h>
1385N/A#include <sys/visual_io.h>
1385N/A#include <X11/Xmd.h>
1385N/A#include <X11/Xlib.h>
1385N/A#include <X11/Xutil.h>
1385N/A#include <X11/extensions/dpms.h>
1117N/A#include "libvtsSUNWxfb.h" /* Common VTS library definitions */
1385N/A#undef Status
1385N/A#define Status pciStatus
1385N/A#include "gfx_common.h"
1385N/A#undef Status
1385N/A#define Status int
1385N/A#include "graphicstest.h"
1385N/A#include "gfx_vts.h"
1385N/A
1117N/A#include "astio.h"
1385N/A#include "ast.h"
1385N/A
1385N/A#define VIS_TEXT 0 /* Use text mode when displaying data */
1385N/A#define VIS_PIXEL 1 /* Use pixel mode when displaying data */
1385N/A
1385N/Atypedef struct ast_info {
1385N/A char const *ast_name;
1385N/A int ast_fd;
1385N/A uint16_t ast_vendor;
1385N/A uint16_t ast_device;
1385N/A offset_t ast_fb_addr;
1385N/A size_t ast_fb_size;
1385N/A uchar_t *ast_fb_ptr;
1385N/A offset_t ast_mmio_addr;
1385N/A size_t ast_mmio_size;
1385N/A uchar_t *ast_mmio_ptr;
1385N/A offset_t ast_relocate_io;
1385N/A int ast_endian;
1385N/A uchar_t ast_pcicr2;
1385N/A uint_t ast_remap_base;
1385N/A uint_t ast_prot_key;
1385N/A uchar_t ast_misc_control;
1385N/A uint_t ast_mode;
1385N/A uint_t ast_width;
1385N/A uint_t ast_height;
1385N/A uint_t ast_depth;
1385N/A uint_t ast_pixelsize;
1385N/A uint_t ast_linesize;
1385N/A int ast_palet_changed;
1385N/A uchar_t ast_red[256];
1385N/A uchar_t ast_green[256];
1385N/A uchar_t ast_blue[256];
1385N/A uint_t ast_queue;
1385N/A uint_t ast_dst_base;
1385N/A uint_t ast_dst_pitch;
1385N/A uint_t ast_dst_xy;
1385N/A uint_t ast_line_err;
1385N/A uint_t ast_rect_xy;
1385N/A uint_t ast_fg;
1385N/A uint_t ast_bg;
1385N/A uint_t ast_mono1;
1385N/A uint_t ast_mono2;
1385N/A uint_t ast_clip1;
1385N/A uint_t ast_clip2;
1385N/A } ast_info_t;
1385N/A
1385N/A
1385N/Atypedef struct ast_xw_struct {
1385N/A sigset_t xw_procmask;
1385N/A sigjmp_buf xw_sigjmpbuf;
1385N/A char const *xw_dispname;
1385N/A Display *xw_display;
1385N/A int xw_screen;
1385N/A Window xw_window;
1385N/A Cursor xw_cursor;
1385N/A Bool xw_grab_server;
1385N/A Bool xw_grab_keyboard;
1385N/A Bool xw_grab_pointer;
1385N/A Bool xw_ss_saved;
1385N/A Bool xw_ss_disabled;
1385N/A int xw_ss_timeout;
1385N/A int xw_ss_interval;
1385N/A int xw_ss_prefer_blanking;
1385N/A int xw_ss_allow_exposures;
1385N/A Status xw_dpms_saved;
1385N/A CARD16 xw_dpms_power;
1385N/A BOOL xw_dpms_state;
1385N/A Bool xw_dpms_disabled;
1385N/A } ast_xw_t;
1117N/A
1117N/A
1385N/A#ifdef __cplusplus
1385N/Aextern "C" {
1385N/A#endif
1385N/A
1385N/A/* chip.c */
1385N/A
1385N/Aextern return_packet *ast_test_chip(
1385N/A int const fd);
1385N/A
1385N/Aextern int chip_test(
1385N/A return_packet *const rp,
1385N/A int const fd);
1385N/A
1385N/Aextern int draw_lines(
1385N/A uint_t const width,
1385N/A uint_t const height);
1385N/A
1385N/Aextern int draw_cascaded_box(
1385N/A uint_t const width,
1385N/A uint_t const height);
1385N/A
1385N/A/* dma.c */
1385N/A
1385N/Aextern return_packet *ast_test_dma(
1385N/A register int const fd);
1385N/A
1385N/Aextern int dma_test(
1385N/A return_packet *const rp,
1385N/A int const fd);
1385N/A
1385N/A/* mapper.c */
1385N/A
1385N/Aextern return_packet *ast_test_open(
1385N/A int const fd);
1385N/A
1385N/Aextern int map_me(
1385N/A return_packet *const rp,
1385N/A int const fd);
1385N/A
1385N/Aextern int ast_test_scratch(
1385N/A return_packet *const rp,
1385N/A int const test);
1385N/A
1385N/A/* memory.c */
1385N/A
1385N/Aextern return_packet *ast_test_memory(
1385N/A int const fd);
1385N/A
1385N/Aextern int memory_test(
1385N/A return_packet *const rp,
1385N/A int const fd);
1385N/A
1385N/Aextern void check_plane(
1385N/A int const num_planes,
1385N/A int const access_mode,
1385N/A int const fb_pitch,
1385N/A int const fb_height,
1385N/A int const fb_width,
1385N/A int const bytepp,
1385N/A caddr_t const base);
1117N/A
1385N/Aextern void init_data(
1385N/A int const num_planes);
1385N/A
1385N/Aextern uint_t test_data(
1385N/A void);
1385N/A
1385N/Aextern boolean_t write_read(
1385N/A int const xoff,
1385N/A int const yoff,
1385N/A boolean_t const complement,
1385N/A int const access_mode,
1385N/A boolean_t const pass,
1385N/A int const fb_pitch,
1385N/A int const bytepp,
1385N/A caddr_t const base);
1385N/A
1385N/A/* tools.c */
1385N/A
1385N/Aextern int ast_map_mem(
1385N/A return_packet *const rp,
1385N/A int const test);
1385N/A
1385N/Aextern int ast_get_pci_info(
1385N/A void);
1385N/A
1385N/Aextern int ast_map_mmio(
1385N/A void);
1385N/A
1385N/Aextern int ast_map_fb(
1385N/A void);
1117N/A
1385N/Aextern int ast_init_info(
1385N/A return_packet *const rp,
1385N/A int const test);
1385N/A
1385N/Aextern int ast_init_graphics(
1385N/A void);
1385N/A
1385N/Aextern int ast_finish_graphics(
1385N/A void);
1385N/A
1385N/Aextern int ast_save_palet(
1385N/A void);
1385N/A
1385N/Aextern int ast_set_palet(
1385N/A void);
1385N/A
1385N/Aextern int ast_restore_palet(
1385N/A void);
1385N/A
1385N/Aextern uint_t ast_color(
1385N/A uint_t const red,
1385N/A uint_t const green,
1385N/A uint_t const blue);
1385N/A
1385N/Aextern int ast_open_key(
1385N/A void);
1385N/A
1385N/Aextern int ast_fill_solid_rect(
1385N/A uint_t const x1,
1385N/A uint_t const y1,
1385N/A uint_t const x2,
1385N/A uint_t const y2,
1385N/A uint_t const fg);
1117N/A
1385N/Aextern int ast_fill_pattern_rect(
1385N/A uint_t const x1,
1385N/A uint_t const y1,
1385N/A uint_t const x2,
1385N/A uint_t const y2,
1385N/A uint_t const bg,
1385N/A uint_t const fg,
1385N/A uint64_t const pat);
1385N/A
1385N/Aextern int ast_draw_solid_line(
1385N/A uint_t const x1,
1385N/A uint_t const y1,
1385N/A uint_t const x2,
1385N/A uint_t const y2,
1385N/A uint_t const fg);
1385N/A
1385N/Aextern int ast_unmap_mem(
1385N/A return_packet *const rp,
1385N/A int const test);
1385N/A
1385N/Aextern int ast_unmap_fb(
1385N/A void);
1385N/A
1385N/Aextern int ast_unmap_mmio(
1385N/A void);
1385N/A
1385N/Aextern int ast_store_mmio(
1385N/A uint_t const port,
1385N/A uint_t const value);
1385N/A
1385N/Aextern int ast_get_index_reg(
1385N/A uchar_t *const valueptr,
1385N/A uchar_t const offset,
1385N/A uchar_t const index);
1385N/A
1385N/Aextern int ast_set_index_reg(
1385N/A uchar_t const offset,
1385N/A uchar_t const index,
1385N/A uchar_t const value);
1385N/A
1385N/Aextern int ast_get_reg(
1385N/A uchar_t *const valueptr,
1385N/A uchar_t const offset);
1385N/A
1385N/Aextern int ast_set_reg(
1385N/A uchar_t const offset,
1385N/A uchar_t const value);
1385N/A
1385N/Aextern uint_t ast_mmio_read32(
1385N/A uint_t const port);
1385N/A
1385N/Aextern void ast_mmio_write32(
1385N/A uint_t const port,
1385N/A uint_t const val);
1385N/A
1385N/Aextern int ast_wait_idle(
1385N/A void);
1385N/A
1385N/A/* libvtsSUNWast.c */
1385N/A
1385N/Aextern ast_info_t ast_info;
1385N/A
1385N/Aextern ast_xw_t ast_xw;
1117N/A
1385N/Aextern void ast_block_signals(
1385N/A void);
1385N/A
1385N/Aextern void ast_restore_signals(
1385N/A void);
1385N/A
1385N/Aextern int ast_lock_display(
1385N/A void);
1385N/A
1385N/Aextern int ast_unlock_display(
1385N/A void);
1385N/A
1385N/Aextern int ast_open_display(
1385N/A void);
1385N/A
1385N/Aextern int ast_create_cursor(
1385N/A void);
1385N/A
1385N/Aextern int ast_create_window(
1385N/A void);
1385N/A
1385N/Aextern int ast_grab_server(
1385N/A void);
1385N/A
1385N/Aextern int ast_ungrab_server(
1385N/A void);
1385N/A
1385N/Aextern int ast_grab_keyboard(
1385N/A void);
1385N/A
1385N/Aextern int ast_ungrab_keyboard(
1385N/A void);
1117N/A
1385N/Aextern int ast_grab_pointer(
1385N/A void);
1385N/A
1385N/Aextern int ast_ungrab_pointer(
1385N/A void);
1385N/A
1385N/Aextern int ast_disable_screensaver(
1385N/A void);
1385N/A
1385N/Aextern int ast_restore_screensaver(
1385N/A void);
1385N/A
1385N/Aextern int ast_disable_dpms(
1385N/A void);
1117N/A
1385N/Aextern int ast_restore_dpms(
1385N/A void);
1385N/A
1385N/Aextern int ast_sleep(
1385N/A uint_t const seconds);
1385N/A
1385N/Aextern void ast_signal_routine(
1385N/A int const signo);
1385N/A
1385N/Aextern int ast_check_for_interrupt(
1385N/A void);
1385N/A
1385N/Aextern void graphicstest_finish(
1385N/A int const flag);
1385N/A
1385N/A#ifdef __cplusplus
1385N/A}
1385N/A#endif
1117N/A
1117N/A#endif /* _LIBVTSSUNWAST_H */
1117N/A
1117N/A/* End of libvtsSUNWast.h */