FreeCalypso > hg > ffs-editor
comparison src/cs/drivers/drv_app/pwr/pwr_messages_i.c @ 0:92470e5d0b9e
src: partial import from FC Selenite
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Fri, 15 May 2020 01:28:16 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:92470e5d0b9e |
|---|---|
| 1 /******************************************************************************* | |
| 2 * | |
| 3 * pwr_messages_i.c | |
| 4 * | |
| 5 * Purpose: Contains functions used by PWR SWE to send events to the SPI task. | |
| 6 * | |
| 7 * | |
| 8 * Author Candice Bazanegue (c-brille@ti.com) | |
| 9 * | |
| 10 * (C) Texas Instruments 2001 | |
| 11 * | |
| 12 ******************************************************************************/ | |
| 13 | |
| 14 #include "rv/rv_defined_swe.h" // for RVM_PWR_SWE | |
| 15 | |
| 16 #ifdef RVM_PWR_SWE | |
| 17 | |
| 18 #include "rvm/rvm_use_id_list.h" | |
| 19 #include "rvf/rvf_api.h" | |
| 20 #include "pwr/pwr_messages_i.h" | |
| 21 #include "pwr/pwr_env.h" | |
| 22 #include "spi/spi_env.h" | |
| 23 | |
| 24 | |
| 25 /********************************************************************************/ | |
| 26 /* */ | |
| 27 /* Function Name: pwr_spi_battery_info */ | |
| 28 /* */ | |
| 29 /* Purpose: This function is used to send a PWR_SPI_INFO_BATTERY_EVT */ | |
| 30 /* message to the SPI task. */ | |
| 31 /* */ | |
| 32 /********************************************************************************/ | |
| 33 T_RV_RET pwr_spi_battery_info(CALLBACK_FUNC CallBack) | |
| 34 { | |
| 35 T_RV_HDR *msgPtr; | |
| 36 | |
| 37 /* check if the driver has been started */ | |
| 38 if (pwr_env_ctrl_blk == NULL) | |
| 39 return (RVM_NOT_READY); | |
| 40 | |
| 41 if(SPI_GBL_INFO_PTR->SpiTaskReady == FALSE) | |
| 42 return(RVM_NOT_READY); | |
| 43 | |
| 44 if (rvf_get_buf (pwr_env_ctrl_blk->prim_id, sizeof (T_RV_HDR),(void **) &msgPtr) == RVF_RED) | |
| 45 { | |
| 46 rvf_send_trace ("PWR ERROR: Not enough memory", | |
| 47 28, | |
| 48 NULL_PARAM, | |
| 49 RV_TRACE_LEVEL_ERROR, | |
| 50 PWR_USE_ID); | |
| 51 | |
| 52 return (RV_MEMORY_ERR); | |
| 53 } | |
| 54 | |
| 55 msgPtr->msg_id = PWR_SPI_INFO_BATTERY_EVT; | |
| 56 msgPtr->dest_addr_id = pwr_env_ctrl_blk->addr_id; | |
| 57 msgPtr->callback_func = (CALLBACK_FUNC) CallBack; | |
| 58 | |
| 59 rvf_send_msg (pwr_env_ctrl_blk->addr_id, msgPtr); | |
| 60 | |
| 61 return (RV_OK); | |
| 62 } | |
| 63 | |
| 64 #endif /* #ifdef RVM_PWR_SWE */ | |
| 65 |
