📄 mp3_drv.c
字号:
/*C**************************************************************************
* NAME: mp3_drv.c
*----------------------------------------------------------------------------
* Copyright (c) 2003 Atmel.
*----------------------------------------------------------------------------
* RELEASE: snd1c-refd-nf-4_0_3
* REVISION: 1.7
*----------------------------------------------------------------------------
* PURPOSE:
* This file contains the MP3 driver routines
*
* NOTES:
* Driver Configuration:
* - MP3_CRC_SKIP in config.h define as:
* TRUE: to skip frames with CRC errors
* FALSE: to play frame with CRC errors
* Global Variables:
* - None
*****************************************************************************/
/*_____ I N C L U D E S ____________________________________________________*/
#include "config.h" /* system configuration */
#include "mp3_drv.h" /* mp3 driver definition */
/*_____ M A C R O S ________________________________________________________*/
/*_____ D E F I N I T I O N ________________________________________________*/
/*_____ D E C L A R A T I O N ______________________________________________*/
/*F**************************************************************************
* NAME: mp3_init
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* MP3 decoder initialisation
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
* ram/xram:
* cycle:
* stack:
* code:
*****************************************************************************/
void mp3_init (void)
{
#if MP3_CRC_SKIP == TRUE
Mp3_skip_crc_error(); /* skip frames with crc error */
#else
Mp3_play_crc_error(); /* play frames with crc error */
#endif
Mp3_enable(); /* MP3 enable */
}
/*F**************************************************************************
* NAME: mp3_set_prio
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Set the MP3 decoder priority interrupt
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
* ram/xram:
* cycle:
* stack:
* code:
*****************************************************************************/
void mp3_set_prio (Byte priority)
{
if ((priority == 1) || (priority == 3)) /* set LSB priority bit */
{
IPL0 |= MSK_EMP3;
}
if ((priority == 2) || (priority == 3)) /* set MSB priority bit */
{
IPH0 |= MSK_EMP3;
}
}
/*F**************************************************************************
* NAME: mp3_stop
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Close the MP3 decoder
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
* ram/xram:
* cycle:
* stack:
* code:
*****************************************************************************/
void mp3_stop (void)
{
Mp3_disable_int(); /* disable MP3 IT */
Mp3_disable(); /* disable decoding */
Mp3_ack_int(); /* clear pending interrupt */
}
/*F**************************************************************************
* NAME: mp3_restart
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* MP3 decoder restart
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
* ram/xram:
* cycle:
* stack:
* code:
*****************************************************************************/
void mp3_restart (void)
{
Mp3_disable();
Mp3_enable();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -