static void tmp007_gpio_callback(struct device *dev, struct gpio_callback *cb, uint32_t pins) { struct tmp007_data *drv_data = CONTAINER_OF(cb, struct tmp007_data, gpio_cb); gpio_pin_disable_callback(dev, CONFIG_TMP007_GPIO_PIN_NUM); #if defined(CONFIG_TMP007_TRIGGER_OWN_FIBER) nano_sem_give(&drv_data->gpio_sem); #elif defined(CONFIG_TMP007_TRIGGER_GLOBAL_FIBER) nano_isr_fifo_put(sensor_get_work_fifo(), &drv_data->work); #endif }
void uart_console_isr(struct device *unused) { ARG_UNUSED(unused); while (uart_irq_update(uart_console_dev) && uart_irq_is_pending(uart_console_dev)) { static struct uart_console_input *cmd; uint8_t byte; int rx; if (!uart_irq_rx_ready(uart_console_dev)) { continue; } /* Character(s) have been received */ rx = read_uart(uart_console_dev, &byte, 1); if (rx < 0) { return; } if (uart_irq_input_hook(uart_console_dev, byte) != 0) { /* * The input hook indicates that no further processing * should be done by this handler. */ return; } if (!cmd) { cmd = nano_isr_fifo_get(avail_queue, TICKS_NONE); if (!cmd) return; } /* Handle ANSI escape mode */ if (atomic_test_bit(&esc_state, ESC_ANSI)) { handle_ansi(byte); continue; } /* Handle escape mode */ if (atomic_test_and_clear_bit(&esc_state, ESC_ESC)) { switch (byte) { case ANSI_ESC: atomic_set_bit(&esc_state, ESC_ANSI); atomic_set_bit(&esc_state, ESC_ANSI_FIRST); break; default: break; } continue; } /* Handle special control characters */ if (!isprint(byte)) { switch (byte) { case DEL: if (cur > 0) { del_char(&cmd->line[--cur], end); } break; case ESC: atomic_set_bit(&esc_state, ESC_ESC); break; case '\r': cmd->line[cur + end] = '\0'; uart_poll_out(uart_console_dev, '\r'); uart_poll_out(uart_console_dev, '\n'); cur = 0; end = 0; nano_isr_fifo_put(lines_queue, cmd); cmd = NULL; break; case '\t': if (completion_cb && !end) { cur += completion_cb(cmd->line, cur); } break; default: break; } continue; } /* Ignore characters if there's no more buffer space */ if (cur + end < sizeof(cmd->line) - 1) { insert_char(&cmd->line[cur++], byte, end); } } }
void isr_fifo_put(void *parameter) { struct isr_fifo_info *pInfo = (struct isr_fifo_info *) parameter; nano_isr_fifo_put(pInfo->fifo_ptr, pInfo->data); }
void isr_fifo_put(void *parameter) { ISR_FIFO_INFO *pInfo = (ISR_FIFO_INFO *) parameter; nano_isr_fifo_put(pInfo->fifo_ptr, pInfo->data); }