Rev 9137 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9137 | Rev 9766 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | * Built on top of the /programs/develop/examples/thread/trunk/thread.asm example. |
3 | * Built on top of the /programs/develop/examples/thread/trunk/thread.asm example. |
4 | * |
4 | * |
5 | * Created by turbocat (Maxim Logaev) 2021. |
5 | * Created by turbocat (Maxim Logaev) 2021. |
6 | */ |
6 | */ |
Line 7... | Line -... | ||
7 | - | ||
8 | #include |
7 | |
9 | #include |
8 | #include |
- | 9 | #include |
|
Line 10... | Line 10... | ||
10 | #include |
10 | #include |
Line 11... | Line 11... | ||
11 | 11 | ||
12 | #define TH_STACK_SIZE 1024 |
12 | #define TH_STACK_SIZE 1024 |
Line 18... | Line 18... | ||
18 | 18 | ||
Line 19... | Line 19... | ||
19 | ksys_colors_table_t sys_colors; |
19 | ksys_colors_table_t sys_colors; |
Line 20... | Line 20... | ||
20 | 20 | ||
- | 21 | extern int main(); |
|
21 | extern int main(); |
22 | |
22 | 23 | void redraw_window(void) |
|
23 | void redraw_window(void){ |
24 | { |
24 | ksys_pos_t mouse_pos = _ksys_get_mouse_pos(KSYS_MOUSE_SCREEN_POS); |
25 | ksys_pos_t mouse_pos = _ksys_get_mouse_pos(KSYS_MOUSE_SCREEN_POS); |
25 | _ksys_start_draw(); |
26 | _ksys_start_draw(); |
26 | _ksys_create_window(mouse_pos.x, mouse_pos.y, 140, 60, "Threads", sys_colors.work_area, 0x14); |
27 | _ksys_create_window(mouse_pos.x, mouse_pos.y, 140, 60, "Threads", sys_colors.work_area, 0x14); |
27 | _ksys_define_button(10, 30, 120, 20, BTN_CREATE_TH, sys_colors.work_button); |
28 | _ksys_define_button(10, 30, 120, 20, BTN_CREATE_TH, sys_colors.work_button); |
Line 28... | Line 29... | ||
28 | _ksys_draw_text("Create thread!", 15, 34, 0, 0x90000000 | sys_colors.work_button_text); |
29 | _ksys_draw_text("Create thread!", 15, 34, 0, 0x90000000 | sys_colors.work_button_text); |
- | 30 | _ksys_end_draw(); |
|
29 | _ksys_end_draw(); |
31 | } |
30 | } |
32 | |
31 | 33 | void create_thread(void) |
|
32 | void create_thread(void){ |
34 | { |
33 | unsigned tid; // New thread ID |
35 | unsigned tid; // New thread ID |
Line 42... | Line 44... | ||
42 | return; |
44 | return; |
43 | } |
45 | } |
44 | debug_printf("New thread created (TID=%u)\n", tid); |
46 | debug_printf("New thread created (TID=%u)\n", tid); |
45 | } |
47 | } |
Line 46... | Line 48... | ||
46 | 48 | ||
- | 49 | int main() |
|
47 | int main(){ |
50 | { |
48 | _ksys_get_system_colors(&sys_colors); |
51 | _ksys_get_system_colors(&sys_colors); |
49 | int gui_event; |
52 | int gui_event; |
Line 50... | Line 53... | ||
50 | redraw_window(); |
53 | redraw_window(); |