1 /*******************************************************************************
2 *Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
4 *Redistribution and use in source and binary forms, with or without modification, are permitted provided
5 *that the following conditions are met:
6 *1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
8 *2. Redistributions in binary form must reproduce the above copyright notice,
9 *this list of conditions and the following disclaimer in the documentation and/or other materials provided
10 *with the distribution.
12 *THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 *WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 *FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
15 *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 *NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
17 *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
18 *LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
19 *SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
23 ********************************************************************************/
24 /*******************************************************************************/
27 * The file defines utilities for SAS/SATA TD layer
34 #include <dev/pms/RefTisa/sallsdk/api/sa.h>
35 #include <dev/pms/RefTisa/tisa/api/tidefs.h>
36 #include <dev/pms/RefTisa/tisa/api/titypes.h>
37 #include <dev/pms/RefTisa/tisa/api/tiapi.h>
38 #include <dev/pms/RefTisa/tisa/sassata/common/tdlist.h>
41 #define HEXDIGIT2CHAR(x) (((x) < 10) ? ('0' + (x)) : ('A' + ((x) - 10)))
42 /*****************************************************************************
43 *! \brief tdDecimal2String
45 * Purpose: This function converts a given number into a decimal string.
47 * \param s: string to be generated
48 * \param num: number to be converted
52 * \note - string s should be large enough to store decimal string of
53 * num and a '\0' character
55 *****************************************************************************/
70 bit8 tdStr2Bit8 (char *buffer);
72 bit32 tdStr2ALPA (char *buffer);
74 void tdStr2WWN (char *buffer, bit8 * NodeName);
76 void tdWWN2Str (char *buffer, bit8 * NodeName);
78 /*****************************************************************************
79 *! \brief tdNextPowerOf2
81 * Purpose: This function is called to calculate the next power of 2
82 * value of given value.
85 * \param Value: The value for which next power of 2 is requested
87 * \return: The next power of 2 value of given Value
89 *****************************************************************************/
102 #endif /* __TDUTIL_H__ */