Project

General

Profile

Statistics
| Revision:

root / proj / graph.h @ 168

History | View | Annotate | Download (2.56 KB)

1
#ifndef GRAPH_H_INCLUDED
2
#define GRAPH_H_INCLUDED
3

    
4
#include <lcom/lcf.h>
5
#include <stdint.h>
6

    
7
#define GET_ALP(n)          (0xFF & ((n) >> 24))
8
#define GET_RED(n)          (0xFF & ((n) >> 16))
9
#define GET_GRE(n)          (0xFF & ((n) >>  8))
10
#define GET_BLU(n)          (0xFF & (n      ))
11
#define SET_ALP(n)          (((n)&0xFF) << 24)
12
#define SET_RED(n)          (((n)&0xFF) << 16)
13
#define SET_GRE(n)          (((n)&0xFF) <<  8)
14
#define SET_BLU(n)          (((n)&0xFF)      )
15
#define SET_RGB(r,g,b)      (             SET_RED(r) | SET_GRE(g) | SET_BLU(b))
16
#define SET_ARGB(a,r,g,b)   (SET_ALP(a) | SET_RED(r) | SET_GRE(g) | SET_BLU(b))
17
#define FAR2PHYS(n)         ((((n)>>12) & 0xFFFFFFF0) + ((n) & 0x0000FFFF))
18

    
19
typedef struct __attribute__((packed)) {
20

    
21
    char        VbeSignature[4]     ;
22
    uint16_t    VbeVersion          ;
23
    uint32_t    OemStringPtr        ;
24
    uint8_t     Capabilities[4]     ;
25
    uint32_t    VideoModePtr        ;
26
    uint16_t    TotalMemory         ;
27

    
28
    uint16_t    OemSoftwareRev      ;
29
    uint32_t    OemVendorNamePtr    ;
30
    uint32_t    OemProductNamePtr   ;
31
    uint32_t    OemProductRevPtr    ;
32
    char        Reserved[222]       ;
33

    
34
    char        OemData[256]        ;
35
} VbeInfoBlock;
36

    
37
int (get_permission)(unsigned int base_addr, unsigned int size);
38

    
39
//int (get_permissions_first_mbyte)(void);
40

    
41
int (graph_init)(uint16_t mode);
42
int (graph_cleanup)(void);
43

    
44
int (vbe_get_mode_information)(uint16_t mode);
45

    
46
int (vbe_get_controller_information)(vg_vbe_contr_info_t *info_p);
47

    
48
phys_bytes (graph_get_phys_addr)    (void);
49
unsigned   (graph_get_vram_size)    (void);
50
uint16_t   (graph_get_XRes)         (void);
51
uint16_t   (graph_get_YRes)         (void);
52
uint16_t   (graph_get_bits_pixel)   (void);
53
uint16_t   (graph_get_bytes_pixel)  (void);
54
uint16_t   (graph_get_RedMaskSize)  (void);
55
uint16_t   (graph_get_GreenMaskSize)(void);
56
uint16_t   (graph_get_BlueMaskSize) (void);
57

    
58
int (graph_map_vram)(void);
59

    
60
int (graph_free_memory)(void);
61

    
62
int (graph_set_pixel)      (uint16_t x, uint16_t y, uint32_t color);
63
int (graph_set_pixel_alpha)(uint16_t x, uint16_t y, uint32_t color, uint8_t alpha);
64

    
65
/**
66
 * @brief
67
 * @param mode
68
 * @return
69
 */
70
int (graph_set_mode)(uint16_t mode);
71

    
72
int (graph_draw_hline)(uint16_t x, uint16_t y, uint16_t len, uint32_t color);
73

    
74
int (graph_draw_rectangle)(uint16_t x, uint16_t y,uint16_t width, uint16_t height, uint32_t color);
75

    
76
int (graph_paint_screen)(uint32_t color);
77

    
78
int (graph_clear_screen)(void);
79

    
80
int (graph_draw)(void);
81

    
82
#endif /* end of include guard: GRAPH_H_INCLUDED */