summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTiago Vignatti <vignatti@freedesktop.org>2009-05-13 17:44:46 -0300
committerTiago Vignatti <vignatti@freedesktop.org>2009-05-13 17:44:46 -0300
commit67af888bcc5667eadf1e9e9bf15305f742416daf (patch)
tree36670d627299ff919498ae79a60538f57f7ecca8 /include
parent8ba6b02ecfa5b03bbf2807e8262bb1253a026493 (diff)
downloadlibpciaccess-67af888bcc5667eadf1e9e9bf15305f742416daf.tar.gz
Import libvgaaccess (VGA Arbiter) implementation from C3SL repository:
http://git.c3sl.ufpr.br/
Diffstat (limited to 'include')
-rw-r--r--include/pciaccess.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/include/pciaccess.h b/include/pciaccess.h
index 6413ae0..2f0bf9d 100644
--- a/include/pciaccess.h
+++ b/include/pciaccess.h
@@ -21,6 +21,31 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
+/*
+ * Copyright (c) 2007 Paulo R. Zanoni, Tiago Vignatti
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
/**
* \file pciaccess.h
@@ -449,4 +474,54 @@ struct pci_pcmcia_bridge_info {
};
+
+/**
+ * VGA Arbiter definitions, functions and related.
+ */
+
+typedef int VgaArbRsrcType;
+
+typedef struct {
+ int fd;
+ VgaArbRsrcType rsrc;
+} vga_arb_rec, *vga_arb_ptr;
+
+/* This is a mask that can be OR'ed */
+#define VGA_ARB_RSRC_NONE 0
+#define VGA_ARB_RSRC_LEGACY_IO 1
+#define VGA_ARB_RSRC_LEGACY_MEM 2
+#define VGA_ARB_RSRC_NORMAL_IO 4
+#define VGA_ARB_RSRC_NORMAL_MEM 8
+
+/*
+ * All functions, except vga_arb_trylock(), return 1 on success and 0 if
+ * something went wrong.
+ * vga_arb_trylock returns 1 on success, 0 if the lock failed and -1 if
+ * something went wrong.
+ *
+ * But I really don't think you should be checking the return values. The lib
+ * checks for these errors but they should never happen, and when they happen
+ * it will print error messages at stderr.
+ *
+ * To understand the way these functions work see test/test2lib.c.
+ */
+
+
+int vga_arb_set_target (vga_arb_ptr vgaDev, unsigned int domain,
+ unsigned int bus, unsigned int dev, unsigned int fn);
+
+int vga_arb_read (vga_arb_ptr vgaDev);
+
+int vga_arb_lock (vga_arb_ptr vgaDev);
+
+int vga_arb_trylock (vga_arb_ptr vgaDev);
+
+int vga_arb_unlock (vga_arb_ptr vgaDev);
+
+int vga_arb_decodes (vga_arb_ptr vgaDev);
+
+int vga_arb_init (vga_arb_ptr *vgaDev);
+
+void vga_arb_fini (vga_arb_ptr vgaDev);
+
#endif /* PCIACCESS_H */