Part 1
요약·해설
세 entry point, 여섯 PAL, 아홉 실행 단계와 네 roadmap 항목을 보존합니다.
Entry points
3
PALs
6
Board
native_sim
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
원문 SHA-256
ACC8EDA627B18E960081475F9569F3BBDEAEF5B77DEBD7057F23DDD34F1E9090
Android's Context Hub Runtime Environment (CHRE)
################################################
Android's context hub enables the use of nanoapps. A single nanoapp has 3 entry points seen in
`chre_api/chre/nanoapp.h`_:
* A ``nanoappStart`` function used to notify the nanoapp that it is now active.
* A ``nanoappHandleEvent`` function used to notify the nanoapp tha an event of interest took place.
* A ``nanoappEnd`` function used to notify the nanoapp that it is now deactivated.
The CHRE connects to several frameworks called Platform Abstraction Layers (PAL)s. Note that
currently, none of these are implemented for Zephyr, but they are scheduled to be added. These
frameworks include:
#. *Audio* - a framework allowing nanoapps to get audio events. See `pal/audio.h`_ for API details.
#. *GNSS* - a framework allowing nanoapps to manage location and measurement sessions. See
`pal/gnss.h`_ for API details.
#. *Sensor* - a framework allowing nanoapps to request changes to sensors configuration get
data/bias events. See `pal/sensor.h`_ for API details.
#. *System* - a framework allowing nanoapps to make common system requests such as logging, clock,
and some basic memory allocation/deallocation. See `pal/system.h`_ for API details.
#. *WiFi* - a framework allowing nanoapps to interact with the on board WiFi. See `pal/wifi.h`_ for
API details.
#. *WWAN* - a framework allowing nanoapps to interact with the WWAN module such as getting the
current capabilities and info. See `pal/wwan.h`_ for API details.
Building and expectations
=========================
To build the sample use the following west command:
.. zephyr-app-commands::
:zephyr-app: samples/modules/chre
:board: native_sim
:goals: build
Once built and run, the sample application should:
#. Print a hello message
#. Notify that the event loop started via an ``inf`` level log
#. Notify that a nanoapp was started and assigned an instance/app ID of 1 via a ``dbg`` level log
#. Print a message saying that the nanoapp's start callback was called
#. Send an event of type ``1`` and no data to the nanoapp
#. Notify that the event was processed
#. Call the ``nanoappEnd`` function of the nanoapp
#. Print a message notifying that it's not possible to remove a system level nanoapp
#. Exit the event loop
Roadmap
=======
#. Add an implementation of the `pal/sensor.h`_ and `pal/system.h`_ to Zephyr. These will be
standalone modules that can be used independently of CHRE, but when ``CONFIG_CHRE`` is enabled
will also provide an implementation of ``chrePalSensorGetApi()`` and ``struct chrePalSystemApi``.
#. Add a directory ``chre/nanoapps`` which will host various nanoapps to be used by the Zephyr
community. These should each have their own Kconfig to enable them and set the appropriate
dependencies. The first nanoapp will be a lid angle calculator which will use 2 accelerometers.
#. Update the ``overlay.dts`` of this sample application to include 2 emulated accelerometers and
configure them to return scripted data.
#. Run this sample application and watch the nanoapp provide lid angle calculations based on 2
accelerometers provided by the sensors PAL framework.
.. _`chre_api/chre/nanoapp.h`: https://cs.android.com/android/platform/superproject/+/master:system/chre/chre_api/include/chre_api/chre/nanoapp.h;drc=7c60a553288d63e6e3370d679803da46dac723a4
.. _`pal/audio.h`: https://cs.android.com/android/platform/superproject/+/master:system/chre/pal/include/chre/pal/audio.h;l=69;drc=6ca547ad175f80ce9f09f5b7b14fcc6f14565f5c
.. _`pal/gnss.h`: https://cs.android.com/android/platform/superproject/+/master:system/chre/pal/include/chre/pal/gnss.h;l=152;drc=830255234157cc7afe5201dca19a7fb71ea850fe
.. _`pal/sensor.h`: https://cs.android.com/android/platform/superproject/+/master:system/chre/pal/include/chre/pal/sensor.h;l=51;drc=23207906add05054a94dfab41b95bcfc39bedfe4
.. _`pal/system.h`: https://cs.android.com/android/platform/superproject/+/master:system/chre/pal/include/chre/pal/system.h;l=49;drc=6ca547ad175f80ce9f09f5b7b14fcc6f14565f5c
.. _`pal/wifi.h`: https://cs.android.com/android/platform/superproject/+/master:system/chre/pal/include/chre/pal/wifi.h;l=153;drc=b673b80ed98e1b6e6360bee4ba98e2cd8f4e0935
.. _`pal/wwan.h`: https://cs.android.com/android/platform/superproject/+/master:system/chre/pal/include/chre/pal/wwan.h;l=69;drc=629361a803cb305c8575b41614e6e071e7141a03
Part 3
한국어 전문 번역
Android의 Context Hub Runtime Environment(CHRE)는 nanoapp을 사용할 수 있게 합니다. Nanoapp 하나에는 chre_api/chre/nanoapp.h에 정의된 세 entry point가 있습니다.
nanoappStart: nanoapp이 이제 active 상태임을 알립니다.nanoappHandleEvent: 관심 있는 event가 발생했음을 nanoapp에 알립니다.nanoappEnd: nanoapp이 이제 deactivated 상태임을 알립니다.
CHRE는 Platform Abstraction Layer(PAL)라고 부르는 여러 framework에 연결됩니다. 현재 Zephyr에는 어느 PAL도 구현되어 있지 않지만 향후 추가할 계획입니다.
- Audio: nanoapp이 audio event를 받을 수 있게 합니다.
- GNSS: nanoapp이 location 및 measurement session을 관리하게 합니다.
- Sensor: nanoapp이 sensor configuration 변경을 요청하고 data 및 bias event를 받게 합니다.
- System: logging, clock, 기본 memory allocation/deallocation 같은 공통 system 요청을 nanoapp이 수행하게 합니다.
- WiFi: nanoapp이 onboard Wi-Fi와 상호 작용하게 합니다.
- WWAN: 현재 capability와 정보 조회 등 WWAN module과 상호 작용하게 합니다.
Build와 예상 동작
다음 west 명령으로 sample을 build합니다.
# From the root of the zephyr repository
west build -b native_sim samples/modules/chre
Build한 sample application을 실행하면 다음 순서로 동작해야 합니다.
- Hello message를 출력합니다.
inflevel log로 event loop가 시작됐음을 알립니다.- Nanoapp이 시작되고 instance/application ID 1이 할당됐음을
dbglevel log로 알립니다. - Nanoapp의 start callback이 호출됐다는 message를 출력합니다.
- Type
1이고 data가 없는 event를 nanoapp에 보냅니다. - Event가 처리됐음을 알립니다.
- Nanoapp의
nanoappEndfunction을 호출합니다. - System-level nanoapp은 제거할 수 없다는 message를 출력합니다.
- Event loop를 종료합니다.
Roadmap
- Zephyr에
pal/sensor.h와pal/system.h구현을 추가합니다. 이들은 CHRE와 독립적으로 쓸 수 있는 standalone module이지만CONFIG_CHRE가 활성화되면chrePalSensorGetApi()와struct chrePalSystemApi구현도 제공합니다. - Zephyr community가 사용할 여러 nanoapp을 저장할
chre/nanoappsdirectory를 추가합니다. 각 nanoapp은 활성화와 dependency 설정을 위한 자체 Kconfig를 가져야 하며, 첫 nanoapp은 accelerometer 두 개를 사용하는 lid angle calculator가 됩니다. - 이 sample application의
overlay.dts에 emulated accelerometer 두 개를 추가하고 scripted data를 반환하도록 설정합니다. - Sample을 실행하여 sensor PAL framework가 제공하는 accelerometer 두 개를 바탕으로 nanoapp이 lid angle을 계산하는 모습을 확인합니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.