fgmac_sinit.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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: fgmac_sinit.c
  15. * Date: 2022-04-06 14:46:52
  16. * LastEditTime: 2022-04-06 14:46:58
  17. * Description:  This file is for
  18. *
  19. * Modify History:
  20. * Ver   Who        Date         Changes
  21. * ----- ------     --------    --------------------------------------
  22. */
  23. /* - This file contains the implementation of driver's static initialization functionality.
  24. - 驱动静态初始化 */
  25. /***************************** Include Files *********************************/
  26. #include "ftypes.h"
  27. #include "fparameters.h"
  28. #include "fgmac.h"
  29. /************************** Constant Definitions *****************************/
  30. /**************************** Type Definitions *******************************/
  31. /***************** Macros (Inline Functions) Definitions *********************/
  32. /************************** Variable Definitions *****************************/
  33. extern const FGmacConfig FGMAC_CONFIG_TBL[GMAC_INSTANCE_NUM];
  34. /************************** Function Prototypes ******************************/
  35. /**
  36. * @name: FGmacLookupConfig
  37. * @msg: 获取FGMAC驱动的默认配置参数
  38. * @return {const FGmacConfig *}, 驱动默认配置
  39. * @param {u32} instance_id, 驱动控制器号
  40. * @note 返回FGMAC的默认配置,复制后修改配置
  41. * 需要确认当前平台支持输入的instance_id
  42. */
  43. const FGmacConfig *FGmacLookupConfig(u32 instance_id)
  44. {
  45. const FGmacConfig *ptr = NULL;
  46. u32 index;
  47. for (index = 0; index < (u32)GMAC_INSTANCE_NUM; index++)
  48. {
  49. if (FGMAC_CONFIG_TBL[index].instance_id == instance_id)
  50. {
  51. ptr = &FGMAC_CONFIG_TBL[index];
  52. break;
  53. }
  54. }
  55. return (const FGmacConfig *)ptr;
  56. }