예제 #1
0
파일: dhcp.c 프로젝트: ConvTeam/WIZlib
static void dhcp_async_cb(uint8 sock, uint8 item, int32 ret)	// for async mode
{
	switch(item) {
	case WATCH_SOCK_UDP_SEND:
		if(dhcp_alarm) alarm_set(10, dhcp_alarm_cb, 0);
		dhcp_run_tick = wizpf_get_systick();
		if(ret == RET_OK) {
			DBG("DHCP Discovery Sent Async");
			if(di.state == DHCP_STATE_INIT) SET_STATE(DHCP_STATE_SEARCHING);
			else if(di.state == DHCP_STATE_SELECTING) SET_STATE(DHCP_STATE_REQUESTING);
			else DBGCRTCA(TRUE, "wrong state(%d)", di.state);
		} else {
			DBGA("WATCH_SOCK_UDP_SEND fail - ret(%d)", ret);
		}
		break;
	case WATCH_SOCK_TCP_SEND:
	case WATCH_SOCK_CONN_TRY:
	case WATCH_SOCK_CLS_TRY:
	case WATCH_SOCK_CONN_EVT:
	case WATCH_SOCK_CLS_EVT:
	case WATCH_SOCK_RECV:
		DBGCRTC(TRUE, "DHCP does not use TCP");
	default: DBGCRTCA(TRUE, "wrong item(0x%x)", item);
	}

}
예제 #2
0
int phys_mem_release(struct inode *inode, struct file *filp)
{
	struct phys_mem_session *session; /* the to-be destroyed session */

	session = (struct phys_mem_session *) filp->private_data;

	if (down_interruptible(&session->sem))
		return -ERESTARTSYS;

	/*
	 * Depending on the state of the session we need to do several
	 * steps. This "fast'n'furious" implementation of the state
	 * machine is chosen over the 'real' steps because
	 * this way it is much cleaner.
	 */
	while (GET_STATE(session) != SESSION_STATE_CLOSED) {
		switch (GET_STATE(session)) {
		case SESSION_STATE_OPEN:
			/*
			 * Release all resources aquired in open (except the
			 * session and the lock)
			 */
			session->device = NULL;
			session->vmas = 0;
			SET_STATE(session, SESSION_STATE_CLOSED);
			break;

		case SESSION_STATE_CONFIGURING:
			/*
			 * Bad: We need to wait until we have a valid state again
			 * In theory this could go on for ever.
			 */
			pr_warn("Session %llu: Releasing device while it is "
				"impossible (SESSION_STATE_CONFIGURING)\n",
				session->session_id);
			up(&session->sem);
			return -ERESTARTSYS;

		case SESSION_STATE_CONFIGURED:
			/* Free all claimed pages */
			free_page_stati(session);
			SET_STATE(session, SESSION_STATE_OPEN);
			break;

		case SESSION_STATE_MAPPED: break;
			/* Hope that all mappings have been taken care of ... */
			if (session->vmas)
				pr_notice("Session %llu: Releasing device "
					  "while it still holds %d mappings "
					  "(SESSION_STATE_MAPPED)\n ",
					  session->session_id, session->vmas);
			SET_STATE(session, SESSION_STATE_CONFIGURED);
			break;
		}
	}

	up(&session->sem);
	kmem_cache_free(session_mem_cache, session);
	return 0;
}
예제 #3
0
파일: dhcp.c 프로젝트: seablueg/FWlib-dev
static void dhcp_alarm_cb(int8 arg)	// for alarm mode
{
	if(dhcp_alarm == FALSE) return;
	if(arg == 0) {
		if(workinfo.DHCP == NETINFO_DHCP_FAIL) {
			workinfo.DHCP = NETINFO_DHCP_BUSY;
			di.action = DHCP_ACT_START;
		}
		if(dhcp_get_state() == DHCP_STATE_IP_CHECK) {
			alarm_set(wizpf_tick_conv(FALSE, di.renew_time), dhcp_alarm_cb, 1);
			alarm_set(wizpf_tick_conv(FALSE, di.rebind_time), dhcp_alarm_cb, 2);
		}
		dhcp_run();
	} else if(arg == 1) {	// renew
		SET_STATE(DHCP_STATE_SELECTING);
		di.action = DHCP_ACT_RENEW;
		di.xid++;
		alarm_set(10, dhcp_alarm_cb, 0);
	} else if(arg == 2) {	// rebind
		SET_STATE(DHCP_STATE_SELECTING);
		di.action = DHCP_ACT_REBIND;
		di.xid++;
		alarm_set(10, dhcp_alarm_cb, 0);
	}
}
예제 #4
0
파일: dhcp.c 프로젝트: ConvTeam/WIZlib
static void dhcp_alarm_cb(int8 arg)	// for DHCP auto mode
{
	if(dhcp_alarm == FALSE) return;
	if(arg == 0) {
		if(di.state == DHCP_STATE_BOUND) {
			alarm_set(wizpf_tick_conv(FALSE, di.renew_time), dhcp_alarm_cb, 1);
			alarm_set(wizpf_tick_conv(FALSE, di.rebind_time), dhcp_alarm_cb, 2);
		}
		if(di.state == DHCP_STATE_FAILED) {
			di.state = DHCP_STATE_INIT;
			di.action = DHCP_ACT_START;
		}
		dhcp_run();
	} else if(arg == 1) {	// renew
		SET_STATE(DHCP_STATE_SELECTING);
		di.action = DHCP_ACT_RENEW;
		di.xid++;
		alarm_set(10, dhcp_alarm_cb, 0);
	} else if(arg == 2) {	// rebind
		SET_STATE(DHCP_STATE_SELECTING);
		di.action = DHCP_ACT_REBIND;
		di.xid++;
		alarm_set(10, dhcp_alarm_cb, 0);
	}
}
예제 #5
0
파일: dhcp.c 프로젝트: ConvTeam/WIZlib
/**
 * DHCP manual mode handler.
 * - Blocking Function
 * - Used only at DHCP manual mode (DHCP mode could be chosen at wizconfig.h file)
 * - DHCP_MANUAL mode does not need a loop structure, but if there is no loop structure, \n
 *    you should handle renew & rebind with your own way, or just ignore renew & rebind action
 *
 * @param action The action you want to do. (@ref dhcp_action)
 * @param renew For returning renew time when DHCP be bound (NULL will be ignored)
 * @param rebind For returning rebind time when DHCP be bound (NULL will be ignored)
 * @return RET_OK: Success
 * @return RET_NOK: Error
 */
int8 dhcp_manual(dhcp_action action, uint32 *renew, uint32 *rebind)	// blocking function
{
	dhcp_state curstt = di.state;

	if(dhcp_alarm == TRUE) return RET_NOK;

	while(curstt != DHCP_STATE_INIT && curstt != DHCP_STATE_BOUND) {
		dhcp_run();
		curstt = di.state;
	}

	if(curstt == DHCP_STATE_INIT) {
		di.action = DHCP_ACT_START;
		memset(&workinfo, 0, sizeof(workinfo));
		workinfo.dhcp = NETINFO_DHCP;
		SetNetInfo(&workinfo);
		
		// ToDo: Set zero IP & SN
		
		do {
			dhcp_run();
			curstt = di.state;
		} while((curstt != DHCP_STATE_INIT || di.action != DHCP_ACT_START) 
			&& curstt != DHCP_STATE_BOUND);
		if(curstt != DHCP_STATE_BOUND) return RET_NOK;
		if(renew) *renew = di.renew_time;
		if(rebind) *rebind = di.rebind_time;
	} else if(curstt == DHCP_STATE_BOUND) {
		if(action == DHCP_ACT_START) {
			if(renew) *renew = 0;
			if(rebind) *rebind = 0;
			return RET_OK;
		} else if(action == DHCP_ACT_RENEW) {	// renew
			SET_STATE(DHCP_STATE_SELECTING);
			di.action = DHCP_ACT_RENEW;
			di.xid++;
		} else if(action == DHCP_ACT_REBIND) {	// rebind
			SET_STATE(DHCP_STATE_SELECTING);
			di.action = DHCP_ACT_REBIND;
			di.xid++;
		} else {
			ERRA("wrong action(%d)", action);
			return RET_NOK;
		}
		curstt = di.state;
		while(curstt != DHCP_STATE_INIT && curstt != DHCP_STATE_BOUND) {
			dhcp_run();
			curstt = di.state;
		}
		if(curstt != DHCP_STATE_BOUND) return RET_NOK;
		if(renew) *renew = di.renew_time;
		if(rebind) *rebind = di.rebind_time;
	}

	return RET_OK;
}
예제 #6
0
파일: dhcp.c 프로젝트: seablueg/FWlib-dev
int8 dhcp_manual(int8 action, uint8 *saved_ip, uint32 *renew, uint32 *rebind)	// blocking function
{
	int8 curstt = dhcp_get_state();

	if(dhcp_alarm == TRUE) return RET_NOK;

	while(curstt != DHCP_STATE_INIT && curstt != DHCP_STATE_BOUND) {
		dhcp_run();
		curstt = dhcp_get_state();
	}

	if(curstt == DHCP_STATE_INIT) {
		di.action = DHCP_ACT_START;
		memset(&workinfo, 0, sizeof(workinfo));
		if(saved_ip) memcpy(workinfo.IP, saved_ip, 4);
		workinfo.DHCP = NETINFO_DHCP_BUSY;
		SetNetInfo(&workinfo);
		do {
			dhcp_run();
			curstt = dhcp_get_state();
		} while((curstt != DHCP_STATE_INIT || workinfo.DHCP == NETINFO_DHCP_BUSY) 
			&& curstt != DHCP_STATE_BOUND);
		if(curstt != DHCP_STATE_BOUND) return RET_NOK;
		if(renew) *renew = di.renew_time;
		if(rebind) *rebind = di.rebind_time;
	} else if(curstt == DHCP_STATE_BOUND) {
		if(action == DHCP_ACT_START) {
			if(renew) *renew = 0;
			if(rebind) *rebind = 0;
			return RET_OK;
		} else if(action == DHCP_ACT_RENEW) {	// renew
			SET_STATE(DHCP_STATE_SELECTING);
			di.action = DHCP_ACT_RENEW;
			di.xid++;
		} else if(action == DHCP_ACT_REBIND) {	// rebind
			SET_STATE(DHCP_STATE_SELECTING);
			di.action = DHCP_ACT_REBIND;
			di.xid++;
		} else {
			ERRA("wrong action(%d)", action);
			return RET_NOK;
		}
		curstt = dhcp_get_state();
		while(curstt != DHCP_STATE_INIT && curstt != DHCP_STATE_BOUND) {
			dhcp_run();
			curstt = dhcp_get_state();
		}
		if(curstt != DHCP_STATE_BOUND) return RET_NOK;
		if(renew) *renew = di.renew_time;
		if(rebind) *rebind = di.rebind_time;
	}

	return RET_OK;
}
예제 #7
0
/* array = '[' [ value { ',' value } ] ']' */
static int parse_array(struct frozen *f) {
  int i = 0, current_path_len;
  char buf[20];
  CALL_BACK(f, JSON_TYPE_ARRAY_START, NULL, 0);
  TRY(test_and_skip(f, '['));
  {
    {
      SET_STATE(f, f->cur - 1, "", 0);
      while (cur(f) != ']') {
        snprintf(buf, sizeof(buf), "[%d]", i);
        i++;
        current_path_len = append_to_path(f, buf, strlen(buf));
        f->cur_name =
            f->path + strlen(f->path) - strlen(buf) + 1 /*opening brace*/;
        f->cur_name_len = strlen(buf) - 2 /*braces*/;
        TRY(parse_value(f));
        truncate_path(f, current_path_len);
        if (cur(f) == ',') f->cur++;
      }
      TRY(test_and_skip(f, ']'));
      truncate_path(f, fstate.path_len);
      CALL_BACK(f, JSON_TYPE_ARRAY_END, fstate.ptr, f->cur - fstate.ptr);
    }
  }
  return 0;
}
예제 #8
0
/* number = [ '-' ] digit+ [ '.' digit+ ] [ ['e'|'E'] ['+'|'-'] digit+ ] */
static int parse_number(struct frozen *f) {
  int ch = cur(f);
  SET_STATE(f, f->cur, "", 0);
  if (ch == '-') f->cur++;
  EXPECT(f->cur < f->end, JSON_STRING_INCOMPLETE);
  EXPECT(is_digit(f->cur[0]), JSON_STRING_INVALID);
  while (f->cur < f->end && is_digit(f->cur[0])) f->cur++;
  if (f->cur < f->end && f->cur[0] == '.') {
    f->cur++;
    EXPECT(f->cur < f->end, JSON_STRING_INCOMPLETE);
    EXPECT(is_digit(f->cur[0]), JSON_STRING_INVALID);
    while (f->cur < f->end && is_digit(f->cur[0])) f->cur++;
  }
  if (f->cur < f->end && (f->cur[0] == 'e' || f->cur[0] == 'E')) {
    f->cur++;
    EXPECT(f->cur < f->end, JSON_STRING_INCOMPLETE);
    if ((f->cur[0] == '+' || f->cur[0] == '-')) f->cur++;
    EXPECT(f->cur < f->end, JSON_STRING_INCOMPLETE);
    EXPECT(is_digit(f->cur[0]), JSON_STRING_INVALID);
    while (f->cur < f->end && is_digit(f->cur[0])) f->cur++;
  }
  truncate_path(f, fstate.path_len);
  CALL_BACK(f, JSON_TYPE_NUMBER, fstate.ptr, f->cur - fstate.ptr);
  return 0;
}
예제 #9
0
파일: c-error.c 프로젝트: 51weekend/r3
*/	void Init_Errors(REBVAL *errors)
/*
***********************************************************************/
{
	REBSER *errs;
	REBVAL *val;

	// Create error objects and error type objects:
	*ROOT_ERROBJ = *Get_System(SYS_STANDARD, STD_ERROR);
	errs = Construct_Object(0, VAL_BLK(errors), 0);
	Set_Object(Get_System(SYS_CATALOG, CAT_ERRORS), errs);

	Set_Root_Series(TASK_ERR_TEMPS, Make_Block(3));

	// Create objects for all error types:
	for (val = BLK_SKIP(errs, 1); NOT_END(val); val++) {
		errs = Construct_Object(0, VAL_BLK(val), 0);
		SET_OBJECT(val, errs);
	}

	// Catch top level errors, to provide decent output:
	PUSH_STATE(Top_State, Saved_State);
	if (SET_JUMP(Top_State)) {
		POP_STATE(Top_State, Saved_State);
		DSP++; // Room for return value
		Catch_Error(DS_TOP); // Stores error value here
		Print_Value(DS_TOP, 0, FALSE);
		Crash(RP_NO_CATCH);
	}
	SET_STATE(Top_State, Saved_State);
}
예제 #10
0
LOCAL VOID do_obj(LONG tree, WORD which, WORD bit)
{
	WORD	state;

	state = GET_STATE(tree, which);
	SET_STATE(tree, which, state | bit);
}
GtkWidget* deepin_workspace_overview_new(void)
{
    DeepinWorkspaceOverview* self = (DeepinWorkspaceOverview*)g_object_new(
            DEEPIN_TYPE_WORKSPACE_OVERVIEW, NULL);

    GdkScreen* screen = gdk_screen_get_default();

    self->priv->fixed_width = gdk_screen_get_width(screen);
    self->priv->fixed_height = gdk_screen_get_height(screen);

    SET_STATE (self, GTK_STATE_FLAG_NORMAL);
    deepin_setup_style_class(GTK_WIDGET(self), "deepin-workspace-clone"); 
    
    g_object_connect(G_OBJECT(self),
            "signal::show", on_deepin_workspace_overview_show, NULL,
            "signal::button-press-event", on_deepin_workspace_overview_pressed, NULL,
            NULL);

    g_object_connect(G_OBJECT(deepin_message_hub_get()), 
            "signal::window-removed", on_window_removed, self,
            "signal::about-to-change-workspace", on_window_change_workspace, self,
            NULL);

    return (GtkWidget*)self;
}
예제 #12
0
static 
NW_Status_t 
Tag_End_CB (NW_WBXML_Parser_t *parser, 
            void *context)
{
  NW_Status_t status = NW_STAT_SUCCESS;
  NW_TinyDom_Parser_t *tiny_parser = (NW_TinyDom_Parser_t*)context;
  NW_Int32 lastvalid;
  NW_REQUIRED_PARAM(parser);

  lastvalid = NW_TinyDom_getLastValid(tiny_parser->dom_tree);
  if(GET_PASS(tiny_parser)== T_PARSE_PASS_2)
  {
    /* for the dom tree appending, we won't handle close tag which is beyond last valid mark */
    if (lastvalid == -1 || (NW_Int32)parser->offset <= lastvalid)
	{
      if(tiny_parser->current_node != NULL)
	  {
      tiny_parser->current_node = NW_TinyTree_findParent(tiny_parser->current_node);
	  }
	  else
	  {
	   status = NW_STAT_FAILURE;
	  }
	}
  }

  if(status == NW_STAT_SUCCESS)
  {
   SET_STATE(tiny_parser, T_PARSE_S_CONTENT);
   tiny_parser->state &= ~T_PARSE_FLAG_TEXT; /* No longer accumulating text */
  }
  return status;
}//end Tag_End_CB (..)
예제 #13
0
파일: dhcp.c 프로젝트: ConvTeam/WIZlib
/**
 * Change DHCP mode to Static.
 * Even though DHCP was enabled, it can be changed to Static mode through this function
 *
 * @param net The addresses you want to set as static addresses
 *	- NULL parameter or NULL member variable will be ignored and internal storage addresses will be used
 *		\n and these address will be returned in this net parameter (if not NULL)
 */
void dhcp_static_mode(wiz_NetInfo *net)
{
	di.action = DHCP_ACT_NONE;
	SET_STATE(DHCP_STATE_INIT);

	if(net != NULL) {
		if(net->ip[0]!=0 || net->ip[1]!=0 || net->ip[2]!=0 || net->ip[3]!=0)
			memcpy(storage.ip, net->ip, 4);
		else memcpy(net->ip, storage.ip, 4);
		if(net->sn[0]!=0 || net->sn[1]!=0 || net->sn[2]!=0 || net->sn[3]!=0)
			memcpy(storage.sn, net->sn, 4);
		else memcpy(net->sn, storage.sn, 4);
		if(net->gw[0]!=0 || net->gw[1]!=0 || net->gw[2]!=0 || net->gw[3]!=0)
			memcpy(storage.gw, net->gw, 4);
		else memcpy(net->gw, storage.gw, 4);
		if(net->dns[0]!=0 || net->dns[1]!=0 || net->dns[2]!=0 || net->dns[3]!=0)
			memcpy(storage.dns, net->dns, 4);
		else memcpy(net->dns, storage.dns, 4);

		net->dhcp = NETINFO_STATIC;
		SetNetInfo(net);
	} else {
		SetNetInfo(&storage);
		memset(&workinfo, 0, sizeof(workinfo));
		workinfo.dhcp = NETINFO_STATIC;
		SetNetInfo(&workinfo);
	}

	if(dhcp_alarm) alarm_del(dhcp_alarm_cb, -1);
	//send_checker_NB();
}
예제 #14
0
파일: smf_track.cpp 프로젝트: iwadon/junk
bool SMFTrack::setup(const data_type *data, const size_t size)
{
  if (size < 8) {
#ifdef SMF_TRACK_DEBUG
    ERROR("Too short data");
#endif
    return false;
  }
  if (memcmp(data, "MTrk", 4) != 0) {
#ifdef SMF_TRACK_DEBUG
    ERROR("Not MTrk data");
#endif
    return false;
  }
  const uint8_t *d = reinterpret_cast<const uint8_t *>(data);
  size_t data_size = d[4] << 24 | d[5] << 16 | d[6] << 8 | d[7];
  if (data_size != size - 8) {
#ifdef SMF_TRACK_DEBUG
    ERROR("mismatch data size: %zu %zu %02x%02x%02x%02x", data_size, size - 8, d[4], d[5], d[6], d[7]);
#endif
    return false;
  }
  data_ = data + 8;
  data_end_ = data_ + data_size;
  data_cur_ = NULL;
  SET_STATE(STATE_INITIALIZED);
  return true;
}
예제 #15
0
int phys_mem_open(struct inode *inode, struct file *filp)
{
	struct phys_mem_dev *dev; /* device information */
	struct phys_mem_session *session; /* the to-be created session */

	/* Find the device */
	dev = container_of(inode->i_cdev, struct phys_mem_dev, cdev);

	session = kmem_cache_alloc(session_mem_cache, GFP_KERNEL);

	if (!session)
		return -ENOMEM;

	session->session_id = atomic64_add_return(1, &session_counter);
	session->device = dev;
	sema_init(&session->sem, 1);
	session->vmas = 0;
	session->num_frame_stati = 0;
	session->frame_stati = NULL;
	session->status.state = SESSION_STATE_INVALID;

	SET_STATE(session, SESSION_STATE_OPEN);

	/* and use filp->private_data to point to the device data */
	filp->private_data = session;

	return 0; /* success */
}
예제 #16
0
//=============================================================================
void run_option(unsigned char event)
{
  switch(event) {
    case EVENT_TIMER_SECOND:
	  lcd_option();
    break;
    case EVENT_KEY_LEFT:
      BEEP_beep();
      if (o_menu > 0) { o_menu--; } else { o_menu = OMENU_MAX; }
	  lcd_option();
    break;
    case EVENT_KEY_RIGHT:
      BEEP_beep();
      if (o_menu < OMENU_MAX) { o_menu++; } else { o_menu = 0; }
	  lcd_option();
    break;
    case EVENT_KEY_SET:
	  if (o_menu == OM_SETTIME) {
        n_edit_time = 0;
        RTC_get_time(&hour, &min, &sec);
        SET_STATE(edit_time);
        lcd_edit_time();
	  } else if (o_menu == OM_SETDATE) {
 	    n_edit_date = 0;
        RTC_get_date(&wday, &day, &mes, &year);
		wday = RTC_day_of_week(day, mes, year);
        SET_STATE(edit_date);
        lcd_edit_date();
	  } else if (o_menu == OM_SETALARM) {
 	    n_edit_alarm = 0;
//        RTC_get_alarm(&a_hour, &a_min, &a_sec);
        SET_STATE(edit_alarm);
        lcd_edit_alarm();
	  } else if (o_menu == OM_SETFM) {
        SET_STATE(edit_fmstation);
        lcd_edit_fmstation();
      }
    break;
    case EVENT_KEY_SET_LONG:
	  LCD_clear();
	  SET_STATE(run_main);
      RTOS_setTask(EVENT_TIMER_SECOND, 0, 0);
    break;
  }
}
static void
leave_meta_state(struct intel_context *intel)
{
   struct i830_context *i830 = i830_context(&intel->ctx);
   intel_region_release(&i830->meta.draw_region);
   intel_region_release(&i830->meta.depth_region);
/*    intel_region_release(intel, &i830->meta.tex_region[0]); */
   SET_STATE(i830, state);
}
예제 #18
0
void CharacterController::setFlyingAllowed(bool value) {
    if (_flyingAllowed != value) {
        _flyingAllowed = value;

        if (!_flyingAllowed && _state == State::Hover) {
            SET_STATE(State::InAir, "flying not allowed");
        }
    }
}
예제 #19
0
파일: smf_track.cpp 프로젝트: iwadon/junk
void SMFTrack::play()
{
  if (data_ == NULL) {
    return;
  }
  data_cur_ = data_;
  SET_STATE(STATE_PLAYING);
  update_wait_time();
}
예제 #20
0
void
push_tag (vxml_parser_t * parser)
{
  opened_tag_t *tag;
  tag = ++(parser->inner_tag);
  SET_STATE(XML_A_CHAR);
  tag->ot_name = parser->tmp.flat_name;
  parser->tmp.flat_name.lm_memblock = NULL;
  tag->ot_descr = parser->tmp.tag_descr;
  tag->ot_pos = parser->curr_pos;
}
예제 #21
0
파일: mmap_phys.c 프로젝트: wangxiaoq/MEI
void phys_mem_vma_open(struct vm_area_struct *vma)
{
    struct phys_mem_session* session = (struct phys_mem_session*) vma->vm_private_data;

    down(&session->sem);
	if (0 == session->vmas)
		SET_STATE(session, SESSION_STATE_MAPPED);

    session->vmas++;
    up(&session->sem);
}
예제 #22
0
파일: frozen.c 프로젝트: Henk-B/frozen
/* identifier = letter { letter | digit | '_' } */
static int parse_identifier(struct frozen *f) {
  EXPECT(is_alpha(cur(f)), JSON_STRING_INVALID);
  {
    SET_STATE(f, f->cur, JSON_TYPE_STRING, "", 0);
    while (f->cur < f->end &&
           (*f->cur == '_' || is_alpha(*f->cur) || is_digit(*f->cur))) {
      f->cur++;
    }
    CALL_BACK(f);
  }
  return 0;
}
예제 #23
0
파일: mmap_phys.c 프로젝트: wangxiaoq/MEI
void phys_mem_vma_close(struct vm_area_struct *vma)
{
  struct phys_mem_session* session = (struct phys_mem_session*) vma->vm_private_data;

  down(&session->sem);
  session->vmas--;

  if (0 == session->vmas)
    SET_STATE(session, SESSION_STATE_CONFIGURED);

  up(&session->sem);
}
예제 #24
0
파일: dhcp.c 프로젝트: ConvTeam/WIZlib
static void dhcp_fail(void)
{
	LOG("DHCP Fail - set temp addr");
	di.action = DHCP_ACT_NONE;
	SET_STATE(DHCP_STATE_FAILED);
	memcpy(&workinfo, &storage, sizeof(storage));
	memset(workinfo.mac, 0, 6);
	SetNetInfo(&workinfo);
	network_disp(NULL);
	if(dhcp_alarm) 
		alarm_set(DHCP_START_RETRY_DELAY, dhcp_alarm_cb, 0);
	//send_checker_NB();
}
예제 #25
0
static 
NW_Status_t 
T_Tag_Start_CB (NW_WBXML_Parser_t *parser, 
                void *context)
{
  NW_TinyDom_Tag_t *tag = (NW_TinyDom_Tag_t*)context;
  NW_TinyDom_Parser_t *tiny_parser = tag->tiny_parser;

  NW_REQUIRED_PARAM(parser);

  SET_STATE(tiny_parser, T_PARSE_S_TAG_START);
  return NW_STAT_SUCCESS;
}
예제 #26
0
static 
NW_Status_t 
Content_CB (NW_WBXML_Parser_t *parser, 
            void *context)
{

  NW_TinyDom_Parser_t *tiny_parser = (NW_TinyDom_Parser_t*)context;

  SET_STATE(tiny_parser, T_PARSE_S_CONTENT);
  /* We need to save the current offset to use if we need a text node. Ugh! */
  tiny_parser->content_offset = (NW_TinyTree_Offset_t)parser->offset; 
  return NW_STAT_SUCCESS;
}
예제 #27
0
파일: frozen.c 프로젝트: Henk-B/frozen
static int expect(struct frozen *f, const char *s, int len, enum json_type t) {
  int i, n = left(f);

  SET_STATE(f, f->cur, t, "", 0);
  for (i = 0; i < len; i++) {
    if (i >= n) return JSON_STRING_INCOMPLETE;
    if (f->cur[i] != s[i]) return JSON_STRING_INVALID;
  }
  f->cur += len;
  CALL_BACK(f);

  return 0;
}
예제 #28
0
static 
NW_Status_t 
Pass_3_Content_CB (NW_WBXML_Parser_t *parser, 
                   void *context)
{
  NW_TinyDom_AttributeHandle_t *handle = (NW_TinyDom_AttributeHandle_t*)context;
  NW_TinyDom_Parser_t *tiny_parser = handle->tlit.tiny_parser;

  NW_REQUIRED_PARAM(parser);

  SET_STATE(tiny_parser, T_PARSE_S_CONTENT);
  return NW_STAT_SUCCESS;
}
예제 #29
0
파일: frozen.c 프로젝트: Henk-B/frozen
/* object = '{' pair { ',' pair } '}' */
static int parse_object(struct frozen *f) {
  TRY(test_and_skip(f, '{'));
  {
    SET_STATE(f, f->cur - 1, JSON_TYPE_OBJECT, ".", 1);
    while (cur(f) != '}') {
      TRY(parse_pair(f));
      if (cur(f) == ',') f->cur++;
    }
    TRY(test_and_skip(f, '}'));
    CALL_BACK(f);
  }
  return 0;
}
/* Operations where the 3D engine is decoupled temporarily from the
 * current GL state and used for other purposes than simply rendering
 * incoming triangles.
 */
static void
install_meta_state(struct intel_context *intel)
{
   struct i830_context *i830 = i830_context(&intel->ctx);
   memcpy(&i830->meta, &i830->initial, sizeof(i830->meta));

   i830->meta.active = ACTIVE;
   i830->meta.emitted = 0;

   SET_STATE(i830, meta);
   set_vertex_format(intel);
   set_no_texture(intel);
}