mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-27 10:22:08 +00:00
Merge branch 'master' into UT_ocmp_powerSource
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
from lcov_cobertura import LcovCobertura
|
||||
|
||||
LCOV_FILE = 'build/coverage/test-coverage.info'
|
||||
OUT_FILE = 'build/coverage/test-coverage.xml'
|
||||
|
||||
with open(LCOV_FILE) as fr:
|
||||
data = fr.read()
|
||||
|
||||
converter = LcovCobertura(data)
|
||||
res = converter.convert()
|
||||
|
||||
with open(OUT_FILE, 'w') as fw:
|
||||
fw.write(res)
|
||||
3
.github/ISSUE_TEMPLATE/bug_report.md
vendored
3
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -13,3 +13,6 @@ A clear and concise description of what you happened.
|
||||
|
||||
**Please provide all necessary steps to reproduce the issue**
|
||||
A clear and concise description of steps to reproduce the bug.
|
||||
|
||||
**Attach build configuration log**
|
||||
Check under firmware/utilities/build and attach build_*_cfg.txt
|
||||
|
||||
@@ -50,3 +50,5 @@ William Laroche
|
||||
David Lacasse
|
||||
Messaoud Ahmed Ouameur
|
||||
Yannick Lebel
|
||||
Mark D Lewis
|
||||
Jack Marriott
|
||||
|
||||
46
firmware/ec/Jenkinsfile
vendored
Normal file
46
firmware/ec/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
node {
|
||||
currentBuild.result = 'SUCCESS'
|
||||
withEnv(["UNITY_ROOT=$HOME/Unity", "TOOLCHAIN=$HOME/gcc-arm-none-eabi", "OCWARE_DIR=./"]) {
|
||||
stage('Checkout') {
|
||||
step([$class: 'WsCleanup'])
|
||||
echo 'Checking out SCM'
|
||||
checkout scm
|
||||
}
|
||||
|
||||
try {
|
||||
stage('Static Analysis') {
|
||||
sh 'bash firmware/utilities/jenkins/clang_patch'
|
||||
}
|
||||
} catch (err) {
|
||||
currentBuild.result = 'ERROR'
|
||||
} finally {
|
||||
archiveArtifacts '**/clang_format.patch'
|
||||
}
|
||||
|
||||
try {
|
||||
stage('Build and Unit Test') {
|
||||
dir ("firmware/ec"){
|
||||
sh 'make ci'
|
||||
sh 'python3 ../utilities/jenkins/coverage.py'
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
currentBuild.result = 'FAILURE'
|
||||
} finally {
|
||||
warnings consoleParsers: [[parserName: 'GNU Make + GNU C Compiler (gcc)']]
|
||||
junit 'firmware/ec/test/build/results/unit-test-results.xml'
|
||||
step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false,\
|
||||
coberturaReportFile: '**/test-coverage.xml', failUnhealthy: false, failUnstable: false,\
|
||||
maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false])
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
# Set proper path.
|
||||
######################
|
||||
|
||||
OCWARE_DIR ?= $(HOME)/OpenCellular/firmware/ec
|
||||
OCWARE_DIR ?= $(shell pwd)
|
||||
TIRTOS_DIR ?= $(HOME)/ti/tirtos_tivac_2_16_01_14
|
||||
XDCTOOLS_DIR ?= $(HOME)/ti/xdctools_3_32_00_06_core
|
||||
TOOLCHAIN ?= /usr
|
||||
@@ -84,7 +84,16 @@ LINT_FLAGS = -i -style=file -fallback-style=none
|
||||
|
||||
.PRECIOUS: %/compiler.opt %/linker.cmd
|
||||
|
||||
all: oc_connect1
|
||||
default: get_cfg all
|
||||
|
||||
all: oc_connect1 hash
|
||||
|
||||
get_cfg:
|
||||
cd ../utilities/build; ./envDetect.sh $(CC) $(TIRTOS_DIR)
|
||||
|
||||
hash:
|
||||
cd ../utilities/checksums; ./hashes.sh $(shell pwd)/$(OUT) -ec
|
||||
|
||||
oc_connect1: $(OUT)/OpenCellular.bin
|
||||
|
||||
$(OUT)/%/compiler.opt $(OUT)/%/linker.cmd : %.cfg
|
||||
@@ -110,6 +119,7 @@ test:
|
||||
cd test && $(MAKE) $(TESTFLAGS)
|
||||
|
||||
ci: TESTFLAGS = ci
|
||||
ci: CFLAGS += -Wextra -Wpointer-arith -Wcast-align -Wwrite-strings -Wswitch-default -Wunreachable-code -Winit-self -Wno-missing-field-initializers -Wno-unknown-pragmas -Wstrict-prototypes -Wundef
|
||||
ci: CFLAGS += -ftest-coverage
|
||||
ci: all test
|
||||
|
||||
|
||||
@@ -51,6 +51,38 @@
|
||||
* however they don't matter as much as the overall chemistry grouping for
|
||||
* selecting the correct conversion factors for the registers
|
||||
*/
|
||||
|
||||
typedef enum LTC4015Status {
|
||||
LTC4015_STATUS_BATTERY_VOLTAGE = 0,
|
||||
LTC4015_STATUS_BATTERY_CURRENT,
|
||||
LTC4015_STATUS_SYSTEM_VOLTAGE,
|
||||
LTC4015_STATUS_INPUT_VOLATGE,
|
||||
LTC4015_STATUS_INPUT_CURRENT,
|
||||
LTC4015_STATUS_DIE_TEMPERATURE,
|
||||
LTC4015_STATUS_ICHARGE_DAC
|
||||
} LTC4015Status;
|
||||
|
||||
typedef enum LTC4015Config {
|
||||
LTC4015_CONFIG_BATTERY_VOLTAGE_LOW = 0,
|
||||
LTC4015_CONFIG_BATTERY_VOLTAGE_HIGH,
|
||||
LTC4015_CONFIG_BATTERY_CURRENT_LOW,
|
||||
LTC4015_CONFIG_INPUT_VOLTAGE_LOW,
|
||||
LTC4015_CONFIG_INPUT_CURRENT_HIGH,
|
||||
LTC4015_CONFIG_INPUT_CURRENT_LIMIT,
|
||||
LTC4015_CONFIG_ICHARGE,
|
||||
LTC4015_CONFIG_VCHARGE,
|
||||
LTC4015_CONFIG_DIE_TEMPERATURE_HIGH,
|
||||
} LTC4015Config;
|
||||
|
||||
typedef enum LTC4015Alert {
|
||||
LTC4015_ALERT_BATTERY_VOLTAGE_LOW = 0,
|
||||
LTC4015_ALERT_BATTERY_VOLTAGE_HIGH,
|
||||
LTC4015_ALERT_BATTERY_CURRENT_LOW,
|
||||
LTC4015_ALERT_INPUT_VOLTAGE_LOW,
|
||||
LTC4015_ALERT_INPUT_CURRENT_HIGH,
|
||||
LTC4015_ALERT_DIE_TEMPERATURE_HIGH,
|
||||
} LTC4015Alert;
|
||||
|
||||
typedef enum LTC4015_Chem {
|
||||
LTC4015_CHEM_LI_ION,
|
||||
LTC4015_CHEM_LI_FE_PO4,
|
||||
@@ -191,4 +223,5 @@ ReturnStatus LTC4015_enableChargerStateAlerts(LTC4015_Dev *dev,
|
||||
|
||||
ePostCode LTC4015_probe(LTC4015_Dev *dev, POSTData *postData);
|
||||
|
||||
void LTC4015_configure(LTC4015_Dev *dev);
|
||||
#endif /* LTC4015_H_ */
|
||||
|
||||
@@ -10,37 +10,6 @@
|
||||
|
||||
#include "inc/devices/ltc4015.h"
|
||||
|
||||
typedef enum LTC4015Status {
|
||||
LTC4015_STATUS_BATTERY_VOLTAGE = 0,
|
||||
LTC4015_STATUS_BATTERY_CURRENT,
|
||||
LTC4015_STATUS_SYSTEM_VOLTAGE,
|
||||
LTC4015_STATUS_INPUT_VOLATGE,
|
||||
LTC4015_STATUS_INPUT_CURRENT,
|
||||
LTC4015_STATUS_DIE_TEMPERATURE,
|
||||
LTC4015_STATUS_ICHARGE_DAC
|
||||
} LTC4015Status;
|
||||
|
||||
typedef enum LTC4015Config {
|
||||
LTC4015_CONFIG_BATTERY_VOLTAGE_LOW = 0,
|
||||
LTC4015_CONFIG_BATTERY_VOLTAGE_HIGH,
|
||||
LTC4015_CONFIG_BATTERY_CURRENT_LOW,
|
||||
LTC4015_CONFIG_INPUT_VOLTAGE_LOW,
|
||||
LTC4015_CONFIG_INPUT_CURRENT_HIGH,
|
||||
LTC4015_CONFIG_INPUT_CURRENT_LIMIT,
|
||||
LTC4015_CONFIG_ICHARGE,
|
||||
LTC4015_CONFIG_VCHARGE,
|
||||
LTC4015_CONFIG_DIE_TEMPERATURE_HIGH,
|
||||
} LTC4015Config;
|
||||
|
||||
typedef enum LTC4015Alert {
|
||||
LTC4015_ALERT_BATTERY_VOLTAGE_LOW = 0,
|
||||
LTC4015_ALERT_BATTERY_VOLTAGE_HIGH,
|
||||
LTC4015_ALERT_BATTERY_CURRENT_LOW,
|
||||
LTC4015_ALERT_INPUT_VOLTAGE_LOW,
|
||||
LTC4015_ALERT_INPUT_CURRENT_HIGH,
|
||||
LTC4015_ALERT_DIE_TEMPERATURE_HIGH,
|
||||
} LTC4015Alert;
|
||||
|
||||
static bool _choose_battery_charger(LTC4015_Dev *dev)
|
||||
{
|
||||
if (OcGpio_write(&dev->cfg.pin_lt4015_i2c_sel,
|
||||
|
||||
@@ -87,9 +87,13 @@ endif
|
||||
|
||||
# Make Targets
|
||||
# =============================================================================
|
||||
test: $(BUILD_PATHS) $(RESULTS)
|
||||
|
||||
test: get_cfg $(BUILD_PATHS) $(RESULTS)
|
||||
ruby $(UNITY_ROOT)/auto/unity_test_summary.rb $(PATHR)
|
||||
|
||||
get_cfg:
|
||||
cd ../../utilities/build; ./envDetect.sh $(shell cat $(UNITY_ROOT)/release/version.info)
|
||||
|
||||
junit: test
|
||||
@ruby $(UNITY_ROOT)/auto/stylize_as_junit.rb -r $(PATHR) -o $(PATHR)/unit-test-results.xml
|
||||
|
||||
@@ -156,6 +160,9 @@ $(PATHB)Test_PinGroup_driver$(TARGET_EXTENSION): $(STD_FILES) $(TEST_PINGROUP_SR
|
||||
TEST_OCGPIO_SRC=$(OCWARE_ROOT)/src/drivers/OcGpio.c $(OCWARE_ROOT)/src/devices/i2cbus.c fake/fake_I2C.c fake/fake_GPIO.c fake/fake_ThreadedISR.c $(OCWARE_ROOT)/src/helpers/memory.c stub/stub_GateMutex.c
|
||||
$(PATHB)Test_OcGpio$(TARGET_EXTENSION): $(STD_FILES) $(TEST_OCGPIO_SRC)
|
||||
|
||||
TEST_OCMP_LTC4015_SRC=$(OCWARE_ROOT)/src/devices/ocmp_wrappers/ocmp_ltc4015.c $(OCWARE_ROOT)/src/devices/ltc4015.c $(OCWARE_ROOT)/src/drivers/GpioSX1509.c $(OCWARE_ROOT)/src/devices/sx1509.c $(OCWARE_ROOT)/src/helpers/memory.c $(OCWARE_ROOT)/src/devices/i2cbus.c fake/fake_GPIO.c fake/fake_I2C.c fake/fake_ThreadedISR.c stub/stub_GateMutex.c stub/stub_GateMutex.c stub/stub_ltc4015.c $(OCWARE_ROOT)/src/post/post_util.c fake/fake_SX1509_register.c fake/fake_ltc4015_register.c $(OCWARE_ROOT)/platform/oc-sdr/cfg/OC_CONNECT_GBC.c
|
||||
$(PATHB)Test_ocmp_ltc4015$(TARGET_EXTENSION): $(STD_FILES) $(TEST_OCMP_LTC4015_SRC) $(INC_M)
|
||||
|
||||
TEST_OCMP_powerSource_SRC=$(OCWARE_ROOT)/src/devices/ocmp_wrappers/ocmp_powerSource.c $(OCWARE_ROOT)/src/devices/powerSource.c $(OCWARE_ROOT)/src/drivers/GpioSX1509.c $(OCWARE_ROOT)/src/devices/sx1509.c $(OCWARE_ROOT)/src/helpers/memory.c $(OCWARE_ROOT)/src/devices/i2cbus.c fake/fake_GPIO.c fake/fake_I2C.c fake/fake_ThreadedISR.c stub/stub_GateMutex.c stub/stub_GateMutex.c $(OCWARE_ROOT)/src/post/post_util.c fake/fake_SX1509_register.c fake/fake_powerSource.c $(OCWARE_ROOT)/platform/oc-sdr/cfg/OC_CONNECT_GBC.c
|
||||
$(PATHB)Test_ocmp_powerSource$(TARGET_EXTENSION): $(STD_FILES) $(TEST_OCMP_powerSource_SRC) $(INC_M)
|
||||
|
||||
|
||||
162
firmware/ec/test/fake/fake_ltc4015_register.c
Normal file
162
firmware/ec/test/fake/fake_ltc4015_register.c
Normal file
@@ -0,0 +1,162 @@
|
||||
/**
|
||||
* Copyright (c) 2017-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
#include "include/test_ltc4015.h"
|
||||
#include <stdint.h>
|
||||
|
||||
OcGpio_Port ec_io = {
|
||||
.fn_table = &FakeGpio_fnTable,
|
||||
.object_data = &(FakeGpio_Obj){},
|
||||
};
|
||||
|
||||
bool LTC4015_GpioPins[] = {
|
||||
[0x04] = 0x1,
|
||||
};
|
||||
|
||||
uint32_t LTC4015_GpioConfig[] = {
|
||||
[0x04] = OCGPIO_CFG_INPUT,
|
||||
};
|
||||
|
||||
extern const OcGpio_FnTable GpioSX1509_fnTable;
|
||||
|
||||
OcGpio_Port gbc_io_1 = {
|
||||
.fn_table = &GpioSX1509_fnTable,
|
||||
.cfg =
|
||||
&(SX1509_Cfg){
|
||||
.i2c_dev = { OC_CONNECT1_I2C0, BIGBROTHER_IOEXP1_ADDRESS },
|
||||
.pin_irq = NULL,
|
||||
},
|
||||
.object_data = &(SX1509_Obj){},
|
||||
};
|
||||
|
||||
/* Invalid Device */
|
||||
LTC4015_Dev gbc_pwr_invalid_dev = {
|
||||
.cfg =
|
||||
{
|
||||
.i2c_dev =
|
||||
{
|
||||
.bus = 2,
|
||||
.slave_addr = 0x52,
|
||||
},
|
||||
.chem = 0,
|
||||
.r_snsb = 30,
|
||||
.r_snsi = 7,
|
||||
.cellcount = 3,
|
||||
.pin_lt4015_i2c_sel = { &gbc_io_1, 4, 32 },
|
||||
},
|
||||
};
|
||||
|
||||
/* Invalid Bus */
|
||||
LTC4015_Dev gbc_pwr_invalid_bus = {
|
||||
.cfg =
|
||||
{
|
||||
.i2c_dev =
|
||||
{
|
||||
.bus = 0xFF,
|
||||
.slave_addr = 0x52,
|
||||
},
|
||||
.chem = 0,
|
||||
.r_snsb = 30,
|
||||
.r_snsi = 7,
|
||||
.cellcount = 3,
|
||||
.pin_lt4015_i2c_sel = { &gbc_io_1, 4, 32 },
|
||||
},
|
||||
};
|
||||
/* Invalid Cfg for _choose_battery_charger*/
|
||||
LTC4015_Dev gbc_pwr_invalid_leadAcid_cfg = {
|
||||
.cfg =
|
||||
{
|
||||
.i2c_dev =
|
||||
{
|
||||
.bus = 2,
|
||||
.slave_addr = 0x52,
|
||||
},
|
||||
.chem = 0,
|
||||
.r_snsb = 30,
|
||||
.r_snsi = 7,
|
||||
.cellcount = 3,
|
||||
.pin_lt4015_i2c_sel = {},
|
||||
},
|
||||
};
|
||||
/* ======================== Constants & variables =========================== */
|
||||
uint16_t LTC4015_regs[] = {
|
||||
[LTC4015_REG_BATTERY_VOLTAGE_LOW_LIMIT] = 0x00,
|
||||
[LTC4015_REG_BATTERY_VOLTAGE_HIGH_LIMIT] = 0x00,
|
||||
[LTC4015_REG_INPUT_VOLTAGE_LOW_LIMIT] = 0x00,
|
||||
[LTC4015_REG_INPUT_VOLTAGE_HIGH_LIMIT] = 0x00,
|
||||
[LTC4015_REG_OUTPUT_VOLTAGE_LOW_LIMIT] = 0x00,
|
||||
[LTC4015_REG_OUTPUT_VOLTAGE_HIGH_LIMIT] = 0x00,
|
||||
[LTC4015_REG_INPUT_CURRENT_HIGH_LIMIT] = 0x00,
|
||||
[LTC4015_REG_CHARGE_CURRENT_LOW_LIMIT] = 0x00,
|
||||
[LTC4015_REG_DIE_TEMP_HIGH_LIMIT] = 0x00,
|
||||
[LTC4015_REG_BATTERY_SERIES_RESISTANCE_HIGH] = 0x00,
|
||||
[LTC4015_REG_THERMISTOR_RATIO_HIGH] = 0x00,
|
||||
[LTC4015_REG_THERMISTOR_RATIO_LOW] = 0x00,
|
||||
[LTC4015_REG_ENABLE_LIMIT_MONITIOR] = 0x00,
|
||||
[LTC4015_REG_ENABLE_CHARGER_STATE] = 0x00,
|
||||
[LTC4015_REG_ENABLE_CHARGER_STATUS] = 0x00,
|
||||
[LTC4015_REG_QCOUNT_LOW_LIMIT] = 0x00,
|
||||
[LTC4015_REG_QCOUNT_HIGH_LIMIT] = 0x00,
|
||||
[LTC4015_REG_PRESCALE_FACTOR] = 0x00,
|
||||
[LTC4015_REG_COLUMB_COUNTER_VALUE] = 0x00,
|
||||
[LTC4015_REG_CONFIGURATION_SETTING] = 0x00,
|
||||
[LTC4015_REG_INPUT_CURRENT_LIMIT_SETTING] = 0x00,
|
||||
[LTC4015_REG_UVCLFB_INPUT_BUFFER] = 0x00,
|
||||
[LTC4015_REG_RESERVE_1] = 0x00,
|
||||
[LTC4015_REG_RESERVE_2] = 0x00,
|
||||
[LTC4015_REG_ARM_SHIP_MODE] = 0x00,
|
||||
[LTC4015_REG_CHARGE_CURRENT_TARGET] = 0x00,
|
||||
[LTC4015_REG_VCHARGE_SETTING] = 0x00,
|
||||
[LTC4015_REG_LOW_BAT_THRESHOLD] = 0x00,
|
||||
[LTC4015_REG_CV_STATE_BATTER_CHARGER_TIME] = 0x00,
|
||||
[LTC4015_REG_MAX_CHARGE_TIME] = 0x00,
|
||||
[LTC4015_REG_JEITA_T1] = 0x00,
|
||||
[LTC4015_REG_JEITA_T2] = 0x00,
|
||||
[LTC4015_REG_JEITA_T3] = 0x00,
|
||||
[LTC4015_REG_JEITA_T4] = 0x00,
|
||||
[LTC4015_REG_JEITA_T5] = 0x00,
|
||||
[LTC4015_REG_JEITA_T6] = 0x00,
|
||||
[LTC4015_REG_VCHARGE_JEITA_6_5] = 0x00,
|
||||
[LTC4015_REG_VCHARGE_JEITA_4_3_2] = 0x00,
|
||||
[LTC4015_REG_ICHARGE_TARGET_JEITA_6_5] = 0x00,
|
||||
[LTC4015_REG_ICHARGE_TARGET_JEITA_4_3_2] = 0x00,
|
||||
[LTC4015_REG_BATTERY_CHARGER_CFGURATION] = 0x00,
|
||||
[LTC4015_REG_ABSORB_VOLTAGE] = 0x00,
|
||||
[LTC4015_REG_ABSORB_CHARGE_MAX_TIME] = 0x00,
|
||||
[LTC4015_REG_LEADACID_EQUALIZE_CHARGE_VOLTAGE] = 0x00,
|
||||
[LTC4015_REG_LEADACID_EQUALIZATION_TIME] = 0x00,
|
||||
[LTC4015_REG_P04_RECHARGE_THRESHOLD] = 0x00,
|
||||
[LTC4015_REG_RESERVE_3] = 0x00,
|
||||
[LTC4015_REG_LITHIUM_MAX_CHARGE_TIME] = 0x00,
|
||||
[LTC4015_REG_LITIUM_CONST_VOLTAGE_REGULATION] = 0x00,
|
||||
[LTC4015_REG_LEADACID_P04_ABSORB_TIME] = 0x00,
|
||||
[LTC4015_REG_LEADACID_EQUALIZE_TIME] = 0x00,
|
||||
[LTC4015_REG_BATTERY_CHARGE_STATE] = 0x00,
|
||||
[LTC4015_REG_CHARGE_STATUS_INDICATOR] = 0x00,
|
||||
[LTC4015_REG_LIMIT_ALERT_REGISTER] = 0x00,
|
||||
[LTC4015_REG_CHARGER_STATE_ALERT_REGISTER] = 0x00,
|
||||
[LTC4015_REG_CHARGE_STATUS_ALERT_INDICATOR] = 0x00,
|
||||
[LTC4015_REG_SYSTEM_STATUS_INDICATOR] = 0x00,
|
||||
[LTC4015_REG_VBAT_VALUE] = 0x00,
|
||||
[LTC4015_REG_VIN] = 0x00,
|
||||
[LTC4015_REG_VSYS] = 0x00,
|
||||
[LTC4015_REG_BATTEY_CURRENT] = 0x00,
|
||||
[LTC4015_REG_INPUT_CURRENT] = 0x00,
|
||||
[LTC4015_REG_DIE_TEMPERATURE] = 0x00,
|
||||
[LTC4015_REG_NTC_THERMISTOR_RATIO] = 0x00,
|
||||
[LTC4015_REG_BATTERY_SERIES_RESISTANCE] = 0x00,
|
||||
[LTC4015_REG_NTC_THERMISTOR_JITA_TEMP] = 0x00,
|
||||
[LTC4015_REG_CHEM_CELLS_PIN] = 0x00,
|
||||
[LTC4015_REG_CHARGE_CUEERNT_DAC_CONTROL] = 0x00,
|
||||
[LTC4015_REG_CHARGE_VOLTAGE_DAC_CONTROL] = 0x00,
|
||||
[LTC4015_REG_INPUT_CUEERNT_DAC_CONTROL] = 0x00,
|
||||
[LTC4015_REG_DIGITALLY_BATTERY_VOLTAGE] = 0x00,
|
||||
[LTC4015_REG_BSR_IBAT_VALUE] = 0x00,
|
||||
[LTC4015_REG_RESERVE_4] = 0x00,
|
||||
[LTC4015_REG_VAILD_BIT_MESURMENT] = 0x00,
|
||||
};
|
||||
177
firmware/ec/test/include/test_ltc4015.h
Normal file
177
firmware/ec/test/include/test_ltc4015.h
Normal file
@@ -0,0 +1,177 @@
|
||||
/**
|
||||
* Copyright (c) 2017-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
#ifndef _TEST_LTC4015_H
|
||||
#define _TEST_LTC4015_H
|
||||
|
||||
#include "common/inc/global/Framework.h"
|
||||
#include "common/inc/global/OC_CONNECT1.h"
|
||||
#include "common/inc/ocmp_wrappers/ocmp_ltc4015.h"
|
||||
#include "drivers/GpioSX1509.h"
|
||||
#include "drivers/OcGpio.h"
|
||||
#include "fake/fake_GPIO.h"
|
||||
#include "fake/fake_I2C.h"
|
||||
#include "fake/fake_ThreadedISR.h"
|
||||
#include "helpers/array.h"
|
||||
#include "helpers/attribute.h"
|
||||
#include "helpers/memory.h"
|
||||
#include "inc/devices/ltc4015.h"
|
||||
#include "include/test_sx1509.h"
|
||||
#include "src/helpers/math.h"
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "unity.h"
|
||||
|
||||
#define LTC4015_LION_INIT_BATTERY_VOLTAGE_LOW_LIMIT 16470
|
||||
#define LTC4015_LION_INIT_BATTERY_VOLTAGE_HIGH_LIMIT 21844
|
||||
#define LTC4015_LION_INIT_CHARGE_CURRENT_LOW_LIMIT 2047
|
||||
#define LTC4015_LION_INIT_INPUT_VOLTAGE_LOW_LIMIT 9830
|
||||
#define LTC4015_LION_INIT_INPUT_CURRENT_HIGH_LIMIT 23892
|
||||
#define LTC4015_LION_INIT_INPUT_CURRENT_LIMIT_SETTING 76
|
||||
#define LTC4015_LEAD_INIT_BATTERY_VOLTAGE_LOW_LIMIT 12352
|
||||
#define LTC4015_LEAD_INIT_BATTERY_VOLTAGE_HIGH_LIMIT 17944
|
||||
#define LTC4015_LEAD_INIT_CHARGE_CURRENT_LOW_LIMIT 204
|
||||
#define LTC4015_LEAD_INIT_INPUT_VOLTAGE_LOW_LIMIT 9830
|
||||
#define LTC4015_LEAD_INIT_INPUT_CURRENT_HIGH_LIMIT 23210
|
||||
#define LTC4015_LEAD_INIT_ICHARGE_TARGET 31
|
||||
#define LTC4015_LEAD_INIT_VCHARGE_SETTING 0
|
||||
#define POST_DATA_NULL 0x00
|
||||
#define POST_DEVID 0xFF
|
||||
#define POST_MANID 0xFF
|
||||
#define SX1509_REG_OPEN_DRAIN_A_ENABLE 0x10
|
||||
/* ======================== Constants & variables =========================== */
|
||||
|
||||
extern const OcGpio_FnTable GpioSX1509_fnTable;
|
||||
|
||||
/*Enumes are defined as per the LTC4015 datasheet*/
|
||||
typedef enum LTC4015Regs {
|
||||
LTC4015_REG_BATTERY_VOLTAGE_LOW_LIMIT = 0x01,
|
||||
LTC4015_REG_BATTERY_VOLTAGE_HIGH_LIMIT,
|
||||
LTC4015_REG_INPUT_VOLTAGE_LOW_LIMIT,
|
||||
LTC4015_REG_INPUT_VOLTAGE_HIGH_LIMIT,
|
||||
LTC4015_REG_OUTPUT_VOLTAGE_LOW_LIMIT,
|
||||
LTC4015_REG_OUTPUT_VOLTAGE_HIGH_LIMIT,
|
||||
LTC4015_REG_INPUT_CURRENT_HIGH_LIMIT,
|
||||
LTC4015_REG_CHARGE_CURRENT_LOW_LIMIT,
|
||||
LTC4015_REG_DIE_TEMP_HIGH_LIMIT,
|
||||
LTC4015_REG_BATTERY_SERIES_RESISTANCE_HIGH,
|
||||
LTC4015_REG_THERMISTOR_RATIO_HIGH,
|
||||
LTC4015_REG_THERMISTOR_RATIO_LOW,
|
||||
LTC4015_REG_ENABLE_LIMIT_MONITIOR,
|
||||
LTC4015_REG_ENABLE_CHARGER_STATE,
|
||||
LTC4015_REG_ENABLE_CHARGER_STATUS,
|
||||
LTC4015_REG_QCOUNT_LOW_LIMIT,
|
||||
LTC4015_REG_QCOUNT_HIGH_LIMIT,
|
||||
LTC4015_REG_PRESCALE_FACTOR,
|
||||
LTC4015_REG_COLUMB_COUNTER_VALUE,
|
||||
LTC4015_REG_CONFIGURATION_SETTING,
|
||||
LTC4015_REG_INPUT_CURRENT_LIMIT_SETTING,
|
||||
LTC4015_REG_UVCLFB_INPUT_BUFFER,
|
||||
LTC4015_REG_RESERVE_1,
|
||||
LTC4015_REG_RESERVE_2,
|
||||
LTC4015_REG_ARM_SHIP_MODE,
|
||||
LTC4015_REG_CHARGE_CURRENT_TARGET,
|
||||
LTC4015_REG_VCHARGE_SETTING,
|
||||
LTC4015_REG_LOW_BAT_THRESHOLD,
|
||||
LTC4015_REG_CV_STATE_BATTER_CHARGER_TIME,
|
||||
LTC4015_REG_MAX_CHARGE_TIME,
|
||||
LTC4015_REG_JEITA_T1,
|
||||
LTC4015_REG_JEITA_T2,
|
||||
LTC4015_REG_JEITA_T3,
|
||||
LTC4015_REG_JEITA_T4,
|
||||
LTC4015_REG_JEITA_T5,
|
||||
LTC4015_REG_JEITA_T6,
|
||||
LTC4015_REG_VCHARGE_JEITA_6_5,
|
||||
LTC4015_REG_VCHARGE_JEITA_4_3_2,
|
||||
LTC4015_REG_ICHARGE_TARGET_JEITA_6_5,
|
||||
LTC4015_REG_ICHARGE_TARGET_JEITA_4_3_2,
|
||||
LTC4015_REG_BATTERY_CHARGER_CFGURATION,
|
||||
LTC4015_REG_ABSORB_VOLTAGE,
|
||||
LTC4015_REG_ABSORB_CHARGE_MAX_TIME,
|
||||
LTC4015_REG_LEADACID_EQUALIZE_CHARGE_VOLTAGE,
|
||||
LTC4015_REG_LEADACID_EQUALIZATION_TIME,
|
||||
LTC4015_REG_P04_RECHARGE_THRESHOLD,
|
||||
LTC4015_REG_RESERVE_3,
|
||||
LTC4015_REG_LITHIUM_MAX_CHARGE_TIME,
|
||||
LTC4015_REG_LITIUM_CONST_VOLTAGE_REGULATION,
|
||||
LTC4015_REG_LEADACID_P04_ABSORB_TIME,
|
||||
LTC4015_REG_LEADACID_EQUALIZE_TIME,
|
||||
LTC4015_REG_BATTERY_CHARGE_STATE,
|
||||
LTC4015_REG_CHARGE_STATUS_INDICATOR,
|
||||
LTC4015_REG_LIMIT_ALERT_REGISTER,
|
||||
LTC4015_REG_CHARGER_STATE_ALERT_REGISTER,
|
||||
LTC4015_REG_CHARGE_STATUS_ALERT_INDICATOR,
|
||||
LTC4015_REG_SYSTEM_STATUS_INDICATOR,
|
||||
LTC4015_REG_VBAT_VALUE,
|
||||
LTC4015_REG_VIN,
|
||||
LTC4015_REG_VSYS,
|
||||
LTC4015_REG_BATTEY_CURRENT,
|
||||
LTC4015_REG_INPUT_CURRENT,
|
||||
LTC4015_REG_DIE_TEMPERATURE,
|
||||
LTC4015_REG_NTC_THERMISTOR_RATIO,
|
||||
LTC4015_REG_BATTERY_SERIES_RESISTANCE,
|
||||
LTC4015_REG_NTC_THERMISTOR_JITA_TEMP,
|
||||
LTC4015_REG_CHEM_CELLS_PIN,
|
||||
LTC4015_REG_CHARGE_CUEERNT_DAC_CONTROL,
|
||||
LTC4015_REG_CHARGE_VOLTAGE_DAC_CONTROL,
|
||||
LTC4015_REG_INPUT_CUEERNT_DAC_CONTROL,
|
||||
LTC4015_REG_DIGITALLY_BATTERY_VOLTAGE,
|
||||
LTC4015_REG_BSR_IBAT_VALUE,
|
||||
LTC4015_REG_RESERVE_4,
|
||||
LTC4015_REG_VAILD_BIT_MESURMENT,
|
||||
} LTC4015Regs;
|
||||
|
||||
int16_t ocmp_ltc4015_get_battery_current(LTC4015_Dev *dev, int16_t value);
|
||||
|
||||
int16_t ocmp_ltc4015_get_battery_voltage(LTC4015_Dev *dev, int16_t value);
|
||||
|
||||
int16_t ocmp_ltc4015_get_system_voltage(int16_t value);
|
||||
|
||||
int16_t ocmp_ltc4015_get_input_voltage(int16_t value);
|
||||
|
||||
int16_t ocmp_ltc4015_get_input_current(LTC4015_Dev *dev, int16_t value);
|
||||
|
||||
int16_t ocmp_ltc4015_get_dia_temperature(int16_t value);
|
||||
|
||||
int16_t ocmp_ltc4015_get_icharge_dac(LTC4015_Dev *dev, int16_t value);
|
||||
|
||||
int16_t ocmp_ltc4015_get_cfg_battery_current_low(LTC4015_Dev *dev,
|
||||
int16_t value);
|
||||
|
||||
int16_t ocmp_ltc4015_get_cfg_input_voltage_low(int16_t value);
|
||||
|
||||
int16_t ocmp_ltc4015_get_cfg_input_current_high(LTC4015_Dev *dev,
|
||||
int16_t value);
|
||||
|
||||
uint16_t ocmp_ltc4015_get_cfg_input_current_limit(LTC4015_Dev *dev,
|
||||
uint16_t value);
|
||||
|
||||
uint16_t ocmp_ltc4015_get_cfg_icharge(LTC4015_Dev *dev, uint16_t value);
|
||||
|
||||
uint16_t ocmp_ltc4015_get_cfg_vcharge(LTC4015_Dev *dev, uint16_t value);
|
||||
|
||||
int16_t ocmp_ltc4015_get_cfg_die_temperature_high(int16_t value);
|
||||
|
||||
uint16_t ocmp_ltc4015_set_cfg_battery_current_low(LTC4015_Dev *dev,
|
||||
int16_t value);
|
||||
|
||||
uint16_t ocmp_ltc4015_set_cfg_input_voltage_low(int16_t value);
|
||||
|
||||
uint16_t ocmp_ltc4015_set_cfg_input_current_high(LTC4015_Dev *dev,
|
||||
int16_t value);
|
||||
|
||||
uint16_t ocmp_ltc4015_set_cfg_input_current_limit(LTC4015_Dev *dev,
|
||||
int16_t value);
|
||||
int ocmp_ltc4015_set_cfg_icharge(LTC4015_Dev *dev, uint16_t value);
|
||||
|
||||
double ocmp_ltc4015_set_cfg_vcharge(LTC4015_Dev *dev, int16_t value);
|
||||
|
||||
uint16_t ocmp_ltc4015_set_cfg_die_temperature_high(int16_t value);
|
||||
|
||||
int16_t ocmp_ltc4015_set_cfg_battery_voltage(LTC4015_Dev *dev, int16_t value);
|
||||
#endif
|
||||
212
firmware/ec/test/stub/stub_ltc4015.c
Normal file
212
firmware/ec/test/stub/stub_ltc4015.c
Normal file
@@ -0,0 +1,212 @@
|
||||
/**
|
||||
* Copyright (c) 2017-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include "include/test_ltc4015.h"
|
||||
|
||||
int16_t ocmp_ltc4015_get_battery_voltage(LTC4015_Dev *dev, int16_t value)
|
||||
{
|
||||
switch (dev->cfg.chem) {
|
||||
case LTC4015_CHEM_LEAD_ACID:
|
||||
return ((int16_t)value / 1000.0) * (128.176 * dev->cfg.cellcount);
|
||||
case LTC4015_CHEM_LI_FE_PO4:
|
||||
case LTC4015_CHEM_LI_ION:
|
||||
return ((int16_t)value / 1000.0) * (192.264 * dev->cfg.cellcount);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int16_t ocmp_ltc4015_get_battery_current(LTC4015_Dev *dev, int16_t value)
|
||||
{
|
||||
int16_t expBatteryCurrent = 0;
|
||||
expBatteryCurrent = ((float)((int16_t)value * 1.46487)) / (dev->cfg.r_snsb);
|
||||
return expBatteryCurrent;
|
||||
}
|
||||
|
||||
int16_t ocmp_ltc4015_get_system_voltage(int16_t value)
|
||||
{
|
||||
int16_t expSystemVoltage = 0;
|
||||
expSystemVoltage = (int16_t)value * 1.648;
|
||||
return expSystemVoltage;
|
||||
}
|
||||
|
||||
int16_t ocmp_ltc4015_get_input_voltage(int16_t value)
|
||||
{
|
||||
int16_t expInputVoltage = 0;
|
||||
expInputVoltage = (int16_t)value * 1.648;
|
||||
return expInputVoltage;
|
||||
}
|
||||
|
||||
int16_t ocmp_ltc4015_get_input_current(LTC4015_Dev *dev, int16_t value)
|
||||
{
|
||||
int16_t expInputCurrent = 0;
|
||||
expInputCurrent = ((float)((int16_t)value * 1.46487)) / (dev->cfg.r_snsi);
|
||||
return expInputCurrent;
|
||||
}
|
||||
|
||||
int16_t ocmp_ltc4015_get_dia_temperature(int16_t value)
|
||||
{
|
||||
int16_t expDieTemperature = 0;
|
||||
expDieTemperature = (((int16_t)value - 12010) / 45.6);
|
||||
return expDieTemperature;
|
||||
}
|
||||
|
||||
int16_t ocmp_ltc4015_get_icharge_dac(LTC4015_Dev *dev, int16_t value)
|
||||
{
|
||||
int16_t expICharge = 0;
|
||||
expICharge = (int16_t)((value + 1) / dev->cfg.r_snsb);
|
||||
return expICharge;
|
||||
}
|
||||
|
||||
int16_t ocmp_ltc4015_get_cfg_battery_current_low(LTC4015_Dev *dev,
|
||||
int16_t value)
|
||||
{
|
||||
int16_t expBatteryCurrentLow = 0;
|
||||
expBatteryCurrentLow = ((int16_t)value * 1.46487) / dev->cfg.r_snsb;
|
||||
return expBatteryCurrentLow;
|
||||
}
|
||||
|
||||
int16_t ocmp_ltc4015_get_cfg_input_voltage_low(int16_t value)
|
||||
{
|
||||
int16_t expInputVoltageLow = 0;
|
||||
expInputVoltageLow = (int16_t)value * 1.648;
|
||||
return expInputVoltageLow;
|
||||
}
|
||||
|
||||
int16_t ocmp_ltc4015_get_cfg_input_current_high(LTC4015_Dev *dev, int16_t value)
|
||||
{
|
||||
int16_t expInputCurrentHigh = 0;
|
||||
expInputCurrentHigh = ((int16_t)value * 1.46487) / dev->cfg.r_snsi;
|
||||
return expInputCurrentHigh;
|
||||
}
|
||||
|
||||
uint16_t ocmp_ltc4015_get_cfg_input_current_limit(LTC4015_Dev *dev,
|
||||
uint16_t value)
|
||||
{
|
||||
uint16_t expInputCurrentLimit = 0;
|
||||
expInputCurrentLimit = ((value + 1) * 500.0) / dev->cfg.r_snsi;
|
||||
return expInputCurrentLimit;
|
||||
}
|
||||
|
||||
uint16_t ocmp_ltc4015_get_cfg_icharge(LTC4015_Dev *dev, uint16_t value)
|
||||
{
|
||||
uint16_t expIcharge = 0;
|
||||
expIcharge = (value + 1) * 1000 / dev->cfg.r_snsb;
|
||||
return expIcharge;
|
||||
}
|
||||
|
||||
uint16_t ocmp_ltc4015_get_cfg_vcharge(LTC4015_Dev *dev, uint16_t value)
|
||||
{
|
||||
uint16_t vcharge = 0;
|
||||
switch (dev->cfg.chem) {
|
||||
case LTC4015_CHEM_LEAD_ACID:
|
||||
vcharge =
|
||||
round(((value / 105.0) + 2.0) * dev->cfg.cellcount * 1000.0);
|
||||
break;
|
||||
case LTC4015_CHEM_LI_FE_PO4:
|
||||
vcharge =
|
||||
round(((value / 80.0) + 3.4125) * dev->cfg.cellcount * 1000.0);
|
||||
break;
|
||||
case LTC4015_CHEM_LI_ION:
|
||||
vcharge =
|
||||
round(((value / 80.0) + 3.8125) * dev->cfg.cellcount * 1000.0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return vcharge;
|
||||
}
|
||||
|
||||
int16_t ocmp_ltc4015_get_cfg_die_temperature_high(int16_t value)
|
||||
{
|
||||
int16_t expDieTempHigh = 0;
|
||||
expDieTempHigh = (((int16_t)value - 12010) / 45.6);
|
||||
return expDieTempHigh;
|
||||
}
|
||||
|
||||
int16_t ocmp_ltc4015_set_cfg_battery_voltage(LTC4015_Dev *dev, int16_t value)
|
||||
{
|
||||
switch (dev->cfg.chem) {
|
||||
case LTC4015_CHEM_LEAD_ACID:
|
||||
return (value / (dev->cfg.cellcount * 128.176)) * 1000.0;
|
||||
case LTC4015_CHEM_LI_FE_PO4:
|
||||
case LTC4015_CHEM_LI_ION:
|
||||
return (value / (dev->cfg.cellcount * 192.264)) * 1000.0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t ocmp_ltc4015_set_cfg_battery_current_low(LTC4015_Dev *dev,
|
||||
int16_t value)
|
||||
{
|
||||
uint16_t expBatteryCurrentLow = 0;
|
||||
expBatteryCurrentLow = (value * dev->cfg.r_snsb) / (1.46487);
|
||||
return expBatteryCurrentLow;
|
||||
}
|
||||
|
||||
uint16_t ocmp_ltc4015_set_cfg_input_voltage_low(int16_t value)
|
||||
{
|
||||
uint16_t expInputVoltageLow = 0;
|
||||
expInputVoltageLow = (value / (1.648));
|
||||
return expInputVoltageLow;
|
||||
}
|
||||
uint16_t ocmp_ltc4015_set_cfg_input_current_high(LTC4015_Dev *dev,
|
||||
int16_t value)
|
||||
{
|
||||
uint16_t expInputCurrentHigh = 0;
|
||||
expInputCurrentHigh = ((value * dev->cfg.r_snsi) / 1.46487);
|
||||
return expInputCurrentHigh;
|
||||
}
|
||||
|
||||
uint16_t ocmp_ltc4015_set_cfg_input_current_limit(LTC4015_Dev *dev,
|
||||
int16_t value)
|
||||
{
|
||||
uint16_t expInputCurrentLimit = 0;
|
||||
expInputCurrentLimit = ((value * dev->cfg.r_snsi) / 500) - 1;
|
||||
return expInputCurrentLimit;
|
||||
}
|
||||
|
||||
int ocmp_ltc4015_set_cfg_icharge(LTC4015_Dev *dev, uint16_t value)
|
||||
{
|
||||
int expIcharge = 0;
|
||||
expIcharge = round((value * dev->cfg.r_snsb) / 1000.0) - 1;
|
||||
expIcharge = MAX(0, expIcharge);
|
||||
return expIcharge;
|
||||
}
|
||||
|
||||
double ocmp_ltc4015_set_cfg_vcharge(LTC4015_Dev *dev, int16_t value)
|
||||
{
|
||||
double targetV = value / (1000.0 * dev->cfg.cellcount);
|
||||
double expVChargeSetting = 0;
|
||||
switch (dev->cfg.chem) {
|
||||
case LTC4015_CHEM_LEAD_ACID:
|
||||
expVChargeSetting = round((targetV - 2.0) * 105.0);
|
||||
break;
|
||||
case LTC4015_CHEM_LI_FE_PO4:
|
||||
expVChargeSetting = round((targetV - 3.4125) * 80.0);
|
||||
break;
|
||||
case LTC4015_CHEM_LI_ION:
|
||||
expVChargeSetting = round((targetV - 3.8125) * 80.0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
expVChargeSetting = MAX(0, expVChargeSetting);
|
||||
return expVChargeSetting;
|
||||
}
|
||||
|
||||
uint16_t ocmp_ltc4015_set_cfg_die_temperature_high(int16_t value)
|
||||
{
|
||||
uint16_t expdieTempAlertLimit = 0;
|
||||
expdieTempAlertLimit = (value * 45.6) + 12010;
|
||||
return expdieTempAlertLimit;
|
||||
}
|
||||
1379
firmware/ec/test/suites/Test_ocmp_ltc4015.c
Normal file
1379
firmware/ec/test/suites/Test_ocmp_ltc4015.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -15,8 +15,14 @@ default:
|
||||
@mkdir -p $(output_dir)
|
||||
make all
|
||||
|
||||
all: ocmw_uart ocmw_usb ocmw_eth occli ocmw_eth_stub ocware_stub
|
||||
|
||||
all: get_cfg ocmw_uart ocmw_usb ocmw_eth occli ocmw_eth_stub ocware_stub hash
|
||||
|
||||
get_cfg:
|
||||
cd ../utilities/build; ./envDetect.sh
|
||||
|
||||
hash:
|
||||
cd ../utilities/checksums; ./hashes.sh $(shell pwd)/$(output_dir) -host
|
||||
|
||||
.PHONY: occli
|
||||
|
||||
ocmw_uart: $(OBJECTS)
|
||||
@@ -41,4 +47,4 @@ occli: $(OBJECTS)
|
||||
|
||||
# --- remove binary and executable files
|
||||
clean:
|
||||
rm -fr $(output_dir)/ocmw_eth_stub $(output_dir)/ocmw_eth $(output_dir)/ocmw_usb $(output_dir)/ocmw_uart $(output_dir)/occli $(output_dir)/ocware_stub
|
||||
rm -fr $(output_dir)/*
|
||||
|
||||
@@ -49,11 +49,11 @@
|
||||
* @param ident an input value (by pointer)
|
||||
*
|
||||
*/
|
||||
void initlog(const char* ident);
|
||||
extern void initlog(const char* ident);
|
||||
/*
|
||||
* deinitialize the logging routine
|
||||
*
|
||||
*/
|
||||
void deinitlog(void);
|
||||
extern void deinitlog(void);
|
||||
|
||||
#endif /* __LOGGER_H__ */
|
||||
|
||||
@@ -31,7 +31,7 @@ typedef struct {
|
||||
char option;
|
||||
int sizeNum;
|
||||
int totalStr;
|
||||
}OCCLI_ARRAY_PARAM;
|
||||
} OCCLI_ARRAY_PARAM;
|
||||
|
||||
typedef struct {
|
||||
char subsystem[OCCLI_CHAR_ARRAY_SIZE];
|
||||
@@ -39,16 +39,16 @@ typedef struct {
|
||||
char subcomponent[OCCLI_CHAR_ARRAY_SIZE];
|
||||
char msgtype[OCCLI_CHAR_ARRAY_SIZE];
|
||||
char parameter[OCCLI_CHAR_ARRAY_SIZE];
|
||||
}strMsgFrame;
|
||||
} strMsgFrame;
|
||||
|
||||
typedef struct {
|
||||
int8_t subsystem;
|
||||
int8_t component;
|
||||
int8_t msgtype;
|
||||
int16_t parameter;
|
||||
}sMsgParam;
|
||||
} sMsgParam;
|
||||
|
||||
typedef struct{
|
||||
typedef struct {
|
||||
char *subsystem;
|
||||
char *component;
|
||||
char *msgtype;
|
||||
@@ -63,7 +63,7 @@ typedef struct {
|
||||
int32_t number;
|
||||
char name[OCCLI_CHAR_ARRAY_SIZE];
|
||||
} Info[OCCLI_CHAR_ARRAY_SIZE];
|
||||
}subSystemInfo;
|
||||
} subSystemInfo;
|
||||
|
||||
//Help Menu structure
|
||||
typedef struct {
|
||||
@@ -74,43 +74,43 @@ typedef struct {
|
||||
char actionType[OCMW_MAX_ACTION_SIZE];
|
||||
char arguments[OCMW_HELP_FRAME_SIZE];
|
||||
char parameter[OCMW_HELP_FRAME_SIZE];
|
||||
}helpMenu;
|
||||
} helpMenu;
|
||||
|
||||
typedef struct {
|
||||
char subsystem[OCCLI_CHAR_ARRAY_SIZE];
|
||||
char component[OCCLI_CHAR_ARRAY_SIZE];
|
||||
char subComponent[OCCLI_CHAR_ARRAY_SIZE];
|
||||
}commandFrame;
|
||||
/*
|
||||
} commandFrame;
|
||||
|
||||
/*
|
||||
* Initialize the ocmw communication
|
||||
*/
|
||||
int32_t occli_init_comm(void);
|
||||
extern int32_t occli_init_comm(void);
|
||||
/*
|
||||
* Deinitialize the ocmw communication
|
||||
*/
|
||||
int8_t occli_deinit_comm(void);
|
||||
extern int8_t occli_deinit_comm(void);
|
||||
/*
|
||||
* @param cmd an input string (by pointer)
|
||||
* @param cmdlen an input value (by value)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t occli_send_cmd_to_ocmw(const char *cmd, int32_t cmdlen);
|
||||
extern int32_t occli_send_cmd_to_ocmw(const char *cmd, int32_t cmdlen);
|
||||
/*
|
||||
* @param resp an output value (by pointer)
|
||||
* @param resplen an output value (by value)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t occli_recv_cmd_resp_from_ocmw(char *resp, int32_t resplen);
|
||||
extern int32_t occli_recv_cmd_resp_from_ocmw(char *resp, int32_t resplen);
|
||||
/*
|
||||
* @param resp an output value (by pointer)
|
||||
* @param resplen an output value (by value)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t occli_recv_alertmsg_from_ocmw(char *resp, int32_t resplen);
|
||||
extern int32_t occli_recv_alertmsg_from_ocmw(char *resp, int32_t resplen);
|
||||
/*
|
||||
* @param root an input value (by pointer)
|
||||
* @param msgFrame an input value (by pointer)
|
||||
@@ -119,8 +119,10 @@ int32_t occli_recv_alertmsg_from_ocmw(char *resp, int32_t resplen);
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_parse_msgframe(const Component *root, strMsgFrame *msgFrame,
|
||||
uint8_t actiontype,ocmwSchemaSendBuf *ecSendBuf);
|
||||
extern int32_t ocmw_parse_msgframe(const Component *root,
|
||||
strMsgFrame *msgFrame,
|
||||
uint8_t actiontype,
|
||||
ocmwSchemaSendBuf *ecSendBuf);
|
||||
/*
|
||||
* @param root an output value (by pointer)
|
||||
* @param dMsgFrameParam an output value (by pointer)
|
||||
@@ -128,9 +130,9 @@ int32_t ocmw_parse_msgframe(const Component *root, strMsgFrame *msgFrame,
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
void ocmw_deserialization_msgframe(const Component *root,
|
||||
sMsgParam *dMsgFrameParam,
|
||||
OCMPMessageFrame *ecReceivedMsg);
|
||||
extern void ocmw_deserialization_msgframe(const Component *root,
|
||||
sMsgParam *dMsgFrameParam,
|
||||
OCMPMessageFrame *ecReceivedMsg);
|
||||
/*
|
||||
* @param compBase an output value (by pointer)
|
||||
* @param msgFrame an output value (by pointer)
|
||||
@@ -139,9 +141,10 @@ void ocmw_deserialization_msgframe(const Component *root,
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_parse_command_msgframe(const Component *compBase,
|
||||
strMsgFrame *msgFrame, uint8_t actiontype,
|
||||
ocmwSchemaSendBuf *ecSendBuf);
|
||||
extern int32_t ocmw_parse_command_msgframe(const Component *compBase,
|
||||
strMsgFrame *msgFrame,
|
||||
uint8_t actiontype,
|
||||
ocmwSchemaSendBuf *ecSendBuf);
|
||||
/*
|
||||
* @param compBase an output value (by pointer)
|
||||
* @param msgFrame an output value (by pointer)
|
||||
@@ -150,17 +153,18 @@ int32_t ocmw_parse_command_msgframe(const Component *compBase,
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_parse_post_msgframe(const Component *compBase,
|
||||
strMsgFrame *msgFrame, uint8_t actiontype,
|
||||
ocmwSchemaSendBuf *ecSendBuf);
|
||||
extern int32_t ocmw_parse_post_msgframe(const Component *compBase,
|
||||
strMsgFrame *msgFrame,
|
||||
uint8_t actiontype,
|
||||
ocmwSchemaSendBuf *ecSendBuf);
|
||||
/*
|
||||
* @param root an output value (by pointer)
|
||||
* @param systemInfo an output value (by pointer)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_frame_subsystem_from_schema(const Component *root,
|
||||
subSystemInfo *systemInfo);
|
||||
extern int32_t ocmw_frame_subsystem_from_schema(const Component *root,
|
||||
subSystemInfo *systemInfo);
|
||||
|
||||
/*
|
||||
* @param root an output value (by pointer)
|
||||
@@ -168,23 +172,23 @@ int32_t ocmw_frame_subsystem_from_schema(const Component *root,
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_frame_postTable_from_schema(const Component *root);
|
||||
extern int32_t ocmw_frame_postTable_from_schema(const Component *root);
|
||||
|
||||
/*
|
||||
* @param pointer to global memory
|
||||
*
|
||||
* @return NONE
|
||||
*/
|
||||
extern inline void ocmw_free_global_pointer(void **ptr);
|
||||
extern void ocmw_free_global_pointer(void **ptr);
|
||||
/*
|
||||
* @param root an output value (by pointer)
|
||||
* @param systemInfo an output value (by pointer)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int8_t occli_printHelpMenu(const Component *root,char *cmd);
|
||||
extern int8_t occli_printHelpMenu(const Component *root,char *cmd);
|
||||
|
||||
/*Display CLI window*/
|
||||
void occli_print_opencelluar();
|
||||
extern void occli_print_opencelluar();
|
||||
|
||||
#endif /* _OCCLI_COMM_H_ */
|
||||
|
||||
@@ -22,7 +22,7 @@ sem_t semCommandPost;
|
||||
#define OCMW_TIMED_WAIT_INDEX 1
|
||||
#define PARAM_STR_MAX_BUFF_SIZE 100
|
||||
|
||||
int32_t ocmw_init();
|
||||
extern int32_t ocmw_init();
|
||||
/*
|
||||
* @param actionType an input enum value (by value)
|
||||
* @param msgType an input enum value (by value)
|
||||
@@ -32,37 +32,37 @@ int32_t ocmw_init();
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_msg_packetize_and_send(char * argv[], uint8_t actionType,
|
||||
extern int32_t ocmw_msg_packetize_and_send(char * argv[], uint8_t actionType,
|
||||
uint8_t msgType, const int8_t * paramStr, uint8_t interface,
|
||||
void* paramVal);
|
||||
/*
|
||||
* Message parser module
|
||||
*
|
||||
*/
|
||||
void ocmw_ec_msgparser(void);
|
||||
extern void ocmw_ec_msgparser(void);
|
||||
/*
|
||||
* Thread to parse the data coming from EC to AP through uart
|
||||
* @param pthreadData an input value (by pointer)
|
||||
*/
|
||||
void * ocmw_thread_uartmsgparser(void *pthreadData);
|
||||
extern void * ocmw_thread_uartmsgparser(void *pthreadData);
|
||||
|
||||
/*
|
||||
* Thread to parse the data coming from EC to AP through ethernet
|
||||
* @param pthreadData an input value (by pointer)
|
||||
*/
|
||||
void * ocmw_thread_ethmsgparser(void *pthreadData);
|
||||
extern void * ocmw_thread_ethmsgparser(void *pthreadData);
|
||||
/*
|
||||
* @param ecMsgFrame an input structure (by value)
|
||||
* @param interface an input enum value (by value)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_send_msg(OCMPMessageFrame ecMsgFrame, uint8_t interface);
|
||||
extern int32_t ocmw_send_msg(OCMPMessageFrame ecMsgFrame, uint8_t interface);
|
||||
/*
|
||||
* @param semId an input value (by pointer)
|
||||
* @param semWaitType an input value (by value)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_sem_wait(sem_t *semId, int32_t semWaitType);
|
||||
extern int32_t ocmw_sem_wait(sem_t *semId, int32_t semWaitType);
|
||||
#endif /* _OCMW_CORE_H_ */
|
||||
|
||||
@@ -30,26 +30,25 @@
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_init_eth_comm(int32_t sentDev);
|
||||
extern int32_t ocmw_init_eth_comm(int32_t sentDev);
|
||||
/*
|
||||
* Deinitialize the ocmw ethernet communication
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_deinit_eth_comm(int32_t sentDev);
|
||||
extern int32_t ocmw_deinit_eth_comm(int32_t sentDev);
|
||||
/*
|
||||
* @param cmd an input string (by pointer)
|
||||
* @param cmdlen an input value (by value)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_send_eth_msgto_ec(const int8_t *cmd, int32_t cmdlen,int32_t sentDev);
|
||||
extern int32_t ocmw_send_eth_msgto_ec(const int8_t *cmd, int32_t cmdlen,int32_t sentDev);
|
||||
/*
|
||||
* @param resp an input value (by pointer)
|
||||
* @param resplen an input value (by value)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_recv_eth_msgfrom_ec(int8_t *resp, int32_t resplen, int32_t sentDev);
|
||||
|
||||
extern int32_t ocmw_recv_eth_msgfrom_ec(int8_t *resp, int32_t resplen, int32_t sentDev);
|
||||
#endif /* _OCCLI_IPC_COMM_H_ */
|
||||
|
||||
@@ -104,7 +104,7 @@ typedef struct __attribute__((packed, aligned(1))){
|
||||
char subsysName[OCMW_MAX_SUBSYSTEM_SIZE]; /* Subsystem Name */
|
||||
char deviceName[OCMW_POST_DEVICE_SIZE]; /* Device Name */
|
||||
uint8_t status; /* device status */
|
||||
}ocwarePostResultData;
|
||||
} ocwarePostResultData;
|
||||
|
||||
typedef struct {
|
||||
unsigned int count; /* Device Status count */
|
||||
@@ -122,14 +122,14 @@ typedef struct {
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_sem_wait_nointr(sem_t *sem);
|
||||
extern int32_t ocmw_sem_wait_nointr(sem_t *sem);
|
||||
/*
|
||||
* @param sem an input value (by pointer)
|
||||
* @param timeout an input value (by pointer)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_sem_timedwait_nointr(sem_t *sem, const struct timespec *timeout);
|
||||
extern int32_t ocmw_sem_timedwait_nointr(sem_t *sem, const struct timespec *timeout);
|
||||
/*
|
||||
* @param paramindex an input value (by value)
|
||||
* @param paramSizebuf an input value (by pointer)
|
||||
@@ -137,47 +137,37 @@ int32_t ocmw_sem_timedwait_nointr(sem_t *sem, const struct timespec *timeout);
|
||||
* @param pos an output value (by pointer)
|
||||
*
|
||||
*/
|
||||
void ocmw_dataparsing_from_db(int32_t paramIndex, int32_t *paramSizebuf,
|
||||
extern void ocmw_dataparsing_from_db(int32_t paramIndex, int32_t *paramSizebuf,
|
||||
int32_t *dataSize, int32_t *pos);
|
||||
/*
|
||||
* @param input an input buffer (by pointer)
|
||||
* @param bufParamStruct an output buffer (by pointer)
|
||||
*
|
||||
*/
|
||||
void ocmw_dataparsing_from_ec(ocmwSendRecvBuf *input,
|
||||
extern void ocmw_dataparsing_from_ec(ocmwSendRecvBuf *input,
|
||||
bufParam * bufParamStruct);
|
||||
/*
|
||||
* @param uartInputBuf an input buffer (by pointer)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_fill_inputstruct(ocmwSendRecvBuf *uartInputBuf);
|
||||
extern int32_t ocmw_fill_inputstruct(ocmwSendRecvBuf *uartInputBuf);
|
||||
/*
|
||||
* @param ecInputData an input data (by value)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int8_t ocmw_parse_eepromdata_from_ec (ocmwSendRecvBuf ecInputData);
|
||||
extern int8_t ocmw_parse_eepromdata_from_ec (ocmwSendRecvBuf ecInputData);
|
||||
/*
|
||||
* @param ecInputData an input data (by value)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_parse_obc_from_ec(ocmwSendRecvBuf ecInputData);
|
||||
extern int32_t ocmw_parse_obc_from_ec(ocmwSendRecvBuf ecInputData);
|
||||
/*
|
||||
* @param ecInputData an input data (by value)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_parse_testingmodule_from_ec(ocmwSendRecvBuf ecInputData);
|
||||
/*
|
||||
* @param msgaction an input value (by value)
|
||||
* @param msgtype an input value (by value)
|
||||
* @param paramstr an input string (by pointer)
|
||||
* @param paramvalue an input value (by pointer)
|
||||
*
|
||||
*/
|
||||
//int ocmw_msgproc_send_msg(int8_t msgaction, int8_t msgtype,
|
||||
// const int8_t* paramstr, void* paramvalue);
|
||||
|
||||
extern int32_t ocmw_parse_testingmodule_from_ec(ocmwSendRecvBuf ecInputData);
|
||||
#endif /* _OCMW_HELPER_H_ */
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "ocmp_frame.h"
|
||||
|
||||
int ocmw_msgproc_send_msg(char * argv[], uint8_t action, int8_t msgtype,
|
||||
const int8_t* paramstr, void* paramvalue);
|
||||
extern int ocmw_msgproc_send_msg(char * argv[], uint8_t action, int8_t msgtype,
|
||||
const int8_t* paramstr, void* paramvalue);
|
||||
|
||||
#endif /* _OCMW_MSGPROC_H_ */
|
||||
|
||||
@@ -23,19 +23,19 @@
|
||||
typedef struct {
|
||||
int8_t pin;
|
||||
int8_t value;
|
||||
}debugGPIOData;
|
||||
} debugGPIOData;
|
||||
|
||||
typedef struct {
|
||||
uint16_t regAddress;
|
||||
uint16_t regValue;
|
||||
}debugMDIOData;
|
||||
} debugMDIOData;
|
||||
|
||||
typedef struct __attribute__((packed, aligned(1))){
|
||||
uint8_t slaveAddress;
|
||||
uint8_t numOfBytes;
|
||||
uint8_t regAddress;
|
||||
uint16_t regValue;
|
||||
}debugI2CData;
|
||||
} debugI2CData;
|
||||
|
||||
typedef enum {
|
||||
SET_STR,
|
||||
@@ -71,58 +71,58 @@ typedef enum {
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_init_occli_comm(void);
|
||||
extern int32_t ocmw_init_occli_comm(void);
|
||||
|
||||
/*
|
||||
* Deinitialize the ocmw cli communication
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_deinit_occli_comm(void);
|
||||
extern int32_t ocmw_deinit_occli_comm(void);
|
||||
/*
|
||||
* @param cmd an input string (by pointer)
|
||||
* @param cmdlen an input value (by value)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_recv_clicmd_from_occli(char* cmdstr, int32_t cmdlen);
|
||||
extern int32_t ocmw_recv_clicmd_from_occli(char* cmdstr, int32_t cmdlen);
|
||||
/*
|
||||
* @param resp an input value (by pointer)
|
||||
* @param resplen an input value (by value)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_send_clicmd_resp_to_occli(const char* resp, int32_t resplen);
|
||||
extern int32_t ocmw_send_clicmd_resp_to_occli(const char* resp, int32_t resplen);
|
||||
/*
|
||||
* @param cmdstr an input value (by pointer)
|
||||
* @param response an output value (by pointer)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int ocmw_clicmd_handler(const char *cmdstr, char *response);
|
||||
extern int ocmw_clicmd_handler(const char *cmdstr, char *response);
|
||||
/*
|
||||
* Initialize the ocmw alert communication
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t init_occli_alert_comm();
|
||||
extern int32_t init_occli_alert_comm();
|
||||
/*
|
||||
* Deinitialize the ocmw alert communication
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_deinit_occli_alert_comm(void);
|
||||
extern int32_t ocmw_deinit_occli_alert_comm(void);
|
||||
/*
|
||||
* @param buf an input value (by pointer)
|
||||
* @param buflen an input value (by value)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_send_alert_to_occli(const char* buf, int32_t buflen);
|
||||
extern int32_t ocmw_send_alert_to_occli(const char* buf, int32_t buflen);
|
||||
|
||||
char ocmw_retrieve_post_results_count(ocwarePostResults *psData);
|
||||
extern char ocmw_retrieve_post_results_count(ocwarePostResults *psData);
|
||||
|
||||
char ocmw_retrieve_post_results(ocwarePostResults *psData);
|
||||
extern char ocmw_retrieve_post_results(ocwarePostResults *psData);
|
||||
|
||||
char ocmw_retrieve_reply_code_desc(ocwarePostReplyCode *replyCode);
|
||||
extern char ocmw_retrieve_reply_code_desc(ocwarePostReplyCode *replyCode);
|
||||
#endif /* _OCMW_IPC_COMM_H_ */
|
||||
|
||||
@@ -40,13 +40,12 @@ typedef enum ErrorSource {
|
||||
ERR_RC_INTERNAL = 0,
|
||||
ERR_SRC_CMS = 1,
|
||||
ERR_SRC_CME = 2
|
||||
}Source;
|
||||
} Source;
|
||||
|
||||
typedef enum OperatorStat {
|
||||
TWOG_SIM_STAT_UNKNOWN = 0x00,
|
||||
TWOG_SIM_STAT_AVAILABLE = 0x01,
|
||||
TWOG_SIM_STAT_CURRENT = 0x02,
|
||||
TWOG_SIM_STAT_FORBIDDEN = 0x03,
|
||||
}eOperatorStat;
|
||||
} eOperatorStat;
|
||||
#endif /* _OCMW_SCHEMA_H_ */
|
||||
|
||||
|
||||
@@ -29,31 +29,31 @@ typedef void
|
||||
* @param msgsize an input value (by value)
|
||||
*
|
||||
*/
|
||||
void ocmw_ec_uart_msg_hndlr(const unsigned char* msgstr, int32_t msgsize);
|
||||
extern void ocmw_ec_uart_msg_hndlr(const unsigned char* msgstr, int32_t msgsize);
|
||||
/*
|
||||
* Initialize the ocmw ec communication
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_init_ec_comm(handle_msg_from_ec_t msghndlr);
|
||||
extern int32_t ocmw_init_ec_comm(handle_msg_from_ec_t msghndlr);
|
||||
/*
|
||||
* Deinitialize the ocmw ec communication
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_deinit_ec_comm(void);
|
||||
extern int32_t ocmw_deinit_ec_comm(void);
|
||||
/*
|
||||
* @param msgstr an input value (by pointer)
|
||||
* @param size an input value (by value)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_send_uart_msg_to_ec(const uint8_t* msgstr, int32_t size);
|
||||
extern int32_t ocmw_send_uart_msg_to_ec(const uint8_t* msgstr, int32_t size);
|
||||
/*
|
||||
* @param pathName an input value (by pointer)
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocmw_find_ttyacm_port(char *pathName);
|
||||
extern int32_t ocmw_find_ttyacm_port(char *pathName);
|
||||
|
||||
#endif /* _OCMW_UART_COMM_H_ */
|
||||
|
||||
@@ -71,13 +71,13 @@ typedef struct {
|
||||
uint8_t paramPos;
|
||||
uint8_t datatype;
|
||||
void *data;
|
||||
}OCWareStubDatabase;
|
||||
} OCWareStubDatabase;
|
||||
|
||||
typedef struct{
|
||||
uint8_t SubsystemId;
|
||||
uint8_t DeviceNumber;
|
||||
ePostCode Status;
|
||||
}OCWareStubPostData;
|
||||
} OCWareStubPostData;
|
||||
|
||||
typedef enum {
|
||||
OCSTUB_VALUE_ZERO,
|
||||
@@ -92,29 +92,29 @@ typedef enum {
|
||||
OCSTUB_VALUE_TYPE_I2C_DEBUG,
|
||||
OCSTUB_VALUE_TYPE_GPIO_DEBUG,
|
||||
OCSTUB_VALUE_TYPE_MDIO_DEBUG,
|
||||
}OCWareStubsizeflag;
|
||||
} OCWareStubsizeflag;
|
||||
|
||||
typedef struct {
|
||||
uint8_t slaveAddress;
|
||||
uint8_t numOfBytes;
|
||||
uint8_t regAddress;
|
||||
uint16_t regValue;
|
||||
}OCWareDebugI2Cinfo;
|
||||
} OCWareDebugI2Cinfo;
|
||||
|
||||
typedef struct {
|
||||
uint16_t regAddress;
|
||||
uint16_t regValue;
|
||||
}OCWareDebugMDIOinfo;
|
||||
} OCWareDebugMDIOinfo;
|
||||
|
||||
typedef struct {
|
||||
uint8_t pin_nbr;
|
||||
uint8_t value;
|
||||
}OCWareDebugGPIOinfo;
|
||||
} OCWareDebugGPIOinfo;
|
||||
|
||||
typedef enum ocware_ret{
|
||||
STUB_FAILED = -1,
|
||||
STUB_SUCCESS = 0
|
||||
}ocware_stub_ret;
|
||||
} ocware_stub_ret;
|
||||
|
||||
|
||||
extern int8_t debugGetCommand;
|
||||
@@ -131,7 +131,7 @@ extern int8_t PostEnable;
|
||||
* @return STUB_SUCCESS - for success
|
||||
* STUB_FAILED - for failure
|
||||
******************************************************************************/
|
||||
ocware_stub_ret ocware_stub_parse_post_get_message(char *buffer);
|
||||
extern ocware_stub_ret ocware_stub_parse_post_get_message(char *buffer);
|
||||
|
||||
/******************************************************************************
|
||||
* Function Name : ocware_stub_parse_command_message
|
||||
@@ -142,7 +142,7 @@ ocware_stub_ret ocware_stub_parse_post_get_message(char *buffer);
|
||||
* @return STUB_SUCCESS - for success
|
||||
* STUB_FAILED - for failure
|
||||
******************************************************************************/
|
||||
ocware_stub_ret ocware_stub_parse_command_message(char *buffer);
|
||||
extern ocware_stub_ret ocware_stub_parse_command_message(char *buffer);
|
||||
|
||||
/******************************************************************************
|
||||
* Function Name : ocware_stub_get_set_params
|
||||
@@ -154,7 +154,7 @@ ocware_stub_ret ocware_stub_parse_command_message(char *buffer);
|
||||
* @return STUB_SUCCESS - for success
|
||||
* STUB_FAILED - for failure
|
||||
******************************************************************************/
|
||||
ocware_stub_ret ocware_stub_get_set_params(OCMPMessage *msgFrameData);
|
||||
extern ocware_stub_ret ocware_stub_get_set_params(OCMPMessage *msgFrameData);
|
||||
/******************************************************************************
|
||||
* Function Name : ocware_stub_init_database
|
||||
* Description : Parse the schema and add entries in the DB
|
||||
@@ -162,7 +162,7 @@ ocware_stub_ret ocware_stub_get_set_params(OCMPMessage *msgFrameData);
|
||||
* @return STUB_SUCCESS - for success
|
||||
* STUB_FAILED - for failure
|
||||
******************************************************************************/
|
||||
ocware_stub_ret ocware_stub_init_database(void);
|
||||
extern ocware_stub_ret ocware_stub_init_database(void);
|
||||
/******************************************************************************
|
||||
* Function Name : ocware_stub_send_msgframe_middleware
|
||||
* Description : send message to the MW
|
||||
@@ -173,7 +173,7 @@ ocware_stub_ret ocware_stub_init_database(void);
|
||||
* @return STUB_SUCCESS - for success
|
||||
* STUB_FAILED - for failure
|
||||
******************************************************************************/
|
||||
ocware_stub_ret ocware_stub_send_msgframe_middleware(char **buffer, int32_t bufferlen);
|
||||
extern ocware_stub_ret ocware_stub_send_msgframe_middleware(char **buffer, int32_t bufferlen);
|
||||
/******************************************************************************
|
||||
* Function Name : ocware_stub_init_ethernet_comm
|
||||
* Description : initialise the socket IPC
|
||||
@@ -181,7 +181,7 @@ ocware_stub_ret ocware_stub_send_msgframe_middleware(char **buffer, int32_t buff
|
||||
* @return STUB_SUCCESS - for success
|
||||
* STUB_FAILED - for failure
|
||||
******************************************************************************/
|
||||
ocware_stub_ret ocware_stub_init_ethernet_comm(void);
|
||||
extern ocware_stub_ret ocware_stub_init_ethernet_comm(void);
|
||||
/******************************************************************************
|
||||
* Function Name : ocware_stub_deinit_ethernet_comm
|
||||
* Description : close the IPC socket
|
||||
@@ -189,7 +189,7 @@ ocware_stub_ret ocware_stub_init_ethernet_comm(void);
|
||||
* @return STUB_SUCCESS - for success
|
||||
* STUB_FAILED - for failure
|
||||
******************************************************************************/
|
||||
ocware_stub_ret ocware_stub_deinit_ethernet_comm();
|
||||
extern ocware_stub_ret ocware_stub_deinit_ethernet_comm();
|
||||
/******************************************************************************
|
||||
* Function Name : ocware_stub_recv_msgfrom_middleware
|
||||
* Description : Receive message from MW
|
||||
@@ -201,7 +201,7 @@ ocware_stub_ret ocware_stub_deinit_ethernet_comm();
|
||||
* @return STUB_SUCCESS - for success
|
||||
* STUB_FAILED - for failure
|
||||
******************************************************************************/
|
||||
ocware_stub_ret ocware_stub_recv_msgfrom_middleware(char **buffer, int32_t bufferlen);
|
||||
extern ocware_stub_ret ocware_stub_recv_msgfrom_middleware(char **buffer, int32_t bufferlen);
|
||||
/******************************************************************************
|
||||
* Function Name : ocware_stub_get_database
|
||||
* Description : Function to retrieve data from the DB
|
||||
@@ -212,7 +212,7 @@ ocware_stub_ret ocware_stub_recv_msgfrom_middleware(char **buffer, int32_t buffe
|
||||
* @return STUB_SUCCESS - for success
|
||||
* STUB_FAILED - for failure
|
||||
******************************************************************************/
|
||||
ocware_stub_ret ocware_stub_get_database(OCMPMessage *msgFrameData);
|
||||
extern ocware_stub_ret ocware_stub_get_database(OCMPMessage *msgFrameData);
|
||||
/******************************************************************************
|
||||
* Function Name : ocware_stub_set_database
|
||||
* Description : Function to modify data in the DB
|
||||
@@ -223,7 +223,7 @@ ocware_stub_ret ocware_stub_get_database(OCMPMessage *msgFrameData);
|
||||
* @return STUB_SUCCESS - for success
|
||||
* STUB_FAILED - for failure
|
||||
******************************************************************************/
|
||||
ocware_stub_ret ocware_stub_set_database(OCMPMessage *msgFrameData);
|
||||
extern ocware_stub_ret ocware_stub_set_database(OCMPMessage *msgFrameData);
|
||||
/******************************************************************************
|
||||
* Function Name : ocware_stub_get_post_result_paramvalue_from_table
|
||||
* Description : Fill payload with the post information
|
||||
@@ -234,7 +234,7 @@ ocware_stub_ret ocware_stub_set_database(OCMPMessage *msgFrameData);
|
||||
* @return STUB_SUCCESS - for success
|
||||
* STUB_FAILED - for failure
|
||||
******************************************************************************/
|
||||
ocware_stub_ret ocware_stub_get_post_result_paramvalue_from_table(
|
||||
extern ocware_stub_ret ocware_stub_get_post_result_paramvalue_from_table(
|
||||
OCMPMessage *msgFrameData,
|
||||
int8_t *payload);
|
||||
/******************************************************************************
|
||||
@@ -247,7 +247,7 @@ ocware_stub_ret ocware_stub_get_post_result_paramvalue_from_table(
|
||||
* @return STUB_SUCCESS - for success
|
||||
* STUB_FAILED - for failure
|
||||
******************************************************************************/
|
||||
ocware_stub_ret ocware_stub_parse_debug_actiontype(OCMPMessage *msgFrameData);
|
||||
extern ocware_stub_ret ocware_stub_parse_debug_actiontype(OCMPMessage *msgFrameData);
|
||||
/******************************************************************************
|
||||
* Function Name : ocware_stub_get_post_database
|
||||
* Description : extract device number and status from the post database
|
||||
@@ -260,7 +260,7 @@ ocware_stub_ret ocware_stub_parse_debug_actiontype(OCMPMessage *msgFrameData);
|
||||
* @return STUB_SUCCESS - for success
|
||||
* STUB_FAILED - for failure
|
||||
******************************************************************************/
|
||||
ocware_stub_ret ocware_stub_get_post_database(OCMPMessage *msgFrameData,
|
||||
char *payload);
|
||||
extern ocware_stub_ret ocware_stub_get_post_database(OCMPMessage *msgFrameData,
|
||||
char *payload);
|
||||
|
||||
#endif /* __OCMW_STUB_H__ */
|
||||
|
||||
@@ -20,11 +20,11 @@ sem_t semEcWdgMsg;
|
||||
*
|
||||
* @return true if function succeeds, false otherwise
|
||||
*/
|
||||
int32_t ocwdg_init(void);
|
||||
extern int32_t ocwdg_init(void);
|
||||
/*
|
||||
* @param pthreadData an input value (by pointer)
|
||||
*
|
||||
*/
|
||||
void * ocwdg_thread_comm_with_ec(void *pthreadData);
|
||||
extern void * ocwdg_thread_comm_with_ec(void *pthreadData);
|
||||
|
||||
#endif /* _OCWGD_DAEMON_H_ */
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
* @param buflen an input value (by value)
|
||||
*
|
||||
*/
|
||||
void hexdisp(const unsigned char* buf, int buflen);
|
||||
extern void hexdisp(const unsigned char* buf, int buflen);
|
||||
|
||||
#endif /* _UTIL_H_ */
|
||||
|
||||
@@ -297,7 +297,7 @@ void occli_printHelpMenu_on_console(helpMenu *helpMenuArray[],
|
||||
* Input(s) : helpMenuArray
|
||||
* Output(s) : helpMenuArray
|
||||
***************************************************************************/
|
||||
inline void occli_free_helpMenupointer(helpMenu *helpMenuArray[])
|
||||
static void occli_free_helpMenupointer(helpMenu *helpMenuArray[])
|
||||
{
|
||||
int32_t mallocIndex = 0;
|
||||
|
||||
|
||||
@@ -816,7 +816,7 @@ static int32_t ocmw_handle_post_command(char* strTokenArray[], char *response)
|
||||
* Input(s) : strTokenArray
|
||||
* Output(s) : strTokenArray
|
||||
***************************************************************************/
|
||||
inline void ocmw_free_pointer(char **strTokenArray) {
|
||||
static void ocmw_free_pointer(char **strTokenArray) {
|
||||
if (strTokenArray) {
|
||||
free(strTokenArray);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ ocwarePostReplyCode ocmwReplyCode[] = {
|
||||
* Input(s) : ptr
|
||||
* Output(s) :
|
||||
******************************************************************************/
|
||||
inline void ocmw_free_global_pointer(void **ptr)
|
||||
void ocmw_free_global_pointer(void **ptr)
|
||||
{
|
||||
if(*ptr != NULL) {
|
||||
free(*ptr);
|
||||
|
||||
53
firmware/utilities/build/envDetect.sh
Executable file
53
firmware/utilities/build/envDetect.sh
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh -e
|
||||
BUILDHOST=$(uname -a)
|
||||
GCCVER=$(gcc --version)
|
||||
GITHASH=$(git rev-parse HEAD)
|
||||
if [ $# = 2 ]; then
|
||||
BUILDTYPE="\tEC Build"
|
||||
BUILDFNAME="build_ec_cfg.txt"
|
||||
UNITYVER=""
|
||||
if [ -e "$1" ]; then
|
||||
ARMVER=$($1 --version)
|
||||
else
|
||||
ARMVER="arm-none-eabi-gcc: Not found"
|
||||
fi
|
||||
if [ -d "$2" ]; then
|
||||
TIRTOSVER="TI RTOS: $2"
|
||||
else
|
||||
TIRTOSVER="TI RTOS: Not found"
|
||||
fi
|
||||
elif [ $# = 1 ]; then
|
||||
BUILDTYPE="\tUnit Test Build"
|
||||
BUILDFNAME="build_ut_cfg.txt"
|
||||
ARMVER=""
|
||||
TIRTOSVER=""
|
||||
UNITYVER="Unity: $1"
|
||||
else
|
||||
BUILDTYPE="\tHost Build"
|
||||
BUILDFNAME="build_host_cfg.txt"
|
||||
ARMVER=""
|
||||
TIRTOSVER=""
|
||||
UNITYVER=""
|
||||
fi
|
||||
{
|
||||
echo "$BUILDTYPE"
|
||||
echo
|
||||
if [ ! "$UNITYVER" = "" ]; then
|
||||
echo "$UNITYVER"
|
||||
echo
|
||||
fi
|
||||
echo "Git Hash: $GITHASH"
|
||||
echo
|
||||
echo "Build Host: $BUILDHOST"
|
||||
echo
|
||||
if [ ! "$TIRTOSVER" = "" ]; then
|
||||
echo "$TIRTOSVER"
|
||||
echo
|
||||
fi
|
||||
echo "GCC: $GCCVER"
|
||||
echo
|
||||
if [ ! "$ARMVER" = "" ]; then
|
||||
echo "$ARMVER"
|
||||
echo
|
||||
fi
|
||||
} > $BUILDFNAME
|
||||
15
firmware/utilities/checksums/hashes.sh
Executable file
15
firmware/utilities/checksums/hashes.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh -e
|
||||
#
|
||||
# Description
|
||||
# This script records the md5 hashes of build objects
|
||||
#
|
||||
BIN_FILES=$(find $1 -executable -type f)
|
||||
if [ "$2" = "-host" ]; then
|
||||
MD5_FILE="hmd5sums.txt"
|
||||
fi
|
||||
|
||||
if [ "$2" = "-ec" ]; then
|
||||
MD5_FILE="ecmd5sums.txt"
|
||||
fi
|
||||
|
||||
md5sum $BIN_FILES > $MD5_FILE
|
||||
26
firmware/utilities/jenkins/clang_patch
Executable file
26
firmware/utilities/jenkins/clang_patch
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2018-present, Facebook, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the BSD-style license found in the
|
||||
# LICENSE file in the root directory of this source tree. An additional grant
|
||||
# of patent rights can be found in the PATENTS file in the same directory.
|
||||
|
||||
# Get all files that are different from master and only lint those.
|
||||
fileList=`git --no-pager diff --name-only HEAD origin/master ./firmware/ec | grep ".\.c$\|.\.h$"`
|
||||
for f in $fileList; do
|
||||
clang-format -style=file -i ${f}
|
||||
done
|
||||
echo "Linting the following files:"
|
||||
echo $fileList
|
||||
git diff > clang_format.patch
|
||||
|
||||
# Delete if 0 size and exit with 0
|
||||
if [ ! -s clang_format.patch ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# There were lint issues and should exit with error
|
||||
exit 1
|
||||
83
firmware/utilities/jenkins/coverage.py
Executable file
83
firmware/utilities/jenkins/coverage.py
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (c) 2018-present, Facebook, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the BSD-style license found in the
|
||||
# LICENSE file in the root directory of this source tree. An additional grant
|
||||
# of patent rights can be found in the PATENTS file in the same directory.
|
||||
|
||||
""""
|
||||
Script to convert lcov generated coverage data to Jenkins readable Cobertura
|
||||
XML coverage formatted data.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
from lcov_cobertura import LcovCobertura
|
||||
|
||||
|
||||
def main(args):
|
||||
# Auto set arguments if none were provided
|
||||
|
||||
# If no sourcefile was provided, find the test-coverage.info file.
|
||||
# This assumes that the first file found is the desired one, so if multiple
|
||||
# exist then the sourceFile must be specified on the command line.
|
||||
if not args.sourceFile:
|
||||
f = glob.glob('**/test-coverage.info', recursive=True)
|
||||
if f:
|
||||
sourceFile = f[0]
|
||||
else:
|
||||
sys.exit("No lcov output file found below current directory.")
|
||||
else:
|
||||
sourceFile = args.sourceFile
|
||||
|
||||
# If no output file was provided, then place it in the same directory as
|
||||
# the source file.
|
||||
if not args.outFile:
|
||||
outFile = os.path.dirname(sourceFile) + '/test-coverage.xml'
|
||||
else:
|
||||
outFile = args.outFile
|
||||
|
||||
# Read all the data from the lcov output file
|
||||
with open(sourceFile) as fr:
|
||||
data = fr.read()
|
||||
|
||||
# Create a converter and convert coverage data
|
||||
converter = LcovCobertura(data)
|
||||
res = converter.convert()
|
||||
|
||||
# Write all output data to the destination file.
|
||||
with open(outFile, 'w') as fw:
|
||||
fw.write(res)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
# lcov data source file
|
||||
parser.add_argument(
|
||||
'-i',
|
||||
dest='sourceFile',
|
||||
action='store',
|
||||
default='',
|
||||
type=str,
|
||||
help='lcov data file to extract coverage information from. If not \
|
||||
provided, will recursively search from cwd for test-coverage.info\
|
||||
to use. If it finds multiple, will use the first one found',
|
||||
)
|
||||
|
||||
# Output file name
|
||||
parser.add_argument(
|
||||
'-o',
|
||||
dest='outFile',
|
||||
action='store',
|
||||
default='',
|
||||
type=str,
|
||||
help='Name of file to write xml coverage data to. If not provided, will\
|
||||
default to test-coverage.xml in the same directory as sourceFile',
|
||||
)
|
||||
|
||||
main(parser.parse_args())
|
||||
Reference in New Issue
Block a user