本文整理汇总了C++中LEVEL_DEBUG函数的典型用法代码示例。如果您正苦于以下问题:C++ LEVEL_DEBUG函数的具体用法?C++ LEVEL_DEBUG怎么用?C++ LEVEL_DEBUG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LEVEL_DEBUG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FlipTree
/* Moves new to old tree, initializes new tree, and clears former old tree location */
static void FlipTree( void )
{
void * flip = cache.temporary_tree_old; // old old saved for later clearing
void * flip_alias = cache.temporary_alias_tree_old; // old old saved for later clearing
/* Flip caches! old = new. New truncated, reset time and counters and flag */
LEVEL_DEBUG("Flipping cache tree (purging timed-out data)");
// move "new" pointers to "old"
cache.temporary_tree_old = cache.temporary_tree_new;
cache.old_ram_size = cache.new_ram_size;
cache.temporary_alias_tree_old = cache.temporary_alias_tree_new;
// New cache setup
cache.temporary_tree_new = NULL;
cache.temporary_alias_tree_new = NULL;
cache.new_ram_size = 0;
cache.added = 0;
// set up "old" cache times
cache.time_retired = NOW_TIME;
cache.time_to_kill = cache.time_retired + cache.retired_lifespan;
// delete really old tree
LEVEL_DEBUG("flip cache. tdestroy() will be called.");
SAFETDESTROY( flip, owfree_func);
SAFETDESTROY( flip_alias, owfree_func);
STATLOCK;
++cache_flips; /* statistics */
memcpy(&old_avg, &new_avg, sizeof(struct average));
AVERAGE_CLEAR(&new_avg);
STATUNLOCK;
}
示例2: LINK_detect_serial
static GOOD_OR_BAD LINK_detect_serial(struct connection_in * in)
{
struct port_in * pin = in->pown ;
/* Set up low-level routines */
LINK_setroutines(in);
pin->timeout.tv_sec = Globals.timeout_serial ;
pin->timeout.tv_usec = 0 ;
/* Open the com port */
RETURN_BAD_IF_BAD(COM_open(in)) ;
//COM_break( in ) ;
LEVEL_DEBUG("Slurp in initial bytes");
LINK_slurp( in ) ;
UT_delay(100) ; // based on http://morpheus.wcf.net/phpbb2/viewtopic.php?t=89&sid=3ab680415917a0ebb1ef020bdc6903ad
LINK_slurp( in ) ;
RETURN_GOOD_IF_GOOD( LINK_version(in) ) ;
LEVEL_DEFAULT("LINK detection error");
serial_powercycle(in) ;
LEVEL_DEBUG("Slurp in initial bytes");
LINK_slurp( in ) ;
UT_delay(100) ; // based on http://morpheus.wcf.net/phpbb2/viewtopic.php?t=89&sid=3ab680415917a0ebb1ef020bdc6903ad
LINK_slurp( in ) ;
RETURN_GOOD_IF_GOOD( LINK_version(in) ) ;
LEVEL_DEFAULT("LINK detection error");
COM_close(in) ;
return gbBAD;
}
示例3: OWQ_create_aggregate
/* Use an single OWQ as a template for the aggregate one */
struct one_wire_query * OWQ_create_aggregate( struct one_wire_query * owq_single )
{
int sz = sizeof( struct one_wire_query ) + OWQ_DEFAULT_READ_BUFFER_SIZE;
struct one_wire_query * owq_all = owmalloc( sz );
LEVEL_DEBUG("%s with extension ALL", PN(owq_single)->path);
if ( owq_all == NO_ONE_WIRE_QUERY) {
LEVEL_DEBUG("No memory to create object for extension ALL") ;
return NO_ONE_WIRE_QUERY ;
}
memset(owq_all, 0, sz);
OWQ_cleanup(owq_all) = owq_cleanup_owq ;
memcpy( PN(owq_all), PN(owq_single), sizeof(struct parsedname) ) ;
PN(owq_all)->extension = EXTENSION_ALL ;
OWQ_buffer(owq_all) = (char *) (& owq_all[1]) ; // point just beyond the one_wire_query struct
OWQ_size(owq_all) = OWQ_DEFAULT_READ_BUFFER_SIZE ;
OWQ_offset(owq_all) = 0 ;
if ( BAD( OWQ_allocate_array(owq_all)) ) {
OWQ_destroy(owq_all);
return NO_ONE_WIRE_QUERY ;
}
return owq_all ;
}
示例4: Bundle_pack
static GOOD_OR_BAD Bundle_pack(const struct transaction_log *tl, const struct parsedname *pn)
{
const struct transaction_log *t_index;
struct transaction_bundle s_tb;
struct transaction_bundle *tb = &s_tb;
Bundle_init(tb, pn);
for (t_index = tl; t_index->type != trxn_end; ++t_index) {
switch (Pack_item(t_index, tb)) {
case gbGOOD:
LEVEL_DEBUG("Item added");
break;
case gbBAD:
LEVEL_DEBUG("Item cannot be bundled");
RETURN_BAD_IF_BAD(Bundle_ship(tb, pn)) ;
RETURN_BAD_IF_BAD(BUS_transaction_single(t_index, pn)) ;
break;
case gbOTHER:
LEVEL_DEBUG("Item too big");
RETURN_BAD_IF_BAD(Bundle_ship(tb, pn)) ;
if ( GOOD( Pack_item(t_index, tb) ) ) {
break;
}
RETURN_BAD_IF_BAD(BUS_transaction_single(t_index, pn)) ;
break;
}
}
return Bundle_ship(tb, pn);
}
示例5: AddPropertyToTree
static void AddPropertyToTree( char * s_property, char * s_family, enum ft_format s_format, size_t s_array, enum ag_combined s_combined, enum ag_index s_index_type, size_t s_length, enum fc_change s_change, char * s_read, char * s_write, char * s_data, char * s_other, enum external_type et )
{
struct property_node * n ;
struct {
struct property_node * key ;
char other[0] ;
} * opaque ;
NonNull( s_property )
NonNull( s_family )
NonNull( s_read )
NonNull( s_write )
NonNull( s_data )
NonNull( s_other )
n = create_property_node( s_property, s_family, s_format, s_array, s_combined, s_index_type, s_length, s_change, s_read, s_write, s_data, s_other, et ) ;
opaque = tsearch( (void *) n, &property_tree, property_compare ) ;
if ( opaque->key != n ) {
// already exists
LEVEL_DEBUG("Duplicate property entry: %s,%s,%s,%s,%s,%s",s_property,s_family,s_read,s_write,s_data,s_other);
owfree( n ) ;
} else {
LEVEL_DEBUG("New property entry: %s,%s,%s,%s,%s,%s",s_property,s_family,s_read,s_write,s_data,s_other);
}
}
示例6: LINK_next_both
static enum search_status LINK_next_both(struct device_search *ds, const struct parsedname *pn)
{
struct connection_in * in = pn->selected_connection ;
//Special case for DS2409 hub, use low-level code
if ( pn->ds2409_depth>0 ) {
return search_error ;
}
if (ds->LastDevice) {
return search_done;
}
if (ds->index == -1) {
if ( BAD(LINK_directory(ds, in)) ) {
return search_error;
}
}
// LOOK FOR NEXT ELEMENT
++ds->index;
LEVEL_DEBUG("Index %d", ds->index);
switch ( DirblobGet(ds->index, ds->sn, &(ds->gulp) ) ) {
case 0:
LEVEL_DEBUG("SN found: " SNformat "", SNvar(ds->sn));
return search_good;
case -ENODEV:
default:
ds->LastDevice = 1;
LEVEL_DEBUG("SN finished");
return search_done;
}
}
示例7: read_device_map_offset
static GOOD_OR_BAD read_device_map_offset(const char *device_name, off_t *offset)
{
const unsigned char path_length = 100;
FILE* file;
unsigned int preoffset;
// Get device filename (e.g. uio0)
const char *uio_filename = strrchr(device_name, '/');
if (uio_filename == NULL) {
return gbBAD;
}
// Offset parameter file path
char uio_map_offset_file[path_length];
snprintf(uio_map_offset_file, path_length, "/sys/class/uio/%s/maps/map0/offset", uio_filename);
// Read offset parameter
file = fopen(uio_map_offset_file, "r");
if (file == NULL) {
return gbBAD;
}
if (fscanf(file, "%x", &preoffset) != 1) {
fclose(file);
return gbBAD;
}
fclose(file);
*offset = preoffset;
LEVEL_DEBUG("[%s] map offset: 0x%x", __FUNCTION__, preoffset);
LEVEL_DEBUG("[%s] map offset: 0x%x", __FUNCTION__, *offset);
return gbGOOD;
}
示例8: K1WM_setup
// set control pins and frequency for defauts and global settings
static GOOD_OR_BAD K1WM_setup( struct connection_in * in )
{
uint8_t control_register = DS1WM_control(in) ;
LEVEL_DEBUG("[%s] control_register before setup: 0x%x", __FUNCTION__, control_register);
// Set to channel
K1WM_channel(in) = in->master.ds1wm.active_channel ;
// set some defaults:
UT_setbit( &control_register, e_ds1wm_ppm, in->master.ds1wm.presence_mask ) ; // pulse presence masked
UT_setbit( &control_register, e_ds1wm_en_fow, 0 ) ; // no bit banging
UT_setbit( &control_register, e_ds1wm_stpen, 0 ) ; // strong pullup not supported in K1WM
UT_setbit( &control_register, e_ds1wm_stp_sply, 0 ) ; // not in strong pullup state, too
in->master.ds1wm.byte_mode = 1 ; // default
UT_setbit( &control_register, e_ds1wm_bit_ctl, 0 ) ; // byte mode
UT_setbit( &control_register, e_ds1wm_od, in->overdrive ) ; // not overdrive
UT_setbit( &control_register, e_ds1wm_llm, in->master.ds1wm.longline ) ; // set long line flag
DS1WM_control(in) = control_register ;
LEVEL_DEBUG("[%s] control_register after setup: 0x%x", __FUNCTION__, DS1WM_control(in));
if ( DS1WM_control(in) != control_register ) {
return gbBAD ;
}
return gbGOOD ;
}
示例9: LINK_reset_in
static RESET_TYPE LINK_reset_in(struct connection_in * in)
{
BYTE resp[1+in->CRLF_size];
if (in->changed_bus_settings > 0) {
--in->changed_bus_settings ;
LINK_set_baud(in); // reset paramters
} else {
LINK_flush(in);
}
if ( BAD(LINK_write(LINK_string("r"), 1, in) || BAD( LINK_read(resp, 1, in))) ) {
LEVEL_DEBUG("Error resetting LINK device");
LINK_slurp(in);
return BUS_RESET_ERROR;
}
switch (resp[0]) {
case 'P':
in->AnyDevices = anydevices_yes;
return BUS_RESET_OK;
case 'N':
in->AnyDevices = anydevices_no;
return BUS_RESET_OK;
case 'S':
return BUS_RESET_SHORT;
default:
LEVEL_DEBUG("bad, Unknown LINK response %c", resp[0]);
LINK_slurp(in);
return BUS_RESET_ERROR;
}
}
示例10: W1_Process_Response
enum Netlink_Read_Status W1_Process_Response( void (* nrs_callback)( struct netlink_parse * nlp, void * v, const struct parsedname * pn), SEQ_OR_ERROR seq, void * v, const struct parsedname * pn )
{
struct connection_in * in = pn->selected_connection ;
FILE_DESCRIPTOR_OR_ERROR file_descriptor ;
int bus ;
if ( seq == SEQ_BAD ) {
return nrs_bad_send ;
}
if ( in == NO_CONNECTION ) {
// Send to main netlink rather than a particular bus
file_descriptor = FILE_DESCRIPTOR_BAD ;
bus = 0 ;
} else {
// Bus-specifc
file_descriptor = in->master.w1.netlink_pipe[fd_pipe_read] ;
bus = in->master.w1.id ;
}
while ( GOOD( W1PipeSelect_timeout(file_descriptor)) ) {
struct netlink_parse nlp ;
nlp.nlm = NULL ;
LEVEL_DEBUG("Loop waiting for netlink piped message");
if ( BAD( Get_and_Parse_Pipe( file_descriptor, &nlp )) ) {
LEVEL_DEBUG("Error reading pipe for w1_bus_master%d",bus);
// Don't need to free since nlm not set if BAD
return nrs_error ;
}
if ( NL_SEQ(nlp.nlm->nlmsg_seq) != (unsigned int) seq ) {
LEVEL_DEBUG("Netlink sequence number out of order");
owfree(nlp.nlm) ;
continue ;
}
if ( nlp.w1m->status != 0) {
owfree(nlp.nlm) ;
return nrs_nodev ;
}
if ( nrs_callback == NULL ) { // status message
owfree(nlp.nlm) ;
return nrs_complete ;
}
LEVEL_DEBUG("About to call nrs_callback");
nrs_callback( &nlp, v, pn ) ;
LEVEL_DEBUG("Called nrs_callback");
owfree(nlp.nlm) ;
if ( nlp.cn->ack != 0 ) {
if ( nlp.w1m->type == W1_LIST_MASTERS ) {
continue ; // look for more data
}
if ( nlp.w1c && (nlp.w1c->cmd==W1_CMD_SEARCH || nlp.w1c->cmd==W1_CMD_ALARM_SEARCH) ) {
continue ; // look for more data
}
}
nrs_callback = NULL ; // now look for status message
}
return nrs_timeout ;
}
示例11: DS9490_next_both
static enum search_status DS9490_next_both(struct device_search *ds, const struct parsedname *pn)
{
int dir_gulp_elements = (pn->ds2409_depth==0) ? DS2490_DIR_GULP_ELEMENTS : 1 ;
// LOOK FOR NEXT ELEMENT
++ds->index;
LEVEL_DEBUG("Index %d", ds->index);
if (ds->index % dir_gulp_elements == 0) {
if (ds->LastDevice) {
return search_done;
}
switch ( DS9490_directory(ds, pn) ) {
case search_done:
return search_done;
case search_error:
return search_error;
case search_good:
break;
}
}
switch ( DirblobGet(ds->index % dir_gulp_elements, ds->sn, &(ds->gulp) ) ) {
case 0:
LEVEL_DEBUG("SN found: " SNformat, SNvar(ds->sn));
return search_good;
case -ENODEV:
default:
LEVEL_DEBUG("SN finished");
return search_done;
}
}
示例12: serial_free
/* Called on head of multibus group */
void serial_free(struct connection_in *connection)
{
FILE_DESCRIPTOR_OR_ERROR fd ;
struct port_in * pin = connection->pown ;
if ( pin->state == cs_virgin ) {
return ;
}
fd = pin->file_descriptor ;
if ( FILE_DESCRIPTOR_NOT_VALID( fd ) ) {
// reopen to restore attributes
fd = open( pin->init_data, O_RDWR | O_NONBLOCK | O_NOCTTY ) ;
}
// restore tty settings
if ( FILE_DESCRIPTOR_VALID( fd ) ) {
LEVEL_DEBUG("COM_close: flush");
tcflush( fd, TCIOFLUSH);
LEVEL_DEBUG("COM_close: restore");
if ( tcsetattr( fd, TCSANOW, &(pin->dev.serial.oldSerialTio) ) < 0) {
ERROR_CONNECT("Cannot restore port attributes: %s", pin->init_data);
}
}
Test_and_Close( &( pin->file_descriptor) ) ;
}
示例13: LINK_detect_net
static GOOD_OR_BAD LINK_detect_net(struct connection_in * in)
{
struct port_in * pin = in->pown ;
/* Set up low-level routines */
LINKE_setroutines(in);
pin->timeout.tv_sec = 0 ;
pin->timeout.tv_usec = 300000 ;
/* Open the tcp port */
RETURN_BAD_IF_BAD( COM_open(in) ) ;
LEVEL_DEBUG("Slurp in initial bytes");
// LINK_slurp( in ) ;
UT_delay(1000) ; // based on http://morpheus.wcf.net/phpbb2/viewtopic.php?t=89&sid=3ab680415917a0ebb1ef020bdc6903ad
LINK_slurp( in ) ;
// LINK_flush(in);
pin->dev.telnet.telnet_negotiated = needs_negotiation ;
RETURN_GOOD_IF_GOOD( LINK_version(in) ) ;
// second try -- send a break and line settings
LEVEL_DEBUG("Second try -- send BREAK");
COM_flush(in) ;
COM_break(in);
telnet_change(in);
// LINK_slurp( in ) ;
RETURN_GOOD_IF_GOOD( LINK_version(in) ) ;
LEVEL_DEFAULT("LINK detection error");
COM_close(in) ;
return gbBAD;
}
示例14: DS9490_overdrive
// Switch to overdrive speed -- 3 tries
static GOOD_OR_BAD DS9490_overdrive(const struct parsedname *pn)
{
BYTE sp = _1W_OVERDRIVE_SKIP_ROM;
BYTE resp;
int i;
// we need to change speed to overdrive
for (i = 0; i < 3; i++) {
LEVEL_DATA("set overdrive speed. Attempt %d",i);
if ( BAD( gbRESET(BUS_reset(pn)) ) ) {
continue;
}
if ( BAD( DS9490_sendback_data(&sp, &resp, 1, pn) ) || (_1W_OVERDRIVE_SKIP_ROM != resp) ) {
LEVEL_DEBUG("error setting overdrive %.2X/0x%02X", _1W_OVERDRIVE_SKIP_ROM, resp);
continue;
}
if ( GOOD( USB_Control_Msg(MODE_CMD, MOD_1WIRE_SPEED, ONEWIREBUSSPEED_OVERDRIVE, pn)) ) {
LEVEL_DEBUG("speed is now set to overdrive");
return gbGOOD;
}
}
LEVEL_DEBUG("Error setting overdrive after 3 retries");
return gbBAD;
}
示例15: Config_Monitor_Add
void Config_Monitor_Add( const char * filename )
{
FILE_DESCRIPTOR_OR_ERROR fd ;
struct kevent ke ;
if ( config_monitor_num_files == 0 ) {
// first one
kq = kqueue() ;
if ( kq < 0 ) {
LEVEL_DEBUG("Could not create a kevent queue (kqueue)" ) ;
return ;
}
}
fd = open( filename, O_EVTONLY ) ;
if ( FILE_DESCRIPTOR_NOT_VALID( fd ) ) {
LEVEL_DEBUG("Can't open %s for monitoring", filename ) ;
return ;
}
EV_SET( &ke, fd, EVFILT_VNODE, EV_ADD, NOTE_DELETE|NOTE_WRITE|NOTE_EXTEND|NOTE_RENAME, 0, NULL ) ;
if ( kevent( kq, &ke, 1, NULL, 0, NULL ) != 0 ) {
LEVEL_DEBUG("Couldn't add %s to kqueue for monitoring",filename ) ;
} else {
++ config_monitor_num_files ;
LEVEL_DEBUG("Added %s to kqueue", filename ) ;
}
}