iLLD_TC29x  1.0
IfxFce.c
Go to the documentation of this file.
1 /**
2  * \file IfxFce.c
3  * \brief FCE basic functionality
4  *
5  * \version iLLD_1_0_0_11_0
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  */
25 
26 /******************************************************************************/
27 /*----------------------------------Includes----------------------------------*/
28 /******************************************************************************/
29 
30 #include "IfxFce.h"
31 
32 /******************************************************************************/
33 /*-------------------------Function Implementations---------------------------*/
34 /******************************************************************************/
35 
36 Ifx_FCE_STS IfxFce_getCrc16InterruptStatus(Ifx_FCE *fce)
37 {
38  Ifx_FCE_STS interruptStatus;
39  interruptStatus.U = fce->IN2.STS.U;
40  return interruptStatus;
41 }
42 
43 
44 Ifx_FCE_STS IfxFce_getCrc32InterruptStatus(Ifx_FCE *fce, IfxFce_Crc32Kernel crc32Kernel)
45 {
46  Ifx_FCE_STS interruptStatus;
47 
48  if (crc32Kernel == IfxFce_Crc32Kernel_0)
49  {
50  interruptStatus.U = fce->IN0.STS.U;
51  }
52  else
53  {
54  interruptStatus.U = fce->IN1.STS.U;
55  }
56 
57  return interruptStatus;
58 }
59 
60 
61 Ifx_FCE_STS IfxFce_getCrc8InterruptStatus(Ifx_FCE *fce)
62 {
63  Ifx_FCE_STS interruptStatus;
64  interruptStatus.U = fce->IN3.STS.U;
65  return interruptStatus;
66 }
67 
68 
69 uint32 IfxFce_reflectCrc32(uint32 crcStartValue, uint8 crcLength)
70 {
71  uint32 ReversedData = 0x0U;
72  uint8 inputDataCounter;
73 
74  for (inputDataCounter = 0; inputDataCounter < crcLength; ++inputDataCounter)
75  {
76  if (crcStartValue & 0x01)
77  {
78  ReversedData |= (uint32)((uint32)1 << ((crcLength - 1) - inputDataCounter));
79  }
80 
81  crcStartValue = (uint32)((uint32)crcStartValue >> (uint32)1);
82  }
83 
84  return ReversedData;
85 }
86 
87 
88 void IfxFce_resetModule(Ifx_FCE *fce)
89 {
91 
92  IfxScuWdt_clearCpuEndinit(password);
93  fce->KRST1.B.RST = 1; /* Only if both Kernel reset bits are set a reset is executed */
94  fce->KRST0.B.RST = 1;
95  IfxScuWdt_setCpuEndinit(password);
96 
97  while (0 == fce->KRST0.B.RSTSTAT) /* Wait until reset is executed */
98 
99  {}
100 
101  IfxScuWdt_clearCpuEndinit(password);
102  fce->KRSTCLR.B.CLR = 1; /* Clear Kernel reset status bit */
103  IfxScuWdt_setCpuEndinit(password);
104 }