본문 바로가기
프로그래밍/시스템

[WinCE BSP] 스트림 인터페이스 드라이버

by 써드아이 2008. 2. 6.

* Registration

HANDLE RegisterDevice( LPCWSTR lpszType, DWORD dwIndex, LPCWSTR lpszLib, DWORD dwInfo )
BOOL DeregisterDevice( HANDLE hDevice )

HANDLE ActivateDevice( LPCWSTR lpszDevKey, DWORD dwClientInfo )
HANDLE ActivateDeviceEx( LPCWSTR lpszDevKey, LPPCVOID lpRegEnts,
                                        DWORD cRegEnts, DWORD lpvParam )
BOOL DeactivateDevice( HANDLE hDevice )


* Interface

DWORD xxx_Init( LPCTSTR pContext, DWORD dwBusContenxt )
BOOL xxx_PreDeinit( DWORD hDeviceContext )
BOOL xxx_Deinit( DWORD hDeviceContext )

DWORD xxx_Open( DWORD hDeviceContext, DWORD AccessCode, DWORD ShareMode )
BOOL xxx_PreClose( DWORD hOpenContext )
BOOL xxx_Close( DWORD hOpenContext )

void xxx_PowerUp( DWORD hDeviceContext )
void xxx_PowerDown( DWORD hDeviceContext )

DWORD xxx_Read( DWORD hOpenContext, LPVOID pBuffer, DWORD Count )
DWORD xxx_Seek( DWORD hOpenContext, long Amount, WORD Type )
DWORD xxx_Write( DWORD hOpenContext, LPCVOID pBuffer, DWORD Count )

BOOL xxx_IOControl( DWORD hOpenContext, DWORD dwCode,
                               PBYTE pBufIn, DWORD dwLenIn,
                               PBYTE pBufOut, DWORD dwLenOut,
                               PWORD pdwActualOut )


* IST - InterruptServiceThread

- prepare thread
CreateEvent()
CreateThread()
CeSetThreadPriority()
InterruptDisable()
InterruptInitialilze()

- finish thread
InterruptDisable()
WaitforSingleObject()
CloseHandle()
CloseHandle()


- thread
while ( 1 )
{
    WaitforSignelObject()
 
    if ( )
        break;
 
    InterruptDone()
}