Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions docs/change_summary/source/drivers/ipc_rpmsg.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ index 95212bce53..dc254758a8 100755
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -97,7 +97,7 @@ int32_t RPMessage_getEndPtMsg(RPMessage_Struct *obj, RPMessage_LocalMsg **pMsg,
@@ -97,7 +97,7 @@ int32_t RPMessage_getEndPtMsg(RPMessage_Object *obj, RPMessage_QueueElem **pMsg,
{
done = 1;
}
Expand All @@ -18,7 +18,7 @@ index 95212bce53..dc254758a8 100755
{
status = SystemP_TIMEOUT;
done = 1;
@@ -108,7 +108,7 @@ int32_t RPMessage_getEndPtMsg(RPMessage_Struct *obj, RPMessage_LocalMsg **pMsg,
@@ -108,7 +108,7 @@ int32_t RPMessage_getEndPtMsg(RPMessage_Object *obj, RPMessage_QueueElem **pMsg,
status = SystemP_SUCCESS;
done = 1;
}
Expand Down Expand Up @@ -91,22 +91,22 @@ index 95212bce53..dc254758a8 100755
{
@@ -280,14 +281,14 @@ int32_t RPMessage_recv(RPMessage_Object *handle, void* data, uint16_t *dataLen,
int32_t status = SystemP_FAILURE;
RPMessage_Struct *obj = (RPMessage_Struct *)handle;
RPMessage_Object *obj = (RPMessage_Object *)handle;

- if( data != NULL && dataLen != NULL && remoteCoreId != NULL && remoteEndPt != NULL
- && obj->recvCallback == NULL /* i.e non-callback mode */
+ if( (data != NULL) && (dataLen != NULL) && (remoteCoreId != NULL) && (remoteEndPt != NULL)
+ && (obj->recvCallback == NULL) /* i.e non-callback mode */
)
{
RPMessage_LocalMsg *pMsg;
status = RPMessage_getEndPtMsg(obj, &pMsg, timeout);
RPMessage_QueueElem *elem;

status = RPMessage_getEndPtMsg(obj, &elem, timeout);
- if(status == SystemP_SUCCESS && pMsg != NULL)
+ if((status == SystemP_SUCCESS) && (pMsg != NULL))
{
uint32_t isAllocPending = 0;
uint16_t vringBufId = pMsg->vringBufId;
uint16_t vringBufId = elem->vringBufId;
@@ -308,11 +309,11 @@ int32_t RPMessage_recv(RPMessage_Object *handle, void* data, uint16_t *dataLen,
*dataLen = header->dataLen;
}
Expand All @@ -115,7 +115,7 @@ index 95212bce53..dc254758a8 100755
+ memcpy((void *) data,(const void *) &vringBufAddr[sizeof(RPMessage_Header)],(size_t) *dataLen);

RPMessage_vringPutEmptyRxBuf(*remoteCoreId, vringBufId);
isAllocPending = RPMessage_freeEndPtMsg(*remoteCoreId, pMsg);
isAllocPending = RPMessage_freeEndPtMsg(*remoteCoreId, elem);
- if(isAllocPending)
+ if(isAllocPending!=0U)
{ /* if any messages are pending message pointer due to free Q being empty,
Expand All @@ -139,42 +139,42 @@ index 95212bce53..dc254758a8 100755

void RPMessage_unblock(RPMessage_Object *handle)
{
- RPMessage_Struct *obj = (RPMessage_Struct *)handle;
+ RPMessage_Struct *obj;
- RPMessage_Object *obj = (RPMessage_Object *)handle;
+ RPMessage_Object *obj;

+ if(handle != NULL)
+ {
+ obj = (RPMessage_Struct *)handle;
+ obj = (RPMessage_Object *)handle;
obj->doRecvUnblock = 1;
SemaphoreP_post(&obj->newEndPtMsgSem);
+ }
}

uint16_t RPMessage_getLocalEndPt(const RPMessage_Object *handle)
{
- RPMessage_Struct *obj = (RPMessage_Struct *)handle;
+ RPMessage_Struct *obj;
- RPMessage_Object *obj = (RPMessage_Object *)handle;
+ RPMessage_Object *obj;

+ DebugP_assert(handle != NULL);
+
+ obj = (RPMessage_Struct *)handle;
+ obj = (RPMessage_Object *)handle;
return obj->localEndPt;
+
}

int32_t RPMessage_construct(RPMessage_Object *handle, const RPMessage_CreateParams *createParams)
{
- RPMessage_Struct *obj = (RPMessage_Struct *)handle;
+ RPMessage_Struct *obj;
- RPMessage_Object *obj = (RPMessage_Object *)handle;
+ RPMessage_Object *obj;
int32_t status = SystemP_FAILURE;

DebugP_assert(sizeof(RPMessage_Object) >= sizeof(RPMessage_Struct));
DebugP_assert(sizeof(RPMessage_Object) >= sizeof(RPMessage_Object));

- if(createParams->localEndPt < RPMESSAGE_MAX_LOCAL_ENDPT
- && gIpcRpmsgCtrl.localEndPtObj[createParams->localEndPt] == NULL)
+ if((handle != NULL) && (createParams != NULL))
+ {
+ obj = (RPMessage_Struct *)handle;
+ obj = (RPMessage_Object *)handle;
+ if((createParams->localEndPt < RPMESSAGE_MAX_LOCAL_ENDPT)
+ && (gIpcRpmsgCtrl.localEndPtObj[createParams->localEndPt] == NULL))
{
Expand All @@ -190,14 +190,14 @@ index 95212bce53..dc254758a8 100755

void RPMessage_destruct(RPMessage_Object *handle)
{
- RPMessage_Struct *obj = (RPMessage_Struct *)handle;
+ RPMessage_Struct *obj;
- RPMessage_Object *obj = (RPMessage_Object *)handle;
+ RPMessage_Object *obj;

- if(obj->localEndPt < RPMESSAGE_MAX_LOCAL_ENDPT &&
- gIpcRpmsgCtrl.localEndPtObj[obj->localEndPt] != NULL)
+ if(handle != NULL)
+ {
+ obj = (RPMessage_Struct *)handle;
+ obj = (RPMessage_Object *)handle;
+ if((obj->localEndPt < RPMESSAGE_MAX_LOCAL_ENDPT) &&
+ (gIpcRpmsgCtrl.localEndPtObj[obj->localEndPt] != NULL))
{
Expand Down Expand Up @@ -233,7 +233,7 @@ index 95212bce53..dc254758a8 100755

int32_t RPMessage_coreInit(uint16_t remoteCoreId, const RPMessage_Params *params)
@@ -442,7 +459,7 @@ int32_t RPMessage_coreInit(uint16_t remoteCoreId, const RPMessage_Params *param
RPMessage_queuePut(&coreObj->freeQ, &coreObj->localMsgObj[elemId].elem);
RPMessage_queuePut(&coreObj->freeQ, &coreObj->localMsgObj[elemId]);
}
/* Linux VRINGs we will init later inside RPMessage_waitForLinuxReady() */
- if(gIpcRpmsgCtrl.isCoreEnable[remoteCoreId] && !RPMessage_isLinuxCore(remoteCoreId))
Expand Down Expand Up @@ -405,10 +405,10 @@ index 27334eea6c..7072652951 100755

+void RPMessage_vringResetInternal(RPMessage_Vring *vringObj, uint16_t numBuf, uint16_t msgSize, uintptr_t vringBaseAddr, uint32_t offset_desc, uint32_t offset_avail, uint32_t offset_used, uint32_t offset_buf, uint32_t isTx);
+
+RPMessage_LocalMsg *RPMessage_allocEndPtMsg(uint32_t remoteCoreId);
+uint32_t RPMessage_freeEndPtMsg(uint16_t remoteCoreId, RPMessage_LocalMsg *pMsg);
+void RPMessage_putEndPtMsg(RPMessage_Struct *obj, RPMessage_LocalMsg *pMsg);
+int32_t RPMessage_getEndPtMsg(RPMessage_Struct *obj, RPMessage_LocalMsg **pMsg, uint32_t timeout);
+RPMessage_QueueElem *RPMessage_allocEndPtMsg(uint32_t remoteCoreId);
+uint32_t RPMessage_freeEndPtMsg(uint16_t remoteCoreId, RPMessage_QueueElem *elem);
+void RPMessage_putEndPtMsg(RPMessage_Object *obj, RPMessage_QueueElem *elem);
+int32_t RPMessage_getEndPtMsg(RPMessage_Object *obj, RPMessage_QueueElem **elem, uint32_t timeout);
+void RPMessage_recvHandler(uint32_t remoteCoreId);
+void RPMessage_notifyCallback(uint32_t remoteCoreId, uint16_t localClientId, uint32_t msgValue, void *args);
+int32_t RPMessage_coreInit(uint16_t remoteCoreId, const RPMessage_Params *params);
Expand Down
25 changes: 19 additions & 6 deletions source/drivers/ipc_rpmsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ extern "C" {

#include <stdint.h>
#include <kernel/dpl/SystemP.h>
#include <kernel/dpl/SemaphoreP.h>
#include <drivers/hw_include/cslr_soc.h>
#include <drivers/ipc_rpmsg/ipc_rpmsg_queue.h>
#include <drivers/ipc_rpmsg/include/ipc_rpmsg_linux_resource_table.h>

/**
Expand Down Expand Up @@ -94,11 +96,9 @@ extern "C" {
#define RPMESSAGE_CRC_SIZE (2U)

/**
* \brief Opaque RPMessage object used with the RPMessage APIs
* \brief RPMessage object used with the RPMessage APIs
*/
typedef struct RPMessage_Object_s {
uintptr_t rsv[RPMESSAGE_OBJECT_SIZE_MAX/sizeof(uint32_t)]; /**< reserved, should NOT be modified by end users */
} RPMessage_Object;
struct RPMessage_Object_s;

/**
* \brief Callback that is invoked when a message is received from any CPU at the specified local end point
Expand All @@ -119,7 +119,7 @@ typedef struct RPMessage_Object_s {
* \param remoteCoreId [in] Core ID of sender
* \param remoteEndPt [in] End point of sender
*/
typedef void (*RPMessage_RecvCallback)(RPMessage_Object *obj, void *arg,
typedef void (*RPMessage_RecvCallback)(struct RPMessage_Object_s *obj, void *arg,
void *data, uint16_t dataLen, int32_t crcStatus,
uint16_t remoteCoreId, uint16_t remoteEndPt);

Expand All @@ -136,7 +136,7 @@ typedef void (*RPMessage_RecvCallback)(RPMessage_Object *obj, void *arg,
* \param obj [in] RPMessage end point object created with \ref RPMessage_construct
* \param arg [in] Arguments specified by user during \ref RPMessage_construct
*/
typedef void (*RPMessage_RecvNotifyCallback)(RPMessage_Object *obj, void *arg);
typedef void (*RPMessage_RecvNotifyCallback)(struct RPMessage_Object_s *obj, void *arg);


/**
Expand Down Expand Up @@ -167,6 +167,19 @@ typedef void (*RPMessage_ControlEndPtCallback)(void *arg,
*/
typedef int32_t (*RPMessage_CrcHookFxn)(uint8_t *data, uint16_t dataLen, uint8_t crcSize, void *crc);

/* structure to hold state of RPMessage end point */
typedef struct RPMessage_Object_s
{
uint16_t localEndPt; /* local end point number, MUST be < RPMESSAGE_MAX_LOCAL_ENDPT */
RPMessage_RecvCallback recvCallback; /* when not NULL, received messages are handled in callback that via RPMessage_recv */
void *recvCallbackArgs; /* arguments passed to the recvCallback callback */
uint32_t doRecvUnblock; /* flag to unblock RPMessage_recv, if its blocked for every waiting for messages and user wants to shutdown or exit */
RPMessage_Queue endPtQ; /* end point specific queue to hold received messages pending for processing at this end point */
SemaphoreP_Object newEndPtMsgSem; /* semaphore to indicate that there messages pending endPtQ */
RPMessage_RecvNotifyCallback recvNotifyCallback; /* when not NULL, this callback is whenever a message is received */
void *recvNotifyCallbackArgs; /* arguments passed to the recvNotifyCallback callback */
} RPMessage_Object;

/**
* \brief Parameters passed to \ref RPMessage_construct
*
Expand Down
Loading
Loading