亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? vs1001.c

?? yampp3 mp3 code
?? C
字號:

/*
  Copyright (C) 2001 Jesper Hansen <jesperh@telia.com>.

  This file is part of the yampp system.

  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software Foundation, 
  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

#include <io.h>
#include <progmem.h>
#include "types.h"
#include "delay.h"
#include "vs1001.h"
#include "uart.h"

//
// VS1001 commands
//
#define VS1001_READ		0x03
#define VS1001_WRITE	0x02


//
// read one or more word(s) from the VS1001 Control registers
//
void vs1001_read(u08 address, u16 count, u16 *pData)
{
	cbi( MP3_PORT, MP3_PIN);	// xCS lo

	outp(VS1001_READ, SPDR);
	loop_until_bit_is_set(SPSR, SPIF);    

	outp(address, SPDR);
	loop_until_bit_is_set(SPSR, SPIF);    

	while (count--)
	{
		outp(0x00, SPDR);
		loop_until_bit_is_set(SPSR, SPIF);    
		*pData = ((u16)inp(SPDR)) << 8;

		outp(0x00, SPDR);
		loop_until_bit_is_set(SPSR, SPIF);    
		*pData |= inp(SPDR);

		pData++;
	}

	sbi( MP3_PORT, MP3_PIN);	// xCS hi

	//this is absolutely neccessary!
	delay(5); //wait 5 microseconds after sending data to control port
}

//
// write one or more word(s) to the VS1001 Control registers
//
void vs1001_write(u08 address, u16 count, u16 *pData)
{
	cbi( MP3_PORT, MP3_PIN);	// xCS lo

	outp(VS1001_WRITE, SPDR);
	loop_until_bit_is_set(SPSR, SPIF);    

	outp(address, SPDR);
	loop_until_bit_is_set(SPSR, SPIF);    

	while (count--)
	{
		outp((u08)((*pData) >> 8), SPDR);
		loop_until_bit_is_set(SPSR, SPIF);    
		
		outp((u08)(*pData), SPDR);
		loop_until_bit_is_set(SPSR, SPIF);    
	
		pData++;
	}

	sbi( MP3_PORT, MP3_PIN);	// xCS hi

	//this is absolutely neccessary!
	delay(6); //wait 5 microseconds after sending data to control port
}


/****************************************************************************
**
** MPEG Data Stream
**
****************************************************************************/

//
// send a byte to the VS1001 MPEG stream
//
inline void vs1001_send_data(u08 b)
{
	
	sbi( BSYNC_PORT,   BSYNC_PIN ); 	// byte sync hi

	outp(b, SPDR);		// send data

	asm volatile("nop");
	asm volatile("nop");
	asm volatile("nop");
	
	cbi( BSYNC_PORT,   BSYNC_PIN ); 	// byte sync lo

	// wait for data to be sent
	loop_until_bit_is_set(SPSR, SPIF);    

}


//
// send a burst of 32 data bytes to the VS1001 MPEG stream
//
inline void vs1001_send_32(u08 *p)
{
	u16 j;

	sbi( BSYNC_PORT,   BSYNC_PIN ); 		// byte sync hi
	for (j=0;j<32;j++)
	{
//		sbi( BSYNC_PORT,   BSYNC_PIN ); 	// byte sync hi
		outp(*p++, SPDR);		// send data
//		asm volatile("nop");
//		asm volatile("nop");
//		asm volatile("nop");
//		cbi( BSYNC_PORT,   BSYNC_PIN ); 	// byte sync lo

		// wait for data to be sent
		loop_until_bit_is_set(SPSR, SPIF);    
	}
	cbi( BSYNC_PORT,   BSYNC_PIN ); 		// byte sync lo
}



/****************************************************************************
**
** Init and helper functions
**
****************************************************************************/


// setup I/O pins and directions for
// communicating with the VS1001
void vs1001_init_io(void)
{
	u08 dummy;
	// setup BSYNC
	sbi( BSYNC_PORT-1, BSYNC_PIN ); 	// pin is output for BSYNC
	cbi( BSYNC_PORT,   BSYNC_PIN ); 	// output low

	// set the MP3/ChipSelect pin hi
	sbi( MP3_PORT-1, MP3_PIN); 			// pin output for xCS
	sbi( MP3_PORT,   MP3_PIN); 			// output hi (select MP3)

	// set the /Reset pin hi
//	sbi( RESET_PORT-1, RESET_PIN); 		// pin output 
//	sbi( RESET_PORT,   RESET_PIN); 		// output hi

	// setup serial data interface :
	// clock = f/4
	// select clock phase positive going in middle of data
	// master mode
	// enable SPI

	// setup serial data I/O pins

	sbi(DDRB, PB5);	// set MOSI a output
	sbi(DDRB, PB4);	// SS must be output for Master mode to work

	sbi(DDRB, PB7);	// set SCK as output
	cbi(PORTB, PB7);// set SCK lo

	outp((1<<MSTR)|(1<<SPE) /*| (1<<SPR0)*/, SPCR );	// 2 MHz clock

	dummy = inp(SPSR);	// clear status
}


// setup the VS1001 chip for decoding
void vs1001_init_chip(void)
{

	//do a software reset

	delay(3000);
	vs1001_reset();

	// ande flush the buffers
	delay(3000);
	vs1001_nulls(32);
}

// reset the VS1001
void vs1001_reset(void)
{
	u16 buf[2];

	delayms(200);		// wait 200 mS
	
	// set SW reset bit	
	buf[0] = 0x04;
	vs1001_write(0,1,buf);	// set bit 2

	delayms(2);		// wait 2 mS

	loop_until_bit_is_set(DREQ_PORT - 2, DREQ_PIN); //wait for DREQ

	// set CLOCKF to compensate for a 24 MHz x-tal
	buf[0] = 12000;
	vs1001_write(3,1,buf);	

	vs1001_nulls(1024);
	    
}


//
// send a number of zero's to the VS1001
//
void vs1001_nulls(u16 nNulls)
{
	while (nNulls--)
		vs1001_send_data(0);
}


//
// Set the VS1001 volume
//
void vs_1001_setvolume(u08 left, u08 right)
{
	u16 buf[2];

	buf[0] = (((u16)left) << 8) | (u16)right;

	vs1001_write(11, 1, buf);
}



?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人久久18免费网站麻豆| 亚洲精品免费在线| 国精品**一区二区三区在线蜜桃| 欧美片网站yy| 免费在线观看成人| 精品国产乱码91久久久久久网站| 老司机精品视频在线| 久久久亚洲高清| 成年人国产精品| 亚洲第一综合色| 精品国产91久久久久久久妲己| 国产精品一级在线| 夜色激情一区二区| 欧美大片顶级少妇| 不卡的av中国片| 亚洲国产欧美在线人成| 精品va天堂亚洲国产| 99久久免费视频.com| 亚洲国产视频一区二区| 精品国产伦一区二区三区观看方式 | 激情欧美日韩一区二区| 国产精品污www在线观看| 欧美日韩一区二区三区高清| 青青草97国产精品免费观看 | 日韩电影免费在线看| 久久众筹精品私拍模特| 91成人在线观看喷潮| 狠狠狠色丁香婷婷综合激情| 亚洲男同性视频| 久久久青草青青国产亚洲免观| 一本一本久久a久久精品综合麻豆| 日韩极品在线观看| 国产精品二三区| 日韩欧美色综合| 欧亚洲嫩模精品一区三区| 久久精工是国产品牌吗| 一区二区三区在线观看欧美| 精品国产在天天线2019| 欧美日韩在线直播| av一区二区三区四区| 狂野欧美性猛交blacked| 一区二区激情小说| 国产欧美一二三区| 日韩欧美视频一区| 欧美色网站导航| av在线不卡网| 国产精品99久久久| 人妖欧美一区二区| 亚洲国产一区二区三区青草影视| 国产精品三级av| 精品1区2区在线观看| 91精品久久久久久久91蜜桃 | 欧美日韩亚洲不卡| 91精品国产综合久久精品麻豆| 国产精品一区一区三区| 午夜国产精品一区| 亚洲激情男女视频| ...av二区三区久久精品| 国产亚洲精久久久久久| 欧美一二三在线| 欧美精品丝袜久久久中文字幕| 91在线一区二区| 99国产精品久久久久| 国产99久久久久| 国产不卡视频在线观看| 久久福利资源站| 精品一区二区三区免费观看| 捆绑变态av一区二区三区| 日韩电影在线免费看| 日韩精品高清不卡| 无码av免费一区二区三区试看| 亚洲制服丝袜av| 亚洲成人精品在线观看| 午夜av一区二区三区| 亚洲国产毛片aaaaa无费看| 一区二区三区在线播| 亚洲综合视频网| 亚洲成人激情综合网| 视频一区二区欧美| 日本中文字幕一区二区视频| 午夜成人免费视频| 美女视频网站黄色亚洲| 久久99国产精品成人| 国产一区日韩二区欧美三区| 国产一区二区在线看| 国产mv日韩mv欧美| 成人精品国产一区二区4080| 99国产精品久| 欧美三级资源在线| 欧美一区二区三区视频| 久久伊人中文字幕| 国产精品麻豆久久久| 亚洲综合小说图片| 日韩av中文字幕一区二区三区| 捆绑变态av一区二区三区| 福利电影一区二区三区| 一本色道久久综合狠狠躁的推荐| 欧美日韩黄色一区二区| 欧美成人女星排名| 国产精品人人做人人爽人人添| 依依成人综合视频| 国产suv精品一区二区6| 99久久亚洲一区二区三区青草| 在线看日韩精品电影| 欧美一区二区三区免费大片| 国产亚洲精品精华液| 亚洲综合成人网| 久久国产生活片100| 成a人片亚洲日本久久| 欧美人牲a欧美精品| 亚洲国产经典视频| 亚洲国产欧美日韩另类综合| 国产麻豆视频一区二区| 91福利视频久久久久| 久久中文娱乐网| 亚洲国产色一区| 国产成人在线色| 欧美顶级少妇做爰| 中文字幕一区二区三区精华液| 午夜欧美视频在线观看 | 日日骚欧美日韩| 国产盗摄女厕一区二区三区| 欧美在线高清视频| 精品日韩一区二区三区免费视频| 亚洲乱码日产精品bd| 国产麻豆日韩欧美久久| 欧美男同性恋视频网站| 欧美国产精品专区| 日韩精品欧美精品| 91久久精品一区二区二区| 精品国产乱码久久久久久浪潮| 亚洲一区二区三区四区中文字幕| 国产精品亚洲а∨天堂免在线| 欧美精品高清视频| 樱花草国产18久久久久| 不卡一区二区在线| 91蜜桃婷婷狠狠久久综合9色| 成人动漫视频在线| 2020国产精品| 日韩中文欧美在线| 91理论电影在线观看| 国产免费观看久久| 韩国一区二区在线观看| 欧美一区欧美二区| 亚洲成人免费视| 欧美羞羞免费网站| 亚洲免费三区一区二区| 成人黄色av电影| 国产欧美一区二区三区鸳鸯浴| 日韩成人av影视| 欧美在线短视频| 亚洲精品乱码久久久久久| 成人黄色小视频在线观看| 久久综合九色综合久久久精品综合 | 依依成人精品视频| 91色九色蝌蚪| 亚洲视频香蕉人妖| 91亚洲国产成人精品一区二区三| 欧美极品xxx| 国产高清亚洲一区| 久久精品亚洲麻豆av一区二区| 久草这里只有精品视频| 精品久久人人做人人爱| 精品一二线国产| 久久综合狠狠综合| 高清不卡一区二区在线| 国产欧美精品在线观看| 成人在线综合网站| 国产精品灌醉下药二区| 91麻豆自制传媒国产之光| 亚洲美女视频在线| 欧美羞羞免费网站| 午夜不卡av在线| 日韩精品一区二区三区视频| 亚洲欧美福利一区二区| 国产福利一区二区三区视频在线 | 一区二区在线观看免费| 99视频有精品| 亚洲激情一二三区| 欧美精品xxxxbbbb| 麻豆国产精品视频| 国产亚洲精品中文字幕| 成人精品亚洲人成在线| 亚洲视频中文字幕| 91麻豆成人久久精品二区三区| 亚洲美腿欧美偷拍| 91精品国模一区二区三区| 国产综合成人久久大片91| 国产三级一区二区| 另类调教123区 | 亚洲欧美一区二区久久| 在线免费精品视频| 日韩av在线发布| 国产女同互慰高潮91漫画| 国产成人aaaa| 亚洲成在人线在线播放| 久久影院视频免费| 日本黄色一区二区| 美女视频第一区二区三区免费观看网站| 久久亚洲一区二区三区明星换脸|