FreeCalypso > hg > fc-magnetite
view src/cs/drivers/drv_app/fchg/fchg_task.c @ 673:62a5285e014a
Lorekeeping: allow tpudrv-leonardo.lib on Leonardo/Tango
Back in 2015 the Mother's idea was to produce a FreeCalypso development
board that would be a clone of TI Leonardo, including the original
quadband RFFE; one major additional stipulation was that this board
needed to be able to run original unmodified TCS211-20070608 firmware
with all blobs intact, with only minimal binary patches to main.lib
and tpudrv.lib. The necessary patched libs were produced at that time
in the tcs211-patches repository.
That plan was changed and we produced FCDEV3B instead, with Openmoko's
triband RFFE instead of Leonardo quadband, but when FC Magnetite started
in 2016, a TPUDRV_blob= provision was still made, allowing the possibility
of patching OM's tpudrv.lib for a restored Leonardo RFFE.
Now in 2020 we have FC Tango which is essentially a verbatim clone of
Leonardo core, including the original quadband RFFE. We have also
deblobbed our firmware so much that we have absolutely no real need
for a blob version of tpudrv.lib - but I thought it would be neat to put
the ancient TPUDRV_blob= mechanism (classic config) to its originally
intended use, just for the heck of it.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 29 May 2020 03:55:36 +0000 |
parents | 1c711302732a |
children |
line wrap: on
line source
/* * The FCHG task's core function lives here. */ #include "fchg/fchg_env.h" #include "fchg/fchg_func_i.h" #include "rv/rv_general.h" #include "rvf/rvf_api.h" #include "rvm/rvm_use_id_list.h" #include "abb/abb.h" static void set_initial_state(void) { SYS_UWORD16 abb_status; abb_status = ABB_Read_Status(); if (abb_status & CHGPRES) { if (pwr_ctrl->config_present) pwr_ctrl->state = FCHG_STATE_READY_TO_CHARGE; else pwr_ctrl->state = FCHG_STATE_NO_CHARGING; } else pwr_ctrl->state = FCHG_STATE_NO_EXT_PWR; } T_RV_RET fchg_core(void) { BOOLEAN error_occured = FALSE; T_RV_HDR *msg_ptr; rvf_send_trace("FCHG task: Initialization", 25, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, FCHG_USE_ID); pwr_load_ffs_batt_table(); pwr_load_ffs_charging_config(); set_initial_state(); pwr_init_discharge(); /* 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(FCHG_MAILBOX); if (msg_ptr) { pwr_process_message(msg_ptr); rvf_free_buf ((void *) msg_ptr); } } /* Timers */ if (received_event & RVF_TIMER_0_EVT_MASK) pwr_handle_timer(); } // end of while return RV_OK; }