/***********************************************************************
 * Copyright (c)  2017 - 2020, Unicmicro Co.,Ltd .
 * All rights reserved.
 * Filename    : common.h
 * Description : common header file
 * Author(s)   : Dan
 * version     : V1.0
 * Modify date : 2019-02-21
 ***********************************************************************/
#ifndef __COMMON_H__
#define __COMMON_H__

#include  "um321xA.h"

#undef NULL
	#define NULL 0          


#undef TRUE
	#define TRUE 1  
	

#undef FALSE
	#define FALSE 0  



#define SWAP(x)             ((((x) & 0xFF) << 8) | (((x) >> 8) & 0xFF))
#define max(a, b)		    (((a) > (b)) ? (a) : (b))
#define min(a, b)		    (((a) < (b)) ? (a) : (b))

/************************************************************************
 * function   : printf_buff_byte
 * Description: printf data block by byte
 * input :
 *         uint8_t* buff: buff
 *         uint32_t length: byte length
 * return: none
 ************************************************************************/
void printf_buff_byte(uint8_t* buff, uint32_t length);

/************************************************************************
 * function   : printf_buff_word
 * Description: printf data block by word
 * input :
 *         uint32_t* buff: buff
 *         uint32_t length: word length
 * return: none
 ************************************************************************/
void printf_buff_word(uint32_t* buff, uint32_t length);

void systick_irq_func(void);
void delay(uint32_t count);
void reverse_DWORD(uint32_t *var);
void reverse_memory(uint8_t *buff, uint32_t length);
void delay_init(uint32_t system_clk_hz);
void delay_us(uint32_t nus);
void delay_ms(uint32_t nms);
void delay_sec(float sec);


#endif

