void set_palette (int start, int end, unsigned char *rgb) { int i, eflags; eflags = io_load_eflags (); io_cli (); /* clear interrupt flag */ io_out8 (0x03c8, start); for (i = start; i <= end; i++) { io_out8(0x03c9, rgb[0] / 4); io_out8(0x03c9, rgb[1] / 4); io_out8(0x03c9, rgb[2] / 4); rgb += 3; } io_store_eflags (eflags); return; }
void set_palette(int start, int end, unsigned char *rgb) { int i, eflags; eflags = io_load_eflags(); /* 割り込み許可フラグの値を記録する */ io_cli(); /* 許可フラグを0にして割り込み禁止にする */ io_out8(0x03c8, start); for (i = start; i <= end; i++) { io_out8(0x03c9, rgb[0] / 4); io_out8(0x03c9, rgb[1] / 4); io_out8(0x03c9, rgb[2] / 4); rgb += 3; } io_store_eflags(eflags); /* 割り込み許可フラグを元に戻す */ return; }
void set_palette(int start, int end, unsigned char *rgb) { int i, eflags; eflags = io_load_eflags(); /* шнТtOЬl№L^Зщ */ io_cli(); /* ТtO№0ЩЕФшнж~ЩЗщ */ io_out8(0x03c8, start); for (i = start; i <= end; i++) { io_out8(0x03c9, rgb[0] / 4); io_out8(0x03c9, rgb[1] / 4); io_out8(0x03c9, rgb[2] / 4); rgb += 3; } io_store_eflags(eflags); /* шнТtO№ГЩпЗ */ return; }
///////////////////////////////////////////////////////////////////////////////////// //功能:初始化设置调色板 //参数:开始标号,结束标号,16*3的颜色表 //附加:关闭中断,进行设置(要知道具体设置要求),恢复中断 void set_palette(int start, int end, unsigned char *rgb) { int i, eflags; eflags = io_load_eflags(); /* 记录中断许可标志 */ io_cli(); /* 将中断许可标志置0,禁止中断 */ io_out8(0x03c8, start); for (i = start; i <= end; i++) { io_out8(0x03c9, rgb[0] / 4); io_out8(0x03c9, rgb[1] / 4); io_out8(0x03c9, rgb[2] / 4); rgb += 3; } io_store_eflags(eflags); /* 恢复原中断 */ return; }
void set_palette(int start, int end, unsigned char *rgb) { int i, eflags; eflags = io_load_eflags(); /* 인터럽트 허가 플래그의 값을 기록한다 */ io_cli(); /* 허가 플래그를 0으로 하여 인터럽트 금지로 한다 */ io_out8(0x03c8, start); for (i = start; i <= end; i++) { io_out8(0x03c9, rgb[0] / 4); io_out8(0x03c9, rgb[1] / 4); io_out8(0x03c9, rgb[2] / 4); rgb += 3; } io_store_eflags(eflags); /* 인터럽트 허가 플래그를 원래대로 되돌린다 */ return; }
void set_palette(int start, int end, unsigned char *rgb) { int i, eflags; eflags = io_load_eflags(); /* 妱傝崬傒嫋壜僼儔僌偺抣傪婰榐偡傞 */ io_cli(); /* 嫋壜僼儔僌傪0偵偟偰妱傝崬傒嬛巭偵偡傞 */ io_out8(0x03c8, start); for (i = start; i <= end; i++) { io_out8(0x03c9, rgb[0] / 4); io_out8(0x03c9, rgb[1] / 4); io_out8(0x03c9, rgb[2] / 4); rgb += 3; } io_store_eflags(eflags); /* 妱傝崬傒嫋壜僼儔僌傪尦偵栠偡 */ return; }
void set_palette(int start, int end, unsigned char *rgb) { int i, j, eflags; eflags = io_load_eflags(); io_cli(); io_out8(0x03c8, start); for(i = start; i <= end; i++) { for(j = 0; j < 3; j++) { io_out8(0x03c9, rgb[j] / 4); } rgb += 3; } io_store_eflags(eflags); return; }
void set_palette(int start, int end, unsigned char *rgb) { int i, eflags; eflags = io_load_eflags(); /* ��¼�ж���ɱ�־��ֵ */ io_cli(); /* ���ж���ɱ�־��Ϊ0����ֹ�ж� */ io_out8(0x03c8, start); /* ����Ҫ�趨�ĵ�ɫ�����д��0x03c8 */ for (i = start; i <= end; i++) { io_out8(0x03c9, rgb[0] / 4); io_out8(0x03c9, rgb[1] / 4); io_out8(0x03c9, rgb[2] / 4); rgb += 3; } io_store_eflags(eflags); /* ��ԭ�ж���ɱ�־ */ return; }
void timer_cancelall (struct Queue8* queue) { int e,i; struct TIMER *t; e = io_load_eflags(); io_cli(); for (i = 0; i < MAX_TIMER ; i ++ ) { t = &timerctl.timers0[i]; if (t->flags != 0 && t->flags2 != 0 && t->queue == queue) { timer_cancel(t); timer_free(t); } } io_store_eflags (e); return; }
void timer_cancelall(struct FIFO32 *fifo) { int e, i; struct TIMER *t; e = io_load_eflags(); io_cli(); /* 在设置过程中禁止改变定时器状态 */ for (i = 0; i < MAX_TIMER; i++) { t = &timerctl.timers0[i]; if (t->flags != 0 && t->flags2 != 0 && t->fifo == fifo) { timer_cancel(t); timer_free(t); } } io_store_eflags(e); return; }
void set_palette(int start, int end, unsigned char *rgb) { int i, eflags; eflags = io_load_eflags(); /* Record the interrupt flag*/ io_cli(); /* Set flag to 0, disable interrupt */ io_out8(0x03c8, start); for (i = start; i <= end; i++) { io_out8(0x03c9, rgb[0] / 4); io_out8(0x03c9, rgb[1] / 4); io_out8(0x03c9, rgb[2] / 4); rgb += 3; } io_store_eflags(eflags); /* Recover the flag of interrupt */ return; }
void set_palette(int start, int end, unsigned char *rgb) { int eflags,i; eflags = io_load_eflags(); io_cli(); io_out8(0x03c8,start); //这里的0x03c8和下面的0x03c9是设定好的,不能随便写,需要调制调色板就得这样写 for(i = start;i <= end;i++) { io_out8(0x03c9,rgb[0] / 4); //设置颜色RGB的R部分 io_out8(0x03c9,rgb[1] / 4); //设置颜色RGB的G部分 io_out8(0x03c9,rgb[2] / 4); //设置颜色RGB的B部分 rgb += 3; } io_store_eflags(eflags); return ; }
static void set_palette(int start, int end, unsigned char* rgb) { int i, eflags; eflags = io_load_eflags(); /* value of interrupt flag */ io_cli(); /* set flag = 0, disabled interrupt */ io_out8(0x03c8, start); for (i = start; i <= end; ++i) { io_out8(0x03c9, rgb[0] / 4); io_out8(0x03c9, rgb[1] / 4); io_out8(0x03c9, rgb[2] / 4); rgb += 3; } io_store_eflags(eflags); }
void set_palette(int start, int end, uchar *rgb) { int i, eflags; eflags = io_load_eflags(); io_cli(); io_out8(0x03c8, start); for (i = start; i <= end; i++) { io_out8(0x03c9, rgb[0] >> 2); io_out8(0x03c9, rgb[1] >> 2); io_out8(0x03c9, rgb[2] >> 2); rgb += 3; } io_store_eflags(eflags); return; }
void Timer::settime(unsigned int timeout){ int e; Timer *t,*s; this->timeout = timeout+TimerControl::count; //ここでのタイムアウトは関数を呼ばれてからの時間のことである this->flags = TIMER_FLAGS_USING; //タイマフラグを使用中にする //この関数内で割り込みが起こると困るので //割り込みを禁止しておく e = io_load_eflags(); //フラグを待避 io_cli(); //割り込みを禁止 //ここでタイマーの最後には番兵がいるのを考慮して t = TimerControl::t0; //1.先頭に入れる場合 if(this->timeout <= t->timeout){ TimerControl::t0 = this; this->next = t; TimerControl::next = this->timeout; io_store_eflags(e); return; } //2.どこに入れるか探していれる while(1){ s = t; t = t->next; if(this->timeout <= t->timeout){ //このとき s <= timer <= t の関係がある //sとtの間にtimerを入れる s->next = this; this->next = t; io_store_eflags(e); return; } } }
void set_palette(int start, int end, unsigned char *rgb) { int i, eflags; eflags = io_load_eflags(); io_cli(); /* access palette: first need to disable all interruption( clear eflags and buffer them) then write palette # to 0x03c8, then write rgb color to 0x03c9, if there's more colors to add, just continue write rgb to 0x03c9 then reset eflags */ io_out8(0x03c8, start); for(i = start; i <=end; i++) { io_out8(0x03c9, rgb[0] / 4); io_out8(0x03c9, rgb[1] / 4); io_out8(0x03c9, rgb[2] / 4); rgb+=3; } io_store_eflags(eflags); return; }
/** * @brief パレット設定 */ void set_palette( int start, int end, unsigned char* rgb ) { int i; int eflags; const int port = 0x03c8; /* パレット設定 */ unsigned char* cur_rgb = rgb; /* 割り込み許可フラグの値を記録 */ eflags = io_load_eflags(); io_cli(); io_out8( port, start ); for( i = start; i <= end; i++ ) { io_out8( 0x03c9, cur_rgb[0]/4 ); io_out8( 0x03c9, cur_rgb[1]/4 ); io_out8( 0x03c9, cur_rgb[2]/4 ); cur_rgb += 3; } /* 割り込み許可フラグの値をもとに戻す */ io_store_eflags( eflags ); return; }
void timer_settimer(timer_t* timer, unsigned int timeout) { int eflags; timer_t* t; /* timers iterator */ timer_t* s; /* prev-timer before t */ timer->timeout = timeout + g_timerctl.count; timer->flags = TIMER_FLAGS_USING; eflags = io_load_eflags(); io_cli(); t = g_timerctl.timer0; if (timer->timeout <= t->timeout) { /* insert into the front */ g_timerctl.timer0 = timer; timer->next = t; g_timerctl.next = timer->timeout; io_store_eflags(eflags); return; } /* search position to be inserted */ for ( ; ; ) { s = t; t = t->next; if (timer->timeout <= t->timeout) { /* insert into between s and t */ s->next = timer; timer->next = t; io_store_eflags(eflags); return; } } }
int timer_cancel(TIMER* timer) { int e = io_load_eflags(); io_cli(); if (timer->flags == TIMER_FLAGS_RUNNING) { if (timer == timerctl.t0) { TIMER* t = timer->next_timer; timerctl.t0 = t; timerctl.next_time = t->timeout; } else { TIMER* t = timerctl.t0; for (;; t = t->next_timer) { if (t->next_timer == timer) break; } t->next_timer = timer->next_timer; } timer->flags = TIMER_FLAGS_ALLOCATED; io_store_eflags(e); return TRUE; } io_store_eflags(e); return FALSE; }
//定时器设定倒计时 void timer_set(TIMER *timer, unsigned int timeout) { int eflags; TIMER *pre, *post; //用来指向链表中的前一个和后一个节点,方便连接链表 timer->timeout = timeout + timerctl.count; //这个timeout需要加上当前时间,因为它代表的是指定时间 timer->flags = TIMER_FLAGS_USING; //这期间需要对定时器进行设定,如果中间有定时器中断并且触发某个定时器的话,会写脏数据 eflags = io_load_eflags(); io_cli(); post = timerctl.first_timer; //先把post设置成指向链表的头结点 //当前设置的这个定时器的预定时间是最靠前的话,直接插入到链表的最前面,即成为头结点 if(timer->timeout <= post->timeout) { //连接好链表,并重置下一个预订时间为当前的timer的预定时间 timerctl.first_timer = timer; timer->next = post; timerctl.next_timeout = timer->timeout; io_store_eflags(eflags); return ; } //如果当前设置的定时器的预定时间比头结点的定时器的预定时间晚的话,需要查找合适的位置 for(;;) { pre = post; post = post->next; //跟后面的那个节点比较就行,因为第一个节点已经在for之前的那个if语句中比较过了 if(timer->timeout <= post->timeout) { pre->next = timer; timer->next = post; io_store_eflags(eflags); return ; } } return ; }
void timer_settime(TIMER* timer, unsigned int timeout) { timer_cancel(timer); timer->timeout = timeout + timerctl.count; timer->flags = TIMER_FLAGS_RUNNING; int e = io_load_eflags(); io_cli(); TIMER* t = timerctl.t0, *s = NULL; if (timer->timeout <= t->timeout) { // Earliest timer. timerctl.t0 = timer; timer->next_timer = t; timerctl.next_time = timer->timeout; } else { for (;;) { s = t; t = t->next_timer; if (timer->timeout <= t->timeout) { s->next_timer = timer; timer->next_timer = t; break; } } } io_store_eflags(e); }
void timer_settime(struct TIMER *timer,unsigned int timeout){ if(timer->flags == TIMER_FLAGS_USING){ remove_timer(timer); } timer->timeout = timeout + timerctrl.count; timer->flags = TIMER_FLAGS_USING; int eflags = io_load_eflags(); cli(); struct TIMER *head = timerctrl.head; if(timer->timeout <= head->timeout){ timerctrl.head = timer; timer->next = head; timerctrl.next = timer->timeout; io_store_eflags(eflags); return; } struct TIMER * tmp = head; while(timer->timeout > tmp->next->timeout){ tmp = tmp->next; } timer->next = tmp->next; tmp->next = timer; io_store_eflags(eflags); }