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, uint32_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, uint32_t slice, float_t frequency, uint32_t core_clk_freq, uint32_t uart_clk_freq, uint32_t tx_rx_clock_source, uint32_t mask, uint32_t totalch, uint32_t protocol_version) |
| 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, uint32_t cmd) |
| Generate CDF command to be sent to encoder. Update encoder ID appropriately with nikon_update_enc_addr API. More... | |
| uint64_t | nikon_reverse_bits (uint64_t bits, uint32_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, uint8_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 specified 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. Default initial address is 0. More... | |
| void | nikon_update_eeprom_addr (struct nikon_priv *priv, uint8_t addr, uint32_t ls_ch) |
| Access encoder's EEPROM location specified by the user. More... | |
| void | nikon_update_eeprom_data (struct nikon_priv *priv, uint16_t data, uint32_t ls_ch) |
| Write data at specified EEPROM location. More... | |
| void | nikon_update_id_code (struct nikon_priv *priv, uint32_t data, uint32_t ls_ch) |
| Assign the specified 24bits as Identification code of encoder. More... | |
| void | nikon_update_velocity_coefficient (struct nikon_priv *priv, uint32_t data, uint32_t ls_ch) |
| Assign the specified 19 bits as velocity coefficient of encoder. More... | |
| void | nikon_update_eeprom_bank (struct nikon_priv *priv, uint8_t bank, uint32_t ls_ch) |
| Configure bank for memory operations in Nikon 3.0. 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, |
| uint32_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, |
| uint32_t | slice, | ||
| float_t | frequency, | ||
| uint32_t | core_clk_freq, | ||
| uint32_t | uart_clk_freq, | ||
| uint32_t | tx_rx_clock_source, | ||
| uint32_t | mask, | ||
| uint32_t | totalch, | ||
| uint32_t | protocol_version | ||
| ) |
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] | tx_rx_clock_source | Clock Source Selection |
| [in] | mask | Mask for the selected channels |
| [in] | totalch | Total number of selected channels |
| [in] | protocol_version | NIKON_PROTOCOL_V2_1 or NIKON_PROTOCOL_V3_0 |
| 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, |
| uint32_t | cmd | ||
| ) |
Generate CDF command to be sent to encoder. Update encoder ID appropriately with nikon_update_enc_addr API.
| [in] | priv | cookie returned by nikon_init |
| [in] | cmd | command code requested by the user. |
| uint64_t nikon_reverse_bits | ( | uint64_t | bits, |
| uint32_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, |
| uint8_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 specified 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. Default initial address is 0.
| [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 or 0 in case of single channel mode |
| void nikon_update_eeprom_addr | ( | struct nikon_priv * | priv, |
| uint8_t | addr, | ||
| uint32_t | ls_ch | ||
| ) |
Access encoder's EEPROM location specified by the user.
| [in] | priv | cookie returned by nikon_init |
| [in] | addr | EEPROM address (Bits [7:0] in addr) |
| [in] | ls_ch | channel in use in load share or 0 in case of single channel mode |
| void nikon_update_eeprom_data | ( | struct nikon_priv * | priv, |
| uint16_t | data, | ||
| uint32_t | ls_ch | ||
| ) |
Write data at specified EEPROM location.
| [in] | priv | cookie returned by nikon_init |
| [in] | data | data to write at EEPROM location (Bits [15:0] in data) |
| [in] | ls_ch | channel in use in load share or 0 in case of single channel mode |
| void nikon_update_id_code | ( | struct nikon_priv * | priv, |
| uint32_t | data, | ||
| uint32_t | ls_ch | ||
| ) |
Assign the specified 24bits as Identification code of encoder.
| [in] | priv | cookie returned by nikon_init |
| [in] | data | data to assign as ID code (Bits [23:0] in data will be used) |
| [in] | ls_ch | channel in use in load share or 0 in case of single channel mode |
| void nikon_update_velocity_coefficient | ( | struct nikon_priv * | priv, |
| uint32_t | data, | ||
| uint32_t | ls_ch | ||
| ) |
Assign the specified 19 bits as velocity coefficient of encoder.
| [in] | priv | cookie returned by nikon_init |
| [in] | data | data to assign as velocity coefficient (Bits [18:0] in data will be used) |
| [in] | ls_ch | channel in use in load share or 0 in case of single channel mode |
| void nikon_update_eeprom_bank | ( | struct nikon_priv * | priv, |
| uint8_t | bank, | ||
| uint32_t | ls_ch | ||
| ) |
Configure bank for memory operations in Nikon 3.0.
| [in] | priv | Cookie returned by nikon_init |
| [in] | bank | Bank number to be set (Bits [7:0] in bank) |
| [in] | ls_ch | channel in use in load share or 0 in case of single channel mode |