本文整理汇总了C++中reset_device函数的典型用法代码示例。如果您正苦于以下问题:C++ reset_device函数的具体用法?C++ reset_device怎么用?C++ reset_device使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了reset_device函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: omap_dss_register_device
int omap_dss_register_device(struct omap_dss_device *dssdev)
{
static int dev_num;
static int panel_num;
int r;
WARN_ON(!dssdev->driver_name);
reset_device(&dssdev->dev, 1);
dssdev->dev.bus = &dss_bus_type;
dssdev->dev.parent = &dss_bus;
dssdev->dev.release = omap_dss_dev_release;
dev_set_name(&dssdev->dev, "display%d", dev_num++);
r = device_register(&dssdev->dev);
if (r)
return r;
if (dssdev->ctrl.panel) {
struct omap_dss_device *panel = dssdev->ctrl.panel;
panel->panel.ctrl = dssdev;
reset_device(&panel->dev, 1);
panel->dev.bus = &dss_bus_type;
panel->dev.parent = &dssdev->dev;
panel->dev.release = omap_dss_dev_release;
dev_set_name(&panel->dev, "panel%d", panel_num++);
r = device_register(&panel->dev);
if (r)
return r;
}
return 0;
}
示例2: update_device_status
static void update_device_status(struct device *dev)
{
if (dev->desc->status == 0)
reset_device(dev);
else if (dev->desc->status & VIRTIO_CONFIG_S_FAILED) {
warnx("Device %s configuration FAILED", dev->name);
if (dev->running)
reset_device(dev);
} else {
if (dev->running)
err(1, "Device %s features finalized twice", dev->name);
start_device(dev);
}
}
示例3: printk
VOID unregister_client
(
INT32 cli_id
)
{
p_atheros_dev dev;
printk("DK::Unregsitering client %d \n",cli_id);
dev = &dev_table[cli_id];
if (!VALID_CLIENT(dev)) {
printk("DK::unregister_client:Invalid client \n");
return;
}
if (!BUSY_CLIENT(dev)) {
printk("DK::unregister_client:Client not registered \n");
return;
}
reset_device(dev->cli_id);
deleteEventQueue(&dev->isr_event_q);
deleteEventQueue(&dev->trigered_event_q);
#if defined(OWL_PB42) || defined(PYTHON_EMU)
bus_dev_exit(dev->bus_dev);
#endif
dev->dev_busy = 0;
return;
}
示例4: trace_device_console
static int trace_device_console(void)
{
int result;
int count = 0;
time_t base = time(0);
if ((result = reset_device(0)))
return result;
while (count < trace_size)
{
if (time(0) - base > trace_time)
break;
if ((result = read_serial_port(device_buffer, 1)))
{
if (result == NO_DEVICE_REPLY)
continue;
return result;
}
fprintf(stdout, isprint(device_buffer[0]) || isspace(device_buffer[0]) ? TTY_NONE "%c" : TTY_NONE "[%02X]", device_buffer[0]);
fflush(stdout);
count++;
base = time(0);
}
return DONE;
}
示例5: cleanup_devices
static void cleanup_devices(void)
{
struct device *dev;
for (dev = devices.dev; dev; dev = dev->next)
reset_device(dev);
if (orig_term.c_lflag & (ISIG|ICANON|ECHO))
tcsetattr(STDIN_FILENO, TCSANOW, &orig_term);
}
示例6: vhost_user_reset_owner
static int
vhost_user_reset_owner(struct virtio_net *dev)
{
if (dev->flags & VIRTIO_DEV_RUNNING) {
dev->flags &= ~VIRTIO_DEV_RUNNING;
dev->notify_ops->destroy_device(dev->vid);
}
cleanup_device(dev, 0);
reset_device(dev);
return 0;
}
示例7: omap_dss_register_device
static int omap_dss_register_device(struct omap_dss_device *dssdev)
{
static int dev_num;
WARN_ON(!dssdev->driver_name);
reset_device(&dssdev->dev, 1);
dssdev->dev.bus = &dss_bus_type;
dssdev->dev.parent = &dss_bus;
dssdev->dev.release = omap_dss_dev_release;
dev_set_name(&dssdev->dev, "display%d", dev_num++);
return device_register(&dssdev->dev);
}
示例8: init_device
/*
* Reset and initialize the device
*/
static int init_device(struct device *dev)
{
struct talitos_private *priv = dev_get_drvdata(dev);
int ch, err;
/*
* Master reset
* errata documentation: warning: certain SEC interrupts
* are not fully cleared by writing the MCR:SWR bit,
* set bit twice to completely reset
*/
err = reset_device(dev);
if (err)
return err;
err = reset_device(dev);
if (err)
return err;
/* reset channels */
for (ch = 0; ch < priv->num_channels; ch++) {
err = reset_channel(dev, ch);
if (err)
return err;
}
/* enable channel done and error interrupts */
setbits32(priv->reg + TALITOS_IMR, TALITOS_IMR_INIT);
setbits32(priv->reg + TALITOS_IMR_LO, TALITOS_IMR_LO_INIT);
/* disable integrity check error interrupts (use writeback instead) */
if (priv->features & TALITOS_FTR_HW_AUTH_CHECK)
setbits32(priv->reg + TALITOS_MDEUICR_LO,
TALITOS_MDEUICR_LO_ICE);
return 0;
}
示例9: cv_read_block
/**
* Get a block of data from the device.
*
* @param devc The struct containing private per-device-instance data. Must not
* be NULL. devc->ftdic must not be NULL either.
*
* @return SR_OK upon success, or SR_ERR upon errors.
*/
SR_PRIV int cv_read_block(struct dev_context *devc)
{
int i, byte_offset, m, mi, p, q, index, bytes_read;
gint64 now;
/* Note: Caller checked that devc and devc->ftdic != NULL. */
sr_spew("Reading block %d.", devc->block_counter);
bytes_read = cv_read(devc, devc->mangled_buf, BS);
/* If first block read got 0 bytes, retry until success or timeout. */
if ((bytes_read == 0) && (devc->block_counter == 0)) {
do {
sr_spew("Reading block 0 (again).");
/* Note: If bytes_read < 0 cv_read() will log errors. */
bytes_read = cv_read(devc, devc->mangled_buf, BS);
now = g_get_monotonic_time();
} while ((devc->done > now) && (bytes_read == 0));
}
/* Check if block read was successful or a timeout occurred. */
if (bytes_read != BS) {
sr_err("Trigger timed out. Bytes read: %d.", bytes_read);
(void) reset_device(devc); /* Ignore errors. */
return SR_ERR;
}
/* De-mangle the data. */
sr_spew("Demangling block %d.", devc->block_counter);
byte_offset = devc->block_counter * BS;
m = byte_offset / (1024 * 1024);
mi = m * (1024 * 1024);
for (i = 0; i < BS; i++) {
if (devc->prof->model == CHRONOVU_LA8) {
p = i & (1 << 0);
index = m * 2 + (((byte_offset + i) - mi) / 2) * 16;
index += (devc->divcount == 0) ? p : (1 - p);
} else {
p = i & (1 << 0);
q = i & (1 << 1);
index = m * 4 + (((byte_offset + i) - mi) / 4) * 32;
index += q + (1 - p);
}
devc->final_buf[index] = devc->mangled_buf[i];
}
return SR_OK;
}
示例10: sighandler
/* #### sigcontext doesn't exist in Solaris. This should be updated
to be correct for Solaris. */
static SIGTYPE
sighandler (int sig)
{
if (audio_fd > 0)
{
reset_device (0);
close (audio_fd);
}
if (sig == SIGHUP && sighup_handler)
sighup_handler (sig);
else if (sig == SIGINT && sigint_handler)
sigint_handler (sig);
else
exit (1);
}
示例11: vhost_reset_owner
/*
* Called from CUSE IOCTL: VHOST_RESET_OWNER
*/
int
vhost_reset_owner(struct vhost_device_ctx ctx)
{
struct virtio_net *dev;
dev = get_device(ctx);
if (dev == NULL)
return -1;
if (dev->flags & VIRTIO_DEV_RUNNING)
notify_ops->destroy_device(dev);
cleanup_device(dev, 0);
reset_device(dev);
return 0;
}
示例12: link_reset
int link_reset(link_phy_t handle){
link_op_t op;
link_debug(3, "try to reset--check bootloader\n");
if( link_isbootloader(handle) ){
//execute the request
op.ioctl.cmd = LINK_CMD_IOCTL;
op.ioctl.fildes = LINK_BOOTLOADER_FILDES;
op.ioctl.request = I_BOOTLOADER_RESET;
op.ioctl.arg = 0;
link_protocol_masterwrite(handle, &op, sizeof(link_ioctl_t));
link_phy_close(handle);
} else {
link_debug(3, "reset device with /dev/core\n");
return reset_device(handle, false);
}
return 0;
}
示例13: vhost_reset_owner
/*
* Called from CUSE IOCTL: VHOST_RESET_OWNER
*/
int
vhost_reset_owner(int vid)
{
struct virtio_net *dev;
dev = get_device(vid);
if (dev == NULL)
return -1;
if (dev->flags & VIRTIO_DEV_RUNNING) {
dev->flags &= ~VIRTIO_DEV_RUNNING;
notify_ops->destroy_device(vid);
}
cleanup_device(dev, 0);
reset_device(dev);
return 0;
}
示例14: invoke_user_cmd
/*
* Invoke user cmd
*
*/
uint8_t invoke_user_cmd(const uint8_t * pData, const uint8_t len) {
uint8_t user_cmd;
user_cmd = nibble_to_bin(pData[0]);
user_cmd <<= 4;
user_cmd |= nibble_to_bin(pData[1]);
DEBUG_PRINTF("user_cmd: 0x%2x\r\n", user_cmd);
switch (user_cmd) {
case CMD_RESET_DEVICE:
reset_device();
break;
case CMD_GET_BL_VERS:
serprintf(device_vers_tag);
break;
case CMD_UNLOCK_MCU:
if (len == 10) {
uint32_t unlock_code = 0;
uint16_t idx = 2;
while (idx < 10) {
unlock_code <<= 4;
unlock_code |= nibble_to_bin(pData[idx++]);
unlock_code <<= 4;
unlock_code |= nibble_to_bin(pData[idx++]);
}
clear_mcu_iap(unlock_code);
}
break;
case CMD_DEBUG_ON:
set_trace(get_trace() == 0 ? serprintf : 0);
break;
default:
break;
}
return SDP_ACK_x06;
}
示例15: pcm_in_cb
void pcm_in_cb(uint32_t opcode, uint32_t token,
uint32_t *payload, void *priv)
{
struct pcm *pcm = (struct pcm *) priv;
unsigned long flags;
spin_lock_irqsave(&pcm->dsp_lock, flags);
switch (opcode) {
case ASM_DATA_EVENT_READ_DONE:
pcm_in_get_dsp_buffers(pcm, token, payload);
break;
case RESET_EVENTS:
reset_device();
break;
default:
break;
}
spin_unlock_irqrestore(&pcm->dsp_lock, flags);
}