59 lines
1.1 KiB
C
59 lines
1.1 KiB
C
/**
|
|
****************************************************************************************
|
|
*
|
|
* @file ll.h
|
|
*
|
|
* @brief Declaration of low level functions.
|
|
*
|
|
* Copyright (C) RivieraWaves 2009-2015
|
|
*
|
|
*
|
|
****************************************************************************************
|
|
*/
|
|
|
|
#ifndef LL_H_
|
|
#define LL_H_
|
|
|
|
#ifndef __arm__
|
|
#error "File only included with RVDS!"
|
|
#endif // __arm__
|
|
|
|
#include <stdint.h>
|
|
#include "arch.h"
|
|
#include "reg_intc.h"
|
|
|
|
/** @brief 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.
|
|
*/
|
|
#define GLOBAL_INT_START() ; \
|
|
do { \
|
|
__enable_irq(); \
|
|
} while(0);
|
|
|
|
#define GLOBAL_INT_STOP() ; \
|
|
do { \
|
|
__disable_irq(); \
|
|
} while(0);
|
|
|
|
#define GLOBAL_INT_DISABLE() ; \
|
|
do { \
|
|
uint32_t irq_temp; \
|
|
irq_temp = __disable_irq();
|
|
#define GLOBAL_INT_RESTORE() ; \
|
|
if(!irq_temp) \
|
|
{ \
|
|
__enable_irq(); \
|
|
} \
|
|
} while(0);
|
|
|
|
#define WFI() ; \
|
|
do { \
|
|
__wfi(); \
|
|
}while(0);
|
|
|
|
|
|
#endif // LL_H_
|
|
|
|
|