Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
lerwys committed Jul 10, 2020
2 parents 320928a + 73753fb commit 4636c9f
Show file tree
Hide file tree
Showing 8 changed files with 714 additions and 24 deletions.
29 changes: 8 additions & 21 deletions doc/halcs-installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,26 +168,14 @@ at your distribution. As all of them use semantic versioning, you can install an
version that is greater or equal than the specified ones for *minor* and *revision*:
numbers.

Additionally, it's often interesting to install customized udev scripts, so
your application will automatically start a given program when some ID is
detected:

.. code-block:: bash
:linenos:
git clone --recursive https://github.com/lnls-dig/halcs-generic-udev.git && \
for project in halcs-generic-udev; do
cd $project && \
git submodule update --init --recursive &&
sudo make install && \
cd ..
UDEV scripts
''''''''''''

# Check last command return status
if [ $? -ne 0 ]; then
echo "Could not compile/install project $project." >&2
exit 1
fi
done
HALCS includes two udev scripts, a generic one that sets the device permissions
to the appropriate ones (called ``60-udev-fpga-rules``) and customized udev script,
in which you can automatically start a userspace application if a certain condition
is detected (called ``50-udev-fpga-rules``). If this, an application will
automatically start a given program when some ID is detected.

Typically the ID used is the *Gateware Name* represented by the SDB [#sdb]_ property
``synthesis-name`` that is baked inside the FPGA Gateware.
Expand All @@ -198,8 +186,7 @@ Typically the ID used is the *Gateware Name* represented by the SDB [#sdb]_ prop
.. |SDB Wiki| replace:: https://ohwr.org/project/fpga-config-space/wikis/home

To add your specific program to start when some ID is found, the ``run-fpga-program.sh``
(typically installed in ``/usr/local/share/halcs/scripts`` or under
``halcs-generic-udev`` repository path ``scripts/share/halcs/scripts``) script
(typically installed in ``/usr/local/share/halcs`` or ``/usr/share/halcs``) script
can be modified. Below, an excerpt of the script is shown with a possible
modification to allow starting another program:

Expand Down
95 changes: 95 additions & 0 deletions include/hw/wb_pos_calc_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
#ifndef __WBGEN2_REGDEFS_WB_POS_CALC_REGS_WB
#define __WBGEN2_REGDEFS_WB_POS_CALC_REGS_WB

#ifdef __KERNEL__
#include <linux/types.h>
#else
#include <inttypes.h>
#endif

#if defined( __GNUC__)
#define PACKED __attribute__ ((packed))
Expand Down Expand Up @@ -626,6 +630,85 @@
#define POS_CALC_TBT_DATA_MASK_SAMPLES_END_SHIFT 16
#define POS_CALC_TBT_DATA_MASK_SAMPLES_END_W(value) WBGEN2_DSP_GEN_WRITE(value, 16, 16)
#define POS_CALC_TBT_DATA_MASK_SAMPLES_END_R(reg) WBGEN2_DSP_GEN_READ(reg, 16, 16)

/* definitions for register: MONIT1 Synchronizing Trigger */

/* definitions for field: MONIT1 Synchronizing Trigger Enable in reg: MONIT1 Synchronizing Trigger */
#define POS_CALC_MONIT1_TAG_EN WBGEN2_DSP_GEN_MASK(0, 1)

/* definitions for field: MONIT1 Synchronizing Trigger Delay in reg: MONIT1 Synchronizing Trigger */
#define POS_CALC_MONIT1_TAG_DLY_MASK WBGEN2_DSP_GEN_MASK(1, 16)
#define POS_CALC_MONIT1_TAG_DLY_SHIFT 1
#define POS_CALC_MONIT1_TAG_DLY_W(value) WBGEN2_DSP_GEN_WRITE(value, 1, 16)
#define POS_CALC_MONIT1_TAG_DLY_R(reg) WBGEN2_DSP_GEN_READ(reg, 1, 16)

/* definitions for field: MONIT1 Desynchronization Counter Reset in reg: MONIT1 Synchronizing Trigger */
#define POS_CALC_MONIT1_TAG_DESYNC_CNT_RST WBGEN2_DSP_GEN_MASK(17, 1)

/* definitions for field: MONIT1 Desynchronization Counter in reg: MONIT1 Synchronizing Trigger */
#define POS_CALC_MONIT1_TAG_DESYNC_CNT_MASK WBGEN2_DSP_GEN_MASK(18, 14)
#define POS_CALC_MONIT1_TAG_DESYNC_CNT_SHIFT 18
#define POS_CALC_MONIT1_TAG_DESYNC_CNT_W(value) WBGEN2_DSP_GEN_WRITE(value, 18, 14)
#define POS_CALC_MONIT1_TAG_DESYNC_CNT_R(reg) WBGEN2_DSP_GEN_READ(reg, 18, 14)

/* definitions for register: MONIT1 Masking Control */

/* definitions for field: MONIT1 Masking Enable in reg: MONIT1 Masking Control */
#define POS_CALC_MONIT1_DATA_MASK_CTL_EN WBGEN2_DSP_GEN_MASK(0, 1)

/* definitions for register: MONIT1 Data Masking Samples */

/* definitions for field: MONIT1 Beginning Data Masking Samples in reg: MONIT1 Data Masking Samples */
#define POS_CALC_MONIT1_DATA_MASK_SAMPLES_BEG_MASK WBGEN2_DSP_GEN_MASK(0, 16)
#define POS_CALC_MONIT1_DATA_MASK_SAMPLES_BEG_SHIFT 0
#define POS_CALC_MONIT1_DATA_MASK_SAMPLES_BEG_W(value) WBGEN2_DSP_GEN_WRITE(value, 0, 16)
#define POS_CALC_MONIT1_DATA_MASK_SAMPLES_BEG_R(reg) WBGEN2_DSP_GEN_READ(reg, 0, 16)

/* definitions for field: MONIT1 Beginning Data Masking Samples in reg: MONIT1 Data Masking Samples */
#define POS_CALC_MONIT1_DATA_MASK_SAMPLES_END_MASK WBGEN2_DSP_GEN_MASK(16, 16)
#define POS_CALC_MONIT1_DATA_MASK_SAMPLES_END_SHIFT 16
#define POS_CALC_MONIT1_DATA_MASK_SAMPLES_END_W(value) WBGEN2_DSP_GEN_WRITE(value, 16, 16)
#define POS_CALC_MONIT1_DATA_MASK_SAMPLES_END_R(reg) WBGEN2_DSP_GEN_READ(reg, 16, 16)

/* definitions for register: MONIT Synchronizing Trigger */

/* definitions for field: MONIT Synchronizing Trigger Enable in reg: MONIT Synchronizing Trigger */
#define POS_CALC_MONIT_TAG_EN WBGEN2_DSP_GEN_MASK(0, 1)

/* definitions for field: MONIT Synchronizing Trigger Delay in reg: MONIT Synchronizing Trigger */
#define POS_CALC_MONIT_TAG_DLY_MASK WBGEN2_DSP_GEN_MASK(1, 16)
#define POS_CALC_MONIT_TAG_DLY_SHIFT 1
#define POS_CALC_MONIT_TAG_DLY_W(value) WBGEN2_DSP_GEN_WRITE(value, 1, 16)
#define POS_CALC_MONIT_TAG_DLY_R(reg) WBGEN2_DSP_GEN_READ(reg, 1, 16)

/* definitions for field: MONIT Desynchronization Counter Reset in reg: MONIT Synchronizing Trigger */
#define POS_CALC_MONIT_TAG_DESYNC_CNT_RST WBGEN2_DSP_GEN_MASK(17, 1)

/* definitions for field: MONIT Desynchronization Counter in reg: MONIT Synchronizing Trigger */
#define POS_CALC_MONIT_TAG_DESYNC_CNT_MASK WBGEN2_DSP_GEN_MASK(18, 14)
#define POS_CALC_MONIT_TAG_DESYNC_CNT_SHIFT 18
#define POS_CALC_MONIT_TAG_DESYNC_CNT_W(value) WBGEN2_DSP_GEN_WRITE(value, 18, 14)
#define POS_CALC_MONIT_TAG_DESYNC_CNT_R(reg) WBGEN2_DSP_GEN_READ(reg, 18, 14)

/* definitions for register: MONIT Masking Control */

/* definitions for field: MONIT Masking Enable in reg: MONIT Masking Control */
#define POS_CALC_MONIT_DATA_MASK_CTL_EN WBGEN2_DSP_GEN_MASK(0, 1)

/* definitions for register: MONIT Data Masking Samples */

/* definitions for field: MONIT Beginning Data Masking Samples in reg: MONIT Data Masking Samples */
#define POS_CALC_MONIT_DATA_MASK_SAMPLES_BEG_MASK WBGEN2_DSP_GEN_MASK(0, 16)
#define POS_CALC_MONIT_DATA_MASK_SAMPLES_BEG_SHIFT 0
#define POS_CALC_MONIT_DATA_MASK_SAMPLES_BEG_W(value) WBGEN2_DSP_GEN_WRITE(value, 0, 16)
#define POS_CALC_MONIT_DATA_MASK_SAMPLES_BEG_R(reg) WBGEN2_DSP_GEN_READ(reg, 0, 16)

/* definitions for field: MONIT Beginning Data Masking Samples in reg: MONIT Data Masking Samples */
#define POS_CALC_MONIT_DATA_MASK_SAMPLES_END_MASK WBGEN2_DSP_GEN_MASK(16, 16)
#define POS_CALC_MONIT_DATA_MASK_SAMPLES_END_SHIFT 16
#define POS_CALC_MONIT_DATA_MASK_SAMPLES_END_W(value) WBGEN2_DSP_GEN_WRITE(value, 16, 16)
#define POS_CALC_MONIT_DATA_MASK_SAMPLES_END_R(reg) WBGEN2_DSP_GEN_READ(reg, 16, 16)

/* [0x0]: REG Config divisor threshold TBT register */
#define POS_CALC_REG_DS_TBT_THRES 0x00000000
/* [0x4]: REG Config divisor threshold FOFB register */
Expand Down Expand Up @@ -752,4 +835,16 @@
#define POS_CALC_REG_TBT_DATA_MASK_CTL 0x000000f4
/* [0xa8]: REG TbT Data Masking Samples */
#define POS_CALC_REG_TBT_DATA_MASK_SAMPLES 0x000000f8
/* [0xfc]: REG MONIT1 Synchronizing Trigger */
#define POS_CALC_REG_MONIT1_TAG 0x000000fc
/* [0x100]: REG MONIT1 Masking Control */
#define POS_CALC_REG_MONIT1_DATA_MASK_CTL 0x00000100
/* [0x104]: REG MONIT1 Data Masking Samples */
#define POS_CALC_REG_MONIT1_DATA_MASK_SAMPLES 0x00000104
/* [0x108]: REG MONIT Synchronizing Trigger */
#define POS_CALC_REG_MONIT_TAG 0x000000108
/* [0x10c]: REG MONIT Masking Control */
#define POS_CALC_REG_MONIT_DATA_MASK_CTL 0x00000010c
/* [0x110]: REG MONIT Data Masking Samples */
#define POS_CALC_REG_MONIT_DATA_MASK_SAMPLES 0x00000110
#endif
86 changes: 86 additions & 0 deletions src/client/include/halcs_client_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,92 @@ halcs_client_err_e halcs_get_tbt_tag_desync_cnt_rst (halcs_client_t *self, char
halcs_client_err_e halcs_get_tbt_tag_desync_cnt (halcs_client_t *self, char *service,
uint32_t *tbt_tag_desync_cnt);

/* MONIT1 Tag Enable. This sets/gets the tag synchronization */
/* All of the functions returns HALCS_CLIENT_SUCCESS if the
* parameter was correctly set or error (see halcs_client_err.h
* for all possible errors)*/
halcs_client_err_e halcs_set_monit1_tag_en (halcs_client_t *self, char *service,
uint32_t monit1_tag_en);
halcs_client_err_e halcs_get_monit1_tag_en (halcs_client_t *self, char *service,
uint32_t *monit1_tag_en);

/* MONIT1 Tag Delay. This sets/gets the tag delay synchronization */
halcs_client_err_e halcs_set_monit1_tag_dly (halcs_client_t *self, char *service,
uint32_t monit1_tag_dly);
halcs_client_err_e halcs_get_monit1_tag_dly (halcs_client_t *self, char *service,
uint32_t *monit1_tag_dly);

/* MONIT1 Data Mask Enable. This sets/gets the MONIT1 masking of samples*/
halcs_client_err_e halcs_set_monit1_data_mask_en (halcs_client_t *self, char *service,
uint32_t monit1_data_mask_en);
halcs_client_err_e halcs_get_monit1_data_mask_en (halcs_client_t *self, char *service,
uint32_t *monit1_data_mask_en);

/* MONIT1 Data Mask. This sets/gets the MONIT1 mask to the specified number of samples at the beginning */
halcs_client_err_e halcs_set_monit1_data_mask_samples_beg (halcs_client_t *self, char *service,
uint32_t monit1_data_mask_samples_beg);
halcs_client_err_e halcs_get_monit1_data_mask_samples_beg (halcs_client_t *self, char *service,
uint32_t *monit1_data_mask_samples_beg);

/* MONIT1 Data Mask Ending. This sets/gets the MONIT1 mask to the specified number of samples at the end*/
halcs_client_err_e halcs_set_monit1_data_mask_samples_end (halcs_client_t *self, char *service,
uint32_t monit1_data_mask_samples_end);
halcs_client_err_e halcs_get_monit1_data_mask_samples_end (halcs_client_t *self, char *service,
uint32_t *monit1_data_mask_samples_end);

/* MONIT1 Tag Desync Counter Reset. This sets/gets the MONIT1 Tag desync counter reset */
halcs_client_err_e halcs_set_monit1_tag_desync_cnt_rst (halcs_client_t *self, char *service,
uint32_t monit1_tag_desync_cnt_rst);
halcs_client_err_e halcs_get_monit1_tag_desync_cnt_rst (halcs_client_t *self, char *service,
uint32_t *monit1_tag_desync_cnt_rst);

/* MONIT1 tag desync counter. This gets the Swithcing tag desync counter */
halcs_client_err_e halcs_get_monit1_tag_desync_cnt (halcs_client_t *self, char *service,
uint32_t *monit1_tag_desync_cnt);

/* MONIT Tag Enable. This sets/gets the tag synchronization */
/* All of the functions returns HALCS_CLIENT_SUCCESS if the
* parameter was correctly set or error (see halcs_client_err.h
* for all possible errors)*/
halcs_client_err_e halcs_set_monit_tag_en (halcs_client_t *self, char *service,
uint32_t monit_tag_en);
halcs_client_err_e halcs_get_monit_tag_en (halcs_client_t *self, char *service,
uint32_t *monit_tag_en);

/* MONIT Tag Delay. This sets/gets the tag delay synchronization */
halcs_client_err_e halcs_set_monit_tag_dly (halcs_client_t *self, char *service,
uint32_t monit_tag_dly);
halcs_client_err_e halcs_get_monit_tag_dly (halcs_client_t *self, char *service,
uint32_t *monit_tag_dly);

/* MONIT Data Mask Enable. This sets/gets the MONIT masking of samples*/
halcs_client_err_e halcs_set_monit_data_mask_en (halcs_client_t *self, char *service,
uint32_t monit_data_mask_en);
halcs_client_err_e halcs_get_monit_data_mask_en (halcs_client_t *self, char *service,
uint32_t *monit_data_mask_en);

/* MONIT Data Mask. This sets/gets the MONIT mask to the specified number of samples at the beginning */
halcs_client_err_e halcs_set_monit_data_mask_samples_beg (halcs_client_t *self, char *service,
uint32_t monit_data_mask_samples_beg);
halcs_client_err_e halcs_get_monit_data_mask_samples_beg (halcs_client_t *self, char *service,
uint32_t *monit_data_mask_samples_beg);

/* MONIT Data Mask Ending. This sets/gets the MONIT mask to the specified number of samples at the end*/
halcs_client_err_e halcs_set_monit_data_mask_samples_end (halcs_client_t *self, char *service,
uint32_t monit_data_mask_samples_end);
halcs_client_err_e halcs_get_monit_data_mask_samples_end (halcs_client_t *self, char *service,
uint32_t *monit_data_mask_samples_end);

/* MONIT Tag Desync Counter Reset. This sets/gets the MONIT Tag desync counter reset */
halcs_client_err_e halcs_set_monit_tag_desync_cnt_rst (halcs_client_t *self, char *service,
uint32_t monit_tag_desync_cnt_rst);
halcs_client_err_e halcs_get_monit_tag_desync_cnt_rst (halcs_client_t *self, char *service,
uint32_t *monit_tag_desync_cnt_rst);

/* MONIT tag desync counter. This gets the Swithcing tag desync counter */
halcs_client_err_e halcs_get_monit_tag_desync_cnt (halcs_client_t *self, char *service,
uint32_t *monit_tag_desync_cnt);

/********************** SWAP Functions ********************/

/* Switching functions */
Expand Down
Loading

0 comments on commit 4636c9f

Please sign in to comment.