iLLD_TC27xC  1.0
lld_codingRules_commonApis.c
Go to the documentation of this file.
1 /*
2 * $Author: $tklose
3 * $Date: 2014-02-26 09:24:11 GMT$
4 * $Revision: $0.2
5 */
6 /**
7 \page lld_dosanddont_commonApis APIs common to many module drivers
8 
9  \section lld_dosanddont_commonApis_getSrc <modue>_get<Interrupt>Src()
10  For each interrupt service request control register, an API that returns the register address shall be available. The API syntax is as follow:
11  volatile Ifx_SRC_SRCR* <driverName>_get<Interrupt>Src(<ModuleType>*module);
12 
13  Example: The transmit interrupt of the QSPI driver has the following API:
14 
15  volatile Ifx_SRC_SRCR* IfxQspi_getTransmitSrc(Ifx_QSPI* module);
16 
17 
18 
19  \section lld_dosanddont_commonApis_get_index <modue>_getIndex()
20  The API Ifx<Module>_getIndex(Ifx_<MODULE>* module) shall be implemented in the file Ifx<Module>.c/h and use an array define in Ifx<Module>_cfg.c/h;
21 
22  Example:
23 
24  In file Ifxcpu.h
25  \code
26  IFX_EXTERN IfxCpu_ResourceCpu IfxCpu_getIndex(Ifx_CPU* cpu);
27  \endcode
28 
29  In file Ifxcpu.c
30  \code
31  // brief Return cpu index
32  //
33  // \param cpu Specifies cpu module
34  //
35  // \return Return cpu index.
36  //
37  IfxCpu_ResourceCpu IfxCpu_getIndex(Ifx_CPU* cpu)
38  {
39  IfxCpu_ResourceCpu result = IfxCpu_ResourceCpu_none, index;
40  for (index = 0; index < IFXCPU_COUNT; index++)
41  {
42  if (IfxCpu_cfg_indexMap[index].module == cpu)
43  {
44  result = IfxCpu_cfg_indexMap[index].index;
45  break;
46  }
47  }
48  return result;
49  }
50 
51  \endcode
52 
53  In file Ifxcpu_cfg.h
54  \code
55  // List of the available CPU resources
56  typedef enum
57  {
58  IfxCpu_ResourceCpu_0 = 0, // CPU 0
59  IfxCpu_ResourceCpu_1, // CPU 1
60  IfxCpu_ResourceCpu_2, // CPU 2
61  IfxCpu_ResourceCpu_none // None of the CPU
62  } IfxCpu_ResourceCpu;
63 
64  IFX_EXTERN IfxCpu_ResourceCpu IfxCpu_getIndex(Ifx_CPU* cpu);
65  \endcode
66 
67  In file Ifxcpu_cfg.c
68  \code
69  const IfxModule_IndexMap IfxCpu_cfg_indexMap[IFXCPU_COUNT] =
70  {
71  {&MODULE_CPU0, IfxCpu_ResourceCpu_0},
72  {&MODULE_CPU1, IfxCpu_ResourceCpu_1},
73  {&MODULE_CPU2, IfxCpu_ResourceCpu_2},
74  };
75  \endcode
76 
77 
78 
79 [\ref lld_codingRules_codeChecking "Previous page"] [\ref lld_dosanddont_if "Next page"]
80 
81 
82 
83  */