# /space/home/slher/rel/Beken/v6_4_5/macsw/plf/refip/src/arch/tl4xx/ll/tl4/ll.h File Reference

Declaration of low level functions. More...

`#include <asm-dsp.h>`
`#include "critical_nesting.h"`
`#include "reg_intc.h"`

Go to the source code of this file.

## Defines
#define | GLOBAL_INT_START()
| Enable interrupts globally in the system.
#define | GLOBAL_INT_STOP() _dsp_asm("dint")
| Disable interrupts globally in the system.
#define | GLOBAL_INT_DISABLE()
| Disable interrupts globally in the system.
#define | GLOBAL_INT_RESTORE()
| Restore interrupts from the previous global disable.
#define | BARRIER() __asm__ volatile("" : : : "memory");
| Force a memory barrier to be inserted.
#define | WFI()
| Invoke the wait for interrupt procedure of the processor.
## Functions
void | rwnxl_wakeup (void)
| This function performs the wake up from DOZE mode.
__INLINE uint32_t | return_address (void)
| Return address to return to.

## Detailed Description

Declaration of low level functions.

Copyright (C) RivieraWaves 2011-2019

Definition in file ll.h.

## Define Documentation

#define BARRIER | ( |  | ) | __asm__ volatile("" : : : "memory");

Force a memory barrier to be inserted.

Definition at line 121 of file ll.h.

#define GLOBAL_INT_DISABLE | ( |  | ) |

Value:

    do {                                                                                     \
        long __l_irq_rest;                                                                   \
        long __l_temp;                                                                       \
                                                                                             \
        /* Load mod1 register */                                                             \
        __asm__ volatile ("mov mod1, %0" :"=&dhjlx" (__l_temp):);                            \
                                                                                             \
        /* Store mod1 in local variable for later restoring */                               \
        __l_irq_rest = __l_temp;                                                             \
                                                                                             \
        /* Clear IE bit */                                                                   \
        __l_temp &= 0xFFFFFFFE;                                                              \
                                                                                             \
        /* Add some nops */                                                                  \
        __asm__ volatile ("nop 2");                                                          \
                                                                                             \
        /* Store mod1 */                                                                     \
        __asm__ volatile ("mov %0, mod1" :: "zdlx" (__l_temp));                              \
                                                                                             \
        /* Increment the critical section nesting level */                                   \
        CRITICAL_NESTING_INC();

Disable interrupts globally in the system.

This macro must be used in conjunction with the GLOBAL_INT_RESTORE macro since this last one will close the brace that the current macro opens. This means that both macros must be located at the same scope level.

Definition at line 78 of file ll.h.

Referenced by apm_start_cac_req_handler(), apm_stop_cac_req_handler(), bfr_start_next_calibration(), chan_conn_less_ctxt_end(), chan_switch_channel(), chan_switch_start(), dma_push(), ke_task_saved_update(), ke_timer_hw_set(), macif_tx_cfm_done(), me_rc_stats_req_handler(), me_update_buffer_control(), mm_ap_tbtt(), mm_reset_req_handler(), mm_timer_hw_set(), p2p_update_go_ps_state(), txl_cfm_evt(), txl_frame_evt(), and txu_cntrl_discard().

#define GLOBAL_INT_RESTORE | ( |  | ) |

Value:

    /* Decrement the critical section nesting level */                                   \
        CRITICAL_NESTING_DEC();                                                              \
                                                                                             \
        /* Restore mod1 to its previous value */                                             \
        __asm__ volatile ("mov %0, mod1" :: "zdlx" (__l_irq_rest));                          \
    } while(0)

Restore interrupts from the previous global disable.

See also:
  GLOBAL_INT_DISABLE

Definition at line 107 of file ll.h.

Referenced by apm_start_cac_req_handler(), apm_stop_cac_req_handler(), bfr_start_next_calibration(), chan_conn_less_ctxt_end(), chan_switch_channel(), chan_switch_start(), dma_push(), ke_task_saved_update(), ke_timer_hw_set(), macif_tx_cfm_done(), me_rc_stats_req_handler(), me_update_buffer_control(), mm_ap_tbtt(), mm_reset_req_handler(), mm_timer_hw_set(), p2p_update_go_ps_state(), txl_cfm_evt(), txl_frame_evt(), and txu_cntrl_discard().

#define GLOBAL_INT_START | ( |  | ) |

Value:

    do                                                                                       \
    {                                                                                        \
        long __l_mod1;                                                                       \
                                                                                             \
        /* Load mod1 register */                                                             \
        __asm__ volatile ("mov mod1, %0" :"=&dhjlx" (__l_mod1):);                            \
                                                                                             \
        /* Set IM0 bit */                                                                    \
        __l_mod1 |= 0x00000002;                                                              \
                                                                                             \
        /* Add some nops */                                                                  \
        __asm__ volatile ("nop 2");                                                          \
                                                                                             \
        /* Store mod1 */                                                                     \
        __asm__ volatile ("mov %0, mod1" :: "zdlx" (__l_mod1));                              \
                                                                                             \
        /* Add some nops */                                                                  \
        __asm__ volatile ("nop 2");                                                          \
                                                                                             \
        /* Enable global maskable interrupt bit */                                           \
        __asm__ volatile ("eint");                                                           \
                                                                                             \
        /* Add some nops */                                                                  \
        __asm__ volatile ("nop 2");                                                          \
    } while(0)

Enable interrupts globally in the system.

This macro must be used when the initialization phase is over and the interrupts can start being handled by the system.

Definition at line 34 of file ll.h.

#define GLOBAL_INT_STOP | ( |  | ) | _dsp_asm("dint")

Disable interrupts globally in the system.

This macro must be used when the system wants to disable all the interrupt it could handle.

Definition at line 68 of file ll.h.

#define WFI | ( |  | ) |

Value:

    do {                                                                                     \
        DBG_CPU_SLEEP_START();                                                               \
        while(!(intc_irq_status_get(0) || intc_irq_status_get(1)));                          \
        DBG_CPU_SLEEP_END();                                                                 \
    } while (0)

Invoke the wait for interrupt procedure of the processor.

Definition at line 131 of file ll.h.

## Function Documentation

__INLINE uint32_t return_address | ( | void |  | ) |

Return address to return to.

Return address is saved in retreg register. However in "big" function compiler will automatically add a call to _call_saved_store_xxx function at the beginning which will override retreg register before this function can be called. In such cases previous value of retreg register is available in r2 when returning form this function. As such this function MUST be called at the very beginning (before r2 is overwritten with something else). It other cases (i.e. "small" functions) this function will return an undefined value. Adding a call to trace function to print this value is enough to include a call to _call_save_store_xxx so for now always trace r2.

Returns:
  return r2

Definition at line 155 of file ll.h.