@@ -77,9 +77,9 @@ rt_err_t rt_qspi_bus_register(struct rt_spi_bus *bus, const char *name, const st
77
77
return spi_bus_register (bus , name , ops );
78
78
}
79
79
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 )
81
81
{
82
- rt_err_t result ;
82
+ rt_ssize_t result ;
83
83
84
84
RT_ASSERT (device != RT_NULL );
85
85
RT_ASSERT (message != RT_NULL );
@@ -128,7 +128,7 @@ rt_size_t rt_qspi_transfer_message(struct rt_qspi_device *device, struct rt_qsp
128
128
return result ;
129
129
}
130
130
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 )
132
132
{
133
133
RT_ASSERT (send_buf );
134
134
RT_ASSERT (recv_buf );
@@ -137,7 +137,7 @@ rt_err_t rt_qspi_send_then_recv(struct rt_qspi_device *device, const void *send_
137
137
struct rt_qspi_message message ;
138
138
unsigned char * ptr = (unsigned char * )send_buf ;
139
139
rt_size_t count = 0 ;
140
- rt_err_t result = 0 ;
140
+ rt_ssize_t result = 0 ;
141
141
142
142
message .instruction .content = ptr [0 ];
143
143
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_
206
206
{
207
207
result = - RT_EIO ;
208
208
}
209
- else
209
+ else if ( result > 0 )
210
210
{
211
211
result = recv_length ;
212
212
}
213
213
214
214
return result ;
215
215
}
216
216
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 )
218
218
{
219
219
RT_ASSERT (send_buf );
220
220
RT_ASSERT (length != 0 );
221
221
222
222
struct rt_qspi_message message ;
223
223
unsigned char * ptr = (unsigned char * )send_buf ;
224
224
rt_size_t count = 0 ;
225
- rt_err_t result = 0 ;
225
+ rt_ssize_t result = 0 ;
226
226
227
227
message .instruction .content = ptr [0 ];
228
228
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
292
292
{
293
293
result = - RT_EIO ;
294
294
}
295
- else
295
+ else if ( result > 0 )
296
296
{
297
297
result = length ;
298
298
}
0 commit comments