|
13 | 13 | #include <hal/nrf_vpr_csr.h> |
14 | 14 | #include <hal/nrf_vpr_csr_vio.h> |
15 | 15 | #include <hal/nrf_vpr_csr_vtim.h> |
| 16 | +#include <hal/nrf_timer.h> |
16 | 17 | #include <haly/nrfy_gpio.h> |
17 | 18 |
|
18 | 19 | #include <drivers/mspi/nrfe_mspi.h> |
@@ -76,6 +77,9 @@ static volatile uint8_t response_buffer[CONFIG_SDP_MSPI_MAX_RESPONSE_SIZE]; |
76 | 77 |
|
77 | 78 | static struct ipc_ept ep; |
78 | 79 | static atomic_t ipc_atomic_sem = ATOMIC_INIT(0); |
| 80 | +#if defined(CONFIG_SDP_MSPI_FAULT_TIMER) |
| 81 | +static NRF_TIMER_Type *fault_timer; |
| 82 | +#endif |
79 | 83 |
|
80 | 84 | static void adjust_tail(volatile hrt_xfer_data_t *xfer_data, uint16_t frame_width, |
81 | 85 | uint32_t data_length) |
@@ -367,10 +371,23 @@ static void ep_recv(const void *data, size_t len, void *priv) |
367 | 371 | nrfe_mspi_flpr_response_msg_t response; |
368 | 372 | uint8_t opcode = *(uint8_t *)data; |
369 | 373 | uint32_t num_bytes = 0; |
370 | | - |
| 374 | +#if defined(CONFIG_SDP_MSPI_FAULT_TIMER) |
| 375 | + if (fault_timer != NULL) { |
| 376 | + nrf_timer_task_trigger(fault_timer, NRF_TIMER_TASK_START); |
| 377 | + } |
| 378 | +#endif |
371 | 379 | response.opcode = opcode; |
372 | 380 |
|
373 | 381 | switch (opcode) { |
| 382 | +#if defined(CONFIG_SDP_MSPI_FAULT_TIMER) |
| 383 | + case NRFE_MSPI_CONFIG_TIMER_PTR: { |
| 384 | + const nrfe_mspi_flpr_timer_msg_t *timer_data = |
| 385 | + (const nrfe_mspi_flpr_timer_msg_t *)data; |
| 386 | + |
| 387 | + fault_timer = timer_data->timer_ptr; |
| 388 | + break; |
| 389 | + } |
| 390 | +#endif |
374 | 391 | case NRFE_MSPI_CONFIG_PINS: { |
375 | 392 | nrfe_mspi_pinctrl_soc_pin_msg_t *pins_cfg = (nrfe_mspi_pinctrl_soc_pin_msg_t *)data; |
376 | 393 |
|
@@ -442,6 +459,12 @@ static void ep_recv(const void *data, size_t len, void *priv) |
442 | 459 |
|
443 | 460 | response_buffer[0] = opcode; |
444 | 461 | ipc_service_send(&ep, (const void *)response_buffer, sizeof(opcode) + num_bytes); |
| 462 | +#if defined(CONFIG_SDP_MSPI_FAULT_TIMER) |
| 463 | + if (fault_timer != NULL) { |
| 464 | + nrf_timer_task_trigger(fault_timer, NRF_TIMER_TASK_CLEAR); |
| 465 | + nrf_timer_task_trigger(fault_timer, NRF_TIMER_TASK_STOP); |
| 466 | + } |
| 467 | +#endif |
445 | 468 | } |
446 | 469 |
|
447 | 470 | static const struct ipc_ept_cfg ep_cfg = { |
|
0 commit comments