@@ -103,25 +103,26 @@ static void distribute_last_word_bits(void)
103103 uint32_t last_word = xfer_params .xfer_data [HRT_FE_DATA ].last_word ;
104104 uint32_t word_count = xfer_params .xfer_data [HRT_FE_DATA ].word_count ;
105105 uint32_t penultimate_word_bits =
106- xfer_params .xfer_data [HRT_FE_DATA ].penultimate_word_clocks *
107- xfer_params .bus_widths .data ;
108- uint32_t last_word_bits = xfer_params . xfer_data [ HRT_FE_DATA ]. last_word_clocks *
109- xfer_params .bus_widths .data ;
106+ xfer_params .xfer_data [HRT_FE_DATA ].penultimate_word_clocks *
107+ xfer_params .bus_widths .data ;
108+ uint32_t last_word_bits =
109+ xfer_params . xfer_data [ HRT_FE_DATA ]. last_word_clocks * xfer_params .bus_widths .data ;
110110 uint32_t penultimate_word_shift = BITS_IN_WORD - penultimate_word_bits ;
111111 /* In case when last word is too short, penultimate word has to give it 1 byte.
112112 * this is here to pass this byte back to penultimate word to avoid holes.
113113 */
114114 if ((penultimate_word_shift != 0 ) && (word_count > 1 )) {
115115 rx_data [word_count - 2 ] = (rx_data [word_count - 2 ] >> penultimate_word_shift ) |
116- (last_word << penultimate_word_bits );
116+ (last_word << penultimate_word_bits );
117117 last_word = last_word >> penultimate_word_shift ;
118118 }
119119
120120 /* This is to avoid writing outside of data buffer in case when buffer_length%4 !=
121121 * 0.
122122 */
123- for (uint8_t byte = 0 ; byte < NRFX_CEIL_DIV (last_word_bits - penultimate_word_shift , BITS_IN_BYTE ); byte ++ ) {
124- ((uint8_t * )& (rx_data [word_count - 1 ]))[byte ] = ((uint8_t * )& last_word )[byte ];
123+ for (uint8_t byte = 0 ;
124+ byte < NRFX_CEIL_DIV (last_word_bits - penultimate_word_shift , BITS_IN_BYTE ); byte ++ ) {
125+ ((uint8_t * )& (rx_data [word_count - 1 ]))[byte ] = ((uint8_t * )& last_word )[byte ];
125126 }
126127}
127128
@@ -294,13 +295,13 @@ static void xfer_execute(nrfe_mspi_xfer_packet_msg_t *xfer_packet, volatile uint
294295 xfer_params .xfer_data [HRT_FE_DATA ].data = NULL ;
295296
296297 adjust_tail (& xfer_params .xfer_data [HRT_FE_DATA ], xfer_params .bus_widths .data ,
297- xfer_packet -> num_bytes * BITS_IN_BYTE );
298+ xfer_packet -> num_bytes * BITS_IN_BYTE );
298299
299300 xfer_params .xfer_data [HRT_FE_DATA ].data = rx_buffer ;
300301 } else {
301302 xfer_params .xfer_data [HRT_FE_DATA ].data = xfer_packet -> data ;
302303 adjust_tail (& xfer_params .xfer_data [HRT_FE_DATA ], xfer_params .bus_widths .data ,
303- xfer_packet -> num_bytes * BITS_IN_BYTE );
304+ xfer_packet -> num_bytes * BITS_IN_BYTE );
304305 }
305306
306307 /* Hardware issue: Additional clock edge when transmitting in modes other
@@ -489,10 +490,15 @@ static void ep_recv(const void *data, size_t len, void *priv)
489490 break ;
490491 case NRFE_MSPI_TXRX : {
491492 nrfe_mspi_xfer_packet_msg_t * packet = (nrfe_mspi_xfer_packet_msg_t * )data ;
492- num_bytes = packet -> num_bytes ;
493-
494- if (num_bytes > 0 ) {
493+ if (packet -> num_bytes > 0 ) {
494+ #ifdef CONFIG_SDP_MSPI_IPC_NO_COPY
495+ xfer_execute (packet , packet -> data );
496+ #else
497+ NRFX_ASSERT (packet -> num_bytes <=
498+ CONFIG_SDP_MSPI_MAX_RESPONSE_SIZE - sizeof (nrfe_mspi_opcode_t ));
499+ num_bytes = packet -> num_bytes ;
495500 xfer_execute (packet , response_buffer + sizeof (nrfe_mspi_opcode_t ));
501+ #endif
496502 }
497503 break ;
498504 }
@@ -502,7 +508,8 @@ static void ep_recv(const void *data, size_t len, void *priv)
502508 }
503509
504510 response_buffer [0 ] = opcode ;
505- ipc_service_send (& ep , (const void * )response_buffer , sizeof (nrfe_mspi_opcode_t ) + num_bytes );
511+ ipc_service_send (& ep , (const void * )response_buffer ,
512+ sizeof (nrfe_mspi_opcode_t ) + num_bytes );
506513
507514#if defined(CONFIG_SDP_MSPI_FAULT_TIMER )
508515 if (fault_timer != NULL ) {
0 commit comments