The system controller timer service is responsible for:
Watchdog - The watchdog resource is managed by the SCU. The SCFW exposes a "virtual" watchdog to all CPUs. This virtual watchdog is managed by software and it is based on a low power timer, the SCU also features a physical watchdog timer that is used to ensure the correct operation of the device.
Some of the features implemented by this watchdog service are:
- Update of the watchdog timeout
- Start/stop of the watchdog
- Refresh of the watchdog
- Return of the watchdog status such as maximum watchdog timeout that can be set, watchdog timeout interval, and watchdog timeout interval remaining.
Since this is usually handled by the OS itself no examples are provided in this guide.
Real Time Clock (RTC) - The SCFW is responsible for providing access to the RTC. The features supported by the API are:
- Set/get time
- Setting alarms
Only the partition that owns the SC_R_SYSTEM resource is allowed to set the time, alarms and calibration values for the RTC. All other partitions are able to read the RTC time.
Here is an example on setting the RTC from the M4 side:
uint8_t sec;} rtc_time;
sc_ipc_t ipc;/* Open IPC channel */
sc_status =sc_ipc_open(&ipc, SC_IPC_AP_CH0);if(sc_status != SC_ERR_NONE)printf("Error opening Inter Processor Channel\n");/* Initialize RTC *//* Hard code RTC time to January 5th 2018 at 12:00 hours */
sc_status =sc_timer_set_rtc_time(ipcHandle,2018,1,5,12,0,0);if(sc_status != SC_ERR_NONE)printf("Error initializing RTC. \r\n");/* Return time */
sc_status =sc_timer_get_rtc_time(ipcHandle,&(rtc_time.year),&(rtc_time.month),&(rtc_time.day),&(rtc_time.hour),&(rtc_time.min),&(rtc_time.sec));printf("Year: %d, Month: %d, Day: %d, Hour: %d, Minutes: %d, Seconds: %d. \r\n", rtc_time.year, rtc_time.month, rtc_time.day, rtc_time.hour, rtc_time.min, rtc_time.sec);