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: fcan_sinit.c
|
|
|
|
|
* Date: 2022-02-10 14:53:42
|
|
|
|
|
* LastEditTime: 2022-02-18 08:29:15
|
2023-05-11 10:25:21 +08:00
|
|
|
|
* Description: This files is for getting default configuration of specific can instance_id
|
2022-11-10 22:22:48 +08:00
|
|
|
|
*
|
|
|
|
|
* Modify History:
|
|
|
|
|
* Ver Who Date Changes
|
|
|
|
|
* ----- ------ -------- --------------------------------------
|
2023-05-11 10:25:21 +08:00
|
|
|
|
* 1.0 wangxiaodong 2022/5/26 first releases
|
2022-11-10 22:22:48 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "fcan.h"
|
|
|
|
|
#include "fparameters.h"
|
|
|
|
|
#include "fassert.h"
|
|
|
|
|
|
2023-05-11 10:25:21 +08:00
|
|
|
|
extern const FCanConfig FCanConfigTbl[FCAN_NUM];
|
2022-11-10 22:22:48 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @name: FCanLookupConfig
|
|
|
|
|
* @msg: get default configuration of specific can instance_id.
|
2023-05-11 10:25:21 +08:00
|
|
|
|
* @param {u32} instance_id, instance id of Can controller
|
2022-11-10 22:22:48 +08:00
|
|
|
|
* @return {FCanConfig*} Default configuration parameters of Can
|
|
|
|
|
*/
|
2023-05-11 10:25:21 +08:00
|
|
|
|
const FCanConfig *FCanLookupConfig(u32 instance_id)
|
2022-11-10 22:22:48 +08:00
|
|
|
|
{
|
2023-05-11 10:25:21 +08:00
|
|
|
|
FASSERT(instance_id < FCAN_NUM);
|
2022-11-10 22:22:48 +08:00
|
|
|
|
const FCanConfig *pconfig = NULL;
|
|
|
|
|
u32 index;
|
|
|
|
|
|
2023-05-11 10:25:21 +08:00
|
|
|
|
for (index = 0; index < (u32)FCAN_NUM; index++)
|
2022-11-10 22:22:48 +08:00
|
|
|
|
{
|
|
|
|
|
if (FCanConfigTbl[index].instance_id == instance_id)
|
|
|
|
|
{
|
|
|
|
|
pconfig = &FCanConfigTbl[index];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-05-11 10:25:21 +08:00
|
|
|
|
return (const FCanConfig *)pconfig;
|
2022-11-10 22:22:48 +08:00
|
|
|
|
}
|