Ejemplo n.º 1
0
/*
 * In order to write GPIODATA, the corresponding bits in the mask, resulting
 * from the address bus, PADDR[9:2], must be HIGH. Otherwise the bit values
 * remain unchanged by the write.
 */
static void pl061_set_value(unsigned int gpio_pin, enum gpio_level value)
{
	vaddr_t base_addr;
	unsigned int offset;

	assert(gpio_pin < PLAT_PL061_MAX_GPIOS);

	base_addr = pl061_reg_base[gpio_pin / GPIOS_PER_PL061];
	offset = gpio_pin % GPIOS_PER_PL061;
	if (value == GPIO_LEVEL_HIGH)
		io_write8(base_addr + BIT(offset + 2), BIT(offset));
	else
		io_write8(base_addr + BIT(offset + 2), 0);
}
Ejemplo n.º 2
0
void write8(struct memory* m, uint16_t addr, uint8_t data) {
  if (!valid_ptr(m, addr)) {
    fprintf(stderr, "mmu: warning: write8\'ing bad address: %04X = %02X\n",
        addr, data);
    return;
  }
  if (addr >= 0xFF00 && addr < 0xFF80)
    io_write8(m, addr & 0xFF, data);
  else if (addr == 0xFFFF)
    write_interrupt_enable((struct regs*)m->devices[DEVICE_CPU], addr, data);
  else
    m->write8(m, addr, data);
}