static void bitmap_set(FS *fs, LOCATION location, int allocated) { unsigned long int bitmap_num = location / fs->bitmap_size; unsigned long int bitmap_offset = location % fs->bitmap_size; unsigned long int bitmap_byte = bitmap_offset / 8; unsigned long int bitmap_bit = bitmap_offset % 8; BLOCK *bitmap; unsigned char *byte; int prev; if (fs->bitmaps[bitmap_num] == 0) { bitmap = allocate_block(fs, B_BITMAP, 0); fs->bitmaps[bitmap_num] = bitmap->location; bitmap_set(fs, bitmap->location, 1); set_flag(fs->superblock, F_DIRTY); } else bitmap = get_block(fs, fs->bitmaps[bitmap_num], 1); byte = (unsigned char *) bitmap->buffer + sizeof(struct bitmap_block_header) + bitmap_byte; prev = (*byte & (1 << bitmap_bit)) != 0; if (allocated) *byte = *byte | (1 << bitmap_bit); else *byte = *byte & ~(1 << bitmap_bit); set_flag(bitmap, F_DIRTY); if (prev == allocated) error("Not toggling bit!\n"); //printf("Set bit %ld to %d from %d\n", location, allocated, prev); }
g1_factory_class::g1_factory_class(g1_object_type g1_ot_id, g1_loader_class * g1_lc_fp) : g1_building_class(g1_ot_id,g1_lc_fp) //, death(this) // JJ modification not to issue MSVC warning { //death.SetG1_Object_Class(this); // JJ modification not to issue MSVC warning char * n=name(); char lod_n[256]; sprintf(lod_n, "%s_lod", n); draw_params.setup(n,0,lod_n); set_flag(BLOCKING | CAN_DRIVE_ON | TARGETABLE | GROUND ,1); if (!strcmp(n, "garage")) { radar_image=&garage_radar_im; set_flag(CAN_DRIVE_ON,0); } else if (!strcmp(n, "airbase")) { radar_image=&airbase_radar_im; set_flag(CAN_DRIVE_ON,0); //this must not be true, otherwise planes might crash into it when starting } else if (!strcmp(n, "mainbasepad")) { radar_image=&mainbasepad_radar_im; } radar_type=G1_RADAR_BUILDING; }
BLOCK *clone_block(FS *fs, BLOCK *block) { BLOCK *clone; if (block->pins == 0 && !(block->flags & F_DIRTY)) { set_flag(block, F_CLONE); remove_block_from_hash(fs, block); return block; } clone = find_free_slot(fs); memcpy(clone->buffer, block->buffer, fs->block_size); set_flag(clone, F_CACHED); set_flag(clone, F_CLONE); clone->type = block->type; clone->location = block->location; if (block->type != B_DATA) { if (!parse_block(fs, clone)) { printf("Error parsing cloned block %ld\n", block->location); return NULL; } } return clone; }
static int parse_flags_option(struct isl_arg *decl, char **arg, struct isl_prefixes *prefixes, void *opt) { int has_argument; const char *flags; const char *comma; unsigned val; flags = skip_name(decl, arg[0], prefixes, 0, &has_argument); if (!flags) return 0; if (!has_argument && !arg[1]) return 0; if (!has_argument) flags = arg[1]; val = 0; while ((comma = strchr(flags, ',')) != NULL) { if (!set_flag(decl, &val, flags, comma - flags)) return 0; flags = comma + 1; } if (!set_flag(decl, &val, flags, strlen(flags))) return 0; *(unsigned *)(((char *)opt) + decl->offset) = val; return has_argument ? 1 : 2; }
UnshadedMaterial::UnshadedMaterial() :Material(VisualServer::get_singleton()->fixed_material_create()){ set_flag(FLAG_UNSHADED,true); set_use_alpha(true); set_flag(FLAG_COLOR_ARRAY_SRGB,true); }
//set flags based on comparison between a and b void CPU::compare(byte a, byte b) { char sa = a; char sb = b; set_flag(N, (sa-sb) & (1 << 7)); set_flag(Z, sa == sb); set_flag(C, a >= b); }
void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisParam p_param, real_t p_value) { ERR_FAIL_INDEX(p_axis, 3); switch (p_param) { case PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT: limits_lower[0][p_axis] = p_value; set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter break; case PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT: limits_upper[0][p_axis] = p_value; set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter break; case PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS: sixDOFConstraint->getTranslationalLimitMotor()->m_limitSoftness = p_value; break; case PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION: sixDOFConstraint->getTranslationalLimitMotor()->m_restitution = p_value; break; case PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING: sixDOFConstraint->getTranslationalLimitMotor()->m_damping = p_value; break; case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY: sixDOFConstraint->getTranslationalLimitMotor()->m_targetVelocity.m_floats[p_axis] = p_value; break; case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT: sixDOFConstraint->getTranslationalLimitMotor()->m_maxMotorForce.m_floats[p_axis] = p_value; break; case PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT: limits_lower[1][p_axis] = p_value; set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter break; case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT: limits_upper[1][p_axis] = p_value; set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter break; case PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_limitSoftness = p_value; break; case PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_damping = p_value; break; case PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_bounce = p_value; break; case PhysicsServer::G6DOF_JOINT_ANGULAR_FORCE_LIMIT: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxLimitForce = p_value; break; case PhysicsServer::G6DOF_JOINT_ANGULAR_ERP: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_stopERP = p_value; break; case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_targetVelocity = p_value; break; case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxLimitForce = p_value; break; default: WARN_PRINT("This parameter is not supported"); } }
ParticleSystemMaterial::ParticleSystemMaterial() :Material(VisualServer::get_singleton()->fixed_material_create()){ set_flag(FLAG_DOUBLE_SIDED,true); set_flag(FLAG_UNSHADED,true); set_depth_draw_mode(DEPTH_DRAW_NEVER); VisualServer::get_singleton()->fixed_material_set_flag(material,VS::FIXED_MATERIAL_FLAG_USE_ALPHA,true); VisualServer::get_singleton()->fixed_material_set_flag(material,VS::FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY,true); }
void hitachi_lcd_service(void){ if(NewCustomSymbolFlags){ set_flag(CGRAMUsed); static uint8_t DataByteNumber = 0, CustomSymbolNumber = 0; if(get_flag(CGRAMAddrSet)){ hitachi_lcd_write_data(*(CustomSymbol[CustomSymbolNumber] + DataByteNumber)); if(++DataByteNumber > 7){ bit_clr(NewCustomSymbolFlags, CustomSymbolNumber); clr_flag(CGRAMAddrSet); DataByteNumber = 0; CustomSymbolNumber = 0; } } else { while(!(NewCustomSymbolFlags & (1<<CustomSymbolNumber))) CustomSymbolNumber++; hitachi_lcd_set_address(CGRAM_ADDR(CustomSymbolNumber*8)); set_flag(CGRAMAddrSet); } } else { if(get_flag(CGRAMUsed)){ clr_flag(CGRAMUsed); clr_flag(DRAMAddrSet); CharNumber = 0; hitachi_lcd_set_address(DRAM_ADDR(0x00)); } else { switch(CharNumber){ case CHAR_IN_ROW: if(get_flag(DRAMAddrSet)){ clr_flag(DRAMAddrSet); hitachi_lcd_write_data(pLcdBuffer[CharNumber]); CharNumber++; } else { set_flag(DRAMAddrSet); hitachi_lcd_set_address(DRAM_ADDR(0x40)); } break; case CHAR_ON_LCD: if(get_flag(DRAMAddrSet)){ clr_flag(DRAMAddrSet); CharNumber = 0; hitachi_lcd_write_data(pLcdBuffer[CharNumber]); CharNumber++; } else { set_flag(DRAMAddrSet); hitachi_lcd_set_address(DRAM_ADDR(0x00)); } break; default: hitachi_lcd_write_data(pLcdBuffer[CharNumber]); CharNumber++; break; } } } }
void pofilestream::vseek(const pos_type n) { check_seekable(); if (fseek((FILE *) m_file, SEEK_SET, n) < 0) set_flag(FLAG_ERROR); else { m_pos = n; if (ferror((FILE *) m_file)) set_flag(FLAG_ERROR); } }
unsigned pifilestream::vread(void *buf, const unsigned n) { std::size_t r = fread(buf, 1, n, (FILE *) m_file); if (r < n) { if (feof((FILE *) m_file)) set_flag(FLAG_EOF); if (ferror((FILE *) m_file)) set_flag(FLAG_ERROR); } m_pos += r; return r; }
/* ----------------------------------------------------------------------------- l2tpvpn_listen - called by vpnd to setup listening socket ----------------------------------------------------------------------------- */ int l2tpvpn_listen(void) { if (listen_sockfd <= 0) return -1; if (!opt_noipsec) { vpnlog(LOG_INFO, "VPND L2TP plugin: start racoon...\n"); /* start racoon */ if (start_racoon(0 /*pppbundle*/, 0 /*"racoon.l2tp"*/) < 0) { vpnlog(LOG_ERR, "VPND L2TP plugin: cannot start racoon...\n"); return -1; } /* XXX if we started racoon, we will need to stop it */ /* racoon should probably provide a control API */ need_stop_racoon = 1; } set_flag(listen_sockfd, debug, L2TP_FLAG_DEBUG); set_flag(listen_sockfd, 1, L2TP_FLAG_CONTROL); /* unknown src and dst addresses */ any_address.sin_len = sizeof(any_address); any_address.sin_family = AF_INET; any_address.sin_port = 0; any_address.sin_addr.s_addr = INADDR_ANY; /* bind the socket in the kernel with L2TP port */ listen_address.sin_len = sizeof(listen_address); listen_address.sin_family = AF_INET; listen_address.sin_port = L2TP_UDP_PORT; listen_address.sin_addr.s_addr = INADDR_ANY; l2tp_set_ouraddress(listen_sockfd, (struct sockaddr *)&listen_address); our_address = listen_address; /* add security policies */ if (!opt_noipsec) { if (configure_racoon(&our_address, &any_address, 0, IPPROTO_UDP, opt_ipsecsharedsecret, opt_ipsecsharedsecrettype) || require_secure_transport((struct sockaddr *)&any_address, (struct sockaddr *)&listen_address, IPPROTO_UDP, "in")) { vpnlog(LOG_ERR, "VPND L2TP plugin: cannot configure secure transport...\n"); return -1; } /* set IPSec Key management to prefer most recent key */ if (set_key_preference(&key_preference, 0)) vpnlog(LOG_ERR, "VPND L2TP plugin: cannot set IPSec Key management preference (error %d)\n", errno); secure_transport = 1; } return listen_sockfd; }
void pifilestream::vseek(pos_type n) { check_seekable(); if (fseek((FILE *) m_file, SEEK_SET, n) < 0) set_flag(FLAG_ERROR); else m_pos = n; if (feof((FILE *) m_file)) set_flag(FLAG_EOF); else clear_flag(FLAG_EOF); if (ferror((FILE *) m_file)) set_flag(FLAG_ERROR); }
void pfm_to_gsf_flags (NV_U_INT32 pfm_flags, NV_U_BYTE *gsf_flags) { *gsf_flags = 0; if ((pfm_flags & PFM_MANUALLY_INVAL) || (pfm_flags & PFM_FILTER_INVAL)) { if (pfm_flags & PFM_MANUALLY_INVAL) { set_flag (gsf_flags, HMPS_IGNORE_MANUALLY_EDITED); } else { set_flag (gsf_flags, HMPS_IGNORE_FILTER_EDITED); } } else { if (pfm_flags & PFM_SELECTED_SOUNDING) set_flag (gsf_flags, HMPS_SELECTED_LEAST); if (pfm_flags & PFM_SUSPECT) set_flag (gsf_flags, HMPS_SELECTED_SPARE_1); if (pfm_flags & PFM_SELECTED_FEATURE) set_flag (gsf_flags, HMPS_SELECTED_CONTACT); } if (pfm_flags & PFM_USER_02) set_flag (gsf_flags, HMPS_INFO_NOT_1X_IHO); if (pfm_flags & PFM_USER_03) set_flag (gsf_flags, HMPS_IGNORE_NOT_2X_IHO); if (pfm_flags & PFM_USER_04) set_flag (gsf_flags, HMPS_IGNORE_FOOTPRINT_TOO_BIG); }
int main(void) { flag_init(); set_flag(UP); _delay_ms(1000); while (1) { set_flag(RIGHT); _delay_ms(2000); set_flag(LEFT); _delay_ms(2000); } return (0); }
void ter_t::load( JsonObject &jo, const std::string &src ) { map_data_common_t::load( jo, src ); mandatory( jo, was_loaded, "name", name_ ); mandatory( jo, was_loaded, "move_cost", movecost ); optional( jo, was_loaded, "max_volume", max_volume, legacy_volume_reader, DEFAULT_MAX_VOLUME_IN_SQUARE ); optional( jo, was_loaded, "trap", trap_id_str ); load_symbol( jo ); trap = tr_null; transparent = false; connect_group = TERCONN_NONE; for( auto &flag : jo.get_string_array( "flags" ) ) { set_flag( flag ); } // connect_group is initialized to none, then terrain flags are set, then finally // connections from JSON are set. This is so that wall flags can set wall connections // but can be overridden by explicit connections in JSON. if( jo.has_member( "connects_to" ) ) { set_connects( jo.get_string( "connects_to" ) ); } optional( jo, was_loaded, "open", open, ter_str_id::NULL_ID() ); optional( jo, was_loaded, "close", close, ter_str_id::NULL_ID() ); optional( jo, was_loaded, "transforms_into", transforms_into, ter_str_id::NULL_ID() ); optional( jo, was_loaded, "roof", roof, ter_str_id::NULL_ID() ); bash.load( jo, "bash", false ); deconstruct.load( jo, "deconstruct", false ); }
NucleicAcid::NucleicAcid( const clipper::Coord_orth& cp, const clipper::Coord_orth& co5, const clipper::Coord_orth& cc5, const clipper::Coord_orth& cc4, const clipper::Coord_orth& co4, const clipper::Coord_orth& cc3, const clipper::Coord_orth& co3, const clipper::Coord_orth& cc2, const clipper::Coord_orth& cc1, const clipper::Coord_orth& cn, const clipper::String& type ) { clipper::String t = type + "?"; typ = t.trim()[0]; clipper::Util::set_null( p_x ); clipper::Util::set_null( o5x ); clipper::Util::set_null( c5x ); clipper::Util::set_null( c4x ); clipper::Util::set_null( o4x ); clipper::Util::set_null( c3x ); clipper::Util::set_null( o3x ); clipper::Util::set_null( c2x ); clipper::Util::set_null( c1x ); clipper::Util::set_null( n_x ); if ( !cp.is_null() ) { p_x = cp.x(); p_y = cp.y(); p_z = cp.z(); } if ( !co5.is_null() ) { o5x = co5.x(); o5y = co5.y(); o5z = co5.z(); } if ( !cc5.is_null() ) { c5x = cc5.x(); c5y = cc5.y(); c5z = cc5.z(); } if ( !cc4.is_null() ) { c4x = cc4.x(); c4y = cc4.y(); c4z = cc4.z(); } if ( !co4.is_null() ) { o4x = co4.x(); o4y = co4.y(); o4z = co4.z(); } if ( !cc3.is_null() ) { c3x = cc3.x(); c3y = cc3.y(); c3z = cc3.z(); } if ( !co3.is_null() ) { o3x = co3.x(); o3y = co3.y(); o3z = co3.z(); } if ( !cc2.is_null() ) { c2x = cc2.x(); c2y = cc2.y(); c2z = cc2.z(); } if ( !cc1.is_null() ) { c1x = cc1.x(); c1y = cc1.y(); c1z = cc1.z(); } if ( !cn.is_null() ) { n_x = cn.x(); n_y = cn.y(); n_z = cn.z(); } set_flag(); }
/** * \brief 向套接口发送原始数据,没有打包的数据,一般发送数据的时候需要加入额外的包头 * \param pBuffer 待发送的原始数据 * \param nSize 待发送的原始数据大小 * \return 实际发送的字节数 * 返回-1,表示发送错误 * 返回0,表示发送超时 * 返回整数,表示实际发送的字节数 */ int CSocket::sendRawData(const void *pBuffer,const int nSize) { if (isset_flag(INCOMPLETE_WRITE)) { clear_flag(INCOMPLETE_WRITE); goto do_select; } if( nSize > 10000 ) { int iii = 0; } int retcode = Send(sock,(const char*)pBuffer,nSize,MSG_NOSIGNAL); if (retcode == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) { do_select: retcode = waitForWrite(); if (1 == retcode) { mutex.lock(); retcode = Send(sock,(const char*)pBuffer,nSize,MSG_NOSIGNAL); mutex.unlock(); } else return retcode; } if (retcode > 0 && retcode < nSize) set_flag(INCOMPLETE_WRITE); return retcode; }
FixedMaterial::FixedMaterial() : Material(VS::get_singleton()->fixed_material_create()) { param[PARAM_DIFFUSE]=Color(1,1,1); param[PARAM_SPECULAR]=Color(0.0,0.0,0.0); param[PARAM_EMISSION]=Color(0.0,0.0,0.0); param[PARAM_SPECULAR_EXP]=40; param[PARAM_GLOW]=0; param[PARAM_NORMAL]=1; param[PARAM_SHADE_PARAM]=0.5; param[PARAM_DETAIL]=1.0; set_flag(FLAG_COLOR_ARRAY_SRGB,true); fixed_flags[FLAG_USE_ALPHA]=false; fixed_flags[FLAG_USE_COLOR_ARRAY]=false; fixed_flags[FLAG_USE_POINT_SIZE]=false; fixed_flags[FLAG_USE_XY_NORMALMAP]=false; fixed_flags[FLAG_DISCARD_ALPHA]=false; for(int i=0;i<PARAM_MAX;i++) { texture_texcoord[i]=TEXCOORD_UV; } light_shader=LIGHT_SHADER_LAMBERT; point_size=1.0; }
__interrupt void TIMERA0_ISR(void) { // ENABLE_ADC; // give Vref time to settle down need 30 uS (clock cycles) before conversion P1OUT ^= GREEN_LED; // Clear P1.0 LED off ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start set_flag(TIMER0_FLAG); }
g1_road_object_class::g1_road_object_class(g1_object_type id, g1_loader_class * fp) : g1_path_object_class(id,fp) { w16 version,data_size; ref=0; rlen=0; if (fp) { fp->get_version(version,data_size); } else { version=0; } switch (version) { case ROAD_DATA_VERSION: { nid=fp->read_32(); fp->read_32(); //reserved fp->end_version(I4_LF); } break; case 0: { nid=0; // a setup() will come shortly } break; } draw_params.setup("smallcrossroad"); set_flag(TARGETABLE,0); }
void apply_cd(char *command) { char **av; int size; t_env *env; av = ft_strsplit(command, ' '); size = av_size(av); env = init_env(NULL, 0); if (!parse_cd(av)) { if (size == 1 || (size == 2 && !ft_strcmp(av[1], "-P")) || (size == 2 && !ft_strcmp(av[1], "-L")) || (size == 2 && !ft_strcmp(av[1], "~")) || (size == 3 && !ft_strcmp(av[2], "~"))) { if (!chdir(env->home)) update_env(&env, "/nfs"); set_flag(&env, 0); } else go_newdir(env, av[size - 1]); if (g_pid.built == -1) g_pid.built = 1; } del_av(av); }
/* * Allocate a page and add it to freelist of given pool. */ static int grow_pool(struct xv_pool *pool, gfp_t flags) { struct page *page; struct block_header *block; page = alloc_page(flags); if (unlikely(!page)) return -ENOMEM; stat_inc(&pool->total_pages); spin_lock(&pool->lock); block = get_ptr_atomic(page, 0); block->size = PAGE_SIZE - XV_ALIGN; set_flag(block, BLOCK_FREE); clear_flag(block, PREV_FREE); set_blockprev(block, 0); insert_block(pool, page, 0, block); put_ptr_atomic(block); spin_unlock(&pool->lock); return 0; }
void cycle4 (void) { if (do_cycle2 == 1) { arb_debug_reg(0x44, 0x00000000); //---------------------------------------------------------------------------------------------------------- // Go into indefinite sleep if (!get_flag(FLAG_GOCEP_SUB)) { set_flag(FLAG_GOCEP_SUB, 1); arb_debug_reg(0x44, 0x00000001); set_wakeup_timer(5, 0, 1); mbus_sleep_all(); } //---------------------------------------------------------------------------------------------------------- // After wakeup by GOCEP else { if (irq_history == ((0x1 << IRQ_WAKEUP) | (0x1 << IRQ_GOCEP))) { pass (0x1, irq_history); irq_history = 0; disable_all_irq(); } else { fail (0x1, irq_history); disable_all_irq(); } arb_debug_reg(0x44, 0x00000002); } } }
void cycle1 (void) { if (do_cycle1 == 1) { #ifdef PREv19 arb_debug_reg(0x41, 0x00000000); //---------------------------------------------------------------------------------------------------------- // XO Timer if (!get_flag(FLAG_XO_SUB)) { set_flag(FLAG_XO_SUB, 1); // Configure XO // In reality, the XO driver must be properly configured and started arb_debug_reg(0x41, 0x00000001); set_wakeup_timer (100, 0, 1); set_xo_timer (100, 1, 1); mbus_sleep_all(); } //---------------------------------------------------------------------------------------------------------- // End of Testing else { uint32_t temp_val = 0; while (temp_val == 0) { temp_val = *XOT_VAL;} arb_debug_reg(0x41, (0x10 << 24) | temp_val); set_xo_timer (100, 0, 1); arb_debug_reg(0x41, 0x00000002); } #endif } }
static int mxt_proc_proximity_msg(struct plugin_ac *p,unsigned long pl_flag) { const struct mxt_config *dcfg = p->dcfg; struct device *dev = dcfg->dev; struct t72_observer *obs = p->obs; int ret; dev_info2(dev, "mxt t72 at mxt_proc_proximity_msg flag 0x%lx pl_flag 0x%lx\n",obs->flag,pl_flag); //proximity if (test_flag(IRAD_FLAG_PROXIMITY_DETECTED, &obs->flag)) { proximity_enable(true); ret = get_proximity_data(); if (ret != 0) { dev_info(dev, "mxt t72 proximity removed\n"); clear_flag(IRAD_FLAG_PROXIMITY_DETECTED, &obs->flag); p->set_and_clr_flag(p->dev, PL_STATUS_FLAG_PROXIMITY_REMOVED, 0); } proximity_enable(false); }else if (test_flag(/*T72_FLAG_CAL*/T72_FLAG_RESUME, &obs->flag)) {//only check when proximity not detected proximity_enable(true); ret = get_proximity_data(); if (ret == 0) { dev_info(dev, "mxt t72 proximity detected\n"); set_flag(IRAD_FLAG_PROXIMITY_DETECTED, &obs->flag); }else { dev_info(dev, "mxt t72 proximity not detected\n"); clear_flag(IRAD_FLAG_PROXIMITY_DETECTED, &obs->flag); } proximity_enable(false); } return 0; }
static BLOCK *find_free_slot(FS *fs) { int attempts = 0, max = 3; while (attempts < max) { BLOCK *ptr = fs->cache_tail; attempts++; while (ptr != NULL) { if (!(ptr->flags & F_CACHED) || (!(ptr->flags & F_DIRTY) && ptr->pins == 0)) { flush_block(fs, ptr); remove_block_from_hash(fs, ptr); ptr->flags = 0; set_flag(ptr, F_CACHED); ptr->pins = 0; return ptr; } ptr = ptr->prev; } flush_fs(fs); } error("No more free slots in cache -- increase size or find bug"); return NULL; }
int main(int argc, char **argv) { int socketDescriptor; struct sockaddr_in serverAddress; sigset(SIGCHLD, signal_handler); /* SEKCJA OBSLUGI SYGNALOW */ sigset(SIGINT, signal_handler); sigset(SIGTERM, signal_handler); set_flag(1); clear_screen(); serverAddress = input_parser(argc,argv); /* SEKCJA PARSUJACA PARAMETRY URUCHOMIENIA */ if (serverAddress.sin_port == 0) info_local_handler(__SRV_INVALID_SYNTAX); /* jezeli uzytkownik nie poda nr'u portu, program nie rozpocznie nawiazywania polaczenia */ else { socketDescriptor = socket_descriptor_create(); /* SEKCJA TWORZENIA POLACZENIA */ socket_binder(socketDescriptor, serverAddress); socket_listen(socketDescriptor); } while (wait(0) != -1) continue; /* ewentualne zakonczenie procesow potomnych */ info_local_handler(__STOP_SERVER); exit(0); }
void emu_options::update_slot_options() { // look up the system configured by name; if no match, do nothing const game_driver *cursystem = system(); if (cursystem == NULL) return; machine_config config(*cursystem, *this); // iterate through all slot devices slot_interface_iterator iter(config.root_device()); for (device_slot_interface *slot = iter.first(); slot != NULL; slot = iter.next()) { // retrieve info about the device instance const char *name = slot->device().tag() + 1; if (exists(name) && slot->first_option() != NULL) { std::string defvalue; slot->get_default_card_software(defvalue); if (defvalue.length() > 0) { set_default_value(name, defvalue.c_str()); const device_slot_option *option = slot->option(defvalue.c_str()); set_flag(name, ~OPTION_FLAG_INTERNAL, (option != NULL && !option->selectable()) ? OPTION_FLAG_INTERNAL : 0); } } } while (add_slot_options(false)); add_device_options(false); }
static void populate_block(FS *fs, BLOCK *block) { struct block_header *bh = (struct block_header *) block->buffer; if (block->type == B_DATA || block->type == B_FREE) return; bh->version = 1; bh->location = block->location; bh->type = block->type; if (block->type == B_SUPER) { struct superblock_header *sbh = (struct superblock_header *) block->buffer; sbh->block_size = fs->block_size; sbh->root_location = fs->root_location; sbh->next_label = fs->next_label; sbh->max_bitmap_pointers = fs->max_bitmap_pointers; sbh->num_bitmap_pointers = fs->num_bitmap_pointers; sbh->bitmap_size = fs->bitmap_size; } set_flag(block, F_DIRTY); }