% # @file custom_check.goilTemplate # # @section desc File description # # Custom checking for MPC5643L - TIMING PROTECTION # # @section copyright Copyright # # Trampoline OS # # Trampoline is copyright (c) IRCCyN # Trampoline is protected by the French intellectual property law. # # This software is distributed under the Lesser GNU Public Licence # # @section infos File informations # # $Date$ # $Rev$ # $Author$ # $URL$ # let OS::TIMINGPROTECTION_WATCHDOG := exists OS::TIMINGPROTECTION_WATCHDOG default (@()) # ----------------------------------------------------------------------------- # ERROR # The watchdog must use a pit channel or the decrementer # foreach watchdog in OS::TIMINGPROTECTION_WATCHDOG do if watchdog::SOURCE != "decrementer" & watchdog::SOURCE != "pit_ch0" & watchdog::SOURCE != "pit_ch1" & watchdog::SOURCE != "pit_ch2" & watchdog::SOURCE != "pit_ch3" then error watchdog::NAME : "Watchdog must use a pit channel. Possible values : " + "pit_ch0, pit_ch1, pit_ch2, pit_ch3, decrementer" end if end foreach # ----------------------------------------------------------------------------- # ERROR # Watchdog must not have any other Counter on its source # foreach watchdog in OS::TIMINGPROTECTION_WATCHDOG do foreach counter in HARDWARECOUNTERS do if watchdog::NAME != counter::NAME & watchdog::SOURCE == counter::SOURCE & watchdog::SOURCE != "decrementer" then error counter::SOURCE : "This Source is reserved for the " + "watchdog \"" + watchdog::NAME + "\"" end if end foreach end foreach # ----------------------------------------------------------------------------- # ERROR # Each core that has a timing protected task/isr must have a watchdog # let task_map := mapof TASK by NAME let isr_map := mapof ISRS by NAME loop core_id from 0 to OS::NUMBER_OF_CORES - 1 do let has_tp := false let protected_task let has_wdg := false # Get if the core has a task/isr timing protected let core_tasks := getCoreAttributes(OS, APPLICATIONS, core_id, TASK, "TASK") let core_isrs := getCoreAttributes(OS, APPLICATIONS, core_id, ISRS, "ISR") foreach task in core_tasks do let task_tp := task::TIMING_PROTECTION if task_tp then let has_tp := true let protected_task := task end if end foreach foreach isr in core_isrs do let isr_tp := isr::TIMING_PROTECTION if isr_tp then let has_tp := true end if end foreach # Get if the core has a wdg timer foreach watchdog in OS::TIMINGPROTECTION_WATCHDOG do if watchdog::CORE == core_id then let has_wdg := true end if end foreach # Error checking if has_tp & not has_wdg then error protected_task::TIMING_PROTECTION : "The core " + [core_id string] + " has a timing protected " + "task/isr but no watchdog has been defined for this core.\n" + "Fix : Define a watchdog under OS::TIMINGPROTECTION_WATCHDOG." end if end loop %