Refactor message, display, resource, readme

This commit is contained in:
idea4good
2018-12-11 14:30:09 +08:00
parent 0f9faa1abe
commit 78f42abe7b
24 changed files with 73 additions and 304 deletions

View File

@@ -46,5 +46,5 @@ void register_timer(int milli_second, void func(void* ptmr, void* parg));
unsigned int get_cur_thread_id();
void create_thread(unsigned long* thread_id, void* attr, void *(*start_routine) (void *), void* arg);
void thread_sleep(unsigned int milli_seconds);
int build_bmp(char *filename, unsigned int width, unsigned int height, unsigned char *data);
int build_bmp(const char *filename, unsigned int width, unsigned int height, unsigned char *data);
#endif

View File

@@ -1,7 +1,6 @@
#ifndef _DISPLAY_H_
#define _DISPLAY_H_
#define MAX_DISPLAY 9
#define SURFACE_CNT_MAX 6//root + pages
class c_hid_pipe;
@@ -14,21 +13,17 @@ public:
unsigned int color_bytes, unsigned int surface_cnt);
c_surface* alloc_surface(void* usr, Z_ORDER_LEVEL max_zorder);
int merge_surface(c_surface* s1, c_surface* s2, int x0, int x1, int y0, int y2, int offset);
c_hid_pipe* get_hid_pipe() { return m_hid_pipe; }
unsigned int get_width() { return m_width; }
unsigned int get_height() { return m_height; }
static void* get_frame_buffer(unsigned int display_id, int* width, int* height);
static int snap_shot(unsigned int display_id);
void* get_frame_buffer(int* width, int* height);
int snap_shot(const char* file_name);
private:
unsigned int m_width; //in pixels
unsigned int m_height; //in pixels
unsigned int m_color_bytes; //16 bits, 32 bits only
void* m_phy_fb;
c_hid_pipe* m_hid_pipe;
c_surface* m_surface_group[SURFACE_CNT_MAX];
unsigned int m_surface_cnt;
static c_display* ms_displays[MAX_DISPLAY];
};
#endif

View File

@@ -8,39 +8,20 @@ typedef struct
unsigned int dwParam2;
}MSG_INFO;
int read_usr_msg(MSG_INFO* msg);
int write_usr_msg(MSG_INFO* msg);
#define FIFO_BUFFER_LEN 1024
#define FIFO_NAME_LEN 16
class c_fifo
{
public:
c_fifo(const char* name);
c_fifo();
int read(void* buf, int len);
int write(void* buf, int len);
private:
unsigned char m_buf[FIFO_BUFFER_LEN];
char m_name[FIFO_NAME_LEN];
int m_head;
int m_tail;
void* m_read_sem;
void* m_write_mutex;
};
#define MAX_HID_PIPES 9
class c_hid_pipe
{
public:
c_hid_pipe(void* id);
static int read_hid_msg();
static int write_hid_msg(MSG_INFO* msg, unsigned int display_id = 0);
MSG_INFO m_msg;
int m_fd;
private:
static c_hid_pipe* ms_pipes[MAX_HID_PIPES];
static int ms_max_fd;
};
#endif