index 94fbc1bc0a8e3f3079c64cc15f000c63545d399a..75d84dbe7521e697f344b167117395069aa823d7 100644 (file)
/*
- * Copyright (c) 2011-2013, Texas Instruments Incorporated
+ * Copyright (c) 2011-2015 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
/* Various arbitrary limits: */
#define MAXMESSAGEQOBJECTS 256
-#define MAXMESSAGEBUFFERS 512
-#define MSGBUFFERSIZE 512 /* Max payload + sizeof(ListElem) */
-#define MAXHEAPSIZE (MAXMESSAGEBUFFERS * MSGBUFFERSIZE)
-#define HEAPALIGNMENT 8
/* The RPMessage Object */
typedef struct RPMessage_Object {
Semaphore_Handle semHandle_toHost;
} RPMessage_Transport;
+/* generated in RPMessage.xs: module$use() */
+extern __FAR__ const HeapBuf_Handle ti_ipc_rpmsg_RPMessage_heap;
+
+/* generated in template file RPMessage.xdt */
+extern __FAR__ const UInt ti_ipc_rpmsg_RPMessage_messageBufferSize;
/* module diags mask */
Registry_Desc Registry_CURDESC;
static RPMessage_Module module;
static RPMessage_Transport transport;
-/* We create a fixed size heap over this memory for copying received msgs */
-#pragma DATA_ALIGN (recv_buffers, HEAPALIGNMENT)
-static UInt8 recv_buffers[MAXHEAPSIZE];
-
/* Module ref count: */
static Int curInit = 0;
Void RPMessage_init(UInt16 remoteProcId)
{
GateHwi_Params gatePrms;
- HeapBuf_Params prms;
Semaphore_Params semParams;
int i;
Registry_Result result;
module.msgqObjects[i] = NULL;
}
- HeapBuf_Params_init(&prms);
- prms.blockSize = MSGBUFFERSIZE;
- prms.numBlocks = MAXMESSAGEBUFFERS;
- prms.buf = recv_buffers;
- prms.bufSize = MAXHEAPSIZE;
- prms.align = HEAPALIGNMENT;
- module.heap = HeapBuf_create(&prms, NULL);
- if (module.heap == 0) {
- System_abort("RPMessage_init: HeapBuf_create returned 0\n");
- }
+ /* store handle to heap created at config time */
+ module.heap = ti_ipc_rpmsg_RPMessage_heap;
Semaphore_Params_init(&semParams);
semParams.mode = Semaphore_Mode_BINARY;
Assert_isTrue(FALSE, NULL);
}
else {
+#if defined(OMAP5) || defined(VAYU)
vqParams.callback = callback_availBufReady;
+#else
+ vqParams.callback = (xdc_Fxn)callback_availBufReady;
+#endif
}
/*
* Create a pair VirtQueues (one for sending, one for receiving).
* Note: First one gets an even, second gets odd vq ID.
*/
- vqParams.vqId = ID_SELF_TO_A9;
+ vqParams.vqId = ID_SELF_TO_HOST;
transport.virtQueue_toHost = (Ptr)VirtQueue_create(remoteProcId,
&vqParams, NULL);
- vqParams.vqId = ID_A9_TO_SELF;
+ vqParams.vqId = ID_HOST_TO_SELF;
transport.virtQueue_fromHost = (Ptr)VirtQueue_create(remoteProcId,
&vqParams, NULL);
}
/* Tear down Module */
- HeapBuf_delete(&(module.heap));
-
Swi_delete(&(transport.swiHandle));
GateHwi_delete(&module.gateH);
/* Free/discard all queued message buffers: */
while ((payload = (Queue_elem *)List_get(obj->queue)) != NULL) {
- HeapBuf_free(module.heap, (Ptr)payload, MSGBUFFERSIZE);
+ HeapBuf_free(module.heap, (Ptr)payload,
+ ti_ipc_rpmsg_RPMessage_messageBufferSize);
}
List_delete(&(obj->queue));
}
else {
payload = (Queue_elem *)List_get(obj->queue);
- Assert_isTrue((!payload), NULL);
+ Assert_isTrue((payload), NULL);
}
if (status == RPMessage_S_SUCCESS) {