[Feature][ZXW-65]merged P49 base code
Change-Id: I3e09c0c3d47483bc645f02310380ecb7fc6f4041
diff --git a/ap/app/zte_comm/rtc-service/rtc-service.c b/ap/app/zte_comm/rtc-service/rtc-service.c
index 481c550..f60984d 100755
--- a/ap/app/zte_comm/rtc-service/rtc-service.c
+++ b/ap/app/zte_comm/rtc-service/rtc-service.c
@@ -704,6 +704,7 @@
list_for_each_entry_safe(pTmp, pTmp1, &rtc_timer_list, list) {
buf.module = pTmp->rtc_id;
ipc_send_message2(MODULE_ID_RTC_SERVICE, pTmp->module_id, RTC_MSG_TIME_CHANGED, sizeof(RTC_DATA_BUF), (unsigned char*)&buf, 0);
+ if(pTmp->is_utc){
if (pTmp->interval + pTmp->time_val < sec) {
list_del(&pTmp->list);
slog(RTC_PRINT, SLOG_NORMAL, "rtc-service: delete ELAPSED timer, alarm_id(%d), alarm_time(%ld).\n", pTmp->rtc_id, (pTmp->interval + pTmp->time_val));
@@ -712,6 +713,7 @@
pTmp->remain_time = pTmp->interval + pTmp->time_val - sec;
slog(RTC_PRINT, SLOG_NORMAL, "rtc-service: timer adjust, alarm_id(%d), alarm_time(%ld), remain(%ld).\n", pTmp->rtc_id, (pTmp->interval + pTmp->time_val), pTmp->remain_time);
}
+ }
}
alarm_restart(&rtc_timer_list);
#else
@@ -748,12 +750,30 @@
ALARM_T *pTmp, *pTmp1;
RTC_DATA_BUF buf = {0};
int wakeup = 0;
+ int ret =0;
+ enum RTC_MSG_CMD cmd = 0;
if (rtc_list == &rtc_timer_list) {
list_for_each_entry_safe(pTmp, pTmp1, rtc_list, list) {
if (pTmp->remain_time <= 0) {
buf.module = pTmp->rtc_id;
- ipc_send_message2(MODULE_ID_RTC_SERVICE, pTmp->module_id, RTC_MSG_ALARM_ELAPSED, sizeof(RTC_DATA_BUF), (unsigned char*)&buf, 0);
+ if(pTmp->cpu == RTC_CPU_CAP)
+ {
+ buf.srcModule = pTmp->module_id;
+ buf.cpu = RTC_CPU_AP;
+ buf.is_utc = pTmp->is_utc;
+ cmd = RTC_MSG_TIMER_TIMEOUT;
+ slog(RTC_PRINT, SLOG_NORMAL, "[rtc] handle_alarm_timeout: send to cap cmd:0x%x, srcMod:0x%x, module:0x%x, utc:%d \n", cmd, buf.srcModule, buf.module, buf.is_utc);
+ ret = send_soc_msg(FAR_PS, MODULE_ID_RTC_SERVICE, cmd, sizeof(RTC_DATA_BUF), (void *)&buf);
+ if (ret != 0)
+ {
+ slog(RTC_PRINT, SLOG_ERR, "rtc-service: send_soc_msg unexpected,ret:%d\n",ret);;
+ }
+ }
+ else
+ {
+ ipc_send_message2(MODULE_ID_RTC_SERVICE, pTmp->module_id, RTC_MSG_ALARM_ELAPSED, sizeof(RTC_DATA_BUF), (unsigned char*)&buf, 0);
+ }
list_del(&pTmp->list);
free(pTmp);
}
@@ -765,8 +785,24 @@
wakeup = pTmp->wakeup;
buf.module = pTmp->rtc_id;
- buf.time_val = pTmp->time_val + pTmp->interval;
- ipc_send_message2(MODULE_ID_RTC_SERVICE, pTmp->module_id, RTC_MSG_ALARM_ELAPSED, sizeof(RTC_DATA_BUF), (unsigned char*)&buf, 0);
+ buf.time_val = pTmp->time_val + pTmp->interval;
+ if(pTmp->cpu == RTC_CPU_CAP)
+ {
+ buf.srcModule = pTmp->module_id;
+ buf.cpu = RTC_CPU_AP;
+ buf.is_utc = pTmp->is_utc;
+ cmd = RTC_MSG_ALARM_TIMEOUT;
+ slog(RTC_PRINT, SLOG_NORMAL, "[rtc] handle_alarm_timeout: send to cap cmd:0x%x, srcMod:0x%x, module:0x%x, utc:%d \n", cmd, buf.srcModule, buf.module, buf.is_utc);
+ ret = send_soc_msg(FAR_PS, MODULE_ID_RTC_SERVICE, cmd, sizeof(RTC_DATA_BUF), (void *)&buf);
+ if (ret != 0)
+ {
+ slog(RTC_PRINT, SLOG_ERR, "rtc-service: send_soc_msg unexpected,ret:%d\n",ret);;
+ }
+ }
+ else
+ {
+ ipc_send_message2(MODULE_ID_RTC_SERVICE, pTmp->module_id, RTC_MSG_ALARM_ELAPSED, sizeof(RTC_DATA_BUF), (unsigned char*)&buf, 0);
+ }
list_del(&pTmp->list);
free(pTmp);
}