fpl011_sinit.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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: fpl011_sinit.c
  15. * Date: 2022-02-10 14:53:42
  16. * LastEditTime: 2022-02-18 09:07:00
  17. * Description:  This files is for uart static init
  18. *
  19. * Modify History:
  20. * Ver   Who        Date         Changes
  21. * ----- ------     --------    --------------------------------------
  22. */
  23. /***************************** Include Files *********************************/
  24. #include "fpl011.h"
  25. #include "fparameters.h"
  26. #include "sdkconfig.h"
  27. extern FPl011Config FPl011ConfigTable[FUART_NUM];
  28. /************************** Constant Definitions *****************************/
  29. /**************************** Type Definitions *******************************/
  30. /***************** Macros (Inline Functions) Definitions *********************/
  31. /************************** Function Prototypes ******************************/
  32. /*****************************************************************************/
  33. /**
  34. * @name: FPl011LookupConfig
  35. * @msg: Initializes a specific FPl011 instance such that it is ready to be used.
  36. * @param contains the ID of the device
  37. * @return {FPl011Config *} A pointer to the configuration structure or NULL if the
  38. * specified device is not in the system.
  39. */
  40. const FPl011Config *FPl011LookupConfig(u32 instance_id)
  41. {
  42. const FPl011Config *cfg_ptr = NULL;
  43. u32 index;
  44. for (index = 0; index < (u32)FUART_NUM; index++)
  45. {
  46. if (FPl011ConfigTable[index].instance_id == instance_id)
  47. {
  48. cfg_ptr = &FPl011ConfigTable[index];
  49. break;
  50. }
  51. }
  52. return (const FPl011Config *)cfg_ptr;
  53. }