summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 96cfcfb)
raw | patch | inline | side by side (parent: 96cfcfb)
author | G Anthony <a0783926@ti.com> | |
Fri, 22 Mar 2013 01:09:18 +0000 (18:09 -0700) | ||
committer | G Anthony <a0783926@ti.com> | |
Mon, 1 Apr 2013 21:15:13 +0000 (14:15 -0700) |
Replaced GateSwi with GateAll, since protection may need to come from threads
and SWIs.
Removed gate enter/leave around VirtQueue calls, as the protection has been
pushed down into VirtQueue.
Signed-off-by: G Anthony <a0783926@ti.com>
and SWIs.
Removed gate enter/leave around VirtQueue calls, as the protection has been
pushed down into VirtQueue.
Signed-off-by: G Anthony <a0783926@ti.com>
packages/ti/ipc/rpmsg/MessageQCopy.c | patch | blob | history |
index 611b19cedf86c62894a44ebd261ace61d5cca0b0..492ee1e0f0c8078328bfd330b350c613bb648316 100644 (file)
#include <ti/sysbios/knl/Swi.h>
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/heaps/HeapBuf.h>
#include <ti/sysbios/knl/Swi.h>
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/heaps/HeapBuf.h>
-#include <ti/sysbios/gates/GateSwi.h>
+#include <ti/sysbios/gates/GateAll.h>
#include <ti/sdo/utils/List.h>
#include <ti/ipc/MultiProc.h>
#include <ti/sdo/utils/List.h>
#include <ti/ipc/MultiProc.h>
/* Module_State */
typedef struct MessageQCopy_Module {
/* Instance gate: */
/* Module_State */
typedef struct MessageQCopy_Module {
/* Instance gate: */
- GateSwi_Handle gateSwi;
+ GateAll_Handle gateH;
/* Array of messageQObjects in the system: */
struct MessageQCopy_Object *msgqObjects[MAXMESSAGEQOBJECTS];
/* Heap from which to allocate free messages for copying: */
/* Array of messageQObjects in the system: */
struct MessageQCopy_Object *msgqObjects[MAXMESSAGEQOBJECTS];
/* Heap from which to allocate free messages for copying: */
#define FXNN "MessageQCopy_init"
Void MessageQCopy_init(UInt16 remoteProcId)
{
#define FXNN "MessageQCopy_init"
Void MessageQCopy_init(UInt16 remoteProcId)
{
- GateSwi_Params gatePrms;
+ GateAll_Params gatePrms;
HeapBuf_Params prms;
int i;
Registry_Result result;
HeapBuf_Params prms;
int i;
Registry_Result result;
(IArg)remoteProcId);
/* Gate to protect module object and lists: */
(IArg)remoteProcId);
/* Gate to protect module object and lists: */
- GateSwi_Params_init(&gatePrms);
- module.gateSwi = GateSwi_create(&gatePrms, NULL);
+ GateAll_Params_init(&gatePrms);
+ module.gateH = GateAll_create(&gatePrms, NULL);
/* Initialize Module State: */
for (i = 0; i < MAXMESSAGEQOBJECTS; i++) {
/* Initialize Module State: */
for (i = 0; i < MAXMESSAGEQOBJECTS; i++) {
Swi_delete(&(transport.swiHandle));
Swi_delete(&(transport.swiHandle));
- GateSwi_delete(&module.gateSwi);
+ GateAll_delete(&module.gateH);
exit:
Log_print0(Diags_EXIT, "<-- "FXNN);
exit:
Log_print0(Diags_EXIT, "<-- "FXNN);
Assert_isTrue((curInit > 0) , NULL);
Assert_isTrue((curInit > 0) , NULL);
- key = GateSwi_enter(module.gateSwi);
+ key = GateAll_enter(module.gateH);
if (reserved == MessageQCopy_ASSIGN_ANY) {
/* Search the array for a free slot above reserved: */
if (reserved == MessageQCopy_ASSIGN_ANY) {
/* Search the array for a free slot above reserved: */
}
}
}
}
- GateSwi_leave(module.gateSwi, key);
+ GateAll_leave(module.gateH, key);
Log_print1(Diags_EXIT, "<-- "FXNN": 0x%x", (IArg)obj);
return (obj);
Log_print1(Diags_EXIT, "<-- "FXNN": 0x%x", (IArg)obj);
return (obj);
}
/* Null out our slot: */
}
/* Null out our slot: */
- key = GateSwi_enter(module.gateSwi);
+ key = GateAll_enter(module.gateH);
module.msgqObjects[obj->queueId] = NULL;
module.msgqObjects[obj->queueId] = NULL;
- GateSwi_leave(module.gateSwi, key);
+ GateAll_leave(module.gateH, key);
Log_print1(Diags_LIFECYCLE, FXNN": endPt deleted: %d",
(IArg)obj->queueId);
Log_print1(Diags_LIFECYCLE, FXNN": endPt deleted: %d",
(IArg)obj->queueId);
if (dstProc != MultiProc_self()) {
/* Send to remote processor: */
do {
if (dstProc != MultiProc_self()) {
/* Send to remote processor: */
do {
- key = GateSwi_enter(module.gateSwi); /* Protect vring structs */
token = VirtQueue_getAvailBuf(transport.virtQueue_toHost,
(Void **)&msg, &length);
token = VirtQueue_getAvailBuf(transport.virtQueue_toHost,
(Void **)&msg, &length);
- GateSwi_leave(module.gateSwi, key);
} while (token < 0 && Semaphore_pend(transport.semHandle_toHost,
BIOS_WAIT_FOREVER));
if (token >= 0) {
} while (token < 0 && Semaphore_pend(transport.semHandle_toHost,
BIOS_WAIT_FOREVER));
if (token >= 0) {
msg->flags = 0;
msg->reserved = 0;
msg->flags = 0;
msg->reserved = 0;
- key = GateSwi_enter(module.gateSwi); // Protect vring structs.
VirtQueue_addUsedBuf(transport.virtQueue_toHost, token,
RPMSG_BUF_SIZE);
VirtQueue_kick(transport.virtQueue_toHost);
VirtQueue_addUsedBuf(transport.virtQueue_toHost, token,
RPMSG_BUF_SIZE);
VirtQueue_kick(transport.virtQueue_toHost);
- GateSwi_leave(module.gateSwi, key);
}
else {
status = MessageQCopy_E_FAIL;
}
else {
status = MessageQCopy_E_FAIL;
/* Put on a Message queue on this processor: */
/* Protect from MessageQCopy_delete */
/* Put on a Message queue on this processor: */
/* Protect from MessageQCopy_delete */
- key = GateSwi_enter(module.gateSwi);
+ key = GateAll_enter(module.gateH);
obj = module.msgqObjects[dstEndpt];
obj = module.msgqObjects[dstEndpt];
- GateSwi_leave(module.gateSwi, key);
+ GateAll_leave(module.gateH, key);
if (obj == NULL) {
Log_print1(Diags_STATUS, FXNN": no object for endpoint: %d",
if (obj == NULL) {
Log_print1(Diags_STATUS, FXNN": no object for endpoint: %d",
size = len + sizeof(Queue_elem);
/* HeapBuf_alloc() is non-blocking, so needs protection: */
size = len + sizeof(Queue_elem);
/* HeapBuf_alloc() is non-blocking, so needs protection: */
- key = GateSwi_enter(module.gateSwi);
+ key = GateAll_enter(module.gateH);
payload = (Queue_elem *)HeapBuf_alloc(module.heap, size, 0, NULL);
payload = (Queue_elem *)HeapBuf_alloc(module.heap, size, 0, NULL);
- GateSwi_leave(module.gateSwi, key);
+ GateAll_leave(module.gateH, key);
if (payload != NULL) {
memcpy(payload->data, data, len);
if (payload != NULL) {
memcpy(payload->data, data, len);