fddma_sinit.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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: fddma_sinit.c
  15. * Date: 2022-02-10 14:53:42
  16. * LastEditTime: 2022-02-18 08:24:47
  17. * Description:  This files is for static initialization
  18. *
  19. * Modify History:
  20. * Ver   Who        Date         Changes
  21. * ----- ------     --------    --------------------------------------
  22. * 1.0 Zhugengyu 2022/5/13 init commit
  23. */
  24. /***************************** Include Files *********************************/
  25. #include "fparameters.h"
  26. #include "fassert.h"
  27. #include "fddma_hw.h"
  28. #include "fddma.h"
  29. /************************** Constant Definitions *****************************/
  30. /**************************** Type Definitions *******************************/
  31. /************************** Variable Definitions *****************************/
  32. extern const FDdmaConfig fddma_cfg_tbl[FDDMA_INSTANCE_NUM];
  33. /***************** Macros (Inline Functions) Definitions *********************/
  34. /************************** Function Prototypes ******************************/
  35. /**
  36. * @name: FDdmaLookupConfig
  37. * @msg: 获取DDMA实例默认配置
  38. * @return {const FDdmaConfig *} DDMA控制器默认配置
  39. * @param {u32} instance_id, DDMA实例号
  40. */
  41. const FDdmaConfig *FDdmaLookupConfig(u32 instance_id)
  42. {
  43. const FDdmaConfig *ptr = NULL;
  44. u32 index;
  45. for (index = 0; index < (u32)FDDMA_INSTANCE_NUM; index++)
  46. {
  47. if (fddma_cfg_tbl[index].id == instance_id)
  48. {
  49. ptr = &fddma_cfg_tbl[index];
  50. break;
  51. }
  52. }
  53. return (const FDdmaConfig *)ptr;
  54. }