test public

Dependencies:   HttpServer_snapshot_mbed-os

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SPDIF_RBSP.h Source File

SPDIF_RBSP.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) 2018 Renesas Electronics Corporation. All rights reserved.
00022 *******************************************************************************/
00023 
00024 #ifndef MBED_SPDIF_RBSP_H
00025 #define MBED_SPDIF_RBSP_H
00026 
00027 #include "mbed.h"
00028 #include "AUDIO_RBSP.h"
00029 #include "R_BSP_Spdif.h"
00030 
00031 #if (R_BSP_SPDIF_ENABLE == 1)
00032 /** SPDIF_RBSP class, defined on the I2C master bus
00033 *
00034 */
00035 class SPDIF_RBSP : public AUDIO_RBSP {
00036 public:
00037 
00038     /** Create a SPDIF_RBSP object defined on the I2C port
00039      * 
00040      * @param audio_clk  audio clock
00041      * @param tx  SPDIF serial data output
00042      * @param rx  SPDIF serial data input
00043      * @param int_level     Interupt priority (SSIF)
00044      * @param max_write_num The upper limit of write buffer (SSIF)
00045      * @param max_read_num  The upper limit of read buffer (SSIF)
00046      */
00047     SPDIF_RBSP(PinName audio_clk, PinName tx, PinName rx, bool tx_udata_enable = false,
00048                 uint8_t int_level = 0x80, int32_t max_write_num = 16, int32_t max_read_num = 16);
00049 
00050     virtual ~SPDIF_RBSP() {}
00051 
00052     /** Overloaded power()
00053      *
00054      * @param type true=power up, false=power down
00055      */
00056     virtual void power(bool type = true);
00057 
00058     /** Set I2S interface bit length and mode
00059      *
00060      * @param length Set bit length to 16 bits
00061      * @return true = success, false = failure
00062      */
00063     virtual bool format(char length);
00064 
00065     /** Set sample frequency
00066      *
00067      * @param frequency Sample frequency of data in Hz
00068      * @return true = success, false = failure
00069      * 
00070      * supports frequencies: 44.1kHz
00071      * Default is 44.1kHz
00072      */
00073     virtual bool frequency(int hz);
00074 
00075     /** Get a value of SSIF channel number
00076      *
00077      * @return SPDIF channel number
00078      */
00079     int32_t GetSsifChNo(void) {
00080         return mSpdif_.GetSsifChNo();
00081     };
00082 
00083     /** Enqueue asynchronous write request
00084      *
00085      * @param p_data Location of the data
00086      * @param data_size Number of bytes to write
00087      * @param p_data_conf Asynchronous control block structure
00088      * @return Number of bytes written on success. negative number on error.
00089      */
00090     virtual int write(void * const p_data, uint32_t data_size, const rbsp_data_conf_t * const p_data_conf = NULL);
00091 
00092     int write_s(spdif_t * const p_spdif_data, const rbsp_data_conf_t * const p_data_conf = NULL);
00093 
00094     /** Enqueue asynchronous read request
00095      *
00096      * @param p_data Location of the data
00097      * @param data_size Number of bytes to read
00098      * @param p_data_conf Asynchronous control block structure
00099      * @return Number of bytes read on success. negative number on error.
00100      */
00101     virtual int read(void * const p_data, uint32_t data_size, const rbsp_data_conf_t * const p_data_conf = NULL);
00102 
00103     int read_s(spdif_t * const p_spdif_data, const rbsp_data_conf_t * const p_data_conf = NULL);
00104 
00105     /** Headphone out volume control
00106      *
00107      * @param leftVolumeOut Left headphone-out volume
00108      * @param rightVolumeOut Right headphone-out volume
00109      * @return Returns "true" for success, "false" if parameters are out of range
00110      */
00111     virtual bool outputVolume(float leftVolumeOut, float rightVolumeOut);
00112 
00113     /** Microphone volume
00114      *
00115      * @param VolumeIn Microphone volume
00116      * @return Returns "true" for success, "false" if parameters are out of range
00117      */
00118     virtual bool micVolume(float VolumeIn);
00119 
00120 private:
00121     R_BSP_Spdif mSpdif_;
00122     spdif_channel_cfg_t  spdif_cfg;
00123 
00124     /******************************************************************************
00125     Macro definitions
00126     ******************************************************************************/
00127 
00128 };
00129 #endif /* R_BSP_SPDIF_ENABLE */
00130 
00131 #endif