cadmus_core/framebuffer/
sunxi_sys.rs1#![allow(unused)]
2
3use nix::{ioctl_readwrite_bad, ioctl_write_ptr_bad};
4use std::mem::ManuallyDrop;
5ioctl_readwrite_bad!(send_update, DISP_EINK_UPDATE2, SunxiDispEinkUpdate2);
6ioctl_write_ptr_bad!(
7 wait_for_update,
8 DISP_EINK_WAIT_FRAME_SYNC_COMPLETE,
9 SunxiDispEinkWaitFrameSyncComplete
10);
11
12pub const DISP_EINK_UPDATE2: libc::c_ulong = 0x0406;
13pub const DISP_EINK_WAIT_FRAME_SYNC_COMPLETE: libc::c_ulong = 0x4014;
14
15pub const LAYER_MODE_BUFFER: libc::c_int = 0;
16pub const DISP_FORMAT_8BIT_GRAY: libc::c_int = 0x50;
17pub const DISP_GBR_F: libc::c_int = 0x200;
18pub const DISP_BF_NORMAL: libc::c_int = 0;
19pub const DISP_SCAN_PROGRESSIVE: libc::c_int = 0;
20pub const DISP_EOTF_GAMMA22: libc::c_int = 0x004;
21
22#[repr(C)]
23#[derive(Debug)]
24pub struct AreaInfo {
25 pub x_top: libc::c_uint,
26 pub y_top: libc::c_uint,
27 pub x_bottom: libc::c_uint,
28 pub y_bottom: libc::c_uint,
29}
30
31#[repr(C)]
32#[derive(Debug)]
33pub struct DispRect {
34 pub x: libc::c_int,
35 pub y: libc::c_int,
36 pub width: libc::c_uint,
37 pub height: libc::c_uint,
38}
39
40#[repr(C)]
41pub struct DispRect64 {
42 pub x: libc::c_longlong,
43 pub y: libc::c_longlong,
44 pub width: libc::c_longlong,
45 pub height: libc::c_longlong,
46}
47
48#[repr(C)]
49#[derive(Debug)]
50pub struct DispRectsz {
51 pub width: libc::c_uint,
52 pub height: libc::c_uint,
53}
54
55#[repr(C)]
56pub struct DispLayerConfig2 {
57 pub info: DispLayerInfo2,
58 pub enable: bool,
59 pub channel: libc::c_uint,
60 pub layer_id: libc::c_uint,
61}
62
63#[repr(C)]
64pub struct DispAtwInfo {
65 pub used: bool,
66 pub mode: libc::c_int,
67 pub b_row: libc::c_uint,
68 pub b_col: libc::c_uint,
69 pub colf_fd: libc::c_int,
70}
71
72#[repr(C)]
73pub struct DispLayerInfo2 {
74 pub mode: libc::c_int,
75 pub zorder: libc::c_uchar,
76 pub alpha_mode: libc::c_uchar,
77 pub alpha_value: libc::c_uchar,
78 pub screen_win: DispRect,
79 pub b_trd_out: bool,
80 pub out_trd_mode: libc::c_int,
81 pub color_fb: ColorFb,
82 pub id: libc::c_uint,
83 pub atw: DispAtwInfo,
84}
85
86#[repr(C)]
87pub struct DispFbInfo2 {
88 pub fd: libc::c_int,
89 pub y8_fd: libc::c_int,
90 pub size: [DispRectsz; 3],
91 pub align: [libc::c_uint; 3],
92 pub format: libc::c_int,
93 pub color_space: libc::c_int,
94 pub trd_right_fd: libc::c_int,
95 pub pre_multiply: bool,
96 pub crop: DispRect64,
97 pub flags: libc::c_int,
98 pub scan: libc::c_int,
99 pub eotf: libc::c_int,
100 pub depth: libc::c_int,
101 pub fbd_en: libc::c_uint,
102 pub metadata_fd: libc::c_int,
103 pub metadata_size: libc::c_uint,
104 pub metadata_flag: libc::c_uint,
105}
106
107#[repr(C)]
108pub union ColorFb {
109 pub color: libc::c_uint,
110 pub fb: ManuallyDrop<DispFbInfo2>,
111}
112
113#[repr(C)]
114#[derive(Clone, Debug)]
115pub struct SunxiDispEinkUpdate2 {
116 pub area: *const AreaInfo,
117 pub layer_num: libc::c_ulong,
118 pub update_mode: libc::c_ulong,
119 pub lyr_cfg2: *const DispLayerConfig2,
120 pub frame_id: *mut libc::c_uint,
121 pub rotate: *const u32,
122 pub cfa_use: libc::c_ulong,
123}
124
125#[repr(C)]
126#[derive(Clone, Debug)]
127pub struct SunxiDispEinkWaitFrameSyncComplete {
128 pub frame_id: u32,
129}
130
131pub const EINK_INIT_MODE: u32 = 0x01;
132pub const EINK_DU_MODE: u32 = 0x02;
133pub const EINK_GC16_MODE: u32 = 0x04;
134pub const EINK_GC4_MODE: u32 = 0x08;
135pub const EINK_A2_MODE: u32 = 0x10;
136pub const EINK_GL16_MODE: u32 = 0x20;
137pub const EINK_GLR16_MODE: u32 = 0x40;
138pub const EINK_GLD16_MODE: u32 = 0x80;
139pub const EINK_GU16_MODE: u32 = 0x84;
140pub const EINK_GCK16_MODE: u32 = 0x90;
141pub const EINK_GLK16_MODE: u32 = 0x94;
142pub const EINK_CLEAR_MODE: u32 = 0x88;
143pub const EINK_GC4L_MODE: u32 = 0x8c;
144pub const EINK_GCC16_MODE: u32 = 0xa0;
145
146pub const EINK_AUTO_MODE: u32 = 0x0000_8000;
147pub const EINK_DITHERING_Y1: u32 = 0x0180_0000;
148pub const EINK_DITHERING_Y4: u32 = 0x0280_0000;
149pub const EINK_DITHERING_SIMPLE: u32 = 0x0480_0000;
150pub const EINK_DITHERING_NTX_Y1: u32 = 0x0880_0000;
151
152pub const EINK_GAMMA_CORRECT: u32 = 0x0020_0000;
153pub const EINK_MONOCHROME: u32 = 0x0040_0000;
154pub const EINK_NEGATIVE_MODE: u32 = 0x0001_0000;
155pub const EINK_REGAL_MODE: u32 = 0x0008_0000;
156pub const EINK_NO_MERGE: u32 = 0x8000_0000;
157
158pub const EINK_PARTIAL_MODE: u32 = 0x0400;