天天看點

iic總線驅動架構

iic總線驅動分為兩個部分:adapter和driver

從adapter注冊分析:

1.先配置設定一個iic_adapter

2.設定algo_xxx(iic總線傳輸方式)

{

master_xfer;傳輸函數

}

3.iic_add_adapter注冊到adapter連結清單中,adapter會周遊driver中的每一個成員,調用attach_adapter,attach_adapter中放有iic_probe函數,iic_probe(adapter,裝置位址,function)函數中調用到adapter中的masker_xfer函數(這個函數的作用是,發送start信号,發送裝置的位址),if(master_xfer)(如果有這個函數就就調用),else(iic_smbus_xfer_emulated)(如果沒有這個就調用這個),這個函數中有iic_transfer函數,這個函數也是調用adapter中的algo->master_xfer,發送信号後,确定有無該裝置,如果有就調用iic_probe中的function函數

繼續閱讀