Move video I/O control definitions to the SDK
authorcoderain <coderain@sdf.org>
Wed, 15 Nov 2017 04:18:02 +0000 (05:18 +0100)
committercoderain <coderain@sdf.org>
Wed, 15 Nov 2017 04:18:02 +0000 (05:18 +0100)
kernel/include/video.h
sdk/device.h

index d0fe90a92a801c745b82fcf9240c62c86807847f..8b5f3369aacf190ed462bbf6a4848268a6e5e332 100644 (file)
 #define VGA_GC_INDEX 0x3CE
 #define VGA_GC_DATA 0x3CF
 
-#define VIDEO_MODE_ALPHANUMERIC     (1 << 0)
-#define VIDEO_MODE_USES_PALETTE     (1 << 1)
-
-#define IOCTL_VIDEO_GET_MODE        0xC9000000
-#define IOCTL_VIDEO_SET_MODE        0xC9000001
-#define IOCTL_VIDEO_LIST_MODES      0xC9000002
-#define IOCTL_VIDEO_QUERY_MODE      0xC9000003
-#define IOCTL_VIDEO_MAP_FRAMEBUFFER 0xC9000004
-#define IOCTL_VIDEO_BITBLT          0xC9000005
-#define IOCTL_VIDEO_READ_PALETTE    0xC9000006
-#define IOCTL_VIDEO_WRITE_PALETTE   0xC9000007
-#define IOCTL_VIDEO_READ_FONT       0xC9000008
-#define IOCTL_VIDEO_WRITE_FONT      0xC9000009
-#define IOCTL_VIDEO_SET_TEXT_CURSOR 0xC900000A
-
-#define BITBLT_RESULT_INVERT        (1 << 2)
-#define BITBLT_SOURCE_INVERT        (1 << 3)
-#define BITBLT_DEST_INVERT          (1 << 4)
-#define BITBLT_SOURCE_ENABLED       (1 << 30)
-#define BITBLT_DEST_ENABLED         (1 << 31)
-
-enum
-{
-    BITBLT_OPERATION_NONE,
-    BITBLT_OPERATION_AND,
-    BITBLT_OPERATION_OR,
-    BITBLT_OPERATION_XOR,
-};
-
-typedef struct
-{
-    dword_t source_x;
-    dword_t source_y;
-    dword_t dest_x;
-    dword_t dest_y;
-    dword_t width;
-    dword_t height;
-    dword_t operation;
-} video_bitblt_parameters_t;
-
-typedef struct
-{
-    void *address;
-    uintptr_t offset;
-    size_t size;
-} video_map_framebuffer_t;
-
-typedef struct
-{
-    dword_t row;
-    dword_t column;
-} video_cursor_location_t;
-
 typedef struct video_device video_device_t;
 
 typedef dword_t (*video_init_proc_t)(list_entry_t *video_devices);
@@ -116,25 +63,6 @@ typedef struct
     video_control_proc_t control_proc;
 } video_driver_t;
 
-typedef struct
-{
-    dword_t number;
-    dword_t flags;
-    dword_t width;
-    dword_t height;
-    dword_t bpp;
-    dword_t scanline_size;
-    uintptr_t framebuffer_phys;
-    byte_t red_mask_size;
-    byte_t red_field_pos;
-    byte_t green_mask_size;
-    byte_t green_field_pos;
-    byte_t blue_mask_size;
-    byte_t blue_field_pos;
-    byte_t reserved_mask_size;
-    byte_t reserved_field_pos;
-} video_mode_t;
-
 struct video_device
 {
     device_t header;
index 99b421c3202ac06922e5eecbf6fff0c866117414..0d5890ef31cf4b72e39843b848b252aab1308075 100644 (file)
 
 #define MAX_DEVICE_NAME 32
 
-#define BLOCK_DEVICE_REMOVABLE_MEDIA  (1 << 0)
+typedef enum
+{
+    BLOCK_DEVICE,
+    CHAR_DEVICE
+} device_type_t;
+
+/* Generic block device IOCTLs and related data */
 
 #define IOCTL_BLOCK_DEV_INFO        0xB0000000
 #define IOCTL_BLOCK_DEV_MEDIA_INFO  0xB0000001
 #define IOCTL_BLOCK_DEV_MEDIA_LOAD  0xB0000002
 #define IOCTL_BLOCK_DEV_MEDIA_EJECT 0xB0000003
 
+#define BLOCK_DEVICE_REMOVABLE_MEDIA  (1 << 0)
+
+/* Generic character device IOCTLs and related data */
+
 #define IOCTL_CHAR_DEV_CHECK_INPUT  0xC0000000
 #define IOCTL_CHAR_DEV_CHECK_OUTPUT 0xC0000001
 
-typedef enum
+/* Video IOCTLs and related data */
+
+#define IOCTL_VIDEO_GET_MODE        0xC9000000
+#define IOCTL_VIDEO_SET_MODE        0xC9000001
+#define IOCTL_VIDEO_LIST_MODES      0xC9000002
+#define IOCTL_VIDEO_QUERY_MODE      0xC9000003
+#define IOCTL_VIDEO_MAP_FRAMEBUFFER 0xC9000004
+#define IOCTL_VIDEO_BITBLT          0xC9000005
+#define IOCTL_VIDEO_READ_PALETTE    0xC9000006
+#define IOCTL_VIDEO_WRITE_PALETTE   0xC9000007
+#define IOCTL_VIDEO_READ_FONT       0xC9000008
+#define IOCTL_VIDEO_WRITE_FONT      0xC9000009
+#define IOCTL_VIDEO_SET_TEXT_CURSOR 0xC900000A
+
+#define VIDEO_MODE_ALPHANUMERIC     (1 << 0)
+#define VIDEO_MODE_USES_PALETTE     (1 << 1)
+
+#define IOCTL_VIDEO_GET_MODE        0xC9000000
+#define IOCTL_VIDEO_SET_MODE        0xC9000001
+#define IOCTL_VIDEO_LIST_MODES      0xC9000002
+#define IOCTL_VIDEO_QUERY_MODE      0xC9000003
+#define IOCTL_VIDEO_MAP_FRAMEBUFFER 0xC9000004
+#define IOCTL_VIDEO_BITBLT          0xC9000005
+#define IOCTL_VIDEO_READ_PALETTE    0xC9000006
+#define IOCTL_VIDEO_WRITE_PALETTE   0xC9000007
+#define IOCTL_VIDEO_READ_FONT       0xC9000008
+#define IOCTL_VIDEO_WRITE_FONT      0xC9000009
+#define IOCTL_VIDEO_SET_TEXT_CURSOR 0xC900000A
+
+#define BITBLT_RESULT_INVERT        (1 << 2)
+#define BITBLT_SOURCE_INVERT        (1 << 3)
+#define BITBLT_DEST_INVERT          (1 << 4)
+#define BITBLT_SOURCE_ENABLED       (1 << 30)
+#define BITBLT_DEST_ENABLED         (1 << 31)
+
+enum
 {
-    BLOCK_DEVICE,
-    CHAR_DEVICE
-} device_type_t;
+    BITBLT_OPERATION_NONE,
+    BITBLT_OPERATION_AND,
+    BITBLT_OPERATION_OR,
+    BITBLT_OPERATION_XOR,
+};
+
+typedef struct
+{
+    dword_t source_x;
+    dword_t source_y;
+    dword_t dest_x;
+    dword_t dest_y;
+    dword_t width;
+    dword_t height;
+    dword_t operation;
+} video_bitblt_parameters_t;
+
+typedef struct
+{
+    void *address;
+    uintptr_t offset;
+    size_t size;
+} video_map_framebuffer_t;
+
+typedef struct
+{
+    dword_t row;
+    dword_t column;
+} video_cursor_location_t;
+
+typedef struct
+{
+    dword_t number;
+    dword_t flags;
+    dword_t width;
+    dword_t height;
+    dword_t bpp;
+    dword_t scanline_size;
+    uintptr_t framebuffer_phys;
+    byte_t red_mask_size;
+    byte_t red_field_pos;
+    byte_t green_mask_size;
+    byte_t green_field_pos;
+    byte_t blue_mask_size;
+    byte_t blue_field_pos;
+    byte_t reserved_mask_size;
+    byte_t reserved_field_pos;
+} video_mode_t;
 
 sysret_t syscall_device_ioctl(handle_t device, dword_t control_code, const void *in_buffer, size_t in_length, void *out_buffer, size_t out_length);