Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

169 linhas
6.1 KiB

  1. /*******************************************************************************
  2. * *
  3. * Copyright 2010 Rheinmetall Canada Inc. *
  4. * *
  5. * No part of this document may be reproduced, stored in *
  6. * a retrieval system, or transmitted, in any form or by any means, *
  7. * electronic, mechanical, photocopying, recording, or otherwise, *
  8. * without the prior written permission of Rheinmetall Canada Inc. *
  9. * *
  10. *******************************************************************************/
  11. /* ¤Revision:
  12. 000 20100616 HCAM,
  13. Original version.
  14. ,----.. ,----..
  15. / / \ / / \ ,--,
  16. | : : __ ,-. ,---. | : : ,--.'| ,---,
  17. . | ;. / ,' ,'/ /| ' ,'\ .--.--. . | ;. / | |, ,-+-. / |
  18. . ; /--` ' | |' | / / | / / ' . ; /--` `--'_ ,--.'|' |
  19. ; | ; __ | | ,'. ; ,. :| : /`./ ; | ; __ ,' ,'| | | ,"' |
  20. | : |.' .'' : / ' | |: :| : ;_ | : |.' .'' | | | | / | |
  21. . | '_.' :| | ' ' | .; : \ \ `. . | '_.' :| | : | | | | |
  22. ' ; : \ |; : | | : | `----. \ ' ; : \ |' : |__ | | | |/
  23. ' | '/ .'| , ; \ \ / / /`--' / ' | '/ .'| | '.'|| | |--'
  24. | : / ---' `----' '--'. / | : / ; : ;| |/
  25. \ \ .' `--'---' \ \ .' | , / '---'
  26. `---` `---` ---`-'
  27. ### YYYYMMDD Initial, Bug Identification
  28. Change description.
  29. */
  30. /****************************** NOTES ***************************************
  31. -> Timers assignment <-
  32. - Timer1 used by general timer module (timer.c)
  33. - Timer2 used by time based Resolver data acquisition module (resolver.c)
  34. - timer3 used by input capture to detect PWM
  35. - timer4 used by hall acquisition module (HallAcquisition.c)
  36. - timer5 used by FPGAInterface to time-base SPI the transfer to the FPGA
  37. -> Interrupt priority assignment <-
  38. Priority.SubPriority - Assignment
  39. HIGHEST
  40. 7.3
  41. 7.2
  42. 7.1 - UART1
  43. 7.0 - UART2
  44. 6.3 - TIMER2 (Resolver acquisition & halls computation)
  45. 6.2 - PMP
  46. 6.1
  47. 6.0 - Input Capture
  48. 5.3 - ADC
  49. 5.2 - SPI
  50. 5.1
  51. 5.0
  52. 4.3 - Drive Enable pin interrupt
  53. 4.2 - AD2S DOS Pin
  54. 4.1 - AD2S LOT Pin
  55. 4.0
  56. 3.3
  57. 3.2
  58. 3.1
  59. 3.0 - TIMER5 (FPGA TX)
  60. 2.3 - TIMER1 (General purpose timer)
  61. 2.2 - TIMER3 (PWM Detection)
  62. 2.1
  63. 1.0
  64. 1.3
  65. 1.2
  66. 1.1
  67. 1.0
  68. LOWEST
  69. *****************************************************************************/
  70. #ifndef DEFINE_H
  71. #define DEFINE_H
  72. /* ************************************************************************** */
  73. /* Includes */
  74. #include <plib.h>
  75. //#include "CUHelperFcns.h"
  76. /* ************************************************************************** */
  77. /* Defines */
  78. #define SYS_FREQ (77824000L) //Clock period = 12.85 ns
  79. #define PERIPHERAL_FREQ (77824000L)
  80. #define PIN_INPUT 1
  81. #define PIN_OUTPUT 0
  82. #define LED_ON 0
  83. #define LED_OFF 1
  84. #define false 0
  85. #define true 1
  86. #define MSB8(x) ((x >> 8) & 0xFF)
  87. #define LSB8(x) (x & 0xFF)
  88. #define PI 3.1415926536
  89. //#define ENABLE_DEBUG_LOG
  90. #ifdef ENABLE_DEBUG_LOG
  91. #include "util.h"
  92. #endif
  93. //#define USE_HALL_ACQ_SIMULATOR //Use this switch for development to test hall acquisition traces
  94. #define USE_ENGINEERING_MODE //Use this switch to disable speed, position and halls traces and traces buffer allocation (all traces !)
  95. //#define USE_TRACE_SIMULATOR //Use this switch to simulate trace data for development
  96. //#define USE_SPI_DONGLE_SIMULATOR //Use this switch if you use the CUMUX as a SPI dongle instead of the CS16IS74 dongle.
  97. //#define USE_PMP_AUTOINCREMENT //Use to speed-up AD2S data transfer
  98. #define USE_PWM_DETECTION //Use PWM detection to enable/disable bridge
  99. #define USE_AUTO_BRIDGE_CONTROL //Execute drive bridge control
  100. //#define FORCE_BRIDGE_ON
  101. //#define DRIVE_BOARD_NOT_INSTALLED
  102. #define DISABLE_PRINT_FAULT
  103. #define SPI_FAST
  104. //#define USE_DMA_WITH_PMP
  105. //#define USE_RESOLVER_STATEMACHINE
  106. //#define DISABLE_DRIVE_PARAM_MGMT // uncomment to avoid setting the drive at power-up
  107. #define POLL_UART1_RX
  108. #define POLL_UART2_RX
  109. // Uncomment next #define for testing with ICCA board
  110. // #define USE_ICCA_CU_PA_UART_SNOOPING
  111. //Define the com port assignations
  112. //----------------------------
  113. #define DRIVE_UART_PORT UART_1
  114. #ifdef USE_ICCA_CU_PA_UART_SNOOPING
  115. // Note: With this configuration there is no CU command going to the PA
  116. #define CU_UART_PORT UART_3
  117. #define CONSOLE_UART_PORT UART_2
  118. #else
  119. // Normal setting using PA SPI for UART_3 (CONSOLE_UART_PORT)
  120. #define CU_UART_PORT UART_2
  121. #define CONSOLE_UART_PORT UART_3
  122. #endif
  123. #define ACTUATOR_WITTENSTEIN
  124. //#define ACTUATOR_DS50
  125. //
  126. //----------------------------
  127. //#define USE_BLOCKING_PRINTF
  128. #define USE_PRINTF
  129. #ifdef USE_PRINTF
  130. #define PRINTF(n, a...) printf(n, ## a)
  131. #else
  132. #define PRINTF(n, a...)
  133. #define NO_EXTERNAL_UART
  134. #endif
  135. /* ************************************************************************** */
  136. /* Type definitions */
  137. typedef int bool;
  138. #endif
  139. //EOF