The "GR-PEACH_Audio_Playback_7InchLCD_Sample" is a sample code that can provides high-resolution audio playback of FLAC format files. It also allows the user to audio-playback control functions such as play, pause, and stop by manipulating key switches.
Dependencies: GR-PEACH_video R_BSP TLV320_RBSP USBHost_custom
Fork of GR-PEACH_Audio_Playback_Sample by
decode.h
00001 /******************************************************************************* 00002 * DISCLAIMER 00003 * This software is supplied by Renesas Electronics Corporation and is only 00004 * intended for use with Renesas products. No other uses are authorized. This 00005 * software is owned by Renesas Electronics Corporation and is protected under 00006 * all applicable laws, including copyright laws. 00007 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING 00008 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT 00009 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 00010 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. 00011 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS 00012 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE 00013 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR 00014 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE 00015 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 00016 * Renesas reserves the right, without notice, to make changes to this software 00017 * and to discontinue the availability of this software. By using this software, 00018 * you agree to the additional terms and conditions found by accessing the 00019 * following link: 00020 * http://www.renesas.com/disclaimer* 00021 * Copyright (C) 2015 Renesas Electronics Corporation. All rights reserved. 00022 *******************************************************************************/ 00023 00024 #ifndef DECODE_H 00025 #define DECODE_H 00026 00027 #include "r_typedefs.h" 00028 #include "USBHostMSD.h" 00029 #include "R_BSP_Scux.h" 00030 00031 /*--- Macro definition ---*/ 00032 #define DEC_STACK_SIZE (2048u) /* Stack size of Decode thread */ 00033 #define DEC_MIN_BLOCK_SIZE (192u) /* Minimum block size */ 00034 #define DEC_MAX_BLOCK_SIZE (16384u) /* Maximum block size */ 00035 #define DEC_16BITS_PER_SAMPLE (16u) /* Bit count per sample */ 00036 #define DEC_24BITS_PER_SAMPLE (24u) /* Bit count per sample */ 00037 #define DEC_MAX_CHANNEL_NUM (2u) /* Maximum number of channel */ 00038 #define DEC_OUTPUT_PADDING_BITS (8u) /* Padding of lower 8 bits */ 00039 #define DEC_SCUX_READ_NUM (9u) /* The number of buffuer for SCUX read */ 00040 00041 /* Minimum sampling rate in Hz of input file */ 00042 #define DEC_INPUT_MIN_SAMPLE_RATE (SAMPLING_RATE_22050HZ) 00043 /* Maximum sampling rate in Hz of input file */ 00044 #define DEC_INPUT_MAX_SAMPLE_RATE (SAMPLING_RATE_96000HZ) 00045 /* Sampling rate in Hz of audio output */ 00046 #define DEC_OUTPUT_SAMPLE_RATE (SAMPLING_RATE_96000HZ) 00047 /* Channel number of audio output */ 00048 #define DEC_OUTPUT_CHANNEL_NUM (DEC_MAX_CHANNEL_NUM) 00049 /* Bit count per sample of audio output */ 00050 #define DEC_OUTPUT_BITS_PER_SAMPLE (DEC_24BITS_PER_SAMPLE) 00051 00052 /*--- User defined types ---*/ 00053 typedef void (*DEC_CbOpen)(const bool result, 00054 const uint32_t sample_freq, const uint32_t channel_num); 00055 typedef void (*DEC_CbClose)(void); 00056 00057 /** Decode Thread 00058 * 00059 * @param argument Pointer to the thread function as start argument. 00060 */ 00061 void dec_thread(void const *argument); 00062 00063 /** Instructs the decode thread to open the decoder. 00064 * 00065 * @param p_handle File handle 00066 * @param p_cb Callback function for notifying the completion of open processing 00067 * typedef void (*DEC_CbOpen)(const bool result, 00068 * const uint32_t sample_freq, const uint32_t channel_num); 00069 * When calling callback function specified in p_cb, specify the following 00070 * in the callback function arguments result, sample_freq, and channel_num: 00071 * result : Execution result; true = Open is successful, false = Open fails 00072 * sample_freq : Sampling frequency of the file to be played back 00073 * channel_num : Number of channels for the file to be played back. 00074 * 00075 * @returns 00076 * Returns true if the API is successful. Returns false if the API fails. 00077 * This function fails when: 00078 * The argument p_handle is set to NULL. 00079 * The argument p_cb is set to NULL. 00080 * Failed to secure memory for mailbox communication. 00081 * Failed to perform transmit processing for mailbox communication. 00082 */ 00083 bool dec_open(FILE * const p_handle, const DEC_CbOpen p_cb); 00084 00085 /** Instructs the decode thread for playback. 00086 * 00087 * @returns 00088 * Returns true if the API is successful. Returns false if the API fails. 00089 * This function fails when: 00090 * Failed to secure memory for mailbox communication. 00091 * Failed to perform transmit processing for mailbox communication. 00092 */ 00093 bool dec_play(void); 00094 00095 /** Instructs the decode thread for pause. 00096 * 00097 * @returns 00098 * Returns true if the API is successful. Returns false if the API fails. 00099 * This function fails when: 00100 * Failed to secure memory for mailbox communication. 00101 * Failed to perform transmit processing for mailbox communication. 00102 */ 00103 bool dec_pause_on(void); 00104 00105 /** Instructs the decode thread to exit the pause state. 00106 * 00107 * @returns 00108 * Returns true if the API is successful. Returns false if the API fails. 00109 * This function fails when: 00110 * Failed to secure memory for mailbox communication. 00111 * Failed to perform transmit processing for mailbox communication. 00112 */ 00113 bool dec_pause_off(void); 00114 00115 /** Instructs the decode thread to stop processing. 00116 * 00117 * @returns 00118 * Returns true if the API is successful. Returns false if the API fails. 00119 * This function fails when: 00120 * Failed to secure memory for mailbox communication. 00121 * Failed to perform transmit processing for mailbox communication. 00122 */ 00123 bool dec_stop(void); 00124 00125 /** Instructs the decode thread to close the decoder. 00126 * 00127 * @param p_cb Callback function for notifying the completion of close processing 00128 * typedef void (*DEC_CbClose)(void); 00129 * 00130 * @returns 00131 * Returns true if the API is successful. Returns false if the API fails. 00132 * This function fails when: 00133 * The argument p_cb is set to NULL. 00134 * Failed to secure memory for mailbox communication. 00135 * Failed to perform transmit processing for mailbox communication. 00136 */ 00137 bool dec_close(const DEC_CbClose p_cb); 00138 00139 /** Issues a read request to the SCUX driver. 00140 * 00141 * @param p_data Buffer for storing the read data 00142 * @param data_size Number of bytes to read 00143 * @param p_data_conf Asynchronous control information 00144 * 00145 * @returns 00146 * Returns true if the API is successful. Returns false if the API fails. 00147 * This function fails when: 00148 * The argument p_data is set to NULL. 00149 * The argument data_size is set to 0. 00150 * The argument p_data_conf is set to NULL. 00151 */ 00152 bool dec_scux_read(void * const p_data, const uint32_t data_size, 00153 const rbsp_data_conf_t * const p_data_conf); 00154 00155 #endif /* DECODE_H */
Generated on Tue Jul 12 2022 19:32:28 by 1.7.2