本文整理汇总了C++中dm_init函数的典型用法代码示例。如果您正苦于以下问题:C++ dm_init函数的具体用法?C++ dm_init怎么用?C++ dm_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dm_init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
// ****************************************************************************
// Program entry point
int main (void)
{
// Initialize platform first
if( platform_init() != PLATFORM_OK )
{
// This should never happen
while( 1 );
}
// Initialize device manager
dm_init();
// And register the ROM filesystem
dm_register( fs_init() );
// Initialize XMODEM
xmodem_init( xmodem_send, xmodem_recv );
printf( ".text ends at %p, first free RAM is at %p, last free ram is at %p\r\n", etext, platform_get_first_free_ram(), platform_get_last_free_ram() );
// Run the shell
if( shell_init( XMODEM_MAX_FILE_SIZE ) == 0 )
printf( "Unable to initialize shell!\n" );
else
shell_start();
while( 1 );
}
示例2: dm_test_main
static int dm_test_main(const char *test_name)
{
struct unit_test *tests = ll_entry_start(struct unit_test, dm_test);
const int n_ents = ll_entry_count(struct unit_test, dm_test);
struct unit_test_state *uts = &global_dm_test_state;
uts->priv = &_global_priv_dm_test_state;
struct unit_test *test;
int run_count;
/*
* If we have no device tree, or it only has a root node, then these
* tests clearly aren't going to work...
*/
if (!gd->fdt_blob || fdt_next_node(gd->fdt_blob, 0, NULL) < 0) {
puts("Please run with test device tree:\n"
" ./u-boot -d arch/sandbox/dts/test.dtb\n");
ut_assert(gd->fdt_blob);
}
if (!test_name)
printf("Running %d driver model tests\n", n_ents);
run_count = 0;
for (test = tests; test < tests + n_ents; test++) {
const char *name = test->name;
/* All tests have this prefix */
if (!strncmp(name, "dm_test_", 8))
name += 8;
if (test_name && strcmp(test_name, name))
continue;
printf("Test: %s\n", test->name);
run_count++;
ut_assertok(dm_test_init(uts));
uts->start = mallinfo();
if (test->flags & DM_TESTF_SCAN_PDATA)
ut_assertok(dm_scan_platdata(false));
if (test->flags & DM_TESTF_PROBE_TEST)
ut_assertok(do_autoprobe(uts));
if (test->flags & DM_TESTF_SCAN_FDT)
ut_assertok(dm_scan_fdt(gd->fdt_blob, false));
test->func(uts);
ut_assertok(dm_test_destroy(uts));
}
if (test_name && !run_count)
printf("Test '%s' not found\n", test_name);
else
printf("Failures: %d\n", uts->fail_count);
gd->dm_root = NULL;
ut_assertok(dm_init());
dm_scan_platdata(false);
dm_scan_fdt(gd->fdt_blob, false);
return uts->fail_count ? CMD_RET_FAILURE : 0;
}
示例3: device_manager_init
/**@brief Function for the Device Manager initialization.
*
* @param[in] erase_bonds Indicates whether bonding information should be cleared from
* persistent storage during initialization of the Device Manager.
*/
static void device_manager_init(bool erase_bonds)
{
uint32_t err_code;
dm_init_param_t init_param = {.clear_persistent_data = erase_bonds};
dm_application_param_t register_param;
// Initialize persistent storage module.
err_code = pstorage_init();
APP_ERROR_CHECK(err_code);
err_code = dm_init(&init_param);
APP_ERROR_CHECK(err_code);
memset(®ister_param.sec_param, 0, sizeof(ble_gap_sec_params_t));
register_param.sec_param.bond = SEC_PARAM_BOND;
register_param.sec_param.mitm = SEC_PARAM_MITM;
register_param.sec_param.io_caps = SEC_PARAM_IO_CAPABILITIES;
register_param.sec_param.oob = SEC_PARAM_OOB;
register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
register_param.evt_handler = device_manager_evt_handler;
register_param.service_type = DM_PROTOCOL_CNTXT_GATT_SRVR_ID;
err_code = dm_register(&m_app_handle, ®ister_param);
APP_ERROR_CHECK(err_code);
}
示例4: device_manager_init
/**@brief Function for the Device Manager initialization.
*
* @param[in] erase_bonds Indicates whether bonding information should be cleared from
* persistent storage during initialization of the Device Manager.
*/
static void device_manager_init(bool erase_bonds)
{
uint32_t err_code;
dm_init_param_t init_param = {.clear_persistent_data = erase_bonds};
dm_application_param_t register_param;
// Initialize persistent storage module.
err_code = pstorage_init();
APP_ERROR_CHECK(err_code);
err_code = dm_init(&init_param);
APP_ERROR_CHECK(err_code);
memset(®ister_param.sec_param, 0, sizeof(ble_gap_sec_params_t));
register_param.sec_param.bond = SEC_PARAM_BOND;
register_param.sec_param.mitm = SEC_PARAM_MITM;
register_param.sec_param.io_caps = SEC_PARAM_IO_CAPABILITIES;
register_param.sec_param.oob = SEC_PARAM_OOB;
register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
register_param.evt_handler = device_manager_evt_handler;
register_param.service_type = DM_PROTOCOL_CNTXT_GATT_SRVR_ID;
err_code = dm_register(&m_app_handle, ®ister_param);
APP_ERROR_CHECK(err_code);
app_bond_init(&m_app_bond_table);
for(uint8_t i = 0; i < DEVICE_MANAGER_MAX_BONDS; i++)
{
APP_LOG("[APP][ID: %d], Application context : %08X\r\n",m_app_bond_table.device_id[i],(unsigned int) m_app_bond_table.app_bond_cnt[i]);
}
}
示例5: device_manager_init
/**@brief Function for the Device Manager initialization.
*/
static void device_manager_init(void)
{
uint32_t err_code;
dm_init_param_t init_data;
dm_application_param_t register_param;
// Initialize persistent storage module.
err_code = pstorage_init();
APP_ERROR_CHECK(err_code);
// Clear all bonded centrals if the "delete all bonds" button is pushed.
err_code = bsp_button_is_pressed(BOND_DELETE_ALL_WAKEUP_BUTTON_ID,&(init_data.clear_persistent_data));
APP_ERROR_CHECK(err_code);
err_code = dm_init(&init_data);
APP_ERROR_CHECK(err_code);
memset(®ister_param.sec_param, 0, sizeof(ble_gap_sec_params_t));
register_param.sec_param.timeout = SEC_PARAM_TIMEOUT;
register_param.sec_param.bond = SEC_PARAM_BOND;
register_param.sec_param.mitm = SEC_PARAM_MITM;
register_param.sec_param.io_caps = SEC_PARAM_IO_CAPABILITIES;
register_param.sec_param.oob = SEC_PARAM_OOB;
register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
register_param.evt_handler = device_manager_evt_handler;
register_param.service_type = DM_PROTOCOL_CNTXT_GATT_SRVR_ID;
err_code = dm_register(&m_app_handle, ®ister_param);
APP_ERROR_CHECK(err_code);
}
示例6: device_manager_init
/**@brief Function for the Device Manager initialization.
*/
static void device_manager_init(void)
{
uint32_t err_code;
dm_init_param_t init_data;
dm_application_param_t register_param;
// Initialize persistent storage module.
err_code = pstorage_init();
APP_ERROR_CHECK(err_code);
// Clear all bonded centrals if the Bonds Delete button is pushed.
init_data.clear_persistent_data = true;//(nrf_gpio_pin_read(BOND_DELETE_ALL_BUTTON_ID) == 0);
err_code = dm_init(&init_data);
APP_ERROR_CHECK(err_code);
memset(®ister_param.sec_param, 0, sizeof(ble_gap_sec_params_t));
//register_param.sec_param.timeout = SEC_PARAM_TIMEOUT;
register_param.sec_param.bond = SEC_PARAM_BOND;
register_param.sec_param.mitm = SEC_PARAM_MITM;
register_param.sec_param.io_caps = SEC_PARAM_IO_CAPABILITIES;
register_param.sec_param.oob = SEC_PARAM_OOB;
register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
register_param.evt_handler = device_manager_evt_handler;
register_param.service_type = DM_PROTOCOL_CNTXT_NONE;
err_code = dm_register(&g_AppHandle, ®ister_param);
APP_ERROR_CHECK(err_code);
}
示例7: kernel_early_init
// TODO: Kernel init functions, kernel_early_init stub is here, kernel_init is just a declaration to shut the linker up.
void kernel_early_init(struct multiboot *mboot_header, addr_t initial_stack)
{
// This is fun, but as long as grub is a bitch, i have a problem.
// Make sure interrupts are disabled.
//asm volatile("cli");
// Store passed values, and set up the early system.
kernel_state_flags = 0;
set_ksf(KSF_BOOTING);
mtboot = mboot_header;
initial_boot_stack = initial_stack;
loader_parse_kernel_elf(mboot_header, &kernel_sections);
#if _DBOS_KERNEL_LOADER_MODULES
loader_init_kernel_symbols();
#endif
serial_init();
cpu_early_init();
#if _DBOS_KERNEL_LOADER_MODULES
loader_init_modules();
#endif
syscall_init();
cpu_timer_install(1000);
cpu_processor_init_1();
printk(8, "[KERNEL]: Parsed kernel elf, end of stub function. If you see this, then it is working.\n");
printk(1, "[KERNEL]: Starting system management.\n");
mm_init(mtboot);
tm_init_multitasking();
dm_init();
fs_init();
}
示例8: setup
int setup(void **state){
int rc = 0;
dm_ctx_t *ctx = NULL;
rc = dm_init(NULL, NULL, NULL, CM_MODE_LOCAL, TEST_SCHEMA_SEARCH_DIR, TEST_DATA_SEARCH_DIR, &ctx);
*state = ctx;
return rc;
}
示例9: dm_init_and_scan
int dm_init_and_scan(bool pre_reloc_only)
{
int ret;
ret = dm_init();
if (ret) {
debug("dm_init() failed: %d\n", ret);
return ret;
}
ret = dm_scan_platdata(pre_reloc_only);
if (ret) {
debug("dm_scan_platdata() failed: %d\n", ret);
return ret;
}
if (CONFIG_IS_ENABLED(OF_CONTROL)) {
ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only);
if (ret) {
debug("dm_scan_fdt() failed: %d\n", ret);
return ret;
}
}
ret = dm_scan_other(pre_reloc_only);
if (ret)
return ret;
return 0;
}
示例10: dm_init_and_scan
int dm_init_and_scan(bool pre_reloc_only)
{
int ret;
ret = dm_init();
if (ret) {
debug("dm_init() failed: %d\n", ret);
return ret;
}
ret = dm_scan_platdata(pre_reloc_only);
if (ret) {
debug("dm_scan_platdata() failed: %d\n", ret);
return ret;
}
#ifdef CONFIG_OF_CONTROL
ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only);
if (ret) {
debug("dm_scan_fdt() failed: %d\n", ret);
return ret;
}
#endif
ret = dm_scan_other(pre_reloc_only);
if (ret)
return ret;
return 0;
}
示例11: device_manager_init
/**@brief Function for the Device Manager initialization.
*
* @param[in] erase_bonds Indicates whether bonding information should be cleared from
* persistent storage during initialization of the Device Manager.
*/
static void device_manager_init(bool erase_bonds)
{
uint32_t err_code;
dm_init_param_t init_param = {.clear_persistent_data = erase_bonds};
dm_application_param_t register_param;
err_code = pstorage_init();
APP_ERROR_CHECK(err_code);
err_code = dm_init(&init_param);
APP_ERROR_CHECK(err_code);
memset(®ister_param.sec_param, 0, sizeof (ble_gap_sec_params_t));
// Event handler to be registered with the module.
register_param.evt_handler = device_manager_event_handler;
// Service or protocol context for device manager to load, store and apply on behalf of application.
// Here set to client as application is a GATT client.
register_param.service_type = DM_PROTOCOL_CNTXT_GATT_CLI_ID;
// Secuirty parameters to be used for security procedures.
register_param.sec_param.bond = SEC_PARAM_BOND;
register_param.sec_param.mitm = SEC_PARAM_MITM;
register_param.sec_param.io_caps = SEC_PARAM_IO_CAPABILITIES;
register_param.sec_param.oob = SEC_PARAM_OOB;
register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
register_param.sec_param.kdist_periph.enc = 1;
register_param.sec_param.kdist_periph.id = 1;
err_code = dm_register(&m_dm_app_id, ®ister_param);
APP_ERROR_CHECK(err_code);
}
示例12: dmapi_init
void __init dmapi_init(void)
{
int ret;
ret = misc_register(&dmapi_dev);
if( ret != 0 )
printk(KERN_INFO "*** dmapi_init: misc_register returned %d\n", ret);
dm_init();
}
示例13: main
int main( void )
{
FILE* fp;
// Initialize platform first
if( platform_init() != PLATFORM_OK )
{
// This should never happen
while( 1 );
}
// Initialize device manager
dm_init();
// Register the ROM filesystem
dm_register( romfs_init() );
// Register the MMC filesystem
dm_register( mmcfs_init() );
// Register the remote filesystem
dm_register( remotefs_init() );
// Autorun: if "autorun.lua" is found in the file system, run it first
if( ( fp = fopen( FS_AUTORUN, "r" ) ) != NULL )
{
fclose( fp );
char* lua_argv[] = { "lua", FS_AUTORUN, NULL };
lua_main( 2, lua_argv );
}
#ifdef ELUA_BOOT_RPC
boot_rpc();
#else
// Run the shell
if( shell_init() == 0 )
{
printf( "Unable to initialize the eLua shell!\n" );
// Start Lua directly
char* lua_argv[] = { "lua", NULL };
lua_main( 1, lua_argv );
}
else
shell_start();
#endif // #ifdef ELUA_BOOT_RPC
#ifdef ELUA_SIMULATOR
hostif_exit(0);
return 0;
#else
while( 1 );
#endif
}
示例14: dm_test_init
/* Get ready for testing */
static int dm_test_init(struct dm_test_state *dms)
{
memset(dms, '\0', sizeof(*dms));
gd->dm_root = NULL;
memset(dm_testdrv_op_count, '\0', sizeof(dm_testdrv_op_count));
ut_assertok(dm_init());
dms->root = dm_root();
return 0;
}
示例15: device_manager_init
/**@brief Function for initializing the Device Manager.
*
* @details Device manager is initialized here.
*/
static void device_manager_init(void)
{
dm_init_param_t init_param;
uint32_t err_code;
err_code = pstorage_init();
APP_ERROR_CHECK(err_code);
err_code = dm_init(&init_param);
APP_ERROR_CHECK(err_code);
}