queue.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /************************************************************************
  2. Project: Welling Motor Control Paltform
  3. Filename: QUEUE.h
  4. Partner Filename: QUEUE.c
  5. Description: The header file of QUEUE.c
  6. Complier: IAR Embedded Workbench for ARM 7.80, IAR Systems.
  7. CPU TYPE : GD32F3x0
  8. *************************************************************************
  9. Copyright (c) 2018 Welling Motor Technology(Shanghai) Co. Ltd.
  10. All rights reserved.
  11. *************************************************************************
  12. *************************************************************************
  13. Revising History (ECL of this file):
  14. ************************************************************************/
  15. /************************************************************************
  16. Beginning of File, do not put anything above here except notes
  17. Compiler Directives:
  18. *************************************************************************/
  19. #ifndef QUEUE_H
  20. #define QUEUE_H
  21. #include "typedefine.h"
  22. #include "canAppl.h"
  23. /************************************************************************
  24. Typedefs & Structure Defines (N/A)
  25. ************************************************************************/
  26. #define QUEUE_SIZE 16u
  27. /************************************************************************
  28. Typedefs & Structures Defines
  29. ************************************************************************/
  30. typedef struct
  31. {
  32. UWORD ErrorIndex; // 故障序列号,地址偏移 0
  33. UWORD NotesInfo1; //备注信息1,地址偏移 2
  34. UWORD NotesInfo2; //备注信息2,地址偏移 4
  35. UWORD NotesInfo3; //备注信息3,地址偏移 6
  36. ULONG ErrorCode; //故障码 4 bytes, 地址偏移 8
  37. ULONG RunTime; //运行时间 4bytes, 地址偏移 12
  38. MC_RunInfo_Struct_t RunInfo; //运行信息 32bytes, 地址偏移 16
  39. SWORD IqCurrentPu; // Iq电流,地址偏移 48
  40. SWORD IqVoltagePu; // Iq电压,地址偏移 50
  41. SWORD IdCurrentPu; // Id电流,地址偏移 52
  42. SWORD IdVoltagePu; // Id电压,地址偏移 54
  43. UBYTE ubHead;
  44. UBYTE ubRear;
  45. UWORD RS1; // 预留信息 1,2bytes,地址偏移 56
  46. UWORD RS2; // 预留信息 1,2bytes,地址偏移 58
  47. UWORD RS3; // 预留信息 1,2bytes,地址偏移 60
  48. } ERROR_LOG; //共64字节
  49. typedef struct
  50. {
  51. UBYTE ubHead;
  52. UBYTE ubRear;
  53. ERROR_LOG stLog[QUEUE_SIZE];
  54. } FLASH_ERROR_QUEUE;
  55. extern ERROR_LOG que_stErrorLog;
  56. extern FLASH_ERROR_QUEUE que_stFlashErrorLog;
  57. /************************************************************************
  58. Exported Function Call Prototypes (N/A)
  59. ************************************************************************/
  60. extern UBYTE que_ubPushIn(FLASH_ERROR_QUEUE *Q, const ERROR_LOG *rxdata, UBYTE length);
  61. extern UBYTE que_ubPopOut(FLASH_ERROR_QUEUE *Q, ERROR_LOG buf[], UBYTE length);
  62. extern void que_voInit(FLASH_ERROR_QUEUE *Q);
  63. extern void que_ubIndexIncrease(FLASH_ERROR_QUEUE *Q, UWORD* ErrorIndex);
  64. #endif
  65. /*************************************************************************
  66. Copyright (c) 2011 Welling Motor Technology(Shanghai) Co. Ltd.
  67. All rights reserved.
  68. *************************************************************************
  69. End of this File (EOF):
  70. Do not put anything after this part!
  71. *************************************************************************/