AM243x Motor Control SDK  09.01.00
bissc_api.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef BISSC_API_H_
34 #define BISSC_API_H_
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 #include "bissc_drv.h"
40 
58 int32_t bissc_command_process(struct bissc_priv *priv);
59 
67 void bissc_command_send(struct bissc_priv *priv);
68 
76 int32_t bissc_command_wait(struct bissc_priv *priv);
77 
84 int32_t bissc_get_pos(struct bissc_priv *priv);
85 
93 void bissc_config_clock(struct bissc_priv *priv,
94  struct bissc_clk_cfg *clk_cfg);
95 
104 void bissc_config_channel(struct bissc_priv *priv, int32_t mask, int32_t totalch);
112 void bissc_config_load_share(struct bissc_priv *priv, int32_t mask);
127 void bissc_config_primary_core_mask(struct bissc_priv *priv, uint8_t mask);
137 int32_t bissc_wait_for_fw_initialization(struct bissc_priv *priv, uint32_t timeout, uint8_t mask);
138 
145 void bissc_hw_init(struct bissc_priv *priv);
146 
160 struct bissc_priv *bissc_init(PRUICSS_Handle gPruIcssXHandle,
161  int32_t slice,
162  uint32_t frequency,
163  uint32_t core_clk_freq,
164  uint32_t uart_clk_freq);
165 
181 int32_t bissc_wait_measure_proc_delay(struct bissc_priv *priv, uint32_t timeout);
182 
190 void bissc_set_default_initialization(struct bissc_priv *priv, uint64_t icssgclk);
199 void bissc_update_data_len(struct bissc_priv *priv, uint32_t single_turn_len[], uint32_t multi_turn_len[], int32_t num_pru);
200 
208 int32_t bissc_set_ctrl_cmd_and_process(struct bissc_priv *priv, uint32_t ctrl_cmd[]);
233 int32_t bissc_calc_clock(struct bissc_priv *priv, struct bissc_clk_cfg *clk_cfg);
236 #ifdef __cplusplus
237 }
238 #endif
239 
240 #endif
bissc_get_pos
int32_t bissc_get_pos(struct bissc_priv *priv)
Get single cycle BiSS-C position data.
bissc_hw_init
void bissc_hw_init(struct bissc_priv *priv)
Initialize BiSSC hardware interface.
bissc_set_default_initialization
void bissc_set_default_initialization(struct bissc_priv *priv, uint64_t icssgclk)
Set default configuration parameters for BiSSC Master firmware.
bissc_command_process
int32_t bissc_command_process(struct bissc_priv *priv)
Send the BiSSC command and wait till firmware acknowledges.
bissc_calc_clock
int32_t bissc_calc_clock(struct bissc_priv *priv, struct bissc_clk_cfg *clk_cfg)
Calculate Rx and Tx divisors for given frequency.
bissc_config_channel
void bissc_config_channel(struct bissc_priv *priv, int32_t mask, int32_t totalch)
Select channel to be used by BiSSC master.
bissc_config_load_share
void bissc_config_load_share(struct bissc_priv *priv, int32_t mask)
Configure the channels to be used by BiSSC master.
bissc_enable_load_share_mode
void bissc_enable_load_share_mode(struct bissc_priv *priv)
Enable load share mode for BiSSC master.
bissc_priv
Initialize BiSS-C firmware interface address and get the pointer to struct bissc_priv instance.
Definition: bissc_drv.h:142
bissc_config_primary_core_mask
void bissc_config_primary_core_mask(struct bissc_priv *priv, uint8_t mask)
Configure the primary core for load share mode.
bissc_update_data_len
void bissc_update_data_len(struct bissc_priv *priv, uint32_t single_turn_len[], uint32_t multi_turn_len[], int32_t num_pru)
Update data length with encoder bit width for BiSSC Master firmware.
bissc_update_max_proc_delay
void bissc_update_max_proc_delay(struct bissc_priv *priv)
Update max processing time and bit index to poll in fifo data.
bissc_get_enc_proc_delay
void bissc_get_enc_proc_delay(struct bissc_priv *priv)
Get measured processing delay of individual channel.
bissc_config_endat_mode
void bissc_config_endat_mode(struct bissc_priv *priv)
Configure the master for EnDat mode.
bissc_command_send
void bissc_command_send(struct bissc_priv *priv)
Trigger sending the BiSSC command in PRU.
bissc_wait_for_fw_initialization
int32_t bissc_wait_for_fw_initialization(struct bissc_priv *priv, uint32_t timeout, uint8_t mask)
Wait for BiSSC master firmware to initialize.
bissc_config_clr_cfg0
void bissc_config_clr_cfg0(struct bissc_priv *priv)
Clear the channel specific frame size cfg registers.
bissc_command_wait
int32_t bissc_command_wait(struct bissc_priv *priv)
Wait till PRU finishes BiSSC transaction.
bissc_priv::multi_turn_len
int32_t multi_turn_len[NUM_ED_CH_MAX][NUM_ENCODERS_MAX]
Definition: bissc_drv.h:151
bissc_priv::core_clk_freq
uint32_t core_clk_freq
Definition: bissc_drv.h:179
bissc_init
struct bissc_priv * bissc_init(PRUICSS_Handle gPruIcssXHandle, int32_t slice, uint32_t frequency, uint32_t core_clk_freq, uint32_t uart_clk_freq)
Initialize BiSSC firmware interface address and get the pointer to struct bissc_priv instance.
bissc_clk_cfg
Structure defining EnDat clock configuration for selected frequency.
Definition: bissc_drv.h:90
bissc_config_clock
void bissc_config_clock(struct bissc_priv *priv, struct bissc_clk_cfg *clk_cfg)
Configure EnDat clock.
bissc_set_ctrl_cmd_and_process
int32_t bissc_set_ctrl_cmd_and_process(struct bissc_priv *priv, uint32_t ctrl_cmd[])
Set control command and process the ctrl communication read/write.
bissc_drv.h
bissc_wait_measure_proc_delay
int32_t bissc_wait_measure_proc_delay(struct bissc_priv *priv, uint32_t timeout)
Wait for BiSSC master firmware to measure processing time.
bissc_priv::single_turn_len
int32_t single_turn_len[NUM_ED_CH_MAX][NUM_ENCODERS_MAX]
Definition: bissc_drv.h:149
bissc_priv::uart_clk_freq
uint32_t uart_clk_freq
Definition: bissc_drv.h:181