test public
Dependencies: HttpServer_snapshot_mbed-os
R_BSP_Scux.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 * @file R_BSP_Scux.h 00025 * @brief SCUX API 00026 ******************************************************************************/ 00027 00028 #ifndef R_BSP_SCUX_H 00029 #define R_BSP_SCUX_H 00030 00031 #if defined(TARGET_RZ_A1XX) 00032 #define R_BSP_SCUX_ENABLE 1 00033 00034 #include "R_BSP_SerialFamily.h" 00035 #include "R_BSP_ScuxDef.h" 00036 00037 #define SAMPLING_RATE_8000HZ (8000U) /* Selects a sampling rate of 8 kHz. */ 00038 #define SAMPLING_RATE_11025HZ (11025U) /* Selects a sampling rate of 11.025 kHz. */ 00039 #define SAMPLING_RATE_12000HZ (12000U) /* Selects a sampling rate of 12 kHz. */ 00040 #define SAMPLING_RATE_16000HZ (16000U) /* Selects a sampling rate of 16 kHz. */ 00041 #define SAMPLING_RATE_22050HZ (22050U) /* Selects a sampling rate of 22.05 kHz. */ 00042 #define SAMPLING_RATE_24000HZ (24000U) /* Selects a sampling rate of 24 kHz. */ 00043 #define SAMPLING_RATE_32000HZ (32000U) /* Selects a sampling rate of 32 kHz. */ 00044 #define SAMPLING_RATE_44100HZ (44100U) /* Selects a sampling rate of 44.1 kHz. */ 00045 #define SAMPLING_RATE_48000HZ (48000U) /* Selects a sampling rate of 48 kHz. */ 00046 #define SAMPLING_RATE_64000HZ (64000U) /* Selects a sampling rate of 64 kHz. */ 00047 #define SAMPLING_RATE_88200HZ (88200U) /* Selects a sampling rate of 88.2 kHz. */ 00048 #define SAMPLING_RATE_96000HZ (96000U) /* Selects a sampling rate of 96 kHz. */ 00049 #define SELECT_IN_DATA_CH_0 (0U) /* Specifies audio channel 0ch. */ 00050 #define SELECT_IN_DATA_CH_1 (1U) /* Specifies audio channel 1ch. */ 00051 00052 /** SRC parameter information */ 00053 typedef struct 00054 { 00055 bool src_enable; /**< SRC function enable setting */ 00056 scux_data_word_len_t word_len; /**< Word length of the audio data to be used 00057 by the SRC. */ 00058 bool mode_sync; /**< Synchronization mode */ 00059 uint32_t input_rate; /**< Input sampling rate */ 00060 uint32_t output_rate; /**< Output sampling rate */ 00061 uint32_t select_in_data_ch[SCUX_USE_CH_2]; /**< For SRC's input data position swapping */ 00062 } scux_src_usr_cfg_t; 00063 00064 /** The SCUX module is made up of a sampling rate converter, a digital volume unit, and a mixer. 00065 * The SCUX driver can perform asynchronous and synchronous sampling rate conversions using the sampling rate 00066 * converter. 00067 * The SCUX driver uses the DMA transfer mode to input and output audio data. 00068 */ 00069 class R_BSP_Scux : public R_BSP_SerialFamily { 00070 00071 public: 00072 /** Constructor: Initializes and opens the channel designated by the SCUX driver. 00073 * 00074 * @param channel SCUX channel number 00075 * @param int_level Transfer interrupt priority level (0x00-0xF7; default = 0x80) 00076 * @param max_write_num Maximum number of writes (1 to 128; default = 16) 00077 * @param max_read_num Maximum number of reads (1 to 128; default = 16) 00078 */ 00079 R_BSP_Scux(scux_ch_num_t channel, uint8_t int_level = 0x80, int32_t max_write_num = 16, int32_t max_read_num = 16); 00080 00081 /** Destructor: Closes the channel designated by the SCUX driver and exits. 00082 * 00083 */ 00084 virtual ~R_BSP_Scux(void); 00085 00086 /** Sets up the SCUX HW and starts operation, then starts accepting write/read requests. 00087 * Allocates a DMA channel for read requests. 00088 * The function also initializes the SCUX HW error state. 00089 * 00090 * @return Returns true if the function is successful. Returns false if the function fails. 00091 */ 00092 bool TransStart(void); 00093 00094 /** Stops accepting write/read requests, flushes out all data in the SCUX that is requested for transfer, 00095 * then stops the HW operation. 00096 * If a transfer request is being processed, the function stops accepting write/read requests, 00097 * then performs preprocessing to stop the HW operation after flushing out all data in the SCUX 00098 * that is requested for transfer. 00099 * If no transfer request is being processed, the function stops accepting write/read requests 00100 * before stopping the HW operation. 00101 * The function releases the DMA channel for read requests when the HW operation is stopped. 00102 * It also calls the user-own callback function at the end of the transfer. 00103 * 00104 * @param callback Pointer to the callback function 00105 * The SCUX driver places an error code indicating the execution result of FlushStop 00106 * in the argument of the callback function before calling the callback function. 00107 * The error code is set to 0 if FlushStop is successful. A negative number is set 00108 * if FlushStop fails. 00109 * @return Returns true if the function is successful. Returns false if the function fails. 00110 */ 00111 bool FlushStop(void (* const callback)(int32_t)); 00112 00113 /** Discards all data in the SCUX that is requested for transfer before stopping the hardware operation 00114 * and stops accepting write/read requests. 00115 * The function releases the DMA channel for read requests when the HW operation is stopped. 00116 * 00117 * @return Returns true if the function is successful. Returns false if the function fails. 00118 */ 00119 bool ClearStop(void); 00120 00121 /** Sets up SRC parameters. 00122 * 00123 * @param p_src_param SRC parameter information 00124 * @return Returns true if the function is successful. Returns false if the function fails. 00125 */ 00126 bool SetSrcCfg(const scux_src_usr_cfg_t * const p_src_param); 00127 00128 /** Obtains the state information of the write request. 00129 * 00130 * @param p_write_stat Status of the write request 00131 * SCUX_STAT_STOP (0) Acceptance of requests is stopped. 00132 * SCUX_STAT_IDLE (1) Processing of all requests is completed and waiting for a request. 00133 * SCUX_STAT_TRANS(2) Transfer in progress 00134 * @return Returns true if the function is successful. Returns false if the function fails. 00135 */ 00136 bool GetWriteStat(uint32_t * const p_write_stat); 00137 00138 /** Obtains the state information of the read request. 00139 * 00140 * @param p_read_stat ead request state 00141 * SCUX_STAT_STOP (0) Acceptance of requests is stopped 00142 * SCUX_STAT_IDLE (1) Processing of all requests is completed and waiting for a request. 00143 * SCUX_STAT_TRANS(2) Transfer in progress 00144 * @return Returns true if the function is successful. Returns false if the function fails. 00145 */ 00146 bool GetReadStat(uint32_t * const p_read_stat); 00147 00148 private: 00149 int32_t scux_ch; 00150 }; 00151 #endif /* TARGET_RZ_A1XX */ 00152 #endif /* R_BSP_SCUX_H */
Generated on Wed Jul 13 2022 05:33:36 by 1.7.2