LCOV - code coverage report
Current view: top level - home/runner/zephyrproject/zephyr/arch/posix/core - cpuhalt.c (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 9 0.0 %
Date: 2024-09-16 20:15:30 Functions: 0 2 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Copyright (c) 2011-2015 Wind River Systems, Inc.
       3                 :            :  * Copyright (c) 2017 Oticon A/S
       4                 :            :  *
       5                 :            :  * SPDX-License-Identifier: Apache-2.0
       6                 :            :  */
       7                 :            : /**
       8                 :            :  * @file  CPU power management code for POSIX
       9                 :            :  *
      10                 :            :  * This module provides:
      11                 :            :  *
      12                 :            :  * An implementation of the architecture-specific
      13                 :            :  * arch_cpu_idle() primitive required by the kernel idle loop component.
      14                 :            :  * It can be called within an implementation of _pm_save_idle(),
      15                 :            :  * which is provided for the kernel by the platform.
      16                 :            :  *
      17                 :            :  * An implementation of arch_cpu_atomic_idle(), which
      18                 :            :  * atomically re-enables interrupts and enters low power mode.
      19                 :            :  *
      20                 :            :  * A weak stub for sys_arch_reboot(), which does nothing
      21                 :            :  */
      22                 :            : 
      23                 :            : #include "posix_core.h"
      24                 :            : #include "posix_board_if.h"
      25                 :            : #include <zephyr/arch/posix/posix_soc_if.h>
      26                 :            : #include <zephyr/tracing/tracing.h>
      27                 :            : 
      28                 :            : #if !defined(CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT)
      29                 :            : #error "The POSIX architecture needs a custom busy_wait implementation. \
      30                 :            : CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT must be selected"
      31                 :            : /* Each POSIX arch board (or SOC) must provide an implementation of
      32                 :            :  * arch_busy_wait()
      33                 :            :  */
      34                 :            : #endif
      35                 :            : 
      36                 :          0 : void arch_cpu_idle(void)
      37                 :            : {
      38                 :          0 :         sys_trace_idle();
      39                 :          0 :         posix_irq_full_unlock();
      40                 :          0 :         posix_halt_cpu();
      41                 :          0 : }
      42                 :            : 
      43                 :          0 : void arch_cpu_atomic_idle(unsigned int key)
      44                 :            : {
      45                 :          0 :         sys_trace_idle();
      46                 :          0 :         posix_atomic_halt_cpu(key);
      47                 :          0 : }
      48                 :            : 
      49                 :            : #if defined(CONFIG_REBOOT)
      50                 :            : /**
      51                 :            :  * @brief Stub for sys_arch_reboot
      52                 :            :  *
      53                 :            :  * Does nothing
      54                 :            :  */
      55                 :            : void __weak sys_arch_reboot(int type)
      56                 :            : {
      57                 :            :         posix_print_warning("%s called with type %d. Exiting\n",
      58                 :            :                                                 __func__, type);
      59                 :            :         posix_exit(1);
      60                 :            : }
      61                 :            : #endif /* CONFIG_REBOOT */

Generated by: LCOV version 1.14