当前位置: 首页>>代码示例>>C++>>正文


C++ SBI函数代码示例

本文整理汇总了C++中SBI函数的典型用法代码示例。如果您正苦于以下问题:C++ SBI函数的具体用法?C++ SBI怎么用?C++ SBI使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SBI函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SBI

///
/// read one or more word(s) from the VS1001 Control registers
///
void vs1001::read(uint8 address, uint16 count, uint16 *pData)
{
	uint8 i;

#ifdef VS1000_NEW
	SBI( xDCS_PORT, xDCS_PIN ); 	// xDCS hi
#else
	CBI( BSYNC_PORT, BSYNC_PIN ); 	// byte sync lo
#endif
	
	CBI( MP3_PORT, MP3_PIN);	// xCS lo
	write_byte_spi(VS1001_READ);
	write_byte_spi(address);

	while (count--)
	{
		*pData = write_byte_spi(0) << 8;
		*pData++ |= write_byte_spi(0);
	}

	SBI( MP3_PORT, MP3_PIN);	// xCS hi

	//this is absolutely neccessary!
	//delay(5); //wait 5 microseconds after sending data to control port
	for (i=0;i<8;i++)
		asm volatile("nop");

    
}
开发者ID:brokentoaster,项目名称:ArduinoMP3,代码行数:32,代码来源:vs1001.cpp

示例2: CBI

///
/// send a byte to the VS1001 MPEG stream
///
void vs1001::send_data(unsigned char b)
{
	char i;
#ifdef VS1000_NEW
	CBI( xDCS_PORT,   xDCS_PIN );		//  XDCS lo
#else
	SBI( BSYNC_PORT,   BSYNC_PIN ); 	// byte sync hi
#endif
	//	outp(b, SPDR);			// send data
	SPDR = b;				// send data
	
	// release BSYNC before end of byte
#ifndef VS1000_NEW
	asm volatile("nop");
	asm volatile("nop"); 
	asm volatile("nop"); 
	CBI( BSYNC_PORT,   BSYNC_PIN ); 	// byte sync lo
#endif	
	// wait for data to be sent
	loop_until_bit_is_set(SPSR, SPIF); 
	
	//release xDCS after byte has been sent
#ifdef VS1000_NEW
	SBI( xDCS_PORT,   xDCS_PIN );		// byte XDCS hi
#endif
	i = SPDR; 				// clear SPIF
	

}
开发者ID:brokentoaster,项目名称:ArduinoMP3,代码行数:32,代码来源:vs1001.cpp

示例3: capifs_put_super

static void capifs_put_super(struct super_block *sb)
{
	struct capifs_sb_info *sbi = SBI(sb);
	struct inode *inode;
	int i;

	for ( i = 0 ; i < sbi->max_ncci ; i++ ) {
		if ( (inode = sbi->nccis[i].inode) ) {
			if (atomic_read(&inode->i_count) != 1 )
				printk("capifs_put_super: badness: entry %d count %d\n",
				       i, (unsigned)atomic_read(&inode->i_count));
			inode->i_nlink--;
			iput(inode);
		}
	}

	*sbi->back = sbi->next;
	if ( sbi->next )
		SBI(sbi->next)->back = sbi->back;

	kfree(sbi->nccis);
	kfree(sbi);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,51)
	MOD_DEC_USE_COUNT;
#endif
}
开发者ID:dmgerman,项目名称:linux-pre-history,代码行数:26,代码来源:capifs.c

示例4: _BV

void MarlinSerial::begin(long baud) {
  uint16_t baud_setting;
  bool useU2X = true;

  #if F_CPU == 16000000UL && SERIAL_PORT == 0
    // hard-coded exception for compatibility with the bootloader shipped
    // with the Duemilanove and previous boards and the firmware on the 8U2
    // on the Uno and Mega 2560.
    if (baud == 57600) {
      useU2X = false;
    }
  #endif

  if (useU2X) {
    M_UCSRxA = _BV(M_U2Xx);
    baud_setting = (F_CPU / 4 / baud - 1) / 2;
  }
  else {
    M_UCSRxA = 0;
    baud_setting = (F_CPU / 8 / baud - 1) / 2;
  }

  // assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register)
  M_UBRRxH = baud_setting >> 8;
  M_UBRRxL = baud_setting;

  SBI(M_UCSRxB, M_RXENx);
  SBI(M_UCSRxB, M_TXENx);
  SBI(M_UCSRxB, M_RXCIEx);
}
开发者ID:StephS,项目名称:Marlin_Gladiola,代码行数:30,代码来源:MarlinSerial.cpp

示例5: SBI

SBI opcja_tekst::EventProc(sf::Event event)
{
	//cout << "otrzymano event";
	//cout << "dla elem: "<< dan->elem->AktTresc() << "\n";
	if (event.Type==sf::Event::MouseButtonPressed)
	{
		return SBI(true);
	}
	if (event.Type==sf::Event::KeyPressed)
	{
		cout << "otrzymano klawiszowy event";
		if (event.Key.Code==sf::Key::Return||event.Key.Code==sf::Key::Escape||event.Key.Code==sf::Key::Left||event.Key.Code==sf::Key::Right)
			return SBI(true);
		cout << " nie exituje... \n";
		if (dan->czyliczba&&(((char)event.Key.Code>=(char)sf::Key::Num0&&(char)event.Key.Code<=(char)sf::Key::Num9)||event.Key.Code==sf::Key::Up||event.Key.Code==sf::Key::Down))//
		{
			cout << " edytujesz liczbe :) ";
			dan->elem->EdycjaUserLiczby(dan->min,dan->max,event.Key.Code);
		}
		if ((((char)event.Key.Code>='a'&&(char)event.Key.Code<='z')||((char)event.Key.Code>='0'&&(char)event.Key.Code<='9')||event.Key.Code==sf::Key::Period||event.Key.Code==sf::Key::Back)&&!(dan->czyliczba))
		{
			cout << "edytujesz klawisz :) ";
			dan->elem->EdycjaUserStringa(event.Key.Code,event.Key.Shift,dan->min, dan->max);
		}
	}
	return SBI();
}
开发者ID:cytadela8,项目名称:GameBall,代码行数:27,代码来源:opcja_tekst.cpp

示例6: delay

/// reset the VS1001
void vs1001::reset(reset_e r)
{

	uint16 buf[2];

	if (r == SOFT_RESET)
	{
		
	//	delay(200);		// 200 mS
		SPSR = (0<<SPI2X);			//set spi to Fosc/4
		
		// set SW reset bit	
		buf[0] = SM_RESET ;
		vs1001::write(SCI_MODE,1,buf);	// set bit 2

		delay(2);		// 2 mS

		while( !((DREQ_PORT) & (1<<DREQ_PIN)) ); //wait for DREQ
	    
        CBI( MP3_PORT, MP3_PIN); 		// output low (select MP3)
#ifdef VS1000_NEW        
        //send a pulse to ensure BSYNC Counter has been reset
        CBI( xDCS_PORT, xDCS_PIN );		// output Low
        SBI( xDCS_PORT, xDCS_PIN );		// output High
#else
        //send a pulse to ensure BSYNC Counter has been reset
        SBI( BSYNC_PORT, BSYNC_PIN );		// output High
        CBI( BSYNC_PORT, BSYNC_PIN );		// output low
#endif
        SBI( MP3_PORT, MP3_PIN); 		// output hi (deselect MP3)
        
#ifdef VS1000_NEW
        buf[0] = SM_SDINEW ; 
        vs1001::write(SCI_MODE,1, buf);
#endif
        // set CLOCKF for 24.576 MHz
		// change to doubler //nick 7/7/04
		buf[0] = 0x9800;
		vs1001::write(SCI_CLOCKF,1,buf);	
   		vs1001::write(SCI_CLOCKF,1,buf);	
#ifdef VS1001
		// Force clock doubler see pg32 of VS10XX appl.notes
		buf[0] = 0x8008;
		vs1001::write(SCI_INT_FCTLH,1,buf);
#endif
        while( !((DREQ_PORT) & (1<<DREQ_PIN)) ); //wait for DREQ
        
		vs1001::nulls(32);
	    
		SPSR = (1<<SPI2X);			//set spi to Fosc/2
	}
	else if (r == HARD_RESET)
	{
		CBI(RESET_PORT, RESET_PIN);	// RESET- lo
		delay(1);	// 1 mS	    
		SBI(RESET_PORT, RESET_PIN);	// RESET- hi
		delay(5);	// 5 mS	    
	}
}
开发者ID:brokentoaster,项目名称:ArduinoMP3,代码行数:60,代码来源:vs1001.cpp

示例7: devpts_pty_new

void devpts_pty_new(int number, kdev_t device)
{
	struct super_block *sb = devpts_mnt->mnt_sb;
	struct devpts_sb_info *sbi = SBI(sb);
	struct inode *inode;
		
	if ( sbi->inodes[number] )
		return; /* Already registered, this does happen */
		
	inode = new_inode(sb);
	if (!inode)
		return;
	inode->i_ino = number+2;
	inode->i_blocks = 0;
	inode->i_blksize = 1024;
	inode->i_uid = sbi->setuid ? sbi->uid : current->fsuid;
	inode->i_gid = sbi->setgid ? sbi->gid : current->fsgid;
	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
	init_special_inode(inode, S_IFCHR|sbi->mode, kdev_t_to_nr(device));

	if ( sbi->inodes[number] ) {
		iput(inode);
		return;
	}
	sbi->inodes[number] = inode;
}
开发者ID:dmgerman,项目名称:original,代码行数:26,代码来源:inode.c

示例8: ss_stream_can_push

static bool ss_stream_can_push(StreamSlave *obj,
                StreamCanPushNotifyFn notify,
                void *notify_opaque)
{
    SlaveBootInt *s = SBI(obj);
    /* FIXME: Check for SMAP mode
     *        Add AXI Slave interface
     *        Add JTAG Interface
     */

    if (!s->smap_busy) {
        smap_data_rdwr(s);
    }
    if (sbi_can_receive_from_dma(s)) {
        /* return false and store the notify opts */
        s->notify = notify;
        s->notify_opaque = notify_opaque;
        return false;
    } else {
        /* Read to receive */
        s->notify = NULL;
        s->notify_opaque = NULL;
        return true;
    }
}
开发者ID:Xilinx,项目名称:qemu,代码行数:25,代码来源:pmc_sbi.c

示例9: capifs_new_ncci

void capifs_new_ncci(char type, unsigned int num, kdev_t device)
{
	struct super_block *sb;
	struct capifs_sb_info *sbi;
	struct capifs_ncci *np;
	ino_t ino;

	for ( sb = mounts ; sb ; sb = sbi->next ) {
		sbi = SBI(sb);

		for (ino = 0, np = sbi->nccis ; ino < sbi->max_ncci; ino++, np++) {
			if (np->used == 0) {
				np->used = 1;
				np->type = type;
				np->num = num;
				np->kdev = device;
				break;
			}
		}

		if ((np->inode = iget(sb, ino+2)) != 0) {
			struct inode *inode = np->inode;
			inode->i_uid = sbi->setuid ? sbi->uid : current->fsuid;
			inode->i_gid = sbi->setgid ? sbi->gid : current->fsgid;
			inode->i_mode = sbi->mode | S_IFCHR;
			inode->i_rdev = np->kdev;
			inode->i_nlink++;
		}
	}
}
开发者ID:dmgerman,项目名称:linux-pre-history,代码行数:30,代码来源:capifs.c

示例10: capifs_read_inode

static void capifs_read_inode(struct inode *inode)
{
	ino_t ino = inode->i_ino;
	struct capifs_sb_info *sbi = SBI(inode->i_sb);

	inode->i_mode = 0;
	inode->i_nlink = 0;
	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
	inode->i_blocks = 0;
	inode->i_blksize = 1024;
	inode->i_uid = inode->i_gid = 0;

	if ( ino == 1 ) {
		inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
		inode->i_op = &capifs_root_inode_operations;
		inode->i_fop = &capifs_root_operations;
		inode->i_nlink = 2;
		return;
	} 

	ino -= 2;
	if ( ino >= sbi->max_ncci )
		return;		/* Bogus */
	
	init_special_inode(inode, S_IFCHR, 0);

	return;
}
开发者ID:dmgerman,项目名称:linux-pre-history,代码行数:28,代码来源:capifs.c

示例11: capifs_free_ncci

void capifs_free_ncci(char type, unsigned int num)
{
	struct super_block *sb;
	struct capifs_sb_info *sbi;
	struct inode *inode;
	struct capifs_ncci *np;
	ino_t ino;

	for ( sb = mounts ; sb ; sb = sbi->next ) {
		sbi = SBI(sb);

		for (ino = 0, np = sbi->nccis ; ino < sbi->max_ncci; ino++, np++) {
			if (!np->used || np->type != type || np->num != num)
				continue;
			if (np->inode) {
				inode = np->inode;
				np->inode = 0;
				np->used = 0;
				inode->i_nlink--;
				iput(inode);
				break;
			}
		}
	}
}
开发者ID:SimonKagstrom,项目名称:mci500h-linux-2.4.27,代码行数:25,代码来源:capifs.c

示例12: MIXER_STEPPER_LOOP

 /**
  * M165: Set multiple mix factors for a mixing extruder.
  *       Omitted factors will be set to 0.
  *       The mix is normalized and stored in the current virtual tool.
  *
  *   A[factor] Mix factor for extruder stepper 1
  *   B[factor] Mix factor for extruder stepper 2
  *   C[factor] Mix factor for extruder stepper 3
  *   D[factor] Mix factor for extruder stepper 4
  *   H[factor] Mix factor for extruder stepper 5
  *   I[factor] Mix factor for extruder stepper 6
  */
 void GcodeSuite::M165() {
   // Get mixing parameters from the GCode
   // The total "must" be 1.0 (but it will be normalized)
   // If no mix factors are given, the old mix is preserved
   const char mixing_codes[] = { 'A', 'B'
     #if MIXING_STEPPERS > 2
       , 'C'
       #if MIXING_STEPPERS > 3
         , 'D'
         #if MIXING_STEPPERS > 4
           , 'H'
           #if MIXING_STEPPERS > 5
             , 'I'
           #endif // MIXING_STEPPERS > 5
         #endif // MIXING_STEPPERS > 4
       #endif // MIXING_STEPPERS > 3
     #endif // MIXING_STEPPERS > 2
   };
   uint8_t mix_bits = 0;
   MIXER_STEPPER_LOOP(i) {
     if (parser.seenval(mixing_codes[i])) {
       SBI(mix_bits, i);
       mixer.set_collector(i, parser.value_float());
     }
   }
   // If any mixing factors were included, clear the rest
   // If none were included, preserve the last mix
   if (mix_bits) {
     MIXER_STEPPER_LOOP(i)
       if (!TEST(mix_bits, i)) mixer.set_collector(i, 0.0f);
     mixer.normalize();
   }
 }
开发者ID:szymonrychu,项目名称:Marlin,代码行数:45,代码来源:M163-M165.cpp

示例13: get_val

// Returns a 10bit value
unsigned int get_val(void)
{
  unsigned int res;

  // Start the free running conversion
  SBI(ADCSRA, ADSC);
  // Wait for conversion to finish (ADIF == interrupt flag == 1)
  while ((ADCSRA & (1 << ADIF)) == 0);
  //res = ADCH;
  //res = res << 8;
  //res = res | ADCL;
  res = 0L | ADCW;
  // Clear the interrupt flag
  SBI(ADCSRA, ADIF);
  return res;
}
开发者ID:mandraga,项目名称:SombreroBms,代码行数:17,代码来源:adc.c

示例14: ss_sbi_receive

static void ss_sbi_receive(void *opaque, const uint8_t *buf, int size)
{
    SlaveBootInt *s = SBI(opaque);
    uint32_t free = fifo_num_free(&s->fifo);

    while (s->BusWidthDetectCounter < 16) {
        /* First 16 bytes are used by harware for input port width
         * detection. We dont need to do that, so discard without
         * copying them to buffer
         */
        s->BusWidthDetectCounter++;
        buf++;
        size--;
        if (!size) {
            break;
        }
    }

    DPRINT("%s: Payload of size: %d recv\n", __func__, size);
    if (size <= free) {
        fifo_push_all(&s->fifo, buf, size);
        if (IF_BURST(free)) {
            ss_stream_notify(s);
            DEP_AF_DP32(s->regs, SBI_IRQ_STATUS, DATA_RDY, 1);
        }

        if (IF_NON_BURST(free)) {
            ss_stream_notify(s);
            DEP_AF_DP32(s->regs, SBI_IRQ_STATUS, DATA_RDY, 1);
        }
    }

    ss_update_busy_line(s);
    sbi_update_irq(s);
}
开发者ID:Xilinx,项目名称:qemu,代码行数:35,代码来源:pmc_sbi.c

示例15: capifs_new_ncci

void capifs_new_ncci(char type, unsigned int num, kdev_t device)
{
	struct super_block *sb;
	struct capifs_sb_info *sbi;
	struct capifs_ncci *np;
	ino_t ino;

	for ( sb = mounts ; sb ; sb = sbi->next ) {
		sbi = SBI(sb);

		for (ino = 0, np = sbi->nccis ; ino < sbi->max_ncci; ino++, np++) {
			if (np->used == 0) {
				np->used = 1;
				np->type = type;
				np->num = num;
				np->kdev = device;
				break;
			}
		}
		if ( ino >= sbi->max_ncci )
			continue;

		if ((np->inode = capifs_new_inode(sb)) != NULL) {
			struct inode *inode = np->inode;
			inode->i_uid = sbi->setuid ? sbi->uid : current->fsuid;
			inode->i_gid = sbi->setgid ? sbi->gid : current->fsgid;
			inode->i_nlink = 1;
			inode->i_ino = ino + 2;
			init_special_inode(inode, sbi->mode|S_IFCHR, np->kdev);
		}
	}
}
开发者ID:SimonKagstrom,项目名称:mci500h-linux-2.4.27,代码行数:32,代码来源:capifs.c


注:本文中的SBI函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。