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


C++ puthex函数代码示例

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


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

示例1: main

int main( void )
{
	avr_init();
	pulse_init();

	puts( "$Id: tach.c,v 2.0 2002/09/22 02:10:18 tramm Exp $" );
	putnl();

	while( 1 )
	{
		puthex( high_bits );
		puthex( time() );
		putc( ':' );

		puthexs( pulse_0 );
		putc( ' ' );
		puthexs( pulse_1 );
		putnl();

		pulse_1 = pulse_0 = 0;

		msleep( 8192 );
	}

	return 0;
}
开发者ID:anjdreas,项目名称:Helicopter-Autopilot-Simulator,代码行数:26,代码来源:tach.c

示例2: init_kheap

void init_kheap()
{
	kernel_heap = build_heap((uintptr_t*)HEAP_BEGIN, 1, 0);
	
	// Self-test
	puts("heap self-test\n");
	uint32_t *test_alloc = (uint32_t*)kalloc(sizeof(uint32_t));
	uint32_t *test_alloc_2 = (uint32_t*)kalloc(sizeof(uint32_t));
	
	puts("var1(uint32_t)=");
	puthex((uintptr_t)test_alloc);
	puts(", var2(uint32_t)=");
	puthex((uintptr_t)test_alloc_2);
	puts("\n");
	
	*test_alloc = 0x1234ABCD;
	*test_alloc_2 = 0xCAFEBEEF;
	
	kfree((uintptr_t*)test_alloc);
	kfree((uintptr_t*)test_alloc_2);
	
	uint32_t* test_alloc_3 = (uint32_t*)kalloc(sizeof(uint64_t));
	puts("var1 and var2 freed, var3(uint64_t)=");
	puthex((uintptr_t)test_alloc_3);
	puts(", should be ");
	puthex((uintptr_t)test_alloc);
	puts("\n");
	
	if(test_alloc_3 == test_alloc)
		puts("self-test succeeded\n");
	
	kfree((uintptr_t*)test_alloc_3);
}
开发者ID:MrXedac,项目名称:riku,代码行数:33,代码来源:heap.c

示例3: decompress_kernel

void decompress_kernel(unsigned long boot_heap_start)
{
    unsigned long zimage_start, zimage_size;

    __stack_chk_guard_setup();

    zimage_start = (unsigned long)(&__image_begin);
    zimage_size = (unsigned long)(&__image_end) -
                  (unsigned long)(&__image_begin);

    puts("zimage at:     ");
    puthex(zimage_start);
    puts(" ");
    puthex(zimage_size + zimage_start);
    puts("\n");

    /* This area are prepared for mallocing when decompressing */
    free_mem_ptr = boot_heap_start;
    free_mem_end_ptr = boot_heap_start + BOOT_HEAP_SIZE;

    /* Display standard Linux/MIPS boot prompt */
    puts("Uncompressing Linux at load address ");
    puthex(VMLINUX_LOAD_ADDRESS_ULL);
    puts("\n");

    /* Decompress the kernel with according algorithm */
    decompress((char *)zimage_start, zimage_size, 0, 0,
               (void *)VMLINUX_LOAD_ADDRESS_ULL, 0, error);

    /* FIXME: should we flush cache here? */
    puts("Now, booting the kernel...\n");
}
开发者ID:asdlei00,项目名称:linux,代码行数:32,代码来源:decompress.c

示例4: startup_message

void startup_message(void)
{
    putcrlf();
#ifdef __GNUC__
    putstring("GCC " __VERSION__ "\r\n");
#endif
    putstring(name_string);
    putspace();
    putstring(version_string);
    /* Silicon Revision */
    putstring(" Mask(");
    puthex(ECHV);
    /* ADC reading codes Board ID */
    putstring(") ID(");
    putstring(board_id_to_string());
    /* Stack pointer */
    putstring(") SP(");
    puthex(SP);
    putstring(") ");
    putstring(date_string);
    putspace();
    putstring(time_string);

    /* now for some manufacturing data */
    putcrlf();
    if( manufacturing_find_tag("T#") )
        manufacturing_print_tag();
    putspace();
    if( manufacturing_find_tag("SN") || manufacturing_find_tag("S#") )
        manufacturing_print_tag();
}
开发者ID:XVilka,项目名称:OpenEC,代码行数:31,代码来源:main.c

示例5: debug_section_header

void debug_section_header(Elf64_Shdr* h)
{
	puts("-- Section header --\n");
	puts("Name: ");
	puthex(h->sh_name);
	puts("\n");
	puts("Type: ");
	puthex(h->sh_type);
	puts("\n");
	puts("Flags: ");
	puthex(h->sh_flags);
	puts("\n");
	puts("Virtual address: ");
	puthex(h->sh_vaddr);
	puts("\n");
	puts("Offset in file: ");
	puthex(h->sh_offset);
	puts("\n");
	puts("Size of section: ");
	puthex(h->sh_size);
	puts("\n");
	puts("Link: ");
	puthex(h->sh_link);
	puts("\n");
	puts("Misc info: ");
	puthex(h->sh_info);
	puts("\n");
	puts("Alignment: ");
	puthex(h->sh_addralign);
	puts("\n");
	puts("Size of entries in section table: ");
	puthex(h->sh_entsize);
	puts("\n");
}
开发者ID:pranas,项目名称:jaos64,代码行数:34,代码来源:elf.c

示例6: ow_dump

void ow_dump()
{
    putspace();
    puthex( transfer_state );
    putspace();
    puthex( transfer_cnt );
}
开发者ID:XVilka,项目名称:OpenEC,代码行数:7,代码来源:one_wire.c

示例7: memcpy

u8 NFC_Module::InListPassiveTarget(u8 *buf, u8 brty,
                                   u8 len, u8 *idata, u8 maxtg)
{
    nfc_buf[0] = PN532_COMMAND_INLISTPASSIVETARGET;
    nfc_buf[1] = maxtg;
    nfc_buf[2] = brty;
    if(len){
        memcpy(nfc_buf+3, idata, len);
    }
    if(!write_cmd_check_ack(nfc_buf, 3+len)){
        return 0;
    }
#ifdef PN532DEBUG
    puthex(nfc_buf, 3+len);
    Serial.println();
#endif
//	puthex(nfc_buf, 3+len);
//    Serial.println();
	
    /** "Waiting for IRQ (indicates card presence)" */
    wait_ready();
	wait_ready();
	wait_ready();
#ifdef PN532DEBUG
	Serial.print(" Found Card.\n");
#endif
    read_dt(nfc_buf,40);
//	puthex(nfc_buf, nfc_buf[3]+6);
//    Serial.println();
    if(nfc_buf[NFC_FRAME_ID_INDEX-1] != 0xD5){
        return 0;
    }
	
    puthex(nfc_buf, nfc_buf[3]+6);
    Serial.println();

    if(nfc_buf[NFC_FRAME_ID_INDEX] != (PN532_COMMAND_INLISTPASSIVETARGET+1)){
        return 0;
    }
//    if(nfc_buf[NFC_FRAME_ID_INDEX+1]!=1){
//#ifdef PN532DEBUG
//        Serial.println(nfc_buf[NFC_FRAME_ID_INDEX+1],DEC);
//#endif
//        return 0;
//    }
    if(brty == PN532_BRTY_ISO14443A){
        /** UUID length */
        buf[0] = nfc_buf[12];

        for(u8 i=1; i<5; i++){
            buf[i] = nfc_buf[12+i];
        }
    }else{
        buf[0] = nfc_buf[3];
        memcpy(buf, nfc_buf+5, nfc_buf[3]);
    }

    return 1;
}
开发者ID:Swifty88,项目名称:nfc-pn532,代码行数:59,代码来源:nfc.cpp

示例8: aes_dec_firstround

static
void aes_dec_firstround(aes_cipher_state_t* state, const aes_roundkey_t* k)
{
    uint8_t i;

    /// *** STEP 1: keyAdd ***
    for(i=0; i<16; ++i)
    {
        state->s[i] ^= k->ks[i];
    }

#ifdef ENCRYPTION_DEBUG
    beginSerial(115200, 0);
    digitalWrite(23,0x01);
    digitalWrite(11,0x00);
    printString("\n\n*** STEP 1: keyAdd    --> ",  0);
    _delay_ms(3);
    for(i=0; i<16; ++i)
    {
        puthex((char)state->s[i],0);
        _delay_ms(3);
    }
#endif


    /// *** STEP 2: invert shiftRows ***
    aes_invshiftcol(state->s+1, 1);
    aes_invshiftcol(state->s+2, 2);
    aes_invshiftcol(state->s+3, 3);

#ifdef ENCRYPTION_DEBUG
    printString("\n*** STEP 2: shiftRows --> ",  0);
    _delay_ms(3);
    for(i=0; i<16; ++i)
    {
        puthex((char)state->s[i],0);
        _delay_ms(3);
    }
#endif


    /// *** STEP 3: subBytes ***
    for(i=0; i<16; ++i)
    {
        state->s[i] = pgm_read_byte(aes_invsbox+state->s[i]);
    }

#ifdef ENCRYPTION_DEBUG
    printString("\n*** STEP 3: subBytes  --> ",  0);
    _delay_ms(3);
    for(i=0; i<16; ++i)
    {
        puthex((char)state->s[i],0);
        _delay_ms(3);
    }
#endif
}
开发者ID:Console32,项目名称:waspmoteapi,代码行数:57,代码来源:aes_dec.c

示例9: set_rime_addr

//added by dongbo huang, this is to set the short address of this node
static void
 set_rime_addr(void)
 {
	signed char i;
  
	#if CC2530_CONF_MAC_FROM_PRIMARY
		unsigned char __xdata *macp = &X_IEEE_ADDR;
	#else
		unsigned char __code *macp = (__code unsigned char *)0xFFE8;
	#endif


//#if CC2530_CONF_MAC_FROM_PRIMARY
//  	putstring("Reading MAC from Info Page\r\n");
//#else
//  	putstring("Reading MAC from flash\r\n");

  /*
   * The MAC is always stored in 0xFFE8 of the highest BANK of our flash. This
   * maps to address 0xFFF8 of our CODE segment, when this BANK is selected.
   * Load the bank, read 8 bytes starting at 0xFFE8 and restore last BANK.
   * Since we are called from main(), this MUST be BANK1 or something is very
   * wrong. This code can be used even without a bankable firmware.
   */

  /* Don't interrupt us to make sure no BANK switching happens while working */
//  DISABLE_INTERRUPTS();

  /* Switch to the BANKn,
   * map CODE: 0x8000 - 0xFFFF to FLASH: 0xn8000 - 0xnFFFF */
//  FMAP = CC2530_LAST_FLASH_BANK;
//#endif

  for(i = (RIMEADDR_SIZE - 1); i >= 0; --i) {
    rimeaddr_node_addr.u8[i] = *macp;
    macp++;
  }

#if !CC2530_CONF_MAC_FROM_PRIMARY
  /* Remap 0x8000 - 0xFFFF to BANK1 */
  FMAP = 1;
  ENABLE_INTERRUPTS();
#endif

  /* Now the address is stored MSB first */
#if STARTUP_CONF_VERBOSE
  putstring("Rime configured with address ");
  for(i = 0; i < RIMEADDR_SIZE - 1; i++) {
    puthex(rimeaddr_node_addr.u8[i]);
    putchar(':');
  }
  puthex(rimeaddr_node_addr.u8[i]);
  putstring("\r\n");
#endif
  cc2530_rf_set_addr(IEEE802154_PANID);
  return;
}
开发者ID:hbofffw,项目名称:mywork,代码行数:58,代码来源:hello-world.c

示例10: PROCESS_THREAD

PROCESS_THREAD(test_send_process, ev, data)
{
	static struct etimer et;
	static char hello[5];
	static int i;
	static char *testvalue;
	PROCESS_BEGIN();
	
	etimer_set(&et,CLOCK_CONF_SECOND/100);
	//event_temperature_send = process_alloc_event();
	//event_uart_send = process_alloc_event();
	//process_post(&test_send_process,event_uart_send,NULL);
	while(1) 
	{
		PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
		//PROCESS_WAIT_EVENT_UNTIL(ev == event_uart_send);
		if(strncmp(rxbuf,"hello",5) == 0)
		{
			//putstring("instruction indicated");
			strcpy(rxbuf,"");
			bufpos = 0;
			buflen = 0;
			unsigned char __code *dst = (__code unsigned char *)FRAME802154_BROADCASTADDR;
			puthex(*dst);
			puthex(*dst++);
			testvalue = getintvalue();
			strcpy(testvalue,"hello");
			
			printf("\r\ntest value is %s, function value = %d, initial value = %d\r\n", testvalue, (char*)getintvalue(),integerValue);
			//strcpy(hello,"hello");
			//now I'm trying to test the basic cc2530rf functionality
			/*cc2530_rf_driver.init();
			if(cc2530_rf_driver.send((void*)hello,sizeof("hello")) == RADIO_TX_OK)
			{
				strcpy(hello,"");
				putstring("some packets sent");
			}
			else
				putstring("send failed");
			*/
			//edited by dognbo huang, the codes commented below is used for to analyse the ADC module working procedure
			//puttemperature();
			//putstring("getting temperature...\r\n");
			//process_post(&sensors_test_process,event_temperature_send,NULL);
		}
		else
		{
			strcpy(rxbuf,"");
			bufpos = 0;
			buflen = 0;
		}
		
		etimer_reset(&et);
	}
	PROCESS_END();
}
开发者ID:hbofffw,项目名称:mywork,代码行数:56,代码来源:hello-world.c

示例11: dumpmem

void
dumpmem (FILE * f, void *buf, unsigned int len, unsigned int offset)
{
  unsigned int i;
  unsigned int address;
  unsigned char *p;
  static const unsigned int MASK_LOWER = 0x0f;

  char line[80];

  if (offset >= len)
    return;

  address = offset;
  p = ((unsigned char *) buf) + offset;

  fputs("  Addr     0 1  2 3  4 5  6 7  8 9  A B  C D  E F 0 2 4 6 8 A C E \n",f);
  fputs("--------  ---- ---- ---- ---- ---- ---- ---- ---- ----------------\n",f);

  while (p < ((unsigned char *) buf) + len)
    {
      for (i = 0; i < 50; i++)
        line[i] = ' ';
      for (; i < 80; i++)
        line[i] = 0;
      if ((address & ~MASK_LOWER) != address)   /* address % 16 != 0 */
        {
          puthex ((address & ~MASK_LOWER), 8, line, 0);
          for (i = 0; i < (address & MASK_LOWER); i++)
            {
              line[10 + i * 2 + i / 2] = ' ';
              line[10 + i * 2 + i / 2 + 1] = ' ';
              line[50 + i] = ' ';
            }
          address = address & ~MASK_LOWER;
        }
      else
        {
          puthex (address, 8, line, 0);
          i = 0;
        }

      for (; i < 16; i++)
        {
          puthex (((long) *p) & 0x0ff, 2, line, 10 + i * 2 + i / 2);
          line[50 + i] = '.';
          if (isprint (*p))
            line[50 + i] = *p;
          if (++p >= (unsigned char *) buf + len)
            break;
        }
      fputs (line, f);
      fputs ("\n", f);
      address += 16;
    }
}
开发者ID:GNsunghokim,项目名称:rtos,代码行数:56,代码来源:test_common.c

示例12: wait_ready

u8 NFC_Module::P2PInitiatorTxRx(u8 *t_buf, u8 t_len, u8 *r_buf, u8 *r_len)
{
//    wait_ready();
//    wait_ready();
    wait_ready(15);
    nfc_buf[0] = PN532_COMMAND_INDATAEXCHANGE;
    nfc_buf[1] = 0x01; // logical number of the relevant target

    memcpy(nfc_buf+2, t_buf, t_len);

    if(!write_cmd_check_ack(nfc_buf, t_len+2)){
        return 0;
    }
#ifdef PN532_P2P_DEBUG
    Serial.println("Initiator DataExchange sent.");
#endif

    wait_ready(200);

    read_dt(nfc_buf, 60);
    if(nfc_buf[5] != 0xD5){
        return 0;
    }

#ifdef PN532_P2P_DEBUG
    Serial.println("Initiator DataExchange Get.");
#endif

    if(nfc_buf[NFC_FRAME_ID_INDEX] != (PN532_COMMAND_INDATAEXCHANGE+1)){
#ifdef PN532_P2P_DEBUG
        puthex(nfc_buf, nfc_buf[3]+7);
        Serial.println("Send data failed");
#endif
        return 0;
    }

    if(nfc_buf[NFC_FRAME_ID_INDEX+1]){
#ifdef PN532_P2P_DEBUG
        Serial.print("InExchangeData Error:");
        puthex(nfc_buf, nfc_buf[3]+7);
        Serial.println();
#endif
        return 0;
    }

#ifdef PN532_P2P_DEBUG
    puthex(nfc_buf, nfc_buf[3]+7);
    Serial.println();
#endif
    /** return read data */
    *r_len = nfc_buf[3]-3;
    memcpy(r_buf, nfc_buf+8, *r_len);
    return 1;
}
开发者ID:babylazy,项目名称:smartdoor,代码行数:54,代码来源:nfc.cpp

示例13: print_ptr

int			print_ptr(void *ptr)
{
	int		size;

	size = get_size(ptr);
	puthex((size_t)ptr);
	ft_putstr(" - ");
	puthex((size_t)(ptr + size));
	ft_putstr(" : ");
	print_nbr(size);
	ft_putendl(" octets");
	return (size);
}
开发者ID:jilth,项目名称:malloc,代码行数:13,代码来源:misc_func.c

示例14: debug_program_header

void debug_program_header(Elf64_Phdr* h)
{
	puts("-- Program header --\n");
	puts("Type: ");
	puthex(h->p_type);
	puts("\n");
	puts("Flags: ");
	puthex(h->p_flags);
	puts("\n");
	puts("Offset in file: ");
	puthex(h->p_offset);
	puts("\n");
	puts("Virtual address: ");
	puthex(h->p_vaddr);
	puts("\n");
	puts("Reserved: ");
	puthex(h->p_paddr);
	puts("\n");
	puts("Segment size in file: ");
	puthex(h->p_filesz);
	puts("\n");
	puts("Segment size in mem: ");
	puthex(h->p_memsz);
	puts("\n");
	puts("Alignment: ");
	puthex(h->p_align);
	puts("\n");
}
开发者ID:pranas,项目名称:jaos64,代码行数:28,代码来源:elf.c

示例15: tcpip_handler

/*---------------------------------------------------------------------------*/
static void
tcpip_handler(void)
{
  leds_on(LEDS_GREEN);
  if(uip_newdata()) {
    putstring("0x");
    puthex(uip_datalen());
    putstring(" bytes response=0x");
    puthex((*(uint16_t *) uip_appdata) >> 8);
    puthex((*(uint16_t *) uip_appdata) & 0xFF);
    putchar('\n');
  }
  leds_off(LEDS_GREEN);
  return;
}
开发者ID:1847123212,项目名称:ampm_contiki_wisun,代码行数:16,代码来源:client.c


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