예제 #1
0
파일: bios.cpp 프로젝트: Beshuta/HWSensors
static void nv30_parse(struct nvbios *bios, char *rom, unsigned short nv_offset)
{
	unsigned short init_offset = 0;
	unsigned short perf_offset=0;
	unsigned short volt_offset=0;

	int offset = READ_SHORT(rom, nv_offset + 30);
	bios->signon_msg = nv_read(rom, offset);

	init_offset = READ_SHORT(rom, nv_offset + 0x4d);

	volt_offset = READ_SHORT(rom, nv_offset + 0x98);
	parse_voltage_table(bios, rom, volt_offset);

	perf_offset = READ_SHORT(rom, nv_offset + 0x94);
	parse_nv30_performance_table(bios, rom, perf_offset);
}
예제 #2
0
INT32S resource_read(INT32U offset_byte, INT8U *pbuf, INT32U byte_count)
{
#if (defined RESOURCE_DEV_TYPE) && (RESOURCE_DEV_TYPE == DEVICE_SPI || RESOURCE_DEV_TYPE == DEVICE_NAND)
	nv_lseek(resource_handle, offset_byte, SEEK_SET);
	if (nv_read(resource_handle, (INT32U) pbuf, byte_count))
		{
			return STATUS_FAIL;
		}

#elif (defined RESOURCE_DEV_TYPE) && (RESOURCE_DEV_TYPE == DEVICE_SD)
	lseek(resource_handle, offset_byte, SEEK_SET);
	if (read(resource_handle, (INT32U) pbuf, byte_count) <= 0)
	{
		return STATUS_FAIL;
	}
#endif

	return STATUS_OK;
}
예제 #3
0
파일: bios.cpp 프로젝트: Beshuta/HWSensors
static void parse_bit_structure(struct nvbios *bios, char *rom, unsigned int bit_offset)
{
	//IOLog("Parsing BIT structure\n");
	unsigned short init_offset=0;
	unsigned short perf_offset=0;
	unsigned short pll_offset=0;
	unsigned short signon_offset=0;
	unsigned short temp_offset=0;
	unsigned short volt_offset=0;
	unsigned short offset=0;

	struct bit_entry
	{
		unsigned char id[2]; /* first byte is ID, second byte sub-ID? */
		unsigned short len; /* size of data pointed to by offset */
		unsigned short offset; /* offset of data */
	} *entry;

	/* In older nvidia bioses there was some start position and at fixed positions from there offsets to various tables were stored.
	/  For Geforce6 bioses this is all different. There is still some start position (now called BIT) but offsets to tables aren't at fixed
	/  positions from the start. There's now some weird pattern which starts a few places from the start of the BIT section.
	/  This pattern seems to consist of a subset of the alphabet (all in uppercase). After each such token there is the length of the data
	/ referred to by the entry and an offset. The first entry "0x00 0x01" is probably somewhat different since the length/offset info
	/ seems to be a bit strange. The list ends with the entry "0x00 0x00"
	*/

	/* skip 'B' 'I' 'T' '\0' */
	offset = bit_offset + 4;

	/* read the entries */
	while (1)
	{
		entry = (struct bit_entry *)&rom[offset];
		if ((entry->id[0] == 0) && (entry->id[1] == 0))
			break;
		//IOLog("Got new entry: ");
		
		switch (entry->id[0])
		{
			case 'B': /* BIOS related data */
				//IOLog("BIOS");
				bios->version = nv40_bios_version_to_str(rom, entry->offset);
				break;
			case 'C': /* Configuration table; it contains at least PLL parameters */
				//IOLog("Configuration");
				pll_offset = READ_SHORT(rom, entry->offset + 8);
				parse_bit_pll_table(bios, rom, pll_offset);
				break;
			case 'I': /* Init table */
				//IOLog("Init");
				init_offset = READ_SHORT(rom, entry->offset);
				parse_bit_init_script_table(bios, rom, init_offset, entry->len);
				break;
			case 'P': /* Performance related data */
				//IOLog("Performance");
				perf_offset = READ_SHORT(rom, entry->offset);
				parse_bit_performance_table(bios, rom, perf_offset);

				temp_offset = READ_SHORT(rom, entry->offset + 0xc);
				parse_bit_temperature_table(bios, rom, temp_offset);

				/* 0x10 behind perf_offset the voltage table offset is stored */
				volt_offset = READ_SHORT(rom, entry->offset + 0x10);
				parse_voltage_table(bios, rom, volt_offset);
				break;
			case 'S':
				//IOLog("String table");
				/* table with string references of signon-message,
				BIOS version, BIOS copyright, OEM string, VESA vendor,
				VESA Product Name, and VESA Product Rev.
				table consists of offset, max-string-length pairs
				for all strings */
				//IOLog("Or panic was here?");
				signon_offset = READ_SHORT(rom, entry->offset);
				bios->signon_msg = nv_read(rom, signon_offset);
				break;
		}
		//IOLog("\n");

		offset += sizeof(struct bit_entry);
	}
	//IOLog("It has been parsed!!!\n");
}
예제 #4
0
파일: bios.cpp 프로젝트: Beshuta/HWSensors
static void nv5_parse(struct nvbios *bios, char *rom, unsigned short nv_offset)
{
	/* Go to the position containing the offset to the card name, it is 30 away from NV. */
	int offset = READ_SHORT(rom, nv_offset + 30);
	bios->signon_msg = nv_read(rom, offset);
}
예제 #5
0
void ap_startup_init(void)
{
	IMAGE_DECODE_STRUCT img_info;
	INT32U	size;
	INT16U	logo_fd;

#if C_LOGO == CUSTOM_ON
	ap_music_effect_resource_init();		//wwj add
	audio_vol_set(ap_state_config_volume_get());	//wwj add

	size = ((INT32U) gvarg.DisplayBufferWidth) * ((INT32U) gvarg.DisplayBufferHeight) * 2UL;
	startup_logo_decode_buff = (INT32U) gp_malloc_align(size, 64);
	if (!startup_logo_decode_buff) {
		DBG_PRINT("State startup allocate jpeg output buffer fail.\r\n");
		return;
	}

	logo_fd = nv_open((INT8U *) "POWER_ON_LOGO.JPG");
	if (logo_fd != 0xFFFF) {
		size = nv_rs_size_get(logo_fd);
		startup_logo_img_ptr = (INT32S) gp_malloc(size);
		if (!startup_logo_img_ptr) {
			DBG_PRINT("State startup allocate jpeg input buffer fail.[%d]\r\n", size);
			gp_free((void *) startup_logo_decode_buff);
			return;
		}
		if (nv_read(logo_fd, (INT32U) startup_logo_img_ptr, size)) {
			DBG_PRINT("Failed to read resource_header in ap_startup_init\r\n");
			gp_free((void *) startup_logo_img_ptr);
			gp_free((void *) startup_logo_decode_buff);
			return;
		}
		img_info.image_source		= (INT32S) startup_logo_img_ptr;
		img_info.source_size		= size;
		img_info.source_type		= TK_IMAGE_SOURCE_TYPE_BUFFER;
		img_info.output_format		= C_SCALER_CTRL_OUT_RGB565;
		img_info.output_ratio		= 0;
		img_info.out_of_boundary_color	= 0x008080;
		img_info.output_buffer_width	= gvarg.DisplayBufferWidth;
		img_info.output_buffer_height	= gvarg.DisplayBufferHeight;
		img_info.output_image_width	= gvarg.DisplayBufferWidth;
		img_info.output_image_height	= gvarg.DisplayBufferHeight;
		img_info.output_buffer_pointer	= startup_logo_decode_buff;
		if (jpeg_buffer_decode_and_scale(&img_info) == STATUS_FAIL) {
			gp_free((void *) startup_logo_img_ptr);
			gp_free((void *) startup_logo_decode_buff);
			DBG_PRINT("State startup decode jpeg file fail.\r\n");
			return;
		}
		OSQPost(DisplayTaskQ, (void *) (startup_logo_decode_buff|MSG_DISPLAY_TASK_JPEG_DRAW));
    #if MINI_DVR_BOARD_VERSION == GPL32680_MINI_DVR_CAR_RECORD_V2
		OSTimeDly(5);
		tft_backlight_en_set(TRUE);		
    #endif
		if (audio_effect_play(EFFECT_BEEP)) {
			audio_done++;
		}
		OSTimeDly(20);
		if (audio_effect_play(EFFECT_POWER_ON)) {
			audio_done++;
		}
		gp_free((void *) startup_logo_img_ptr);
		OSTimeDly(100);
	} else {
    #if MINI_DVR_BOARD_VERSION == GPL32680_MINI_DVR_CAR_RECORD_V2
		tft_backlight_en_set(TRUE);
    #endif
	}
	gp_free((void *) startup_logo_decode_buff);
#endif
	if (vid_dec_entry() < 0) {
		DBG_PRINT("Failed to init motion jpeg task\r\n");
	}
}
예제 #6
0
void state_handling_init(void)
{
	INT32S config_load_flag;

	StateHandlingQ = OSQCreate(state_handling_q_stack, STATE_HANDLING_QUEUE_MAX);
	ApQ = msgQCreate(AP_QUEUE_MAX, AP_QUEUE_MAX, AP_QUEUE_MSG_MAX_LEN);
	
	nvmemory_init();
	config_load_flag = ap_state_config_load();
	ap_state_resource_init();
	ap_state_config_initial(config_load_flag);
#if ENABLE_CHECK_RTC == 1
	if (config_load_flag != STATUS_FAIL)
	{
		ap_state_config_data_time_check();
	}
#endif
	ap_state_handling_calendar_init();

	ap_state_handling_storage_id_set(NO_STORAGE);
	
	{
		DISPLAY_ICONSHOW icon = {216, 144, TRANSPARENT_COLOR, 0, 0};
		INT32U i, *buff_ptr, color_data, cnt;
		INT32U display_frame0;

		display_battery_low_frame0 = (INT32U) gp_malloc_align(icon.icon_w * icon.icon_h * 2, 64);
		DBG_PRINT("batteryLow_display_buf_addr = 0x%x \r\n",display_frame0);
		buff_ptr = (INT32U *) display_battery_low_frame0;
		color_data = 0x8C71ul|(0x8C71ul<<16);
		cnt = (icon.icon_w * icon.icon_h * 2) >> 2;
		for (i=0 ; i<cnt ; i++) {
			*buff_ptr++ = color_data;
		}
		DBG_PRINT("batteryLowshow! \r\n");

		{
			INT32U size, read_buf;
			INT16U logo_fd;
			INT8U *zip_buf;
			INT32U icon_buffer;

			logo_fd = nv_open((INT8U*)"INSERTSDC.GPZP");
			if (logo_fd != 0xFFFF) {
				size = nv_rs_size_get(logo_fd);
				read_buf = (INT32S) gp_malloc(size);
				if (!read_buf) {
					DBG_PRINT("allocate BACKGROUND.GPZP read buffer fail.[%d]\r\n", size);
				}

				if (nv_read(logo_fd, (INT32U) read_buf, size)) {
					DBG_PRINT("Failed to read icon_buffer resource\r\n");
					gp_free((void *) read_buf);
				}

				zip_buf = (INT8U *)read_buf;
				if (gpzp_decode((INT8U *) &zip_buf[4], (INT8U *) display_battery_low_frame0) == STATUS_FAIL) {
					DBG_PRINT("Failed to unzip GPZP file\r\n");
					gp_free((void *) read_buf);
					gp_free((void *) icon_buffer);
					read_buf = 0;
					icon_buffer = 0;
				}

				gp_free((void *) read_buf);
			}
		}
	}
	
	DBG_PRINT("state_handling_init OK!\r\n"); 
}