X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=AMSS%2Ftmc.c;fp=AMSS%2Ftmc.c;h=39610415ffe4e8915c8784fa515b748cf006ce1e;hb=3e70a93cdfb4c7d7ea32d04d3263827b752ccb00;hp=0000000000000000000000000000000000000000;hpb=932883ea61826723d57f912fae6fa3938393f286;p=huawei.git diff --git a/AMSS/tmc.c b/AMSS/tmc.c new file mode 100644 index 0000000..3961041 --- /dev/null +++ b/AMSS/tmc.c @@ -0,0 +1,6336 @@ +/*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====* + + TASK MAIN CONTROLLER + +GENERAL DESCRIPTION + This module provides none protocol specific power up initialization, and + task related operations such as task define start, offline and stop. + +EXTERNALIZED FUNCTIONS + + Task Entrance + tmc_task + + TMC Tasks-Interface + tmc_task_start Procedure for tasks to acknowledge start up from TMC. + tmc_task_ack Procedure for task to acknowledge from TMC. + tmc_task_stop Procedure for task to do task stop processing from TMC. + tmc_task_offline Procedure for task to do task offline processing from + MC. + tmc_cmd Procedure to send a command to TMC from other tasks. + tmc_ack Procedure to send acknowledge signal to TMC from other + tasks. + +INITIALIZATION AND SEQUENCING REQUIREMENTS + + This task is the first task created in the DMSS. It is created from + the main module (using the REX task initialization service) after boot + processing is completed. No other tasks or drivers have been created + or started when this task is started. + +Copyright (c) 2002 - 2009 by QUALCOMM INCORPORATED. +All Rights Reserved. + +Export of this technology or software is regulated by the U.S. Government. +Diversion contrary to U.S. law prohibited. + +*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*/ + +/*=========================================================================== + + EDIT HISTORY FOR MODULE + + This section contains comments describing changes made to the module. + Notice that changes are listed in reverse chronological order. + + $Header: //source/qcom/qct/core/pkg/2H09/halcyon_modem/rel/LA2.0/AMSS/products/7x30/core/debugtools/tmc/src/tmc.c#2 $ + +when who what, where, why +-------- --- ---------------------------------------------------------- +07/08/10 rsb Added call to mobile_init_modem_sw_build_id +07/30/09 rbo Added WLAN DS task +07/02/09 va Added TCXO Manager Task +05/26/09 st Added GFX task +05/27/09 wd Added FEATURE_COREIMG and fix incorrect FEATURIZATINON +01/23/09 taw Remove the reference to SLEEP_MP4_OKTS_SIG. +03/12/09 vas Added entries for IPAUKCC_IPC +02/02/09 jwh Added TMC_CMD_TYPE_RESET_MODEM +11/11/08 ry Removed FEATURE_SENSORS. +10/28/08 jwh Changed smsm_init() per updated SMEM APIs. +06/30/08 apu Added support for FEATURE_VBATT_TASK. +05/29/08 gfr Added MPP4 configuration for WLAN (from Evgeni Diment). +05/20/08 jac Removed banned apis. +05/14/08 grl Added FEATURE_TMC_WB_CACHE support. +05/14/08 gfr Minor code cleanup and call clk_regime_init_nv instead of + using global variables. +04/22/08 trc First phase of 1x/HDR clock resource gating changes +03/18/08 gfr Replace clk_regime_enable with resource manager. +02/28/08 cr/aar Added PGI task. +01/21/08 gfr Enable component services for WM. +12/12/07 ry Updated the Sensors task to support FEATURE_ENHANCED_REX_TASK +12/13/07 gfr Add SDC pmic MPP initialization. +12/10/07 jhs Moved bus_init() and bus_monitor_init() to after + clk_regime_init(). +10/12/07 hwu Added support for FEATURE_AMSS_RESTART. +10/01/07 gfr Enable the USBH MPPs here until WM USBH driver does it. +09/26/07 gfr Remove hack forcing phone online even when no NV is + present. +09/20/07 gfr Removed BREW code. +09/11/07 gfr Support for time-of-day RTC offset and headset switch + detection. +09/12/07 gfr Support for UBM L1 task. +08/08/07 ah Replaced defined(FEATURE_CGPS_PD_COMMS_TCP_ON_MODEM) with + !defined(FEATURE_DATA_ON_APPS). +08/03/07 gfr Do not initialize component services if the apps image + is WinMobile. +07/18/07 gfr Initialize component services. +07/10/07 gfr Support for Quartz 1.3.6 +06/18/07 ry Added support for FEATURE_SENSORS +06/05/07 tbg Added support for FEATURE_DLOAD_HW_RESET_DETECT. +06/04/07 mg Add sleepctl_init() to initialize sleep controller driver. +05/22/07 gfr Support for security tasks (Anuj Mundi). +05/09/07 gfr Support for CPU Based Flow Control +05/08/07 gfr Support for WLAN +05/04/07 gfr Do not turn on graphics core at init. +04/27/07 gfr HSU updates. +04/12/07 ptm moved spin_lock initialization to smem +03/27/07 jfc Reinstate rflib_init() for UMTS mode +03/06/07 gfr Remove FEATURE_QVPHONE +03/01/07 gfr Re-add the removal of 1x clocks since the change was + incorrectly dropped in the last merge. +02/14/07 gfr Remove obselete 1X clocks. +02/06/07 gfr Change USBH_RST to USBH_CS1 and invert it. +02/05/07 gfr Always call tlmm_init. +02/01/07 gfr Reset HS_USB PHY as part of power-up sequence. +01/23/07 gfr Featurize for 1X-only builds. +01/17/07 gfr Support for new PMEM init functionality. +01/04/07 trc Remove unnecessary SRCH4 MDSP registration +12/15/06 gfr Fixes for WPLT. +11/22/06 gfr Add FEATURE_DISABLE_CGPS. +11/22/06 gfr Add WPLT task. +10/23/06 gfr Remove flash_nand_init for new flash driver. +10/22/06 gfr Remove msm_init.h +09/06/06 taw Use smem_proc_comm API. +08/17/06 taw Add a call to smem_init(); Change the call to smsm_init() + to pass in no parameters. +08/15/06 taw Include smem.h and set the modem status to TMCINIT in + smem_proc_comm after TMC is initialized. +09/27/06 gb Changes to get user set time working +09/01/06 kvk Initializing USB for the Modem only configuration +08/30/06 kvk Added support for Data on Apps +07/20/06 jhs Add support for I2C on Apps. +07/17/06 sb Added FEATURE_NO_USB_HW_ON_PROCESSOR for usb tasks +07/07/06 gfr Deregister boot clock client when tmc_init is complete. +07/03/06 jhs Cleaned up Bus Manager featurization. + Added support for reading NV configuration for Bus + Monitors. +06/20/06 dsn Featurize BT for Modem, cleanup obsolete BT related tasks +05/11/06 ptm Added call to process_init_callbacks for AMSS restart. +04/30/06 dlb Added call to turn on recent_thread tracking. +04/26/06 ptm Add OEMSBL release synchronization point for 7K. +03/29/06 ptm Added init calls for spinlocks and smem logging for 7K. +03/24/06 pc Added support for SECRND task +03/23/06 cl Added PDSM_COMM_TASK +03/10/06 xz Changed QVPHONE related code for 7500 support +01/25/06 ddh Added DEM Task +01/24/06 ajn Enabled GRAPHICS Clock regime +01/23/06 rlp Added HID Support. +01/02/06 dle Added FEATURE_CAMERA_DRV_TASK. +12/14/05 taw Pmem is now initialized with the real modem heap in SMI. +11/10/05 pc Added support for AVS_SBCENC_TASK +11/08/05 pc Added support for GSM_PLT task +11/02/05 gw Added support for GameMode. +10/26/05 ck Fixed a compiler issue. +10/19/05 as Fixed compiler warnings. +10/03/05 dd Added L4 call to enable timetest. +08/01/05 vs Added usbhost_api_init based on feature FEATURe_USB_HOST +08/26/05 pc Added support for DISP_TASK. +08/20/05 pc Renamed FEATURE_PROF_DIAG to FEATURE_PROFDIAG +08/15/05 hn Replaced use of FS_FEATURE_RMTEFS_SERVER with FS_FEATURE_IG_IPC_SERVER +08/10/05 taw Added a call to flash_nand_init() to init the flash driver + and HW. Added a call to pmem_init() to allow pmem use + by the flash driver. +08/10/05 pc Increased the wait_cnt for the UI task in tmc_stop_tasks() + to 5s, for Sirius. +08/09/05 fl Replaced file qvp_aud_eng.h with extern void qvp_ae_task() +08/05/05 jhs Removed SMEM references. Added SMD include file. +08/05/05 jhs Removed SMEM references. Added SMD include file. +08/03/05 pc Replaced certain FEATURE_L4 with FEATURE_L4LINUX, added + support for FEATURE_USB_HOST_API, included + FEATURE_TCXOMGR_TMC. +08/01/05 vs Added usbhost_api_init based on feature FEATURe_USB_HOST +07/19/05 taw Added includes for flash functions and removed NANDC MPU + usage for modem only builds. +07/18/05 et added PARK MODE support +07/15/05 adm Merged from mainline ver #23 +07/13/05 adm Merged in changes related to supporting BootLoader compilation + for L4 builds +07/12/05 jz Featureized QVP APP Task for Codec Only +07/12/05 grl Added initialization of TRM for 1x targets. +06/20/05 fl Replaced file sipt_task.h with extern void sipt_task() +06/17/05 fl Replaced file qvp_encvfe.h with extern void qvp_vfe_task() +06/13/05 pc Added support for WLAN sec task +06/13/05 sl Sirius changes: Task Reordering; Secure clock API. +06/17/05 jhs Removed time_tod_task. +06/07/05 jhs Added pm_pwr_key_init for power key support. +06/01/05 grl Removed srm/xrm initialization since they aren't used. +05/23/05 cep Added aps_init for tmc_libraries_init_before_tasks_start +05/12/05 pc Added call to time_set_from_pmic() to get the time from + PMC RTC for Time Services. +05/02/05 ibm Moved UI initialization past DS and GSDI for Sirius. +04/21/05 pc Added support for FEATURE_MFLO +04/20/05 pc Added support for FEATURE_QIPCALL +04/09/05 pc Added support for CNV task +04/14/05 sr Remove the featurization for adie_init call +05/19/05 lp Removed HWIO PMIC_SSBI call that enables MDDI +05/18/05 ~SN Removed clk_regime_msm_init() & clk_regime_msm_enable (CLKRGM_PRPH_CLK). +05/18/05 jhs Added time_tod_task. +04/05/05 ddh Replace OKTS MASK with OKTS SIG +03/28/05 sv More Update Abnormal Exit count - Sirius specific change +03/21/05 sv Update Abnormal Exit count - Sirius specific change +03/15/05 wal Added APS task for L4/Linux under FEATURE_APS +03/15/05 adg Added QDIAG task for L4/Linux under FEATURE_IG_QDIAG +03/15/05 jqi Added support for FS_FEATURE_RMTEFS_SERVER, FEATURE_L4 + FEATURE_PM_SERVER,FEATURE_IG_UI_CLIENT_SELECT +03/07/05 lyr Moved WLAN task startup before DS task startup +02/24/05 t_jarmis Added FEATURE_FM for FM-RDS Radio. +02/14/05 jqi Updated for FEATURE_BATTERY_CHARGER. +02/04/05 jqi Fix the bug in the tmc processing stop/offline tasks. + Revised the change for TMC vote for sleep. + Send stop/offline signal to sleep task. +02/05/05 aku Added support for WLAN Adapter initialization in TMC. +02/04/05 dwp Added QVP support for SIP. +02/03/05 jqi Added support for TMC vote for sleep. +02/03/05 eprice Addition of Sirius specific tasks using define SIRIUS_PLATFORM +01/31/05 jqi Added support for FEATURE_CC_MONITOR, FEATURE_FOTA_FS, + FEATURE_ENABLE_FLOATING_POINT_ERRORS. +05/06/05 ptm Moved dmov_init to before time_init to ensure it completes + before apps dmov_init starts. +04/29/05 jc Added PMIC support to enable MDDI power on SURF. +04/22/05 ptm Moved smem and oncrpc tasks to top of task def routine. + Moved timer sync code to the timer subsystem. +04/24/05 ~SN Added FEATURE_BRINGUP_DIAG_ONLY +04/14/05 adm Added smd task under FEATURE_SMD +03/24/05 jhs Moved i2c_init above sio_init becuase USB uses I2C. +03/21/05 smkg Update the function call to clk_regime_msm_init. +03/14/05 jhs Added support for multiprocessor slow clock sync. Again + moved rdm_get_prev_ports and rdm_issue_opens as per + comment 12/06/04, ptm. +01/28/04 ptm Remove references to sta_remote_task and add feature + protection around sta references. +01/21/05 ~sn Added DMOV INIT +12/27/04 ro Add offline and stop sigs for VOC, QDSP, QDSP_RTOS. +12/06/04 ptm Moved the start up ONCRPC of to tmc_start_service_tasks and + rdm_get_prev_ports and rdm_issue_opens up to + tmc_libraries_init_after_service_tasks_start so that + ONCRPC is ready to handle RPC calls before any of the + application tasks are started. + Moved #ifndef T_RUMI2_DIAG_ONLY around call to + tmc_libraries_init_after_service_tasks_start into the + routine so that only part of the routine is protected. +12/03/04 lp Enabled QDSP task by removing T_RUMI_QDSP. Fixed compile + error when TIMETEST is defined. +11/24/04 cr Add smem_boot_sync to release aARM to begin executing + Reset_Handler. +11/08/04 ro Added FEATURE_QDSP_RTOS - start ADSP RTOS Task +10/13/04 adm Added smem task +01/25/05 jqi Fixed constantly high sleep current issue. +01/21/05 ldaita Added support MGPCC task (needed for GPS). +01/19/05 aar Fixed compilation problem due to rex_def_task2 I/F mismatch. +01/14/05 rp Added background loading in Progressive boot task support + jh Added support for enabling profiling through diag interface. +01/12/05 jqi Lint fixes. +01/06/05 aar Added support for GPSSRCH demod task. +12/23/04 ty Changed ran_seed() use to ran_init() to initialize seed +11/22/04 gfr Suppress intlock profiling during init. +11/10/04 jz Added QVP VFE Task +11/18/04 pa Added support for PBM task. +11/02/04 jqi Fixed compilation warning and featurization issue. + updated comments. +10/22/04 jqi Featurization fixes. +10/20/04 ajn Added support for TIMER task. +10/15/04 rp Added support for page and interrupt tasks. +10/08/04 jqi Added support for FEATURE_HSDPA +09/29/04 ss Added support for DTV (Digital TV) task +09/29/04 jqi Fixed ADS1.2 and RVCT compilation warnings. +09/24/04 gfr Rename feature +09/16/04 gfr Added support for tcxo manager init and powerdown. +09/16/04 jqi Added ftm_task.h file. +09/10/04 hl Added support for joystick feature +08/25/04 jqi Fixed compilation errors/warnings. +08/23/04 vr Replaced include dsbcdb_api.h by dsbcdb_task.h +08/11/04 efy Unified adie_init() interface. +08/05/04 ap Moved UI task to stop last. +07/26/04 jqi Added support to read GPS nv items during power up. +07/22/04 jqi Added support for WPLT and GPLT. +07/13/04 ajn Added initialization for SRM/XRM +07/09/04 jqi Corrected the parameters for tmc_realloc() API. + Added support for FEATURE_ADC_CALIBRATION. +06/24/04 jm Used prototype directly for DRM task. +06/21/04 dc Wrapped#include "acpwb.h" with FEATURE_ACP. +06/16/04 bd Unconditional include "adie.h" regardless of + FEATURE_WCDMA_PLT. +06/10/04 jqi Updated the history comments. +06/09/04 jl Featurized CLK_RGM_DFM_M regime enable function with + FEATURE_ACP. +05/25/04 jqi Fixed mode preference reset issue after power up. + et Unified adie init interface for all the targets. +05/19/04 vr Added support for BCDB and HDRBC tasks + jqi TMC HEAP API. + Bump up tlmm_init() before rflib_init(). + ml Added FEATURE_UI_CORE_REMOVED. +04/27/04 jqi Back up the changes to rename time.h to time_svc.h. +04/23/04 jqi Read Vbatt, therm and HW config during power up regardless + of multimode RF feature. +04/07/04 tg Added support for FEATURE_ERR_EXTENDED_STORE. + Removed support for FEATURE_LOG_EXCEPTIONS_TO_NV. +04/06/04 jqi Added FEATURE_BREW_PWRUP_INIT. +04/01/04 sg removed support for LP task as task no longer exists. +03/15/04 tg Added support for FEATURE_LOG_EXCEPTIONS_TO_NV. +03/12/04 st Removed MSM6500 work around when creating MDSP task. +02/23/04 jqi Fixed some typo in FEATURE_SEC_DRM. + bs Added support for Bluetooth External Profiles feature support . +02/19/04 jqi Fixed Lint error + ak Added support for Brew 3.0. + Jm Added support for FEATURE_SEC_DRM. +02/12/04 vd Added support for FEATURE_GSM_CB. +02/09/04 ajn Renamed time.h to time_svc.h to avoid OS conflict. + Moved time_init() below tramp_init(), since it uses tramp. +02/06/04 et Added support for DRM feature. +02/02/04 dd Called adie_init after rflib_init and before voc task is + started for 1x target. +01/19/04 jqi Fixed compile warninigs. +12/03/03 bt Move srch4 registration into + tmc_libraries_init_after_service_tasks_start. +11/26/03 jqi Remove update rf init status based on ftm nv flag. +11/20/03 jqi Added support for SYS_OPRT_MODE_OFFLINE_IF_NOT_FTM. +11/19/03 jqi Added support for FEATURE_ENHANCED_REX_TASK. +11/14/03 dd Added support for GPS Search task. +11/12/03 dwp Additional QVPHONE updates. +10/31/02 sr QVPHONE changes merged for Saber. SBI API's rolled into RF + VU's. +10/29/03 jqi Consolidate MSM6200 target related features. +10/22/03 ts re-organization in PDSM files. +10/17/03 jm Fixed typo. +10/13/03 jqi Fixed compile warning. +10/07/03 sa CR30885-Add diag request to check the size of TMC heap +10/06/03 jqi Fixed multimode RF enter mode issue. +09/29/03 dna Get T_QUASAR to compile and work again for MSM6500 +09/21/03 bt Download SRCH4 App after all tasks have been started. +08/14/03 ht Merged MSM6500 changes and QUASAR support. +07/21/03 xfg Changed for Thin UI build and set lock to memory heap. +07/14/03 jqi Swapped the tlmm_init() with sio_init(). +07/09/03 cd CR32650-Replace FEATURE_UIM_USIM withe FEATURE_UIM. +07/01/03 jqi Added support for FEATURE_RESET_COUNTER. +06/19/03 ev Added support for MSM6500 target for power up + initialization. +06/12/03 rtp Changed the FEATURE_DYNAMIC_CLOCK_FREQUENCY_CHANGING to + FEATURE_AUTOMATIC_CLOCK_FREQUENCY_CHANGING +05/30/03 jqi Renamed TIMETEST_SECIPS_TASK_ID to TIMETEST_SECIPSEC_TASK_ID. +05/29/03 jqi CR28002 + Show task name which does not responds offline cmd in LCD. + Om Added support for ARM_CRYPTO and IPSEC tasks, +05/28/03 TMR/dgy Added changes for WCDMA single-mode build. +05/14/03 ld Added support for MGP related tasks +04/30/03 jqi Added !FEATURE_MDSP_TASK around included file dmddown.h +04/26/03 jqi Delete enable all clk regimes for leopard target. +04/25/03 ts Swapped the tlmm_init with uim_dev_init(). +04/23/03 rtp Modified the code under + FEATURE_DYNAMIC_CLOCK_FREQUENCY_CHANGING +04/22/03 jqi Removed TMC heap to tmc_nzi.c. + Added include file virtuim.h under FEATURE_VIRTUAL_SIM. +04/17/03 dgy Used dsgcsd_task.h instead of dsgcsd.h. +04/16/03 jqi Removed test_mc.h and used ftm.h for cougar,leopard, + cheetah and saber targets. + Removed T_RF_ZRF6200 feature around sbi_init(). +04/14/03 jqi Revised MM RF driver initialization for cougar. + Only did once during power up in tmc.c and removed codes + in mc.c +04/04/03 jqi Moved stack profiling inside of tmc_define_tasks(). + bd Added WPLT support for PMIC + cd Added uim_power_control() in power off and reset. +04/01/03 jqi Rename TIMETEST_GCDS_TASK_ID to TIMETEST_GCSD_TASK_ID. +03/25/03 jqi Increased GSTK,UIM,GSDI stop time out to 5 seconds. + Added definition of tmc_get_mem_heap_size(). +03/21/03 jqi Removed technology features around adie_init(). + Moved stop UIM task aster GSDI and GSTK tasks. +03/14/03 jqi Added FEATURE_MULTIMODE_ARCH around mmoc task. + Added FEATURE_CM around sending cm offline command. +03/12/03 jqi CR28464 - added tasks' name. +03/11/03 jqi CR28438 - moved err_init() after nv_task starts. +03/05/03 jqi If RF CAL is invalid and FTM flag is invalid, + set ftm flag to true. + Clearn up MMRF interface for Cougar, Leopard and Cheetah. +03/04/03 at Changes to resolve naming conflict with MMGPS defined types + in mmgps_types.h + 1. Replace nf.h, cd.h (pe.lib's internal include files) with pe_task.h + 2. Replace pb.h with pb_task.h +03/04/03 lz Removed FEATURE_MOBILE_SUITE. +02/28/03 jqi Set ftm mode default value amss_mode for cheetah (temporary fix) +02/27/03 jqi Set ftm mode default value ftm_mode. +02/26/03 jqi Without feature FEATURE_DIAG_COUPLED_ARCHITECTURE, diag no + longer wait for complete signal during offline process. +02/21/03 jay Added support for FEATURE_SEC_SSL. + Clear task start signal in tmc_start_task(). +02/19/03 sj Added support for LPM. +02/19/03 jqi Added support for FEATURE_DYNAMIC_CLOCK_FREQUENCY_CHANGING. +02/18/03 jqi/jar Added Generic SIM Tookit Task (FEATURE_GSTK) Support and + Virtual Sim Application Toolkit (FEATURE_VIRTUAL_SAT) Task. +02/14/03 jqi Added support for FTM task + If nv ftm flag is set true, do not send offline command. + Remove unfinished LPM support. + Added support for FEATURE_MULTIMODE_APIRF. +02/07/03 jqi Added support for LPM.(not finished yet) + Added support for stack profiling. + Expanded FEATUREs associated with GSDI task. +02/06/03 jqi FTM support with all tasks start for UMTS target. + Use chg_init(TRUE) for UMTS target. +01/29/03 jqi Fixed a typo. +01/28/03 jqi Called ftm_tmc_init() on behalf of FEATURE_FACTORY_TEST_MOE. +01/27/03 sj Moved starting of UI/CM/MMOC etc tasks after initializing + rf so that offline is the first command in the CM queue. +01/22/03 lz Added support for FEATURE_MOBILE_SUITE. +01/21/03 jqi Featurize the UMTS FTM change with T_RF_ZRF_6200 + Rename MC_RPT_TIMER_SIG with TMC_RPT_TIMER_SIG. + Remove mc.h +01/20/03 jqi Removed feature around rf_init() and rf_init_delayed(). +01/15/03 jqi Merged with MSM6200 TMC #68. + 1.added "clkrtc.h" + 2.New feature support + FEATURE_VDSP_AT_48MHZ + 3.A temporary support for UMTS FTM: do not start all tasks + Featurized the clk_regime_enable() for only 6300 target. +12/31/02 jqi Merged with MSM6200 TMC #62. + 1.added tmc_heap_small. + 2.New feature support + FEATURE_GSM_GPRS + FEATURE_RF + FEATURE_MVS + FEATURE_UIM_USIM + FEATURE_HS_DETECT_BASEBAND_TYPE + FEATURE_PDAPI + DEBUG_TEST_RF + 3.added support for FEATURE_WCDMA_PLT, FEATURE_GSM_PLT + 4.added support for FEATURE T_RF_ZRF6200 during power up HW initialication + 5.remove ftm_tmc_init to where ftm_mode is read. +12/09/02 jqi Remove test_mc.h out of FEATURE_GSM. +12/05/02 jqi Fixed compile errors. +12/04/02 jqi Added support for multimode FTM. + -Start all tasks in FTM mode. + -use test_mc.h instead of ftm.h + -add ftm_init in tmc_libraries_init_before_tasks_start(); +11/06/02 jqi Featurized the temporary fixes for MM combined builds. +11/05/02 jai A temporary fixes for MM combined builds. + - Removed adie_init(), rf_init, rf_init_delayed, + - Added enable all clk regimes during Power up. +11/01/02 jqi Added and featurized pm1000_init(). +10/24/02 dle Removed grp_init. It should only be called from disp_init. +10/21/02 jqi Added support for FTM mode. +10/17/02 jqi Remove bio_init on behalf of GSM feature. + Added support for GSM FTM mode support. +10/15/02 jqi Added support for GSM FTM mode support. +10/02/02 jqi Use TIMETEST_TMC_TASK_ID for TMC task. + Change TIMETEST_RR_TASK_ID to TIMETEST_GSM_RR_TASK_ID. + Updated timetest.h and hp_stats.ini with missing TIMETEST task IDs. +09/27/02 jkl Fixed featurization in ZIF libraries. + jqi Added GSDI task in offline/stop handler. + Featurized dog report code. + Included WCDMA task header files. +09/26/02 dle camera_init moved to graph_task. +09/26/02 jqi Included target.h header file. +09/25/02 rmd Moved pm init functions before adie init. + jqi Used timed_wait for ack signal when sending offline/stop + signals.Removed reset work around for cougar. +09/24/02 rmd Added chg_init() with FEATURE_BATTERY_CHARGER. +09/18/02 jqi Removed the redundant enc_init(). +09/17/02 jqi Fixed error when creating GCSD task. +09/17/02 hr Added reset work around for cougar. +09/17/02 cyran Complete the HWIO port such that MSM6000, MSM6050, and MSM6100 +09/14/02 jqi Removed custcmx.h. +09/13/02 jqi Removed support for FTM mode. +09/10/02 jqi Featurized HW related header files for unit test environment. + Added support for camera and graph. +09/06/02 jqi Change tmc_wait() return type to void to support MM RF. +09/06/02 jqi Change gsdi_task_stack to gsdi_stack. +08/27/02 jqi Added support for powerup init with FEATURE_MDSP_TASK. + Require RF changes. + Replaced GSDI feature with FEATURE_MMGSDI. + Replaced TMC_WMS with FEATURE_CDSMS || FEATURE_GWSMS. + Moved read ESN ME to start service tasks. + started wms task after ui task started. +08/21/02 jqi Reverse the sequence of srch_util_demod_reset and + demod_down_image. +08/19/02 jqi Replace tempore uim feature with FEATURE_UIM. + Treated GSM/WCDMA task as application tasks. + Added support for timetest profile. + Treated tlmm and I2C as generic HW. + Reverse the sequence of srch_util_demod_reset and + demod_download_image. + Remove clkrgm_6050.h header file. +07/26/02 jqi Featurize header files + Used FEATURE_DATA_PS for ps task. + Remove support for cdma.esn_me +07/25/02 jqi Added temporary support for cdma.esn_me. + Added support for MDSP task. +07/24/02 jqi TMC reorganization. +07/09/02 jqi Changes for code review. +07/02/02 jqi Changes per 4th week of I&T +06/19/02 jqi Added sending DIAG_OFFLINE_COMPLETE_SIG in the end of + offline procedure. +06/14/02 jqi Changes per 1st week of I&T. +06/06/02 jqi Initial Release + +===========================================================================*/ + +/*=========================================================================== + + INCLUDE FILES FOR MODULE + +===========================================================================*/ + +#include "target.h" /* Target header file */ +#include "msg.h" /* Message header file */ +#include "err.h" /* Error header file */ +#include "customer.h" /* Customer configuration file */ +#include "comdef.h" /* Definition for basic types and macros */ + +#include "tmcnv.h" /* TMC NV-Interface header file */ +#include "tmc.h" /* Task Main Controller header file */ +#include "tmci.h" /* Task Main Controller interal header file */ +#include "task.h" /* Task header file */ + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include "tramp.h" /* Interrupt trampline header file */ +#include "hw.h" /* Hardware header file */ +#include "gpio_int.h" /* GPIO Init header file */ +#include "clk.h" /* Clock header file */ +#include "clkregim.h" /* CLK Regim header file */ + +#include "sbi.h" +#ifdef FEATURE_I2C +#include "i2c.h" /* I2C header file */ +#endif /* FEATURE_I2C */ +#include "ran.h" /* random header file */ +#ifdef FEATURE_PMIC_RTC +#include "clkrtc.h" /* clk */ +#endif + +#ifdef FEATURE_I2C_NPA +extern void i2c_npa_target_init(void); +#endif + +#if defined(FEATURE_MULTIMODE_RFAPI) +#include "rfm_ext.h" +#endif /* FEATURE_MULTIMODE_RFAPI */ + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +#include "dog.h" /* Watch Dog Task header file */ + +void dog_auto_register(void); + +#ifdef FEATURE_NV +#include "nv.h" /* NV header file */ +#endif /* FEATURE_NV */ + +#ifdef FEATURE_CM +#include "cm.h" /* CM header file */ +#endif /* FEATURE_CM */ + +#ifdef FEATURE_DIAG_TASK +#include "diag.h" /* Diag header file */ +#include "event.h" /* Event header file */ +#endif /* FEATURE_DIAG_TASK */ + +#if defined(FEATURE_REX_CS) +/* BREW component services init function */ +int initialize_component_services(void); +#ifdef __ARMCC_VERSION +__weak int initialize_component_services_modules(void); +#else +int initialize_component_services_modules(void); +#endif +#endif + +#if defined(FEATURE_UIM) || defined(FEATURE_UIM_RUIM) +#include "uim.h" +#endif + +#ifdef FEATURE_CTA +extern void cta_task (dword param); /* CTA task header file */ +extern dog_report_type dyn_dog_cta_rpt; +#endif /* FEATURE_CTA */ + +#if defined(FEATURE_UIM_RUIM) +#include "memory.h" +#include "nvruimi.h" /* UIM RUIM header files */ +#endif /* FEATURE_UIM_RUIM */ + +#ifdef TIMETEST +#include "timetest.h" +#include "l4/cust/msm_syscall.h" +#endif /* TIMETEST */ + +#include "iguana/memsection.h" +#include "l4/misc.h" + +#if defined(FEATURE_SEC_TIME) && !defined(FEATURE_SEC_PROCESS_INIT) +#include "sectime.h" /* Secure time header file */ +#endif /* FEATURE_SEC_TIME && !FEATURE_SEC_PROCESS_INIT */ + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +#ifdef FEATURE_PMIC +#include "pm.h" /* PM header file */ +#endif + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +#ifdef FEATURE_GSM_PLT +#error code not present +#endif +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +#include "err.h" + +#include "sd.h" + +#if defined(FEATURE_TMC_TCXOMGR) || defined(FEATURE_TCXOMGR_TMC) +#include "tcxomgr.h" +#endif + +#ifdef FEATURE_SMEM +#include "smem_pcmod.h" +#include "smem.h" +#ifdef FEATURE_SMSM +#include "smsm.h" +#endif /* FEATURE_SMSM */ +#include "mobile.h" +#endif /* FEATURE_SMEM */ + +#ifdef FEATURE_L4LINUX +#include "qids_smms.h" +#endif + +#if defined(FEATURE_BUSMON) +#error code not present +#endif /* FEATURE_BUSMON */ + +#ifdef FEATURE_DAL +#include "DALSys.h" +#endif + +#if (defined(FEATURE_L4) && defined(FEATURE_STACKS_TCB_IN_WRITETHROUGH)) +#include "iguana/memsection.h" +#include "l4/misc.h" +extern byte *Image__ZI_STACKS__Base; +extern byte *Image__UNINIT_RAM__Base; +#endif /*FEATURE_L4 && FEATURE_STACKS_TCB_IN_WRITETHROUGH*/ + +#ifdef FEATURE_BATTERY_CHARGER +#include "charger.h" /* Charger header file */ +#endif + +#include "memheap.h" /* Memory heap header file */ + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/*=========================================================================== + + GLOBAL DEFINITIONS AND DECLARATIONS + +This section contains global definitions for constants, macros, types, +variables + +===========================================================================*/ + +/*--------------------------------------------------------------------------- + REX TIMER +---------------------------------------------------------------------------*/ + +static rex_timer_type tmc_rpt_timer; /* Timer for kicking watchdog */ +static rex_timer_type tmc_wait_timer; /* Timer for timer wait */ + +/*--------------------------------------------------------------------------- + QUEUE +---------------------------------------------------------------------------*/ + +#define TMC_CMD_POOL_SIZE 10 /* Maximun number of command waiting in the queue */ + +static tmc_cmd_type tmc_cmd_arr[TMC_CMD_POOL_SIZE]; /* RAM command pool */ + +static q_type tmc_free_cmd_q; /* Queue to manage commands pool */ + +static q_type tmc_cmd_q; + +/*--------------------------------------------------------------------------- + STATE +---------------------------------------------------------------------------*/ + +typedef struct /* TMC data structure is defined to hold all internal used data. */ +{ + tmc_state_e_type state; // TMC task state indicator - record current TMC task state. + dword esn_me; // ESN ME - read ESN ME from TMC-NV interface and store it here. + boolean is_init_done; // Inidcate tmc initialization is done or not. + rex_tcb_type *ack_task_ptr; // The task tcb who responses the ack signal to TMC. + +} tmc_data_s_type; + +static tmc_data_s_type tmc_data; + +typedef struct +{ + rex_tcb_type handle; + rex_timer_cnt_type count; + +} tmc_notify_s_type; + +/* Be ware of the risk in case the max number of task is over 100. +*/ +#define TMC_MAX_NUM_OF_TASK 100 + +/* wait counter in milliseconds for waiting for acknowledge for +** offline/stop signal from each tasks. +*/ + +#define TMC_DEFAULT_WAIT_CNT 50 +#define TMC_WAIT_CNT_5SEC 5000 + +/* Global variable used to turn write back cache off at run-time for +** debugging. +*/ +static boolean tmc_write_back_cache_on = TRUE; + +/*=========================================================================== + + LOCAL DEFINITIONS AND DECLARATIONS FOR MODULE + +This section contains local definitions for constants, macros, types, +variables and other items needed by this module. + +===========================================================================*/ + +#ifdef DOG_DYNAMIC_API /* Dynamic Dog Interface */ +#undef DOG_TMC_RPT +#define DOG_TMC_RPT tmc_dog_rpt_var +dog_report_type tmc_dog_rpt_var = 0; /* Initial Safety */ + +#undef DOG_TMC_RPT_TIME +#define DOG_TMC_RPT_TIME tmc_dog_rpt_time_var +uint32 tmc_dog_rpt_time_var = 0xffff; /* Initial Safety */ +#endif /* DOG_DYNAMIC_API */ + +/*=========================================================================== +============================================================================= +============================= MISCELLANEOUS BLOCK =========================== +================================= FUNCTIONS ================================= +============================================================================= +===========================================================================*/ + +#if defined(T_MSM7500) && defined(T_FFA) && !defined(FEATURE_I2C_DIRECT_ON_ARM11) +/*=========================================================================== + +FUNCTION TMC_POWER_DOWN_USB_OTG + +DESCRIPTION + This function sends an I2C command to the USB OTG XCVR chip to put it in + power down mode to save current in sleep state. Any future I2C command or + activity will power up the chip again. + +DEPENDENCIES + The I2C driver must be initialized. + +RETURN VALUE + None. + +SIDE EFFECTS + The USB OTG chip in the FFA will be in power down mode (power save mode). + +===========================================================================*/ +static void tmc_power_down_usb_otg(void) +{ + i2c_rw_cmd_type usb_xcvr_i2c_command; + uint8 i2c_data; + + /* Mode Control Register 2 - Addr: 0x12 */ + /* Bit 0: global_pwr_dn - set to power down */ + i2c_data = 0x01; + usb_xcvr_i2c_command.bus_id = I2C_BUS_HW_CTRL; + usb_xcvr_i2c_command.options = (i2c_options_type)(I2C_REG_DEV | + I2C_START_BEFORE_READ); + usb_xcvr_i2c_command.slave_addr = 0x5A; + usb_xcvr_i2c_command.addr.reg = 0x12; + usb_xcvr_i2c_command.buf_ptr = &i2c_data; + usb_xcvr_i2c_command.len = 1; + i2c_write(&usb_xcvr_i2c_command); +} /* tmc_power_down_usb_otg */ +#endif + +/*=========================================================================== + +FUNCTION tmc_set_ack_task + +DESCRIPTION + Set task tcb pointer in tmc_data. + +DEPENDENCIES + None. + +RETURN VALUE + None. + +SIDE EFFECTS + None. + +===========================================================================*/ +static void tmc_set_ack_task(rex_tcb_type *tcb_ptr) +{ + tmc_data.ack_task_ptr = tcb_ptr; +} /* tmc_set_ack_task */ + +/*=========================================================================== + +FUNCTION tmc_is_ack_task + +DESCRIPTION + If the specified task tcb pointer is the same as that in tmc_data. + +DEPENDENCIES + None. + +RETURN VALUE + None. + +SIDE EFFECTS + None. + +===========================================================================*/ +static boolean tmc_is_ack_task(rex_tcb_type *tcb_ptr) +{ + return (tmc_data.ack_task_ptr == tcb_ptr); +} /* tmc_is_ack_task */ + +/*=========================================================================== + +FUNCTION tmc_module_init + +DESCRIPTION + Initialize timers and queues of Task Main Controller + +DEPENDENCIES + None + +RETURN VALUE + void + +SIDE EFFECTS + None + +===========================================================================*/ +static void tmc_module_init(void) +{ + unsigned int i; + + /* Initialize timers */ + rex_def_timer(&tmc_rpt_timer, TASK_HANDLE(tmc), TMC_RPT_TIMER_SIG); + rex_def_timer(&tmc_wait_timer, TASK_HANDLE(tmc), TMC_WAIT_SIG); + + /* Initialize queues */ + (void) q_init(&tmc_cmd_q); + (void) q_init(&tmc_free_cmd_q); + + /* Link and place each block in command pool into the free command queue. + ** Initalize command array.The done_q_ptr is for free command buffer back + ** to free command queue. If the task pointer is non-NULL, signal the task + ** that the tone is done. + */ + for ( i=0; i< ARR_SIZE(tmc_cmd_arr); i++) + { + tmc_cmd_arr[i].cmd_id = TMC_CMD_TYPE_NONE; + tmc_cmd_arr[i].hdr.done_q_ptr = &tmc_free_cmd_q; + tmc_cmd_arr[i].hdr.task_ptr = NULL; + tmc_cmd_arr[i].hdr.sigs = 0; + (void) q_link(&tmc_cmd_arr[i],&tmc_cmd_arr[i].hdr.link); + q_put(&tmc_free_cmd_q, &tmc_cmd_arr[i].hdr.link); + } +} /* tmc_module_init */ + +/*=========================================================================== + +FUNCTION tmc_dog_report + +DESCRIPTION + Kick watch dog and set watch dog timer + +DEPENDENCIES + None + +RETURN VALUE + void + +SIDE EFFECTS + None + +===========================================================================*/ + +static void tmc_dog_report(void) +{ + (void) rex_clr_sigs (TASK_HANDLE(tmc), TMC_RPT_TIMER_SIG); + +#ifdef FEATURE_DOG + + if (tmc_dog_rpt_time_var > 0) /* Zero means don't report */ + { + (void) rex_set_timer(&tmc_rpt_timer, tmc_dog_rpt_time_var); + + dog_report(tmc_dog_rpt_var); + } + +#endif /* FEATURE_DOG */ + +} /* tmc_dog_report */ + +/*=========================================================================== + +FUNCTION tmc_wait + +DESCRIPTION + Suspend TMC from executing until at least one of the specified signals + in the input mask is set. + + Note that this function keep reporting to the watchdog while waiting + for the signal(s) to be set. + +DEPENDENCIES + tmc_rpt_timer must have been defined with rex_def_timer(). + +RETURN VALUE + rex_sigs_type + +SIDE EFFECTS + None + +===========================================================================*/ +static rex_sigs_type tmc_wait(rex_sigs_type mask) +{ + rex_sigs_type sigs; + /* Signals returned by rex_wait */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + /* Loop while waiting for one of the specified signals + ** to be set. + */ + for( ;; ) + { + /* Wait on specified signals, as well as, + ** on the watchdog signal. + */ + sigs = rex_wait( mask | TMC_RPT_TIMER_SIG ); + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + /* If watchdog signal is set, report back to the watchdog + */ + if( sigs & TMC_RPT_TIMER_SIG ) + { + tmc_dog_report(); + } + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + /* If one or more of the specified signals is set + ** return now. + */ + if( sigs & mask ) + { + return(sigs); + } + } /* for ( ;; ) */ +} /* tmc_wait */ + +static void tmc_define_tasks_common(_TASK_INFO const* p_info, unsigned int dogval) +{ + unsigned int i; + + TMC_MSG_MED("Creating task : %c%c%c.", + p_info->t_ident[0], + p_info->t_ident[1], + p_info->t_ident[2]); + + rex_def_task_ext2(p_info->t_handle, + (unsigned char *)p_info->t_stack, p_info->t_stksz * sizeof(rex_stack_word_type), + p_info->t_prio, p_info->t_main, TASK_ARGV_NIL, p_info->t_ident, FALSE, dogval); + + (void) tmc_wait(TMC_ACK_SIG); + (void) rex_clr_sigs(rex_self(), TMC_ACK_SIG); +} + +static void tmc_start_tasks_common(_TASK_INFO const* p_info) +{ + TMC_MSG_MED("Starting task : %c%c%c.", + p_info->t_ident[0], + p_info->t_ident[1], + p_info->t_ident[2]); + + (void) rex_set_sigs(p_info->t_handle, TASK_START_SIG); + + (void) tmc_wait(TMC_ACK_SIG); + (void) rex_clr_sigs(rex_self(), TMC_ACK_SIG); + } + +/*=========================================================================== + +FUNCTION tmc_get_cmd + +DESCRIPTION +This function dequeue a command from command queue and queue the memory +back to the free command queue + +DEPENDENCIES +Command queue has to be initialized. + +RETURN VALUE +A buffer of type tmc_cmd_type. + +SIDE EFFECTS + None + +===========================================================================*/ +static tmc_cmd_type *tmc_get_cmd(void) +{ + /* Dequeue a command from command queue */ + return(tmc_cmd_type *) q_get(&tmc_cmd_q); +} /* tmc_get_cmd */ + +/*=========================================================================== + +FUNCTION tmc_free_cmd + +DESCRIPTION + This function returns a command buffer to the free queue. + +DEPENDENCIES + Free queue has to be initialized. + +RETURN VALUE + None + +SIDE EFFECTS + None + +===========================================================================*/ +static void tmc_free_cmd(tmc_cmd_type *cmd_ptr) +{ + /* Enqueue a command into the free queue + */ + if ( cmd_ptr != NULL ) + { + /* Enqueue item onto done queue if requested (done_q_ptr != NULL) + ** Do this before we signal the task so that it has its buffer back + ** before we call its attention to the fact that the operation has + ** completed. + */ + if (cmd_ptr->hdr.done_q_ptr != NULL) + { + q_put( cmd_ptr->hdr.done_q_ptr, &cmd_ptr->hdr.link ); + } + + /* If the task pointer is non-NULL, signal the task that the tone is done. + ** Note: The pointer was either passed as NULL, or was set to NULL because + ** the signal was sent elsewhere. + */ + if (cmd_ptr->hdr.task_ptr != NULL) + { + (void) rex_set_sigs( cmd_ptr->hdr.task_ptr, cmd_ptr->hdr.sigs ); + } + } +} /* tmc_free_cmd */ + +/*=========================================================================== + +FUNCTION tmc_offline_tasks + +DESCRIPTION + The function sends the offline signal to tasks that need to be notified + of offline. For each task it waits for the task to acknowledge the signal. + +DEPENDENCIES + Task Main Controller has start. + +RETURN VALUE + void + +SIDE EFFECTS + None + +===========================================================================*/ +static void tmc_offline_tasks(void) +{ + rex_sigs_type received_sigs; + rex_tcb_type *tcb_ptr[TMC_MAX_NUM_OF_TASK]; + int i=0,num_of_task; /* number of task counter */ + /* the wait time counter in milliseconds */ + rex_timer_cnt_type wait_cnt[TMC_MAX_NUM_OF_TASK]; + +#ifdef TMC_SLEEP + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(sleep); /* Sleep task should received the offline signal as earlier as possible. */ +#endif /* TMC_SLEEP */ +#ifdef FEATURE_NV + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(nv); +#endif /* FEATURE_NV */ +#if !defined(FEATURE_THIN_UI) && !defined(FEATURE_UI_CORE_REMOVED) +#ifdef FEATURE_HS + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(hs); +#endif /* FEATURE_HS */ +#endif /* !defined(FEATURE_THIN_UI) && !defined(FEATURE_UI_CORE_REMOVED) */ +#ifdef FEATURE_DIAG_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(diag); +#endif /* FEATURE_DIAG_TASK */ +#ifdef FEATURE_IG_QDIAG + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(qdiag); +#endif /* FEATURE_IG_QDIAG */ +#ifdef FEATURE_UI + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ui); +#endif /* FEATURE_UI */ +#ifdef FEATURE_CM + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(cm); +#endif /* FEATURE_CM */ +#ifdef FEATURE_SND_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(snd); +#endif /* FEATURE_SND_TASK */ +#ifdef FEATURE_VOC_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(voc); +#endif /* FEATURE_VOC_TASK */ +#ifdef FEATURE_QDSP_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(qdsp); +#endif /* FEATURE_QDSP_TASK */ +#ifdef FEATURE_QDSP_RTOS + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(adsp_rtos); +#endif /* FEATURE_QDSP_RTOS */ +#ifdef FEATURE_IS2000_TDSO + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(tdso); +#endif /* FEATURE_IS2000_TDSO */ +#ifdef FEATURE_HDR + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(hdrsrch); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(hdrrx); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(hdrtx); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(hdrmc); +#endif /* FEATURE_HDR */ +#ifdef FEATURE_HDR_BCMCS + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(hdrbc); +#endif /* FEATURE_HDR_BCMCS */ +#ifdef FEATURE_VBATT_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT ; + tcb_ptr[i++] = TASK_HANDLE(vbatt) ; +#endif /* FEATURE_VBATT_TASK */ +#ifdef TMC_1X + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(rxtx); +#endif /* TMC_1X */ +#if defined(FEATURE_AUTH) || defined(FEATURE_RUIM) + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(auth); +#endif /* FEATURE_AUTH || FEATURE_RUIM */ +#ifdef FEATURE_DH + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(dh); +#endif /* FEATURE_DH */ +#ifdef FEATURE_DOG + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(dog); +#endif /* FEATURE_DOG */ +#if defined(FEATURE_CDSMS) || defined(FEATURE_GWSMS) + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(wms); +#endif /* FEATURE_CDSMS || FEATURE_GWSMS */ +#ifdef FEATURE_MDSP_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(mdsp); +#endif /* FEATURE_MDSP_TASK */ +#if defined(FEATURE_CGPS) && !defined(FEATURE_DISABLE_CGPS) + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(mgpmc); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(pp); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(cc); +#ifdef FEATURE_CGPS_PGI_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(pgi); +#endif /* FEATURE_CGPS_PGI_TASK */ + wait_cnt[i] = TMC_WAIT_CNT_5SEC; + tcb_ptr[i++] = TASK_HANDLE(cd); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(nf); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(gpsfft); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(lm); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(sm_tm); +#ifdef FEATURE_CGPS_PD_COMMS_TCP_ON_MODEM + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(pdcommtcp); +#endif /* !FEATURE_DATA_ON_APPS */ + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(pdcommwms); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(gps_fs); +#ifdef FEATURE_CGPS_LOC_MIDDLEWARE + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(loc_middleware); +#endif // FEATURE_CGPS_LOC_MIDDLEWARE +#endif /* FEATURE_CGPS */ +#ifdef FEATURE_XO + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(tcxomgr); +#endif /* FEATURE_XO */ +#ifdef FEATURE_MMGSDI + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(gsdi); +#endif /* FEATURE_MMGSDI */ +#ifdef FEATURE_FTM_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ftm); +#endif /* FEATURE_FTM_TASK */ +#ifdef FEATURE_GSTK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(gstk); +#endif /* FEATURE_GSTK */ +#ifdef FEATURE_UIM + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(uim); +#endif /* FEATURE_UIM */ +#ifdef FEATURE_BCMCS + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(bcdb); +#endif /* FEATURE_BCMCS */ +#ifdef FEATURE_JOYST_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(joyst); +#endif /* FEATURE_JOSYT_TASK */ +#ifdef FEATURE_DTV + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(dtv); +#endif /* FEATURE_DTV */ +#ifdef FEATURE_PBM_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(pbm); +#endif /* FEATURE_PBM_TASK */ +#ifdef FEATURE_APS + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(aps); +#endif /* FEATURE_APS */ +#ifdef FEATURE_ATS + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ats); +#endif /* FEATURE_ATS */ +#ifdef FEATURE_PM_SERVER + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(pms); +#endif /* FEATURE_PM_SERVER */ +#ifdef FEATURE_QIPCALL + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(qipcall); +#endif /* FEATURE_QIPCALL */ +#ifdef FEATURE_MFLO +#error code not present +#endif /* FEATURE_MFLO */ +#if defined(FEATURE_DISP_TASK) && (!defined(T_MSM7500) || defined(T_MSM7500) && defined(IMAGE_APPS_PROC)) + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(disp); +#endif /* FEATURE_DISP_TASK */ +#ifdef FEATURE_AVS_SBCENC_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(sbcenc); +#endif +#ifdef FEATURE_UBM_L1 + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ubm_l1); +#endif /* FEATURE_UBM_L1 */ +#ifdef FEATURE_CHG_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(chg); +#endif /* FEATURE_CHG_TASK */ +#ifdef FEATURE_CTA + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(cta) ;; +#endif /* FEATURE_CTA */ + + (void) rex_clr_sigs(rex_self(), TMC_ACK_SIG); + + /* If total num of offline task are greater than TMC_MAX_NUM_TASKS, + ** you have to increase TMC_MAX_NUM_TASKS to match the number. + */ + num_of_task = i ; + + /* Sending offline signale and timer wait for ACK signale.*/ + + for (i = 0; i < num_of_task; i++) + { + QSR_TMC_MSG_MED( 918780172ULL, "Offline task : %c%c%c.", + tcb_ptr[i]->task_name[0], + tcb_ptr[i]->task_name[1], + tcb_ptr[i]->task_name[2]);//auto-gen, to change remove 'QSR_' and first param + + (void) rex_set_sigs(tcb_ptr[i], TASK_OFFLINE_SIG); + + /* Report dog first so that it would not timer out immediately after we are + ** waiting for ack signal from other tasks. + */ + tmc_dog_report(); + + /* Set the Sanity Timer to avoid having the possibility of + ** losing the time when the wrong Task Acks back after + ** it had timed out + */ + (void) rex_set_timer (&tmc_wait_timer, wait_cnt[i]); + + do + { + /* Wait for either the Sanity Timer to Expire or + ** the TMC_ACK_SIG To occur + */ + received_sigs = rex_wait(TMC_ACK_SIG | TMC_WAIT_SIG); + + (void) rex_clr_sigs(rex_self(), TMC_ACK_SIG); + /* Get out only, if the task that acks back + ** is the task that we are waiting for + */ + } while( !tmc_is_ack_task( tcb_ptr[i] ) && + !(received_sigs & TMC_WAIT_SIG) ); + + (void) rex_clr_timer(&tmc_wait_timer); + + (void) rex_clr_sigs(rex_self(), TMC_WAIT_SIG); + + if (received_sigs & TMC_WAIT_SIG) + { + QSR_TMC_MSG_ERROR( 2284056914ULL, "Offline timer out task : %c%c%c.", + tcb_ptr[i]->task_name[0], + tcb_ptr[i]->task_name[1], + tcb_ptr[i]->task_name[2]);//auto-gen, to change remove 'QSR_' and first param + } + } +} /* tmc_offline_tasks */ + +/*=========================================================================== + +FUNCTION tmc_stop_tasks + The function sends the stop signal to each task then waits for + the task to acknowledge the signal. + +DEPENDENCIES + Task Main Controller has start. + +RETURN VALUE + void + +SIDE EFFECTS + void + +===========================================================================*/ +static void tmc_stop_tasks(void) +{ + rex_sigs_type received_sigs; /* Received signal */ + rex_tcb_type *tcb_ptr[TMC_MAX_NUM_OF_TASK]; /* Stop task array */ + int i=0,num_of_task; /* number of task counter */ + /* the wait time counter in milliseconds */ + rex_timer_cnt_type wait_cnt[TMC_MAX_NUM_OF_TASK]; + +#ifdef FEATURE_DOG + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(dog); +#endif /* FEATURE_DOG */ +#ifdef TMC_SLEEP + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(sleep); +#endif /* TMC_SLEEP */ +#ifdef FEATURE_DH + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(dh); +#endif /* FEATURE_DH */ +#ifdef FEATURE_ONCRPC +#ifdef FEATURE_STA + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(sta); +#endif /* FEATURE_STA */ + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(oncrpc); +#endif /* FEATURE_ONCRPC */ +#if defined(FEATURE_WLAN) && !defined(FEATURE_MULTIPROCESSOR) + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(wlan_cp); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(wlan_trp); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(wlan_sec); +#if defined(FEATURE_WLAN_DECOUPLE_DS) + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(wlan_ds); +#endif +#endif /* FEATURE_WLAN && !FEATURE_MULTIPROCESSOR */ +#if defined(FEATURE_DATA) && !defined(FEATURE_DATA_ON_APPS) + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ds); +#ifdef FEATURE_DATA_PS + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ps); +#ifdef FEATURE_DATA_PS_DCC + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(dcc); +#endif /* FEATURE_DATA_PS_DCC */ +#ifdef FEATURE_DATA_PS_SOCK_REARCH + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ds_sig); +#endif /* FEATURE_DATA_PS_SOCK_REARCH */ +#endif /* FEATURE_DATA_PS */ +#ifdef FEATURE_DATA_MUX +#error code not present +#endif +#endif /* defined(FEATURE_DATA) && !defined FEATURE_DATA_ON_APPS) */ +#ifdef FEATURE_DATA +#ifdef FEATURE_COMP_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(comp); +#endif /* FEATURE_COMP_TASK */ +#endif +#if defined(FEATURE_GAN) && !(defined(IMAGE_APPS_PROC)) +#error code not present +#endif +#ifdef FEATURE_GAN +#error code not present +#endif +#ifndef FEATURE_SEC_PROCESS_INIT +#ifdef FEATURE_IXHTTPSVC + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ix_httpsvc); +#endif +#ifdef FEATURE_IXTIMESVC + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ix_timesvc); +#endif +#ifdef FEATURE_IXCONTENTSVC + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ix_contentclnt); +#endif +#endif /* !FEATURE_SEC_PROCESS_INIT */ +#ifdef FEATURE_IXCONTENTSVC + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ix_contentsvc); +#endif +#ifndef FEATURE_SEC_PROCESS_INIT +#ifdef FEATURE_IXDESCRAMBLERSVC + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ix_descramblersvc); +#endif +#ifdef FEATURE_SEC + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(sec); +#ifdef FEATURE_SEC_CONTENT_AGENT + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(contentagentdiag); +#endif +#ifdef FEATURE_SEC_ARM_CRYPTO + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(seccryptarm); +#endif +#ifdef FEATURE_SECRND + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(secrnd); +#endif +#ifdef FEATURE_SEC_USFS + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(sfs); +#endif +#endif /* FEATURE_SEC */ +#endif /* !FEATURE_SEC_PROCESS_INIT */ +#ifdef FEATURE_SEC +#ifdef FEATURE_SSD + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ssd); +#endif +#ifdef FEATURE_SEC_SSL + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(secssl); +#endif /* FEATURE_SEC_SSL */ +#if defined(FEATURE_SEC_SSL_TESTAPP) || defined(FEATURE_SEC_CRYPT_TESTAPP) + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(sectestapp); +#endif /* FEATURE_SEC_SSL_TESTAPP || FEATURE_SEC_CRYPT_TESTAPP */ +#ifdef FEATURE_SEC_IPSEC + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(secips); +#endif +#ifdef FEATURE_SEC_DRM + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(secdrm); +#endif /* FEATURE_SEC_DRM */ +#endif /* FEATURE_SEC */ +#ifdef FEATURE_DS_SOCKETS_TEST_TCP +#error code not present +#endif /* FEATURE_DS_SOCKETS_TEST_TCP */ +#ifdef FEATURE_DS_SOCKETS_TEST_UDP +#error code not present +#endif /* FEATURE_DS_SOCKETS_TEST_UDP */ +#ifdef FEATURE_QMIP +#error code not present +#endif /* FEATURE_QMIP */ +#ifdef FEATURE_IS2000_TDSO + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(tdso); +#endif /* FEATURE_IS2000_TDSO */ +#if defined(FEATURE_AUTH) || defined(FEATURE_RUIM) + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(auth); +#endif /* FEATURE_AUTH || FEATURE_RUIM */ +#ifdef FEATURE_HDR + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(hdrsrch); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(hdrrx); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(hdrtx); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(hdrmc); +#endif /* FEATURE_HDR */ +#ifdef FEATURE_HDR_BCMCS + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(hdrbc); +#endif /* FEATURE_HDR_BCMCS */ +#ifdef FEATURE_VBATT_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT ; + tcb_ptr[i++] = TASK_HANDLE(vbatt) ; +#endif /* FEATURE_VBATT_TASK */ +#ifdef TMC_1X + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(rxtx); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(srch); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(rx); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(tx); +#endif /* TMC_1X */ +#ifdef FEATURE_CM + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(cm); +#endif /* FEATURE_CM */ +#if defined( FEATURE_BT ) && !defined(IMAGE_MODEM_PROC) + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(bt); +#ifdef FEATURE_BT_FS_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(bt_fs); +#endif /* FEATURE_BT_FS_TASK */ +#endif /* FEATURE_BT && !IMAGE_MODEM_PROC */ +#ifdef FEATURE_FM + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(fmrds); +#endif /* FEATURE_FM */ +#ifdef FEATURE_IG_QDIAG + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(qdiag); +#endif /* FEATURE_IG_QDIAG */ +#ifdef FEATURE_DIAG_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(diag); +#endif /* FEATURE_DIAG_TASK */ +#if !defined(FEATURE_THIN_UI) && !defined(FEATURE_UI_CORE_REMOVED) +#ifdef FEATURE_HS + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(hs); +#endif /* FEATURE_HS */ +#endif /* !defined(FEATURE_THIN_UI) && !defined(FEATURE_UI_CORE_REMOVED) */ +#ifdef FEATURE_IDS +#error code not present +#endif /* FEATURE_IDS */ +#if defined(FEATURE_USB) && !defined(FEATURE_NO_USB_HW_ON_PROCESSOR) + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(usbdc); +#ifdef FEATURE_USB_HOST_ENHANCED + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(usbhc_urb); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(usbhc_dev); +#if defined(FEATURE_USB_HOST_TEST_ENHANCED) && (defined(FEATURE_USB_HOST_MASS_STORAGE_TEST_ENHANCED) || defined(FEATURE_USB_HOST_HID_TEST_ENHANCED)) + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(usbhc_test); +#endif +#endif +#endif /* FEATURE_USB */ +#if defined(FEATURE_HS_USB) && (defined(FEATURE_STANDALONE_MODEM) || !defined(FEATURE_NO_USB_HW_ON_PROCESSOR)) +#ifdef FEATURE_HS_USB_MS_FD + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(hsu_al_ms); +#endif + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(hsu_al_task); +#endif /* FEATURE_HS_USB && (FEATURE_STANDALONE_MODEM || !FEATURE_NO_USB_HW_ON_PROCESSOR) */ +#ifdef FEATURE_SMD + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(smd); +#endif /*FEATURE_SMD*/ +#ifdef FEATURE_TIME_IPC_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(time_ipc); +#endif /*FEATURE_TIME_IPC_TASK */ +#ifdef FEATURE_NV + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(nv); +#endif /* FEATURE_NV */ +#ifdef FEATURE_VS_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(vs); +#endif /* FEATURE_VS_TASK */ +#ifdef FEATURE_GRAPH_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(graph); +#endif /* FEATURE_GRAPH_TASK */ +#ifdef FEATURE_GFX_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(gfx); +#endif /* FEATURE_GFX_TASK */ +#ifdef FEATURE_CAMERA_DRV_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(camera_drv); +#endif /* FEATURE_CAMERA_DRV_TASK */ +#ifdef FEATURE_SND_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(snd); +#endif /* FEATURE_SND_TASK */ +#ifdef FEATURE_VOC_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(voc); +#endif /* FEATURE_VOC_TASK */ +#ifdef FEATURE_QDSP_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(qdsp); +#endif /* FEATURE_QDSP_TASK */ +#ifdef FEATURE_QDSP_RTOS + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(adsp_rtos); +#endif /* FEATURE_QDSP_RTOS */ +#ifndef FEATURE_SEC_PROCESS_INIT +#ifdef FEATURE_IXFILESVC + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ix_filesvc); +#endif +#ifdef FEATURE_IXSQLSVC + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ix_sqlsvc); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ix_sqlclnt); +#endif +#endif /* !FEATURE_SEC_PROCESS_INIT */ +#ifdef FEATURE_EFS_SFAT + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(sfat); +#endif /* FEATURE_EFS_SFAT */ +#ifdef FEATURE_EFS + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(fs); +#endif /* FEATURE_EFS */ +#if ( defined(FEATURE_CDSMS) || defined(FEATURE_GWSMS) ) + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(wms); +#endif /* FEATURE_CDSMS || FEATURE_GWSMS */ +#ifdef FEATURE_MDSP_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(mdsp); +#endif /* FEATURE_MDSP_TASK */ +#if (defined(FEATURE_CGPS) && !defined(FEATURE_DISABLE_CGPS)) + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(mgpmc); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(pp); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(cc); +#ifdef FEATURE_CGPS_PGI_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(pgi); +#endif /* FEATURE_CGPS_PGI_TASK */ + wait_cnt[i] = TMC_WAIT_CNT_5SEC; + tcb_ptr[i++] = TASK_HANDLE(cd); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(nf); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(gpsfft); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(lm); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(sm_tm); +#ifdef FEATURE_CGPS_PD_COMMS_TCP_ON_MODEM + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(pdcommtcp); +#endif /* !FEATURE_DATA_ON_APPS */ + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(pdcommwms); + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(gps_fs); +#ifdef FEATURE_CGPS_LOC_MIDDLEWARE + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(loc_middleware); +#endif // FEATURE_CGPS_LOC_MIDDLEWARE +#endif /* FEATURE_CGPS */ +#ifdef FEATURE_MMGSDI + wait_cnt[i] = TMC_WAIT_CNT_5SEC; + tcb_ptr[i++] = TASK_HANDLE(gsdi); +#endif /* FEATURE_MMGSDI */ +#ifdef FEATURE_FTM_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ftm); +#endif /* FEATURE_FTM_TASK */ +#ifdef FEATURE_GSTK + wait_cnt[i] = TMC_WAIT_CNT_5SEC; + tcb_ptr[i++] = TASK_HANDLE(gstk); +#endif /* FEATURE_GSTK */ +#ifdef FEATURE_UIM + wait_cnt[i] = TMC_WAIT_CNT_5SEC; + tcb_ptr[i++] = TASK_HANDLE(uim); +#endif /* FEATURE_UIM */ +#if defined( FEATURE_BT ) && !defined(IMAGE_MODEM_PROC) +#ifdef FEATURE_BT_EXTPF + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(bt_pf); +#endif /* FEATURE_BT_EXTPF */ +#endif +#ifdef FEATURE_BT_FTM_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(bt_ftm); +#endif +#ifdef FEATURE_BCMCS + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(bcdb); +#endif /* FEATURE_BCMCS */ +#ifdef FEATURE_DTV + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(dtv); +#endif /* FEATURE_DTV */ +#ifdef FEATURE_JOYST + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcp_ptr[i++] = TASK_HANDLE(joyst); +#endif /* FEATURE_JOYST */ +#ifdef FEATURE_PBM_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(pbm); +#endif /* FEATURE_PBM_TASK */ +#ifdef FEATURE_APS + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(aps); +#endif /* FEATURE_APS */ +#ifdef FEATURE_ATS + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ats); +#endif /* FEATURE_ATS */ +#ifdef FEATURE_PM_SERVER + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(pms); +#endif /* FEATURE_PM_SERVER */ +#ifdef FEATURE_QIPCALL + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(qipcall); +#endif /* FEATURE_QIPCALL */ +#ifdef FEATURE_MFLO +#error code not present +#endif /* FEATURE_MFLO */ +#ifdef FEATURE_AVS_SBCENC_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(sbcenc); +#endif +#ifdef FEATURE_FTM_CAMERA_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ftm_camera); +#endif /*FEATURE_FTM_CAMERA_TASK */ +#ifdef FEATURE_UBM_L1 + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(ubm_l1); +#endif /* FEATURE_UBM_L1 */ +#if defined(FEATURE_SENSORS) + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(sns); +#endif /* FEATURE_SENSORS */ +#ifdef FEATURE_CTA + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(cta); +#endif /* FEATURE_CTA */ +#ifdef FEATURE_CHG_TASK + wait_cnt[i] = TMC_DEFAULT_WAIT_CNT; + tcb_ptr[i++] = TASK_HANDLE(chg); +#endif /* FEATURE_CHG_TASK */ +#ifdef FEATURE_UI + wait_cnt[i] = TMC_WAIT_CNT_5SEC; + tcb_ptr[i++] = TASK_HANDLE(ui); +#endif /* FEATURE_UI */ + + (void) rex_clr_sigs(rex_self(), TMC_ACK_SIG); + + /* If total num of stop task are greater than TMC_MAX_NUM_TASKS, + ** you have to increase TMC_MAX_NUM_TASKS to match the number. + */ + num_of_task = i ; + + /* Sending stop signale and timed wait for ACK signale.*/ + + for (i = 0; i < num_of_task; i++) + { + + QSR_TMC_MSG_MED( 2835790621ULL, "Stop task : %c%c%c.", + tcb_ptr[i]->task_name[0], + tcb_ptr[i]->task_name[1], + tcb_ptr[i]->task_name[2]);//auto-gen, to change remove 'QSR_' and first param + + (void) rex_set_sigs(tcb_ptr[i], TASK_STOP_SIG); + /* Report dog first so that it would not timer out immediately after we are + ** waiting for ack signal from other tasks. + */ + tmc_dog_report(); + + /* Set the Sanity Timer to avoid having the possibility of + ** losing the time when the wrong Task Acks back after + ** it had timed out + */ + (void) rex_set_timer (&tmc_wait_timer, wait_cnt[i]); + + do + { + /* Wait for either the Sanity Timer to Expire or + ** the TMC_ACK_SIG To occur + */ + received_sigs = rex_wait(TMC_ACK_SIG | TMC_WAIT_SIG); + + (void) rex_clr_sigs(rex_self(), TMC_ACK_SIG); + /* Get out only, if the task that acks back + ** is the task that we are waiting for + */ + } while( !tmc_is_ack_task( tcb_ptr[i] ) && + !(received_sigs & TMC_WAIT_SIG) ); + + (void) rex_clr_timer(&tmc_wait_timer); + + (void) rex_clr_sigs(rex_self(), TMC_WAIT_SIG); + + if(received_sigs & TMC_WAIT_SIG) + { + QSR_TMC_MSG_ERROR( 3180694873ULL, "Stop timer out task : %c%c%c.", + tcb_ptr[i]->task_name[0], + tcb_ptr[i]->task_name[1], + tcb_ptr[i]->task_name[2]);//auto-gen, to change remove 'QSR_' and first param + } + } +} /* tmc_stop_tasks */ + +/*=========================================================================== + +FUNCTION tmc_online_handler + +DESCRIPTION + This function is called when the MS is to transition to the online + state. The function processes the reset procedures. + +DEPENDENCIES + Task Main Controller has start. + +RETURN VALUE + void + +SIDE EFFECTS + None + +===========================================================================*/ +static void tmc_online_handler(void) +{ + if ( tmc_get_state() == TMC_LPM ) + { +#ifdef TMC_HW_IMPLEMENT_LPM + TMC_VOID_FUNCTION_CALL(hw_exit_low_power_mode); +#endif /* TMC_HW_IMPLEMENT_LPM */ + } +}/* tmc_online__handler */ + +/*=========================================================================== + +FUNCTION tmc_offline_handler + +DESCRIPTION + This function is called when the MS is to transition to the OFFLINE + state. The function processes the offline command. + +DEPENDENCIES + Task Main Controller has start. + +RETURN VALUE + void + +SIDE EFFECTS + None +===========================================================================*/ +static void tmc_offline_handler(void) +{ + tmc_offline_tasks(); /* send task offline signals */ + +#if (defined(FEATURE_DIAG_TASK) && defined(FEATURE_DIAG_COUPLED_ARCHITECTURE)) + (void) rex_set_sigs(TASK_HANDLE(diag), DIAG_OFFLINE_COMPLETE_SIG); /* Send Offline complete signal to diag task in the end. */ +#endif /* FEATURE_DIAG_TASK && FEATURE_DIAG_COUPLED_ARCHITECTURE */ + +#ifdef FEATURE_UIM_RUIM + + (void) uim_power_control(UIM_MC, FALSE); /* Indicate to power down the RUIM */ +#endif /* FEATURE_UIM_RUIM */ +}/* tmc_offline_handler */ + +/*=========================================================================== + +FUNCTION tmc_reset_handler + +DESCRIPTION + This function is called when the MS is to transition to the reset + state. The function processes the reset procedures. + +DEPENDENCIES + Task Main Controller has start. + +RETURN VALUE + void + +SIDE EFFECTS + None + +===========================================================================*/ +static void tmc_reset_handler(void) +{ +#ifdef FEATURE_SDCC_BOOT + { + /* if we're using eMMC boot, prepare the modem file system for reset */ + + extern int efs_prepare_shutdown(void); + + dog_task_disable(TRUE); /*Temp workaround to disable s/w wdog as efs_prepare_shutdown takes too long */ + + (void)efs_prepare_shutdown(); + } +#endif + +#ifdef FEATURE_UIM_RUIM + (void) uim_power_control(UIM_MC, FALSE); /* Indicate to power down the RUIM */ +#endif /* FEATURE_UIM_RUIM */ + + tmc_stop_tasks(); /* Send stop signal to various tasks. */ + + TMC_VOID_FUNCTION_CALL(hw_reset); /* Finish the reset process */ + +}/* tmc_reset_handler */ + +/*=========================================================================== + +FUNCTION tmc_powerdown_handler + +DESCRIPTION + This function is called when the MS is to transition to the power down + state. The function processes the powerdown command. + +DEPENDENCIES + Task Main Controller has start. + +RETURN VALUE + void + +SIDE EFFECTS + None + +===========================================================================*/ +void tmc_powerdown_handler(void) +{ +#ifdef FEATURE_UIM_RUIM + (void) uim_power_control(UIM_MC, FALSE); /* Indicate to power down the RUIM */ +#endif /* FEATURE_UIM_RUIM */ + +#if defined(FEATURE_TMC_TCXOMGR) || defined(FEATURE_TCXOMGR_TMC) + { + // void tcxomgr_powerdown(rex_tcb_type*, rex_sigs_type, void*); + tcxomgr_powerdown(rex_self(), TMC_NV_CMD_SIG, (void (*)( rex_sigs_type ))tmc_wait); /* Power off the TCXO manager */ + } +#endif + + tmc_stop_tasks(); /* Send stop signal to various tasks. */ + + TMC_VOID_FUNCTION_CALL(hw_power_off); /* Finish the power down process */ + +}/* tmc_powerdown_handler */ + +/*=========================================================================== + +LOCAL FUNCTION TMC_LPM_HANDLER + +DESCRIPTION + + This function handles the low power mode signal + +DEPENDENCIES + + None. + +RETURN VALUE + + None. + +SIDE EFFECTS + + None. + +===========================================================================*/ +static void tmc_lpm_handler(void) +{ +#ifdef TMC_HW_IMPLEMENT_LPM + hw_enter_low_power_mode(); +#endif /* TMC_HW_IMPLEMENT_LPM */ +} + +/*=========================================================================== + +FUNCTION tmc_set_state + +DESCRIPTION + Set tmc operation state. + +DEPENDENCIES + None. + +RETURN VALUE + None. + +SIDE EFFECTS + None. + +===========================================================================*/ +static void tmc_set_state(tmc_state_e_type state) +{ + tmc_data.state = state; +} /* tmc_set_state */ + +#ifdef FEATURE_UIM_RUIM +/*=========================================================================== + +FUNCTION tmc_store_esn_me + +DESCRIPTION + This function store esn_me to TMC internal data structure. + +DEPENDENCIES + None + +RETURN + None + +SIDE EFFECTS + None + +===========================================================================*/ +static void tmc_store_esn_me (dword esn_me) +{ + tmc_data.esn_me = esn_me; +} /* tmc_store_esn_me */ +#endif /* FEATURE_UIM_RUIM */ + +/*=========================================================================== + +FUNCTION tmc_set_init_state + +DESCRIPTION + Set tmc initialization state. + +DEPENDENCIES + None. + +RETURN VALUE + None. + +SIDE EFFECTS + None. + +===========================================================================*/ +static void tmc_set_init_state(boolean init_state) +{ + tmc_data.is_init_done = init_state; +} /* tmc_set_state */ + +/*=========================================================================== + +FUNCTION tmc_data_reset + +DESCRIPTION + Reset TMC data. + +DEPENDENCIES + None. + +RETURN VALUE + None. + +SIDE EFFECTS + None. + +===========================================================================*/ +static void tmc_data_reset(void) +{ +#ifdef FEATURE_UIM_RUIM + tmc_data.esn_me = 0 ; +#endif + tmc_data.state = TMC_PWROFF ; +} /* tmc_set_state */ + +/*=========================================================================== + +FUNCTION tmc_dispatch_commands + +DESCRIPTION + This function handles the commands received in TMC's command queue. + This function dequeues each command in the command queue + until the command queue is empty. For each command, it looks at + the command ID and handles it appropriately. Then it frees the command. + +DEPENDENCIES + None. + +RETURN VALUE + None. + +SIDE EFFECTS + None. + +===========================================================================*/ +static void tmc_dispatch_commands(void) +{ + tmc_cmd_type *cmd_ptr; /* To hold received command */ + + /* We need to dequeue items from the internal + ** command queue and process them till the queue is + ** empty + */ + + while( (cmd_ptr = tmc_get_cmd()) != NULL) + { + /* Switch on the command id of the received command, and + ** call the appropriate function to process each command. + */ + switch( cmd_ptr->cmd_id ) + { + case TMC_CMD_TYPE_ONLINE: + tmc_online_handler(); + tmc_set_state(TMC_ONLINE); + break; + + case TMC_CMD_TYPE_OFFLINE: + tmc_offline_handler(); + tmc_set_state(TMC_OFFLINE); + break; + + case TMC_CMD_TYPE_RESET: + tmc_reset_handler(); + tmc_set_state(TMC_RESET); + break; + + case TMC_CMD_TYPE_RESET_MODEM: + tmc_set_state(TMC_RESET_MODEM); + TMC_ERR_FATAL(" MODEM RESET",0, 0, 0 ); + break; + + case TMC_CMD_TYPE_POWERDOWN: + tmc_powerdown_handler(); + tmc_set_state(TMC_PWROFF); + break; + + case TMC_CMD_TYPE_LPM: + tmc_lpm_handler(); + tmc_set_state(TMC_LPM); + break; + + default: + /* receive a invalid command*/ + TMC_ERR("A invalid command",0,0,0); + break; + } /* switch */ + + /* Free the command. + */ + tmc_free_cmd( cmd_ptr ); + + } /* end while */ +} /* tmc_dispatch_command */ + +/*=========================================================================== + +FUNCTION tmc_order_0_init + +DESCRIPTION + This function does first part of power up initialization. The + initialization is required before any tasks is defined or started. + +DEPENDENCIES + None + +RETURN VALUE + void + +SIDE EFFECTS + None + +===========================================================================*/ +static void tmc_order_0_init(void) +{ +#if defined(TIMETEST) + L4_MSM_TIMETEST_ENABLE(TRUE); +#endif + +#ifdef FEATURE_L4_RECENT_THREADS + /* Turn profiling (recent_threads) on */ + L4_MSM_PROFILE(1); +#endif + +#ifdef FEATURE_TMC_WB_CACHE + if (tmc_write_back_cache_on) + { + thread_ref_t tIgnore; + memsection_ref_t ms; + + ms = memsection_lookup(TASK_STACK(dog), &tIgnore); + + memsection_set_attributes(ms, L4_WriteBackMemory); + } +#endif + + /* Generic Initialization */ + +#ifdef FEATURE_SMEM + /* Init the shared memory data structure */ + TMC_VOID_FUNCTION_CALL(smem_init); + TMC_VOID_FUNCTION_CALL(mobile_init_modem_sw_build_id); + TMC_VOID_FUNCTION_CALL(smem_proc_comm_init); +#endif /* FEATURE_SMEM */ + +#ifdef FEATURE_PMEM +#ifdef PMEM_7K_INIT + TMC_VOID_FUNCTION_CALL(pmem_module_init); /* Initialize the pmem system */ + TMC_VOID_FUNCTION_CALL(pmem_7k_init_smi); +#else + TMC_VOID_FUNCTION_CALL(pmem_7k_modem_init); +#endif +#endif + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + tmcnv_init(TMC_NV_CMD_SIG, TMC_RPT_TIMER_SIG, tmc_dog_report); /* Initialize TMC NV-Interface */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_ENABLE_FLOATING_POINT_ERRORS + TMC_VOID_FUNCTION_CALL(boot_enable_fp_errors); +#endif + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + TMC_VOID_FUNCTION_CALL(msg_init); /* MSG services */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + TMC_VOID_FUNCTION_CALL(dsm_init); /* Data services */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_REX_IPC /* IPC header file */ + TMC_VOID_FUNCTION_CALL(ipcmem_pool_init); + TMC_VOID_FUNCTION_CALL(tsvc_init); +#endif + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + mem_init_heap(&tmc_heap, tmc_heap_mem_buffer, TMC_HEAP_MEM_BUFFER_SIZE, NULL); + mem_init_heap(&tmc_heap_small, tmc_heap_small_mem_buffer, TMC_HEAP_SMALL_MEM_BUFFER_SIZE, NULL); + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef TMC_BIO_INIT + TMC_VOID_FUNCTION_CALL(bio_init); /* BIO initialization. */ +#endif /* TMC_BIO_INIT */ + + TMC_VOID_FUNCTION_CALL(npa_init); /* Initialize NPA */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + TMC_VOID_FUNCTION_CALL(clk_regime_init); /* Init the clock regime to a known state. */ + + TMC_VOID_FUNCTION_CALL(ddr_init); /* Init DDR to a known state. */ + + TMC_VOID_FUNCTION_CALL(CoreCpuInitialize); /* Initialize the /core/cpu node */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + TMC_VOID_FUNCTION_CALL(tramp_init); /* Interrupt initialization */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef KILL_EBI0_CLOCK +#if defined(FEATURE_BUSPERF) + TMC_VOID_FUNCTION_CALL(bus_init); /* Initialize the bus performance subsystem */ +#endif /* FEATURE_BUSPERF */ +#endif + +#if defined(FEATURE_BUSMON) +#error code not present +#endif /* FEATURE_BUSMON */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_SMSM + smsm_init(SMSM_MODEM); /* shared memory state machine init */ + smsm_set_state(SMSM_THIS_HOST, SMSM_OEMSBL_RELEASE); /* Give apps process access to the OEM SBL section */ +#endif /* FEATURE_SMSM */ + +#ifdef FEATURE_DOG_KEEPALIVE_TASK + TMC_VOID_FUNCTION_CALL(dog_keepalive_init); +#endif + +#ifdef FEATURE_SMEM_LOG + TMC_VOID_FUNCTION_CALL(smem_log_init); /* shared memory event log init */ +#endif /* FEATURE_SMEM_LOG */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_DMOV + { + void dmov_init(void*); + /* Initialize DMOV data mover driver */ + /* The DMOV init on the modem process must happen before the DMOV init + on the apps processor. So by placing the init on the modem processor + before time_init. We know the the apps processor has not passed + time_init and therefore has not reached DMOV init. */ + (void)dmov_init(NULL); + } +#endif + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_USE_TIME_VU + + TMC_VOID_FUNCTION_CALL(time_init); /* Time services */ + +#ifdef FEATURE_TIMER_TASK + + rex_def_task_ext2(TASK_HANDLE(timer), + (unsigned char*)TASK_STACK(timer), + TIMER_STACK_SIZ * sizeof(rex_stack_word_type), + TIMER_PRI, + TASK_MAIN(timer), + TASK_ARGV_NIL, + TASK_IDENT(timer), + FALSE, + TASK_NODOG_RPT); + + // THIS TASK IS NOT IMPLEMENTED TO RESPOND TO THE REQUIRED + // TMC SIGNALING PROTOCOL. + + // (void) tmc_wait(TMC_ACK_SIG); + // (void) rex_clr_sigs(rex_self(), TMC_ACK_SIG); + +#endif /* FEATURE_TIMER_TASK */ +#endif /* FEATURE_USE_TIME_VU */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + /* Multi-processor SHIM layer */ +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#if defined(FEATURE_DATA_ON_APPS) && defined(FEATURE_CDMA) + TMC_VOID_FUNCTION_CALL(ds_mp_shim_modem_power_up_init); +#endif /* FEATURE_DATA_ON_APPS */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /* If FEATURE_PROGRESSIVE_BOOT is defined, then the time tick interrupt is + serviced in the task context. The interrupt task should be started + before enabling the interrupt so that the task is running when an + interrupt accurrs +*/ + +#if defined(FEATURE_PROGRESSIVE_BOOT) && !defined(FEATURE_TIMER_TASK) + + tmc_define_tasks_common(_TASK_INFO_P(interrupt), DOG_INTERRUPT_RPT); + +#endif /* FEATURE_PROGRESSIVE_BOOT && !FEATURE_TIMER_TASK */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + TMC_VOID_FUNCTION_CALL(sleepctl_init); /* Initialize Sleep controller */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + gpio_int_init(); /* Initialize GPIO interrupt handler*/ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + _enable(); /* Enable interrupts and start processing. */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef TMC_HW_INIT + hw_init(0); /* Miscellaneous hardware initialization */ +#endif /* TMC_HW_INIT */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + TMC_VOID_FUNCTION_CALL(tlmm_init); /* Initialize the TLMM. */ + +#ifdef FEATURE_SENSORS + + /* The I2C attach on the modem processor must happen before any I2C access + * on the apps processor. Linux doesn't have capability to allocate + * remote-lock since the lock (ie DAL I2C remote lock for I2C, DAL SPI + * remote lock for SPI) is internal data-structures of DAL drivers and + * there is no DAL framework in Linux kernel to see those data structure + * of DAL drivers. If Linux doesn't see the lock during boot-up, it will + * not allocate the remote-lock and we may run into concurrency issue. + */ + + TMC_VOID_FUNCTION_CALL(snsd_i2c_init); /* Attach the Sensors I2C */ + +#endif /* FEATURE_SENSORS */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + //lesp sbi_init( SBI_9p6MHZ ); + sbi_init( SBI_DEFAULT_FREQ ); + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if defined(FEATURE_PM1000) || defined(FEATURE_PM1000_LDO_ONLY) +#error code not present +#endif + +#ifdef FEATURE_PMIC + { + pm_mpp_dlogic_lvl_type mpp3_levels [2] = {PM_MPP__DLOGIC__LVL_MSMP, PM_MPP__DLOGIC__LVL_VDD}; + + pm_mpp_dlogic_out_ctrl_type mpp3_ctrls [2] = {PM_MPP__DLOGIC_OUT__CTRL_LOW, PM_MPP__DLOGIC_OUT__CTRL_HIGH}; + + pm_mpp_dlogic_lvl_type mpp4_levels [1] = {PM_MPP__DLOGIC__LVL_MMC}; + + pm_mpp_dlogic_out_ctrl_type mpp4_ctrls [2] = {PM_MPP__DLOGIC_OUT__CTRL_LOW, PM_MPP__DLOGIC_OUT__CTRL_HIGH}; + +#ifdef FEATURE_WCDMA_PLT +#error code not present +#endif /* FEATURE_WCDMA_PLT */ + { + pm_init(); /* Please look at dependency notes inside the function before move around those code */ + pm_init_delayed(); + } + + pm_config_secure_mpp_config_digital_output (PM_MPP_3, mpp3_levels, 2, mpp3_ctrls, 2); + pm_config_secure_mpp_config_digital_output (PM_MPP_4, mpp4_levels, 1, mpp4_ctrls, 2); + +#ifdef FEATURE_APPS_IMAGE_WINMOB + /* Temporary hack to enable the USBH core until the WM driver does this properly. */ + (void)pm_mpp_config_digital_output(PM_MPP_19, /* RESET */ + PM_MPP__DLOGIC__LVL_VDD, + PM_MPP__DLOGIC_OUT__CTRL_HIGH); + + (void)pm_mpp_config_digital_output(PM_MPP_20, /* VBUS2_BOOST */ + PM_MPP__DLOGIC__LVL_VDD, + PM_MPP__DLOGIC_OUT__CTRL_HIGH); +#endif + +#ifdef FEATURE_BF3_SD_CONTROLLER + (void) pm_mpp_config_digital_output( PM_MPP_3, PM_MPP__DLOGIC__LVL_VDD, + PM_MPP__DLOGIC_OUT__CTRL_HIGH); +#endif + +#if defined(SIRIUS_PLATFORM) && defined(WOLF_5) +#error code not present +#endif /* defined(SIRIUS_PLATFORM) && defined(WOLF_5) */ + + } +#endif /* FEATURE_PMIC */ + +#ifdef FEATURE_HS_DETECT_BASEBAND_TYPE +#ifndef FEATURE_BRINGUP_DIAG_ONLY + TMC_VOID_FUNCTION_CALL(hs_get_baseband_version); /* Read PCB ID after pm_init() */ +#endif +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + +#ifdef FEATURE_PMIC_RTC + /* Initialization for RTC */ +#ifndef FEATURE_BRINGUP_DIAG_ONLY + clk_rtc_init(); +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ +#endif /* FEATURE_PMIC_RTC */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef TMC_I2C_INIT +#ifndef FEATURE_I2C_DIRECT_ON_ARM11 + TMC_VOID_FUNCTION_CALL(i2c_init); /* I2C driver */ +#endif +#endif +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + +#ifdef FEATURE_I2C_NPA + i2c_npa_target_init(); +#endif + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY + + TMC_VOID_FUNCTION_CALL(adc_init); + +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + sio_init(); /* Initialize SIO */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#if defined(FEATURE_DATA_ON_APPS) && (defined(FEATURE_WCDMA) || defined(FEATURE_GSM)) + TMC_VOID_FUNCTION_CALL(dsmp_umts_modem_l2_initialize); +#endif /* FEATURE_DATA_ON_APPS */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + +#if defined(FEATURE_USB) && !defined(FEATURE_NO_USB_HW_ON_PROCESSOR) +#ifdef FEATURE_USB_HOST + TMC_VOID_FUNCTION_CALL(usbhost_api_init); /* Initialize USB host API */ +#endif +#endif + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_APS + TMC_VOID_FUNCTION_CALL(aps_init); /* Initialize APS */ +#endif /* FEATURE_APS */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +#define FEATURE_NO_UIM +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#if (defined( FEATURE_UIM_DRIVER ) && !defined(FEATURE_GSM_PLT)) +#ifndef FEATURE_NO_UIM + TMC_VOID_FUNCTION_CALL(uim_dev_init); /* UIM driver */ +#endif +#endif /* FEATURE_UIM_DRIVER && !FEATURE_GSM_PLT*/ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_BATTERY_CHARGER + tmc_chg_init(); +#endif +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + /* Mode Specific Initialization */ + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + /* 1x specific */ + + /* GSM specific */ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_WCDMA +#if (!defined(FEATURE_WCDMA_PLT) && !defined(FEATURE_GSM_PLT) && !defined(FEATURE_MVS)) + TMC_VOID_FUNCTION_CALL(wvs_init); /* initialize Voice services */ +#endif /* !FEATURE_WCDMA_PLT && !FEATURE_MVS*/ +#endif /* FEATURE_WCDMA */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#if (defined(FEATURE_WLAN) && !defined(FEATURE_MULTIPROCESSOR)) + TMC_VOID_FUNCTION_CALL(wlan_adp_init); /* Initialize the WLAN Adapter library */ +#endif /* FEATURE_WLAN && !FEATURE_MULTIPROCESSOR */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#if (defined(FEATURE_FACTORY_TESTMODE) && !defined(FEATURE_FTM_TASK)) + TMC_VOID_FUNCTION_CALL(ftm_tmc_init); /* ftm initializaiton that has to be done in TMC task. */ +#endif /* FEATURE_FACTORY_TESTMODE && ! FEATURE_FTM_TASK */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + TMC_VOID_FUNCTION_CALL(tmcdiag_init); /* Register TMC dispatch table through diag interface */ + +#ifdef FEATURE_PROFDIAG +#error code not present +#endif + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_L4LINUX + if (qids_smms_init(SMMS_DEAFULT_SERVER_PRIORITY) == SMMS_STATUS_SUCCESS) /* Init SMMS Library */ + { + /* Start a loopback server in background */ + qids_smms_start_loopback_server(SMMS_LOOPBACK_SERVER_PRIORITY, + SMMS_SERVICE_ECHO1); + } +#endif + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_CBSP_TEST + TMC_VOID_FUNCTION_CALL(apttests_daltf_init); /* Initialize apttests */ +#endif +} /* tmc_order_0_init */ + +/*=========================================================================== + +FUNCTION tmc_order_0_exec + This function creates all the software tasks with the rex_def_task + procedure. After a task has been created it sets the TMC_ACK_SIG to + communicate to the Task Main Control task that it has completed static + initialization. This procedure waits to receive the TMC_ACK_SIG before + creating the next software task. + +DEPENDENCIES + The watchdog task resetting the Watchdog timer while attempting to + start all other tasks. If the unable to create other tasks in the time + allotted by the Watchdog task, the Watchdog task will log the error and + reset the microprocessor. + +RETURN VALUE + void + +SIDE EFFECTS + After this procedure all the tasks in the Software system will have + performed preliminary initialization and will be waiting for the + startup signal from the Main Control task. + +===========================================================================*/ +static void tmc_order_0_exec(void) +{ + /* Enable and disable autodog for MC as a way of getting the dog report + ** id into the TCB. + */ + (void) rex_autodog_enable( DOG_TMC_RPT ); + (void) rex_autodog_disable( ); + +#ifdef FEATURE_SOFTWARE_PROFILE +#ifdef FEATURE_MSMHWIO + rex_init_profile( HWIO_ADDR(TIME_TICK2_COUNT) ); +#else + rex_init_profile( TIME_TICK2_COUNT_WH ); +#endif /* FEATURE_MSMHWIO */ +#endif + +#ifdef TIMETEST +#ifdef TIMETEST_PROF + TMC_VOID_FUNCTION_CALL(timetest_prof_init); +#endif /* TIMETEST_PROF */ +#endif /* TIMETEST*/ + + (void) rex_clr_sigs(rex_self(), TMC_ACK_SIG); /* Clear ACK signal. */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + /* If FEATURE_PROGRESSIVE_BOOT is defined, then the pager task should be + started as early as possible to reduce the number of page faults + handled in abort context +*/ +#ifdef FEATURE_PROGRESSIVE_BOOT + + rex_def_task_ext2(TASK_HANDLE(pager), + (unsigned char*)TASK_STACK(pager), + PAGER_STACK_SIZ * sizeof(rex_stack_word_type), + PAGER_PRI, + TASK_MAIN(pager), + TASK_ARGV_NIL, + TASK_IDENT(pager), + FALSE, + TASK_NODOG_RPT); + + // THIS TASK IS NOT IMPLEMENTED TO RESPOND TO THE REQUIRED + // TMC SIGNALING PROTOCOL. + + // (void) tmc_wait(TMC_ACK_SIG); + // (void) rex_clr_sigs(rex_self(), TMC_ACK_SIG); + +#endif /* FEATURE_PROGRESSIVE_BOOT */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + tmc_define_tasks_common(_TASK_INFO_P(sleep), DOG_SLEEP_RPT); + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +#if ! defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_APPS_TCXO_SLEEP + + tmc_define_tasks_common(_TASK_INFO_P(dem), TASK_NODOG_RPT); + +#endif /* FEATURE_APPS_TCXO_SLEEP */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_SMD + + tmc_define_tasks_common(_TASK_INFO_P(smd), TASK_NODOG_RPT); + +#endif /*FEATURE_SMD*/ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_ONCRPC + + tmc_define_tasks_common(_TASK_INFO_P(oncrpc), TASK_NODOG_RPT); + +#ifdef FEATURE_STA + + tmc_define_tasks_common(_TASK_INFO_P(sta), TASK_NODOG_RPT); + +#endif /* FEATURE_STA */ + +#endif /* FEATURE_ONCRPC */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_DOG + + tmc_define_tasks_common(_TASK_INFO_P(dog), TASK_NODOG_RPT); + +#endif /* FEATURE_DOG */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef SIRIUS_PLATFORM +#error code not present +#endif /* SIRIUS_PLATFORM */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_QDSP_TASK + + tmc_define_tasks_common(_TASK_INFO_P(qdsp), DOG_QDSP_RPT); + +#endif /* FEATURE_QDSP_TASK */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_QDSP_RTOS + + tmc_define_tasks_common(_TASK_INFO_P(adsp_rtos), DOG_ADSP_RTOS_RPT); + +#endif /* FEATURE_ADSP_RTOS_TASK */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_VOC_TASK + + tmc_define_tasks_common(_TASK_INFO_P(voc), DOG_VOC_RPT); + +#endif /* FEATURE_VOC_TASK */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_SND_TASK + + tmc_define_tasks_common(_TASK_INFO_P(snd), DOG_SND_RPT); + +#endif /* FEATURE_SND_TASK */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if ! defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_AVS_SBCENC_TASK + + tmc_define_tasks_common(_TASK_INFO_P(sbcenc), DOG_SBCENC_RPT); + +#endif /* FEATURE_AVS_SBCENC_TASK */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if ! defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#if !defined(FEATURE_THIN_UI) && !defined(FEATURE_UI_CORE_REMOVED) || defined(FEATURE_HS_POLLING_ON_MODEM) + +#ifdef FEATURE_HS + + tmc_define_tasks_common(_TASK_INFO_P(hs), DOG_HS_RPT); + +#endif /* FEATURE_HS */ + +#endif /* !defined(FEATURE_THIN_UI) && !defined(FEATURE_UI_CORE_REMOVED) || defined(FEATURE_HS_POLLING_ON_MODEM)*/ + +#if defined(FEATURE_PMIC) && !defined(FEATURE_KEYPAD_USES_GPIO_FOR_PWR_KEY) + /* Initialize the Power Key. Without this, PMIC will not send an + * IRQ to MSM when power key is pressed */ + TMC_VOID_FUNCTION_CALL(pm_pwr_key_init); +#endif + +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_IS2000_TDSO + + tmc_define_tasks_common(_TASK_INFO_P(tdso), DOG_TDSO_RPT); + +#endif /* FEATURE_IS2000_TDSO */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_IDS +#error code not present +#endif /* FEATURE_IDS */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_EFS + + tmc_define_tasks_common(_TASK_INFO_P(fs), DOG_FS_RPT); + +#if (defined(FS_FEATURE_RMTEFS_SERVER)||defined(FS_FEATURE_IG_IPC_SERVER)) && !defined(FEATURE_IG_EFS_EXT_SERVER) + + tmc_define_tasks_common(_TASK_INFO_P(efs_srvr), DOG_FS_RPT); + +#endif /* FS_FEATURE_RMTEFS_SERVER && !FEATURE_IG_EFS_EXT_SERVER */ +#endif /* FEATURE_EFS */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_EFS_SFAT + + tmc_define_tasks_common(_TASK_INFO_P(sfat), DOG_SFAT_RPT); + +#endif /* FEATURE_EFS_SFAT */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_SEC_PROCESS_INIT +#ifdef FEATURE_IXFILESVC + + tmc_define_tasks_common(_TASK_INFO_P(ix_filesvc), TASK_NODOG_RPT); + +#endif /* FEATURE_IXFILESVC */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_IXSQLSVC + + tmc_define_tasks_common(_TASK_INFO_P(ix_sqlclnt), TASK_NODOG_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(ix_sqlsvc), TASK_NODOG_RPT); + +#endif /* FEATURE_IXSQLSVC */ +#endif /* !FEATURE_SEC_PROCESS_INIT */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_NV + + tmc_define_tasks_common(_TASK_INFO_P(nv), DOG_NV_RPT); + +#endif /* FEATURE_NV */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef TMC_1X + + tmc_define_tasks_common(_TASK_INFO_P(tx), DOG_TX_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(rx), DOG_RX_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(srch), DOG_SRCH_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(rxtx), DOG_RXTX_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(mc), DOG_MC_RPT); + +#endif /* TMC_1X */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_CM + + tmc_define_tasks_common(_TASK_INFO_P(cm), DOG_CM_RPT); + +#endif /* FEATURE_CM */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) && !defined(FEATURE_COREIMG) +#ifdef FEATURE_MULTIMODE_ARCH + + tmc_define_tasks_common(_TASK_INFO_P(mmoc), DOG_MMOC_RPT); + +#endif /* FEATURE_MULTIMODE_ARCH */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY && FETURE_COREIMG */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_HDR + + tmc_define_tasks_common(_TASK_INFO_P(hdrmc), DOG_HDRMC_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(hdrtx), DOG_HDRTX_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(hdrrx), DOG_HDRRX_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(hdrsrch), DOG_HDRSRCH_RPT); + +#endif /* FEATURE_HDR */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_HDR_BCMCS + + tmc_define_tasks_common(_TASK_INFO_P(hdrbc), DOG_HDRBC_RPT); + +#endif /* FEATURE_HDR_BCMCS */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#if defined( FEATURE_BT ) && !defined(IMAGE_MODEM_PROC) + + tmc_define_tasks_common(_TASK_INFO_P(bt), DOG_BT_RPT); + +#ifdef FEATURE_BT_EXTPF + + tmc_define_tasks_common(_TASK_INFO_P(bt_pf), DOG_BT_PF_RPT); + +#endif /* FEATURE_BT_EXTPF */ + +#ifdef FEATURE_BT_FS_TASK + + tmc_define_tasks_common(_TASK_INFO_P(bt_fs), DOG_BT_FS_RPT); + +#endif /* FEATURE_BT_FS_TASK */ + +#endif /* FEATURE_BT && !IMAGE_MODEM_PROC */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_FM + + tmc_define_tasks_common(_TASK_INFO_P(fmrds), TASK_NODOG_RPT); + +#endif /* FEATURE_FM */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + +#ifdef FEATURE_BT_FTM_TASK + + tmc_define_tasks_common(_TASK_INFO_P(bt_ftm), TASK_NODOG_RPT); + +#endif /* FEATURE_BT_FTM_TASK */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_UI + + tmc_define_tasks_common(_TASK_INFO_P(ui), DOG_UI_RPT); + +#endif /* FEATURE_UI */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_NV_CNV + + tmc_define_tasks_common(_TASK_INFO_P(cnv), DOG_CNV_RPT); +#endif /* FEATURE_NV_CNV */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_DIAG_TASK + + tmc_define_tasks_common(_TASK_INFO_P(diag), DOG_DIAG_RPT); + +#ifdef FEATURE_GSM + event_report(EVENT_POWERUP); +#endif /* FEATURE_GSM */ + +#endif /* FEATURE_DIAG_TASK */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_IG_QDIAG + + tmc_define_tasks_common(_TASK_INFO_P(qdiag), DOG_QDIAG_RPT); + +#endif /* FEATURE_IG_QDIAG */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_SEC_PROCESS_INIT + + tmc_define_tasks_common(_TASK_INFO_P(ix_contentsvc), TASK_NODOG_RPT); + +#else + +#ifdef FEATURE_IXHTTPSVC + + tmc_define_tasks_common(_TASK_INFO_P(ix_httpsvc), DOG_IXHTTPSVC_RPT); + +#endif /* FEATURE_IXHTTPSVC */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_IXTIMESVC + + tmc_define_tasks_common(_TASK_INFO_P(ix_timesvc), TASK_NODOG_RPT); + +#endif /* FEATURE_IXTIMESVC */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_IXCONTENTSVC + + tmc_define_tasks_common(_TASK_INFO_P(ix_contentclnt), TASK_NODOG_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(ix_contentsvc), TASK_NODOG_RPT); + +#endif /* FEATURE_IXCONTENTSVC */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_IXDESCRAMBLERSVC + + tmc_define_tasks_common(_TASK_INFO_P(ix_descramblersvc), TASK_NODOG_RPT); + +#endif /* FEATURE_IXDESCRAMBLERSVC */ +#endif /* FEATURE_SEC_PROCESS_INIT */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_SEC +#ifndef FEATURE_SEC_PROCESS_INIT + + tmc_define_tasks_common(_TASK_INFO_P(sec), DOG_SEC_RPT); + +#ifdef FEATURE_SEC_CONTENT_AGENT + + tmc_define_tasks_common(_TASK_INFO_P(contentagentdiag), TASK_NODOG_RPT); + +#endif /* FEATURE_SEC_CONTENT_AGENT */ +#ifdef FEATURE_SECRND + + tmc_define_tasks_common(_TASK_INFO_P(secrnd), DOG_SECRND_RPT); + +#endif /* FEATURE_SECRND */ +#ifdef FEATURE_SEC_ARM_CRYPTO + + tmc_define_tasks_common(_TASK_INFO_P(seccryptarm), DOG_SECCRYPTARM_RPT); + +#endif /* FEATURE_SEC_ARM_CRYPTO */ +#ifdef FEATURE_SEC_USFS + + tmc_define_tasks_common(_TASK_INFO_P(sfs), DOG_SFS_RPT); + +#endif /* FEATURE_SEC_USFS */ +#endif /* FEATURE_SEC_PROCESS_INIT */ +#ifdef FEATURE_SSD + + tmc_define_tasks_common(_TASK_INFO_P(ssd), 0); + +#endif /* FEATURE_SSD */ +#ifdef FEATURE_SEC_SSL +#ifndef FEATURE_DATA_ON_APPS + + tmc_define_tasks_common(_TASK_INFO_P(secssl), DOG_SECSSL_RPT); + +#endif /* !FEATURE_DATA_ON_APPS */ +#endif /* FEATURE_SEC_SSL */ + +#if defined(FEATURE_SEC_SSL_TESTAPP) || defined(FEATURE_SEC_CRYPT_TESTAPP) + + tmc_define_tasks_common(_TASK_INFO_P(sectestapp), TASK_NODOG_RPT); + +#endif /* FEATURE_SEC_SSL_TESTAPP || FEATURE_SEC_CRYPT_TESTAPP */ + +#ifdef FEATURE_SEC_IPSEC + + tmc_define_tasks_common(_TASK_INFO_P(secips), DOG_SECIPS_RPT); + +#endif /* FEATURE_SEC_IPSEC */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef T_RUMI +#ifdef FEATURE_SEC_DRM + + tmc_define_tasks_common(_TASK_INFO_P(secdrm), DOG_SECDRM_RPT); + +#endif /* FEATURE_SEC_DRM */ +#endif /* ! T_RUMI */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#endif /* FEATURE_SEC */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_DS_SOCKETS_TEST_TCP +#error code not present +#endif /* FEATURE_DS_SOCKETS_TEST_TCP */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_DS_SOCKETS_TEST_UDP +#error code not present +#endif /* FEATURE_DS_SOCKETS_TEST_UDP */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_QMIP +#error code not present +#endif /* FEATURE_QMIP */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#if defined(FEATURE_AUTH) || defined(FEATURE_RUIM) + + tmc_define_tasks_common(_TASK_INFO_P(auth), DOG_AUTH_RPT); + +#endif /*FEATURE_AUTH || FEATURE_RUIM */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#if (defined( FEATURE_UIM ) && ! defined(FEATURE_GSM_PLT) ) + + tmc_define_tasks_common(_TASK_INFO_P(uim), DOG_UIM_RPT); + +#endif /* FEATURE_UIM */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_MMGSDI + + tmc_define_tasks_common(_TASK_INFO_P(gsdi), DOG_GSDI_RPT); + +#endif /* FEATURE_MMGSDI */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#if defined(FEATURE_GSTK) && defined(FEATURE_VIRTUAL_SAT) + + tmc_define_tasks_common(_TASK_INFO_P(virtsat), DOG_VIRTSAT_RPT); + +#endif /* #if defined(FEATURE_GSTK) && defined(FEATURE_VIRTUAL_SAT) */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_GSTK + + tmc_define_tasks_common(_TASK_INFO_P(gstk), DOG_GSTK_RPT); + +#endif /* FEATURE_GSTK */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_DH + + tmc_define_tasks_common(_TASK_INFO_P(dh), DOG_DH_RPT); + +#endif /* FEATURE_DH */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_GRAPH_TASK + + tmc_define_tasks_common(_TASK_INFO_P(graph), DOG_GRAPH_RPT); + +#endif /* FEATURE_GRAPH_TASK */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_GFX_TASK + + tmc_define_tasks_common(_TASK_INFO_P(gfx), DOG_GFX_RPT); + +#endif /* FEATURE_GFX_TASK */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_CAMERA_DRV_TASK + + tmc_define_tasks_common(_TASK_INFO_P(camera_drv), DOG_CAMERA_DRV_RPT); + +#endif /* FEATURE_CAMERA_DRV_TASK */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_VS_TASK + + tmc_define_tasks_common(_TASK_INFO_P(vs), DOG_VS_RPT); + +#endif /* FEATURE_VS_TASK */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#if defined(FEATURE_USB) && !defined(FEATURE_NO_USB_HW_ON_PROCESSOR) + + tmc_define_tasks_common(_TASK_INFO_P(usbdc), DOG_USBDC_RPT); + +#ifdef FEATURE_USB_HOST_ENHANCED + + tmc_define_tasks_common(_TASK_INFO_P(usbhc_urb), DOG_USBHC_URB_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(usbhc_dev), DOG_USBHC_DEV_RPT); + +#if defined(FEATURE_USB_HOST_TEST_ENHANCED) && (defined(FEATURE_USB_HOST_MASS_STORAGE_TEST_ENHANCED) || defined(FEATURE_USB_HOST_HID_TEST_ENHANCED)) + + tmc_define_tasks_common(_TASK_INFO_P(usbhc_test), DOG_USBHC_TEST_RPT); + +#endif + +#endif /* FEATURE_USB_HOST_ENHANCED */ + +#endif /* FEATURE_USB */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#if (defined(FEATURE_GSM) && !defined(FEATURE_WCDMA_PLT) && !defined(FEATURE_GSM_PLT)) + + tmc_define_tasks_common(_TASK_INFO_P(gsm_l1), DOG_GSM_L1_RPT); + +#ifndef FEATURE_GSM_PLT + + tmc_define_tasks_common(_TASK_INFO_P(gsm_l2), DOG_GSM_L2_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(rr), DOG_RR_RPT); + +#endif /* !FEATURE_GSM_PLT*/ + +#ifdef FEATURE_GSM_GPRS + + tmc_define_tasks_common(_TASK_INFO_P(gprs_mac), DOG_GMAC_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(gprs_rlc_ul), DOG_GRLC_UL_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(gprs_rlc_dl), DOG_GRLC_DL_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(gprs_llc), DOG_GLLC_RPT); + +#endif /* FEATURE_GSM_GPRS */ + +#endif /* FEATURE_GSM && !FEATURE_WCDMA_PLT */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_NAS + + tmc_define_tasks_common(_TASK_INFO_P(mm), DOG_MM_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(reg), DOG_REG_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(mn_cnm), DOG_MN_CNM_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(sm), DOG_SM_RPT); + +#ifdef FEATURE_GSM_CB + + tmc_define_tasks_common(_TASK_INFO_P(cb), DOG_MM_RPT); + +#endif /* #ifdef FEATURE_GSM_CB */ + +#endif /* FEATURE_NAS */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#if ( defined(FEATURE_CDSMS) || defined(FEATURE_GWSMS) ) + + tmc_define_tasks_common(_TASK_INFO_P(wms), DOG_WMS_RPT); + +#endif /* FEATURE_CDSMS || FEATURE_GWSMS */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_MDSP_TASK + + tmc_define_tasks_common(_TASK_INFO_P(mdsp), DOG_MDSP_RPT); + +#endif /* FEATURE_MDSP_TASK */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_TIME_IPC_TASK + + tmc_define_tasks_common(_TASK_INFO_P(time_ipc), TASK_NODOG_RPT); + +#endif /* FEATURE_TIME_IPC_TASK */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_VIRTUAL_SIM + + tmc_define_tasks_common(_TASK_INFO_P(gsdi_uim_server), TASK_NODOG_RPT); + +#endif /* ifdef FEATURE_VIRTUAL_SIM */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_WCDMA +#ifndef FEATURE_GSM_PLT + + tmc_define_tasks_common(_TASK_INFO_P(wcdma_l1), DOG_L1_RPT); + +#endif + +#if ( !defined( FEATURE_WCDMA_PLT) && !defined(FEATURE_GSM_PLT) ) + + tmc_define_tasks_common(_TASK_INFO_P(wcdma_l2_ul), DOG_L2UL_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(wcdma_l2_dl), DOG_L2DL_RPT); + +#ifdef FEATURE_HSDPA + + tmc_define_tasks_common(_TASK_INFO_P(wcdma_mac_hs_dl), DOG_MAC_HS_DL_RPT); + +#endif + + tmc_define_tasks_common(_TASK_INFO_P(rrc), DOG_RRC_RPT); + +#endif /* !FEATURE_WCDMA_PLT */ +#endif /* FEATURE_WCDMA */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#if ( defined(FEATURE_WCDMA_VST_FULLSTACK) || defined(FEATURE_WCDMA_VST_AS)) + + tmc_define_tasks_common(_TASK_INFO_P(al1), TASK_NODOG_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(menu), TASK_NODOG_RPT); + +#endif /* FEATURE_WCDMA_VST_FULLSTACK || FEATURE_WCDMA_VST_AS */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_VBATT_TASK + + tmc_define_tasks_common(_TASK_INFO_P(vbatt), DOG_VBATT_RPT); + +#endif /* FEATURE_VBATT_TASK */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +#ifdef FEATURE_CTA + + tmc_define_tasks_common(_TASK_INFO_P(cta), dyn_dog_cta_rpt); + +#endif /* FEATURE_CTA_TASK */ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_TC + + tmc_define_tasks_common(_TASK_INFO_P(tc), DOG_TC_RPT); + +#endif /* FEATURE_TC */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_WCDMA_VST_AS + + tmc_define_tasks_common(_TASK_INFO_P(rrcut), TASK_NODOG_RPT); + +#endif /*FEATURE_WCDMA_VST_AS*/ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_WCDMA_PLT /* FEATURE_WPLT_TASK */ +#error code not present +#endif /*FEATURE_WCDMA_PLT*/ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + +#if ! defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_GSM_PLT /* FEATURE_GSM_PLT_TASK */ +#error code not present +#endif /*FEATURE_GSM_PLT*/ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#if (defined(FEATURE_WLAN) && !defined(FEATURE_MULTIPROCESSOR)) + + tmc_define_tasks_common(_TASK_INFO_P(wlan_cp), DOG_WLAN_CP_RPT); + +#endif /* FEATURE_WLAN && !FEATURE_MULTIPROCESSOR */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_DATA +#ifndef FEATURE_DATA_ON_APPS +#ifdef FEATURE_DATA_PS + + tmc_define_tasks_common(_TASK_INFO_P(ps), DOG_PS_RPT); + +#ifdef FEATURE_DATA_PS_DCC + + tmc_define_tasks_common(_TASK_INFO_P(dcc), DOG_DCC_RPT); + +#endif /* FEATURE_DATA_PS_DCC */ + +#ifdef FEATURE_DATA_PS_SOCK_REARCH + + tmc_define_tasks_common(_TASK_INFO_P(ds_sig), TASK_NODOG_RPT); + +#endif /* FEATURE_DATA_PS_SOCK_REARCH */ + +#ifdef FEATURE_DATA_MUX +#error code not present +#endif /* FEATURE_DATA_MUX */ + +#endif /* FEATURE_DATA_PS */ + + tmc_define_tasks_common(_TASK_INFO_P(ds), DOG_DS_RPT); + +#endif /* !FEATURE_DATA_ON_APPS */ + +#if (defined(FEATURE_GAN) && !(defined(IMAGE_APPS_PROC))) +#error code not present +#endif + +#ifdef FEATURE_GAN +#error code not present +#endif /* FEATURE_GAN */ + +#ifdef FEATURE_COMP_TASK + + tmc_define_tasks_common(_TASK_INFO_P(comp), DOG_COMP_RPT); + +#endif /* FEATURE_COMP_TASK */ + +#if ( (defined(FEATURE_DATA_GCSD) || defined(FEATURE_DATA_WCDMA_CS)) && !defined(FEATURE_WCDMA_PLT) && !defined(FEATURE_GSM_PLT) ) + + tmc_define_tasks_common(_TASK_INFO_P(Gcsd), DOG_GCSD_RPT); + +#endif /* (FEATURE_DATA_GCSD || FEATURE_DATA_WCDMA_CS) && !FEATURE_WCDMA_PLT */ + +#ifndef FEATURE_DATA_ON_APPS + +#ifdef FEATURE_WCDMA /* ) && ( defined FEATURE_DATA_WCDMA_CS ) ) */ + + tmc_define_tasks_common(_TASK_INFO_P(dswcsd_ul), TASK_NODOG_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(dswcsd_dl), TASK_NODOG_RPT); + +#endif /* FEATURE_WCDMA */ + +#endif /* !FEATURE_DATA_ON_APPS */ + +#endif /* FEATURE_DATA */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + /* Create WLAN Data Service task */ +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#if (defined(FEATURE_WLAN) && !defined(FEATURE_MULTIPROCESSOR)) + + tmc_define_tasks_common(_TASK_INFO_P(wlan_ds), DOG_WLAN_DS_RPT); + +#endif /* (defined(FEATURE_WLAN) && !defined(FEATURE_MULTIPROCESSOR)) */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +#if ! defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#if (defined(FEATURE_WLAN) && !defined(FEATURE_MULTIPROCESSOR)) + + tmc_define_tasks_common(_TASK_INFO_P(wlan_trp), DOG_WLAN_TRP_RPT); + +#endif /* FEATURE_WLAN && !FEATURE_MULTIPROCESSOR */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if (defined(FEATURE_WLAN) && !defined(FEATURE_MULTIPROCESSOR)) + + tmc_define_tasks_common(_TASK_INFO_P(wlan_sec), DOG_WLAN_SEC_RPT); + +#endif /* FEATURE_WLAN && !FEATURE_MULTIPROCESSOR */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if (defined(FEATURE_CGPS) && !defined(FEATURE_DISABLE_CGPS)) + + tmc_define_tasks_common(_TASK_INFO_P(mgpmc), DOG_MGPMC_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(cc), DOG_CC_RPT); + +#ifdef FEATURE_CGPS_PGI_TASK + + tmc_define_tasks_common(_TASK_INFO_P(pgi), DOG_PGI_RPT); + +#endif /* FEATURE_CGPS_PGI_TASK */ + + tmc_define_tasks_common(_TASK_INFO_P(pp), DOG_PP_RPT); + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_XO + + tmc_define_tasks_common(_TASK_INFO_P(tcxomgr), DOG_TCXOMGR_RPT); + +#endif /* FEATURE_XO */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /* ---------------------------------------------------------------------- */ + + tmc_define_tasks_common(_TASK_INFO_P(cd), DOG_CD_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(nf), DOG_NF_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(gps_fs), TASK_NODOG_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(gpsfft), DOG_GPSFFT_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(lm), DOG_LM_RPT); + + tmc_define_tasks_common(_TASK_INFO_P(sm_tm), DOG_SM_TM_RPT); + +#ifdef FEATURE_CGPS_PD_COMMS_TCP_ON_MODEM + + tmc_define_tasks_common(_TASK_INFO_P(pdcommtcp), DOG_PDCOMMTCP_RPT); + +#endif /* !FEATURE_DATA_ON_APPS */ + + tmc_define_tasks_common(_TASK_INFO_P(pdcommwms), DOG_PDCOMMWMS_RPT); + +#ifdef FEATURE_CGPS_LOC_MIDDLEWARE + + tmc_define_tasks_common(_TASK_INFO_P(loc_middleware), DOG_LOC_MIDDLEWARE_RPT); + +#endif // FEATURE_CGPS_LOC_MIDDLEWARE + +#endif /* FEATURE_CGPS */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_FTM_TASK + + tmc_define_tasks_common(_TASK_INFO_P(ftm), DOG_FTM_RPT); + +#endif /* FEATURE_FTM_TASK */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_CHG_TASK + + tmc_define_tasks_common(_TASK_INFO_P(chg), DOG_CHG_RPT); + +#endif /* FEATURE_CHG_TASK */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_BCMCS + + tmc_define_tasks_common(_TASK_INFO_P(bcdb), DOG_BCDB_RPT); + +#endif /* FEATURE_BCMCS */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_DTV + + tmc_define_tasks_common(_TASK_INFO_P(dtv), DOG_DTV_RPT); + +#endif /* FEATURE_DTV */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_JOYST_TASK + + tmc_define_tasks_common(_TASK_INFO_P(joyst), DOG_JOYST_RPT); + +#endif /* FEATURE_JOYST_TASK */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_PBM_TASK + + tmc_define_tasks_common(_TASK_INFO_P(pbm), DOG_PBM_RPT); + +#endif /* FEATURE_PBM_TASK */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + +#ifdef FEATURE_CPU_BASED_FLOW_CONTROL + + tmc_define_tasks_common(_TASK_INFO_P(fc), DOG_FC_RPT); + +#endif /* FEATURE_CPU_BASED_FLOW_CONTROL_TASK */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef SIRIUS_PLATFORM +#error code not present +#endif /* SIRIUS_PLATFORM */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_PM_SERVER + + tmc_define_tasks_common(_TASK_INFO_P(pms), DOG_PMS_RPT); + +#endif /* FEATURE_PM_SERVER */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_APS + + tmc_define_tasks_common(_TASK_INFO_P(aps), DOG_APS_RPT); + +#endif /* FEATURE_APS */ + +#ifdef FEATURE_ATS + + tmc_define_tasks_common(_TASK_INFO_P(ats), DOG_ATS_RPT); + +#endif /* FEATURE_ATS */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_QIPCALL + + tmc_define_tasks_common(_TASK_INFO_P(qipcall), DOG_QIPCALL_RPT); + +#endif /* FEATURE_QIPCALL */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_MFLO +#error code not present +#endif /* FEATURE_MFLO */ + +#ifdef FEATURE_UBM_L1 + + tmc_define_tasks_common(_TASK_INFO_P(ubm_l1), DOG_UBM_L1_RPT); + +#endif /* FEATURE_UBM_L1 */ + +#if (defined(FEATURE_DISP_TASK)) && (!defined(T_MSM7500) || (defined(T_MSM7500) && defined(IMAGE_APPS_PROC))) + + tmc_define_tasks_common(_TASK_INFO_P(disp), DOG_DISP_RPT); + +#endif /* FEATURE_DISP_TASK */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +#ifdef FEATURE_FTM_CAMERA_TASK + + tmc_define_tasks_common(_TASK_INFO_P(ftm_camera), DOG_FTM_CAMERA_RPT); + +#endif /*FEATURE_FTM_CAMERA_TASK */ + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if defined(FEATURE_HS_USB) && (defined(FEATURE_STANDALONE_MODEM) || !defined(FEATURE_NO_USB_HW_ON_PROCESSOR)) + +#define HSU_AL_TASK_STACK_SIZ TASK_STACK_SIZ(AL_TASK_STACK_SIZE_IN_BYTES) + + rex_def_task_ext2(TASK_HANDLE(hsu_al_task), + (unsigned char*)TASK_STACK(hsu_al_task), + HSU_AL_TASK_STACK_SIZ * sizeof(rex_stack_word_type) + HSU_AL_TASK_PRI, + TASK_MAIN(hsu_al_task), + TASK_ARGV_NIL, + TASK_IDENT(hsu_al_task), + FALSE, + DOG_HSU_AL_TASK_RPT); + + (void) tmc_wait(TMC_ACK_SIG); + (void) rex_clr_sigs(rex_self(), TMC_ACK_SIG); + +#endif /* FEATURE_HS_USB && (FEATURE_STANDALONE_MODEM || !FEATURE_NO_USB_HW_ON_PROCESSOR) */ + +#if defined(FEATURE_HS_USB_MS_FD) && (defined(FEATURE_STANDALONE_MODEM) || !defined(FEATURE_NO_USB_HW_ON_PROCESSOR)) + + rex_def_task_ext2(TASK_HANDLE(hsu_al_ms), + (unsigned char*)TASK_STACK(hsu_al_ms), + HSU_AL_MS_STACK_SIZE * sizeof(rex_stack_word_type), + HSU_AL_MS_PRI, + TASK_MAIN(hsu_al_ms), + TASK_ARGV_NIL, + TASK_IDENT(hsu_al_ms), + FALSE, + DOG_HSU_AL_MS_RPT); + + (void) tmc_wait(TMC_ACK_SIG); + (void) rex_clr_sigs(rex_self(), TMC_ACK_SIG); + +#endif /* FEATURE_HS_USB_MS_FD && (FEATURE_STANDALONE_MODEM || !FEATURE_NO_USB_HW_ON_PROCESSOR) */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +#if defined(FEATURE_SENSORS) + + tmc_define_tasks_common(_TASK_INFO_P(sns), DOG_SNS_RPT); + +#endif /* FEATURE_SENSORS */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_PWRDB +#error code not present +#endif /* FEATURE_PWRDB */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + #ifdef FEATURE_DOG_KEEPALIVE_TASK + + tmc_define_tasks_common(_TASK_INFO_P(dog_keepalive), TASK_NODOG_RPT); + +#endif /* FEATURE_APPS_KEEPALIVE */ +} /* tmc_order_0_exec(void) */ + +/*=========================================================================== + +FUNCTION tmc_order_1_init + +DESCRIPTION + Perform any initializations that must be done after the tasks are defined, + but before any tasks (including the service tasks) are started. + +DEPENDENCIES + The tasks must have been defined, but not started. + +RETURN VALUE + None + +SIDE EFFECTS + None + +===========================================================================*/ +static void tmc_order_1_init(void) +{ +#ifdef DOG_DYNAMIC_API + dog_auto_register(); /* Register the legacy tasks. */ +#endif + +#if defined(T_MSM7500) && !defined(FEATURE_STANDALONE_MODEM) + /* Initialize the remote API services */ + TMC_VOID_FUNCTION_CALL(remote_apis_init); +#endif /* T_MSM7500 && ! FEATURE_STANDALONE_MODEM */ + +#if defined(FEATURE_PMIC) && defined(FEATURE_USE_TIME_VU) + /* The PMIC has been initialized, get time-of-day from the PMIC's RTC */ + TMC_VOID_FUNCTION_CALL(time_set_from_pmic); +#endif /* FEATURE_USE_TIME_VU */ +} /* tmc_order_1_init */ + +/*=========================================================================== + +FUNCTION tmc_order_2_init + +DESCRIPTION + Continue on initialization after service tasks start. This initialization + requires NV task has been started. The initialization consists of generic + initialization and mode specific initilaization. Generic refers to any HW + regardless any specific mode. Specific refers to mode related ones. + +DEPENDENCIES + TMC must have already been initialized with tmc_init_before_task_start, and + service tasks have already started. + +RETURN VALUE + boolean - Initialization success return TRUE othewise return FALSE. + +SIDE EFFECTS + None + +===========================================================================*/ +static void tmc_order_2_init(void) +{ + boolean rf_initial_status = TRUE; + +#if (defined(FEATURE_L4) && defined(FEATURE_STACKS_TCB_IN_WRITETHROUGH)) + { + extern byte *Image__ZI_STACKS__Base; + extern byte *Image__UNINIT_RAM__Base; + + thread_ref_t tIgnore; + memsection_ref_t memsection; + uint8 cachePolicy; + + /* *********************************************************** * + * Temporary change to set Write-Through cache policy from NV * + * Bit 0 - DEFAULT * + * Bit 1 - STacks in WT * + * *************************************************************/ + /* If NV item is set read the configuration otherwise leave as is default +policy which is WB */ + if (NV_DONE_S == tmcnv_read( NV_CACHE_WT_I , (nv_item_type*)&cachePolicy)) + { + if (cachePolicy == 0x1) + { + memsection = memsection_lookup((uintptr_t)Image__UNINIT_RAM__Base, &tIgnore); + if (memsection == (memsection_ref_t)0) + { + ERR_FATAL("memsection lookup failed", 0, 0, 0); + } + memsection_set_attributes(memsection, L4_WriteThroughMemory); + + memsection = memsection_lookup((uintptr_t)Image__ZI_STACKS__Base, &tIgnore); + if (memsection == (memsection_ref_t)0) + { + ERR_FATAL("memsection lookup failed", 0, 0, 0); + } + memsection_set_attributes(memsection, L4_WriteThroughMemory); + } + } + } + +#endif /*FEATURE_L4 && FEATURE_STACKS_TCB_IN_WRITETHROUGH*/ + + + { + nv_item_type nv_data_buf; /* NV data buffer */ + nv_stat_enum_type nv_read_status; /* NV read status */ + nv_read_status = tmcnv_read(NV_CGPS_NMEA_CONFIG_INFO_I,&nv_data_buf); + if(nv_read_status != NV_DONE_S) + { + nv_data_buf.cgps_nmea_config_info.nmea_port_type = 3; + nv_data_buf.cgps_nmea_config_info.nmea_reporting_type = 0; + tmcnv_write(NV_CGPS_NMEA_CONFIG_INFO_I,&nv_data_buf); + } + + //NV_RF_HW_CONFIG_I + nv_read_status = tmcnv_read(NV_RF_HW_CONFIG_I,&nv_data_buf); + if(nv_read_status != NV_DONE_S) + { + nv_data_buf.rf_hw_config = 0x18; //TRF6500 + tmcnv_write(NV_RF_HW_CONFIG_I,&nv_data_buf); + } + + //NV_RF_BC_CONFIG_I + nv_read_status = tmcnv_read(NV_RF_BC_CONFIG_I,&nv_data_buf); + if(nv_read_status != NV_DONE_S) + { + nv_data_buf.rf_bc_config = 7; + + tmcnv_write(NV_RF_BC_CONFIG_I,&nv_data_buf); + } + //NV_RF_BC_CONFIG_DIV_I + nv_read_status = tmcnv_read(NV_RF_BC_CONFIG_DIV_I,&nv_data_buf); + if(nv_read_status != NV_DONE_S) + { + nv_data_buf.rf_bc_config_div = 7; + + tmcnv_write(NV_RF_BC_CONFIG_DIV_I,&nv_data_buf); + } + +#ifdef FEATURE_AUTO_DLOAD_ON_ERROR + nv_read_status = tmcnv_read(NV_DETECT_HW_RESET_I,&nv_data_buf); + if(nv_read_status != NV_DONE_S) + { + nv_data_buf.detect_hw_reset = 1; + + tmcnv_write(NV_DETECT_HW_RESET_I,&nv_data_buf); + } +#endif + } + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + /* */ + /* */ + /* Bus Monitor Initialization */ + /* */ + /* */ + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_BUSMON_HAS_NV_CFG + { + nv_item_type nv_data_buf; /* NV data buffer */ + nv_stat_enum_type nv_read_status; /* NV read status */ + uint32 i; + boolean ebi1_enabled; + boolean ebi1_simple[BUS_MON_NUM_MONITORS]; + boolean ebi1_mode_valid; + nv_items_enum_type nv_id; + + /* Get nv read */ + nv_read_status = tmcnv_read( NV_BUS_PROF_EBI1_ENABLE_I, &nv_data_buf ); + + if (nv_read_status == NV_DONE_S) + { + bus_monitor_set_nv_cfg( NV_BUS_PROF_EBI1_ENABLE_I, &nv_data_buf ); + ebi1_enabled = bus_monitor_get_nv_enable_settings( BUS_MON_EBI1 ); + } + else + { + ebi1_enabled = FALSE; + TMC_ERR( "Bad NV read status %d on bus monitor configuration", + nv_read_status, 0, 0 ); + } + + if( ebi1_enabled == TRUE ) + { + /* Get nv read */ + nv_read_status = tmcnv_read( NV_BUS_PROF_EBI1_MODE_I, &nv_data_buf ); + + if (nv_read_status == NV_DONE_S) + { + bus_monitor_set_nv_cfg( NV_BUS_PROF_EBI1_MODE_I, &nv_data_buf ); + bus_monitor_get_nv_mode_settings( BUS_MON_EBI1, ebi1_simple ); + ebi1_mode_valid = TRUE; + } + else + { + ebi1_mode_valid = FALSE; + TMC_ERR( "Bad NV read status %d on bus monitor configuration", + nv_read_status, 0, 0 ); + } + + /* Get nv read */ + nv_read_status = tmcnv_read( NV_BUS_PROF_EBI1_TRIGGER_ID_I, + &nv_data_buf ); + + if (nv_read_status == NV_DONE_S) + { + bus_monitor_set_nv_cfg( NV_BUS_PROF_EBI1_TRIGGER_ID_I, &nv_data_buf ); + } + else + { + TMC_ERR( "Bad NV read status %d on bus monitor configuration", + nv_read_status, 0, 0 ); + } + + /* Get nv read */ + nv_read_status = tmcnv_read( NV_BUS_PROF_EBI1_BUS_COUNT_I, + &nv_data_buf ); + + if (nv_read_status == NV_DONE_S) + { + bus_monitor_set_nv_cfg( NV_BUS_PROF_EBI1_BUS_COUNT_I, &nv_data_buf ); + } + else + { + TMC_ERR( "Bad NV read status %d on bus monitor configuration", + nv_read_status, 0, 0 ); + } + + if( ebi1_mode_valid == TRUE ) + { + for( i = 0; i < BUS_MON_NUM_MONITORS; i++ ) + { + + if( ebi1_simple[i] == FALSE ) + { + if( bus_monitor_get_nv_id( BUS_MON_EBI1, + BUS_MON_SIMPLE_MODE, + i, + &nv_id ) != BUS_MON_FAIL ) + { + nv_read_status = tmcnv_read( nv_id, &nv_data_buf ); + + if (nv_read_status == NV_DONE_S) + { + bus_monitor_set_nv_cfg( nv_id, + &nv_data_buf ); + } + else + { + TMC_ERR( "Bad NV read status %d on bus monitor configuration", + nv_read_status, 0, 0 ); + } + } + } + else + { + if( bus_monitor_get_nv_id( BUS_MON_EBI1, + BUS_MON_ADVANCED_MODE, + i, + &nv_id ) != BUS_MON_FAIL ) + { + nv_read_status = tmcnv_read( nv_id, &nv_data_buf ); + + if (nv_read_status == NV_DONE_S) + { + bus_monitor_set_nv_cfg( nv_id, + &nv_data_buf ); + } + else + { + TMC_ERR( "Bad NV read status %d on bus monitor configuration", + nv_read_status, 0, 0 ); + } /* else nv_read_status != NV_DONE_S */ + } /* if bus_monitor_get_nv_id == TRUE */ + } /* else ebi1_simple[i] == TRUE */ + } /* for */ + } /* if ebi1_mode_valid == TRUE */ + } /* if ebi1_enabled */ + +#ifdef FEATURE_SMI + /* Get nv read */ + nv_read_status = tmcnv_read( NV_BUS_PROF_SMI_ENABLE_I, &nv_data_buf ); + + if (nv_read_status == NV_DONE_S) + { + bus_monitor_set_nv_cfg( NV_BUS_PROF_SMI_ENABLE_I, &nv_data_buf ); + smi_enabled = bus_monitor_get_nv_enable_settings( BUS_MON_SMI ); + } + else + { + smi_enabled = FALSE; + TMC_ERR( "Bad NV read status %d on bus monitor configuration", + nv_read_status, 0, 0 ); + } + + if( smi_enabled == TRUE ) + { + /* Get nv read */ + nv_read_status = tmcnv_read( NV_BUS_PROF_SMI_MODE_I, &nv_data_buf ); + + if (nv_read_status == NV_DONE_S) + { + bus_monitor_set_nv_cfg( NV_BUS_PROF_SMI_MODE_I, &nv_data_buf ); + bus_monitor_get_nv_mode_settings( BUS_MON_SMI, smi_simple ); + smi_mode_valid = TRUE; + } + else + { + smi_mode_valid = FALSE; + TMC_ERR( "Bad NV read status %d on bus monitor configuration", + nv_read_status, 0, 0 ); + } + + /* Get nv read */ + nv_read_status = tmcnv_read( NV_BUS_PROF_SMI_TRIGGER_ID_I, + &nv_data_buf ); + + if (nv_read_status == NV_DONE_S) + { + bus_monitor_set_nv_cfg( NV_BUS_PROF_SMI_TRIGGER_ID_I, &nv_data_buf ); + } + else + { + TMC_ERR( "Bad NV read status %d on bus monitor configuration", + nv_read_status, 0, 0 ); + } + + /* Get nv read */ + nv_read_status = tmcnv_read( NV_BUS_PROF_SMI_BUS_COUNT_I, + &nv_data_buf ); + + if (nv_read_status == NV_DONE_S) + { + bus_monitor_set_nv_cfg( NV_BUS_PROF_SMI_BUS_COUNT_I, &nv_data_buf ); + } + else + { + TMC_ERR( "Bad NV read status %d on bus monitor configuration", + nv_read_status, 0, 0 ); + } + + if( smi_mode_valid == TRUE ) + { + for( i = 0; i < BUS_MON_NUM_MONITORS; i++ ) + { + + if( smi_simple[i] == FALSE ) + { + if( bus_monitor_get_nv_id( BUS_MON_SMI, + BUS_MON_SIMPLE_MODE, + i, + &nv_id ) != BUS_MON_FAIL ) + { + nv_read_status = tmcnv_read( nv_id, &nv_data_buf ); + + if (nv_read_status == NV_DONE_S) + { + bus_monitor_set_nv_cfg( nv_id, + &nv_data_buf ); + } + else + { + TMC_ERR( "Bad NV read status %d on bus monitor configuration", + nv_read_status, 0, 0 ); + } + } + } + else + { + if( bus_monitor_get_nv_id( BUS_MON_SMI, + BUS_MON_ADVANCED_MODE, + i, + &nv_id ) != BUS_MON_FAIL ) + { + nv_read_status = tmcnv_read( nv_id, &nv_data_buf ); + + if (nv_read_status == NV_DONE_S) + { + bus_monitor_set_nv_cfg( nv_id, + &nv_data_buf ); + } + else + { + TMC_ERR( "Bad NV read status %d on bus monitor configuration", + nv_read_status, 0, 0 ); + } /* else nv_read_status != NV_DONE_S */ + } /* if bus_monitor_get_nv_id == TRUE */ + } /* else smi_simple[i] == TRUE */ + } /* for */ + } /* if smi_mode_valid == TRUE */ + } /* if smi_enabled */ +#endif /* FEATURE_SMI */ + + bus_monitor_commit_nv_settings(); + } +#endif /* FEATURE_BUSMON_HAS_NV_CFG */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + /* */ + /* BUS Arbiter NPA node Initialization */ + /* */ + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + TMC_VOID_FUNCTION_CALL(axi_bus_node_init); + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + /* */ + /* */ + /* HS USB Initialization */ + /* */ + /* */ + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if defined(FEATURE_HS_USB) && (defined(FEATURE_STANDALONE_MODEM) || !defined(FEATURE_NO_USB_HW_ON_PROCESSOR)) + TMC_VOID_FUNCTION_CALL(hsu_config_selector_init); +#endif + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + /* */ + /* */ + /* Mode Specific Initialization */ + /* */ + /* */ + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + /* 1X specific */ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef TMC_1X + + /* Load calibration items from NV on behalf of Vbatt library */ + + // TMC_HAS_VBATT_CONFIG + { + nv_item_type nv_data_buf; /* NV data buffer */ + nv_stat_enum_type nv_read_status; /* NV read status */ + /* NV_VBATT_I */ + + /* Get nv read*/ + nv_read_status = tmcnv_read( NV_VBATT_I, &nv_data_buf ); + + if (nv_read_status == NV_DONE_S) + { + + vbatt_calibrate( nv_data_buf.vbatt.min, nv_data_buf.vbatt.max ); + + } + else + { + + TMC_ERR( "Bad NV read status %d on vbatt calibration", + nv_read_status, 0, 0 ); + } + } + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + /* Load calibration items from NV on behalf of Charger Utility */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + /* Load calibration items from NV on behalf of Thermistor library */ + + // TMC_HAS_THERM_CONFIG + { + nv_stat_enum_type nv_read_status; + nv_item_type nv_data_buf; /* NV data buffer */ + /* NV_THERM_I */ + + nv_read_status = tmcnv_read( NV_THERM_I, &nv_data_buf ); + if (nv_read_status == NV_DONE_S) + { + therm_calibrate( nv_data_buf.therm.min, nv_data_buf.therm.max ); + } + else + { + TMC_ERR( "Bad NV read status %d on therm calibration", nv_read_status, 0, 0 ); + } + } + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + /* Load calibration items from NV on behalf of HW library */ + + // TMC_HAS_HW_CONFIG + { + nv_stat_enum_type nv_read_status; + nv_item_type nv_data_buf; /* NV data buffer */ + + /* NV_HW_CONFIG_I */ + + nv_read_status = tmcnv_read( NV_HW_CONFIG_I, &nv_data_buf ); + if (nv_read_status == NV_DONE_S) + { + hw_init( nv_data_buf.hw_config ); + } + else + { + TMC_ERR( "Bad NV read status %d on HW_CONFIG calibration", nv_read_status, 0, 0 ); + } + } + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#endif /* TMC_1X */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /* MM RF driver initialization + ** Leopard/Cheetah: + ** 1. Initializes common RF hardware and RF NV variables. + ** 2. Other remaining RF initialization is done where protocols are activated. + ** Cougar + ** 1. All Initialization will done here and only once. + ** Notes: If phone is in FTM mode, it also does RF initialization. + */ +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) && !defined(FEATURE_COREIMG) + rf_initial_status = rfm_init( + rex_self(), + TMC_NV_CMD_SIG, + (void (*)( rex_sigs_type )) tmc_wait) ; + +#ifdef FEATURE_SRCH_CLKREGIM_RM + /* RF leaves Tx clocks on, on behalf on 1x, turn them OFF here */ + clk_regime_resource_disable(CLKRGM_CLIENT_1X, CLKRGM_RESOURCE_CDMA_TX); +#endif /* FEATURE_SRCH_CLKREGIM_RM */ + +#endif /* !FEATURE_BRINGUP_DIAG_ONLY && !FEATURE_COREIMG */ + + /* If RF initialization is fail, + ** case I nv ftm flag is true: + ** do nothing. + ** case II nv ftm flag is invalid: + ** set nv ftm flag to TRUE, ftm_mode. + ** + ** Otherwise do nothing. + */ +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_FACTORY_TESTMODE + { + typedef enum + { + AMSS_MODE, + DMSS_MODE = AMSS_MODE, + FTM_MODE + } ftm_mode_type; + + nv_stat_enum_type nv_read_status; + ftm_mode_type nv_data_buf; /* NV data buffer */ + + if (!rf_initial_status) + { + + nv_read_status = tmcnv_read( NV_FTM_MODE_I, (nv_item_type *)&nv_data_buf ); + + /* If NV read failed, substitute a default value.*/ + if( nv_read_status != NV_DONE_S ) + { + QSR_TMC_MSG_ERROR( 1311059ULL, "NV read failed, item=%d, status=%d", + NV_FTM_MODE_I, nv_read_status, 0 );//auto-gen, to change remove 'QSR_' and first param + + if (!rf_initial_status) + { + nv_data_buf = FTM_MODE; + (void) tmcnv_write( NV_FTM_MODE_I,(nv_item_type *)&nv_data_buf); + } + } + } + +#ifdef FEATURE_FTM_CAMERA_TASK + /* Make additional memory available for modem in FTM mode */ + nv_read_status = tmcnv_read( NV_FTM_MODE_I, (nv_item_type *)&nv_data_buf ); + if (nv_read_status == NV_DONE_S && nv_data_buf == FTM_MODE) + { + void pmem_7k_modem_ftm_init(void); + pmem_7k_modem_ftm_init(); + } +#endif + } +#endif /* FEATURE_FACTORY_TESTMODE */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /* Initial SD before application tasks. + ** + ** The band capability provided by SD need to be ready before CM/UI task + ** get started. + */ +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) && !defined(FEATURE_COREIMG) + sd_init_before_app_task_start(); +#endif /* !FEATURE_BRINGUP_DIAG_ONLY && !FEATURE_COREIMG*/ + +#if defined(FEATURE_TMC_TCXOMGR) || defined(FEATURE_TCXOMGR_TMC) + { + // void tcxomgr_init(rex_tcb_type*, rex_sigs_type, void*); + (void) tcxomgr_init(rex_self(), TMC_NV_CMD_SIG, (void (*)( rex_sigs_type ))tmc_wait); + } +#endif + +#ifdef FEATURE_TMC_TRM + { + /* Initialize TRM. This call must be made after rf_init which is also + done in tmc_order_2_init. Note that no + TRM clients can call TRM until after they first call task_start. */ + void trm_init(rex_tcb_type*, rex_sigs_type, void*); + trm_init(rex_self(), TMC_NV_CMD_SIG, (void*)tmc_wait); + } +#endif + +#if defined(FEATURE_RUNTIME_DEVMAP) && defined(IMAGE_MODEM_PROC) + /* Have RDM issue any open commands. If there were none retrieved from + ** EFS, compile time defaults will be issued + */ + TMC_VOID_FUNCTION_CALL(rdm_issue_opens); +#endif + +#ifdef FEATURE_BATTERY_CHARGER + chg_init_delayed( rex_self(), TMC_NV_CMD_SIG, tmc_wait ); +#endif + +#ifdef FEATURE_TIME_IPC_TASK + TMC_VOID_FUNCTION_CALL(time_init_config); +#endif /* FEATURE_TIME_IPC_TASK */ + +#if defined(FEATURE_SEC_TIME) && !defined(FEATURE_SEC_PROCESS_INIT) + sectime_init( rex_self(), + TMC_NV_CMD_SIG, + (void (*)( rex_sigs_type )) tmc_wait ); +#endif /* FEATURE_SEC_TIME && !FEATURE_SEC_PROCESS_INIT */ + +#if defined(FEATURE_L4LINUX) || defined(FEATURE_QIDS_RPC) + /* Initialize the QIDS RPC application + */ + TMC_VOID_FUNCTION_CALL(qids_rpc_app_init); +#endif + +#ifdef FEATURE_DAL + { + DALSYSConfig SysCfg = {NULL, 2, NULL}; + DALSYS_InitMod(&SysCfg); + } +#endif + +#ifdef FEATURE_BRINGUP_NO_SLEEP + bio_set_sw(0x100); /* Force to not sleep for Rumi */ +#endif /* FEATURE_BRINGUP_NO_SLEEP */ + + if (rf_initial_status == FALSE) + { + /* Set TMC State to OFFLINE. + */ + tmc_set_state(TMC_LPM); + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_CM + /* Send offline digital cmd to CM.Need to update with different offline + ** cmd once the interface is defined. + */ + (void) cm_ph_cmd_oprt_mode(NULL, + NULL, + CM_CLIENT_ID_ANONYMOUS, + SYS_OPRT_MODE_LPM + ); +#endif /* FEAURE_CM */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + } + else + { + /* Set TMC State to ONLINE. + */ + tmc_set_state(TMC_ONLINE); + + /* TMC does not send online command to CM. Online command is send by MMOC + ** after MMOC is started. + */ + } +} /* tmc_order_2_init */ + +/*=========================================================================== + +FUNCTION tmc_order_1_exec() + +DESCRIPTION + This function starts service tasks tasks. Service tasks are defined as + those that are required to be started so that the system can determine if + it is to continue powerup or if it should return to powerdown. The NV + task is started first, to allow all other tasks to read any needed + variables from NVM. + + It sends START signals to all tasks, one at a time. After sending a START + signal to a task, it expects an Ack back from the task. Once Ack is + received, it sends a START Signal to the next task. This handshaking + ensures a controlled starting of all tasks. + +DEPENDENCIES +All tasks must already be created through tmc_order_0_exec(). + +RETURN VALUE + void + +SIDE EFFECTS + None + +===========================================================================*/ +static void tmc_order_1_exec(void) +{ + (void) rex_clr_sigs(rex_self(), TMC_ACK_SIG); + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_ONCRPC + + tmc_start_tasks_common(_TASK_INFO_P(oncrpc)); + +#ifdef FEATURE_STA + + tmc_start_tasks_common(_TASK_INFO_P(sta)); + +#endif /* FEATURE_STA */ +#endif /* FEATURE_ONCRPC */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_EFS + + tmc_start_tasks_common(_TASK_INFO_P(fs)); + +#endif /* FEATURE_EFS */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_TIME_IPC_TASK + + tmc_start_tasks_common(_TASK_INFO_P(time_ipc)); + +#endif /* FEATURE_TIME_IPC_TASK */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if (defined(FS_FEATURE_RMTEFS_SERVER) || defined(FS_FEATURE_IG_IPC_SERVER) ) && !defined(FEATURE_IG_EFS_EXT_SERVER) + + tmc_start_tasks_common(_TASK_INFO_P(efs_srvr)); + +#endif /* FS_FEATURE_RMTEFS_SERVER && !FEATURE_IG_EFS_EXT_SERVER */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_EFS_SFAT + + tmc_start_tasks_common(_TASK_INFO_P(sfat)); + +#endif /* FEATURE_EFS_SFAT */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + +#ifndef FEATURE_SEC_PROCESS_INIT +#ifdef FEATURE_IXFILESVC + + tmc_start_tasks_common(_TASK_INFO_P(ix_filesvc)); + +#endif /* FEATURE_IXFILESVC */ + +#ifdef FEATURE_IXSQLSVC + + tmc_start_tasks_common(_TASK_INFO_P(ix_sqlsvc)); + + tmc_start_tasks_common(_TASK_INFO_P(ix_sqlclnt)); + +#endif /* FEATURE_IXSQLSVC */ +#endif /* !FEATURE_SEC_PROCESS_INIT */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_FOTA_FS + TMC_VOID_FUNCTION_CALL(fota_update_init_after_fs_task_started); +#endif /* FEATURE_FOTA_FS */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_NV + + tmc_start_tasks_common(_TASK_INFO_P(nv)); + +#endif /* FEATURE_NV */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + /* It has dependency on nv task. so it need to be called after nv task is + ** started. + */ + TMC_VOID_FUNCTION_CALL(err_init); /* Start error services. */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_UIM_RUIM + { + nv_item_type nv_data_buf; /* NV data buffer */ + nv_stat_enum_type nv_read_status; /* NV read status */ + /* + ** ESN-ME could be esn number in stored in NV or a RUIM id. + ** This function will read ESN-ME from NV,cached to tmc data. The ESN + ** usage is set to Zero. From that on any entity reads ESN-ME from now on + ** will get zero until the ESN usage is changed. + ** When ui task is started, it uses cached ESN-ME to initial RUIM and + ** reset the ESN usage indicator to NV or RUIM Id based on certain + ** conditions.After that any entity reads ESN-ME, it will get a number + ** decided by ESN usage indicator. + ** + ** Note: ui task is started priori to esn_me cached here. But ui reads + ** stored esn_me after esn_me is cached right now. If anyhow ui read + ** stored esn_me before esn_me is cached. We have to move the code before + ** ui task is started. + ** + */ + + /* Read the ESN ESN from NV */ + + nv_read_status = tmcnv_read( NV_ESN_I, &nv_data_buf ); + + if (nv_read_status != NV_DONE_S) + nv_data_buf.esn.esn = 0; + + /* Store esn me to TMC internal data buffer. + */ + tmc_store_esn_me(nv_data_buf.esn.esn); + + /* Set the esn to return Zero until after store esn-me is finished + */ + nvruim_set_esn_usage( NV_RUIM_ZERO_ESN ); + + } +#endif /* FEATURE_UIM_RUIM */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#if (defined( FEATURE_UIM ) && ! defined(FEATURE_GSM_PLT) ) + + tmc_start_tasks_common(_TASK_INFO_P(uim)); + +#endif +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_VBATT_TASK + + tmc_start_tasks_common(_TASK_INFO_P(vbatt)); + +#endif +#endif + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_CHG_TASK + + tmc_start_tasks_common(_TASK_INFO_P(chg)); + +#endif /* FEATURE_CHG_TASK */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#if defined(FEATURE_USB) && !defined(FEATURE_NO_USB_HW_ON_PROCESSOR) + + tmc_start_tasks_common(_TASK_INFO_P(usbdc)); + +#ifdef FEATURE_USB_HOST_ENHANCED + + tmc_start_tasks_common(_TASK_INFO_P(usbhc_urb)); + + tmc_start_tasks_common(_TASK_INFO_P(usbhc_dev)); + +#if defined(FEATURE_USB_HOST_TEST_ENHANCED) && (defined(FEATURE_USB_HOST_MASS_STORAGE_TEST_ENHANCED) || defined(FEATURE_USB_HOST_HID_TEST_ENHANCED)) + + tmc_start_tasks_common(_TASK_INFO_P(usbhc_test)); + +#endif +#endif +#endif /* FEATURE_USB */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_CTA + + tmc_start_tasks_common(_TASK_INFO_P(cta)); + +#endif /* FEATURE_CTA_TASK */ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY + + tmc_start_tasks_common(_TASK_INFO_P(sleep)); + + clk_regime_init_nv(); /* Load dynamic clock/voltage scaling flags before DSP services are active */ + +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + TMC_VOID_FUNCTION_CALL(DCVSInitialize); /* Initialize the DCVS System... */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_QDSP_TASK + + tmc_start_tasks_common(_TASK_INFO_P(qdsp)); + +#endif /* FEATURE_QDSP_TASK */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_QDSP_RTOS + + tmc_start_tasks_common(_TASK_INFO_P(adsp_rtos)); + +#endif /* FEATURE_QDSP_RTOS */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_MDSP_TASK + + tmc_start_tasks_common(_TASK_INFO_P(mdsp)); + +#endif /* FEATURE_MDSP_TASK */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_VOC_TASK + + tmc_start_tasks_common(_TASK_INFO_P(voc)); + +#endif /* FEATURE_VOC_TASK */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if ! defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_SND_TASK + + tmc_start_tasks_common(_TASK_INFO_P(snd)); + +#endif /* FEATURE_SND_TASK */ + +#ifdef FEATURE_AVS_SBCENC_TASK + + tmc_start_tasks_common(_TASK_INFO_P(sbcenc)); + +#endif /* FEATURE_AVS_SBCENC_TASK */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_GRAPH_TASK + + tmc_start_tasks_common(_TASK_INFO_P(graph)); + +#endif /* FEATURE_GRAPH_TASK */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_GFX_TASK + + tmc_start_tasks_common(_TASK_INFO_P(gfx)); + +#endif /* FEATURE_GFX_TASK */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_CAMERA_DRV_TASK + + tmc_start_tasks_common(_TASK_INFO_P(camera_drv)); + +#endif /* FEATURE_CAMERA_DRV_TASK */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_VS_TASK + + tmc_start_tasks_common(_TASK_INFO_P(vs)); + +#endif /* FEATURE_VS_TASK */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_IS2000_TDSO + + tmc_start_tasks_common(_TASK_INFO_P(tdso)); + +#endif /* FEATURE_IS2000_TDSO */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#if !defined(FEATURE_THIN_UI) && !defined(FEATURE_UI_CORE_REMOVED) || defined(FEATURE_HS_POLLING_ON_MODEM) +#ifdef FEATURE_HS + + tmc_start_tasks_common(_TASK_INFO_P(hs)); + +#endif /* FEATURE_HS */ +#endif /* !defined(FEATURE_THIN_UI) && !defined(FEATURE_UI_CORE_REMOVED) */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_IDS +#error code not present +#endif /* FEATURE_IDS */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_DIAG_TASK + +#ifdef FEATURE_BRINGUP_DIAG_ONLY +#if defined(FEATURE_GSM) || defined(FEATURE_WCDMA) + { + /* For diag only bringup on GSM/WCDMA targets, set mm_gsm_supported to + true here */ + mm_gsm_supported = TRUE; + } +#endif /* FEATURE_GSM || FEATURE_WCDMA */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + tmc_start_tasks_common(_TASK_INFO_P(diag)); + +#endif /* FEATURE_DIAG_TASK */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_IG_QDIAG + + tmc_start_tasks_common(_TASK_INFO_P(qdiag)); + +#endif /* FEATURE_IG_QDIAG */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_NV_CNV + + tmc_start_tasks_common(_TASK_INFO_P(cnv)); + +#endif /* FEATURE_NV_CNV */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if (defined(FEATURE_DISP_TASK)) && (!defined(T_MSM7500) || (defined(T_MSM7500) && defined(IMAGE_APPS_PROC))) + + tmc_start_tasks_common(_TASK_INFO_P(disp)); + +#endif /* FEATURE_DISP_TASK */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_APPS_TCXO_SLEEP + + tmc_start_tasks_common(_TASK_INFO_P(dem)); + +#endif /* FEATURE_APPS_TCXO_SLEEP */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_XO + + tmc_start_tasks_common(_TASK_INFO_P(tcxomgr)); + +#endif /* FEATURE_XO */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +#ifdef FEATURE_FTM_CAMERA_TASK + + tmc_start_tasks_common(_TASK_INFO_P(ftm_camera)); + +#endif /*FEATURE_FTM_CAMERA_TASK*/ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if defined(FEATURE_HS_USB) && (defined(FEATURE_STANDALONE_MODEM) || !defined(FEATURE_NO_USB_HW_ON_PROCESSOR)) + + tmc_start_tasks_common(_TASK_INFO_P(hsu_al_task)); + +#endif /* FEATURE_HS_USB && (FEATURE_STANDALONE_MODEM || !FEATURE_NO_USB_HW_ON_PROCESSOR) */ + +#if defined(FEATURE_HS_USB_MS_FD) && (defined(FEATURE_STANDALONE_MODEM) || !defined(FEATURE_NO_USB_HW_ON_PROCESSOR)) + + tmc_start_tasks_common(_TASK_INFO_P(hsu_al_ms)); + +#endif /* FEATURE_HS_USB_MS_FD && (FEATURE_STANDALONE_MODEM || !FEATURE_NO_USB_HW_ON_PROCESSOR) */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_PWRDB +#error code not present +#endif /* FEATURE_PWRDB */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if defined(FEATURE_REX_CS) + if (initialize_component_services() != 0) + { + TMC_ERR("CS initialization failed ",0,0,0); + } +#endif + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) && !defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#if (defined(FEATURE_CDSMS) || defined(FEATURE_GWSMS)) + + tmc_start_tasks_common(_TASK_INFO_P(wms)); + +#endif /* FEATURE_CDSMS || FEATURE_GWSMS */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY && ! FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + +} /* tmc_order_1_exec */ + +/*=========================================================================== + +FUNCTION tmc_order_2_exec() + +DESCRIPTION + This function starts application tasks.It sends START signals to all tasks, + one at a time. After sending a START signal to a task, it expects an Ack + back from the task. Once Ack is received, it sends a START Signal to the + next task. This handshaking ensures a controlled starting of all tasks. + +DEPENDENCIES +All tasks must already be created through tmc_order_0_exec(). + +RETURN VALUE + void + +SIDE EFFECTS + None + +===========================================================================*/ +static void tmc_order_2_exec(void) +{ + (void) rex_clr_sigs(rex_self(), TMC_ACK_SIG); + +#ifndef FEATURE_BRINGUP_DIAG_ONLY + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if (defined(FEATURE_WLAN) && !defined(FEATURE_MULTIPROCESSOR)) + + tmc_start_tasks_common(_TASK_INFO_P(wlan_cp)); + + tmc_start_tasks_common(_TASK_INFO_P(wlan_trp)); + +#endif /* FEATURE_WLAN && !FEATURE_MULTIPROCESSOR */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if (defined(FEATURE_DATA) && defined(FEATURE_DATA_PS) && !defined(FEATURE_DATA_ON_APPS)) + + tmc_start_tasks_common(_TASK_INFO_P(ps)); + +#endif /* FEATURE_DATA && FEATURE_DATA_PS && !FEATURE_DATA_ON_APPS */ + +#ifdef FEATURE_DATA_PS +#ifdef FEATURE_DATA_PS_DCC + + tmc_start_tasks_common(_TASK_INFO_P(dcc)); + +#endif /* FEATURE_DATA_PS_DCC */ +#endif + +#if defined(FEATURE_DATA_PS) && defined(FEATURE_DATA_PS_SOCK_REARCH) + + tmc_start_tasks_common(_TASK_INFO_P(ds_sig)); + +#endif /* FEATURE_DATA_PS && FEATURE_DATA_PS_SOCK_REARCH */ +#if defined(FEATURE_DATA_MUX) +#error code not present +#endif /* FEATURE_DATA_MUX*/ +#if (defined(FEATURE_WLAN) && !defined(FEATURE_MULTIPROCESSOR)) + + tmc_start_tasks_common(_TASK_INFO_P(wlan_sec)); + +#endif /* FEATURE_WLAN && !FEATURE_MULTIPROCESSOR */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_SEC_PROCESS_INIT +#ifdef FEATURE_IXHTTPSVC + + tmc_start_tasks_common(_TASK_INFO_P(ix_httpsvc)); + +#endif /* FEATURE_IXHTTPSVC */ + +#ifdef FEATURE_IXTIMESVC + + tmc_start_tasks_common(_TASK_INFO_P(ix_timesvc)); + +#endif /* FEATURE_IXTIMESVC */ + +#ifdef FEATURE_IXCONTENTSVC + + tmc_start_tasks_common(_TASK_INFO_P(ix_contentclnt)); + +#endif /* FEATURE_IXCONTENTSVC */ + +#ifdef FEATURE_IXDESCRAMBLERSVC + + tmc_start_tasks_common(_TASK_INFO_P(ix_descramblersvc)); + +#endif +#endif /* !FEATURE_SEC_PROCESS_INIT */ + +#ifdef FEATURE_IXCONTENTSVC + + tmc_start_tasks_common(_TASK_INFO_P(ix_contentsvc)); + +#endif /* FEATURE_IXCONTENTSVC */ + +#ifdef FEATURE_SEC + +#ifndef FEATURE_SEC_PROCESS_INIT + + tmc_start_tasks_common(_TASK_INFO_P(sec)); + +#ifdef FEATURE_SEC_ARM_CRYPTO + + tmc_start_tasks_common(_TASK_INFO_P(seccryptarm)); + +#endif /* FEATURE_SEC_ARM_CRYPTO */ + +#ifdef FEATURE_SEC_CONTENT_AGENT + + tmc_start_tasks_common(_TASK_INFO_P(contentagentdiag)); + +#endif /* FEATURE_SEC_CONTENT_AGENT */ + +#ifdef FEATURE_SECRND + + tmc_start_tasks_common(_TASK_INFO_P(secrnd)); + +#endif /* FEATURE_SECRND */ + +#ifdef FEATURE_SEC_USFS + + tmc_start_tasks_common(_TASK_INFO_P(sfs)); + +#endif /* FEATURE_SEC_USFS */ +#endif /* !FEATURE_SEC_PROCESS_INIT */ + +#ifdef FEATURE_SSD + + tmc_start_tasks_common(_TASK_INFO_P(ssd)); + +#endif /* FEATURE_SEC_USFS */ + +#ifdef FEATURE_SEC_IPSEC + + tmc_start_tasks_common(_TASK_INFO_P(secips)); + +#endif /* FEATURE_SEC_IPSEC */ + +#ifndef FEATURE_DATA_ON_APPS +#ifdef FEATURE_SEC_SSL + + tmc_start_tasks_common(_TASK_INFO_P(secssl)); + +#endif /* FEATURE_SEC_SSL */ +#endif /* !FEATURE_DATA_ON_APPS */ + +#ifndef T_RUMI +#ifdef FEATURE_SEC_DRM + + tmc_start_tasks_common(_TASK_INFO_P(secdrm)); + +#endif /* FEATURE_SEC_DRM */ +#endif /* ! T_RUMI */ + +#endif /* FEATURE_SEC */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_CM + + tmc_start_tasks_common(_TASK_INFO_P(cm)); + +#endif /* FEATURE_CM */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if defined(FEATURE_MULTIMODE_ARCH) && !defined(FEATURE_COREIMG) + + tmc_start_tasks_common(_TASK_INFO_P(mmoc)); + +#endif /* FEATURE_MULTIMODE_ARCH */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef TMC_1X + + tmc_start_tasks_common(_TASK_INFO_P(mc)); + +#endif /* TMC_1X */ + +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef SIRIUS_PLATFORM +#ifndef T_QUASAR +#ifdef FEATURE_UI + + tmc_start_tasks_common(_TASK_INFO_P(ui)); + +#endif /* FEATURE_UI */ +#endif /* T_QUASAR */ +#endif /* SIRIUS_PLATFORM */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY + +#ifndef T_QUASAR +#if defined(FEATURE_BT) && !defined(IMAGE_MODEM_PROC) + + tmc_start_tasks_common(_TASK_INFO_P(bt)); + +#ifdef FEATURE_BT_EXTPF + + tmc_start_tasks_common(_TASK_INFO_P(bt_pf)); + +#endif /* FEATURE_BT_EXTPF */ + +#ifdef FEATURE_BT_FS_TASK + + tmc_start_tasks_common(_TASK_INFO_P(bt_fs)); + +#endif /* FEATURE_BT_FS_TASK */ + +#endif /* FEATURE_BT && !IMAGE_MODEM_PROC */ +#endif /* T_QUASAR */ + +#ifdef FEATURE_BT_FTM_TASK + + tmc_start_tasks_common(_TASK_INFO_P(bt_ftm)); + +#endif /* FEATURE_BT_FTM_TASK */ + +#ifdef FEATURE_FM + + tmc_start_tasks_common(_TASK_INFO_P(fmrds)); + +#endif /* FEATURE_FM */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef TMC_1X + + tmc_start_tasks_common(_TASK_INFO_P(tx)); + + tmc_start_tasks_common(_TASK_INFO_P(rx)); + + tmc_start_tasks_common(_TASK_INFO_P(srch)); + + tmc_start_tasks_common(_TASK_INFO_P(rxtx)); + +#endif /* TMC_1X */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_HDR + + tmc_start_tasks_common(_TASK_INFO_P(hdrmc)); + + tmc_start_tasks_common(_TASK_INFO_P(hdrtx)); + + tmc_start_tasks_common(_TASK_INFO_P(hdrrx)); + + tmc_start_tasks_common(_TASK_INFO_P(hdrsrch)); + +#endif /* FEATURE_HDR */ + +#ifdef FEATURE_HDR_BCMCS + + tmc_start_tasks_common(_TASK_INFO_P(hdrbc)); + +#endif /* FEATURE_HDR_BCMCS */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifndef T_QUASAR +#ifdef FEATURE_QMIP +#error code not present +#endif /* FEATURE_QMIP */ +#endif /* T_QUASAR */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_DATA + +#ifndef T_QUASAR +#ifndef FEATURE_DATA_ON_APPS + + tmc_start_tasks_common(_TASK_INFO_P(ds)); + +#endif /* !FEATURE_DATA_ON_APPS */ + +#ifdef FEATURE_COMP_TASK + + tmc_start_tasks_common(_TASK_INFO_P(comp)); + +#endif /* FEATURE_COMP_TASK */ + +#if ( (defined(FEATURE_DATA_GCSD) || defined(FEATURE_DATA_WCDMA_CS)) && !defined(FEATURE_WCDMA_PLT) && !defined(FEATURE_GSM_PLT)) + + tmc_start_tasks_common(_TASK_INFO_P(Gcsd)); + +#endif /* (FEATURE_DATA_GCSD || FEATURE_DATA_WCDMA_CS) && !FEATURE_WCDMA_PLT */ + +#ifndef FEATURE_DATA_ON_APPS +#ifdef FEATURE_WCDMA /* ) && ( defined FEATURE_DATA_WCDMA_CS ) ) */ + + tmc_start_tasks_common(_TASK_INFO_P(dswcsd_ul)); + + tmc_start_tasks_common(_TASK_INFO_P(dswcsd_dl)); + +#endif /* FEATURE_WCDMA */ +#endif /* !FEATURE_DATA_ON_APPS */ +#endif /* T_QUASAR */ +#endif /* FEATURE_DATA */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_DS_SOCKETS_TEST_TCP +#error code not present +#endif /* FEATURE_DS_SOCKETS_TEST_TCP */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_DS_SOCKETS_TEST_UDP +#error code not present +#endif /* FEATURE_DS_SOCKETS_TEST_UDP */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if defined( FEATURE_AUTH ) || defined( FEATURE_RUIM ) + + tmc_start_tasks_common(_TASK_INFO_P(auth)); + +#endif /* FEATURE_AUTH || FEATURE_RUIM */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +#ifndef T_QUASAR +#ifdef FEATURE_DH + + tmc_start_tasks_common(_TASK_INFO_P(dh)); + +#endif /* FEATURE_DH */ +#endif /* T_QUASAR */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if (defined(FEATURE_GAN) && !(defined(IMAGE_APPS_PROC))) +#error code not present +#endif + +#ifdef FEATURE_GAN +#error code not present +#endif /* FEATURE_GAN */ + +#ifdef FEATURE_MMGSDI + + tmc_start_tasks_common(_TASK_INFO_P(gsdi)); + +#endif /* FEATURE_MMGSDI */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef SIRIUS_PLATFORM +#error code not present +#endif /* SIRIUS_PLATFORM */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_VIRTUAL_SIM + + tmc_start_tasks_common(_TASK_INFO_P(gsdi_uim_server)); + +#endif + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if defined(FEATURE_GSTK) + + tmc_start_tasks_common(_TASK_INFO_P(gstk)); + +#endif /* FEATURE_GSTK */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if defined( FEATURE_VIRTUAL_SAT ) && defined( FEATURE_GSTK ) + + tmc_start_tasks_common(_TASK_INFO_P(virtsat)); + +#endif /* FEATURE_VIRTUAL_SAT && FEATURE_GSIK */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_WCDMA +#ifndef FEATURE_GSM_PLT + + tmc_start_tasks_common(_TASK_INFO_P(wcdma_l1)); + +#ifdef FEATURE_WCDMA_PLT +#error code not present +#endif +#endif + +#if ( !defined(FEATURE_WCDMA_PLT) && !defined(FEATURE_GSM_PLT) ) + + tmc_start_tasks_common(_TASK_INFO_P(wcdma_l2_ul)); + + tmc_start_tasks_common(_TASK_INFO_P(wcdma_l2_dl)); + +#ifdef FEATURE_HSDPA + + tmc_start_tasks_common(_TASK_INFO_P(wcdma_mac_hs_dl)); + +#endif + + tmc_start_tasks_common(_TASK_INFO_P(rrc)); + +#endif /* !FEATURE_WCDMA_PLT */ +#endif /* FEATURE_WCDMA */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if (defined(FEATURE_GSM) && !defined(FEATURE_WCDMA_PLT) && !defined(FEATURE_GSM_PLT) ) + + tmc_start_tasks_common(_TASK_INFO_P(gsm_l1)); + +#ifndef FEATURE_GSM_PLT + + tmc_start_tasks_common(_TASK_INFO_P(gsm_l2)); + + tmc_start_tasks_common(_TASK_INFO_P(rr)); + +#endif /* !FEATURE_GSM_PLT */ + +#ifdef FEATURE_GSM_GPRS + + tmc_start_tasks_common(_TASK_INFO_P(gprs_mac)); + + tmc_start_tasks_common(_TASK_INFO_P(gprs_rlc_ul)); + + tmc_start_tasks_common(_TASK_INFO_P(gprs_rlc_dl)); + + tmc_start_tasks_common(_TASK_INFO_P(gprs_llc)); + +#endif /* FEATURE_GSM_GPRS */ +#endif /* FEATURE_GSM && !FEATURE_WCDMA_PLT */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_NAS + + tmc_start_tasks_common(_TASK_INFO_P(mm)); + + tmc_start_tasks_common(_TASK_INFO_P(reg)); + + tmc_start_tasks_common(_TASK_INFO_P(mn_cnm)); + + tmc_start_tasks_common(_TASK_INFO_P(sm)); + +#ifdef FEATURE_GSM_CB + + tmc_start_tasks_common(_TASK_INFO_P(cb)); + +#endif /* #ifdef FEATURE_GSM_CB */ +#endif /* FEATURE_NAS */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_TC + + tmc_start_tasks_common(_TASK_INFO_P(tc)); + +#endif /* FEATURE_TC */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if ( defined(FEATURE_WCDMA_VST_FULLSTACK) || defined(FEATURE_WCDMA_VST_AS)) + + tmc_start_tasks_common(_TASK_INFO_P(menu)); + +#endif + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if (defined(FEATURE_CGPS) && !defined(FEATURE_DISABLE_CGPS)) + + tmc_start_tasks_common(_TASK_INFO_P(mgpmc)); + + tmc_start_tasks_common(_TASK_INFO_P(cc)); + +#ifdef FEATURE_CGPS_PGI_TASK + + tmc_start_tasks_common(_TASK_INFO_P(pgi)); + +#endif /* FEATURE_CGPS_PGI_TASK */ + + tmc_start_tasks_common(_TASK_INFO_P(pp)); + + tmc_start_tasks_common(_TASK_INFO_P(cd)); + + tmc_start_tasks_common(_TASK_INFO_P(nf)); + + tmc_start_tasks_common(_TASK_INFO_P(gpsfft)); + + tmc_start_tasks_common(_TASK_INFO_P(lm)); + + tmc_start_tasks_common(_TASK_INFO_P(sm_tm)); + +#ifdef FEATURE_CGPS_PD_COMMS_TCP_ON_MODEM + + tmc_start_tasks_common(_TASK_INFO_P(pdcommtcp)); + +#endif /* !FEATURE_DATA_ON_APPS */ + + tmc_start_tasks_common(_TASK_INFO_P(pdcommwms)); + + tmc_start_tasks_common(_TASK_INFO_P(gps_fs)); + +#ifdef FEATURE_CGPS_LOC_MIDDLEWARE + + tmc_start_tasks_common(_TASK_INFO_P(loc_middleware)); + +#endif // FEATURE_CGPS_LOC_MIDDLEWARE +#endif /* FEATURE_CGPS */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if ( defined(FEATURE_WCDMA_VST_FULLSTACK) || defined(FEATURE_WCDMA_VST_AS)) + + tmc_start_tasks_common(_TASK_INFO_P(al1)); + +#endif + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_WCDMA_VST_AS + + tmc_start_tasks_common(_TASK_INFO_P(rrcut)); + +#endif + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_FTM_TASK + + tmc_start_tasks_common(_TASK_INFO_P(ftm)); + +#endif /* FEATURE_FTM_TASK */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_QIPCALL + + tmc_start_tasks_common(_TASK_INFO_P(qipcall)); + +#endif /* FEATURE_QIPCALL */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_BCMCS + + tmc_start_tasks_common(_TASK_INFO_P(bcdb)); + +#endif /* FEATURE_BCMCS */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) +#if (defined(FEATURE_WLAN) && !defined(FEATURE_MULTIPROCESSOR)) + + tmc_start_tasks_common(_TASK_INFO_P(wlan_ds)); + +#endif /* (defined(FEATURE_WLAN) && !defined(FEATURE_MULTIPROCESSOR)) */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_DTV + + tmc_start_tasks_common(_TASK_INFO_P(dtv)); + +#endif /* FEATURE_DTV */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#if !defined(FEATURE_BRINGUP_DIAG_ONLY) || defined(FEATURE_BRINGUP_MULTIMEDIA_ONLY) +#ifdef FEATURE_JOYST_TASK + + tmc_start_tasks_common(_TASK_INFO_P(joyst)); + +#endif /* FEATURE_JOYST_TASK */ +#endif /* ! FEATURE_BRINGUP_DIAG_ONLY || FEATURE_BRINGUP_MULTIMEDIA_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#if defined(FEATURE_PBM_TASK) + + tmc_start_tasks_common(_TASK_INFO_P(pbm)); + +#endif /* FEATURE_PBM_TASK */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + +#if defined(FEATURE_CPU_BASED_FLOW_CONTROL) + + tmc_start_tasks_common(_TASK_INFO_P(fc)); + +#endif /* FEATURE_CPU_BASED_FLOW_CONTROL */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef SIRIUS_PLATFORM +#error code not present +#endif /* SIRIUS_PLATFORM */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_PM_SERVER + + tmc_start_tasks_common(_TASK_INFO_P(pms)); + +#endif /* FEATURE_PM_SERVER */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_APS + + tmc_start_tasks_common(_TASK_INFO_P(aps)); + +#endif /* FEATURE_APS */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_ATS + + tmc_start_tasks_common(_TASK_INFO_P(ats)); + +#endif /* FEATURE_ATS */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_GSM_PLT +#error code not present +#endif + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_DOG + + tmc_start_tasks_common(_TASK_INFO_P(dog)); + +#endif /* FEATURE_DOG */ + + /* Loads the pages from NAND in the background. + ** It exist only during boot up and once the pages are loaded, it suspends. + ** This task could be started any time. it is put as the last task to + ** eliminates any time wasted in background loading during boot. + ** Ideally the background loading should be start after the initialization + ** is over. But that is not a hard requirement. + */ +#ifndef FEATURE_BRINGUP_DIAG_ONLY +#ifdef FEATURE_PROGRESSIVE_BOOT + + rex_def_task_ext2(TASK_HANDLE(background_loader), + (unsigned char*)TASK_STACK(background_loader), + BACKGROUND_LOADER_STACK_SIZ * sizeof(rex_stack_word_type), + BACKGROUND_LOADER_PRI, + TASK_MAIN(background_loader), + TASK_IDENT(background_loader), + FALSE, + TASK_NODOG_RPT); + + // THIS TASK IS NOT IMPLEMENTED TO RESPOND TO THE REQUIRED + // TMC SIGNALING PROTOCOL. + + // (void) tmc_wait(TMC_ACK_SIG); + // (void) rex_clr_sigs(rex_self(), TMC_ACK_SIG); + +#endif /* FEATURE_PROGRESSIVE_BOOT */ +#endif /* FEATURE_BRINGUP_DIAG_ONLY */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +#ifdef FEATURE_MFLO +#error code not present +#endif/* FEATURE_MFLO */ + +#ifdef FEATURE_UBM_L1 + + tmc_start_tasks_common(_TASK_INFO_P(ubm_l1)); + +#endif /* FEATURE_UBM_L1 */ + +#if defined(FEATURE_SENSORS) + + tmc_start_tasks_common(_TASK_INFO_P(sns)); + +#endif /* FEATURE_SENSORS */ + +#if defined(FEATURE_REX_CS) + if (0 != initialize_component_services_modules()) + { + TMC_ERR("CS module initialization ",0,0,0); + } +#endif + +#if defined(FEATURE_DOG_KEEPALIVE_TASK) + + tmc_start_tasks_common(_TASK_INFO_P(dog_keepalive)); + +#endif /* FEATURE_DOG_KEEPALIVE_TASK */ + +} /* tmc_order_2_exec */ + +/*=========================================================================== + +FUNCTION tmc_order_3_init + +DESCRIPTION + Initialize on behalf of runtime device mapper + +DEPENDENCIES +It has be called after tmc_order_0_init and + tmc_start_tasks. + +RETURN VALUE + void + +SIDE EFFECTS + None + +===========================================================================*/ +static void tmc_order_3_init(void) +{ +#ifdef TMC_SET_RAN_SEED + { + qword clk_time; + clk_read_ms(clk_time); /* Seed the random function with time from clk. */ + ran_seed(qw_lo(clk_time)); + } +#endif /* TMC_SET_RAN_SEED */ + +#ifdef FEATURE_AUTOMATIC_CLOCK_FREQUENCY_CHANGING + clk_switch_enable(); +#endif /* FEATURE_AUTOMATIC_CLOCK_FREQUENCY_CHANGING */ + +#if defined(FEATURE_DYNAMIC_CLOCK_FREQUENCY_CHANGING) + /* Deregister the boot client. */ + clk_regime_deregister_for_cpu_resource(CLKRGM_CPU_CLIENT_BOOT); +#endif + +#if defined(SLEEP_MP4_OKTS_SIG) && defined(FEATURE_MP4_DECODER) + /* MP4 - okay to sleep. We do this here because MP4 task init is not + ** carried out until a media clip is played. + */ + SLEEP_ASSERT_OKTS( SLEEP_MP4_OKTS_SIG ); +#endif /* SLEEP_MP4_OKTS_SIG && FEATURE_MP4_DECODER */ + +#ifdef FEATURE_USB +#if !defined(FEATURE_USB_ON_APPS_PROC) && !defined(FEATURE_WCDMA_PLT) +#if defined(FEATURE_USB_CDC_ACM) || defined(FEATURE_USB_DIAG) || defined(FEATURE_USB_DIAG_NMEA) || defined(FEATURE_USB) && defined(FEATURE_MMC) + TMC_VOID_FUNCTION_CALL(sio_usb_dev_init); /* Currently done in MC */ +#endif +#endif /* !FEATURE_USB_ON_APPS_PROC && !FEATURE_WCDMA_PLT */ +#endif /* FEATURE_USB */ + +#if defined(FEATURE_QFUSE_PROGRAMMING) && defined(IMAGE_MODEM_PROC) + TMC_VOID_FUNCTION_CALL(efuse_diag_init); +#endif + +} /* tmc_order_3_init */ + +static void tmc_order_3_exec(void) +{ +#if defined(T_MSM7500) && defined(T_FFA) && !defined(FEATURE_I2C_DIRECT_ON_ARM11) + /* Set the Philips USB OTG XCVR in power down mode */ + tmc_power_down_usb_otg(); +#endif + +#ifdef FEATURE_SMEM + /* Set the modem status to READY */ + smem_proc_comm_set_status(SMEM_PROC_COMM_READY); +#endif /* FEATURE_SMEM */ +} + +static void tmc_order_4_init(void) +{ +} +static void tmc_order_4_exec(void) +{ +} + +static void tmc_order_5_init(void) +{ +} +static void tmc_order_5_exec(void) +{ +} + +static void tmc_order_6_init(void) +{ +} +static void tmc_order_6_exec(void) +{ +} + +static void tmc_order_7_init(void) +{ +} +static void tmc_order_7_exec(void) +{ +} + +/*=========================================================================== + +FUNCTION tmc_init + +DESCRIPTION + Initialize Task Main Controller - Called immediately after rex_init is + called. It does DMSS none protocol specific power up initialization, + queue initialization, defines timers, defines tasks and starts tasks. + + Initialization sequence: + 1. Set state of TMC task. + 2. Initial timer and command queue of TMC task. + 3. Initialize before any tasks start. + 4. Create tasks. + 5. Start service tasks + 6. Continue on initialization after serice tasks start. + 7. Start application tasks + 8. Continue on initialization after all tasks start. + 9. Update state of TMC task. + 10.if initializaion is fail, send offline cmda command to CM. + +DEPENDENCIES + It has be called before any other functions is used. + +RETURN VALUE + void + +SIDE EFFECTS + Called is stopped until it finishes. + +===========================================================================*/ +static void tmc_init(void) +{ + REX_STAT_DISABLE(); // Disable intlock profiling during startup + + tmc_set_init_state(FALSE); // Inidicate that tmc initializaiton is done + + tmc_data_reset(); // Reset TMC data + + tmc_module_init(); // Initialize queues and timers + + tmc_order_0_init(); // Inits Performed TMC Context (Global) + tmc_order_0_exec(); + + tmc_order_1_init(); // Inits Performed TMC Context (Global) + tmc_order_1_exec(); + + tmc_order_2_init(); // Inits Performed TMC Context (Global) + tmc_order_2_exec(); + + tmc_order_3_init(); // Inits Performed TMC Context (Global) + tmc_order_3_exec(); + + tmc_order_4_init(); // Inits Performed TMC Context (Global) + tmc_order_4_exec(); + + tmc_order_5_init(); // Inits Performed TMC Context (Global) + tmc_order_5_exec(); + + tmc_order_6_init(); // Inits Performed TMC Context (Global) + tmc_order_6_exec(); + + tmc_order_7_init(); // Inits Performed TMC Context (Global) + tmc_order_7_exec(); + + tmc_set_init_state(TRUE); // Inidicate that tmc initializaiton is done + + REX_STAT_ENABLE(); // Enable intlock profiling +} /* tmc_init */ + +/*=========================================================================== +============================================================================= +============================================================================= +=================================== TMC CMD ================================= +============================================================================= +============================================================================= +===========================================================================*/ + +/*=========================================================================== + +FUNCTION tmc_cmd + +DESCRIPTION + This function is called by other tasks to queue a command and send a + command signal to tmc task.Then function returns to the caller. This does + not mean that the command has been executed yet, just that it is waiting to + be executed. + +DEPENDENCIES + Free command queue and command queue have be initialized with tmc_init. + +RETURN VALUE + boolean If command queue is full, FALSE is returned. + +SIDE EFFECTS + None + +===========================================================================*/ +boolean tmc_cmd(tmc_cmd_e_type cmd) +{ + tmc_cmd_type *cmd_ptr; + + /* Dequeue a command buffer from the free command queue. + ** Point done_q_ptr to the free command queue. Set task pointer and signal + ** to NULL for now. + ** + ** The done_q_ptr is for free command buffer back to free command queue. + ** If the task pointer is non-NULL, signal the task that the tone is done. + */ + cmd_ptr = (tmc_cmd_type *) q_get(&tmc_free_cmd_q); + + if (cmd_ptr == NULL) + { + return(FALSE); + } + + cmd_ptr->hdr.done_q_ptr = &tmc_free_cmd_q; + cmd_ptr->hdr.task_ptr = NULL; + cmd_ptr->cmd_id = cmd; + + /* Queue the command. */ + q_put(&tmc_cmd_q, &cmd_ptr->hdr.link); + + /* Set the command signal to notify TMC */ + (void) rex_set_sigs(TASK_HANDLE(tmc), TMC_CMD_Q_SIG); + + return(TRUE); + +} /* tmc_cmd */ + +/*=========================================================================== + +FUNCTION tmc_get_cmd_buf + +DESCRIPTION + This function is called by other tasks to get a command buffer to pass a + command to tmc task. + +DEPENDENCIES + Free command queue has be initialized with tmc_init. + +RETURN VALUE + tmc_cmd_type If command queue is full, NULL is returned. + +SIDE EFFECTS + None + +===========================================================================*/ +tmc_cmd_type *tmc_get_cmd_buf(void) +{ + tmc_cmd_type *cmd_ptr; + + /* Dequeue a command buffer from the free command queue. + ** Point done_q_ptr to free command queue. Set task pointer and signals to + ** NULL for now. + ** + ** After command is processed, command buffer will be free back to queue + ** pointed by done_q_ptr.If task pointer is not NULL,signals will be set to + ** the task pointed by task_ptr. + */ + cmd_ptr = (tmc_cmd_type *) q_get(&tmc_free_cmd_q); + + cmd_ptr->hdr.done_q_ptr = &tmc_free_cmd_q; + cmd_ptr->hdr.task_ptr = NULL; + + return(cmd_ptr); +} + +/*=========================================================================== + +FUNCTION TMC_GET_STATE + +DESCRIPTION + + This function returns the current TMC state + +DEPENDENCIES + + None. + +RETURN VALUE + + Current TMC state. + +SIDE EFFECTS + + None. + +===========================================================================*/ +tmc_state_e_type tmc_get_state(void) +{ + return(tmc_data.state); +} + +/*=========================================================================== + +FUNCTION tmc_get_stored_esn_me + +DESCRIPTION + This function returns the stored esn_me . + +DEPENDENCIES + None + +RETURN + dword + +SIDE EFFECTS + None + +===========================================================================*/ +dword tmc_get_stored_esn_me(void) +{ + return (tmc_data.esn_me); + +} /* tmc_get_stored_esn_me */ + +/*=========================================================================== + +FUNCTION TMC_IS_INIT_DONE + +DESCRIPTION + + This function returns if the tmc initialization is done. + +DEPENDENCIES + + None. + +RETURN VALUE + TRUE if the tmc initialization is done.Otherwise return FALSE. + +SIDE EFFECTS + + None. + +===========================================================================*/ +boolean tmc_is_init_done(void) +{ + return(tmc_data.is_init_done); +} + +/*=========================================================================== + +FUNCTION tmc_get_mem_heap_size + +DESCRIPTION + This function returns the size of requested memory heap. + +DEPENDENCIES + None + +RETURN + dword + +SIDE EFFECTS + None + +===========================================================================*/ +dword tmc_get_mem_heap_size(tmc_mem_heap_e_type p_type) +{ + dword heap_size = 0; + + switch (p_type) + { + case TMC_MEM_HEAP_TYPE_THRD: + heap_size = MEM_HEAP_THRESHOLD; + break; + case TMC_MEM_HEAP_TYPE_BUF: + heap_size = TMC_HEAP_MEM_BUFFER_SIZE; + break; + case TMC_MEM_HEAP_TYPE_SMALL_BUF: + heap_size = TMC_HEAP_SMALL_MEM_BUFFER_SIZE; + break; + default: + /* invalid command mem heap enum type.*/ + TMC_ERR("A invalid mem heap enum type ",0,0,0); + break; + } + return(heap_size); +} + +/*=========================================================================== + +FUNCTION tmc_put_cmd_buf + +DESCRIPTION + This function is called by other tasks to queue a command and send a + command signal to tmc task.Then function returns to the caller. This does + not mean that the command has been executed yet, just that it is waiting to + be executed. + +DEPENDENCIES + Command queue has be initialized with tmc_init. + +RETURN VALUE + void + +SIDE EFFECTS + None + +===========================================================================*/ +void tmc_put_cmd_buf(tmc_cmd_type *cmd_ptr) +{ + if ( cmd_ptr != NULL ) + { + q_put(&tmc_cmd_q, &cmd_ptr->hdr.link); /* Queue the command. */ + + (void) rex_set_sigs(TASK_HANDLE(tmc), TMC_CMD_Q_SIG); /* Set the command signal to notify TMC */ + } +} + +/*=========================================================================== + +FUNCTION tmc_task_start + +DESCRIPTION + This function is called by each task when it is created. The function + then performs the startup processing for the calling task. The function + first sets the acknowledge signal back to TMC to acknowledge that is had + been created. It then waits for the start signal back to it. While + waiting for the start signal and keeps kicking the watchdog timer + everytime its interval timer has expired. When it gets the start + signal it acknowledges it back to TMC and it then returns to the caller. + The caller task is now formally started and it can start normal application + processing. + +DEPENDENCIES + TMC task has to be started. + +RETURN VALUE + void + +SIDE EFFECTS + The calling task stays here until it receives the START signal. + +===========================================================================*/ +void tmc_task_start(void) +{ + tmc_set_ack_task(rex_self()); + + (void) rex_set_sigs(TASK_HANDLE(tmc), TMC_ACK_SIG); /* Acknowledge task creation. */ + + (void) rex_wait(TASK_START_SIG); /* Wait for the start signal */ + + (void) rex_clr_sigs(rex_self(), TASK_START_SIG); /* Clear task start signal. */ + + tmc_set_ack_task(rex_self()); + + (void) rex_set_sigs(TASK_HANDLE(tmc), TMC_ACK_SIG); /* If start signal is set then signal back to TMC and return to caller. */ + +} /* tmc_task_start*/ + +void tmc_task_start_ex(tmc_task_start_client_cb_type clnt_cb) // DEPRECATE +{ + tmc_set_ack_task(rex_self()); + + (void) rex_set_sigs(TASK_HANDLE(tmc), TMC_ACK_SIG); /* Acknowledge task creation. */ + + (void) rex_wait(TASK_START_SIG); /* Wait for the start signal */ + + (void) rex_clr_sigs(rex_self(), TASK_START_SIG); /* Clear task start signal. */ + + clnt_cb(); /* Call client callback */ + + tmc_set_ack_task(rex_self()); + + (void) rex_set_sigs(TASK_HANDLE(tmc), TMC_ACK_SIG); /* If start signal is set then signal back to TMC and return to caller. */ + +} /* tmc_task_start*/ + +/*=========================================================================== + +FUNCTION tmc_task_ack + +DESCRIPTION + This function sends acknowledge signal to Task Main Control task by caller + +DEPENDENCIES + Task Main Control task is running. + +RETURN VALUE + void + +SIDE EFFECTS + none + +===========================================================================*/ +void tmc_task_ack(void) +{ + tmc_set_ack_task(rex_self()); + + (void) rex_set_sigs(TASK_HANDLE(tmc), TMC_ACK_SIG); + +} /* tmc_ack */ + +/*=========================================================================== + +FUNCTION tmc_task_stop + +DESCRIPTION + This function is called by each task when it stops. The function then + performs the stop processing for the calling task. The function + sets the acknowledge signal back to TMC to acknowledge that is had + been stopped. + +DEPENDENCIES + Task Main Control task is running. + +RETURN VALUE + void + +SIDE EFFECTS + none + +===========================================================================*/ +void tmc_task_stop(void) +{ + tmc_set_ack_task(rex_self()); + + (void) rex_set_sigs(TASK_HANDLE(tmc), TMC_ACK_SIG); + +} /* tmc_task_stop */ + +/*=========================================================================== + +FUNCTION tmc_task_offline + +DESCRIPTION + This function is called by each task when it goes offline. The function + then performs the offline processing for the calling task. The function + sets the acknowledge signal back to TMC to acknowledge that is had + been offline. + +DEPENDENCIES + Task Main Control task is running. + +RETURN VALUE + void + +SIDE EFFECTS + none + +===========================================================================*/ +void tmc_task_offline(void) +{ + tmc_set_ack_task(rex_self()); + + (void) rex_set_sigs(TASK_HANDLE(tmc), TMC_ACK_SIG); + +} /* tmc_task_offline */ + +/*=========================================================================== + +FUNCTION tmc_malloc + +DESCRIPTION + This function allocate the memmory from tmc heap. + If the number of bytes to allocate is less than the memory threshold, use + tmc_heap_small_size otherwise use the tmc_heap_size. + +DEPENDENCIES + None + +RETURN VALUE + the pointer to the tmc heap. + +SIDE EFFECTS + +===========================================================================*/ +void *tmc_malloc_debug(size_t size, char *file_name, unsigned int line_number) +{ + if(size <= tmc_get_mem_heap_size(TMC_MEM_HEAP_TYPE_THRD) ) + { +#ifdef FEATURE_MEM_DEBUG + return(mem_malloc_debug(&tmc_heap_small, size, file_name, line_number)); +#else + return( mem_malloc(&tmc_heap_small,size) ); +#endif + } + else + { +#ifdef FEATURE_MEM_DEBUG + return(mem_malloc_debug(&tmc_heap, size, file_name, line_number)); +#else + return( mem_malloc(&tmc_heap, size) ); +#endif + } +} + +/*=========================================================================== + +FUNCTION tmc_free + +DESCRIPTION + This function free the memmory allocated tmc heap. + If the memory is in the range of tmc heap or tmc small heap, free per + request. + Otherwise, return the error message. + +DEPENDENCIES + None + +RETURN VALUE + None + +SIDE EFFECTS + +===========================================================================*/ +void tmc_free_debug(void *ptr, char *file_name, unsigned int line_number) +{ + if((ptr >= (void *) tmc_heap_small_mem_buffer) && + (ptr < (void *)(tmc_heap_small_mem_buffer + tmc_get_mem_heap_size(TMC_MEM_HEAP_TYPE_SMALL_BUF)))) + { /*lint -e424 *//* inappropriate free for static data */ +#ifdef FEATURE_MEM_DEBUG + mem_free_debug(&tmc_heap_small, ptr, file_name, line_number); +#else + mem_free( &tmc_heap_small, ptr ); +#endif + } + else if((ptr >= (void *) tmc_heap_mem_buffer) && + (ptr < (void *)(tmc_heap_mem_buffer + tmc_get_mem_heap_size(TMC_MEM_HEAP_TYPE_BUF)))) + { /*lint -e424 *//* inappropriate free for static data */ +#ifdef FEATURE_MEM_DEBUG + mem_free_debug(&tmc_heap, ptr, file_name, line_number); +#else + mem_free( &tmc_heap, ptr ); +#endif + } + else + { + TMC_ERR_FATAL("Mem Free error : Invalid Heap enountered",0,0,0); + } +} + +/*=========================================================================== + +FUNCTION tmc_realloc + +DESCRIPTION + This function allocate the memmory from tmc heap. + If the memory is in the range of tmc heap or tmc small heap, reallocate the + memory per request. + Otherwise, return the error message. + +DEPENDENCIES + None + +RETURN VALUE + the pointer to the tmc heap. + +SIDE EFFECTS + +===========================================================================*/ +void *tmc_realloc_debug(void *ptr, size_t size, char *file_name, unsigned int line_number) +{ + if((ptr >= (void *) tmc_heap_small_mem_buffer) && + (ptr < (void *)(tmc_heap_small_mem_buffer + tmc_get_mem_heap_size(TMC_MEM_HEAP_TYPE_SMALL_BUF)))) + { +#ifdef FEATURE_MEM_DEBUG + return(mem_realloc_debug(&tmc_heap_small, ptr, size, file_name, line_number)); +#else + return (mem_realloc(&tmc_heap_small, ptr, size)); +#endif + } + else if((ptr >= (void *) tmc_heap_mem_buffer) && + (ptr < (void *)(tmc_heap_mem_buffer + tmc_get_mem_heap_size(TMC_MEM_HEAP_TYPE_BUF)))) + { +#ifdef FEATURE_MEM_DEBUG + return(mem_realloc_debug(&tmc_heap, ptr, size, file_name, line_number)); +#else + return (mem_realloc(&tmc_heap, ptr, size)); +#endif + } + + TMC_ERR_FATAL("Memory Reallocate Error: Invalid Heap enountered",0,0,0); + + /*lint +e527 */ return (NULL); +} + +/*=========================================================================== + +FUNCTION tmc_task + +DESCRIPTION + This function is entrance of the Task Main Controller. It is responsible + for none protocol specific power up initialization and task related + operation, such as define, start, offline, power down, stop, and LPM. + +DEPENDENCIES + None + +RETURN VALUE + None. + +SIDE EFFECTS + Reset and powerdown processing are special in that they cause the + complete DMSS software to either restart or to be shutdown. + +===========================================================================*/ +void tmc_task(dword ignored) +{ +#ifdef DOG_DYNAMIC_API + tmc_dog_rpt_var = dog_register(TASK_HANDLE(tmc), DOG_DEFAULT_TIMEOUT, DOG_DEADLKCHK_DISABLE); + tmc_dog_rpt_time_var = dog_get_report_period(tmc_dog_rpt_var); +#endif + + tmc_init(); /* TMC timer, queue init: define and start all other tasks */ + + (void) rex_set_sigs(rex_self(), TMC_RPT_TIMER_SIG); /* Set the watchdog report timer signal */ + + for(;;) + { + rex_sigs_type received_sigs = rex_wait(TMC_CMD_Q_SIG | TMC_RPT_TIMER_SIG); /* Perform the rex wait. */ + + if (received_sigs & TMC_RPT_TIMER_SIG) /* Process report timer signal. */ + { + tmc_dog_report(); + } + + if (received_sigs & TMC_CMD_Q_SIG) /* Process command signal and update state of TMC task. */ + { + (void) rex_clr_sigs( rex_self(), TMC_CMD_Q_SIG ); + + tmc_dispatch_commands(); + } + + } /* for (;;) */ + + /*lint -esym(715, ignored) */ ignored = ignored; + +} /* tmc_task */