int main(int argc, char *argv[]) { if (pf_init()) err(1, "pf_init"); if (pf_read()) err(1, "pf_read"); return (0); }
/** * If initial_pose_hyp_ and map_ are both non-null, apply the initial * pose to the particle filter state. initial_pose_hyp_ is deleted * and set to NULL after it is used. */ void AMCLocalizer::applyInitialPose() { // boost::recursive_mutex::scoped_lock cfl(configuration_mutex_); if( initial_pose_hyp_ != NULL && map_ != NULL ) { pf_init(pf_, initial_pose_hyp_->pf_pose_mean, initial_pose_hyp_->pf_pose_cov); pf_init_ = false; delete initial_pose_hyp_; initial_pose_hyp_ = NULL; } }
//void AmclNode::reconfigureCB(AMCLConfig &config, uint32_t level) void AMCLocalizer::configure() { initialize(); pf_ = pf_alloc(min_particles_, max_particles_, alpha_slow_, alpha_fast_, (pf_init_model_fn_t)AMCLocalizer::uniformPoseGenerator, (void *)map_); pf_->pop_err = pf_err_; pf_->pop_z = pf_z_; // Initialize the filter pf_vector_t pf_init_pose_mean = pf_vector_zero(); pf_init_pose_mean.v[0] = last_published_pose.pose.pose.position.x; pf_init_pose_mean.v[1] = last_published_pose.pose.pose.position.y; pf_init_pose_mean.v[2] = tf::getYaw(last_published_pose.pose.pose.orientation); pf_matrix_t pf_init_pose_cov = pf_matrix_zero(); pf_init_pose_cov.m[0][0] = last_published_pose.pose.covariance[6*0+0]; pf_init_pose_cov.m[1][1] = last_published_pose.pose.covariance[6*1+1]; pf_init_pose_cov.m[2][2] = last_published_pose.pose.covariance[6*5+5]; pf_init(pf_, pf_init_pose_mean, pf_init_pose_cov); pf_init_ = false; // Instantiate Odometry delete odom_; odom_ = new AMCLOdom(); if(odom_model_type_ == ODOM_MODEL_OMNI) odom_->SetModelOmni(alpha1_, alpha2_, alpha3_, alpha4_, alpha5_); else odom_->SetModelDiff(alpha1_, alpha2_, alpha3_, alpha4_); // Instantiate Laser delete laser_; laser_ = new AMCLLaser(max_beams_, map_); if(laser_model_type_ == LASER_MODEL_BEAM) laser_->SetModelBeam(z_hit_, z_short_, z_max_, z_rand_, sigma_hit_, lambda_short_, 0.0); else { printf("Initializing likelihood field model; this can take some time on large maps..."); laser_->SetModelLikelihoodField(z_hit_, z_rand_, sigma_hit_, laser_likelihood_max_dist_); printf("Done initializing likelihood field model."); } /* * ********************* ROS specific ************************************ */ // transform_tolerance_.fromSec(config.transform_tolerance); // odom_frame_id_ = config.odom_frame_id; // base_frame_id_ = config.base_frame_id; // global_frame_id_ = config.global_frame_id; // delete laser_scan_filter_; // laser_scan_filter_ = new tf::MessageFilter<sensor_msgs::LaserScan>(*laser_scan_sub_, *tf_, odom_frame_id_, 100); // laser_scan_filter_->registerCallback(boost::bind(&AmclNode::laserReceived, this, _1)); // initial_pose_sub_ = nh_.subscribe("initialpose", 2, &AmclNode::initialPoseReceived, this); /* *********************************************************************** */ }
bool pf_load_from_buffer_list (struct context *c, const struct buffer_list *config) { struct pf_set *pfs = pf_init (config, "[SERVER-PF]", false); if (pfs) { if (c->c2.pf.pfs) pf_destroy (c->c2.pf.pfs); c->c2.pf.pfs = pfs; return true; } else return false; }
static struct pf_set * pf_init_from_file(const char *fn) { struct buffer_list *bl = buffer_list_file(fn, PF_MAX_LINE_LEN); if (bl) { struct pf_set *pfs = pf_init(bl, fn, true); buffer_list_free(bl); return pfs; } else { msg(D_PF_INFO|M_ERRNO, "PF: %s: cannot open", fn); return NULL; } }
/* * control ops entry point: * * Requests handled completely: * DDI_CTLOPS_INITCHILD see init_child() for details * DDI_CTLOPS_UNINITCHILD * DDI_CTLOPS_REPORTDEV see report_dev() for details * DDI_CTLOPS_IOMIN cache line size if streaming otherwise 1 * DDI_CTLOPS_REGSIZE * DDI_CTLOPS_NREGS * DDI_CTLOPS_DVMAPAGESIZE * DDI_CTLOPS_POKE * DDI_CTLOPS_PEEK * * All others passed to parent. */ int px_ctlops(dev_info_t *dip, dev_info_t *rdip, ddi_ctl_enum_t op, void *arg, void *result) { px_t *px_p = DIP_TO_STATE(dip); struct detachspec *ds; struct attachspec *as; switch (op) { case DDI_CTLOPS_INITCHILD: return (px_init_child(px_p, (dev_info_t *)arg)); case DDI_CTLOPS_UNINITCHILD: return (px_uninit_child(px_p, (dev_info_t *)arg)); case DDI_CTLOPS_ATTACH: if (!pcie_is_child(dip, rdip)) return (DDI_SUCCESS); as = (struct attachspec *)arg; switch (as->when) { case DDI_PRE: if (as->cmd == DDI_ATTACH) { DBG(DBG_PWR, dip, "PRE_ATTACH for %s@%d\n", ddi_driver_name(rdip), ddi_get_instance(rdip)); return (pcie_pm_hold(dip)); } if (as->cmd == DDI_RESUME) { DBG(DBG_PWR, dip, "PRE_RESUME for %s@%d\n", ddi_driver_name(rdip), ddi_get_instance(rdip)); pcie_clear_errors(rdip); } return (DDI_SUCCESS); case DDI_POST: DBG(DBG_PWR, dip, "POST_ATTACH for %s@%d\n", ddi_driver_name(rdip), ddi_get_instance(rdip)); if (as->cmd == DDI_ATTACH && as->result != DDI_SUCCESS) { /* * Attach failed for the child device. The child * driver may have made PM calls before the * attach failed. pcie_pm_remove_child() should * cleanup PM state and holds (if any) * associated with the child device. */ return (pcie_pm_remove_child(dip, rdip)); } if (as->result == DDI_SUCCESS) pf_init(rdip, (void *)px_p->px_fm_ibc, as->cmd); (void) pcie_postattach_child(rdip); return (DDI_SUCCESS); default: break; } break; case DDI_CTLOPS_DETACH: if (!pcie_is_child(dip, rdip)) return (DDI_SUCCESS); ds = (struct detachspec *)arg; switch (ds->when) { case DDI_POST: if (ds->cmd == DDI_DETACH && ds->result == DDI_SUCCESS) { DBG(DBG_PWR, dip, "POST_DETACH for %s@%d\n", ddi_driver_name(rdip), ddi_get_instance(rdip)); return (pcie_pm_remove_child(dip, rdip)); } return (DDI_SUCCESS); case DDI_PRE: pf_fini(rdip, ds->cmd); return (DDI_SUCCESS); default: break; } break; case DDI_CTLOPS_REPORTDEV: if (ddi_get_parent(rdip) == dip) return (px_report_dev(rdip)); (void) px_lib_fabric_sync(rdip); return (DDI_SUCCESS); case DDI_CTLOPS_IOMIN: return (DDI_SUCCESS); case DDI_CTLOPS_REGSIZE: *((off_t *)result) = px_get_reg_set_size(rdip, *((int *)arg)); return (*((off_t *)result) == 0 ? DDI_FAILURE : DDI_SUCCESS); case DDI_CTLOPS_NREGS: *((uint_t *)result) = px_get_nreg_set(rdip); return (DDI_SUCCESS); case DDI_CTLOPS_DVMAPAGESIZE: *((ulong_t *)result) = MMU_PAGE_SIZE; return (DDI_SUCCESS); case DDI_CTLOPS_POKE: /* platform dependent implementation. */ return (px_lib_ctlops_poke(dip, rdip, (peekpoke_ctlops_t *)arg)); case DDI_CTLOPS_PEEK: /* platform dependent implementation. */ return (px_lib_ctlops_peek(dip, rdip, (peekpoke_ctlops_t *)arg, result)); case DDI_CTLOPS_POWER: default: break; } /* * Now pass the request up to our parent. */ DBG(DBG_CTLOPS, dip, "passing request to parent: rdip=%s%d\n", ddi_driver_name(rdip), ddi_get_instance(rdip)); return (ddi_ctlops(dip, rdip, op, arg, result)); }
// init driver static int init(sh_video_t *sh){ int i; uint8_t *extradata = (uint8_t *)(sh->bih + 1); int extradata_size = sh->bih->biSize - sizeof(*sh->bih); unsigned char *p = extradata; for (i=0;i<extradata_size;i++) mp_msg(MSGT_VO,MSGL_ERR,"[%x]",extradata[i]); dll_handle=dlopen("libOmxCore.so",RTLD_NOW|RTLD_GLOBAL); if (dll_handle){ pf_init = dlsym( dll_handle, "OMX_Init" ); pf_deinit = dlsym( dll_handle, "OMX_Deinit" ); pf_get_handle = dlsym( dll_handle, "OMX_GetHandle" ); pf_free_handle = dlsym( dll_handle, "OMX_FreeHandle" ); pf_component_enum = dlsym( dll_handle, "OMX_ComponentNameEnum" ); pf_get_roles_of_component = dlsym( dll_handle, "OMX_GetRolesOfComponent" ); if( !pf_init || !pf_deinit || !pf_get_handle || !pf_free_handle || !pf_component_enum || !pf_get_roles_of_component ) { __android_log_print(ANDROID_LOG_ERROR , "MPlayer","Error in OMX"); } else { __android_log_print(ANDROID_LOG_ERROR , "MPlayer","Success in OMX"); omx_error = pf_init(); if(omx_error != OMX_ErrorNone) { __android_log_print(ANDROID_LOG_ERROR , "MPlayer","OMX Init Failed"); return 0; } while (1){ omx_error=pf_component_enum(psz_name, OMX_MAX_STRINGNAME_SIZE, i); if(omx_error != OMX_ErrorNone) break; __android_log_print(ANDROID_LOG_ERROR , "MPlayer","Component %d,%s",i,psz_name); omx_error = pf_get_roles_of_component(psz_name, &no_of_roles, NULL); if (omx_error != OMX_ErrorNone) { __android_log_print(ANDROID_LOG_ERROR , "MPlayer","No Role for Component %s",psz_name); } else { if(no_of_roles == 0) { __android_log_print(ANDROID_LOG_ERROR , "MPlayer","No Role for Component -2 %s",psz_name); } else { string_of_roles = malloc(no_of_roles * sizeof(OMX_STRING)); for (index1 = 0; index1 < no_of_roles; index1++) { *(string_of_roles + index1) = malloc(no_of_roles * OMX_MAX_STRINGNAME_SIZE); } omx_error = pf_get_roles_of_component(psz_name, &no_of_roles, string_of_roles); if (omx_error == OMX_ErrorNone && string_of_roles!=NULL) { for (index1 = 0; index1 < no_of_roles; index1++) { __android_log_print(ANDROID_LOG_ERROR , "MPlayer","The role %i for the component: %s",(index1+1),*(string_of_roles+index1)); } } else { __android_log_print(ANDROID_LOG_ERROR , "MPlayer","Error getting role"); } } } i++; } omx_error=pf_get_handle( &omx_handle, "OMX.qcom.video.decoder.avc\0",NULL,&callbacks); __android_log_print(ANDROID_LOG_ERROR , "MPlayer","Get Handle %s",ErrorToString(omx_error)); if (omx_handle){ input_port_def.nPortIndex = 0; omx_error = OMX_GetParameter(omx_handle, OMX_IndexParamPortDefinition, &input_port_def); __android_log_print(ANDROID_LOG_ERROR , "MPlayer","GetPortDefination %s",ErrorToString(omx_error)); input_port_def.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC; input_port_def.format.video.nFrameWidth = sh->disp_w; input_port_def.format.video.nFrameHeight = sh->disp_h; omx_error = OMX_SetParameter(omx_handle, OMX_IndexParamPortDefinition, &input_port_def); __android_log_print(ANDROID_LOG_ERROR , "MPlayer","SetParameter %s",ErrorToString(omx_error)); omx_error = OMX_SendCommand(omx_handle, OMX_CommandPortEnable, 1, NULL); __android_log_print(ANDROID_LOG_ERROR , "MPlayer","PortEnable %s",ErrorToString(omx_error)); outBufferParseVideo[0] = outBufferParseVideo[1] = NULL; omx_error = OMX_SendCommand( omx_handle, OMX_CommandStateSet, OMX_StateIdle, 0 ); __android_log_print(ANDROID_LOG_ERROR , "MPlayer","StateIdle %s",ErrorToString(omx_error)); sleep(1); omx_error = OMX_SendCommand( omx_handle, OMX_CommandStateSet, OMX_StateLoaded, 0 ); __android_log_print(ANDROID_LOG_ERROR , "MPlayer","StateLoaded %s",ErrorToString(omx_error)); omx_error = OMX_AllocateBuffer(omx_handle, &outBufferParseVideo[0], 0, NULL,16384); __android_log_print(ANDROID_LOG_ERROR , "MPlayer","AllocateBuffer %s",ErrorToString(omx_error)); omx_error = OMX_AllocateBuffer(omx_handle, &outBufferParseVideo[1], 0, NULL,16384); __android_log_print(ANDROID_LOG_ERROR , "MPlayer","AllocateBuffer %s",ErrorToString(omx_error)); /* omx_error = OMX_UseBuffer(omx_handle, &inBufferVideoDec[0], 0, NULL, 16384, outBufferParseVideo[0]->pBuffer); __android_log_print(ANDROID_LOG_ERROR , "MPlayer","UseBuffer 1%s",ErrorToString(omx_error)); omx_error = OMX_UseBuffer(omx_handle, &inBufferVideoDec[1], 0, NULL, 16384, outBufferParseVideo[1]->pBuffer); __android_log_print(ANDROID_LOG_ERROR , "MPlayer","UseBuffer 2%s",ErrorToString(omx_error));*/ omx_error = OMX_AllocateBuffer(omx_handle, &outBufferVideoDec[0], 1, NULL, 16384); __android_log_print(ANDROID_LOG_ERROR , "MPlayer","AllocateBuffer Video 1%s",ErrorToString(omx_error)); omx_error = OMX_AllocateBuffer(omx_handle, &outBufferVideoDec[1], 1, NULL, 16384); __android_log_print(ANDROID_LOG_ERROR , "MPlayer","AllocateBuffer Video 2%s",ErrorToString(omx_error)); omx_error = OMX_SendCommand(omx_handle, OMX_CommandStateSet,OMX_StateExecuting, 0); sleep(1); outBufferParseVideo[0]->nFilledLen = extradata_size; memcpy(outBufferParseVideo[0]->pBuffer, extradata, extradata_size); omx_error=OMX_EmptyThisBuffer(omx_handle, outBufferParseVideo[0]); if (omx_error != OMX_ErrorNone) { __android_log_print(ANDROID_LOG_ERROR , "MPlayer","Error %s",ErrorToString(omx_error)); } __android_log_print(ANDROID_LOG_ERROR , "MPlayer","Error %s",ErrorToString(omx_error)); } } } else __android_log_print(ANDROID_LOG_ERROR , "MPlayer","Unable to open OMX dll"); return 1; }
/** * Convert an OccupancyGrid map message into the internal representation. */ void AMCLocalizer::initMap( const nav_msgs::OccupancyGrid& map_msg ) { /* * Convert an OccupancyGrid map message into the internal representation. */ std::cout << "1" << std::endl; freeMapDependentMemory(); // Clear queued laser objects because they hold pointers to the existing map, #5202. // lasers_.clear(); // lasers_update_.clear(); std::cout << "2" << std::endl; map_t* map = map_alloc(); // ROS_ASSERT(map); std::cout << "3" << std::endl; map->size_x = map_msg.info.width; map->size_y = map_msg.info.height; map->scale = map_msg.info.resolution; map->origin_x = map_msg.info.origin.position.x + (map->size_x / 2) * map->scale; map->origin_y = map_msg.info.origin.position.y + (map->size_y / 2) * map->scale; // Convert to player format std::cout << "4" << std::endl; map->cells = (map_cell_t*)malloc(sizeof(map_cell_t)*map->size_x*map->size_y); //ROS_ASSERT(map->cells); std::cout << "5" << std::endl; for(int i=0; i<map->size_x * map->size_y; i++) { if(map_msg.data[i] == 0) map->cells[i].occ_state = -1; else if(map_msg.data[i] == 100) map->cells[i].occ_state = +1; else map->cells[i].occ_state = 0; } std::cout << "6" << std::endl; first_map_received_ = true; /* * Initialize the particle filter */ #if NEW_UNIFORM_SAMPLING // Index of free space std::cout << "7" << std::endl; free_space_indices.resize(0); std::cout << "8" << std::endl; for(int i = 0; i < map_->size_x; i++) for(int j = 0; j < map_->size_y; j++) if(map_->cells[MAP_INDEX(map_,i,j)].occ_state == -1) free_space_indices.push_back(std::make_pair(i,j)); #endif std::cout << "9" << std::endl; // boost::recursive_mutex::scoped_lock cfl(configuration_mutex_); pf_ = pf_alloc(min_particles_, max_particles_, alpha_slow_, alpha_fast_, (pf_init_model_fn_t)AMCLocalizer::uniformPoseGenerator, (void *)map_); std::cout << "10" << std::endl; pf_->pop_err = pf_err_; pf_->pop_z = pf_z_; pf_vector_t pf_init_pose_mean = pf_vector_zero(); pf_init_pose_mean.v[0] = init_pose_[0]; pf_init_pose_mean.v[1] = init_pose_[1]; pf_init_pose_mean.v[2] = init_pose_[2]; pf_matrix_t pf_init_pose_cov = pf_matrix_zero(); pf_init_pose_cov.m[0][0] = init_cov_[0]; pf_init_pose_cov.m[1][1] = init_cov_[1]; pf_init_pose_cov.m[2][2] = init_cov_[2]; pf_init(pf_, pf_init_pose_mean, pf_init_pose_cov); pf_init_ = false; /* * Instantiate the sensor objects: Odometry */ delete odom_; odom_ = new AMCLOdom(); // ROS_ASSERT(odom_); if(odom_model_type_ == ODOM_MODEL_OMNI) odom_->SetModelOmni(alpha1_, alpha2_, alpha3_, alpha4_, alpha5_); else odom_->SetModelDiff(alpha1_, alpha2_, alpha3_, alpha4_); /* * Instantiate the sensor objects: Laser */ delete laser_; laser_ = new AMCLLaser(max_beams_, map_); // ROS_ASSERT(laser_); if(laser_model_type_ == LASER_MODEL_BEAM) laser_->SetModelBeam(z_hit_, z_short_, z_max_, z_rand_, sigma_hit_, lambda_short_, 0.0); else { laser_->SetModelLikelihoodField(z_hit_, z_rand_, sigma_hit_, laser_likelihood_max_dist_); } // In case the initial pose message arrived before the first map, // try to apply the initial pose now that the map has arrived. applyInitialPose(); }
/*ARGSUSED*/ static int ppb_ctlops(dev_info_t *dip, dev_info_t *rdip, ddi_ctl_enum_t ctlop, void *arg, void *result) { pci_regspec_t *drv_regp; int reglen; int rn; struct attachspec *as; struct detachspec *ds; int totreg; ppb_devstate_t *ppb_p; ppb_p = (ppb_devstate_t *)ddi_get_soft_state(ppb_state, ddi_get_instance(dip)); switch (ctlop) { case DDI_CTLOPS_REPORTDEV: if (rdip == (dev_info_t *)0) return (DDI_FAILURE); cmn_err(CE_CONT, "?PCI-device: %s@%s, %s%d\n", ddi_node_name(rdip), ddi_get_name_addr(rdip), ddi_driver_name(rdip), ddi_get_instance(rdip)); return (DDI_SUCCESS); case DDI_CTLOPS_INITCHILD: return (ppb_initchild((dev_info_t *)arg)); case DDI_CTLOPS_UNINITCHILD: ppb_uninitchild((dev_info_t *)arg); return (DDI_SUCCESS); case DDI_CTLOPS_ATTACH: if (!pcie_is_child(dip, rdip)) return (DDI_SUCCESS); as = (struct attachspec *)arg; if ((ppb_p->parent_bus == PCIE_PCIECAP_DEV_TYPE_PCIE_DEV) && (as->when == DDI_POST) && (as->result == DDI_SUCCESS)) pf_init(rdip, ppb_p->fm_ibc, as->cmd); return (DDI_SUCCESS); case DDI_CTLOPS_DETACH: if (!pcie_is_child(dip, rdip)) return (DDI_SUCCESS); ds = (struct detachspec *)arg; if ((ppb_p->parent_bus == PCIE_PCIECAP_DEV_TYPE_PCIE_DEV) && (ds->when == DDI_PRE)) pf_fini(rdip, ds->cmd); return (DDI_SUCCESS); case DDI_CTLOPS_SIDDEV: return (DDI_SUCCESS); case DDI_CTLOPS_REGSIZE: case DDI_CTLOPS_NREGS: if (rdip == (dev_info_t *)0) return (DDI_FAILURE); break; default: return (ddi_ctlops(dip, rdip, ctlop, arg, result)); } *(int *)result = 0; if (ddi_getlongprop(DDI_DEV_T_ANY, rdip, DDI_PROP_DONTPASS | DDI_PROP_CANSLEEP, "reg", (caddr_t)&drv_regp, ®len) != DDI_SUCCESS) return (DDI_FAILURE); totreg = reglen / sizeof (pci_regspec_t); if (ctlop == DDI_CTLOPS_NREGS) *(int *)result = totreg; else if (ctlop == DDI_CTLOPS_REGSIZE) { rn = *(int *)arg; if (rn >= totreg) { kmem_free(drv_regp, reglen); return (DDI_FAILURE); } *(off_t *)result = drv_regp[rn].pci_size_low | ((uint64_t)drv_regp[rn].pci_size_hi << 32); } kmem_free(drv_regp, reglen); return (DDI_SUCCESS); }
/*ARGSUSED*/ static int ppb_ctlops(dev_info_t *dip, dev_info_t *rdip, ddi_ctl_enum_t ctlop, void *arg, void *result) { pci_regspec_t *drv_regp; int reglen; int rn; int totreg; ppb_devstate_t *ppb = ddi_get_soft_state(ppb_state, ddi_get_instance(dip)); struct detachspec *dsp; struct attachspec *asp; switch (ctlop) { case DDI_CTLOPS_REPORTDEV: if (rdip == (dev_info_t *)0) return (DDI_FAILURE); cmn_err(CE_CONT, "?PCI-device: %s@%s, %s%d\n", ddi_node_name(rdip), ddi_get_name_addr(rdip), ddi_driver_name(rdip), ddi_get_instance(rdip)); return (DDI_SUCCESS); case DDI_CTLOPS_INITCHILD: return (ppb_initchild((dev_info_t *)arg)); case DDI_CTLOPS_UNINITCHILD: ppb_removechild((dev_info_t *)arg); return (DDI_SUCCESS); case DDI_CTLOPS_SIDDEV: return (DDI_SUCCESS); case DDI_CTLOPS_REGSIZE: case DDI_CTLOPS_NREGS: if (rdip == (dev_info_t *)0) return (DDI_FAILURE); break; /* X86 systems support PME wakeup from suspend */ case DDI_CTLOPS_ATTACH: if (!pcie_is_child(dip, rdip)) return (DDI_SUCCESS); asp = (struct attachspec *)arg; if ((ppb->parent_bus == PCIE_PCIECAP_DEV_TYPE_PCIE_DEV) && (asp->when == DDI_POST) && (asp->result == DDI_SUCCESS)) pf_init(rdip, (void *)ppb->ppb_fm_ibc, asp->cmd); if (asp->cmd == DDI_RESUME && asp->when == DDI_PRE) if (pci_pre_resume(rdip) != DDI_SUCCESS) return (DDI_FAILURE); return (DDI_SUCCESS); case DDI_CTLOPS_DETACH: if (!pcie_is_child(dip, rdip)) return (DDI_SUCCESS); dsp = (struct detachspec *)arg; if ((ppb->parent_bus == PCIE_PCIECAP_DEV_TYPE_PCIE_DEV) && (dsp->when == DDI_PRE)) pf_fini(rdip, dsp->cmd); if (dsp->cmd == DDI_SUSPEND && dsp->when == DDI_POST) if (pci_post_suspend(rdip) != DDI_SUCCESS) return (DDI_FAILURE); return (DDI_SUCCESS); case DDI_CTLOPS_PEEK: case DDI_CTLOPS_POKE: if (strcmp(ddi_driver_name(ddi_get_parent(dip)), "npe") != 0) return (ddi_ctlops(dip, rdip, ctlop, arg, result)); return (pci_peekpoke_check(dip, rdip, ctlop, arg, result, ddi_ctlops, &ppb->ppb_err_mutex, &ppb->ppb_peek_poke_mutex, ppb_peekpoke_cb)); default: return (ddi_ctlops(dip, rdip, ctlop, arg, result)); } *(int *)result = 0; if (ddi_getlongprop(DDI_DEV_T_ANY, rdip, DDI_PROP_DONTPASS | DDI_PROP_CANSLEEP, "reg", (caddr_t)&drv_regp, ®len) != DDI_SUCCESS) return (DDI_FAILURE); totreg = reglen / sizeof (pci_regspec_t); if (ctlop == DDI_CTLOPS_NREGS) *(int *)result = totreg; else if (ctlop == DDI_CTLOPS_REGSIZE) { rn = *(int *)arg; if (rn >= totreg) { kmem_free(drv_regp, reglen); return (DDI_FAILURE); } *(off_t *)result = drv_regp[rn].pci_size_low; } kmem_free(drv_regp, reglen); return (DDI_SUCCESS); }