Lines Matching +full:data +full:- +full:ready

4  * SPDX-License-Identifier: Apache-2.0
46 return gpio_pin_get_dt(&spi->cfg->dr) > 0; in eswifi_spi_cmddata_ready()
56 } while (!eswifi_spi_cmddata_ready(spi) && --max_retries); in eswifi_spi_wait_cmddata_ready()
58 return max_retries ? 0 : -ETIMEDOUT; in eswifi_spi_wait_cmddata_ready()
61 static int eswifi_spi_write(struct eswifi_dev *eswifi, char *data, size_t dlen) in eswifi_spi_write() argument
63 struct eswifi_spi_data *spi = eswifi->bus_data; in eswifi_spi_write()
68 spi_tx_buf[0].buf = data; in eswifi_spi_write()
73 status = spi_write_dt(&spi->cfg->bus, &spi_tx); in eswifi_spi_write()
83 static int eswifi_spi_read(struct eswifi_dev *eswifi, char *data, size_t dlen) in eswifi_spi_read() argument
85 struct eswifi_spi_data *spi = eswifi->bus_data; in eswifi_spi_read()
90 spi_rx_buf[0].buf = data; in eswifi_spi_read()
95 status = spi_read_dt(&spi->cfg->bus, &spi_rx); in eswifi_spi_read()
108 struct eswifi_spi_data *spi = eswifi->bus_data; in eswifi_spi_request()
116 * CMD/DATA protocol: in eswifi_spi_request()
117 * 1. Module raises data-ready when ready for **command phase** in eswifi_spi_request()
118 * 2. Host announces command start by lowering chip-select in eswifi_spi_request()
120 * 4. Host announces end of command by raising chip-select in eswifi_spi_request()
121 * 5. Module lowers data-ready signal in eswifi_spi_request()
122 * 6. Module raises data-ready to signal start of the **data phase** in eswifi_spi_request()
123 * 7. Host lowers chip-select in eswifi_spi_request()
124 * 8. Host fetch data as long as data-ready pin is up in eswifi_spi_request()
125 * 9. Module lowers data-ready to signal the end of the data Phase in eswifi_spi_request()
126 * 10. Host raises chip-select in eswifi_spi_request()
129 * All commands to the eS-WiFi module must be post-padded with in eswifi_spi_request()
131 * All data from eS-WiFi module are post-padded with 0x15(NAK) to an in eswifi_spi_request()
136 goto data; in eswifi_spi_request()
139 /* CMD/DATA READY signals the Command Phase */ in eswifi_spi_request()
142 LOG_ERR("CMD ready timeout\n"); in eswifi_spi_request()
146 if (clen % 2) { /* Add post-padding if necessary */ in eswifi_spi_request()
155 spi_release_dt(&spi->cfg->bus); in eswifi_spi_request()
157 data: in eswifi_spi_request()
158 /* CMD/DATA READY signals the Data Phase */ in eswifi_spi_request()
161 LOG_ERR("DATA ready timeout\n"); in eswifi_spi_request()
166 to_read = MIN(rlen - offset, to_read); in eswifi_spi_request()
173 /* Flush remaining data if receiving buffer not large enough */ in eswifi_spi_request()
180 spi_release_dt(&spi->cfg->bus); in eswifi_spi_request()
207 if (strncmp(rsp, startstr, sizeof(endstr) - 1)) { in eswifi_spi_read_msg()
214 msg_len = ret - (sizeof(startstr) - 1) - (sizeof(endstr) - 1); in eswifi_spi_read_msg()
216 eswifi_async_msg(eswifi, rsp + sizeof(endstr) - 1, msg_len); in eswifi_spi_read_msg()
240 /* SPI DATA READY PIN */ in eswifi_spi_init()
241 if (!gpio_is_ready_dt(&cfg->dr)) { in eswifi_spi_init()
242 LOG_ERR("device %s is not ready", cfg->dr.port->name); in eswifi_spi_init()
243 return -ENODEV; in eswifi_spi_init()
245 gpio_pin_configure_dt(&cfg->dr, GPIO_INPUT); in eswifi_spi_init()
248 if (!spi_is_ready_dt(&cfg->bus)) { in eswifi_spi_init()
249 LOG_ERR("SPI bus is not ready"); in eswifi_spi_init()
250 return -ENODEV; in eswifi_spi_init()
253 spi->cfg = cfg; in eswifi_spi_init()
255 eswifi->bus_data = spi; in eswifi_spi_init()
259 k_thread_create(&spi->poll_thread, eswifi_spi_poll_stack, in eswifi_spi_init()