hpw422移植新的sdk

This commit is contained in:
xushaoxiang
2026-07-03 18:08:25 +08:00
commit 945a5a5b0b
2583 changed files with 713209 additions and 0 deletions
@@ -0,0 +1,78 @@
/*!
* \file hal_board_cfg.h
*
* \brief The header of xc_drv_aotimer.c
*
* \copyright Revised BSD License, see section \ref LICENSE.
*
* \code
*
* _ __ _ ________ _
* | |/ /(_)___ / ____/ /_ (_)___
* | // / __ \/ / / __ \/ / __ \
* / |/ / / / / /___/ / / / / /_/ /
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
* /_/
* (C) 2022-2025 XinChip
*
* \endcode
*
* \author ( XinChip ) Alex-J
*
* \author ( XinChip )
*/
#ifndef HAL_BOARD_CFG_H
#define HAL_BOARD_CFG_H
/* ------------------------------------------------------------------------------------------------
* Includes
* ------------------------------------------------------------------------------------------------
*/
#include "hal_mcu.h"
#include "hal_defs.h"
#include "hal_types.h"
/* ------------------------------------------------------------------------------------------------
* LED Configuration
* ------------------------------------------------------------------------------------------------
*/
#define HAL_LED_BLINK_DELAY() st( { volatile uint32 i; for (i=0; i<0x5800; i++) { }; } )
/* ----------- Debounce ---------- */
#define HAL_DEBOUNCE(expr) \
{ \
int i; \
for (i = 0; i < 500; i++) \
{ \
if (!(expr)) \
i = 0; \
} \
}
/* ----------- Push Buttons ---------- */
#define HAL_PUSH_BUTTON1()
#define HAL_PUSH_BUTTON2()
#define HAL_PUSH_BUTTON3()
#define HAL_PUSH_BUTTON4()
#define HAL_PUSH_BUTTON5()
#define HAL_PUSH_BUTTON6()
/* ----------- LED's ---------- */
#define HAL_TURN_ON_LED1()
#define HAL_TURN_ON_LED2()
#define HAL_TURN_ON_LED3()
#define HAL_TURN_ON_LED4()
#define HAL_TURN_OFF_LED1()
#define HAL_TURN_OFF_LED2()
#define HAL_TURN_OFF_LED3()
#define HAL_TURN_OFF_LED4()
#define HAL_BOARD_INIT()
#endif
/*******************************************************************************************************
*/
+151
View File
@@ -0,0 +1,151 @@
/*!
* \file hal_mcu.h
*
* \brief The header of hal_mcu.c
*
* \copyright Revised BSD License, see section \ref LICENSE.
*
* \code
*
* _ __ _ ________ _
* | |/ /(_)___ / ____/ /_ (_)___
* | // / __ \/ / / __ \/ / __ \
* / |/ / / / / /___/ / / / / /_/ /
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
* /_/
* (C) 2022-2025 XinChip
*
* \endcode
*
* \author ( XinChip ) Alex-J
*
* \author ( XinChip )
*/
#ifndef _HAL_MCU_H
#define _HAL_MCU_H
/* ------------------------------------------------------------------------------------------------
* Includes
* ------------------------------------------------------------------------------------------------
*/
#include "hal_defs.h"
#include "hal_types.h"
/* ------------------------------------------------------------------------------------------------
* Target Defines
* ------------------------------------------------------------------------------------------------
*/
// #define HAL_MCU_CC2530
/* ------------------------------------------------------------------------------------------------
* Compiler Abstraction
* ------------------------------------------------------------------------------------------------
*/
/* ---------------------- IAR Compiler ---------------------- */
#ifdef __IAR_SYSTEMS_ICC__
#include <ioCC2530.h>
#define HAL_COMPILER_IAR
#define HAL_MCU_LITTLE_ENDIAN() __LITTLE_ENDIAN__
#define _PRAGMA(x) _Pragma(#x)
#define HAL_ISR_FUNC_DECLARATION(f,v) _PRAGMA(vector=v) __near_func __interrupt void f(void)
#define HAL_ISR_FUNC_PROTOTYPE(f,v) _PRAGMA(vector=v) __near_func __interrupt void f(void)
#define HAL_ISR_FUNCTION(f,v) HAL_ISR_FUNC_PROTOTYPE(f,v); HAL_ISR_FUNC_DECLARATION(f,v)
/* ---------------------- Keil Compiler ---------------------- */
#elif defined __KEIL__ // TODO
//#include <CC2530.h>
//#define HAL_COMPILER_KEIL
//#define HAL_MCU_LITTLE_ENDIAN() 0
//#define HAL_ISR_FUNC_DECLARATION(f,v) void f(void) interrupt v
//#define HAL_ISR_FUNC_PROTOTYPE(f,v) void f(void)
//#define HAL_ISR_FUNCTION(f,v) HAL_ISR_FUNC_PROTOTYPE(f,v); HAL_ISR_FUNC_DECLARATION(f,v)
/* ------------------ Unrecognized Compiler ------------------ */
#else
// #error "ERROR: Unknown compiler."
#endif
/* ------------------------------------------------------------------------------------------------
* Interrupt Macros
* ------------------------------------------------------------------------------------------------
*/
#define HAL_ENABLE_INTERRUPTS() __enable_irq()
#define HAL_DISABLE_INTERRUPTS() __disable_irq()
#define HAL_INTERRUPTS_ARE_ENABLED() \
({ \
uint32 primask; \
__asm volatile("mrs %0, primask" : "=r"(primask)); \
(primask == 0); \
})
// typedef unsigned char halIntState_t;
static uint32 criticalNesting = 0;
#define HAL_ENTER_CRITICAL_SECTION() \
do \
{ \
if (criticalNesting == 0) \
{ \
HAL_DISABLE_INTERRUPTS(); \
} \
criticalNesting++; \
} while (0)
#define HAL_EXIT_CRITICAL_SECTION() \
do \
{ \
if (criticalNesting > 0) \
{ \
criticalNesting--; \
if (criticalNesting == 0) \
{ \
HAL_ENABLE_INTERRUPTS(); \
} \
} \
} while (0)
#define HAL_CRITICAL_STATEMENT(x) \
do \
{ \
HAL_ENTER_CRITICAL_SECTION(); \
x; \
HAL_EXIT_CRITICAL_SECTION(); \
} while (0)
#ifdef __IAR_SYSTEMS_ICC__
/* IAR library uses XCH instruction with EA. It may cause the higher priority interrupt to be
* locked out, therefore, may increase interrupt latency. It may also create a lockup condition.
* This workaround should only be used with 8051 using IAR compiler. When IAR fixes this by
* removing XCH usage in its library, compile the following macros to null to disable them.
*/
#define HAL_ENTER_ISR() { halIntState_t _isrIntState = EA; HAL_ENABLE_INTERRUPTS();
#define HAL_EXIT_ISR() EA = _isrIntState; }
#else
// #define HAL_ENTER_ISR() // TODO
// #define HAL_EXIT_ISR()
#endif /* __IAR_SYSTEMS_ICC__ */
/* Dummy for this platform */
// #define HAL_AES_ENTER_WORKAROUND() // TODO
// #define HAL_AES_EXIT_WORKAROUND()
#ifdef POWER_SAVING
// extern volatile __data uint8 halSleepPconValue;
extern volatile uint8 halSleepPconValue; // TODO
/* Any ISR that is used to wake up the chip shall call this macro. This prevents the race condition
* when the PCON IDLE bit is set after such a critical ISR fires during the prep for sleep.
*/
#define CLEAR_SLEEP_MODE() st( halSleepPconValue = 0; )
#define ALLOW_SLEEP_MODE() st( halSleepPconValue = 1; ) // TODO
#else
#define CLEAR_SLEEP_MODE()
#define ALLOW_SLEEP_MODE()
#endif
/**************************************************************************************************
*/
#endif
+304
View File
@@ -0,0 +1,304 @@
/*!
* \file hal_sleep.c
*
* \brief Target xc6xxx hal spi implementation
*
* \copyright Revised BSD License, see section \ref LICENSE.
*
* \code
*
* _ __ _ ________ _
* | |/ /(_)___ / ____/ /_ (_)___
* | // / __ \/ / / __ \/ / __ \
* / |/ / / / / /___/ / / / / /_/ /
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
* /_/
* (C) 2022-2025 XinChip
*
* \endcode
*
* \author ( XinChip ) Alex-J
*
* \author ( XinChip )
*/
/* ------------------------------------------------------------------------------------------------
* Includes
* ------------------------------------------------------------------------------------------------
*/
#include "hal_types.h"
#include "hal_mcu.h"
#include "hal_board.h"
#include "hal_sleep.h"
#include "OSAL.h"
#include "OSAL_Timers.h"
#include "OSAL_Tasks.h"
#include "OSAL_PwrMgr.h"
#include "OnBoard.h"
#include "hal_drivers.h"
#include "hal_assert.h"
#include "hal_timer.h"
#include "xc_drv_pwr.h"
#include "xc_drv_clock.h"
#include "xc6xxx.h"
#define WAKEUP_TIMER (TIMER0_IDX)
#define OSASL_MIN_SLEEP_TIME (5)
/* ------------------------------------------------------------------------------------------------
* Global Variables
* ------------------------------------------------------------------------------------------------
*/
volatile uint8 halSleepPconValue;
uint32 rtc_time_mod = 0;
/* ------------------------------------------------------------------------------------------------
* Function Prototypes
* ------------------------------------------------------------------------------------------------
*/
#if (0)
__RAM_CODE static uint32_t wakeup_timer_set(uint32_t ms)
{
uint32_t ticks;
cprao_aon_reg1__timer_ao_sleep_clksw__setf(0);
/* aotimer0 init */
if (cprao_aon_clken_grctl__timer_ao_pclk_en__getf() != ENABLE)
{
cprao_aon_clken_grctl__timer_ao_pclk_en__setf(ENABLE);
}
cprao_aon_clken_grctl__timer0_ao_pclk_en__setf(ENABLE);
cprao_aon_clken_grctl__timer1_ao_pclk_en__setf(ENABLE);
cpr_lp_ctl__timer_sysclk_sel__setf(ENABLE);
aotimer_tcr__tes__setf(WAKEUP_TIMER, DISABLE);
aotimer_tcr__tms__setf(WAKEUP_TIMER, (uint8_t)AOTIMER_MODE_SINGLE);
(void)aotimer_tic__tic__getf(WAKEUP_TIMER);
/* aotimer0 set value */
if (clock_cb.lfclk_in == CLOCK_LFCLK_IN_32768) {
ticks = 32 * ms + (768 * ms) / 1000;}
else if (clock_cb.lfclk_in == CLOCK_LFCLK_IN_32K) {
ticks = 32 * ms;}
ticks = ticks < AOTIMER_MIN_TLC_VAL ? AOTIMER_MIN_TLC_VAL : ticks;
aotimer_tcr__tes__setf(WAKEUP_TIMER, AOTIMER_TCR_TES_DISABLE);
aotimer_tlc_set(WAKEUP_TIMER, ticks);
/* aotimer0 start */
NVIC_EnableIRQ(TIMER_AO0_IRQn);
aotimer_tcr__tim__setf(WAKEUP_TIMER, DISABLE);
aotimer_tcr__tes__setf(WAKEUP_TIMER, ENABLE);
// Wait for timer enable
while (aotimer_tcr__tes__getf(WAKEUP_TIMER) != ENABLE)
{
__nop();
}
return ticks;
}
#endif
__RAM_CODE static uint32_t wakeup_timer_set(uint32_t ms)
{
uint32_t ticks;
/* wakeup timer init */
if (cpr_ctlapbclken_grctl__timer_pclk_en__getf() != ENABLE) {
cpr_ctlapbclken_grctl__timer_pclk_en__setf(ENABLE);}
cpr_timer0_clk_ctl__timer_clksel__setf((uint8_t)TIMER_CLK_SRC_32K);
cpr_timer0_clk_ctl__timer_clk0_div__setf((uint8_t)TIMER_DIV_CLK_32000Hz);
cpr_timer0_clk_ctl__timer_clk1_div__setf((uint8_t)TIMER_DIV_CLK_32000Hz);
if (cpr_lp_ctl__timer_sysclk_sel__getf() != ENABLE) {
cpr_lp_ctl__timer_sysclk_sel__setf(ENABLE);}
timer_tcr__tes__setf(WAKEUP_TIMER, TIMER_TCR_TES_DISABLE);
timer_tcr__tms__setf(WAKEUP_TIMER, (uint8_t)TIMER_MODE_SINGLE);
#if !defined(NO_SUPPORT_LFCLK_XTAL_32768)
/* wakeup timer set value */
if (clock_cb.lfclk_in == CLOCK_LFCLK_IN_32768) {
ticks = 32 * ms + (768 * ms) / 1000;}
else if (clock_cb.lfclk_in == CLOCK_LFCLK_IN_32K) {
ticks = 32 * ms;}
#else
ticks = 32 * ms;
#endif
ticks = ticks < TIMER_MIN_TLC_VAL ? TIMER_MIN_TLC_VAL : ticks;
// timer_tcr__tes__setf(WAKEUP_TIMER, TIMER_TCR_TES_DISABLE);
timer_tlc_set(WAKEUP_TIMER, ticks);
/* wakeup timer start */
NVIC_EnableIRQ(TIMER0_IRQn);
timer_tcr__tim__setf(WAKEUP_TIMER, TIMER_TCR_TIM_DISABLE);
timer_tcr__tes__setf(WAKEUP_TIMER, TIMER_TCR_TES_ENABLE);
// Wait for timer enable
while (timer_tcr__tes__getf(WAKEUP_TIMER) != ENABLE)
{
__nop();
}
return ticks;
}
static void bor_init(void)
{
cprao_aon_bor_ctr_reg0__bor_ctrl__setf(0x0);
cprao_aon_bor_ctr_reg0__bor_rstn_mask__setf(1);
cprao_aon_bor_ctr_reg0__bor_intr_mask__setf(0);
NVIC_EnableIRQ(MPU_IRQn);
}
static void system_lightsleep_cfg(void)
{
#if (USE_XIP != 1)
cprao_aon_puctrl1_set(0x4); /* puctrl1= 0x4 , SSI0RX must pulldown*/
#endif
cprao_aon_sys_time_set((RST_READY_TIME << 12) | (OSC32_STABLE_TIME));
xc_pwr_pd_lightsleep_set();
xc_pwr_sleepsrc_mask_set(0x1e001e);
xc_pwr_osc_off();
}
void system_sleep_init(void)
{
uint32_t wake_it_src;
bor_init();
#if (0)
#if !defined(NO_SUPPORT_ROM_FMC_SPI)
#if (USE_XIP == 1)
xc_fmc_spi_init_oprt();
#endif
#else
#if (USE_XIP == 1)
SPI_InitCfg_t spi_cfg = {0};
spi_cfg.Mode = SPI_MODE_MASTER;
spi_cfg.DataSize = SSI_CTRL0_DFS_LEN_8BIT;
spi_cfg.Direction = SSI_CTRL0_TMOD_WR;
spi_cfg.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2;
spi_cfg.CLKPolarity = SSI_CTRL0_SCPOL_LOW;
spi_cfg.CLKPhase = SPI_CPHA_LEAD;
spi_cfg.FirstBit = SPI_FirstBit_MSB;
xc_spi_init(XC_SPI0, &spi_cfg);
#endif
#endif
#endif
xc_pwr_gpio_sleep_config();
wake_it_src = GPIO_IRQn_WAKE | RTC_IRQn_WAKE | TIMER_AO0_IRQn_WAKE | TIMER0_IRQn_WAKE;
xc_pwr_wake_it_set(wake_it_src);
system_lightsleep_cfg();
}
__RAM_CODE void halSleep(uint32 osal_timeout)
{
uint32 before_sleep_tick, wakeup_timer_set_tick, wakeup_timer_current_tick, wakeup_timer_dlt_tick, wakeup_timer_dlt_us, temp_tick;
if (osal_timeout <= OSASL_MIN_SLEEP_TIME)
return;
NVIC_DisableIRQ(TIMER1_IRQn);
HAL_DISABLE_INTERRUPTS();
/* stop OSAL timer */
timer_tcr__tes__setf(OSAL_TIMER, TIMER_TCR_TES_DISABLE);
/* get before sleep tick */
before_sleep_tick = getMcuPrecisionCount();
/* set sleep time:ms */
wakeup_timer_set_tick = wakeup_timer_set(osal_timeout);
delay_us(100);
/* sleep */
xc_sleep();
xc_rc32k_soft_calib_enable();
wakeup_timer_current_tick = timer_tcv_get(WAKEUP_TIMER);
/* stop wakeup timer */
timer_tcr__tes__setf(WAKEUP_TIMER, TIMER_TCR_TES_DISABLE);
if (wakeup_timer_current_tick < wakeup_timer_set_tick) {
wakeup_timer_dlt_tick = wakeup_timer_set_tick - wakeup_timer_current_tick;}
else {
wakeup_timer_dlt_tick = 0xffffffff - wakeup_timer_current_tick + wakeup_timer_set_tick;}
#if !defined(NO_SUPPORT_LFCLK_XTAL_32768)
if (clock_cb.lfclk_in == CLOCK_LFCLK_IN_32768) {
wakeup_timer_dlt_us = (((wakeup_timer_dlt_tick << 7) - (wakeup_timer_dlt_tick << 2) - (wakeup_timer_dlt_tick << 1)) >> 2) + (((wakeup_timer_dlt_tick << 3) + wakeup_timer_dlt_tick) >> 9);}
else {
wakeup_timer_dlt_us = (wakeup_timer_dlt_tick * 125) >> 2;}
#else
wakeup_timer_dlt_us = (wakeup_timer_dlt_tick * 125) >> 2;
#endif
temp_tick = before_sleep_tick + wakeup_timer_dlt_us / 625;
rtc_time_mod += wakeup_timer_dlt_us % 625;
if (rtc_time_mod > 625)
{
temp_tick++;
rtc_time_mod = rtc_time_mod % 625;
}
/* update system tick */
osal_timer_tick_set(temp_tick);
osal_timer_start();
HAL_ENABLE_INTERRUPTS();
xc_rc32k_soft_calib_disable();
}
__RAM_CODE void MPU_Handler(void)
{
cprao_aon_slp_pd_mask_set(0x001);
#if XTAL_32K
#if !defined(NO_SUPPORT_LFCLK_XTAL_32768)
cprao_aon_ctl_clk32k_set(0x109);
#endif
#endif
printf("MPU_Handler\n");
WDT_InitCfg_t wdt_cfg;
wdt_cfg.WorkMode = WDT_WORK_MODE0;
wdt_cfg.ReloadValue = WDT_CLK_32M_RESET_MODE0_4096US;
wdt_cfg.PclkSel = WDT_WORK_32M;
xc_wdt_init(&wdt_cfg);
xc_wdt_start();
while (1);
}
/**************************************************************************************************
* @fn TimerElapsed
*
* @brief Determine the number of OSAL timer ticks elapsed during sleep.
* Deprecated for CC2538 and CC2430 SoC.
*
* input parameters
*
* @param None.
*
* output parameters
*
* None.
*
* @return Number of timer ticks elapsed during sleep.
**************************************************************************************************
*/
uint32 TimerElapsed( void )
{
/* Stubs */
return (0);
}
/**************************************************************************************************
* @fn halRestoreSleepLevel
*
* @brief Restore the deepest timer sleep level.
*
* input parameters
*
* @param None
*
* output parameters
*
* None.
*
* @return None.
**************************************************************************************************
*/
void halRestoreSleepLevel( void )
{
/* Stubs */
}
+81
View File
@@ -0,0 +1,81 @@
/*!
* \file hal_sleep.c
*
* \brief Target xc6xxx hal spi implementation
*
* \copyright Revised BSD License, see section \ref LICENSE.
*
* \code
*
* _ __ _ ________ _
* | |/ /(_)___ / ____/ /_ (_)___
* | // / __ \/ / / __ \/ / __ \
* / |/ / / / / /___/ / / / / /_/ /
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
* /_/
* (C) 2022-2025 XinChip
*
* \endcode
*
* \author ( XinChip ) Alex-J
*
* \author ( XinChip )
*/
/* ------------------------------------------------------------------------------------------------
* Includes
* ------------------------------------------------------------------------------------------------
*/
#include "hal_timer.h"
#include "OSAL_Clock.h"
#include "xc_drv_timer.h"
uint32 sys_tick_cnt;
__RAM_CODE void timer1_callback(void *context)
{
sys_tick_cnt++;
}
__RAM_CODE void osal_timer_init(void)
{
/* timer1 init */
if (cpr_ctlapbclken_grctl__timer_pclk_en__getf() != ENABLE)
cpr_ctlapbclken_grctl__timer_pclk_en__setf(ENABLE);
cpr_timer1_clk_ctl__timer_clksel__setf(TIMER_CLK_SRC_32M_DIV);
cpr_timer1_clk_ctl__timer_clk0_div__setf(TIMER_DIV_CLK_16MHzOr16K);
cpr_timer1_clk_ctl__timer_clk1_div__setf(TIMER_DIV_CLK_16MHzOr16K);
cpr_lp_ctl__timer_sysclk_sel__setf(ENABLE);
timer_tcr__tes__setf(OSAL_TIMER, TIMER_TCR_TES_DISABLE);
timer_tcr__tms__setf(OSAL_TIMER, TIMER_MODE_CYCLE);
/* value set */
timer_tlc_set(OSAL_TIMER, 10000); //625us = 10000tick
/* timer1 start */
NVIC_EnableIRQ(TIMER1_IRQn);
NVIC_SetPriority(TIMER1_IRQn,1);
timer_tcr__tim__setf(OSAL_TIMER, TIMER_TCR_TIM_DISABLE);
timer_tcr__tes__setf(OSAL_TIMER, TIMER_TCR_TES_ENABLE);
return;
}
__RAM_CODE void osal_timer_start(void)
{
NVIC_EnableIRQ(TIMER1_IRQn);
timer_tcr__tim__setf(OSAL_TIMER, TIMER_TCR_TIM_DISABLE);
timer_tcr__tes__setf(OSAL_TIMER, TIMER_TCR_TES_ENABLE);
}
__RAM_CODE void osal_timer_tick_set(uint32 tick)
{
sys_tick_cnt = tick;
}
__RAM_CODE uint32 getMcuPrecisionCount(void)
{
return sys_tick_cnt;
}
+101
View File
@@ -0,0 +1,101 @@
/*!
* \file hal_types.h
*
* \brief The header of hal_types.c
*
* \copyright Revised BSD License, see section \ref LICENSE.
*
* \code
*
* _ __ _ ________ _
* | |/ /(_)___ / ____/ /_ (_)___
* | // / __ \/ / / __ \/ / __ \
* / |/ / / / / /___/ / / / / /_/ /
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
* /_/
* (C) 2022-2025 XinChip
*
* \endcode
*
* \author ( XinChip ) Alex-J
*
* \author ( XinChip )
*/
#ifndef _HAL_TYPES_H
#define _HAL_TYPES_H
/* ------------------------------------------------------------------------------------------------
* Types
* ------------------------------------------------------------------------------------------------
*/
typedef signed char int8;
typedef unsigned char uint8;
typedef signed short int16;
typedef unsigned short uint16;
typedef signed long int32;
typedef unsigned long uint32;
//typedef unsigned char bool;
typedef uint32 halDataAlign_t;
#define POWER_SAVING
/* ------------------------------------------------------------------------------------------------
* Memory Attributes and Compiler Macros
* ------------------------------------------------------------------------------------------------
*/
/* ----------- IAR Compiler ----------- */
#ifdef __IAR_SYSTEMS_ICC__
#define CODE __code
#define XDATA __xdata
#define ASM_NOP asm("NOP")
/* ----------- KEIL Compiler ----------- */
#elif defined __KEIL__
#define CODE code
#define XDATA xdata
#define ASM_NOP __nop()
/* ----------- CCS Compiler ----------- */
#elif defined __TI_COMPILER_VERSION
#define ASM_NOP asm(" NOP")
/* ----------- GNU Compiler ----------- */
#elif defined __GNUC__
#define ASM_NOP __asm__ __volatile__ ("nop")
/* ---------- MSVC compiler ---------- */
#elif _MSC_VER
#define ASM_NOP __asm NOP
/* ----------- Unrecognized Compiler ----------- */
#else
#error "ERROR: Unknown compiler."
#endif
/* ------------------------------------------------------------------------------------------------
* Standard Defines
* ------------------------------------------------------------------------------------------------
*/
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NULL
#define NULL 0
#endif
/**************************************************************************************************
*/
#endif