Lines Matching +full:level +full:- +full:detect

2  * nRF51 System-on-Chip general purpose input/output register definition
7 * Copyright 2018 Steffen Görtz <contrib@steffen-goertz.de>
10 * the COPYING file in the top-level directory.
23 * given the current configuration and logic level.
24 * It is not differentiated between standard and "high"(-power) drive modes.
26 static bool is_connected(uint32_t config, uint32_t level) in is_connected() argument
36 state = level != 0; in is_connected()
39 state = level == 0; in is_connected()
56 return -1; in pull_value()
60 bool connected, bool level) in update_output_irq() argument
62 int64_t irq_level = connected ? level : -1; in update_output_irq()
63 bool old_connected = extract32(s->old_out_connected, i, 1); in update_output_irq()
64 bool old_level = extract32(s->old_out, i, 1); in update_output_irq()
66 if ((old_connected != connected) || (old_level != level)) { in update_output_irq()
67 qemu_set_irq(s->output[i], irq_level); in update_output_irq()
71 s->old_out = deposit32(s->old_out, i, 1, level); in update_output_irq()
72 s->old_out_connected = deposit32(s->old_out_connected, i, 1, connected); in update_output_irq()
83 pull = pull_value(s->cnf[i]); in update_state()
84 dir = extract32(s->cnf[i], 0, 1); in update_state()
85 connected_in = extract32(s->in_mask, i, 1); in update_state()
86 out = extract32(s->out, i, 1); in update_state()
87 in = extract32(s->in, i, 1); in update_state()
88 input = !extract32(s->cnf[i], 1, 1); in update_state()
89 connected_out = is_connected(s->cnf[i], out) && dir; in update_state()
94 s->in = deposit32(s->in, i, 1, pull); in update_state()
103 uint32_t detect_config = extract32(s->cnf[i], 16, 2); in update_state()
113 * otherwise pull-up/pull-down resistors put a value on both in update_state()
121 s->in = deposit32(s->in, i, 1, out); in update_state()
128 qemu_set_irq(s->detect, assert_detect); in update_state()
140 uint32_t value = s->dir; in reflect_dir_bit_in_cnf()
143 s->cnf[i] = (s->cnf[i] & ~(1UL)) | ((value >> i) & 0x01); in reflect_dir_bit_in_cnf()
155 r = s->out; in nrf51_gpio_read()
159 r = s->in; in nrf51_gpio_read()
163 r = s->dir; in nrf51_gpio_read()
167 idx = (offset - NRF51_GPIO_REG_CNF_START) / 4; in nrf51_gpio_read()
168 r = s->cnf[idx]; in nrf51_gpio_read()
192 s->out = value; in nrf51_gpio_write()
196 s->out |= value; in nrf51_gpio_write()
200 s->out &= ~value; in nrf51_gpio_write()
204 s->dir = value; in nrf51_gpio_write()
209 s->dir |= value; in nrf51_gpio_write()
214 s->dir &= ~value; in nrf51_gpio_write()
219 idx = (offset - NRF51_GPIO_REG_CNF_START) / 4; in nrf51_gpio_write()
220 s->cnf[idx] = value; in nrf51_gpio_write()
225 s->dir = (s->dir & ~(1UL << idx)) | ((value & 0x01) << idx); in nrf51_gpio_write()
253 s->in_mask = deposit32(s->in_mask, line, 1, value >= 0); in nrf51_gpio_set()
255 s->in = deposit32(s->in, line, 1, value != 0); in nrf51_gpio_set()
266 s->out = 0; in nrf51_gpio_reset()
267 s->old_out = 0; in nrf51_gpio_reset()
268 s->old_out_connected = 0; in nrf51_gpio_reset()
269 s->in = 0; in nrf51_gpio_reset()
270 s->in_mask = 0; in nrf51_gpio_reset()
271 s->dir = 0; in nrf51_gpio_reset()
274 s->cnf[i] = 0x00000002; in nrf51_gpio_reset()
298 memory_region_init_io(&s->mmio, obj, &gpio_ops, s, in nrf51_gpio_init()
300 sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio); in nrf51_gpio_init()
303 qdev_init_gpio_out(DEVICE(s), s->output, NRF51_GPIO_PINS); in nrf51_gpio_init()
304 qdev_init_gpio_out_named(DEVICE(s), &s->detect, "detect", 1); in nrf51_gpio_init()
311 dc->vmsd = &vmstate_nrf51_gpio; in nrf51_gpio_class_init()
313 dc->desc = "nRF51 GPIO"; in nrf51_gpio_class_init()