@@ -196,45 +196,6 @@ static void ep_recv(const void *data, size_t len, void *priv)
196
196
LOG_HEXDUMP_DBG ((uint8_t * )data , len , "Received msg:" );
197
197
}
198
198
199
- /**
200
- * @brief Send data to the flpr with the given opcode.
201
- *
202
- * @param opcode The opcode of the message to send.
203
- * @param data The data to send.
204
- * @param len The length of the data to send.
205
- *
206
- * @return 0 on success, -ENOMEM if there is no space in the buffer,
207
- * -ETIMEDOUT if the transfer timed out.
208
- */
209
- static int mspi_ipc_data_send (nrfe_mspi_opcode_t opcode , const void * data , size_t len )
210
- {
211
- int rc ;
212
-
213
- LOG_DBG ("Sending msg with opcode: %d" , (uint8_t )opcode );
214
- #if defined(CONFIG_SYS_CLOCK_EXISTS )
215
- uint32_t start = k_uptime_get_32 ();
216
- #else
217
- uint32_t repeat = EP_SEND_TIMEOUT_MS ;
218
- #endif
219
- #if !defined(CONFIG_MULTITHREADING )
220
- atomic_clear_bit (& ipc_atomic_sem , opcode );
221
- #endif
222
-
223
- do {
224
- rc = ipc_service_send (& ep , data , len );
225
- #if defined(CONFIG_SYS_CLOCK_EXISTS )
226
- if ((k_uptime_get_32 () - start ) > EP_SEND_TIMEOUT_MS ) {
227
- #else
228
- repeat -- ;
229
- if ((rc < 0 ) && (repeat == 0 )) {
230
- #endif
231
- break ;
232
- };
233
- } while (rc == - ENOMEM ); /* No space in the buffer. Retry. */
234
-
235
- return rc ;
236
- }
237
-
238
199
/**
239
200
* @brief Waits for a response from the peer with the given opcode.
240
201
*
@@ -303,16 +264,38 @@ static int nrfe_mspi_wait_for_response(nrfe_mspi_opcode_t opcode, uint32_t timeo
303
264
*/
304
265
static int send_data (nrfe_mspi_opcode_t opcode , const void * data , size_t len )
305
266
{
306
- int rc ;
267
+ LOG_DBG ( "Sending msg with opcode: %d" , ( uint8_t ) opcode ) ;
307
268
269
+ int rc ;
308
270
#ifdef CONFIG_MSPI_NRFE_IPC_NO_COPY
309
271
(void )len ;
310
272
void * data_ptr = (void * )data ;
273
+ #endif
311
274
312
- rc = mspi_ipc_data_send (opcode , & data_ptr , sizeof (void * ));
275
+ #if defined(CONFIG_SYS_CLOCK_EXISTS )
276
+ uint32_t start = k_uptime_get_32 ();
313
277
#else
314
- rc = mspi_ipc_data_send ( opcode , data , len ) ;
278
+ uint32_t repeat = EP_SEND_TIMEOUT_MS ;
315
279
#endif
280
+ #if !defined(CONFIG_MULTITHREADING )
281
+ atomic_clear_bit (& ipc_atomic_sem , opcode );
282
+ #endif
283
+
284
+ do {
285
+ #ifdef CONFIG_MSPI_NRFE_IPC_NO_COPY
286
+ rc = ipc_service_send (& ep , & data_ptr , sizeof (void * ));
287
+ #else
288
+ rc = ipc_service_send (& ep , data , len );
289
+ #endif
290
+ #if defined(CONFIG_SYS_CLOCK_EXISTS )
291
+ if ((k_uptime_get_32 () - start ) > EP_SEND_TIMEOUT_MS ) {
292
+ #else
293
+ repeat -- ;
294
+ if ((rc < 0 ) && (repeat == 0 )) {
295
+ #endif
296
+ break ;
297
+ };
298
+ } while (rc == - ENOMEM ); /* No space in the buffer. Retry. */
316
299
317
300
if (rc < 0 ) {
318
301
LOG_ERR ("Data transfer failed: %d" , rc );
@@ -520,7 +503,7 @@ static int api_get_channel_status(const struct device *dev, uint8_t ch)
520
503
* @retval -ENOMEM if there is no space in the buffer
521
504
* @retval -ETIMEDOUT if the transfer timed out
522
505
*/
523
- static int xfer_packet (struct mspi_xfer_packet * packet , uint32_t timeout )
506
+ static int send_packet (struct mspi_xfer_packet * packet , uint32_t timeout )
524
507
{
525
508
int rc ;
526
509
nrfe_mspi_opcode_t opcode = (packet -> dir == MSPI_RX ) ? NRFE_MSPI_TXRX : NRFE_MSPI_TX ;
@@ -598,7 +581,7 @@ static int start_next_packet(struct mspi_xfer *xfer, uint32_t packets_done)
598
581
return - EINVAL ;
599
582
}
600
583
601
- return xfer_packet (packet , xfer -> timeout );
584
+ return send_packet (packet , xfer -> timeout );
602
585
}
603
586
604
587
/**
0 commit comments