]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/lx-rocon.git/blob - sw/app/rocon/appl_pxmc.h
215b7475e2180a38dd618c39b4a6ae73747119ae
[fpga/lx-cpu1/lx-rocon.git] / sw / app / rocon / appl_pxmc.h
1 /*******************************************************************
2   Components for embedded applications builded for
3   laboratory and medical instruments firmware
4
5   pxmcc_rocon.h - multi axis motion controller coprocessor
6                RoCoN specific extensions
7
8   (C) 2001-2014 by Pavel Pisa pisa@cmp.felk.cvut.cz
9   (C) 2002-2014 by PiKRON Ltd. http://www.pikron.com
10
11   This file can be used and copied according to next
12   license alternatives
13    - GPL - GNU Public License
14    - other license provided by project originators
15
16  *******************************************************************/
17
18 #ifndef _APPL_PXMC_H_
19 #define _APPL_PXMC_H_
20
21 #include <stdint.h>
22 #include <pxmc.h>
23
24 typedef struct pxmc_rocon_state_t {
25   pxmc_state_t base;
26   uint32_t steps_pos_prev;
27   uint32_t cur_d_cum_prev;
28   uint32_t cur_q_cum_prev;
29   int32_t  cur_d_err_sum;
30   int32_t  cur_q_err_sum;
31   short    cur_d_p;
32   short    cur_d_i;
33   short    cur_q_p;
34   short    cur_q_i;
35   short    cur_hold;
36 } pxmc_rocon_state_t;
37
38 #define pxmc_rocon_state_offs(_fld) \
39                 (((size_t)&((pxmc_rocon_state_t *)0L)->_fld) - \
40                  ((size_t)&((pxmc_rocon_state_t *)0L)->base))
41
42 extern int pxmc_rocon_vin_act;
43 extern unsigned pxmc_rocon_lxpwr_chips;
44
45 int pxmc_rocon_pwm_direct_wr(unsigned chan, unsigned pwm, int en);
46
47 #endif /*_APPL_PXMC_H_*/