]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/lx-rocon.git/blobdiff - hw/lx-rocon_firmware/pxmcc_types.h
RoCoN and TUMBL firmware: reimplemented control of stepper motor without feedback.
[fpga/lx-cpu1/lx-rocon.git] / hw / lx-rocon_firmware / pxmcc_types.h
index 33be1681ee1872d44eb03e8f73fb776d0aa0ab96..afad06c571ebcb318509dbd63c92da009ef5db45 100644 (file)
@@ -2,7 +2,7 @@
   Components for embedded applications builded for
   laboratory and medical instruments firmware
 
-  pxmcc_types.h - multi axis motion controller comprocesor
+  pxmcc_types.h - multi axis motion controller coprocessor
         for FPGA tumble CPU of lx-rocon system - data types
 
   (C) 2001-2014 by Pavel Pisa pisa@cmp.felk.cvut.cz
 
  *******************************************************************/
 
-#include <stdint.h>
+#ifndef _PXMCC_TYPES_H_
+#define _PXMCC_TYPES_H_
 
+#include <stdint.h>
 
 #define PXMCC_FWVERSION       0xACCE0001
 #define PXMCC_AXIS_COUNT      4
 #define PXMCC_CURADC_CHANNELS 16
 
+#define PXMCC_MODE_IDLE              2
+#define PXMCC_MODE_BLDC              0
+#define PXMCC_MODE_STEPPER_WITH_IRC  1
+#define PXMCC_MODE_STEPPER           3
+
 typedef struct pxmcc_common_data_t {
   uint32_t  fwversion;
   uint32_t  pwm_cycle;
   uint32_t  act_idle;
   uint32_t  min_idle;
   uint32_t  rx_done_sqn;
+  uint32_t  irc_base;
 } pxmcc_common_data_t;
 
 typedef struct pxmcc_axis_data_t {
@@ -47,13 +55,18 @@ typedef struct pxmcc_axis_data_t {
   uint32_t  inp_info;  /* which irc to use */
   uint32_t  out_info;  /* output index */
   uint32_t  pwmtx_info;        /* offsets of pwm1 .. pwm4 from FPGA_LX_MASTER_TX */
-  uint16_t  pwm_prew[4];
+  uint32_t  pwm_prew[4];
+  uint32_t  steps_inc; /* increments for selfgenerated stepper motor */
+  uint32_t  steps_pos; /* self generated position for stepper motor */
+  uint32_t  steps_sqn_next; /* when to apply steps_inc_next */
+  uint32_t  steps_inc_next; /* increment to apply at steps_sqn_next */
+  uint32_t  steps_pos_next; /* base position to apply at steps_sqn_next */
 } pxmcc_axis_data_t;
 
 typedef struct pxmcc_curadc_data_t {
   int32_t   cur_val;
-  uint16_t  siroladc_offs;
-  uint16_t  siroladc_last;
+  int32_t   siroladc_offs;
+  uint32_t  siroladc_last;
 } pxmcc_curadc_data_t;
 
 typedef struct pxmcc_data_t {
@@ -61,3 +74,5 @@ typedef struct pxmcc_data_t {
   pxmcc_axis_data_t   axis[PXMCC_AXIS_COUNT];
   pxmcc_curadc_data_t curadc[PXMCC_CURADC_CHANNELS];
 } pxmcc_data_t;
+
+#endif /*_PXMCC_TYPES_H_*/