Buster I2C updates.

The i2c headers and libraries have been split in buster.
This change configures the code for building and linking under buster.
This commit is contained in:
Jeffrey Townsend
2019-07-30 19:27:26 +00:00
parent 0084c3eca5
commit 38de7819de
6 changed files with 38 additions and 12 deletions

View File

@@ -59,6 +59,10 @@ cdefs: &cdefs
doc: "Include the custom i2c header (include/linux/i2c-devices.h) to avoid conflicts with the kernel and i2c-dev packages."
default: 1
- ONLPLIB_CONFIG_I2C_INCLUDE_SMBUS:
doc: "Include <i2c/smbus.h>"
default: 0
definitions:
cdefs:
ONLPLIB_CONFIG_HEADER:

View File

@@ -29,6 +29,7 @@
#if ONLPLIB_CONFIG_INCLUDE_I2C == 1
/**
* Use TENBIT mode. Default is to disable TENBIT mode.
*/
@@ -350,7 +351,15 @@ extern onlp_i2c_mux_driver_t onlp_i2c_mux_driver_pca9548;
#if ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER == 1
#include <linux/i2c-devices.h>
#else
#include <linux/i2c-dev.h>
#endif
#if ONLPLIB_CONFIG_I2C_INCLUDE_SMBUS == 1
#include <i2c/smbus.h>
#endif
#endif /* ONLPLIB_CONFIG_INCLUDE_I2C */

View File

@@ -155,6 +155,16 @@
#define ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER 1
#endif
/**
* ONLPLIB_CONFIG_INCLUDE_I2C_SMBUS
*
* Include <i2c/smbus.h> */
#ifndef ONLPLIB_CONFIG_INCLUDE_I2C_SMBUS
#define ONLPLIB_CONFIG_INCLUDE_I2C_SMBUS 0
#endif
/**

View File

@@ -1,21 +1,21 @@
############################################################
# <bsn.cl fy=2014 v=onl>
#
# Copyright 2014, 2015 Big Switch Networks, Inc.
#
#
# Copyright 2014, 2015 Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#
# http://www.eclipse.org/legal/epl-v10.html
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
#
# </bsn.cl>
############################################################
#
@@ -28,3 +28,7 @@ onlplib_INCLUDES := -I $(THIS_DIR)inc
onlplib_INTERNAL_INCLUDES := -I $(THIS_DIR)src
onlplib_DEPENDMODULE_ENTRIES := init:onlplib
ifeq ($(ONL_DEBIAN_SUITE),buster)
GLOBAL_CFLAGS += -DONLPLIB_CONFIG_I2C_INCLUDE_SMBUS=1
GLOBAL_LINK_LIBS += -li2c
endif

View File

@@ -30,12 +30,6 @@
#include <fcntl.h>
#include <unistd.h>
#if ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER == 1
#include <linux/i2c-devices.h>
#else
#include <linux/i2c-dev.h>
#endif
#include <sys/types.h>
#include <sys/ioctl.h>
#include <errno.h>

View File

@@ -84,6 +84,11 @@ onlplib_config_settings_t onlplib_config_settings[] =
{ __onlplib_config_STRINGIFY_NAME(ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER), __onlplib_config_STRINGIFY_VALUE(ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER) },
#else
{ ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER(__onlplib_config_STRINGIFY_NAME), "__undefined__" },
#endif
#ifdef ONLPLIB_CONFIG_INCLUDE_I2C_SMBUS
{ __onlplib_config_STRINGIFY_NAME(ONLPLIB_CONFIG_INCLUDE_I2C_SMBUS), __onlplib_config_STRINGIFY_VALUE(ONLPLIB_CONFIG_INCLUDE_I2C_SMBUS) },
#else
{ ONLPLIB_CONFIG_INCLUDE_I2C_SMBUS(__onlplib_config_STRINGIFY_NAME), "__undefined__" },
#endif
{ NULL, NULL }
};