1 /*******************************************************************
2 Components for embedded applications builded for
3 laboratory and medical instruments firmware
5 pxmcc_types.h - multi axis motion controller coprocessor
6 for FPGA tumble CPU of lx-rocon system - data types
8 (C) 2001-2014 by Pavel Pisa pisa@cmp.felk.cvut.cz
9 (C) 2002-2014 by PiKRON Ltd. http://www.pikron.com
11 This file can be used and copied according to next
13 - GPL - GNU Public License
14 - other license provided by project originators
16 *******************************************************************/
18 #ifndef _PXMCC_TYPES_H_
19 #define _PXMCC_TYPES_H_
23 #define PXMCC_FWVERSION 0xACCE0001
24 #define PXMCC_AXIS_COUNT 4
25 #define PXMCC_CURADC_CHANNELS 16
27 #define PXMCC_MODE_IDLE 2
28 #define PXMCC_MODE_BLDC 0
29 #define PXMCC_MODE_STEPPER_WITH_IRC 1
30 #define PXMCC_MODE_STEPPER 3
32 typedef struct pxmcc_common_data_t {
39 } pxmcc_common_data_t;
41 typedef struct pxmcc_axis_data_t {
44 uint32_t pwm_dq; /* D and Q components of PWM (pwm_d << 16) | (pwm_q) & 0xffff */
45 uint32_t cur_dq; /* D and Q components current (cur_d << 16) | (cur_q) & 0xffff */
46 uint32_t ptindx; /* index into phase table / irc in the cycle */
47 uint32_t ptirc; /* IRC count per phase table */
48 uint32_t ptreci; /* Reciprocal value of ptirc * 63356 */
49 uint32_t ptofs; /* offset between table and IRC counter */
55 uint32_t inp_info; /* which irc to use */
56 uint32_t out_info; /* output index */
57 uint32_t pwmtx_info; /* offsets of pwm1 .. pwm4 from FPGA_LX_MASTER_TX */
59 uint32_t steps_inc; /* increments for selfgenerated stepper motor */
60 uint32_t steps_pos; /* self generated position for stepper motor */
61 uint32_t steps_sqn_next; /* when to apply steps_inc_next */
62 uint32_t steps_inc_next; /* increment to apply at steps_sqn_next */
63 uint32_t steps_pos_next; /* base position to apply at steps_sqn_next */
66 typedef struct pxmcc_curadc_data_t {
68 int32_t siroladc_offs;
69 uint32_t siroladc_last;
70 } pxmcc_curadc_data_t;
72 typedef struct pxmcc_data_t {
73 pxmcc_common_data_t common;
74 pxmcc_axis_data_t axis[PXMCC_AXIS_COUNT];
75 pxmcc_curadc_data_t curadc[PXMCC_CURADC_CHANNELS];
78 #endif /*_PXMCC_TYPES_H_*/