diff options
author | Anton Staaf <robotboy@chromium.org> | 2015-01-07 11:03:51 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-01-08 00:38:13 +0000 |
commit | dc1362ca82e72ac488bb25d308c97aaf733274fc (patch) | |
tree | de3023bc3c0c9362afaf30d030287f1df27722a4 /include/queue.h | |
parent | 18d3bde7f89cb0bf62e3703d1954791dbb2a0df3 (diff) | |
download | chrome-ec-dc1362ca82e72ac488bb25d308c97aaf733274fc.tar.gz |
Queue: Add methods that accept a memcpy routine
These versions of the queue add and remove methods support
using memcpy like routines to access regions of memory with
specific requirements. In particular, this will allow for
transfers between queues and USB packet RAM on the STM32
which has specific access requirements.
This change also includes an update to the mem* util routines
to make their prototypes compatible with C89 and POSIX
standards.
Signed-off-by: Anton Staaf <robotboy@chromium.org>
BRANCH=None
BUG=None
TEST=make buildall -j
Test USB Echo functionality on discovery-stm32f072 board to
ensure that queues still function correctly.
Change-Id: I557064d99abfc3e8cfc98099a1d94334a976550c
Reviewed-on: https://chromium-review.googlesource.com/239217
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
Trybot-Ready: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'include/queue.h')
-rw-r--r-- | include/queue.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/queue.h b/include/queue.h index 9be0f31bdc..c38e5313f5 100644 --- a/include/queue.h +++ b/include/queue.h @@ -80,12 +80,28 @@ size_t queue_add_unit(struct queue const *q, void const *src); /* Add multiple units to queue. */ size_t queue_add_units(struct queue const *q, void const *src, size_t count); +/* Add multiple units to queue using supplied memcpy. */ +size_t queue_add_memcpy(struct queue const *q, + void const *src, + size_t count, + void *(*memcpy)(void *dest, + void const *src, + size_t n)); + /* Remove one unit from the begin of the queue. */ size_t queue_remove_unit(struct queue const *q, void *dest); /* Remove multiple units from the begin of the queue. */ size_t queue_remove_units(struct queue const *q, void *dest, size_t count); +/* Remove multiple units from the begin of the queue using supplied memcpy. */ +size_t queue_remove_memcpy(struct queue const *q, + void *dest, + size_t count, + void *(*memcpy)(void *dest, + void const *src, + size_t n)); + /* Peek (return but don't remove) the count elements starting with the i'th. */ size_t queue_peek_units(struct queue const *q, void *dest, |