Anh Tran / Mbed OS GR-Boards_WebCamera

Dependencies:   HttpServer_snapshot_mbed-os

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers R_BSP_Ssif.cpp Source File

R_BSP_Ssif.cpp

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 #include "r_bsp_cmn.h"
00025 #include "R_BSP_Ssif.h"
00026 #include "ssif_if.h"
00027 #include "ssif_api.h"
00028 
00029 R_BSP_Ssif::R_BSP_Ssif(PinName sck, PinName ws, PinName tx, PinName rx, PinName audio_clk) : ssif_ch(-1) {
00030     int32_t wk_channel;
00031 
00032     wk_channel = ssif_init(sck, ws, tx, rx, audio_clk);
00033     if (wk_channel != NC) {
00034         ssif_ch      = wk_channel;
00035     }
00036 }
00037 
00038 R_BSP_Ssif::~R_BSP_Ssif() {
00039     // do nothing
00040 }
00041 
00042 void R_BSP_Ssif::init(const ssif_channel_cfg_t* const p_ch_cfg, int32_t max_write_num, int32_t max_read_num) {
00043     if (ssif_ch >= 0) {
00044         init_channel(R_SSIF_MakeCbTbl_mbed(), ssif_ch, (void *)p_ch_cfg, max_write_num, max_read_num);
00045     }
00046 }
00047 
00048 
00049 bool R_BSP_Ssif::ConfigChannel(const ssif_channel_cfg_t* const p_ch_cfg) {
00050     return ioctl(SSIF_CONFIG_CHANNEL, (void *)p_ch_cfg);
00051 }
00052 
00053 bool R_BSP_Ssif::GetStatus(uint32_t* const p_status) {
00054     return ioctl(SSIF_CONFIG_CHANNEL, (void *)p_status);
00055 }