本文整理汇总了C++中FMR_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ FMR_ASSERT函数的具体用法?C++ FMR_ASSERT怎么用?C++ FMR_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FMR_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bt_host_rfkill_path_get
static int bt_host_rfkill_path_get(int *bt_id, char **state_path)
{
char path[128];
char buf[32];
int fd, id;
ssize_t sz;
FMR_ASSERT(bt_id);
FMR_ASSERT(state_path);
for(id = 0; id < 10 ; id++){
snprintf(path, sizeof(path), "/sys/class/rfkill/rfkill%d/type", id);
fd = open(path, O_RDONLY);
if(fd < 0){
LOGE("open(%s) failed\n", path);
return -1;
}
sz = read(fd, &buf, sizeof(buf));
close(fd);
if(sz >= 9 && (memcmp(buf, "bluetooth", 9) == 0)){
*bt_id = id;
break;
}
}
if (id == 10)
return -1;
asprintf(state_path, "/sys/class/rfkill/rfkill%d/state", *bt_id);
return 0;
}
示例2: fm_workthread_add_work
static fm_s32 fm_workthread_add_work(struct fm_workthread *thiz, struct fm_work *work)
{
FMR_ASSERT(thiz);
FMR_ASSERT(work);
queue_work((struct workqueue_struct *)thiz->priv, (struct work_struct *)work->priv);
return 0;
}
示例3: fm_spin_lock_unlock
static fm_s32 fm_spin_lock_unlock(struct fm_lock *thiz)
{
struct task_struct *task = current;
FMR_ASSERT(thiz);
FMR_ASSERT(thiz->priv);
FM_LOG_DBG(MAIN, "%s <---unlock, pid=%d\n", thiz->name, task->pid);
spin_unlock_bh((spinlock_t *) thiz->priv);
return 0;
}
示例4: fm_lock_unlock
static fm_s32 fm_lock_unlock(struct fm_lock *thiz)
{
struct semaphore *sem;
struct task_struct *task = current;
FMR_ASSERT(thiz);
FMR_ASSERT(thiz->priv);
sem = (struct semaphore *)thiz->priv;
FM_LOG_DBG(MAIN, "%s <---unlock, cnt=%d, pid=%d\n", thiz->name, (int)sem->count + 1, task->pid);
up((struct semaphore *)thiz->priv);
return 0;
}
示例5: fm_lock_lock
/* fm try lock methods */
static fm_s32 fm_lock_lock(struct fm_lock *thiz)
{
struct semaphore *sem;
struct task_struct *task = current;
FMR_ASSERT(thiz);
FMR_ASSERT(thiz->priv);
if (down_interruptible((struct semaphore *)thiz->priv)) {
WCN_DBG(FM_CRT | MAIN, "get mutex failed\n");
return -FM_ELOCK;
}
sem = (struct semaphore *)thiz->priv;
FM_LOG_DBG(MAIN, "%s --->lock, cnt=%d, pid=%d\n", thiz->name, (int)sem->count, task->pid);
return 0;
}
示例6: fm_cust_config_default
static fm_s32 fm_cust_config_default(fm_cust_cfg *cfg)
{
FMR_ASSERT(cfg);
#if (!defined(MT6628_FM) && !defined(MT6620_FM) && !defined(MT6627_FM) && !defined(MT6580_FM) && !defined(MT6630_FM))
cfg->rx_cfg.long_ana_rssi_th = FM_RX_RSSI_TH_LONG;
cfg->rx_cfg.short_ana_rssi_th = FM_RX_RSSI_TH_SHORT;
cfg->rx_cfg.cqi_th = FM_RX_CQI_TH;
cfg->rx_cfg.mr_th = FM_RX_MR_TH;
cfg->rx_cfg.smg_th = FM_RX_SMG_TH;
cfg->rx_cfg.scan_ch_size = FM_RX_SCAN_CH_SIZE;
cfg->rx_cfg.seek_space = FM_RX_SEEK_SPACE;
cfg->rx_cfg.band = FM_RX_BAND;
cfg->rx_cfg.band_freq_l = FM_RX_BAND_FREQ_L;
cfg->rx_cfg.band_freq_h = FM_RX_BAND_FREQ_H;
cfg->rx_cfg.scan_sort = FM_RX_SCAN_SORT_SELECT;
cfg->rx_cfg.fake_ch_num = FM_RX_FAKE_CH_NUM;
cfg->rx_cfg.fake_ch_rssi_th = FM_RX_FAKE_CH_RSSI;
cfg->rx_cfg.fake_ch[0] = FM_RX_FAKE_CH_1;
cfg->rx_cfg.fake_ch[1] = FM_RX_FAKE_CH_2;
cfg->rx_cfg.fake_ch[2] = FM_RX_FAKE_CH_3;
cfg->rx_cfg.fake_ch[3] = FM_RX_FAKE_CH_4;
cfg->rx_cfg.fake_ch[4] = FM_RX_FAKE_CH_5;
cfg->rx_cfg.deemphasis = FM_RX_DEEMPHASIS;
cfg->tx_cfg.scan_hole_low = FM_TX_SCAN_HOLE_LOW;
cfg->tx_cfg.scan_hole_high = FM_TX_SCAN_HOLE_HIGH;
cfg->tx_cfg.power_level = FM_TX_PWR_LEVEL_MAX;
#endif
return 0;
}
示例7: fm_cdev_destroy
static fm_s32 fm_cdev_destroy(struct fm *fm)
{
FMR_ASSERT(fm);
device_destroy(fm->platform.cls, fm->platform.dev_t);
class_destroy(fm->platform.cls);
cdev_del(&fm->platform.cdev);
unregister_chrdev_region(fm->platform.dev_t, 1);
return 0;
}
示例8: fm_mod_destroy
static fm_s32 fm_mod_destroy(struct fm *fm)
{
fm_s32 ret = 0;
FMR_ASSERT(fm);
WCN_DBG(FM_NTC | MAIN, "%s\n", __func__);
remove_proc_entry(FM_PROC_FILE, NULL);
fm_cdev_destroy(fm);
fm_dev_destroy(fm);
return ret;
}
示例9: fmtx_open_dev
static int fmtx_open_dev(char *pname, int *fd)
{
int ret = 0;
int flag = 0;
int tmp = -1;
FMR_ASSERT(pname);
FMR_ASSERT(fd);
tmp = open(pname, O_RDWR);
if (tmp < 0) {
LOGE("Open %s failed, %s\n", pname, strerror(errno));
ret = -ERR_INVALID_FD;
}
*fd = tmp;
flag = fcntl(*fd, F_GETFL, tmp);
ret = fcntl(*fd, F_SETFD, flag|FD_CLOEXEC);
if(ret < 0){
LOGE("fcntl %s failed, %s\n", pname, strerror(errno));
}
LOGI("%s, [fd=%d] [ret=%d]\n", __func__, *fd, ret);
return ret;
}
示例10: fm_workthread_put
fm_s32 fm_workthread_put(struct fm_workthread *thiz)
{
FMR_ASSERT(thiz);
thiz->ref--;
if (thiz->ref == 0) {
destroy_workqueue((struct workqueue_struct *)thiz->priv);
fm_free(thiz);
return 0;
} else if (thiz->ref > 0) {
return -FM_EINUSE;
} else {
return -FM_EPARA;
}
}
示例11: fm_work_put
fm_s32 fm_work_put(struct fm_work *thiz)
{
FMR_ASSERT(thiz);
thiz->ref--;
if (thiz->ref == 0) {
fm_free(thiz->priv);
fm_free(thiz);
return 0;
} else if (thiz->ref > 0) {
return -FM_EINUSE;
} else {
return -FM_EPARA;
}
}
示例12: fm_fifo_in
fm_s32 fm_fifo_in(struct fm_fifo *thiz, void *item)
{
FMR_ASSERT(item);
if (thiz->len < thiz->size) {
fm_memcpy((thiz->obj.priv + (thiz->item_size * thiz->in)), item, thiz->item_size);
thiz->in = (thiz->in + 1) % thiz->size;
thiz->len++;
/* WCN_DBG(FM_DBG | MAIN, "add a new item[len=%d]\n", thiz->len); */
} else {
WCN_DBG(FM_WAR | MAIN, "%s fifo is full\n", thiz->obj.name);
return -FM_ENOMEM;
}
return 0;
}
示例13: bt_host_pwr_state_get
static int bt_host_pwr_state_get(int *state)
{
int sz;
int fd = -1;
int ret = 0;
char sta;
int bt_rfkill_id = -1;
char *bt_rfkill_state_path = NULL;
FMR_ASSERT(state);
if(bt_rfkill_id == -1){
ret = bt_host_rfkill_path_get(&bt_rfkill_id, &bt_rfkill_state_path);
if(ret){
LOGE("get bt rfkill sate path failed\n");
return ret;
}
}
fd = open(bt_rfkill_state_path, O_RDONLY);
if(fd < 0){
LOGE("open(%s) failed\n", bt_rfkill_state_path);
return fd;
}
sz = read(fd, &sta, 1);
if(sz != 1){
LOGE("read(%s) failed", bt_rfkill_state_path);
close(fd);
return -1;
}
switch(sta){
case '1':
*state = BT_PWR_ON;
break;
case '0':
*state = BT_PWR_OFF;
break;
default:
LOGE("unknown bt pwr state\n");
ret = -1;
}
free(bt_rfkill_state_path);
close(fd);
return ret;
}
示例14: MT6630fm_cust_config_default
static fm_s32 MT6630fm_cust_config_default(fm_cust_cfg *cfg)
{
FMR_ASSERT(cfg);
cfg->rx_cfg.long_ana_rssi_th = FM_RX_RSSI_TH_LONG_MT6630;
cfg->rx_cfg.short_ana_rssi_th = FM_RX_RSSI_TH_SHORT_MT6630;
cfg->rx_cfg.desene_rssi_th = FM_RX_DESENSE_RSSI_MT6630;
cfg->rx_cfg.pamd_th = FM_RX_PAMD_TH_MT6630;
cfg->rx_cfg.mr_th = FM_RX_MR_TH_MT6630;
cfg->rx_cfg.atdc_th = FM_RX_ATDC_TH_MT6630;
cfg->rx_cfg.prx_th = FM_RX_PRX_TH_MT6630;
cfg->rx_cfg.smg_th = FM_RX_SMG_TH_MT6630;
cfg->rx_cfg.deemphasis = FM_RX_DEEMPHASIS_MT6630;
cfg->rx_cfg.osc_freq = FM_RX_OSC_FREQ_MT6630;
cfg->tx_cfg.pamd_th = FM_TX_PAMD_TH_MT6630;
cfg->tx_cfg.mr_th = FM_TX_MR_TH_MT6630;
cfg->tx_cfg.smg_th = FM_TX_SMG_TH_MT6630;
#ifdef CONFIG_MTK_MERGE_INTERFACE_SUPPORT
cfg->aud_cfg.aud_path = FM_AUD_MRGIF;
cfg->aud_cfg.i2s_info.status = FM_I2S_OFF;
cfg->aud_cfg.i2s_info.mode = FM_I2S_SLAVE;
cfg->aud_cfg.i2s_info.rate = FM_I2S_44K;
cfg->aud_cfg.i2s_pad = FM_I2S_PAD_IO;
#elif defined FM_DIGITAL_INPUT
cfg->aud_cfg.aud_path = FM_AUD_I2S;
cfg->aud_cfg.i2s_info.status = FM_I2S_OFF;
cfg->aud_cfg.i2s_info.mode = FM_I2S_SLAVE;
cfg->aud_cfg.i2s_info.rate = FM_I2S_44K;
cfg->aud_cfg.i2s_pad = FM_I2S_PAD_IO;
#elif defined FM_ANALOG_INPUT
cfg->aud_cfg.aud_path = FM_AUD_ANALOG;
cfg->aud_cfg.i2s_info.status = FM_I2S_STATE_ERR;
cfg->aud_cfg.i2s_info.mode = FM_I2S_MODE_ERR;
cfg->aud_cfg.i2s_info.rate = FM_I2S_SR_ERR;
cfg->aud_cfg.i2s_pad = FM_I2S_PAD_ERR;
#else
cfg->aud_cfg.aud_path = FM_AUD_ERR;
cfg->aud_cfg.i2s_info.status = FM_I2S_STATE_ERR;
cfg->aud_cfg.i2s_info.mode = FM_I2S_MODE_ERR;
cfg->aud_cfg.i2s_info.rate = FM_I2S_SR_ERR;
cfg->aud_cfg.i2s_pad = FM_I2S_PAD_ERR;
#endif
return 0;
}
示例15: MT6630fm_cust_config_default
static fm_s32 MT6630fm_cust_config_default(fm_cust_cfg *cfg)
{
FMR_ASSERT(cfg);
cfg->rx_cfg.long_ana_rssi_th = FM_RX_RSSI_TH_LONG_MT6630;
cfg->rx_cfg.short_ana_rssi_th = FM_RX_RSSI_TH_SHORT_MT6630;
cfg->rx_cfg.desene_rssi_th = FM_RX_DESENSE_RSSI_MT6630;
cfg->rx_cfg.pamd_th = FM_RX_PAMD_TH_MT6630;
cfg->rx_cfg.mr_th = FM_RX_MR_TH_MT6630;
cfg->rx_cfg.atdc_th = FM_RX_ATDC_TH_MT6630;
cfg->rx_cfg.prx_th = FM_RX_PRX_TH_MT6630;
cfg->rx_cfg.smg_th = FM_RX_SMG_TH_MT6630;
cfg->rx_cfg.deemphasis = FM_RX_DEEMPHASIS_MT6630;
cfg->rx_cfg.osc_freq = FM_RX_OSC_FREQ_MT6630;
return 0;
}