这篇教程C++ CHECK_BIT函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CHECK_BIT函数的典型用法代码示例。如果您正苦于以下问题:C++ CHECK_BIT函数的具体用法?C++ CHECK_BIT怎么用?C++ CHECK_BIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CHECK_BIT函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: macaddr_init/* * Reads MAC address if available or uses fixed one */void macaddr_init(u8 *mac_addr){ u8 buffer[6]; u8 fixed_mac[6] = {0x00, 0x03, 0x7F, 0x09, 0x0B, 0xAD};#if defined(OFFSET_MAC_ADDRESS) memcpy(buffer, (void *)(CFG_FLASH_BASE + OFFSET_MAC_DATA_BLOCK + OFFSET_MAC_ADDRESS), 6); /* * Check first LSBit (I/G bit) and second LSBit (U/L bit) in MSByte of vendor part * both of them should be 0: * I/G bit == 0 -> Individual MAC address (unicast address) * U/L bit == 0 -> Burned-In-Address (BIA) MAC address */ if (CHECK_BIT((buffer[0] & 0xFF), 0) != 0 || CHECK_BIT((buffer[0] & 0xFF), 1) != 0) { memcpy(buffer, fixed_mac, 6); mac_is_not_valid = 1; }#else memcpy(buffer, fixed_mac, 6); mac_is_not_valid = 1;#endif memcpy(mac_addr, buffer, 6);}
开发者ID:KAPMA,项目名称:u-boot_mod,代码行数:30,
示例2: SoundPlayer_SendCommandvoid SoundPlayer_SendCommand(SoundPlayer *sp, uint16_t command) { int8_t bit; CLEAR_BIT(sp->port, sp->clockPin); Util_WaitMicros(1000); if(CHECK_BIT(command, 15)) SET_BIT(sp->port, sp->dataPin); else CLEAR_BIT(sp->port, sp->dataPin); Util_WaitMicros(1000); SET_BIT(sp->port, sp->clockPin); for(bit = 14; bit >= 0; bit--) { Util_WaitMicros(200); CLEAR_BIT(sp->port, sp->clockPin); if(CHECK_BIT(command, bit)) SET_BIT(sp->port, sp->dataPin); else CLEAR_BIT(sp->port, sp->dataPin); Util_WaitMicros(200); SET_BIT(sp->port, sp->clockPin); }}
开发者ID:ISU-ETG,项目名称:Doorbell,代码行数:31,
示例3: mainint main(int argc, char* argv[]){ //unlock the system level control register volatile void *devcfg_ctrl = getvaddr(0xF8007000); volatile void *semdev = getvaddr(0x42C00000);// printf("/t/tInitial: 0x%x/n", *((volatile unsigned *)(semdev)+0)); *((volatile unsigned *)devcfg_ctrl) = *((volatile unsigned *)devcfg_ctrl) & ~PCAP_PR; *((volatile unsigned *)(semdev)+4) = 1; //set icap_grant to 1 while(!CHECK_BIT(*((volatile unsigned *)(semdev)+0), 2)){ } //Wait till we are in the observation state // printf("/t/tObservation: 0x%x/n", *((volatile unsigned *)(semdev)+0)); //Attempting to enter idle state *((volatile unsigned*)(semdev)+3) = 224; *((volatile unsigned*)(semdev)+1) = 1; *((volatile unsigned*)(semdev)+1) = 0; while(CHECK_BIT(*((volatile unsigned *)(semdev)+0), 1) || CHECK_BIT(*((volatile unsigned *)(semdev)+0), 2) || CHECK_BIT(*((volatile unsigned *)(semdev)+0), 3) || CHECK_BIT(*((volatile unsigned *)(semdev)+0), 4) || CHECK_BIT(*((volatile unsigned *)(semdev)+0), 5)){} //Wait till we are in the Idle state. //while(CHECK_BIT(*((volatile unsigned *)(semdev)+0), 2)){ } // printf("/t/tEntering Idle State: 0x%x/n", *((volatile unsigned *)(semdev)+0)); // printf("SEM Core Initialisation completed, and ready for injection./n"); return 0;}
开发者ID:STFleming,项目名称:StitchUp,代码行数:28,
示例4: memtestunsigned int memtest(multiboot_info_t* mbd, unsigned int magic){ magic = (int) magic; terminal_writestring(MULTIBOOT_TEST); if (CHECK_BIT(mbd->flags, 0)) { vgatestok(); terminal_writestring(MEMORY_MAP_TEST); if (CHECK_BIT(mbd->flags, 6)) { vgatestok(); terminal_printf("/nLower memory : %d KB/n", mbd->mem_lower); terminal_printf("Upper memory : %d KB/n/n", mbd->mem_upper); } else { vgatestko(); return (1); } return (0); } vgatestko(); return (1);}
开发者ID:Happykat,项目名称:ATOS,代码行数:31,
示例5: fpidinlockint fpidinlock (int pid,int ldes){ struct pentry *pptr; int bit_s; int r=0; //unsigned long ctime; pptr=&proctab[pid];#ifdef DEBUGD kprintf("/nInside find function ldes=%d, pid=%d, lheld50=%d/n",ldes,pid,pptr->lheld50);#endif if (ldes-100>31) { bit_s=ldes-132; if (r=CHECK_BIT(pptr->lheld50,bit_s)) CLEAR(pptr->lheld50,bit_s); return (r); } else { bit_s=ldes-100; if (r=CHECK_BIT(pptr->lheld32,bit_s)) CLEAR(pptr->lheld32,bit_s); return(r); } //should not come here return 0;}
开发者ID:ananthraghavan,项目名称:csc501-lab3,代码行数:34,
示例6: initdatastatic WORD initdata(){ union { WORD tempvar; struct { BYTE LoByte; BYTE HiByte; } bytes; } TWOBYTES; BYTE programflags; XEEBeginRead(sizeof(AppConfig)+ 49000); //This is a cheat, needs to fix memory map properly! programflags = XEERead(); //ONLY autorun program on first execution if (initflag == 0) { initflag=1; runprogram = CHECK_BIT(programflags,0); debugoutput = CHECK_BIT(programflags,1); } TWOBYTES.bytes.HiByte = XEERead(); TWOBYTES.bytes.LoByte = XEERead(); return(TWOBYTES.tempvar);}
开发者ID:DrAndyArmstrong,项目名称:tl-assembler,代码行数:29,
示例7: rotary_intr_handlerLOCAL voidrotary_intr_handler(int8_t key){ uint8 direction = 0; uint32 inputs; inputs = PIN_IN; //Read input register //Read rotary state if (CHECK_BIT(inputs,13) == CHECK_BIT(inputs,12)) direction = 1; //Not that sure what this does yet and where the register is used for uint32 gpio_status = GPIO_REG_READ(GPIO_STATUS_ADDRESS); //disable interrupt gpio_pin_intr_state_set(GPIO_ID_PIN(12), GPIO_PIN_INTR_DISABLE); //clear interrupt status GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, gpio_status & BIT(12)); //Disarm timer os_timer_disarm(&rotary_debounce_timer); //Setup timer os_timer_setfn(&rotary_debounce_timer, (os_timer_func_t *)rotary_debounce, direction); //Arm the debounce timer os_timer_arm(&rotary_debounce_timer, 350, 0);}
开发者ID:IoT-ESP8266,项目名称:ESP8266,代码行数:30,
示例8: lcdWriteBitsvoid lcdWriteBits(__s8 bits, __u8 char_mode){ mcpOutput(pin_rs, char_mode); bool z; int i; for(i=7; i>=4; i--) { z = CHECK_BIT(bits,i); if(z) mcpOutput(pin_db[i-4], 1); else mcpOutput(pin_db[i-4], 0); } lcdPulseEnable(); for(i=3; i>=0; i--) { z = CHECK_BIT(bits,i); if(z) mcpOutput(pin_db[i], 1); else mcpOutput(pin_db[i], 0); } lcdPulseEnable();}
开发者ID:dylan32406,项目名称:rpi_lcd,代码行数:25,
示例9: mainint main(void) { char x = 0x0F, i; for (i = 0; i < 8; i++) { printf("%d : %d/n", i, CHECK_BIT(x, i) > 0); if (!CHECK_BIT(x, i)) SET_BIT(x, i); else UNSET_BIT(x, i); } printf("x: %x/n", x);}
开发者ID:emancu,项目名称:pso,代码行数:9,
示例10: SET_BITvoid CLogoState::Update(float fDT){ m_fDT = fDT; m_fStateTimer += fDT; m_pGUI->Update(fDT); if (CHECK_BIT(m_nPhaseCheck, 2) == TRUE) { return; } if (m_fStateTimer > IMAGECHANGETIMER) { if (FadeToWhite(fDT, 1.0f) == TRUE) { if (FadeToNotBlack(fDT, 0.0f) == TRUE) { if (CHECK_BIT(m_nPhaseCheck, 0) == FALSE) { SET_BIT(m_nPhaseCheck, 0); m_fStateTimer = 0; m_pGPLogo->SetVisible(false); m_pStudioLogo->SetVisible(true); m_fFadeIn = 0; m_fFadeOut = 0; } else if (CHECK_BIT(m_nPhaseCheck, 1) == FALSE) { SET_BIT(m_nPhaseCheck, 1); m_fStateTimer = 0; m_pStudioLogo->SetVisible(false); m_pTeamLogo->SetVisible(true); m_fFadeIn = 0; m_fFadeOut = 0; } else if (CHECK_BIT(m_nPhaseCheck, 2) == FALSE) { SET_BIT(m_nPhaseCheck, 2); m_fStateTimer = 0; m_pTeamLogo->SetVisible(false); m_fFadeIn = 0; m_fFadeOut = 0; QueueStateChange(STATE_CH_MAINMENU); } } } } if (m_fFadeIn >= 0.0f && FadeToNotBlack(fDT, 0.0f) == FALSE) { return; }}
开发者ID:jmazzola,项目名称:Damage-Control-FinalProject,代码行数:57,
示例11: printNode/* This function reads the memory from <currentPtr> and sets * * a DEntry object's values. Then prints all the required info * * in the format. Returns 1 if there are no more entries left */int printNode(void *currentPtr) { DEntry Entry; int i; /* Get the status byte, no need for ntohs because */ memcpy(&Entry.status, currentPtr, 1); currentPtr++; if (!CHECK_BIT(Entry.status, 0)) /* checks if the bit in <pos> is 1 */ return 1; /* Get the starting block */ memcpy(&Entry.startBlock, currentPtr, 4); Entry.startBlock = ntohl(Entry.startBlock); currentPtr += 4; /* No need for this right now, maybe later * memcpy(&Entry.numBlocks, currentPtr, 4); * Entry.numBlocks = ntohl(Entry.numBlocks); */ currentPtr += 4; /* Don't need the number of blocks */ memcpy(&Entry.fileSize, currentPtr, 4); Entry.fileSize = ntohl(Entry.fileSize); currentPtr += 4; currentPtr += 7; /* Don't need the creation date */ memcpy(&Entry.modifyTimeYear, currentPtr, 2); Entry.modifyTimeYear = ntohs(Entry.modifyTimeYear); /* Get the year as a short int */ currentPtr += 2; for (i = 0;i < 5;i++) { memcpy(&Entry.modifyTime[i], currentPtr, 1); /* store the date as YYYYMMDDHHSS */ currentPtr++; } memcpy(Entry.fileName, currentPtr, 31); /* Get filename from 31 bytes, its already */ currentPtr += 37; /* null terminated. skip the unused bytes */ /* Output nicely */ if (CHECK_BIT(Entry.status, 1)) printf("F"); else printf("D"); printf("%10d%30s %4d/", Entry.fileSize, Entry.fileName, Entry.modifyTimeYear); for (i = 0;i < 4;i++) { if (i == 0) printf("%.2d/", Entry.modifyTime[i]); else if (i == 1) printf("%.2d ", Entry.modifyTime[i]); else printf("%.2d:", Entry.modifyTime[i]); } printf("%.2d/n", Entry.modifyTime[4]); return 0;}
开发者ID:bradens,项目名称:uvc,代码行数:57,
示例12: __attribute__void __attribute__ ((interrupt)) __cs3_isr_wwdg(void) { uint32_t msr = PWMSR; PWMSR = 0b111000; if(CHECK_BIT(msr, 5)) {// mb_core_message("COMPARE/n"); } if(CHECK_BIT(msr, 4)) {// mb_core_print(msr); } if(CHECK_BIT(msr, 3)) {// mb_core_message("FIFO-EMPTY/n"); // push a new compare value PWMSAR = makeSpeed(pwm_cmp); }}
开发者ID:jonmcdonald,项目名称:VistaModels,代码行数:15,
示例13: SoundPlayer_Playvoid SoundPlayer_Play(SoundPlayer *sp) { SoundPlayer_SendCommand(sp, SP_PLAY); //Initialize the blocking timeout of 50ms Util_BlockWhile(0, 50); //PIN is two bytes before the associated PORT //Block until the busy pin goes high, or 50ms has passed while(Util_BlockWhile( !CHECK_BIT(*(sp->port - 2), sp->busyPin), 0 )); //Block until the busy signal goes low while(CHECK_BIT(*(sp->port - 2), sp->busyPin)); //Wait 10ms. Otherwise the module can get confused with repeated play requests. Util_WaitMillis(10);}
开发者ID:ISU-ETG,项目名称:Doorbell,代码行数:16,
示例14: acquire_spinlock_nocheckstatic struct smp_msg *smp_check_for_message(int curr_cpu, int *source_mailbox){ struct smp_msg *msg; acquire_spinlock_nocheck(&cpu_msg_spinlock[curr_cpu]); msg = smp_msgs[curr_cpu]; if(msg != 0) { smp_msgs[curr_cpu] = msg->next; release_spinlock(&cpu_msg_spinlock[curr_cpu]); // dprintf(" found msg 0x%x in cpu mailbox/n", msg); *source_mailbox = MAILBOX_LOCAL; } else { // try getting one from the broadcast mailbox release_spinlock(&cpu_msg_spinlock[curr_cpu]); acquire_spinlock_nocheck(&broadcast_msg_spinlock); msg = smp_broadcast_msgs; while(msg != 0) { if(CHECK_BIT(msg->proc_bitmap, curr_cpu) != 0) { // we have handled this one already msg = msg->next; continue; } // mark it so we wont try to process this one again msg->proc_bitmap = SET_BIT(msg->proc_bitmap, curr_cpu); *source_mailbox = MAILBOX_BCAST; break; } release_spinlock(&broadcast_msg_spinlock); // dprintf(" found msg 0x%x in broadcast mailbox/n", msg); } return msg;}
开发者ID:NoSuchProcess,项目名称:phantomuserland,代码行数:35,
示例15: test_allocstaticunsigned long long test_alloc(ivshmem_pci_dev_t *dev, size_t size){/* * first implementation: First Fit * * param: size = # of needed _frames_ * * returns index of first free frame * returns -1 if memory is filled * * */ unsigned long long n; unsigned long long cnt = 0; for(n=0; n< dev->num_of_frames; n++) { if (!CHECK_BIT(dev->bitmap,n)) { cnt++; } else { cnt = 0; } // return index of first free frame belonging to a block of at least N free frames! if (cnt >= size) { return (n - cnt + 1); // return index of first free frame belonging to a block of at least N free frames! } } return -1; //not enough memory}
开发者ID:RWTH-OS,项目名称:pscom,代码行数:31,
示例16: do_gtellvoid do_gtell( CHAR_DATA * ch, char * argument ) { CHAR_DATA * gch; char buf[ MAX_STRING_LENGTH ]; if ( argument[ 0 ] == '/0' ) { send_to_char( AT_GREEN, "Tell your group what?/n/r", ch ); return; } if ( CHECK_BIT( ch->act, PLR_NO_TELL ) ) { send_to_char( AT_GREEN, "Your message didn't get through!/n/r", ch ); return; } /* * Note use of send_to_char, so gtell works on sleepers. */ sprintf( buf, "%s tells the group '%s'./n/r", ch->name, argument ); for ( gch = char_list; gch; gch = gch->next ) { if ( gch->deleted ) { continue; } if ( is_same_group( gch, ch ) ) { send_to_char( AT_GREEN, buf, gch ); } } return;}
开发者ID:zachflower,项目名称:oasis-mud,代码行数:31,
示例17: send_and_receive_byte/* exchanges a byte (full duplex) with the controller */static byte send_and_receive_byte(byte send_data) { byte received_data = 0x00; unsigned char i; /* send bit by bit */ for(i = 0; i < 8; i++) { /* send our bit by setting the command pin with our send_data "i" bit */ if(CHECK_BIT(send_data, i) == 0) { DS2MSP_PORTOUT &= ~DS2MSP_COMMAND_PIN; } else { DS2MSP_PORTOUT |= DS2MSP_COMMAND_PIN; } /* sinalize that our data is there and ask for the controller data by setting the clock pin to low */ DS2MSP_PORTOUT &= ~DS2MSP_CLOCK_PIN; bit_delay(); /* receive the data sent by the controller */ if((DS2MSP_PORTIN & DS2MSP_DATA_PIN) != 0) { received_data |= (1 << i); } /* set the clock to high */ DS2MSP_PORTOUT |= DS2MSP_CLOCK_PIN; bit_delay(); } return received_data;}
开发者ID:durub,项目名称:msp430-dualshock2,代码行数:28,
示例18: do_emotevoid do_emote( CHAR_DATA * ch, char * argument ) { char buf[ MAX_STRING_LENGTH ]; char * plast; if ( !IS_NPC( ch ) && CHECK_BIT( ch->act, PLR_NO_EMOTE ) ) { send_to_char( AT_PURPLE, "You are an emotionless blob./n/r", ch ); return; } if ( argument[ 0 ] == '/0' ) { send_to_char( AT_PURPLE, "Emote what?/n/r", ch ); return; } for ( plast = argument; *plast != '/0'; plast++ ) { ; } sprintf( buf, "%s%s", ( *argument == '/'' ) ? "" : " ", argument ); if ( isalpha( plast[ -1 ] ) ) { strcat( buf, "." ); } act( AT_PINK, "$n$T", ch, NULL, buf, TO_ROOM ); act( AT_PINK, "$n$T", ch, NULL, buf, TO_CHAR ); return;}
开发者ID:zachflower,项目名称:oasis-mud,代码行数:28,
示例19: printbitsvoid printbits(uint32_t n, uint8_t bits) { unsigned int step; // Loop over bits, printing as we go step = 4; // A buffer for collecting the 0s and 1s before printing as a group char output[MESSAGE_MAX_PAYLOAD]; int j = 0; for (int i = bits - 1; i >= 0; i--) { if (CHECK_BIT(n, i)) { // dprintf("1"); output[j]='1'; } else { // dprintf("0"); output[j]='0'; } j++; if (i % step == 0) { // dprintf(" "); output[j]=' '; j++; } assert(j < MESSAGE_MAX_PAYLOAD - 2); } output[j++]='/n'; output[j++]='/0'; dprintf("%s", output);}
开发者ID:henryhallam,项目名称:leitshow,代码行数:29,
示例20: add_to_boardint add_to_board(shape s, board * b){ int i, j; int * map; int * (*map_func)(int i, int j) = get_map_func(s, 0); for(i = 0; i < 4; i++){ for(j = 0; j < 4; j++){ map = map_func(i , j); //set piece in board if(CHECK_BIT(shape_bytes[s.type][BYTE_MAP(map)], BIT_MAP(map))){ if(s.y == -1) return -1; b->xy[s.x + X_MAP(map)][s.y + Y_MAP(map)] = s.type + 1; } } } return 1;}
开发者ID:biirdy,项目名称:textris,代码行数:25,
示例21: draw_shapeint draw_shape(shape s, int board_x, int board_y){ int i, j; int * map; int * (*map_func)(int i, int j) = get_map_func(s, 0); int y_vals[4]; int height = 0; attron(COLOR_PAIR(s.type+1)); for(i = 0; i < 4; i++){ for(j = 0; j < 4; j++){ map = map_func(i , j); if(CHECK_BIT(shape_bytes[s.type][BYTE_MAP(map)], BIT_MAP(map))){ mvaddch(s.y + Y_MAP(map) + board_y, ((s.x + X_MAP(map))*2) + (board_x) + 1, ' '|A_REVERSE); mvaddch(s.y + Y_MAP(map) + board_y, ((s.x + X_MAP(map))*2) + (board_x) + 2, ' '|A_REVERSE); if(!in_array(s.y + Y_MAP(map), y_vals, 4)){ y_vals[height] = s.y + Y_MAP(map); height++; } }/*else{ mvaddch(s.y + Y_MAP(map) + board_y, ((s.x + X_MAP(map))*2) + (board_x*2) + 1, 'x'); mvaddch(s.y + Y_MAP(map) + board_y, ((s.x + X_MAP(map))*2) + (board_x*2) + 2, 'x'); }*/ } } attroff(COLOR_PAIR(s.type+1)); return height;}
开发者ID:biirdy,项目名称:textris,代码行数:35,
示例22: sfsaddvoid sfsadd(sSuperStruct *s, char *name){ printf("dans sfs add avec fichier : %s /n", name); if(fileExists(name)){ int compteur=0; int add_taille=0; //addition des tailles->permet de récupérer la taille du bitmap int num_bit; //quelle place est encore disponible dans les files entries if(s->fe[0].size!=0) printf("le premier fichier est %s /n",s->fe[0].name); // CHECK_BIT(var, pos) ((var) &(1<<pos)) while( CHECK_BIT(s->fe[compteur].name[0], 6) ){ //while(s->fe[compteur].size!=0){ //printf("parcours fichier %s",s->fe[compteur].name); compteur++; } printf("on recupere la taille des num_bit /n"); num_bit=get_bit_free(); printf("on a récuperer les bits /n"); // printf("nous sommes au %d compteur et add_taille vaut %d num_bit %d /n", compteur, add_taille, num_bit); //récupération taille fichier struct stat st; stat(name, &st); printf("la taille du fichier est %d /n", st.st_size); strcpy(s->fe[compteur].name, name); s->fe[compteur].size=st.st_size; int num=0; //remplissage des bytes du bitmap int nbre_bloc= (st.st_size/1024)+1; //obtient le nombre de bloc == le nombre de bits du bitmap int byte_asked; //le byte du tab_bitmap sur lequel l'on travail byte buf[1024]; init_byte(buf, 1024); int i, fp; fp=fopen(name, "r"); for(i=num_bit; i<num_bit+nbre_bloc; i++){ byte_asked= i/8; //quel byte de tabBitmap est affecté? s->fe[compteur].indexBlock[num]=i; //enregistre le numéro du bloc dans la file entries s->sbit.tabBitmap[byte_asked]=s->sbit.tabBitmap[byte_asked]^(1<<(i%8)); //enregistre la présence du fichier sur le bit XXX byte_asked printf("remplissage du tabBitmap et le byte vaut %d /n",s->sbit.tabBitmap[byte_asked]); fread(buf, 1024,1, fp); //lecture des bytes du fichier demandée printf("LE BUFFER contient %s /n", buf); file_to_buffer(s->fc.data[i], buf, 1024); printf("Après copies l'on a dans le tableau %s /n", s->fc.data[i]); num++; } fclose(fp); } else { printf("Fichier existe pas : %s /n/n", name); }}
开发者ID:bilgin1812,项目名称:hepiaOS,代码行数:58,
示例23: serial_putchar/** * /brief Prints a single character to a serial port. */void serial_putchar(char c){ // TODO: Wait until FIFO can hold more characters (i.e. TX_FIFO_E == 1) while(!CHECK_BIT(*UART_LSR, 5)) ; //Write character (*(char *) UART_BASE) = c;}
开发者ID:gm561,项目名称:aos,代码行数:12,
示例24: save_char_obj/* * Save a character and inventory. * Would be cool to save NPC's too for quest purposes, * some of the infrastructure is provided. */void save_char_obj( CHAR_DATA * ch ) { FILE * fp; CHAR_DATA * pet; char buf[ MAX_STRING_LENGTH ]; char strsave[ MAX_INPUT_LENGTH ]; if ( IS_NPC( ch ) ) { return; } if ( ch->desc && ch->desc->original ) { ch = ch->desc->original; } update_playerlist( ch ); ch->save_time = current_time; fclose( fpReserve ); /* player files parsed directories by Yaz 4th Realm */ sprintf( strsave, "%s%c/%s", PLAYER_DIR, LOWER( ch->name[ 0 ] ), capitalize( ch->name ) ); if ( !( fp = fopen( strsave, "w" ) ) ) { sprintf( buf, "Save_char_obj: fopen %s: ", ch->name ); bug( buf, 0 ); perror( strsave ); } else { fwrite_char( ch, fp ); if ( ch->carrying ) { fwrite_obj( ch, ch->carrying, fp, 0, FALSE ); } if ( !IS_NPC( ch ) && ch->pcdata->storage ) { fwrite_obj( ch, ch->pcdata->storage, fp, 0, TRUE ); } for ( pet = ch->in_room->people; pet; pet = pet->next_in_room ) { if ( IS_NPC( pet ) ) { if ( CHECK_BIT( pet->act, ACT_PET ) && ( pet->master == ch ) ) { save_pet( ch, fp, pet ); break; } } } tail_chain(); fprintf( fp, "#END/n" ); } fclose( fp ); fpReserve = fopen( NULL_FILE, "r" ); return;}
开发者ID:zachflower,项目名称:oasis-mud,代码行数:60,
示例25: ag7240_get_ethaddr/* * Get MAC address stored in flash */static void ag7240_get_ethaddr(struct eth_device *dev) { unsigned char *mac = dev->enetaddr;#ifdef OFFSET_MAC_ADDRESS unsigned char buffer[6]; // get MAC address from flash and check it memcpy(buffer, (void *)(CFG_FLASH_BASE + OFFSET_MAC_DATA_BLOCK + OFFSET_MAC_ADDRESS), 6); /* * check first LSBit (I/G bit) and second LSBit (U/L bit) in MSByte of vendor part * both of them should be 0: * I/G bit == 0 -> Individual MAC address (unicast address) * U/L bit == 0 -> Burned-In-Address (BIA) MAC address */ if(CHECK_BIT((buffer[0] & 0xFF), 0) == 0 && CHECK_BIT((buffer[0] & 0xFF), 1) == 0){ mac[0] = (buffer[0] & 0xFF); mac[1] = (buffer[1] & 0xFF); mac[2] = (buffer[2] & 0xFF); mac[3] = (buffer[3] & 0xFF); mac[4] = (buffer[4] & 0xFF); mac[5] = (buffer[5] & 0xFF); } else { // 00-03-7F (Atheros Communications, Inc.) mac[0] = 0x00; mac[1] = 0x03; mac[2] = 0x7f; mac[3] = 0x09; mac[4] = 0x0b; mac[5] = 0xad; printf("## Error: MAC address in FLASH is invalid, using fixed!/n"); }#else // 00-03-7F (Atheros Communications, Inc.) mac[0] = 0x00; mac[1] = 0x03; mac[2] = 0x7f; mac[3] = 0x09; mac[4] = 0x0b; mac[5] = 0xad;#endif}
开发者ID:AdityaL05,项目名称:uboot,代码行数:45,
示例26: isBitSetstatic inline uint isBitSet(cbuf_t ptr, int offset) {// LOGD("isBitSet(%d, %d) called", ptr, offset); int t, poff, off; if(offset < 0) { offset = -offset; poff = -(offset / BITS + 1); off = BITS - (offset % BITS);// LOGD(" offset<0: off=%d, poff=%d", off, poff); t = CHECK_BIT(*(ptr + poff), off); } else if (offset < 8) {// LOGD(" offset<8: ---"); t = CHECK_BIT(*ptr, offset); } else { poff = offset / BITS; off = offset % BITS;// LOGD(" ---: off=%d, poff=%d", off, poff); t = CHECK_BIT(*(ptr + poff), off); }// LOGD("isBitSet(%d) exited", t); return t;}
开发者ID:bueti,项目名称:droidoflife,代码行数:21,
示例27: button_pushvoid ICACHE_FLASH_ATTRbutton_push(uint8 debounce){ if (debounce == 1) { os_timer_disarm(&button_timer); os_timer_setfn(&button_timer, (os_timer_func_t *)button_push, 0); os_timer_arm(&button_timer, 100, 1); } if (CHECK_BIT(PIN_IN,0) == 0 && button_last_state == 0) { os_printf("Button press/n"); os_timer_disarm(&button_timer); os_timer_setfn(&button_timer, (os_timer_func_t *)button_push, 1); os_timer_arm(&button_timer, 1000, 0); button_last_state = 1; } if (CHECK_BIT(PIN_IN,0) == 1 && button_last_state == 1) button_last_state = 0;}
开发者ID:IoT-ESP8266,项目名称:ESP8266,代码行数:22,
示例28: do_replyvoid do_reply( CHAR_DATA * ch, char * argument ) { CHAR_DATA * victim; int position; if ( !IS_NPC( ch ) && CHECK_BIT( ch->act, PLR_SILENCE ) ) { send_to_char( AT_WHITE, "Your message didn't get through./n/r", ch ); return; } if ( !( victim = ch->reply ) ) { send_to_char( AT_WHITE, "They aren't here./n/r", ch ); return; } if ( argument[ 0 ] == '/0' ) { send_to_char( AT_WHITE, "Reply what?/n/r", ch ); return; } if ( ( !IS_IMMORTAL( ch ) && !IS_AWAKE( victim ) ) || ( CHECK_BIT( victim->in_room->room_flags, ROOM_SILENT ) && ( get_trust( ch ) < L_APP ) ) ) { act( AT_WHITE, "$E can't hear you.", ch, 0, victim, TO_CHAR ); return; } if ( victim->desc && victim->desc->pString ) { act( AT_WHITE, "$E is in a writing buffer.", ch, 0, victim, TO_CHAR ); return; } act( AT_WHITE, "You tell $N '$t'", ch, argument, victim, TO_CHAR ); position = victim->position; victim->position = POS_STANDING; act( AT_WHITE, "$n tells you '$t'", ch, argument, victim, TO_VICT ); victim->position = position; victim->reply = ch; return;}
开发者ID:zachflower,项目名称:oasis-mud,代码行数:39,
示例29: ag7240_get_ethaddr/* * Get MAC address stored in flash */static void ag7240_get_ethaddr(struct eth_device *dev){ unsigned char *mac = dev->enetaddr; unsigned char buffer[6];#ifdef OFFSET_MAC_ADDRESS // get MAC address from flash and check it memcpy(buffer, (void *)(CFG_FLASH_BASE + OFFSET_MAC_DATA_BLOCK + OFFSET_MAC_ADDRESS), 6); // check LSBit and second LCBit in MSByte of vendor part -> both of them should be 0 if(CHECK_BIT((buffer[0] & 0xFF), 0) == 0 && CHECK_BIT((buffer[0] & 0xFF), 1) == 0){ mac[0] = (buffer[0] & 0xFF); mac[1] = (buffer[1] & 0xFF); mac[2] = (buffer[2] & 0xFF); mac[3] = (buffer[3] & 0xFF); mac[4] = (buffer[4] & 0xFF); mac[5] = (buffer[5] & 0xFF); } else { // 00-03-7F (Atheros Communications, Inc.) mac[0] = 0x00; mac[1] = 0x03; mac[2] = 0x7f; mac[3] = 0x09; mac[4] = 0x0b; mac[5] = 0xad; printf("## Error: MAC address stored in flash is invalid!/nUsing fixed address!/n"); }#else // 00-03-7F (Atheros Communications, Inc.) mac[0] = 0x00; mac[1] = 0x03; mac[2] = 0x7f; mac[3] = 0x09; mac[4] = 0x0b; mac[5] = 0xad; printf("## Error: Using fixed MAC address!/n");#endif}
开发者ID:jfojfo,项目名称:u-boot_mod,代码行数:41,
示例30: printPatternMaskInLatexvoid printPatternMaskInLatex(int mask) { int i, count; count = 0; printf("$$//left//{ "); for (i = 0; i < 16; i++) { if (!!CHECK_BIT(mask, i)) { print2x2MatrixInLatex(i); count++; if (count == 8) printf("/////n"); } } printf(" //right//} $$/n");}
开发者ID:chadbrewbaker,项目名称:polyBernoulli,代码行数:14,
注:本文中的CHECK_BIT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CHECK_BOOL函数代码示例 C++ CHECK_ARRAYS函数代码示例 |