source: trunk/kernel/devices/dev_dma.h @ 647

Last change on this file since 647 was 647, checked in by alain, 4 years ago

...miscelaneous...

File size: 4.5 KB
RevLine 
[3]1/*
2 * dev_dma.h - DMA (Direct Memory Access) generic device API definition.
3 *
[437]4 * Authors   Alain Greiner  (2016,2017,2018)
[3]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 PARTDMALAR 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_DMA_H_
25#define _DEV_DMA_H_
26
[14]27#include <kernel_config.h>
[457]28#include <hal_kernel_types.h>
[3]29
30/*****************************************************************************************
31 *     Generic Multi-channels DMA controller definition
32 *
33 * The DMA device describes a generic, multi-channels DMA controller, that can be used
34 * by the kernel to speedup memory copies. It is an "internal" device, replicated in all
35 * clusters. It can only be configured by a local kernel thread, but it can move data
36 * to/from remote clusters. The burst size is defined by the cache line size.
37 * Each DMA channel is described by a specific chdev descriptor, handling its private
[647]38 * waiting threads queue. It implement one single command : move data from a (remote)
39 * source buffer to a (remote) destination buffer.
[3]40 ****************************************************************************************/
41 
42/****  Forward declarations  ****/
43
44struct chdev_s;
45
46/*****************************************************************************************
47 * This defines the (implementation independant) command passed to the driver.
48 ****************************************************************************************/
49
50typedef struct dma_command_s
51{
52    xptr_t      dev_xp;    /*! extended pointer on the DMA chdev descriptor             */
53    xptr_t      src_xp;    /*! extended pointer on source buffer.                        */
54    xptr_t      dst_xp;    /*! extended pointer on destination buffer.                   */
55    uint32_t    size;      /*! number of bytes to move.                                  */
56    uint32_t    error;     /*! operation status (0 if success)                           */
57}
58dma_command_t;
59
60/*****************************************************************************************
61 * This enum defines the various implementations of the DMA internal interrupt controller.
62 * This array must be kept consistent with the define in arch_info.h file
63 ****************************************************************************************/
64
65enum dma_impl_e
66{
67    IMPL_DMA_SCL =   0,         /* vci_xdma component used in TSAR                      */
68    IMPL_DMA_I86 =   1          /* TBD                                                  */
69}
70dma_impl_t;
71
72/*****************************************************************************************
73 * This function makes two initialisations:
74 * - It initialises the DMA specific fields of the chdev descriptor.
75 * - it initialises the implementation specific DMA hardware device and associated
76 *   data structures if required.
77 * It must be called by a local thread.
78 *****************************************************************************************
79 * @ chdev   : pointer on DMA chdev descriptor.
80 ****************************************************************************************/
81void dev_dma_init( struct chdev_s * chdev );
82
83/*****************************************************************************************
84 * This blocking function register a DMA request in the device queue.
85 * It uses a descheduling policy to wait completion, and return an error status
86 * when the transfer is completed.
87 *****************************************************************************************
88 * @ dst        : extended pointer on destination buffer.
89 * @ src        : extended pointer on Rsource buffer.
90 * @ size       : number of bytes to move.
91 ****************************************************************************************/
92error_t dev_dma_remote_memcpy( xptr_t     dst_xp,
93                               xptr_t     src_xp,
94                               uint32_t   size );   
95
96
97#endif  /* _DEV_DMA_H_ */
Note: See TracBrowser for help on using the repository browser.