From 007d4e12977ca76d981368bd5e0303115f657946 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 25 Feb 2019 07:07:19 +0100 Subject: bsp/lpc24xx: Convert I2C driver to Linux API Change license to BSD-2-Clause. Close #3725. --- bsps/arm/lpc24xx/include/bsp/i2c.h | 66 ++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 35 deletions(-) (limited to 'bsps/arm/lpc24xx/include/bsp/i2c.h') diff --git a/bsps/arm/lpc24xx/include/bsp/i2c.h b/bsps/arm/lpc24xx/include/bsp/i2c.h index 3c29468c4e..9c3566cd86 100644 --- a/bsps/arm/lpc24xx/include/bsp/i2c.h +++ b/bsps/arm/lpc24xx/include/bsp/i2c.h @@ -1,66 +1,62 @@ /** * @file * - * @ingroup RTEMSBSPsARMLPC24XX_libi2c - * - * @brief LibI2C bus driver for the I2C modules. + * @ingroup RTEMSBSPsARMLPC24XXI2C */ /* - * Copyright (c) 2009-2011 embedded brains GmbH. All rights reserved. + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (C) 2009, 2019 embedded brains GmbH * - * embedded brains GmbH - * Obere Lagerstr. 30 - * 82178 Puchheim - * Germany - * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifndef LIBBSP_ARM_LPC24XX_I2C_H #define LIBBSP_ARM_LPC24XX_I2C_H -#include -#include - -#include -#include - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** - * @defgroup lpc24xx_libi2c LPC24XX Bus Drivers + * @defgroup RTEMSBSPsARMLPC24XXI2C I2C Driver * * @ingroup RTEMSBSPsARMLPC24XX * - * @brief LibI2C bus drivers for LPC24XX. - * * @{ */ -typedef struct { - rtems_libi2c_bus_t bus; - volatile lpc24xx_i2c *regs; - size_t index; - const lpc24xx_pin_range *pins; - rtems_vector_number vector; - rtems_id state_update; - uint8_t *volatile data; - uint8_t *volatile end; -} lpc24xx_i2c_bus_entry; +#define LPC24XX_I2C_0_BUS_PATH "/dev/i2c-0" + +#define LPC24XX_I2C_1_BUS_PATH "/dev/i2c-1" -extern const rtems_libi2c_bus_ops_t lpc24xx_i2c_ops; +#define LPC24XX_I2C_2_BUS_PATH "/dev/i2c-2" -extern rtems_libi2c_bus_t *const lpc24xx_i2c_0; +int lpc24xx_register_i2c_0(void); -extern rtems_libi2c_bus_t *const lpc24xx_i2c_1; +int lpc24xx_register_i2c_1(void); -extern rtems_libi2c_bus_t *const lpc24xx_i2c_2; +int lpc24xx_register_i2c_2(void); /** @} */ -- cgit v1.2.3