Here is the list of APIs used for Tamagawa encoder communication protocol
Data Structures | |
struct | tamagawa_ch_info |
Structure defining tamagawa per channel interface. More... | |
struct | tamagawa_cmd |
Structure defining Tamagawa command interface. More... | |
struct | tamagawa_config |
Structure defining Tamagawa configuration interface. More... | |
struct | rx_frames_received |
Tamagawa Interface Received data. More... | |
struct | tamagawa_interface |
Tamagawa Interface. More... | |
struct | config |
struct | tamagawa_eeprom_interface |
Tamagawa EEPROM Interface. More... | |
struct | tamagawa_xchg |
Structure defining Tamagawa interface. More... | |
struct | tamagawa_clk_cfg |
Used to configure the Tamagawa Clock. More... | |
struct | register_offsets |
Used to store the register offsets depending on different PRU slices. More... | |
struct | tamagawa_priv |
Used to structures defining the Tamagawa interface, PRU slice and register offsets. More... | |
Functions | |
int32_t | tamagawa_command_process (struct tamagawa_priv *priv, int32_t cmd, uint8_t gTamagawa_multi_ch_mask) |
send the tamagawa command and wait till firmware acknowledges More... | |
int32_t | tamagawa_command_build (struct tamagawa_priv *priv, int32_t cmd, uint8_t gTamagawa_multi_ch_mask) |
setup the tamagawa command in the PRU interface buffer More... | |
void | tamagawa_command_send (struct tamagawa_priv *priv) |
trigger sending the tamagawa command in PRU More... | |
void | tamagawa_command_wait (struct tamagawa_priv *priv) |
wait till PRU finishes tamagawa transaction More... | |
void | tamagawa_config_clock (struct tamagawa_priv *priv, struct tamagawa_clk_cfg *clk_cfg) |
configure tamagawa clock More... | |
void | tamagawa_config_host_trigger (struct tamagawa_priv *priv) |
configure tamagawa master for host trigger mode More... | |
void | tamagawa_config_periodic_trigger (struct tamagawa_priv *priv) |
configure tamagawa master in periodic trigger mode More... | |
void | tamagawa_config_channel (struct tamagawa_priv *priv, uint32_t ch) |
select channel to be used by tamagawa master More... | |
void | tamagawa_config_multi_channel_mask (struct tamagawa_priv *priv, uint8_t mask) |
select mask of channels to be used in multi channel configuration by tamagawa master More... | |
uint8_t | tamagawa_multi_channel_detected (struct tamagawa_priv *priv) |
select channels detected in multi channel configuration by tamagawa master. required to be invoked only if firmware indicates initialization failure to know the channels that has been detected. Initialization success implies that all channels indicated has been detected. More... | |
void | tamagawa_multi_channel_set_cur (struct tamagawa_priv *priv, uint32_t ch) |
In multi channel configuration, select channel before receive processing in multi channel configuration. After receive is complete, select each channel and invoke rx API's to parse data recieved in each channel. More... | |
struct tamagawa_priv * | tamagawa_init (struct tamagawa_xchg *tamagawa_xchg, void *pruss_cfg, uint32_t slice_value) |
Initialize tamagawa firmware interface address and get the pointer to struct tamagawa_priv instance. More... | |
void | tamagawa_update_data_id (struct tamagawa_priv *priv, int32_t cmd) |
update the current requested command id in tamagawa interface. More... | |
void | tamagawa_update_adf (struct tamagawa_priv *priv, uint32_t val, uint32_t ch) |
update the adf(address of EEPROM) field entered by user for EEPROM command in tamagawa interface. More... | |
void | tamagawa_update_edf (struct tamagawa_priv *priv, uint32_t val, uint32_t ch) |
update the edf(data for EEPROM) field entered by user for EEPROM command in tamagawa interface. More... | |
int32_t | tamagawa_parse (int32_t cmd, struct tamagawa_priv *priv) |
Parse the data in tamagawa interface. More... | |
int32_t | tamagawa_crc_verify (struct tamagawa_priv *priv) |
verify the CRC computed with the encoder crc. More... | |
void | tamagawa_update_crc (struct tamagawa_priv *priv, int32_t cmd, uint32_t ch) |
Pass the values of CF(Control Field), ADF(address of EEPROM) and EDF(data for EEPROM) to the CRC calculator fucntion and update the CRC field. More... | |
void | tamagawa_set_baudrate (struct tamagawa_priv *priv, double baudrate) |
Update the values for oversample rate and division factor for Tx and Rx. More... | |
void | tamagawa_eeprom_crc_reinit (struct tamagawa_priv *priv) |
Reset the values of the variables used in CRC calculation to 0. More... | |
uint32_t | tamagawa_reverse_bits (int8_t data) |
Reverse the bits of a number. More... | |
uint64_t | tamagawa_prepare_eeprom_tx_data (uint64_t eeprom_tx_data, volatile uint32_t data) |
Add the start and the stop bit to the reversed data. More... | |
void | tamagawa_prepare_eeprom_command (struct tamagawa_priv *priv, int32_t cmd, uint32_t ch) |
Prepare the required EEPROM command from the CF(Control Field), ADF(address of EEPROM) and EDF(data for EEPROM). More... | |
Enumerations | |
enum | data_id { DATA_ID_0, DATA_ID_1, DATA_ID_2, DATA_ID_3, DATA_ID_6, DATA_ID_7, DATA_ID_8, DATA_ID_C, DATA_ID_D, DATA_ID_NUM } |
Data ID codes. More... | |
Macros | |
#define | TAMAGAWA_MULTI_CH0 (1 << 0) |
Used to set the value of Tamagawa multi-channel mask based on the whether the Channel 0 is selected or not. More... | |
#define | TAMAGAWA_MULTI_CH1 (1 << 1) |
Used to set the value of Tamagawa multi-channel mask based on the whether the Channel 1 is selected or not. More... | |
#define | TAMAGAWA_MULTI_CH2 (1 << 2) |
Used to set the value of Tamagawa multi-channel mask based on the whether the Channel 2 is selected or not. More... | |
#define | MAX_CHANNELS (3) |
Used to set the maximum channels supported. More... | |
#define | MAX_EEPROM_ADDRESS (127) |
Used to set the maximum address that can be used for EEPROM Read/Write. More... | |
#define | MAX_EEPROM_WRITE_DATA (255) |
Used to set the maximum value that can be written in EEPROM. More... | |
#define TAMAGAWA_MULTI_CH0 (1 << 0) |
Used to set the value of Tamagawa multi-channel mask based on the whether the Channel 0 is selected or not.
#define TAMAGAWA_MULTI_CH1 (1 << 1) |
Used to set the value of Tamagawa multi-channel mask based on the whether the Channel 1 is selected or not.
#define TAMAGAWA_MULTI_CH2 (1 << 2) |
Used to set the value of Tamagawa multi-channel mask based on the whether the Channel 2 is selected or not.
#define MAX_CHANNELS (3) |
Used to set the maximum channels supported.
#define MAX_EEPROM_ADDRESS (127) |
Used to set the maximum address that can be used for EEPROM Read/Write.
#define MAX_EEPROM_WRITE_DATA (255) |
Used to set the maximum value that can be written in EEPROM.
enum data_id |
Data ID codes.
int32_t tamagawa_command_process | ( | struct tamagawa_priv * | priv, |
int32_t | cmd, | ||
uint8_t | gTamagawa_multi_ch_mask | ||
) |
send the tamagawa command and wait till firmware acknowledges
[in] | priv | cookie returned by tamagawa_init |
[in] | cmd | tamagawa command number |
[in] | gTamagawa_multi_ch_mask | Multi-channel mask to keep track of which channels are selected |
0 | success |
-EINVAL | failure |
int32_t tamagawa_command_build | ( | struct tamagawa_priv * | priv, |
int32_t | cmd, | ||
uint8_t | gTamagawa_multi_ch_mask | ||
) |
setup the tamagawa command in the PRU interface buffer
[in] | priv | cookie returned by tamagawa_init |
[in] | cmd | tamagawa command number |
[in] | gTamagawa_multi_ch_mask | Multi-channel mask to keep track of which channels are selected |
0 | success |
-EINVAL | failure |
void tamagawa_command_send | ( | struct tamagawa_priv * | priv | ) |
trigger sending the tamagawa command in PRU
[in] | priv | cookie returned by tamagawa_init |
void tamagawa_command_wait | ( | struct tamagawa_priv * | priv | ) |
wait till PRU finishes tamagawa transaction
[in] | priv | cookie returned by tamagawa_init |
void tamagawa_config_clock | ( | struct tamagawa_priv * | priv, |
struct tamagawa_clk_cfg * | clk_cfg | ||
) |
configure tamagawa clock
[in] | priv | cookie returned by tamagawa_init |
[in] | clk_cfg | pointer to structure containing clock configuration data |
void tamagawa_config_host_trigger | ( | struct tamagawa_priv * | priv | ) |
configure tamagawa master for host trigger mode
[in] | priv | cookie returned by tamagawa_init |
void tamagawa_config_periodic_trigger | ( | struct tamagawa_priv * | priv | ) |
configure tamagawa master in periodic trigger mode
[in] | priv | cookie returned by tamagawa_init |
void tamagawa_config_channel | ( | struct tamagawa_priv * | priv, |
uint32_t | ch | ||
) |
select channel to be used by tamagawa master
[in] | priv | cookie returned by tamagawa_init |
[in] | ch | channel to be selected |
void tamagawa_config_multi_channel_mask | ( | struct tamagawa_priv * | priv, |
uint8_t | mask | ||
) |
select mask of channels to be used in multi channel configuration by tamagawa master
[in] | priv | cookie returned by tamagawa_init |
[in] | mask | channel mask |
uint8_t tamagawa_multi_channel_detected | ( | struct tamagawa_priv * | priv | ) |
select channels detected in multi channel configuration by tamagawa master.
required to be invoked only if firmware indicates initialization failure
to know the channels that has been detected. Initialization success implies
that all channels indicated has been detected.
[in] | priv | cookie returned by tamagawa_init |
mask | mask of the detected channels |
void tamagawa_multi_channel_set_cur | ( | struct tamagawa_priv * | priv, |
uint32_t | ch | ||
) |
In multi channel configuration, select channel before receive processing in
multi channel configuration. After receive is complete, select each channel
and invoke rx API's to parse data recieved in each channel.
[in] | priv | cookie returned by tamagawa_init |
[in] | ch | channel number to be selected |
struct tamagawa_priv* tamagawa_init | ( | struct tamagawa_xchg * | tamagawa_xchg, |
void * | pruss_cfg, | ||
uint32_t | slice_value | ||
) |
Initialize tamagawa firmware interface address and get the pointer to struct tamagawa_priv instance.
[in] | tamagawa_xchg | tamagawa firmware interface address |
[in] | pruss_cfg | ICSS PRU config base address |
[in] | slice_value | PRUx slice value : 0 for PRU0 and 1 for PRU1 |
priv | pointer to struct tamagawa_priv instance |
void tamagawa_update_data_id | ( | struct tamagawa_priv * | priv, |
int32_t | cmd | ||
) |
update the current requested command id in tamagawa interface.
[in] | priv | cookie returned by tamagawa_init |
[in] | cmd | tamagawa command number |
void tamagawa_update_adf | ( | struct tamagawa_priv * | priv, |
uint32_t | val, | ||
uint32_t | ch | ||
) |
update the adf(address of EEPROM) field entered by user for EEPROM command in tamagawa interface.
[in] | priv | cookie returned by tamagawa_init |
[in] | val | ADF value to be updated |
[in] | ch | channel number that is currently selected |
void tamagawa_update_edf | ( | struct tamagawa_priv * | priv, |
uint32_t | val, | ||
uint32_t | ch | ||
) |
update the edf(data for EEPROM) field entered by user for EEPROM command in tamagawa interface.
[in] | priv | cookie returned by tamagawa_init |
[in] | val | EDF value to be updated |
[in] | ch | channel number that is currently selected |
int32_t tamagawa_parse | ( | int32_t | cmd, |
struct tamagawa_priv * | priv | ||
) |
Parse the data in tamagawa interface.
[in] | cmd | tamagawa command number |
[in] | priv | cookie returned by tamagawa_init |
int32_t tamagawa_crc_verify | ( | struct tamagawa_priv * | priv | ) |
verify the CRC computed with the encoder crc.
[in] | priv | cookie returned by tamagawa_init |
1/0 | if verify correctly, return 1 else return 0. |
void tamagawa_update_crc | ( | struct tamagawa_priv * | priv, |
int32_t | cmd, | ||
uint32_t | ch | ||
) |
Pass the values of CF(Control Field), ADF(address of EEPROM) and EDF(data for EEPROM) to the CRC calculator fucntion and update the CRC field.
[in] | priv | cookie returned by tamagawa_init |
[in] | cmd | tamagawa command number |
[in] | ch | channel number that is currently selected |
void tamagawa_set_baudrate | ( | struct tamagawa_priv * | priv, |
double | baudrate | ||
) |
Update the values for oversample rate and division factor for Tx and Rx.
[in] | priv | cookie returned by tamagawa_init |
[in] | baudrate | baud rate of the tamagawa encoder |
void tamagawa_eeprom_crc_reinit | ( | struct tamagawa_priv * | priv | ) |
Reset the values of the variables used in CRC calculation to 0.
[in] | priv | cookie returned by tamagawa_init |
uint32_t tamagawa_reverse_bits | ( | int8_t | data | ) |
Reverse the bits of a number.
[in] | data | 8 bit value for any of CF(Control Field), ADF(address of EEPROM) or EDF(data for EEPROM) |
reversed_num | number obtained after reversing the bits of data provided |
uint64_t tamagawa_prepare_eeprom_tx_data | ( | uint64_t | eeprom_tx_data, |
volatile uint32_t | data | ||
) |
Add the start and the stop bit to the reversed data.
[in] | eeprom_tx_data | holds the value of the Tx data to be sent |
[in] | data | holds the value of CF(Control Field), ADF(address of EEPROM) or EDF(data for EEPROM) |
eeprom_tx_data | 64 bit integer that holds the value of the Tx data to be sent |
void tamagawa_prepare_eeprom_command | ( | struct tamagawa_priv * | priv, |
int32_t | cmd, | ||
uint32_t | ch | ||
) |
Prepare the required EEPROM command from the CF(Control Field), ADF(address of EEPROM) and EDF(data for EEPROM).
[in] | priv | cookie returned by tamagawa_init |
[in] | cmd | tamagawa command number |
[in] | ch | channel number that is currently selected |