@@ -77,9 +77,9 @@ rt_err_t rt_qspi_bus_register(struct rt_spi_bus *bus, const char *name, const st
7777 return spi_bus_register (bus , name , ops );
7878}
7979
80- rt_size_t rt_qspi_transfer_message (struct rt_qspi_device * device , struct rt_qspi_message * message )
80+ rt_ssize_t rt_qspi_transfer_message (struct rt_qspi_device * device , struct rt_qspi_message * message )
8181{
82- rt_err_t result ;
82+ rt_ssize_t result ;
8383
8484 RT_ASSERT (device != RT_NULL );
8585 RT_ASSERT (message != RT_NULL );
@@ -128,7 +128,7 @@ rt_size_t rt_qspi_transfer_message(struct rt_qspi_device *device, struct rt_qsp
128128 return result ;
129129}
130130
131- rt_err_t rt_qspi_send_then_recv (struct rt_qspi_device * device , const void * send_buf , rt_size_t send_length , void * recv_buf , rt_size_t recv_length )
131+ rt_ssize_t rt_qspi_send_then_recv (struct rt_qspi_device * device , const void * send_buf , rt_size_t send_length , void * recv_buf , rt_size_t recv_length )
132132{
133133 RT_ASSERT (send_buf );
134134 RT_ASSERT (recv_buf );
@@ -137,7 +137,7 @@ rt_err_t rt_qspi_send_then_recv(struct rt_qspi_device *device, const void *send_
137137 struct rt_qspi_message message ;
138138 unsigned char * ptr = (unsigned char * )send_buf ;
139139 rt_size_t count = 0 ;
140- rt_err_t result = 0 ;
140+ rt_ssize_t result = 0 ;
141141
142142 message .instruction .content = ptr [0 ];
143143 message .instruction .qspi_lines = 1 ;
@@ -206,23 +206,23 @@ rt_err_t rt_qspi_send_then_recv(struct rt_qspi_device *device, const void *send_
206206 {
207207 result = - RT_EIO ;
208208 }
209- else
209+ else if ( result > 0 )
210210 {
211211 result = recv_length ;
212212 }
213213
214214 return result ;
215215}
216216
217- rt_err_t rt_qspi_send (struct rt_qspi_device * device , const void * send_buf , rt_size_t length )
217+ rt_ssize_t rt_qspi_send (struct rt_qspi_device * device , const void * send_buf , rt_size_t length )
218218{
219219 RT_ASSERT (send_buf );
220220 RT_ASSERT (length != 0 );
221221
222222 struct rt_qspi_message message ;
223223 unsigned char * ptr = (unsigned char * )send_buf ;
224224 rt_size_t count = 0 ;
225- rt_err_t result = 0 ;
225+ rt_ssize_t result = 0 ;
226226
227227 message .instruction .content = ptr [0 ];
228228 message .instruction .qspi_lines = 1 ;
@@ -292,7 +292,7 @@ rt_err_t rt_qspi_send(struct rt_qspi_device *device, const void *send_buf, rt_si
292292 {
293293 result = - RT_EIO ;
294294 }
295- else
295+ else if ( result > 0 )
296296 {
297297 result = length ;
298298 }
0 commit comments