RZ/A1H CMSIS-RTOS RTX BSP for GR-PEACH.

Dependents:   GR-PEACH_Azure_Speech ImageZoomInout_Sample ImageRotaion_Sample ImageScroll_Sample ... more

Fork of R_BSP by Daiki Kato

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers r_bsp_cmn.c Source File

r_bsp_cmn.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) 2015 Renesas Electronics Corporation. All rights reserved.
00022 *******************************************************************************/
00023 
00024 #include <stdio.h>
00025 #include "dma_if.h"
00026 
00027 
00028 static bool_t dma_init_end = false;
00029 static dma_drv_init_t dma_init_param;
00030 void userdef_dma_error_callback(union sigval signo);
00031 static AIOCB dma_err_aio;
00032 
00033 int32_t R_BSP_CMN_Init(void) {
00034     int32_t retval = ESUCCESS;
00035 
00036     if (dma_init_end == false) {
00037         dma_init_end = true;
00038         /***********************************************************************/
00039         /* Initialise DMA */
00040         /***********************************************************************/
00041 
00042         dma_init_param.channel[DMA_CH_0] = true;
00043         dma_init_param.channel[DMA_CH_1] = true;
00044         dma_init_param.channel[DMA_CH_2] = true;
00045         dma_init_param.channel[DMA_CH_3] = true;
00046         dma_init_param.channel[DMA_CH_4] = true;
00047         dma_init_param.channel[DMA_CH_5] = true;
00048         dma_init_param.channel[DMA_CH_6] = true;
00049         dma_init_param.channel[DMA_CH_7] = true;
00050         dma_init_param.channel[DMA_CH_8] = true;
00051         dma_init_param.channel[DMA_CH_9] = true;
00052         dma_init_param.channel[DMA_CH_10] = true;
00053         dma_init_param.channel[DMA_CH_11] = true;
00054         dma_init_param.channel[DMA_CH_12] = true;
00055         dma_init_param.channel[DMA_CH_13] = true;
00056         dma_init_param.channel[DMA_CH_14] = true;
00057         dma_init_param.channel[DMA_CH_15] = true;
00058 
00059         dma_err_aio.aio_sigevent.sigev_notify = SIGEV_THREAD;
00060         dma_err_aio.aio_sigevent.sigev_notify_function = &userdef_dma_error_callback;
00061         dma_init_param.p_aio = &dma_err_aio;
00062 
00063         retval = R_DMA_Init(&dma_init_param, NULL);
00064         if (retval != ESUCCESS) {
00065             dma_init_end = false;
00066         }
00067     }
00068 
00069     return retval;
00070 }
00071 
00072 /**************************************************************************//**
00073 * Function Name: userdef_dma_error_callback
00074 * @brief         DMA driver : error callback function
00075 *
00076 *                Description:<br>
00077 *                DMA error interrupt callback function
00078 * @param[in]     signo.sival_int : bitmap of error channel(bit0=ch0)
00079 * @retval        none
00080 ******************************************************************************/
00081 void userdef_dma_error_callback(union sigval signo) {
00082     printf("DMAERR MAP:0x%02x\n", signo.sival_int);
00083 }
00084