Commit Graph

7 Commits

Author SHA1 Message Date
Anton Staaf
88a1790bb7 Queue: Add ability to modify contiguous units inplace
Previously all access to the queue was done by adding or removing units
with no access to the underlying byte array, or ability to notify the
queue that the byte array had been updated.  This prevented direct DMA
transfers to and from the underlying byte array.

This change adds a new struct, a queue_chunk, that represents a
contiguous region of the queues byte array.  Regions of valid units as
well as free space can be requested.  And there are now update functions
to signal to the queue that new units were added or existing units were
read from these chunks.  A chunk can be queried and used to initialize
a DMA transfer, as interrupts or polling indicates that the DMA is
working the queue indicies can be updated and the policy activated as
needed.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j

Change-Id: I7e37d937c56153122f0a3c73ba8064b656106e3a
Reviewed-on: https://chromium-review.googlesource.com/285556
Trybot-Ready: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
2015-07-15 21:57:36 +00:00
Bill Richardson
104f811e67 cleanup: fix all the header guards
This unifies all the EC header files to use __CROS_EC_FILENAME_H
as the include guard. Well, except for test/ util/ and extra/
which use __TEST_ __UTIL_ and __EXTRA_ prefixes respectively.

BUG=chromium:496895
BRANCH=none
TEST=make buildall -j

Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Change-Id: Iea71b3a08bdec94a11239de810a2b2e152b15029
Reviewed-on: https://chromium-review.googlesource.com/278121
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-06-18 19:07:00 +00:00
Gwendal Grignou
f58d821a5a Queue: add peek_memcpy function
Add queue_peek_memcpy to peek at queue and move the element using
specific memcpy function.
Also change memcpy prototype argument from void const * to const void*.

BUG=none
BRANCH=none
TEST=Compile and use.

Change-Id: I8c582563e7d204ee5568637f819d63404624faf6
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/274226
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Anton Staaf <robotboy@chromium.org>
2015-06-09 12:10:37 +00:00
Anton Staaf
a0ebf0a008 Queue: Add policies to queues
Policies give a convenient place to hook into the queue operations
and notify something that there is new space free in the queue or
new units added.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j

Change-Id: I94b2aa94b8e8d07911191bc19a39fa827623b117
Reviewed-on: https://chromium-review.googlesource.com/271791
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Anton Staaf <robotboy@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
Trybot-Ready: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
2015-05-26 19:36:15 +00:00
Anton Staaf
dc1362ca82 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>
2015-01-08 00:38:13 +00:00
Anton Staaf
a6da62d284 Queue: Add functionality needed by new USART stream driver
Previously there was no way to remove multiple units at a time
from the queue, and the queue was wasting an entry to disambiguate
full from empty.  There was also no way to get the free entry
count from the queue, only the ability to query if it was above
a required amount.  The queue was also storing its constant
compile time configuration as well as its dynamic state in the
same structure.  This wasted RAM on configuration information
that doesn't change.

This refactor fixes these issues, making the queue suitable for
use in the new USART stream driver.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j

Change-Id: I284cee52d8189928dbc4c499f87ab34e14019e5a
Reviewed-on: https://chromium-review.googlesource.com/210533
Reviewed-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
2014-09-18 02:59:24 +00:00
Louis Yung-Chieh Lo
210ddfefcf Refactor the i8042 module to be thread-safe.
Any command/data coming from host will be placed in from_host queue, and
the interrupt handler returns immediately. The i8042_command_task() will
handle them later.

Data reply to the host will be protected by the mutex.

BUG=chrome-os-partner:10090
TEST=randomly play around on the link board.

Change-Id: Ic19d5abd1abf8dc261ddaad4224cd9305c2f36a4
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/24299
Commit-Ready: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Tested-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
2012-06-07 20:48:51 -07:00