本文整理汇总了C++中MIPS_PHYS_TO_KSEG1函数的典型用法代码示例。如果您正苦于以下问题:C++ MIPS_PHYS_TO_KSEG1函数的具体用法?C++ MIPS_PHYS_TO_KSEG1怎么用?C++ MIPS_PHYS_TO_KSEG1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MIPS_PHYS_TO_KSEG1函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sq_match
static int
sq_match(device_t parent, cfdata_t cf, void *aux)
{
struct hpc_attach_args *ha = aux;
if (strcmp(ha->ha_name, cf->cf_name) == 0) {
vaddr_t reset, txstat;
reset = MIPS_PHYS_TO_KSEG1(ha->ha_sh +
ha->ha_dmaoff + ha->hpc_regs->enetr_reset);
txstat = MIPS_PHYS_TO_KSEG1(ha->ha_sh +
ha->ha_devoff + (SEEQ_TXSTAT << 2));
if (platform.badaddr((void *)reset, sizeof(reset)))
return 0;
*(volatile uint32_t *)reset = 0x1;
delay(20);
*(volatile uint32_t *)reset = 0x0;
if (platform.badaddr((void *)txstat, sizeof(txstat)))
return 0;
if ((*(volatile uint32_t *)txstat & 0xff) == TXSTAT_OLDNEW)
return 1;
}
return 0;
}
示例2: dt_cninit
void
dt_cninit(void)
{
dt_state.ds_poll = (volatile u_int *)
MIPS_PHYS_TO_KSEG1(XINE_REG_INTR);
dt_state.ds_data = (volatile u_int *)
MIPS_PHYS_TO_KSEG1(XINE_PHYS_TC_3_START + 0x280000);
}
示例3: rtcin
static __inline uint8_t
rtcin(uint8_t addr)
{
*((volatile uint8_t *)
MIPS_PHYS_TO_KSEG1(MALTA_PCI0_ADDR(MALTA_RTCADR))) = addr;
return (*((volatile uint8_t *)
MIPS_PHYS_TO_KSEG1(MALTA_PCI0_ADDR(MALTA_RTCDAT))));
}
示例4: writertc
static __inline void
writertc(uint8_t addr, uint8_t val)
{
*((volatile uint8_t *)
MIPS_PHYS_TO_KSEG1(MALTA_PCI0_ADDR(MALTA_RTCADR))) = addr;
*((volatile uint8_t *)
MIPS_PHYS_TO_KSEG1(MALTA_PCI0_ADDR(MALTA_RTCDAT))) = val;
}
示例5: dec_3maxplus_init
void
dec_3maxplus_init(void)
{
uint32_t prodtype;
platform.iobus = "tcbus";
platform.bus_reset = dec_3maxplus_bus_reset;
platform.cons_init = dec_3maxplus_cons_init;
platform.iointr = dec_3maxplus_intr;
platform.intr_establish = dec_3maxplus_intr_establish;
platform.memsize = memsize_bitmap;
/* 3MAX+ has IOASIC free-running high resolution timer */
platform.tc_init = dec_3maxplus_tc_init;
/* clear any memory errors */
*(volatile uint32_t *)MIPS_PHYS_TO_KSEG1(KN03_SYS_ERRADR) = 0;
kn03_wbflush();
ioasic_base = MIPS_PHYS_TO_KSEG1(KN03_SYS_ASIC);
ipl_sr_map = dec_3maxplus_ipl_sr_map;
/* calibrate cpu_mhz value */
mc_cpuspeed(ioasic_base+IOASIC_SLOT_8_START, MIPS_INT_MASK_1);
*(volatile uint32_t *)(ioasic_base + IOASIC_LANCE_DECODE) = 0x3;
*(volatile uint32_t *)(ioasic_base + IOASIC_SCSI_DECODE) = 0xe;
#if 0
*(volatile uint32_t *)(ioasic_base + IOASIC_SCC0_DECODE) = (0x10|4);
*(volatile uint32_t *)(ioasic_base + IOASIC_SCC1_DECODE) = (0x10|6);
*(volatile uint32_t *)(ioasic_base + IOASIC_CSR) = 0x00000f00;
#endif
/* XXX hard-reset LANCE */
*(volatile uint32_t *)(ioasic_base + IOASIC_CSR) |= 0x100;
/* sanitize interrupt mask */
kn03_tc3_imask = KN03_INTR_PSWARN;
*(volatile uint32_t *)(ioasic_base + IOASIC_INTR) = 0;
*(volatile uint32_t *)(ioasic_base + IOASIC_IMSK) = kn03_tc3_imask;
kn03_wbflush();
prodtype = *(volatile uint32_t *)MIPS_PHYS_TO_KSEG1(KN03_REG_INTR);
prodtype &= KN03_INTR_PROD_JUMPER;
/* the bit persists even if INTR register is assigned value 0 */
if (prodtype)
cpu_setmodel("DECstation 5000/%s (3MAXPLUS)",
(CPUISMIPS3) ? "260" : "240");
else
cpu_setmodel("DECsystem 5900%s (3MAXPLUS)",
(CPUISMIPS3) ? "-260" : "");
}
示例6: iodi_alloc_resource
static struct resource *
iodi_alloc_resource(device_t bus, device_t child, int type, int *rid,
u_long start, u_long end, u_long count, u_int flags)
{
struct resource *res = malloc(sizeof(*res), M_DEVBUF, M_WAITOK);
const char *name = device_get_name(child);
int unit;
#ifdef DEBUG
switch (type) {
case SYS_RES_IRQ:
device_printf(bus, "IRQ resource - for %s %lx-%lx\n",
device_get_nameunit(child), start, end);
break;
case SYS_RES_IOPORT:
device_printf(bus, "IOPORT resource - for %s %lx-%lx\n",
device_get_nameunit(child), start, end);
break;
case SYS_RES_MEMORY:
device_printf(bus, "MEMORY resource - for %s %lx-%lx\n",
device_get_nameunit(child), start, end);
break;
}
#endif
if (strcmp(name, "uart") == 0) {
if ((unit = device_get_unit(child)) == 0) { /* uart 0 */
res->r_bushandle = (xlr_io_base + XLR_IO_UART_0_OFFSET);
} else if (unit == 1) {
res->r_bushandle = (xlr_io_base + XLR_IO_UART_1_OFFSET);
} else
printf("%s: Unknown uart unit\n", __FUNCTION__);
res->r_bustag = uart_bus_space_mem;
} else if (strcmp(name, "ehci") == 0) {
res->r_bushandle = MIPS_PHYS_TO_KSEG1(0x1ef24000);
res->r_bustag = rmi_pci_bus_space;
} else if (strcmp(name, "cfi") == 0) {
res->r_bushandle = MIPS_PHYS_TO_KSEG1(0x1c000000);
res->r_bustag = 0;
} else if (strcmp(name, "ata") == 0) {
res->r_bushandle = MIPS_PHYS_TO_KSEG1(0x1d000000);
res->r_bustag = rmi_pci_bus_space; /* byte swapping (not really PCI) */
}
/* res->r_start = *rid; */
return (res);
}
示例7: uart_malta_probe
static int
uart_malta_probe(device_t dev)
{
struct uart_softc *sc;
sc = device_get_softc(dev);
sc->sc_sysdev = SLIST_FIRST(&uart_sysdevs);
sc->sc_class = &uart_ns8250_class;
bcopy(&sc->sc_sysdev->bas, &sc->sc_bas, sizeof(sc->sc_bas));
sc->sc_sysdev->bas.bst = mips_bus_space_generic;
sc->sc_sysdev->bas.bsh = MIPS_PHYS_TO_KSEG1(SENTRY5_UART1ADR);
sc->sc_bas.bst = mips_bus_space_generic;
sc->sc_bas.bsh = MIPS_PHYS_TO_KSEG1(SENTRY5_UART1ADR);
return(uart_bus_probe(dev, 0, 0, 0, 0));
}
示例8: __find_pcic
static void
__find_pcic(void)
{
int i, j, step, found;
u_int32_t addr;
u_int8_t reg;
int __read_revid (u_int32_t port)
{
addr = MIPS_PHYS_TO_KSEG1(i + port);
printf("%#x\r", i);
for (found = 0, j = 0; j < 0x100; j += 0x40) {
*((volatile u_int8_t *)addr) = j;
reg = *((volatile u_int8_t *)(addr + 1));
#ifdef DEBUG_FIND_PCIC_I82365SL_ONLY
if (reg == 0x82 || reg == 0x83) {
#else
if ((reg & 0xc0) == 0x80) {
#endif
found++;
}
if (found)
printf("\nfound %d socket at %#x"
"(base from %#x)\n", found, addr,
i + port - VR_ISA_PORT_BASE);
}
}
step = 0x1000000;
printf("\nFinding PCIC. Trying ISA port %#x-%#x step %#x\n",
VR_ISA_PORT_BASE, VR_ISA_PORT_BASE + VR_ISA_PORT_SIZE, step);
for (i = VR_ISA_PORT_BASE; i < VR_ISA_PORT_BASE+VR_ISA_PORT_SIZE;
i+= step) {
__read_revid (0x3e0);
__read_revid (0x3e2);
}
}
示例9: dec_3maxplus_errintr
/*
* Handle Memory error. 3max, 3maxplus has ECC.
* Correct single-bit error, panic on double-bit error.
* XXX on double-error on clean user page, mark bad and reload frame?
*/
static void
dec_3maxplus_errintr(void)
{
uint32_t erradr, csr;
vaddr_t errsyn;
/* Fetch error address, ECC chk/syn bits, clear interrupt */
erradr = *(volatile uint32_t *)MIPS_PHYS_TO_KSEG1(KN03_SYS_ERRADR);
errsyn = MIPS_PHYS_TO_KSEG1(KN03_SYS_ERRSYN);
*(volatile uint32_t *)MIPS_PHYS_TO_KSEG1(KN03_SYS_ERRADR) = 0;
kn03_wbflush();
csr = *(volatile uint32_t *)MIPS_PHYS_TO_KSEG1(KN03_SYS_CSR);
/* Send to kn02/kn03 memory subsystem handler */
dec_mtasic_err(erradr, errsyn, csr & KN03_CSR_BNK32M);
}
示例10: ar5315_get_radio_info
/*
* Locate the radio configuration data; it is located relative to the
* board configuration data.
*/
static const void *
ar5315_get_radio_info(void)
{
static const void *radio = NULL;
const struct ar531x_boarddata *board;
const uint8_t *baddr, *ptr, *end;
if (radio)
goto done;
board = ar5315_get_board_info();
if (board == NULL)
return NULL;
baddr = (const uint8_t *) board;
end = (const uint8_t *)MIPS_PHYS_TO_KSEG1(AR5315_RADIO_END);
for (ptr = baddr + 0x1000; ptr < end; ptr += 0x1000)
if (*(const uint32_t *)ptr != 0xffffffffU) {
radio = ptr;
goto done;
}
/* AR2316 moves radio data */
for (ptr = baddr + 0xf8; ptr < end; ptr += 0x1000)
if (*(const uint32_t *)ptr != 0xffffffffU) {
radio = ptr;
goto done;
}
done:
return radio;
}
示例11: led_display_word
void
led_display_word(uint32_t val)
{
uint32_t *ledbar = (uint32_t *)MIPS_PHYS_TO_KSEG1(MALTA_ASCIIWORD);
*ledbar = val;
}
示例12: led_bar
void
led_bar(uint8_t val)
{
uint8_t *ledbar = (uint8_t *)MIPS_PHYS_TO_KSEG1(MALTA_LEDBAR);
*ledbar = val;
}
示例13: zscninit
void
zscninit(struct consdev *cn)
{
struct zs_chanstate *cs;
extern const struct cdevsw zstty_cdevsw;
cn->cn_dev = makedev(cdevsw_lookup_major(&zstty_cdevsw), 0);
zs_cons = (uint8_t *)MIPS_PHYS_TO_KSEG1(ZS_BASE) + ZS_CHAN_A; /* XXX */
zs_conschan = cs = &zs_conschan_store;
/* Setup temporary chanstate. */
cs->cs_reg_csr = zs_cons + ZS_CSR;
cs->cs_reg_data = zs_cons + ZS_DATA;
/* Initialize the pending registers. */
memcpy(cs->cs_preg, zs_init_reg, 16);
cs->cs_preg[5] |= ZSWR5_DTR | ZSWR5_RTS;
cs->cs_preg[12] = BPS_TO_TCONST(PCLK / 16, ZS_DEFSPEED);
cs->cs_preg[13] = 0;
cs->cs_defspeed = ZS_DEFSPEED;
/* Clear the master interrupt enable. */
zs_write_reg(cs, 9, 0);
/* Reset the whole SCC chip. */
zs_write_reg(cs, 9, ZSWR9_HARD_RESET);
/* Copy "pending" to "current" and H/W */
zs_loadchannelregs(cs);
}
示例14: ingenic_putchar_init
void
ingenic_putchar_init(void)
{
/*
* XXX don't screw with the UART's speed until we know what clock
* we're on
*/
#if 0
int rate;
#endif
extern int comspeed(long, long, int);
com0addr = (uint32_t *)MIPS_PHYS_TO_KSEG1(JZ_UART0);
#if 0
if (comcnfreq != -1) {
rate = comspeed(comcnspeed, comcnfreq, COM_TYPE_INGENIC);
if (rate < 0)
return; /* XXX */
#endif
com0addr[com_ier] = 0;
com0addr[com_lctl] = htole32(LCR_DLAB);
#if 0
com0addr[com_dlbl] = htole32(rate & 0xff);
com0addr[com_dlbh] = htole32(rate >> 8);
#endif
com0addr[com_lctl] = htole32(LCR_8BITS); /* XXX */
com0addr[com_mcr] = htole32(MCR_DTR|MCR_RTS);
com0addr[com_fifo] = htole32(
FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST |
FIFO_TRIGGER_1 | FIFO_UART_ON);
#if 0
}
示例15: mace_serial_init
static int
mace_serial_init(const char *consdev)
{
#if (NCOM > 0)
const char *dbaud;
int speed;
u_int32_t base;
if ((strlen(consdev) == 9) && (!strncmp(consdev, "serial", 6)) &&
(consdev[7] == '0' || consdev[7] == '1')) {
/* Get comm speed from ARCS */
dbaud = ARCBIOS->GetEnvironmentVariable("dbaud");
speed = strtoul(dbaud, NULL, 10);
base = (consdev[7] == '0') ? MACE_ISA_SER1_BASE :
MACE_ISA_SER2_BASE;
delay(10000);
/* XXX: hardcoded MACE iotag */
if (comcnattach(3, MIPS_PHYS_TO_KSEG1(MACE_BASE + base),
speed, COM_FREQ, COM_TYPE_NORMAL, comcnmode) == 0)
return (1);
}
#endif
return (0);
}