FreeCalypso > hg > fc-tourmaline
view src/cs/services/fcbm/fcbm_task.c @ 261:841a848ba762
SPI SWE: clear any pending boot-time interrupts in spi_init()
Charger plug/unplug hw logic in the Iota ABB has no built-in debouncing,
thus electrical contact bounce on the charging power connection interface
produces a lot of charger plug/unplug interrupts. When we boot in
charging mode (charging power present at boot time and is presumably
the cause of Switch-ON), some bounce may occur between the initial
Iota Switch-ON action and Calypso firmware booting. By clearing any
accumulated ITSTATREG interrupts on boot, we prevent these pre-boot
interrupts from generating charger plug/unplug events to FCHG, which
would upset smooth from-boot charging.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 14 May 2021 02:49:05 +0000 |
parents | baa738eeb842 |
children |
line wrap: on
line source
/* * The FCBM task's core function lives here. */ #include "fcbm/fcbm_env.h" #include "fcbm/fcbm_func_i.h" #include "fcbm/fcbm_timer_i.h" #include "fcbm/fcbm_life_cycle.h" #include "rv/rv_general.h" #include "rvf/rvf_api.h" #include "rvm/rvm_use_id_list.h" enum fcbm_life_cycle_state fcbm_life_cycle_state; T_RV_RET fcbm_core(void) { BOOLEAN error_occured = FALSE; T_RV_HDR *msg_ptr; /* loop to process messages */ while (error_occured == FALSE) { /* Wait for the necessary events (infinite wait for a msg in the mailbox 0). */ UINT16 received_event = rvf_wait (0xffff, 0); /* If an event related to mailbox 0 is received, then */ if (received_event & RVF_TASK_MBOX_0_EVT_MASK) { /* Read the message in the driver mailbox and delegate action..*/ msg_ptr = (T_RV_HDR *) rvf_read_mbox(FCBM_MAILBOX); if (msg_ptr) { fcbm_process_message(msg_ptr); rvf_free_buf ((void *) msg_ptr); } } /* Timers */ if (received_event & RVF_TIMER_0_EVT_MASK) fcbm_chg_periodic_timer(); if (received_event & RVF_TIMER_1_EVT_MASK) fcbm_display_off_timer(); } // end of while return RV_OK; }