Tizen porting guide_2.0.beta_1025

4,851 views

Published on

test

Published in: Education
83 Comments
41 Likes
Statistics
Notes
No Downloads
Views
Total views
4,851
On SlideShare
0
From Embeds
0
Number of Embeds
81
Actions
Shares
0
Downloads
203
Comments
83
Likes
41
Embeds 0
No embeds

No notes for slide

Tizen porting guide_2.0.beta_1025

  1. 1. SAMSUNG ELECTRONICS CO LTD. Tizen Porting Guide Tizen the True Open Platform 9/10/2012 This document acts as a guide for porting and bringing up the Tizen OS on a new hardwareplatform.
  2. 2. Tizen Porting GuideRevision HistoryVersion Date Comments 1.0 03/13/2012 Tizen Porting Guide Initial version 2.0-α 09/10/2012 Overall document update ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 1 of 143
  3. 3. Tizen Porting GuideContentsCONTENTS ................................................................................................................................................ 2INTRODUCTION...................................................................................................................................... 6 About Tizen ...............................................................................................................................................................6 Purpose of this document .........................................................................................................................................6TIZEN ARCHITECTURE......................................................................................................................... 7 The Application Layer ................................................................................................................................................8 The Core Layer ...........................................................................................................................................................8 The Kernel Layer ........................................................................................................................................................9DEVELOPMENT ENVIRONMENT SETUP ....................................................................................... 10 Tizen OS Development Setup ..................................................................................................................................10 Introduction to OBS .................................................................................................................................................11 OBS Light .................................................................................................................................................................11 OBS Light server Appliance............................................................................................................................12 OBS Light Client Appliance ............................................................................................................................12 Installation of SDK ...................................................................................................................................................12GETTING SOURCE CODE & BUILD .................................................................................................. 13 Platform Build ..........................................................................................................................................................13 Kernel Build .............................................................................................................................................................13TIZEN BOOTUP OVERVIEW .............................................................................................................. 15 Kernel Bootup ..........................................................................................................................................................15 Platform Bootup ......................................................................................................................................................15BSP CUSTOMIZATION ......................................................................................................................... 18 Bootloader Fundamentals .......................................................................................................................................18 Bootloader Setup and Build ....................................................................................................................................18 ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 2 of 143
  4. 4. Tizen Porting Guide Bootloader Commands Support ..............................................................................................................................18 Bootloader Kernel Parameters ................................................................................................................................19KERNEL FUNDAMENTALS ................................................................................................................. 20 Kernel Configurations ..............................................................................................................................................20 Tizen File System .....................................................................................................................................................21 Virtual Filesystem (VFS ) ................................................................................................................................21 Tizen Partition Layout ....................................................................................................................................22 File-system Hierarchy Standard in Tizen ........................................................................................................23 Configuration .................................................................................................................................................23 Reference.......................................................................................................................................................23 MMC ........................................................................................................................................................................24 Description ....................................................................................................................................................24 Reference.......................................................................................................................................................25SYSTEM ................................................................................................................................................... 26 System Framework ..................................................................................................................................................26 Description ....................................................................................................................................................26 Porting OAL Interface ....................................................................................................................................28 Configuration .................................................................................................................................................36 Reference.......................................................................................................................................................36 Sensor Framework ...................................................................................................................................................40 Description ....................................................................................................................................................40 Porting OAL Interface ....................................................................................................................................42 Configuration .................................................................................................................................................46 Reference.......................................................................................................................................................46GRAPHICS AND UI ................................................................................................................................ 48 OpenGL ....................................................................................................................................................................48 3D Graphics Library .......................................................................................................................................48 EGL (Embedded-System Graphics Library) ....................................................................................................49 Porting ...........................................................................................................................................................50 OpenGL ES .....................................................................................................................................................50 X server ....................................................................................................................................................................54 Input Driver .............................................................................................................................................................54 Description: ...................................................................................................................................................54 Porting OAL Interface: ...................................................................................................................................55 Configuration .................................................................................................................................................56 Video Driver .............................................................................................................................................................57 Description: ...................................................................................................................................................57 Porting OAL Interface: ...................................................................................................................................58 ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 3 of 143
  5. 5. Tizen Porting Guide Configuration .................................................................................................................................................64 References .....................................................................................................................................................64MULTIMEDIA ......................................................................................................................................... 66 Camcorder ...............................................................................................................................................................66 Description ....................................................................................................................................................66 Porting OAL Interface ....................................................................................................................................67 Configuration .................................................................................................................................................73 References .....................................................................................................................................................77 Radio........................................................................................................................................................................79 Description ....................................................................................................................................................79 Porting OAL Interface ....................................................................................................................................79 Configuration .................................................................................................................................................79 References .....................................................................................................................................................79 Audio .......................................................................................................................................................................81 Description ....................................................................................................................................................81 Porting OAL Interface ....................................................................................................................................82 Configuration .................................................................................................................................................83 References .....................................................................................................................................................86 Player .......................................................................................................................................................................88 Description ....................................................................................................................................................88 Porting OAL Interface ....................................................................................................................................88 Configuration .................................................................................................................................................89 References .....................................................................................................................................................90 Codec .......................................................................................................................................................................91 Description ....................................................................................................................................................91 Porting OAL Interface ....................................................................................................................................93 Configuration .................................................................................................................................................96 References .....................................................................................................................................................98CONNECTIVITY ..................................................................................................................................... 99 Bluetooth .................................................................................................................................................................99 Description ..................................................................................................................................................100 Porting OAL Interface ..................................................................................................................................101 Configuration ...............................................................................................................................................101 References ...................................................................................................................................................102 WLAN.....................................................................................................................................................................104 Description: .................................................................................................................................................104 Porting OAL Interface: .................................................................................................................................105 Configuration: ..............................................................................................................................................105 References: ..................................................................................................................................................105 NFC ........................................................................................................................................................................107 Description ..................................................................................................................................................107 ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 4 of 143
  6. 6. Tizen Porting Guide Porting OAL Interface ..................................................................................................................................108 Configuration ...............................................................................................................................................110 Reference.....................................................................................................................................................110LOCATION ............................................................................................................................................ 111 Description ..................................................................................................................................................111 Porting OAL Interface ..................................................................................................................................115 Configuration ...............................................................................................................................................117 References ...................................................................................................................................................118TELEPHONY ........................................................................................................................................ 119 Description ..................................................................................................................................................119 Porting OAL Interface ..................................................................................................................................120 Configuration ...............................................................................................................................................134APPENDIX............................................................................................................................................ 135 Sensor Processor Plugin APIs .................................................................................................................................135 NFC OAL API...........................................................................................................................................................137 ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 5 of 143
  7. 7. Tizen Porting GuideIntroductionAbout TizenTizen is an open source standards-based software platform, targeted towards multiple devicesegments, including smart phones, tablets, netbooks, in-vehicle infotainment devices, smart TVs, and more.Purpose of this documentThe intent of this document is to provide information and instruction to boot Tizen on newhardware and create products based on the Tizen OS. The Tizen porting guide takes you throughthe porting process by elaborating the Tizen architecture, the tools needed, the developmentenvironment setup, as well as creating a Tizen Image and demonstrating the modificationsneeded across various functional areas. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 6 of 143
  8. 8. Tizen Porting GuideTizen ArchitectureThe figure below illustrates the Tizen architecture for smartphone and tablet devices. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 7 of 143
  9. 9. Tizen Porting GuideThe Application LayerTizen supports web applications. Tizen web applications leverage the full power of the platform, just likenative applications.The Core Layer The Core layer consists of the Tizen API and Tizen Core Service.Tizen APITizen web applications can be developed using the Tizen Web API. The Tizen Web API is a collection ofW3C (HTML5 and more), Khronos WebGL, and newly defined device APIs.Tizen Core ServicesApplication FrameworkThe Application Framework provides application management, including launching other applicationsusing the package name, URI, or MIME type. It also launches pre-defined services, such as the systemdialer application. The Application Framework also notifies applications of common events, such as lowmemory events, low battery, changes in screen orientation, and push notification.BaseBase contains Linux* base essential system libraries that provide key features, such as database support,internationalization, and XML parsing.ConnectivityConnectivity consists of all network- and connectivity-related functionalities, such as 3G, Wi-Fi,Bluetooth, HTTP, and NFC (Near Field Communication). Data network is based on ConnMan (Connectionmanager), which provides 3G and Wi-Fi based network connection management.Graphics and UIGraphics and UI consist of the system graphic and UI stacks, which includes the EFL (EnlightenmentFoundation Libraries), an X11-based window management system, input methods, and OpenGL® ES*.The heart of the Graphics component, the EFL, is a suite of libraries. It is for creating rich graphics withease, for all UI resolutions. The libraries build UIs in layers, allowing for 3D transformations and more.The EFL includes the Evas canvas API library and the elementary widget library.LocationLocation provides location based services (LBS), including position information, geocoding, satelliteinformation, and GPS status. It is based on GeoClue, which delivers location information from variouspositioning sources, such as GPS, WPS (Wi-Fi Positioning System), Cell ID, and sensors.MessagingMessaging consists of SMS, MMS, Email, and IM.MultimediaMultimedia is based on GStreamer. It provides support for media, including video, audio, imaging, andVoIP. It also provides media content management for managing media file metadata information. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 8 of 143
  10. 10. Tizen Porting GuidePIM (Personal Information Management)PIM enables managing user data on the device, including managing calendar, contacts, tasks, andretrieving data about the device context (such as device position and cable status).SecuritySecurity is responsible for security deployment across the system. It consists of platform securityenablers, such as access control, certificate management, and secure application distribution.SystemSystem consists of system and device management features, including:  Interfaces for accessing devices, such as sensors, display, or vibrator.  Power management, such as LCD display backlight dimming/off and application processor sleep.  Monitoring devices and handling events, such as USB, MMC, charger, and ear jack events.  System upgrade.  Mobile device management.TelephonyTelephony consists of cellular functionalities communicating with the modem:  Managing call-related and non-call-related information and services for UMTS and CDMA.  Managing packet service and network status information for UMTS and CDMA.  Managing SMS-related services for UMTS and CDMA.  Managing SIM files, phone book, and security.  Managing SIM Application Toolkit services for UMTS.WebWeb provides a complete implementation of the Tizen Web API optimized for low power devices. Itincludes WebKit, which is a layout engine designed to allow web browsers to render web pages. It alsoprovides web runtimes for web applications.The Kernel LayerThe Kernel layer includes Linux kernel and device drivers. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 9 of 143
  11. 11. Tizen Porting GuideDevelopment Environment SetupThis section provides a brief overview about setting up your development environment on yourhost system, such as your Ubuntu* system. The below figure briefly describes the Tizendevelopment environment setup.Follow the steps below to set up the development environment on your Ubuntu system.Tizen OS Development SetupPlease refer to the following links to set up the Tizen OS Development environment and toobtain infomation regarding devlopment. https://source.tizen.org/os-development 1. Work Flow This section explains GIT/Gerrit based source code management and review process, package creation using Open Build Service(OBS), and code submission methods, including development and upstream branches. 2. Developer Guide This section describes registration and information on a development environment ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 10 of 143
  12. 12. Tizen Porting Guide setup for GIT/Gerrit, SSH, GIT Build system, Image creator, and install tools. It includes the code and package submission using GIT and OBS buildsystem and the complete development flow. 3. Git Build System The GBS(Git-Build-System) is a custom command line tool that supports Tizen package development. This section explains about auto-generating tarballs based on git repositories, performing local and report builds, and OBS code submission. This section also has procedure to monitor remote build log and status. 4. MIC Image Creator This tools is used to create images for Tizen. This section provides detailed explainations of image creation, conversion and chrooting into image procedure. As is explained in the above URLs, Tizen development requires Open(SuSE) Build system and the required components. In the following sections, we will briefly introduce various such build requirements.Introduction to OBSThe Open Build Service (OBS) is an open and complete distribution development platform thatprovides a transparent infrastructure for development of Linux distributions, used by openSUSE,MeeGo, and other distributions. (Supporting also Fedora, Debian, Ubuntu, RedHat, and otherLinux distributions). OBS provides the developers an easy way of using web-based andcommand based interface to achieve development activities. OBS maintains a consistent buildenvironment, which each developer can rely on for various Linux distributions. For moreinformation on OBS, you can refer to this link: https://build.tizen.org/OBS can be set up locally or we can refer any available OBS services. http://doc.opensuse.org/products/draft/OBS/obs-best-practices_draft/cha.obs.best-practices.localsetup.html is one of the links that talks about setting up OBS server locally. To make use of any available OBS servers,user credentials are required. Each OBS implemetiation can have more customized tools to achieve the build servies. You can find information on Tizen OBS and its customized build tool, named git-build-System(GBS), in this linkhttps://source.tizen.org/os-development/git-build-system/OBS LightOBS Light is an OBS base development process, but which is lighter to use. It creates anencapsulation of OBS and presents a lighter face of OBS. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 11 of 143
  13. 13. Tizen Porting GuideOBS Light server ApplianceThis is a ready-to-use OBS for MeeGo and Tizen. openSUSE Build Service(OBS) 2.3.0-1.6. TheopenSUSE Build Service appliance contains the complete OBS stack, including a Worker, theBackend, API, Webclient, and osc, the command line client. FakeOBS is an added utility, throughwhich we can achieve priovate OBS Builds.OBS Light Client ApplianceOBS Client Appliance consists of a command line (obslight) and a graphical user interface GUI(obslightgui). OBS Client includes MIC to create a bootable image.http://en.opensuse.org/openSUSE:OBS_Light_Manualhttp://en.opensuse.org/openSUSE:OBS_Light_Fakeobshttp://susestudio.com/a/e0uuBG/obs-obs-server-obs-lighthttp://en.opensuse.org/openSUSE:OBS_Light_InstallationInstallation of SDKThe Tizen SDK is a comprehensive set of tools for developing Tizen web applications. It consistsof Web IDE, Emulator, tool chain, sample code, and documentation. The beta release of theTizen SDK runs on Windows*, as well as Ubuntu. Tizen Web applications may be developedwithout relying on an official Tizen IDE, as long as the application complies with Tizen packagingrules. Use the link below to download the Tizen SDK. https://developer.tizen.org/sdk ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 12 of 143
  14. 14. Tizen Porting Guide Getting Source Code & Build Follow this link to download the full source code for your Tizen platform and kernel https://review.tizen.org/git/ Refer to below link for more information Sorurce code Management on Tizen releases: GIT/Gerrit: https://review.tizen.org/gerrit Tizen Build setup OBS: https://build.tizen.org/ Tizen Bug Tracking system Jira: https://bugs.tizen.org/jira Download URL: http://download.tizen.org/ Platform Build Follow the link below to get learn how to add something like below: https://source.tizen.org/os-development/developer-guide Follow the link below to build the source code by using git build system. https://source.tizen.org/os-development/git-build-system Kernel Build Follow the steps below steps to build the Tizen kernel.  Install and set up the osc, OBS client tools on your system.  Get the kernel source package and spec file from OBS . You can see kernel-3.0.15.tar.gz and kernel.spec file. $ osc co TIZEN:2.0:System kernel  Createdefconfig kernel configuration file as per the target requirement. The configuration files available under arch/arm/configs/ can be modified by adding and removking kernel configuration options to create a customized default config, file like xyz_defconfig.  Copy the new config file (such as xyz_defconfig) into the arch/arm/configs/ folder inside the kernel source directory. This step can be skipped to use the existing defconfig file. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 13 of 143
  15. 15. Tizen Porting Guide The following command is used to apply the custom config file such as xyz_defconfig for the target, this command can be updated within the spec file to specify the custom defconfig file. make xyz_defconfig The following command is used to build the kernel RPM package inside the kernel directory. $ osc build armv7el –no-verify --clean Once the build is successful, the RPM kernel package is created under/var/tmp/build- root/abuild/rpmbuild/RPMS/armv7l/kernel-3.0.15-1.armv7l.rpm. The kernel RPM package is downloaded on to the target and installed, as below # rpm –Uvh kernel-3.0.15-1.armv7l.rpm Instead of using the RPM kernel package, the kernel uImage can also be downloaded to the target. The uImage is created under /var/tmp/build-root/home/abuild/rmpbuild/BUILD /kernel-3.0.15/arch/arm/boot/uImage after the successful build. Create a tarball to download the kernel to your target . $ cd /var/tmp/build-root/home/abuild/rpmbuild/BUILD/kernel- 3.0.15/arch/arm/boot/ $ tar cvf tizen-kernel.tar uImage ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 14 of 143
  16. 16. Tizen Porting GuideTizen Bootup OverviewThis section provides a brief overview of the typical booting sequence, starting from boot loaderto the kernel and the platform.Kernel BootupThe Tizen bootup process is the same as any other Linux kernel. We just need to make sure thatthe correct machine ID and the boot arguments are passed from the boot loader.Platform BootupThe system-plugin-slp is an OAL plugin for booting the Tizen platform. Thisplugin shall bemodified as per the platform bootup sequence requirements from the vendor.The platform bootup, using the OAL plugin (system-plugin-slp), is mentioned below and isapplicable for Tizen SDK Bootup. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 15 of 143
  17. 17. Tizen Porting Guide Special file-systems like /proc, /tmp, /var, /sys and /dev are mounted during ‘mount *1+. Make device node about NULL device. Run hotplug daemon of Linux. Script checks for special booting mode. For example, in charging mode or during FOTA (Firmware upgrade On The Air), it runs scripts from /etc/rc.d/rc2.d. This directory should have the scripts for the special booting mode. After exiting special booting mode, the target will be restarted. For the first time booting after downloading, resize all ext4 partitions before mounting them and configure the device information. General file-systems for Tizen like /opt, /opt/media are mounted during ‘mount *2+. Set device node permissions for security. Start modem booting. Run scripts in /etc/rc.d/rc3.d. Detailed sequence of rc3.d scripts are described in the next chapter.The following section provides an overview on the init script sequence for the Tizen platform. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 16 of 143
  18. 18. Tizen Porting GuideIn the Tizen SDK, rc.sysinit runs every scripts on rc3.d in the order indicated above.For example: S05dlog is run for dlog. S10sqlfs-mount and S12vconf-init is run for vconf which is configuration system for Tizen. S20xserver is for xserver - Xorg, and window manager - enlightenment. Others are run for each module. The scripts, which are not important for bringing up the menu screen, are launched after the S46menudaemon script. In S46menudaemon script, register /opt/share/applications/*.desktop files, change the VCONFKEY_START value to 1, and then run the menu-screen.The Tizen Git repository for the system-plugin-slp ishttps://review.tizen.org/git/adaptation/system-plugin-slp.git;a=summaryThe rpm package installation of this plugin is: #zypper install system-plugin-slpNote: Verify that the installation command is correct. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 17 of 143
  19. 19. Tizen Porting GuideBSP CustomizationThis section covers the basic configuration, set up, and build procedure required for building theboot loader and the kernel image.Bootloader FundamentalsBoot loader is a small piece of software that is required to perform the basic hardware andperipheral initialization and load the kernel to RAM. For the Tizen platform, the boot loadercomes in two parts. The first part is the primary boot loader and the second part is thesecondary boot loader. The primary boot loader is the Samsung proprietary boot loader and isalso called s-boot. The secondary boot loader is the open source boot loader u-boot, which iscustomized further for the Tizen platform.If your platform is already loaded with the compatible boot loader software, then you can skipthis section and move directly to the kernel section.Bootloader Setup and BuildFollow the steps to build the Tizen boot loader SSet up OBS (Open Build Service) on the host system. Get bootloader source from OBS, as shown below: $ osc co TIZEN:2.0:System u-boot Execute command to build the boot loader image: $ osc build armv7el --no-verify --clean Once the build is successful, the bootloader RPM package is created under /var/tmp/build-root/home/abuild/rpmbuild/ Create a bootloader tarball to download the boot loader onto the target $ cd /var/tmp/build-root/home/abuild/rpmbuild/BUILD/u-boot- 0.1.1 $ tar cvf bootloader.tar u-boot.binBootloader Commands SupportThe Tizen boot loader supports various commands, which are used with u-boot prompt beforeloading the kernel. Below are some examples of the commands used in boot loader. Example: usb reset printenv ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 18 of 143
  20. 20. Tizen Porting Guide setenv saveenv ramdump pit helpYou can find the details about each command using the help command followed by thecommand name.Example:<u-boot prompt> help ramdumpramdump - Kernel lockup/panic loggerUsage:ramdump show klog/dlog - log print on consoleramdump show blog <index[-1(default), 0]> - log print on consoleramdump save <ram/klog/dlog/blog/fb> - log save as file on UMSramdump logo - draw logoramdump check - check header infoBootloader Kernel ParametersThe command line parameters can be passed from boot loader to the kernel. Here are someexample command line parameters.Example: console=ttySAC2,115200n8 fbmem=24M@0x66800000 csa=/dev/mmcblk0p1 bootloader_log=1167@0x62d08010 ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 19 of 143
  21. 21. Tizen Porting GuideKernel FundamentalsThe kernel is the operating system that drives the platform. Here the kernel refers to the opensource Linux kernel that is customized for the Tizen platform. The following section will give abrief overview about the Tizen kernel setup, configuration, and the build procedure for buildinga Linux kernel for your Tizen platform. The output of the kernel binary will be a uImage that issuitable only for u-boot boot loader. If you have chosen for a secure booting configuration inyour boot loader, then this uImage should be compatible with your boot loader.Kernel ConfigurationsTo download the Tizen kernel source package, refer to “Getting Source code and Build” sectionin this document. Set up or modify your kernel configuration, use the appropriate defconfig filefrom arch/arm/configs/.For more detailed information about Tizen kernel configuration and kernel building, refer to thesection “Kernel Build” under “Getting Source code and Build” in this document.Note: Tizen uses INOTIFY and does not use DNOTIFY. So, you should disable DNOTIFY from yourkernel configuration.If you want to use initramfs, you can use these configurations: CONFIG_INITRAMFS_SOURCE CONFIG_INITRAMFS_ROOT_UID CONFIG_INITRAMFS_ROOT_GID CONFIG_INITRAMFS_COMPRESSION_NONE/GZIP/BZIP2/LZNA/LZO ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 20 of 143
  22. 22. Tizen Porting GuideTizen File SystemVirtual Filesystem (VFS )The virtual file system (VFS) is an interesting aspect of the Linux kernel because it provides acommon interface abstraction for file systems (ext2, jfs, ext4, etc...). The VFS provides aswitching layer between the SCI (System call interface) and the file systems supported by thekernel, as shown in 7.1 Figure 7.1At the top of the VFS is a common API abstraction of functions, such as open, close, read, andwrites. At the bottom of the VFS are the file system abstractions that define how the upper-layer functions are implemented with respect to specific file system.Below the file system layer is the buffer cache, which provides a common set of functions to thefile system layer (independent of any particular file system). This caching layer optimizes accessto the physical devices by keeping data around for a short time (or speculatively read ahead, sothat the data is available when needed). Below the buffer cache are the device drivers, whichimplement the interface for the particular physical device. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 21 of 143
  23. 23. Tizen Porting GuideTizen Partition LayoutThe following description is an example of the Tizen partition layout. The product vendor canmodify the sequence or partition layout for their devices, as needed. Figure 7.2The ‘boot’ partition is mounted in ‘/boot’ of rootfs. Here s-boot, u-boot, and kernel image aresaved as a file format, provided as system.tar.1. CSA (Configuration Saved Area) is for non-volatile data that is calibration value of modem, etc.2. The boot partition includes kernel image, boot-loader image, and modem image. Additionally,it can have device driver modules.3. Third partition is reserved for the future.4. The ‘platform’ partition is mounted on the root directory ( / ). It contains fundamentalframeworks for Tizen and some general utility for Linux. It may be provided as platform.img file.5. The ‘data’ partition is mounted on ‘/opt’ and it includes applications, libraries of applications,and the platform database. It may be provided as a data.img file.6. CSC (Customer Software Configuration) ‘csc’ partition is mounted on /mnt/csc. It can storethe customer’s software configuration, such as default language, time zone, etc.7. UMS (USB Mass Storage) partition is mounted on ‘/opt/media’ and it includes default (media)contents. It may be provided as ums.img.8. Each image file, ‘platform.img’, ‘data.img’, and ‘ums.img’ can be zipped for downloading, likeIMAGE_NAME.tar.gz. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 22 of 143
  24. 24. Tizen Porting GuideFile-system Hierarchy Standard in TizenEach partition has this hierarchy: Figure 7.3Supported filesystems in TizenFilesystems that Tizen supports are Extended 4 (Ext 4) file-system, and MSDOS VFAT file-system.The Tizen kernel has to be compiled to enable support for the other file systems like JFS, XFS,BTRFS, and Reiserfs.Default File-system in TizenThe Extended (Ext 4) file-system is configured as a default file-system for Tizen.ConfigurationThe ext4 kernel configuration is done like this standard kernel configuration.ReferenceCONFIG_EXT4_FS=yCONFIG_EXT4_FS_XATTR=yCONFIG_EXT4_FS_POSIX_ACL=yCONFIG_EXT4_FS_SECURITY=yThese are the configuration option to enable in kernel configuration file. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 23 of 143
  25. 25. Tizen Porting GuideMMCDescriptionTizen supports MultiMediaCard, Secure Digital, and Secure Digital I/O Support. The MMC driveris implemented on top of host controller (such as SDHCI controller driver) and supports MMC,SD, SD High Speed, and SDHC cards.If MMC is your booting device, read-write APIs, partition management, and flashing should beprovided at the boot loader.Features Overview:The MMC/SD/SDIO driver supports these features: The driver is built in-kernel MMC cards, including high speed cards SD cards, including SD high speed and SDHC cardsMMC subsystem code structure in kernel is at /driver/mmcMMC subsystem structure is divided into three parts: ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 24 of 143
  26. 26. Tizen Porting GuideMMC block device driver /driver/mmc/card/Protocol stack for MMC, SD, SDIO /driver/mmc/core/Host controller driver /driver/mmc/host/Hotplug MMC event handling in Tizen:Based on the hotplug event handling, the notification is passed to the System server for devicestatus changes. It detects, mounts, and monitors the status of the sd card.ReferenceKernel ConfigurationCONFIG_MMC_BLOCKCONFIG_MMCCONFIG_MMC_SDHCI (For SDHCI host Interface enable)sys interface: /dev/mmcblk0pXHere ‘X’ denotes the MMC partition number. Details of partition mount point for Tizen arecovered under Tizen partition Layout. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 25 of 143
  27. 27. Tizen Porting GuideSystemSystem FrameworkDescriptionThe System framework module abstracts low level system functions and manages the Tizen platform, in terms of platform policy, with the following major functionality.The System framework contains these sub-components:System serverThe system server handles system events like out of memory, battery level, plug & play device status as well as handles process watchdog.Power managerThe power manager is a session daemon that runs to manage the power for a system. Itprovides conditional state transition. The power manager transitions with any wakeup event,shifting to a higher power state. Similarly, based on timeouts, it transits to the next lowerpower state. The Tizen Power manager functionalities control display backlight dimming/off anddevice sleep.Power manager conditional state transitionWhen an application such as a media player is running, there may be no input from the user fora long time, but the LCD should not be dimmed or turned off. Applications can request that thePower manager not change to a specific state. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 26 of 143
  28. 28. Tizen Porting GuideConditional state transitionLock : keep system from entering lower state than specific stateFor example, lock(LCD_OFF) forces system to be in LCD_NORMAL, LCD_DIM or LCD_OFF.Unlock : allow system to enter lower state than specific stateControlling the device’s power status and sleep mode.sys interface: /sys/power/state /sys/power/wakeup_count /dev/event0 /dev/event1Device manager  Providing the interface to controlling all devices  LCD backlight dimming/off, application processor sleep  System monitoring and events handling from devices and system  Process/battery level/low memory monitoring  USB/MMC/charger/earjack event handling  Interfaces for accessing devices  LCD, touch, LED, vibrator, etc.System OALThe System OAL interface provides function pointers for OEMs to plug in their device/platformspecific code to the System framework. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 27 of 143
  29. 29. Tizen Porting GuidePorting OAL InterfaceThe OAL interface provides function pointers for OEMs to plugin their device/platform specificcode to System framework.OEM developers should implement API defined in devman_plugin_intf.h and compile theirlibrary as libslp_devman_plugin.so. OEM APIs can be grouped as power, battery, haptics, LED,light, and memory. Device Manager (devman) upon initialization calls constOEM_sys_devman_plugin_interface* OEM_sys_get_devman_plugin_interface() ,which in turn returns the address of implemented OEM APIs.If and when applications requestdevice manager APIs then appropriate OEM APIs referred byOEM_sys_devman_plugin_interface would be called.Devman library uses sysfs for interfaces with device drivers and kernel. sysfs is a virtual filesystem provided by Linux 2.6 or above.Configuration:Install the OEM library as libslp_devman_plugin.so to /usr/libOAL API definitions are in the devman_plugin_intf.h header file:typedef struct { int (*OEM_sys_get_display_count) (int *value); int (*OEM_sys_get_backlight_min_brightness) (int index, int *value); int (*OEM_sys_get_backlight_max_brightness) (int index, int *value); int (*OEM_sys_get_backlight_brightness) (int index, int *value, int power_saving); int (*OEM_sys_set_backlight_brightness) (int index, int value, int power_saving); int (*OEM_sys_set_backlight_dimming) (int index, int value); int (*OEM_sys_get_backlight_acl_control) (int index, int *value); int (*OEM_sys_set_backlight_acl_control) (int index, int value); int (*OEM_sys_get_lcd_power) (int index, int *value); int (*OEM_sys_set_lcd_power) (int index, int value); int (*OEM_sys_get_image_enhance_mode) (int *value); int (*OEM_sys_set_image_enhance_mode) (int value); int (*OEM_sys_get_image_enhance_scenario) (int *value); int (*OEM_sys_set_image_enhance_scenario) (int value); int (*OEM_sys_get_image_enhance_tone) (int *value); int (*OEM_sys_set_image_enhance_tone) (int value); int (*OEM_sys_get_image_enhance_outdoor) (int *value); int (*OEM_sys_set_image_enhance_outdoor) (int value); int (*OEM_sys_get_image_enhance_tune) (int *value); int (*OEM_sys_set_image_enhance_tune) (int value); int (*OEM_sys_image_enhance_info) (int *value); int (*OEM_sys_set_display_frame_rate) (int value); int (*OEM_sys_get_uart_path) (int *value); int (*OEM_sys_set_uart_path) (int value); int (*OEM_sys_get_usb_path) (int *value); int (*OEM_sys_set_usb_path) (int value); int (*OEM_sys_get_haptic_vibetones_level_max) (int *value); ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 28 of 143
  30. 30. Tizen Porting Guide int (*OEM_sys_get_haptic_vibetones_level) (int *value); int (*OEM_sys_set_haptic_vibetones_level) (int value); int (*OEM_sys_set_haptic_vibetones_enable) (int value); int (*OEM_sys_set_haptic_vibetones_oneshot) (int value); int (*OEM_sys_get_battery_capacity) (int *value); int (*OEM_sys_get_battery_capacity_raw) (int *value); int (*OEM_sys_get_battery_charge_full) (int *value); int (*OEM_sys_get_battery_charge_now) (int *value); int (*OEM_sys_get_battery_present) (int *value); int (*OEM_sys_get_battery_health) (int *value); int (*OEM_sys_get_battery_polling_required) (int *value); int (*OEM_sys_get_jack_charger_online) (int *value); int (*OEM_sys_get_jack_earjack_online) (int *value); int (*OEM_sys_get_jack_earkey_online) (int *value); int (*OEM_sys_get_jack_hdmi_online) (int *value); int (*OEM_sys_get_jack_usb_online) (int *value); int (*OEM_sys_get_jack_cradle_online) (int *value); int (*OEM_sys_get_jack_tvout_online) (int *value); int (*OEM_sys_get_jack_keyboard_online) (int *value); int (*OEM_sys_get_leds_torch_max_brightness) (int *value); int (*OEM_sys_get_leds_torch_brightness) (int *value); int (*OEM_sys_set_leds_torch_brightness) (int value); /* TODO: Change args type */ int (*OEM_sys_set_power_state) (int value); /* TODO: Should determine enum values of wakeup_count nodes */ int (*OEM_sys_get_power_wakeup_count) (int *value); int (*OEM_sys_set_power_wakeup_count) (int value); int (*OEM_sys_get_memnotify_node) (char *node); int (*OEM_sys_get_memnotify_victim_task) (int *value); int (*OEM_sys_set_memnotify_threshold_lv1) (int value); int (*OEM_sys_set_memnotify_threshold_lv2) (int value); int (*OEM_sys_get_process_monitor_node) (char *node); int (*OEM_sys_set_process_monitor_mp_pnp) (int value); int (*OEM_sys_set_process_monitor_mp_vip) (int value); int (*OEM_sys_get_cpufreq_cpuinfo_max_freq) (int *value); int (*OEM_sys_get_cpufreq_cpuinfo_min_freq) (int *value); int (*OEM_sys_get_cpufreq_scaling_max_freq) (int *value); int (*OEM_sys_set_cpufreq_scaling_max_freq) (int value); int (*OEM_sys_get_cpufreq_scaling_min_freq) (int *value); int (*OEM_sys_set_cpufreq_scaling_min_freq) (int value);}OEM_sys_devman_plugin_interface;const OEM_sys_devman_plugin_interface *OEM_sys_get_devman_plugin_interface();Device manager (devman) gets the pointer to the structureOEM_sys_get_devman_plugin_interface in variable plugin_intf, as shown below in the code.const OEM_sys_devman_plugin_interface *(*OEM_sys_get_devman_plugin_interface)();OEM_sys_get_devman_plugin_interface = dlsym(dlopen_handle,"OEM_sys_get_devman_plugin_interface"); if ((error = dlerror()) != NULL) { ERR("dlsym() failed: %s", error); dlclose(dlopen_handle); return; } ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 29 of 143
  31. 31. Tizen Porting Guide plugin_intf = OEM_sys_get_devman_plugin_interface(); if (!plugin_intf) { ERR("get_devman_plugin_interface() failed"); dlclose(dlopen_handle); return; }OAL API reference implementation:Sample implementation code for OEM_sys_get_backlight_brightness()This function gets the current brightness of the backlight unit and the output is stored in thevariable “value”. The “value” can range from :0 <= value <= MAX_BACKLIGHT_BRIGHTNESSThe path for input and output parameters of OEM APIs can be found in filedevman_define_node_path.h#define BATTERY_CAPACITY_PATH "/sys/class/power_supply/battery/capacity"#define BATTERY_CHARGE_FULL_PATH "/sys/class/power_supply/battery/charge_full"#define BACKLIGHT_PATH "/sys/class/backlight/"#define BACKLIGHT_MAX_BRIGHTNESS_PATH BACKLIGHT_PATH"%s/max_brightness"#define BACKLIGHT_BRIGHTNESS_PATH BACKLIGHT_PATH"%s/brightness"int OEM_sys_get_backlight_brightness(int index, int *value, int power_saving){ int ret = -1; char path[MAX_NAME+1]; int max_brightness; int pwr_saving_offset; if (index >= DISP_MAX) { devmgr_log("supports %d display node", DISP_MAX); return ret; } snprintf(path, MAX_NAME, BACKLIGHT_BRIGHTNESS_PATH,disp_info[index].bl_name); ret = sys_get_int(path, value); devmgr_log("path[%s]value[%d]power_saving[%d]", path, *value,power_saving); if (power_saving){ snprintf(path, MAX_NAME, BACKLIGHT_MAX_BRIGHTNESS_PATH,disp_info[index].bl_name); ret = sys_get_int(path, &max_brightness); if (ret) { devmgr_log("Cant read max_brightness node[%s]", path); return ret; } pwr_saving_offset = (PWR_SAVING_CANDELA_CRITERION *max_brightness / MAX_CANDELA_CRITERION) + 0.5; ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 30 of 143
  32. 32. Tizen Porting Guide if (*value > max_brightness - pwr_saving_offset) *value = max_brightness; else *value = *value + pwr_saving_offset; devmgr_log("power_saving result[%d]", *value); } return ret;}The function, sys_get_int(path,value) provides access to kernel device driver node parameters.The parameter “path” is defined in the file devman_define_node_path.h , as described above.The value to be get/set is stored in parameter “value”. In similar ways , functions like sys_get_str,sys_set_int, sys_set_str, and sys_get_node are implemented to set/get the parameter values atthe respective path. Here is the sample implementation for sys_get_int.int sys_get_int(char *fname, int *val){ char buf[BUFF_MAX]; if (sys_read_buf(fname, buf) == 0) { *val = atoi(buf); return 0; } else { *val = -1; return -1; }}static int sys_read_buf(char *file, char *buf){ int fd; int r; fd = open(file, O_RDONLY); if (fd == -1) { return -ENOENT; } r = read(fd, buf, BUFF_MAX); if ((r >= 0) && (r < BUFF_MAX)) buf[r] = 0; else { return -EIO; } close(fd); return 0;} ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 31 of 143
  33. 33. Tizen Porting GuidePower managerThe various power states include Normal, LCD_DIM, LCD_OFF, and SLEEP and the device canswitch from one state to another, as shown in the above diagram. The values for different states The power states are defined in the below enum.typedef enum { POWER_STATE_NORMAL, /**< Normal state */ POWER_STATE_SCREEN_DIM, /**< Screen dim state */ POWER_STATE-SCREEN_OFF, /**< Screen off state */ } power_state_e; Function Prototype Description (0-success, others -failure) The function sets the device to suspend mode (0: Mandatory int (*OEM_sys_set_power_state) (int value); Suspend Mode). int (*OEM_sys_get_power_wakeup_count) Mandatory The function gets the current “wakeup_count”. (int *value); int (*OEM_sys_set_power_wakeup_count) The function sets the “wakeup_count” with input Mandatory (int value); value. int The function gets the limitation of max cpu Optional (*OEM_sys_get_cpufreq_cpuinfo_max_freq) frequency (int *value); value : cpu frequency (KHz). int The function gets the limitation of min cpu Optional (*OEM_sys_get_cpufreq_cpuinfo_min_freq) frequency (int *value); value : cpu frequency (KHz). int The function gets the current max cpu frequency Optional (*OEM_sys_get_cpufreq_scaling_max_freq) (CPUINFO_MIN_FREQ <= value <= (int *value); CPUINFO_MAX_FREQ in KHz). int The function sets the current max cpu frequency Optional (*OEM_sys_set_cpufreq_scaling_max_freq) (CPUINFO_MIN_FREQ <= value <= (int value); CPUINFO_MAX_FREQ in KHz). int The function gets the current min cpu frequency Optional (*OEM_sys_get_cpufreq_scaling_min_freq) (CPUINFO_MIN_FREQ <= value <= (int *value); CPUINFO_MAX_FREQ in KHz). int The function sets the current min cpu frequency Optional (*OEM_sys_set_cpufreq_scaling_min_freq) (CPUINFO_MIN_FREQ <= value <= (int value); CPUINFO_MAX_FREQ in KHz). The function gets the current path of uart node (0: Optional int (*OEM_sys_get_uart_path) (int *value); CP, 1: AP). The function sets the current path of uart node (0: Optional int (*OEM_sys_set_uart_path) (int value); CP, 1: AP). The function gets the current path of usb node (0: Optional int (*OEM_sys_get_usb_path) (int *value); CP, 1: AP). The function sets the current path of usb node (0: Optional int (*OEM_sys_set_usb_path) (int value); CP, 1: AP). int (*OEM_sys_get_jack_charger_online) (int The function gets the charger online status (0: Mandatory *value); Offline, 1: Online). ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 32 of 143
  34. 34. Tizen Porting Guide int (*OEM_sys_get_jack_earjack_online) (int The function gets the earjack online status (0: Mandatory *value); Offline, 1: Online). int (*OEM_sys_get_jack_earkey_online) (int The function gets the earkey online status (0: Mandatory *value); Offline, 1: Online). int (*OEM_sys_get_jack_hdmi_online) (int The function gets the hdmi online status (0: Offline, Optional *value); 1: Online). int (*OEM_sys_get_jack_usb_online) (int The function gets the usb online status (0: Offline, Optional *value); 1: Online). int (*OEM_sys_get_jack_cradle_online) (int The function gets the cradle online status (0: Optional *value); Offline, 1: Online). int (*OEM_sys_get_jack_tvout_online) (int The function gets the TV out online status (0: Optional *value); Offline, 1: Online). int(*OEM_sys_get_jack_keyboard_online) Optional The fuction gets the keyboard interface status. (int *value);VibratorVibrator interfaces are used to for accessing vibrator device. They provides functions to controland retrieve vibrator parameters. Function Prototype Description (0: Success, Others: Failed)int The function gets the max vibrationOptional(*OEM_sys_get_haptic_vibetones_level_max) feedback intensity level.(int *value)int (*OEM_sys_get_haptic_vibetones_level) (int The function gets the current vibration Optional*value) feedback intensity level (0 <= value <= VIBETONES_LEVEL_MAX).int (*OEM_sys_set_haptic_vibetones_level) (int The function sets the current vibration Optionalvalue) feedback intensity level (0 <= value <= VIBETONES_LEVEL_MAX).int (*OEM_sys_set_haptic_vibetones_enable) The function enables the vibration with Mandatory(int value) current intensity level (0: Off, 1: On).int (*OEM_sys_set_haptic_vibetones_oneshot) The function enables the oneshot Optional(int value) vibration with current intensity level (mili-second).Image EnhancementImage Enhancement interfaces provides functions to control the Image Quality EnhancementAlgorithm. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 33 of 143
  35. 35. Tizen Porting Guide Function Prototype Description (0: Success, Others: Failed)int (*OEM_sys_get_image_enh The function gets the mode of image enhance algorithm Optionalance_mode) (int *value); (0 : DYNAMIC, 1 : STANDARD, 2 : NATURAL, 3 : MOVIE)int (*OEM_sys_set_image_enh The function sets the mode of image enhance algorithm Optionalance_mode) (int value); (0 : DYNAMIC, 1 : STANDARD, 2 : NATURAL, 3 : MOVIE)int (*OEM_sys_get_image_enh The function gets the scenario of image enhance algorithm Optionalance_scenario) (int *value); (0 : UI, 1 : GALLERY, 2: VIDEO, 3 : VTCALL, 4 : CAMERA, 5 : B ROWSER, 6 : NEGATIVE, 7 : BYPASS)int (*OEM_sys_set_image_enh The function sets the scenario of image enhance algorithm Optionalance_scenario) (int value); (0 : UI, 1 : GALLERY, 2: VIDEO, 3 : VTCALL, 4 : CAMERA, 5 : B ROWSER, 6 : NEGATIVE, 7 : BYPASS)int (*OEM_sys_get_image_enh The function gets the tone of image enhance algorithm Optionalance_tone) (int *value); (browser scenario - 0 : TONE_1, 1 : TONE_2, 2 : TONE_3) (other scenario - 0 : NORMAL, 1: WARM, 2: COLD)int (*OEM_sys_set_image_enh The function sets the tone of image enhance algorithm Optionalance_tone) (int value); (browser scenario - 0 : TONE_1, 1 : TONE_2, 2 : TONE_3) (other scenario - 0 : NORMAL, 1: WARM, 2: COLD)int (*OEM_sys_get_image_enh The function gets the outdoor of image enhance algorithm Optionalance_outdoor) (int *value); (0 : OUTDOOR_OFF, 1: OUTDOOR_ON)int (*OEM_sys_set_image_enh The function sets the outdoor of image enhance algorithm Optionalance_outdoor) (int value); (0 : OUTDOOR_OFF, 1: OUTDOOR_ON)int (*OEM_sys_image_enhanc This function reports whether Image Quality Enhancement Optionale_info) (int *value); Algorithm is supportedint (*OEM_sys_set_display_fra The function sets the frame rate of LCD Optionalme_rate) (int value); (0 : OFF - 60HZ, 1 : ON - 40HZ)LightLight interfaces provides functions to control light, brightness, and get and set brightness of LEDand to control power status of LCD power. Function Prototype Description (0: Success, Others: Failed)int The function gets the max brightness of Mandatory(*OEM_sys_get_backlight_max_brightn backlight unit.ess) (int index, int *value)Int The function gets the min brightness of Mandatory(*OEM_sys_get_backlight_min_brightn backlight unit.ess) (int index, int *value)int The function gets the current brightness of Mandatory(*OEM_sys_get_backlight_brightness) backlight unit(int index, int *value, int power_saving) (0 <= value <= MAX_BACKLIGHT_BRIGHTNESS).int The function sets the current brightness of Mandatory(*OEM_sys_set_backlight_brightness) backlight unit(int index, int value, int power_saving) (0 <= value <= MAX_BACKLIGHT_BRIGHTNESS). ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 34 of 143
  36. 36. Tizen Porting Guideint The function sets the dimming status of Mandatory (*OEM_sys_set_backlight_dim backlight unit (0: Off, 1: On).ming) (int index, int value)int The function gets the current ACL control status Optional(*OEM_sys_get_backlight_acl_control) of backlight unit (0: Off, 1: On).(int index, int *value)int The function sets the current ACL control status Optional(*OEM_sys_set_backlight_acl_control) of backlight unit (0: Off, 1: On).(int index, int value)int (*OEM_sys_get_lcd_power) (int The function gets the current LCD power status Optionalindex, int *value) (0: Off, 1: On).int (*OEM_sys_set_lcd_power) (int The function sets the current LCD power status Optionalindex, int value) (0: Off, 1: On).int The function gets the max brightness of the led Optional(*OEM_sys_get_leds_torch_max_bright torch.ness) (int *value)int The function gets the current brightness of the Optional(*OEM_sys_get_leds_torch_brightness) led torch(int *value) (0 <= value <= TORCH_MAX_BRIGHTNESS).int The function sets the current brightness of the Optional(*OEM_sys_set_leds_torch_brightness) led torch(int value) (0 <= value <= TORCH_MAX_BRIGHTNESS).Keytouch OAL interfacesKey and touch event OAL interfaces uses standard input driver methods. These interfaces areused to get the key and touch events. The standard input structure in include/linux/input.h is:struct input_event { struct timeval time; __u16 type; __u16 code; __s32 value;};BatteryBattery Interfaces provide access to battery status functions to retrieve current battery statusinformation. Function Name Description (0: Success, Others: Failed)int (*OEM_sys_get_battery_capacity) (int The function gets the current battery Mandatory*value) capacity (0 %< value < 100%).int The function gets the current battery Mandatory (*OEM_sys_get_battery_capacity_ capacity (0% < value < 10000%). ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 35 of 143
  37. 37. Tizen Porting Guideraw) (int *value)int (*OEM_sys_get_battery_charge_full) The function gets the current battery full Mandatory(int *value) charge status (0: Not full charge, 1: Full charge).int (*OEM_sys_get_battery_charge_now) The function gets the battery charging status Mandatory(int *value) (0: Not charging, 1: Charging).int (*OEM_sys_get_battery_present) (int The function gets the battery installation Mandatory*value) status (0: Not charging, 1: Charging).int (*OEM_sys_get_battery_health) The function gets the temperature status Optional(int *value) (0: UNKNOWN, 1: good, 2: overheat, 3: dead 4: overvoltage, 5: unspecified, 6: cold, 7: health maxUtilityThese utility OAL interfaces monitor process, notify low memory warning, and kill the process. Function Name Description (0: Success, Others: Failed) int (*OEM_sys_get_memnotify_node) (char The function gets the node of out of memory Mandatory *node); notification. Int (*OEM_sys_get_memnotify_victim_task) The function gets the pid of victim process to be Mandatory (int *value); killed in OOM. Int Mandatory The function sets the memory size of thershold (*OEM_sys_set_memnotify_threshold_lv1) OOM level 1. (int value); Int The function sets the memory size of thershold Mandatory (*OEM_sys_set_memnotify_threshold_lv2) OOM level 2. (int value); Int (*OEM_sys_get_process_monitor_node) The function gets the node that send pid of Mandatory (char *node); unexpected killed proccess. Int The function sets the pid of the process regarded Mandatory (*OEM_sys_set_process_monitor_mp_pnp) as a permanent process. (int value);00 Int Mandatory The function sets the pid of the process regarded (*OEM_sys_set_process_monitor_mp_vip) as vip process type. (int value);ConfigurationNoneReferencePackagename: device-manager-plugin-exynosInclude file : devman_define_node_path.h ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 36 of 143
  38. 38. Tizen Porting GuideSource file: device_manager_plugin_exynos.cPM Kernel ConfigurationPower management options[*] Power Management supportLinux Suspend Resume Code is located at kernel/powerGeneric Device/Bus suspend resume code located at drivers/base/power/Device/Bus level suspend resume code in .suspend and .resume callbacks for each device driveror bus driversys interface: /sys/kernel/power/CPU IdleIt is a generic framework for supporting software-controlled idle processor power management.It includes modular cross-platform governors that can be swapped during runtime. [*] CPU idle PM supportThe default CPU Idle governor is the menu governor and the code is located at drivers/cpuidle.sys interface: /sys/devices/system/cpu/cpuidle/CPU DVFSIt allows you to change the clock speed of CPUs on the fly. This is a nice method to save power,because the lower the CPU clock speed, the less power the CPU consumes.There are different generic CPU frequency governors, like performance, powersave, userspace, ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 37 of 143
  39. 39. Tizen Porting Guideondemand, etc., to control transitions among various Operating Points. The code is located atdrivers/cpufreq.sys interface: /sys/devices/system/cpu/cpufreq/CPU HotplugIn addition to the above, Tizen Power management provides extra features to support dynamiccpu hotplug to reduce power consumption.To enable this feature, select this configuration:-*- Support for hot-pluggable CPUs (EXPERIMENTAL)sys interface: /sys/devices/system/cpu/To support dynamic CPU hotplug to reduce power consumption, select this configurationSystem Type  Support dynamic cpu hotplug sys interface: /sys/module/pm_hotplug/System OAL Kernel configurationCONFIG_SLP_PROCESS_MONCONFIG_INPUTCONFIG_INPUT_MISCCONFIG_INPUT_MOUSEDEV(Optional)CONFIG_INPUT_KEYBOARD(Optional)CONFIG_INPUT_TOUCHSCREEN(Optional)CONFIG_FBCONFIG_FB_S3CCONFIG_BACKLIGHT_CLASS_DEVICECONFIG_LCD_CLASS_DEVICECONFIG_LCD_S6E8AA0CONFIG_MMCCONFIG_MMC_BLOCKCONFIG_MMC_SDHCI_S3CCONFIG_MMC_S3C_DEV_HSMMC*CONFIG_USB_EXYNOS_SWITCHCONFIG_UART_SELECTCONFIG_VIBETONZCONFIG_CHARGER_MANAGERCONFIG_PMCONFIG_PM_SLEEP ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 38 of 143
  40. 40. Tizen Porting GuideCONFIG_JACKMONCONFIG_CPU_FREQCONFIG_RTC_DRV_S3CCONFIG_RTC_DRV_MAX8997 ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 39 of 143
  41. 41. Tizen Porting GuideSensor FrameworkDescriptionSensor devices are used widely in mobile devices to enhance user experience. Most modernmobile OSs have a framework which manages sensor hardware on the platform and providesconvenient API to the application.Types of SensorsTizen supports individual plugin frameworks for these sensors:  Accelerometer sensor  Gyroscope sensor  Proximity sensor  Motion sensor  Geomagnetic sensor  Light sensorNote: Details are not available for Ambient light, Magnetic sensorsAccelerometer sensorThe accelerometer sensor is used to measure the acceleration of the device. The threedimensional coordinate system is used to illustrate the direction of the acceleration. When aphone is moving along an axis, the acceleration is positive if it moves in a positive direction.Gyroscope sensorA gyroscope is a device used primarily for navigation and measurement of angular velocity.Gyroscopes measure how quickly an object rotates. This rate of rotation can be measured alongany of the three axes X, Y, and Z.Proximity sensorA proximity sensor can detect the presence of nearby objects without any physical contact.That is, it indicates if the device is close or not close to the user.Motion sensorA motion sensor is a virtual sensor that uses the accelerometer and gyroscope sensors. Motionsensor detects snap, panning, tilt, shake, overturn, and double tap event.Geomagnetic sensorA geomagnetic sensor indicates the strength of the geomagnetic flux density in the X, Y, and Zaxes. This sensor is used to find the orientation of a body, which is a description of how it isaligned to the space it is in.Light sensorA light sensor measures the amount of light that it receives or the surrounding light conditions.The ambient light state is measured as a step value, where 0 is very dark and 10 is brightsunlight. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 40 of 143
  42. 42. Tizen Porting GuideFigure: Sensor Framework ArchitectureComponents of Sensor FrameworkThe Sensor framework provides a sensor server for creating plugins and a medium throughwhich the client applications are connected to the sensor hardware to exchange data. Thesensor plugins retrieve data from sensor hardware and enable the client applications to use thedata for specific requirements.Heres the description of the sensor framework components:Sensor LibraryThe application that wants to access the sensor service should communicate with the daemonthrough the sensor API library. An API library allows the application to access the sensor service.As shown in the below diagram, applications/middleware frameworks can have the sensor-framework client library in the process context.Sensor ServerThe sensor server is a daemon which communicates uniquely to sensor drivers in the systemand dispatches sensor data to the application. The sensor server takes care of interacting withthe sensor driver in hardware initialization, driver configuration, and data fetching, to manage ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 41 of 143
  43. 43. Tizen Porting Guideall sensors on the platform.Type of plugins in sensor frameworkSensor PluginSensor plugins takes care of interacting with the sensor driver.Plug-ins process data from sensor drivers and communicate it to the sensor server.Processor:Active component (it has a thread) that processes data or makes events from a filteror from sensor data.Filter: Passive component that converts sensor raw data to other types of dataSensor: Passive component that gets raw data from the kernel nodeFigure: Sensor Framework ComponentsPorting OAL InterfaceThe sensor OAL includes the processor plugin, the filter plugin, and the sensor plugin. Theaccelerometer sensor (accel) is taken as an example to illustrate each plugin prototypeimplementation.Processor PluginActive component (it has a thread) that processes data or makes events from a filter or fromsensor data. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 42 of 143
  44. 44. Tizen Porting GuidePrototype implementation of processor pluginclass accel_processor : public cprocessor_module { public: /*define enums*/ /*define structures*/ accel_processor(); virtual ~ accel_processor(); const char *name(void); int id(void); int version(void); bool update_name(char *name); bool update_id(int id); bool update_version(int version); bool add_input(csensor_module * sensor); bool add_input(cfilter_module * filter); long value(char *port); long value(int id); cprocessor_module *create_new(void); void destroy(cprocessor_module * module); static void *working(void *inst); static void *stopped(void *inst); virtual bool start(void); virtual bool stop(void); bool add_callback_func(cmd_reg_t * param); bool remove_callback_func(cmd_reg_t * param); bool check_callback_event(cmd_reg_t * param); long set_cmd(int type, int property, long input_value); int get_property(unsigned int property_level, void *property_data); int get_struct_value(unsigned int struct_type, void *struct_values); bool waiting_for_data(unsigned long time_us, bool real_update = false);private: /* Define private data structures and functions*/};Refer to the Appendix for sensor the processor plugin API’s.Sensor PluginA passive component that gets raw data from the kernel node.Prototype implementation sensor pluginclass caccel:public csensor_module { public:/*define enums*/ /*define structures*/ caccel(); virtual ~ caccel(); const char *name(void); int version(void); ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 43 of 143
  45. 45. Tizen Porting Guide int id(void); bool is_data_ready(bool wait = false); long value(const char *port); long value(int id); bool update_name(char *name); bool update_version(int ver); bool update_id(int id); int port_count(void); const char *port(int idx); bool need_polling(void); long polling_interval(void); bool update_polling_interval(unsigned long val); int get_sensor_type(void); long set_cmd(int type, int property, long input_value); int get_property(unsigned int property_level, void *property_data); int get_struct_value(unsigned int struct_type, void *struct_values); bool calibration(int iteration); int check_hw_node(void); bool start(void); bool stop(void); void reset(void); private:/* Define private data structures and functions*/};Prototype Descriptionbool is_data_ready(bool wait) When sensor data is available that can be read from sensor node, then return that status. This function waits during polling time and calls update_value. If wait is true, then wait during polling interval time.int port_count(void) Returns the port count in sensor. For example, accelerometer sensor has X, Y, Z port. In this case, port_count function return 3.const char *port(int idx) Returns port name by index number. When port(0) called in the accelerometer sensor, then this function returns ‘x’.void reset(void) Reset s sensor node.bool start(void) / bool This function enables or disables the sensor. It isstop(void) the interface for the on or off function for the sensor. It starts or stops function success, then returns true. Otherwise, it returns false.bool need_polling(void) This function announces that sensor’s data reading type is polling or interrupt. If it is true, it is polling, otherwise it is interrupt. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 44 of 143
  46. 46. Tizen Porting Guidelong polling_interval(void) It senses the need to poll data. Then returns the polling interval time by ms.bool Updates polling interval by ms.update_polling_interval(unsigned long val)void lock(void) Locks the sensor and blocks the other component’s access.void unlock(void) Unlocks the sensor and releases the other components access.Filter PluginA passive component that converts sensor raw data to other types of data.Prototype implementation filter pluginclass caccel:public csensor_module { public: /* Define enums*//* Define structures*/ caccel(); virtual ~ caccel(); const char *name(void); int version(void); int id(void); bool is_data_ready(bool wait = false); long value(const char *port); long value(int id); bool update_name(char *name); bool update_version(int ver); bool update_id(int id); int port_count(void); const char *port(int idx); bool need_polling(void); long polling_interval(void); bool update_polling_interval(unsigned long val); int get_sensor_type(void); long set_cmd(int type, int property, long input_value); int get_property(unsigned int property_level, void *property_data); int get_struct_value(unsigned int struct_type, void *struct_values); bool calibration(int iteration); int check_hw_node(void); bool start(void); ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 45 of 143
  47. 47. Tizen Porting Guide bool stop(void); void reset(void); private:/* Define private data structures and functions*/}ConfigurationSensor Framework loads configuration files sf_sensor.conf , sf_filter,conf , sf_processor.conf ,sf_datastream.conf for loading sensor, filter, and processor plugins.Each configuration file supports the following fields and values: disable=yes/no override=yes/no path=Absolute path of a component id=decimal version=decimalBetween [ and ], the names of plugin are placed. If don’t want to use the plugin, set disable toyesExample of a sample configuration file: [kxsd9_sensor] disable=no override=yes path=/opt/x1/lib/sensor_framework/libkxsd9.so id=1111 version=1 poll=100 [ak8973b_sensor] disable=yes override=yes path=/opt/x1/lib/sensor_framework/libak8973b.so id=1113 version=1 poll=100ReferenceReference kernel configuration for sensors, will vary with different vendor types.Sensor components Kernel Config Device nodes /dev/input/event0/ /dev/ input/event1/Accelerometer CONFIG_INPUT_KR3DH /dev/ input/event2/ ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 46 of 143
  48. 48. Tizen Porting Guide /dev/ input/event3/ /dev/ input/event4/ /dev/ input/event5/Proximity CONFIG_INPUT_GP2ALight sensor CONFIG_INPUT_GP2AElectronic compass CONFIG_SENSORS_AK8975 ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 47 of 143
  49. 49. Tizen Porting GuideGraphics and UIThis figure provides a brief overview of the Tizen UI and graphics architecture.Description:Tizen provides high performance 3D graphics as a component of UI & Graphics, as shown in thefigure above. There are hardware-accelerated OpenGL ES (Open Graphics Library EmbeddedSystem) and EGL (Embedded-System Graphics Library) for 3D applications, such as 3D games.OpenGL ES is an application programming interface (API) for advanced 3D graphics, targeted athandheld and embedded devices. To overcome device constraints, such as, limited processingcapabilities and memory availability, it provides a subset of the functionality in OpenGL.But embedded system-specific features were added to enhance rendering efficiency, such as,precision qualifiers to the shading language from OpenGL ES 2.0.OpenGL3D Graphics LibraryThe diagram provides an overview of the interface for Tizen high performance 3D graphicslibrary with OpenGL. ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary Page 48 of 143

×