test public

Dependencies:   HttpServer_snapshot_mbed-os

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers spdif_api.c Source File

spdif_api.c

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 #if defined(TARGET_RZ_A2XX)
00025 
00026 #include "spdif_api.h"
00027 
00028 static const PinMap PinMap_SPDIF_AUDIO_CLK[] = {
00029     {P6_4,  0,      4},
00030     {PH_0,  0,      1},
00031     {NC,    NC,     0}
00032 };
00033 
00034 static const PinMap PinMap_SPDIF_TX[] = {
00035     {PJ_0,  0,      2},
00036     {PC_5,  0,      4},
00037     {NC,    NC,     0}
00038 };
00039 
00040 static const PinMap PinMap_SPDIF_RX[] = {
00041     {PJ_1,  0,      2},
00042     {PC_4,  0,      4},
00043     {NC,    NC,     0}
00044 };
00045 
00046 int32_t spdif_init(PinName audio_clk, PinName tx, PinName rx) {
00047     /* determine the ssif to use */
00048     uint32_t spdif_clk = pinmap_peripheral(audio_clk, PinMap_SPDIF_AUDIO_CLK);
00049     uint32_t spdif_tx  = pinmap_peripheral(tx, PinMap_SPDIF_TX);
00050     uint32_t spdif_rx  = pinmap_peripheral(rx, PinMap_SPDIF_RX);
00051     uint32_t spdif_ch  = pinmap_merge(spdif_tx, spdif_rx);
00052 
00053     if ((int32_t)spdif_clk != NC) {
00054         pinmap_pinout(audio_clk, PinMap_SPDIF_AUDIO_CLK);
00055     }
00056 
00057     if ((int32_t)spdif_tx != NC) {
00058         pinmap_pinout(tx, PinMap_SPDIF_TX);
00059     }
00060 
00061     if ((int32_t)spdif_rx != NC) {
00062         pinmap_pinout(rx, PinMap_SPDIF_RX);
00063     }
00064 
00065     return (int32_t)spdif_ch;
00066 }
00067 
00068 #endif /* TARGET_RZ_A2XX */