Wednesday, June 20, 2012

IPC : AP-CP communication

IPC here refers Inter Processor Communication and not Inter Process Communication.
AP refers to Application Processor.
CP refers to Communication Processor. Its also called as Modem, BP (BaseBand Processor).
AP is considered as main processor. It is responsible for most of the mobile processing except the heart of it !
AP deals with everything except Cellular Network related work. This is done by the Modem.
Display unit, Camera, Touch key, Keypad etc are controlled by AP. These peripherals are present in AP.
Modem has hardware's that is responsible for connecting to mobile network. Modem maybe 2G,3G,4G capability. 
Modem handles call, sms, browser processing.
Actual UI features of call/sms are handled in AP.
Now this must be enough to guess the importance of IPC between AP and CP.


IPC consists of physical connection (set of wires) between AP and CP, corresponding controller on AP and CP, drivers to talk with controller.
Other than IPC medium, set of GPIO lines are also connected between AP and CP for modem control operations like modem on,off etc.

Both AP and CP are separate chip packages. Both can be single core or multi core processors.
This means that both are independent computing unit. There should be a connection between these 2 units so
that the data is transferred between them. This connection is referred as IPC (Inter Processor Communication).
Please be noted that all handsets are not designed in this way. There maybe a single chip package which hosts all the hardware. It does the job of both AP and modem.
Its a design issue in selecting the architecture for the same, whether to go for a single chip solution or dual / multi chip solution.
AP --> Texas Instruments OMAP series, Qualcom MSM series, Samsung chip-set, Nvdia Tegra etc.
CP --> Qualcom MDM series, Infineon, Samsung, Broadcom, Marvel chip-set etc.
For an Android handset, Android (Linux OS) runs on AP whereas CP runs on its own proprietary OS platform.

Different kind of IPC's

  • MIPI HSI
  • HSIC (USB HS)
  • DpRam (Shared Memory)
  • SPI
  • c2c (Chip to Chip)

Functionality of IPC

IPC are used to transfer Voice data, SMS data, Net (browser) data between CP and AP.
Usually CP wont have Flash memory. The modem binary itself is stored in AP side Flash.
Hence AP uses IPC to transfer modem binary to CP.
When CP is powered on, Boot ROM code of CP runs and it waits for modem binary.
After Linux kernel boots up in AP, the kernel IPC driver sends modem binary to CP.
This is referred as Flashless Boot. (CP is flashless)

Since CP is flashless, it should use AP side flash to store NV data (data across boot).
This remote File system feature is also provided with IPC as medium.

Whenever AP asks for CP logs or in case of CP crash CP ram dump can be transferred to AP
through IPC.

IPC drivers (AP side,Linux Kernel)

If we consider MIPI HSI as IPC medium, HSI controller driver is responsible for HSI controller configuration, register settings, data transmission / reception with CP. The actual data transfer happens through IPC physical wires connected between AP and CP 
Usually HSI read / write functions are exported and exposed to another set of drivers called IPC utility driver which actually calls these exported functions.
These utility drivers are character drivers which interacts with user space, in case of android its RIL.
Based on RIL directives, utility driver writes and reads data from CP with the help of exported functions as mentioned above. 
Set of GPIO lines are also connected between AP and CP. These GPIO lines can be used for Modem on/off, interrupt from CP to AP, AP status to CP etc.
We can handle all these GPIO lines under a driver.
Other than this, for net data, kernel TCP/IP stack and net drivers are utilized.


6 comments:

ANIRUDH GARGI said...

Great work ! Very Informative , Good for anybody wanting a know how of what IPC is , how it works , and how its sits inside kernel..

Anirudh Gargi

ANIRUDH GARGI said...

Great work !! Nice article to learn the basics and concepts of IPC inside a smartphooe !
Handy for anybody looking on how IPC works, its importance , technologies involved, how it sits inside a kernel.

Anirudh Gargi

Anonymous said...

nice article...keep posting such system related stuff...

venkatesh yadav said...

Great work .... very good basic info on AP and CP

Unknown said...

Nice.informative

Anonymous said...

Good start. Can we discuss also about Application -> TCP/IP -> Net driver -> Modem -> RF flow also ?
Thx.