| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
SH7709 WindowsCE Reference Platform (PFM-DS3) Application Notes (Tempo
Top Searches for this datasheetHitachi Confidential SH7709 WindowsCE Reference Platform (PFM-DS3) Application Notes (Temporary Version) (Software volume) Hitachi Confidential Contents PREFACE TOUCH PANEL 3.1. PREFACE 3.1.1. Outline 3.1.2. Target Environment 3.2. DEVICE DRIVER INTERFACE (DDI) SPECIFICATIONS 3.2.1. Driver Name 3.2.2. Module Definition 3.2.3. Function Prototype 3.3. OPERATING SPECIFICATIONS 3.3.1. Calibration 3.3.2. Acquiring Coordinates 3.3.3. Coordinate Acquisition Procedure 3.3.4. Pen-up Pen-down Processing 3.3.5. Interrupt Processing 3.4. DEVICE DRIVER SERVICE PROVIDER INTERFACE (DDSI) SPECIFICATIONS 3.4.1. Interface Data Specifications 3.4.2. Interface Function Specifications 3.4.3. Interface function call relationships 3.4.4. Cross Reference between Interface Data Interface Function 3.5. PLATFORM DEPENDENT DEVICE (PDD) SPECIFICATIONS 3.5.1. Global Variable 3.5.2. Cross Reference between Global Variables Functions 3.5.3. Function process flowchart KEYBOARD DRIVER 4.1. PREFACE 4.1.1. Outline 4.1.2. Target Environment 4.2. DEVICE DRIVER INTERFACE (DDI) SPECIFICATIONS 4.2.1. Driver Name 4.2.2. Module Definition 4.2.3. Function Prototype 4.2.4. Contents Registry 4.3. OPERATING SPECIFICATIONS 4.3.1. Scanning 4.3.2. Interrupts 4.3.3. Hardware Initialization 4.3.4. Power Supply Recovery Termination 4.4. DEVICE DRIVER SERVICE-PROVIDER INTERFACE (DDSI) SPECIFICATIONS 4.4.1. Interface Data Specifications Hitachi Confidential 4.4.2. Interface Function Specifications 4.4.3. Interface function call relationships 4.4.4. Interface data interface function cross reference 4.5. PLATFORM DEPENDENT DEVICE DRIVER 4.5.1. Global parameter 4.5.2. Global parameter function cross reference 4.5.3. Function processing flowchart SPECIFICATIONS SOUND DRIVER 5.1. PREFACE 5.1.1. Outline 5.1.2. Target Environment 5.2. DEVICE DRIVER INTERFACE (DDI) SPECIFICATIONS 5.2.1. Driver Name 5.2.2. Module Definition 5.2.3. Function Prototype 5.2.4. Contents Registry 5.3. OPERATING SPECIFICATIONS 5.3.1. Continuous Playback Operation 5.3.2. Playback Mode 5.3.3. Recording Mode 5.3.4. Hardware Initialization 5.3.5. Header Analysis 5.3.6. WAVE File Support 5.3.7. Turn Power 5.3.8. Output Volume Control 5.4. DEVICE DRIVER SERVICE-PROVIDER INTERFACE (DDSI) SPECIFICATIONS 5.4.1. Interface Data Specifications 5.4.2. Interface Function Specifications 5.4.3. Function call interface/peripheral 5.5. PLATFORM DEPENDENT DEVICE DRIVER (PDD) SPECIFICATIONS 5.5.1. Global Variables 5.5.2. Cross Reference between Global Variables Functions 5.5.3. Buffer 5.5.4. Driven Sampling Frequency 5.5.5. Function processing flowchart SERIAL DRIVER 6.1. PREFACE 6.1.1. Outline 6.1.2. Target Environment 6.2. SERIAL (DEVICE DRIVER INTERFACE) SPECIFICATIONS 6.2.1. Driver Name 6.2.2. Module Definition 6.2.3. Function Prototype 6.3. OPERATING SPECIFICATIONS 6.3.1. Windows Serial Communications Hitachi Confidential 6.3.2. Function Serial Driver 6.3.3. Device Driver Initialization 6.3.4. Interrupt Processing 6.3.5. Reading Data (Receive data) 6.3.6. Writing Data (Transmit data) 6.3.7. Device Control 6.4. SERIAL DDSI (DRIVER DEVICE DRIVER SERVICE-PROVIDER INTERFACE) SPECIFICATIONS 6.4.1. Interface Function Specifications 6.4.2. Interface function call relationships 6.4.3. Specifications Hardware Information (PDD Common Information) Specifications Cross Reference 6.4.4. Function process flowchart PCMCIA DRIVER 7.1. PREFACES 7.1.1. Outline 7.1.2. PCMCIA Driver Supported Card 7.2. DEVICE DRIVER INTERFACE (DDI) SPECIFICATIONS 7.2.1. Driver Name 7.2.2. Module Definition 7.2.3. Function Prototype 7.3. OPERATING SPECIFICATIONS 7.3.1. Hardware Configuration 7.3.2. Memory Window Structure 7.3.3. Hardware Initialization 7.3.4. Interrupt Processing 7.3.5. Interface Function Specifications 7.4. PLATFORM-DEPENDENT DEVICE DRIVER (PDD) SPECIFICATIONS 7.4.1. Relationship between Interface Functions 7.4.2. Global Variables 7.4.3. Cross Reference between Global Variables Functions 7.4.4. Flowchart Function Processing 8.1. PREFACE 8.1.1. Outline 8.1.2. Target Environment 8.2. OPERATING SPECIFICATIONS 8.2.1. Display Operation 8.3. PLATFORM-DEPENDENT DEVICE DRIVER (PDD) SPECIFICATIONS 8.3.1. Class 8.3.2. Working Area Used 8.3.3. Function process flowchart KERNEL 9.1. PREFACE 9.1.1. Outline 9.1.2. Target Environment 9.2. CFW.C 9.2.1. OEMInit() 9.2.2. OEMInterruptEnable() Hitachi Confidential 9.2.3. OEMInterruptDisable() 9.2.4. OEMInterruptDone() 9.2.5. InitClockFreq() 9.3. INTERRUPT SERVICE ROUTINE(ISR) 9.3.1. fw.src 9.3.2. ccISR.src 9.3.3. dmaISR.src 9.3.4. kbdISR.src 9.3.5. tchISRs.src 9.3.6. halasm.src 9.3.7. Flowchart Hitachi Confidential Hitachi Confidential Preface This document describe about routine kernel interrupt processing each driver source program CP09. About drivers, their names functions listed below; Fig1.1 Driver Drivers CP09 name Touch.dll Audio.dll PCMCIA.dll Serial.dll Keybddr.dll ddi.dl Description Touch-panel input Wave files input/output Handling PCMCIA card Serial port Keyboard input display Touch-Panel Sound PCMCIA Serial Keyboard Hitachi Confidential PlatForm CP09 Drivers Display 2Bpp Color Keybd sctovk PCMCIA Serial Builddll ccir scif touchp Wavedev Kernel Fig1.2 Directory Structure Hitachi Confidential Preface Outline touch panel driver acquires coordinates specified locations sends data Microsoft® Windows® following describes details operating function specifications touch panel driver. Target Environment Table shows target environment. Table Target Environment Platform Function version CP09 touch-panel input -1.01 Note Hitachi Confidential Device Driver Interface (DDI) Specifications Driver Name name touch panel driver must touch.dll because Windows uses this name. this name build touch panel driver. different name used, driver will loaded memory. Therefore, touch.dll been specified default name OAK. driver exported with different name, will match Win32 Windows API. device driver connected Win32 Windows through upper interface. definition file Module Definition touch panel driver exports modules. They exported dynamic link library, must have same names used Windows Table shows module definitions their functions. definition file Table List Definitions Modules Exported their Functions Module (Function) Definition TouchPanelGetDeviceCaps Description Attain physical specifications touch panel TouchPanelEnable TouchPanelDisable TouchPanelSetMode TouchPanelReadCalibrationPoint TouchPanelReadCalibrationAbort TouchPanelSetCalibration TouchPanelCalibrateAPoint TouchPanelPowerHandler Validates touch panel Void touch panel mode touch panel Acquire coordinates calibration Terminate calibration Calculate coordinates after calibration Convert result calibration Power control Hitachi Confidential Function Prototype shown section 3.2, differs widely depending version OAK. Therefore, description will given each DDI. details, refer online document Reference Win32 Programmers Reference. Driver entry point BOOL DllEntry( HINSTANCE DllInstance, instance handle driver Reason, LPVOID Reserved Driver export BOOL TouchPanelGetDeviceCaps( LPVOID iIndex, kind device specifications attained reason function call reserved lpOutput acquisition source BOOL TouchPanelEnable( PFN_TOUCH_PANEL_CALLBACK pfnCallback address callback function VOID TouchPanelDisable( VOID BOOL TouchPanelSetMode( LPVOID iIndex, lpInput configured mode type setting information BOOL TouchPanelReadCalibrationPoint( *pRawX, *pRawY coordinate coordinate VOID TouchPanelReadCalibrationAbort( VOID Hitachi Confidential BOOL TouchPanelSetCalibration( INT32 INT32 INT32 INT32 INT32 cCalibrationPoints, number calibration points *pScreenXBuffer, indicated coordinate list *pScreenYBuffer, *pUncalXBuffer, *pUncalYBuffer indicated coordinate list attained coordinate list attained coordinate list void TouchPanelCalibrateAPoint( INT32 INT32 INT32 INT32 UncalX, UncalY, *pCalX, *pCalY uncalibrated coordinate uncalibrated coordinate calibrated coordinate calibrated coordinate void TouchPanelPowerHandler( BOOL bOff Hitachi Confidential Operating Specifications This section explains characteristics Windows touch panel driver. Calibration Calibration performed five points. coordinates each point follows: coordinate,Y coordinate) (display width/2,display height/2) coordinate,Y coordinate) =((width 2)/10,(height *2)/10) coordinate,Y coordinate) =((width 2)/10,(height *8)/10) coordinate,Y coordinate) =((width 8)/10,(height *8)/10) coordinate,Y coordinate) =((width 8)/10,(height *2)/10) coordinates each point specified TouchDriverCalibrationPointGet function. After coordinates specified, coordinate values returned upper function DdsiTouchPanelDeviceCaps. DdsiTouchPanelDeviceCaps function assumes return value function return value, returns upper function TouchPanelDeviceCaps function (Model Device Driver (MDD)). Acquiring Coordinates coordinates calculated from multiple points. algorithm follows: Acquire five coordinates Select three coordinates from these five coordinates Calculate coordinates from three selected coordinates three coordinates selected step elements (A[1], A[2], A[3]) four elements assume three coordinates arrays with four elements (A[i]: i=0,1,2,3). took average three coordinates. Coordinate Acquisition Procedure This procedure described procedure follows: coordinate acquisition done five times coordinate acquisition done five times coordinate acquisition algorithm described above used acquire coordinates here. Coordinates acquired five times this procedure; however, number times changed modifying value TCH_NUM_COORD tchISRs.src. Pen-up Pen-down Processing Pen-up pen-down processing, coordinate acquisition controlled through DdsiTouchPanelPointGet function. this process, acquired coordinates (hereafter called current coordinates) previously acquired coordinates stored. current coordinates used interface variable between touch panel driver touch panel driver provides coordinates storing current coordinates variable. previously acquired coordinates (hereafter called previous coordinates) stored static variable declared DdsiTouchPanelPointGet function used only DdsiTouchPanelPointGet function. Hitachi Confidential There three types processing DdsiTouchPanelPointGet function. Pen-down processing Pen-up processing Coordinate acquisition processing Refer table contents each process. Table Pen-down, Pen-up, Coordinate Acquisition Processes Process pendown penup acquire coordinates Process TOUCH_PEN_DOWN TOUCH_PEN_UP TOUCH_PEN_SAMPLE Description interrupt process previous coordinate present coordinate previous coordinate coordinate attained coordinate previous coordinate Interrupt Processing touch panel driver branches interrupt service routine (ISR) through IREQ1, conversion, timer interrupt. touch panel described tchISR.src. After acquiring coordinates, write device number register return from ISR. entry name TchPDISR, TchADCISR, TchTmr1ISR, device number (each defined SYSINTR_TOUCH_CHANGED SYSINTR_TOUCH, respectively), priority interrupts Hitachi Confidential Device Driver Service Provider Interface (DDSI) Specifications This section describes interface between PDD. This section must understood thoroughly driver two-layer driver structure sample source code. Interface Data Specifications interface data does have structure type. Data transferred from includes flag variable that validates invalidates acquired coordinates variable store coordinates Interface Function Specifications function prototype defined details, refer Reference. Interface function BOOL DdsiTouchPanelGetDeviceCaps( LPVOID iIndex, lpOutput kind requested process address structure conclusion storage calibration BOOL DdsiTouchPanelSetMode( LPVOID iIndex, lpInput device information kind requested process BOOL DdsiTouchPanelEnable( void attain initialize work area void DdsiTouchPanelDisable( void purge work area, powerdown control void DdsiTouchPanelGetPoint( P_TOUCH_PANEL_SAMPLE_FLAGS pTipState, control flag coordinate *pUncalX, *pUncalY// coordinate acquire coordinates Hitachi Confidential Interface function call relationships Fig.3.4 describes interface function call relationships. lloca hieralchy Fig.3.4 Interface call relationships moduled etSam Hitachi Confidential Cross Reference between Interface Data Interface Function Table shows cross reference between DDSI interface data functions. Refer section 3.5.3, Outline Function Processing Flow, cross reference functions their operations, Table Cross Reference between DDSI Interface Data Functions SampleFlags(pTipStateFlags) description data word parenthesis name RawX(pUncalX) RawY(pUncalY) TouchPanelpDetach TouchPanelpAttach TouchPanelISR TouchPanelDllEntry TouchPanelGetDeviceCaps TouchPanelSetMode TouchPanelPowerHandler TouchPanelEnable TouchPanelDisable TouchPanelReadCalibrationPoint TouchPanelReadCalibrationAbort DdsiTouchPanelGetDeviceCaps DdsiTouchPanelSetMode DdsiTouchPanelEnable DdsiTouchPanelDisable DdsiTouchPanelAttach DdsiTouchPanelGetPoint DdsiTouchPanelPowerHandler initialize setting reference update lpInput(lpInput) iIndex(iIndex) Hitachi Confidential Platform Dependent Device (PDD) Specifications This section describes internal specifications Windows touch panel. Global Variable uses following variables. important understand variables order understand PDD. Tables lists variables. Table Global Variables Parameter CurrentSampleRateSetting v_pTch_FPGA_Registers PTCH_FPGA_REGISTERS Type present sample rate address FPGA control register Description v_pPenSamples PTOUCHPANEL_ SAMPLE_AREA area address coordinate sampling SampleFlags TOUCH_PANEL_ SAMPLE_FLAGS control flag coordinate sampling Cross Reference between Global Variables Functions Table shows cross reference between global variables functions. Table Cross Reference between Global Variables Functions description CurrentSampleRateSetting v_pTch_FPGA_Registers v_pPenSamples parameter function PddTouchPanelDeallocateVm PddTouchPanelGetSamples PddTouchPanelEvaluateSamples PddSetupPenDownIntr TouchDriverCalibrationPointGet initialize setting reference update SampleFlags Hitachi Confidential Function process flowchart PddTouchPenDeallocateVm Purge gpLEDs area Purge gpIORegs area Purge gpArea1IntCtrlRegs area Purge gpArea7IntCtrlRegs area Hitachi Confidential PddpTouchPanelGetSamples devDrvPointer Copy attained coorddinates work area coordinate calculation Initialize Hitachi Confidential PddpTouchPanelEvaluateSamples Calculate coordinates *UncalX coordinate *UncalY coordinate these three points used calculation under threshold, sampleFlag TouchSampleValidFlag TouchSampleDownFlag Hitachi Confidential TouchDriverCalibrationPointGet calibration points Hitachi Confidential DdsiTouchPanelGetDeviceCaps sample rate Iindex TPDC_SAMPLE_RATE times calibration Iindex TPDC_CALIBRATION _POINT_COUNT_ID Iindex TPDC_CALIBRATION _POINT_ID calibration points Hitachi Confidential DdsiTouchPanelSetMode return code normal Iindex TPSM_SAMPLERATE_LOW_ID TPSM_SAMPLERATE_HIGH_ID return code abnormal Hitachi Confidential DdsiTouchPanelEnable Attain gpLEDs area Attain gpIORegs area Attain gpArea1IntCtrlRegs area Attain gpArea7IntCtrlRegs area Attain gpTouchSample area DdsiTouchPanelPowerHandler() Hitachi Confidential DdsiTouchPanelGetPoint InterruptDone Status TOUCH_PEN_DOWN SYSINTR_TOUCH_CHANGED Clear previous coordinate calculation results Status TOUCH_PEN_UP InteruptDone (SYSINTR_TOUCH_CHANGED) Else Copy previously calculated coordinates UncalX coordinate UncalY coordinate PddpTouchPanelEvaluateSamples() Calculate coordinates tchPosNest() calculation result previous result PrevX Xcoordinate PrevY Ycoordinate InteruptDone SYSINTR_TOUCH Keyboard Driver 4.1.Preface 4.1.1.Outline keyboard driver manages data input from keyboard. keyboard driver directly accesses hardware provides interface that does depend hardware Microsoft® Windows® Windows applications. function highest-layer interface keyboard driver follows. This manual describes details operating function specifications keyboard driver. 4.1.2.Target Environment Table shows target environment. Table Target Environment Platform Function version CP09 Keyboard inputs 1.01 Note 4.2. Device Driver Interface (DDI) Specifications This section describes keyboard driver matches remaining operating system. This section does have understood thoroughly driver two-layer driver structure sample source code. single-layer driver developed, this section must understood thoroughly. 4.2.1.Driver Name name keyboard driver must same Windows version 1.01 earlier, driver name must keybddr.dll. different name used, driver will loaded memory. Therefore, this name been specified default name OAK. definition file 4.2.2.Module Definition keyboard driver exports modules. These exported dynamic link library, must have same names used Windows Table shows module definitions functions. module exported with incorrect name, will match device manager. keyboard driver connected device manager through upper interface. definition file Table List Definitions Modules Exported their Functions Module (Function) Definition KeybdDriverInitialize KeybdDriverVKeyToUnicode KeybdDriverPowerHandler KeybdDriverGetInfo KeybdDriverInitStates KeybdDriverSetMode Description Initializes keyboard driver Converts virtual UNICODE Turns power Acquires driver information Initializes state Sets mode 4.2.3. Function Prototype shown section 4.2, differs widely depending version OAK. Therefore, description will given each version. details, refer online document Reference Win32 Programmers Reference. Driver entry point BOOL DllEntry( HINSTANCE DllInstance, instance handle driver Reason, LPVOID Reserved Driver export void KeybdDriverInitialize( pointer callback ofkeyboard input event reason function call //reserved, use. UINT32 KeybdDriverVKeyToUnicode( UINT32 KEY_STATE_FLAGS KEY_STATE void UINT32 UINT32 KEY_STATE_FLAGS VirtualKey, KeyEvent, virtual code kind event KeyState, state array *pKeybdDriverToUnicodeState, cBufferSize, *pcCharacters, *pShiftStateBuffer, pointer shift state buffer UNICODE conversion buffer size pointer number character UINT32 *pCharacterBuffer pointer character buffer void KeybdDriverPowerHandler( BOOL bOff switch power shutdown/recover TRUE when power FALSE when power BOOL KeybdDriverGetInfo( iKeybdId, keyboard iIndex, acquired information index KBDI_VKEY_TO_UNICODE_INFO_ID acquire UNICODE conversion settings KBDI_AUTOREPEAT_INFO_ID acquire AUTOREPEAT settings LPVOID acquire AUTOREPEAT setting information lpOutput pointer acquired information buffer BOOL KeybdDriverInitStates( KEY_STATE void iKeybdId, keyboard KeyState, state array *pKeybdDeviceToUnicodeState @parm Keyboard specific state initialize. BOOL KeybdDriverSetMode( iKeybdId, keyboard iIndex, setting information index KBDI_AUTOREPEAT_INFO_ID LPVOID 4.2.4. Contents Registry lpInput AUTOREPEAT settings pointer setting information Registry required sound driver, used 4.3. Operating Specifications This section explains characteristics Windows keyboard driver. 4.3.1. Scanning keyboard driver determines which keys pressed matrixby scanning keys matrix. acquires state line with eight keys, then repeats this remaining lines. 4.3.2. Interrupts keyboard driver types interrupt. Generating Interrupt Pressing PINT used interrupt generated pressing key, generated when pressed. After PINT generated, keyboard driver initiates scan timer scan keys specified intervals. This interrupt processing. Generating Interrupt Scan Keys with Scan Timer scan timer interrupt processing means keys scanned specified intervals. TMU0 used scan timer interrupt. After scan timer initiated interrupt processing, TMU0 generated every time specified time passed. generating TMU0 with specified timing, scanning performed specified intervals. This scanning timer interrupt processing. entry name KeyboardTimerISR, device number eight (defined SYSINTR_KEYBOARD), priority PCMCIA interrupt 4.3.3. Hardware Initialization keyboard driver initializes hardware calling initialization routine entry function keyboard driver. does call initialization routine keyboard driver program description. 4.3.4. Power Supply Recovery Termination When power supply Windows system turned off, device manager calls power supply termination module function, when power supply turned calls power supply recovery module. However, keyboard driver does have call modules. Therefore, keyboard driver modules initiated modules called device manager ignored. 4.4. Device Driver Service-Provider Interface (DDSI) Specifications This section describes interface between PDD. This section must understood thoroughly driver two-layer driver structure sample source code. single layer driver developed, this section will useful does have understood thoroughly. 4.4.1. Interface Data Specifications data transferred between 4-byte integer type array which buffer store acquired virtual KEY_STATE_FLAGS type array which stores state acquired. Name VirtualKeys [16] KeyEvents[16] UINT32 Type Description store acquired virtual store acquired state virtual KEY_STATE_FLAGS 4.4.2. Interface Function Specifications function prototype defined details, refer online document Reference. Interface function BOOL WINAPI KeybdPdd_InitializeDriver( PFN_KEYBD_EVENT_CALLBACK pfnKeybdEventCallback callback keyboard input attain register address keyscan,initialize device. BOOL KeybdDriverInitializeAddresses( void attain/map register address keyscan WINAPI KeybdPdd_GetEvent( UINT32 VirtualKeys[ buffer virtual buffer state storage KEY_STATE_FLAGS KeyEvents[ scan every keys, acquire state each keys. void WINAPI KeybdPdd_PowerHandler( BOOL bOff condition system power supply TRUE when power FALSE when power off. execute process INLINE UINT GetSenseLine( UINT nScanState status scanning execute scannning INLINE void EnablePowerUp( void power control INLINE void StopTimer( void timerstop companion chip INLINE void StartTimer( UINT16 nTimerCount wait time timerstart next keyscan UINT32 ScanKeyboardCodeToVirtualKey( UINT32 UINT32 UINT32 nShiftCode, nScanCode, nSenseCode //shift code(0=normal, 1='Fn') scanline (0.12) senseline (0.7) 4.4.3. Interface function call relationships DDSI DllEntry KeybdPdd_DllEntry KeybdDriverInitialize KeydbPdd_InitilalizeDriver KeybdDriverThread KeybdDriverInitializeAddress KeybdSendKeyDownToUser (*v_pfnKeybdEventCallback) KeybdSendKeyUpToUser KeybdPdd_GetEvent KeybdDriverVKeyToUnicode AllKeyScan KeybdDriverKeyStateToShiftFlag GetCsr VKeyToUnicode KeybdDriverPowerHandler KeybdPdd_PowerHandler KeybdDriverGetInfo KeybdDriverInitStates Interfacenote fanction Int. Func. KeybdDriverSetMode Fig.4.1 Interface calling relationships module hierarchy 4.4.4. Interface data interface function cross reference Figure shows interface data function reference. About function names descreptions related with this, Fig.4.1. Fig.4.1 Iinterface data function cross-reference Note VirtualKeys [16] Function DllEntry KeybdDriverInitialize KeybdDriverThread KeyEvents [16] Data Int.funct. Int.funct. Int.funct. KeybdSendKeyDownToUser KeybdSendKeyUpToUser KeybdDriverVKeyToUnicode KeybdDriverPowerHandler KeybdDriverGetInfo KeybdDriverInitStates KeybdDriverSetMode KeybdPdd_InitializeDriver KeybdDriverInitializeAddresses KeybdPdd_GetEvent KeybdPdd_PowerHandler InitializePrevSenseArray EnableSenseAll DisableSenseAll GetSenseLine EnablePowerUp StopTimer StartTimer ScanKeyboardCodeToVirtualKey initialize setting reference update Int.funct. 4.5. Platform Dependent Device Driver specifications This chapter describes about points with internal specifications keyboard reference platform. 4.5.1.Global parameter Several global parameters used PDD. Figure lists these global parameters more understanding PDD. Fig.5.1 Global parameters Name v_PioRegs Type PVBYTE Description Headder address SH7709 port register area v_pCCRegs PVBYTE Headder address companion chip register area. g_nTmrCount g_nTmrWait g_aiCurrentSense[13] g_aiPrevSense[13] g_ScanLineTable[13] g_bPowerOff UINT32 UINT32 UINT8 UINT8 SScanLineTable BOOL Internal timer keyscan Wait time resuming keyscan Store keyscan status latest event. Store keyscan status previous event. Scanline settings keyscan. TRUE:Power off, FALSE:Power Keycode conversion table keyboard matrix (Both Key=OFF/Fn Key=ON) ScanCodeToVKeyTable[2][13 UINT32 ][8] 4.5.2. Global parameter function cross reference Fig.5.2 lists global parameter function cross-reference. Fig.5.2 global parameter function cross-reference ScanCodeToVKeyTable[2][13][8] Note MatrixToScanCode1[8][ Parameter g_aiCurrentSense[13] g_nTmrCount g_aiPrevSense[13] g_ScanLineTable[13] KeybdPdd_DllEntry KeybdPdd_InitializeDriver KeybdDriverInitializeAddresses KeybdPdd_GetEvent KeybdPdd_PowerHandler InitializePrevSenseArray EnableSenseAll DisableSenseAll GetSenseLine EnablePowerUp StopTimer StartTimer ScanKeyboardCodeToVirtualKey I:initialize W:setting R:reference U:update Int.funct. g_nTmrWait v_pCCRegs v_pIORegs Function g_bPowerOff 4.5.3. Function processing flowchart KeybdPdd_InitializeDriver Initialize register address keyscan (*pfnKeybdEventCallback) event callback Timer setting KeybdDriverInitializeAddresses Allocate register keyscan access logical area user mode VirtualAlloc() Mapping register keyscan access logical area user mode VirtualCopy() KeybdPdd_GetEvent AllKeyScan Scan keys GetCsr Obtain keycode status Number keys Obtain event virtual pushed KeybdPdd_PowerHandler Shutdown process bOff SetInterruptEvent SYSINTR_KEYBOARD InitializePrevSenseArray Clear g_aiPrevSense by0xff EnableSenseAll Validate keyscan process DisableSenseAll Void keyscan process GetSenseLine Attain column scan EnablePowerUp Validate PINT interrupt StopTimer MR_TCR0 StartTimer TMR_TCR0 TMR_TCVR0 nTimerCount TMR_TCR0 ScanKeyboardCodeToVirtualKey Return configuration doesn't include search area return content Sound Driver 5.1.Preface 5.1.1.Outline sound driver manages audio WAVE files (file extension .wav). sound driver directly accesses hardware provides interface that does depend hardware Windows applications. functions highest-layer interface sound driver follows: Plays back WAVE file physical device Creates WAVE data from data related physical device Controls output level when WAVE file played back following describes details operating function specifications sound driver. 5.1.2.Target Environment Table shows target environment. Table Target Evironment Platform CP09 Function Plays back WAVE file Version 1.01 Notes 5.2. Device Driver Interface (DDI) Specifications This section describes sound driver matches remaining operating system. This section does have thoroughly understood driver two-layer driver structure sample source code. single-layer driver developed, though, this section must understood thoroughly. 5.2.1.Driver Name name sound driver must wavedev.dll because Windows uses this name. this name build sound driver. different name used, driver will loaded memory. Therefore, wavedev.dll been specified default name OAK. definition file 5.2.2.Module Definition sound driver exports modules. These exported dynamic link library, must have same names those used Windows This also true driver name. Table shows module definitions functions. module exported with different name, will match Windows multimedia version 1.01 earlier). sound driver connected Windows multimedia through upper interface driver. Therefore, following module definitions have been specified default names OAK. definition file Table List Definitions Modules Exported their Functions Module (Function) Definition WAV_Init WAV_Deinit WAV_Open WAV_Close WAV_Read WAV_Write WAV_Seek WAV_IOControl WAV_PowerUp WAV_PowerDown Description Initializes device Terminates device Opens device Closes device Reads data device Writes data device Seeks data Controls device Performs power-up processing Performs power-down processing 5.2.3. Function Prototype shown section 5.2.2, differs widely depending version OAK. Therefore, description will given each DDI. details, refer online document Reference Win32 Programmers Reference. Driver entry point BOOL DllEntry( HANDLE hinstDll, instance handle driver DWORD fdwReason, function call reason LPVOID lpvReserved //reserved(not use) Driver export BOOL WAV_Deinit( DWORD dwData DWORD WAV_Init( DWORD Index //return value WAV_Init call RegisterDevice information DWORD WAV_Open( DWORD dwData, return value WAV_Init call(not use) DWORD dwAccess, demanded access code(not use) DWORD dwShareMode demanded share code(not use) BOOL WAV_Close( DWORD dwData return value WAV_Open call DWORD WAV_Read( DWORD dwData, return value WAV_Open call (not use) LPVOID pBuf, //address receive buffer (not use) DWORD readable word length (not use) DWORD WAV_Write( DWORD dwData, return value WAV_Open call (not use) LPCVOID pBuf, address buffer (not use) DWORD recoadable word length (not use) DWORD WAV_Seek( DWORD dwData, return value WAV_Open call (not use) long pos, //seek position (not use) DWORD type FILE_BEGIN, FILE_CURRENT, FILE_END (not use) VOID WAV_PowerUp( VOID VOID WAV_PowerDown( VOID BOOL WAV_IOControl( DWORD dwOpenData, return value WAV_Open call DWORD PBYTE DWORD PBYTE DWORD PDWORD dwCode, control code pBufIn, address input data dwLenIn, size input data pBufOut, address return value dwLenOut, size return value pdwActualOut (not use) 5.2.4. Contents Registry registry required sound driver, none used. 5.3. Operating Specifications This section explains characteristics Windows touch panel driver. described above, sound driver plays back WAVE file physical device reads WAVE data from physical device. this section, former called playback mode latter recording mode. Note: following description, playback module when written playback module* will mean function AudioPlaySound driver version 1.01 earlier versions. 5.3.1. Continuous Playback Operation Once WAVE file played back, sound driver must guarantee completion operation without interruptions. Requirements Level Design When request made play back WAVE file while another WAVE file being played, Critical Section Object, which type thread synchronous support function prevents play-back module* being called request until resource becomes available. resource mentioned here belongs process shared exclusively different thread groups that correspond playback requests made. details Critical Section Object, refer online manual Windows Programmer Guide. Section 5.3.2 also describes playback operation without interruption. Required Conditions Level Design buffer used, recommended that sound driver thread executed high priority, output buffer must large enough avoid playback termination task switching. 5.3.2.Playback Mode sound driver normal playback mode loop playback mode. mode name this section example, driver itself does have simple clear playback operation flag definition. Table shows mode specification. Table Mode Specification when Calling Playback Module* Mode Name Normal playback mode Loop playback mode Description WAVE file played back once (default) WAVE file played back repeatedly wFlags Parameter Setting Values other than (SND_ASYNC SND_LOOP) value obtained result performing logical between (SND_ASYNC SND_LOOP) macro constants that prefixed with SND_ defined which headers related Windows multimedia API. There many macro constants that prefixed with SND_; however, playback module* only responds three types flags transferred through upper layer Windows audio support function (part multimedia support function). Table shows flags related playback mode their meanings. Flags that shown table handled upper layer. Table Flags Related Playback Mode Meaning Each Flag Flag value SND_SYNC SND_ASYNC Description sound driver plays back WAVE file synchronously playback module* does return control until WAVE file played back completely. sound driver plays back WAVE file synchronously playback module* returns control soon WAVE file starts played back. stop WAVE file that played back asynchronously, specify NULL pMemFile parameter call sound driver again. sound driver repeats playing back WAVE file until NULL specified pMemFile parameter sound driver called again. SND_ASYNC specified together with SND_LOOP, WAVE file played back repeatedly. SND_LOOP application specifies synchronous playback when playing back DATA file, user must confirm contents guaranteed upper heirarchy interface Windows audio support function. playback module* always plays back WAVE file asynchronously regardless whether SND_SYNC flag specified lowest-layer interface. mentioned section 5.3.1, request made play back WAVE file while another WAVE file being played, second thread should wait until resource available avoid interrupting first thread being played. However, some cases, second thread acquire resource even first WAVE file being played back because driver operating asynchronously driver Windows uses transfer, resource available while being transferred. such case, playback module* does execute second request returns MMSYSERR_ERROR. sound driver does operate further than this passes control application that application cope with this error. Unlike other versions Windows, Windows installed hand-held through control panel generate clicking sound when user presses keyboard touches touch screen. clicking sound keyboard touch screen same other WAVE files Windows sound driver. other words, request made play back clicking sound keyboard touch screen while WAVE file being played, playback* module that request suspended error code returned, which means ignored. 5.3.3.Recording Mode recording mode uses Analog Front (AFE) interface following algorithm record data. Start reading WAVE data Turns data receive ASTR register, enables reading data. Read WAVE data Stores data 96-byte buffer area starting from ARXDBR register Terminates reading WAVE data Turns data receive ASTR register, stops reading data. 5.3.4.Hardware Initialization sound driver initializes hardware calling initialization routine entry function sound driver. does call initialization routine sound driver program description. 5.3.5.Header Analysis sound driver analyzes WAVE file header determines whether current WAVE file played back target device. file cannot played back, playback module* returns MMSYSTEM_NOTSUPPORTED. 5.3.6.WAVE File Support playback mode, sound driver plays back one-channel WAVE file format 11.025 22.050 kHz. Table shows minimum settings standard WAVE format that should supported Windows system. driver reference platform also these minimum settings sample driver. Table Minimum Settings WAVE Format Type that Windows System will Support sample rate 11.025 bits sample 22.050 44.100 channel monoral stereo monoral stereo monoral stereo monoral stereo monoral stereo monoral stereo Minimum requirements Windows required optional required optional required optional required optional optional optional optional optional recording mode, WAVE data format table read. Table Format WAVE that readable Sample rate 11.025 Bits sample 22.050 44.100 Channel monoral stereo monoral stereo monoral stereo monoral stereo monoral stereo monoral stereo details WAVE format, refer Multimedia Programming Interface Data Specifications 1.0, issued joint design Corporation Corporation, August 1991. 5.3.7.Turn Power When Windows system turned off, device manager calls power-off module, when turned calls power-on module. When system turned off, only hardware device turned off, sound driver does release allocated memory resource. When power supply turned however, sound driver does resume releases resource aborting play-back processing. This enables driver quickly enter wait state processing. 5.3.8.Output Volume Control output volume specified sound driver export function. default output volume full volume. case channel, value parameter v_nVolume private_AudioOutInitialize() function 0xFFFF. output volume controlled level. audio output device volume control interface, driver directly refers hardware specifies output volume. reference platform, hardware does have such function. Therefore, shown table 5.6, volume controlled driver software only. output volume controlling program installed reference platform, volume controlled upper four bits v_nVolume parameter. example, assume value 8-bit sample this case, value v_nVolume parameter 0xCFFF, value input converter according following expressions. -111 Subtract reference value (-111 Multiply -111 0.625 (40/64 62.5%). 40/64 corresponds 0xC. same value input target converter case on-chip converter) value v_nVolume parameter 0x0789, value input converter 128, which means lowest volume specified sound output). value v_nVolume 0xF0A4, value input converter which same volume that original sample. different volume control method used create driver installed platform. Table Software Volume Control Method used Sample Driver Reference Platform Driver high 4bit value parameter v_nVolume value coefficient that multiplies sample before conversion (value divisor against divident high 4bit value parameter v_nVolume(continued) value coefficient that multiplies sample before conversion (value divisor against divident 64)(continued) 5.4. Device Driver Service-Provider Interface (DDSI) Specifications This section describes interface between PDD. This section must thoroughly understood driver two-layer driver structure sample source code. single-layer driver developed, this section will useful does have understood thoroughly. 5.4.1.Interface Data Specifications data structure interface defined following information transferred between PDD. variable indicating state physical device managed enumeration-type variable indicating state playback recording (WAPI_INOUT) waveform output device capabilities structure(WAVEOUTCAPS) general extended waveform format structure. this formats (information common formats) (WAVEFORMATEX) enumeration-type variable indicating type WAVE data (PCM_TYPE) WAVE data block structure (WAVEHDR) Audio Device State Detection Contents Name AUDIO_STATE_ OUT_STOPPED AUDIO_STATE_ OUT_UNDERFLOW State Sound Driver sound driver completed playing back WAVE data operation device stopped. underflow occurred device (error state). When completes playing back buffer page, interrupt generated. Then calls private_AudioOutGetInterrupt() acknowledge state PDD. This function performs following operations. returns AUDIO_STATE_OUT_PLAYING when there buffer page left play back. returns AUDIO_STATE_OUT_STOPPED when page left play back, acknowledges that buffer data will sent from MDD. This correct play back termination. buffer page left play back, buffer data will sent from MDD, means that able provide data time driver play back data, which means that underflow occurred. WAVE data still being played back device making request play back buffer page data. WAVE data been completly read device stopped operation. overflow occurred device. still writing data buffer, however sending data time write data. Even though buffer exists, providing data time playback data, which means underflow occurred. WAVE data still being read device making request read data. Indicates that data must ignored MDD. AUDIO_STATE_IGNORE state used notify state MDD. AUDIO_STATE_ OUT_PLAYING AUDIO_STATE_IN_ STOPPED AUDIO_STATE_IN_ OVERFLOW AUDIO_STATE_IN_ RECORDING AUDIO_STATE_ IGNORE Enumeration type variables indicating state playback recording (WAPI_INOUT) Contents Name WAPI_IN WAPI_OUT State Currently recording mode Currently playback mode Waveform output device capabilities structure (WAVEOUTCAPS) Syntax typedef struct tagWAVEOUTCAPS WORD wMid; WORD wPid; MMVERSION vDriverVersion; TCHAR szPname[MAXPNAMELEN]; DWORD dwFormats; WORD wChannels; WORD wReserved1; DWORD dwSupport; WAVEOUTCAPS, *PWAVEOUTCAPS, *NPWAVEOUTCAPS, *LPWAVEOUTCAPS; Member Name Description wMid wPid vDriverVersion szPname dwFormats wChannels wReserved1 dwSupport manufacturer product driver version product name(has NULL character end) Formats supported Number sources supported reserved Functionality supported driver General extended waveform format structure this formats (information common formats) (WAVEFORMATEX) Syntax typedef struct tWAVEFORMATEX WORD wFormatTag; WORD nChannels; DWORD nSamplesPerSec; DWORD nAvgBytesPerSec; WORD nBlockAlign; WORD wBitsPerSample; WORD cbSize; WAVEFORMATEX; Member Name wFormatTag nChannels nSamplesPerSec nAvgBytesPerSec nBlockAlign wBitsPerSample cbSize Description format type channel(monoral stereo) sample rate buffer estimation size data block sample number monoral data length data followed cbSize enum parameter indicating type WAVE data(PCM_TYPE) contents Name PCM_TYPE_M8 PCM_TYPE_M16 PCM_TYPE_S8 PCM_TYPE_S16 Status monoral data, 8bits monoral data, 16bits stereo data, 8bits stereo data, 16bits WAVE data block structure(WAVEHDR) syntax typedef struct wavehdr_tag LPSTR lpData; DWORD dwBufferLength; DWORD dwBytesRecorded; DWORD dwUser; DWORD dwFlags; DWORD dwLoops; struct wavehdr_tag *lpNext; DWORD reserved; WAVEHDR, *PWAVEHDR, NEAR *NPWAVEHDR, *LPWAVEHDR;menber Name lpData dwBufferLength dwBytesRecorded dwUser dwFlags dwLoops lpNext reserved Description pointer locked data buffer length data buffer only when recording client's Assorted flags (see definition) loop counter next pointer WAVEHDR reserved dwFormats formats supported 5.4.2. Interface Function Specifications function prototype defined details refer online document Reference. Interface function AUDIO_STATE PDD_AudioGetInterruptType VOID //Evaluate status every transmission buffer page. DWORD PDD_AudioMessage UINT uMsg, transmitting message DWORD dwParam1, parameter DWORD dwParam2 parameter //transmit message BOOL PDD_AudioInitialize VOID //allocate work area from logical memory, initialize devices VOID PDD_AudioDeinitialize VOID //powerdown, hangup connection VOID PDD_AudioPowerHandler BOOL power_down TRUE, powerdown,else power power management MMRESULT PDD_WaveProc WAPI_INOUT apidir, type recording/playing DWORD dwCode, requifee DWORD dwParam1, parameter1 DWORD dwParam2 parameter2 dispense processing recording playing 5.4.3.Function call interface/peripheral DDS1 WAV_Init WMDD_Init PDD_AudioInitialize Private_AudioInitialize GetVirtualAddressOfUncached Memory FreeAllocateVirtualMemory WAV_Deinit Private_AudioOutitialize WMDD_Deinit Private_AudioDeinitialize WAV_PowerUp Private_AudioOutDeinitialize WMDD_PowerHandler PDD_AudioPowerHandlerInitialize Private_AudioOutPowerHandler WAV_PowerDown Private_AudioInPowerHandler WMDD_PowerHandler note Interface function Figure5.8 Call relationship interface module level Int. Func WAV_IOControl wdev_COMMON_BreakLoop MarkAllAsNotInLoop MarkAllAsDone PDD_WaveProc wdev_WODM_RESET Private_WaveInClose wdev_WIDM_RESET MarkAllAsDone Private_WaveOutClose wdev_COMMON_CLOSE Private_WaveInContinue wdev_COMMON_GETDEVCAPS Private_WaveOutContinue wdev_COMMON_GETNUMDEVS Private_AudioFillBuffer wdev_WODM_GETVOLUME wdev_COMMON_OPEN Write_AudioPlayingAddress wdev_WODM_PAUSE Private_WaveInOpen wdev_WODM_RESTART Private_WaveOutOpen wdev_WODM_SETVOLUME Private_WaveInStart wdev_WIDM_START wdev_WIDM_STOP Private_WaveOutStart wdev_WODM_WRITE SatrtCMT wdev_WODM_GETPITCH Private_WaveInStandby Call relationship interface module level wdev_WODM_GETPLAYBACKRATE Private_WaveOutStandby wdev_WODM_SETPLAYBACKRATE Private_WaveInStop wdev_COMMON_GETPOS Private_WaveOutStop wdev_COMMON_PREPARE Write_AudioPlayingAddress wdev_WODM_SETPITCH Private_WaveOutPause wdev_COMMON_UNPREPARE Private_WaveOutEndOfData WaveAudioPlayingAddress wdev_COMMON_ADDBUFFER Private_WaveOutRestart Private_AudioGetVolume Private_AudioSetVolume Private_WaveGetDevCaps PDD_AudioMessage WMDD_InterruptThread PDD_AudioGetInterruptTypes MarkAllAsFull Private_AudioGetInterruptType MarkAllAsNotInLoop Private_AudioGetOutterruptType MarkFullAsDone PDD_WaveProc Call relationship interface module level (Continue) description section described table 5.9, showing cross reference between DDSI interface data functions. Refer figure cross reference functions their operations. Table Cross Reference between DDSI Interface Function WAVEFORMATE WAVEOUTCAPS note PCM_TYPE WAVEHDR dwBytesRecorded dwBufferLength AUDIO_STATE DATA function nAvgBytesPerSec wBitsPerSample nSamplesPerSec wMid wPid vDriverVersion nBlockAlign wFormatTag dwFormats wChannels dwSupport nChannels dwLoops szPname dwFlags dwUser wdev_COMMON_ADDB UFFER wdev_COMMON_CLOS wdev_COMMON_GETD EVCAPS wdev_COMMON_GETN UMDEVS wdev_COMMON_GETP wdev_COMMON_OPEN wdev_COMMON_PREP wdev_COMMON_UNPR EPARE WAV_Deinit WAV_Init WAV_Open WAV_Close WAV_Read WAV_Write WAV_Seek WAV_PowerUp WAV_PowerDown WAV_IOControl dllentry RemoveCompleteBlocks GetBytePosition MarkAllAsDone MarkAllAsNotInLoop MarkAllAsFull lpNext Int.funct. Int.funct. Int.funct. Int.funct. Int.funct. cbSize lpData MarkFullAsDone InitGSI Int.funct. Int.funct. WMDD_InterruptThrea WMDD_PowerHandler WMDD_Deinit WMDD_Init wdev_WIDM_RESET wdev_WIDM_START wdev_WIDM_STOP wdev_WODM_BREAKL wdev_WODM_GETPITC wdev_WODM_GETPLA YBACKRATE wdev_WODM_GETVOL wdev_WODM_PAUSE wdev_WODM_RESET wdev_WODM_RESTAR wdev_WODM_SETPITC wdev_WODM_SETPLA YBACKRATE wdev_WODM_SETVOL wdev_WODM_WRITE private_AudioInGetInterru ptType private_AudioInInitialize private_AudioInPowerHa ndler AudioOutPowerHandler private_AudioInDeinitiali private_WaveInStart private_WaveInContinue private_WaveInStop private_WaveInStandby private_WaveInClose private_WaveInOpen private_AudioOutGetInter ruptType private_AudioOutInitializ private_AudioOutPowerH andler private_AudioOutDeinitial private_WaveOutStart private_AudioFillBuffer private_AudioPlayFirstBu ffer private_WaveOutContinue private_WaveOutRestart private_WaveOutPause private_WaveOutStop private_WaveOutEndOfD private_WaveOutStandby private_WaveOutOpen private_WaveOutClose private_AudioGetVolume private_AudioSetVolume PDD_AudioGetInterruptT PDD_AudioInitialize PDD_AudioPowerHandler PDD_AudioMessage PDD_AudioDeinitialize private_WaveGetDevCaps PDD_WaveProc FreeAllocatedVirtualMem GetVirtualAddressOfUnca chedMemory note Initalize config. referring renewal Int.funct. Int.funct. 5.5. Platform Dependent Device Driver (PDD) Specifications This section describes major internal specifications reference platform keyboard PDD. 5.5.1.Global Variables uses following global variables. important understand variables order understand PDD. Tables lists variables. Table 5.10 Global Variables Variable g_pwfx[2] g_pcmtype[2] g_pAFE g_pGPIO g_pLED g_dwAfeDelayTime 1000 g_nAfeControlRegister g_nAfeMasterClockRegister g_dwOverruns g_dwFrames pIRR1 pIPRE pDACR virtual address control resistor pSAR2 pDAR2 pDMATCR2 pCHCR2 pCMSTR pCMCSR pCMCOR pCMCNT dma_page[2] dma_pagePhysicalAddress[2] pAudioPlayingAddress v_nNextPag pAudioOutInterrupt pRegisterBase pDrvGlobalBase v_nVolume v_fMoreData[2] clockRate Type PWAVEFORMATEX PCM_TYPE PUCHAR PUCHAR PUCHAR DWORD USHORT UCHAR DWORD DWORD PVBYTE PVBYTE PVBYTE PVUSHORT PVULONG PVULONG PVULONG PVULONG PVUSHORT PVUSHORT PVUSHORT PVUSHORT static PVBYTE static const PVBYTE PVBYTE static ULONG PVSHORT static PBYTE static PBYTE static ULONG static volatile BOOL static LONG Description array waveform format structure Distinguish 8bits/16bits, stereo monoral. Interface(companion chip) GPIO Interface(SH3) debugging port Delay counter when launching AFE. Value STLC6550 control register Value SCPDR clock (SH) Overrun error Frame number words Interrupt request. virtual address Interrupt priority. virtual address Virtual address control resistor Virtual address DMA2 opeation resistor Virtual address DMA2 opeation resistor Virtual address DMA2 opeation resistor Virtual address DMA2 control resistor Virtual address DMA2 control resistor Virtual address resistor Virtual address resistor Virtual address array pointing dma_pagePhysicalAddress[i] Real address array data buffer Buffer address playing. Begin playing interrupt occurs Array number dma_page[i] PDD_GetInterruptType renders TRUE when recent Playback passes. Base address resistor offset Base address AudioPlayingAddress Current volume configuration Calls TRUE when StopPlay Indicates MHz. Dependent hardware 5.5.2.Cross Reference between Global Variables Functions Table 5.11 shows cross reference between global variables functions. Table 5.11 Cross Reference between Global Variables Functions pIRR1, pIPRE, pDACR, pDMAOR, pDAR2, pCHCR2, pCMSTR, pCMCSR, PcmcnT pSAR2, pDMATCR2, pCMCOR Data g_nAfeMasterClockRegister dma_pagePhysicalAddress g_nAfeControlRegister g_dwAfeDelayTime Function pAudioPlayingAddress pAudioOutInterrupt pDrvGlobalBase g_dwOverruns pRegisterBase v_fMoreData g_dwFrames v_nNextPag v_nVolume g_pcmtype dma_page private_AudioInGetInterruptType private_AudioInInitialize private_AudioInPowerHandler AudioOutPowerHandler private_AudioInDeinitialize private_WaveInStart private_WaveInContinue private_WaveInStop private_WaveInStandby private_WaveInClose private_WaveInOpen private_AudioOutInitialize private_AudioOutPowerHandler private_AudioOutDeinitialize private_WaveOutStart private_AudioFillBuffer private_AudioPlayFirstBuffer private_WaveOutContinue private_WaveOutRestart private_WaveOutPause private_WaveOutStop private_WaveOutEndOfData private_WaveOutStandby private_WaveOutOpen private_WaveOutClose private_AudioGetVolume clockRate g_PgpIO g_pwfx g_Pled g_Pafe private_AudioSetVolume PDD_AudioGetInterruptType PDD_AudioInitialize PDD_AudioPowerHandler PDD_AudioMessage PDD_AudioDeinitialize private_WaveGetDevCaps PDD_WaveProc FreeAllocatedVirtualMemory GetVirtualAddressOfUncachedMem note Initialize configuration referring updating 5.5.3.DMA Buffer sound driver reference platform uses buffers DRAM alternatively. size buffer 2048 bytes page. memory must allocated same config.bib file, which setting file image builder utility. config.bib file, memory allocation information work area used various device drivers firmware defined. setting value start address buffer 0xAC002000 non-cachable fixed physical space address. 5.5.4.DMA Driven Sampling Frequency sound driver Windows always drives DMAC KHz, which means that sampling data sampled sampling ratio KHz, sampling data sampled time sampling ratio KHz. driven frequency specified count value internal timer SH7707/SH7709 on-chip DMAC. count value calculated following expression: integer closest (External clock rate)/(divider ratio)/22050 This value defined following macro defintion file audiopdd.h. platform AUDIO_TIMER_COUNT_RATE_22KHZ platform CP09, AUDIO_CMT_RATE_22KHZ 5.5.5. Function processing flowchart PDD_AudioGetInterruptType Distinguish sort interruption PDD_AudioInitialize Initializing record play back private_AudioInInitialize() private_AudioOutInitialize() PDD_AudioPowerHandler power_down Control power private_AudioOutPowerHandler() private_AudioInPowerHandler() PDD_AudioMessage (uMsg ,dwParam1 ,dwParam2 Return MMSYSERR_NOTSUPPORTED PDD_AudioDeinitialize initialization private_AudioInDeinitialize() private_AudioOutDeinitialize() private_WaveGetDevCaps (apidir ,pCaps ,wSize) Setting device information pwc->wMid pwc->wPid pwc->vDriverVersion pwc->szPname pwc->dwFormats pwc->wChannels Setting volume pwc->dwSupport TRUE Play back PDD_WaveProc (apidir,dwCode ,dwParam1, dwParam2) Close wave file private_WaveInClose() private_WaveOutClose() WPDM_CLOSE Request code WPDM_CONTINUE Continue record play back private_WaveInContinue() private_WaveOutContinue() WPDM_GETDEVCAPS Setting device information private_WaveGetDevCaps() WPDM_OPEN Opening wave file private_WaveInOpen() private_WaveOutOpen() WPDM_STANDBY Standby record play back private_WaveInStandby() private_WaveOutOpen() WPDM_START Starting record play back private_WaveInStart() private_WaveOutStart() WPDM_STOP Stop record play back private_WaveInStop() private_WaveOutStop() Pause record play back private_WaveOutPause() WPDM_PAUSE WPDM_ENDOFDATA Detect private_WaveOutEndOfData() WPDM_GETDEVCAPS Restarting play back WPDM_RESTART() WPDM_GETVOLUME Getting volume information private_AudioGetVolume() WPDM_SETVOLUME Setting volume information private_AudioSetVolume() FreeAllocatedVirtualMemory (virtualAddress) Open area VirtualFree() (physicalAddress ,size, callerID) area VirtualAlloc() VirtualCopy() FreeAllocatedVirtualMemory() private_AudioInGetInterruptType lpnVolume Switch RERR ASTR g_dwOverruns++; return AUDIO_STATE_IN_OVERFLOW Switch ASTR g_dwFrames++; return AUDIO_STATE_IN_ RECORDING return AUDIO_STATE_IGNORE private_AudioInInitialize Getting g_pAF,g_pGPIO g_pLED area Setting delay counter AdjustMicroSecondsToLoopCount() private_AudioInPowerHandler (bPowerDown ,bInKernel) Request code bPowerDown Setting ACTR SCPDR Setting SCPCR,SCPDR,ACTR ATXDR Setting ASTR private_AudioInDeinitialize Open g_pAF g_pGPIO g_pLED area FreeAllocatedVirtualMemory() private_WaveInStart (pwh Read ASTR Switch REIR RXIR ACTR private_WaveInContinue (pwh Take sample from Buffer size Input size Buffer size Setting next point sample from WAVEHDR Switch ASTR 8bit monoral pSample->Set m8.sample dwBytesRecorded 8bit stereo pSample->set s8.sample_left,_right dwBytesRecorded 16bit monoral pSample->set m16.sample dwBytesRecorded 16bit stereo pSample->set s16.sample_left,_right dwBytesRecorded private_WaveInStop Setting ACTR private_WaveInStandby lpnVolume Setting ACTR private_WaveInClose Power private_AudioInPowerHandler() private_WaveInOpen Illegal data mmRet WAVERR_BADFORMAT Setting 8/16bit monoral/stereo Setting g_nAfeMasterClockRegister g_nAfeControlRegister Power private_AudioInPowerHandler() !AudioOutInterrupt() return AUDIO_STATE_OUT_STOPPED ResetAudioOutInterrupt() v_fMoreData return AUDIO_STATE_OUT_STOPPED AudioPlayingAddress() return AUDIO_STATE_ OUT_PLAYING return AUDIO_STATE_ OUT_UNDERFLOW private_AudioOutInitialize pRegisterBase area, dma_page area, pDrvGlobalBase area Setting register Setting pAudioPlayingAddress pAudioOutInterrupt Setting volume ResetAudioOutInterrupt() private_AudioOutPowerHandler (bPowerDown) bPowerDown playback wave file private_AudioOutDeinitialize() Initialize play back Wave file private_AudioOutInitialize() private_AudioOutDeinitialize set-up register DisableDMA2() ClearDMA2Interrupt() DisableDA0() Open area FreeAllocatedVirtualMemory() private_WaveOutStart (pwh) Start StartCMT() v_nNextPage Transfer wave file buffer private_AudioFillBuffer() Transfer wave file buffer private_AudioFillBuffer() Initialize audio interrupt flagAudio ResetAudioOutInterrupt() Start play back wave file private_AudioPlayFirstBuffer() private_AudioFillBuffer (pwh) Setting volume data Input silent data Buffer size Setting sample WriteAudioPlayingAddress() v_nNextPage v_nNextPage private_AudioPlayFirstBuffer Transfer first buffer WriteSAR2() WriteDMATCR2() ClearDMA2Interrupt() Start play back first buffer StartDMA2Transfer() private_WaveOutContinue (pwh) private_AudioFillBuffer() private_WaveOutPause private_WaveOutEndOfData() private_WaveOutStop v_fMoreData[WAPI_OUT] FALSE WriteAudioPlayingAddress() private_WaveOutEndOfData WriteAudioPlayingAddress() v_fMoreData[WAPI_OUT] FALSE Stop StopCMT() private_WaveOutStandby DisableDMA2() ClearDMA2Interrupt() StopCMT() private_WaveOutOpen (pFormat ,fQueryFormatOnly) Check wave format Format mmRet WAVERR_BADFORMAT Setting 8/16bit,monoral/stereo private_AudioGetVolume lpnVolume Return volume information private_AudioSetVolume (volumeSetting Setting volume information Hitachi Confidential 7.1. PCMCIA Driver Prefaces 7.1.1.Outline PCMCIA driver uses SH7709 on-chip PCMCIA controller interface between card. PCMCIA driver directly accesses hardware provides interface that does depend Microsoft® Windows® Windows applications. following describes details operating function specifications PCMCIA driver. 7.1.2. PCMCIA Driver Supported Card PCMCIA driver supports only following SRAM card. Manufacturer: Hitachi Maxell Card type: SRAM card (2MB) Product type name: ML-2M-TB4N Hitachi Confidential 7.2. Device Driver Interface (DDI) Specifications This section describes PCMCIA driver matches remaining operating system. 7.2.1.Driver Name name PCMCIA driver must pcmcia.dll because Windows uses this name. this name build PCMCIA driver. different name used, driver will loaded memory. Therefore, pcmcia.dll been specified default name OAK. driver exported with different name, will match Win32 Windows API. PCMCIA driver connected Win32 Windows through upper interface driver. definition file 7.2.2.Module Definition PCMCIA driver exports modules. They exported dynamic link library, must have same names used Windows Table shows module definitions functions. definition file file. Table List Definitions Modules Exported their Functions Module(function)definition name CallbackThread CardDeregisterClient CardRegisterClient CardGetStatus CardRequestConfiguration CardSystemPower CardAccessConfigurationRegister CardModifyWindow CardMapWindow Callback each event Unregister card Register card socket status Configure card interface/power supply voltage Turn ON/OFF card power supply Read/write attribute memory card Modify attribute memory window Allocate memory window Description Hitachi Confidential 7.2.3. Function Prototype shown section 7.2, differs widely depending version OAK. details, refer online document Reference Win32 Programmers Reference. Driver Entry Point BOOL DllEntry( HINSTANCE DllInstance, Reason, LPVOID Reserved Instance handle fordriver Reason function call //Reserved, use. Driver Export UINT CallbackThread( UINT Nothing STATUS CardDeregisterClient CARD_CLIENT_HANDLE hCardClient //Handle card client. STATUS CardGetStatus PCARD_STATUS pStatus Pointer structure indicating socket status. CARD_CLIENT_HANDLE CardRegisterClient CLIENT_CALLBACK CallBackFn, Pointer callback function. PCARD_REGISTER_PARMS pParms Pointer structure storing parameter. UINT StatusChangeThread UINT Nothing use. STATUS CardRequestConfiguration CARD_CLIENT_HANDLE hCardClient, Handle card client. PCARD_CONFIG_INFO pParms Pointer card information structure. STATUS CardSystemPower UINT32 bOff Switch event STATUS CardAccessConfigurationRegister CARD_CLIENT_HANDLE hCardClient, Handle card client CARD_SOCKET_HANDLE hSock, Handle socket UINT8 rw_flag, Switch flag reading/writing card. UINT8 offset, Offset card memory address UINT8 *pValue Pointer write data STATUS CardModifyWindow CARD_WINDOW_HANDLE hWin, Handle memory window UINT16 fAttributes, window attribute value UINT8 fAccessSpeed access speed value PVOID CardMapWindow CARD_WINDOW_HANDLE hWin, Handle memory window UINT32 uCardAddress, Allocated start address cardmap UINT32 uSize, Allocateed region size cardmap PUINT32 pGranularity Multiplier given memory address size Hitachi Confidential 7.3. Operating Specifications This section describes PCMCIA driver software hardware. 7.3.1. Hardware Configuration Figure shows PCMCIA interface. Since buffer card same power supply, power supply buffer turned even when PCMCIA driver waiting card inserted. Buffer Card Slot Figure PCMCIA Interface 7.3.2. Memory Window Structure SH7709 on-chip PCMCIA controller uses areas PCMCIA controller area mode specified Continuous 32-MB Area Mode. this case, address space fixed SH7709 specifications (see figure 7.3). user define window freely within this address space. Figure shows five memory maps defined this driver. Attribute memory 16MB figure PCMCIA address space Hitachi Confidential 14000000 15000000 18000000 19000000 1A000000 Window0 Attribute(8bit/16bit width) Window2 Common(8bit/16bit width) Window1 Attribute(8bit/16bit width) Window3 Common(8bit/16bit width) Window4 I/O(8bit/16bit width) Figure Window Memory 7.3.3. Hardware Initialization PCMCIA driver initializes hardware calling initialization routine entry function PCMCIA driver. does call initialization routine PCMCIA driver program description. initialization routine, card power supply This turns driver card interface receives card detection signals (CD1, CD2). 7.3.4. Interrupt Processing PCMCIA driver branches interrupt service routine (ISR) response CD2. PCMCIA described ccISRs.src. ISR, device number assigned register after determines that card detection interrupt occurred. entry name main_isr_Pcmcia0 main_isr_Pcmcia1, device number (defined SYSINTR_PCMCIA_LEVEL SYSINTR_PCMCIA_STATE, respectively), priority PCMCIA interrupt allocated 7.3.5. Interface Function Specifications function prototype defined Interface Function STATUS PDCardInitServices VOID initialize device STATUS PDCardInquireAdapter PPDCARD_ADAPTER_INFO pAdapterInfo Pointer structure including adapter information Acquire card information STATUS PDCardGetAdapter PPDCARD_ADAPTER_STATE pAdapterState *pState Pointer adapter status STATUS PDCardSetAdapter PPDCARD_ADAPTER_STATE pAdapterState Pointer adapter status Configuration card power supply(on this driver,RETURN) STATUS PDCardInquireWindow UINT32 uWindow, Window number PPDCARD_WINDOW_INFO pWindowInfo Pointer window information structure. Acquire window information STATUS PDCardGetWindow UINT32 uWindow, PPDCARD_WINDOW_STATE pWindowState Acquire window state Window number Pointer window state structure. Hitachi Confidential STATUS PDCardSetWindow UINT32 uWindow, Window number PPDCARD_WINDOW_STATE pWindowState Pointer window state structure Update window state information STATUS PDCardGetSocket UINT32 uSocket, Socket number PPDCARD_SOCKET_STATE pSocketState Pointer socket state structure Acquire card event information STATUS PDCardSetSocket UINT32 uSocket, Socket number PPDCARD_SOCKET_STATE pSocketState Pointer socket state structure Configuration interrupt card power supply STATUS PDCardResetSocket UINT32 uSocket Socket number Reset card UINT8 PDCardReadAttrByte PVOID pCardMem, Pointer card memory address UINT32 uOffset Offset card memory address Read attribute memory UINT8 PDCardReadCmnByte PVOID pCardMem, Pointer card memory address UINT32 uOffset Offset card memory address Read common memory UINT8 PDCardWriteAttrByte PVOID pCardMem, Pointer card memory address UINT32 uOffset, Offset card memory address UINT8 uByte Write data (1byte) Write attribute memory Hitachi Confidential 7.4. Platform-dependent Device Driver (PDD) Specifications This section describes PCMCIA. 7.4.1.Relationship between Interface Functions DDSI itServices InitCardSvc PDCardResetSocket CallbackThread PDCardGetSocket PDCardSetSocket CreateDeviceID PDCardGetAdapter CardDeregisterClient PDCardSetAdapter CardReleaseConfiguration CardReleaseIRQ PDCardReadCmnByte PDCardReadAttrByte CardGetStatus iteAttrByte CardRegisterClient StatusChangeThread tueem sPow CardSystemPower CardAccessConfigurationRegister Interface Fig.7.5 calling relationships module hieralchy Hitachi Confidential 7.4.2.Global Variables global variables used listed table 7.6. Table Global Variables Used Parameter PcmciaRegisters[ v_WinState[ v_WinInfo[ v_AdapterState[ v_AdapterInfo struct struct struct UINT32 struct Type Description Store header address PCMCIA control register Structure storing PCMCIA window status Structure storing PCMCIA window information Indicates status card power supply Structure card information (card power supply, etc.) Structure card information (kind card, received interrupt, etc.) Structure storing voltage card power supply Stores Vcc, settings socket Stores Vcc, settings socket v_SockState[ struct v_PowerEntries[4] PowerSettingsA[4][4] PowerSettingsB[4][4] struct POWER_REGISTER_VALU POWER_REGISTER_VALU CRITICAL_SECTION CRITICAL_SECTION CRITICAL_SECTION CRITICAL_SECTION PVBYTE PVBYTE PVBYTE PVBYTE gPddSocketCrit gPddWindowCrit gPddMemoryCrit gPddPowerCrit pPcmciaBase pGPIOBase pDriverGlobals pControlRegs Critical section reentrant Store header address mapping area register control Hitachi Confidential 7.4.3. Cross Reference between Global Variables Functions Table shows cross reference between global variables. Table Cross Reference between Global Functions note PowerSettingsA[4][4] parameter PowerSettings [4][4] PcmciaRegisters[ v_AdapterState[ v_PowerEntries[4] gPddWindowCrit gPddMemoryCrit v_SockState[ gPddSocketCrit pDriverGlobals gPddPowerCrit v_WinState[ v_AdapterInfo v_WinInfo[ PDCardInitServices PDCardInquireWindow PDCardGetWindow PDCardSetWindow PDCardReadCmnByte PDCardReadAttrByte PDCardWriteAttrByte PDCardInquireAdapter PDCardGetAdapter PDCardSetAdapter PDCardResetSocket PDCardGetSocket PDCardSetSocket SetPower pGPIOBase function pControlRegs Int.fun initialize configuration reference update pPcmciaBase Hitachi Confidential 7.4.4. Flowchart Function Processing PDCardInitServices Memory allocation mapping PDMCIA register access user-mode logical space VirtualAlloc() VirtualCopy() Initialize global parameter PCMCIA reset Setting PCMCIA controller operation mode Hitachi Confidential PDCardReadCmnByte Read 1byte from common memory PDCardReadAttrByte Read 1byte from attribute memory PDCardWriteAttrByte Write 1byte attribute memory Hitachi Confidential PDCardGetWindow Return CERR_BAD_WINDOW Selected window number>Defined window number Acquire window state Copy v_WinState pWindowState Hitachi Confidential PDCardSetWindow Return CERR_BAD_WINDOW Selected window number>Defined window number Setting window BCN_BCR2 status,access speed,address offset, v_WinState.fState pWindowState->fState; v_WinState.fSpeed pWindowState->fSpeed; v_WinState.uOffset pWindowState->uOffset; Hitachi Confidential PDCardInquireWindow Return CERR_BAD_WINDOW Selected window number>Defined window number Acquire window information Copy v_WinInfo pWinInfo Hitachi Confidential PDCardResetSocket Return CERR_BAD_SOCKET Selected socket number>Defined socket number Reset card CD2= (CardDetect#2=0) Hitachi Confidential PDCardGetSocket Return CERR_BAD_SOCKET Hitachi Confidential PDCardSetSocket Return CERR_BAD_SOCKET Hitachi Confidential PDCardGetAdapter Return CERR_BAD_SOCKET Return CERR_BAD_ARGS pState NULL *pState v_AdapterState[uSocket] Hitachi Confidential PDCardSetAdapter Return CERR_BAD_SOCKET Return CERR_BAD_ARGS pState NULL Power v_AdapterState *pState Hitachi Confidential PDCardInquireAdapter Return CERR_BAD_ARG_LENGTH Hitachi Confidential SetPower Power supply setting power-supply relative register Hitachi Confidential Preface Outline driver displays information transmitted Microsoft® Windows® LCD. Target Environment Table shows target environment. Table Target Environment. Platform Function Version CP09 Display 1.01 Note Operating Specifications This section explains characteristics Windows driver. Display Operation This driver allocates following LCD. Table Panel Display Color display Display size(V Color depth 240*640 colors display 240*640 2colors4gradation colors displayed stored PALETTEENTRY structure.For details structure, refer Hitachi Confidential Platform-dependent Device Driver (PDD) Specifications This section describes internal specifications reference platform. Class class called CE2Disp used display LCD. This CE2Disp class defined derived class class defined MDD. Therefore, understand CE2Disp class, necessary understand class. Refer class. Working Area Used This driver acquires following four working areas. Table Working Areas name m_PdisplayRegs m_pDACRRegs Size (bytes) 1024 Address 0xb0001000 0xA4000000 Applications Register display Audio register contrast configuration m_pLinearVideoMem m_pPrimarySurface ->Buffer 2048*1024 640*240 0xB2000000 Video memory Display buffer Hitachi Confidential Function process flowchart CE2Disp::CE2Disp Getting work area VirtualAlloc() VirtualCopy() CE2Disp::dspInitAttribute (inModelTypes) Setting register Hitachi Confidential CE2Disp::SetMode (modelid ,pPalette) Power control PowerHandle() Getting display area AllocSurface() Setting palette SetPalette() Hitachi Confidential CE2Disp::ContrastControl (cmd,pValue) Switch(cmd) CONTRAST_CMD_GET Setting present status Change setting value present CONTRAST_CMD_SET value present value(Max254) CONTRAST_CMD_INCREASE Minus from present value(minimum CONTRAST_CMD_DECLEASE Clear present value CONTRAST_CMD_DEFAULT Hitachi Confidential CE2Disp::PowerHandle (bOff) Setting register dspInitAttribute() Hitachi Confidential Other recent searchesPL123-04 - PL123-04 PL123-04 Datasheet PIC16C52 - PIC16C52 PIC16C52 Datasheet NZ2016S - NZ2016S NZ2016S Datasheet NZ2016SA - NZ2016SA NZ2016SA Datasheet HM5116405 - HM5116405 HM5116405 Datasheet GR-326-Core - GR-326-Core GR-326-Core Datasheet CP353V - CP353V CP353V Datasheet Al3m - Al3m Al3m Datasheet
Privacy Policy | Disclaimer |