iLLD_TC27xC  1.0
IfxScuWdt.asm.h
Go to the documentation of this file.
1 /**
2  * \file IfxScuWdt.asm.h
3  * \brief SCU basic functionality
4  *
5  * \version iLLD_0_1_0_10
6  * \copyright Copyright (c) 2013 Infineon Technologies AG. All rights reserved.
7  *
8  *
9  * IMPORTANT NOTICE
10  *
11  *
12  * Infineon Technologies AG (Infineon) is supplying this file for use
13  * exclusively with Infineon's microcontroller products. This file can be freely
14  * distributed within development tools that are supporting such microcontroller
15  * products.
16  *
17  * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
18  * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
19  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
20  * INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
21  * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
22  *
23  */
24 #ifndef IFXSCUWDT_ASM_H
25 #define IFXSCUWDT_ASM_H 1
26 
27 #include "Cpu/Std/Ifx_Types.h"
28 #include "IfxScu_reg.h"
29 
30 /** \addtogroup IfxLld_Scu_Std_Wdt_Operative
31  * \{ */
32 
33 /**
34  * \brief SCUWDT Inline API utility to Calculte new 14-bit LFSR.
35  *
36  * This API will Calculte new 14-bit LFSR (Linear Feedback Shift Register) with characteristic polynomial
37  * x14+x13+x12+x2+1.
38  *
39  * \param password Password for which LFSR value to be calculated.
40  * \return New LFSR.
41  */
42 IFX_INLINE unsigned IfxScuWdt_calculateLfsr(uint16 password);
43 /** \} */
44 
45 /**
46  * \brief SCUWDT Inline API utility to Calculte new 14-bit LFSR.
47  */
48 #if defined(__GNUC__) || defined(__TASKING__)
49 IFX_INLINE unsigned IfxScuWdt_calculateLfsr(uint16 password)
50 {
51  /* *INDENT-OFF* */
52  uint16 res;
53  __asm("xor.t %0,%1,#0,%1,#2 \n\
54  xor.t %0,%0,#0,%1,#12 \n\
55  xor.t %0,%1,#0,%1,#13 \n\
56  xor.t %0,%1,#0,%1,#14 \n\
57  sh %1,#-1 \n\
58  ins.t %0,%0,#1,%1,#14 \n" : "=d" (res) : "d" (password));
59  return res;
60  /* *INDENT-ON* */
61 }
62 
63 
64 #endif
65 #if defined(__DCC__)
66 asm unsigned IfxScuWdt_calculateLfsr_asm(short password)
67 {
68  /* *INDENT-OFF* */
69 %reg password
70 !"%d2"
71  xor.t %d2, password, 0, password, 2
72  xor.t %d2, %d2, 0, password, 12
73  xor.t %d2, password, 0, password, 13
74  xor.t %d2, password, 0, password, 14
75  sh password, -1
76  ins.t %d2, %d2, 1, password, 14
77  /* *INDENT-ON* */
78 }
79 
80 
81 IFX_INLINE unsigned IfxScuWdt_calculateLfsr(uint16 password)
82 {
83  return IfxScuWdt_calculateLfsr_asm(password);
84 }
85 
86 
87 #endif
88 
89 #endif