Skip to content

Commit 0cdff8a

Browse files
committed
openamp: improve documentation
1 parent b1a0e87 commit 0cdff8a

File tree

2 files changed

+35
-12
lines changed

2 files changed

+35
-12
lines changed

cores/arduino/stm32/OpenAMP/openamp.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ struct rpmsg_virtio_device rvdev;
3939

4040
static metal_phys_addr_t shm_physmap;
4141

42+
/**
43+
* @brief OpenAMP libmetal device structure
44+
*/
4245
struct metal_device shm_device = {
4346
.name = SHM_DEVICE_NAME,
4447
.num_regions = 2,
@@ -51,6 +54,12 @@ struct metal_device shm_device = {
5154
.irq_info = NULL
5255
};
5356

57+
/**
58+
* @brief Initialize OpenAMP shared memory (libmetal and resource table)
59+
*
60+
* @param RPMsgRole: RPMSG_REMOTE - Device is remote (slave)
61+
* @retval 0 on success
62+
*/
5463
static int OPENAMP_shmem_init(int RPMsgRole)
5564
{
5665
int status = 0;
@@ -98,6 +107,11 @@ static int OPENAMP_shmem_init(int RPMsgRole)
98107
return 0;
99108
}
100109

110+
/**
111+
* @brief Initialize the openamp framework
112+
*
113+
* @retval 0 when success
114+
*/
101115
int OPENAMP_Init()
102116
{
103117
struct fw_rsc_vdev_vring *vring_rsc;
@@ -141,18 +155,37 @@ int OPENAMP_Init()
141155
return 0;
142156
}
143157

158+
/**
159+
* @brief Deinitialize the openamp framework
160+
*/
144161
void OPENAMP_DeInit()
145162
{
146163
rpmsg_deinit_vdev(&rvdev);
147164

148165
metal_finish();
149166
}
150167

168+
/**
169+
* @brief Initialize the endpoint struct
170+
*
171+
* @param ept: virtio rpmsg endpoint
172+
*/
151173
void OPENAMP_init_ept(struct rpmsg_endpoint *ept)
152174
{
153175
rpmsg_init_ept(ept, "", RPMSG_ADDR_ANY, RPMSG_ADDR_ANY, NULL, NULL);
154176
}
155177

178+
/**
179+
* @brief Create and register the name service endpoint
180+
*
181+
* @param ept: virtio rpmsg endpoint
182+
* @param name: virtio rpmsg name service name
183+
* @param dest: message destination address. Set RPMSG_ADDR_ANY if
184+
* the host processor will decide this
185+
* @param cb: virtio rpmsg endpoint callback (receive)
186+
* @param unbind_cb: virtio rpmsg endpoint destroy callback
187+
* @retval 0 when success
188+
*/
156189
int OPENAMP_create_endpoint(struct rpmsg_endpoint *ept, const char *name,
157190
uint32_t dest, rpmsg_ept_cb cb,
158191
rpmsg_ns_unbind_cb unbind_cb)

cores/arduino/stm32/OpenAMP/openamp.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,18 @@ extern "C" {
3030
#include <openamp/rpmsg.h>
3131
#include "openamp_conf.h"
3232

33-
3433
#define OPENAMP_send rpmsg_send
3534
#define OPENAMP_destroy_ept rpmsg_destroy_ept
3635

37-
/* Initialize the openamp framework*/
3836
int OPENAMP_Init(void);
39-
40-
/* Deinitialize the openamp framework*/
4137
void OPENAMP_DeInit(void);
42-
43-
/* Initialize the endpoint struct*/
4438
void OPENAMP_init_ept(struct rpmsg_endpoint *ept);
4539

46-
/* Create and register the endpoint */
4740
int OPENAMP_create_endpoint(struct rpmsg_endpoint *ept, const char *name,
4841
uint32_t dest, rpmsg_ept_cb cb,
4942
rpmsg_ns_unbind_cb unbind_cb);
50-
51-
/* Check for new rpmsg reception */
52-
void OPENAMP_check_for_message(void);
53-
54-
/* Wait loop on endpoint ready ( message dest address is know)*/
43+
void OPENAMP_check_for_tx_message(void);
44+
void OPENAMP_check_for_rx_message(void);
5545
void OPENAMP_Wait_EndPointready(struct rpmsg_endpoint *rp_ept);
5646

5747
#ifdef __cplusplus

0 commit comments

Comments
 (0)