代码取自no_os的ad9361_api.c文件。我们先来看看fastlock中发送部分的相关代码:
/**
* Store TX fastlock profile.
* To create a profile tune the synthesizer (ad9361_set_tx_lo_freq()) and then
* call this function specifying the target profile number.
* @param phy The AD9361 state structure.
* @param profile The profile number (0 - 7).
* Accepted values:
* 0 - 7
* @return 0 in case of success, negative error code otherwise.
*/
int32_t ad9361_tx_fastlock_store(struct ad9361_rf_phy *phy, uint32_t profile)
{
return ad9361_fastlock_store(phy, 1, profile);
}
/**
* Recall specified TX fastlock profile.
* When in fastlock pin select mode (init_param->tx_fastlock_pincontrol_enable),
* the function needs to be called before then the pin-control can be used.
* @param phy The AD9361 state structure.
* @param profile The profile number (0 - 7).
* Accepted values:
* 0 - 7
* @return 0 in case of success, negative error code otherwise.
*/
int32_t ad9361_tx_fastlock_recall(struct ad9361_rf_phy *phy, uint32_t profile)
{
return ad9361_fastlock_recall(phy, 1, profile);
}
/**
* Load TX fastlock profile. A previously saved profile can be loaded in any
* of the 8 available slots.
* @param phy The AD9361 state structure.
* @param profile The profile number (0 - 7).
* Accepted values:
* 0 - 7
* @param values Fastlock profile program data.
* Example:
* val0,val1,val2,聟,val15
* @return 0 in case of success, negative error code otherwise.
*/
int32_t ad9361_tx_fastlock_load(struct ad9361_rf_phy *phy, uint32_t profile, uint8_t *values)
{
return ad9361_fastlock_load(phy, 1, profile, values);
}
/**
* Save TX fastlock profile. In order to use more than 8 Profiles, an existing
* profile can be read back and stored by the user application.
* @param phy The AD9361 state structure.
* @param profile The profile number (0 - 7).
* Accepted values:
* 0 - 7
* @param values Fastlock profile program data.
* @return 0 in case of success, negative error code otherwise.
*/
int32_t ad9361_tx_fastlock_save(struct ad9361_rf_phy *phy, uint32_t profile, uint8_t *values)
{
return ad9361_fastlock_save(phy, 1, profile, values);
}
看到四个函数:ad9361_tx_fastlock_XXX
其中XXX 可以是:load,save,store,recall.
这里我们要知道三个对象:
用户程序USER_APP就是调用这些API函数的用户程序。
AD9361上的存储槽SLOT保存了FASTLOCK的配置。
AD9361的收发器,这个需要被配置。
三个关系如下图:
recall 是将slot制定序号profile的fastlock参数配置在收发器里。其中profile可以是0~7.
save 是将当前收发器fastlock参数的配置保存到profile是制定的slot里。其中profile可以是0~7.
如果我们要保存多于8个fast lock的fastlock参数配置,可以将slot指定序号profile的配置读出来保存在user_app的数据结构里。也就有了load和save.
load 从slot中取出制定profile的fastlock参数配置保存到用户程序。其中profile可以是0~7.
save是将用户程序的fastlock参数配置保存到slot制定的profile里。其中profile可以是0~7.
由于这些参数在从新开机或者上电时候就变得无效了,所以没有保存到文件的必要。如果要保存的fastlock配置不超过8个就可以用不到load和save函数。