summaryrefslogtreecommitdiff
path: root/chip/stm32/usb_gpio.h
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2015-05-19 00:00:23 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-18 05:07:55 +0000
commitb72a5f5e8e97ba86736c1e26b4204fc6d0c215da (patch)
tree155559713f9432bbc849bbe18a12983a672db5c6 /chip/stm32/usb_gpio.h
parentdd1987051b473e74dab3490921d0cc77c76fcac3 (diff)
downloadchrome-ec-b72a5f5e8e97ba86736c1e26b4204fc6d0c215da.tar.gz
discovery-stm32f072: Blink the LEDs
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>
Diffstat (limited to 'chip/stm32/usb_gpio.h')
-rw-r--r--chip/stm32/usb_gpio.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/chip/stm32/usb_gpio.h b/chip/stm32/usb_gpio.h
index 2027df9d21..56f3d72c57 100644
--- a/chip/stm32/usb_gpio.h
+++ b/chip/stm32/usb_gpio.h
@@ -10,12 +10,19 @@
#include "compile_time_macros.h"
#include "usb.h"
+struct usb_gpio_state {
+ uint32_t set_mask;
+ uint32_t clear_mask;
+};
+
/*
* Compile time Per-USB gpio configuration stored in flash. Instances of this
* structure are provided by the user of the USB gpio. This structure binds
* together all information required to operate a USB gpio.
*/
struct usb_gpio_config {
+ struct usb_gpio_state *state;
+
/*
* Endpoint index, and pointers to the USB packet RAM buffers.
*/
@@ -55,6 +62,7 @@ struct usb_gpio_config {
static usb_uint CONCAT2(NAME, _ep_rx_buffer)[USB_GPIO_RX_PACKET_SIZE / 2] __usb_ram; \
static usb_uint CONCAT2(NAME, _ep_tx_buffer)[USB_GPIO_TX_PACKET_SIZE / 2] __usb_ram; \
struct usb_gpio_config const NAME = { \
+ .state = &((struct usb_gpio_state){}), \
.endpoint = ENDPOINT, \
.rx_ram = CONCAT2(NAME, _ep_rx_buffer), \
.tx_ram = CONCAT2(NAME, _ep_tx_buffer), \
@@ -106,7 +114,8 @@ struct usb_gpio_config {
USB_DECLARE_EP(ENDPOINT, \
CONCAT2(NAME, _ep_tx), \
CONCAT2(NAME, _ep_rx), \
- CONCAT2(NAME, _ep_reset));
+ CONCAT2(NAME, _ep_reset))
+
/*
* These functions are used by the trampoline functions defined above to