From 4e75e20f4ec5cecda6742d821b1a4484952fd07e Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Tue, 6 Jan 2015 11:00:36 -0800 Subject: Add PD events logging Add a FIFO to log important events on the PD MCU and coming from the PD accessories. The retrieval of the accessories log from the accessories by the PD MCU is not implemented yet. Signed-off-by: Vincent Palatin BRANCH=samus BUG=chrome-os-partner:32785 TEST=execute "ectool --name=cros_pd pdlog" before and after plugging Zinger charger. Change-Id: If96d73e711ff6ad64cfb99bd3e4d2d8f2643f19a Reviewed-on: https://chromium-review.googlesource.com/238854 Tested-by: Vincent Palatin Reviewed-by: Alec Berg Commit-Queue: Vincent Palatin Trybot-Ready: Vincent Palatin --- board/zinger/board.h | 2 ++ board/zinger/runtime.c | 10 ++++++++++ board/zinger/usb_pd_policy.c | 3 +++ 3 files changed, 15 insertions(+) (limited to 'board/zinger') diff --git a/board/zinger/board.h b/board/zinger/board.h index e307c6ff27..8eba23e214 100644 --- a/board/zinger/board.h +++ b/board/zinger/board.h @@ -51,6 +51,8 @@ #define CONFIG_USB_PD_CUSTOM_VDM #undef CONFIG_USB_PD_DUAL_ROLE #undef CONFIG_USB_PD_INTERNAL_COMP +#define CONFIG_USB_PD_LOGGING +#define CONFIG_USB_PD_LOG_SIZE 256 #undef CONFIG_USB_PD_RX_COMP_IRQ #define CONFIG_USB_PD_SIMPLE_DFP #undef CONFIG_WATCHDOG_HELP diff --git a/board/zinger/runtime.c b/board/zinger/runtime.c index 9d644e763a..0dfb51aed4 100644 --- a/board/zinger/runtime.c +++ b/board/zinger/runtime.c @@ -56,6 +56,16 @@ void task_clear_pending_irq(int irq) CPU_NVIC_UNPEND(0) = 1 << irq; } +void interrupt_disable(void) +{ + asm("cpsid i"); +} + +void interrupt_enable(void) +{ + asm("cpsie i"); +} + uint32_t task_set_event(task_id_t tskid, uint32_t event, int wait) { last_event = event; diff --git a/board/zinger/usb_pd_policy.c b/board/zinger/usb_pd_policy.c index 59c49012d3..a228712290 100644 --- a/board/zinger/usb_pd_policy.c +++ b/board/zinger/usb_pd_policy.c @@ -554,6 +554,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, payload[1] = ADC_TO_CURR_MA(vbus_amp); rsize = 2; break; + case VDO_CMD_GET_LOG: + rsize = pd_vdm_get_log_entry(payload); + break; default: /* Unknown : do not answer */ return 0; -- cgit v1.2.1