CMI Instrumentation Library API Reference Guide
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator
CMILib.h
Go to the documentation of this file.
1 #ifndef __CMILIBRARY_H
2 #define __CMILIBRARY_H
3 /*
4  * CMILib.h
5  *
6  * Clock Management Instrumentation API Definitions
7  *
8  * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
9  *
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  *
15  * Redistributions of source code must retain the above copyright
16  * notice, this list of conditions and the following disclaimer.
17  *
18  * Redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the
21  * distribution.
22  *
23  * Neither the name of Texas Instruments Incorporated nor the names of
24  * its contributors may be used to endorse or promote products derived
25  * from this software without specific prior written permission.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38  *
39 */
40 
108 #ifdef _CIO
109 #include <stdio.h>
110 #endif
111 
112 #ifndef __linux__ //If linux don't need
113 #include <stdlib.h>
114 #include <stdint.h> // The library uses C99 exact-width integer types
115 #else
116 #include <linux/kernel.h>
117 #include <stddef.h>
118 #endif
119 
120 //Using forward slashes in the relative search path for linux compatibility
121 
122 #ifdef _OMAP4430 // must be OMAP4430 build
123 #include "../../PMICMILib/src/PCMI_Omap4430.h"
124 #endif
125 
126 #include "../../STMLib/include/StmLibrary.h"
127 #include "../../STMLib/src/StmSupport.h"
128 #include "../../PMICMILib/src/PCMI_Common.h"
129 
130 #ifdef __cplusplus
131 extern "C" {
132 #endif
133 
135 //
136 // Public CMI Specific Enumerations
137 //
139 
143 typedef enum { eCMI_Event,
146 
150 typedef enum { eCMI_ENABLE_EVENT_NONE = 0,
167 
171 typedef enum { eCMI_ENABLE_ACTIVITY_NONE = 0,
176 
178 //
179 // Public Typedefs and Enums
180 //
182 
185 typedef enum { eCMI_CM1,
186 #ifndef _DRA7xx
188 #endif
190  } eCMI_ModID;
191 
196 typedef struct CMI_Handle_t CMI_Handle;
197 
202 
206 typedef struct _CMI_CfgParams {
212 #ifdef _STMLogging
213  STMHandle * pSTMHandle;
215  uint8_t STMMessageCh;
220 #endif
221  uint32_t FuncClockDivider;
223  uint32_t SampleWindowSize;
225  }CMI_CfgParams;
226 
232 //
234 // Public Function Definitions
235 //
237 
238 
287 eCMI_Error CMI_OpenModule(CMI_Handle_Pntr * pCMI_Handle, eCMI_ModID CMI_ModId, CMI_CfgParams * pCMI_CfgParams);
288 
313 eCMI_Error CMI_CloseModule(CMI_Handle_Pntr pCMI_Handle );
314 
345 eCMI_Error CMI_GetVersion(CMI_Handle_Pntr pCMI_Handle, uint32_t * pLibMajorVersion, uint32_t * pLibMinorVersion, uint32_t * pSWFuncID, uint32_t * pHwFuncID);
346 
372 eCMI_Error CMI_ModuleEnable (CMI_Handle_Pntr pCMI_Handle, eCMI_ModEnableType modEnableType);
373 
404 eCMI_Error CMI_ModuleDisable(CMI_Handle_Pntr pCMI_Handle, int32_t retain);
405 
440 eCMI_Error CMI_ConfigModule(CMI_Handle_Pntr pCMI_Handle, ePCMI_Triggers triggerEnables, eCMI_EventEnables eventEnables, eCMI_ActivityEnables activityEnables);
441 
457 eCMI_Error CMI_GetSampleWindow(CMI_Handle_Pntr pCMI_Handle, uint32_t * pFuncClockDivider, uint32_t * pSampleWindowSize );
458 
476 const char * CMI_GetErrorMsg(eCMI_Error errorCode);
477 
503 eCMI_Error CMI_LogMsg(CMI_Handle_Pntr pCMI_Handle, const char * FmtString, int32_t * pValue);
504 
505 #ifndef _NoMark
506 
536 eCMI_Error CMI_MarkClockDomainStateChange(CMI_Handle_Pntr pCMI_Handle, eCMI_ClockDomainStateChange clkDomain, eCMI_clkState clkState);
537 
568 eCMI_Error CMI_MarkClockDividerRatioChange(CMI_Handle_Pntr pCMI_Handle, eCMI_ClockDividerRatioChange divDomain, eCMI_divState divState);
569 
599 eCMI_Error CMI_MarkClockSourceSelectionChange(CMI_Handle_Pntr pCMI_Handle, eCMI_ClockSource clkSource);
600 
630 eCMI_Error CMI_MarkDPLLSettingChange(CMI_Handle_Pntr pCMI_Handle, eCMI_DPLLSrc dlppSource);
631 #endif
632 
633 #ifdef __cplusplus
634 }
635 #endif
636 
637 #endif /* __CMILIBARY_H */
eCMI_clkState
Definition: PCMI_Omap4430.h:245
eCMI_Error CMI_CloseModule(CMI_Handle_Pntr pCMI_Handle)
eCMI_Error CMI_OpenModule(CMI_Handle_Pntr *pCMI_Handle, eCMI_ModID CMI_ModId, CMI_CfgParams *pCMI_CfgParams)
eCMI_ModID
Definition: CMILib.h:185
eCMI_Error CMI_ModuleEnable(CMI_Handle_Pntr pCMI_Handle, eCMI_ModEnableType modEnableType)
eCMI_Error CMI_ModuleDisable(CMI_Handle_Pntr pCMI_Handle, int32_t retain)
eCMI_divState
Definition: PCMI_Omap4430.h:269
eCMI_Error CMI_ConfigModule(CMI_Handle_Pntr pCMI_Handle, ePCMI_Triggers triggerEnables, eCMI_EventEnables eventEnables, eCMI_ActivityEnables activityEnables)
eCMI_EventEnables
Definition: CMILib.h:150
Definition: CMILib.h:150
uint32_t CMI_ClockCtl_BaseAddr
Definition: CMILib.h:208
eCMI_Error CMI_LogMsg(CMI_Handle_Pntr pCMI_Handle, const char *FmtString, int32_t *pValue)
eCMI_ClockDomainStateChange
Definition: PCMI_Omap4430.h:184
eCMI_Error CMI_GetSampleWindow(CMI_Handle_Pntr pCMI_Handle, uint32_t *pFuncClockDivider, uint32_t *pSampleWindowSize)
ePCMI_Error
Definition: PCMI_Common.h:89
Definition: CMILib.h:144
eCMI_Error CMI_GetVersion(CMI_Handle_Pntr pCMI_Handle, uint32_t *pLibMajorVersion, uint32_t *pLibMinorVersion, uint32_t *pSWFuncID, uint32_t *pHwFuncID)
ePCMI_Error eCMI_Error
Definition: CMILib.h:230
Definition: CMILib.h:187
const char * CMI_GetErrorMsg(eCMI_Error errorCode)
eCMI_ActivityEnables
Definition: CMILib.h:171
eCMI_Error CMI_MarkClockDividerRatioChange(CMI_Handle_Pntr pCMI_Handle, eCMI_ClockDividerRatioChange divDomain, eCMI_divState divState)
eCMI_Error CMI_MarkClockSourceSelectionChange(CMI_Handle_Pntr pCMI_Handle, eCMI_ClockSource clkSource)
CMI_Handle * CMI_Handle_Pntr
Definition: CMILib.h:201
eCMI_Error CMI_MarkDPLLSettingChange(CMI_Handle_Pntr pCMI_Handle, eCMI_DPLLSrc dlppSource)
void(* PCMI_CallBack)(const char *funcName, ePCMI_Error)
Definition: PCMI_Common.h:120
eCMI_ModEnableType
Definition: CMILib.h:143
eCMI_DPLLSrc
Definition: PCMI_Omap4430.h:300
uint32_t FuncClockDivider
Definition: CMILib.h:221
uint32_t CMI_Module_BaseAddr
Definition: CMILib.h:207
Definition: CMILib.h:172
eCMI_ClockSource
Definition: PCMI_Omap4430.h:280
Definition: CMILib.h:143
struct CMI_Handle_t CMI_Handle
Definition: CMILib.h:196
Definition: CMILib.h:165
Definition: CMILib.h:174
eCMI_Error CMI_MarkClockDomainStateChange(CMI_Handle_Pntr pCMI_Handle, eCMI_ClockDomainStateChange clkDomain, eCMI_clkState clkState)
Definition: CMILib.h:189
PCMI_CallBack pCMI_CallBack
Definition: CMILib.h:210
Definition: CMILib.h:171
struct _CMI_CfgParams CMI_CfgParams
uint32_t SampleWindowSize
Definition: CMILib.h:223
Definition: CMILib.h:185
Definition: CMILib.h:206
eCMI_ClockDividerRatioChange
Definition: PCMI_Omap4430.h:252
Definition: CMILib.h:173