[1] | 1 | /* |
---|
| 2 | * dev_mwr.h - MWR (Multi Fifos DMA Controller) generic device API. |
---|
| 3 | * |
---|
| 4 | * Authors Alain Greiner (2016) |
---|
| 5 | * |
---|
| 6 | * Copyright (c) UPMC Sorbonne Universites |
---|
| 7 | * |
---|
| 8 | * This file is part of ALMOS-MKH. |
---|
| 9 | * |
---|
| 10 | * ALMOS-MKH is free software; you can redistribute it and/or modify it |
---|
| 11 | * under the terms of the GNU General Public License as published by |
---|
| 12 | * the Free Software Foundation; version 2.0 of the License. |
---|
| 13 | * |
---|
| 14 | * ALMOS-MKH is distributed in the hope that it will be useful, but |
---|
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTMWRLAR PURPOSE. See the GNU |
---|
| 17 | * General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with ALMOS-MKH; if not, write to the Free Software Foundation, |
---|
| 21 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 22 | */ |
---|
| 23 | |
---|
| 24 | #ifndef _DEV_MWR_H_ |
---|
| 25 | #define _DEV_MWR_H_ |
---|
| 26 | |
---|
| 27 | #include <almos_config.h> |
---|
| 28 | #include <hal_types.h> |
---|
| 29 | #include <spinlock.h> |
---|
| 30 | |
---|
| 31 | /***************************************************************************************** |
---|
| 32 | * Generic multi-fifos DMA controller for harware coprocessors. |
---|
| 33 | * |
---|
| 34 | ****************************************************************************************/ |
---|
| 35 | |
---|
| 36 | struct device_s; |
---|
| 37 | |
---|
| 38 | /***************************************************************************************** |
---|
| 39 | * This defines the (implementation independant) extension for the generic MWR device. |
---|
| 40 | ****************************************************************************************/ |
---|
| 41 | |
---|
| 42 | typedef struct mwr_extend_s |
---|
| 43 | { |
---|
| 44 | uint32_t to_coproc_nr; /*! actual number of to_coproc FIFOs */ |
---|
| 45 | uint32_t from_coproc_nr; /*! actual number of from coproc FIFOs */ |
---|
| 46 | uint32_t config_nr; /*! actual number of configuration registers */ |
---|
| 47 | uint32_t status_nr; /*! actual number of status registers */ |
---|
| 48 | } |
---|
| 49 | mwr_extend_t; |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | /***************************************************************************************** |
---|
| 53 | * This function initializes the MWR specific fields of the device descriptor. |
---|
| 54 | * It must be executed once in the cluster containing a MWR device descriptor. |
---|
| 55 | ***************************************************************************************** |
---|
| 56 | * @ mwr_xp : extended pointer on MWR device descriptor. |
---|
| 57 | * @ to_coproc_nr : number of to_coproc fifos. |
---|
| 58 | * @ from_coproc_nr : number of from_coproc fifos. |
---|
| 59 | * @ config_nr : number of coprocessor configuration registers. |
---|
| 60 | * # status_nr : number of coprocessor status registers. |
---|
| 61 | ****************************************************************************************/ |
---|
| 62 | void dev_mwr_init( xptr_t mwr_xp, |
---|
| 63 | uint32_t to_coproc_nr, |
---|
| 64 | uint32_t from_coproc_nr, |
---|
| 65 | uint32_t config_nr, |
---|
| 66 | uint32_t status_nr ); |
---|
| 67 | |
---|
| 68 | /***************************************************************************************** |
---|
| 69 | * This function set a value in one coprocessor register. |
---|
| 70 | * It can only be executed by a local thread. |
---|
| 71 | ***************************************************************************************** |
---|
| 72 | * @ cxy : MMC cluster identifier. |
---|
| 73 | * @ index : register index in MMC peripheral. |
---|
| 74 | * @ wdata : value to be written. |
---|
| 75 | ****************************************************************************************/ |
---|
| 76 | void dev_mwr_set_coproc_register( cxy_t cxy, |
---|
| 77 | uint32_t index, |
---|
| 78 | uint32_t wdata ); |
---|
| 79 | |
---|
| 80 | /***************************************************************************************** |
---|
| 81 | * This function returns the value contained in one coprocessor register. |
---|
| 82 | * It can only be executed by a local thread. |
---|
| 83 | ***************************************************************************************** |
---|
| 84 | * @ cxy : MMC cluster identifier. |
---|
| 85 | * @ index : error register index in MMC peripheral. |
---|
| 86 | * @ rdata : local pointer on buffer for returned value. |
---|
| 87 | ****************************************************************************************/ |
---|
| 88 | void dev_mmc_get_coproc_register( cxy_t cxy, |
---|
| 89 | uint32_t index, |
---|
| 90 | uint32_t * rdata ); |
---|
| 91 | |
---|
| 92 | /***************************************************************************************** |
---|
| 93 | * This function set a value in one channel register. |
---|
| 94 | * It can only be executed by a local thread. |
---|
| 95 | ***************************************************************************************** |
---|
| 96 | * @ cxy : MMC cluster identifier. |
---|
| 97 | * @ index : register index in MMC peripheral. |
---|
| 98 | * @ wdata : value to be written. |
---|
| 99 | ****************************************************************************************/ |
---|
| 100 | void dev_mwr_set_channel_register( cxy_t cxy, |
---|
| 101 | uint32_t channel, |
---|
| 102 | uint32_t index, |
---|
| 103 | uint32_t wdata ); |
---|
| 104 | |
---|
| 105 | /***************************************************************************************** |
---|
| 106 | * This function returns the value contained in one channel register. |
---|
| 107 | * It can only be executed by a local thread. |
---|
| 108 | ***************************************************************************************** |
---|
| 109 | * @ cxy : MMC cluster identifier. |
---|
| 110 | * @ index : error register index in MMC peripheral. |
---|
| 111 | * @ rdata : local pointer on buffer for returned value. |
---|
| 112 | ****************************************************************************************/ |
---|
| 113 | void dev_mmc_get_channel_register( cxy_t cxy, |
---|
| 114 | uint32_t channel, |
---|
| 115 | uint32_t index, |
---|
| 116 | uint32_t * rdata ); |
---|
| 117 | |
---|
| 118 | |
---|
| 119 | |
---|
| 120 | #endif /* _DEV_MWR_H_ */ |
---|