Here is the list of APIs used for Nikon A-Format encoder communication protocol
Functions | |
int32_t | nikon_command_wait (struct nikon_priv *priv) |
Wait till PRU finishes Nikon transaction. More... | |
int32_t | nikon_get_pos (struct nikon_priv *priv, int8_t cmd) |
Get single cycle Nikon position data. More... | |
void | nikon_config_clock (struct nikon_priv *priv, struct nikon_clk_cfg *clk_cfg) |
Configure Nikon clock. More... | |
struct nikon_priv * | nikon_init (PRUICSS_Handle gPruIcssXHandle, int32_t slice, float_t frequency, uint32_t core_clk_freq, uint32_t uart_clk_freq, uint32_t mask, uint32_t totalch) |
Initialize Nikon firmware interface address and get the pointer to struct nikon_priv instance. More... | |
void | nikon_config_clr_cfg0 (struct nikon_priv *priv) |
Clear the channel specific frame size cfg registers. More... | |
int32_t | nikon_calc_clock (struct nikon_priv *priv, struct nikon_clk_cfg *clk_cfg) |
Calculate Rx and Tx divisors for given frequency. More... | |
void | nikon_generate_cdf (struct nikon_priv *priv, int32_t cmd) |
Generate CDF command to be passed in Tx fifo. More... | |
int32_t | nikon_reverse_bits (uint64_t bits, int32_t num_bits) |
Reverse the bits (LSB to be sent out first) provided as parameters. More... | |
uint32_t | nikon_calc_3bitcrc (struct nikon_priv *priv, uint32_t cmd) |
Calculate 3 bit otf crc and generate tx command. More... | |
void | nikon_config_load_share (struct nikon_priv *priv, int32_t mask) |
Configure Load Share mode for Nikon receiver. More... | |
void | nikon_config_periodic_trigger (struct nikon_priv *priv) |
Configure periodic trigger operation mode. More... | |
void | nikon_config_host_trigger (struct nikon_priv *priv) |
Configure host trigger operation mode. More... | |
int32_t | nikon_wait_for_encoder_detection (struct nikon_priv *priv) |
Detect whether the connected encoder is of selected frequency. More... | |
void | nikon_update_enc_len (struct nikon_priv *priv, uint32_t num_encoders, uint32_t single_turn_len[], uint32_t multi_turn_len[], uint32_t ch) |
Update number of encoders connected in bus or one-to-one and update data lengths of those encoders. More... | |
void | nikon_update_clock_freq (struct nikon_priv *priv, float_t frequency) |
Update the operating baud rate as user speciefied baud rate through UART menu. More... | |
uint32_t | nikon_get_current_channel (struct nikon_priv *priv, uint32_t ch_idx) |
Retrives the current channel in use. More... | |
uint32_t | nikon_get_totalchannels (struct nikon_priv *priv) |
Retrives total number of channels configured. More... | |
void | nikon_update_enc_addr (struct nikon_priv *priv, uint32_t enc_addr, uint32_t ls_ch) |
Update encoder address as specified by the user. More... | |
void | nikon_update_eeprom_addr (struct nikon_priv *priv, uint32_t addr) |
Access encoder's EEPROM location specified by the user. More... | |
void | nikon_update_eeprom_data (struct nikon_priv *priv, uint32_t data_high, uint32_t data_low) |
Write data at specified EEPROM location. More... | |
void | nikon_update_id_code (struct nikon_priv *priv, uint32_t data_high, uint32_t data_mid, uint32_t data_low) |
Assign the specified 24bits as Identification code of encoder. More... | |
int32_t nikon_command_wait | ( | struct nikon_priv * | priv | ) |
Wait till PRU finishes Nikon transaction.
[in] | priv | cookie returned by nikon_init |
int32_t nikon_get_pos | ( | struct nikon_priv * | priv, |
int8_t | cmd | ||
) |
Get single cycle Nikon position data.
[in] | priv | cookie returned by nikon_init |
[in] | cmd | command code specified by user |
void nikon_config_clock | ( | struct nikon_priv * | priv, |
struct nikon_clk_cfg * | clk_cfg | ||
) |
Configure Nikon clock.
[in] | priv | cookie returned by nikon_init |
[in] | clk_cfg | pointer to structure containing clock configuration data |
struct nikon_priv* nikon_init | ( | PRUICSS_Handle | gPruIcssXHandle, |
int32_t | slice, | ||
float_t | frequency, | ||
uint32_t | core_clk_freq, | ||
uint32_t | uart_clk_freq, | ||
uint32_t | mask, | ||
uint32_t | totalch | ||
) |
Initialize Nikon firmware interface address and get the pointer to struct nikon_priv instance.
[in] | gPruIcssXHandle | Nikon firmware interface address |
[in] | slice | ICSS PRU SLICE |
[in] | frequency | Input frequency |
[in] | core_clk_freq | Core clock frequency |
[in] | uart_clk_freq | Uart clock frequency |
[in] | mask | Mask for the selected channels |
[in] | totalch | Total number of selected channels |
priv | pointer to struct nikon_priv instance |
void nikon_config_clr_cfg0 | ( | struct nikon_priv * | priv | ) |
Clear the channel specific frame size cfg registers.
[in] | priv | cookie returned by nikon_init |
int32_t nikon_calc_clock | ( | struct nikon_priv * | priv, |
struct nikon_clk_cfg * | clk_cfg | ||
) |
Calculate Rx and Tx divisors for given frequency.
[in] | priv | cookie returned by nikon_init |
[in] | clk_cfg | pointer to structure containing clock configuration data. |
void nikon_generate_cdf | ( | struct nikon_priv * | priv, |
int32_t | cmd | ||
) |
Generate CDF command to be passed in Tx fifo.
[in] | priv | cookie returned by nikon_init |
[in] | cmd | command code requested by the user. |
int32_t nikon_reverse_bits | ( | uint64_t | bits, |
int32_t | num_bits | ||
) |
Reverse the bits (LSB to be sent out first) provided as parameters.
[in] | bits | field to be reversed as specified by the user. |
[in] | num_bits | width of field to be reversed. |
res | return the reversed field. |
uint32_t nikon_calc_3bitcrc | ( | struct nikon_priv * | priv, |
uint32_t | cmd | ||
) |
Calculate 3 bit otf crc and generate tx command.
[in] | priv | cookie returned by nikon_init |
[in] | cmd | cdf or mdf command to be included in 3 bit crc calculation. |
void nikon_config_load_share | ( | struct nikon_priv * | priv, |
int32_t | mask | ||
) |
Configure Load Share mode for Nikon receiver.
[in] | priv | cookie returned by nikon_init |
[in] | mask | channel mask |
void nikon_config_periodic_trigger | ( | struct nikon_priv * | priv | ) |
Configure periodic trigger operation mode.
[in] | priv | cookie returned by nikon_init |
void nikon_config_host_trigger | ( | struct nikon_priv * | priv | ) |
Configure host trigger operation mode.
[in] | priv | cookie returned by nikon_init |
int32_t nikon_wait_for_encoder_detection | ( | struct nikon_priv * | priv | ) |
Detect whether the connected encoder is of selected frequency.
[in] | priv | cookie returned by nikon_init |
void nikon_update_enc_len | ( | struct nikon_priv * | priv, |
uint32_t | num_encoders, | ||
uint32_t | single_turn_len[], | ||
uint32_t | multi_turn_len[], | ||
uint32_t | ch | ||
) |
Update number of encoders connected in bus or one-to-one and update data lengths of those encoders.
[in] | priv | cookie returned by nikon_init |
[in] | num_encoders | number of encoders connected to each channel |
[in] | single_turn_len | Encoder's single turn resolution |
[in] | multi_turn_len | Encoder's multi turn resolution |
[in] | ch | channel in use |
void nikon_update_clock_freq | ( | struct nikon_priv * | priv, |
float_t | frequency | ||
) |
Update the operating baud rate as user speciefied baud rate through UART menu.
[in] | priv | cookie returned by nikon_init |
[in] | frequency | frequency as specified by the user |
uint32_t nikon_get_current_channel | ( | struct nikon_priv * | priv, |
uint32_t | ch_idx | ||
) |
Retrives the current channel in use.
[in] | priv | cookie returned by nikon_init |
[in] | ch_idx | index of current channel to be selected |
channel[ch_idx] | current channel in use |
uint32_t nikon_get_totalchannels | ( | struct nikon_priv * | priv | ) |
Retrives total number of channels configured.
[in] | priv | cookie returned by nikon_init |
totalchannels | total number of channels configured |
void nikon_update_enc_addr | ( | struct nikon_priv * | priv, |
uint32_t | enc_addr, | ||
uint32_t | ls_ch | ||
) |
Update encoder address as specified by the user.
[in] | priv | cookie returned by nikon_init |
[in] | enc_addr | encoder address specified by the user |
[in] | ls_ch | channel in use in load share |
void nikon_update_eeprom_addr | ( | struct nikon_priv * | priv, |
uint32_t | addr | ||
) |
Access encoder's EEPROM location specified by the user.
[in] | priv | cookie returned by nikon_init |
[in] | addr | EEPROM address specified by the user |
void nikon_update_eeprom_data | ( | struct nikon_priv * | priv, |
uint32_t | data_high, | ||
uint32_t | data_low | ||
) |
Write data at specified EEPROM location.
[in] | priv | cookie returned by nikon_init |
[in] | data_high | upper byte of data to write at EEPROM location |
[in] | data_low | lower byte of data to write at EEPROM location |
void nikon_update_id_code | ( | struct nikon_priv * | priv, |
uint32_t | data_high, | ||
uint32_t | data_mid, | ||
uint32_t | data_low | ||
) |
Assign the specified 24bits as Identification code of encoder.
[in] | priv | cookie returned by nikon_init |
[in] | data_high | Upper byte to assign as ID code[23 : 16] |
[in] | data_mid | Middle byte to assign as ID code[15 : 8] |
[in] | data_low | Lower byte to assign as ID code[7 : 0] |