root / lab5 / graphics.h @ 133
History | View | Annotate | Download (2.01 KB)
1 | 95 | up20180655 | #ifndef GRAPHICS_H_INCLUDED
|
---|---|---|---|
2 | #define GRAPHICS_H_INCLUDED
|
||
3 | |||
4 | 99 | up20180655 | #include <lcom/lcf.h> |
5 | 95 | up20180655 | #include <stdint.h> |
6 | |||
7 | 122 | up20180655 | #define GET_RED(n) (0xFF & ((n) >> 16)) |
8 | #define GET_GRE(n) (0xFF & ((n) >> 8)) |
||
9 | #define GET_BLU(n) (0xFF & (n )) |
||
10 | #define SET_RED(n) (((n)&0xFF) << 16) |
||
11 | #define SET_GRE(n) (((n)&0xFF) << 8) |
||
12 | #define SET_BLU(n) (((n)&0xFF) ) |
||
13 | #define SET_COLOR(r,g,b) (SET_RED(r) | SET_GRE(g) | SET_BLU(b))
|
||
14 | #define FAR2PHYS(n) ((((n)>>12) & 0xFFFFFFF0) + ((n) & 0x0000FFFF)) |
||
15 | 113 | up20180642 | |
16 | 126 | up20180655 | typedef struct __attribute__((packed)) { |
17 | |||
18 | char VbeSignature[4] ; |
||
19 | uint16_t VbeVersion ; |
||
20 | uint32_t OemStringPtr ; |
||
21 | uint8_t Capabilities[4] ;
|
||
22 | uint32_t VideoModePtr ; |
||
23 | uint16_t TotalMemory ; |
||
24 | |||
25 | uint16_t OemSoftwareRev ; |
||
26 | uint32_t OemVendorNamePtr ; |
||
27 | uint32_t OemProductNamePtr ; |
||
28 | uint32_t OemProductRevPtr ; |
||
29 | char Reserved[222] ; |
||
30 | |||
31 | char OemData[256] ; |
||
32 | } VbeInfoBlock; |
||
33 | |||
34 | 99 | up20180655 | int (get_permission)(unsigned int base_addr, unsigned int size); |
35 | |||
36 | 121 | up20180642 | //int (get_permissions_first_mbyte)(void);
|
37 | 99 | up20180655 | |
38 | 103 | up20180655 | int (vbe_get_mode_information)(uint16_t mode);
|
39 | 99 | up20180655 | |
40 | 126 | up20180655 | int (vbe_get_controller_information)(vg_vbe_contr_info_t *info_p);
|
41 | |||
42 | 103 | up20180655 | phys_bytes get_phys_addr(void);
|
43 | 99 | up20180655 | |
44 | 103 | up20180655 | unsigned int get_vram_size(void); |
45 | |||
46 | uint16_t get_XRes(void);
|
||
47 | |||
48 | uint16_t get_YRes(void);
|
||
49 | |||
50 | uint16_t get_bits_pixel(void);
|
||
51 | |||
52 | 105 | up20180655 | uint16_t get_bytes_pixel(void);
|
53 | |||
54 | 111 | up20180642 | uint16_t get_RedMaskSize(void);
|
55 | |||
56 | uint16_t get_GreenMaskSize(void);
|
||
57 | |||
58 | uint16_t get_BlueMaskSize(void);
|
||
59 | |||
60 | 103 | up20180655 | int (map_vram)(void); |
61 | |||
62 | 133 | up20180655 | int (free_memory_map)(void); |
63 | 99 | up20180655 | |
64 | 105 | up20180655 | int (set_pixel)(uint16_t row, uint16_t col, uint32_t color);
|
65 | |||
66 | 95 | up20180655 | /**
|
67 | * @brief
|
||
68 | * @param mode
|
||
69 | * @return
|
||
70 | */
|
||
71 | int (set_graphics_mode)(uint16_t mode);
|
||
72 | |||
73 | 120 | up20180642 | int (draw_hline)(uint16_t x, uint16_t y, uint16_t len, uint32_t color);
|
74 | 118 | up20180642 | |
75 | 119 | up20180642 | int (draw_rectangle)(uint16_t x, uint16_t y,uint16_t width, uint16_t height, uint32_t color);
|
76 | 117 | up20180642 | |
77 | 95 | up20180655 | #endif /* end of include guard: GRAPHICS_H_INCLUDED */ |