Home | History | Annotate | Download | only in contexthubhal
      1 /*
      2  * Copyright (C) 2016 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #define LOG_TAG "NanohubHAL"
     18 #include <hardware/context_hub.h>
     19 #include "nanohub_perdevice.h"
     20 #include "nanohubhal.h"
     21 #include <utils/Log.h>
     22 
     23 namespace android {
     24 
     25 namespace nanohub {
     26 
     27 #define DEVICE "Default"
     28 #define DEVICE_TAG (DEVICE[0])
     29 
     30 static const connected_sensor_t mSensors[] = {
     31     {
     32         .sensor_id = ((int)DEVICE_TAG << 8) + 1,
     33         .physical_sensor = {
     34             .name = "i'll get to this later",
     35         },
     36     },
     37     {
     38         .sensor_id = ((int)DEVICE_TAG << 8) + 2,
     39         .physical_sensor = {
     40             .name = "i'll get to this later as well",
     41         },
     42     },
     43 };
     44 
     45 static const context_hub_t mHub = {
     46     .name = "Google System Nanohub on " DEVICE,
     47     .vendor = "Google/StMicro",
     48     .toolchain = "gcc-arm-none-eabi",
     49     .platform_version = 1,
     50     .toolchain_version = 0x04080000, //4.8
     51     .hub_id = 0,
     52 
     53     .peak_mips = 16,
     54     .stopped_power_draw_mw = 0.010 * 1.800,
     55     .sleep_power_draw_mw   = 0.080 * 1.800,
     56     .peak_power_draw_mw    = 3.000 * 1.800,
     57 
     58     .connected_sensors = mSensors,
     59     .num_connected_sensors = sizeof(mSensors) / sizeof(*mSensors),
     60 
     61     .max_supported_msg_len = MAX_RX_PACKET,
     62     .os_app_name = { .id = 0 },
     63 };
     64 
     65 const char *get_devnode_path(void)
     66 {
     67     return "/dev/nanohub_comms";
     68 }
     69 
     70 const context_hub_t* get_hub_info(void)
     71 {
     72     return &mHub;
     73 }
     74 
     75 }; // namespace nanohub
     76 
     77 }; // namespace android
     78