50,16 → 50,11 |
unsigned long int VMEMLONG = WIDTH * HEIGHT * BYTES_PP / 4; // Used by copy_videomem_16to16 |
unsigned long int RGB565MEM = WIDTH * HEIGHT * BYTES_PP; // Total video mem |
|
unsigned long int PERIOD_REFRESH = 50000; |
unsigned long int WCET_REFRESH = 20000; |
#define FG_PERIOD 50000 |
#define FG_WCET 30000 |
#define FG_W 400 |
#define FG_H 300 |
|
void * fg_buffer; |
|
int fg_p = 40000; |
int fp_c = 15000; |
int fg_w = 320; |
int fg_h = 200; |
|
static int screen(int mode) |
{ |
|
91,11 → 86,11 |
|
void program_end(void *arg) |
{ |
|
|
FG_close(); |
|
vga_setmode(TEXT,CARD); |
|
FG_close(); |
|
sys_end(); |
|
} |
107,7 → 102,7 |
|
} |
|
TASK ref(void) |
void elaborate_image(void *imageptr) |
{ |
|
WORD col,x,y; |
114,12 → 109,10 |
|
while(1) { |
|
fg_buffer = FG_getbuffer(); |
|
for(y = 0; y < fg_h; y++) |
for(x = 0; x < fg_w; x++) { |
for(y = 0; y < FG_H; y++) |
for(x = 0; x < FG_W; x++) { |
|
col = *(BYTE *)(fg_buffer + y*fg_w + x); |
col = *(BYTE *)(imageptr + y*FG_W + x); |
*(WORD *)(video_buf + y*(WIDTH*2) + x*2) = (WORD)rgb16(col,col,col); |
|
} |
135,23 → 128,8 |
int main(int argc, char **argv) |
{ |
|
HARD_TASK_MODEL ht_ref; |
PID ref_PID; |
|
sys_atrunlevel(program_end,NULL, RUNLEVEL_BEFORE_EXIT); |
|
hard_task_default_model(ht_ref); |
hard_task_def_wcet(ht_ref,WCET_REFRESH); |
hard_task_def_mit(ht_ref,PERIOD_REFRESH); |
hard_task_def_usemath(ht_ref); |
hard_task_def_group(ht_ref,1); |
hard_task_def_ctrl_jet(ht_ref); |
|
ref_PID = task_create("HT_ref", ref, &ht_ref, NULL); |
if (ref_PID == -1) { |
sys_end(); |
} |
|
{ |
KEY_EVT k; |
k.flag = ALTL_BIT; |
162,11 → 140,9 |
|
screen(INITSTR); |
|
sleep(5); |
|
FG_init(fg_p, fp_c, fg_w, fg_h); |
FG_init(FG_PERIOD, FG_WCET, FG_W, FG_H); |
|
task_activate(ref_PID); |
FG_set_hook(elaborate_image); |
|
return 0; |
|