Changeset 4 for trunk/kernel/drivers/soclib/soclib_dma.h
- Timestamp:
- Apr 26, 2017, 2:10:21 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/drivers/soclib/soclib_dma.h
r1 r4 1 1 /* 2 * soclib_dma. c - soclib DMA driver2 * soclib_dma.h - soclib Multi Channels DMA driver definition. 3 3 * 4 * Copyright (c) 2008,2009,2010,2011,2012 Ghassan Almaless 5 * Copyright (c) 2011,2012 UPMC Sorbonne Universites 4 * Author Alain Greiner (2017) 6 5 * 7 * This file is part of ALMOS-kernel.6 * Copyright (c) UPMC Sorbonne Universites 8 7 * 9 * ALMOS-kernel is free software; you can redistribute it and/or modify it 8 * This file is part of ALMOS-MKH. 9 * 10 * ALMOS-MKH is free software; you can redistribute it and/or modify it 10 11 * under the terms of the GNU General Public License as published by 11 12 * the Free Software Foundation; version 2.0 of the License. 12 13 * 13 * ALMOS- kernelis distributed in the hope that it will be useful, but14 * ALMOS-MKH is distributed in the hope that it will be useful, but 14 15 * WITHOUT ANY WARRANTY; without even the implied warranty of 15 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU … … 17 18 * 18 19 * You should have received a copy of the GNU General Public License 19 * along with ALMOS- kernel; if not, write to the Free Software Foundation,20 * along with ALMOS-MKH; if not, write to the Free Software Foundation, 20 21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 21 22 */ … … 24 25 #define _SOCLIB_DMA_H_ 25 26 26 extern struct driver_s soclib_dma_driver; 27 /******************************************************************************************** 28 * This driver supports the SocLib VciBlockDevice component, that is a simgle channel, 29 * block oriented, external storage controler, supporting only one I/O transaction, 30 * at a given time. 31 *******************************************************************************************/ 32 33 /******************************************************************************************** 34 * SOCLIB_DMA registers offset 35 *******************************************************************************************/ 36 37 enum SoclibDmaRegisters 38 { 39 DMA_SRC = 0, /*! source buffer 32 LSB address bits */ 40 DMA_DST = 1, /*! source buffer 32 LSB address bits */ 41 DMA_LEN = 2, /*! number of bytes (on write) / transfer status (on read) */ 42 DMA_RESET = 3, /*! desactivate channel (can be usde to acknowledge IRQ) */ 43 DMA_IRQ_DISABLED = 4, /*! no IRQ generated if non zero */ 44 DMA_SRC_EXT = 5, /*! source buffer 32 MSB address bits */ 45 DMA_DST_EXT = 6, /*! source buffer 32 MSB address bits */ 46 47 DMA_SPAN = 8, /*! number of registers per channel */ 48 }; 49 50 /******************************************************************************************** 51 * SOCLIB_DMA status values 52 *******************************************************************************************/ 53 54 #define DMA_SUCCESS 0 55 #define DMA_IDLE 2 56 #define DMA_ERROR_READ 1 57 #define DMA_ERROR_WRITE 3 58 #define DMA_BUSY 4 // or any value larger than 3 59 60 61 /******************************************************************************************** 62 * This function access the SOCLIB_DMA hardware register to enable interrupts. 63 ******************************************************************************************** 64 * @ chdev : pointer on DMA chdev descriptor. 65 *******************************************************************************************/ 66 extern void soclib_dma_init( chdev_t * chdev ); 67 68 /******************************************************************************************** 69 * This function is called by the server thread associated to the DMA device. 70 * It access the command embedded in the calling thread descriptor, (format defined in the 71 * dev_dma.h file) and access the SOCLIB_DMA hardware registers to start command execution. 72 * Then it blocks on the THREAD_BLOCKED_DEV_ISR and deschedules, because each DMA channel 73 * can only execute one command at a given time. 74 * It is re-activated by the ISR signaling the transfer completion. 75 ******************************************************************************************** 76 * @ thread_xp : extended pointer on the client thread. 77 *******************************************************************************************/ 78 extern void soclib_dma_cmd( xptr_t thread_xp ); 79 80 /******************************************************************************************** 81 * This Interrupt Service Routine is executed when the IRQ signaling the completion of 82 * a DMA command is received by a core. It acknowledge the IRQ by accessing the proper 83 * SOCLIB_DMA register, unblock the client thread, and unblock the server thread that 84 * can starts execution of a new command if the waiting queue is not emppty. 85 ******************************************************************************************** 86 * @ chdev : pointer on DMA chdev descriptor. 87 *******************************************************************************************/ 88 extern void soclib_dma_isr( chdev_t * chdev ); 89 27 90 28 91 #endif /* _SOCLIB_DMA_H_ */
Note: See TracChangeset
for help on using the changeset viewer.