ZipAmp中英文对照表

2011-07-23 22:39:17来源: 互联网

ZipAmp中英文对照表

/*********************************************
ZipAmp

Author : Nasif Akand
Copyright : (C) Nasif Akand 2003
Notice :
Copyright 2003 Nasif Akand (nasif@yifan.net)
http://go.to/zipamp
http://zipamp.virtualave.net

This file is part of ZipAmp MP3 software.

ZipAmp 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.

ZipAmp 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 code; if not write to the Free Software
Foundation Inc. 59 Temple Place Suite 330 Boston MA 02111-1307 USA
这一个文件是 ZipAmp MP3 软件的一部份。

ZipAmp 是免费的软件;你能重新分配它及[或] 修正
它在角马公众执照的术语之下当做出版被
免费的软件基础; 或执照的 2 版 或
(在你的选项)任何的较迟版本。

ZipAmp 在希望中被分配它将会是有用的
但是没有任何的担保; 没有更甚至被暗示的担保
为一个特别的目的 MERCHANTABILITY 或健身。 那
为较多的细节角马公众执照。

你应该要接受角马公众执照的副本
连同这一个密码一起; 如果不 写到免费的软件
基础,公司, 59个寺庙地方,随员 330 ,波士顿 文学硕士 02111-1307 美国

Chip type : AT90S8515
Clock frequency : 12.00000 MHz
Memory model : Small
Internal SRAM size : 512 bytes
External SRAM size : 0 byte
Data Stack size : 64 bytes

这个是用来设置Codevision的,按照这个设置然后添加下面所提示的包含就可以编译了。
芯片类型 : AT90S8515
时钟频率 : 12.00000 MHz
内存模式 : 小的
内在的 SRAM 大小 : 512 bytes
外部 SRAM 大小 : 0 byte
数据堆栈大小 : 64 bytes

Tested ATA Drive
Samsung SpinPoint SV3064D 30 GB

Test Drive Access Time:
Track to Track : 0.8 m/s
Average : 9.0m/s
Full Stroke : 17 m/s

Test Drive Playback:
Full speed MP3 playback at 320KBps.

测试时使用的是三星的 SV3064D 30 GB 硬盘

测试硬盘的平均时间:
轨迹到轨迹 : 0.8 m/s
平均 : 9.0m/s
完全的读取 : 17 m/s

测试硬盘重放:
使用的是编码率高达320KBps的mp3.
*********************************************/

#define DataReq PINB.2

#include <90s8515.h> //8515 header file
#include //Codevision spi
#include "zfat.h"
#include "zata.h"
#include "ztype.h"
#include "zcontrol.h"
#include "zlcd.h"
#include //Codevision delay
#include "i2c.h"
//下面是按照Datazyb所提示而添加进的。添加这些包含后就能顺利的编译了。
//编译好了的程序能读取我的富士通3g的硬盘,但是出来的声音不流畅,可能示由于硬盘太老的缘故吧。
#include "zata.c"
#include "zfat.c"
#include "ztype.c"
#include "zcontrol.c"
#include "zlcd.c"
#include "i2c.c"

// External Interrupt 0 service routine
// 外部中断 0个服务常式
//这里说明一下,这里是按钮输入的反应设置,也就是说当按钮按下zipmap要干些什么就是在这里设置的。
//情形(case)按照1,2,4,8...这样排列是照按键接口ad0,ad1...来的,
interrupt [EXT_INT0] void ext_int0_isr(void)
{
unsigned char in;
#asm("cli");
in=PINC; //Read the input buttons /读输入按钮
in=~in; //Invert them to see which one is high (thats the one pressed) /判断它们是哪一个按下了。

while ((!PIND.2)); //wait until interrupt key released /等候按纽松开了才输出

switch (in) {

//Case 1= STOP /情形 1= 停止
case 1: //play=0 is pause play=1 is play play=2 is stop
//播放=0 代表暂停 播放=1 代表播放 播放=2 代表停止

play=2; //STOP /停止
STAPlay(); //Stop player /停止播放器
UnBusy(); //Remove HD Busy light /使硬盘指示灯长亮
currentCluster=firstCluster; //Remember file start cluster /记忆文件开始群
clusterBufferReadPos=clusterBufferWritePos; //Clear cluster buffer /清除群缓冲

filePos=0; //Set filestart pos at beginning
sectorPos=0;
mp3Pos=0;
break;

//Case 2= Play or Pause /情形 2= 播放或暂停
case 2: play=(~play) & 1; //Invert play. If play then pause if pause then play
//反转播放.如果是播放就暂停,如果暂停就播放
STAPlay(); //Load command /读取命令
break;

//Case 4=
case 4:
if (currentFileNum<=1) currentFileNum=totalFiles-1;
else currentFileNum=currentFileNum-2;
dirReadOffset.fileNum=0; //To reread dir from start.

break;

case 8: currentFileNum+=advance; //FF
if (currentFileNum>totalFiles) {
currentFileNum=1;
dirReadOffset.fileNum=0;
}
break;

case 16: filePos=FileSize; //NEXT
break;

case 32: //声音模式设置
soundMode = (soundMode+1) & soundModeMask;
SetBassTreble();
break;

case 64: playMode = (playMode+1) & playModeMask; //播放模式设定
break;
};

intFlag=1; //Set interrupt occured flag /设置中断发生情况
}

/*
// External Interrupt 1 service routine / 外部中断 1个服务常式
interrupt [EXT_INT1] void ext_int1_isr(void)
{
// Place your code here
// 把你的代码放到这里,实际上在zipamp里这里可以不用理会,因为它的中断1口根本就没有接东西上去
//不过你如果想添加遥控的话,把代码放到这里是再合适不过的了。
printf("Entered Interrupt 2");
} */


// Declare your global variables here
//全局变量在这里

void main(void)
{
// Declare your local variables here
byte temp; dword extension;

//这些设置要结合硬件电路图才能看得明白。
// Input/Output Ports initialization /设定输入输出口初始值。
// Port A /PA口
DDRA=0x00; //Start as Input port /开始为输入口
PORTA=0x00; //Set to High-Z state /设定为高阻状态

// Port B /PA口
DDRB=0xBB;
PORTB=0x0B; //Enable Reset for STA013 Disable ATA IOR and IOW. /允许重启STA013 禁止ATA IOR与IOW.

// Port C /PA口
DDRC=0xFF; //Output port /输出口
PORTC=0x00; //Set 0 /设定 0

// Port D /PA口
DDRD=0xF2;
PORTD=0x20; //Disable Latch and Buffer. Never pull PORTD.1 high that will cause damage to STA013
//使门电路和缓冲器失去能力。千万别拉高“PORTD.1”(这里注释可能有误,应该为PORTD.0)那样做会损坏到STA013

//这些设置要结合90s8515的说明书才会明白
// Timer/Counter 0 initialization / 定时/计数器0初始值设定
// Clock source: System Clock / 时钟来源: 系统时钟
// Clock value: Timer 0 Stopped / 时钟值: 时钟0停止
// Mode: Output Compare / 模式: 输出比较
// OC0 output: Disconnected / OC0 输出: 分离
TCCR0=0x00;
TCNT0=0x00;

// Timer/Counter 1 initialization / 定时/计数器1初始值设定
// Clock source: System Clock / 时钟来源: 系统时钟
// Clock value: 14318.180 kHz / 时钟值: 14318.180 kHz
// Mode: Output Compare / 模式: 输出比较
// OC1A output: Discon. / OC1A 输出: 不精读.
// OC1B output: Discon. / OC1B 输出: 不精读.
// Noise Canceler: Off / 噪音取消: 关
// Input Capture on Falling Edge / 输入取下下降沿
TCCR1A=0x00;
TCCR1B=0x01;
TCNT1H=0x00;
TCNT1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;

// External Interrupt(s) initialization /设定外部(s)初始值
// INT0: On /INT0: 开
// INT0 Mode: Low level /INT0 模式: 低电平有效
// INT1: On /INT1: 开
// INT1 Mode: Low level /INT1 模式: 低电平有效
GIMSK=0x40;
MCUCR=0x00;
GIFR=0x40;


// Timer(s)/Counter(s) Interrupt(s) initialization /设定定时(s)/计数器(s)中断(s)初始值
TIMSK=0x00;

// UART initialization /串口初始值设定
// Communication Parameters: 8 Data 1 Stop No Parity /沟通叁数: 8 数据 1 没有同等
// UART Receiver: Off /串口接收器(rx):开
// UART Transmitter: On /串口发射器(tx):关


// UART Baud rate: 19200 at 14.3181 /串口通讯波特率: 19200到14.3181之间
UCR=0x08;
UBRR=0x2E;


// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;

// SPI initialization
// SPI Type: Master
// SPI Clock Rate: 2460.000 kHz
// SPI Clock Phase: Cycle Half
// SPI Clock Polarity: Low
// SPI Data Order: MSB First
// SPI 初始值设定
// SPI 类型: Master
// SPI 时钟频率: 2460.000 kHz
// SPI 时钟周期: 一半
// SPI 时钟极性: 低
// SPI 数据次序: MSB第一
SPCR=0x50;

#asm("cli");

//好了,设置好8515各个端口的初始之后,我们要开始干正事了,先初始化lcd屏,然后延时3000ms,这是为了在
//屏上显示logo
InitLCD();
delay_ms(3000);
//DDRC=0x00;
//PORTC=0x00;

//接下来就初始话ata与fta
ATA_Init();
InitFAT();

currentFileNum=0;
temp=0;

//Find two required files in root dir ZIPAMP.SYS and ZIPAMP.CFG and save their LBA address
//查找两个必须的文件ZIPAMP.SYS和ZIPAMP.CFG并保存它们的LBA地址
while ((temp<2)&&(getDirEntry(0)==1)) {
extension = (*(dword *)fileExtension) & 0x00FFFFFF;
//low-case z "logic AND" up-case Z =will equal up-case Z. Thus following checks for both 'z' and 'Z'
//通过逻辑或来检测zipamp文件的存在
if ((fileName[0] & 0x5A)==0x5A) { //if the name starts with Z then see if it is SYS or CFG file
//如果有文件名字为zipamp那么检查它是否为SYS或CFG文件
if (extension==0x00535953) { dirStackLBA=clust2LBA(currentCluster); temp++; } //ZIPAMP.SYS Stack file address
// 如果是ZIPAMP.SYS文件则保存文件地址
if (extension==0x00474643) { cfgFileLBA=clust2LBA(currentCluster); temp++; } //ZIPAMP.CFG Config file address
// 如果是ZIPAMP.CFG文件则保存文件地址,这里不知是否有错,cfg文件名转换成bin码应该为0x00434647
}
}

if (temp<2) Halt(4); //Missing SYS or CFG file. /如果找不到SYS或CFG文件则停止并显示错误.

STA013Setup(); //Setup STA013 decoder. /装载STA013解码器.

currentFileNum=0;
if (loadConfig()!=1) {//goto LOADED; /转到装载;
while (getDirEntry(1)==1) { //count # of MP3 files. /计数MP3文件.
totalFiles++;
gotoxy(3 0
writeNumber(totalFiles); //这里要用到数字输出,因为统计出来的数字是16进制的,所以需要通过数字输出
//将其转换成10进制的显示在屏幕上面。
}
}

//gotoxy(3 0
writestring(" Wait.."); //显示等待种,如果是中文屏的话,这里可以输入中文字

dirReadOffset.fileNum=0;
SetSoundCg(); //Load Sound Mode character bars into LCD CGRAM. /载如声音模式特性图形到LCD CGRAM.
play=1; //ZipAmp will start playing after boot finish. /ZipAmp会在启动完毕后开始播放.
SetBassTreble(); //Setup Bass Treble registers in STA013. /装备低音使 STA013 的寄存器增为三倍
SongSelect();
while (1) { //Main loop /主体循环

key<<=1;
if (key==0) key=1;
PORTC=~key;
DDRC=key;
#asm("sei");

//下面这段还不是太清楚,暂时不进行翻译。
//Following "if" is True when INTR in NEXT FF PREV occurs. filePos and FileSize is set equal there.
//In first iteration filePos will be greater than FileSize because STA013.BIN has been read to the finish
//thus this becomes true.
if (filePos>=FileSize) SongSelect(); //Song is selected when playing finished or NEXT/PREV button pressed
///当歌曲在播放的时候被按下了NEXT或PREV按纽时
if (intFlag) { //Interrupt occured and LCD display wasn't fixed fix it.
intFlag=0;
printInfo();
}

while ((DataReq)&&(filePos if (mp3Pos==0) read();
spi(sectorBuffer.data[mp3Pos++]);
spi(sectorBuffer.data[mp3Pos++]);
}

//If finished reading one cluster and head hasn't been moved
if ((sectorPos==Sectors_Per_Cluster) && (headMoved==0)) {

//if we have buffered next cluster then move head
if (readClusterBuffer()==1) ATA_Move_Head(clust2LBA(currentCluster));


else { //we didn't buffer it so find next cluster and move head
currentCluster=findNextCluster();
ATA_Move_Head(clust2LBA(currentCluster)); //Move head to read position
}
//Reset all parameters /重新安排全部数
sectorPos=0;
readPos=0;
headMoved=1;
}

//if we have already moved head then we can buffer next clusters
else if ((readPos|DataReq)==0) {
//check if datareq is set if set then get out of buffering
temp=sectorPos;
if (writeClusterBuffer()==1) { //if buffering was successful then move head to original location.
sectorPos=temp;
ATA_Move_Head(clust2LBA(currentCluster)+sectorPos); //move head to the current reading cluster.
headMoved=1;
readPos=0;
}
}

} // end of main loop /主体循环结束


} //END. /结束.

i2c.c
/*
Copyright 2003 Nasif Akand (nasif@yifan.net)
http://go.to/zipamp
http://zipamp.virtualave.net

This file is part of ZipAmp MP3 software.

ZipAmp 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.

ZipAmp 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 code; if not write to the Free Software
Foundation Inc. 59 Temple Place Suite 330 Boston MA 02111-1307 USA
这一个文件是 ZipAmp MP3 软件的一部份。

ZipAmp 是免费的软件;你能重新分配它及[或] 修正
它在角马公众执照的术语之下当做出版被
免费的软件基础; 或执照的 2 版 或
(在你的选项)任何的较迟版本。

ZipAmp 在希望中被分配它将会是有用的
但是没有任何的担保; 没有更甚至被暗示的担保
为一个特别的目的 MERCHANTABILITY 或健身。 那
为较多的细节角马公众执照。

你应该要接受角马公众执照的副本
连同这一个密码一起; 如果不 写到免费的软件
基础,公司, 59个寺庙地方,随员 330 ,波士顿 文学硕士 02111-1307 美国

*/

//This module performs I2C operations for ZipAmp /这是zipamp的i2c程序组件
//Nasif Akand

//If using CodeVision then following includes aren't needed. /如果使用 CodeVision 不需要包括下列各项
//#include "zcontrol.h"
//#include "zfat.h"
//#include "zata.h"
//#include "ztype.h"
#include "i2c.h"
//#include "" //CodeVision AVR internal delay routines /CodeVision AVR 内在的延迟常式

//I2C implementation for STA013 通过i2c控制sta013

//Port D bit 7 (pin 17) is SDA output while bit 0 (pin 10) is input Pin 16 is SCL
//SDA input is always at HighZ state. If this pin is pulled up or output high STA013 will be damaged.
//这里是定意的i2c sda数据的输入输出口,输出为17脚,输入为10脚,时钟信号scl为16脚。

#define SDA PORTD.7
#define SCL PORTD.6
#define SDAIn PIND.0
#define Out DDRD.7=1
#define In DDRD.7=0

#define qDelay delay_us(3) //According to Phillips I2C specs in all modes.. /这里是按照菲利普i2c总线模式写的
#define delay delay_us(3) //..max I2C delay can be 5 micro seconds. /最大 I2C 延迟可能是 5个微秒。
#define Read 0x87 //STA013 I2C Read address /STA013 I2C 读取地址
#define Write 0x86 //STA013 I2C Write Address /STA013 I2C 写入地址

//下面这段函数是复位sta013
void STA013Reset() {
DDRB.3=1; //Set bit3 to Output mode /设置pb3为输出状态
PORTB.3=0; //Set to 0 for reset /这里可以参看原理图就明白。pb3是连在sta013的26脚/reset上的.
delay_ms(500); //Wait
PORTB.3=1; //Set to 1
delay_ms(500); //Wait
}


//下面这段数据类型声明是用来测试i2c是否有正确应答,如果有就输出0则表示成功
unsigned char wait_Ack (void) {
//returns 1 if ACK was 0 (meaning transfer was successful). In I2C ACK=0 means success.

unsigned char t=1;
delay;

// Take clock high
SCL=1;
delay;

// Test of ACK
delay;
if (PIND.0) { /*test of SDA level if high -> problem*/
t=0;
}

delay;
if (PIND.0) { /*test of SDA level if high -> problem*/
t=0;
}

// Take clock back low
delay;
SCL=0;
delay;

return t;
}



//数据声明,声明i2c的阅读地址 adr为地址的缩写
unsigned char i2cReadAddress(unsigned char adr) {
//Returns data read from register given in adr./从寄存器中读取数据后返回
//In most cases we don't have to worry about it. If we don't get ACK try 10 times before giving up.
//在大部分的情况下,我们不需要为它担忧,在拿不到正确的应答之前要尝试十次。
unsigned char data try=0 ack;
do {
i2cStart(); //I2c start /i2c开始
ack=i2cSend(Write); //Send i2c write address /发送i2c写入地址
ack &=i2cSend(adr); //Send register address /发送记录地址
i2cStart(); //i2c re-start
delay; //wait
ack &= i2cSend(Read); //Send i2c read address
data=i2cReceive(0); //Receive data without sending ACK
i2cStop(); //Stop
try++;
}
while ((ack==0)&&(try<10)); //try 10 times if failed /尝试10次后返回

return data;
}

//数据声明,声明i2c的写入地址。这段和上面一段类似只不过由读变成了写
unsigned char i2cWriteAddress(unsigned char adr unsigned char data) {
// Writes data to register adr.
//Returns 1 on successful write tries 10 times before giving up.

unsigned char ack try=0;
do {
i2cStart(); //Start
ack = i2cSend(Write); //Send i2c write address
ack &= i2cSend(adr); //Send register address
delay; //wait
ack &= i2cSend(data); //Send data
i2cStop(); //Stop
try++;
}
while ((ack==0)&&(try<10)); //give up after 10 tries
return ack;
}

//这段函数是初始化i2c
void i2cInit() {
DDRD.7=1; //Set to output mode for SDA
DDRD.6=1; //Set to output mode for SCL
}

//下面这段函数是i2c开始的必要条件
void i2cStart() {
//I2C start condition.

DDRD.7=1; //SDA output mode
SDA=1;
delay;
SCL=1;
delay;
SDA=0;
delay;
SCL=0;
}

//数据声明,发送i2c数据到sta013后返回,成功为1,失败为0,这里发送的字节不大,一次为8个2进制数据,也就是1bit
unsigned char i2cSend(unsigned char value){
//Sends byte value and returs ACK from STA013 1=Success 0=Fail

unsigned char i;
DDRD.7=1;
for (i=0; i<8; i++) {
DDRD.7=1;
if (((value >> (7-i)) & 0x01)==0x01) SDA=1; //Send bit by bit
else SDA=0;
SCL=1;
delay;
SCL=0;
DDRD.7=1;
SDA=1;
delay;
}
delay;
i=wait_Ack();
return i;
}


//数据声明,和上面的声明类似,不过变成了接收。
unsigned char i2cReceive(unsigned char ack) {
//Receives data byte. Sends back acknoledge if ack is true

unsigned char value=0 i;
DDRD.7=1;
SDA=1;
for (i=0; i<8; i++) {
delay;
SCL=1;
delay;
value = (value << 1) + PIND.0; //leftshift previous value and add one more bit that's read
delay;
SCL=0;
}
if (ack) { //send ack if requested
DDRD.7=1;
SDA=0;
delay;
SCL=1;
delay;
SCL=0;
}
return value;
}

//此函数是i2c停止的条件
void i2cStop(){
//I2C stop condition.

delay;
DDRD.7=1; //SDA output mode
SDA=0;
delay;
SCL=1;
delay;
SDA=1;
delay;
}

i2c.h
/*
Copyright 2003 Nasif Akand (nasif@yifan.net)
http://go.to/zipamp
http://zipamp.virtualave.net

This file is part of ZipAmp MP3 software.

ZipAmp 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.

ZipAmp 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 code; if not write to the Free Software
Foundation Inc. 59 Temple Place Suite 330 Boston MA 02111-1307 USA
这一个文件是 ZipAmp MP3 软件的一部份。

ZipAmp 是免费的软件;你能重新分配它及[或] 修正
它在角马公众执照的术语之下当做出版被
免费的软件基础; 或执照的 2 版 或
(在你的选项)任何的较迟版本。

ZipAmp 在希望中被分配它将会是有用的
但是没有任何的担保; 没有更甚至被暗示的担保
为一个特别的目的 MERCHANTABILITY 或健身。 那
为较多的细节角马公众执照。

你应该要接受角马公众执照的副本
连同这一个密码一起; 如果不 写到免费的软件
基础,公司, 59个寺庙地方,随员 330 ,波士顿 文学硕士 02111-1307 美国
*/

//This module performs I2C operations for ZipAmp /这是zipamp的i2c程序组件
//Nasif Akand

//I2C implementation for STA013 /用i2c来操控sta013

#ifndef __I2C_H__
#define __I2C_H__

unsigned char wait_Ack (void);
unsigned char i2cReadAddress(unsigned char adr);
unsigned char i2cWriteAddress(unsigned char adr unsigned char data);
void i2cInit();
void i2cStart();
unsigned char i2cSend(unsigned char value);
unsigned char i2cReceive(unsigned char ack);
void i2cStop();
void STA013Reset();

#endif

关键字:英文  对照  对照表

编辑:神话 引用地址:http://www.eeworld.com.cn/mndz/2011/0723/article_10956.html
本网站转载的所有的文章、图片、音频视频文件等资料的版权归版权所有人所有,本站采用的非本站原创文章及图片等内容无法一一联系确认版权者。如果本网所选内容的文章作者及编辑认为其作品不宜公开自由传播,或不应无偿使用,请及时通过电子邮件或电话通知我们,以迅速采取适当措施,避免给双方造成不必要的经济损失。
论坛活动 E手掌握
微信扫一扫加关注
论坛活动 E手掌握
芯片资讯 锐利解读
微信扫一扫加关注
芯片资讯 锐利解读
推荐阅读
全部
英文
对照
对照表

小广播

独家专题更多

迎接创新的黄金时代 无创想,不奇迹
迎接创新的黄金时代 无创想,不奇迹
​TE工程师帮助将不可能变成可能,通过技术突破,使世界更加清洁、安全和美好。
TTI携TE传感器样片与你相见,一起传感未来
TTI携TE传感器样片与你相见,一起传感未来
TTI携TE传感器样片与你相见,一起传感未来
富士通铁电随机存储器FRAM主题展馆
富士通铁电随机存储器FRAM主题展馆
馆内包含了 纵览FRAM、独立FRAM存储器专区、FRAM内置LSI专区三大部分内容。 
电子工程世界版权所有 京ICP证060456号 京ICP备10001474号 电信业务审批[2006]字第258号函 京公海网安备110108001534 Copyright © 2005-2016 EEWORLD.com.cn, Inc. All rights reserved