Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about rpmsg_register_callback() #11555

Closed
hzc04 opened this issue Jan 16, 2024 · 4 comments
Closed

Question about rpmsg_register_callback() #11555

hzc04 opened this issue Jan 16, 2024 · 4 comments

Comments

@hzc04
Copy link

hzc04 commented Jan 16, 2024

Hello, I've been reading the code related to rptun recently, and I have a question about the implementation of rpmsg_register_callback().

I think after creating the rpmsg_device, I need to register a rpmsg service using rpmsg_register_callback(). This service will be added to g_rptun_cb.
Until the remote send a ns msg to create rpmsg channel, the host will scan the g_rptun_cb and call ns_bind() to bind a rpmsg_endpoint. This endpoint will be added to priv->bind. After that, we can communicate normally, and see what endpoints have been bound based on priv->bind.

That's my current understanding. I'm not sure I've got it right.

I don't understand why, in the process of rpmsg_register_callback(), if it finds that this cb(or endpoint?) is already bound, it removes the cb from priv->bind and triggers ns_bind()..? (https://github.com/apache/nuttx/blob/master/drivers/rptun/rptun.c#L1111) Don't need to trigger ns_bind() via ns msg?

Would you please explain this to me? Thanks a lot!

@xiaoxiang781216
Copy link
Contributor

https://github.com/apache/nuttx/blob/master/drivers/rptun/rptun.c#L1111 is invalid, please provide the correct location.

@hzc04
Copy link
Author

hzc04 commented Jan 17, 2024

https://github.com/apache/nuttx/blob/master/drivers/rptun/rptun.c#L1111 is invalid, please provide the correct location.

Yesterday this code was split into rpmsg.c

https://github.com/apache/nuttx/blob/master/drivers/rpmsg/rpmsg.c#L184

@xiaoxiang781216
Copy link
Contributor

Since the ns message may come before you call rpmsg_register_callback, the framework has to append the endpoint to bind list in this case, and notify you later. After this point, it isn't used anymore and then removed.

@hzc04
Copy link
Author

hzc04 commented Jan 17, 2024

Since the ns message may come before you call rpmsg_register_callback, the framework has to append the endpoint to bind list in this case, and notify you later. After this point, it isn't used anymore and then removed.

I clearly understand this now. Many thanks!!

@hzc04 hzc04 closed this as completed Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants