# HG changeset patch # User Daniel Rubio # Date 1246027444 -3600 # Node ID bb4b476bbb967dfb04ac2138e2f9e696ce225e4a Initial contribution of SHAI APIs from Nokia. diff -r 000000000000 -r bb4b476bbb96 ASSP Variant/asicinfo_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ASSP Variant/asicinfo_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,56 @@ +/* + asicinfo_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @file +@brief ASIC info Chipset API H + +@publishedDeviceAbstraction +*/ + +#ifndef __ASICINFO_CHIPSET_API_H__ +#define __ASICINFO_CHIPSET_API_H__ + + +// Include files +#include + +// Class declaration + +/** +@brief ASIC information class + +Delivers ASIC related informations to clients +*/ +class AsicInfo + { + public: + /** + returns the ASIC version + + the return value is MMmmxxyy where + MM------ is the major version + --mm---- is the minor version + ----xx-- is the major revision + ------yy is the minor revision + */ + IMPORT_C static TUint GetAsicVersion(); + }; + + + + +#endif // __ASICINFO_CHIPSET_API_H__ diff -r 000000000000 -r bb4b476bbb96 ASSP Variant/cpupage_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ASSP Variant/cpupage_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,71 @@ +/* + cpupage_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ +/** @file +@brief CPU page chipset API H + + +@publishedDeviceAbstraction +*/ + +#ifndef __CPUPAGE_CHIPSET_API_H__ +#define __CPUPAGE_CHIPSET_API_H__ + + +// Include files +#include + + +/** +CPU page structure which contains data delivered by bootstrap to ASSP/Variant +*/ +struct TCpuPage + { + public: + TBool iRdcAvailable; /**< is R&D certificate available */ + TPhysAddr *iDebugBufferPhys; /**< address of the debug buffer */ + TUint32 iDebugBufferSize; /**< size of the debug buffer */ + }; + +/** +@brief CPU page class + +class CPU page which contains the methods returning the CPU page related data +*/ +class CpuPage + { + public: + /** + returns the address and size of the debug buffer + + @param aAddr address of the buffer on output in case of a success, NULL otherwise + @param aSize size of the buffer on output (65536 bytes on success, 0 otherwise) + @return returns KErrNone on success, KErrNotSupported otherwise + @pre Pre-condition: bootstrap has reserved the memory for the debug buffer + and has set up the CPU page: iDebugBufferPhys, iDebugBufferSize, Kern::SuperPage().iMachineData + */ + IMPORT_C static TInt GetDebugBuffer(TPhysAddr &aAddr, TUint32 &aSize); + + + /** + returns whether R&D certificate is available + @pre Pre-condition: bootstrap has set up the CPU page: iRdcAvailable, Kern::SuperPage().iMachineData + */ + IMPORT_C static TBool IsRdcAvailable(); + }; + + +#endif // __CPUPAGE_CHIPSET_API_H__ diff -r 000000000000 -r bb4b476bbb96 ASSP Variant/gptimer_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ASSP Variant/gptimer_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,175 @@ +/* + gptimer_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @file +@brief General Purpose Timer Chipset API H + +@publishedDeviceAbstraction +*/ + +#ifndef __GPTIMER_CHIPSET_API_H__ +#define __GPTIMER_CHIPSET_API_H__ + + +// Include files +#include + + +/** +Pointer to a callback function for the GPT client to use + +@note "Callback is executed in the DFC or ISR context" + +@param TAny* pointer to a parameter the call back function may use +*/ +typedef void (*GPTimerFn)(TAny*); + + + +// Class declaration + +/** +@brief GP timer class + + General Purpose Timer functionality for clients +*/ +class GPTimer + { + public: + /** + constructor of a GPT object + */ + IMPORT_C GPTimer(); + + + /** + allocates a HW GPT + + @param aFunction A pointer to a callback function which is called + when the timer expires. + @param aPtr A parameter of the callback function. + + @return returns KErrNone if there was no error or KErrInUse if no + HW GPT is available. + + @pre Pre-condition: HW GPT must be available + */ + IMPORT_C TInt Open(GPTimerFn aFunction, TAny* aPtr); + + + /** + Releases a HW GPT + + @return Returns KErrNone if there was no error or KErrNotFound if + no HW GPT was allocated before. + + @pre Pre-condition: Open was called + */ + IMPORT_C TInt Close(); + + + /** + Starts a GPT in one-shot mode, the callback routine will be called in + interrupt context. + + @param aTime Timeout in microseconds. + + @return returns KErrNone if there was no error, KErrInUse if the timer is already active, + KErrNotFound if no HW GPT was allocated before. + */ + IMPORT_C TInt OneShot(TUint aTime); + + + + /** + Starts a GPT in one-shot mode, the callback routine will be called in client's DFC context. + + @param aTime Timeout in microseconds. + @param aDfc client's DFC object. + + @return returns KErrNone if there was no error, KErrInUse if the timer is already active, + KErrArgument if aDfc is NULL, KErrNotFound if no HW GPT was allocated before. + */ + IMPORT_C TInt OneShot(TUint aTime, TDfc& aDfc); + + + + /** + Starts a GPT in periodic mode (the timer is restarted after it expired). + The callback routine will be called in interrupt context. + + @param aTime Timeout in microseconds. + + @return returns KErrNone if there was no error, KErrInUse if the timer is already active, + KErrNotFound if no HW GPT was allocated before. + */ + IMPORT_C TInt Periodic(TUint aTime); + + + /** + Starts a GPT in periodic mode (the timer is restarted after it expired). + The callback routine will be called in client's DFC context. + + @param aTime Timeout in microseconds. + @param aDfc client's DFC object. + + @return returns KErrNone if there was no error or KErrInUse if the timer is already active, + KErrArgument if aDfc is NULL, KErrNotFound if no HW GPT was allocated before. + */ + IMPORT_C TInt Periodic(TUint aTime, TDfc& aDfc); + + + /** + Requests to cancel a GPT. + + @return Returns ETrue if the timer was actually cancelled or EFalse if the timer was not + cancelled because it was not running or the callback was already running. + */ + IMPORT_C TBool Cancel(); + + /** + destructor of a GPT object + */ + IMPORT_C ~GPTimer(); + + private: + /** + stores aFunction parameter + */ + GPTimerFn iFunction; + + + /** + stores aPtr parameter + */ + TAny* iPtr; + + + /** + stores aTime parameter + */ + TUint iTime; + + + /** + stores aDfc parameter + */ + TDfc iDfc; + }; + + +#endif // __GPTIMER_CHIPSET_API_H__ diff -r 000000000000 -r bb4b476bbb96 Audio HW Control/audio_hw_control_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Audio HW Control/audio_hw_control_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,382 @@ +/* + audio_hw_control_chipset_api.h + + Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +#ifndef AUDIO_HWCTRL_CHIPSET_API_H +#define AUDIO_HWCTRL_CHIPSET_API_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* Each OMX header must include all required header files to allow the + * header to compile without errors. The includes below are required + * for this header file to compile successfully + */ + +#include + + +/* structures and enums used by OMX interface */ + + typedef enum OMX_AUDIO_HWREGISTERTYPE { + OMX_AUDIO_IO = 0, + OMX_AUDIO_I2C, + OMX_AUDIO_SLIMBUS, + OMX_AUDIO_CBUS = 0xFFFF + } OMX_AUDIO_HWREGISTERTYPE; + + typedef struct OMX_AUDIO_REGBANKDESCRIPTORTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nRegBankIndex; + OMX_U32 nLogicalStartAddr; + OMX_U32 nLogicalEndAddr; + OMX_AUDIO_HWREGISTERTYPE eRegBankType; + + } OMX_AUDIO_REGBANKDESCRIPTORTYPE; + + typedef enum OMX_AUDIO_HWLOOPSTYPE { + OMX_AUDIO_NOLOOP = 0, + OMX_AUDIO_SIDETONE_LOOP = 0xFFFF + /* rest of HW loops are to be defined on a vendor specific basis */ + + } OMX_AUDIO_HWLOOPSTYPE; + + typedef enum OMX_AUDIO_HWOPERATIONTYPE { + OMX_AUDIO_NOOP = 0, + OMX_AUDIO_16BIT_SINGLE_READ, + OMX_AUDIO_16BIT_SINGLE_WRITE, + OMX_AUDIO_32BIT_SINGLE_READ, + OMX_AUDIO_32BIT_SINGLE_WRITE, + OMX_AUDIO_16BIT_MULTI_READ, + OMX_AUDIO_16BIT_MULTI_WRITE, + OMX_AUDIO_32BIT_MULTI_READ, + OMX_AUDIO_32BIT_MULTI_WRITE, + OMX_AUDIO_16BIT_BURST_MULTI_READ, + OMX_AUDIO_16BIT_BURST_MULTI_WRITE, + OMX_AUDIO_32BIT_BURST_MULTI_READ, + OMX_AUDIO_32BIT_BURST_MULTI_WRITE = 0xFFFF + } OMX_AUDIO_HWOPERATIONTYPE; + + + typedef enum OMX_AUDIO_HWCTRL_STATUSTYPE { + OMX_AUDIO_OK = 0, + OMX_AUDIO_FAIL, + /* if callback facility is somehow solved in OpenMAX IL for + getconfig/setconfig parameter calls, it is expected */ + /* to have here extra status information that can be returned + for e.g. multi-read/write commands */ + OMX_AUDIO_NOT_SUPPORTED = 0xFFFF + } OMX_AUDIO_HWCTRL_STATUSTYPE; + + + +/* Configuration parameters */ + +typedef struct OMX_AUDIO_CONFIG_POWERTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nChannel; + OMX_BOOL bPower; +} OMX_AUDIO_CONFIG_POWERTYPE; + + +typedef struct OMX_AUDIO_CONFIG_VOLUMERAMPTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nChannel; + OMX_BOOL bLinear; + OMX_BS32 sStartVolume; + OMX_BS32 sEndVolume; + OMX_TICKS nRampDuration; + OMX_BOOL bRampTerminate; + OMX_BS32 sCurrentVolume; + OMX_TICKS nRampCurrentTime; + OMX_TICKS nRampMinDuration; + OMX_TICKS nRampMaxDuration; + OMX_U32 nVolumeStep; + } OMX_AUDIO_CONFIG_VOLUMERAMPTYPE; + + + typedef struct OMX_AUDIO_CONFIG_BURSTCONTROLTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bBurstControl; + OMX_BOOL bStatus; + } OMX_AUDIO_CONFIG_BURSTCONTROLTYPE; + + typedef struct OMX_AUDIO_CONFIG_REGISTERBANKQUERYTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U16 nNumRegisterBanks; + } OMX_AUDIO_CONFIG_REGISTERBANKQUERYTYPE; + + + typedef enum OMX_AUDIO_HWREGISTERTYPE { + OMX_AUDIO_IO = 0, + OMX_AUDIO_I2C, + OMX_AUDIO_SLIMBUS, + OMX_AUDIO_CBUS = 0xFFFF + } OMX_AUDIO_HWREGISTERTYPE; + + + typedef struct OMX_AUDIO_REGBANKDESCRIPTORTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nRegBankIndex; + OMX_U32 nLogicalStartAddr; + OMX_U32 nLogicalEndAddr; + OMX_AUDIO_HWREGISTERTYPE eRegBankType; + + } OMX_AUDIO_REGBANKDESCRIPTORTYPE; + + typedef struct OMX_AUDIO_CONFIG_REGISTERBANKTABLETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U16 nNumRegisterBanks; + OMX_AUDIO_REGBANKDESCRIPTORTYPE RegBankDescriptorTable; + } OMX_AUDIO_CONFIG_REGISTERBANKTABLETYPE; + + + typedef struct OMX_AUDIO_CONFIG_CUSTOMHWCONTROLTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_AUDIO_HWCTRL_STATUSTYPE eStatus; + OMX_AUDIO_HWOPERATIONTYPE eHwOperation; + OMX_AUDIO_HWREGISTERTYPE eRegisterType; + OMX_U16 nDataCount; + OMX_U32 nLogicalAddress; + OMX_U16 nData; + } OMX_AUDIO_CONFIG_CUSTOMHWCONTROLTYPE; + +typedef struct OMX_AUDIO_CONFIG_HWLOOPSUPPORTTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nSupportedLoops; + OMX_AUDIO_HWLOOPSTYPE eLoopIndex; + + } OMX_AUDIO_CONFIG_HWLOOPSUPPORTTYPE; + +typedef struct OMX_AUDIO_CONFIG_HWLOOPCONTROLTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_AUDIO_HWLOOPSTYPE eLoopIndex; + OMX_U32 nChannel; + OMX_BOOL bControlSwitch; + OMX_BOOL bLinear; + OMX_BS32 sLoopVolume; + + } OMX_AUDIO_CONFIG_HWLOOPCONTROLTYPE; + + + +/* End of OMX part */ + +/************ non-OMX interface definition **************/ + +/* types and constants used by non-OMX APIs */ + +/* channel ID denoting special case of all channels being selected + where possible */ +#define AUDIO_COMMON_CHANNEL_ALL 0x7FFFFFFF + +typedef enum AUDIO_COMMON_SWITCH { + AUDIO_COMMON_OFF = 0, + AUDIO_COMMON_ON, + AUDIO_COMMON_UNSUPPORTED = 0xFFFF + } AUDIO_COMMON_SWITCH; + + +typedef enum AUDIO_COMMON_STATUS { + AUDIO_COMMON_OK = 0, + AUDIO_COMMON_FAIL, + AUDIO_COMMON_UNSUPPORTED = 0xFFFF +} AUDIO_COMMON_STATUS; + +typedef enum AUDIO_HAL_HW_LOOPS { + AUDIO_NOLOOP = 0, + AUDIO_SIDETONE_LOOP = 0xFFFF + /* rest of HW loops are to be defined on a vendor specific basis */ + +} AUDIO_HAL_HW_LOOPS; + +typedef enum AUDIO_HAL_HW_OPERATION{ + AUDIO_HAL_NOOP = 0, + AUDIO_HAL_16BIT_SINGLE_READ, + AUDIO_HAL_16BIT_SINGLE_WRITE, + AUDIO_HAL_32BIT_SINGLE_READ, + AUDIO_HAL_32BIT_SINGLE_WRITE, + AUDIO_HAL_16BIT_MULTI_READ, + AUDIO_HAL_16BIT_MULTI_WRITE, + AUDIO_HAL_32BIT_MULTI_READ, + AUDIO_HAL_32BIT_MULTI_WRITE, + AUDIO_HAL_16BIT_BURST_MULTI_READ, + AUDIO_HAL_16BIT_BURST_MULTI_WRITE, + AUDIO_HAL_32BIT_BURST_MULTI_READ, + AUDIO_HAL_32BIT_BURST_MULTI_WRITE = 0xFFFF +} AUDIO_HAL_HW_OPERATION; + +typedef enum AUDIO_HAL_HW_REGISTER_TYPE { + OMX_AUDIO_IO = 0, + OMX_AUDIO_I2C, + OMX_AUDIO_SLIMBUS, + OMX_AUDIO_CBUS = 0xFFFF +} AUDIO_HAL_HW_REGISTER_TYPE; + + +/** 16 bit unsigned quantity that is 16 bit word aligned */ +typedef unsigned short uint16; + +/** 16 bit signed quantity that is 16 bit word aligned */ +typedef signed short int16; + +/** 32 bit unsigned quantity that is 32 bit word aligned */ +typedef unsigned long uint32; + +/** signed quantity that is 32 bit word aligned */ +typedef signed long int32; + +typedef struct AUDIO_HAL_REGBANK_DESCRIPTOR{ + uint32 reg_bank_index; + uint32 logical_start_addr; + uint32 logical_end_addr; + AUDIO_HAL_HW_REGISTER_TYPE reg_bank_type; +} AUDIO_HAL_REGBANK_DESCRIPTOR; + +typedef struct AUDIO_HAL_GAIN_DESCRIPTOR { + uint32 channel_index; + uint16 gain_index; + uint32 linear; + int32 min_gain; + int32 max_gain; + uint32 gain_step; + uint32 analog_gain; + +} AUDIO_HAL_GAIN_DESCRIPTOR; + +typedef struct AUDIO_TIMED_RAMP_INFO { + + uint32 linear, + int32 ramp_start_volume; + int32 ramp_end_volume; + int32 current_volume; + uint32 current_time_hi; + uint32 current_time_lo; + uint32 ramp_min_duration_hi; + uint32 ramp_min_duration_lo; + uint32 ramp_max_duration_hi; + uint32 ramp_max_duration_lo; + int32 min_volume; + int32 max_volume; + uint32 volume_step; + +} AUDIO_TIMED_RAMP_INFO; + + +/* API functions */ + +/* The convention for the functions will be: */ +/* __ */ + +/* HAL layer */ + +void audio_hal_mute_control (void (*call_back_fn_ptr)(AUDIO_COMMON_STATUS status), + uint32 channel_index, + AUDIO_COMMON_SWITCH mute_control); + +AUDIO_COMMON_SWITCH audio_hal_mute_status (uint32 channel_index); + +void audio_hal_power_control (void (*call_back_fn_ptr)(AUDIO_COMMON_STATUS status), + uint32 channel_index, AUDIO_COMMON_SWITCH power_control); + +AUDIO_COMMON_SWITCH audio_hal_power_status(uint32 channel_index); + +void audio_hal_gain_capabilities_query(uint32* num_channels, uint16* max_num_gains); + +void audio_hal_gains_descriptor_query(AUDIO_HAL_GAIN_DESCRIPTOR* gain_descriptor_table); + +void audio_hal_loop_gain_capabilities_query(AUDIO_HAL_HW_LOOPS* num_loops, uint16* max_num_gains); + +void audio_hal_supported_loops_query (uint16* supported_loop_indexes); + +void audio_hal_loop_gains_descriptor_query (AUDIO_HAL_HW_LOOPS loop_index, + AUDIO_HAL_GAIN_DESCRIPTOR* gain_descriptor_table); + +AUDIO_COMMON_STATUS audio_hal_gain_control (uint32 channel_index, uint16 gain_index, + uint32 linear, int32 gain_value); + +AUDIO_COMMON_STATUS audio_hal_gain_query (uint32 channel_index, uint16 gain_index, + uint32 linear, int32* gain_value); + +AUDIO_COMMON_STATUS audio_hal_loop_control(AUDIO_HAL_HW_LOOPS loop_index, AUDIO_COMMON_SWITCH loop_switch, + uint16 channel_index, uint16 gain_index, uint32 linear, + int32 loop_gain_value); + + +uint16 audio_hal_registerbank_query(); + +void audio_hal_regbank_descriptors_query(AUDIO_HAL_REGBANK_DESCRIPTOR* register_banks); + +void audio_hal_custom_hw_control (void (*call_back_fn_ptr)(AUDIO_COMMON_STATUS status, uint32 extra_status_info), + AUDIO_HAL_HW_OPERATION hw_operation, AUDIO_HAL_HW_REGISTER_TYPE register_type, + uint16 num_data, uint32* address_data_sequence); + + +/* Sequencer layer */ +void audio_sequencer_mute_control(void (*call_back_fn_ptr)(AUDIO_COMMON_STATUS status), + uint32 channel_index, AUDIO_COMMON_SWITCH mute_control); + +void audio_sequencer_power_control(void (*call_back_fn_ptr)(AUDIO_COMMON_STATUS status), + uint32 channel_index, AUDIO_COMMON_SWITCH power_control); + +AUDIO_COMMON_STATUS audio_sequencer_burst_control(void (*call_back_fn_ptr)(AUDIO_COMMON_STATUS status), + AUDIO_COMMON_SWITCH burst_control); + +void audio_sequencer_volume_control(void (*call_back_fn_ptr)(AUDIO_COMMON_STATUS status), + uint32 channel_index, uint32 linear, int32 volume); + +void audio_sequencer_volume_query(uint32 channel_index, uint32 linear, int32* min_volume, + int32* max_volume, int32* current_volume); + +/* Timing critical layer */ +void audio_timed_mute_control(void (*call_back_fn_ptr)(AUDIO_COMMON_STATUS status), + uint32 channel_index, AUDIO_COMMON_SWITCH mute_control); + +void audio_timed_volume_ramp_control (void (*call_back_fn_ptr)(AUDIO_COMMON_STATUS status), + uint32 channel_index, uint32 linear, int32 start_volume, + int32 end_volume, uint32 ramp_duration_hi, uint32 ram_duration_lo, + AUDIO_COMMON_SWITCH ramp_terminate); + +void audio_timed_volume_ramp_query (uint32 channel_index, AUDIO_TIMED_RAMP_INFO* volume_ramp_info); + + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif \ No newline at end of file diff -r 000000000000 -r bb4b476bbb96 Audio Signal Processing/audio_codecs_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Audio Signal Processing/audio_codecs_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,226 @@ +/* + audio_codecs_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +#ifndef AUDIO_CODECS_CHIPSET_API_H +#define AUDIO_CODECS_CHIPSET_API_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* Each OMX header must include all required header files to allow the + * header to compile without errors. The includes below are required + * for this header file to compile successfully + */ + +#include + +/** AMR-WB+ related **/ + +typedef enum OMX_AUDIOCODINGEXTTYPE { + OMX_AudioCodingExtStart = 0x6F000000, /* = OMX_AUDIO_CodingExtensions */ + /* Add Khronos approved extended components indexes here */ + OMX_AUDIO_CodingAMRWBPLUS, + OMX_AudioCodingExtMax = 0x6FFFFFFF +} OMX_AUDIOCODINGEXTTYPE; + +/** AMR Wideband Plus Extensions */ +/** AMR Frame format Extension */ +typedef enum OMX_AUDIO_AMREXT_FRAMEFORMATTYPE { + OMX_AUDIO_AMRFrameFormatConformance = 0, /**< Frame Format is AMR Conformance + (Standard) Format */ + OMX_AUDIO_AMRFrameFormatIF1, /**< Frame Format is AMR Interface + Format 1 */ + OMX_AUDIO_AMRFrameFormatIF2, /**< Frame Format is AMR Interface + Format 2*/ + OMX_AUDIO_AMRFrameFormatFSF, /**< Frame Format is AMR File Storage + Format */ + OMX_AUDIO_AMRFrameFormatRTPPayload, /**< Frame Format is AMR Real-Time + Transport Protocol Payload Format */ + OMX_AUDIO_AMRFrameFormatITU, /**< Frame Format is ITU Format (added at Motorola request) */ + OMX_AUDIO_AMRWideBandPlusFrameFormat, /**< 3GPP TS 26.290, clause 8.2 */ + OMX_AUDIO_AMRFrameFormatMax = 0x7FFFFFFF +} OMX_AUDIO_AMREXT_FRAMEFORMATTYPE; + +typedef enum OMX_AUDIO_AMRDTXMODETYPE { + OMX_AUDIO_AMRDTXModeUsed = 0, /**< DTX used or unused */ + OMX_AUDIO_AMRDTXModeOnVAD1, /**< Use Type 1 VAD */ + OMX_AUDIO_AMRDTXModeOnVAD2, /**< Use Type 2 VAD */ + OMX_AUDIO_AMRDTXModeOnAuto, /**< VAD type automatic */ + OMX_AUDIO_AMRDTXModeAsEFR, /**< DTX frames as EFR */ + OMX_AUDIO_AMRDTXModeMax = 0x7FFFFFFF + + } OMX_AUDIO_AMRDTXMODETYPE; + + + +/** AMR band mode extension */ +typedef enum OMX_AUDIO_AMREXT_BANDMODETYPE { + OMX_AUDIO_AMRBandModeUnused = 0, /**< AMRNB Mode unused / unknown */ + OMX_AUDIO_AMRBandModeNB0, /**< AMRNB Mode 0 = 4750 bps */ + OMX_AUDIO_AMRBandModeNB1, /**< AMRNB Mode 1 = 5150 bps */ + OMX_AUDIO_AMRBandModeNB2, /**< AMRNB Mode 2 = 5900 bps */ + OMX_AUDIO_AMRBandModeNB3, /**< AMRNB Mode 3 = 6700 bps */ + OMX_AUDIO_AMRBandModeNB4, /**< AMRNB Mode 4 = 7400 bps */ + OMX_AUDIO_AMRBandModeNB5, /**< AMRNB Mode 5 = 7950 bps */ + OMX_AUDIO_AMRBandModeNB6, /**< AMRNB Mode 6 = 10200 bps */ + OMX_AUDIO_AMRBandModeNB7, /**< AMRNB Mode 7 = 12200 bps */ + OMX_AUDIO_AMRBandModeWB0, /**< AMRWB Mode 0 = 6600 bps */ + OMX_AUDIO_AMRBandModeWB1, /**< AMRWB Mode 1 = 8850 bps */ + OMX_AUDIO_AMRBandModeWB2, /**< AMRWB Mode 2 = 12650 bps */ + OMX_AUDIO_AMRBandModeWB3, /**< AMRWB Mode 3 = 14250 bps */ + OMX_AUDIO_AMRBandModeWB4, /**< AMRWB Mode 4 = 15850 bps */ + OMX_AUDIO_AMRBandModeWB5, /**< AMRWB Mode 5 = 18250 bps */ + OMX_AUDIO_AMRBandModeWB6, /**< AMRWB Mode 6 = 19850 bps */ + OMX_AUDIO_AMRBandModeWB7, /**< AMRWB Mode 7 = 23050 bps */ + OMX_AUDIO_AMRBandModeWB8, /**< AMRWB Mode 8 = 23850 bps */ + OMX_AUDIO_AMRBandModeWP0, /**< AMR-WB+ 13.6 kbps (mono, 16/24kHz output) */ + OMX_AUDIO_AMRBandModeWP1, /**< AMR-WB+ 18 kbps (stereo, 16/24kHz output) */ + OMX_AUDIO_AMRBandModeWP2, /**< AMR-WB+ 24 kbps (mono, 16/24kHz output) */ + OMX_AUDIO_AMRBandModeWP3, /**< AMR-WB+ 24 kbps (stereo, 16/24kHz output) */ + OMX_AUDIO_AMRBandModeWP4, /**< AMR-WB+ 10.4 kbps (mono) */ + OMX_AUDIO_AMRBandModeWP5, /**< AMR-WB+ 12.0 kbps (mono) */ + OMX_AUDIO_AMRBandModeWP6, /**< AMR-WB+ 13.6 kbps (mono) */ + OMX_AUDIO_AMRBandModeWP7, /**< AMR-WB+ 15.2 kbps (mono) */ + OMX_AUDIO_AMRBandModeWP8, /**< AMR-WB+ 16.8 kbps (mono) */ + OMX_AUDIO_AMRBandModeWP9, /**< AMR-WB+ 19.2 kbps (mono) */ + OMX_AUDIO_AMRBandModeWP10, /**< AMR-WB+ 20.8 kbps (mono) */ + OMX_AUDIO_AMRBandModeWP11, /**< AMR-WB+ 24.0 kbps (mono) */ + OMX_AUDIO_AMRBandModeWP12, /**< AMR-WB+ 12.4 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP13, /**< AMR-WB+ 12.8 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP14, /**< AMR-WB+ 14.0 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP15, /**< AMR-WB+ 14.4 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP16, /**< AMR-WB+ 15.2 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP17, /**< AMR-WB+ 16.0 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP18, /**< AMR-WB+ 16.4 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP19, /**< AMR-WB+ 17.2 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP20, /**< AMR-WB+ 18.0 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP21, /**< AMR-WB+ 18.4 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP22, /**< AMR-WB+ 19.2 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP23, /**< AMR-WB+ 20.0 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP24, /**< AMR-WB+ 20.4 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP25, /**< AMR-WB+ 21.2 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP26, /**< AMR-WB+ 22.4 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP27, /**< AMR-WB+ 23.2 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP28, /**< AMR-WB+ 24.0 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP29, /**< AMR-WB+ 25.6 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP30, /**< AMR-WB+ 26.0 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP31, /**< AMR-WB+ 26.8 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP32, /**< AMR-WB+ 28.8 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP33, /**< AMR-WB+ 29.6 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP34, /**< AMR-WB+ 30.0 kbps (stereo) */ + OMX_AUDIO_AMRBandModeWP35, /**< AMR-WB+ 32.0 kbps (stereo) */ + + OMX_AUDIO_AMRBandModeMax = 0x7FFFFFFF /**< 5.15 kbps */ +} OMX_AUDIO_AMREXT_BANDMODETYPE; + + +/** AMR params extension */ + + +typedef struct OMX_AUDIO_PARAM_AMREXT_TYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels */ + OMX_U32 nBitRate; /**< Bit rate read only field */ + OMX_AUDIO_AMREXT_BANDMODETYPE eAMRBandMode; /**< AMR Band Mode enumeration */ + OMX_AUDIO_AMRDTXMODETYPE eAMRDTXMode; /**< AMR DTX Mode enumeration */ + OMX_AUDIO_AMREXT_FRAMEFORMATTYPE eAMRFrameFormat; /**< AMR frame format enumeration */ + OMX_U32 nAMRWideBandPlusISF; /**< AMR-WB+ internal Sampling Frequency Factor expressed in percentage */ + OMX_BOOL bAMRWideBandPlusLC; /**< Activates/deactivates AMR-WB+ low complexity Extended AMR Wide Band encoding mode */ + OMX_BOOL bAMRWideBandPlusLimiter /**< Activates/deactivates the limiter option of the decoder */ + +} OMX_AUDIO_PARAM_AMREXT_TYPE; + +/** End of AMR-WB+ related **/ + +/** WMA Pro related **/ + +/** WMA Pro params **/ + +typedef enum OMX_AUDIO_WMAPROFORMATTYPE { + OMX_AUDIO_WMAPROFormatUnused = 0, /**< AMRNB Mode unused / unknown */ + OMX_AUDIO_WMAPROFormat9, + OMX_AUDIO_WMAPROFormat10, + OMX_AUDIO_WMAPROFormatMax = 0x7FFFFFFF +} OMX_AUDIO_WMAPROFORMATTYPE; + +typedef enum OMX_AUDIO_WMAPROPROFILETYPE { + OMX_AUDIO_WMAPROProfileUnused = 0, /**< AMRNB Mode unused / unknown */ + OMX_AUDIO_WMAPROProfileM0, + OMX_AUDIO_WMAPROProfileM1, + OMX_AUDIO_WMAPROProfileM2, + OMX_AUDIO_WMAPROProfileM3, + OMX_AUDIO_WMAPROProfileMax = 0x7FFFFFFF +} OMX_AUDIO_WMAPROPROFILETYPE; + +typedef struct OMX_AUDIO_PARAM_WMAPROTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U16 nChannels; + OMX_U32 nBitRate; + OMX_AUDIO_WMAPROFORMATTYPE eFormat; + OMX_AUDIO_WMAPROPROFILETYPE eProfile; + OMX_U32 nSamplingRate; + OMX_U32 nBlockAlign; + OMX_U32 nSuperBlockAlign; + OMX_U32 nEncodeOptions; + OMX_U32 nAdvancedEncodeOptions; + OMX_U32 nAdvancedEncodeOptions2; + OMX_U32 nChannelMask; +} OMX_AUDIO_PARAM_WMAPROTYPE; + +/** End of WMA Pro related **/ + +/** iLBC related **/ +typedef struct OMX_AUDIO_PARAM_ILBCTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nFrameLength; + OMX_BOOL bIsDTXCNGSupported; + OMX_BOOL bDTXCNGSelected; + OMX_BOOL bPLCSelected; + } OMX_AUDIO_PARAM_ILBCTYPE; + +/** End of iLBC related **/ + +/** G711 related **/ +typedef struct OMX_AUDIO_PARAM_G711TYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bIsDTXCNGSupported; + OMX_BOOL bIsPLCSupported; + OMX_BOOL bDTXCNGEnabled; + OMX_BOOL bPLCEnabled; + OMX_U32 nFrameLength; + } OMX_AUDIO_PARAM_G711TYPE; + +/** End of G711 related **/ + + +/** End of Dummy component **/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif \ No newline at end of file diff -r 000000000000 -r bb4b476bbb96 Audio Signal Processing/audio_render_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Audio Signal Processing/audio_render_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,273 @@ +/* + audio_render_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +#ifndef AUDIO_RENDER_CHIPSET_API_H +#define AUDIO_RENDER_CHIPSET_API_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* Each OMX header must include all required header files to allow the + * header to compile without errors. The includes below are required + * for this header file to compile successfully + */ + +#include + +/* Volume ramp duration parameters */ +typedef struct OMX_AUDIO_CONFIG_VOLUMERAMPTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nChannel; + OMX_BOOL bLinear; + OMX_BS32 sStartVolume; + OMX_BS32 sEndVolume; + OMX_BU32 nRampDuration; + OMX_BOOL bRampTerminate; + OMX_BS32 sCurrentVolume; + OMX_TICKS nRampCurrentTime; + } OMX_AUDIO_CONFIG_VOLUMERAMPTYPE; + +typedef struct OMX_AUDIO_CONFIG_PORTPAUSETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bIsPaused; +} OMX_AUDIO_CONFIG_PORTPAUSETYPE; + +typedef struct OMX_AUDIO_PARAM_SYNCHRONIZEDTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bIsSynchronized; +} OMX_AUDIO_PARAM_SYNCHRONIZEDTYPE; + + +/* Positional 3D parameters */ + +typedef enum OMX_AUDIO_3DOUTPUTTYPE { +OMX_AUDIO_3DOutputHeadphones, /*Positional 3D audio for headphones */ +OMX_AUDIO_3DOutputLoudspeakers, /*Positional 3D audio for two closely spaced loudspeakers */ +OMX_AUDIO_3DOutputMax /*Allowance for expansion in the number of positional 3D audio types */ +} OMX_AUDIO_3DOUTPUTTYPE; + +typedef struct OMX_AUDIO_CONFIG_3DOUTPUTTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_AUDIO_3DOUTPUTTYPE e3DOutputType; +} OMX_AUDIO_CONFIG_3DOUTPUTTYPE; + +typedef struct OMX_AUDIO_CONFIG_3DLOCATIONTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_S32 nX; + OMX_S32 nY; + OMX_S32 nZ; +} OMX_AUDIO_CONFIG_3DLOCATIONTYPE; + +typedef struct OMX_AUDIO_PARAM_3DDOPPLERMODETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnabled; +} OMX_AUDIO_PARAM_3DDOPPLERMODETYPE; + +typedef struct OMX_AUDIO_CONFIG_3DDIRECTIVITYSETTINGSTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nSoundSpeed; + OMX_S32 nSourceVelocity; + OMX_S32 nListenerVelocity; + } OMX_AUDIO_CONFIG_3DDOPPLERSETTINGSTYPE; + +typedef struct OMX_AUDIO_CONFIG_3DLEVELSTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BS16 sDirectLevel; + OMX_BS16 sRoomLevel; +} OMX_AUDIO_CONFIG_3DLEVELSTYPE; + +typedef struct OMX_AUDIO_CONFIG_3DDISTANCEATTENUATIONTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BS32 sMinDistance; + OMX_BS32 sMaxDistance; + OMX_BS16 sRollOffFactor; + OMX_BS16 sRoomRollOffFactor; + OMX_AUDIO_ROLLOFFMODEL eRollOffModel; + OMX_BOOL bMuteAfterMax; +} OMX_AUDIO_CONFIG_3DDISTANCEATTENUATIONTYPE; + +typedef struct OMX_AUDIO_CONFIG_3DDIRECTIVITYSETTINGSTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BS32 sInnerAngle; + OMX_BS32 sOuterAngle; + OMX_BS16 sOuterLevel; +} OMX_AUDIO_CONFIG_3DDIRECTIVITYSETTINGSTYPE; + +typedef struct OMX_AUDIO_CONFIG_3DDIRECTIVITYORIENTATIONTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_S32 nXFront; + OMX_S32 nYFront; + OMX_S32 nZFront; +} OMX_AUDIO_CONFIG_3DDIRECTIVITYORIENTATIONTYPE; + +typedef struct OMX_AUDIO_CONFIG_3DMACROSCOPICORIENTATIONTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_S32 nXFront; + OMX_S32 nYFront; + OMX_S32 nZFront; + OMX_S32 nXAbove; + OMX_S32 nYAbove; + OMX_S32 nZAbove; + +} OMX_AUDIO_CONFIG_3DMACROSCOPICORIENTATIONTYPE; + +typedef struct OMX_AUDIO_CONFIG_3DMACROSCOPICSIZETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_S32 nWidth; + OMX_S32 nHeight; + OMX_S32 nDepth; +} OMX_AUDIO_CONFIG_3DMACROSCOPICSIZETYPE; + +typedef struct OMX_AUDIO_CONFIG_3DCOMMITMODETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bDeferred; +} OMX_AUDIO_CONFIG_3DCOMMITMODETYPE; + +typedef struct OMX_AUDIO_CONFIG_3DCOMMITTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; +} OMX_AUDIO_CONFIG_3DCOMMITTYPE; + +/** End of positional 3D related **/ + + +/* Audio virtualizer related parameters */ +typedef enum OMX_AUDIO_VIRTUALIZERTYPE { + OMX_AUDIO_VirtualizerLoudspeakers, /* Loudspeakers */ + OMX_AUDIO_VirtualizerHeadphones /* Headphones */ +} OMX_AUDIO_VIRTUALIZERTYPE; + +typedef struct OMX_AUDIO_CONFIG_VIRTUALIZERTYPE { +OMX_U32 nSize; +OMX_VERSIONTYPE nVersion; +OMX_U32 nPortIndex; +OMX_BOOL bEnable; +OMX_AUDIO_VIRTUALIZERTYPE eVirtualizationType; +OMX_U32 nVirtualizationStrength; + } OMX_AUDIO_CONFIG_VIRTUALIZERTYPE; + +typedef struct OMX_AUDIO_CONFIG_VIRTUALIZERLOUDSPEAKERTYPE { +OMX_U32 nSize; +OMX_VERSIONTYPE nVersion; +OMX_U32 nPortIndex; +OMX_U32 nListeningAngle; + } OMX_AUDIO_CONFIG_VIRTUALIZERLOUDSPEAKERTYPE; + +typedef struct OMX_AUDIO_CONFIG_VIRTUALIZERUPMIXTYPE { +OMX_U32 nSize; +OMX_VERSIONTYPE nVersion; +OMX_U32 nPortIndex; +OMX_BOOL bEnable; +} OMX_AUDIO_CONFIG_VIRTUALIZERUPMIXTYPE; + +/* End of audio virtualizer related params */ + +/* Audio visualizer related parameters */ +typedef enum OMX_AUDIO_VISUALIZATIONTYPE { + OMX_AUDIO_VisualizationPresetNone, + OMX_AUDIO_VisualizationPresetWaveform, + OMX_AUDIO_VisualizationPresetSpectrum, + OMX_AUDIO_VisualizationPresetWaveformAndSpectrum +} OMX_AUDIO_VISUALIZATIONTYPE; + +typedef struct OMX_AUDIO_CONFIG_VISUALIZATIONTYPE { +OMX_U32 nSize; +OMX_VERSIONTYPE nVersion; +OMX_U32 nPortIndex; +OMX_BOOL bEnable; +OMX_AUDIO_VISUALIZATIONTYPE ePreset; +OMX_BU32 sRate; +} OMX_AUDIO_CONFIG_VISUALIZATIONTYPE; + +typedef struct OMX_AUDIO_CONFIG_VISUALIZATIONSPECTRALTYPE { +OMX_U32 nSize; +OMX_VERSIONTYPE nVersion; +OMX_U32 nPortIndex; +OMX_BU32 sBandIndex; +OMX_BU32 sCenterFreq; +OMX_U32 nType; +} OMX_AUDIO_CONFIG_VISUALIZATIONSPECTRALTYPE; + +typedef struct OMX_AUDIO_CONFIG_VISUALIZATIONWAVEFORMTYPE { +OMX_U32 nSize; +OMX_VERSIONTYPE nVersion; +OMX_U32 nPortIndex; +OMX_BU32 sWaveformLength; +} OMX_AUDIO_CONFIG_VISUALIZATIONWAVEFORMTYPE; + + +typedef struct OMX_AUDIO_CONFIG_DOWNMIXERTYPE { +OMX_U32 nSize; +OMX_VERSIONTYPE nVersion; +OMX_U32 nPortIndex; +OMX_BOOL bEnable; +} OMX_AUDIO_CONFIG_DOWNMIXERTYPE; + + +typedef enum OMX_OTHER_FORMATTYPE { + OMX_OTHER_FormatTime = 0, /**< Transmission of various timestamps, elapsed time, + time deltas, etc */ + OMX_OTHER_FormatPower, /**< Perhaps used for enabling/disabling power + management, setting clocks? */ + OMX_OTHER_FormatStats, /**< Could be things such as frame rate, frames + dropped, etc */ + OMX_OTHER_FormatBinary, /**< Arbitrary binary data */ + OMX_OTHER_FormatVendorReserved = 1000, /**< Starting value for vendor specific + formats */ + OMX_OTHER_FormatNokiaSpectral, + OMX_OTHER_FormatMax = 0x7FFFFFFF +} OMX_OTHER_FORMATTYPE; + + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif \ No newline at end of file diff -r 000000000000 -r bb4b476bbb96 Audio Signal Processing/audio_sourcesink_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Audio Signal Processing/audio_sourcesink_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,77 @@ +/* + audio_sourcesink_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +#ifndef AUDIO_SOURCESINK_CHIPSET_API_H +#define AUDIO_SOURCESINK_CHIPSET_API_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* Each OMX header must include all required header files to allow the + * header to compile without errors. The includes below are required + * for this header file to compile successfully + */ + +#include + +/* Including audio_hw_control_chipset_api_v0_1.h */ +#include "audio_hw_control_chipset_api_v0_1.h" + +typedef struct OMX_AUDIO_PARAM_SIDETONEYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_S32 nAttenuation; + OMX_S32 nGain; + } OMX_AUDIO_PARAM_SIDETONETYPE; + + +/* HDMI related configuration structure */ +typedef struct OMX_AUDIO_PARAM_HDMITYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nSubFrameSize; + OMX_U32 nVaildBitsPerSample; + OMX_U32 nQFormat; +} OMX_AUDIO_PARAM_HDMITYPE; + +typedef struct OMX_AUDIO_CONFIG_TONEGENERATORTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnabled; + OMX_TONEGENTONETYPE eTonetype; + OMX_U32 nFrequency[2]; + OMX_U32 nDigit; +} OMX_AUDIO_CONFIG_TONEGENERATORTYPE + +/* Enumerations */ +typedef enum OMX_TONEGENTONETYPE { + OMX_TONEGEN_NormalTone, /**< Normal Tone */ + OMX_TONEGEN_DtmfTone, /**< DTMF Tone */ + } OMX_TONEGENTONETYPE; + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif \ No newline at end of file diff -r 000000000000 -r bb4b476bbb96 Audio Signal Processing/audio_transducer_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Audio Signal Processing/audio_transducer_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,180 @@ +/* + audio_transducer_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +#ifndef AUDIO_TRANSDUCER_CHIPSET_API_H +#define AUDIO_TRANSDUCER_CHIPSET_API_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* Each OMX header must include all required header files to allow the + * header to compile without errors. The includes below are required + * for this header file to compile successfully + */ + +#include + +#define MAX_FIRRESPONSE_POINTS 100 + +/* Transducer Equalizer parameters */ + + +typedef enum OMX_AUDIO_PHASERESPONSETYPE { +OMX_AUDIO_PhaseNotDefined, +OMX_AUDIO_LinearPhase, +OMX_AUDIO_MinimumPhase, +} OMX_AUDIO_PHASERESPONSETYPE; + + +typedef enum OMX_AUDIO_FILTERTYPE { +OMX_AUDIO_NotDefined, +OMX_AUDIO_Peaking, +OMX_AUDIO_Lowpass, +OMX_AUDIO_Highpass, +OMX_AUDIO_Lowshelf, +OMX_AUDIO_Highshelf, +} OMX_AUDIO_FILTERTYPE; + + +typedef struct OMX_AUDIO_CONFIG_IIR_EQUALIZER { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BU32 sBandIndex ; + OMX_AUDIO_FILTERTYPE eFilterType; + OMX_U32 nFilterCenterCutoffFrequency; + OMX_S32 nFilterGain; + OMX_U32 nFilterBandwidth; /* Q-value could be used instead. */ + } OMX_AUDIO_CONFIG_IIR_EQUALIZER; + + +typedef struct OMX_AUDIO_CONFIG_FIR_RESPONSE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_u32 nFrequencyPoints; + OMX_S32 nFrequencies[MAX_FIRRESPONSE_POINTS]; + OMX_S32 nGains[MAX_FIRRESPONSE_POINTS]; +} OMX_AUDIO_CONFIG_FIR_RESPONSE; + + +typedef struct OMX_AUDIO_CONFIG_TRANSDUCEREQUALIZERTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnableFir; + OMX_BOOL bEnableIir; + OMX_U32 nChannel; + OMX_AUDIO_PHASERESPONSETYPE ePhaseResponseTargetFir; + OMX_AUDIO_PHASERESPONSETYPE ePhaseResponseTargetIir; + OMX_U32 nIIREqualizerBlocks; + OMX_U32 nIIREqualizerGain; +} OMX_AUDIO_CONFIG_TRANSDUCEREQUALIZERTYPE; + + +/* MDRC parameters */ + +typedef struct OMX_AUDIO_CONFIG_MDRCTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + OMX_BU32 sBandIndex; + OMX_BU32 sBandRange; + OMX_BU32 sBandLevel; + OMX_BU32 sKneePoints; + OMX_U32 nDynamicResponse[10][2]; + OMX_BU32 sAttackTime; + OMX_BU32 sReleaseTime; +} OMX_AUDIO_CONFIG_MDRCTYPE; + +/* Transducer (Loudspeaker) protection parameters */ + +typedef struct OMX_AUDIO_CONFIG_LSPROTECTIONTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_AUDIO_CHANNELTYPE eChannel; + OMX_BOOL bEnable; + } OMX_AUDIO_CONFIG_LSPROTECTIONTYPE; + +/* End of Transducer protection params */ + +/* Transducer SPL limit parameters */ + +typedef enum OMX_AUDIO_SPLLIMITTYPE { +OMX_AUDIO_SPLLimitation, +OMX_AUDIO_SPLNormalization, +OMX_AUDIO_SPLMax, +} OMX_AUDIO_OMX_AUDIO_SPLLIMITTYPE; + + +typedef struct OMX_AUDIO_CONFIG_SPLLIMITTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + OMX_AUDIO_SPLLIMITTYPE eMode; + OMX_S32 nSplLimit; + OMX_S32 nGain; +} OMX_AUDIO_CONFIG_SPLLIMITTYPE; +/* End of transducer SPL limit params */ + +/* Click Removal algorithm parameters */ + +typedef struct OMX_AUDIO_CONFIG_CLICKREMOVALTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + OMX_BU16 sClickControl; +} OMX_AUDIO_CONFIG_CLICKREMOVALTYPE; +/* End of click removal params */ + +/* Earpiece Active Noise Control */ + +typedef struct OMX_AUDIO_CONFIG_EARPIECE_ACTIVE_NOISE_CONTROL { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; +} OMX_AUDIO_CONFIG_EARPIECE_ACTIVE_NOISE_CONTROL; + +/* Algorithm for Preventing System Shutdown by Audio System (APSSAS) */ + +typedef struct OMX_AUDIO_PARAM_APSSASTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; +} OMX_AUDIO_PARAM_APSSASTYPE; + +typedef struct OMX_AUDIO_CONFIG_BATTERY_VOLTAGETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nBattVol; +} OMX_AUDIO_CONFIG_BATTERY_VOLTAGETYPE; + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif \ No newline at end of file diff -r 000000000000 -r bb4b476bbb96 Audio Telephony/audio_telephony_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Audio Telephony/audio_telephony_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,229 @@ +/* + audio_telephony_chipset_api.h + + Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +#ifndef AUDIO_TELEPHONY_CHIPSET_API_H +#define AUDIO_TELEPHONY_CHIPSET_API_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* Each OMX header must include all required header files to allow the + * header to compile without errors. The includes below are required + * for this header file to compile successfully + */ + +#include + + /* Speech decoder status information */ + + typedef struct OMX_AUDIO_DECODER_STATUS { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion ; + OMX_AUDIO_CODINGTYPE nCoding; + OMX_U32 nBitrate; + } OMX_AUDIO_DECODER_STATUS; + + /* Speech encoder status information */ + + typedef struct OMX_AUDIO_ENCODER_STATUS { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion ; + OMX_AUDIO_CODINGTYPE nCoding; + OMX_U32 nBitrate; + OMX_BOOL bDtx; + OMX_BOOL bAudioActivityControl; + OMX_BOOL bNsync; + } OMX_AUDIO_ENCODER_STATUS; + + /* Uplink timing control */ + + typedef struct OMX_AUDIO_UPLINK_TIMING { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nDeliveryTime; + OMX_U32 nModemProcessingTime; + } OMX_AUDIO_UPLINK_TIMING; + + /* RF-TX Power information */ + + typedef struct OMX_AUDIO_RF_TX_POWER { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPower; + OMX_U32 nTime; + } OMX_AUDIO_RF_TX_POWER; + + /* Acoustic echo control configuration parameters */ + + typedef struct OMX_AUDIO_CONFIG_ACOUSTIC_ECHO_CONTROL { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + OMX_S32 sEchoGain; + OMX_U32 nEchoMinDelay; + OMX_U32 nEchoMaxDelay; + } OMX_AUDIO_CONFIG_ACOUSTIC_ECHO_CONTROL; + + /* Artificial bandwidth expansion configuration parameters */ + + typedef struct OMX_AUDIO_ARTIFICIAL_BANDWIDTH_EXPANSION { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + OMX_S32 nStrength; + } OMX_AUDIO_ARTIFICIAL_BANDWIDTH_EXPANSION; + + /* Automatic volume control configuration parameters */ + + typedef struct OMX_AUDIO_CONFIG_AUTOMATIC_VOLUME_CONTROL { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + } OMX_AUDIO_CONFIG_AUTOMATIC_VOLUME_CONTROL; + + /* Background noise control configuration parameters */ + + typedef struct OMX_AUDIO_CONFIG_BACKGROUND_NOISE_CONTROL { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + OMX_U32 nStrength; + } OMX_AUDIO_CONFIG_BACKGROUND_NOISE_CONTROL; + + /* Comfort noise generation configuration parameters */ + + typedef struct OMX_AUDIO_CONFIG_COMFORT_NOISE_GENERATION { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + } OMX_AUDIO_CONFIG_COMFORT_NOISE_GENERATION; + + /* Downlink noise control configuration parameters */ + + typedef struct OMX_AUDIO_CONFIG_DOWNLINK_NOISE_CONTROL { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + OMX_U32 nStrength; + } OMX_AUDIO_CONFIG_DOWNLINK_NOISE_CONTROL; + + /* Multimicrophone noise control configuration parameters */ + + typedef struct OMX_AUDIO_CONFIG_MULTIMICROPHONE_NOISE_CONTROL { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + } OMX_AUDIO_CONFIG_MULTIMICROPHONE_NOISE_CONTROL; + + /* Sidetone howling control configuration parameters */ + + typedef struct OMX_AUDIO_CONFIG_SIDETONE_HOWLING_CONTROL { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + OMX_S32 nSidetoneAttenuation; + } OMX_AUDIO_CONFIG_SIDETONE_HOWLING_CONTROL; + + /* Transducer dynamic range control configuration parameters */ + + typedef struct OMX_AUDIO_CONFIG_TRANSDUCER_DYNAMIC_RANGE_CONTROL { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + } OMX_AUDIO_CONFIG_TRANSDUCER_DYNAMIC_CONTROL; + + /* Uplink level configuration parameters */ + + typedef struct OMX_AUDIO_CONFIG_UPLINK_LEVEL_NORMALIZATION { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + } OMX_AUDIO_CONFIG_UPLINK_LEVEL_NORMALIZATION; + + /* Voice clarity configuration parameters */ + + typedef struct OMX_AUDIO_CONFIG_VOICE_CLARITY { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + } OMX_AUDIO_CONFIG_VOICE_CLARITY; + + /* Wind noise control configuration parameters */ + + typedef struct OMX_AUDIO_CONFIG_WIND_NOISE_CONTROL { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + OMX_U32 nSensitivity; + } OMX_AUDIO_CONFIG_WIND_NOISE_CONTROL; + + /* Extra data base typeWind noise control configuration parameters */ + + typedef struct OMX_OTHER_EXTRADATABASETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_EXTRADATATYPE eType; + OMX_U32 nDataSize; + } OMX_OTHER_EXTRADATABASETYPE; + + /* Extra data base type */ + + typedef struct OMX_AUDIO_DLSPEECHINFOTYPE { + OMX_BOOL bComfortNoiseFrame; + OMX_BOOL bCorruptedFrame; + } OMX_AUDIO_DLSPEECHINFOTYPE; + + /* Downlink speech information extra data */ + + typedef struct OMX_AUDIO_EXTRADATA_DLSPEECHINFOTYPE { + OMX_OTHER_EXTRADATABASETYPE base; + OMX_AUDIO_DLSPEECHINFOTYPE dlspeechinfo; + } OMX_AUDIO_EXTRADATA_DLSPEECHINFOTYPE; + + /* DA-AD timing difference information extra data */ + + typedef struct OMX_AUDIO_DAADTIMINGDIFFTYPE { + OMX_TICKS nDaAdTimingDifference; + } OMX_AUDIO_DAADTIMINGDIFFTYPE; + + /* DA-AD timing difference information extra data */ + + typedef struct OMX_AUDIO_DAADTIMINGDIFFTYPE { + OMX_OTHER_EXTRADATABASETYPE base; + OMX_AUDIO_DLSPEECHINFOTYPE dlspeechinfo; + } OMX_AUDIO_OMX_AUDIO_DAADTIMINGDIFFTYPE; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif diff -r 000000000000 -r bb4b476bbb96 Bluetooth/bt_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Bluetooth/bt_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,188 @@ +/* + bt_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/* + Abstract and functional description + + 3rd party Chipset API Specification for Bluetooth + + Specification/design references + + BT Chipset API Specification.doc + + +*/ + +#ifndef BT_CHIPSET_API_H +#define BT_CHIPSET_API_H + + +/* Informative list of headers which are directly used by the present header + * and hence assumed to be included by the .c module before the present header + * global.h + * type_def.h + */ + +/* --------------------------------------------------------------------------- + * + * CONSTANTS + * + */ + +/* ----------------------------------------------------------- */ +/* macros for interface function: hal_bt_uart_control() */ +/* ----------------------------------------------------------- */ +/* possible actions */ +#define HAL_BT_UART_CTRL_ENABLE_INT 0 +#define HAL_BT_UART_CTRL_DISABLE_INT 1 +#define HAL_BT_UART_CTRL_INIT_UART 2 +#define HAL_BT_UART_CTRL_BAUDRATE_SET 3 +#define HAL_BT_UART_CTRL_SLEEP 4 +#define HAL_BT_UART_CTRL_FLUSH 5 + +/* possible interrupts for enable/disable interrupts */ +#define HAL_BT_UART_HOST_WAKEUP_INT (1<<0) +#define HAL_BT_UART_RX_INT (1<<1) +#define HAL_BT_UART_TX_INT (1<<2) +#define HAL_BT_UART_CTS_INT (1<<3) +#define HAL_BT_UART_ALL_INT ( HAL_BT_UART_HOST_WAKEUP_INT| \ + HAL_BT_UART_RX_INT| \ + HAL_BT_UART_TX_INT| \ + HAL_BT_UART_CTS_INT ) +/* possible actions for enable/disable interrupts */ +#define HAL_BT_UART_DISABLE_INT 0 +#define HAL_BT_UART_ENABLE_INT 1 /* Note: any value != 0 will enable the int */ + +/* possible activities for sleep control */ +#define HAL_BT_UART_SLEEP_DISABLE 0 +#define HAL_BT_UART_SLEEP_ENABLE 1 +#define HAL_BT_UART_SLEEP_ENABLE_TX 2 +#define HAL_BT_UART_SLEEP_ENABLE_RX 3 +#define HAL_BT_UART_SLEEP_DISABLE_TX 4 +#define HAL_BT_UART_SLEEP_DISABLE_RX 5 + +/* possible buffers rx/tx flush */ +#define HAL_BT_UART_RX_BUFFER (1<<0) +#define HAL_BT_UART_TX_BUFFER (1<<1) + +/* constants for UART init: */ +/* parity setting */ +#define HAL_BT_UART_PARITY_NONE 0 +#define HAL_BT_UART_PARITY_ODD 1 +#define HAL_BT_UART_PARITY_EVEN 2 +/* flow control */ +#define HAL_BT_UART_FLOW_MODE_FREE 1 /* no flow control used */ +#define HAL_BT_UART_FLOW_MODE_SOFT 2 /* SW controled flow control */ +#define HAL_BT_UART_FLOW_MODE_HARD 3 /* HW controled flow control */ +/* need to write number of bits-1 to register */ +#define HAL_BT_UART_DATA_BIT_8 7 +#define HAL_BT_UART_STOP_BIT_1 0 + + + +/* ----------------------------------------------------------- */ +/* macros for interface function: hal_bt_uart_port_access() */ +/* ----------------------------------------------------------- */ +/* possible ports */ +#define HAL_BT_UART_RTS 0 +#define HAL_BT_UART_BT_WAKEUP 1 +#define HAL_BT_UART_BT_RESETX 2 +#define HAL_BT_UART_HOST_WAKEUP 3 +#define HAL_BT_UART_CTS 4 +/* access types */ +#define HAL_BT_UART_READ 0 +#define HAL_BT_UART_WRITE 1 +/* possible port states */ +#define HAL_BT_UART_OFF 0 +#define HAL_BT_UART_ON 1 + + +/* ----------------------------------------------------------- */ +/* macros for interface function: hal_bt_uart_register_event() */ +/* ----------------------------------------------------------- */ +/* possible events */ +/* used when registrating handler for certain events */ +#define HAL_BT_UART_TX_FINISHED_EVENT 0 +#define HAL_BT_UART_RX_FINISHED_EVENT 1 +#define HAL_BT_UART_RX_HEADER_EVENT 2 +#define HAL_BT_UART_HOST_WAKEUP_EVENT 3 +#define HAL_BT_UART_CTS_EVENT 4 + + +/* ----------------------------------------------------------- */ +/* HAL BT UART interface function error codes/return values */ +/* ----------------------------------------------------------- */ +#define HAL_BT_UART_ERR_UNSUPPORTED_PORT 2 +#define HAL_BT_UART_ERR_UNSUPPORTED_OPERATION 3 +#define HAL_BT_UART_ERR_UNSUPPORTED_PARAMETER 5 + +/* --------------------------------------------------------------------------- + * + * TYPES + * + */ + +typedef void (*HAL_BT_UART_EVENT_HANDLER)(void); +typedef uint8 HAL_BT_UART_INTR_CTRL_STR; +typedef uint32 HAL_BT_UART_BAUDRATE; + +typedef struct + { + uint8 data_bit; + uint8 stop_bit; + uint8 parity; + uint8 flow_control; + } HAL_BT_UART_INIT_CTRL_STR; + +/** a pointer to a union of this type is used to pass parameters to the + * different control features of bt_hal_control function + */ +typedef union + { + HAL_BT_UART_INTR_CTRL_STR intr_control; + HAL_BT_UART_INIT_CTRL_STR init_control; + HAL_BT_UART_BAUDRATE baudrate_control; + uint8 sleep_control; + uint8 flush_control; + } HAL_BT_UART_CONTROL_STR; + +/* --------------------------------------------------------------------------- + * + * FUNCTIONAL PROTOTYPES AND MACROS + * + */ + +/** This function serves as control and configuration function */ +uint8 hal_bt_uart_control(uint8 action, HAL_BT_UART_CONTROL_STR* control_str); + +/** Register an event handler for one of the possible interrupts */ +void hal_bt_uart_register_event(uint8 event_type, HAL_BT_UART_EVENT_HANDLER event_cb_hdl, uint16 trigger_level); + +/** access input/output pins */ +uint8 hal_bt_uart_port_access(uint8 port, uint8 action, uint8 pin_set, uint8* port_status); + +/** Starts data transmission */ +void hal_bt_uart_send(uint8* tx_data, uint16 num_bytes); + +/** Prepare reception of one message */ +uint8 hal_bt_uart_rx_buffer_set(uint8* rx_buf, uint16 length); + +/** Given a theoretical baudrate to be used return a real baudrate that will be used on UART */ +uint32 hal_bt_uart_phy_baudrate_get(uint32 baudrate); + +#endif /* BT_CHIPSET_API_H */ +/* End of Include File */ diff -r 000000000000 -r bb4b476bbb96 Boot Reason/boot_reason_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Boot Reason/boot_reason_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,123 @@ +/* + boot_reason_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @file +@brief Boot Reason API H file + +A header file for Boot Reason API. + +@publishedDeviceAbstraction +*/ + +#ifndef __BOOT_REASON_API_H__ +#define __BOOT_REASON_API_H__ + +// Include files +#include + +// Constants + +// Macros + +// Data types + +// Function prototypes + +// Forward declarations + +// Class declaration + +/** +@brief TBootReason class + +Execution: Synchronous +Re-entrant: No +Blocking: No +Panic mode: Kern::Fault +Memory allocation: No +Execution time: Quick +SMP safe: Yes + +@lib boot_reason_api.lib +*/ +class TBootReason + { + public: + enum TStartupMode + { + EStartupModeNone = 0, + EStartupModeNormal, + EStartupModeCharging, + EStartupModeAlarm, + EStartupModeTest, + EStartupModeFota + }; + + /** + This function is used to read startup mode. + + @param aStartupMode On return contains one of the enumerated values. + + @return None. + */ + IMPORT_C static void GetStartupMode( TStartupMode& aStartupMode ); + + /** + This function is used to write target startup mode. + + @param aTargetStartupMode Target startup mode. + + @return None. + */ + IMPORT_C static void SetTargetStartupMode( TStartupMode aTargetStartupMode ); + + /** + This function is used to read target startup mode. + + @param aTargetStartupMode On return contains one of the enumerated values. + + @return None. + */ + IMPORT_C static void GetTargetStartupMode( TStartupMode& aTargetStartupMode ); + + /** + This function is used to read a hidden reset status. + + This query should return ETrue if the system startup is caused by a SW reset + (e.g. a critical SW failure). + This query should return EFalse if the system startup is initiated by any + other means (e.g. power key press or a wakeup alarm). + + @param None. + + @return ETrue / EFalse. + + */ + IMPORT_C static TBool IsHiddenReset(); + + /** + This function is used to write sleep test timeout value. + + @param aResetReasons Sleep test timeout value in milliseconds. The value + must not be equal to zero. + + @return None. + */ + IMPORT_C static void SetSleepTest( TUint16 aTimeout ); + }; + +#endif // __BOOT_REASON_API_H__ diff -r 000000000000 -r bb4b476bbb96 CPS Kernel/CpsKernelIf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CPS Kernel/CpsKernelIf.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,283 @@ +/* + CpsKernelIf.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +#ifndef __CPSKERNELIF_H__ +#define __CPSKERNELIF_H__ + +// - Includes ------------------------ + +// - Namespace ----------------------- + +// - Macros -------------------------- + +// - Constants ----------------------- + +// - External data ------------------- + +// - Forward declarations ------------ + +class DCpsLddFactory; +class TCpsCallback; + +// - Data types ---------------------- + +// - Class declarations -------------- + +/** + * CPS interface for kernel side clients + */ +class DCpsKernelIf : public DBase + { +public: + /** + * Returns data stored into record (synchronous). + * + * @param aGroup The group ID which is accessed. + * @param aIndex The index ID which is accessed. + * @param aLength The size of data to be read from the beginning of record. + * @param aDataBuffer The pointer to data buffer that contains read data. + * + * @return KErrNone or standard error code + */ + IMPORT_C static TInt ReadRecord( TUint16 aGroup, TUint16 aIndex, TUint32 aLength, TDes8& aDataBuffer ); + + /** + * Returns data stored into record (asynchronous). + * + * @param aCb The pointer to a CPS callback object. + * @param aGroup The group ID which is accessed. + * @param aIndex The index ID which is accessed. + * @param aLength The size of data to be read from the beginning of record. + * @param aDataBuffer The pointer to data buffer that contains read data. + */ + IMPORT_C static void ReadRecord( TCpsCallback* aCb, TUint16 aGroup, TUint16 aIndex, TUint32 aLength, TDes8& aDataBuffer ); + + /** + * Used to store data into record (synchronous). + * + * @param aGroup The group ID which is accessed. + * @param aIndex The index ID which is accessed. + * @param aLength The size of data to be written into record. + * @param aDataBuffer The pointer to data buffer that contains data. + * + * @return KErrNone or standard error code + */ + IMPORT_C static TInt WriteRecord( TUint16 aGroup, TUint16 aIndex, TUint32 aLength, const TDesC8& aDataBuffer ); + + /** + * Used to store data into record (asynchronous). + * + * @param aCb The pointer to a CPS callback object. + * @param aGroup The group ID which is accessed. + * @param aIndex The index ID which is accessed. + * @param aLength The size of data to be written into record. + * @param aDataBuffer The pointer to data buffer that contains data. + */ + IMPORT_C static void WriteRecord( TCpsCallback* aCb, TUint16 aGroup, TUint16 aIndex, TUint32 aLength, const TDesC8& aDataBuffer ); + + /** + * Used to remove existing record (synchronous). + * + * @param aGroup The group ID which is accessed. + * @param aIndex The index ID which is accessed. + * + * @return KErrNone or standard error code + */ + IMPORT_C static TInt RemoveRecord( TUint16 aGroup, TUint16 aIndex ); + + /** + * Used to remove existing record (asynchronous). + * + * @param aCb The pointer to a CPS callback object. + * @param aGroup The group ID which is accessed. + * @param aIndex The index ID which is accessed. + */ + IMPORT_C static void RemoveRecord( TCpsCallback* aCb, TUint16 aGroup, TUint16 aIndex ); + + /** + * Used to remove all existing records from given group (synchronous). + * + * @param aGroup The group ID which is accessed. + * + * @return KErrNone or standard error code + */ + IMPORT_C static TInt RemoveAllRecords( TUint16 aGroup ); + + /** + * Used to remove all existing records from given group (asynchronous). + * + * @param aCb The pointer to a CPS callback object. + * @param aGroup The group ID which is accessed. + */ + IMPORT_C static void RemoveAllRecords( TCpsCallback* aCb, TUint16 aGroup ); + + /** + * Used to query size of existing record (synchronous). + * + * @param aGroup The group ID which is accessed. + * @param aIndex The index ID which is accessed. + * @param aSize CPS stores record size to this parameter. + * + * @return KErrNone or standard error code + */ + IMPORT_C static TInt RecordSizeGet( TUint16 aGroup, TUint16 aIndex, TUint32& aSize ); + + /** + * Used to query amount of memory used by given group (synchronous). + * + * @param aGroup The group ID which is accessed. + * @param aSize CPS stores amount of used memory by aGroup to this parameter. + * + * @return KErrNone or standard error code + */ + IMPORT_C static TInt GroupSizeGet( TUint16 aGroup, TUint32& aSize ); + + /** + * Used to amount of available memory for given group (synchronous). + * + * @param aGroup The group ID which is accessed. + * @param aSize CPS stores amount of available memory to this parameter. + * + * @return KErrNone or standard error code + */ + IMPORT_C static TInt AvailableSizeGet( TUint16 aGroup, TUint32& aSize ); + + /** + * Cancels ongoing client request. + * + * @note Client's callback is called with KErrCancel status if request is removed successfully from the operation queue + * + * @param aCb The pointer to a CPS callback object. + */ + IMPORT_C static void CancelRequest( TCpsCallback* aCb ); + + /** + * CPS factory calls this to create kernel IF + * + * @note For CPS internal use only + * + * @param aFactoryObj Factory object + */ + static void CreateKernelInstance( DCpsLddFactory* aFactoryObj ); + + /** + * CPS factory calls this to delete kernel IF + * + * @note For CPS internal use only + */ + static void DeleteKernelInstance(); + +private: + + /** + * Used to query size of existing record (asynchronous). + * + * @param aCb The pointer to a CPS callback object. + * @param aGroup The group ID which is accessed. + * @param aIndex The index ID which is accessed. + * @param aSize CPS stores record size to this parameter. + */ + static void RecordSizeGet( TCpsCallback* aCb, TUint16 aGroup, TUint16 aIndex, TUint32& aSize ); + + /** + * Used to query amount of memory used by given group (asynchronous). + * + * @param aCb The pointer to a CPS callback object. + * @param aGroup The group ID which is accessed. + * @param aSize CPS stores amount of used memory by aGroup to this parameter. + */ + static void GroupSizeGet( TCpsCallback* aCb, TUint16 aGroup, TUint32& aSize ); + + /** + * Used to amount of available memory for given group. + * + * @param aCb The pointer to a CPS callback object. + * @param aGroup The group ID which is accessed. + * @param aSize CPS stores amount of available memory to this parameter. + */ + static void AvailableSizeGet( TCpsCallback* aCb, TUint16 aGroup, TUint32& aSize ); + + /** + * Callback function for synchronous CPS kernel operation. + * + * @ param aStatus KErrNone or standard error code + * @ aArg Argument for callback + */ + static void SyncOperationReady( TInt aStatus, TAny* aArg ); + +private: + /** + * Constructor + */ + DCpsKernelIf(); + + /** + * Destructor + */ + ~DCpsKernelIf(); + +private: + /** Kernel IF object */ + static DCpsKernelIf* iKernelIf; + + /** Factory object */ + static DCpsLddFactory* iFactory; + + /** Callback for synchronous operations */ + TCpsCallback* iSyncCb; + + /** Semaphore for locking the synchronous interface */ + DSemaphore *iSyncLock; + + /** Synchronous operation result */ + TInt iSyncOpResult; + }; + + +/** + * CPS asynchronous callback function + */ +typedef void (*TCpsCbFn)( TInt aResult, TAny* aParam ); + +/** + * CPS asynchronous callback DFC + * The client must create one of these to be passed to each asynchronous call to kernel interface + * The callback function is called in the context supplied by the client when creating an object of this kind (aQue) + * The callback function takes as arguments the pin id and the state, so it can be common to all TGpioCallback + */ +class TCpsCallback : public TDfc + { +public: + inline TCpsCallback( TCpsCbFn aFn, TAny* aPtr, TDfcQue* aQue, TInt aPriority ) + : TDfc( DfcFunc, this, aQue, aPriority ), iParam( aPtr ), iCallback( aFn ) + {} +private: + inline static void DfcFunc( TAny* aPtr ) + { + TCpsCallback* pCb = (TCpsCallback*)aPtr; + //Warning -- Possible use of null pointer + //lint -e613 + pCb->iCallback( pCb->iResult, pCb->iParam ); + } +public: + TInt iResult; + TAny* iParam; + TCpsCbFn iCallback; + }; + +#endif /* __CPSKERNELIF_H__ */ + diff -r 000000000000 -r bb4b476bbb96 Display Updater/display_updater.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Display Updater/display_updater.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,533 @@ +/* + display_updater.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + + +/** + + @mainpage + @section intro_sec Introduction + +

This is adaptation component which hides hw-drivers from users. + Because this is adaptation API, and user is also adaptation, this + API is not binary compatible, only source compatible. + + Following tags definities the category where method/member/enum causes: + [@Update] Display updating + [@Rotate] Display rotation + [@Overlay] Display Hw made overlay/composition + [@Variation] Dynamic variation of display Hw +

+ +*/ +/** @file + +API for updating and controlling display. + +*/ + + +#ifndef __DISPLAY_UPDATER_H__ +#define __DISPLAY_UPDATER_H__ + + +//- Include Files ---------------------------------------------------------- + +#ifndef __KERNEL_MODE__ + #include +#else + #include +#endif //__KERNEL_MODE__ + +//- Enumerations and consts ------------------------------------------------- + +//API version number +// 3: ARGB4444 +// 2: Pre-multiplied alpha modes +// 1: First version +const TUint KDisplayUpdaterApiVersion = 3; + +/** Display rotation */ +enum TDispRotation + { + EInvalidDeg = 0x0000, /**< Initialisation value, don't use */ + ERotate0Deg = ( 1 << 0 ),/**< No rotation */ + ERotate90Deg = ( 1 << 1 ),/**< 90 degree */ + ERotate180Deg = ( 1 << 2 ),/**< 180 degree */ + ERotate270Deg = ( 1 << 3 ),/**< 270 degree */ + }; + +/** Color formats */ +const TUint32 KDispLittleEndian = 0x0; +const TUint32 KDispBigEndian = 0x1; +enum TDisplayPixelFormats + { + EPixelFormatInvalid = 0, /**< Initialisation value, don't use */ + EPixelFormatXRgb8888Le = ( 1 << 1 ) | KDispLittleEndian, /**< = EColor16MU */ + EPixelFormatXRgb8888Be = ( 1 << 1 ) | KDispBigEndian, + EPixelFormatARgb8888Le = ( 1 << 2 ) | KDispLittleEndian, /**< = EColor16MA */ + EPixelFormatARgb8888Be = ( 1 << 2 ) | KDispBigEndian, + EPixelFormatARgb8888LeP = ( 1 << 3 ) | KDispLittleEndian, /**< = EColor16MAP, Pre-multiplied */ + EPixelFormatARgb8888BeP = ( 1 << 3 ) | KDispBigEndian, + EPixelFormatRgb888Le = ( 1 << 4 ) | KDispLittleEndian, + EPixelFormatRgb888Be = ( 1 << 4 ) | KDispBigEndian, + EPixelFormatRgb565Le = ( 1 << 5 ) | KDispLittleEndian, /**< = EColor64K */ + EPixelFormatRgb565Be = ( 1 << 5 ) | KDispBigEndian, + EPixelFormatARgb1555Le = ( 1 << 6 ) | KDispLittleEndian, + EPixelFormatARgb1555Be = ( 1 << 6 ) | KDispBigEndian, + EPixelFormatARgb1555LeP = ( 1 << 7 ) | KDispLittleEndian, /**< Pre-multiplied */ + EPixelFormatARgb1555BeP = ( 1 << 7 ) | KDispBigEndian, + EPixelFormatARgb4444Le = ( 1 << 8 ) | KDispLittleEndian, + EPixelFormatARgb4444Be = ( 1 << 8 ) | KDispBigEndian, + EPixelFormatARgb4444LeP = ( 1 << 9 ) | KDispLittleEndian, /**< Pre-multiplied */ + EPixelFormatARgb4444BeP = ( 1 << 9 ) | KDispBigEndian, + EPixelFormatYCbCr422Le = ( 1 << 10 ) | KDispLittleEndian, /** 422 is assumed to be interleaved (as pixel pairs) */ + EPixelFormatYCbCr422Be = ( 1 << 10 ) | KDispBigEndian, + EPixelFormatYCbCr420Le = ( 1 << 11 ) | KDispLittleEndian, /** 420 is assumed to be planar */ + EPixelFormatYCbCr420Be = ( 1 << 11 ) | KDispBigEndian, + EPixelFormatPlatform = ( 1 << 12 ), /**< Non standard, platform specific format */ + }; + +/** YCbCr standard bit mask */ +enum TDisplayYCbCrBitMask + { + EYCbCrBitMaskInvalid = 0x0000, /**< Can be set when RGB */ + EYCbCrBitMaskFullRange = ( 1 << 0 ),/**< Full range 0-255 */ + EYCbCrBitMaskLimitedRange = ( 1 << 1 ),/**< Limited range 16-235 */ + }; + +/** Colorspace */ +enum TDisplayColorSpace + { + EColorSpaceNone = 0x0000, /**< Initialisation value, don't use */ + EColorSpaceSRgb = ( 1 << 0 ), /**< sRGB */ + EColorSpaceLinear = ( 1 << 1 ), /**< Linear color space */ + EColorSpaceFixedDisplayLinear = ( 1 << 2 ), /**< Fixed display color space - Buffer pixels are linearised RGB for Fixed colorspace */ + EColorSpaceFixedDisplay = ( 1 << 3 ), /**< Fixed display color space, one fixed colorspace, case-by-case */ + EColorSpaceColorCoordinates = ( 1 << 4 ), /**< Free color coordinates definition. @see TColorCoordinates */ + }; + +/** Advanced feature bit masks - Used for capability query */ +enum TDisplayFeatures + { + EFeatureNone = 0x0000, /**< Initialisation value */ + EFeatureScaling = ( 1 << 0 ), /**< Scaling */ + EFeatureRotation = ( 1 << 1 ), /**< 90, 180 or 270 rotation */ + EFeatureOverlay = ( 1 << 2 ), /**< Overlay without colorkey and alpha */ + EFeatureYCbCr = ( 1 << 3 ), /**< YCbCr support */ + EFeatureYCbCrPlanar = ( 1 << 4 ), /**< YCbCr planar */ + EFeatureAlphaBlend = ( 1 << 5 ), /**< Overlay with alpha */ + EFeatureInternalBuf = ( 1 << 6 ), /**< Internal buffers (display driver's own) */ + EFeatureExternalBuf = ( 1 << 7 ), /**< External buffers */ + }; + +/** Buffer purpose - TODO are these enough */ +enum TBufferPurpose + { + EPurposeNone = 0x0000, /**< Initialisation value, don't use */ + EPurposeUi = ( 1 << 0 ), /**< UI graphics */ + EPurposeOpenGlVg = ( 1 << 1 ), /**< OpenGl|ES or OpenVg. Game or pure graphics, not UI. */ + EPurposeVideo = ( 1 << 2 ), /**< Video playback */ + EPurposeCamera = ( 1 << 3 ), /**< Camera viewfinder */ + EPurposeImage = ( 1 << 4 ), /**< Still image */ + EPurposeCompose = ( 1 << 5 ), /**< Composition destination buffer */ + }; + +//- Structs ----------------------------------------------------------------- + +/** +[@Variation] + +CIE 1931 color space coordinates. To be defined if EColorSpaceColorCoordinates is used. +Fixed point is 10th bit. +E.g. If iRed.iY=625, it should be divided by 1024 (2^10) for getting real value 0.61035... +*/ +class TColorCoordinates + { + public: + TColorCoordinates():iRed(0,0), + iGreen(0,0), + iBlue(0,0), + iWhite(0,0) + {} + ///Red chromaticity coordinates (X,Y) + TPoint iRed; + ///Green chromaticity coordinates + TPoint iGreen; + ///Blue chromaticity coordinates + TPoint iBlue; + ///White chromaticity coordinates + TPoint iWhite; + }; + +/** +[@Update] + +Describes display buffer informations. + +One of four to be set, iLinearAddress, iPhysicalAddress, iBufferAdaptationId or iBufferRChunkHandle. +It means that if iBufferAdaptationId is only set member, adaptation to have rights and access to use +only that ID for doing update, and e.g. addresses are not needed. +*/ +class TBufferInfo + { + public: + TBufferInfo():iLinearAddress(NULL), + iPhysicalAddress(NULL), + iBufferAdaptationId(0), + iBufferRChunkHandle(0), + iStride(0), + iOffsetToY(0), + iOffsetToCb(0), + iOffsetToCr(0), + iBufferWidth(0), + iBufferHeight(0), + iBufferFormat(EPixelFormatInvalid), + iYCbCrBitMask(EYCbCrBitMaskInvalid), + iColorSpace(EColorSpaceSRgb), + iColorCoordinates() + {} + ///Linear address to begin of the pixels + TAny* iLinearAddress; + ///Physical address to begin of the pixels. If missing, physical address will be converted from iLinearAddress + TUint32 iPhysicalAddress; + ///Buffer ID for adaptation internal use + TUint32 iBufferAdaptationId; + ///RChunk handle ID for this buffer (RHandleBase::Handle()). Can be set 0 if not needed. + TInt iBufferRChunkHandle; + + ///The color buffer stride in bytes. With 420 planar, this tells one line Y-components stride. + TUint16 iStride; + + ///Offset from iLinearAddress to Y-components (needed if planar, otherwise can be set 0) + TUint32 iOffsetToY; + ///Offset from iLinearAddress to Cb-components (needed if planar, otherwise can be set 0) + TUint32 iOffsetToCb; + ///Offset from iLinearAddress to Cr-components (needed if planar, otherwise can be set 0) + TUint32 iOffsetToCr; + + ///Buffer width in pixels + TInt16 iBufferWidth; + ///Buffer height in pixels + TInt16 iBufferHeight; + + ///Pixel format + TDisplayPixelFormats iBufferFormat; + ///Full/limited range. Required if YCbCr defined in iBufferFormat + TDisplayYCbCrBitMask iYCbCrBitMask; + ///Buffer colorspace, most used is EColorSpaceSRgb + TDisplayColorSpace iColorSpace; + ///Buffer colorspace, this is used if iColorSpace = EColorSpaceColorCoordinates + TColorCoordinates iColorCoordinates; + }; + +/** +[@Update][@Overlay] + +Describes display scaling, cropping, etc. view settings +*/ +class TDisplayViewSettings + { + public: + TDisplayViewSettings():iPerLayerAlphaValue(0xFF), + iMainBackgroundColor(0x000000),//Black +#ifndef __KERNEL_MODE__ + iSourceScissor(0,0,0,0),//startCol, startRow, lastCol, lastRow + iDestinationScaledRect(0,0,0,0), +#endif //__KERNEL_MODE__ + iLayerRotation(EInvalidDeg), + iUsageHint(EPurposeNone), + iTearingFree(EFalse) + {} + public: + ///Per layer alpha if supported, 0x00-0xFF + TUint8 iPerLayerAlphaValue; + ///RGB888 background color. Farest layer in the view. Valid only when layer number 0. + TUint32 iMainBackgroundColor; +#ifndef __KERNEL_MODE__ + /** Inputcrop (viewport) from source buffer. + To be <= than iBufferWidth&iBufferHeight */ + TRect iSourceScissor; + /** This is scaled resolution to destination (to display) (extent). + Set to same with iSourceScissor if scaling is disabled. + To be <= than display panel native resolution and are given in current + global orientation resolution (SetRotation()). */ + TRect iDestinationScaledRect; +#endif //__KERNEL_MODE__ + /** Per layer orientation. This to be given compared to global orientation (SetRotation()). + If global orienation is ERotate90Deg and this has ERotate270Deg -> no rotation. + Sequence for all view operations is: + iSourceScissor->SetRotation()->iLayerRotation->iDestinationScaledRect */ + TDispRotation iLayerRotation; + ///Bit mask - Purpose of buffer + TBufferPurpose iUsageHint; + ///ETrue when tearing free needed. Remember that TE-logic increases power consumption. + TBool iTearingFree; + }; + +/** +[@Variation] + +Describes the display driver capabilities and properties +*/ +class TDisplayDrvInfo + { + public: + inline TDisplayDrvInfo():iPanelResolution(), + iPanelRefreshRateHz(0), + iNumberOfBuffers(0), + iSupportedFormats(EPixelFormatInvalid), + iPixelAspectRNumerator(1),//Square pixel by default (1/1) + iPixelAspectRDenominator(1), + iSupportedRotations(EInvalidDeg), + iSupportedPerLayerRotations(EInvalidDeg), + iRotationWorksWithTheseFeatures(EFeatureNone), + iScalingWorksWithTheseFeatures(EFeatureNone), + iScalingMinDenominator(0), + iScalingMaxNumerator(0), + iNumberOfOverlays(0), + iDestinationColorSpace(EColorSpaceNone), + iDestinationColorCoordinates(), + iGivenBufferWorksAsFrameBuffer(EFalse), + iVariableResolution(EFalse), + iOverscanToBeDrawn(EFalse), + iDisplayOn(EFalse) + {} + public: + ///Display panel resolution. Parameters will not swap when rotated. + TSize iPanelResolution; + ///Display panel twips. 0 when unknown (TV). Parameters will not swap when rotated. + TSize iPanelTwips; + ///Display panel refresh rate. E.g. if 60Hz, then this is 6000 (iPanelRefreshRateHz / 100). 29.97Hz = 2997. + TUint iPanelRefreshRateHz; + ///How many composition buffers (internal) are reserved for display. @see GetCompositionBuffer(). + TUint8 iNumberOfBuffers; + + ///Bit mask of supported pixel formats for external buffers + TDisplayPixelFormats iSupportedFormats; + ///Display pixel aspect ratio numerator (AR=iPixelAspectRNumerator/iPixelAspectRDenominator) + TUint16 iPixelAspectRNumerator; + ///Display pixel aspect ratio denominator (@see iPixelAspectRNumerator) + TUint16 iPixelAspectRDenominator; + + ///Bit mask of supported global rotations (SetRotation()) [@Rotate] + TDispRotation iSupportedRotations; + ///Bit mask of supported per layer rotations (TDisplayViewSettings::iLayerRotation) [@Rotate] + TDispRotation iSupportedPerLayerRotations; + ///Bitmask for features when display driver can do rotation [@Rotate] + TDisplayFeatures iRotationWorksWithTheseFeatures; + + ///Bitmask for features when display driver can do scaling + TDisplayFeatures iScalingWorksWithTheseFeatures; + ///Minimum scaling factor. E.g. if 1/2x is min, then this is 200 (100 / iScalingMinDenominator). 1x = 100. 0xFFFF = infinity + TUint16 iScalingMinDenominator; + ///Maximum scaling factor. E.g. if 2.5x is max, then this is 250 (iScalingMaxNumerator / 100). 1x = 100. 0xFFFF = infinity + TUint16 iScalingMaxNumerator; + + ///Value how many layers can be set to display driver (overlays). Minimum is 0, if overlays are not supported. [@Overlay] + TUint8 iNumberOfOverlays; + + /** Destination display colorspace - buffers can be delivered in these formats. Bit mask. + If EColorSpaceColorCoordinates is set, then display driver has capability to convert + input (TBufferInfo.iColorCoordinates/iColorSpace) to needed space (iDestinationColorCoordinates), + otherwise GCE has this responsibility */ + TDisplayColorSpace iDestinationColorSpace; + ///Destination display colorspace coordinates, valid if non-zeroes. + TColorCoordinates iDestinationColorCoordinates; + + ///If ETrue, given buffers works as frame buffer and display panel gets refresh from that (video display) + TBool iGivenBufferWorksAsFrameBuffer; + + ///If ETrue, display supports many resolutions and those can be set dynamically + TBool iVariableResolution; + + ///ETrue when composition should draw overscan (inc. position) to destination buffer + TBool iOverscanToBeDrawn; + + ///ETrue when display panel is ON, EFalse when OFF + TBool iDisplayOn; + }; + +///Typedef for layer order, like a z-order. 0 is farest, and bigger is more nearest. @see TDisplayDrvInfo.iNumberOfLayers [@Overlay] +typedef TUint TLayerNumber; + +//- Macros ------------------------------------------------------------------ + + +//- External Data ----------------------------------------------------------- + + +//- Variables --------------------------------------------------------------- + + +//- Forward Declarations ---------------------------------------------------- + + +//- Class Definitions ------------------------------------------------------- + +#ifndef __KERNEL_MODE__ + +/** +Adaptation API for display updating purpose +*/ +class CDisplayUpdater : public CBase + { + public: + /** [@Variation] Gets API version number. Compare this to KDisplayUpdaterApiVersion, must match. + @return KDisplayUpdaterApiVersion which is used for display driver */ + IMPORT_C static TUint ApiVersion(); + + + /** Creates object. Only one client can be registered (hold the object) for one display. + @param aDisplayNumber Which display is connected, primary display is 0 + @return new CDisplayUpdater, NULL if there is error, otherwise CDisplayUpdater */ + IMPORT_C static CDisplayUpdater* NewL(TInt aDisplayNumber); + ///Object destructor + virtual ~CDisplayUpdater(){}; + + + /** [@Variation] Returns API provided properties to parameter + @param aInfo Supported features, filled by driver */ + virtual void GetDisplayProperties(TDisplayDrvInfo& aInfo) = 0; + /** [@Variation] Listener for changing display configuration. When this listener is completed, + GetDisplayProperties and needed actions to be executed. + @see GetDisplayProperties + @see CancelConfigurationListener + @param aCompletedWhenReady Will be completed when configuration is changed. + @return KErrNone if success */ + virtual TInt ConfigurationListener(TRequestStatus& aCompletedWhenReady) = 0; + /** [@Variation] Cancels pending of ConfigurationListener. + @return KErrNone if success */ + virtual TInt CancelConfigurationListener() = 0; + + + /** [@Update] Get method for DSA UI-buffer. This is same buffer what can be fetched from HAL. + This call may allocate DSA-buffer, so to be called only when DSA-buffer is needed. + @see FreeDsaBuffer + @param aBuffer Buffer settings, filled by driver + @return KErrNone if success */ + virtual TInt GetDsaBuffer(TBufferInfo& aBuffer) = 0; + /** [@Update] This will be called when DSA buffer is not anymore needed/used by compositor. + After this call, DSA-buffer memory may be de-allocated. + @see GetDsaBuffer + @return KErrNone if success */ + virtual TInt FreeDsaBuffer() = 0; + /** [@Update] Get method for composition engine's destination buffer. + Needed if configuration has display driver allocated composition buffers. + @see TDisplayDrvInfo.iNumberOfBuffers + @see FreeCompositionBuffer + @param aBufferNumber Buffer number which to be get (first is 0, @see TDisplayDrvInfo.iNumberOfBuffers) + @param aBuffer Returned buffer info for caller + @return KErrNone if success */ + virtual TInt GetCompositionBuffer(TUint32 aBufferNumber, TBufferInfo& aBuffer) = 0; + /** [@Update] This will be called when composition buffer is not anymore needed/used by compositor, + then the display is disconnected or shut down. Used when display driver allocated composition buffers + are used. After this call, the buffer may be de-allocated. + @see GetCompositionBuffer + @param aBufferNumber Buffer number which to be freed + @return KErrNone if success */ + virtual TInt FreeCompositionBuffer(TUint32 aBufferNumber) = 0; + + + /** [@Update] If external buffers are used (display driver does not own), + those must be bound in here before use. + @param aBuffer New buffer for display driver knowledge + @return KErrNone if success */ + virtual TInt BindExternalBuffer(const TBufferInfo& aBuffer) = 0; + /** [@Update] Unbinds buffer if that is not wanted use anymore for displaying use. + Buffer should not be visible on screen when unbinding happens. + @pre Buffer is not "on screen" anymore, and display driver does not work with that. + @pre BindExternalBuffer is called for this buffer, without errors. + @param aBuffer Buffer to be removed from display driver knowledge + @return KErrNone if success */ + virtual TInt UnbindExternalBuffer(const TBufferInfo& aBuffer) = 0; + + + /** [@Update][@Overlay] Constructs view on the display. Layer parameter tells which layer is set, and layernumber + means z-order of view. 0 to be always defined before Flush. Layer 0 is on background of layer 1. + If is needed to remove e.g. layer 1, then replace default (clear) TDisplayViewSettings object. + @param aLayer Z-order where layer to be set. 0 must be always defined. [@Overlay] + @param aViewSettings This layer view information, including changed areas [@Update at least for layer 0][@Overlay] + @param aBuffer Buffer which matching to this layer settings [@Update at least for layer 0][@Overlay] + @return KErrNone if success */ + virtual TInt SetView(TLayerNumber aLayer, const TDisplayViewSettings& aViewSettings, const TBufferInfo& aBuffer) = 0; + /** [@Update] Changes TBufferInfo settings of layer. Settings will be taken use in next flush. + @param aLayer Z-order where layer to be set. 0 must be always defined. [@Overlay] + @param aLatestChangedRect Changed area rectangle. Set fullscreen if disabled. Driver can ignore these. + To be smaller than iBufferWidth&iBufferHeight, and 0,0,0,0 means full screen [@Update] + @param aBuffer New buffer which matching to this layer settings [@Update] + @return KErrNone if success */ + virtual TInt SetBuffer(TLayerNumber aLayer, const TRect& aLatestChangedRect, const TBufferInfo& aBuffer) = 0; + + + /** [@Update] Flushes current view to display. Asynchronous method. + TDisplayDrvInfo.iGivenBufferWorksAsFrameBuffer==EFalse: + TRequestStatus will be completed when display buffer is transferred to the display. + TDisplayDrvInfo.iGivenBufferWorksAsFrameBuffer==ETrue: + TRequestStatus will be completed when display buffer is starting to be visible. So when request is completed + any pixel of flush is not yet shown. And after that, given buffer works as framebuffer + until next's flush TRequestStatus will be completed. So caller should be aware of that, + to avoiding tearing (no draw to buffer if that is still work as framebuffer). + @param aCompletedWhenReady Will be completed when transfer is ready (or just begun, see above) + @return KErrNone if success + KErrInUse if SetOrientation or other settings are changing */ + virtual TInt Flush(TRequestStatus& aCompletedWhenReady) = 0; + /** [@Update] Cancels all pending Flush operations. Should not be called normally at all, correct way is to wait + that both pending Flush TRequestStatuses are completed. + @return KErrNone if success */ + virtual TInt FlushCancelAll() = 0; + + + /** [@Rotate] Changes orientation of full screen. New flushes are not welcome before TRequestStatus is completed. + Got buffers should not be under read/write while this mehtod is ongoing. + All buffers should be read (GetDsaBuffer & GetCompositionBuffer & GetDisplayProperties) again after completed and ready. + SetView to be called with valid parameters after rotation. + @param aNewOrientation New orientation + @param aCompletedWhenReady Will be completed when orientation is changed + @return KErrNone if success, KErrNotSupported if driver cannot handle orientation */ + virtual TInt SetRotation(TDispRotation aNewOrientation, TRequestStatus& aCompletedWhenReady) = 0; + /** [@Update] Changes resolution of full screen. New flushes are not welcome before TRequestStatus is completed. + To be called every time before first SetView(). + Got buffers should not be under read/write while this mehtod is ongoing. + All buffers should be read (GetDsaBuffer & GetCompositionBuffer & GetDisplayProperties) again after completed and ready. + SetView to be called with valid parameters after rotation. + @param aNewResolution New resolution in 0deg + @param aCompletedWhenReady Will be completed when resolution is changed + @return KErrNone if success + KErrNotSupported if display cannot change resolution (TDisplayDrvInfo.iVariableResolution==EFalse) + KErrArgument if display resolution is not supported (aNewResolution) */ + virtual TInt SetResolution(TSize aNewResolution, TRequestStatus& aCompletedWhenReady) = 0; + + protected: + ///Constructor + CDisplayUpdater(){}; + ///Second phase constructor + virtual void ConstructL(TInt aDisplayNumber) = 0; + }; + +#endif //__KERNEL_MODE__ + +//- Global Function Prototypes ---------------------------------------------- + + +//- Inline Functions -------------------------------------------------------- + + +#endif //__DISPLAY_UPDATER_H__ + +// End of File + + diff -r 000000000000 -r bb4b476bbb96 Display/display_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Display/display_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,1126 @@ +/* + display_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** + + @mainpage + @section intro_sec Introduction + +

This is the display chipset driver API document.

+

This API hides HW differences from display (and other users) driver. + API is not kept as binary compatible.

+

+

Multiclient: + API is purposed for multiclient use. Same chipset driver should take care + more than one client in same time. Common HW (bus) will be shared + for two clients, that way that they cannot detect sharing.

+

+

Resource managing: + Chipset driver is responsible to allocate needed power resources. Chipset driver + should deallocate resources immediately when those are not needed. Display + driver (top of chipset driver) does not need allocate any of power resources for + chipset driver.

+

+

DVFS (Dynamic Voltage and Frequency Scaling): + Chipset driver is responsible to allocate needed clock state and + listening if clock will change. It is better if display driver does not + listening (top of chipset driver) DVFS at all, for avoiding death locks.

+

+

Structs: + Always when some of any struct is created, creator is responsible to fill it + with zeroes, and should use sizeof() operator.

+

+

Identifier: + Functions where is not IDENTIFIER given, and chipset driver still need to detect + the client, it has to implement couple of methods for same function, to getting + difference using different function pointer. +

+

Image processing stages: + Image processing should happen in order (or output should look like this): + [Source image] -> [Color space conversion] -> [InputScissor] -> [Mirror] -> + [Rotate] -> [TargetArea(Scaling)] -> [Offset] -> [Blend] -> [Output]

+

+*/ +/** @file + +Declaration of display chipset driver API + +@publishedDeviceAbstraction +*/ + +#ifndef DISPLAY_CHIPSET_API_H +#define DISPLAY_CHIPSET_API_H + +/*- Include Files ----------------------------------------------------------*/ + +#include "display_chipset_os.h" /* OS specific header file, typedef etc. */ + +/*- Data Types --------------------------------------------------------------*/ + +/*- Enumerations ------------------------------------------------------------*/ + +/** Error codes */ +typedef enum + { + DISP_ERROR_NONE, /**< OK */ + DISP_ERROR_FATAL, /**< Restart needed. Fatal error. */ + DISP_ERROR_INVALID_PARAMETER, /**< Given parameter is not ok */ + DISP_ERROR_BUS_TIMEOUT, /**< Possible Hw jam */ + DISP_ERROR_INVALID_BUFFER_FORMAT, /**< Unknown buffer format */ + DISP_ERROR_BUFFER_FORMAT_MISMATCH, /**< when target device has different format than the input hal_buffer and Hw is not capable to perform conversion */ + DISP_ERROR_OUT_OF_MEMORY, /**< Chipset driver operation is not made, because out of memory */ + DISP_ERROR_NO_DEVICE, /**< Device not found */ + DISP_ERROR_INVALID_SIZE, /**< Given size parameters are too small or too big */ + DISP_ERROR_HW_IS_BUSY, /**< Operation is not allowed, because Hw is reserved for another use */ + DISP_ERROR_USER_IS_NOT_RECOGNISED, /**< User is not detected (parameter: identifier), or initialisiation is not done */ + DISP_ERROR_CANNOT_CLONE, /**< If clone combination is impossible. @see dispCloneOutput() */ + DISP_ERROR_NOT_SUPPORTED, /**< Given operation is not supported by Hw */ + DISP_ERROR_NOT_IMPLEMENTED, /**< Given operation is not supported by Sw */ + DISP_ERROR_INVALID_NAME, /**< Invalid name */ + DISP_ERROR_ALREADY_EXISTS, /**< E.g.: Set twice */ + DISP_ERROR_NOT_FOUND, /**< Something missing */ + DISP_ERROR_ALIGNMENT, /**< Data alignment error */ + DISP_ERROR_NOT_READY, /**< Device is not ready for operation */ + DISP_ERROR_CANCELLED, /**< Operation cancelled */ + DISP_ERROR_NO_CLOCK, /**< Bad clock signal */ + DISP_ERROR_BLUE, /**< Blue color error */ + DISP_ERROR_GREEN, /**< Green color error */ + DISP_ERROR_RED, /**< Red color error */ + DISP_ERROR_NOT_IDENTIFIED, /**< Cannot identify HW */ + DISP_ERROR_TE_MISSED, /**< Tearing Effect line is not detected */ + DISP_ERROR_RESET, /**< Reset line error */ + DISP_ERROR_DATA_LINES, /**< Data lines error */ + DISP_ERROR_AUDIO, /**< HDMI audio error */ + DISP_ERROR_CEC, /**< CEC error */ + DISP_ERROR_DDC, /**< DDC error */ + DISP_ERROR_HPD, /**< Hot Plug Detection */ + DISP_ERROR_NO_POWER, /**< Not powered */ + DISP_ERROR_NACK, /**< Not acknowledged */ + DISP_ERROR_CRC, /**< CRC error */ + } DISPE_ERROR; + +/** Rotation and flipping */ +typedef enum + { + DISP_ROTATION_INVALID = 0x0000, /**< Initialisation value, don't use */ + DISP_ROTATION_0 = ( 1 << 0 ),/**< No rotation */ + DISP_ROTATION_90 = ( 1 << 1 ),/**< 90 degree */ + DISP_ROTATION_180 = ( 1 << 2 ),/**< 180 degree */ + DISP_ROTATION_270 = ( 1 << 3 ),/**< 270 degree */ + DISP_ROTATION_MIRROR_VERTICAL = ( 1 << 4 ),/**< Upside down/flip */ + DISP_ROTATION_MIRROR_HORIZONTAL = ( 1 << 5 ),/**< Mirrored */ + } DISPE_ROTATION; + +/** Color format */ +const uint32 KLittleEndian = 0x0; +const uint32 KBigEndian = 0x1; +typedef enum + { + DISP_COLOR_FORMAT_INVALID = 0, /**< Initialisation value, don't use */ + DISP_COLOR_FORMAT_XRGB8888_LE = ( 1 << 1 ) | KLittleEndian, + DISP_COLOR_FORMAT_XRGB8888_BE = ( 1 << 1 ) | KBigEndian, + DISP_COLOR_FORMAT_ARGB8888_LE = ( 1 << 2 ) | KLittleEndian, + DISP_COLOR_FORMAT_ARGB8888_BE = ( 1 << 2 ) | KBigEndian, + DISP_COLOR_FORMAT_ARGB8888P_LE = ( 1 << 3 ) | KLittleEndian, /** Pre-multiplied */ + DISP_COLOR_FORMAT_ARGB8888P_BE = ( 1 << 3 ) | KBigEndian, + DISP_COLOR_FORMAT_RGB888_LE = ( 1 << 4 ) | KLittleEndian, + DISP_COLOR_FORMAT_RGB888_BE = ( 1 << 4 ) | KBigEndian, + DISP_COLOR_FORMAT_RGB565_LE = ( 1 << 5 ) | KLittleEndian, + DISP_COLOR_FORMAT_RGB565_BE = ( 1 << 5 ) | KBigEndian, + DISP_COLOR_FORMAT_ARGB1555_LE = ( 1 << 6 ) | KLittleEndian, + DISP_COLOR_FORMAT_ARGB1555_BE = ( 1 << 6 ) | KBigEndian, + DISP_COLOR_FORMAT_ARGB1555P_LE = ( 1 << 7 ) | KLittleEndian, /** Pre-multiplied */ + DISP_COLOR_FORMAT_ARGB1555P_BE = ( 1 << 7 ) | KBigEndian, + DISP_COLOR_FORMAT_ARGB4444_LE = ( 1 << 8 ) | KLittleEndian, + DISP_COLOR_FORMAT_ARGB4444_BE = ( 1 << 8 ) | KBigEndian, + DISP_COLOR_FORMAT_ARGB4444P_LE = ( 1 << 9 ) | KLittleEndian, /** Pre-multiplied */ + DISP_COLOR_FORMAT_ARGB4444P_BE = ( 1 << 9 ) | KBigEndian, + DISP_COLOR_FORMAT_YCBCR422_LE = ( 1 << 10 ) | KLittleEndian, + DISP_COLOR_FORMAT_YCBCR422_BE = ( 1 << 10 ) | KBigEndian, + DISP_COLOR_FORMAT_YCBCR420_LE = ( 1 << 11 ) | KLittleEndian, + DISP_COLOR_FORMAT_YCBCR420_BE = ( 1 << 11 ) | KBigEndian, + DISP_COLOR_FORMAT_PLATFORM = ( 1 << 12 ), /**< Non standard, platform specific format */ + } DISPE_COLOR_FORMAT; + +/** YCbCr standard bit mask */ +typedef enum + { + DISP_COLOR_FORMAT_YCBCR_INVALID = 0x0000, /**< Can be set when RGB */ + DISP_COLOR_FORMAT_FULL_RANGE = ( 1 << 0 ),/**< Full range 0-255 */ + DISP_COLOR_FORMAT_LIMITED_RANGE = ( 1 << 1 ),/**< Limited range 16-235 */ + } DISPE_COLOR_YCBCR_BIT_MASK; + +/** Colorspace - API supports one case-by-case fixed conversion matrix (FIXED) for one most used conversion */ +typedef enum + { + DISP_COLOR_SPACE_NONE = 0x0000, /**< Initialisation value, don't use */ + DISP_COLOR_SPACE_LINEAR_RGB = ( 1 << 0 ), /**< Linear color space */ + DISP_COLOR_SPACE_STANDARD_RGB = ( 1 << 1 ), /**< sRGB, Red[0.6400, 0.3300] Green[0.3000, 0.6000] Blue[0.1500, 0.0600] White[0.3127,0.3290] */ + DISP_COLOR_FIXED_DISPLAY_CS_LINEAR = ( 1 << 2 ), /**< Fixed display color space - Buffer pixels are linearised RGB for FIXED */ + DISP_COLOR_FIXED_DISPLAY_CS = ( 1 << 3 ), /**< Fixed display color space */ + DISP_COLOR_COORDINATES = ( 1 << 4 ), /**< With this, Chipset driver does the conversion, according to input and output coordinates */ + DISP_COLOR_MATRIX_CONV = ( 1 << 5 ), /**< Free 3x3 matrix conversion. @see DISPS_COLOR_SPACE_CONV_MATRIX */ + } DISPE_COLOR_SPACE; + +/** Scaling */ +typedef enum + { + DISP_SCALING_NO = 0x0000, /**< No HW support for scaling */ + DISP_SCALING_NEAREST_NEIGHBOUR = ( 1 << 0 ),/**< Style: Plain pixel copy */ + DISP_SCALING_BILINEAR_OR_BEST = ( 1 << 1 ),/**< Style: Bilinear or better*/ + } DISPE_SCALING; + +/** Display Interface Types */ +const uint32 KMeSSIBus = 0x1; /**< MIPI DBI-2 type B */ +const uint32 KLoSSIBus = 0x2; /**< MIPI DBI-2 type C option 1 */ +const uint32 KViSSIBus = 0x3; /**< MIPI DPI-2 */ +const uint32 KCDPBus = 0x4; /**< CDP (HiSSI-V)=No corresponding MIPI standard. LoSSI works as control bus. */ +const uint32 KDSIVideoBus = 0x5; /**< DSI (HiSSI-M)=MIPI DSI1.1, Videobus */ +const uint32 KDSICmdBus = 0x6; /**< DSI (HiSSI-M)=MIPI DSI1.1, Commandbus */ +const uint32 KOffscreenDisplay = 0x7; /**< Offscreen display, for possible USB, WLAN, etc. purpose */ +const uint32 KCvbsBus = 0x8; +const uint32 KHdmiBus = 0x9; +const uint32 KDdcBus = 0xA; +const uint32 KCecBus = 0xB; + +const uint32 KInterfaceNumberShift = 5; +typedef enum + { + DISP_BUS_NONE = 0, /**< Initialisation value */ + + DISP_BUS_MESSI0 = ( 0 << KInterfaceNumberShift ) | KMeSSIBus, /**< MeSSI bus ID:0 */ + DISP_BUS_MESSI1 = ( 1 << KInterfaceNumberShift ) | KMeSSIBus, + DISP_BUS_MESSI2 = ( 2 << KInterfaceNumberShift ) | KMeSSIBus, + DISP_BUS_MESSI3 = ( 3 << KInterfaceNumberShift ) | KMeSSIBus, + DISP_BUS_MESSI4 = ( 4 << KInterfaceNumberShift ) | KMeSSIBus, + + DISP_BUS_LOSSI0 = ( 0 << KInterfaceNumberShift ) | KLoSSIBus, /**< LoSSI bus ID:0 */ + DISP_BUS_LOSSI1 = ( 1 << KInterfaceNumberShift ) | KLoSSIBus, + DISP_BUS_LOSSI2 = ( 2 << KInterfaceNumberShift ) | KLoSSIBus, + DISP_BUS_LOSSI3 = ( 3 << KInterfaceNumberShift ) | KLoSSIBus, + DISP_BUS_LOSSI4 = ( 4 << KInterfaceNumberShift ) | KLoSSIBus, + + DISP_BUS_VISSI0 = ( 0 << KInterfaceNumberShift ) | KViSSIBus, /**< ViSSI ID:0 */ + DISP_BUS_VISSI1 = ( 1 << KInterfaceNumberShift ) | KViSSIBus, + DISP_BUS_VISSI2 = ( 2 << KInterfaceNumberShift ) | KViSSIBus, + DISP_BUS_VISSI3 = ( 3 << KInterfaceNumberShift ) | KViSSIBus, + DISP_BUS_VISSI4 = ( 4 << KInterfaceNumberShift ) | KViSSIBus, + + DISP_BUS_CDP0 = ( 0 << KInterfaceNumberShift ) | KCDPBus, /**< CDP ID:0 */ + DISP_BUS_CDP1 = ( 1 << KInterfaceNumberShift ) | KCDPBus, + DISP_BUS_CDP2 = ( 2 << KInterfaceNumberShift ) | KCDPBus, + DISP_BUS_CDP3 = ( 3 << KInterfaceNumberShift ) | KCDPBus, + DISP_BUS_CDP4 = ( 4 << KInterfaceNumberShift ) | KCDPBus, + + DISP_BUS_DSIV0 = ( 0 << KInterfaceNumberShift ) | KDSIVideoBus, /**< HiSSI-M ID:0. ID maps to Virtual Channel */ + DISP_BUS_DSIV1 = ( 1 << KInterfaceNumberShift ) | KDSIVideoBus, + DISP_BUS_DSIV2 = ( 2 << KInterfaceNumberShift ) | KDSIVideoBus, + DISP_BUS_DSIV3 = ( 3 << KInterfaceNumberShift ) | KDSIVideoBus, + DISP_BUS_DSIV4 = ( 4 << KInterfaceNumberShift ) | KDSIVideoBus, /**< ID:0 in second physical layer */ + DISP_BUS_DSIV5 = ( 5 << KInterfaceNumberShift ) | KDSIVideoBus, + DISP_BUS_DSIV6 = ( 6 << KInterfaceNumberShift ) | KDSIVideoBus, + DISP_BUS_DSIV7 = ( 7 << KInterfaceNumberShift ) | KDSIVideoBus, + DISP_BUS_DSIV8 = ( 8 << KInterfaceNumberShift ) | KDSIVideoBus, /**< ID:0 in third physical layer */ + DISP_BUS_DSIV9 = ( 9 << KInterfaceNumberShift ) | KDSIVideoBus, + DISP_BUS_DSIV10 = ( 10 << KInterfaceNumberShift ) | KDSIVideoBus, + DISP_BUS_DSIV11 = ( 11 << KInterfaceNumberShift ) | KDSIVideoBus, + + DISP_BUS_DSIC0 = ( 0 << KInterfaceNumberShift ) | KDSICmdBus, /**< HiSSI-M ID:0. ID maps to Virtual Channel */ + DISP_BUS_DSIC1 = ( 1 << KInterfaceNumberShift ) | KDSICmdBus, + DISP_BUS_DSIC2 = ( 2 << KInterfaceNumberShift ) | KDSICmdBus, + DISP_BUS_DSIC3 = ( 3 << KInterfaceNumberShift ) | KDSICmdBus, + DISP_BUS_DSIC4 = ( 4 << KInterfaceNumberShift ) | KDSICmdBus, /**< ID:0 in second physical layer */ + DISP_BUS_DSIC5 = ( 5 << KInterfaceNumberShift ) | KDSICmdBus, + DISP_BUS_DSIC6 = ( 6 << KInterfaceNumberShift ) | KDSICmdBus, + DISP_BUS_DSIC7 = ( 7 << KInterfaceNumberShift ) | KDSICmdBus, + DISP_BUS_DSIC8 = ( 8 << KInterfaceNumberShift ) | KDSICmdBus, /**< ID:0 in third physical layer */ + DISP_BUS_DSIC9 = ( 9 << KInterfaceNumberShift ) | KDSICmdBus, + DISP_BUS_DSIC10 = ( 10 << KInterfaceNumberShift ) | KDSICmdBus, + DISP_BUS_DSIC11 = ( 11 << KInterfaceNumberShift ) | KDSICmdBus, + + DISP_BUS_OFFSCR = KOffscreenDisplay, /**< Offscreen display */ + + DISP_BUS_CVBS = KCvbsBus, /**< Composite Tv-out */ + DISP_BUS_HDMI = KHdmiBus, /**< Hdmi Tv-out */ + DISP_BUS_DDC = KDdcBus, /**< DDC bus (HDMI and DVI) */ + DISP_BUS_CEC = KCecBus, /**< CEC bus (HDMI) */ + } DISPE_BUS; + +/** Transfer mode */ +typedef enum + { + DISP_BUS_0BIT = 0x0000, /**< Initialisation value, don't use */ + DISP_BUS_1BIT = ( 1 << 0 ),/**< 1bit width bus, bidirectional LoSSI */ + DISP_BUS_2BIT = ( 1 << 1 ),/**< LoSSI with separate read and write signals */ + DISP_BUS_3BIT = ( 1 << 2 ),/**< E.g. DSI 3 lanes */ + DISP_BUS_4BIT = ( 1 << 3 ),/**< E.g. DSI 4 lanes */ + DISP_BUS_8BIT = ( 1 << 4 ),/**< E.g. MeSSI-8 */ + DISP_BUS_12BIT = ( 1 << 5 ), + DISP_BUS_16BIT = ( 1 << 6 ), + DISP_BUS_18BIT = ( 1 << 7 ), + DISP_BUS_24BIT = ( 1 << 8 ), + DISP_BUS_32BIT = ( 1 << 9 ), + } DISPE_BUS_WIDTH; + +/** Power control */ +typedef enum + { + DISP_PWR_MODE_INVALID = 0x0000, /**< Initialisation value, don't use */ + DISP_PWR_MODE_ANALOG_POWER_ON = 0x0011, /**< External analogue voltages */ + DISP_PWR_MODE_ANALOG_POWER_OFF = 0x0010, + DISP_PWR_MODE_DIGITAL_POWER_ON = 0x0021, /**< External digital voltages */ + DISP_PWR_MODE_DIGITAL_POWER_OFF = 0x0020, + DISP_PWR_MODE_RESET_ACTIVE = 0x0041, /**< Activate external reset signal. With DSI, RAR will be listened. */ + DISP_PWR_MODE_RESET_INACTIVE = 0x0040, + DISP_PWR_MODE_DISPLAY_ON = 0x0081, /**< Pixel clock for memoryless displays (ViSSI/HiSSI). LP/HS when DSI. */ + DISP_PWR_MODE_DISPLAY_OFF = 0x0080, /**< Ultra Low Power State (ULPS) mode when DSI */ + } DISPE_PWR_MODE; + +/** Driver messages - @see dispDriverMessage */ +typedef enum + { + DISP_MSG_PING = 0x00000000, /**< Ping for all drivers. All drivers forwards this msg and + gives callback. Doesn't matter what is the 'receiver'-parameter. */ + DISP_MSG_SELFTEST = 0x00000001, /**< Selftest */ + DISP_MSG_PRODTEST = 0x00000002, /**< Production test */ + DISP_MSG_LAST = 0xFFFFFFFF, /**< Not in use */ + } DISPE_DRV_MSG; + +/** Colorkey handling */ +typedef enum + { + DISP_COLORKEYMODE_NONE = 0x0000, /**< No colorkey */ + DISP_COLORKEYMODE_SINGLE_KEY = ( 1 << 0 ), /**< One color is colorkey (simplest) */ + DISP_COLORKEYMODE_KEY_MASK = ( 1 << 1 ), /**< Colorkey mask. If (pixel_color & mask) -> transparent pixel */ + DISP_COLORKEYMODE_ALPHA = ( 1 << 2 ), /**< To utilize alphachannel of source buffer for transparency, + works with followings as ARGB : DISP_COLOR_FORMAT_ARGB8888, DISP_COLOR_FORMAT_ARGB1555 */ + } DISPE_COLORKEYMODE; + +/** Tearing synchronisation type */ +typedef enum + { + DISP_TE_SYNC_NO = 0x0000, /**< No HW support for tearing synchronization */ + DISP_TE_SYNC_VS_RAISING_EDGE = ( 1 << 0 ),/**< Vertical synchronization when raising edge */ + DISP_TE_SYNC_VS_FALLING_EDGE = ( 1 << 1 ),/**< Vertical synchronization when falling edge */ + DISP_TE_SYNC_HS_VS = ( 1 << 2 ),/**< Horisontal and vertical tearing synchronization */ + DISP_TE_SYNC_VS_BUS_TRIGGER = ( 1 << 3 ),/**< In DSI mode only (TEE) */ + } DISPE_TE_SYNC; + +/** Advanced feature bit masks - Used for capability query */ +typedef enum + { + DISP_FEATURE_NONE = 0x0000, /**< Initialisation value */ + DISP_FEATURE_SCALING = ( 1 << 0 ), /**< Scaling */ + DISP_FEATURE_ALL_CASES = ( 1 << 1 ), /**< No matter what is the used feature */ + DISP_FEATURE_ROTATION = ( 1 << 2 ), /**< 90, 180 or 270 rotation */ + DISP_FEATURE_OVERLAY = ( 1 << 3 ), /**< Overlay without colorkey and alpha */ + DISP_FEATURE_COLOR_KEY = ( 1 << 4 ), /**< Overlay with colorkey */ + DISP_FEATURE_ALPHA_BLEND = ( 1 << 5 ), /**< Overlay with alpha */ + DISP_FEATURE_YCBCR = ( 1 << 6 ), /**< YCbCr support */ + } DISPE_FEATURE; + +/** Buffer's cache and MMU settings - Write buffers to be always enabled - Chipset driver is responsible to syncronise caches */ +typedef enum + { + DISP_CACHE_NOTHING = 0x0000, /**< Only writebuffers */ + DISP_CACHE_WRITE_THROUGH = ( 1 << 0 ), /**< Write through caches (writes to cache (if hit) and to memory) */ + DISP_CACHE_WRITE_ALLOCATION_L1 = ( 1 << 1 ), /**< Cache level 1 -line will be allocated for write access */ + DISP_CACHE_WRITE_ALLOCATION_L2 = ( 1 << 2 ), /**< Cache level 2 -line will be allocated for write access */ + DISP_CACHE_READ_ALLOCATION_L1 = ( 1 << 3 ), /**< Cache level 1 -line will be allocated for read access */ + DISP_CACHE_READ_ALLOCATION_L2 = ( 1 << 4 ), /**< Cache level 2 -line will be allocated for read access */ + DISP_CACHE_USER_READ_PRIVILEGE = ( 1 << 5 ), /**< User code (user mode) have read accesses to buffer */ + DISP_CACHE_USER_WRITE_PRIVILEGE = ( 1 << 6 ), /**< User code (user mode) have write accesses to buffer */ + DISP_CACHE_KERNEL_READ_PRIVILEGE = ( 1 << 7 ), /**< Kernel code (supervisor undefined mode) have read accesses to buffer */ + DISP_CACHE_KERNEL_WRITE_PRIVILEGE = ( 1 << 8 ), /**< Kernel code (supervisor undefined mode) have write accesses to buffer */ + DISP_CACHE_ARM_ACCESSIBLE = ( 1 << 9 ), /**< To be always defined if ARM can see the buffer. Otherwise can be allocated only for HW. */ + } DISPE_CACHE_SETTINGS; + +/*- Data Structs ------------------------------------------------------------*/ + +/** Color Space Converter 3x3 matrix. To be defined if DISP_COLOR_MATRIX_CONV is used. + Output conversion formula: + Red Out = (red[0] * Rin) + (red[1] * Gin) + (red[2] * Bin) + red[3] + Green Out = (green[0] * Rin) + (green[1] * Gin) + (green[2] * Bin) + green[3] + Blue Out = (blue[0] * Rin) + (blue[1] * Gin) + (blue[2] * Bin) + blue[3] */ +typedef struct + { + /** Fixed point position. E.g: value = ( red.cell1 >> fixedPoint ). E.g: fixedPoint=2 -> b0.00 */ + uint8 fixedPoint; + /** Conversion matrixes per color component */ + int16 red[ 4 ]; + int16 green[ 4 ]; + int16 blue[ 4 ]; + } DISPS_COLOR_SPACE_CONV_MATRIX; + +/** CIE 1931 color space coordinates. To be defined if DISP_COLOR_COORDINATES is used. + When chipset driver knows source and destination coordinates, it can operate + conversion from source to destination. Fixed point is 10th bit. + E.g. If redX=625, it should be divided by 1024 (2^10) for getting real value 0.61035... */ +typedef struct + { + /** Red chromaticity coordinates */ + uint16 redX; + uint16 redY; + /** Green chromaticity coordinates */ + uint16 greenX; + uint16 greenY; + /** Blue chromaticity coordinates */ + uint16 blueX; + uint16 blueY; + /** White chromaticity coordinates */ + uint16 whiteX; + uint16 whiteY; + } DISPS_COLOR_COORDINATES; + +/** Rectangle */ +typedef struct + { + /** Begin line (first line is 0) */ + uint16 startRow; + /** Begin column (first column is 0) */ + uint16 startColumn; + /** Rectangle height in pixels */ + uint16 rows; + /** Rectangle width in pixels */ + uint16 columns; + } DISPS_RECTANGLE; + +/** Source buffer dimensions and format */ +typedef struct + { + /** Local memory linear address */ + void* bufferLinearAddress; + /** Local memory physical address */ + uint32 bufferPhysicalAddress; + /** Can be zero. Required if not-local memory, then addresses can be NULL */ + uint32 bufferId; + /** Physically linear */ + bool8 physicallyLinear; + /** Cache/MMU features - bit mask */ + DISPE_CACHE_SETTINGS caches; + /** Features what to be used for this buffer - This is like usage-hint for chipset driver, and can be ignored */ + DISPE_FEATURE bufferUseCases; + + /** Offset from bufferPhysicalAddress to Y-components (needed if planar, otherwise can be set 0) */ + uint32 offsetToY; + /** Offset from bufferPhysicalAddress to Cb-components (needed if planar, otherwise can be set 0) */ + uint32 offsetToCb; + /** Offset from bufferPhysicalAddress to Cr-components (needed if planar, otherwise can be set 0) */ + uint32 offsetToCr; + + /** Source buffer pixel format */ + DISPE_COLOR_FORMAT pixelFormat; + /** Source buffer color space (normally = DISP_COLOR_SPACE_STANDARD_RGB) */ + DISPE_COLOR_SPACE sourceColorSpace; + /** Source buffer color space (free) to be defined if sourceColorSpace=DISP_COLOR_COORDINATES */ + DISPS_COLOR_COORDINATES sourceColorCoordinates; + /** Used if API user wants to use free conversion table, to be defined if sourceColorSpace=DISP_COLOR_MATRIX_CONV */ + DISPS_COLOR_SPACE_CONV_MATRIX colorSpaceConversion; + /** Required if YCbCr format used */ + DISPE_COLOR_YCBCR_BIT_MASK yCbCrBitMask; + + /** Buffer width in pixels */ + uint32 width; + /** Buffer height in pixels */ + uint32 height; + /** One line in bytes. With 420 planar, this tells one line Y-components stride. */ + uint32 stride; + } DISPS_BUFFER; + +/** Colorkey - Makes hole to layer */ +typedef struct + { + /** Only one colorkeymode can be defined */ + DISPE_COLORKEYMODE mode; + /** If DISP_COLORKEYMODE_SINGLE_KEY -> Defines transparency key when needed. Planar not supported. + If DISP_COLORKEYMODE_KEY_MASK -> if (pixel_color & colorkey) -> transparent pixel. Then colorkey defines maskColor. */ + uint32 colorkey; + } DISPS_COLORKEY; + +/** Layer - one visible layer information */ +typedef struct + { + /** True when this layer is enabled */ + bool8 enabled; + /** True if forces transfer to display. Forcing means that chipset drv logic cannot do any own decisions + (optimising/buffer changes/buffer manipulation) for the transfers. When this is true, buffer content must be + visible on display panel after transfer. Normally can be false. */ + bool8 forceView; + + /** Source buffer struct */ + DISPS_BUFFER sourceBuffer; + + /** Input crop. Max size < sourceBuffer.width & height. */ + DISPS_RECTANGLE inputScissor; + /** Target area coordinates. if source area is different size than target up/downscaling will need to be + performed by HW. Return Error if scaling requested but no HW capability. */ + DISPS_RECTANGLE targetArea; + /* If inputScissor!=targetArea sizes mismatch, then scaling method need to be defined here */ + DISPE_SCALING scalingMethod; + + /** Layer rotation information */ + DISPE_ROTATION rotate; + + /** Colorkey struct which is used in this buffer */ + DISPS_COLORKEY colorkey; + + /** Brightness value on screen, [-100,100]%, may be ignored by the driver. + If chipset driver can control only one brightness (not for each layer), + then first layer settings are used. */ + int16 brightness; + /** Contrast value on screen, [-100,100]% + If chipset driver can control only one contrast (not for each layer), + then first layer settings are used. */ + int16 contrast; + /** Gamma value on screen, e.g.: 1.00=100, 2.20=220. + If chipset driver can control only one gamma (not for each layer), + then DISPS_FINAL_VIEW::topLayer settings are used. + + Formula: output_signal = intensity^( 1 / gamma ) + + In the C++ language this can be represented as follows: + output_signal = pow( double( intensity ), double( 1.0 ) / ( double( gamma ) / 100 ) ); + + Gamma-correction lookup table can be constructed like this: + int32 lut[ 256 ]; + for ( int32 intensity = 0; intensity < 256; intensity++ ) + lut[ i ] = pow( double( intensity ), double( 1.0 ) / ( double( gamma ) / 100 ) ); + + Loading this table into the hardware lookup table at the output side of + framebuffer will cause RGB intensity values with integer components + between 0 and 255 to be gamma-corrected by the hardware as if by the following code: + red_signal = lut[ r ]; + green_signal = lut[ g ]; + blue_signal = lut[ b ]; */ + uint16 gamma; + /** True when dithering is enabled (if HW does not support, then ignore this without error) */ + bool8 enableDithering; + /** Per layer alpha if supported, 0x00-0xFF (if HW does not support, then ignore this without error) */ + uint8 perLayerAlphaValue; + } DISPS_LAYER; + +/** +Final view - composed view information + +@code +__________________________ __________________________ __________________________ +| | | | | | +| DISPS_COLORKEY (1) | | DISPS_RECTANGLE (2) | | DISPS_BUFFER (1) | +| | | | | | +ŻŻŻŻŻŻŻŻŻŻŻŻ|ŻŻŻŻŻŻŻŻŻŻŻŻŻ ŻŻŻŻŻŻŻŻŻŻŻŻ|ŻŻŻŻŻŻŻŻŻŻŻŻŻ ŻŻŻŻŻŻŻŻŻŻŻŻ|ŻŻŻŻŻŻŻŻŻŻŻŻŻ + `--------------------------|--------------------------´ + ____________|_____________ + | | + | DISPS_LAYER (5) | + | | + ŻŻŻŻŻŻŻŻŻŻŻŻ|ŻŻŻŻŻŻŻŻŻŻŻŻŻ + ____________|_____________ + | | + | DISPS_FINAL_VIEW | + | | + ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ +@endcode +*/ +typedef struct /* TODO can be done for n-amount of layers somehow else - perhaps not needed */ + { + DISPS_LAYER topLayer; /**< top most layer (nearest), normally UI-layer and always defined (but not for pure control bus) */ + DISPS_LAYER secondLayer; /**< 2nd */ + DISPS_LAYER thirdLayer; /**< 3rd */ + DISPS_LAYER fourthLayer; /**< 4th */ + DISPS_LAYER fifthLayer; /**< 5th */ + uint32 backgroundColor; /**< Latest layer (farthermost). Background color in URGB8888 format. */ + } DISPS_FINAL_VIEW; + +/** +Update - Gives changed areas what to be updated. Chipset driver can ignore parameters, if hw cannot handle. + +@code +__________________________ +| | +| DISPS_RECTANGLE | +| | +ŻŻŻŻŻŻŻŻŻŻŻŻ|ŻŻŻŻŻŻŻŻŻŻŻŻŻ +____________|_____________ +| | +| DISPS_UPDATE | +| | +ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ +@endcode +*/ +typedef struct + { + /** Changed area of layers - Coordinate space in DISPS_LAYER::sourceBuffer - Shall be inside DISPS_LAYER::inputScissor */ + DISPS_RECTANGLE topLayerRect; + DISPS_RECTANGLE secondLayerRect; + DISPS_RECTANGLE thirdLayerRect; + DISPS_RECTANGLE fourthLayerRect; + DISPS_RECTANGLE fifthLayerRect; + + /** Tearing remove use */ + DISPE_TE_SYNC teSync; + /** If DISP_TE_SYNC_HS_VS sync method chosen, the sync line needs to be defined here */ + uint32 hsSyncLine; + } DISPS_UPDATE; + +/** Target device and bus definition */ +typedef struct + { + /** System display number. Normally primary display has 0, secondary 1, etc. Set to 0xFF if unknown. */ + uint8 systemDisplayNumber; + + /** Bus color format */ + DISPE_COLOR_FORMAT busColorFormat; + /** Native resolution of display */ + uint16 panelHeight; + /** Native resolution of display */ + uint16 panelWidth; + /** Destination color space, HW converts space to another if this is not DISP_COLOR_SPACE_NONE + If DISPS_BUFFER.sourceColorSpace is same, then conversion is disabled. + This operations can be defined platform specific, perhaps similar behavior is not possible for all platforms. */ + DISPE_COLOR_SPACE destinationColorSpace; + /** Destination color coordinates. With this and sourceColorCoordinates chipset driver should do the conversion. + to be defined if destinationColorSpace=DISP_COLOR_COORDINATES */ + DISPS_COLOR_COORDINATES destinationColorCoordinates; + /** Used for DSI command packet mode. Continue command if pixel data to be splitted for several parts. + (normally: Memory Write Continue = 0x3C) If not used at all, then this is 0. */ + uint8 memoryWriteContinueCmd; + /** Used for DSI. Continue command if read data to be splitted for several parts. + (normally: Memory Read Continue = 0x3E) If not used at all, then this is 0. */ + uint8 memoryReadContinueCmd; + + /* Timing and polarities -> */ + + /** Used bus width. max is DISPS_CAPABILITIES.busWidth. E.g. with MeSSI-8 this is DISP_BUS_8BIT. */ + DISPE_BUS_WIDTH outputBusWidth; + /** How many clock cycles are used per pixel. E.g. with MeSSI-8 and 24bpp, this is 30 (3 bytes per pixel). + 1 cycle = 10. 1.5 cycles = 15. 3 cycles = 30 */ + uint8 cyclesPerPixel; + /** Specifies how many LSB bits will be taken from dispAppendCommand() 'command' -parameter. Normally byte alignment only 8/16/24/32 */ + uint8 bitsPerGivenCommand; + /** Specifies how many LSB bits will be taken from dispAppendParameter() 'parameter' -parameter. Normally byte alignment only 8/16/24/32 */ + uint8 bitsPerGivenParameter; + + /** (Pixel data) Clock write cycle high time in ns -> chipset HW should adjust highest possible clockrate to meet the requirement. + -In DSI case, chipset driver has to detect speed mode according to the timing parameters. High Speed (HS) >= 80Mb/s, + Low Power mode (LP) 1Mb/s <= 10Mb/s. @see DISP_PWR_MODE_DISPLAY_OFF. These DSI timings are used for dispFlush() + combined commands. + -In ViSSI/CDP-case, these tells max ViSSI/CDP pixel clock speed. */ + uint32 clockHighDataWriteNs; + /** (Pixel data) Clock write cycle low time in ns -> chipset HW should adjust highest possible clockrate to meet the requirement */ + uint32 clockLowDataWriteNs; + /** (Pixel data) Clock write cycle total time */ + uint32 clockCycleDataWriteNs; + + /** (Command data) Clock write cycle high time in ns -> chipset HW should adjust highest possible clockrate to meet the requirement. + -In DSI case, chipset driver has to detect speed mode according to the timing parameters. High Speed (HS) >= 80Mb/s, + Low Speed (LP) 1Mb/s <= 10Mb/s. @see DISP_PWR_MODE_DISPLAY_OFF. These DSI timings are used for dispProcessList(). + -In ViSSI/CDP-case, these tells max LoSSI write speed. */ + uint32 clockHighCmdWriteNs; + /** (Command data) Clock write cycle low time in ns -> chipset HW should adjust highest possible clockrate to meet the requirement */ + uint32 clockLowCmdWriteNs; + /** (Command data) Clock write cycle total time */ + uint32 clockCycleCmdWriteNs; + + /** Clock read cycle high time in ns -> chipset HW should adjust highest possible clockrate to meet the requirement. + -In DSI case, chipset driver has to detect speed mode according to the timing parameters. + According to DSI-specification, read is normally LP. These DSI timings are used when dispAppendRead()/dispAppendReadRaw(). + -In ViSSI/CDP-case, these tells max LoSSI read speed. */ + uint32 clockHighReadNs; + /** Clock read cycle low time in ns -> chipset HW should adjust highest possible clockrate to meet the requirement */ + uint32 clockLowReadNs; + /** Clock read cycle total time */ + uint32 clockCycleReadNs; + + /** Video display: vertical sync polarity */ + bool8 vSyncPolarityLow; + /** Video display: horisontal sync polarity */ + bool8 hSyncPolarityLow; + /** Video display: pixel clock polarity */ + bool8 pClkActiveFalling; + /** Video display: in pixel clock cycles */ + uint16 hFrontPorch; + /** Video display: in pixel clock cycles */ + uint16 hBackPorch; + /** Video display: in pixel clock cycles */ + uint16 hPulseWidth; + /** Video display: in horisontal clock cycles */ + uint16 vFrontPorch; + /** Video display: in horisontal clock cycles */ + uint16 vBackPorch; + /** Video display: in horisontal clock cycles */ + uint16 vPulseWidth; + + /** TE-signal GPIO line number. 0 means HW block controlled */ + int32 teSignalGpioNumber; + + /** Chip Select -signal GPIO line number. 0 means HW block controlled */ + int32 csSignalGpioNumber; + + /** Reset signal GPIO line number. 0 means HW block controlled */ + int32 resetSignalGpioNumber; + /** True when target reset is active low */ + bool8 resetActiveLow; + + /** TE vertical pulse in microseconds (Needed for TE-line detection) */ + uint32 vsPulseUs; + /** TE horizontal pulse in microseconds (Needed for TE-line detection) */ + uint32 hsPulseUs; + } DISPS_HW_SETTINGS; + +/** Defines HW capabilities for one interface */ +typedef struct + { + /** For what interface the capability is defined */ + DISPE_BUS busInterface; + + /** Control bus width */ + DISPE_BUS_WIDTH controlBusWidth; + /** Data (pxl) bus width */ + DISPE_BUS_WIDTH dataBusWidth; + + /** Scaling represents supported scaling capabilities of the HW interface. + --> if HW support for scaling is not available buffer transfer for different viewport dimensions should + return DISP_ERROR_NO_HW_CAPABILITY */ + DISPE_SCALING scalingMethods; + /** Minimum scaling factor. + E.g. if 1/2x is min, then this is 200 (100 / scalingMinDenominator). 1x = 100. 0xFFFF = infinity. */ + uint16 scalingMinDenominator; + /** Maximum scaling factor. + E.g. if 2.5x is max, then this is 250 (scalingMaxNumerator / 100). 1x = 100. 0xFFFF = infinity. */ + uint16 scalingMaxNumerator; + + /** Source resolution parameters must be even, if following features are used (bit mask) */ + DISPE_FEATURE evenSourceResolution; + /** Destination resolution parameters must be even, if following features are used (bit mask) */ + DISPE_FEATURE evenDestinationResolution; + + /** Supported color space conversions from sRGB to DISPE_COLOR_SPACE (bit mask) */ + DISPE_COLOR_SPACE supportedColorSpaceConversion; + /** True when brightness tuning is supported */ + bool8 supportsBrightnessControl; + /** True when contrast tuning is supported */ + bool8 supportsContrastControl; + /** True when gamma tuning is supported */ + bool8 supportsGammaControl; + /** True when (at least one layer) dithering is supported */ + bool8 supportsDithering; + + /** Rotation represents supported rotation capabilities of HW. */ + DISPE_ROTATION rotations; + /** True if HW can rotate each layer separately. False if only whole view can be rotated. + (Hopefully will not be needed in NGA) */ + bool8 separateRotationPerLayer; + /** Bitmask for features which needs bound buffers. If 0, then can be done for any input buffer */ + DISPE_FEATURE featuresNeedsBindedBuffers; + + /** All the possible colorkey modes supported by the interface */ + DISPE_COLORKEYMODE colorKeyModes; + + /** How many layers supported, at least 1 */ + uint8 layers; + /** True when per layer alpha supported */ + bool8 perLayerAlpha; + + /** Partial update can transfer separate rows */ + bool8 rowPartialUpdate; + /** Partial update can transfer separate columns */ + bool8 columnPartialUpdate; + + /** Supported TE modes for the Hw-block controlled (e.g. DIF module TE capabilities) */ + DISPE_TE_SYNC teSyncMethodsHwBlock; + /** Supported TE modes for the GPIO controlled (If TE line is connected to GPIO-pin) */ + DISPE_TE_SYNC teSyncMethodsGpio; + + /** Color buffer formats natively supported by HW */ + DISPE_COLOR_FORMAT pixelFormats; + /** Bit mask for features, which works with 24bpp aligned color mode */ + DISPE_FEATURE packedPixelsSupported; + + /** True when given buffer(s) works as frame buffer (memoryless displays). False when buffer is free after transfer (MeSSI=False) */ + bool8 requiresFrameBuffer; + + /** Bit mask for features, which needs work buffer from host memory - TODO is needed to get sizes for those */ + DISPE_FEATURE requiresWorkBuffer; + /** True if DMA buffers must be physically linear */ + bool8 requiresPhysicallyLinearBuffer; + + /** True when interface can carry pixel data */ + bool8 carryData; + /** True when interface can carry control data. Typically this can be false if driver implements ViSSI only, but not LoSSI. */ + bool8 carryControl; + } DISPS_CAPABILITIES; + +/*- Constants ---------------------------------------------------------------*/ + +/** API version number. @see dispApiVersion(). + 7: memoryReadContinueCmd added + 6: systemDisplayNumber. ARGB4444. dispDriverMessage. + 5: Pre-multiplied alpha modes + 4: Free colorspace + 3: Callback parameter for DISPT_READY_CB. fetchedArea added to dispGetWorkBuffer(). + 2: forceView and DISP_CACHE_ARM_ACCESSIBLE added + 1: First version where dispApiVersion-method exists */ +const uint32 KApiVersionNumber = 7; + +/** Fixed Chipset driver name char array. Name ends to '0', so max name length is 9 + '\0'. */ +typedef char CHIPSET_DRV_NAME[ 10 ]; + +/** Chipset driver calls this, when something is executed. + Callback must not be called in the API user thread context. + @see dispProcessList + @param error An error code + @param parameter Given parameter (@see dispBindDisplayNumber()) + @param isrContext True when callback is called in interrupt context */ +typedef void (*DISPT_READY_CB)(DISPE_ERROR error, void* parameter, bool8 isrContext); + +/** Chipset driver calls this, when message (dispDriverMessage) is sent and executed. + Callback must not be called in the API user thread context. + @see dispDriverMessage + @param error An error code + @param parameter Given parameter (@see dispBindDisplayNumber()) + @param receiverForThisMsg Driver name who responded for this message + @param responseForThisMsg dispDriverMessage's 'message'-parameter for this message + @param value Message specific return value, unique meaning per DISPE_DRV_MSG + @param isrContext True when callback is called in interrupt context */ +typedef void (*DISPT_MSG_CB)(DISPE_ERROR error, void* parameter, CHIPSET_DRV_NAME receiverForThisMsg, + DISPE_DRV_MSG responseForThisMsg, uint32 value, bool8 isrContext); + +/** Chipset API interface type */ +typedef uint32* API_POINTER; + +/** Identifier type */ +typedef uint32 IDENTIFIER; + +/*- Macros ------------------------------------------------------------------*/ + +/*- External Data -----------------------------------------------------------*/ + +/*- Variables ---------------------------------------------------------------*/ + +/*- Forward Declarations ----------------------------------------------------*/ + +/*- Functional Prototypes ---------------------------------------------------*/ + +/* VERSION -> */ +/** Gets implemented chipset API version. Verify the return value to KApiVersionNumber. + @param api Api interface pointer, fetched from dispGetInterface() + @see KApiVersionNumber + @return Implemented display chipset API version, KApiVersionNumber (should match to client version) */ +inline uint32 dispApiVersion(API_POINTER api); +/* <- VERSION */ + +/* CAPABILITY -> */ +/** Gets number of supported capabilities (DISPS_CAPABILITIES). + @param api Api interface pointer, fetched from dispGetInterface() + @see dispGetCapabilities + @return Max value for getCapabilities() */ +inline uint32 dispGetNumberOfCapabilities(API_POINTER api); + +/** Capability query. Capability list has struct for all the supported devices. + @see dispGetNumberOfCapabilities + @param api Api interface pointer, fetched from dispGetInterface() + @param capabilityNumber Capability number, max value is got from dispGetNumberOfCapabilities() + @param capability Returned capability for user + @return an error code */ +inline DISPE_ERROR dispGetCapabilities(API_POINTER api, uint32 capabilityNumber, DISPS_CAPABILITIES* capability); +/* <- CAPABILITY */ + +/* CONTROL -> */ +/** Binds display number to Hw (constructor). This method initialises and reserved this DISPE_BUS for this client. + This method can be called if settings of bus are wanted to change, so can be called in any time. + Settings will be take in use immediately. + If client calls this method multiple times, chipset driver should return same identifier each time. + @param api Api interface pointer, fetched from dispGetInterface() + @param busInterface Wanted busInterface, which to be initialised and reserved + @param cbParam Callback parameter, returned in callbacks. Normally can be 'this' pointer in C++. + @param identifier Method fills this for user, and user will be recognised with this parameter. + @param displaySettings Target settings + @return an error code */ +inline DISPE_ERROR dispBindDisplayNumber(API_POINTER api, DISPE_BUS busInterface, void* cbParam, IDENTIFIER* identifier, const DISPS_HW_SETTINGS* displaySettings); + +/** Unbinds and deallocates display Hw (destuctor). After this HW is free for another client use. + After call identifier is undefined. Pending callbacks will be completed with DISP_ERROR_CANCELLED-error. + @param api Api interface pointer, fetched from dispGetInterface() + @param identifier Chipset driver uses this parameter for detecting client + @return an error code */ +inline DISPE_ERROR dispUnbindDisplayNumber(API_POINTER api, IDENTIFIER identifier); + +/** Sets all per layer settings for chipset driver. Settings will be used on next dispFlush()-call. + In double buffered case, this method to be call every time before dispFlush, with different buffer + addresses. Chipset driver is responsible to optimise unneeded reinitialisation. It should store + previous settings and compare changed settings of DISPS_FINAL_VIEW, and use that result + for HW reinitialisation. + @see dispFlush + @param api API interface pointer, fetched from dispGetInterface() + @param identifier Chipset driver uses this parameter for detecting client + @param finalView Source buffer and final composition settings + @return an error code */ +inline DISPE_ERROR dispSetFinalView(API_POINTER api, IDENTIFIER identifier, const DISPS_FINAL_VIEW* finalView); + +/** Clones output (dispFlush()) to given destination bus. + Source buffer information is fetched from (this client's) dispSetFinalView()-parameters. + Bus speed settings are fetched from 'destinationBus' client's dispBindDisplayNumber()-parameters. + Commands (control) are still coming from 'destinationBus' client. + Stop cloning with DISP_BUS_NONE-parameter. + @param api API interface pointer, fetched from dispGetInterface() + @param identifier Chipset driver uses this parameter for detecting client (source) + @param destinationBus This client's source buffer is cloned to this bus (destination) + @return an error code */ +inline DISPE_ERROR dispCloneOutput(API_POINTER api, IDENTIFIER identifier, DISPE_BUS destinationBus); + +/** Power control. Chipset API handles own resources, e.g. HW-block clock resources. + @param api API interface pointer, fetched from dispGetInterface() + @param identifier Chipset driver uses this parameter for detecting client + @param powerMode New wanted power states + @param callback To be called when power change is ready, even error occurred. (especially needed when pixelclock). Synchronic call if NULL. + @return an error code */ +inline DISPE_ERROR dispPowerControl(API_POINTER api, IDENTIFIER identifier, DISPE_PWR_MODE powerMode, DISPT_READY_CB callback); + +/** This method makes possible to send some messages for whole chipset driver stack. + When chipset drivers will get the message call and name does not match for that driver, + then it has to forward message for next driver in same driver stack. + + If message==DISP_MSG_PING: Chipset driver will forward same message for + next chipset drivers in the stack, then all drivers call 'callback' with + their own name (CHIPSET_DRV_NAME) and got message (DISP_MSG_PING). With this, topmost + driver can make query, what components stack has. Topmost caller sets param=0, when chipset + driver calls this forward, it increases param by one (param=1). If chipset driver uses to + separated chipset drivers, both will to be called with param=1. Then 'param' means stack level. + In callback chipset drivers will set given param to DISPT_MSG_CB's 'value'-parameter. + + If message==DISP_MSG_SELFTEST: If given name (receiver) matches to driver name, then the + driver will execute selftest. When selftest is ready, it reports test result with 'callback' + for caller. Chipset drivers will forward the same message, if name (receiver) and their own + name doesn't match. Doesn't care what is the 'param'-parameter with this message. + + @param api API interface pointer, fetched from dispGetInterface() + @param identifier Chipset driver uses this parameter for detecting client + @param receiver Message receiver name (same what is stored in Interface Storage) + @param message Message identifier + @param param Optional, has different meaning per 'message' + @param callback Callback when message actions are executed. Cannot be NULL. + @return an error code */ +inline DISPE_ERROR dispDriverMessage(API_POINTER api, IDENTIFIER identifier, CHIPSET_DRV_NAME receiver, + DISPE_DRV_MSG message, uint32 param, DISPT_MSG_CB callback); +/* <- CONTROL */ + + +/* DISPLAY UPDATE -> */ +/** Prepares DMA-transfer according to latest dispSetFinalView parameters. + After this, if DISPS_CAPABILITIES.requiresWorkBuffer is true (some bit is set), work buffer is ready. + This method can be called multiple times, before dispFlush(). + @see dispFlush + @see dispSetFinalView + @param api Api interface pointer, fetched from dispGetInterface() + @param identifier Chipset driver uses this parameter for detecting client + @param changedArea Changed areas, rectangle per layer. Chipset driver can ignore and transfer bigger part. + @param callback To be called when preparation is ready, even error occurred. Synchronic call if NULL. + @return an error code */ +inline DISPE_ERROR dispPrepareFlush(API_POINTER api, IDENTIFIER identifier, const DISPS_UPDATE* changedArea, DISPT_READY_CB callback); +/** Display flush (real DMA-transfer) according to latest not flushed dispPrepareFlush parameters. + Special case if is wanted to flush once for ViSSI output. Keep DISP_PWR_MODE_DISPLAY_OFF always, so if + power state DISP_PWR_MODE_DISPLAY_OFF is set, and Flush is called, then Hw flushes one frame through ViSSI. + + DISPS_CAPABILITIES.requiresFrameBuffer==false: + callback will be called when display buffer is transferred to the display. + DISPS_CAPABILITIES.requiresFrameBuffer==true: + callback will be called when display buffer starting to be visible. So when callback is called + any pixel of flush is not yet shown. And after that given buffer works as framebuffer + until next's flush callback will be called. So caller should be aware of that + to avoiding tearing (no draw to buffer if that is still work as framebuffer). + + If there is pending appended commands+parameters (e.g. dispAppendCommand) the list to be sent before + actual image flush. With this method, only dispFlush() callback will be called after ready. + + If display has TE-line, and TE-line is enabled with DISPS_UPDATE::teSync, chipset driver + shall avoid death lock with backup timer if TE will never detected (TE line may be broken). + When TE-line is not detected and backup timer is triggered DMA, then DISP_ERROR_TE_MISSED error + is reported in return value and/or with callback. + + @see dispSetFinalView + @param api Api interface pointer, fetched from dispGetInterface() + @param identifier Chipset driver uses this parameter for detecting client + @param callback To be called when transfer (DMA) is ready, even error occurred. Synchronic call if NULL. + @return an error code */ +inline DISPE_ERROR dispFlush(API_POINTER api, IDENTIFIER identifier, DISPT_READY_CB callback); +/* <- DISPLAY UPDATE */ + + +/** COMMANDS/PARAMETERS -> + Commands and parameters are collected to dynamic size table or array (linked list or compatible). + List is collected with dispAppendXX()-methods, in that order what is called. When display driver + is appended all needed commands and parameters, then it calls dispProcessList(), which sends appended data + to display bus. After next use, display driver is responsible to clear previous list by dispClearList(). +*/ +/** Clears/resets list. This to be called every time before new list will be collected for chipset driver. + Don't ever call if callback waiting is ongoing (between dispProcessList->callback) + @param api Api interface pointer, fetched from dispGetInterface() + @param identifier Chipset driver uses this parameter for detecting client + @return an error code */ +inline DISPE_ERROR dispClearList(API_POINTER api, IDENTIFIER identifier); + +/** Appends command to the list. + @param api Api interface pointer, fetched from dispGetInterface() + @param identifier Chipset driver uses this parameter for detecting client + @param command Command to be sent to display bus (LSB bits taken only, @see bitsPerGivenCommand) + @return an error code */ +inline DISPE_ERROR dispAppendCommand(API_POINTER api, IDENTIFIER identifier, uint32 command); + +/** Appends parameter to the list. + @param api Api interface pointer, fetched from dispGetInterface() + @param identifier Chipset driver uses this parameter for detecting client + @param parameter Parameter to be sent to display bus (LSB bits taken only, @see bitsPerGivenParameter) + If e.g. dispAppendParameter=16, at least with MeSSI-8 then MSB byte is sent before LSB-byte. + E.g. with MeSSI-16, some devices may require 16bit parameters, then dispAppendParameter=16. (See MIPI) + @return an error code */ +inline DISPE_ERROR dispAppendParameter(API_POINTER api, IDENTIFIER identifier, uint32 parameter); + +/** Appends read data amount in bytes to given buffer. + With DSI: Each read operation shall generate "Set Maximum Return Packet Size" (SMRPS) + command for display (before last DCS command), according to lengthInBytes or max HW read fifo size. + @param api Api interface pointer, fetched from dispGetInterface() + @param identifier Chipset driver uses this parameter for detecting client + @param lengthInBytes How many bytes will be read from display bus + @param readBuffer Destination where chipset driver writes data after read + @return an error code */ +inline DISPE_ERROR dispAppendRead(API_POINTER api, IDENTIFIER identifier, uint32 lengthInBytes, void* readBuffer); + +/** Reads raw data (e.g. pixels) to wanted place. + @see dispAppendRead + @param api Api interface pointer, fetched from dispGetInterface() + @param identifier Chipset driver uses this parameter for detecting client + @param lengthInBytes How many bytes will be read from display bus + @param readBuffer Destination where chipset driver writes data after read + @param readBufferOneLine Read buffer one line in bytes (after this will be skipped according to stride) + @param readBufferStride Read buffer stride in bytes. Must be => readBufferOneLine + @return an error code */ +inline DISPE_ERROR dispAppendReadRaw(API_POINTER api, IDENTIFIER identifier, uint32 lengthInBytes, void* readBuffer, uint32 readBufferOneLine, uint32 readBufferStride); + +/** Sends list. Send list in same order than it is filled. Can be skipped if next operation is dispFlush(). + Then dispFlush() prepares flush with sending appended commands before flush. + @param api Api interface pointer, fetched from dispGetInterface() + @param identifier Chipset driver uses this parameter for detecting client + @param callback To be called when the list is sent, even error occurred. Synchronic call if NULL. + @return an error code */ +inline DISPE_ERROR dispProcessList(API_POINTER api, IDENTIFIER identifier, DISPT_READY_CB callback); +/* <- COMMANDS/PARAMETERS */ + + +/** MEMORY MANAGING -> + Memory allocation is needed for hiding all hardwares, and all special buffer modes, like tiled buffers. + Here is couple of use cases, and how they should be handled. + + Use case #1 - Display driver allocated buffer from chipset driver (chipset driver allocates): + -Display driver fills all members, except addresses to bufferInfo. + -Display driver calls dispAllocateBuffer() + -Chipset driver fills allocatedBuffer-struct, and display driver uses that for work + + Use case #2 - Display driver wants allocate buffers by itself: + -Display driver fills all members, except addresses to bufferInfo. + -Display driver calls dispCalculateMemorySize() + -Display driver allocates buffer using OS-services, according to returned neededMemorySize value + -Display driver binds allocated buffer to chipset driver, using dispInitialiseBuffer()-method + -Chipset driver fills allocatedBuffer-struct, and display driver uses that for work + + Use case #3 - Display color mode changed dynamically: + -Display driver gets requirement to change ARGB8888 mode to RGB565 + -Display driver waits that all DMA and other accesses to the buffer are ready (no accesses) + -Display driver calls dispInitialiseBuffer() + -Chipset driver fills allocatedBuffer-struct, and display driver uses that for work + + Use case #4 - Free buffer: + -Display driver waits that all DMA and other accesses to the buffer are ready (no accesses) + -Display driver calls dispDeallocateBuffer() + -Chipset driver deallocates given buffer (buffer must be allocated or bound in chipset driver) + + API client has to fill following parameters before give the buffer for dispAllocateBuffer(), + dispCalculateMemorySize() or dispInitialiseBuffer(): + -At least one of these: bufferLinearAddress, bufferPhysicalAddress, bufferId + -physicallyLinear required or not + -caches + -bufferUseCases + -pixelFormat and yCbCrBitMask + -width and height + Chipset driver has to fill rest data members + +*/ +/** Allocates buffer for user. This method makes allocation and display driver does not need do any buffer allocation anymore. + @param api Api interface pointer, fetched from dispGetInterface() + @param identifier Chipset driver uses this parameter for detecting client + @param bufferInfo Display driver gives buffer size and format requirements to chipset driver (not all members filled) + @param allocatedBuffer Chipset driver fills all data members for display driver use + @return an error code */ +inline DISPE_ERROR dispAllocateBuffer(API_POINTER api, IDENTIFIER identifier, const DISPS_BUFFER* bufferInfo, DISPS_BUFFER* allocatedBuffer); + +/** If display driver wants to allocate buffers itself, it can make query from chipset driver, that how much it requires memory + for doing memory allocation. This is needed e.g. if buffer must have some extra alignment for tiling. + After own allocation, display driver must to initialise buffer using dispInitialiseBuffer(). + @see dispInitialiseBuffer() + @param api Api interface pointer, fetched from dispGetInterface() + @param identifier Chipset driver uses this parameter for detecting client + @param bufferInfo Display driver gives new buffer information to chipset driver + @param neededMemorySize Chipset driver fills needed buffer size to display driver (in bytes) + @return an error code */ +inline DISPE_ERROR dispCalculateMemorySize(API_POINTER api, IDENTIFIER identifier, const DISPS_BUFFER* bufferInfo, uint32* neededMemorySize); + +/** If user settings are changed, e.g. colormode or DISPS_BUFFER.bufferUseCases changed, chipset driver can do some changes to buffer settings. + It can change tile size, or re-allocate new version of buffer for user. + This to be called every time when some of bufferInfo or DISPS_BUFFER.bufferUseCases is changed. + Display driver should be aware that any transfer or access to old buffer is not ongoing when this method is called. + If display driver is allocated buffer by itself, it should give allocated buffer to chipset driver using this method. Then + returned buffer (allocatedBuffer) will be used for update and draw purpose (this method binds the buffer). + + @note Any buffer can be tried to give directly to chipset driver (for flush), but if e.g. rotation + requires some special buffer type, chipset driver cannot do all operations for "not initalised" buffers. + So-called external buffers can be tried to flush directly without dispInitialiseBuffer, but then error may occur. + + @see dispCalculateMemorySize() + @param api Api interface pointer, fetched from dispGetInterface() + @param identifier Chipset driver uses this parameter for detecting client + @param bufferInfo Display driver gives new buffer information to chipset driver + @param allocatedBuffer Chipset driver fills all data members for display driver use + @return an error code */ +inline DISPE_ERROR dispInitialiseBuffer(API_POINTER api, IDENTIFIER identifier, const DISPS_BUFFER* bufferInfo, DISPS_BUFFER* allocatedBuffer); + +/** Deallocates and unbinds the buffer. If display driver is allocated buffer itself, this must be done + before the real memory deallocation. + So-called external buffers will not be deallocated with this function. + @param api Api interface pointer, fetched from dispGetInterface() + @param identifier Chipset driver uses this parameter for detecting client + @param bufferToBeRemoved Display driver gives new buffer information to chipset driver + @return an error code */ +inline DISPE_ERROR dispDeallocateBuffer(API_POINTER api, IDENTIFIER identifier, const DISPS_BUFFER* bufferToBeRemoved); + +/** Fetchs chipset driver workbuffer (if exists, DISPS_CAPABILITIES.requiresWorkBuffer) + Work buffer is available when dispPrepareFlush() is called. To be called separately for each dispPrepareFlush() call. + Can fetch also partial buffer, and then can be faster operation, and peek memory consumption will be smaller. + @param api Api interface pointer, fetched from dispGetInterface() + @param identifier Chipset driver uses this parameter for detecting client + @param fetchedArea Rectangle which to be fetched + @param fetchedWorkBuffer Chipset driver fills own work buffer information to this buffer (if in host memory) + @return an error code */ +inline DISPE_ERROR dispGetWorkBuffer(API_POINTER api, IDENTIFIER identifier, const DISPS_RECTANGLE* fetchedArea, DISPS_BUFFER* fetchedWorkBuffer); + +/* <- MEMORY MANAGING */ + +/*- Inline Functions --------------------------------------------------------*/ + +#include "display_chipset_api.inl" + +#endif /* DISPLAY_CHIPSET_API_H */ + +/* End of File */ + diff -r 000000000000 -r bb4b476bbb96 Display/display_chipset_api.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Display/display_chipset_api.inl Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,385 @@ +/* + display_chipset_api.inl + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @file + +Inline methods of display chipset driver API + +@publishedDeviceAbstraction +*/ + +/*- Include Files ----------------------------------------------------------*/ + +/*- Data Types --------------------------------------------------------------*/ + +/*- Enumerations ------------------------------------------------------------*/ + +/** Error codes */ +typedef enum + { + /* Init */ + DISP_FUNC_DISP_API_VERSION = 0, + DISP_FUNC_GET_NUMBER_OF_CAPABILITIES, + DISP_FUNC_GET_CAPABILITIES, + DISP_FUNC_BIND_DISPLAY_NUMBER, + DISP_FUNC_UNBIND_DISPLAY_NUMBER, + + /* Control */ + DISP_FUNC_SET_FINAL_VIEW, + DISP_FUNC_CLONE_OUTPUT, + DISP_FUNC_POWER_CONTROL, + DISP_FUNC_DRIVER_MESSAGE, + + /* Flush */ + DISP_FUNC_PREPARE_FLUSH, + DISP_FUNC_FLUSH, + + /* Commands */ + DISP_FUNC_CLEAR_LIST, + DISP_FUNC_APPEND_COMMAND, + DISP_FUNC_APPEND_PARAMETER, + DISP_FUNC_APPEND_READ, + DISP_FUNC_APPEND_READ_RAW, + DISP_FUNC_PROCESS_LIST, + + /* Memory */ + DISP_FUNC_ALLOCATE_BUFFER, + DISP_FUNC_CALCULATE_MEMORY_SIZE, + DISP_FUNC_INITIALISE_BUFFER, + DISP_FUNC_DEALLOCATE_BUFFER, + DISP_FUNC_GET_WORK_BUFFER, + + DISP_FUNC_SIZE_OF_ARRAY, + } DISPE_FUNCTIONS; + +/*- Data Structs ------------------------------------------------------------*/ + +/*- Constants ---------------------------------------------------------------*/ + +/*- Functions ---------------------------------------------------------------*/ + +/*== Init ===================================================================*/ + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline uint32 dispApiVersion(API_POINTER api) + { + + typedef uint32 (*DISPT_API_VERSION)(); + DISPT_API_VERSION function = ( DISPT_API_VERSION ) api[ DISP_FUNC_DISP_API_VERSION ]; + return function(); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline uint32 dispGetNumberOfCapabilities(API_POINTER api) + { + + typedef uint32 (*DISPT_GET_NUMBER_OF_CAPABILITIES)(); + DISPT_GET_NUMBER_OF_CAPABILITIES function = ( DISPT_GET_NUMBER_OF_CAPABILITIES ) api[ DISP_FUNC_GET_NUMBER_OF_CAPABILITIES ]; + return function(); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispGetCapabilities(API_POINTER api, uint32 capabilityNumber, DISPS_CAPABILITIES* capability) + { + + typedef DISPE_ERROR (*DISPT_GET_CAPABILITIES)(uint32 capabilityNumber, DISPS_CAPABILITIES* capability); + DISPT_GET_CAPABILITIES function = ( DISPT_GET_CAPABILITIES ) api[ DISP_FUNC_GET_CAPABILITIES ]; + return function( capabilityNumber, capability ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispBindDisplayNumber(API_POINTER api, DISPE_BUS busInterface, void* cbParam, + IDENTIFIER* identifier, const DISPS_HW_SETTINGS* displaySettings) + { + + typedef DISPE_ERROR (*DISPT_BIND_DISPLAY_NUMBER)(DISPE_BUS busInterface, void* cbParam, + IDENTIFIER* identifier, const DISPS_HW_SETTINGS* displaySettings); + DISPT_BIND_DISPLAY_NUMBER function = ( DISPT_BIND_DISPLAY_NUMBER ) api[ DISP_FUNC_BIND_DISPLAY_NUMBER ]; + return function( busInterface, cbParam, identifier, displaySettings ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispUnbindDisplayNumber(API_POINTER api, IDENTIFIER identifier) + { + + typedef DISPE_ERROR (*DISPT_UNBIND_DISPLAY_NUMBER)(IDENTIFIER identifier); + DISPT_UNBIND_DISPLAY_NUMBER function = ( DISPT_UNBIND_DISPLAY_NUMBER ) api[ DISP_FUNC_UNBIND_DISPLAY_NUMBER ]; + return function( identifier ); + + } + + +/*== Control ================================================================*/ + + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispSetFinalView(API_POINTER api, IDENTIFIER identifier, const DISPS_FINAL_VIEW* finalView) + { + + typedef DISPE_ERROR (*DISPT_SET_FINAL_VIEW)(IDENTIFIER identifier, const DISPS_FINAL_VIEW* finalView); + DISPT_SET_FINAL_VIEW function = ( DISPT_SET_FINAL_VIEW ) api[ DISP_FUNC_SET_FINAL_VIEW ]; + return function( identifier, finalView ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispCloneOutput(API_POINTER api, IDENTIFIER identifier, const DISPE_BUS destinationBus) + { + + typedef DISPE_ERROR (*DISPT_CLONE_OUTPUT)(IDENTIFIER identifier, const DISPE_BUS destinationBus); + DISPT_CLONE_OUTPUT function = ( DISPT_CLONE_OUTPUT ) api[ DISP_FUNC_CLONE_OUTPUT ]; + return function( identifier, destinationBus ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispPowerControl(API_POINTER api, IDENTIFIER identifier, DISPE_PWR_MODE powerMode, DISPT_READY_CB callback) + { + + typedef DISPE_ERROR (*DISPT_POWER_CONTROL)(IDENTIFIER identifier, DISPE_PWR_MODE powerMode, DISPT_READY_CB callback); + DISPT_POWER_CONTROL function = ( DISPT_POWER_CONTROL ) api[ DISP_FUNC_POWER_CONTROL ]; + return function( identifier, powerMode, callback ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispDriverMessage(API_POINTER api, IDENTIFIER identifier, CHIPSET_DRV_NAME receiver, + DISPE_DRV_MSG message, uint32 param, DISPT_MSG_CB callback) + { + + typedef DISPE_ERROR (*DISPT_DRIVER_MESSAGE)(IDENTIFIER identifier, CHIPSET_DRV_NAME receiver, + DISPE_DRV_MSG message, uint32 param, DISPT_MSG_CB callback); + DISPT_DRIVER_MESSAGE function = ( DISPT_DRIVER_MESSAGE ) api[ DISP_FUNC_DRIVER_MESSAGE ]; + return function( identifier, receiver, message, param, callback ); + + } + + +/*== Flush ==================================================================*/ + + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispPrepareFlush(API_POINTER api, IDENTIFIER identifier, const DISPS_UPDATE* changedArea, DISPT_READY_CB callback) + { + + typedef DISPE_ERROR (*DISPT_PREPARE_FLUSH)(IDENTIFIER identifier, const DISPS_UPDATE* changedArea, DISPT_READY_CB callback); + DISPT_PREPARE_FLUSH function = ( DISPT_PREPARE_FLUSH ) api[ DISP_FUNC_PREPARE_FLUSH ]; + return function( identifier, changedArea, callback ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispFlush(API_POINTER api, IDENTIFIER identifier, DISPT_READY_CB callback) + { + + typedef DISPE_ERROR (*DISPT_FLUSH)(IDENTIFIER identifier, DISPT_READY_CB callback); + DISPT_FLUSH function = ( DISPT_FLUSH ) api[ DISP_FUNC_FLUSH ]; + return function( identifier, callback ); + + } + + +/*== Commands ===============================================================*/ + + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispClearList(API_POINTER api, IDENTIFIER identifier) + { + + typedef DISPE_ERROR (*DISPT_CLEAR_LIST)(IDENTIFIER identifier); + DISPT_CLEAR_LIST function = ( DISPT_CLEAR_LIST ) api[ DISP_FUNC_CLEAR_LIST ]; + return function( identifier ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispAppendCommand(API_POINTER api, IDENTIFIER identifier, uint32 command) + { + + typedef DISPE_ERROR (*DISPT_APPEND_COMMAND)(IDENTIFIER identifier, uint32 command); + DISPT_APPEND_COMMAND function = ( DISPT_APPEND_COMMAND ) api[ DISP_FUNC_APPEND_COMMAND ]; + return function( identifier, command ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispAppendParameter(API_POINTER api, IDENTIFIER identifier, uint32 parameter) + { + + typedef DISPE_ERROR (*DISPT_APPEND_PARAMETER)(IDENTIFIER identifier, uint32 parameter); + DISPT_APPEND_PARAMETER function = ( DISPT_APPEND_PARAMETER ) api[ DISP_FUNC_APPEND_PARAMETER ]; + return function( identifier, parameter ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispAppendRead(API_POINTER api, IDENTIFIER identifier, uint32 lengthInBytes, void* readBuffer) + { + + typedef DISPE_ERROR (*DISPT_APPEND_READ)(IDENTIFIER identifier, uint32 lengthInBytes, void* readBuffer); + DISPT_APPEND_READ function = ( DISPT_APPEND_READ ) api[ DISP_FUNC_APPEND_READ ]; + return function( identifier, lengthInBytes, readBuffer ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispAppendReadRaw(API_POINTER api, IDENTIFIER identifier, uint32 lengthInBytes, void* readBuffer, uint32 readBufferOneLine, uint32 readBufferStride) + { + + typedef DISPE_ERROR (*DISPT_APPEND_READ_RAW)(IDENTIFIER identifier, uint32 lengthInBytes, + void* readBuffer, uint32 readBufferOneLine, uint32 readBufferStride); + DISPT_APPEND_READ_RAW function = ( DISPT_APPEND_READ_RAW ) api[ DISP_FUNC_APPEND_READ_RAW ]; + return function( identifier, lengthInBytes, readBuffer, readBufferOneLine, readBufferStride ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispProcessList(API_POINTER api, IDENTIFIER identifier, DISPT_READY_CB callback) + { + + typedef DISPE_ERROR (*DISPT_PROCESS_LIST)(IDENTIFIER identifier, DISPT_READY_CB callback); + DISPT_PROCESS_LIST function = ( DISPT_PROCESS_LIST ) api[ DISP_FUNC_PROCESS_LIST ]; + return function( identifier, callback ); + + } + + +/*== Memory =================================================================*/ + + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispAllocateBuffer(API_POINTER api, IDENTIFIER identifier, const DISPS_BUFFER* bufferInfo, DISPS_BUFFER* allocatedBuffer) + { + + typedef DISPE_ERROR (*DISPT_ALLOCATE_BUFFER)(IDENTIFIER identifier, const DISPS_BUFFER* bufferInfo, DISPS_BUFFER* allocatedBuffer); + DISPT_ALLOCATE_BUFFER function = ( DISPT_ALLOCATE_BUFFER ) api[ DISP_FUNC_ALLOCATE_BUFFER ]; + return function( identifier, bufferInfo, allocatedBuffer ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispCalculateMemorySize(API_POINTER api, IDENTIFIER identifier, const DISPS_BUFFER* bufferInfo, uint32* neededMemorySize) + { + + typedef DISPE_ERROR (*DISPT_CALCULATE_MEMORY_SIZE)(IDENTIFIER identifier, const DISPS_BUFFER* bufferInfo, uint32* neededMemorySize); + DISPT_CALCULATE_MEMORY_SIZE function = ( DISPT_CALCULATE_MEMORY_SIZE ) api[ DISP_FUNC_CALCULATE_MEMORY_SIZE ]; + return function( identifier, bufferInfo, neededMemorySize ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispInitialiseBuffer(API_POINTER api, IDENTIFIER identifier, const DISPS_BUFFER* bufferInfo, DISPS_BUFFER* allocatedBuffer) + { + + typedef DISPE_ERROR (*DISPT_INITIALISE_BUFFER)(IDENTIFIER identifier, const DISPS_BUFFER* bufferInfo, DISPS_BUFFER* allocatedBuffer); + DISPT_INITIALISE_BUFFER function = ( DISPT_INITIALISE_BUFFER ) api[ DISP_FUNC_INITIALISE_BUFFER ]; + return function( identifier, bufferInfo, allocatedBuffer ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispDeallocateBuffer(API_POINTER api, IDENTIFIER identifier, const DISPS_BUFFER* bufferToBeRemoved) + { + + typedef DISPE_ERROR (*DISPT_DEALLOCATE_BUFFER)(IDENTIFIER identifier, const DISPS_BUFFER* bufferToBeRemoved); + DISPT_DEALLOCATE_BUFFER function = ( DISPT_DEALLOCATE_BUFFER ) api[ DISP_FUNC_DEALLOCATE_BUFFER ]; + return function( identifier, bufferToBeRemoved ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispGetWorkBuffer(API_POINTER api, IDENTIFIER identifier, const DISPS_RECTANGLE* fetchedArea, DISPS_BUFFER* fetchedWorkBuffer) + { + + typedef DISPE_ERROR (*DISPT_GET_WORK_BUFFER)(IDENTIFIER identifier, const DISPS_RECTANGLE* fetchedArea, DISPS_BUFFER* fetchedWorkBuffer); + DISPT_GET_WORK_BUFFER function = ( DISPT_GET_WORK_BUFFER ) api[ DISP_FUNC_GET_WORK_BUFFER ]; + return function( identifier, fetchedArea, fetchedWorkBuffer ); + + } + +/* End of File */ + diff -r 000000000000 -r bb4b476bbb96 Display/display_chipset_api_interfaces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Display/display_chipset_api_interfaces.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,74 @@ +/* + display_chipset_api_interfaces.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @file + +Declaration of display chipset driver API interface storage + +@publishedDeviceAbstraction +*/ + +#ifndef DISPLAY_CHIPSET_API_INTERFACES_H +#define DISPLAY_CHIPSET_API_INTERFACES_H + +/*- Include Files ----------------------------------------------------------*/ + +#include "display_chipset_os.h" /* OS specific header file, typedefs etc. */ +#include "display_chipset_api.h" /* Fetch enumeration etc */ + +/*- Data Types --------------------------------------------------------------*/ + +/*- Enumerations ------------------------------------------------------------*/ + +/*- Data Structs ------------------------------------------------------------*/ + +/*- Constants ---------------------------------------------------------------*/ + +/*- Macros ------------------------------------------------------------------*/ + +/*- External Data -----------------------------------------------------------*/ + +/*- Variables ---------------------------------------------------------------*/ + +/*- Forward Declarations ----------------------------------------------------*/ + +/*- Functional Prototypes ---------------------------------------------------*/ + +/** Chipset API interface registration method. + @param driverName Unique name of component which will register to the Interface Storage + @param displayBus Bus type what this interface controls + @param apiPointer This chipset API interface pointer + @return DISP_ERROR_NONE if ok. + DISP_ERROR_ALREADY_EXISTS if same name and bus is already registered. */ +DLL_IMPORT DISPE_ERROR dispSetInterface(CHIPSET_DRV_NAME driverName, DISPE_BUS displayBus, API_POINTER apiPointer); + +/** Chipset API interface getter. + If got pointer is NULL or DISP_ERROR_NOT_FOUND is returned, caller has to try same query later. + @param callerName Unique name of component which is getting the pointer to specific 'displayBus' + @param displayBus Bus type what this interface controls + @param gotApiPointer Pointer to API interface. This is filled for caller by interface storage. + @return DISP_ERROR_NONE if ok. + DISP_ERROR_INVALID_NAME This name is not recognised + DISP_ERROR_NOT_FOUND no any registered for this DISPE_BUS */ +DLL_IMPORT DISPE_ERROR dispGetInterface(CHIPSET_DRV_NAME callerName, DISPE_BUS displayBus, API_POINTER* gotApiPointer); + +/*- Inline Functions --------------------------------------------------------*/ + +#endif /* DISPLAY_CHIPSET_API_INTERFACES_H */ + +/* End of File */ + diff -r 000000000000 -r bb4b476bbb96 Display/display_chipset_os.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Display/display_chipset_os.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,68 @@ +/* + display_chipset_os.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @file + +Symbian version of display_chipset_os.h-file. Typedefs Symbian types to chipset versions. + +@publishedDeviceAbstraction + +*/ + +#ifndef DISPLAY_CHIPSET_OS_H +#define DISPLAY_CHIPSET_OS_H + +/*- Include Files ----------------------------------------------------------*/ + +#include + +/*- Data Types --------------------------------------------------------------*/ + +typedef TUint8 uint8; +typedef TUint16 uint16; +typedef TUint32 uint32; + +typedef TInt8 int8; +typedef TInt16 int16; +typedef TInt32 int32; + +typedef TUint8 bool8; + +#define DLL_IMPORT IMPORT_C + +/*- Enumerations ------------------------------------------------------------*/ + +/*- Data Structs ------------------------------------------------------------*/ + +/*- Constants ---------------------------------------------------------------*/ + +/*- Macros ------------------------------------------------------------------*/ + +/*- External Data -----------------------------------------------------------*/ + +/*- Variables ---------------------------------------------------------------*/ + +/*- Forward Declarations ----------------------------------------------------*/ + +/*- Functional Prototypes ---------------------------------------------------*/ + +/*- Inline Functions --------------------------------------------------------*/ + +#endif /* DISPLAY_CHIPSET_OS_H */ + +/* End of File */ + diff -r 000000000000 -r bb4b476bbb96 Energy Management/adc_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Energy Management/adc_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,151 @@ +/* + adc_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @file + @brief ADC chipset API. + + For details see document "EM Chipset API Specification" + + @publishedDeviceAbstraction + */ + +#ifndef ADC_CHIPSET_API_H +#define ADC_CHIPSET_API_H + +/* --------------------------------------------------------------------------- + * + * CONSTANTS + * + */ + +/* Battery Voltage (VBAT) */ +#define HAL_ADC_CHIPSET_VBAT 0x01 + +/* Battery Size Identification (BSI) */ +#define HAL_ADC_CHIPSET_BSI 0x04 + +/* Battery TEMPerature (BTEMP) */ +#define HAL_ADC_CHIPSET_BTEMP 0x05 + +/* Power Amplifier TEMPerature (PATEMP) */ +#define HAL_ADC_PATEMP 0x09 + +/* Battery current (positive: current from battery to phone, negative: current running to the battery) */ +/* Ibat can be implemented as a physical or logical adc channel, in case of logical this channel is still used in calibration */ +#define HAL_ADC_CHIPSET_IBAT 0x0E + +/* PWB Temperature */ +#define HAL_ADC_CHIPSET_PWBTEMP 0x22 + +/* Main channel */ +#define HAL_ADC_MAIN_CAL 0xFE + +#include +#include + +/* --------------------------------------------------------------------------- + * + * TYPES + * + */ + +/* + * Type definition for the call-back function used writing to + * asynchronous em callback. + */ +typedef void (*HAL_ADC_CALLBACK)(TUint event, TInt p1, TAny* p2); + +/* --------------------------------------------------------------------------- + * + * FUNCTIONAL PROTOTYPES AND MACROS + * + */ +class TAdcHal + { + + // Class declaration + + /** + Implements AdcHal chipset + */ + +public: + + enum THalAdcCalType + { + EHalAdcCalAppliedVoltage = 1, + EHalAdcCalAppliedCurrent, + EHalAdcCalSensor + }; + + /* --------------------------------------------------------------------------- + * + * DATA STRUCTURES + * + */ + + class HAL_ADC_CAL_DATA_ELEMENT_TYPE + { + public: + TUint8 Channel; + TUint16 RawReading; + THalAdcCalType Type; + TInt32 ReferenceValue; + TInt32 Identification; + }; + + class HAL_ADC_CAL_DATA_TYPE + { + public: + TUint16 NumberOfElements; + HAL_ADC_CAL_DATA_ELEMENT_TYPE *Element; + }; + + /* + * Constructor: + */ + + TAdcHal(); + + /* + * Extension entrypoint + */ + IMPORT_C static TAdcHal* hal_adc_entry_point(); + + /* Initialisation */ + virtual void hal_adc_init(); + + /* Read/convert raw values */ + virtual TInt hal_adc_raw_read(TUint channel, TUint* value, + HAL_ADC_CALLBACK adc_handler, TAny* context); + virtual TInt hal_adc_unit_convert(TUint channel, TUint value); + + /* Calibration depending function */ + virtual TInt hal_adc_unit_read(TUint channel, TInt* value, + HAL_ADC_CALLBACK adc_handler, TAny* context); + virtual TInt hal_adc_cal_unit_conv(TUint channel, TUint rawval, + TInt *unitval); + virtual TInt hal_adc_cal_get(TUint8 channel, TUint *identification, + TInt *value1, TInt *value2, TInt *value3); + virtual TInt hal_adc_cal_set(HAL_ADC_CAL_DATA_TYPE *data); + virtual TInt hal_adc_cal_store(); + virtual TInt hal_adc_unit_lock_channel(TUint channel, TBool action, + TInt value); + }; + +#endif /* ADC_CHIPSET_API_H */ +/* End of Include File */ diff -r 000000000000 -r bb4b476bbb96 Energy Management/em_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Energy Management/em_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,195 @@ +/* + em_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @file + @brief Energy management chipset API + + @publishedDeviceAbstraction + */ + +#ifndef EM_CHIPSET_API_H +#define EM_CHIPSET_API_H + +#include +#include + +/* --------------------------------------------------------------------------- + * + * TYPES + * + */ + +/** + * Type definition for the call-back function used writing to + * asynchronous em callback. Callback is executed in the EM chipset's context. + */ +typedef void (*HAL_EM_CALLBACK)(TUint event, TInt p1, TAny* p2); + +/* --------------------------------------------------------------------------- + * + * FUNCTIONAL PROTOTYPES AND MACROS + * + */ + +class TEmHal + { + // Class declaration + + /** + Implements EmHal chipset + */ +public: + + /* --------------------------------------------------------------------------- + * + * CONSTANTS + * + */ + + enum THalEmChaEvtType + { + EHalEMChaChargeStarted = 1, + EHalEmChaChargeStopped, + EHalEamChaChargeReady, + EHalEamChaChargeChargerType, + EHalEamChaChargeFull, + EHalEamChaChargeError + }; + + enum THalEmChaChargerType + { + EHalEmChaChargerNone = 1, + EHalEmChaChargerSpecial, + EHalEmChaChargerDynamo + }; + + enum THalEmChaSource + { + EHalEmChaSourceDynamo = 1, + EHalEmChaSourceUsb + }; + + enum THalEmIbatEvtType + { + EHalEmChaIbatStarted = 1, + EHalEmChaIbatStopped, + EHalEmChaIbatSampling, + EHalEmChaIbatError + }; + + enum THalEmVbatEvtType + { + EHalEmVbatTxOn = 1, + EHalEmVbatTxOff, + EHalEmVbatChOn, + EHalEmVbatChOff, + EHalEmVbatError + }; + + enum THalEmBsiEvtType + { + EHalEmBsiFloating = 1 + }; + + enum THalEmDbiEvtType + { + EHalEmDbiAuthenticationOk = 1, + EHalEmDbiAuthenticationFailed, + EHalEmDbiReadReady, + EHalEmDbiReadError, + EHalEmDbiWriteReady, + EHalEmDbiWriteError + }; + + /* + * Constructor: + */ + + TEmHal(); + + /* + * Extension entrypoint + */ + + IMPORT_C static TEmHal* hal_em_entry_point(); + + /* + * INIT (setup): + */ + + virtual void hal_em_init(HAL_EM_CALLBACK cha_handler, + HAL_EM_CALLBACK ibat_handler, HAL_EM_CALLBACK vbat_handler, + HAL_EM_CALLBACK bsi_handler); + + /* + * CHARGING: + */ + virtual TInt hal_em_cha_charge(TInt action); + virtual TInt hal_em_cha_charge_pause(TInt action); + virtual TInt hal_em_cha_set_target_voltage(TInt mV); + virtual TInt hal_em_cha_set_termination_current(TInt mA); + virtual TInt hal_em_cha_set_in_current(TInt mA); + virtual TInt hal_em_cha_set_out_current(TInt mA); + virtual TInt hal_em_cha_set_min_vbus_volt(TInt mv); + virtual TInt hal_em_cha_set_charging_source(THalEmChaSource source); + + /* + * IBAT + */ + virtual TInt hal_em_ibat_read(); + virtual TUint hal_em_ibat_sample_time(); + virtual TUint hal_em_ibat_avg_time_get(); + virtual TInt hal_em_ibat_avg_time_set(TUint number); + virtual TInt hal_em_ibat_avg_get(); + virtual TInt hal_em_ibat_avg_start(); + virtual TInt hal_em_ibat_avg_stop(); + virtual TInt hal_em_ibat_avg_state_get(); + + /* + * VBAT + */ + + virtual TInt hal_em_vbat_initial(); + virtual TInt hal_em_vbat_read(TUint *value); + virtual TInt hal_em_vbat_sync(TInt action); + + /* + * BTEMP + */ + virtual TInt hal_em_btemp_read(TUint *value); + + /* + * BSI + */ + virtual TInt hal_em_bsi_read(TUint *value); + + /* WATCHDOG */ + virtual void hal_em_watchdog(); + + /* DBI */ + + virtual TInt hal_em_dbi_init(HAL_EM_CALLBACK dbi_handler); + virtual TInt hal_em_dbi_authenticate(TUint8 *challenge, + TUint8 challengelength, TUint8 *response, TUint8 responselength); + virtual TInt + hal_em_dbi_read(TUint address, TUint length, TUint8* readbuf); + virtual TInt hal_em_dbi_write(TUint address, TUint length, + TUint8* writebuf); + }; + +#endif /* EM_CHIPSET_API_H */ +/* End of Include File */ diff -r 000000000000 -r bb4b476bbb96 GAPE/gape_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GAPE/gape_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,208 @@ +/* + gptimer_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @file +@brief gape_chipset_api.h + +This a header file of gape_chipset_api.h + +@publishedDeviceAbstraction +*/ + +#ifndef __GAPE_H__ +#define __GAPE_H__ + +// Include files + +#include + +// Constants + +/* The list of the descriptor names what the array can hold */ +_LIT8( KTvOut, "TvOut" ); +_LIT8( KKeypad, "Keypad" ); +_LIT8( KNand, "Nand" ); +_LIT8( KPrimaryDisplay, "PriDisp" ); +_LIT8( KSecondaryDisplay, "SecDisp" ); +_LIT8( KSecurity, "Security" ); +_LIT8( KUsbExt, "UsbExtension" ); +_LIT8( KUsbDriver, "UsbDriver" ); +_LIT8( KDigitiser, "Digitiser" ); +_LIT8( KMmc, "Mmc" ); +_LIT8( KSd, "Sd" ); +_LIT8( KHdd, "Hdd" ); +_LIT8( KCustom, "Custom" ); +_LIT8( KJoystick, "Joystick" ); +_LIT8( KLight, "Light" ); +_LIT8( KSwitch, "Switch" ); +_LIT8( KQwerty, "Qwerty" ); +_LIT8( KPanicScreen, "PanicScreen" ); +_LIT8( KBootFigure0, "BootFigure0" ); +_LIT8( KBootFigure1, "BootFigure1" ); +_LIT8( KThermalSensor, "ThermalSensor" ); +_LIT8( KCameraHWA, "CameraHWA" ); +_LIT8( KCameraDriver, "CameraDriver" ); +_LIT8( KDisplayDriver, "DisplayDriver" ); +_LIT8( KPowerModel, "PowerController" ); +_LIT8( KTwistDriver, "TwistDriver" ); +_LIT8( KCameraStaticData, "CameraStaticData" ); +_LIT8( KAccelerometer, "Accelerometer" ); +_LIT8( KExpander, "KeypadExpander" ); +_LIT8( KPowerTouareg, "PowerTouareg" ); +_LIT8( KKernelDataTransferApiUsb, "UsbDataIf" ); +_LIT8( KNaviScroll, "NaviScroll" ); +_LIT8( KTouchIC, "TouchIC" ); + +/** Array for pointers (for registered descriptors) */ +const TDesC8* const KPtrArray[] = + { + &KTvOut, + &KKeypad, + &KNand, + &KPrimaryDisplay, + &KSecondaryDisplay, + &KSecurity, + &KUsbExt, + &KUsbDriver, + &KDigitiser, + &KMmc, + &KSd, + &KHdd, + &KCustom, + &KJoystick, + &KLight, + &KSwitch, + &KQwerty, + &KPanicScreen, + &KBootFigure0, + &KBootFigure1, + &KThermalSensor, + &KCameraHWA, + &KCameraDriver, + &KDisplayDriver, + &KPowerModel, + &KCameraStaticData, + &KAccelerometer, + &KExpander, + &KPowerTouareg, + &KKernelDataTransferApiUsb, + &KNaviScroll, + &KTouchIC + }; + +/** Maximum number of items in an array */ +const TUint KPtrArraySize = ( sizeof( KPtrArray ) / sizeof( KPtrArray[0] ) ); + +// Macros + +// Data types + +// Function prototypes + +// Forward declarations + +// Class declaration + +/** +@brief Class description +/** + +Generic APE-side library for kernel side clients. + +*/ +class GApe + { + public: + /** + Return an instance to GApe interface. This method returns the + only GApe instance system can have, it is not possible to create + new instances of this class. + + @return GApe* An instance to GApe class + */ + static GApe* Instance(); + + /** + Save pointer to internal array e.g. + + @code + TInt ret = GApe::SetPtr( KTvOut, this ); + if ( ret != KErrNone ) + { + // Error handling... + } + @endcode + + @param aName Name used for registering pointer + @param aPtr Pointer to be saved + + @return KErrNone, if successful. KErrAlreadyExists, if the pointer + is already registered. KErrNotFound, if the 'aName' is not + a valid name. + */ + IMPORT_C static TInt SetPtr(const TDesC8& aName, TAny* const aPtr); + + /** + Get pointer from internal array e.g. + + @code + DTvOut* tvout = static_cast( GApe::GetPtr( KTvOut ) ); + if ( tvout ) + { + // Usage... + } + @endcode + + @param aName Name of the registered pointer + + @return Pointer to requested item. May also return NULL, which + indicates that the pointer is not registered or the name + is not valid. + */ + IMPORT_C static TAny* GetPtr(const TDesC8& aName); + + private: + /** + Defined as a private to prevent clients to create own instances + from this class. + */ + GApe(); + + /** + Defined as a private to prevent clients to delete the instance of + this class. + */ + ~GApe(); + + private: + /** Array where the registered pointers are stored */ + TAny* iPtrArray[ KPtrArraySize ]; + + /** Internal instance to allow static methods to access instance + data. */ + static GApe* GApePtr; + }; + +// Global Function Prototypes + +// Inline Functions + +// Namespace + +#endif // __GAPE_H__ + +// End of File diff -r 000000000000 -r bb4b476bbb96 Haptics/haptics_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Haptics/haptics_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,47 @@ +/* + haptics_chipset_api.h + + Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +#ifndef HAPTICS_CHIPSET_API_H +#define HAPTICS_CHIPSET_API_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* Each OMX header must include all required header files to allow the + * header to compile without errors. The includes below are required + * for this header file to compile successfully + */ + +#include + +typedef struct OMX_AUDIO_PARAM_HAPTICSDRIVERPROPERTIESTYPE + { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nNativeSamplingRate; + OMX_U32 nHapticsDriverNominalVoltage; + OMX_U32 nHapticsDriverImpedance; + } OMX_AUDIO_PARAM_HAPTICSDRIVERPROPERTIESTYPE; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif \ No newline at end of file diff -r 000000000000 -r bb4b476bbb96 Idle Timers/idletimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Idle Timers/idletimer.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,196 @@ +/* + idletimer.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ +// Description +// + +#ifndef IDLETIMER_H +#define IDLETIMER_H + +#include + +/** +@file API for Idle Timers +@publishedPartner +@prototype +*/ + +/** +@publishedPartner +@prototype + +Idle Timer class. These are a timers which allow the client to specify a window in which +the timer should queue a Dfc. The implementation aligns multiple timers to allow the device +to spend longer periods in low power modes, thus saving power. + */ +NONSHARABLE_CLASS(TIdleTimer) + { +public: + static const TInt KNoTimeout = -1; + + enum TFault + { + + /** + This fault is raised from TIdleTimer::SetDfcQ if an attempt is made to set the Dfc + queue for an Idle Timer where one has already been set. + */ + EDfcQueAlreadySet = 0, + + /** + This fault is raised from TIdleTimer::SetFunciton if an attempt is made to change + the function the Dfc callback should call whilst either a OneShot or Periodic + request is outstanding on the Idle Timer. + */ + ESetFunctionCalledOnPendingTimer = 1, + + /** + This fault is raised if either TIdleTimer::OneShot or TIdleTimer::Periodic is + called but no Dfc queue has been set for the Idle Timer. + */ + ENoDfcQSet = 2 + }; + +public: + /** Idle Timer constructor + + @param aFunction, function to call on completion of the timer + @param aPtr, parameter to be passed to function callback + @param aPriority, priority of DFC within the queue (0 to 7, where 7 is highest) + */ + IMPORT_C TIdleTimer(TDfcFn aFunction, TAny* aPtr, TInt aPriority); + + /** Idle Timer constructor + + @param aFunction, function to call on completion of the timer + @param aPtr, parameter to be passed to function callback + @param aDfcQ, pointer to a DFC queue on which this Idle Timer should queue + the DFC callback on timer completion. + @param aPriority, priority of DFC within the queue (0 to 7, where 7 is highest) + */ + IMPORT_C TIdleTimer(TDfcFn aFunction, TAny* aPtr, TDfcQue* aDfcQ, TInt aPriority); + + /** Set the Dfc queue on which this Idle Timer should make its Dfc callback on + completion of the timer. + + A Dfc queue must be set either with this function or from the TIdleTimer + constructor before the Idle Timer can be used – not doing so will fault the + kernel when the Idle Timer is scheduled. + + This function should only be used in the initialization of the Idle Timer, + when it has not previously had a Dfc queue set. This function does not move + the Idle Timer from one queue to another –attempting to do so will fault the kernel. + + @param aDfcQ, pointer to a DFC queue on which this Idle Timer should queue + the DFC callback on timer completion. + */ + IMPORT_C void SetDfcQ(TDfcQue* aDfcQ); + + /** Sets the function to be run when the Idle Timer is completed. This function + may only be called when the Idle Timer is not queued - attempting otherwise will + fault the kernel. + + @param aDfcFn, The function called when the TIdleTimer expires + */ + IMPORT_C void SetFunction(TDfcFn aDfcFn); + + /** Starts a one-shot Idle Timer + + The timer will queue a Dfc callback at a time (in nanokernel ticks) between aTime + and aMaxTime after this function is called. The callback will be made to the previously + set DfcFn on the requested DfcQue. + + If the default value of KNoTimeout is specified for aMaxTime the Idle Timer will + have no upper bound on when to schedule the DFC callback. As such, if the device was + idle at the time aTime number of ticks after the OneShot request was made, the + Idle Timer will not be completed (i.e. the Dfc callback will not be queued) until the next + occasion the device comes out of idle. + + @param aTime the minimum number of nanokernel ticks after which the Dfc callback + is to be be queued. + @param aMaxTime the maximum number of nanokernel ticks before which the Dfc + callback must be queued. + @return KErrNone if no error, KErrInUse if timer is already active, KErrArgument if + aMaxTime is neither greater than aMinTime nor equal to TIdleTimer::KNoTimeout + + @pre No fast mutex can be held. + @pre Kernel must be unlocked. + @pre Call in a thread context. + @pre Interrupts must be enabled. + + @see NKern::TimerTicks() + */ + IMPORT_C TInt OneShot(TInt aTime, TInt aMaxTime = KNoTimeout); + + /** Starts a periodic Idle Timer + + The timer will queue a DFC callback at a time (in nanokernel ticks) between aTime and aMaxTime + after this function is called, and then at successive intervals somewhere between aTime + and aMaxTime after the previous queuing. The callback will be made to the previously set + DfcFn on the requested DfcQue. Since the callback is queued automatically, the Idle Timer + must be explicitly cancelled after Periodic is called on it before it can safely go out of scope. + + If the default value of KNoTimeout is specified for aMaxTime, the Idle Timer will have no + maximum timeout each cycle. In this case, if the device was idle at the minimum expiry time + (aTime + time of previous expiry) queuing of the Dfc will not occur until the next time the + device comes out of idle. + + @param aTime – the minimum number of nanokernel ticks from the previous completion + after which the Dfc callback is to be queued. + @param aMaxTime – the maximum number of nanokernel ticks after the previous + completion before which the Dfc callback must be queued. + @return KErrNone if no error, KErrInUse if timer is already active, KErrArgument if + aMaxTime is neither greater than aMinTime nor equal to TIdleTimer::KNoTimeout + + @pre No fast mutex can be held. + @pre Kernel must be unlocked. + @pre Call in a thread context. + @pre Interrupts must be enabled. + + @see NKern::TimerTicks() + */ + IMPORT_C TInt Periodic(TInt aTime, TInt aMaxTime = KNoTimeout); + + /** Cancels an Idle Timer + + This function does nothing if the Idle Timer is not scheduled. + + Note that the implementation of this function is such that, if Cancel is called from a + thread (i.e. DFC queue) other than the one that the callback is to be made on… + • if the callback has started, Cancel will block until the callback has finished + • if the callback hasn’t started, Cancel will ensure that it won’t run after Cancel + has returned + In order to do this, if called from a different thread, the Cancel function blocks the calling + thread on a semaphore until the DFC queue thread used for the callback eventually signals it. + Given this, if the callback function somehow reciprocally blocks on the thread that is calling + Cancel, a deadlock could occur. It is up to the client to ensure this doesn’t happen. + + To re-iterate - the deadlock scenario described above is only a possibility if Cancel is called + from a different thread (i.e. DFC queue) than that in which the callback is made. If Cancel + is called from the same thread then there’s nothing to worry about in this respect. + + @pre No fast mutex can be held. + @pre Kernel must be unlocked. + @pre Call in a thread context. + @pre Interrupts must be enabled. + */ + IMPORT_C void Cancel(); + +private: + TInt iData[20]; //Reserved space for implementation + }; + +#endif //IDLETIMER_H diff -r 000000000000 -r bb4b476bbb96 Intersystem Tranceiver/mmuxtrxif.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Intersystem Tranceiver/mmuxtrxif.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,94 @@ +/* + mmuxtrxif.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @mmuxtrxif.h +@brief Abstract interface class. Part of IST API. +@publishedDeviceAbstraction +*/ + +#ifndef __MMUXTRXIF_H__ +#define __MMUXTRXIF_H__ + +// Include files +#include // For TInt +#include // For TDes8 + +// Macros +/* +A equals to asserted value b equals unique identifier of transceiver and c equals to TTransceiverFault codes. +*/ +#define TRX_ASSERT_FAULT_MACRO( a, b, c ) if( !( a ) ){ Kern::Fault( "mmuxtrxif:", ( ( TUint32 ) ( ( TUint32 ) b | ( TUint32 ) c << 16 ) ) ); } + +/** +@brief Abstract interface class to use transceiver services. + +Interface implemented by transceiver and used from multiplexer. + +Class is used to transmit data from multiplexer to transceiver. +*/ +class MMuxTrxIf + { + + public: + + /** + Data transmission priorities. + */ + enum TDataTransmitPriority + { + EPriorityNormal = 5, + EPriorityHigh = 10, + }; + + /** + Interface functions fault values. + */ + enum TTransceiverFault + { + ENotThreadContext = 1, + ETransmissionFailed, + }; + + /** + Transmits data from multiplexer to transceiver. + Transceiver is responsible of transmitting the data over the interconnection. + If data is needed to be queued, data with highest priority shall be transmitted first over the interconnection. + Transmission over the interconnection shall be done in reliable and ordered manner. + Transceiver is responsible of deallocating the data block after transmission with MTrxMuxIf::DeallocateBlock. + Transceiver is recommended to transmit data over the interconnection in its own thread context to avoid blocking calling thread for too long. + If not called in kernel thread context fault ENotThreadContext thrown with TRX_ASSERT_FAULT_MACRO. + If data transmission reliability or ordering failed fault ETransmissionFailed thrown with TRX_ASSERT_FAULT_MACRO. + Execution: Synchronous + Re-entrant: No + Can block: Yes + Panic mode: Kern::Fault + Memory allocation: No + Execution time: Quick + SMP safe: Yes + @param aData data to be transmitted + @param aPriority priority of the data to be transmitted + @param aMuxingHeader multiplexing protocol header formulated by multiplexer + @return void + @pre Called always in kernel thread context + @pre No fastmutex held + @post Calling thread not blocked + */ + virtual void Transmit( TDes8& aData, const TDataTransmitPriority aPriority, const TUint32 aMuxingHeader ) = 0; + + }; + +#endif // __MMUXTRXIF_H__ diff -r 000000000000 -r bb4b476bbb96 Intersystem Tranceiver/mtrxmuxif.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Intersystem Tranceiver/mtrxmuxif.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,183 @@ +/* + mtrxmuxif.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @mtrxmuxif.h +@brief Abstract interface class. Part of IST API. +@publishedDeviceAbstraction +*/ + +#ifndef __MTRXMUXIF_H__ +#define __MTRXMUXIF_H__ + +// Include files +#include // For TInt +#include // For TDes8 + +// Macros +/* +A equals to asserted value and b equals to TMultiplexerFault codes. +*/ +#define MUX_ASSERT_FAULT_MACRO( a, b ) if( !( a ) ){ Kern::Fault("mtrxmuxif:", b ); } + +// Forward declarations +class MMuxTrxIf; + +/** +@brief Abstract interface class to use multiplexer services. + +Interface implemented by multiplexer and used from transceiver. + +Class is used for registering and unregistering transceiver to multiplexer. +Class is used for receiving data from transceiver to multiplexer. +Class is used for deallocating over the interconnection transmitted datas memory block. +*/ +class MTrxMuxIf + { + + public: + + /** + Interface functions fault values. + */ + enum TMultiplexerFault + { + ENotKernelThreadContext = 1, + ENullTrxPointer, + EInvalidTrxId, + ETrxAlreadyRegistered, + ETrxNotRegistered, + EInvalidMuxingHeader, + EInvalidSize, + }; + + /** + Allocates a memory block for data receiving over the interconnection. + Blocks descriptor length is set to zero, but maximum length can be bigger + than size given as parameter (it depends on memory block configurations). + Memory content of the descriptor is filled with zeros until maximum length. + Memory allocated for the block is physically contigous and non cached. + Note! Transceiver shall register before with MTrxMuxIf::Register. + Note! Transceiver shall transfer the data block to multiplexer before with MTrxMuxIf::Receive. + If not called in kernel thread context fault ENotKernelThreadContext thrown with MUX_ASSERT_FAULT_MACRO. + If size is zero, fault EInvalidSize thrown with MUX_ASSERT_FAULT_MACRO. + Execution: Synchronous + Re-entrant: No + Can block: Yes + Panic mode: Kern::Fault + Memory allocation: No + Execution time: Quick + SMP safe: Yes + @param aSize 16-bit minimum size of the needed data block + @return reference to allocated block + @pre Called always in kernel thread context + @pre No fastmutex held + @post Calling thread not blocked + */ + virtual TDes8& AllocateBlock( const TUint16 aSize ) = 0; + + /** + Deallocates a memory block transmitted over the interconnection. + Note! Transceiver shall register before with MTrxMuxIf::Register. + Note! Transceiver shall receive the block before with MMuxTrxIf::Transmit. + If not called in kernel thread context fault ENotKernelThreadContext thrown with MUX_ASSERT_FAULT_MACRO. + Execution: Synchronous + Re-entrant: No + Can block: Yes + Panic mode: Kern::Fault + Memory allocation: No + Execution time: Quick + SMP safe: Yes + @param aBlock reference to block to be deallocated + @return void + @pre Called always in kernel thread context + @pre No fastmutex held + @post Calling thread not blocked + */ + virtual void DeallocateBlock( TDes8& aBlock ) = 0; + + /** + Transfers data received over the interconnection from transceiver to multiplexer. + Transceiver is responsible of allocating the data block and giving correct 32-bit multiplexing protocol header. + Multiplexer is responsible of multiplexing and deallocating the transferred data block. + Note! Transceiver shall register before with MTrxMuxIf::Register. + Note! Transceiver shall allocate the block before with MTrxMuxIf::AllocateBlock. + If not called in kernel thread context fault ENotKernelThreadContext thrown with MUX_ASSERT_FAULT_MACRO. + If invalid multiplexing protocol header fault EInvalidMuxingHeader thrown with MUX_ASSERT_FAULT_MACRO. + If invalid lenght either in data or in multiplexing protocol header fault EInvalidSize thrown with MUX_ASSERT_FAULT_MACRO. + Execution: Synchronous + Re-entrant: No + Can block: Yes + Panic mode: Kern::Fault + Memory allocation: No + Execution time: Quick + SMP safe: Yes + @param aData reference to received data + @param aMuxingHeader multiplexing protocol header formulated by other systems multiplexer + @return void + @pre Called always in kernel thread context + @pre No fastmutex held + @post Calling thread not blocked + */ + virtual void Receive( TDes8& aData, const TUint32 aMuxingHeader ) = 0; + + /** + Registers a transceiver to multiplexer and returns an interface to it. + Transceiver shall call this function when interconnection to other system becomes functional. + Note! Multiplexer shall be initialized before. + If not called in kernel thread context fault ENotKernelThreadContext thrown with MUX_ASSERT_FAULT_MACRO. + If aTrx is NULL fault ENullTrxPointer thrown with MUX_ASSERT_FAULT_MACRO. + If aTrxId is invalid fault EInvalidTrxId thrown with MUX_ASSERT_FAULT_MACRO. + If transceiver is already registered fault ETrxAlreadyRegistered thrown with MUX_ASSERT_FAULT_MACRO. + Execution: Synchronous + Re-entrant: No + Can block: Yes + Panic mode: Kern::Fault + Memory allocation: Yes + Execution time: Quick + SMP safe: Yes + @param aTrx, pointer to transceiver + @param aTrxId, transceiver unique identifier (from trxdefs.h) + @return pointer to multiplexer interface + @pre Called always in kernel thread context + @pre No fastmutex held + @post Calling thread not blocked + */ + IMPORT_C static MTrxMuxIf* Register( MMuxTrxIf* aTrx, const TUint8 aTrxId ); + + /** + Unregisters transceiver + Transceiver shall call this function when interconnection to other system becomes non-functional. + Note! Transceiver shall register before with MTrxMuxIf::Register. + If not called in kernel thread context fault ENotKernelThreadContext thrown with MUX_ASSERT_FAULT_MACRO. + If transceiver is not registered fault ETrxNotRegistered thrown with MUX_ASSERT_FAULT_MACRO. + Execution: Synchronous + Re-entrant: No + Can block: Yes + Panic mode: Kern::Fault + Memory allocation: No + Execution time: Quick + SMP safe: Yes + @return void + @pre Called always in kernel thread context + @pre No fastmutex held + @post Calling thread not blocked + */ + virtual void Unregister() = 0; + + }; + +#endif // __MTRXMUXIF_H__ diff -r 000000000000 -r bb4b476bbb96 Intersystem Tranceiver/trxdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Intersystem Tranceiver/trxdefs.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,41 @@ +/* + trxdefs.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @trxdefs.h +@brief Unique identifiers of transceivers. Part of IST API. +@publishedDeviceAbstraction +*/ + +#ifndef __TRXDEFS_H__ +#define __TRXDEFS_H__ + +// Enumerations + +/** +Unique identifiers for each transceiver. +*/ +enum TTrxId + { + ETrxHSI = 0x00, + ETrxSharedMemory, + ETrxPartnerOS, + ETrxTest, // Only for testing purposes + ETrxTest2, // Only for testing purposes + EAmountOfTrxs, // Not used by transceivers + }; + +#endif /* __TRXDEFS_H__ */ diff -r 000000000000 -r bb4b476bbb96 Keyboard/keyboard_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Keyboard/keyboard_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,156 @@ +/* + keyboard_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @file +@brief Keyboard Chipset API H + +This is the header file for Keyboard Chipset API that is used to access +the matrix keyboard and power key services provided by the third party chipset vendors. + +@publishedDeviceAbstraction +*/ + +#ifndef __KEYBOARD_CHIPSET_API_H__ +#define __KEYBOARD_CHIPSET_API_H__ + + +// Include files + +#include +#include + + +// Constants + + +// Macros + + +// Data types + +/** +This defines the type of a callback function which is called to +notify a new key event to the client. The callback function is +executed in the context of the calling thread. +*/ +typedef void (*TKeyboardEventCbFn)(); + +// Function prototypes + +// Forward declarations + +// Class declaration + +/** +This class defines the Chipset API that is used to access +the matrix keyboard service provided by the third party chipset vendors. +*/ +class KeyboardMatrix + { + public: + + /** + This function is used to do the necessary initialization with the given matrix size + so that the chipset is ready to provide the matrix keyboard service. It registers + a callback function which is called to notify a new key event. + + @param aSize The size of matrix keyboard that the client is using. + @param aCallback The callback function which is called to notify a new key event. + + @return Symbian OS system wide error code, and the followings are required: + KErrNone – the operation is successfully executed; + KErrGeneral – error condition; + + @pre Pre-condition, it should be called before the other methods in the class are used. + */ + IMPORT_C static TInt Init(TUint aSize, TKeyboardEventCbFn aCallback); + + /** + This function is used to enable the matrix keyboard service. + + @return Symbian OS system wide error code, and the followings are required: + KErrNone – the operation is successfully executed; + KErrGeneral – error condition; + + @pre Pre-condition, the matrix keyboard service has been initialized successfully. + */ + IMPORT_C static TInt Enable(); + + /** + This function is used to disable the matrix keyboard service. + + @return Symbian OS system wide error code, and the followings are required: + KErrNone – the operation is successfully executed; + KErrGeneral – error condition; + + @pre Pre-condition, the matrix keyboard service has been enabled. + */ + IMPORT_C static TInt Disable(); + + /** + This function is used to read the key state of the matrix keyboard. + + @param aKeys Reference to the number of keys that are currently pressed. + If the return value is 0 then it means all the previously pressed keys are released. + @param aBuffer Pointer to the buffer where all the key presses shall be reported. + + @return Symbian OS system wide error code, and the followings are required: + KErrNone – the operation is successfully executed; + KErrGeneral – error condition; + + @pre Pre-condition, the matrix keyboard service has been enabled. + */ + IMPORT_C static TInt Read(TInt& aKeys, TInt* aBuffer); + + }; + + +/** +This class defines the Chipset API that is used to access +the power key service provided by the third party chipset vendors. +*/ +class KeyboardPowerKey + { + public: + + /** + This function is used to do the necessary initialization so that + the chipset is ready to provide the power key service. It registers + a callback function which is called to notify a new power key event. + + @param aCallback The callback function which is called to notify a new power key event. + + @return Symbian OS system wide error code, and the followings are required: + KErrNone – the operation is successfully executed; + KErrGeneral – error condition; + */ + IMPORT_C static TInt Init(TKeyboardEventCbFn aCallback); + + /** + This function is used to read the key state of the power key. + + @param aState Reference to the variable that contains the power key state. + + @return Symbian OS system wide error code, and the followings are required: + KErrNone – the operation is successfully executed; + KErrGeneral – error condition; + */ + IMPORT_C static TInt Read(TRawEvent::TType& aState); + + }; + +#endif // __KEYBOARD_CHIPSET_API_H__ diff -r 000000000000 -r bb4b476bbb96 Light/light_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Light/light_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,120 @@ +/* + light_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @file +@brief Light Chipset API H + +This is the header file for Light Chipset API that is used to access +the light service provided by the third party chipset vendor. + +@publishedDeviceAbstraction +*/ + +#ifndef __LIGHT_CHIPSET_API_H__ +#define __LIGHT_CHIPSET_API_H__ + +// Include files + +#include + + +// Constants + + +// Macros + + +// Data types + + +// Function prototypes + + +// Class declaration + +/** +This class defines the Chipset API that is used to access +the light service provided by the third party chipset vendor. +*/ +class LightService + { + public: + + /** + This method is used to do all the necessary initialization so + that the chipset is ready to provide the light service. + + @return Symbian OS system wide error code, and the followings are required: + KErrNone – the operation is successfully executed + KErrGeneral – error condition + KErrAlreadyExists – if trying to initialize twice + + @pre Pre-condition, it should be called first before the other methods of this class are used + */ + IMPORT_C static TInt Init(); + + /** + This function is used to set the specified output to the desired intensity. + + @param aOutputId The identity of the output line that shall be controlled + @param aIntensity The desired intensity of the light with range 0 – 10000 [1/100%] + + @return Symbian OS system wide error code, and the followings are required: + KErrNone – the operation is successfully executed + KErrGeneral – error condition + KErrNotReady –if trying to access uninitialized device + KErrNotSupported – if the feature is not supported by the HW + + @pre Pre-condition, the method Init() has been executed successfully + */ + IMPORT_C static TInt SetIntensity(TUint aOutputId, TUint16 aIntensity); + + /** + This function is used to set the specified output to the desired current. + + @param aOutputId The identity of the output line that shall be controlled + @param aCurrent The driving current from 0 to the maximum current available from the chipset [1/10 mA] (range 0.0 to 6553.5mA) + + @return Symbian OS system wide error code, and the followings are required: + KErrNone – the operation is successfully executed + KErrGeneral – error condition + KErrNotReady – if trying to access uninitialized device + KErrNotSupported – if the feature is not supported by the HW + + @pre Pre-condition, the method Init() has been executed successfully + */ + IMPORT_C static TInt SetCurrent(TUint aOutputId, TUint16 aCurrent); + + /** + This function is used to set the specified output to the desired PWM frequency. + + @param aOutputId The identity of the output line that shall be controlled + @param aFrequency The PWM frequency from 0 to the maximum frequency available from the chipset (range 0 to 65535Hz) + + @return Symbian OS system wide error code, and the followings are required: + KErrNone – the operation is successfully executed + KErrGeneral – error condition + KErrNotReady – if trying to access uninitialized device + KErrNotSupported – if the feature is not supported by the HW + + @pre Pre-condition, the method Init() has been executed successfully + */ + IMPORT_C static TInt SetFrequency(TUint aOutputId, TUint16 aFrequency); + + }; + +#endif // __LIGHT_CHIPSET_API_H__ diff -r 000000000000 -r bb4b476bbb96 Memory Card/s60_memcard_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Memory Card/s60_memcard_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,512 @@ +/* + s60_memcard_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @file +@brief Memcard Chipset API H + + Abstract and functional description + + 3rd party Chipset API Specification for low level memory card driver + + Specification/design references + + Memory Card Chipset API Specification.doc +*/ + +/** + * defgroup csapi Chipset API + * Chipset API Documentation + */ + +#ifndef MEMCARD_CHIPSET_API_H +#define MEMCARD_CHIPSET_API_H + +/* Informative list of headers which are directly used by the present header + * and hence assumed to be included by the .c module before the present header + * global.h + * type_def.h + */ + +/* --------------------------------------------------------------------------- + * + * CONSTANTS + * + */ + +/** + * @brief + * Memory card ID. + * + * @details + * Logical ID for memory card. + * + * @see link + */ +typedef enum hal_memcard_card + { + HAL_MEMCARD_CARD0, /**< Memory card 0 */ + HAL_MEMCARD_CARD1, /**< Memory card 1 */ + HAL_MEMCARD_CARD2, /**< Memory card 2 */ + HAL_MEMCARD_CARD3, /**< Memory card 3 */ + HAL_MEMCARD_NONE /**< Memory card 4 */ + } HAL_MEMCARD_CARD; + +/** + * @brief + * Memory card chipset API return values. + * + * @details + * Memory card chipset API return values. + * + * @see link + */ +typedef enum hal_memcard_return + { + HAL_MEMCARD_FAIL = 0, /**< Operation failed */ + HAL_MEMCARD_OK = 1, /**< Operation succeeded */ + HAL_MEMCARD_DMA_ALLOC_FAIL = 2, /**< DMA channel allocation failed */ + HAL_MEMCARD_DMA_TRANSFER_FAIL = 3, /**< DMA transfer failed */ + HAL_MEMCARD_CARD_STATUS_ERROR = 4, /**< A non-masked error bit was set in the card status */ + HAL_MEMCARD_CMD_TIMEOUT = 5, /**< Command timeout occured */ + HAL_MEMCARD_DATA_TIMEOUT = 6, /**< Data timeout occured */ + HAL_MEMCARD_CMD_CRC_ERROR = 7, /**< Command CRC error occured */ + HAL_MEMCARD_DATA_CRC_ERROR = 8 /**< Data CRC error occured */ + } HAL_MEMCARD_RETURN; + +/** + * @brief + * Memory access operation. + * + * @details + * Memory access operation types (read/write) + * + * @see link + */ +typedef enum hal_memcard_operation + { + HAL_MEMCARD_READ = 0, /**< Read operation */ + HAL_MEMCARD_WRITE = 1 /**< Write operation */ + } HAL_MEMCARD_OPERATION; + +/** + * @brief + * Media change types. + * + * @details + * Memory card media change types. + * + * @see link + */ +typedef enum hal_memcard_media_change_event + { + HAL_MEMCARD_INSERTED = 0, /**< Memory card inserted */ + HAL_MEMCARD_REMOVED = 1 /**< Memory card removed */ + } HAL_MEMCARD_MEDIA_CHANGE_EVENT; + +/** + * @brief + * Media change callback definition + * + * @details + * - + * + * @see link + */ +typedef void (*hal_memcard_media_change_callback) (HAL_MEMCARD_MEDIA_CHANGE_EVENT mce, HAL_MEMCARD_CARD card); + +/** + * @brief + * Data (bus) width types + * + * @details + * Memory card bus widths (1/4/8-bits). + * + * @see link + */ +typedef enum hal_memcard_data_width + { + HAL_MEMCARD_DATA_WIDTH_1_BIT = 0, /**< 1-bit bus width */ + HAL_MEMCARD_DATA_WIDTH_4_BIT = 1, /**< 4-bit bus width */ + HAL_MEMCARD_DATA_WIDTH_8_BIT = 2 /**< 8-bit bus width */ + } HAL_MEMCARD_DATA_WIDTH; + +/** + * @brief + * Presence of the memory card + * + * @details + * Presence of the memory card. + * + * @see link + */ +typedef enum hal_memcard_presence_status + { + HAL_MEMCARD_CARD_IS_IN = 0, /**< Memory card is in */ + HAL_MEMCARD_CARD_IS_OUT = 1 /**< Memory card is out */ + } HAL_MEMCARD_PRESENCE_STATUS; + + +/** + * @brief + * Mode of data transfer + * + * @details + * Data transfer mode, DMA or not DMA (for example interrupt transfer). + * + * @see link + */ +typedef enum hal_memcard_data_transfer_mode + { + HAL_MEMCARD_DMA = 0, /**< Use DMA transfer */ + HAL_MEMCARD_NOT_DMA = 1 /**< Do not use DMA transfer */ + } HAL_MEMCARD_DATA_TRANSFER_MODE; + +/** + * @brief + * Memory card response type + * + * @details + * - + * + * @see link + */ +typedef enum hal_memcard_response_type +{ + HAL_MEMCARD_RESPONSE_NONE = 0x00000, /**< None */ + HAL_MEMCARD_RESPONSE_R1 = 0x00100, /**< R1 response */ + HAL_MEMCARD_RESPONSE_R1b = 0x00200, /**< R1b response */ + HAL_MEMCARD_RESPONSE_R2 = 0x00300, /**< R2 response */ + HAL_MEMCARD_RESPONSE_R3 = 0x00400, /**< R3 response */ + HAL_MEMCARD_RESPONSE_R4 = 0x00500, /**< R4 response */ + HAL_MEMCARD_RESPONSE_R5 = 0x00600, /**< R5 response */ + HAL_MEMCARD_RESPONSE_R6 = 0x00700, /**< R6 response */ + HAL_MEMCARD_RESPONSE_R7 = 0x00800, /**< R7 response */ + HAL_MEMCARD_RESPONSE_TYPE_MASK = 0x00f00 /**< Response type mask */ +} HAL_MEMCARD_RESPONSE_TYPE; + +/** + * @brief + * Memory card command type + * + * @details + * - + * + * @see link + */ +typedef enum hal_memcard_command_type +{ + HAL_MEMCARD_COMMAND_TYPE_BC = 0x00000, /**< BC */ + HAL_MEMCARD_COMMAND_TYPE_BCR = 0x01000, /**< BCR */ + HAL_MEMCARD_COMMAND_TYPE_AC = 0x02000, /**< AC */ + HAL_MEMCARD_COMMAND_TYPE_ADTC_WRITE = 0x03000, /**< ADTC write */ + HAL_MEMCARD_COMMAND_TYPE_ADTC_READ = 0x04000, /**< ADTC read */ + HAL_MEMCARD_COMMAND_TYPE_MASK = 0x07000 /**< Command type mask */ +} HAL_MEMCARD_COMMAND_TYPE; + +/** + * @brief + * Memory card type + * + * @details + * - + * + * @see link + */ +typedef enum hal_memcard_command_card_type +{ + HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON = 0x00000, /**< Common */ + HAL_MEMCARD_COMMAND_CARD_TYPE_MMC = 0x08000, /**< MMC card */ + HAL_MEMCARD_COMMAND_CARD_TYPE_SD = 0x10000, /**< SD card */ + HAL_MEMCARD_COMMAND_CARD_TYPE_MASK = 0x18000 /**< Card type mask */ +} HAL_MEMCARD_COMMAND_CARD_TYPE; + +/** + * @brief + * Memory card command type + * + * @details + * - + * + * @see link + */ +typedef enum hal_memcard_command_app_norm +{ + HAL_MEMCARD_COMMAND_NORMAL = 0x00000, /**< Normal */ + HAL_MEMCARD_COMMAND_APP = 0x20000, /**< Application command */ + HAL_MEMCARD_COMMAND_APP_NORM_MASK = 0x20000 /**< Mask */ +} HAL_MEMCARD_COMMAND_APP_NORM; + +/** + * @brief + * Memory card command index mask + * + * @details + * - + * + * @see link + */ +#define HAL_MEMCARD_COMMAND_INDEX_MASK 0x0003f + +/** + * @brief + * Memorycard commands + * + * @details + * Memory card command codes + * + * @see link + */ +typedef enum hal_memcard_command +{ + /* class 0 and class 1 */ + CMD0_GO_IDLE_STATE = 0 | HAL_MEMCARD_RESPONSE_NONE | HAL_MEMCARD_COMMAND_TYPE_BC | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD0 */ + CMD1_SEND_OP_COND = 1 | HAL_MEMCARD_RESPONSE_R3 | HAL_MEMCARD_COMMAND_TYPE_BCR | HAL_MEMCARD_COMMAND_CARD_TYPE_MMC | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD1 */ + CMD2_ALL_SEND_CID_MMC = 2 | HAL_MEMCARD_RESPONSE_R2 | HAL_MEMCARD_COMMAND_TYPE_BCR | HAL_MEMCARD_COMMAND_CARD_TYPE_MMC | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD2 */ + CMD2_ALL_SEND_CID_SD = 2 | HAL_MEMCARD_RESPONSE_R2 | HAL_MEMCARD_COMMAND_TYPE_BCR | HAL_MEMCARD_COMMAND_CARD_TYPE_SD | HAL_MEMCARD_COMMAND_NORMAL, + CMD3_SET_RELATIVE_ADDR = 3 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_MMC | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD3 */ + CMD3_SEND_RELATIVE_ADDR = 3 | HAL_MEMCARD_RESPONSE_R6 | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_SD | HAL_MEMCARD_COMMAND_NORMAL, + CMD4_SET_DSR = 4 | HAL_MEMCARD_RESPONSE_NONE | HAL_MEMCARD_COMMAND_TYPE_BC | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD4 */ + CMD5_SLEEP_AWAKE = 5 | HAL_MEMCARD_RESPONSE_R1b | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_MMC | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD5 */ + CMD6_SWITCH = 6 | HAL_MEMCARD_RESPONSE_R1b | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_MMC | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD6 */ + CMD6_SWITCH_FUNC = 6 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_ADTC_READ | HAL_MEMCARD_COMMAND_CARD_TYPE_SD | HAL_MEMCARD_COMMAND_NORMAL, + ACMD6_SET_BUS_WIDTH = 6 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_SD | HAL_MEMCARD_COMMAND_APP, + CMD7_SELECT_CARD = 7 | HAL_MEMCARD_RESPONSE_R1b | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD7 */ + CMD7_DESELECT_CARD = 7 | HAL_MEMCARD_RESPONSE_NONE | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, + CMD8_SEND_EXT_CSD = 8 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_ADTC_READ | HAL_MEMCARD_COMMAND_CARD_TYPE_MMC | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD8 */ + CMD8_SEND_IF_COND = 8 | HAL_MEMCARD_RESPONSE_R7 | HAL_MEMCARD_COMMAND_TYPE_BCR | HAL_MEMCARD_COMMAND_CARD_TYPE_SD | HAL_MEMCARD_COMMAND_NORMAL, + CMD9_SEND_CSD = 9 | HAL_MEMCARD_RESPONSE_R2 | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD9 */ + CMD10_SEND_CID = 10 | HAL_MEMCARD_RESPONSE_R2 | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD10 */ + CMD11_READ_DAT_UNTIL_STOP = 11 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_ADTC_READ | HAL_MEMCARD_COMMAND_CARD_TYPE_SD | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD11 */ + CMD12_STOP_TRANSMISSION = 12 | HAL_MEMCARD_RESPONSE_R1b | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD12 */ + CMD13_SEND_STATUS = 13 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD13 */ + ACMD13_SD_STATUS = 13 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_ADTC_READ | HAL_MEMCARD_COMMAND_CARD_TYPE_SD | HAL_MEMCARD_COMMAND_APP, + CMD14_BUSTEST_R = 14 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_ADTC_READ | HAL_MEMCARD_COMMAND_CARD_TYPE_MMC | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD14 */ + CMD15_GO_INACTIVE_STATE = 15 | HAL_MEMCARD_RESPONSE_NONE | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD15 */ + /* class 2 */ + CMD16_SET_BLOCKLEN = 16 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD16 */ + CMD17_READ_SINGLE_BLOCK = 17 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_ADTC_READ | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD17 */ + CMD18_READ_MULTIPLE_BLOCK = 18 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_ADTC_READ | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD18 */ + CMD19_BUS_TEST_W = 19 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_ADTC_WRITE | HAL_MEMCARD_COMMAND_CARD_TYPE_MMC | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD19 */ + /* class 3 */ + CMD20_WRITE_DAT_UNTIL_STOP = 20 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_ADTC_WRITE | HAL_MEMCARD_COMMAND_CARD_TYPE_MMC | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD20 */ + CMD21 = 21, /**< CMD21 */ + CMD22 = 22, /**< CMD22 */ + ACMD22_SEND_NUM_WR_BLOCKS = 22 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_SD | HAL_MEMCARD_COMMAND_APP, + /* class 4 */ + CMD23_SET_BLOCK_COUNT = 23 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_MMC | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD23 */ + ACMD23_SET_WR_BLK_ERASE_COUNT = 23 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_SD | HAL_MEMCARD_COMMAND_APP, + CMD24_WRITE_BLOCK = 24 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_ADTC_WRITE | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD24 */ + CMD25_WRITE_MULTIPLE_BLOCK = 25 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_ADTC_WRITE | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD25 */ + CMD26_PROGRAM_CID = 26 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_ADTC_WRITE | HAL_MEMCARD_COMMAND_CARD_TYPE_MMC | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD26 */ + CMD27_PROGRAM_CSD = 27 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_ADTC_WRITE | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD27 */ + /* class 6 */ + CMD28_SET_WRITE_PROT = 28 | HAL_MEMCARD_RESPONSE_R1b | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD28 */ + CMD29_CLR_WRITE_PROT = 29 | HAL_MEMCARD_RESPONSE_R1b | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD29 */ + CMD30_SEND_WRITE_PROT = 30 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_ADTC_READ | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD30 */ + CMD31 = 31, /**< CMD31 */ + /* class 5 */ + CMD32_ERASE_WR_BLK_START = 32 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_SD | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD32 */ + CMD33_ERASE_WR_BLK_END = 33 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_SD | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD33 */ + CMD34 = 34, /**< CMD34 */ + CMD35_ERASE_GROUP_START = 35 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_MMC | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD35 */ + CMD36_ERASE_GROUP_END = 36 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_MMC | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD36 */ + CMD37 = 37, /**< CMD37 */ + CMD38_ERASE = 38 | HAL_MEMCARD_RESPONSE_R1b | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD38 */ + /* class 9 */ + CMD39_FASTIO = 39 | HAL_MEMCARD_RESPONSE_R4 | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_MMC | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD39 */ + CMD40_GO_IRQSTATE = 40 | HAL_MEMCARD_RESPONSE_R5 | HAL_MEMCARD_COMMAND_TYPE_BCR | HAL_MEMCARD_COMMAND_CARD_TYPE_MMC | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD40 */ + CMD41 = 41, /**< CMD41 */ + ACMD41_SD_SEND_OP_COND = 41 | HAL_MEMCARD_RESPONSE_R3 | HAL_MEMCARD_COMMAND_TYPE_BCR | HAL_MEMCARD_COMMAND_CARD_TYPE_SD | HAL_MEMCARD_COMMAND_APP, + /* class 7 */ + CMD42_LOCK_UNLOCK = 42 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_ADTC_WRITE | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD42 */ + ACMD42_SET_CLR_CARD_DETECT = 42 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_SD | HAL_MEMCARD_COMMAND_APP, + CMD43 = 43, /**< CMD43 */ + CMD44 = 44, /**< CMD44 */ + CMD45 = 45, /**< CMD45 */ + CMD46 = 46, /**< CMD46 */ + CMD47 = 47, /**< CMD47 */ + CMD48 = 48, /**< CMD48 */ + CMD49 = 49, /**< CMD49 */ + CMD50 = 50, /**< CMD50 */ + CMD51 = 51, /**< CMD51 */ + ACMD51_SEND_SCR = 51 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_ADTC_READ | HAL_MEMCARD_COMMAND_CARD_TYPE_SD | HAL_MEMCARD_COMMAND_APP, + CMD52 = 52, /**< CMD52 */ + CMD53 = 53, /**< CMD53 */ + CMD54 = 54, /**< CMD54 */ + /* class 8 */ + CMD55_APP_CMD = 55 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_AC | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD55 */ + CMD56_GEN_CMD = 56 | HAL_MEMCARD_RESPONSE_R1 | HAL_MEMCARD_COMMAND_TYPE_ADTC_WRITE | HAL_MEMCARD_COMMAND_CARD_TYPE_COMMON | HAL_MEMCARD_COMMAND_NORMAL, /**< CMD56 */ + CMD57 = 57, /**< CMD57 */ + CMD58 = 58, /**< CMD58 */ + CMD59 = 59, /**< CMD59 */ + CMD60 = 60, /**< CMD60 */ + CMD61 = 61, /**< CMD61 */ + CMD62 = 62, /**< CMD62 */ + CMD63 = 63 /**< CMD63 */ +} HAL_MEMCARD_COMMAND; + + +/** + * @name Memorycard error/status types + * @{ + */ +#define HAL_MEMCARD_OUT_OF_RANGE 0x80000000 /**< The command’s address argument was out of the allowed range for this card */ +#define HAL_MEMCARD_ADDRESS_ERROR 0x40000000 /**< misaligned address which did not match the block length was used in the command. */ +#define HAL_MEMCARD_BLOCK_LEN_ERROR 0x20000000 /**< The transferred block length is not allowed for this card, or the number of transferred bytes does not match the block length. */ +#define HAL_MEMCARD_ERASE_SEQ_ERROR 0x10000000 /**< An error in the sequence of erase commands occurred. */ +#define HAL_MEMCARD_ERASE_PARAM 0x08000000 /**< An invalid selection of write-blocks for erase occurred. */ +#define HAL_MEMCARD_WP_VIOLATION 0x04000000 /**< Set when the host attempts to write to a protected block or to the temporary or permanent write protected card. */ +#define HAL_MEMCARD_CARD_IS_LOCKED 0x02000000 /**< When set, signals that the card is locked by the host */ +#define HAL_MEMCARD_LOCK_UNLOCK_FAILED 0x01000000 /**< Set when a sequence or password error has been detected in lock/unlock card command. */ +#define HAL_MEMCARD_COM_CRC_ERROR 0x00800000 /**< The CRC check of the previous command failed. */ +#define HAL_MEMCARD_ILLEGAL_COMMAND 0x00400000 /**< Command not legal for the card state */ +#define HAL_MEMCARD_CARD_ECC_FAILED 0x00200000 /**< Card internal ECC was applied but failed to correct the data. */ +#define HAL_MEMCARD_CC_ERROR 0x00100000 /**< Internal card controller error */ +#define HAL_MEMCARD_ERROR 0x00080000 /**< A general or an unknown error occurred during the operation. */ +#define HAL_MEMCARD_UNDERRUN 0x00040000 /**< The card could not sustain data transfer in stream read mode */ +#define HAL_MEMCARD_OVERRUN 0x00020000 /**< The card could not sustain data programming in stream write mode */ +#define HAL_MEMCARD_CIDCSD_OVERWRITE 0x00010000 /**< CID or CSD cannot be overwritten */ +#define HAL_MEMCARD_WP_ERASE_SKIP 0x00008000 /**< Only partial address space was erased due to existing write protected blocks. */ +#define HAL_MEMCARD_CARD_ECC_DISABLED 0x00004000 /**< The command has been executed without using the internal ECC. */ +#define HAL_MEMCARD_ERASE_RESET 0x00002000 /**< An erase sequence was cleared before executing because an out of erase sequence command was received */ +#define HAL_MEMCARD_CARD_STATE 0x00001E00 /**< The state of the card when receiving the command. */ +#define HAL_MEMCARD_CARD_READY_FOR_DATA 0x00000100 /**< Corresponds to buffer empty signaling on the bus */ +#define HAL_MEMCARD_APP_CMD 0x00000020 /**< The card will expect ACMD, or an indication that the command has been interpreted as ACMD */ +#define HAL_MEMCARD_SWITCH_ERROR 0x00000080 /**< If set, the card did not switch to the expected mode as requested by the SWITCH command */ +#define HAL_MEMCARD_AKE_SEQ_ERROR 0x00000008 /**< Error in the sequence of the authentication process */ +#define HAL_MEMCARD_NO_ERRORS 0 /**< No errors */ +/*@}*/ + +/* --------------------------------------------------------------------------- + * + * DATA TYPES + * + */ + +/* Configuration structure to 3rd party API */ +/** + * @brief + * Configuration structure to HAL layer. + * + * @details + * Main structure is HAL_MEMCARD_INIT_CONF which is passed to the low level + * memory card driver. This structure contains some HW related configuration data. + * + * @see link + */ +typedef struct hal_memcard_init_conf + { + /** How many times to try after fail, for instance sending commands */ + uint32 retries_after_fail; + } HAL_MEMCARD_INIT_CONF; + +/* Configuration structure from 3rd party API */ +/** + * @brief + * Configuration structure from HAL layer. + * + * @details + * Configuration structure from HAL layer. + * + * @see link + */ +typedef struct hal_memcard_hw_conf + { + /** + * Version of the chipset API implementation
+ * bits [31:24] API specification major version number.
+ * bits [23:16] API specification minor version number.
+ * bits [15:8] API implemention year. (2000 = 0, 2001 = 1, ...)
+ * bits [7:0] API implemention week.
+ * Example: API specification version 4.0, implementation w46 2008 => 0x0400082E + */ + uint32 api_version; + + /** Maximum block count which can be transferred at once */ + uint32 max_block_count; + + /** Maximum clock frequence in Hz supported by HW */ + uint32 max_clock_freq; + + /** Maximum data bus width supported by HW */ + uint16 max_data_width; + + /** Is high-speed mode supported by HW (supported=1, not supported=0) */ + uint8 hs_mode_supported; + + /** Is memory card removable (removable=1, not removable=0) */ + uint8 card_removable; + } HAL_MEMCARD_HW_CONF; + +/* --------------------------------------------------------------------------- + * + * FUNCTIONAL PROTOTYPES AND MACROS + * + */ + +HAL_MEMCARD_HW_CONF hal_memcard_get_hw_conf(HAL_MEMCARD_CARD card); + +HAL_MEMCARD_RETURN hal_memcard_init_data_transfer(HAL_MEMCARD_CARD card, + uint32 blocks, + uint32 block_size, + uint8* data, + void (*fp)(HAL_MEMCARD_RETURN result), + HAL_MEMCARD_OPERATION op, + HAL_MEMCARD_DATA_TRANSFER_MODE transfer_mode); + +HAL_MEMCARD_RETURN hal_memcard_power(HAL_MEMCARD_CARD card, + uint8 mode, + void (*fp)(HAL_MEMCARD_RETURN result)); + +HAL_MEMCARD_PRESENCE_STATUS hal_memcard_presence_status_get(HAL_MEMCARD_CARD card); + +HAL_MEMCARD_RETURN hal_memcard_send_init_seq(HAL_MEMCARD_CARD card); + +HAL_MEMCARD_RETURN hal_memcard_send_cmd(HAL_MEMCARD_CARD card, + HAL_MEMCARD_COMMAND cmd, + uint32 argument, + uint32 error_mask, + uint32* response); + +HAL_MEMCARD_RETURN hal_memcard_set_clk(HAL_MEMCARD_CARD card, + uint8 mode); + +HAL_MEMCARD_RETURN hal_memcard_set_clk_freq(HAL_MEMCARD_CARD card, + uint32 *freq); + +HAL_MEMCARD_RETURN hal_memcard_set_data_width(HAL_MEMCARD_CARD card, + HAL_MEMCARD_DATA_WIDTH width); + +HAL_MEMCARD_RETURN hal_memcard_set_dto(HAL_MEMCARD_CARD card, + uint32 time_out); + +HAL_MEMCARD_RETURN hal_memcard_standby(HAL_MEMCARD_CARD card, + uint8 mode); + +void hal_memcard_stop_data_transfer(HAL_MEMCARD_CARD card); + +HAL_MEMCARD_RETURN hal_memcard_register_conf(HAL_MEMCARD_CARD card, + HAL_MEMCARD_INIT_CONF* init_conf); + +HAL_MEMCARD_RETURN hal_memcard_register_mc_callback(hal_memcard_media_change_callback fp); + +HAL_MEMCARD_RETURN hal_memcard_reset_controller(HAL_MEMCARD_CARD card, + void (*fp)(HAL_MEMCARD_RETURN result)); + +#endif /* MEMCARD_CHIPSET_API_H */ + +/* End of Include File */ diff -r 000000000000 -r bb4b476bbb96 Muxed Mass Memory Control/mmmCtrl_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Muxed Mass Memory Control/mmmCtrl_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,106 @@ +/* + mmmCtrl_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @file +@brief mmm Ctrl Chipset API H + +This is the header file for Muxed Mass Memory Control chipset API. + +@publishedDeviceAbstraction +*/ + +#ifndef __MMM_CTRL_CHIPSET_API_H__ +#define __MMM_CTRL_CHIPSET_API_H__ + +#ifdef __cplusplus +extern "C" { + +#ifndef SYMOS_OAM +#define SYMOS_OAM +#endif + +#endif + +#if defined(SYMOS_OAM) /* do not use SYMOS_OAM -flag inside chipset API code */ +#define MMM_CTRL_SYMBIAN +#else + /* these definitions are for non symbian code */ +typedef unsigned long int TUint32; +typedef unsigned char TUint8; +typedef unsigned int TUint; +typedef signed int TInt; +typedef void TAny; +#endif + +/* Include files */ + + /* all the needed include files must be included by C or CPP -file */ + /* before this header file. */ + +/* Constants */ + + /* Parameter values for mmmCtrlStateSet */ +#define mmmCtrlDeviceOff 0x0000 +#define mmmCtrlBusControllerReset 0x0001 +#define mmmCtrlBusModeNormal 0x0002 + + /* return values for mmmCtrlLastErrorGet() -function */ +#define mmmCtrlErrorNone ((TUint32)mmmCtrlOk) + /* the rest of the error codes are defined by the vendor */ + /* to their own header file. */ + + /* Error return value for mmmCtrlIntPinGet() –function */ +#define mmmCtrlNonValid (-1) + + /* Error return value for mmmCtrlBaseAddressGet() –function */ +#define mmmCtrlInvalidAddress (TAny*)(-1) + +/* Macros */ + +/* Data types */ + +typedef enum + { + mmmCtrlOk = 0, /* status OK */ + mmmCtrlNotSupported, /* feature not supported */ + mmmCtrlDmaOnGoing, /* DMA started */ + mmmCtrlFail /* error has happened */ + } TmmmCtrlStatus; + +typedef enum + { + mmmCtrlVirtualAddress = 0, /* Virtual base address of device */ + mmmCtrlPhysicalAddress /* Physical base address of device */ + } TmmmCtrlAddress; + + /* Function prototypes */ +TmmmCtrlStatus mmmCtrlInit( void ); +TUint32 mmmCtrlVersionGet( void ); +TAny* mmmCtrlBaseAddressGet( TmmmCtrlAddress address ); +TmmmCtrlStatus mmmCtrlStateSet( TUint32 state ); +TInt mmmCtrlIntPinGet( void ); +TmmmCtrlStatus mmmCtrlMemCpy( TAny* target, TAny* source, TUint32 n, + void (*cb)(TmmmCtrlStatus) ); +TUint32 mmmCtrlLastErrorGet( void ); + +/* Class declaration */ + +#ifdef __cplusplus +} +#endif + +#endif /* __MMM_CTRL_CHIPSET_API_H__ */ diff -r 000000000000 -r bb4b476bbb96 TV Out/cec_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TV Out/cec_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,263 @@ +/* + cec_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** + + @mainpage + @section intro_sec Introduction + +

This is the tv chipset driver API document.

+

This API hides HW differencies from display (and other users) driver. + API is not kept as binary compatible.

+

Get API pointer: + API pointer (API_POINTER) will be found from Interface Storage. + DDC is found from interface storage with bus name DISP_BUS_CEC.

+

+ +*/ +/** @file + +Declaration of TV chipset driver API + +@publishedDeviceAbstraction +*/ + +#ifndef CEC_CHIPSET_API_H +#define CEC_CHIPSET_API_H + +/*- Include Files ----------------------------------------------------------*/ + +#include "display_chipset_os.h" /* OS specific header file, typedef etc. */ +#include "display_chipset_api.h" /* Fetch enumeration etc */ + +/*- Namespace ---------------------------------------------------------------*/ + +/*- Enumerations ------------------------------------------------------------*/ + +/** CEC logical addresses */ +typedef enum + { + DISP_CEC_TV = 0, + DISP_CEC_REC_DEV1 = 1, + DISP_CEC_REC_DEV2 = 2, + DISP_CEC_TUNER1 = 3, + DISP_CEC_PLAYBACK_DEV1 = 4, + DISP_CEC_AUDIO_SYSTEM = 5, + DISP_CEC_TUNER2 = 6, + DISP_CEC_TUNER3 = 7, + DISP_CEC_PLAYBACK_DEV2 = 8, + DISP_CEC_REC_DEV3 = 9, + DISP_CEC_TUNER4 = 10, /**< Since HDMI 1.3a */ + DISP_CEC_PLAYBACK_DEV3 = 11, /**< Since HDMI 1.3a */ + DISP_CEC_RESERVED1 = 12, /**< Reserved until specified */ + DISP_CEC_RESERVED2 = 13, /**< Reserved until specified */ + DISP_CEC_FREE_USE = 14, + DISP_CEC_UNREG_BROADCAST = 15, /**< Unregistered=As initiator address, Broadcast=As destination address */ + } DISPE_CEC_LOGICAL_ADDR; + +/** Use case on bus - needed for protocol timing */ +typedef enum + { + DISP_CEC_UNKNOWN = 0, + DISP_CEC_NEW_INITIATOR = 1, /**< New initiator wants to send a frame */ + DISP_CEC_SAME_INITIATOR = 2, /**< Present initiator wants to send another frame immediately after its previous frame */ + } DISPE_CEC_SEND_USE_CASE; + +/*- Data Structs ------------------------------------------------------------*/ + +/** +CEC header block +*/ +typedef struct + { + /** Initiator logical address */ + DISPE_CEC_LOGICAL_ADDR initiator; + /** Destination logical address */ + DISPE_CEC_LOGICAL_ADDR destination; + } DISPS_CEC_HEADER_BLOCK; + +/** +CEC data block +*/ +typedef struct + { + /** Information bits (data, opcode or address) */ + uint8 infoBits; + } DISPS_CEC_DATA_BLOCK; + +///Maximum amount of operands (max amount of blocks=16, 2 goes to header and opcode) +const uint32 KMaxCecOperands = 14; + +/** +CEC frame +@code +__________________________ __________________________ +| | | | +| DISPS_CEC_HEADER_BLOCK | | DISPS_CEC_DATA_BLOCK(n)| +| | | | +ŻŻŻŻŻŻŻŻŻŻŻŻ|ŻŻŻŻŻŻŻŻŻŻŻŻŻ ŻŻŻŻŻŻŻŻŻŻŻŻ|ŻŻŻŻŻŻŻŻŻŻŻŻŻ + `--------------------------´ + ____________|_____________ + | | + | DISPS_CEC_FRAME | + | | + ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ +@endcode +*/ +typedef struct + { + /** Message header */ + DISPS_CEC_HEADER_BLOCK cecHeader; + /** Message opcode (optional) */ + DISPS_CEC_DATA_BLOCK opcode; + /** Message operand(s) */ + DISPS_CEC_DATA_BLOCK operand[ KMaxCecOperands ]; + /** Describes how many blocks in this frame has to be sent. 0 is invalid, means start bit only. + 1 = cecHeader only, 2 = cecHeader+opcode, 3 = cecHeader+opcode+operand[0], and so on. + Blocks (cecHeader/opcode/operand) which are after this value, are undefined. */ + uint8 numOfBlocks; + /** Fill this for giving hint for driver (dispCecTransmit). + When reading, driver tries to fill this. */ + DISPE_CEC_SEND_USE_CASE useCase; + } DISPS_CEC_FRAME; + +/*- Constants ---------------------------------------------------------------*/ + +/** API version number. @see dispCecApiVersion(). + 1: First version */ +const uint32 KApiCecVersionNumber = 1; + +/*- Macros ------------------------------------------------------------------*/ + +/*- External Data -----------------------------------------------------------*/ + +/*- Variables ---------------------------------------------------------------*/ + +/*- Forward Declarations ----------------------------------------------------*/ + +/*- Functional Prototypes ---------------------------------------------------*/ + +/* VERSION -> */ + +/** Gets implemented chipset API version. Verify the return value to KApiCecVersionNumber. + @param api API interface pointer, fetched from dispGetInterface() + @see KApiCecVersionNumber + @return Implemented Tv chipset API version, KApiCecVersionNumber (should match to client version) */ +inline uint32 dispCecApiVersion(API_POINTER api); + +/* <- VERSION */ + + +/* CONTROL -> */ + +/** Sets device's own allocated logical address to driver. + + With this address, driver can detect message which is sent for this + particular device and act ACK-bit as specified. + + If for some reason, address is wanted set to undefined, DISP_CEC_TV can be used for + that. Therefore, with this method, DISP_CEC_TV=undefined=unallocated. + + @param api API interface pointer, fetched from dispGetInterface() + @param ownLogicalAddress Device's own allocated logical address + + @return an error code */ +inline DISPE_ERROR dispSetLogicalAddress(API_POINTER api, DISPE_CEC_LOGICAL_ADDR ownLogicalAddress); + +/** Transmits one frame to follower. + + Driver sends DISPS_CEC_FRAME blocks until numOfBlocks value is reached. + + Driver is responsible for taking care about timing issues, + for reaching minimum signal free times in separate use cases (DISPE_CEC_SEND_USE_CASE). + + When driver detectes an error while transferring, it tries re-transmit + specified max times, and after that rises error for client with callback. + + If dispSetLogicalAddress() is not called and initiator&destination addresses are equal, + then it is assumed that there is a logical address allocation ongoing. + If a free logical address is found, callbackWhenTransmitted returns DISP_ERROR_NACK (NACK). + + When iDestination==DISP_CEC_UNREG_BROADCAST (broadcast), driver detects that + and observing ACK-bit with this special way. + + @see dispSetLogicalAddress + @see dispCecRead + + @param api API interface pointer, fetched from dispGetInterface() + @param frame A CEC frame, which needs to be sent to follower + @param callbackWhenTransmitted Completed when sent or error. + Multiple (max 8) transmits can be pending at same time. + Frames will be sent in same order as received by client. + Always check callbackWhenTransmitted for getting reason for complete: + DISP_ERROR_NONE = Sent ok (no detected errors during transmit) + DISP_ERROR_NACK = Acknowledge error (NACK) + DISP_ERROR_DATA_LINES = If the initiator detects low impedance on the + CEC-line, when it is transmitting high impedance and + is not expecting a follower asserted bit. + + @return DISP_ERROR_NONE if success */ +inline DISPE_ERROR dispCecTransmit(API_POINTER api, const DISPS_CEC_FRAME* frame, DISPT_READY_CB callbackWhenTransmitted); + +/** Listening and reads all CEC traffic. + + When complete is ready, readFrame will contain data moved in CEC. + + If monitorAll is True, received message might not be sent for this + particular device, so all frames will be detected with this, + therefore method can be used for CEC-bus monitoring. Of course, + if this device is not the follower for a message, driver will not + acknowledge the data, except broadcast-messages. + + callbackWhenRead should always pending (when cable connected). + + If new frame is detected by driver while callbackWhenRead is not pending, + cec-driver caches (min 10 frames) the read data and calls callbackWhenRead + immediately after next dispCecRead() call. This way data should not be lost by API client. + + readFrame.numOfBlocks is filled correctly showing the number of valid received + blocks. + + Driver tries to fill DISPE_CEC_SEND_USE_CASE if possible, otherwise useCase=DISP_CEC_UNKNOWN. + + @param api API interface pointer, fetched from dispGetInterface() + @param readFrame Read frame when callbackWhenRead completed. + @param monitorAll True if Read method monitors all traffic on CEC, + even this device is not follower for message. + @param callbackWhenRead Will be completed when ready, if no errors, + then readFrame contains read values. + Check always callbackWhenRead. + Call with NULL-callback cancels all read operations + (and cec-driver calls pending callbacks). + + @return DISP_ERROR_NONE if success. + DISP_ERROR_NOT_IMPLEMENTED if monitorAll==True but Hw hasn't capability for that. + DISP_ERROR_INVALID_PARAMETER if readFrame has illegal value(s) (driver does not care about actual data) + DISP_ERROR_ALREADY_EXISTS if Read is already pending. + Any other error for rest of reasons. */ +inline DISPE_ERROR dispCecRead(API_POINTER api, DISPS_CEC_FRAME* readFrame, bool8 monitorAll, DISPT_READY_CB callbackWhenRead); + +/* <- CONTROL */ + +/*- Inline Functions --------------------------------------------------------*/ + +#include "cec_chipset_api.inl" + +#endif /* CEC_CHIPSET_API_H */ + +/* End of File */ + diff -r 000000000000 -r bb4b476bbb96 TV Out/cec_chipset_api.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TV Out/cec_chipset_api.inl Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,109 @@ +/* + cec_chipset_api.inl + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @file + +Inline methods of cec chipset driver API + +@publishedDeviceAbstraction +*/ + +/*- Include Files ----------------------------------------------------------*/ + +/*- Data Types --------------------------------------------------------------*/ + +/*- Enumerations ------------------------------------------------------------*/ + +/** Error codes */ +typedef enum + { + /* VERSION */ + DISP_FUNC_DISP_CEC_API_VERSION = 0, + + /* CONTROL */ + DISP_FUNC_DISP_SET_LOGICAL_ADDRESS, + DISP_FUNC_DISP_CEC_TRANSMIT, + DISP_FUNC_DISP_CEC_READ, + + /* Size of array */ + DISP_FUNC_CEC_SIZE_OF_ARRAY, + } DISPE_CEC_FUNCTIONS; + +/*- Data Structs ------------------------------------------------------------*/ + +/*- Constants ---------------------------------------------------------------*/ + +/*- Functions ---------------------------------------------------------------*/ + +/*== VERSION ================================================================*/ + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline uint32 dispCecApiVersion(API_POINTER api) + { + + typedef uint32 (*FUNC)(); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_CEC_API_VERSION ]; + return function(); + + } + +/*== CONTROL ================================================================*/ + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispSetLogicalAddress(API_POINTER api, DISPE_CEC_LOGICAL_ADDR ownLogicalAddress) + { + + typedef DISPE_ERROR (*FUNC)(DISPE_CEC_LOGICAL_ADDR ownLogicalAddress); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_SET_LOGICAL_ADDRESS ]; + return function( ownLogicalAddress ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispCecTransmit(API_POINTER api, const DISPS_CEC_FRAME* frame, DISPT_READY_CB callbackWhenTransmitted) + { + + typedef DISPE_ERROR (*FUNC)(const DISPS_CEC_FRAME* frame, DISPT_READY_CB callbackWhenTransmitted); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_CEC_TRANSMIT ]; + return function( frame, callbackWhenTransmitted ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispCecRead(API_POINTER api, DISPS_CEC_FRAME* readFrame, bool8 monitorAll, DISPT_READY_CB callbackWhenRead) + { + + typedef DISPE_ERROR (*FUNC)(DISPS_CEC_FRAME* readFrame, bool8 monitorAll, DISPT_READY_CB callbackWhenRead); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_CEC_READ ]; + return function( readFrame, monitorAll, callbackWhenRead ); + + } + +/* End of File */ + diff -r 000000000000 -r bb4b476bbb96 TV Out/ddc_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TV Out/ddc_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,116 @@ +/* + ddc_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** + + @mainpage + @section intro_sec Introduction + +

This is the tv chipset driver API document.

+

This API hides HW differencies from display (and other users) driver. + API is not kept as binary compatible.

+

Get API pointer: + API pointer (API_POINTER) will be found from Interface Storage. + DDC is found from interface storage with bus name DISP_BUS_DDC.

+

+ +*/ +/** @file + +Declaration of TV chipset driver API + +@publishedDeviceAbstraction +*/ + +#ifndef DDC_CHIPSET_API_H +#define DDC_CHIPSET_API_H + +/*- Include Files ----------------------------------------------------------*/ + +#include "display_chipset_os.h" /* OS specific header file, typedef etc. */ +#include "display_chipset_api.h" /* Fetch enumeration etc */ + +/*- Namespace ---------------------------------------------------------------*/ + +/*- Enumerations ------------------------------------------------------------*/ + +/*- Data Structs ------------------------------------------------------------*/ + +/*- Constants ---------------------------------------------------------------*/ + +/** One DDC segment size. See that EDID block size is just 128 bytes, + so base-EDID read might contain one EDID extension */ +const uint32 KSegmentSize = 256; + +/** One data block */ +typedef uint8 DISPA_DDC_DATA_BLOCK[ KSegmentSize ]; + +/** API version number. @see dispDdcApiVersion(). + 1: First version */ +const uint32 KApiDdcVersionNumber = 1; + +/*- Macros ------------------------------------------------------------------*/ + +/*- External Data -----------------------------------------------------------*/ + +/*- Variables ---------------------------------------------------------------*/ + +/*- Forward Declarations ----------------------------------------------------*/ + +/*- Functional Prototypes ---------------------------------------------------*/ + +/* VERSION -> */ + +/** Gets implemented chipset API version. Verify the return value to KApiDdcVersionNumber. + @param api API interface pointer, fetched from dispGetInterface() + @see KApiDdcVersionNumber + @return Implemented Tv chipset API version, KApiDdcVersionNumber (should match to client version) */ +inline uint32 dispDdcApiVersion(API_POINTER api); + +/* <- VERSION */ + + +/* ACCESS -> */ + +/** Starts DDC read from wanted port. + + Method reads one DISPA_DDC_DATA_BLOCK, and it size is double of one EDID block, + so the first EDID read might get base-EDID and first extension, if exists. + With variable size of DisplayID, method reads anyway whole size of DISPA_DDC_DATA_BLOCK, + even DisplayID section is smaller. + + @param api API interface pointer, fetched from dispGetInterface() + @param ddcPortAddress DDC port which needs to be read + @param blockNumber Datablock which needs to be read (parameter maps to segment-register 0x60) + @param dataBlock Method fills this with read values. Ensure that this data exists all the time, + be careful if local variable. + @param callbackWhenRead Will be called when ready, if no errors, then aDataBlock contains read values. + Call with NULL-callback cancels all read operations + (and ddc-driver calls pending callbacks). + @return an error code */ +inline DISPE_ERROR dispDdcRead(API_POINTER api, uint8 ddcPortAddress, uint32 blockNumber, DISPA_DDC_DATA_BLOCK* dataBlock, DISPT_READY_CB callbackWhenRead); + +/* <- ACCESS */ + +/*- Inline Functions --------------------------------------------------------*/ + +#include "ddc_chipset_api.inl" + +#endif /* DDC_CHIPSET_API_H */ + +/* End of File */ + diff -r 000000000000 -r bb4b476bbb96 TV Out/ddc_chipset_api.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TV Out/ddc_chipset_api.inl Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,83 @@ +/* + ddc_chipset_api.inl + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @file + +Inline methods of ddc chipset driver API + +@publishedDeviceAbstraction +*/ + +/*- Include Files ----------------------------------------------------------*/ + +/*- Data Types --------------------------------------------------------------*/ + +/*- Enumerations ------------------------------------------------------------*/ + +/** Error codes */ +typedef enum + { + /* VERSION */ + DISP_FUNC_DISP_DDC_API_VERSION = 0, + + /* ACCESS */ + DISP_FUNC_DISP_DDC_READ, + + /* Size of array */ + DISP_FUNC_DDC_SIZE_OF_ARRAY, + } DISPE_DDC_FUNCTIONS; + +/*- Data Structs ------------------------------------------------------------*/ + +/*- Constants ---------------------------------------------------------------*/ + +/*- Functions ---------------------------------------------------------------*/ + +/*== VERSION ================================================================*/ + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline uint32 dispDdcApiVersion(API_POINTER api) + { + + typedef uint32 (*FUNC)(); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_DDC_API_VERSION ]; + return function(); + + } + +/*== ACCESS =================================================================*/ + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispDdcRead(API_POINTER api, uint8 ddcPortAddress, uint32 blockNumber, + DISPA_DDC_DATA_BLOCK* dataBlock, DISPT_READY_CB callbackWhenRead) + { + + typedef DISPE_ERROR (*FUNC)(uint8 ddcPortAddress, uint32 blockNumber, + DISPA_DDC_DATA_BLOCK* dataBlock, DISPT_READY_CB callbackWhenRead); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_DDC_READ ]; + return function( ddcPortAddress, blockNumber, dataBlock, callbackWhenRead ); + + } + +/* End of File */ + diff -r 000000000000 -r bb4b476bbb96 TV Out/tv_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TV Out/tv_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,740 @@ +/* + tv_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** + + @mainpage + @section intro_sec Introduction + +

This is the tv chipset driver API document.

+

This API hides HW differencies from display (and other users) driver. + API is not kept as binary compatible.

+

Get API pointer: + API pointer (API_POINTER) will be found from Interface Storage. + CVBS is found with bus name DISP_BUS_CVBS and HDMI with DISP_BUS_HDMI

+

+ +*/ +/** @file + +Declaration of TV chipset driver API + +@publishedDeviceAbstraction +*/ + +#ifndef TV_CHIPSET_API_H +#define TV_CHIPSET_API_H + +/*- Include Files ----------------------------------------------------------*/ + +#include "display_chipset_os.h" /* OS specific header file, typedef etc. */ +#include "display_chipset_api.h" /* Fetch enumeration etc */ + +/*- Namespace ---------------------------------------------------------------*/ + +/*- Enumerations ------------------------------------------------------------*/ + +/** Pixel repetation bit masks for TSupportedHdmiDviMode::pixelRepeatBitMask */ +const uint32 KPixelRepeatOnce = 0; /**< No repetation, pixel sent once */ +const uint32 KPixelRepeat2Times = ( 1 << 0 ); +const uint32 KPixelRepeat3Times = ( 1 << 1 ); +const uint32 KPixelRepeat4Times = ( 1 << 2 ); +const uint32 KPixelRepeat5Times = ( 1 << 3 ); +const uint32 KPixelRepeat6Times = ( 1 << 4 ); +const uint32 KPixelRepeat7Times = ( 1 << 5 ); +const uint32 KPixelRepeat8Times = ( 1 << 6 ); +const uint32 KPixelRepeat9Times = ( 1 << 7 ); +const uint32 KPixelRepeat10Times = ( 1 << 8 ); +typedef enum + { + /** CEA mode, TCeaFixedMode */ + DISP_CEA = 0x00, + /** Dmt mode, TDmtFixedMode */ + DISP_DMT = 0x01, + } DISPE_STANDARD_MODE_TYPE; + +/** Television broadcast standard */ +typedef enum + { + DISP_UNDEF_SYSTEM = 0x0, /**< Invalid */ + DISP_NTSCJ = 0x1, + DISP_NTSCM = 0x2, + DISP_NTSC443 = 0x3, + DISP_SECAM = 0x4, + DISP_PAL60 = 0x5, + DISP_PALB = 0x6, + DISP_PALD = 0x7, + DISP_PALG = 0x8, + DISP_PALH = 0x9, + DISP_PALI = 0xA, + DISP_PALM = 0xB, + DISP_PALN = 0xC, + DISP_PALNC = 0xD, + } DISPE_TV_STANDARD; + +/** HDMI/DVI source type */ +typedef enum + { + DISP_SRC_TYPE_UNKN = 0x00, /**< Invalid */ + DISP_SRC_TYPE_DIG_STB = 0x01, + DISP_SRC_TYPE_DVD = 0x02, + DISP_SRC_TYPE_DVHS = 0x03, + DISP_SRC_TYPE_HDD_VIDEO = 0x04, + DISP_SRC_TYPE_DVC = 0x05, + DISP_SRC_TYPE_DSC = 0x06, + DISP_SRC_TYPE_VIDEO_CD = 0x07, + DISP_SRC_TYPE_GAME = 0x08, + DISP_SRC_TYPE_PC_GENERAL = 0x09, + } DISPE_HDMI_SOURCE_TYPE; + +/** Analog Protection System (APS) levels */ +typedef enum + { + DISP_ANALOG_PROTECTION_OFF = 0, /**< APS off */ + DISP_ANALOG_PROTECTION_AGC = ( 1 << 0 ),/**< Automatic Gain Control */ + DISP_ANALOG_PROTECTION_AGC_2CS = ( 1 << 1 ),/**< Automatic Gain Control + 2-line Color Stripe */ + DISP_ANALOG_PROTECTION_AGC_4CS = ( 1 << 2 ),/**< Automatic Gain Control + 4-line Color Stripe */ + } DISPE_ANALOG_PROTECTION_LEVELS; + +/** Copy Generation Management System - Analog (CGMS-A) levels. + In conflict case, highest bit value will be taken in use. + @see DISPE_CGMSA_CAPABILITIES */ +typedef enum + { + DISP_CGMSA_COPY_FREELY = 0x0,/**< Copying is allowed without restrictions */ + DISP_CGMSA_COPY_NO_MORE = 0x1,/**< Condition not to be used */ + DISP_CGMSA_COPY_ONCE = 0x2,/**< One generation of copies is allowed */ + DISP_CGMSA_COPY_NEVER = 0x3,/**< No copying is allowed */ + } DISPE_CGMSA_LEVELS; + +/** Copy Generation Management System - Analog (CGMS-A) capabilities + @see DISPE_CGMSA_LEVELS */ +typedef enum + { + DISP_CGMSA_IEC_61880 = ( 1 << 0 ),/**< IEC 61880 */ + DISP_CGMSA_ETSI_EN_300_294 = ( 1 << 1 ),/**< ETSI EN 300 294 */ + DISP_CGMSA_CEA_608 = ( 1 << 2 ),/**< CEA 608 B */ + } DISPE_CGMSA_CAPABILITIES; + +/** Type of executed selftest */ +typedef enum + { + DISP_CONTROLLER = 0x0, /**< Tests tv controller hw (inside source device), e.g. host<->controller busses. */ + DISP_CONNECTOR = 0x1, /**< Tests tv output connector, e.g. source<->HDMI-Tv */ + } DISPE_SELFTEST_TYPE; + +/*- Data Structs ------------------------------------------------------------*/ + +/* CONTROL ->>>>>> */ + +/** +Current tv-out mode resolutions and aspect ratios +*/ +typedef struct + { + /** Number of rows of frame (full rows) */ + uint32 linesPerFrame; + /** Number of rows of field, interlaced. Same as linesPerFrame if progressive */ + uint32 linesPerField; + /** Number of columns of frame */ + uint32 columns; + /** Pixel aspect ratio = pixelAspectNumerator/pixelAspectDenominator */ + uint32 pixelAspectNumerator; + /** @see pixelAspectNumerator */ + uint32 pixelAspectDenominator; + } DISPS_TV_RESOLUTION; + +/** The maximum length for the product name on TMDS bus */ +const uint32 KProductNameSize = 8; +/** The maximum length for the product description on TMDS bus */ +const uint32 KProductDescriptorsSize = 16; +/** +HDMI/DVI timings and settings. See detailed values of standard formats from OutputModes_X.xls +*/ +typedef struct + { + /** @see ceaModeSetInsteadOfDmtMode. This is 0 if no any fixed modes set. */ + uint32 fixedMode; + /** True=fixedMode is CEA mode. False=fixedMode is DMT mode. @see fixedMode */ + uint32 ceaModeSetInsteadOfDmtMode; + + /** True when HDCP is enabled on source output. False when HDCP disabled. @see dispCopyProtectionStatus()*/ + bool8 enableHdcp; + + /** Tv physical size in millimetres. Can be 0 if tvPhysicalImageAspectRatioNumerator is used. */ + uint32 tvPhysicalImageWidthMm; + /** @see tvPhysicalImageWidthMm */ + uint32 tvPhysicalImageHeightMm; + /** Tv physical aspect ratio. Can be NULL if tvPhysicalImageWidthMm is defined. Read from EDID. + AR=tvPhysicalImageAspectRatioNumerator/tvPhysicalImageAspectRatioDenominator */ + uint16 tvPhysicalImageAspectRatioNumerator; + /** @see tvPhysicalImageAspectRatioNumerator */ + uint16 tvPhysicalImageAspectRatioDenominator; + + /** Pixel clock. With CEA mode 1 and 59.94Hz this is 25175KHz */ + uint32 pixelClockKHz; + + /** Horizontal image width (resolution, columns). + With CEA mode 1 this is 640 */ + uint16 horizontalActivePixels; + /** Horizontal blanking time in pixels. Total HTime=horizontalActivePixels+horizontalBlankingPixels. + With CEA mode 1 this is 160. Presented always as in CEA-model. */ + uint16 horizontalBlankingPixels; + /** Vertical image height (resolution, lines). With CEA mode 1 this is 480 */ + uint16 verticalActiveLines; + /** Vertical blanking time in lines. Total VTime=verticalActiveLines+verticalBlankingLines. + With CEA mode 1 this is 45 */ + uint16 verticalBlankingLines; + + /** Horizontal pulse frontporch in pixels. With CEA mode 1 this is 16 */ + uint16 horizontalSyncOffsetPixels; + /** Horizontal pulse duration in pixels. With CEA mode 1 this is 96 */ + uint16 horizontalSyncPulseWidthPixels; + /** Horizontal border (decreases addressable area). With CEA mode 1 this is 0. */ + uint16 horizontalBorderPixels; + /** Vertical pulse frontporch in lines. Fixed point with 10x, 1=10. 1.5=15. + With CEA mode 1 this is 100 (actual value = 10). + Presented always as CEA-model handle porches. For example E1024x768i87HzRB this is 00 */ + uint16 verticalSyncOffsetLinesField1; + /** Vertical pulse duration in lines. With CEA mode 1 this is 2. + With E1024x768i87HzRB this is 4. */ + uint16 verticalSyncPulseWidthLinesField1; + /** Vertical border (decreases addressable area). With CEA mode 1 this is 0. */ + uint16 verticalBorderLinesField1; + /** @see verticalSyncOffsetLinesField1. With progressive mode, this is unused. + With E1024x768i87HzRB this is 10 (value 1). */ + uint16 verticalSyncOffsetLinesField2; + /** @see verticalSyncPulseWidthLinesField1. With progressive mode, this is unused. + With E1024x768i87HzRB this is 4. */ + uint16 verticalSyncPulseWidthLinesField2; + /** @see verticalBorderLinesField1. With progressive mode, this is unused. */ + uint16 verticalBorderLinesField2; + + /** Left border (decreases addressable area). With CEA mode 1 this is 0. */ + uint16 leftBorderPixels; + /** Right border (decreases addressable area). With CEA mode 1 this is 0. */ + uint16 rightBorderPixels; + + /** Horizontal sync polarity, false=Negative, true=Positive. + With CEA mode 1 this is false. */ + bool8 horizontalSyncPolarity; + /** Vertical sync polarity, false=Negative, true=Positive. + With CEA mode 1 this is false. */ + bool8 verticalSyncPolarity; + /** Wanted pixel repeat, can be used if mode supports. + Otherwise horisontal resolution can be increased also. + 0 when repeat is disabled. With CEA mode 1 this is 0. */ + uint8 pixelRepeat; + + /** True if overscan is enabled (if Tv supports underscan). False otherwise */ + bool8 underscanEnabled; + + /** Pixel aspect ratio (PAR) numerator. PAR=pixelAspectRatioNumerator/pixelAspectRatioDenominator. + With CEA mode 1 PAR=1/1. */ + uint8 pixelAspectRatioNumerator; + /** @see pixelAspectRatioNumerator */ + uint8 pixelAspectRatioDenominator; + + /** True=HDMI, False=DVI. */ + bool8 hdmiConnector; + + /** Tv color coordinates (read from EDID) */ + DISPS_COLOR_COORDINATES tvColorCoordinates; + + /** HDMI version what Tv supports. Version combination is tvHdmiVersion.tvHdmiRevision. + Zeroes if DVI. */ + uint8 tvHdmiVersion; + /** @see tvHdmiVersion */ + uint8 tvHdmiRevision; + + /** Product name which to be sent to Tv in "Source Product Infoframe". + Cell 0 contains first letter. All unused characters should be Null. */ + uint8 productName[ KProductNameSize ]; + /** Product Description which to be sent to Tv in "Source Product Infoframe". + Cell 0 contains first letter. All unused characters should be Null. */ + uint8 productDescription[ KProductDescriptorsSize ]; + /** Source type which to be sent to Tv in "Source Product Infoframe". */ + DISPE_HDMI_SOURCE_TYPE sourceType; + } DISPS_HDMI_SETTINGS; + +/** +Configure object for analogue TV-Out, such as CVBS +*/ +typedef struct + { + /** Analogue signal type */ + DISPE_TV_STANDARD tvSystem; + /** Set analog protection system */ + DISPE_ANALOG_PROTECTION_LEVELS analogProtection; + /** Set CGMS-A level */ + DISPE_CGMSA_LEVELS cgmsaLevel; + } DISPS_ANALOGUE_SETTINGS; + +/** +Configure object for TV-Out. Has all common between CVBS and HDMI and connector specific structs. +@code +__________________________ __________________________ +| | | | +| DISPS_HDMI_SETTINGS | |DISPS_ANALOGUE_SETTINGS | +| | | | +ŻŻŻŻŻŻŻŻŻŻŻŻ|ŻŻŻŻŻŻŻŻŻŻŻŻŻ ŻŻŻŻŻŻŻŻŻŻŻŻ|ŻŻŻŻŻŻŻŻŻŻŻŻŻ + `--------------------------´ + ____________|_____________ + | | + |DISPS_TV_CONFIG_SETTINGS| + | | + ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ +@endcode +*/ +typedef struct + { + /** True=Interlaced scanning, False=Progressive scanning. */ + bool8 interlaced; + /** Tv aspect ratio = imageRatioNumerator/imageRatioDenominator */ + uint8 imageRatioNumerator; + /** @see imageRatioNumerator */ + uint8 imageRatioDenominator; + /** True=flicker filter is enabled. False=disabled */ + bool8 flickerFilter; + /** True=autodetect. False=cable is detected outside of this driver. + Even True is set, Tv-out will not be enabled automatically, just cable detected. */ + bool8 autoDetection; + + /** Overscan in pixels. Set Left Top corner point. Zero when Tv supports overscan (0=underscan enabled) + This should be "point" to active image area. Cannot point out of active image area. + Cannot across with rightBottomCorner. And this allows overscan and position tuning. */ + uint16 leftTopCornerX; + uint16 leftTopCornerY; + /** Overscan in pixels. Set Right Bottom corner point. @see leftTopCornerX + If driver supports centralizing only, then this has to be same as leftTopCornerX. */ + uint16 rightBottomCornerX; + uint16 rightBottomCornerY; + + /** Settings for HDMI, used when DISPS_TV_CAPABILITIES::hdmiSettingsNeeded is true */ + DISPS_HDMI_SETTINGS hdmiSettings; + /** Settings for analog Tv, used when DISPS_TV_CAPABILITIES::hdmiSettingsNeeded is false */ + DISPS_ANALOGUE_SETTINGS analogueSettings; + + /** Parameter which will be given in callbacks (DISPT_READY_CB). This-pointer for example. */ + void* cbParameter; + + /** Tv updating method. True when dispTvFlush() is used, + False when Tv gets updating with other method (platform) */ + bool8 setBufferForTvInUsed; + } DISPS_TV_CONFIG_SETTINGS; + +/* <<<<<<- CONTROL */ + +/* CAPABILITY ->>>>>> */ + +/** +One mode struct for making capability query of own HW (phone capabilities). +*/ +typedef struct + { + /** Standard CEA or DMT mode number. @see standardModeType */ + uint8 standardMode; + /** Type of DISPE_STANDARD_MODE_TYPE. DISP_CEA if standardMode is CEA mode, DISP_DMT when DMT mode. */ + uint8 standardModeType; + /** @see lowerRefreshRateSupported. If this is True (1), then higher frequency is supported. */ + bool8 higherRefreshRateSupported; + /** If mode has two refresh rates. If is True (1), then lower frequency is supported. + If mode has only one refresh rate, then this has to be True (1). + E.g. CEA mode 1: 640x480p @59.94/60Hz, so this defines is 59.94Hz supported (lower) or not. + Don't care if mode has only one refresh rate (e.g. CEA 17 720x576p @50Hz) + lowerRefreshRateSupported = 1 = Lower refresrate supported (e.g. 59.94Hz). + higherRefreshRateSupported = 1 = Higher refreshrate supported (e.g. 60Hz) */ + bool8 lowerRefreshRateSupported; + /** Bit mask of supported pixel repetation. 0=no repetation=KPixelSentOnce. */ + uint16 pixelRepeatBitMask; + } DISPS_SUPPORTED_HDMI_MODE; + +/** +Struct for own TV HW capabilities query. +*/ +typedef struct + { + /** Own source HW supports HDCP (or compatible) */ + bool8 hdcpSupported; + /** Own source HW supported APS levels. (bit mask) */ + DISPE_ANALOG_PROTECTION_LEVELS analogProtectionLevels; + /** Supported CGMS-A WSS bits */ + DISPE_CGMSA_CAPABILITIES supportedCgmsa; + + /** Number of supported modes what to be called with dispGetSupportedHdmiMode */ + uint8 numberOfHdmiModes; + + /** HDMI version what (own) Hw supports. Version combination is sourceHdmiVersion.sourceHdmiRevision. */ + uint8 sourceHdmiVersion; + /** @see sourceHdmiVersion */ + uint8 sourceHdmiRevision; + + /** True when DISPS_TV_CONFIG_SETTINGS::hdmiSettings is needed to be filled */ + bool8 hdmiSettingsNeeded; + + /** True when dispSetHdcpKey-call is needed. @see dispSetHdcpKey */ + bool8 hdcpKeysNeeded; + + /* CONTENT UPDATE -> */ + + /** This tells to tv-out-driver client, is the sent buffer free after DISPT_READY_CB + or is that buffer that buffer where tv-out gets updating all the time. Normally + if tv-out-hw is external, and tv-buffer will be sent over some bus, this method returns + False. Otherwise, when DMA reads all the time given buffer, and tv-out gets refresh + directly from that buffer, then this returns True. */ + bool8 requiresFrameBuffer; + /** This is true when pixel data to be updated with dispTvFlush(). + If this is false, then Tv-out HW can transfer/refresh Tv-out signal itself, + without dispTvFlush() */ + bool8 contentUpdateNeeded; + /** How many backbuffers Tv-out driver has. 0 when none */ + uint8 numberOfBackBuffers; + + /** Minimum scaling factor. E.g. if 1/2x is min, then this is 200 (100 / scalingMinDenominator). 1x = 100. 0xFFFF = infinity */ + uint16 scalingMinDenominator; + /** Maximum scaling factor. E.g. if 2.5x is max, then this is 250 (scalingMaxNumerator / 100). 1x = 100. 0xFFFF = infinity */ + uint16 scalingMaxNumerator; + + /** True when position of Tv-out cannot be change, image is always centralized. + False when position can be changed. @see rightBottomCorner */ + bool8 centralizingOnly; + + /** Supported color space conversions from sRGB to DISPE_COLOR_SPACE (bit mask) */ + DISPE_COLOR_SPACE supportedColorSpaceConversion; + /** True when brightness tuning is supported */ + bool8 supportsBrightnessControl; + /** True when contrast tuning is supported */ + bool8 supportsContrastControl; + /** True when gamma tuning is supported */ + bool8 supportsGammaControl; + /** True when (at least one layer) dithering is supported */ + bool8 supportsDithering; + + /** Rotation represents supported rotation capablities of HW. */ + DISPE_ROTATION rotations; + /** True if HW can rotate each layer separately. False if only whole view can be rotated. + (Hopefully will not be needed in NGA) */ + bool8 separateRotationPerLayer; + + /** All the possible colorkey modes supported by the interface */ + DISPE_COLORKEYMODE colorKeyModes; + + /** How many layers supported, at least 1 */ + uint8 layers; + /** True when per layer alpha supported */ + bool8 perLayerAlpha; + + /** Color buffer formats natively supported by HW */ + DISPE_COLOR_FORMAT pixelFormats; + /** Bit mask for features, which works with 24bpp aligned color mode */ + DISPE_FEATURE packedPixelsSupported; + /** True if DMA buffers must be physically linear */ + bool8 requiresPhysicallyLinearBuffer; + } DISPS_TV_CAPABILITIES; + +/* <<<<<<- CAPABILITY */ + +/* TESTS ->>>>>> */ + +/** +Struct for output signal test +*/ +typedef struct + { + /** Output color in RGB888 format */ + uint32 outColorRgb888; + /** True when amplifier is disabled even Tv-out is ON */ + bool8 amplifierDisabled; + } DISPS_TV_OUT_TEST_COLOR; + +/* <<<<<<- TESTS */ + +/*- Constants ---------------------------------------------------------------*/ + +/** API version number. @see dispTvApiVersion(). + 2: Aspect ratio with enum/denom. SRM + HDCP structs and hdcpKeysNeeded. + 1: First version */ +const uint32 KTvApiVersionNumber = 2; + +/** Chipset driver calls this, when something is executed. + Callback must not be called in the API user thread context. + @param error An error code + @param parameter Given parameter (@see DISPS_TV_CONFIG_SETTINGS::cbParameter) + @param status Listener status + @param isrContext True when callback is called in interrupt context */ +typedef void (*DISPF_LISTENER_CB)(DISPE_ERROR error, void* parameter, uint32 status, bool8 isrContext); + +/*- Macros ------------------------------------------------------------------*/ + +/*- External Data -----------------------------------------------------------*/ + +/*- Variables ---------------------------------------------------------------*/ + +/*- Forward Declarations ----------------------------------------------------*/ + +/*- Functional Prototypes ---------------------------------------------------*/ + +/* VERSION -> */ + +/** Gets implemented chipset API version. Verify the return value to KTvApiVersionNumber. + @param api API interface pointer, fetched from dispGetInterface() + @see KTvApiVersionNumber + @return Implemented Tv chipset API version, KTvApiVersionNumber (should match to client version) */ +inline uint32 dispTvApiVersion(API_POINTER api); + +/* <- VERSION */ + +/* CAPABILITY -> */ + +/** Returns Tv-out HW capabilities for caller. + + @param api API interface pointer, fetched from dispGetInterface() + @param tvCapabilities Capability struct filled for caller + @return an error code */ +inline DISPE_ERROR dispGetTvCapabilities(API_POINTER api, DISPS_TV_CAPABILITIES* tvCapabilities); + +/** Reads supported modes of HDMI hardware + + @see DISPS_TV_CAPABILITIES::numberOfHdmiModes + @param api API interface pointer, fetched from dispGetInterface() + @param capabilityNumber Mode number, begins from 0, up to dispGetTvCapabilities. + @param readMode Method fills these for caller + @return an error code */ +inline DISPE_ERROR dispGetSupportedHdmiMode(API_POINTER api, uint32 capabilityNumber, DISPS_SUPPORTED_HDMI_MODE* readMode); + +/* <- CAPABILITY */ + + +/* CONTROL -> */ + +/** Before Tv-out using, dispSetTvConfig() must be called during boot and always + when user is changed configurations. + + Fill correct values to DISPS_TV_CONFIG_SETTINGS object and give it by parameter. + + If driver can set settings without dispDisableTvOut()/dispEnableTvOut() it does that. + Driver checks only changed members in DISPS_TV_CONFIG_SETTINGS, so if only overscan + is changing, then rest of members are same. If just overscan is different, + and driver can change that on the fly, method returns DISP_ERROR_NONE, if driver + requires dispDisableTvOut/dispEnableTvOut sequence, it returns DISP_ERROR_HW_IS_BUSY. + After DISP_ERROR_HW_IS_BUSY next dispEnableTvOut() enables new settings. + callback will be called even in error case. + + Settings what has to be changed during Tv-out is enabled are at least copy protections, + DISPS_HDMI_SETTINGS::enableHdcp and DISPE_ANALOG_PROTECTION_LEVELS::analogProtectionLevels. + See that copy protection enable might be delayed, or even never enabled. dispCopyProtectionStatusListener() + will be completed when protection status changes on Tv-output. If the API client + wants to enable e.g. HDCP, Tv-driver tries to enable it ASAP. In case where 1st phase + of authentication will fail, Tv-driver will continuously try to enable it, without + timeout (but period can be long). Status listener will be completed if success. + + @param api API interface pointer, fetched from dispGetInterface() + @param tvSettings Struct which contains wanted setting (e.g. PAL/NTSC/...) + @param callback Callback when ready + @return an error code */ +inline DISPE_ERROR dispSetTvConfig(API_POINTER api, const DISPS_TV_CONFIG_SETTINGS* tvSettings, DISPT_READY_CB callback); + +/** Calculates DISPS_TV_RESOLUTION members but do not any HW configurations, so this is + just calculator service for client use and does not anything else. + + @param api API interface pointer, fetched from dispGetInterface() + @param tvSettings Struct which contains wanted setting (e.g. PAL/NTSC/...)(user fills) + @param resolution Driver fills resolutions for user + @return an error code */ +inline DISPE_ERROR dispResolutionQuery(API_POINTER api, const DISPS_TV_CONFIG_SETTINGS* tvSettings, DISPS_TV_RESOLUTION* resolution); + +/** Enables Tv-out. Callback will be called even in error case. + + @pre dispSetTvConfig() is called without errors. + @param api API interface pointer, fetched from dispGetInterface() + @param callback Callback when enabled + @return an error code */ +inline DISPE_ERROR dispEnableTvOut(API_POINTER api, DISPT_READY_CB callback); + +/** Disables Tv-out. Callback will be called even in error case. + + @pre dispEnableTvOut() is called without errors. + @param api API interface pointer, fetched from dispGetInterface() + @param callback Callback when disabled + @return an error code */ +inline DISPE_ERROR dispDisableTvOut(API_POINTER api, DISPT_READY_CB callback); + +/** Asks is TV-out enabled or not + @param api API interface pointer, fetched from dispGetInterface() + @return State of TV-out, False=TV-out is disabled or if not supported (or error), + True=TV-out is enabled */ +inline bool8 dispIsTvOutEnabled(API_POINTER api); + +/** This method makes possible to send some messages for whole chipset driver stack + When chipset drivers will get the message call and name does not match for that driver, + then it has to forward message for next driver in same driver stack through dispDriverMessage. + + If message==DISP_MSG_PING: + Chipset driver will forward same message for + next chipset drivers in the stack (dispDriverMessage), then all drivers call 'callback' with + their own name (CHIPSET_DRV_NAME) and got message (DISP_MSG_PING). With this, topmost + driver can make query, what components stack has. Topmost caller sets param=0, when chipset + driver calls this forward, it increases param by one (param=1). If chipset driver uses to + separated chipset drivers, both will to be called with param=1. Then 'param' means stack level. + In callback chipset drivers will set given param to DISPT_MSG_CB's value-parameter. + + If message=DISP_MSG_SELFTEST: + If given name (receiver) matches to driver name, then the + driver will execute self test. When self test is ready, it reports test result with 'callback' + for caller. Chipset drivers will forward the same message, if name (receiver) and their own + name doesn't match. param is type of the DISPE_SELFTEST_TYPE. + + If message=DISP_MSG_PRODTEST: + Production tests of TV-out, see more information from each platform's specifications. + Sets test figure on TV, e.g. white display. + When production tests are completed, remember close Tv-Out by calling dispDisableTvOut(). + param is pointer to DISPS_TV_OUT_TEST_COLOR. + + @see dispDriverMessage in display chipset API + + @param api API interface pointer, fetched from dispGetInterface() + @param receiver Message receiver name (same what is stored in Interface Storage) + @param message Message identifier + @param param Optional, has different meaning per message + @param callback Callback when message actions are executed + @return an error code */ +inline DISPE_ERROR dispTvMessage(API_POINTER api, CHIPSET_DRV_NAME receiver, DISPE_DRV_MSG message, uint32 param, DISPT_MSG_CB callback); + +/* <- CONTROL */ + + +/* LISTENERS AND COPY PROTECTION -> */ + +/** Registers listener for Tv-out cable. (does not enable Tv, only listener for cable). + When dispCableListener listener is added, listener will be completed immediatelly, + that makes possible to read boot time status. + + If cable is attached, DISPF_LISTENER_CB's status==1 + If cable is detach, DISPF_LISTENER_CB's status==0 + + @param api API interface pointer, fetched from dispGetInterface() + @param callback Function pointer to user callback. + callback which to be called when cable is attached/detach + @param add True=callback will be added. False=callback will be removed. + @return an error code */ +inline DISPE_ERROR dispCableListener(API_POINTER api, DISPF_LISTENER_CB callback, bool8 add); + +/** Listener for status of copyprotection (e.g. HDCP). After this, check newest status with dispCopyProtectionStatus() + or check the callback value. + + If protection is handshaked and enabled, DISPF_LISTENER_CB's status==1 + If protection is disabled, DISPF_LISTENER_CB's status==0 + + @see dispCopyProtectionStatus() + @param api API interface pointer, fetched from dispGetInterface() + @param copyProtectionChangedCb Will be called when protection is disabled/enabled in output signal. + Second parameter of callback is status of copy protection (bool) + @param add True=callback will be added. False=callback will be removed. + @return an error code */ +inline DISPE_ERROR dispCopyProtectionStatusListener(API_POINTER api, DISPF_LISTENER_CB copyProtectionChangedCb, bool8 add); + +/** Asks is HDCP/macrovision enabled or not at the moment in Tv-output. + If HDCP is available, it can be enabled with DISPS_HDMI_SETTINGS::enableHdcp using + dispSetTvConfig(). + + @param api API interface pointer, fetched from dispGetInterface() + @return status of copy protection (True=enabled, False=disabled) */ +inline bool8 dispCopyProtectionStatus(API_POINTER api); + +/** Sets newest SRM list to the Tv-driver. Has to be done before dispEnableTvOut if digital + Tv-output. Tv-driver has to parse SRM open, it is in the same form what HDCP specification + describes. + + If copy protection authentication is already executed, the SRM-list can be still + updated, and Tv-driver has to re-check the revocation list (without 1st phase of reauthentication). + + @param api API interface pointer, fetched from dispGetInterface() + @param srmData Pointer to SRM. Tv-driver stores the SRM and client + can delete the SRM after function call. + @param srmInBytes SRM size in bytes. + @return an error code */ +inline DISPE_ERROR dispSetSrm(API_POINTER api, void* srmData, uint32 srmInBytes); + +/** Sets the unique HDCP and KSV for Tv-driver knowledge. Has to be done before dispEnableTvOut if digital + Tv-output. Tv-driver has to parse HDCP data (hdcpData) open, it is in platform specific form. + + All instances who handle the HDCP and KSV -keys, has to overwrite HDCP data (zeroes) in registers, stacks + and heaps after this call (and perhaps even before this call, in all SW levels) and when HW is initialised. + + Depending of HW, HDCP+KSV can be burned with "eFuses" in Tv-HW. Thus, Tv-driver requires to get the keys + only once in production line. + When/if eFuses are burned, DISPS_TV_CAPABILITIES::hdcpKeysNeeded can be false on next time + when capabilities will be read, and the API client will not call this function anymore. + DISPS_TV_CAPABILITIES::hdcpKeysNeeded is true when Tv-HW needs to get HDCP+KSV. + The reason for this mechanism is to avoid to hold the HDCP-keys in system RAM. + + @param api API interface pointer, fetched from dispGetInterface() + @param hdcpData Pointer to HDCP. Tv-driver stores the HDCP and client + can delete the HDCP after function call. Data is in platform specific form. + @param hdcpInBytes HDCP struct (hdcpData) size in bytes. + @return an error code */ +inline DISPE_ERROR dispSetHdcpKey(API_POINTER api, void* hdcpData, uint32 hdcpInBytes); + +/* <- LISTENERS AND COPY PROTECTION */ + + +/* CONTENT UPDATE -> */ + +/** Content update to be used if DISPS_TV_CAPABILITIES::contentUpdateNeeded=True */ + +/** Sets all per layer settings for chipset driver. Settings will be used on next dispFlush()-call. + In double buffered case, this method to be call every time before dispTvFlush, with different buffer + addresses. Tv driver is responsible to optimise unneeded reinitialisation. It should store + previous settings and compare changed settings of DISPS_FINAL_VIEW, and use that result + for HW reinitialisation. + + @see dispTvFlush + @param api API interface pointer, fetched from dispGetInterface() + @param finalView Source buffer and final composition settings + @return an error code */ +inline DISPE_ERROR dispSetTvFinalView(API_POINTER api, const DISPS_FINAL_VIEW* finalView); + +/** Prepares Tv update according to latest dispSetTvFinalView parameters. + After this, if DISPS_TV_CAPABILITIES.requiresFrameBuffer is false, work buffer is ready. + + DISPS_TV_CAPABILITIES.requiresFrameBuffer==false: + callback will be called when display buffer is transferred to the display. + DISPS_CAPABILITIES.requiresFrameBuffer==true: + callback will be called when display buffer starting to be visible. So when callback is called + any pixel of flush is not yet shown. And after that given buffer works as framebuffer + until next's flush callback will be called. So caller should be aware of that + to avoiding tearing (no draw to buffer if that is still work as framebuffer). + + @see dispFlush + @see dispSetFinalView + @param api API interface pointer, fetched from dispGetInterface() + @param changedArea Changed areas, rectangle per layer. Chipset driver can ignore and transfer bigger part. + @param callback To be called when preparation is ready, even error occured. Can be NULL. + @return an error code */ +inline DISPE_ERROR dispTvFlush(API_POINTER api, const DISPS_UPDATE* changedArea, DISPT_READY_CB callback); + +/* <- CONTENT UPDATE */ + + +/*- Inline Functions --------------------------------------------------------*/ + +#include "tv_chipset_api.inl" + +#endif /* TV_CHIPSET_API_H */ + +/* End of File */ + diff -r 000000000000 -r bb4b476bbb96 TV Out/tv_chipset_api.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TV Out/tv_chipset_api.inl Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,289 @@ +/* + tv_chipset_api.inl + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @file + +Inline methods of tv chipset driver API + +@publishedDeviceAbstraction +*/ + +/*- Include Files ----------------------------------------------------------*/ + +/*- Data Types --------------------------------------------------------------*/ + +/*- Enumerations ------------------------------------------------------------*/ + +/** Error codes */ +typedef enum + { + /* VERSION */ + DISP_FUNC_DISP_TVAPI_VERSION = 0, + + /* CAPABILITY */ + DISP_FUNC_DISP_GET_TV_CAPABILITIES, + DISP_FUNC_DISP_GET_SUPPORTED_HDMI_MODE, + + /* CONTROL */ + DISP_FUNC_DISP_SET_TV_CONFIG, + DISP_FUNC_DISP_RESOLUTION_QUERY, + DISP_FUNC_DISP_ENABLE_TV_OUT, + DISP_FUNC_DISP_DISABLE_TV_OUT, + DISP_FUNC_DISP_IS_TV_OUT_ENABLED, + DISP_FUNC_DISP_TV_MESSAGE, + + /* LISTENERS AND COPY PROTECTION */ + DISP_FUNC_DISP_CABLE_LISTENER, + DISP_FUNC_DISP_COPY_PROTECTION_STATUS, + DISP_FUNC_DISP_COPY_PROTECTION_STATUS_LISTENER, + DISP_FUNC_DISP_SET_SRM, + DISP_FUNC_DISP_SET_HDCP_KEY, + + /* CONTENT UPDATE */ + DISP_FUNC_DISP_SET_TV_FINAL_VIEW, + DISP_FUNC_DISP_TV_FLUSH, + + /* Size of array */ + DISP_FUNC_TV_SIZE_OF_ARRAY, + } DISPE_TV_FUNCTIONS; + +/*- Data Structs ------------------------------------------------------------*/ + +/*- Constants ---------------------------------------------------------------*/ + +/*- Functions ---------------------------------------------------------------*/ + +/*== VERSION ================================================================*/ + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline uint32 dispTvApiVersion(API_POINTER api) + { + + typedef uint32 (*FUNC)(); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_TVAPI_VERSION ]; + return function(); + + } + +/*== CAPABILITY =============================================================*/ + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispGetTvCapabilities(API_POINTER api, DISPS_TV_CAPABILITIES* tvCapabilities) + { + + typedef DISPE_ERROR (*FUNC)(DISPS_TV_CAPABILITIES* tvCapabilities); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_GET_TV_CAPABILITIES ]; + return function( tvCapabilities ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispGetSupportedHdmiMode(API_POINTER api, uint32 capabilityNumber, DISPS_SUPPORTED_HDMI_MODE* readMode) + { + + typedef DISPE_ERROR (*FUNC)(uint32 capabilityNumber, DISPS_SUPPORTED_HDMI_MODE* readMode); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_GET_SUPPORTED_HDMI_MODE ]; + return function( capabilityNumber, readMode ); + + } + +/*== CONTROL ================================================================*/ + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispSetTvConfig(API_POINTER api, const DISPS_TV_CONFIG_SETTINGS* tvSettings, DISPT_READY_CB callback) + { + + typedef DISPE_ERROR (*FUNC)(const DISPS_TV_CONFIG_SETTINGS* tvSettings, DISPT_READY_CB callback); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_SET_TV_CONFIG ]; + return function( tvSettings, callback ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispResolutionQuery(API_POINTER api, const DISPS_TV_CONFIG_SETTINGS* tvSettings, DISPS_TV_RESOLUTION* resolution) + { + + typedef DISPE_ERROR (*FUNC)(const DISPS_TV_CONFIG_SETTINGS* tvSettings, DISPS_TV_RESOLUTION* resolution); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_RESOLUTION_QUERY ]; + return function( tvSettings, resolution ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispEnableTvOut(API_POINTER api, DISPT_READY_CB callback) + { + + typedef DISPE_ERROR (*FUNC)(DISPT_READY_CB callback); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_ENABLE_TV_OUT ]; + return function( callback ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispDisableTvOut(API_POINTER api, DISPT_READY_CB callback) + { + + typedef DISPE_ERROR (*FUNC)(DISPT_READY_CB callback); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_DISABLE_TV_OUT ]; + return function( callback ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline bool8 dispIsTvOutEnabled(API_POINTER api) + { + + typedef bool8 (*FUNC)(); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_IS_TV_OUT_ENABLED ]; + return function(); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispTvMessage(API_POINTER api, CHIPSET_DRV_NAME receiver, DISPE_DRV_MSG message, uint32 param, DISPT_MSG_CB callback) + { + + typedef DISPE_ERROR (*FUNC)(CHIPSET_DRV_NAME receiver, DISPE_DRV_MSG message, uint32 param, DISPT_MSG_CB callback); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_TV_MESSAGE ]; + return function( receiver, message, param, callback ); + + } + +/*== LISTENERS AND COPY PROTECTION ==========================================*/ + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispCableListener(API_POINTER api, DISPF_LISTENER_CB callback, bool8 add) + { + + typedef DISPE_ERROR (*FUNC)(DISPF_LISTENER_CB callback, bool8 add); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_CABLE_LISTENER ]; + return function( callback, add ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline bool8 dispCopyProtectionStatus(API_POINTER api) + { + + typedef bool8 (*FUNC)(); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_COPY_PROTECTION_STATUS ]; + return function(); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispCopyProtectionStatusListener(API_POINTER api, DISPF_LISTENER_CB copyProtectionChangedCb, bool8 add) + { + + typedef DISPE_ERROR (*FUNC)(DISPF_LISTENER_CB copyProtectionChangedCb, bool8 add); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_COPY_PROTECTION_STATUS_LISTENER ]; + return function( copyProtectionChangedCb, add ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispSetSrm(API_POINTER api, void* srmData, uint32 srmInBytes) + { + + typedef DISPE_ERROR (*FUNC)(void* srmData, uint32 srmInBytes); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_SET_SRM ]; + return function( srmData, srmInBytes ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispSetHdcpKey(API_POINTER api, void* hdcpData, uint32 hdcpInBytes) + { + + typedef DISPE_ERROR (*FUNC)(void* hdcpData, uint32 hdcpInBytes); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_SET_HDCP_KEY ]; + return function( hdcpData, hdcpInBytes ); + + } + +/*== CONTENT UPDATE =========================================================*/ + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispSetTvFinalView(API_POINTER api, const DISPS_FINAL_VIEW* finalView) + { + + typedef DISPE_ERROR (*FUNC)(const DISPS_FINAL_VIEW* finalView); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_SET_TV_FINAL_VIEW ]; + return function( finalView ); + + } + +/*---------------------------------------------------------------------------*/ +/** + @see header +*/ +inline DISPE_ERROR dispTvFlush(API_POINTER api, const DISPS_UPDATE* changedArea, DISPT_READY_CB callback) + { + + typedef DISPE_ERROR (*FUNC)(const DISPS_UPDATE* changedArea, DISPT_READY_CB callback); + FUNC function = ( FUNC ) api[ DISP_FUNC_DISP_TV_FLUSH ]; + return function( changedArea, callback ); + + } + +/* End of File */ + diff -r 000000000000 -r bb4b476bbb96 Thermal Sensing/pm_thermalsensing_chipset_api.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Thermal Sensing/pm_thermalsensing_chipset_api.h Fri Jun 26 15:44:04 2009 +0100 @@ -0,0 +1,297 @@ +/* + pm_thermalsensing_chipset_api.h + + Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This program and the accompanying materials are made available + under the terms of the Eclipse Public License v1.0 which accompanies + this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Initial Contributors: + Nokia Corporation - initial contribution. + + Contributors: +*/ + +/** @file +@brief Thermal sensing chipset API + +@publishedDeviceAbstraction +*/ + +#ifndef __PM_THERMALSENSING_CHIPSET_API_H__ +#define __PM_THERMALSENSING_CHIPSET_API_H__ + + +// Include files + +#include + + +/** +Description of the function pointer + +@note Description Callback Function which is being executed from DFC + +@param TAny* Any type of parameter passed to the callback function +*/ +typedef void (*TthermalSensorCbFn(TAny* aParam)); + +// Forward declarations + +class TthermalSensorCb; +class ChipsetThermalSensorHWPool; +class DThermalSensorHW; + + +// Class declaration +/** + * + * Thermal Sensor Callback function + * + */ + class TthermalSensorCb : public TDfc + { + + public : + /** + Description of TthermalSensorCb + This is the Thermal Sensor Callback Function + @param aFn Callback Function Pointer + @param aParam Any type of parameter passed to the callback function + @param aPriority Priority Assigned + @return KErrNone or a system wide error code to specify the effect of the method call. + @pre This can be called only after the ChipsetThermalSensorHWPool has been initialized + in the system. Preferable way to call this function is from a thread context with + interrupts enabled after all the kernel extensions have been initialized in the boot up. + */ + IMPORT_C TthermalSensorCb(TthermalSensorCbFn aFn, TAny *aParam, TInt aPriority); + /** + Description of TthermalSensorCb + This is the Thermal Sensor Callback Function + @param aFn Callback Function Pointer + @param aParam Any type of parameter passed to the callback function + @param aPriority Priority Assigned + @param aQue Interrupt Handling DFC queue. The same queue is used by the HW specific interface + @return KErrNone or a system wide error code to specify the effect of the method call. + @pre This can be called only after the ChipsetThermalSensorHWPool has been initialized + in the system. Preferable way to call this function is from a thread context with + interrupts enabled after all the kernel extensions have been initialized in the boot up. + */ + IMPORT_C TthermalSensorCb(TthermalSensorCbFn aFn, TAny *aParam, TInt aPriority, TDfcQue* aQue); + + private : + + static void CallbackFunc( TAny *); + + private : + /*** Any type of parameter passed to the callback function */ + TAny* iParam; + + /*** Callback Function Pointer */ + TthermalSensorCbFn iCallback; + + }; + + /** +@brief Class acting as a container class for several sensor objects + +This class acts as a repository using which the references to the specific thermal sensor +interface can be accessed. The recommendation is to implement this as a Singleton class. +*/ +class ChipsetThermalSensorHWPool +{ + // Methods + public : + enum TthermalSensorID + { + /// Invalid Sensor ID to be used if system design does not have any thermal sensor. + EInvalidThermalSensor = 0x0, + /// Battery Specific Sensing + EBatteryThermalSensor, + /// DRAM Specific Sensing + EDRAMThermalSensor, + /// RF ASIC Specific Sensors + ERFThermalSensor, + /// Memory Card Specific Sensors + EMemoryCardThermalSensor, + /// SOC Specific Sensors + EAPEThermalSensor, + /// Camera Module Specific Sensors + ECameraThermalSensor, + /// GPS Module Specific Sensors + EGPSThermalSensor, + /// Display Module Specific Sensors + EDisplayThermalSensor, + /// Chipset Specific Sensors + EChipsetCustom1ThermalSensor, + EChipsetCustom2ThermalSensor, + EChipsetCustom3hermalSensor, + EChipsetCustom4ThermalSensor, + EChipsetCustom5ThermalSensor, + EChipsetCustom6ThermalSensor + }; + + /** + Description of GetThermalSensorHW + This is the method to get the pointer of the DThermalSensorHW object from the + ChipsetThermalSensorHWPool. + @param aId input parameter specifying the ID of the thermal sensor whose pointer we are + trying to reference. + @param aSensor output parameter giving the pointer of the thermal sensor object representing + the ID requested or NULL if the thermal sensor do not exist in the system. + @return KErrNone or a system wide error code to specify the effect of the method call. + @pre This can be called only after the ChipsetThermalSensorHWPool has been initialized + in the system. Preferable way to call this function is from a thread context with + interrupts enabled after all the kernel extensions have been initialized in the boot up. + */ + +IMPORT_C static TInt GetThermalSensorHW(TthermalSensorID aId, DThermalSensorHW** aSensor); + + /** + Description of GetNumberOfSensors + This is the method to get the number of sensors supported by the chipset adaptation software. + In addition it should give the highest and lowest identifier for the sensors to optimize the search + possibilities for the client software. + @param aHighestID output parameter that gives the ID of the thermal sensor with the most positive value + or 0 if no sensor is present. + @param aLowestID output parameter that gives the ID of the thermal sensor with the least positive value + or 0 if no sensor is present. + @return number of sensors in the system (+ve value or 0) or + a system wide error code to specify the effect of the method call. + @pre This can be called only after the ChipsetThermalSensorHWPool has been initialized + in the system. + */ +IMPORT_C static TInt GetNumberOfSensors(TthermalSensorID& aHighestID, TthermalSensorID& aLowestID); + +}; + + +/** +* +* This class represents a generic thermal sensor that would be found in the HW. +* The pointer of the thermal sensor object would be passed to the client who can then call the virtual methods that are exposed by this interface. +* +*/ +NONSHARABLE_CLASS( DThermalSensorHW ) : public DBase +{ + public : + /** + Constructor + Defined as a private to prevent clients to create own instances + from this class + @since ver 1 + @param none + @return none + @panic none + */ + DThermalSensorHW(); + + /** + Virtual Destructor + @since ver 1 + @param none + @return none + @panic none + */ + virtual ~DThermalSensorHW(); + + /** + Description of InitHw + This is the method by which the HW is initialized in the system. + The implementation has to take care that the HW is initialized only once even though this method can be called multiple times. + The main motivation for this method is that the client becomes sure about the functional state of the HW after it calls this method. + There are several scenarios possible when the interface is called. For example, + • If the HW cannot be initialized then the implementation should return KErrNotReady or KErrNotSupported depending on the scenario. + • If the HW can be initialized then the call would do the necessary initializations and reply with KErrNone. + • If the HW is already initialized, then the call should return immediately without changing the HW state and return value should also be KErrNone. + @since ver 1 + @param none + @return KErrNone if success + otherwise system wide error code to let the client know about the status of the HW + @panic none + @ pre This can be called at any time after the kernel extensions have been loaded. + The preferable way to call this function is from a thread context with interrupts enabled. + */ + virtual TInt InitHw() = 0; + + /** + Description of SetupAlert + This is the method to set up a callback mechanism when temperature moves outside the range + [alerts should occur when temperature is higher than high temperature limit (aTmpHigh) and lower than the low temperature limit (aTmpHigh – aTmpDiff)] + presented in the arguments of this method. Only one client is permitted to call this API because this controls the functional behavior of the thermal sensor. + If the boundary condition is already set and another client calls this method the call would not have any functional effect and the callback would not be registered. + @since ver 1 + @param aTmpHigh The higher boundary of the temperature range in Kelvin. + The callback specified would be triggered if the temperature of the sensor becomes greater than this level + @param aTmpDiff difference between THIGH and TLOW + @param aCb this is the DFC that should be queued when the temperature of the sensor moves outside the range specified by the boundaries + @return KErrNone if success + KErrAlreadyExists if the boundary values are already specified + otherwise system wide error code + @panic none + @pre the preferable way to call this function is from a thread context with interrupts enabled after all the kernel extensions have been initialized in the boot up. + */ + virtual TInt SetupAlert(TInt16 aTmpHigh, TInt16 aTmpDiff,TthermalSensorCb *aCb) = 0; + + /** + Description of SetupCallBack + This is the method to register callbacks for the current prevailing boundary conditions for a particular sensor. + This function is needed because only the controlling client is allowed to call the SetupAlert API, hence this API needs to be used by all other observer clients + @since ver 1 + @param aCb This is the DFC that should be queued when the temperature of the sensor moves outside the range specified by the boundaries set before in the SetAlert method. + @return KErrNone if success + otherwise system wide error code + @panic none + @pre The preferable way to call this function is from a thread context with interrupts enabled after all the kernel extensions have been initialized in the boot up. + */ + virtual TInt SetupCallBack(TthermalSensorCb *aCb) = 0; + + /** + Description of StopAlert + This is the method to cancel callbacks or the entire alert mechanism for a particular sensor. + @since ver 1 + @param stopAll If this true then the Alert mechanism is stopped altogether and the sensing HW is disabled until the next InitHW is called. + It is recommended that only the client who has called SetupAlert successfully before calls this method. + In other cases only the callback function is removed. If the callback function was the one used in the SetupAlert call before + then the Alert mechanism is disabled also before the next SetupAlert is called. + @param aCb This is the DFC that should be removed from the list of callbacks. + @return KErrNone if success + otherwise system wide error code + @panic none + @pre This can only be called after SetupAlert API or SetupCallback API + The preferable way to call this function is from a thread context with interrupts enabled after all the kernel extensions have been initialized in the boot up. + */ + virtual TInt StopAlert(TBool stopAll, TthermalSensorCb *aCb) = 0; + + + /** + Description of ReadTempData + This is the method to read temperature data from a particular sensor + @since ver 2 + @param tmpData stores the current temperature reading + @param aNewRead checks whether a new read is required for temperature + @return KErrNone if success + otherwise system wide error code + @panic none + @pre The preferable way to call this function is from a thread context with interrupts enabled after all the kernel extensions have been initialized in the boot up. + */ + virtual TInt ReadTempData(TInt16& tmpData, TBool aNewRead) = 0; + + /** + Description of PeformHWSelfTest + This is the method to performing self test on the underlying thermal sensor HW. This method should be self contained meaning it should be able to save the context , + perform the self test and then restore the context back exactly to the state before the self test. + @since ver 2 + @param none + @return KErrNone if success + otherwise system wide error code + @panic none + @pre The preferable way to call this function is from a thread context with interrupts enabled after all the kernel extensions have been initialized in the boot up. + */ + virtual TInt PerformHWSelfTest(void) = 0; +}; + +#endif // __PM_THERMALSENSING_CHIPSET_API_H__ \ No newline at end of file