issp_delays.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* //filename: ISSP_Delays.h
  2. */
  3. #include "issp_revision.h"
  4. #ifdef PROJECT_REV_304
  5. /*
  6. * Copyright 2006-2007, Cypress Semiconductor Corporation.
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  20. * MA 02110-1301, USA.
  21. */
  22. #ifndef INC_ISSP_DELAYS
  23. #define INC_ISSP_DELAYS
  24. /*
  25. The Delay() routine, in ISSP_Driver_Routines.c, has a delay of n+3 usec,
  26. where n is the value passed to the routine. This is true for the m8c micro-
  27. processor in the PSoC when it is running at a CPU clock of 24MHz.
  28. PROCESSOR_SPECIFIC
  29. If another processor is used, or if the m8c is running at a slower clock
  30. speed, then the delay parameters will be different. This file makes changing
  31. the delays simpiler when porting the program to other processors.
  32. */
  33. /* DELAY_M is the slope of the Delay = Mx + B equation
  34. */
  35. #define DELAY_M 1
  36. /* DELAY_B is the offset of the delay in Delay = Mx + B.
  37. */
  38. #define DELAY_B 3
  39. /*
  40. CAUTION:
  41. For the above parameters the minimum delay value is 3 (this would result in
  42. 0 being passed for a minimum delay. A value less than 3 would actually
  43. create a negative number, causing a very long delay
  44. TRANSITION_TIMEOUT is a loop counter for a 100msec timeout when waiting for
  45. a high-to-low transition. This is used in the polling loop of
  46. fDetectHiLoTransition(). Each pass through the loop takes approximately 15
  47. usec. 100 msec is about 6740 loops. 13480
  48. */
  49. #define TRANSITION_TIMEOUT (65535*10)
  50. /*
  51. XRES_DELAY is the time duration for which XRES is asserted. This defines
  52. a 63 usec delay.
  53. The minimum Xres time (from the device datasheet) is 10 usec.
  54. */
  55. #define XRES_CLK_DELAY ((63 - DELAY_B) / DELAY_M)
  56. /*
  57. POWER_CYCLE_DELAY is the time required when power is cycled to the target
  58. device to create a power reset after programming has been completed. The
  59. actual time of this delay will vary from system to system depending on the
  60. bypass capacitor size. A delay of 150 usec is used here.
  61. */
  62. #define POWER_CYCLE_DELAY ((150 - DELAY_B) / DELAY_M)
  63. /*
  64. DELAY_100us delays 100 usec. This is used in fXRESInitializeTargetForISSP to
  65. time the wait for Vdd to become stable after a power up. A loop runs 10 of
  66. these for a total delay of 1 msec.
  67. */
  68. #define DELAY100us ((100 - DELAY_B) / DELAY_M)
  69. #endif /* (INC_ISSP_DELAYS)
  70. */
  71. #endif /* (PROJECT_REV_)
  72. */
  73. /* end of file ISSP_Delays.h */