summaryrefslogtreecommitdiff
path: root/zephyr/shim/src/tasks.c
Commit message (Collapse)AuthorAgeFilesLines
* ish: Trim down the release branchstabilize-wristpin-14469.59.B-ishstabilize-voshyr-14637.B-ishstabilize-quickfix-14695.187.B-ishstabilize-quickfix-14695.124.B-ishstabilize-quickfix-14526.91.B-ishstabilize-14695.85.B-ishstabilize-14695.107.B-ishstabilize-14682.B-ishstabilize-14633.B-ishstabilize-14616.B-ishstabilize-14589.B-ishstabilize-14588.98.B-ishstabilize-14588.14.B-ishstabilize-14588.123.B-ishstabilize-14536.B-ishstabilize-14532.B-ishstabilize-14528.B-ishstabilize-14526.89.B-ishstabilize-14526.84.B-ishstabilize-14526.73.B-ishstabilize-14526.67.B-ishstabilize-14526.57.B-ishstabilize-14498.B-ishstabilize-14496.B-ishstabilize-14477.B-ishstabilize-14469.9.B-ishstabilize-14469.8.B-ishstabilize-14469.58.B-ishstabilize-14469.41.B-ishstabilize-14442.B-ishstabilize-14438.B-ishstabilize-14411.B-ishstabilize-14396.B-ishstabilize-14395.B-ishstabilize-14388.62.B-ishstabilize-14388.61.B-ishstabilize-14388.52.B-ishstabilize-14385.B-ishstabilize-14345.B-ishstabilize-14336.B-ishstabilize-14333.B-ishrelease-R99-14469.B-ishrelease-R98-14388.B-ishrelease-R102-14695.B-ishrelease-R101-14588.B-ishrelease-R100-14526.B-ishfirmware-cherry-14454.B-ishfirmware-brya-14505.B-ishfirmware-brya-14505.71.B-ishfactory-kukui-14374.B-ishfactory-guybrush-14600.B-ishfactory-cherry-14455.B-ishfactory-brya-14517.B-ishJack Rosenthal2021-11-051-353/+0
| | | | | | | | | | | | | | | | | | | | | | In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* zephyr: shell: add alias for kernel threads commandMichał Barnaś2021-09-221-0/+9
| | | | | | | | | | | | | | | Add taskinfo command as alias for "kernel threads" for backward compatibility with CrOS EC. BRANCH=main BUG=b:190224781 TEST=Check that taskinfo correctly executes "kernel threads" command Change-Id: Ibdce9d8342fb7a99577b1f8d031c419fa485e7b0 Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3174058 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: Add test runner in shimmed taskTomasz Michalec2021-09-151-11/+14
| | | | | | | | | | | | | | | | | | | Some functions requires to call task_wait_event in test task context. Because of that there is needed shimmed_tasks entry for TASK_ID_TEST_RUNNER. BUG=none BRANCH=none TEST=make configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I92cd3776a827f9a7f9bb1faee67ed998260e23a8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3159528 Tested-by: Tomasz Michalec <tmichalec@google.com> Tested-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Tomasz Michalec <tmichalec@google.com>
* zephyr: Add test runner task idTomasz Michalec2021-09-021-0/+16
| | | | | | | | | | | | | | | | | Code calling task_get_current() requires to return from this function valid task ID. To test this code, new TASK_ID_TEST_RUNNER is introduced. Test can set current thread as test runner and guarantee that task_get_current() return valid task ID. BUG=b:184856919 BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Id5470e5337ab2419aad07f0f22de5f1576e870c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3110086 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: shim/src: task: add in_interrupt_context routineTim Lin2021-08-051-0/+5
| | | | | | | | | | | | | | | This routine is needed when enable CONFIG_HOST_COMMAND_STATUS. This routine allows the caller to customize its actions, depending on whether it is a thread or an ISR. BUG=b:195342437 BRANCH=none TEST=zmake testall Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Change-Id: Id2a948c67de81fbc8ee161e5711cff17b8ac359d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3070941 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: implement irq functions for tasksDino Li2021-07-071-2/+4
| | | | | | | | | | | | | | | Implement irq functions for tasks. BRANCH=none BUG=b:190203712 TEST=can zmake hayato and it8xxx2_evb Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Change-Id: Ic35ed656f10a1b24543145421843b540a6cbc5a7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2988744 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: tasks: fix task id for deferred callsTomasz Michalec2021-06-301-0/+8
| | | | | | | | | | | | | | | In Zephyr deferred calls are run in k_sys_work_queue context instead of thread running hook_task(). Because of that shimmed task_get_current() is modfied to return TASK_ID_HOOKS if run from k_sys_work_queue context. BUG=b:190727776 TEST=make hosttest BRANCH=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I9e15627df8dce6b0829ad872150cbe2318330f28 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2953225 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Add dummies for a few more task functionsSimon Glass2021-06-151-0/+15
| | | | | | | | | | | | | | These need to be implemented properly, or another way found. For now, add stubs. BUG=b:190213172 BRANCH=none TEST=with other CLs, build asurada for Zephyr Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I12283dcc2b70b5e2c788169b9b3939cba4380f10 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2941814 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: Conditionally remove the task nameKeith Short2021-06-111-0/+15
| | | | | | | | | | | | | | | | | | The names stored in the shimmed task list are not accessible unless CONFIG_THREAD_NAME is defined. Compile out the task names unless CONFIG_THREAD_NAME is enabled. This provides a modest 300 byte savings. BUG=none BRANCH=none TEST=zmake testall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Iaf6bc8a1a7311ed42221a89fc9520e962cdf1b7f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2956829 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: Implement task_start_calledDawid Niedzwiecki2021-03-311-1/+3
| | | | | | | | | | | | | | | | | Fix task_start_called to return a correct value, not hardcoded 1. The task_start_called is used before jumping to RW to prepare PD before sysjump. If the PD tasks are not started, the preparation is not needed. BUG=b:164421798 BRANCH=none TEST=Flash DUT with bootimage with Zephyr included then boot with the SoftSync enabled. Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: Ib2a2dbdb56c109e51a31b5a6f20a42f1e181727b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2794141 Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: implement task timersJack Rosenthal2021-03-201-0/+47
| | | | | | | | | | | | | | | | | | | | | CrOS EC OS provides one implicit timer associated with every task (see docs/core_runtime.md). As luck has it, we never needed these implicit timers for volteer, but ARM power sequencing code uses it. This implements the timer_arm and timer_cancel functions, which function equivalently to how they would in CrOS EC OS. (Note: we previously were compiling timer_arm and timer_cancel from CrOS EC, but these definitions were non-functional as we never call process_timers from Zephyr). BUG=b:183058135 BRANCH=none TEST=provided unit tests pass Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ibad20002c489a8149efde713d8273adae835f653 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2774362 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: implement cortex-m's interrupt_disable()Yuval Peress2021-02-181-9/+0
| | | | | | | | | | | | | | | | | | Add implementation in lieu of Zephyr APIs. Zephyr's support for irq_disable() doesn't disable all interrupts (see Zephyr's include/arch/arm/aarch32/asm_inline_gcc.h for more information). The implementation is done via a #define inside the system.c file, this is done on purpose to avoid leaking the interrupt_disable() functionality outside of sysjump. All other uses of disabling interrupts should be done via irq_lock(). BRANCH=none BUG=b:174481378 TEST=build/flash volteer, run sysjump command Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Idccb93211296f81796ce4ba200c62adc5c19e691 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2695959
* zephyr: flash/system: enable common/flash.c & common/system.cYuval Peress2021-02-031-0/+14
| | | | | | | | | | | | | | | | | | | Bring both flash.c and system.c into the build. zephyr/shim/src/system.c now includes only code that is needed to stub out the chip specific system.c implementation in platform/ec (which is now using the devicetree values). BRANCH=none BUG=b:176828988, b:174481378 TEST=zmake testall TEST=build volteer, flash, and test flashinfo. Cq-Depend: chromium:2631353 Change-Id: I5c542fca01dcc4af98401bcbbf402e579cd45e36 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2649463 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Enable the power-delivery taskSimon Glass2021-01-121-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Enable the PD_C0-3 tasks so that the power-delivery logic can run. Drop the PLATFORM_EC_USB_PD_TCPMV2 Kconfig which does not actually exist. We always use TCPMV2 with Zephyr. BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer -j30 build volteer on zephyr run and see lots of charge_requests and activity, none of it very useful: [658 Battery 26% (Display 24.2 %) / ??h:?? to full] [662 charge_request(13200mV, 2584mA)] [666 charge problem: set current, 0x0 -> 0xfffffffb after %.6llds] [673 charge problem: set voltage, 0x0 -> 0xfffffffb after %.6llds] [679 charge problem: set mode, 0x0 -> 0xfffffffb after %.6llds] [707 charge problem: chg params, 0x0 -> 0x1f after %.6llds] Signed-off-by: Simon Glass <sjg@chromium.org> Cq-Depend: chromium:2623427 Change-Id: Icde0f7f4205d85e02cffded351c54047fe220c9d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2617204
* zephyr: improve shimming for unit testsPaul Fagerburg2020-12-311-0/+7
| | | | | | | | | | | | | | | | | | | | | | | * Move the Ztest-related definitions out of test_util and into a shim version of that header. * Add definitions for EC unit tests declaring additional tasks so the task shim will pick them up correctly. * Copy the prng functions into the shimmed test_util. BUG=None BRANCH=None TEST=`make clobber ; make buildall -j ; make runhosttests` Then build the unit tests that have been ported to Ztest, e.g. `zmake configure --test -B build/base32 zephyr/test/base32` for `base32`, `crc`, `hooks`, `i2c`,and `tasks` Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: Ia2873a4c2028fcb6960e80f683189def2f3a228d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2605231 Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org> Auto-Submit: Paul Fagerburg <pfagerburg@chromium.org>
* task_set_event: remove the wait argumentDawid Niedzwiecki2020-12-141-2/+1
| | | | | | | | | | | | | | | | | | | | There is an option in the task_set_event function which force the calling task to wait for an event. However, the option is never used thus remove it. This also will help in the Zephyr migration process. BUG=b:172360521 BRANCH=none TEST=make buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: Ic152fd3d6862d487bcc0024c48d136556c0b81bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2521599 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: fix build for keyboard shimYuval Peress2020-12-051-7/+1
| | | | | | | | | | | | | | | | | | | | | See platform/ec/common/build.mk for reference. The use of keyboard_scan.c should only be allowed when HAS_TASK_KEYSCAN is defined. As such, we should always set HAS_TASK_KEYSCAN to 1 if CONFIG_PLATFORM_EC_KEYBOARD is defined. Further, CROS_EC_TASK_LIST was defined per project and it doesn't need to be, we can instead define it once for all boards depending on which tasks are set to 1 in shimmed_tasks.h Note that shimmed_tasks.h can still be used in tests. BRANCH=none BUG=none TEST=zmake testall Cq-Depend: chromium:2566421 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Id0ed49dd49e3c4eb2ac23184cf943c91dcd261eb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2567560
* zephyr: fix issue with set_event hanging before tasks startJett Rink2020-11-131-3/+20
| | | | | | | | | | | | | | Initialize the kernel objects before application code as a chance to run. This ensures that any event that is set before tasks start will get delivered (and won't crash the kernel). BRANCH=none BUG=none TEST=included unit test Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I84ecfddbe706e7e1860f310571851ee8dedd07d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2535984
* zephyr: correct shimmed task prioritiesJett Rink2020-11-091-2/+3
| | | | | | | | | | | | | | | | | Add build assert to ensure that deferred task is lower than all of the other shimmed tasks. Also make priority of tasks from 0 to COUNT - 1 instead of 1 to COUNT BRANCH=none BUG=none TEST=volteer still builds Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: Iabe9f1117850975ec9bf3df1dcfc690b4725a7e0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2523389 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* cleanup: follow header include styleJett Rink2020-11-091-1/+1
| | | | | | | | | | | | | | | | | In order to align with go/zephyr-shim-how-to, update all of the platform/ec header files to use "quotes" and only use <brackets> for zephyr header files. Also include an empty line between the two. BRANCH=none BUG=none TEST=all zephyr tests build and pass; build volteer Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I27c275c24aa4f8eb40e100b07517b60f548f06cf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2521594 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* zephyr: move from SYS_INIT to mainJett Rink2020-11-091-5/+1
| | | | | | | | | | | | | | | | | | We are going to need to perform initialization in Zephyr's main before we start the EC tasks or call the INIT hooks. If we rely on SYS_INIT, all of that happens before main is called. BRANCH=none BUG=none TEST=pass tasks unit tests and run on volteer Cq-Depend: chromium:2523462 Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: Icd035695b86fc9690cea88887902be61d9b37a18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2523380 Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: add task shimJett Rink2020-11-051-0/+205
Provide shim/translation layer for converting platform/ec tasks into zephyr threads. Provide implementation API for platform/ec task_ API BRANCH=none BUG=b:171741620 TEST=unit test provided TEST=clean_build.sh ~/chromiumos/src/platform/ec/zephyr/tests/tasks && ../build/zephyr/zephyr.elf Change-Id: Ia2a1f808ec56a89c2a08df9de318edb1b6e9f869 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2518665 Reviewed-by: Simon Glass <sjg@chromium.org>