yangsong8-a1 opened a new pull request, #22196:
URL: https://github.com/apache/nuttx/pull/22196
## Summary
Two improvements to the rpmsgblk client driver:
1. Add `rpmsgblk_unregister()` so the client CPU can tear down an
rpmsg block device proxy during board uninitialize. The function
looks up the block driver inode, unregisters it, removes the rpmsg
callback, and frees the driver resources. The declaration is added
to `include/nuttx/drivers/rpmsgblk.h`.
2. Use `rpmsgblk_get_tx_payload_buffer()` inside `rpmsgblk_send_recv()`
for all message paths, so the endpoint bound state is checked before
every operation. Previously the `copy=true` path called
`rpmsg_send()` directly.
## Impact
Adds a new public API (`rpmsgblk_unregister`). No callers in tree
yet — it is intended for board-level uninitialize code.
Before the send_recv change, the copy path sent with rpmsg_send()
without waiting for the endpoint to be bound to the peer.
## Testing
Ubuntu 22.04, host gcc. sim:rpserver and sim:rpproxy (Make), no new
warnings. The proxy registers /dev/ram1 with rpmsgblk_register("server",
"/dev/ram1", NULL) in sim_bringup.c; the server side is a 1 MiB ramdisk.
Both images run on the host; the proxy console is reached with
`cu /dev/ttyproxy` on the server. A temporary test program on the proxy
(not part of this PR) opens /dev/ram1 with open_blockdriver(), writes
and reads back sector 0 through the rpmsg connection, then calls the new
rpmsgblk_unregister():
proxy> hello
open_blockdriver: 0
geometry: 0 nsectors 2048 sectorsize 512
write sector 0: 1
read sector 0: 1 "hello-rpmsgblk" match 1
rpmsgblk_unregister: 0, stat /dev/ram1: -1
`ls /dev` on the proxy afterwards no longer lists ram1.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]