fcan_sinit.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright : (C) 2022 Phytium Information Technology, Inc.
  3. * All Rights Reserved.
  4. *
  5. * This program is OPEN SOURCE software: you can redistribute it and/or modify it
  6. * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
  7. * either version 1.0 of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
  10. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. * See the Phytium Public License for more details.
  12. *
  13. *
  14. * FilePath: fcan_sinit.c
  15. * Date: 2022-02-10 14:53:42
  16. * LastEditTime: 2022-02-18 08:29:15
  17. * Description:  This files is for
  18. *
  19. * Modify History:
  20. * Ver   Who        Date         Changes
  21. * ----- ------     --------    --------------------------------------
  22. */
  23. #include "fcan.h"
  24. #include "fparameters.h"
  25. #include "fassert.h"
  26. extern const FCanConfig FCanConfigTbl[FCAN_INSTANCE_NUM];
  27. /**
  28. * @name: FCanLookupConfig
  29. * @msg: get default configuration of specific can instance_id.
  30. * @param {FCanInstance} instance_id, instance id of Can controller
  31. * @return {FCanConfig*} Default configuration parameters of Can
  32. */
  33. const FCanConfig *FCanLookupConfig(FCanInstance instance_id)
  34. {
  35. FASSERT(instance_id < FCAN_INSTANCE_NUM);
  36. const FCanConfig *pconfig = NULL;
  37. u32 index;
  38. for (index = 0; index < (u32)FCAN_INSTANCE_NUM; index++)
  39. {
  40. if (FCanConfigTbl[index].instance_id == instance_id)
  41. {
  42. pconfig = &FCanConfigTbl[index];
  43. break;
  44. }
  45. }
  46. return (FCanConfig *)pconfig;
  47. }