Revert "Fix kernel bug in INIT_LX_SIZE"
This reverts commit 16f26e8aa0.
This commit is contained in:
parent
16f26e8aa0
commit
69feeaf9d0
@ -126,78 +126,34 @@ aos_rpc_serial_putchar(struct aos_rpc *rpc, char c) {
|
||||
);
|
||||
}
|
||||
|
||||
// putchar for terminal printing is too slow so we write buffers instead
|
||||
// the corresponding interface does not know about errors, just partial writes
|
||||
size_t
|
||||
// putchar for terminal printing is too slow so we send buffers instead
|
||||
errval_t
|
||||
aos_rpc_serial_write(struct aos_rpc *rpc, const char *buf, size_t buf_len) {
|
||||
errval_t err;
|
||||
|
||||
// split the buffer into chunks for sending
|
||||
size_t total_bytes = 0;
|
||||
while(buf_len > 0) {
|
||||
size_t chunk_len = MIN(buf_len, RPC_SHARED_SIZE);
|
||||
size_t chunk_len = buf_len;
|
||||
if (chunk_len > RPC_SHARED_SIZE) {
|
||||
chunk_len = RPC_SHARED_SIZE;
|
||||
}
|
||||
|
||||
memcpy(rpc->shared_mem, buf, chunk_len);
|
||||
|
||||
size_t written_bytes;
|
||||
err = do_aos_rpc(
|
||||
rpc, RPC_MTYPE_SERIAL_WRITE,
|
||||
NULL_CAP, chunk_len, 0, 0,
|
||||
NULL, NULL, &written_bytes, NULL
|
||||
NULL, NULL, NULL, NULL
|
||||
);
|
||||
if (err_is_fail(err)) {
|
||||
return total_bytes;
|
||||
}
|
||||
|
||||
total_bytes += written_bytes;
|
||||
|
||||
// if the receiver was not able to write all we have given, return for now
|
||||
if (written_bytes < chunk_len) {
|
||||
return total_bytes;
|
||||
return err;
|
||||
}
|
||||
|
||||
buf += chunk_len;
|
||||
buf_len -= chunk_len;
|
||||
}
|
||||
|
||||
return total_bytes;
|
||||
}
|
||||
|
||||
// getchar for terminal reading is too slow so we read buffers instead
|
||||
// the corresponding interface does not know about errors, just partial reads
|
||||
size_t
|
||||
aos_rpc_serial_read(struct aos_rpc *rpc, const char *buf, size_t buf_len) {
|
||||
errval_t err;
|
||||
|
||||
// split the buffer into chunks for reading
|
||||
size_t total_bytes = 0;
|
||||
while(buf_len > 0) {
|
||||
size_t chunk_len = MIN(buf_len, RPC_SHARED_SIZE);
|
||||
|
||||
memcpy(rpc->shared_mem, buf, chunk_len);
|
||||
|
||||
size_t written_bytes;
|
||||
err = do_aos_rpc(
|
||||
rpc, RPC_MTYPE_SERIAL_WRITE,
|
||||
NULL_CAP, chunk_len, 0, 0,
|
||||
NULL, NULL, &written_bytes, NULL
|
||||
);
|
||||
if (err_is_fail(err)) {
|
||||
return total_bytes;
|
||||
}
|
||||
|
||||
total_bytes += written_bytes;
|
||||
|
||||
// if the receiver was not able to write all we have given, return for now
|
||||
if (written_bytes < chunk_len) {
|
||||
return total_bytes;
|
||||
}
|
||||
|
||||
buf += chunk_len;
|
||||
buf_len -= chunk_len;
|
||||
}
|
||||
|
||||
return total_bytes;
|
||||
return SYS_ERR_OK;
|
||||
}
|
||||
|
||||
errval_t
|
||||
|
||||
Loading…
Reference in New Issue
Block a user