issp_delays.h 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // filename: ISSP_Delays.h
  2. #include "issp_revision.h"
  3. #ifdef PROJECT_REV_304
  4. /* Copyright 2006-2007, Cypress Semiconductor Corporation.
  5. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
  6. CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  7. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  8. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  9. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
  10. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  11. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
  12. OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  13. BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  14. LIABILITY, WHETHER IN CONRTACT, STRICT LIABILITY, OR TORT (INCLUDING
  15. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  16. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  17. Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND,EXPRESS OR IMPLIED,
  18. WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  20. Cypress reserves the right to make changes without further notice to the
  21. materials described herein. Cypress does not assume any liability arising
  22. out of the application or use of any product or circuit described herein.
  23. Cypress does not authorize its products for use as critical components in
  24. life-support systems where a malfunction or failure may reasonably be
  25. expected to result in significant injury to the user. The inclusion of
  26. Cypress� product in a life-support systems application implies that the
  27. manufacturer assumes all risk of such use and in doing so indemnifies
  28. Cypress against all charges.
  29. Use may be limited by and subject to the applicable Cypress software
  30. license agreement.
  31. -----------------------------------------------------------------------------*/
  32. #ifndef INC_ISSP_DELAYS
  33. #define INC_ISSP_DELAYS
  34. // The Delay() routine, in ISSP_Driver_Routines.c, has a delay of n+3 usec,
  35. // where n is the value passed to the routine. This is true for the m8c micro-
  36. // processor in the PSoC when it is running at a CPU clock of 24MHz.
  37. //
  38. // PROCESSOR_SPECIFIC
  39. // If another processor is used, or if the m8c is running at a slower clock
  40. // speed, then the delay parameters will be different. This file makes changing
  41. // the delays simpiler when porting the program to other processors.
  42. // DELAY_M is the slope of the Delay = Mx + B equation
  43. #define DELAY_M 1
  44. // DELAY_B is the offset of the delay in Delay = Mx + B.
  45. #define DELAY_B 3
  46. ///////////////////////////////////////////////////////////////////////////////
  47. // CAUTION:
  48. // For the above parameters the minimum delay value is 3 (this would result in
  49. // 0 being passed for a minimum delay. A value less than 3 would actually
  50. // create a negative number, causing a very long delay
  51. ///////////////////////////////////////////////////////////////////////////////
  52. // TRANSITION_TIMEOUT is a loop counter for a 100msec timeout when waiting for
  53. // a high-to-low transition. This is used in the polling loop of
  54. // fDetectHiLoTransition(). Each pass through the loop takes approximately 15
  55. // usec. 100 msec is about 6740 loops. 13480
  56. #define TRANSITION_TIMEOUT 0x100000 //6740
  57. // XRES_DELAY is the time duration for which XRES is asserted. This defines
  58. // a 63 usec delay.
  59. // The minimum Xres time (from the device datasheet) is 10 usec.
  60. //mhsong #define XRES_CLK_DELAY ((63 - DELAY_B) / DELAY_M)
  61. #define XRES_CLK_DELAY 63
  62. // POWER_CYCLE_DELAY is the time required when power is cycled to the target
  63. // device to create a power reset after programming has been completed. The
  64. // actual time of this delay will vary from system to system depending on the
  65. // bypass capacitor size. A delay of 150 usec is used here.
  66. //mhsong #define POWER_CYCLE_DELAY ((150 - DELAY_B) / DELAY_M)
  67. #define POWER_CYCLE_DELAY 150
  68. // DELAY_100us delays 100 usec. This is used in fXRESInitializeTargetForISSP to
  69. // time the wait for Vdd to become stable after a power up. A loop runs 10 of
  70. // these for a total delay of 1 msec.
  71. //mhsong #define DELAY100us ((100 - DELAY_B) / DELAY_M)
  72. #define DELAY100us 100
  73. #endif //(INC_ISSP_DELAYS)
  74. #endif //(PROJECT_REV_)
  75. //end of file ISSP_Delays.h