本文整理匯總了C++中DBC_ENSURE函數的典型用法代碼示例。如果您正苦於以下問題:C++ DBC_ENSURE函數的具體用法?C++ DBC_ENSURE怎麽用?C++ DBC_ENSURE使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DBC_ENSURE函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: cfg_get_exec_file
/*
* ======== cfg_get_exec_file ========
* Purpose:
* Retreive the default executable, if any, for this board.
*/
dsp_status cfg_get_exec_file(struct cfg_devnode *dev_node_obj, u32 ul_buf_size,
OUT char *pstrExecFile)
{
dsp_status status = DSP_SOK;
struct drv_data *drv_datap = dev_get_drvdata(bridge);
if (!dev_node_obj)
status = -EFAULT;
else if (!pstrExecFile || !drv_datap)
status = -EFAULT;
if (DSP_FAILED(status))
goto func_end;
if (!drv_datap->base_img || strlen(drv_datap->base_img) > ul_buf_size)
status = -EINVAL;
if (DSP_SUCCEEDED(status))
strcpy(pstrExecFile, drv_datap->base_img);
if (DSP_FAILED(status))
pr_err("%s: Failed, status 0x%x\n", __func__, status);
func_end:
DBC_ENSURE(((status == DSP_SOK) &&
(strlen(pstrExecFile) <= ul_buf_size))
|| (status != DSP_SOK));
return status;
}
示例2: cod_get_section
/*
* ======== cod_get_section ========
* Purpose:
* Retrieve the starting address and length of a section in the COFF file
* given the section name.
*/
int cod_get_section(struct cod_libraryobj *lib, char *str_sect,
u32 *addr, u32 *len)
{
struct cod_manager *cod_mgr_obj;
int status = 0;
DBC_REQUIRE(refs > 0);
DBC_REQUIRE(lib != NULL);
DBC_REQUIRE(lib->cod_mgr);
DBC_REQUIRE(str_sect != NULL);
DBC_REQUIRE(addr != NULL);
DBC_REQUIRE(len != NULL);
*addr = 0;
*len = 0;
if (lib != NULL) {
cod_mgr_obj = lib->cod_mgr;
status = cod_mgr_obj->fxns.get_sect_fxn(lib->dbll_lib, str_sect,
addr, len);
} else {
status = -ESPIPE;
}
DBC_ENSURE(!status || ((*addr == 0) && (*len == 0)));
return status;
}
示例3: dbll_unload
/*
* ======== dbll_unload ========
*/
void dbll_unload(struct dbll_library_obj *lib, struct dbll_attrs *attrs)
{
struct dbll_library_obj *zl_lib = (struct dbll_library_obj *)lib;
s32 err = 0;
DBC_REQUIRE(refs > 0);
DBC_REQUIRE(zl_lib);
DBC_REQUIRE(zl_lib->load_ref > 0);
dev_dbg(bridge, "%s: lib: %p\n", __func__, lib);
zl_lib->load_ref--;
/* Unload only if reference count is 0 */
if (zl_lib->load_ref != 0)
goto func_end;
zl_lib->target_obj->attrs = *attrs;
if (zl_lib->dload_mod_obj) {
err = dynamic_unload_module(zl_lib->dload_mod_obj,
&zl_lib->symbol.dl_symbol,
&zl_lib->allocate.dl_alloc,
&zl_lib->init.dl_init);
if (err != 0) {
dev_dbg(bridge, "%s: failed: %i\n", __func__, err);
}
}
/* remove symbols from symbol table */
if (zl_lib->sym_tab != NULL) {
gh_delete(zl_lib->sym_tab);
zl_lib->sym_tab = NULL;
}
/* delete DOFF desc since it holds *lots* of host OS
* resources */
dof_close(zl_lib);
func_end:
DBC_ENSURE(zl_lib->load_ref >= 0);
}
示例4: dbll_create
/*
* ======== dbll_create ========
*/
int dbll_create(struct dbll_tar_obj **target_obj,
struct dbll_attrs *pattrs)
{
struct dbll_tar_obj *pzl_target;
int status = 0;
DBC_REQUIRE(refs > 0);
DBC_REQUIRE(pattrs != NULL);
DBC_REQUIRE(target_obj != NULL);
/* Allocate DBL target object */
pzl_target = kzalloc(sizeof(struct dbll_tar_obj), GFP_KERNEL);
if (target_obj != NULL) {
if (pzl_target == NULL) {
*target_obj = NULL;
status = -ENOMEM;
} else {
pzl_target->attrs = *pattrs;
*target_obj = (struct dbll_tar_obj *)pzl_target;
}
DBC_ENSURE((DSP_SUCCEEDED(status) && *target_obj) ||
(DSP_FAILED(status) && *target_obj == NULL));
}
return status;
}
示例5: msg_exit
/*
* ======== msg_exit ========
*/
void msg_exit(void)
{
DBC_REQUIRE(refs > 0);
refs--;
DBC_ENSURE(refs >= 0);
}
示例6: dev_init
/*
* ======== dev_init ========
* Purpose:
* Initialize DEV's private state, keeping a reference count on each call.
*/
bool dev_init(void)
{
bool cmm_ret, dmm_ret, ret = true;
DBC_REQUIRE(refs >= 0);
if (refs == 0) {
cmm_ret = cmm_init();
dmm_ret = dmm_init();
ret = cmm_ret && dmm_ret;
if (!ret) {
if (cmm_ret)
cmm_exit();
if (dmm_ret)
dmm_exit();
}
}
if (ret)
refs++;
DBC_ENSURE((ret && (refs > 0)) || (!ret && (refs >= 0)));
return ret;
}
示例7: mgr_exit
/*
* ======== mgr_exit ========
* Decrement reference count, and free resources when reference count is
* 0.
*/
void mgr_exit(void)
{
DBC_REQUIRE(refs > 0);
refs--;
if (refs == 0)
dcd_exit();
DBC_ENSURE(refs >= 0);
}
示例8: msg_mod_init
/*
* ======== msg_mod_init ========
*/
bool msg_mod_init(void)
{
DBC_REQUIRE(refs >= 0);
refs++;
DBC_ENSURE(refs >= 0);
return true;
}
示例9: update_sample_endianess
void ECA_AUDIO_FORMAT::set_sample_endianess(ECA_AUDIO_FORMAT::Sample_endianess v)
{
update_sample_endianess(v);
/* make sure classes that reimplement set_sample_format
* see the change in sample endianess */
set_sample_format_string(format_string());
DBC_ENSURE(se_rep == se_big || se_rep == se_little);
}
示例10: chnl_create
/*
* ======== chnl_create ========
* Purpose:
* Create a channel manager object, responsible for opening new channels
* and closing old ones for a given 'Bridge board.
*/
int chnl_create(OUT struct chnl_mgr **phChnlMgr,
struct dev_object *hdev_obj,
IN CONST struct chnl_mgrattrs *pMgrAttrs)
{
int status;
struct chnl_mgr *hchnl_mgr;
struct chnl_mgr_ *chnl_mgr_obj = NULL;
DBC_REQUIRE(refs > 0);
DBC_REQUIRE(phChnlMgr != NULL);
DBC_REQUIRE(pMgrAttrs != NULL);
*phChnlMgr = NULL;
/* Validate args: */
if ((0 < pMgrAttrs->max_channels) &&
(pMgrAttrs->max_channels <= CHNL_MAXCHANNELS))
status = 0;
else if (pMgrAttrs->max_channels == 0)
status = -EINVAL;
else
status = -ECHRNG;
if (pMgrAttrs->word_size == 0)
status = -EINVAL;
if (DSP_SUCCEEDED(status)) {
status = dev_get_chnl_mgr(hdev_obj, &hchnl_mgr);
if (DSP_SUCCEEDED(status) && hchnl_mgr != NULL)
status = -EEXIST;
}
if (DSP_SUCCEEDED(status)) {
struct bridge_drv_interface *intf_fxns;
dev_get_intf_fxns(hdev_obj, &intf_fxns);
if (intf_fxns) {
/* Let WMD channel module finish the create */
status = (*intf_fxns->pfn_chnl_create)(&hchnl_mgr,
hdev_obj, pMgrAttrs);
}
if (DSP_SUCCEEDED(status)) {
/* Fill in WCD channel module's fields of the
* chnl_mgr structure */
chnl_mgr_obj = (struct chnl_mgr_ *)hchnl_mgr;
chnl_mgr_obj->intf_fxns = intf_fxns;
/* Finally, return the new channel manager handle: */
*phChnlMgr = hchnl_mgr;
}
}
DBC_ENSURE(DSP_FAILED(status) || chnl_mgr_obj);
return status;
}
示例11: guard
/**
* Detaches the current logger implementation.
*/
void ECA_LOGGER::detach_logger(void)
{
if (ECA_LOGGER::interface_impl_repp != 0) {
KVU_GUARD_LOCK guard(&ECA_LOGGER::lock_rep);
if (ECA_LOGGER::interface_impl_repp != 0) {
delete ECA_LOGGER::interface_impl_repp;
ECA_LOGGER::interface_impl_repp = 0;
}
}
DBC_ENSURE(ECA_LOGGER::interface_impl_repp == 0);
}
示例12: dbll_exit
/*
* ======== dbll_exit ========
* Discontinue usage of DBL module.
*/
void dbll_exit(void)
{
DBC_REQUIRE(refs > 0);
refs--;
if (refs == 0)
gh_exit();
DBC_ENSURE(refs >= 0);
}
示例13: cod_init
/*
* ======== cod_init ========
* Purpose:
* Initialize the COD module's private state.
*
*/
bool cod_init(void)
{
bool ret = true;
DBC_REQUIRE(refs >= 0);
if (ret)
refs++;
DBC_ENSURE((ret && refs > 0) || (!ret && refs >= 0));
return ret;
}
示例14: chnl_create
/*
* ======== chnl_create ========
* Purpose:
* Create a channel manager object, responsible for opening new channels
* and closing old ones for a given 'Bridge board.
*/
int chnl_create(struct chnl_mgr **channel_mgr,
struct dev_object *hdev_obj,
const struct chnl_mgrattrs *mgr_attrts)
{
int status;
struct chnl_mgr *hchnl_mgr;
struct chnl_mgr_ *chnl_mgr_obj = NULL;
DBC_REQUIRE(refs > 0);
DBC_REQUIRE(channel_mgr != NULL);
DBC_REQUIRE(mgr_attrts != NULL);
*channel_mgr = NULL;
/* Validate args: */
if ((0 < mgr_attrts->max_channels) &&
(mgr_attrts->max_channels <= CHNL_MAXCHANNELS))
status = 0;
else if (mgr_attrts->max_channels == 0)
status = -EINVAL;
else
status = -ECHRNG;
if (mgr_attrts->word_size == 0)
status = -EINVAL;
if (!status) {
status = dev_get_chnl_mgr(hdev_obj, &hchnl_mgr);
if (!status && hchnl_mgr != NULL)
status = -EEXIST;
}
if (!status) {
struct bridge_drv_interface *intf_fxns;
dev_get_intf_fxns(hdev_obj, &intf_fxns);
/* Let Bridge channel module finish the create: */
status = (*intf_fxns->pfn_chnl_create) (&hchnl_mgr, hdev_obj,
mgr_attrts);
if (!status) {
/* Fill in DSP API channel module's fields of the
* chnl_mgr structure */
chnl_mgr_obj = (struct chnl_mgr_ *)hchnl_mgr;
chnl_mgr_obj->intf_fxns = intf_fxns;
/* Finally, return the new channel manager handle: */
*channel_mgr = hchnl_mgr;
}
}
DBC_ENSURE(status || chnl_mgr_obj);
return status;
}
示例15: dev_exit
/*
* ======== dev_exit ========
* Purpose:
* Decrement reference count, and free resources when reference count is
* 0.
*/
void dev_exit(void)
{
DBC_REQUIRE(refs > 0);
refs--;
if (refs == 0) {
cmm_exit();
dmm_exit();
}
DBC_ENSURE(refs >= 0);
}