/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
* File Name          : waveplayer.h
* Author             : MCD Application Team
* Date First Issued  : 03/10/2006
* Description        : This file contains all the functions prototypes for the
*                      wave player software driver.
********************************************************************************
* History:
* 07/17/2006 : V1.0
* 03/10/2006 : V0.1
********************************************************************************
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*******************************************************************************/

/* Define to prevent recursive inclusion ---------------------------------------*/
#ifndef __WAVEPLAYER_H
#define __WAVEPLAYER_H

/* .WAV file format :

 Endian      Offset      Length      Contents
  big         0           4 bytes     'RIFF'             // 0x52494646
  little      4           4 bytes     <file length - 8>
  big         8           4 bytes     'WAVE'             // 0x57415645

Next, the fmt chunk describes the sample format:

  big         12          4 bytes     'fmt '          // 0x666D7420
  little      16          4 bytes     0x00000010      // Length of the fmt data (16 bytes)
  little      20          2 bytes     0x0001          // Format tag: 1 = PCM
  little      22          2 bytes     <channels>      // Channels: 1 = mono, 2 = stereo
  little      24          4 bytes     <sample rate>   // Samples per second: e.g., 22050
  little      28          4 bytes     <bytes/second>  // sample rate * block align
  little      32          2 bytes     <block align>   // channels * bits/sample / 8
  little      34          2 bytes     <bits/sample>   // 8 or 16

Finally, the data chunk contains the sample data:

  big         36          4 bytes     'data'        // 0x64617461
  little      40          4 bytes     <length of the data block>
  little      44          *           <sample data>

*/

/* Includes --------------------------------------------------------------------*/
#include "75x_lib.h"

/* Exported types --------------------------------------------------------------*/
typedef struct
{
  u32  RIFFchunksize;
  u16  FormatTag;
  u16  NumChannels;
  u32  SampleRate;
  u32  ByteRate;
  u16  BlockAlign;
  u16  BitsPerSample;
  u32  DataSize;
} WAVE_FormatTypeDef;

typedef enum
{
  Valid_WAVE_File = 0,
  Unvalid_RIFF_ID,
  Unvalid_WAVE_Format,
  Unvalid_FormatChunk_ID,
  Unsupporetd_FormatTag,
  Unsupporetd_Number_Of_Channel,
  Unsupporetd_Sample_Rate,
  Unsupporetd_Bits_Per_Sample,
  Unvalid_DataChunk_ID,
  Unsupporetd_ExtraFormatBytes,
  Unvalid_FactChunk_ID
} ErrorCode;

/* Exported constants ----------------------------------------------------------*/
#define IntroReadAddr          0x80100000 /* Intro wave start read address */
#define OSIRISReadAddr         0x80400000 /* OSIRIS wave start read address */
#define AlarmReadAddr          0x80600000 /* Alarm wave start read address */
#define BoardTestReadWriteAddr 0x80620000 /* Board test wave start read write address */
#define RecordReadWritedAddr   0x80700000 /* Recorded wave start read write address */

#define AlarmDataLength        0x00006340  /* Alarm wave data length */

/* Exported macro --------------------------------------------------------------*/
/* Exported functions ----------------------------------------------------------*/
void WavePlayer_Init(void);
void WavePlayer_Start(void);
void WavePlayer_Stop(void);
void WavePlayerAlarm_Start(void);
void WavePlayerAlarm_Stop(void);
void WavePlayer_GlobalVarReset(void);
void WavePlayer_GlobalVarSetPromo(void);
void WavePlayer_GlobalVarSetOSIRIS(void);
void WavePlayer_WaveProperties(void);
ErrorCode WavePlayer_WaveParsing(u32 ReadAddress);

#endif /*__WAVEPLAYER_H */

/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE******/
