Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:46

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /*
0004  * RTEMS generic mcf548x BSP
0005  *
0006  * This file declares glue functions to the Freescale Mcdma API.
0007  */
0008 
0009 /*
0010  * Copyright (C) 2004, 2009 embedded brains GmbH & Co. KG
0011  *
0012  * Redistribution and use in source and binary forms, with or without
0013  * modification, are permitted provided that the following conditions
0014  * are met:
0015  * 1. Redistributions of source code must retain the above copyright
0016  *    notice, this list of conditions and the following disclaimer.
0017  * 2. Redistributions in binary form must reproduce the above copyright
0018  *    notice, this list of conditions and the following disclaimer in the
0019  *    documentation and/or other materials provided with the distribution.
0020  *
0021  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0022  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0023  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0024  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0025  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0026  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0027  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0028  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0029  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0030  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0031  * POSSIBILITY OF SUCH DAMAGE.
0032  */
0033 
0034 #ifndef _MCDMA_GLUE_H
0035 #define _MCDMA_GLUE_H
0036 
0037 #include <rtems.h>
0038 #include <rtems/irq.h>
0039 #include <mcf548x/mcf548x.h>
0040 
0041 #define MCDMA_CLR_PENDING(chan) (MCF548X_DMA_DIPR = (1 << (chan)))
0042 #define MCDMA_GET_PENDING(chan) (MCF548X_DMA_DIPR & (1 << (chan)))
0043 
0044 /*=========================================================================*\
0045 | Function:                                                                 |
0046 \*-------------------------------------------------------------------------*/
0047 void mcdma_glue_irq_enable
0048 (
0049 /*-------------------------------------------------------------------------*\
0050 | Purpose:                                                                  |
0051 |   enable interrupt for given task number                                  |
0052 +---------------------------------------------------------------------------+
0053 | Input Parameters:                                                         |
0054 \*-------------------------------------------------------------------------*/
0055  int mcdma_taskno                           /* task number to enable    */
0056  );
0057 /*-------------------------------------------------------------------------*\
0058 | Return Value:                                                             |
0059 |    none                                                                   |
0060 \*=========================================================================*/
0061 
0062 /*=========================================================================*\
0063 | Function:                                                                 |
0064 \*-------------------------------------------------------------------------*/
0065 void mcdma_glue_irq_disable
0066 (
0067 /*-------------------------------------------------------------------------*\
0068 | Purpose:                                                                  |
0069 |   disable interrupt for given task number                                 |
0070 +---------------------------------------------------------------------------+
0071 | Input Parameters:                                                         |
0072 \*-------------------------------------------------------------------------*/
0073  int mcdma_taskno                           /* task number to disable   */
0074  );
0075 /*-------------------------------------------------------------------------*\
0076 | Return Value:                                                             |
0077 |    none                                                                   |
0078 \*=========================================================================*/
0079 
0080 /*=========================================================================*\
0081 | Function:                                                                 |
0082 \*-------------------------------------------------------------------------*/
0083 void mcdma_glue_irq_install
0084 (
0085 /*-------------------------------------------------------------------------*\
0086 | Purpose:                                                                  |
0087 |   install given function as mcdma interrupt handler                    |
0088 +---------------------------------------------------------------------------+
0089 | Input Parameters:                                                         |
0090 \*-------------------------------------------------------------------------*/
0091  int mcdma_taskno,                          /* task number for handler  */
0092  void (*the_handler)(rtems_irq_hdl_param),     /* function to call         */
0093  void *the_param
0094  );
0095 /*-------------------------------------------------------------------------*\
0096 | Return Value:                                                             |
0097 |    none                                                                   |
0098 \*=========================================================================*/
0099 
0100 /*=========================================================================*\
0101 | Function:                                                                 |
0102 \*-------------------------------------------------------------------------*/
0103 void mcdma_glue_init
0104 (
0105 /*-------------------------------------------------------------------------*\
0106 | Purpose:                                                                  |
0107 |   initialize the mcdma module (if not yet done):                          |
0108 |   - load code                                                             |
0109 |   - initialize registers                                                  |
0110 |   - initialize bus arbiter                                                |
0111 |   - initialize interrupt control                                          |
0112 +---------------------------------------------------------------------------+
0113 | Input Parameters:                                                         |
0114 \*-------------------------------------------------------------------------*/
0115  void *sram_base         /* base address for SRAM, to be used for DMA task */
0116  );
0117 /*-------------------------------------------------------------------------*\
0118 | Return Value:                                                             |
0119 |    none                                                                   |
0120 \*=========================================================================*/
0121 
0122 #endif /* _MCDMA_GLUE_H */