Skip Navigation Links | |
Exit Print View | |
man pages section 9: DDI and DKI Kernel Functions Oracle Solaris 11.1 Information Library |
csx_AccessConfigurationRegister(9F)
csx_Parse_CISTPL_BYTEORDER(9F)
csx_Parse_CISTPL_CFTABLE_ENTRY(9F)
csx_Parse_CISTPL_DEVICEGEO(9F)
csx_Parse_CISTPL_DEVICEGEO_A(9F)
csx_Parse_CISTPL_DEVICE_OA(9F)
csx_Parse_CISTPL_DEVICE_OC(9F)
csx_Parse_CISTPL_LINKTARGET(9F)
csx_Parse_CISTPL_LONGLINK_A(9F)
csx_Parse_CISTPL_LONGLINK_C(9F)
csx_Parse_CISTPL_LONGLINK_MFC(9F)
ddi_get_soft_iblock_cookie(9F)
ddi_intr_get_supported_types(9F)
ddi_prop_lookup_byte_array(9F)
ddi_prop_lookup_int64_array(9F)
ddi_prop_lookup_string_array(9F)
ddi_prop_update_byte_array(9F)
ddi_prop_update_int64_array(9F)
ddi_prop_update_string_array(9F)
ldi_prop_lookup_byte_array(9F)
ldi_prop_lookup_int64_array(9F)
ldi_prop_lookup_string_array(9F)
mac_prop_info_set_default_link_flowctrl(9F)
mac_prop_info_set_default_str(9F)
mac_prop_info_set_default_uint8(9F)
mac_prop_info_set_range_uint32(9F)
net_event_notify_unregister(9F)
net_instance_notify_register(9F)
net_instance_notify_unregister(9F)
net_instance_protocol_unregister(9F)
net_protocol_notify_register(9F)
nvlist_lookup_boolean_array(9F)
nvlist_lookup_boolean_value(9F)
nvlist_lookup_nvlist_array(9F)
nvlist_lookup_string_array(9F)
nvlist_lookup_uint16_array(9F)
nvlist_lookup_uint32_array(9F)
nvlist_lookup_uint64_array(9F)
nvpair_value_boolean_array(9F)
pci_plist_lookup_int16_array(9F)
pci_plist_lookup_int32_array(9F)
pci_plist_lookup_int64_array(9F)
pci_plist_lookup_int8_array(9F)
pci_plist_lookup_string_array(9F)
pci_plist_lookup_uint16_array(9F)
pci_plist_lookup_uint32_array(9F)
pci_plist_lookup_uint64_array(9F)
pci_plist_lookup_uint8_array(9F)
scsi_get_device_type_scsi_options(9F)
scsi_get_device_type_string(9F)
scsi_sense_cmdspecific_uint64(9F)
usb_get_current_frame_number(9F)
usb_get_max_pkts_per_isoc_request(9F)
usb_pipe_get_max_bulk_transfer_size(9F)
usb_pipe_stop_intr_polling(9F)
usb_pipe_stop_isoc_polling(9F)
- issue nanosecond periodic timeout requests
#include <sys/dditypes.h> #include <sys/sunddi.h> ddi_periodic_t ddi_periodic_add(void (*func)(void *), void arg, hrtime_t interval, int level);
Solaris DDI specific (Solaris DDI)
The callback function is invoked periodically in the specified interval. If the argument level is zero, the function is invoked in kernel context. Otherwise, it's invoked in interrupt context at the specified level.
The argument passed to the callback function.
Interval time in nanoseconds.
Callback interrupt level. If the value is zero, the callback function is invoked in kernel context. If the value is more than zero, but less than or equal to ten, the callback function is invoked in interrupt context at the specified interrupt level, which may be used for real time applications.
This value must be in range of 0-10, which can be either a numeric number, a pre-defined macro (DDI_IPL_0, ... , DDI_IPL_10), or the DDI_INTR_PRI macro with the interrupt priority.
The ddi_periodic_add() function schedules the specified function to be periodically invoked in the nanosecond interval time.
As with timeout(9F), the exact time interval over which the function takes effect cannot be guaranteed, but the value given is a close approximation.
ddi_periodic_add()returns the non-zero opaque value (ddi_periodic_t), which might be used for ddi_periodic_delete(9F) to specify the request.
The ddi_periodic_add() function may be called from user or kernel context.
Example 1 Using ddi_periodic_add() for a periodic callback function
In the following example, the device driver registers a periodic callback function invoked in kernel context.
static void my_periodic_func(void *arg) { /* * This handler is invoked periodically. */ struct my_state *statep = (struct my_state *)arg; mutex_enter(&statep->lock); if (load_unbalanced(statep)) { balance_tasks(statep); } mutex_exit(&statep->lock); } static void start_periodic_timer(struct my_state *statep) { hrtime_t interval = CHECK_INTERVAL; mutex_init(&statep->lock, NULL, MUTEX_DRIVER, (void *)DDI_IPL_0); /* * Register my_callback which is invoked periodically * in CHECK_INTERVAL in kernel context. */ statep->periodic_id = ddi_periodic_add(my_periodic_func, statep, interval, DDI_IPL_0);
In the following example, the device driver registers a callback function invoked in interrupt context at level 7.
/* * This handler is invoked periodically in interrupt context. */ static void my_periodic_int7_func(void *arg) { struct my_state *statep = (struct my_state *)arg; mutex_enter(&statep->lock); monitor_device(statep); mutex_exit(&statep->lock); } static void start_monitor_device(struct my_state *statep) { hrtime_t interval = MONITOR_INTERVAL; mutex_init(&statep->lock, NULL, MUTEX_DRIVER, (void *)DDI_IPL_7); /* * Register the callback function invoked periodically * at interrupt level 7. */ statep->periodic_id = ddi_periodic_add(my_periodic_int7_func, statep, interval, DDI_IPL_7); }
cv_timedwait(9F), ddi_intr_get_pri(9F), ddi_periodic_delete(9F), ddi_intr_get_softint_pri(9F), delay(9F), drv_usectohz(9F), qtimeout(9F), quntimeout(9F), timeout(9F), untimeout(9F)
A caller can only specify an interval in an integral multiple of 10ms. No other values are supported at this time. The interval specified is a lower bound on the interval on which the callback occurs.