2022-11-10 22:22:48 +08:00
|
|
|
|
/*
|
|
|
|
|
* Copyright : (C) 2022 Phytium Information Technology, Inc.
|
|
|
|
|
* All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* This program is OPEN SOURCE software: you can redistribute it and/or modify it
|
|
|
|
|
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
|
|
|
|
|
* either version 1.0 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
|
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
* See the Phytium Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* FilePath: fi2c_sinit.c
|
2023-05-11 10:25:21 +08:00
|
|
|
|
* Date: 2021-11-01 14:53:42
|
2022-11-10 22:22:48 +08:00
|
|
|
|
* LastEditTime: 2022-02-18 08:36:52
|
2023-05-11 10:25:21 +08:00
|
|
|
|
* Description: This file is for implementation of driver's static initialization functionality
|
2022-11-10 22:22:48 +08:00
|
|
|
|
*
|
|
|
|
|
* Modify History:
|
|
|
|
|
* Ver Who Date Changes
|
|
|
|
|
* ----- ------ -------- --------------------------------------
|
2023-05-11 10:25:21 +08:00
|
|
|
|
* 1.0 zhugengyu 2021/11/1 first commit
|
2022-11-10 22:22:48 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/***************************** Include Files *********************************/
|
|
|
|
|
|
|
|
|
|
#include "ftypes.h"
|
|
|
|
|
#include "fparameters.h"
|
|
|
|
|
#include "fi2c.h"
|
|
|
|
|
#include "sdkconfig.h"
|
|
|
|
|
/************************** Constant Definitions *****************************/
|
|
|
|
|
|
|
|
|
|
/**************************** Type Definitions *******************************/
|
|
|
|
|
|
|
|
|
|
/***************** Macros (Inline Functions) Definitions *********************/
|
|
|
|
|
|
|
|
|
|
/************************** Variable Definitions *****************************/
|
|
|
|
|
|
2023-05-11 10:25:21 +08:00
|
|
|
|
extern const FI2cConfig FI2C_CONFIG_TBL[FI2C_NUM];
|
2022-11-10 22:22:48 +08:00
|
|
|
|
/************************** Function Prototypes ******************************/
|
|
|
|
|
/**
|
|
|
|
|
* @name: FI2cLookupConfig
|
|
|
|
|
* @msg: 获取I2C驱动的默认配置参数
|
|
|
|
|
* @return {const FI2cConfig*} 驱动默认参数
|
|
|
|
|
* @param {u32} instance_id, 当前控制的I2C控制器实例号
|
|
|
|
|
*/
|
|
|
|
|
const FI2cConfig *FI2cLookupConfig(u32 instance_id)
|
|
|
|
|
{
|
|
|
|
|
const FI2cConfig *ptr = NULL;
|
|
|
|
|
u32 index;
|
|
|
|
|
|
2023-05-11 10:25:21 +08:00
|
|
|
|
for (index = 0; index < (u32)FI2C_NUM; index++)
|
2022-11-10 22:22:48 +08:00
|
|
|
|
{
|
|
|
|
|
if (FI2C_CONFIG_TBL[index].instance_id == instance_id)
|
|
|
|
|
{
|
|
|
|
|
ptr = &FI2C_CONFIG_TBL[index];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (const FI2cConfig *)ptr;
|
|
|
|
|
}
|