summaryrefslogtreecommitdiff
path: root/extra
Commit message (Collapse)AuthorAgeFilesLines
* Cr50: Fix spshc console commandBill Richardson2015-08-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SPS RX FIFO handler prototype changed from passing cs_enabled to cs_disabled, but the callback function for the spshc command didn't. Now it does. The spshc command switches the protocol on the SPI Slave bus to expect EC Host Commands. BUG=none BRANCH=none TEST=manual At the EC console: spstpm off spshc On the build machine, with an FTDI cable connected to the SPS input: cd extra/ftdi_hostcmd make ./test_cmds Change-Id: I69294a977b83854c5f6348904330bf74416cc6ec Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/293619 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* Cr50: Add extra/sps_errs/ test programBill Richardson2015-07-114-0/+513
| | | | | | | | | | | | | | | | | | | | | | | | | This adds another test program to use with the EC connected to the build host via an FTDI USB-to-SPI adapater, This program sends an EC_CMD_HELLO host command to the EC. Options exist to display the bytes transferred over the SPI interface, and to truncate the message before its complete, to see how the EC reacts. BUG=chrome-os-partner:40969 BRANCH=none TEST=make buildall To try out the new test program: cd extra/sps_errs make ./prog ./prog -v ./prog -v -c 22 Change-Id: I1d370ecdbae047d9504bc6e5f73949d4e3aed9d9 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/284865 Reviewed-by: Vadim Bendebury <vbendeb@google.com>
* Cr50: Add verbose & range options to extra/ftdi_hostcmd/Bill Richardson2015-07-101-13/+61
| | | | | | | | | | | | | This just helps debug the SPI traffic. BUG=none BRANCH=none TEST=make buildall Change-Id: I09c2f0e0fed9a9f7d0b4cbcea6719c73cdf61068 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/284409 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Cr50: Enable host commands over SPI busBill Richardson2015-07-094-0/+617
| | | | | | | | | | | | | | | | | | | | | | This enables the feature that lets the Cr50 receive host commands via the SPI (slave) interface. BUG=chrome-os-partner:40969 BRANCH=none TEST=make buildall CQ-DEPEND=CL:283998 This CL also adds a test example in the extra/ftdi_hostcmd/ directory. To use it, you need the Cr50 attached to the build host via an FTDI USB-to-SPI adapter. cd extra/ftdi_hostcmd make ./test_cmds Change-Id: Ia719b1c898afc45b3105a9cd573a8492178d9be2 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/284001
* cleanup: fix all the header guardsBill Richardson2015-06-181-3/+3
| | | | | | | | | | | | | | | 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>
* discovery-stm32f072: Blink the LEDsBill Richardson2015-06-181-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This just makes the LEDs blink continually, because I have a development board sitting on my desk and I like to see it doing something. You can still force the GPIOs on and off using the tool in extra/usb_gpio/. BUG=none BRANCH=none TEST=make buildall Try it: sudo make BOARD=discovery-stm32f072 flash The LEDs blink. Force them on and off with: cd extra/usb_gpio make ./usb_gpio write -1 0 ./usb_gpio write 0 -1 ./usb_gpio write 2 0 ./usb_gpio write 4 2 To resume blinking, use ./usb_gpio write 0 0 Change-Id: Iadbe7436c02de5b6eae81885d95bad154ca3692c Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/274131 Reviewed-by: Anton Staaf <robotboy@chromium.org>
* extra: add simple USB console app for discovery-stm32f072Bill Richardson2015-05-272-0/+491
| | | | | | | | | | | | | | | | | | | | | | | This provides a very simple console interface for talking to the discovery-stm32f072 board over its USB connection. It's a simpler way to check that the board is working than configuring udev and/or various drivers to recognize USB device 18d1:500f as a serial console. BUG=none BRANCH=none TEST=manual Connect a discovery-stm32f072, then cd extra/usb_console make ./usb_console Change-Id: Ib25baebe5b4f3a930cdc3a1367d6d20d05b70c56 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/273570 Reviewed-by: Anton Staaf <robotboy@chromium.org>
* CCD: Disable ModemManager for CCD USB consolesAnton Staaf2015-05-062-14/+33
| | | | | | | | | | | | | | | | | | | | | | | | ModemManager likes to play with serial ports it shouldn't play with, mark our serial ports as off limits. This also bumps the ordering of this rules file just past the udev default rules because it uses environment variables populated by that file. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=install new rules file, delete old rules file verify that symlinks to TTY's are still created verify that ModemManager leaves them alone now Change-Id: I4ded95192d78b5b1bbc661ca5b762e18307d2d60 Reviewed-on: https://chromium-review.googlesource.com/269743 Trybot-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
* USB: Add udev rule to handle CCD devicesAnton Staaf2015-03-161-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | This udev rule creates a directory in /dev/google for each device attached. The name of the directory is unique to the device and is prefixed with the device product name. Within the directory there is a serial directory that contains symlinks to each USB serial port exposed by the device. The symlinks are named based on the USB interface name provided by the EC. Additional subdirectories can be added for I2C, JTAG, GPIOs, and SPI as needed. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=Verify that two different CCD devices generate uniquely named entries. Change-Id: I7e6f2ace29b7302c7c072bcf6aab7c8f060b993a Reviewed-on: https://chromium-review.googlesource.com/260420 Trybot-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
* USB-console: Add Linux USB serial kernel moduleAnton Staaf2014-10-292-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a simple kernel module and Makefile for building it out of tree. This module just uses the existing kernel usb serial driver and probes for the Google VID/Class/SubClass/Protocol that identifies a valid simple serial interface. This code should be rolled into the existing kernel driver at: drivers/usb/serial/usb-serial-simple.c While that happens, this module is still useful to developers. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=cd extra/usb_serial; make; sudo insmod raiden.ko Connect the discovery-stm32f072 over USB and see that its console is discovered and works. Change-Id: I83661b816643c43b3e2dc9fdc825bc3a796af2f4 Reviewed-on: https://chromium-review.googlesource.com/225923 Reviewed-by: Olof Johansson <olofj@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
* lightbar: interpreter additions to encode other patternsEric Caruso2014-10-1522-1/+187
| | | | | | | | | | | | | | | | | | | | Makes a significant encoding change to existing opcodes and adds several opcodes to allow for encoding the more complicated patterns that we have on the lightbar (S0, etc.) as well as condense the ones we technically could encode but couldn't fit in the 192-byte footprint allotted to us (KONAMI). We need this to remove sequences from the EC code. BUG=chrome-os-partner:32203 BRANCH=ToT TEST=run test programs on hardware and lightbar simulator Signed-off-by: Eric Caruso <ejcaruso@chromium.org> Change-Id: I12fe908d3a43a924aa39f24ad66adbe53f7f38e1 Reviewed-on: https://chromium-review.googlesource.com/222949 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* lightbar: bring the TAP sequence in graduallyBill Richardson2014-10-151-0/+1
| | | | | | | | | | | | | | | | | | | With only four LED segments, it's confusing to indicate a power percentage by dimming the top segment unless you can see the indicator smoothly ramping up from all-off. This does that. Kind of pretty, if I say so myself. BUG=chrome-os-partner:29041 BRANCH=ToT, Samus TEST=make buildall Run "ectool lightbar demo on", then press the T key to invoke the pattern and the arrow keys to fake the charge state. Change-Id: Ib6a56aea56078b8c1fc9edddda469d7f41735ff7 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/223300 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* discovery-stm32f072: discovery USB GPIO testAnton Staaf2014-10-143-0/+193
| | | | | | | | | | | | | | | | | | | | | | Wire up the discovery's four LEDs and one user button as GPIOs that can be written and read using the new USB GPIO driver. This also adds an extra tool called usb_gpio that provides control of GPIOs from the linux command line. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=cd board/discovery-stm32f072 ; make flash cd extra/usb_gpio ; make usb_gpio write 0x1e 0x00 Change-Id: I15115f82b15b6c35d1a34b83b7114a6bfa6a3d67 Reviewed-on: https://chromium-review.googlesource.com/218270 Reviewed-by: Anton Staaf <robotboy@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org>
* lightbar: Rename structs and macros for kernel cros_ec_commandsEric Caruso2014-10-092-5/+5
| | | | | | | | | | | | | | | This prepends EC_ a macro exposed in ec_commands.h, moves a macro into lbcc that is not used elsewhere, and changes lb_program structs to lightbar_program. BUG=None BRANCH=ToT TEST=make buildall -j Change-Id: I481562da72d91f846c64cf9af40338027641462c Signed-off-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/222406 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* lightbar: extra test programEric Caruso2014-10-091-0/+0
| | | | | | | | | | | | | | Gets a little more coverage on the SET_COLOR control operand. BUG=None BRANCH=ToT TEST=On hardware and simulator. Should appear exactly the same as rainbow-shift.bin. Change-Id: Id9c9948ae178884180e4d42e4fcceb58218423f8 Signed-off-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/222004 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Remove PULSE and TEST sequences from lightbar moduleVic Yang2014-10-081-1/+0
| | | | | | | | | | | | | | | PULSE and TEST sequences are not used anywhere. Remove them to save flash space. Also, fix msleep(MSEC) calls in the unit test; it's essentially usleep(SECOND) written in an incorrect way. BUG=chrome-os-partner:32203 TEST=make buildall BRANCH=None Change-Id: I61ba897df632538eb89364a4c913d5fee87f3864 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220711 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* lightbar: test programs for seq type PROGRAMEric Caruso2014-09-268-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | These programs test various bytecode interpreter functions. rainbow-shift, red-green-blink and green-pulse produce visual effects, whereas the other three programs test error cases. bad-jump makes sure the interpreter stops if the PC goes out of bounds. bad-opcode makes sure the interpreter stops if it does not understand the instructions it is decoding. infinite-jump makes sure that sticking a tight loop in the EC (i.e., one not perforated with any DELAYs, RAMP_ONCEs, or CYCLE*s) does not cause it to hang or crash. bad-decode-8 and -32 test that malformed instructions are detected while decoding the instruction's immediate data. BUG=None BRANCH=ToT TEST=In simulator/scp files to device and test Change-Id: I6c189997a13e7c6196daa28eb74d5506b5288f2b Signed-off-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219565 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* lightbar: add seq type PROGRAM for user-programmable sequencesEric Caruso2014-09-252-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | This diff allows the user to send small programs to the EC and gain control of the lightbar. Right now, this is only exposed through ectool, and sysfs support will come later. To send a program to the EC, use $ ectool lightbar program /path/to/program.bin and then start running the program with $ ectool lightbar seq program BUG=None BRANCH=ToT TEST=Using the above steps with hand-assembled programs. Checked that infinite bytecode loops do not hang the EC. Checked that bad opcodes exit with an error. Stress tested pushing programs and changing sequences. Signed-off-by: Eric Caruso <ejcaruso@chromium.org> Change-Id: I635fb041a5dc5c403f7c26fb9a41b5563be9b6b7 Reviewed-on: https://chromium-review.googlesource.com/219558 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* extra: Move lightbar simulator into subdirectoryAnton Staaf2014-09-118-43/+41
| | | | | | | | | | | | | | | | | This clears the top level extra directory for additional extras. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=cd extra/lightbar; make; lightbar Change-Id: If05a768e4d33cbf21b2ce47a056c960a95728558 Reviewed-on: https://chromium-review.googlesource.com/217537 Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
* Make lightbar simulation compile againBill Richardson2014-08-203-10/+34
| | | | | | | | | | | | | | | | | | | This just brings the competely unsupported but occasionally useful lightbar simulation tool up to date with the rest of the source tree so it will compile and run again. BUG=none BRANCH=ToT TEST=manual cd extra make ./lightbar Change-Id: Iafeaaa5ac56a4b711c63d2c64d8c51ab4b324104 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/213206 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Tweaks to lightbar simulationBill Richardson2014-06-054-4/+69
| | | | | | | | | | | | | | | | | Improve the get_time() function, add support for GNU readline if desired. BUG=none BRANCH=ToT TEST=manual cd extra make ./lightbar Change-Id: Iedf84253b0e616a6a1b502415a487a2e6248cb2e Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/202698 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add standalone lightbar simulation toolBill Richardson2014-05-157-0/+766
This adds an "extra/" directory to hold various experiments and optional programs. With this change, we add a tool that can simulate the lightbar behavior on the build machine. That can be used to experment with variations in the lightbar pattern code without needing to reflash a Pixel with a new EC to see the effect. There is no functional change to the EC code, just a couple of #ifdefs to allow common/lightbar.c to be compiled separately from the EC. BUG=none BRANCH=ToT TEST=make buildall -j cd extra make ./lightbar You may need to install the libxcb1-dev package on your build machine. Change-Id: I847ce7ea97cae792b1de1b91f488819e873b6555 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/199883