Home | History | Annotate | Download | only in avd
      1 /* Copyright (C) 2008 The Android Open Source Project
      2 **
      3 ** This software is licensed under the terms of the GNU General Public
      4 ** License version 2, as published by the Free Software Foundation, and
      5 ** may be copied, distributed, and modified under those terms.
      6 **
      7 ** This program is distributed in the hope that it will be useful,
      8 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
      9 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     10 ** GNU General Public License for more details.
     11 */
     12 #ifndef _ANDROID_AVD_HW_CONFIG_H
     13 #define _ANDROID_AVD_HW_CONFIG_H
     14 
     15 #include <stdint.h>
     16 #include "android/utils/compiler.h"
     17 #include "android/utils/ini.h"
     18 
     19 ANDROID_BEGIN_HEADER
     20 
     21 typedef char      hw_bool_t;
     22 typedef int       hw_int_t;
     23 typedef int64_t   hw_disksize_t;
     24 typedef char*     hw_string_t;
     25 typedef double    hw_double_t;
     26 
     27 /* these macros are used to define the fields of AndroidHwConfig
     28  * declared below
     29  */
     30 #define   HWCFG_BOOL(n,s,d,a,t)       hw_bool_t      n;
     31 #define   HWCFG_INT(n,s,d,a,t)        hw_int_t       n;
     32 #define   HWCFG_STRING(n,s,d,a,t)     hw_string_t    n;
     33 #define   HWCFG_DOUBLE(n,s,d,a,t)     hw_double_t    n;
     34 #define   HWCFG_DISKSIZE(n,s,d,a,t)   hw_disksize_t  n;
     35 
     36 typedef struct {
     37 #include "android/avd/hw-config-defs.h"
     38 } AndroidHwConfig;
     39 
     40 /* Set all default values, based on the target API level */
     41 void androidHwConfig_init( AndroidHwConfig*  hwConfig,
     42                            int               apiLevel );
     43 
     44 /* reads a hardware configuration file from disk.
     45  * returns -1 if the file could not be read, or 0 in case of success.
     46  *
     47  * note that default values are written to hwConfig if the configuration
     48  * file doesn't have the corresponding hardware properties.
     49  */
     50 int  androidHwConfig_read( AndroidHwConfig*  hwConfig,
     51                            IniFile*          configFile );
     52 
     53 /* Write a hardware configuration to a config file object.
     54  * Returns 0 in case of success. Note that any value that is set to the
     55  * default will not bet written.
     56  */
     57 int  androidHwConfig_write( AndroidHwConfig*  hwConfig,
     58                             IniFile*          configFile );
     59 
     60 /* Finalize a given hardware configuration */
     61 void androidHwConfig_done( AndroidHwConfig* config );
     62 
     63 /* Checks if screen doesn't support touch, or multi-touch */
     64 int  androidHwConfig_isScreenNoTouch( AndroidHwConfig* config );
     65 /* Checks if screen supports touch (but not multi-touch). */
     66 int  androidHwConfig_isScreenTouch( AndroidHwConfig* config );
     67 /* Checks if screen supports multi-touch. */
     68 int  androidHwConfig_isScreenMultiTouch( AndroidHwConfig* config );
     69 
     70 // Return an integer indicating if the kernel requires a new device
     71 // naming scheme. More specifically:
     72 //  -1 -> don't know, caller will need to auto-detect.
     73 //   0 -> legacy device naming
     74 //   1 -> new device naming.
     75 //
     76 // The new device naming was allegedly introduced in Linux 3.10 and
     77 // replaces /dev/ttyS<num with /dev/ttyGF<num>. Also see related
     78 // declarations in android/kernel/kernel_utils.h
     79 int androidHwConfig_getKernelDeviceNaming( AndroidHwConfig* config );
     80 
     81 // Return an integer indicating is the kernel supports YAFFS2 partition
     82 // images. More specifically:
     83 //  -1 -> don't know, caller will need to auto-detect.
     84 //   0 -> does not support YAFFS2 partitions.
     85 //   1 -> does support YAFFS2 partitions.
     86 int androidHwConfig_getKernelYaffs2Support( AndroidHwConfig* config );
     87 
     88 // Return the kernel device prefix for serial ports, depending on
     89 // kernel.newDeviceNaming.
     90 const char* androidHwConfig_getKernelSerialPrefix( AndroidHwConfig* config );
     91 
     92 ANDROID_END_HEADER
     93 
     94 #endif /* _ANDROID_AVD_HW_CONFIG_H */
     95