9/02/2011

TI 128x BT/GPS/FM Share transport design and architecture


TI因為多了一個GPS...原本127x的BT/FM架構都完全不一樣了...T_T

沒想到TI的GPS也是利用UART來進行傳輸,看來GPS的資料量也不大嘛0.0

不過這個Share Transport的概念還真滿有意思的 !

但Porting到別的平台超複雜....= =

一出問題,如果不知道原理,根本無從查起....

所以紀錄一下今天study過後的整理.....

KIM = Kernel Initialization Manage
UIM = User space Initialization Manager

ST summary

ST(share transport)的設計理念是基於在OMAP程序中,實現BT、GPS、FM協議以及整合至軟體元件中,並提供一個界面對應各自不同的physcial ports。

它主要的工作是處理chip的整個初始化。而且還負責處理硬體去對每一個core(BT,GPS,FM)做enable/disable;而且BT則多了一項發送download script commands的工作。

除此之外,ST還負責chip與OMAP的之間的Power Managerment(PM),像是power saving/Wakup etc...,

ST driver其實是一個基於TTY driver的line discipline,在BT,GPS,FM元件之間開啟了一個具有分享作用的一個physical ports (像是UART,SPI or SlimBus等)

而這個分享的原理,是利用邏輯通道(logical channel)的設計理念來實現,如下定義 :

BT Protocol : Channel 1,2,3,4

FM Protocol : Channel 8

GPS Protocol : Channel 9

Power Managerment (HCILL) : Channel 30,31,32,33

ST Core driver中,利用KIM這個module,來處理並打開對BT,GPS,FM等元件的通信,並且會去下載init script到BT元件裡,還有最重要的一件事..

隨著FM和GPS driver註冊和註銷,KIM會去控制FM和GPS的GPIO。

而ST drvier則是會利用HCILL protocol發送message來控制chip的sleep or wakeup

KIM & UIM

1. Initialization

初始化時,ST driver會請求KIM開始對chip去做初始化(Control GPIO etc..,),在KIM對chip初始化過程中,KIM會要求UIM去打開TTY device並設定ST做為line discipline....

之後KIM會繼續初始化,然後再開啟各自chip core的GPIO和download script.

而卸載時,則跟上述步驟一樣...KIM會去要求UIM去 close TTY device and restore line discipline

2. Process

UIM是一支deamon,當它被運行時,會去install ST driver,在install ST driver期間,ST Core則會去install KIM module,並收到ST Core的要求去對chip做初始化,在這同時,KIM還會去建立一個sysfs entry --> "/sys/uim/pid"。

當install ST driver安裝完之後,這時UIM會用KIM所創的節點寫入它的Process ID(PID),然後等待信號(Signals)...等待從KIM發送過來的信號。

然後KIM會利用UIM剛寫入PID,對它發送信號,要求UIM去打開TTY device(對應physical ports)和安裝ST Line Discipline...

如果UIM是打開TTY device for UART的話,則設定baud為115200,這時TI的chip會follow這個設定去start...然後,UIM將會傳送一個HCI Vendor Specific(VS) Command去把baudrate設定成3M。

接著UIM會去call TTY function去安裝ST Line discipline driver...

整個過程跑完之後,UIM就會一直等待KIM的信號,讓它做restore and uinstall的動作。



ST Driver

ST layer主要是實現ST Line Discipline,這個Line discipline暴露(容許讓我用大陸名詞...因為不知道怎麼理解原文的意思....= =)在BT,GPS,FM driver之下。

ST driver包含3個sub-modules :

1. ST Core
2. ST Kernel space Initialization Manager (KIM)
3. ST HCILL

ST KIM在上面己經說了...它是會隨著UIM而緊密連接著...

ST Core則提供如下的作用 :
  •  Core will provide APIs for BT, FM, and GPS drivers to register, de-register, and send  protocol packets
  • If ST Core is busy sending current packet, it will buffer new requests to send protocol packets
  • ST Core will provide packets received from chip to BT, FM, and GPS drivers by calling callback routines registered by these protocol drivers
  • ST Core will maintain a finite state machine to handle multiple register, de-register, and send requests
  • When first register request is received, ST Core will interact with KIM to initialize transport and chip. When last de-register request is received, ST Core will interact with KIM to de-initialize transport and chip
  • ST Core will interact with ST HCILL to get state information of Connectivity chip and to  wakeup chip when required
ST Core使用特有的ID來區分不同的protocol driver,而BT,GPS,FM則會提供該ID來與ST driver註冊,寫在一個list當中,ST Core會去負責維護這個list來避免不當的操作。

No comments:

Post a Comment