Esempio n. 1
0
/* This is similar with the one in start.S. However the previous one
 * cannot be accessed in user process, because its virtual address is
 * below 0xC0000000, and is not in the user process' address space. */
void
init_segment(void) {
	memset(gdt, 0, sizeof(gdt));
	set_segment(&gdt[SEG_KERNEL_CODE], DPL_KERNEL, SEG_EXECUTABLE | SEG_READABLE);
	set_segment(&gdt[SEG_KERNEL_DATA], DPL_KERNEL, SEG_WRITABLE );

	write_gdtr(gdt, sizeof(gdt));
}
Esempio n. 2
0
File: kvm.c Progetto: dpingg/os-lab1
void
init_segment(void) {
	memset(gdt, 0, sizeof(gdt));
	set_segment(&gdt[SEG_KERNEL_CODE], DPL_KERNEL, SEG_EXECUTABLE | SEG_READABLE);
	set_segment(&gdt[SEG_KERNEL_DATA], DPL_KERNEL, SEG_WRITABLE );
	set_segment(&gdt[SEG_USER_CODE], DPL_USER, SEG_EXECUTABLE | SEG_READABLE);
	set_segment(&gdt[SEG_USER_DATA], DPL_USER, SEG_WRITABLE );

	write_gdtr(gdt, sizeof(gdt));

	set_tss(&gdt[SEG_TSS]);
	write_tr( SELECTOR_USER(SEG_TSS) );
}
Esempio n. 3
0
void parse(char *str, uint8_t *char_pos, uint8_t *segment_pos, et6220_display_data *data) 
{

	u_char ch = str[*char_pos];
	
	// consume character
	if(get_character(ch) != 0xFFFF) {
		// our character is in the lookup so we set it
		set_segment(*segment_pos, data, get_character(ch));
	} else if (ch == ':') {
		// our character is the colon		
		set_colon(*segment_pos, data);
		if((*segment_pos) > 0) {
		  (*segment_pos)--;
		}
	} else if (ch == '#') {
		// we detected a segment definition start
		(*char_pos)++;
		ch = str[*char_pos];
		// start parsing custom segment data
		parse_custom_segment(str, char_pos, segment_pos, data);
	} else if (ch == '\0') {
		// exit when NULL character found
		return;
	} else {
		// exit when non recognizable character found
		return;
	}

	// increment char_pos and segment
	(*char_pos)++;
	(*segment_pos)++;
	parse(str, char_pos, segment_pos, data);

}
/************************************************************************//**
 * \brief 'ticks' the module through its internal state machine. This
 *        function should be called in the main loop of the program.
 * \param none
 * \return none
 ****************************************************************************/
void SSD_Tick(void)
{
  int i = 0,
  segment_bit;
  for (; i < 8; i++) {
    segment_bit = get_bit(segment_state, i);
    set_segment(i, segment_bit);
  }
}
Esempio n. 5
0
void display_blank() {
  int i;
  PORTB &= ~(_BV(PORTB5) | _BV(PORTB4));
  PORTC &= ~(_BV(PORTC4) | _BV(PORTC3) | _BV(PORTC1));

  for(i=0; i<7; i++) {
    set_segment(i, seven_seg_digits[CHAR_BLANK][i]);
  }
}
Esempio n. 6
0
CompositeBranchContainer::CompositeBranchContainer(CompositeBranchContainer * branch){
    NeuronSegment * segment_copy = copy_segment_markers(branch->get_segment());
    set_segment(segment_copy);
    branch_matches = branch->get_branch_matches();
    bc_confidence = branch->get_confidence();
    confidence_denominator = branch->get_confidence_denominator();
    cbc_parent = nullptr;
    dp1 = nullptr;
    dp2 = nullptr;
};
Esempio n. 7
0
/*
 * Parse custom segment 
 */
void parse_custom_segment(char *str, uint8_t *char_pos, uint8_t *segment_pos, et6220_display_data *data) 
{
	uint8_t iterate = 1;
	uint16_t segment_data = 0;

	while(iterate) {
		uint8_t chp = str[*char_pos];
		int ch = chp;
		switch(ch) {
			case 'a':
				segment_data |= SEGMENT_A;
				break;
			case 'b':
				segment_data |= SEGMENT_B;
				break;
			case 'c':
				segment_data |= SEGMENT_C;
				break;
			case 'd':
				segment_data |= SEGMENT_D;
				break;
			case 'e':
				segment_data |= SEGMENT_E;
				break;
			case 'f':
				segment_data |= SEGMENT_F;
				break;
			case 'g':
				segment_data |= SEGMENT_G;
				break;
		        case '.':
			        segment_data |= SEGMENT_DOT;
				break;
			case '#':
				// end of definition write to segment and end
				iterate = 0;
				set_segment(*segment_pos, data, segment_data);
				break;
			default:
				return;
		}
		(*char_pos)++;
	}

}
Esempio n. 8
0
        void PptvLive2::handle_async_open(
            boost::system::error_code const & ec)
        {
            if (ec) {
                response(ec);
                return;
            }

            framework::string::Url url;

            switch(open_step_) {
                case StepType::closed:
                    if (jump_ && video_ && segment_) {
                        open_step_ = StepType::finish;
                        response(ec);
                        break;
                    }
                    open_step_ = StepType::jumping;
                    LOG_INFO("jump: start");
                    async_fetch(
                        get_jump_url(url),
                        dns_live2_jump,
                        jump_info_, 
                        boost::bind(&PptvLive2::handle_async_open, this ,_1));
                    break;
                case StepType::jumping:
                    jump_info_.video.delay = jump_info_.delay_play_time;
                    set_video(jump_info_.video);
                    set_jump(jump_info_.jump);
                    set_segment(seg_);
                    open_step_ = StepType::finish;
                    response(ec);
                    break;
                default:
                    assert(0);
                    break;
            }
        }