コード例 #1
0
/*
 * shareinput_writer_notifyready
 *
 *  Called by the writer (producer) once it is done producing all tuples and
 *  writing them to disk. It notifies all the readers (consumers) that tuples
 *  are ready to be read from disk.
 *
 *  For planner-generated plans we wait for acks from all the readers before
 *  proceedings. It is a blocking operation.
 *
 *	For optimizer-generated plans we don't wait for acks, we proceed immediately.
 *  It is a non-blocking operation.
 */
void *
shareinput_writer_notifyready(int share_id, int xslice, PlanGenerator planGen)
{
	int n;

	ShareInput_Lk_Context *pctxt = gp_malloc(sizeof(ShareInput_Lk_Context));

	if(!pctxt)
		ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY),
			errmsg("Shareinput Writer failed: out of memory")));

	pctxt->readyfd = -1;
	pctxt->donefd = -1;
	pctxt->zcnt = 0;
	pctxt->del_ready = false;
	pctxt->del_done = false;
	pctxt->lkname_ready[0] = '\0';
	pctxt->lkname_done[0] = '\0';

	RegisterXactCallbackOnce(XCallBack_ShareInput_FIFO, pctxt);

	sisc_lockname(pctxt->lkname_ready, MAXPGPATH, share_id, "ready");
	create_tmp_fifo(pctxt->lkname_ready);
	pctxt->del_ready = true;
	pctxt->readyfd = open(pctxt->lkname_ready, O_RDWR, 0600); 
	if(pctxt->readyfd < 0)
	
		elog(ERROR, "could not open fifo \"%s\": %m", pctxt->lkname_ready);
	sisc_lockname(pctxt->lkname_done, MAXPGPATH, share_id, "done");
	create_tmp_fifo(pctxt->lkname_done);
	pctxt->del_done = true;
	pctxt->donefd = open(pctxt->lkname_done, O_RDWR, 0600);
	if(pctxt->donefd < 0)
		elog(ERROR, "could not open fifo \"%s\": %m", pctxt->lkname_done);

	for(n=0; n<xslice; ++n)
	{
#if USE_ASSERT_CHECKING
		int rwsize =
#endif
		retry_write(pctxt->readyfd, "a", 1);
		Assert(rwsize == 1);
	}
	elog(DEBUG1, "SISC WRITER (shareid=%d, slice=%d): wrote notify_ready to %d xslice readers",
						share_id, currentSliceId, xslice);
	
	if (planGen == PLANGEN_PLANNER)
	{
		/* For planner-generated plans, we wait for acks from all the readers */
		writer_wait_for_acks(pctxt, share_id, xslice);
	}

	return (void *) pctxt;
}
コード例 #2
0
ファイル: msg_manager.c プロジェクト: danielgm6/gpl32
//========================================================
//Function Name:msgQCreate
//Syntax:		MSG_Q_ID msgQCreate(INT32U maxQSize, INT32U maxMsgs, INT32U maxMsgLength)
//Purpose:		create and initialize a message queue
//Note:
//Parameters:   INT32U maxQSize			/* max queue can be creat */
//				INT32U	maxMsgs			/* max messages that can be queued */
//				INT32U	maxMsgLength	/* max bytes in a message */
//Return:		NULL if faile
//=======================================================
MSG_Q_ID msgQCreate(INT32U maxQSize, INT32U maxMsgs, INT32U maxMsgLength)
{
	MSG_Q_ID	msgQId;
	OS_EVENT*	pEvent;
	void*		pMsgQ;
	INT32U		msg_length = (maxMsgLength + 4 - 1) & (~(4 - 1));
	INT32U		size = sizeof(*msgQId) + 						/* MSG_Q_ID struct size */
					maxQSize * sizeof(void*) + 					/* OS Q size */
					maxMsgs * (msg_length + 4);				/* type + message size */



	msgQId = (MSG_Q_ID)gp_malloc(size);
	if(msgQId == NULL)
	{
	#if MSG_Q_DEBUG == 1
		DBG_PRINT("msg create err:memory allocate fail\r\n");
	#endif
		return NULL;
	}

	gp_memset((INT8S *)msgQId, 0, size);	/* clear out msg q structure */

	pMsgQ = (void*)(msgQId + 1);
	pEvent = OSQCreate(pMsgQ, maxQSize);
	if(pEvent == NULL)						/* creat q faile */
	{
		gp_free(msgQId);
	#if MSG_Q_DEBUG == 1
		DBG_PRINT("msg create err:queue create fail\r\n");
	#endif
		return NULL;
	}

	msgQId->pEvent = pEvent;
	msgQId->pMsgQ = pMsgQ;
	msgQId->maxMsgs = maxMsgs;
	msgQId->maxMsgLength = msg_length;
	msgQId->pMsgPool = (INT8U*)((INT32U*)pMsgQ + maxQSize);

	return ((MSG_Q_ID) msgQId);
}
コード例 #3
0
ファイル: ap_startup.c プロジェクト: wythe-lin/ZTKVR
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");
	}
}
コード例 #4
0
ファイル: task_state_handling.c プロジェクト: ZhaGoo/gp720
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"); 
}
コード例 #5
0
/*
 * shareinput_reader_waitready
 *
 *  Called by the reader (consumer) to wait for the writer (producer) to produce
 *  all the tuples and write them to disk.
 *
 *  This is a blocking operation.
 */
void *
shareinput_reader_waitready(int share_id, PlanGenerator planGen)
{
	mpp_fd_set rset;
	struct timeval tval;
	int n;
	char a;

	ShareInput_Lk_Context *pctxt = gp_malloc(sizeof(ShareInput_Lk_Context));

	if(!pctxt)
		ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY),
			errmsg("Share input reader failed: out of memory")));

	pctxt->readyfd = -1;
	pctxt->donefd = -1;
	pctxt->zcnt = 0;
	pctxt->del_ready = false;
	pctxt->del_done = false;
	pctxt->lkname_ready[0] = '\0';
	pctxt->lkname_done[0] = '\0';

	RegisterXactCallbackOnce(XCallBack_ShareInput_FIFO, pctxt);

	sisc_lockname(pctxt->lkname_ready, MAXPGPATH, share_id, "ready");
	create_tmp_fifo(pctxt->lkname_ready);
	pctxt->readyfd = open(pctxt->lkname_ready, O_RDWR, 0600); 
	if(pctxt->readyfd < 0)
		elog(ERROR, "could not open fifo \"%s\": %m", pctxt->lkname_ready);
	
	sisc_lockname(pctxt->lkname_done, MAXPGPATH, share_id, "done");
	create_tmp_fifo(pctxt->lkname_done);
	pctxt->donefd = open(pctxt->lkname_done, O_RDWR, 0600);
	if(pctxt->donefd < 0)
		elog(ERROR, "could not open fifo \"%s\": %m", pctxt->lkname_done);

	while(1)
	{
		CHECK_FOR_INTERRUPTS();

		MPP_FD_ZERO(&rset);
		MPP_FD_SET(pctxt->readyfd, &rset);

		tval.tv_sec = 1;
		tval.tv_usec = 0;

		n = select(pctxt->readyfd+1, (fd_set *) &rset, NULL, NULL, &tval);

		if(n==1)
		{
#if USE_ASSERT_CHECKING
			int rwsize =
#endif
			retry_read(pctxt->readyfd, &a, 1);
			Assert(rwsize == 1 && a == 'a');

			elog(DEBUG1, "SISC READER (shareid=%d, slice=%d): Wait ready got writer's handshake",
					share_id, currentSliceId);

			if (planGen == PLANGEN_PLANNER)
			{
				/* For planner-generated plans, we send ack back after receiving the handshake */
				elog(DEBUG1, "SISC READER (shareid=%d, slice=%d): Wait ready writing ack back to writer",
						share_id, currentSliceId);

#if USE_ASSERT_CHECKING
				rwsize =
#endif
				retry_write(pctxt->donefd, "b", 1);
				Assert(rwsize == 1);
			}

			break;
		}
		else if(n==0)
		{
			elog(DEBUG1, "SISC READER (shareid=%d, slice=%d): Wait ready time out once",
					share_id, currentSliceId);
		}
		else
		{
			int save_errno = errno;
			elog(LOG, "SISC READER (shareid=%d, slice=%d): Wait ready try again, errno %d ... ",
					share_id, currentSliceId, save_errno);
		}
	}
	return (void *) pctxt;
}
コード例 #6
0
ファイル: ap_avifilesrv_task.c プロジェクト: danielgm6/gpl32
void FileSrv_AVIAudio_Read(STAVIAUDIOBufConfig *para)
{
	INT32S read_cnt;
	INT32S temp_len;
	STAVIAUDIOBufConfig *newptr;
	INT8U *ptr = NULL;

	newptr = avi_audio_buf_wi->next;
	if(avi_audio_buf_wi->status!=AUDIO_BUF_OVER)
	{
		switch(newptr->status)
		{
			case AUDIO_BUF_FIRST_FILL:
				avi_audio_flag = 1;
				if(avi_mov_switchflag == C_MOV_MODE_PLAY)
					audiolen = tk_mov_find_adpos(1);		
				else if(avi_mov_switchflag == C_AVI_MODE_PLAY)
				audiolen = tk_avi_get_audio_data(1);		
			case AUDIO_BUF_FILL_ALL_AGAIN:
				avi_audio_flag = 0;
				while(1)
				{
					if(avi_audio_flag)
					{
						if(avi_mov_switchflag == C_MOV_MODE_PLAY)
							audiolen = tk_mov_find_adpos(1);		
						else if(avi_mov_switchflag == C_AVI_MODE_PLAY)
						audiolen = tk_avi_get_audio_data(1);		
						avi_audio_flag = 0;
					}
					
					//added for the avi file size is small.
					if(audiolen < 0)
					{
						avi_audio_buf_wi->status = AUDIO_BUF_OVER;
						avi_audio_flag = 1;	
						break;			
					}
					if(audiolen <= avi_audio_buf_wi->length)
					{
						if(avi_audio_buf_wi->length>=(avi_audio_buf_wi->wi + (INT32U)audiolen))
						{
							if(avi_mov_switchflag == C_MOV_MODE_PLAY)
								read_cnt = tk_mov_read_audio_data((CHAR *)((INT32U)avi_audio_buf_wi->audiobufptr+avi_audio_buf_wi->wi),(INT32U)audiolen);
							else if(avi_mov_switchflag == C_AVI_MODE_PLAY)
							read_cnt = tk_avi_read_audio_data((CHAR *)((INT32U)avi_audio_buf_wi->audiobufptr+avi_audio_buf_wi->wi),(INT32U)audiolen);
							avi_audio_buf_wi->wi += (INT32U)audiolen;
							avi_audio_flag = 1;
						}
						else
						{
							avi_audio_buf_wi->status = AUDIO_BUF_FILLING;
							avi_audio_buf_wi->ri = 0;
							avi_audio_buf_wi = avi_audio_buf_wi->next;
							if(avi_audio_buf_wi->status != AUDIO_BUF_FIRST_FILL)
								break;
						}
					}
					//sunxw modify code for avi audio length
					else if(audiolen > avi_audio_buf_wi->length*2)
					{
						avi_audio_buf_wi->status = AUDIO_BUF_OVER;
						avi_audio_buf_wi->wi = 0;
						break;
					}
					else
					{
						if(ptr == NULL)
							ptr = (INT8U*)gp_malloc(audiolen);
							
						if(avi_mov_switchflag == C_MOV_MODE_PLAY)
							read_cnt = tk_mov_read_audio_data((CHAR *)((INT32U)avi_audio_buf_wi->audiobufptr+avi_audio_buf_wi->wi),(INT32U)audiolen);
						else if(avi_mov_switchflag == C_AVI_MODE_PLAY)
							read_cnt = tk_avi_read_audio_data((CHAR *)((INT32U)avi_audio_buf_wi->audiobufptr+avi_audio_buf_wi->wi),(INT32U)audiolen);
						if(read_cnt != -1)
						{
							gp_memcpy((INT8S*)avi_audio_buf_wi->audiobufptr,(INT8S*)ptr,avi_audio_buf_wi->length);
							avi_audio_buf_wi->wi = avi_audio_buf_wi->length;
							avi_audio_buf_wi->ri = 0;
							avi_audio_buf_wi->status = AUDIO_BUF_FILLING;
							avi_audio_buf_wi = avi_audio_buf_wi->next;
							
							avi_audio_buf_wi->wi = (INT32U)audiolen - avi_audio_buf_wi->length;
							avi_audio_buf_wi->ri = 0;
							avi_audio_buf_wi->status = AUDIO_BUF_GETING;
							gp_memcpy((INT8S*)avi_audio_buf_wi->audiobufptr,(INT8S*)((INT32U)ptr+avi_audio_buf_wi->length),avi_audio_buf_wi->wi);
							avi_audio_flag = 1;
							
							avi_audio_buf_wi = avi_audio_buf_wi->next;							
							if(avi_audio_buf_wi->status != AUDIO_BUF_FIRST_FILL)
							{
								gp_free((void*)ptr);
								ptr = NULL;
								break;												
							}	
						}
					}			
				}
				if(audio_fs_result_q)
					OSQPost(audio_fs_result_q , (void *) read_cnt);					
				break;

			case AUDIO_BUF_GETING:
				// if audio len < 1000,or audio len > 1000;		
				temp_len = 0;
				while(1)
				{
					if(avi_audio_flag)
					{
						if(avi_mov_switchflag == C_MOV_MODE_PLAY)
							audiolen = tk_mov_find_adpos(1);		
						else if(avi_mov_switchflag == C_AVI_MODE_PLAY)
						audiolen = tk_avi_get_audio_data(1);		
						if(audiolen == -1)
						{
							avi_audio_buf_wi->status = AUDIO_BUF_OVER;
							avi_audio_flag = 1;
							avi_audio_buf_wi->ri = 0;
							break;
						}
						else
							avi_audio_flag = 0;
					}
					
					if(audiolen <= avi_audio_buf_wi->length)
					{	
						if(avi_audio_buf_wi->length>=(avi_audio_buf_wi->wi + (INT32U)audiolen))
						{
							if(avi_mov_switchflag == C_MOV_MODE_PLAY)
								read_cnt = tk_mov_read_audio_data((CHAR *)((INT32U)avi_audio_buf_wi->audiobufptr+avi_audio_buf_wi->wi),(INT32U)audiolen);
							else if(avi_mov_switchflag == C_AVI_MODE_PLAY)
							read_cnt = tk_avi_read_audio_data((CHAR *)((INT32U)avi_audio_buf_wi->audiobufptr+avi_audio_buf_wi->wi),(INT32U)audiolen);
							if(read_cnt != -1)
							{
								avi_audio_buf_wi->wi += (INT32U)audiolen;
								avi_audio_flag = 1;
								temp_len += audiolen;
							}
							else
							{
								avi_audio_buf_wi->status = AUDIO_BUF_OVER;
								avi_audio_flag = 1;
								avi_audio_buf_wi->ri = 0;
								break;
							}
						}
						else
						{
							avi_audio_buf_wi->status = AUDIO_BUF_FILLING;
							avi_audio_buf_wi->ri = 0;
							avi_audio_buf_wi = avi_audio_buf_wi->next;
							break;
						}

						if(temp_len>AUDIO_AVI_RINGBUF_LEN)
							break;	
					}	
					else
						break;					
				}
					
				break;
				
			
			case AUDIO_BUF_EMPTY:
				//data len smaller than ring buffer len.		
				// if audio len < 1000,or audio len > 1000;		
				temp_len = 0;
				while(1)
				{
					if(avi_audio_flag)
					{
						if(avi_mov_switchflag == C_MOV_MODE_PLAY)
							audiolen = tk_mov_find_adpos(1);		
						else if(avi_mov_switchflag == C_AVI_MODE_PLAY)
						audiolen = tk_avi_get_audio_data(1);		
						if(audiolen == -1)
						{
							avi_audio_buf_wi->status = AUDIO_BUF_OVER;
							avi_audio_flag = 1;
							avi_audio_buf_wi->ri = 0;
							break;
						}
						else
							avi_audio_flag = 0;
					}
						
					if(audiolen <= avi_audio_buf_wi->length)	
					{	
						if(avi_audio_buf_wi->length>=(avi_audio_buf_wi->wi + (INT32U)audiolen))
						{
							if(avi_mov_switchflag == C_MOV_MODE_PLAY)
								read_cnt = tk_mov_read_audio_data((CHAR *)((INT32U)avi_audio_buf_wi->audiobufptr+avi_audio_buf_wi->wi),(INT32U)audiolen);
							else if(avi_mov_switchflag == C_AVI_MODE_PLAY)
							read_cnt = tk_avi_read_audio_data((CHAR *)((INT32U)avi_audio_buf_wi->audiobufptr+avi_audio_buf_wi->wi),(INT32U)audiolen);
							if(read_cnt != -1)
							{
								avi_audio_buf_wi->wi += (INT32U)audiolen;
								avi_audio_flag = 1;
								temp_len += audiolen;
							}
							else
							{
								avi_audio_buf_wi->status = AUDIO_BUF_OVER;
								avi_audio_flag = 1;
								avi_audio_buf_wi->ri = 0;
								break;
							}
						}
						else
						{
							avi_audio_buf_wi->status = AUDIO_BUF_FILLING;
							avi_audio_buf_wi->ri = 0;
							avi_audio_buf_wi = avi_audio_buf_wi->next;
							break;
						}
					}
					//sunxw modify code for avi audio length
					else if(audiolen > avi_audio_buf_wi->length*2)
					{
						avi_audio_buf_wi->status = AUDIO_BUF_OVER;
						avi_audio_buf_wi->wi = 0;
						break;
					}
					else
					{
						if(ptr == NULL)
							ptr = (INT8U*)gp_malloc(audiolen);
							
						if(avi_mov_switchflag == C_MOV_MODE_PLAY)
							read_cnt = tk_mov_read_audio_data((CHAR *)((INT32U)avi_audio_buf_wi->audiobufptr+avi_audio_buf_wi->wi),(INT32U)audiolen);
						else if(avi_mov_switchflag == C_AVI_MODE_PLAY)
							read_cnt = tk_avi_read_audio_data((CHAR *)((INT32U)avi_audio_buf_wi->audiobufptr+avi_audio_buf_wi->wi),(INT32U)audiolen);
						if(read_cnt != -1)
						{
							gp_memcpy((INT8S*)avi_audio_buf_wi->audiobufptr,(INT8S*)ptr,avi_audio_buf_wi->length);
							avi_audio_buf_wi->wi = avi_audio_buf_wi->length;
							avi_audio_buf_wi->ri = 0;
							avi_audio_buf_wi->status = AUDIO_BUF_FILLING;
							avi_audio_buf_wi = avi_audio_buf_wi->next;
							
							avi_audio_buf_wi->wi = (INT32U)audiolen - avi_audio_buf_wi->length;
							avi_audio_buf_wi->ri = 0;
							avi_audio_buf_wi->status = AUDIO_BUF_GETING;
							gp_memcpy((INT8S*)avi_audio_buf_wi->audiobufptr,(INT8S*)((INT32U)ptr+avi_audio_buf_wi->length),avi_audio_buf_wi->wi);
							avi_audio_flag = 1;
							
							avi_audio_buf_wi = avi_audio_buf_wi->next;							
							gp_free((void*)ptr);
							ptr = NULL;
								break;												
						}	
						else
						{
							avi_audio_buf_wi->status = AUDIO_BUF_OVER;
							avi_audio_flag = 1;
							avi_audio_buf_wi->ri = 0;
							gp_free((void*)ptr);
							ptr = NULL;							
							break;						
						}			
					}
					
					if(audio_fs_result_q)
						OSQPost(audio_fs_result_q , (void *) read_cnt);
				}							
				break;
			
			case AUDIO_BUF_OVER:
				break;
			
			case AUDIO_BUF_FILLING:
				
				break;
			default:
				break;	
		}
	}
}