本文整理汇总了C++中register_device函数的典型用法代码示例。如果您正苦于以下问题:C++ register_device函数的具体用法?C++ register_device怎么用?C++ register_device使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了register_device函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eukrea_cpuimx25_devices_init
static int eukrea_cpuimx25_devices_init(void)
{
eukrea_cpuimx25_mmu_init();
mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads,
ARRAY_SIZE(eukrea_cpuimx25_pads));
register_device(&fec_dev);
nand_info.width = 1;
register_device(&nand_dev);
devfs_add_partition("nand0", 0x00000, 0x40000,
PARTITION_FIXED, "self_raw");
dev_add_bb_dev("self_raw", "self0");
devfs_add_partition("nand0", 0x40000, 0x20000,
PARTITION_FIXED, "env_raw");
dev_add_bb_dev("env_raw", "env0");
register_device(&sdram0_dev);
/* enable LCD */
gpio_direction_output(26, 1);
gpio_set_value(26, 1);
register_device(&imxfb_dev);
armlinux_add_dram(&sdram0_dev);
armlinux_set_bootparams((void *)0x80000100);
armlinux_set_architecture(MACH_TYPE_EUKREA_CPUIMX25);
return 0;
}
示例2: init_qsdk_module
void init_qsdk_module(void)
{
dev_init_t uart;
dev_init_t pmc;
dev_init_t uotghs;
dev_init_t arduino;
uart.name = "arduinodue_uart";
uart.dev_init = uart_init;
uart.dev_inst = uart_inst;
uart.dev_delete = NULL;
register_device(&uart);
pmc.name = "arduinodue_pmc";
pmc.dev_init = pmc_init;
pmc.dev_inst = pmc_inst;
pmc.dev_delete = NULL;
register_device(&pmc);
uotghs.name = "arduinodue_uotghs";
uotghs.dev_init = uotghs_init;
uotghs.dev_inst = uotghs_inst;
uotghs.dev_delete = NULL;
register_device(&uotghs);
arduino.name = "arduino_board";
arduino.dev_init = arduino_board_init;
arduino.dev_inst = arduino_board_inst;
arduino.dev_delete = NULL;
register_board(&arduino);
}
示例3: nhk8815_devices_init
static int nhk8815_devices_init(void)
{
st8815_add_device_sdram(64 * 1024 *1024);
writel(0xC37800F0, NOMADIK_GPIO1_BASE + 0x20);
writel(0x00000000, NOMADIK_GPIO1_BASE + 0x24);
writel(0x00000000, NOMADIK_GPIO1_BASE + 0x28);
writel(readl(NOMADIK_SRC_BASE) | 0x8000, NOMADIK_SRC_BASE);
/* Set up SMCS1 for Ethernet: sram-like, enabled, timing values */
writel(0x0000305b, FSMC_BCR(1));
writel(0x00033f33, FSMC_BTR(1));
register_device(&nhk8815_network_dev);
register_device(&nhk8815_nand_device);
armlinux_set_architecture(MACH_TYPE_NOMADIK);
armlinux_set_bootparams((void *)(0x00000100));
devfs_add_partition("nand0", 0x0000000, 0x040000, PARTITION_FIXED, "xloader_raw");
devfs_add_partition("nand0", 0x0040000, 0x080000, PARTITION_FIXED, "meminit_raw");
devfs_add_partition("nand0", 0x0080000, 0x200000, PARTITION_FIXED, "self_raw");
dev_add_bb_dev("self_raw", "self0");
devfs_add_partition("nand0", 0x7FE0000, 0x020000, PARTITION_FIXED, "env_raw");
dev_add_bb_dev("env_raw", "env0");
return 0;
}
示例4: scb9328_devices_init
static int scb9328_devices_init(void) {
imx_gpio_mode(PA23_PF_CS5);
/* CS3 becomes CS3 by clearing reset default bit 1 in FMCR */
FMCR = 0x1;
CS0U = 0x000F2000;
CS0L = 0x11110d01;
CS1U = 0x000F0a00;
CS1L = 0x11110601;
CS2U = 0x0;
CS2L = 0x0;
CS3U = 0x000FFFFF;
CS3L = 0x00000303;
CS4U = 0x000F0a00;
CS4L = 0x11110301;
CS5U = 0x00008400;
CS5L = 0x00000D03;
register_device(&cfi_dev);
register_device(&sdram_dev);
register_device(&dm9000_dev);
devfs_add_partition("nor0", 0x00000, 0x20000, PARTITION_FIXED, "self0");
devfs_add_partition("nor0", 0x40000, 0x20000, PARTITION_FIXED, "env0");
protect_file("/dev/env0", 1);
armlinux_add_dram(&sdram_dev);
armlinux_set_bootparams((void *)0x08000100);
armlinux_set_architecture(MACH_TYPE_SCB9328);
return 0;
}
示例5: devices_init
static int devices_init (void)
{
register_device(&cfi_dev);
register_device(&sdram_dev);
register_device(ð_dev);
devfs_add_partition("nor0", 0x00f00000, 0x40000, PARTITION_FIXED, "self0");
devfs_add_partition("nor0", 0x00f60000, 0x20000, PARTITION_FIXED, "env0");
return 0;
}
示例6: st8815_register_uart
void st8815_register_uart(unsigned id)
{
switch (id) {
case 0:
nmdk_clk_create(&st8815_clk_48, dev_name(&uart0_serial_device));
register_device(&uart0_serial_device);
break;
case 1:
nmdk_clk_create(&st8815_clk_48, dev_name(&uart1_serial_device));
register_device(&uart1_serial_device);
break;
}
}
示例7: eukrea_cpuimx27_console_init
static int eukrea_cpuimx27_console_init(void)
{
#ifdef CONFIG_DRIVER_SERIAL_IMX
register_device(&eukrea_cpuimx27_serial_device);
#endif
/* configure 8 bit UART on cs3 */
FMCR &= ~0x2;
CS3U = 0x0000D603;
CS3L = 0x0D1D0D01;
CS3A = 0x00D20000;
#ifdef CONFIG_DRIVER_SERIAL_NS16550
register_device(&quad_uart_serial_device);
#endif
return 0;
}
示例8: connectionAuthSetTrustLevel
/****************************************************************************
NAME
connectionAuthSetTrustLevel
FUNCTION
This function is called to set the trust level of a device stored in the
trusted device list. The Blustack Security Manager is updated with the
change.
RETURNS
TRUE is record updated, otherwise FALSE
*/
uint16 connectionAuthSetTrustLevel(cl_dm_bt_version version, const bdaddr* peer_bd_addr, uint16 trusted)
{
/* Holds the position of a device in the trusted device list (TDL) */
uint16 rec = 0;
TrustedDeviceRecordType record;
/* Search for the device in the TDL */
rec = find_trusted_device(peer_bd_addr);
/* If the device is in the TDL */
if(rec)
{
rec--;
/* Read the record */
(void)PsRetrieve(TRUSTED_DEVICE_LIST_BASE + rec, &record, sizeof(TrustedDeviceRecordType));
/* Update the trust level */
record.trusted = trusted;
/* Store the record */
(void)PsStore(TRUSTED_DEVICE_LIST_BASE + rec, &record, sizeof(TrustedDeviceRecordType));
/* Update Bluestack Security Manager Database */
register_device(version, &record);
/* Record updated */
return TRUE;
}
/* Record for this device does not exist */
return FALSE;
}
示例9: main
int main() {
ARMDevice uart;
UARTInterface *inter;
uart.base_addr = 0xFFFB0000;
uart.size = sizeof(UARTInterface);
strcpy(uart.name, "uart");
if(register_device(&uart, &valueWritten, &uart) == -1) {
perror("register_device");
exit(1);
}
inter = (UARTInterface *)uart.memory;
inter->US_IMR = 0x0;
inter->US_RHR = 0x0;
inter->US_BRGR = 0x0;
inter->US_RTOR = 0x0;
inter->US_TTGR = 0x0;
inter->US_FIDI = 0x174;
inter->US_IF = 0x0;
while(1) {}
return 0;
}
示例10: xzalloc
static struct state *state_new(const char *name)
{
struct state *state;
int ret;
state = xzalloc(sizeof(*state));
safe_strncpy(state->dev.name, name, MAX_DRIVER_NAME);
state->name = state->dev.name;
state->dev.id = DEVICE_ID_SINGLE;
INIT_LIST_HEAD(&state->variables);
ret = register_device(&state->dev);
if (ret) {
pr_err("Failed to register state device %s, %d\n", name, ret);
free(state);
return ERR_PTR(ret);
}
state->dirty = 1;
dev_add_param_bool(&state->dev, "dirty", NULL, NULL, &state->dirty,
NULL);
state->save_on_shutdown = 1;
dev_add_param_bool(&state->dev, "save_on_shutdown", NULL, NULL,
&state->save_on_shutdown, NULL);
list_add_tail(&state->list, &state_list);
return state;
}
示例11: load_config
static int load_config(const char *config,PLISTINFO pDevList)
{
FILE *fp = NULL;
int cnt = 0;
PLIST link = NULL;
char so_name[256];
fp = fopen(config,"r");
if(!fp) return -DEV_FAIL;
while(1)
{
if(fgets(so_name,256,fp))
{
strip_illegal_char(so_name);
if(so_name[0] == '#')
{
continue;
}
if(register_device(so_name) >= 0 && ++ cnt);
}
else
break;
}
fclose(fp);
return cnt;
}
示例12: ubi_add_volume
/**
* ubi_add_volume - add volume.
* @ubi: UBI device description object
* @vol: volume description object
*
* This function adds an existing volume and initializes all its data
* structures. Returns zero in case of success and a negative error code in
* case of failure.
*/
int ubi_add_volume(struct ubi_device *ubi, struct ubi_volume *vol)
{
int err = 0;
dbg_gen("add volume");
sprintf(vol->dev.name, "%s.%s", dev_name(&ubi->dev), vol->name);
vol->dev.id = DEVICE_ID_SINGLE;
vol->dev.parent = &ubi->dev;
err = register_device(&vol->dev);
if (err)
return err;
/* Register character device for the volume */
err = ubi_volume_cdev_add(ubi, vol);
if (err) {
ubi_err(ubi, "cannot add character device for volume, error %d",
err);
return err;
}
self_check_volumes(ubi);
return err;
return err;
}
示例13: device_init
status_t device_init( int nDeviceID )
{
int nError;
int nHandle;
printk( "Keyboard device: device_init() called\n" );
g_sVolume.hWaitThread = -1;
atomic_set( &g_sVolume.nInPos, 0 );
atomic_set( &g_sVolume.nOutPos, 0 );
atomic_set( &g_sVolume.nBytesReceived, 0 );
atomic_set( &g_sVolume.nOpenCount, 0 );
g_sVolume.nIrqHandle = request_irq( 1, kbd_irq, NULL, 0, "keyboard_device", NULL );
g_nKbdLedStatus = 0;
if ( g_sVolume.nIrqHandle < 0 ) {
printk( "ERROR : Failed to initiate keyboard interrupt handler\n" );
return( g_sVolume.nIrqHandle );
}
nHandle = register_device( "", "system" );
claim_device( nDeviceID, nHandle , "Keyboard", DEVICE_INPUT );
nError = create_device_node( nDeviceID, nHandle, "keybd", &g_sOperations, NULL );
return( nError );
}
示例14: mdiobus_register
/**
* mdiobus_register - bring up all the PHYs on a given bus and attach them to bus
* @bus: target mii_bus
*
* Description: Called by a bus driver to bring up all the PHYs
* on a given bus, and attach them to the bus.
*
* Returns 0 on success or < 0 on error.
*/
int mdiobus_register(struct mii_bus *bus)
{
int err;
if (NULL == bus ||
NULL == bus->read ||
NULL == bus->write)
return -EINVAL;
bus->dev.priv = bus;
bus->dev.id = DEVICE_ID_DYNAMIC;
strcpy(bus->dev.name, "miibus");
bus->dev.parent = bus->parent;
err = register_device(&bus->dev);
if (err) {
pr_err("mii_bus %s failed to register\n", bus->dev.name);
return -EINVAL;
}
if (bus->reset)
bus->reset(bus);
pr_info("%s: probed\n", dev_name(&bus->dev));
return 0;
}
示例15: diskflat_device_register
void
diskflat_device_register(void)
{
const char *device_prefix_list[] = { "diskflat", NULL };
register_device(diskflat_device_factory, device_prefix_list);
}