/**
 * \file    types.h
 * \brief   Type definition of system adaptation layer 
 *
 * \par     Copyright (c) 2018 UWE Technologies Corp., Ltd. All Rights Reserved.
 * \author  James
 * \date    2018-02-29
 * \version 
 * 
 * \history 
 *  Date        Note
 *  2018-02-29  Original Creation
 * 
 */
 
#ifndef __TYPES_H_
#define __TYPES_H_


#include <stdarg.h>
#include <stdint.h>
#include "arch.h"

#pragma pack(1)

/** Some compilers consider sizeof() to be unsigned... */
#define sizeof (int)sizeof

/** f32_t type */
typedef float                   f32_t;

/** u64_t type */
typedef unsigned long long      u64_t;

/** s64_t type */
typedef long long               s64_t;

/** u32_t type */
typedef unsigned int            u32_t;

/** s32_t type */
typedef signed int              s32_t;

/** u16_t type */
typedef unsigned short          u16_t;

/** s16_t type */
typedef signed short            s16_t;

/** u8_t type */
typedef unsigned char           u8_t;

/** s8_t type */
typedef signed char             s8_t;

/** status_t type */
typedef int                     status_t;

/** boolean type */
typedef int                     bool_t;

/** void function type with one argument */
typedef void (*v_func_ptr_t)(u32_t arg);

/** void function type with one argument */
typedef void (*v_func_b_ptr_t)(bool_t arg);

/** void function type without argument */
typedef void (*v_func_v_ptr_t)(void);

/** function type without argument */
typedef status_t (*s_func_v_ptr_t)(void);

/** function type with one argument */
typedef status_t (*s_func_ptr_t)(u32_t arg);

/** function type without argument */
typedef bool_t (*b_func_v_ptr_t)(void);

/** void function type without argument */
typedef void (*v_func_args_ptr_t)(u32_t arg1, u32_t arg2);

/** ZERO definition */
#define ZERO                (0)


/** NULL definition */
#ifndef NULL
#define NULL                ((void *) 0)
#endif

/** \name BOOLEAN value definition 
 * \{ 
 */
#ifndef FALSE
#define FALSE               (0)     ///< FALSE
#endif
#ifndef TRUE
#define TRUE                (1)     ///< TRUE
#endif
/** \}*/

/** \name ON/OFF value definition 
 * \{ 
 */
#define OFF                 (0)     ///< OFF
#define ON                  (1)     ///< ON
/** \}*/

/** \name  Error code of status_t
 * \{ 
 */
#define S_OK                (0)     ///< OK
#define S_ERROR             (-1)     ///< Common error
#define S_INVALID_PARAMS    (-2)     ///< Invalid parameter
#define S_NULL_POINTER      (-3)     ///< Null pointer
#define S_NO_RESOURCE       (-4)     ///< No free resource
/** \}*/

#pragma pack()

#endif /* #ifndef __TYPES_H_ */

