cy2239x.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #ifndef _DEV_CY2239X_H_
  2. #define _DEV_CY2239X_H_
  3. /*
  4. * Copyright (C) 2005 by egnite Software GmbH. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. Neither the name of the copyright holders nor the names of
  16. * contributors may be used to endorse or promote products derived
  17. * from this software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
  20. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  22. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
  23. * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  25. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  26. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  27. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  29. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30. * SUCH DAMAGE.
  31. *
  32. * For additional information see http://www.ethernut.de/
  33. */
  34. /*
  35. * $Log: cy2239x.h,v $
  36. * Revision 1.2 2006/01/05 16:53:26 haraldkipp
  37. * Several new functions added to query and modify the clock settings.
  38. *
  39. * Revision 1.1 2005/10/24 11:41:39 haraldkipp
  40. * Initial check-in.
  41. *
  42. */
  43. /*!
  44. * \addtogroup xgCy2239x
  45. */
  46. /*@{*/
  47. #include <sys/types.h>
  48. /*! \brief Clock A output.
  49. *
  50. * On Ethernut 3 this is output drives the Ethernet Controller,
  51. * if R3 is mounted (default).
  52. */
  53. #define CY2239X_CLKA 0
  54. /*! \brief Clock B output.
  55. *
  56. * On Ethernut 3 this is output drives the GCK1 input of the CPLD,
  57. * if R6 is mounted (default).
  58. */
  59. #define CY2239X_CLKB 1
  60. /*! \brief Clock C output.
  61. *
  62. * On Ethernut 3 this is output drives the CPU, if R5 is mounted
  63. * (default).
  64. */
  65. #define CY2239X_CLKC 2
  66. /*! \brief Clock D output.
  67. *
  68. * On Ethernut 3 this is output drives the GCK3 input of the CPLD,
  69. * if R4 is mounted and R104 is not mounted (default).
  70. */
  71. #define CY2239X_CLKD 3
  72. /*! \brief Clock E output.
  73. *
  74. * On Ethernut 3 this is output drives the GCK3 input of the CPLD,
  75. * if R104 is mounted and R4 is not mounted. By default R104 is not
  76. * mounted, but R4 is.
  77. */
  78. #define CY2239X_CLKE 4
  79. /*! \brief Reference clock identifier. */
  80. #define CY2239X_REF 0
  81. /*! \brief PLL1 identifier.
  82. *
  83. * The output of PLL1 can be connected to any output divider.
  84. * Clock E output is fixed to PLL1.
  85. */
  86. #define CY2239X_PLL1 1
  87. /*! \brief PLL2 identifier.
  88. *
  89. * The output of PLL2 can be connected to the output divider
  90. * of clock A, B, C or D.
  91. */
  92. #define CY2239X_PLL2 2
  93. /*! \brief PLL3 identifier.
  94. *
  95. * The output of PLL3 can be connected to the output divider
  96. * of clock A, B, C or D.
  97. */
  98. #define CY2239X_PLL3 3
  99. /*@}*/
  100. __BEGIN_DECLS
  101. /* Prototypes */
  102. extern u_long Cy2239xGetFreq(int clk, int fctrl);
  103. extern int Cy2239xGetPll(int clk);
  104. extern int Cy2239xSetPll(int clk, int pll);
  105. extern int Cy2239xGetDivider(int clk, int fctrl);
  106. extern int Cy2239xSetDivider(int clk, int sel, int val);
  107. extern int Cy2239xPllEnable(int pll, int fctrl, int ena);
  108. extern u_long Cy2239xPllGetFreq(int pll, int fctrl);
  109. extern int Cy2239xPllSetFreq(int pll, int fctrl, u_int pval, u_int poff, u_int qval, u_int fval);
  110. __END_DECLS
  111. /* End of prototypes */
  112. #endif