![]() |
|
|||
File indexing completed on 2025-05-11 08:23:00
0001 /* 0002 * Copyright (c) 2015, Freescale Semiconductor, Inc. 0003 * Copyright 2016-2022 NXP 0004 * All rights reserved. 0005 * 0006 * SPDX-License-Identifier: BSD-3-Clause 0007 */ 0008 #ifndef __FSL_LPI2C_FREERTOS_H__ 0009 #define __FSL_LPI2C_FREERTOS_H__ 0010 0011 #include "FreeRTOS.h" 0012 #include "portable.h" 0013 #include "semphr.h" 0014 0015 #include "fsl_lpi2c.h" 0016 0017 /*! 0018 * @addtogroup lpi2c_freertos_driver LPI2C FreeRTOS Driver 0019 * @{ 0020 */ 0021 0022 /******************************************************************************* 0023 * Definitions 0024 ******************************************************************************/ 0025 0026 /*! @name Driver version */ 0027 /*@{*/ 0028 /*! @brief LPI2C FreeRTOS driver version. */ 0029 #define FSL_LPI2C_FREERTOS_DRIVER_VERSION (MAKE_VERSION(2, 3, 2)) 0030 /*@}*/ 0031 0032 /*! 0033 * @cond RTOS_PRIVATE 0034 * @brief LPI2C FreeRTOS handle 0035 */ 0036 typedef struct _lpi2c_rtos_handle 0037 { 0038 LPI2C_Type *base; /*!< LPI2C base address */ 0039 lpi2c_master_handle_t drv_handle; /*!< Handle of the underlying driver, treated as opaque by the RTOS layer */ 0040 status_t async_status; 0041 SemaphoreHandle_t mutex; /*!< Mutex to lock the handle during a trasfer */ 0042 SemaphoreHandle_t semaphore; /*!< Semaphore to notify and unblock task when transfer ends */ 0043 } lpi2c_rtos_handle_t; 0044 /*! \endcond */ 0045 0046 /******************************************************************************* 0047 * API 0048 ******************************************************************************/ 0049 0050 #if defined(__cplusplus) 0051 extern "C" { 0052 #endif 0053 0054 /*! 0055 * @name LPI2C RTOS Operation 0056 * @{ 0057 */ 0058 0059 /*! 0060 * @brief Initializes LPI2C. 0061 * 0062 * This function initializes the LPI2C module and related RTOS context. 0063 * 0064 * @param handle The RTOS LPI2C handle, the pointer to an allocated space for RTOS context. 0065 * @param base The pointer base address of the LPI2C instance to initialize. 0066 * @param masterConfig Configuration structure to set-up LPI2C in master mode. 0067 * @param srcClock_Hz Frequency of input clock of the LPI2C module. 0068 * @return status of the operation. 0069 */ 0070 status_t LPI2C_RTOS_Init(lpi2c_rtos_handle_t *handle, 0071 LPI2C_Type *base, 0072 const lpi2c_master_config_t *masterConfig, 0073 uint32_t srcClock_Hz); 0074 0075 /*! 0076 * @brief Deinitializes the LPI2C. 0077 * 0078 * This function deinitializes the LPI2C module and related RTOS context. 0079 * 0080 * @param handle The RTOS LPI2C handle. 0081 */ 0082 status_t LPI2C_RTOS_Deinit(lpi2c_rtos_handle_t *handle); 0083 0084 /*! 0085 * @brief Performs I2C transfer. 0086 * 0087 * This function performs an I2C transfer using LPI2C module according to data given in the transfer structure. 0088 * 0089 * @param handle The RTOS LPI2C handle. 0090 * @param transfer Structure specifying the transfer parameters. 0091 * @return status of the operation. 0092 */ 0093 status_t LPI2C_RTOS_Transfer(lpi2c_rtos_handle_t *handle, lpi2c_master_transfer_t *transfer); 0094 0095 /*! 0096 * @} 0097 */ 0098 0099 #if defined(__cplusplus) 0100 } 0101 #endif 0102 0103 /*! 0104 * @} 0105 */ 0106 0107 #endif /* __FSL_LPI2C_FREERTOS_H__ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |