/****************************************************************
 ****************************************************************
 **                                                            **
 **    (C)Copyright 2005-2006, American Megatrends Inc.        **
 **                                                            **
 **            All Rights Reserved.                            **
 **                                                            **
 **        6145-F, Northbelt Parkway, Norcross,                **
 **                                                            **
 **        Georgia - 30071, USA. Phone-(770)-246-8600.         **
 **                                                            **
 ****************************************************************
 ****************************************************************/
/*****************************************************************
 *
 * util.h
 * Utility functions.
 *
 * Author: Govind Kothandapani <govindk@ami.com> 
 * 
 *****************************************************************/
#ifndef UTIL_H
#define UTIL_H

#include "com_IPMIDefs.h"
#include <stdio.h>

/**
 * Returns the maximum of two values
**/
#define UTIL_MAX(val1, val2) \
    ((val1 > val2) ? val1 : val2)

/**
 * Returns the minimum of two values
**/
#define UTIL_MIN(val1, val2) \
    ((val1 < val2) ? val1 : val2)

/**
 * @brief Extracts the contents of the bits corresponding to the mask.
**/
 uint8_t GetBits (uint8_t Val, uint8_t Mask);

/**
 * @brief Sets the bits corresponding to the mask according to the value.
**/
 uint8_t SetBits (uint8_t Mask, uint8_t Val);

/**
 * @brief Find the checksum
**/
 uint8_t CalculateCheckSum (uint8_t* Data, uint16_t Len);

// *
// *@ brief Retrieves the value from sysctl

// int GetJiffySysCtlvalue (const char *TagName, long long *SysVal);


/*
    index = 0,1,2,3,4,5
*/
uint8_t mac2hex(const char *strMac, uint8_t index);
/*
    index = 0,1,2,3
*/
uint8_t ip2dec(const char *strIp, uint8_t index);

int FlushUserInfo(void);
int FlushFRU(void);
int FlushSDR(void);
int FlushIpmiConfig(void);
int FlushSEL(void);







#endif	/* UTIL_H */
