Mistake on this page?
Report an issue in GitHub or email us
ssi_pal_types.h
Go to the documentation of this file.
1 /**************************************************************************************
2 * Copyright (c) 2016-2017, ARM Limited or its affiliates. All rights reserved *
3 * *
4 * This file and the related binary are licensed under the following license: *
5 * *
6 * ARM Object Code and Header Files License, v1.0 Redistribution. *
7 * *
8 * Redistribution and use of object code, header files, and documentation, without *
9 * modification, are permitted provided that the following conditions are met: *
10 * *
11 * 1) Redistributions must reproduce the above copyright notice and the *
12 * following disclaimer in the documentation and/or other materials *
13 * provided with the distribution. *
14 * *
15 * 2) Unless to the extent explicitly permitted by law, no reverse *
16 * engineering, decompilation, or disassembly of is permitted. *
17 * *
18 * 3) Redistribution and use is permitted solely for the purpose of *
19 * developing or executing applications that are targeted for use *
20 * on an ARM-based product. *
21 * *
22 * DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
23 * CONTRIBUTORS "AS IS." ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT *
24 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, *
25 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
26 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED *
28 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
29 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
30 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
31 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
33 **************************************************************************************/
34 
35 
36 /*!
37 @file
38 @brief This file contains the platform dependent definitions and types.
39 @defgroup ssi_pal_types CryptoCell PAL platform dependant types
40 @{
41 @ingroup ssi_pal
42 */
43 
44 #ifndef SSI_PAL_TYPES_H
45 #define SSI_PAL_TYPES_H
46 
47 #include "ssi_pal_types_plat.h"
48 
49 /*! Boolean definition.*/
50 typedef enum {
51  /*! Boolean false definition.*/
53  /*! Boolean true definition.*/
55 } SaSiBool;
56 
57 /*! Success definition. */
58 #define SASI_SUCCESS 0UL
59 /*! Failure definition. */
60 #define SASI_FAIL 1UL
61 
62 /*! Defintion of 1KB in bytes. */
63 #define SASI_1K_SIZE_IN_BYTES 1024
64 /*! Defintion of number of bits in a byte. */
65 #define SASI_BITS_IN_BYTE 8
66 /*! Defintion of number of bits in a 32bits word. */
67 #define SASI_BITS_IN_32BIT_WORD 32
68 /*! Defintion of number of bytes in a 32bits word. */
69 #define SASI_32BIT_WORD_SIZE (sizeof(uint32_t))
70 
71 /*! Success (OK) defintion. */
72 #define SASI_OK SASI_SUCCESS
73 
74 /*! Macro that handles unused parameters in the code (to avoid compilation warnings). */
75 #define SASI_UNUSED_PARAM(prm) ((void)prm)
76 
77 /*! Maximal uint32 value.*/
78 #define SASI_MAX_UINT32_VAL (0xFFFFFFFF)
79 
80 
81 /* Minimum and Maximum macros */
82 #ifdef min
83 /*! Definition for minimum. */
84 #define CRYS_MIN(a,b) min( a , b )
85 #else
86 /*! Definition for minimum. */
87 #define CRYS_MIN( a , b ) ( ( (a) < (b) ) ? (a) : (b) )
88 #endif
89 
90 #ifdef max
91 /*! Definition for maximum. */
92 #define CRYS_MAX(a,b) max( a , b )
93 #else
94 /*! Definition for maximum. */
95 #define CRYS_MAX( a , b ) ( ( (a) > (b) ) ? (a) : (b) )
96 #endif
97 
98 /*! Macro that calculates number of full bytes from bits (i.e. 7 bits are 1 byte). */
99 #define CALC_FULL_BYTES(numBits) (((numBits) + (SASI_BITS_IN_BYTE -1))/SASI_BITS_IN_BYTE)
100 /*! Macro that calculates number of full 32bits words from bits (i.e. 31 bits are 1 word). */
101 #define CALC_FULL_32BIT_WORDS(numBits) (((numBits) + (SASI_BITS_IN_32BIT_WORD -1))/SASI_BITS_IN_32BIT_WORD)
102 /*! Macro that calculates number of full 32bits words from bytes (i.e. 3 bytes are 1 word). */
103 #define CALC_32BIT_WORDS_FROM_BYTES(sizeBytes) (((sizeBytes) + SASI_32BIT_WORD_SIZE - 1) / SASI_32BIT_WORD_SIZE)
104 /*! Macro that round up bits to 32bits words. */
105 #define ROUNDUP_BITS_TO_32BIT_WORD(numBits) (CALC_FULL_32BIT_WORDS(numBits)*SASI_BITS_IN_32BIT_WORD)
106 /*! Macro that round up bits to bytes. */
107 #define ROUNDUP_BITS_TO_BYTES(numBits) (CALC_FULL_BYTES(numBits)*SASI_BITS_IN_BYTE)
108 /*! Macro that round up bytes to 32bits words. */
109 #define ROUNDUP_BYTES_TO_32BIT_WORD(numBytes) (SASI_32BIT_WORD_SIZE*(((numBytes)+SASI_32BIT_WORD_SIZE-1)/SASI_32BIT_WORD_SIZE))
110 
111 
112 /**
113 @}
114  */
115 #endif
This file contains basic type definitions that are platform dependent.
SaSiBool
Definition: ssi_pal_types.h:50
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.