[62f31d05] | 1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
| 2 | |
---|
[98e43e83] | 3 | /* |
---|
| 4 | * RTEMS generic mcf548x BSP |
---|
| 5 | * |
---|
| 6 | * This file declares glue functions to the Freescale Mcdma API. |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | /* |
---|
[bcef89f2] | 10 | * Copyright (C) 2004, 2009 embedded brains GmbH & Co. KG |
---|
[98e43e83] | 11 | * |
---|
[62f31d05] | 12 | * Redistribution and use in source and binary forms, with or without |
---|
| 13 | * modification, are permitted provided that the following conditions |
---|
| 14 | * are met: |
---|
| 15 | * 1. Redistributions of source code must retain the above copyright |
---|
| 16 | * notice, this list of conditions and the following disclaimer. |
---|
| 17 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
| 18 | * notice, this list of conditions and the following disclaimer in the |
---|
| 19 | * documentation and/or other materials provided with the distribution. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
| 25 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
| 31 | * POSSIBILITY OF SUCH DAMAGE. |
---|
[98e43e83] | 32 | */ |
---|
| 33 | |
---|
[6229b2a7] | 34 | #ifndef _MCDMA_GLUE_H |
---|
| 35 | #define _MCDMA_GLUE_H |
---|
| 36 | |
---|
| 37 | #include <rtems.h> |
---|
[4d22b554] | 38 | #include <rtems/irq.h> |
---|
[6229b2a7] | 39 | #include <mcf548x/mcf548x.h> |
---|
| 40 | |
---|
| 41 | #define MCDMA_CLR_PENDING(chan) (MCF548X_DMA_DIPR = (1 << (chan))) |
---|
| 42 | #define MCDMA_GET_PENDING(chan) (MCF548X_DMA_DIPR & (1 << (chan))) |
---|
| 43 | |
---|
| 44 | /*=========================================================================*\ |
---|
| 45 | | Function: | |
---|
| 46 | \*-------------------------------------------------------------------------*/ |
---|
| 47 | void mcdma_glue_irq_enable |
---|
| 48 | ( |
---|
| 49 | /*-------------------------------------------------------------------------*\ |
---|
| 50 | | Purpose: | |
---|
| 51 | | enable interrupt for given task number | |
---|
| 52 | +---------------------------------------------------------------------------+ |
---|
| 53 | | Input Parameters: | |
---|
| 54 | \*-------------------------------------------------------------------------*/ |
---|
| 55 | int mcdma_taskno /* task number to enable */ |
---|
| 56 | ); |
---|
| 57 | /*-------------------------------------------------------------------------*\ |
---|
| 58 | | Return Value: | |
---|
| 59 | | none | |
---|
| 60 | \*=========================================================================*/ |
---|
| 61 | |
---|
| 62 | /*=========================================================================*\ |
---|
| 63 | | Function: | |
---|
| 64 | \*-------------------------------------------------------------------------*/ |
---|
| 65 | void mcdma_glue_irq_disable |
---|
| 66 | ( |
---|
| 67 | /*-------------------------------------------------------------------------*\ |
---|
| 68 | | Purpose: | |
---|
| 69 | | disable interrupt for given task number | |
---|
| 70 | +---------------------------------------------------------------------------+ |
---|
| 71 | | Input Parameters: | |
---|
| 72 | \*-------------------------------------------------------------------------*/ |
---|
| 73 | int mcdma_taskno /* task number to disable */ |
---|
| 74 | ); |
---|
| 75 | /*-------------------------------------------------------------------------*\ |
---|
| 76 | | Return Value: | |
---|
| 77 | | none | |
---|
| 78 | \*=========================================================================*/ |
---|
| 79 | |
---|
| 80 | /*=========================================================================*\ |
---|
| 81 | | Function: | |
---|
| 82 | \*-------------------------------------------------------------------------*/ |
---|
| 83 | void mcdma_glue_irq_install |
---|
| 84 | ( |
---|
| 85 | /*-------------------------------------------------------------------------*\ |
---|
| 86 | | Purpose: | |
---|
| 87 | | install given function as mcdma interrupt handler | |
---|
| 88 | +---------------------------------------------------------------------------+ |
---|
| 89 | | Input Parameters: | |
---|
| 90 | \*-------------------------------------------------------------------------*/ |
---|
| 91 | int mcdma_taskno, /* task number for handler */ |
---|
| 92 | void (*the_handler)(rtems_irq_hdl_param), /* function to call */ |
---|
| 93 | void *the_param |
---|
| 94 | ); |
---|
| 95 | /*-------------------------------------------------------------------------*\ |
---|
| 96 | | Return Value: | |
---|
| 97 | | none | |
---|
| 98 | \*=========================================================================*/ |
---|
| 99 | |
---|
| 100 | /*=========================================================================*\ |
---|
| 101 | | Function: | |
---|
| 102 | \*-------------------------------------------------------------------------*/ |
---|
| 103 | void mcdma_glue_init |
---|
| 104 | ( |
---|
| 105 | /*-------------------------------------------------------------------------*\ |
---|
| 106 | | Purpose: | |
---|
| 107 | | initialize the mcdma module (if not yet done): | |
---|
| 108 | | - load code | |
---|
| 109 | | - initialize registers | |
---|
| 110 | | - initialize bus arbiter | |
---|
| 111 | | - initialize interrupt control | |
---|
| 112 | +---------------------------------------------------------------------------+ |
---|
| 113 | | Input Parameters: | |
---|
| 114 | \*-------------------------------------------------------------------------*/ |
---|
| 115 | void *sram_base /* base address for SRAM, to be used for DMA task */ |
---|
| 116 | ); |
---|
| 117 | /*-------------------------------------------------------------------------*\ |
---|
| 118 | | Return Value: | |
---|
| 119 | | none | |
---|
| 120 | \*=========================================================================*/ |
---|
| 121 | |
---|
| 122 | #endif /* _MCDMA_GLUE_H */ |
---|