summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c34f5ff)
raw | patch | inline | side by side (parent: c34f5ff)
author | vwan@ti.com <vwan@ti.com> | |
Wed, 21 May 2014 17:01:31 +0000 (10:01 -0700) | ||
committer | Robert Tivy <rtivy@ti.com> | |
Fri, 23 May 2014 00:11:35 +0000 (17:11 -0700) |
Signed-off-by: VW <vwan@ti.com>
qnx/src/ipc3x_dev/ti/syslink/inc/knl/VirtQueue.h | patch | blob | history | |
qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/transports/virtio/VirtQueue.c | patch | blob | history |
diff --git a/qnx/src/ipc3x_dev/ti/syslink/inc/knl/VirtQueue.h b/qnx/src/ipc3x_dev/ti/syslink/inc/knl/VirtQueue.h
index 8ee79f63dbd1bda90a1632a0f1725512e6650d2a..c4fd5017c0654b35073199e947837a2311dd6757 100644 (file)
/*
- * Copyright (c) 2011, Texas Instruments Incorporated
+ * Copyright (c) 2011-2014, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -227,41 +227,6 @@ Int VirtQueue_addAvailBuf(VirtQueue_Handle vq, Void *buf, UInt32 len, Int16 head
*/
Int16 VirtQueue_getUsedBuf(VirtQueue_Handle vq, Void **buf);
-/*
- * ============================================================================
- * Slave Only Functions:
- * ============================================================================
- */
-
-/*!
- * @brief Get the next available buffer.
- * Only used by Slave.
- *
- * @param[in] vq the VirtQueue.
- * @param[out] buf Pointer to location of available buffer;
- *
- * @return Returns a token used to identify the available buffer, to be
- * passed back into VirtQueue_addUsedBuf();
- * token is negative if failure to find an available buffer.
- *
- * @sa VirtQueue_addUsedBuf
- */
-Int16 VirtQueue_getAvailBuf(VirtQueue_Handle vq, Void **buf);
-
-/*!
- * @brief Add used buffer to virtqueue's used buffer list.
- * Only used by Slave.
- *
- * @param[in] vq the VirtQueue.
- * @param[in] token token of the buffer to be added to vring used list.
- * @param[in] len length of the message in the buffer being added.
- *
- * @return Remaining capacity of queue or a negative error.
- *
- * @sa VirtQueue_getAvailBuf
- */
-Int VirtQueue_addUsedBuf(VirtQueue_Handle vq, Int16 token, UInt32 len);
-
/*!
* @brief Add used buffer address to virtqueue's used buffer list.
* Only used by Host.
* @param[in] len length of the message in the buffer being added.
*
* @return Remaining capacity of queue or a negative error.
- *
- * @sa VirtQueue_getAvailBuf
*/
Int VirtQueue_addUsedBufAddr(VirtQueue_Handle vq, Void *buf, UInt32 len);
diff --git a/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/transports/virtio/VirtQueue.c b/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/transports/virtio/VirtQueue.c
index 90481866a0d3256c13c8fc1a76562ca518561b2c..8fc1c094dda77353c40db453f52a8358572cbe59 100644 (file)
#include <ti/syslink/utils/Memory.h>
#include <ti/syslink/utils/Trace.h>
-//#include <ti/sysbios/hal/Hwi.h>
-//#include <ti/sysbios/knl/Semaphore.h>
-//#include <ti/sysbios/knl/Clock.h>
-//#include <ti/sysbios/BIOS.h>
-//#include <ti/sysbios/hal/Cache.h>
-
#include <_ArchIpcInt.h>
#include <ArchIpcInt.h>
#include "VirtQueue.h"
/* Number of free buffers */
UInt16 num_free;
- /* Last available index; updated by VirtQueue_getAvailBuf */
- UInt16 last_avail_idx;
-
- /* Last available index; updated by VirtQueue_addUsedBuf */
+ /* Last available index; updated by VirtQueue_getUsedBuf */
UInt16 last_used_idx;
/* Will eventually be used to kick remote processor */
ArchIpcInt_sendInterrupt(vq->procId, vq->intId, vq->id);
}
-/*!
- * ======== VirtQueue_addUsedBuf ========
- */
-Int VirtQueue_addUsedBuf(VirtQueue_Handle vq, Int16 head, UInt32 len)
-{
- struct vring_used_elem *used;
- Int status = 0;
-
- if ((head > vq->vring.num) || (head < 0)) {
- status = -1;
- GT_setFailureReason (curTrace,
- GT_4CLASS,
- "VirtQueue_addUsedBuf",
- status,
- "head is invalid!");
- }
- else {
- /*
- * The virtqueue contains a ring of used buffers. Get a pointer to the
- * next entry in that used ring.
- */
- used = &vq->vring.used->ring[vq->vring.used->idx % vq->vring.num];
- used->id = head;
- used->len = len;
-
- vq->vring.used->idx++;
- }
-
- return status;
-}
-
/*!
* ======== VirtQueue_addUsedBufAddr ========
*/
return (head);
}
-/*!
- * ======== VirtQueue_getAvailBuf ========
- */
-Int16 VirtQueue_getAvailBuf(VirtQueue_Handle vq, Void **buf)
-{
- UInt16 head;
-
- GT_6trace(curTrace, GT_2CLASS, "getAvailBuf vq: 0x%x %d %d %d 0x%x 0x%x",
- (IArg)vq, vq->last_avail_idx, vq->vring.avail->idx, vq->vring.num,
- (IArg)&vq->vring.avail, (IArg)vq->vring.avail);
-
- /* Clear flag here to avoid race condition with remote processor.
- * This is a negative flag, clearing it means that we want to
- * receive an interrupt when a buffer has been added to the pool.
- */
- vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;
- /* There's nothing available? */
- if (vq->last_avail_idx == vq->vring.avail->idx) {
- /* We need to know about added buffers */
- return (-1);
- }
-
- /* No need to know be kicked about added buffers anymore */
- vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY;
-
- /*
- * Grab the next descriptor number they're advertising, and increment
- * the index we've seen.
- */
- head = vq->vring.avail->ring[vq->last_avail_idx++ % vq->vring.num];
-
- *buf = mapPAtoVA(vq, vq->vring.desc[head].addr);
-
- return (head);
-}
-
/*!
* ======== VirtQueue_disableCallback ========
*/
numQueues++;
vq->procId = procId;
vq->intId = coreIntId[procId];
- vq->last_avail_idx = 0;
vq->arg = arg;
/* init the vring */