issp_directives.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. // filename: ISSP_Directives.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. // --------------------- Compiler Directives ----------------------------------
  33. #ifndef INC_ISSP_DIRECTIVES
  34. #define INC_ISSP_DIRECTIVES
  35. // This directive will enable a Genral Purpose test-point on P1.7
  36. // It can be toggled as needed to measure timing, execution, etc...
  37. // A "Test Point" sets a GPIO pin of the host processor high or low. This GPIO
  38. // pin can be observed with an oscilloscope to verify the timing of key
  39. // programming steps. TPs have been added in main() that set Port 0, pin 1
  40. // high during bulk erase, during each block write and during security write.
  41. // The timing of these programming steps should be verified as correct as part
  42. // of the validation process of the final program.
  43. //JBA
  44. //#define USE_TP
  45. // ****************************************************************************
  46. // ************* USER ATTENTION REQUIRED: TARGET SUPPLY VOLTAGE ***************
  47. // ****************************************************************************
  48. // This directive causes the proper Initialization vector #3 to be sent
  49. // to the Target, based on what the Target Vdd programming voltage will
  50. // be. Either 5V (if #define enabled) or 3.3V (if #define disabled).
  51. //JBA
  52. //#define TARGET_VOLTAGE_IS_5V
  53. // ****************************************************************************
  54. // **************** USER ATTENTION REQUIRED: PROGRAMMING MODE *****************
  55. // ****************************************************************************
  56. // This directive selects whether code that uses reset programming mode or code
  57. // that uses power cycle programming is use. Reset programming mode uses the
  58. // external reset pin (XRES) to enter programming mode. Power cycle programming
  59. // mode uses the power-on reset to enter programming mode.
  60. // Applying signals to various pins on the target device must be done in a
  61. // deliberate order when using power cycle mode. Otherwise, high signals to GPIO
  62. // pins on the target will power the PSoC through the protection diodes.
  63. //JBA
  64. // choose the RESET MODE or POWER MODE
  65. //#define RESET_MODE
  66. // ****************************************************************************
  67. // ****************** USER ATTENTION REQUIRED: TARGET PSOC ********************
  68. // ****************************************************************************
  69. // The directives below enable support for various PSoC devices. The root part
  70. // number to be programmed should be un-commented so that its value becomes
  71. // defined. All other devices should be commented out.
  72. // Select one device to be supported below:
  73. /*************** CY8CTMA30x, CY8CTMG30x, CY8CTST30x series by KIMC, 2009.08.11 ***********************************/
  74. //#define CY8CTST300_36 // CY8CTST300_36LQXI // 2009.08.11, not tested.
  75. //#define CY8CTST300_48 // CY8CTST300_48LTXI // 2009.08.11, not tested.
  76. //#define CY8CTST300_49 // CY8CTST300_49FNXI // 2009.08.11, not tested.
  77. //#define CY8CTMA300_36 // CY8CTMA300_36LQXI // 2009.08.11, Test OK.
  78. //#define CY8CTMA300_48 // CY8CTMA300_48LTXI // 2009.08.11, not tested.
  79. //#define CY8CTMA300_49 // CY8CTMA300_49FNXI // 2009.08.11, not tested.
  80. //#define CY8CTMG300_36 // CY8CTMG300_36LQXI // 2009.08.11, not tested.
  81. //#define CY8CTMG300_48 // CY8CTMG300_48LTXI // 2009.08.11, not tested.
  82. //#define CY8CTMG300_49 // CY8CTMG300_49FNXI // 2009.08.11, not tested.
  83. //#define CY8CTMG300B_36 // CY8CTMG300B_36LQXI // 2009.08.11, not tested.
  84. //#define CY8CTMA300B_36 // CY8CTMA300B_36LQXI // 2009.08.11, not tested.
  85. //#define CY8CTST300B_36 // CY8CTST300B_36LQXI // 2009.08.11, not tested.
  86. //#define CY8CTMA301_36 // CY8CTMA301_36LQXI // 2009.08.11, not tested.
  87. //#define CY8CTMA301_48 // CY8CTMA301_48LTXI // 2009.08.11, not tested.
  88. //#define CY8CTMA301D_36 // CY8CTMA301D_36LQXI // 2009.08.11, not tested.
  89. //#define CY8CTMA301D_48 // CY8CTMA301D_48LTXI // 2009.08.11, not tested.
  90. //#define CY8CTMA300D_36 // CY8CTMA300D_36LQXI // 2009.08.11, not tested.
  91. //#define CY8CTMA300D_48 // CY8CTMA300D_48LTXI // 2009.08.11, not tested.
  92. //#define CY8CTMA300D_49 // CY8CTMA300D_49FNXIT // 2009.08.11, not tested.
  93. /****************************************************************************************************/
  94. /*************** CY8CTMG/TST series modified by KJHW, 2009.08.14 *********************************************/
  95. //#define CY8CTMG110
  96. //#define CY8CTST200_24PIN
  97. //#define CY8CTST200_32PIN
  98. //#define CY8CTMG200_24PIN
  99. //#define CY8CTMG200_32PIN
  100. /***************************************************************************************************/
  101. #define CY8C20236
  102. // **** CY8C20x66 devices ****
  103. //#define CY8C20246 /// 2009.03.26. kimc
  104. //#define CY8C20266
  105. //#define CY8C20366
  106. //#define CY8C20466
  107. //#define CY8C20566
  108. //#define CY8C20666
  109. //#define CY8C20066
  110. //#define CY8C200661
  111. // **** CY8C21x23 devices ****
  112. //#define CY8C21123
  113. //#define CY8C21223
  114. //#define CY8C21323
  115. //#define CY8C21002
  116. // **** CY8C21x34 devices ****
  117. //#define CY8C21234
  118. //#define CY8C21334
  119. //#define CY8C21434
  120. //#define CY8C21534
  121. //#define CY8C21634
  122. //#define CY8C21001
  123. // **** CY8C24x23A devices ****
  124. //#define CY8C24123A
  125. //#define CY8C24223A
  126. //#define CY8C24423A
  127. //#define CY8C24000A
  128. // **** CY8C24x94 devices ****
  129. //#define CY8C24794
  130. //#define CY8C24894
  131. //#define CY8C24994
  132. //#define CY8C24094
  133. // **** CY8C27x34 devices ****
  134. //#define CY8C27143
  135. //#define CY8C27243
  136. //#define CY8C27443
  137. //#define CY8C27543
  138. //#define CY8C27643
  139. //#define CY8C27002
  140. // **** CY8C29x66 devices ****
  141. //#define CY8C29466
  142. //#define CY8C29566
  143. //#define CY8C29666
  144. //#define CY8C29866
  145. //#define CY8C29002
  146. //-----------------------------------------------------------------------------
  147. // This section sets the Family that has been selected. These are used to
  148. // simplify other conditional compilation blocks.
  149. //-----------------------------------------------------------------------------
  150. /*************** CY8CTMA30x, CY8CTMG30x, CY8CTST30x series by KIMC, 2009.08.11 ***********************************/
  151. #ifdef CY8CTST300_36 // CY8CTST300_36LQXI // 2009.08.11, not tested.
  152. #define CY8CTMx30x
  153. #define CY8C20x66
  154. #endif
  155. #ifdef CY8CTST300_48 // CY8CTST300_48LTXI // 2009.08.11, not tested.
  156. #define CY8CTMx30x
  157. #define CY8C20x66
  158. #endif
  159. #ifdef CY8CTST300_49 // CY8CTST300_49FNXI // 2009.08.11, not tested.
  160. #define CY8CTMx30x
  161. #define CY8C20x66
  162. #endif
  163. #ifdef CY8CTMA300_36 // CY8CTMA300_36LQXI // 2009.08.11, test OK
  164. #define CY8CTMx30x
  165. #define CY8C20x66
  166. #endif
  167. #ifdef CY8CTMA300_48 // CY8CTMA300_48LTXI // 2009.08.11, not tested.
  168. #define CY8CTMx30x
  169. #define CY8C20x66
  170. #endif
  171. #ifdef CY8CTMA300_49 // CY8CTMA300_49FNXI // 2009.08.11, not tested.
  172. #define CY8CTMx30x
  173. #define CY8C20x66
  174. #endif
  175. #ifdef CY8CTMG300_36 // CY8CTMG300_36LQXI // 2009.08.11, not tested.
  176. #define CY8CTMx30x
  177. #define CY8C20x66
  178. #endif
  179. #ifdef CY8CTMG300_48 // CY8CTMG300_48LTXI // 2009.08.11, not tested.
  180. #define CY8CTMx30x
  181. #define CY8C20x66
  182. #endif
  183. #ifdef CY8CTMG300_49 // CY8CTMG300_49FNXI // 2009.08.11, not tested.
  184. #define CY8CTMx30x
  185. #define CY8C20x66
  186. #endif
  187. #ifdef CY8CTMG300B_36 // CY8CTMG300B_36LQXI // 2009.08.11, not tested.
  188. #define CY8CTMx30x
  189. #define CY8C20x66
  190. #endif
  191. #ifdef CY8CTMA300B_36 // CY8CTMA300B_36LQXI // 2009.08.11, not tested.
  192. #define CY8CTMx30x
  193. #define CY8C20x66
  194. #endif
  195. #ifdef CY8CTST300B_36 // CY8CTST300B_36LQXI // 2009.08.11, not tested.
  196. #define CY8CTMx30x
  197. #define CY8C20x66
  198. #endif
  199. #ifdef CY8CTMA301_36 // CY8CTMA301_36LQXI // 2009.08.11, not tested.
  200. #define CY8CTMx30x
  201. #define CY8C20x66
  202. #endif
  203. #ifdef CY8CTMA301_48 // CY8CTMA301_48LTXI // 2009.08.11, not tested.
  204. #define CY8CTMx30x
  205. #define CY8C20x66
  206. #endif
  207. #ifdef CY8CTMA301D_36 // CY8CTMA301D_36LQXI // 2009.08.11, not tested.
  208. #define CY8CTMx30x
  209. #define CY8C20x66
  210. #endif
  211. #ifdef CY8CTMA301D_48 // CY8CTMA301D_48LTXI // 2009.08.11, not tested.
  212. #define CY8CTMx30x
  213. #define CY8C20x66
  214. #endif
  215. #ifdef CY8CTMA300D_36 // CY8CTMA300D_36LQXI // 2009.08.11, not tested.
  216. #define CY8CTMx30x
  217. #define CY8C20x66
  218. #endif
  219. #ifdef CY8CTMA300D_48 // CY8CTMA300D_48LTXI // 2009.08.11, not tested.
  220. #define CY8CTMx30x
  221. #define CY8C20x66
  222. #endif
  223. #ifdef CY8CTMA300D_49 // CY8CTMA300D_49FNXIT // 2009.08.11, not tested.
  224. #define CY8CTMx30x
  225. #define CY8C20x66
  226. #endif
  227. /**************************************************/
  228. /*************** CY8CTMG/TST series modified by KJHW, 2009.08.14 *********************************************/
  229. #ifdef CY8CTMG110
  230. #define CY8C21x34
  231. #endif
  232. #ifdef CY8CTST200_24PIN
  233. #define CY8C20x66
  234. #endif
  235. #ifdef CY8CTST200_32PIN
  236. #define CY8C20x66
  237. #endif
  238. #ifdef CY8CTMG200_24PIN
  239. #define CY8C20x66
  240. #endif
  241. #ifdef CY8CTMG200_32PIN
  242. #define CY8C20x66
  243. #endif
  244. /***************************************************************************************************/
  245. #ifdef CY8C20236
  246. #define CY8C20x66
  247. #endif
  248. #ifdef CY8C20246 /// 2009.03.26. kimc
  249. #define CY8C20x66
  250. #endif
  251. #ifdef CY8C20266
  252. #define CY8C20x66
  253. #endif
  254. #ifdef CY8C20366
  255. #define CY8C20x66
  256. #endif
  257. #ifdef CY8C20466
  258. #define CY8C20x66
  259. #endif
  260. #ifdef CY8C20566
  261. #define CY8C20x66
  262. #endif
  263. #ifdef CY8C20666
  264. #define CY8C20x66
  265. #endif
  266. #ifdef CY8C20066
  267. #define CY8C20x66
  268. #endif
  269. #ifdef CY8C200661
  270. #define CY8C20x66
  271. #endif
  272. #ifdef CY8C21123
  273. #define CY8C21x23
  274. #endif
  275. #ifdef CY8C21223
  276. #define CY8C21x23
  277. #endif
  278. #ifdef CY8C21323
  279. #define CY8C21x23
  280. #endif
  281. #ifdef CY8C21002
  282. #define CY8C21x23
  283. #endif
  284. #ifdef CY8C21234
  285. #define CY8C21x34
  286. #endif
  287. #ifdef CY8C21334
  288. #define CY8C21x34
  289. #endif
  290. #ifdef CY8C21434
  291. #define CY8C21x34
  292. #endif
  293. #ifdef CY8C21534
  294. #define CY8C21x34
  295. #endif
  296. #ifdef CY8C21634
  297. #define CY8C21x34
  298. #endif
  299. #ifdef CY8C21001
  300. #define CY8C21x34
  301. #endif
  302. #ifdef CY8C24123A
  303. #define CY8C24x23A
  304. #endif
  305. #ifdef CY8C24223A
  306. #define CY8C24x23A
  307. #endif
  308. #ifdef CY8C24423A
  309. #define CY8C24x23A
  310. #endif
  311. #ifdef CY8C24000A
  312. #define CY8C24x23A
  313. #endif
  314. #ifdef CY8C24794
  315. #define CY8C24x94
  316. #endif
  317. #ifdef CY8C24894
  318. #define CY8C24x94
  319. #endif
  320. #ifdef CY8C24994
  321. #define CY8C24x94
  322. #endif
  323. #ifdef CY8C24094
  324. #define CY8C24x94
  325. #endif
  326. #ifdef CY8C27143
  327. #define CY8C27x43
  328. #endif
  329. #ifdef CY8C27243
  330. #define CY8C27x43
  331. #endif
  332. #ifdef CY8C27443
  333. #define CY8C27x43
  334. #endif
  335. #ifdef CY8C27543
  336. #define CY8C27x43
  337. #endif
  338. #ifdef CY8C27643
  339. #define CY8C27x43
  340. #endif
  341. #ifdef CY8C27002
  342. #define CY8C27x43
  343. #endif
  344. #ifdef CY8C29466
  345. #define CY8C29x66
  346. #endif
  347. #ifdef CY8C29566
  348. #define CY8C29x66
  349. #endif
  350. #ifdef CY8C29666
  351. #define CY8C29x66
  352. #endif
  353. #ifdef CY8C29866
  354. #define CY8C29x66
  355. #endif
  356. #ifdef CY8C29002
  357. #define CY8C29x66
  358. #endif
  359. //-----------------------------------------------------------------------------
  360. // The directives below are used for Krypton.
  361. // See the Krypton programming spec 001-15870 rev *A for more details. (The
  362. // spec uses "mnemonics" instead of "directives"
  363. //-----------------------------------------------------------------------------
  364. #ifdef CY8C20x66
  365. #define TSYNC
  366. #define ID_SETUP_1 //PTJ: ID_SETUP_1 is similar to init1_v
  367. #define ID_SETUP_2 //PTJ: ID_SETUP_2 is similar to init2_v
  368. #define SET_BLOCK_NUM
  369. #define CHECKSUM_SETUP //PTJ: CHECKSUM_SETUP_20x66 is the same as CHECKSUM-SETUP in 001-15870
  370. #define READ_CHECKSUM
  371. #define PROGRAM_AND_VERIFY //PTJ: PROGRAM_BLOCK_20x66 is the same as PROGRAM-AND-VERIFY in 001-15870
  372. #define ERASE
  373. #define SECURE
  374. #define READ_SECURITY
  375. #define READ_WRITE_SETUP
  376. #define WRITE_BYTE
  377. #define VERIFY_SETUP
  378. #define READ_STATUS
  379. #define READ_BYTE
  380. //READ_ID_WORD //PTJ: 3rd Party Progrmmer will have to write code to handle this directive, we do it out own way in this code, see read_id_v
  381. #endif
  382. //-----------------------------------------------------------------------------
  383. //-----------------------------------------------------------------------------
  384. // The directives below are used to define various sets of vectors that differ
  385. // for more than one set of PSoC parts.
  386. //-----------------------------------------------------------------------------
  387. // **** Select a Checksum Setup Vector ****
  388. #ifdef CY8C21x23
  389. #define CHECKSUM_SETUP_21_27
  390. #endif
  391. #ifdef CY8C21x34
  392. #define CHECKSUM_SETUP_21_27
  393. #endif
  394. #ifdef CY8C24x23A
  395. #define CHECKSUM_SETUP_24_24A
  396. #endif
  397. #ifdef CY8C24x94
  398. #define CHECKSUM_SETUP_24_29
  399. #endif
  400. #ifdef CY8C27x43
  401. #define CHECKSUM_SETUP_21_27
  402. #endif
  403. #ifdef CY8C29x66
  404. #define CHECKSUM_SETUP_24_29
  405. #endif
  406. // **** Select a Program Block Vector ****
  407. #ifdef CY8C21x23
  408. #define PROGRAM_BLOCK_21_24_29
  409. #endif
  410. #ifdef CY8C21x34
  411. #define PROGRAM_BLOCK_21_24_29
  412. #endif
  413. #ifdef CY8C24x23A
  414. #define PROGRAM_BLOCK_21_24_29
  415. #endif
  416. #ifdef CY8C24x94
  417. #define PROGRAM_BLOCK_21_24_29
  418. #endif
  419. #ifdef CY8C27x43
  420. #define PROGRAM_BLOCK_27
  421. #endif
  422. #ifdef CY8C29x66
  423. #define PROGRAM_BLOCK_21_24_29
  424. #endif
  425. //-----------------------------------------------------------------------------
  426. // The directives below are used to control switching banks if the device is
  427. // has multiple banks of Flash.
  428. //-----------------------------------------------------------------------------
  429. // **** Select a Checksum Setup Vector ****
  430. #ifdef CY8C24x94
  431. #define MULTI_BANK
  432. #endif
  433. #ifdef CY8C29x66
  434. #define MULTI_BANK
  435. #endif
  436. // ----------------------------------------------------------------------------
  437. #endif //(INC_ISSP_DIRECTIVES)
  438. #endif //(PROJECT_REV_)
  439. //end of file ISSP_Directives.h