Lines Matching refs:p

49 static void osdp_handle_in_byte(struct osdp_device *p, uint8_t *buf, int len)  in osdp_handle_in_byte()  argument
51 if (p->wait_for_mark) { in osdp_handle_in_byte()
53 if (p->last_byte == 0xFF && buf[0] == 0x53) { in osdp_handle_in_byte()
55 ring_buf_put(&p->rx_buf, buf, 1); /* put last byte */ in osdp_handle_in_byte()
57 ring_buf_put(&p->rx_buf, buf, len); /* put rest */ in osdp_handle_in_byte()
58 p->wait_for_mark = 0; /* Mark found. Clear flag */ in osdp_handle_in_byte()
60 p->last_byte = buf[0]; in osdp_handle_in_byte()
63 ring_buf_put(&p->rx_buf, buf, len); in osdp_handle_in_byte()
70 struct osdp_device *p = user_data; in osdp_uart_isr() local
77 osdp_handle_in_byte(p, buf, len); in osdp_uart_isr()
82 len = ring_buf_get(&p->tx_buf, buf, 1); in osdp_uart_isr()
91 if (p->wait_for_mark == 0) { in osdp_uart_isr()
93 k_fifo_put(&p->rx_event_fifo, &p->rx_event_data); in osdp_uart_isr()
100 struct osdp_device *p = data; in osdp_uart_receive() local
102 return (int)ring_buf_get(&p->rx_buf, buf, len); in osdp_uart_receive()
108 struct osdp_device *p = data; in osdp_uart_send() local
110 sent = (int)ring_buf_put(&p->tx_buf, buf, len); in osdp_uart_send()
111 uart_irq_tx_enable(p->dev); in osdp_uart_send()
117 struct osdp_device *p = data; in osdp_uart_flush() local
119 p->wait_for_mark = 1; in osdp_uart_flush()
120 ring_buf_reset(&p->tx_buf); in osdp_uart_flush()
121 ring_buf_reset(&p->rx_buf); in osdp_uart_flush()
184 struct osdp_device *p = &osdp_device; in osdp_init() local
193 k_fifo_init(&p->rx_event_fifo); in osdp_init()
196 ring_buf_init(&p->rx_buf, sizeof(p->rx_fbuf), p->rx_fbuf); in osdp_init()
197 ring_buf_init(&p->tx_buf, sizeof(p->tx_fbuf), p->tx_fbuf); in osdp_init()
200 p->dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_osdp_uart)); in osdp_init()
201 if (!device_is_ready(p->dev)) { in osdp_init()
207 p->dev_config.baudrate = CONFIG_OSDP_UART_BAUD_RATE; in osdp_init()
208 p->dev_config.data_bits = UART_CFG_DATA_BITS_8; in osdp_init()
209 p->dev_config.parity = UART_CFG_PARITY_NONE; in osdp_init()
210 p->dev_config.stop_bits = UART_CFG_STOP_BITS_1; in osdp_init()
211 p->dev_config.flow_ctrl = UART_CFG_FLOW_CTRL_NONE; in osdp_init()
212 uart_configure(p->dev, &p->dev_config); in osdp_init()
214 uart_irq_rx_disable(p->dev); in osdp_init()
215 uart_irq_tx_disable(p->dev); in osdp_init()
216 uart_irq_callback_user_data_set(p->dev, osdp_uart_isr, p); in osdp_init()
219 while (uart_irq_rx_ready(p->dev)) { in osdp_init()
220 uart_fifo_read(p->dev, &c, 1); in osdp_init()
222 p->wait_for_mark = 1; in osdp_init()
225 uart_irq_rx_enable(p->dev); in osdp_init()