#if 0

uint16_t readpos = 0;
uint16_t writepos = 0;
uint16_t total = 0;
uint8_t ble_buf[512];

uint16_t uart_readpos = 0;
uint16_t uart_writepos = 0;
uint16_t uart_total = 0;
uint8_t uart_ble_buf[512];

void put_ble_data_2_fifo( UINT8 *value,UINT16 len)
{
	UINT16 i;
	for(i=0;i<len;i++){
		if(total < 512)
			total ++;
		else{
			readpos  = writepos;
		}
		ble_buf[writepos ++] = value[i];
		if(writepos >= 512)
			writepos = 0;
	}
}

uint8_t ble_data_read(uint8_t *buf, uint8_t len)
{
	uint8_t read_len = 0;
	while((read_len < len) && (total > 0))
	{
		buf[read_len] =	ble_buf[readpos ++];
		if(readpos >= 512)
			readpos = 0;
		total --;
		
		read_len ++;
	}
	return read_len;
}

void put_uart_data_2_fifo( UINT8 *value,UINT16 len)
{
	UINT16 i;
	
#if (INDECATE)	
	indecate_pin_value |= gpio_to_value(GPIOA_Pin5);
	user_gpio_dir_out_hig(gpio_to_value(GPIOA_Pin4)|gpio_to_value(GPIOA_Pin5),indecate_pin_value);
#endif

	for(i=0;i<len;i++){
		if(uart_total < 512)
			uart_total ++;
		else{
			uart_readpos  = uart_writepos;
		}
		uart_ble_buf[uart_writepos ++] = value[i];
		if(uart_writepos >= 512)
			uart_writepos = 0;
	}
}

#endif

