//------------------------------- static void HIGHBITS(int8u_t data) { if(data & 0x80) ENABLE(LCD_WIRE,D7); else DISABLE(LCD_WIRE,D7); if(data & 0x40) ENABLE(LCD_WIRE,D6); else DISABLE(LCD_WIRE,D6); if(data & 0x20) ENABLE(LCD_WIRE,D5); else DISABLE(LCD_WIRE,D5); if(data & 0x10) ENABLE(LCD_WIRE,D4); else DISABLE(LCD_WIRE,D4); }
//------------------------------- static void LOWBITS(int8u_t data) { if(data & 0x08) ENABLE(LCD_WIRE,D7); else DISABLE(LCD_WIRE,D7); if(data & 0x04) ENABLE(LCD_WIRE,D6); else DISABLE(LCD_WIRE,D6); if(data & 0x02) ENABLE(LCD_WIRE,D5); else DISABLE(LCD_WIRE,D5); if(data & 0x01) ENABLE(LCD_WIRE,D4); else DISABLE(LCD_WIRE,D4); }
//------------------------------- void lcd_prints(const char *p) {/* WRITE A STRING TO LCD */ ENABLE(LCD_WIRE,RS); while(*p) { #if ( USE_FORMATTED_OUTPUT ) //------------------------------- // new line //------------------------------- if((*p == '\n')) { DISABLE(LCD_WIRE,RS); lcd_goto(2,0); ENABLE(LCD_WIRE,RS); p++; } //------------------------------- // return //------------------------------- else if((*p == '\r')) { DISABLE(LCD_WIRE,RS); lcd_return(); ENABLE(LCD_WIRE,RS); p++; } //------------------------------- // tab //------------------------------- else if((*p == '\t')) { DISABLE(LCD_WIRE,RS); switch(TAB_SPACE) { case 8: lcd_cmd(0x14,0); // cursor right shift lcd_cmd(0x14,0); // cursor right shift lcd_cmd(0x14,0); // cursor right shift lcd_cmd(0x14,0); // cursor right shift case 4: lcd_cmd(0x14,0); // cursor right shift lcd_cmd(0x14,0); // cursor right shift case 2: lcd_cmd(0x14,0); // cursor right shift case 1: lcd_cmd(0x14,0); // cursor right shift } ENABLE(LCD_WIRE,RS); p++; } //------------------------------- // display //------------------------------- else #endif lcd_cmd(*p++,0); } DISABLE(LCD_WIRE,RS); }
int tinytimber(Object *obj, Method m, int arg) { char status; DISABLE(status); initialize(); ENABLE(1); if (m != NULL) m(obj, arg); DISABLE(status); idle(); return 0; }
// See usage in header. cct_node_t* hpcrun_cct_insert_backtrace(cct_node_t* treenode, frame_t* path_beg, frame_t* path_end) { TMSG(FENCE, "insert backtrace into treenode %p", treenode); TMSG(FENCE, "backtrace below"); bool bt_ins = ENABLED(BT_INSERT); if (ENABLED(FENCE)) { ENABLE(BT_INSERT); } cct_node_t* path = cct_insert_raw_backtrace(treenode, path_beg, path_end); if (! bt_ins) DISABLE(BT_INSERT); // Put lush as_info class correction here // N.B. If 'frm' is a 1-to-1 bichord and 'path' is not (i.e., 'path' // is M-to-1 or 1-to-M), then update the association of 'path' to // reflect that 'path' is now a proxy for two bichord types (1-to-1 // and M-to-1 or 1-to-M) cct_addr_t* addr = hpcrun_cct_addr(path); lush_assoc_t as_frm = lush_assoc_info__get_assoc(path_beg->as_info); lush_assoc_t as_path = lush_assoc_info__get_assoc(addr->as_info); if (as_frm == LUSH_ASSOC_1_to_1 && as_path != LUSH_ASSOC_1_to_1) { // INVARIANT: path->as_info should be either M-to-1 or 1-to-M lush_assoc_info__set_assoc(hpcrun_cct_addr(path)->as_info, LUSH_ASSOC_1_to_1); } return path; }
/* fixed_timer_init: * Installs the fixed-rate timer driver. */ int dzdos_fixed_timer_init() { int i; detect_os(); LOCK_VARIABLE(dzdos_timedrv_fixed_rate); LOCK_VARIABLE(dzdos_bios_counter); LOCK_FUNCTION(dzdos_fixed_timer_handler); dzdos_bios_counter = 0x10000; if (_dzdos_install_irq(TIMER_INT, dzdos_fixed_timer_handler) != 0) return -1; DISABLE(); /* sometimes it doesn't seem to register if we only do this once... */ for (i=0; i<4; i++) dzdos_set_timer_rate(LOVEBILL_TIMER_SPEED); ENABLE(); return 0; }
//------------------------------- static void LCD_STROBE(int16u_t loop) { ENABLE(LCD_WIRE,E); DELAY(MCU_CLK); DISABLE(LCD_WIRE,E); // Enter DELAY(loop); }
/* request_modex_scroll: * Requests a scroll but doesn't wait for it to be competed: just writes * to some VGA registers and some variables used by the vertical retrace * interrupt simulator, and then returns immediately. The scroll will * actually take place during the next vertical retrace, so this function * can be used together with poll_modex_scroll to implement triple buffered * animation systems (see examples/ex20.c). */ static int request_modex_scroll(int x, int y) { long a = x + (y * VIRTUAL_W); DISABLE(); _vsync_out_h(); /* write to VGA address registers */ _write_vga_register(_crtc, 0x0D, (a>>2) & 0xFF); _write_vga_register(_crtc, 0x0C, (a>>10) & 0xFF); ENABLE(); if (_timer_use_retrace) { /* store low 2 bits where the timer handler will find them */ _retrace_hpp_value = (a&3)<<1; } else { /* change instantly */ _write_hpp((a&3)<<1); } return 0; }
void StepApplicationStartup(void) { /* Handle re-entrancy */ boolean_T inStepApplicationStartup_Now; DISABLE(); inStepApplicationStartup_Now = inStepApplicationStartup; inStepApplicationStartup = 1; UNDISABLE(); if (inStepApplicationStartup_Now) return; if ((ApplicationInitStatus == APP_INIT_BEFORE_MODEL) && (ApplicationPausePoint > APP_INIT_BEFORE_MODEL)) { /* Initialize Application Model: BaseEngineController_A02_bak2 */ BaseEngineController_A02_bak2_initialize(1); BaseEngineController_A02_bak2_step(); ApplicationInitStatus = APP_INIT_BEFORE_STARTUP; } if ((ApplicationInitStatus == APP_INIT_BEFORE_STARTUP) && (ApplicationPausePoint > APP_INIT_BEFORE_STARTUP)) { /* Trigger the STARTUP_EVENT trigger after MODEL_initialize, but before any other events. */ SendEvent(STARTUP_EVENT); ApplicationInitStatus = APP_INIT_AFTER_STARTUP; } if ((ApplicationInitStatus == APP_INIT_AFTER_STARTUP) && (ApplicationPausePoint > APP_INIT_AFTER_STARTUP)) { ApplicationInitStatus = APP_INIT_RUN; ApplicationStatus = APPLICATION_RUN; } /* Handle re-entrancy */ inStepApplicationStartup = 0; }
static void LCD_STROBE_native(uint32_t us) { ENABLE(LCD_WIRE,E); DELAY_native(us); DISABLE(LCD_WIRE,E); // Enter DELAY_native(us); }
/* communication primitives */ Msg async(Time bl, Time dl, Object *to, Method meth, int arg) { Msg m; Time now; char status; DISABLE(status); m = dequeue(&msgPool); m->to = to; m->method = meth; m->arg = arg; m->baseline = (status ? current->msg->baseline : timestamp) + bl; m->deadline = m->baseline + (dl > 0 ? dl : INFINITY); TIMERGET(now); if (m->baseline - now > 0) { // baseline has not yet passed enqueueByBaseline(m, &timerQ); TIMERSET(timerQ); } else { // m is immediately schedulable enqueueByDeadline(m, &msgQ); if (status && threadPool && (msgQ->deadline - activeStack->msg->deadline < 0)) { push(pop(&threadPool), &activeStack); dispatch(activeStack); } } ENABLE(status); return m; }
Time CURRENT_OFFSET(void) { char status; Time now; DISABLE(status); TIMERGET(now); ENABLE(status); return now - (status ? current->msg->baseline : timestamp); }
void glDisableClientState.@precall() { switch (array) { case GL_VERTEX_ARRAY: DISABLE(TRS_CTX_VERTEX_ENABLED); break; case GL_NORMAL_ARRAY: DISABLE(TRS_CTX_NORMAL_ENABLED); break; case GL_COLOR_ARRAY: DISABLE(TRS_CTX_COLOR_ENABLED); break; case GL_MATRIX_INDEX_ARRAY_OES: DISABLE(TRS_CTX_MATRIXINDEX_ENABLED); break; case GL_POINT_SIZE_ARRAY_OES: DISABLE(TRS_CTX_POINTSIZE_ENABLED); break; case GL_TEXTURE_COORD_ARRAY: DISABLE(TRS_CTX_CTEXUNIT_TEXCOORD_ENABLED); break; case GL_WEIGHT_ARRAY_OES: DISABLE(TRS_CTX_WEIGHT_ENABLED); break; } }
void timerdisable( int timer ) { TimerReg *t = TIMERREG; if ((timer < 0) || (timer > 1)) return; intrmask(TIMERbit(timer), 0); DISABLE(t, timer); }
void install(Object *obj, Method m, enum Vector i) { if (i >= 0 && i < N_VECTORS) { char status; DISABLE(status); otable[i] = obj; mtable[i] = m; obj->wantedBy = INSTALLED_TAG; // Mark object as subject to synchronization by interrupt disabling ENABLE(status); } }
static INTR_PROTOTYPE newinterrupt (void) { (*oldinterrupt)(); DISABLE(); if (inside) { static UINT tempstack [STK_SIZE]; #ifdef __WATCOMC__ STACK_SET (&tempstack[STK_SIZE-1]); #else static UINT old_SP; static WORD old_SS; asm mov ax, ss asm mov old_SS, ax asm mov ax, sp asm mov old_SP, ax asm mov ax, ds asm mov ss, ax asm lea sp, tempstack[STK_SIZE-1] #endif ENABLE(); if (user_routine) (*user_routine)(); tcp_tick (NULL); DISABLE(); #ifdef __WATCOMC__ STACK_RESTORE(); #else asm mov ax, old_SS asm mov ss, ax asm mov ax, old_SP asm mov sp, ax #endif inside = 0; } ENABLE(); }
static void interrupt newinterrupt(void) { (*oldinterrupt)(); DISABLE(); if (inside) { static UINT tempstack [STK_SIZE]; #ifdef __WATCOMC__ stackset (&tempstack[STK_SIZE-1]); #else static UINT old_SP; static WORD old_SS; asm mov ax,ss asm mov old_SS,ax asm mov ax,sp asm mov old_SP,ax asm mov ax,ds asm mov ss,ax asm lea sp,tempstack[STK_SIZE-1] #endif ENABLE(); if (userRoutine) (*userRoutine)(); tcp_tick (NULL); DISABLE(); #ifdef __WATCOMC__ stackrestore(); #else asm mov ax,old_SS asm mov ss,ax asm mov ax,old_SP asm mov sp,ax #endif inside = 0; } ENABLE(); }
int pkt_buffers_used (void) { BYTE in_idx, out_idx; DISABLE(); out_idx = PEEKW (0, QUE_OFS(out_index)); in_idx = PEEKW (0, QUE_OFS(in_index)); ENABLE(); if (in_idx >= out_idx) return (in_idx - out_idx); return (RX_BUFS + in_idx - out_idx); }
void _glfwWaitNextEvent( void ) { int noevent = 1; while( noevent ) { DISABLE(); noevent = ( _glfwEventBuffer.Start == _glfwEventBuffer.End ); ENABLE(); // Wait for an interrupt to happen?... } }
/* var_timer_exit: * Shuts down the variable-rate timer driver. */ void dzdos_var_timer_exit() { DISABLE(); dzdos_set_timer_rate(0); _dzdos_remove_irq(TIMER_INT); dzdos_set_timer_rate(0); ENABLE(); }
int sync(Object *to, Method meth, int arg) { Thread t; int result; char status, status_ignore; DISABLE(status); t = to->ownedBy; if (t) { // to is already locked while (t->waitsFor) t = t->waitsFor->ownedBy; if (t == current || !status) { // deadlock! ENABLE(status); return -1; } if (to->wantedBy) // must be a lower priority thread to->wantedBy->waitsFor = NULL; to->wantedBy = current; current->waitsFor = to; dispatch(t); if (current->msg == NULL) { // message was aborted (when called from run) ENABLE(status); return 0; } } to->ownedBy = current; ENABLE(status && (to->wantedBy != INSTALLED_TAG)); result = meth(to, arg); DISABLE(status_ignore); to->ownedBy = NULL; t = to->wantedBy; if (t && (t != INSTALLED_TAG)) { // we have run on someone's behalf to->wantedBy = NULL; t->waitsFor = NULL; dispatch(t); } ENABLE(status); return result; }
/* mouse_position: */ static void mouse_position(int x, int y) { DISABLE(); x_axis.out_abs = x; y_axis.out_abs = y; x_axis.mickeys = 0; y_axis.mickeys = 0; _mouse_x = x; _mouse_y = y; ENABLE(); }
/* mick_set_speed: * Sets the speed of the mickey-mode mouse. */ static void mick_set_speed(int xspeed, int yspeed) { DISABLE(); mouse_sx = MAX(1, xspeed); mouse_sy = MAX(1, yspeed); mouse_mx = COORD_TO_MICKEY_X(_mouse_x); mouse_my = COORD_TO_MICKEY_Y(_mouse_y); CLEAR_MICKEYS(); ENABLE(); }
/* mouse_set_range: */ static void mouse_set_range(int x1, int y1, int x2, int y2) { x_axis.out_min = x1; y_axis.out_min = y1; x_axis.out_max = x2; y_axis.out_max = y2; /* There's no set range for z */ DISABLE(); _mouse_x = CLAMP(x1, _mouse_x, x2); _mouse_y = CLAMP(y1, _mouse_y, y2); ENABLE(); }
/* mick_position: * Sets the position of the mickey-mode mouse. */ static void mick_position(int x, int y) { DISABLE(); _mouse_x = x; _mouse_y = y; mouse_mx = COORD_TO_MICKEY_X(x); mouse_my = COORD_TO_MICKEY_Y(y); CLEAR_MICKEYS(); mymickey_x = mymickey_y = 0; ENABLE(); }
/* mouse_set_speed: * Number of mickeys to cross the screen horizontally: speed * 320. */ static void mouse_set_speed(int speedx, int speedy) { float scale = 1; if (gfx_driver) scale = gfx_driver->w/320; DISABLE(); x_axis.speed = scale / MAX(1, speedx); y_axis.speed = scale / MAX(1, speedy); x_axis.mickeys = 0; y_axis.mickeys = 0; ENABLE(); }
/* * Close the service descriptor. * If this is an RPC service, deregister it. * Close the log. */ void svc_deactivate( struct service *sp ) { if ( ! SVC_IS_AVAILABLE( sp ) ) return ; deactivate( sp ) ; ps.rws.descriptors_free++ ; if ( SVC_IS_ACTIVE( sp ) ) { FD_CLR( SVC_FD( sp ), &ps.rws.socket_mask ) ; ps.rws.active_services-- ; } ps.rws.available_services-- ; DISABLE( sp ) ; }
void ABORT(Msg m) { char status; DISABLE(status); if (remove(m, &timerQ) || remove(m, &msgQ)) insert(m, &msgPool); else { Thread t = activeStack; while (t) { if ((t != current) && (t->msg == m) && (t->waitsFor == m->to)) { t->msg = NULL; insert(m, &msgPool); break; } t = t->next; } } ENABLE(status); }
/* modex_scroll: * Hardware scrolling routine for mode-X. */ static int modex_scroll(int x, int y) { long a = x + (y * VIRTUAL_W); DISABLE(); _vsync_out_h(); /* write to VGA address registers */ _write_vga_register(_crtc, 0x0D, (a>>2) & 0xFF); _write_vga_register(_crtc, 0x0C, (a>>10) & 0xFF); ENABLE(); /* write low 2 bits to horizontal pan register */ _write_hpp((a&3)<<1); return 0; }
/* mick_set_range: * Sets the range of the mickey-mode mouse. */ static void mick_set_range(int x1, int y1, int x2, int y2) { mouse_minx = x1; mouse_miny = y1; mouse_maxx = x2; mouse_maxy = y2; DISABLE(); _mouse_x = CLAMP(mouse_minx, _mouse_x, mouse_maxx); _mouse_y = CLAMP(mouse_miny, _mouse_y, mouse_maxy); mouse_mx = COORD_TO_MICKEY_X(_mouse_x); mouse_my = COORD_TO_MICKEY_Y(_mouse_y); CLEAR_MICKEYS(); ENABLE(); }