- Init
 - -PreDeInit
 - DeInit
 - Open
 - -PreClose
 - Close
 - PowerUp
 - PowerDown
 - IOControl
 
MDD和PDD最後會Link啟程成為Dll。
最後Dll name和export function 在PDD的build file中定義 *.def。
因為MDD在上層,是MS為了統一driver interface所寫的,所以export funciton 也通常會是implement在MDD中。
MDD, PDD 雖然是Link在一起,但是溝通並不是直接使用funcion name,
而是透過function table (array)。
在MDD呼叫PDD的Init function時,MDD, PDD 互傳需要的function array。
( 既然PDD_Init都直接call了,為甚麼其他的就要透過function array ?
又不兩個DLL,動態load,沒辦法直接call..)
UfnPdd_Init(pszActiveKey : 好像是registry Key
LPCTSTR pszActiveKey,
PVOID pvMddContext,
PUFN_MDD_INTERFACE_INFO pMddInterfaceInfo,
PUFN_PDD_INTERFACE_INFO pPddInterfaceInfo
)
pvMddContext : 指向使用Mdd Class ?
pMddInterfaceInfo : 只是一個version string 和一個function pointer - PUFN_MDD_INTERFACE_INFO. Callback funciton.
pPddInterfaceInfo : Init Function 就是要把這個function table 都填好,給Mdd使用。
Ufn_Init 從registry 中取出chip access memory base address, range, isrname, 做好access chip 的準備。
create需要的event, critical section, thread. BusAccessHandle
安裝isr : KernelIoControl(IOCTL_HAL_REQUEST_SYSINTR...)
USB 的Pdd 好像只需要MDD的一個function : Notify。
PDD則要準備好 PUFN_PDD_INTERFACE_INFO 內的20個function,供MDD使用:
MDD呼叫的順序是
- DllEntry
 - Init
 - IOControl
 - IsConfigurationSupportable
 - IsEndpointSupportable x 3
 - RegisterDevice
 - InitEndpoint
 - IOControl
 - Start
 
enumeration process:
- IssueTransfer
 - SendControlStatusHandshake
 - SetAddress
 - SendControlStatusHandshake
 - IssueTransfer
 - SendControlStatusHandshake
 
之後
- InitialEndpoint
 - ClearEndpointStall
 
- IssueTransfer
 - SendControlStatusHandshake
 
沒有留言:
張貼留言