• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PTOV函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: bd_int13probe

/*
 * Try to detect a device supported by the legacy int13 BIOS
 */
static int
bd_int13probe(struct bdinfo *bd)
{
    int addr;

    if (bd->bd_flags & BD_FLOPPY) {
	addr = 0xa155c;
    } else {
	if ((bd->bd_unit & 0xf0) == 0x80)
	    addr = 0xa155d;
	else
	    addr = 0xa1482;
    }
    if ( *(u_char *)PTOV(addr) & (1<<(bd->bd_unit & 0x0f))) {
	bd->bd_flags |= BD_MODEINT13;
	return(1);
    }
    if ((bd->bd_unit & 0xF0) == 0xA0) {
	int media = ((unsigned *)PTOV(0xA1460))[bd->bd_unit & 0x0F] & 0x1F;

	if (media == 7) { /* MO */
	    bd->bd_flags |= BD_MODEINT13 | BD_OPTICAL;
	    return(1);
	}
    }
    return(0);
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:30,代码来源:biosdisk.c


示例2: vidc_init

static int
vidc_init(int arg)
{
    int		i, hw_cursor;

    if (vidc_started && arg == 0)
	return (0);
    vidc_started = 1;
    Crtat = (unsigned short *)PTOV(0xA0000);
    while ((inb(0x60) & 0x04) == 0)
	;
    outb(0x62, 0xe0);
    while ((inb(0x60) & 0x01) == 0)
	;
    hw_cursor = inb(0x62);
    hw_cursor |= (inb(0x62) << 8);
    inb(0x62);
    inb(0x62);
    inb(0x62);
    crtat = Crtat + hw_cursor;
#ifdef TERM_EMU
    /* Init terminal emulator */
    end_term();
    get_pos();
    curs_move(curx, cury);
    fg_c = DEFAULT_FGCOLOR;
    bg_c = DEFAULT_BGCOLOR;
#endif
    for (i = 0; i < 10 && vidc_ischar(); i++)
	(void)vidc_getchar();
    return (0);	/* XXX reinit? */
}
开发者ID:2asoft,项目名称:freebsd,代码行数:32,代码来源:vidconsole.c


示例3: fw_probe

static void
fw_probe(int index, struct fwohci_softc *sc)
{
	int err;

	sc->state = FWOHCI_STATE_INIT;
	err = biospci_find_devclass(
		0x0c0010	/* Serial:FireWire:OHCI */,
		index		/* index */,
		&sc->locator);

	if (err != 0) {
		sc->state = FWOHCI_STATE_DEAD;
		return;
	}

	biospci_write_config(sc->locator,
		0x4	/* command */,
		0x6	/* enable bus master and memory mapped I/O */,
		1	/* word */);

	biospci_read_config(sc->locator, 0x00 /*devid*/, 2 /*dword*/,
		&sc->devid);
	biospci_read_config(sc->locator, 0x10 /*base_addr*/, 2 /*dword*/,
		&sc->base_addr);

        sc->handle = (uint32_t)PTOV(sc->base_addr);
	sc->bus_id = OREAD(sc, OHCI_BUS_ID);

	return;
}
开发者ID:coyizumi,项目名称:cs111,代码行数:31,代码来源:firewire.c


示例4: smbios_probe

static void
smbios_probe(const caddr_t addr)
{
    caddr_t		saddr, info;
    uintptr_t	paddr;

    if (smbios.probed)
        return;
    smbios.probed = 1;

    /* Search signatures and validate checksums. */
    saddr = smbios_sigsearch(addr ? addr : PTOV(SMBIOS_START),
                             SMBIOS_LENGTH);
    if (saddr == NULL)
        return;

    smbios.length = SMBIOS_GET16(saddr, 0x16);	/* Structure Table Length */
    paddr = SMBIOS_GET32(saddr, 0x18);		/* Structure Table Address */
    smbios.count = SMBIOS_GET16(saddr, 0x1c);	/* No of SMBIOS Structures */
    smbios.ver = SMBIOS_GET8(saddr, 0x1e);		/* SMBIOS BCD Revision */

    if (smbios.ver != 0) {
        smbios.major = smbios.ver >> 4;
        smbios.minor = smbios.ver & 0x0f;
        if (smbios.major > 9 || smbios.minor > 9)
            smbios.ver = 0;
    }
开发者ID:kwitaszczyk,项目名称:freebsd,代码行数:27,代码来源:smbios.c


示例5:

void *atari_stram_alloc( long size, unsigned long *start_mem )

{
	static int				kernel_in_stram = -1;
	
	void	*adr = 0;
	
	if (kernel_in_stram < 0)
		kernel_in_stram = (PTOV( 0 ) == 0);

	if (kernel_in_stram) {
		/* Get memory from kernel data space */
		adr = (void *) *start_mem;
		*start_mem += size;
	}
	else {
		/* Get memory from rsvd_stram_beg */
		if (rsvd_stram_end + size < stram_end) {
			adr = (void *) rsvd_stram_end;
			rsvd_stram_end += size;
		}
	}
	
	return( adr );
}
开发者ID:carlobar,项目名称:uclinux_leon3_UD,代码行数:25,代码来源:stram.c


示例6: biosacpi_search_rsdp

static ACPI_TABLE_RSDP *
biosacpi_search_rsdp(char *base, int length)
{
    ACPI_TABLE_RSDP	*rsdp;
    u_int8_t		*cp, sum;
    int			ofs, idx;

    /* search on 16-byte boundaries */
    for (ofs = 0; ofs < length; ofs += 16) {
	rsdp = (ACPI_TABLE_RSDP *)PTOV(base + ofs);

	/* compare signature, validate checksum */
	if (!strncmp(rsdp->Signature, ACPI_SIG_RSDP, strlen(ACPI_SIG_RSDP))) {
	    cp = (u_int8_t *)rsdp;
	    sum = 0;
	    for (idx = 0; idx < RSDP_CHECKSUM_LENGTH; idx++)
		sum += *(cp + idx);
	    if (sum != 0) {
		printf("acpi: bad RSDP checksum (%d)\n", sum);
		continue;
	    }
	    return(rsdp);
	}
    }
    return(NULL);
}
开发者ID:Gwenio,项目名称:DragonFlyBSD,代码行数:26,代码来源:biosacpi.c


示例7: scsi_falcon_intr

static void scsi_falcon_intr (int irq, struct pt_regs *fp, void *dummy)
{
#ifdef REAL_DMA
	int dma_stat;

	/* Turn off DMA and select sector counter register before
	 * accessing the status register (Atari recommendation!)
	 */
	st_dma.dma_mode_status = 0x90;
	dma_stat = st_dma.dma_mode_status;

	/* Bit 0 indicates some error in the DMA process... don't know
	 * what happened exactly (no further docu).
	 */
	if (!(dma_stat & 0x01)) {
		/* DMA error */
		printk(KERN_CRIT "SCSI DMA error near 0x%08lx!\n", SCSI_DMA_GETADR());
	}

	/* If the DMA was active, but now bit 1 is not clear, it is some
	 * other 5380 interrupt that finishes the DMA transfer. We have to
	 * calculate the number of residual bytes and give a warning if
	 * bytes are stuck in the ST-DMA fifo (there's no way to reach them!)
	 */
	if (atari_dma_active && (dma_stat & 0x02)) {
		unsigned long	transferred;

		transferred = SCSI_DMA_GETADR() - atari_dma_startaddr;
		/* The ST-DMA address is incremented in 2-byte steps, but the
		 * data are written only in 16-byte chunks. If the number of
		 * transferred bytes is not divisible by 16, the remainder is
		 * lost somewhere in outer space.
		 */
		if (transferred & 15)
			printk(KERN_ERR "SCSI DMA error: %ld bytes lost in "
			       "ST-DMA fifo\n", transferred & 15);

		atari_dma_residual = HOSTDATA_DMALEN - transferred;
		DMA_PRINTK("SCSI DMA: There are %ld residual bytes.\n",
			   atari_dma_residual);
	}
	else
		atari_dma_residual = 0;
	atari_dma_active = 0;

	if (atari_dma_orig_addr) {
		/* If the dribble buffer was used on a read operation, copy the DMA-ed
		 * data to the original destination address.
		 */
		memcpy( atari_dma_orig_addr, (void *)PTOV(atari_dma_startaddr),
		       HOSTDATA_DMALEN - atari_dma_residual );
		atari_dma_orig_addr = NULL;
	}

#endif /* REAL_DMA */

	NCR5380_intr (0, 0, 0);
}
开发者ID:liexusong,项目名称:linux2.0-comment,代码行数:58,代码来源:atari_scsi.c


示例8: biospnp_init

/*
 * Initialisation: locate the PnP BIOS, test that we can call it.
 * Returns nonzero if the PnP BIOS is not usable on this system.
 */
static int
biospnp_init(void)
{
    struct pnp_isaConfiguration	icfg;
    char			*sigptr;
    int				result;
    
    /* Search for the $PnP signature */
    pnp_Icheck = NULL;
    for (sigptr = PTOV(0xf0000); sigptr < PTOV(0xfffff); sigptr += 16)
	if (!bcmp(sigptr, "$PnP", 4)) {
	    pnp_Icheck = (struct pnp_ICstructure *)sigptr;
	    break;
	}
	
    /* No signature, no BIOS */
    if (pnp_Icheck == NULL)
	return(1);

    /*
     * Fetch the system table parameters as a test of the BIOS
     */
    result = biospnp_f00(vsegofs(&pnp_NumNodes), vsegofs(&pnp_NodeSize));
    if (result != PNP_SUCCESS) {
	return(1);
    }

    /*
     * Look for the PnP ISA configuration table 
     */
    result = biospnp_f40(vsegofs(&icfg));
    switch (result) {
    case PNP_SUCCESS:
	/* If the BIOS found some PnP devices, take its hint for the read port */
	if ((icfg.ic_revision == 1) && (icfg.ic_nCSN > 0))
	    isapnp_readport = icfg.ic_rdport;
	break;
    case PNP_FUNCTION_NOT_SUPPORTED:
	/* The BIOS says there is no ISA bus (should we trust that this works?) */
	printf("PnP BIOS claims no ISA bus\n");
	isapnp_readport = -1;
	break;
    }
    return(0);
}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:49,代码来源:biospnp.c


示例9: test_isp_regs

U32
test_isp_regs()
{
	U16	*sptr = (U16 *)PTOV(get_isp_base(0));
	U32	*lptr = (U32 *)PTOV(get_isp_base(0));
	int i;
	

	for(i=0; i < 20; i++) {
		if ( sptr[i] != isp_regvals[i])
			return(0);
	}
	for(i=0; i < 20; i++) {
		if ( lptr[i] != 0xFFFFFFFF)
			return(0);
	}
	return(1);
}
开发者ID:JoeAltmaier,项目名称:Odyssey,代码行数:18,代码来源:pcidev.c


示例10: bd_init

/*    
 * Quiz the BIOS for disk devices, save a little info about them.
 */
static int
bd_init(void) 
{
    int		base, unit;
    int		da_drive=0, n=-0x10;

    /* sequence 0x90, 0x80, 0xa0 */
    for (base = 0x90; base <= 0xa0; base += n, n += 0x30) {
	for (unit = base; (nbdinfo < MAXBDDEV) || ((unit & 0x0f) < 4); unit++) {
	    bdinfo[nbdinfo].bd_open = 0;
	    bdinfo[nbdinfo].bd_bcache = NULL;
	    bdinfo[nbdinfo].bd_unit = unit;
	    bdinfo[nbdinfo].bd_flags = (unit & 0xf0) == 0x90 ? BD_FLOPPY : 0;

	    if (!bd_int13probe(&bdinfo[nbdinfo])){
		if (((unit & 0xf0) == 0x90 && (unit & 0x0f) < 4) ||
		    ((unit & 0xf0) == 0xa0 && (unit & 0x0f) < 6))
		    continue;	/* Target IDs are not contiguous. */
		else
		    break;
	    }

	    if (bdinfo[nbdinfo].bd_flags & BD_FLOPPY){
		/* available 1.44MB access? */
		if (*(u_char *)PTOV(0xA15AE) & (1<<(unit & 0xf))) {
		    /* boot media 1.2MB FD? */
		    if ((*(u_char *)PTOV(0xA1584) & 0xf0) != 0x90)
		        bdinfo[nbdinfo].bd_unit = 0x30 + (unit & 0xf);
		}
	    }
	    else {
		if ((unit & 0xF0) == 0xA0)	/* SCSI HD or MO */
		    bdinfo[nbdinfo].bd_da_unit = da_drive++;
	    }
	    /* XXX we need "disk aliases" to make this simpler */
	    printf("BIOS drive %c: is disk%d\n", 
		   'A' + nbdinfo, nbdinfo);
	    nbdinfo++;
	}
    }
    bcache_add_dev(nbdinfo);
    return(0);
}
开发者ID:yaneurabeya,项目名称:freebsd,代码行数:46,代码来源:biosdisk.c


示例11: i386_readin

ssize_t
i386_readin(const int fd, vm_offset_t dest, const size_t len)
{
    if (dest + len >= memtop_copyin) {
	errno = EFBIG;
	return(-1);
    }

    return (read(fd, PTOV(dest), len));
}
开发者ID:alek-p,项目名称:openzfs,代码行数:10,代码来源:i386_copy.c


示例12: biosmptable_find_mpfps

/*
 * Find the MP Floating Pointer Structure.  See the MP spec section 4.1.
 */
static mpfps_t
biosmptable_find_mpfps(void)
{
    mpfps_t mpfps;
    uint16_t addr;

    /* EBDA is the 1 KB addressed by the 16 bit pointer at 0x40E. */
    if (!memread(PTOV(0x40E), &addr, sizeof(addr)))
	return (NULL);
    mpfps = biosmptable_search_mpfps(PTOV(addr << 4), 0x400);
    if (mpfps != NULL)
	return (mpfps);

    /* Check the BIOS. */
    mpfps = biosmptable_search_mpfps(PTOV(0xf0000), 0x10000);
    if (mpfps != NULL)
	return (mpfps);

    return (NULL);
}
开发者ID:coyizumi,项目名称:cs111,代码行数:23,代码来源:biosmptable.c


示例13: i386_copyout

ssize_t
i386_copyout(const vm_offset_t src, void *dest, const size_t len)
{
    if (src + len >= memtop) {
	errno = EFBIG;
	return(-1);
    }
    
    bcopy(PTOV(src), dest, len);
    return(len);
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:11,代码来源:i386_copy.c


示例14: fw_cleanup

static void 
fw_cleanup()
{
    struct dcons_buf *db;

    /* invalidate dcons buffer */
    if (dcons_paddr) {
	db = (struct dcons_buf *)PTOV(dcons_paddr);
	db->magic = 0;
    }
}
开发者ID:coyizumi,项目名称:cs111,代码行数:11,代码来源:firewire.c


示例15: i386_copyin

ssize_t
i386_copyin(const void *src, vm_offset_t dest, const size_t len)
{
    if (dest + len >= memtop) {
	errno = EFBIG;
	return(-1);
    }

    bcopy(src, PTOV(dest), len);
    return(len);
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:11,代码来源:i386_copy.c


示例16: bios_getmem

void
bios_getmem(void)
{

    bios_basemem = ((*(u_char *)PTOV(0xA1501) & 0x07) + 1) * 128 * 1024;
    bios_extmem = *(u_char *)PTOV(0xA1401) * 128 * 1024 +
	*(u_int16_t *)PTOV(0xA1594) * 1024 * 1024;

    /* Set memtop to actual top of memory */
    memtop = memtop_copyin = 0x100000 + bios_extmem;

    /*
     * If we have extended memory, use the last 3MB of 'extended' memory
     * as a high heap candidate.
     */
    if (bios_extmem >= HEAP_MIN) {
	high_heap_size = HEAP_MIN;
	high_heap_base = memtop - HEAP_MIN;
    }
}    
开发者ID:coyizumi,项目名称:cs111,代码行数:20,代码来源:biosmem.c


示例17: set_machine_type

/*
 * Set machine type to PC98_SYSTEM_PARAMETER.
 */
void
set_machine_type(void)
{
	int i;
	u_long ret, data;

	/* PC98_SYSTEM_PARAMETER (0x501) */
	ret = ((*(u_char *)PTOV(0xA1501)) & 0x08) >> 3;

	/* Wait V-SYNC */
	while (inb(0x60) & 0x20) {}
	while (!(inb(0x60) & 0x20)) {}

	/* ANK 'A' font */
	outb(0xa1, 0x00);
	outb(0xa3, 0x41);

	/* M_NORMAL, use CG window (all NEC OK)  */
	for (i = data = 0; i < 4; i++)
		data += *((u_long *)PTOV(0xA4000) + i);	/* 0xa4000 */
	if (data == 0x6efc58fc)		/* DA data */
		ret |= M_NEC_PC98;
	else
		ret |= M_EPSON_PC98;
	ret |= (inb(0x42) & 0x20) ? M_8M : 0;

	/* PC98_SYSTEM_PARAMETER(0x400) */
	if ((*(u_char *)PTOV(0xA1400)) & 0x80)
		ret |= M_NOTE;
	if (ret & M_NEC_PC98) {
		/* PC98_SYSTEM_PARAMETER(0x458) */
		if ((*(u_char *)PTOV(0xA1458)) & 0x80)
			ret |= M_H98;
		else
			ret |= M_NOT_H98;
	} else
		ret |= M_NOT_H98;

	(*(u_long *)PTOV(0xA1620)) = ret;
}
开发者ID:2asoft,项目名称:freebsd,代码行数:43,代码来源:pc98_sys.c


示例18: atari_stram_init

void atari_stram_init( void )

{	int		i;

	for( i = 0; i < boot_info.num_memory; ++i ) {
		if (boot_info.memory[i].addr == 0) {
			rsvd_stram_beg = PTOV( 0x800 ); /* skip super-only first 2 KB! */
			rsvd_stram_end = rsvd_stram_beg;
			stram_end = rsvd_stram_beg - 0x800 + boot_info.memory[i].size;
			return;
		}
	}
	/* Should never come here! (There is always ST-Ram!) */
}
开发者ID:carlobar,项目名称:uclinux_leon3_UD,代码行数:14,代码来源:stram.c


示例19: biosacpi_find_rsdp

/*
 * Find the RSDP in low memory.  See section 5.2.2 of the ACPI spec.
 */
static ACPI_TABLE_RSDP *
biosacpi_find_rsdp(void)
{
    ACPI_TABLE_RSDP	*rsdp;
    uint16_t		*addr;

    /* EBDA is the 1 KB addressed by the 16 bit pointer at 0x40E. */
    addr = (uint16_t *)PTOV(0x40E);
    if ((rsdp = biosacpi_search_rsdp((char *)(*addr << 4), 0x400)) != NULL)
	return (rsdp);

    /* Check the upper memory BIOS space, 0xe0000 - 0xfffff. */
    if ((rsdp = biosacpi_search_rsdp((char *)0xe0000, 0x20000)) != NULL)
	return (rsdp);

    return (NULL);
}
开发者ID:Gwenio,项目名称:DragonFlyBSD,代码行数:20,代码来源:biosacpi.c


示例20: atari_scsi_fetch_restbytes

static void atari_scsi_fetch_restbytes( void )
{
	int nr;
	char	*src, *dst;

	/* fetch rest bytes in the DMA register */
	dst = (char *)SCSI_DMA_READ_P( dma_addr );
	if ((nr = ((long)dst & 3))) {
		/* there are 'nr' bytes left for the last long address before the
		   DMA pointer */
		dst = (char *)( (unsigned long)dst & ~3 );
		DMA_PRINTK("SCSI DMA: there are %d rest bytes for phys addr 0x%08lx",
			   nr, (long)dst);
		dst = (char *)PTOV(dst);  /* The content of the DMA pointer
					   * is a physical address! */
		DMA_PRINTK(" = virt addr 0x%08lx\n", (long)dst);
		for( src = (char *)&tt_scsi_dma.dma_restdata; nr > 0; --nr )
			*dst++ = *src++;
	}
}
开发者ID:liexusong,项目名称:linux2.0-comment,代码行数:20,代码来源:atari_scsi.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PTR函数代码示例发布时间:2022-05-30
下一篇:
C++ PTHREAD_MUTEX_UNLOCK函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap