fusb_sinit.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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: fusb_sinit.c
  15. * Date: 2022-02-11 13:33:11
  16. * LastEditTime: 2022-02-18 09:21:45
  17. * Description:  This files is for static initialization of USB
  18. *
  19. * Modify History:
  20. * Ver   Who        Date         Changes
  21. * ----- ------     --------    --------------------------------------
  22. * 1.0 Zhugengyu 2022/2/8 init version
  23. */
  24. /***************************** Include Files *********************************/
  25. #include "fparameters.h"
  26. #include "fusb_private.h"
  27. /************************** Constant Definitions *****************************/
  28. /**************************** Type Definitions *******************************/
  29. /***************** Macros (Inline Functions) Definitions *********************/
  30. /************************** Variable Definitions *****************************/
  31. extern const FUsbConfig FUSBHC_CONFIG_TBL[FUSB3_NUM];
  32. /************************** Function Prototypes ******************************/
  33. /**
  34. * @name: FUsbLookupConfig
  35. * @msg: 获取USB的默认配置
  36. * @return {const FUsbConfig *} USB默认配置
  37. * @param {u32} instance_id USB实例号
  38. */
  39. const FUsbConfig *FUsbLookupConfig(u32 instance_id)
  40. {
  41. const FUsbConfig *ptr = NULL;
  42. u32 index;
  43. for (index = 0; index < (u32)FUSB3_NUM; index++)
  44. {
  45. if (FUSBHC_CONFIG_TBL[index].instance_id == instance_id)
  46. {
  47. ptr = &FUSBHC_CONFIG_TBL[index];
  48. break;
  49. }
  50. }
  51. return (const FUsbConfig *)ptr;
  52. }