• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 #pragma once
15 
16 #include "hw-lcd.h"
17 
18 #include <stdint.h>
19 
20 typedef char      hw_bool_t;
21 typedef int       hw_int_t;
22 typedef int64_t   hw_disksize_t;
23 typedef char*     hw_string_t;
24 typedef double    hw_double_t;
25 
26 /* these macros are used to define the fields of AndroidHwConfig
27  * declared below
28  */
29 #define   HWCFG_BOOL(n,s,d,a,t)       hw_bool_t      n;
30 #define   HWCFG_INT(n,s,d,a,t)        hw_int_t       n;
31 #define   HWCFG_STRING(n,s,d,a,t)     hw_string_t    n;
32 #define   HWCFG_DOUBLE(n,s,d,a,t)     hw_double_t    n;
33 #define   HWCFG_DISKSIZE(n,s,d,a,t)   hw_disksize_t  n;
34 
35 typedef struct {
36 #include "hw-config-defs.h"
37 } AndroidHwConfig;
38 
39 /* Set all default values, based on the target API level */
40 void androidHwConfig_init( AndroidHwConfig*  hwConfig,
41                            int               apiLevel );
42 
43 /* reads a hardware configuration file from disk.
44  * returns -1 if the file could not be read, or 0 in case of success.
45  *
46  * note that default values are written to hwConfig if the configuration
47  * file doesn't have the corresponding hardware properties.
48  */
49 // int androidHwConfig_read(AndroidHwConfig* hwConfig, CIniFile* configFile);
50 
51 /* Write a hardware configuration to a config file object.
52  * Returns 0 in case of success. Note that any value that is set to the
53  * default will not bet written.
54  */
55 // int androidHwConfig_write(AndroidHwConfig* hwConfig, CIniFile* configFile);
56 
57 /* Finalize a given hardware configuration */
58 void androidHwConfig_done( AndroidHwConfig* config );
59 
60 /* Checks if screen doesn't support touch, or multi-touch */
61 int  androidHwConfig_isScreenNoTouch( AndroidHwConfig* config );
62 /* Checks if screen supports touch (but not multi-touch). */
63 int  androidHwConfig_isScreenTouch( AndroidHwConfig* config );
64 /* Checks if screen supports multi-touch. */
65 int  androidHwConfig_isScreenMultiTouch( AndroidHwConfig* config );
66 
67 /* Returns the Screen Size */
68 hwLcd_screenSize_t androidHwConfig_getScreenSize(AndroidHwConfig* config);
69 
70 /* Returns CDD defined minimum heap size in MB */
71 int androidHwConfig_getMinVmHeapSize(AndroidHwConfig* config, int apiLevel);
72 
73 // Return an integer indicating if the kernel requires a new device
74 // naming scheme. More specifically:
75 //  -1 -> don't know, caller will need to auto-detect.
76 //   0 -> legacy device naming
77 //   1 -> new device naming.
78 //
79 // The new device naming was allegedly introduced in Linux 3.10 and
80 // replaces /dev/ttyS<num with /dev/ttyGF<num>. Also see related
81 // declarations in android/kernel/kernel_utils.h
82 int androidHwConfig_getKernelDeviceNaming( AndroidHwConfig* config );
83 
84 // Return an integer indicating is the kernel supports YAFFS2 partition
85 // images. More specifically:
86 //  -1 -> don't know, caller will need to auto-detect.
87 //   0 -> does not support YAFFS2 partitions.
88 //   1 -> does support YAFFS2 partitions.
89 int androidHwConfig_getKernelYaffs2Support( AndroidHwConfig* config );
90 
91 // Return the kernel device prefix for serial ports, depending on
92 // kernel.newDeviceNaming.
93 const char* androidHwConfig_getKernelSerialPrefix( AndroidHwConfig* config );
94 
95 // Remove all default values from the |source| ini file and write only
96 // non-defaulted settings into |target|
97 // void androidHwConfig_stripDefaults(CIniFile* source, CIniFile* target);
98 
99 // Checks if the hw config has the virtual scene camera enabled.
100 int androidHwConfig_hasVirtualSceneCamera(AndroidHwConfig* config);
101 
102 // Checks if the hw config has the video playback camera enabled.
103 int androidHwConfig_hasVideoPlaybackCamera(AndroidHwConfig* config);
104 
105 
106 int androidHwConfig_hasVideoPlaybackFrontCamera(AndroidHwConfig* config);
107 
108 int androidHwConfig_hasVideoPlaybackBackCamera(AndroidHwConfig* config);
109