SoC Common: vrtc/rtc: optimize driver printf [1/1]
PD#SWPL-195141
Problem:
optimize vrtc/rtc driver printf
Solution:
fix code
Verify:
t5m
Change-Id: I64b1c940067dfb0810f205cbc4a5cf82206406a2
Signed-off-by: yiting.deng <yiting.deng@amlogic.com>
diff --git a/rtc/rtc.c b/rtc/rtc.c
index e6645b8..be6fc11 100644
--- a/rtc/rtc.c
+++ b/rtc/rtc.c
@@ -21,7 +21,13 @@
#include "interrupt_control_eclic.h"
#undef TAG
-#define TAG "AOCPU RTC"
+#define TAG "RTC"
+
+#ifdef RTC_DEBUG
+#define RTC_DBG(...) printf(__VA_ARGS__)
+#else
+#define RTC_DBG(...)
+#endif
static TimerHandle_t xAlarmTimer;
static int alarm_flags;
@@ -109,7 +115,7 @@
{
unsigned int val = *(uint32_t *)msg;
- printf("[%s]: %s val=0x%x\n", TAG, __func__, val);
+ RTC_DBG("[%s]: %s val=0x%x\n", TAG, __func__, val);
set_rtc(val);
return NULL;
@@ -123,7 +129,7 @@
memset(msg, 0, MBOX_BUF_LEN);
*(uint32_t *)msg = val;
- printf("[%s]: %s val=0x%x\n", TAG, __func__, val);
+ RTC_DBG("[%s]: %s val=0x%x\n", TAG, __func__, val);
return NULL;
}
@@ -149,7 +155,7 @@
if (val > 0) {
ret = RegisterIrq(RTC_IRQ, 6, vRTCInterruptHandler);
if (ret)
- printf("RTC_irq RegisterIrq error, ret = %d\n", ret);
+ printf("RTC_irq Register err, ret = %d\n", ret);
EnableIrq(RTC_IRQ);
printf("[%s]: alarm val=%d S\n", TAG, val);
if (xAlarmTimer != NULL) {
@@ -168,7 +174,7 @@
DisableIrq(RTC_IRQ);
ret = UnRegisterIrq(RTC_IRQ);
if (ret)
- printf("RTC_irq UnRegisterIrq error, ret = %d\n", ret);
+ printf("RTC_irq UnRegister err, ret = %d\n", ret);
}
}
@@ -180,10 +186,10 @@
status = REG32(RTC_DIG_INT_STATUS) & 0x1;
if (status && !alarm_flags) {
- printf("warning: rtc interrupt lost!trigger rtc interrupt manually!\n");
+ printf("warning: rtc irq lost! trigger it manually!\n");
irq_num = RTC_IRQ % 32;
reg_val = REG32(IRQCTRL_IRQ_LATCH4) >> irq_num & 0x1;
- printf("[%s]: timer read rtc irqctrl status: 0x%x !!\n", TAG, reg_val);
+ printf("[%s]: irqctrl status: 0x%x !!\n", TAG, reg_val);
rtc_irq = GetIrqInner(RTC_IRQ);
if (rtc_irq)
eclic_set_pending(rtc_irq);
@@ -201,7 +207,7 @@
irq_num = RTC_IRQ % 32;
reg_val = REG32(IRQCTRL_IRQ_LATCH4) >> irq_num & 0x1;
- printf("[%s]: rtc irqctrl status: 0x%x !!\n", TAG, reg_val);
+ printf("[%s]: irqctrl status: 0x%x !!\n", TAG, reg_val);
if (reg_val)
REG32(IRQCTRL_IRQ_LATCH_CLR4) |= (0x1 << irq_num);
reg_val = REG32(IRQCTRL_IRQ_LATCH4) >> irq_num & 0x1;
@@ -218,7 +224,7 @@
int ret;
uint32_t reboot_mode;
- printf("[%s]: init rtc\n", TAG);
+ RTC_DBG("[%s]: init rtc\n", TAG);
ret = xInstallRemoteMessageCallbackFeedBack(AOREE_CHANNEL, MBX_CMD_SET_RTC, MboxSetRTC, 0);
if (ret)