xref: /freebsd/sys/dev/altera/softdma/a_api.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
18f89e7dbSRuslan Bukin /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
38f89e7dbSRuslan Bukin  *
48f89e7dbSRuslan Bukin  * Copyright (c) 2012 Bjoern A. Zeeb
58f89e7dbSRuslan Bukin  * All rights reserved.
68f89e7dbSRuslan Bukin  *
78f89e7dbSRuslan Bukin  * This software was developed by SRI International and the University of
88f89e7dbSRuslan Bukin  * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-11-C-0249)
98f89e7dbSRuslan Bukin  * ("MRC2"), as part of the DARPA MRC research programme.
108f89e7dbSRuslan Bukin  *
118f89e7dbSRuslan Bukin  * Redistribution and use in source and binary forms, with or without
128f89e7dbSRuslan Bukin  * modification, are permitted provided that the following conditions
138f89e7dbSRuslan Bukin  * are met:
148f89e7dbSRuslan Bukin  * 1. Redistributions of source code must retain the above copyright
158f89e7dbSRuslan Bukin  *    notice, this list of conditions and the following disclaimer.
168f89e7dbSRuslan Bukin  * 2. Redistributions in binary form must reproduce the above copyright
178f89e7dbSRuslan Bukin  *    notice, this list of conditions and the following disclaimer in the
188f89e7dbSRuslan Bukin  *    documentation and/or other materials provided with the distribution.
198f89e7dbSRuslan Bukin  *
208f89e7dbSRuslan Bukin  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
218f89e7dbSRuslan Bukin  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
228f89e7dbSRuslan Bukin  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
238f89e7dbSRuslan Bukin  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
248f89e7dbSRuslan Bukin  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
258f89e7dbSRuslan Bukin  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
268f89e7dbSRuslan Bukin  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
278f89e7dbSRuslan Bukin  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
288f89e7dbSRuslan Bukin  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
298f89e7dbSRuslan Bukin  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
308f89e7dbSRuslan Bukin  * SUCH DAMAGE.
318f89e7dbSRuslan Bukin  */
328f89e7dbSRuslan Bukin /*
338f89e7dbSRuslan Bukin  * Altera, Embedded Peripherals IP, User Guide, v. 11.0, June 2011.
348f89e7dbSRuslan Bukin  * UG-01085-11.0.
358f89e7dbSRuslan Bukin  */
368f89e7dbSRuslan Bukin 
378f89e7dbSRuslan Bukin #ifndef _A_API_H
388f89e7dbSRuslan Bukin #define _A_API_H
398f89e7dbSRuslan Bukin 
408f89e7dbSRuslan Bukin /* Table 16-1. Memory Map. */
418f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_DATA		0x00
428f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_METADATA		0x04
438f89e7dbSRuslan Bukin 
448f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_SOP		(1<<0)
458f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_EOP		(1<<1)
468f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_EMPTY_MASK	0x000000f7
478f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_EMPTY_SHIFT	2
488f89e7dbSRuslan Bukin 	/* Reserved				(1<<7)	   */
498f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_CHANNEL_MASK	0x0000ff00
508f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_CHANNEL_SHIFT	8
518f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_ERROR_MASK	0x00ff0000
528f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_ERROR_SHIFT	16
538f89e7dbSRuslan Bukin 	/* Reserved				0xff000000 */
548f89e7dbSRuslan Bukin 
558f89e7dbSRuslan Bukin /* Table 16-3. FIFO Status Register Memory Map. */
568f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_FILL_LEVEL	0x00
578f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_I_STATUS	0x04
588f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_EVENT		0x08
598f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_INT_ENABLE	0x0c
608f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_ALMOSTFULL	0x10
618f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_ALMOSTEMPTY	0x14
628f89e7dbSRuslan Bukin 
638f89e7dbSRuslan Bukin /* Table 16-5. Status Bit Field Descriptions. */
648f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_STATUS_FULL		(1<<0)
658f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_STATUS_EMPTY		(1<<1)
668f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_STATUS_ALMOSTFULL	(1<<2)
678f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_STATUS_ALMOSTEMPTY	(1<<3)
688f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_STATUS_OVERFLOW		(1<<4)
698f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_STATUS_UNDERFLOW		(1<<5)
708f89e7dbSRuslan Bukin 
718f89e7dbSRuslan Bukin /* Table 16-6. Event Bit Field Descriptions. */
728f89e7dbSRuslan Bukin /* XXX Datasheet has incorrect bit fields. Validate. */
738f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_EVENT_FULL		(1<<0)
748f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_EVENT_EMPTY		(1<<1)
758f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_EVENT_ALMOSTFULL		(1<<2)
768f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_EVENT_ALMOSTEMPTY	(1<<3)
778f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_EVENT_OVERFLOW		(1<<4)
788f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_EVENT_UNDERFLOW		(1<<5)
798f89e7dbSRuslan Bukin 
808f89e7dbSRuslan Bukin /* Table 16-7. InterruptEnable Bit Field Descriptions. */
818f89e7dbSRuslan Bukin /* XXX Datasheet has incorrect bit fields. Validate. */
828f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_INTR_FULL		(1<<0)
838f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_INTR_EMPTY		(1<<1)
848f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_INTR_ALMOSTFULL		(1<<2)
858f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_INTR_ALMOSTEMPTY		(1<<3)
868f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_INTR_OVERFLOW		(1<<4)
878f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_INTR_UNDERFLOW		(1<<5)
888f89e7dbSRuslan Bukin #define	A_ONCHIP_FIFO_MEM_CORE_INTR_ALL			\
898f89e7dbSRuslan Bukin 	    (A_ONCHIP_FIFO_MEM_CORE_INTR_EMPTY|		\
908f89e7dbSRuslan Bukin 	    A_ONCHIP_FIFO_MEM_CORE_INTR_FULL|		\
918f89e7dbSRuslan Bukin 	    A_ONCHIP_FIFO_MEM_CORE_INTR_ALMOSTEMPTY|	\
928f89e7dbSRuslan Bukin 	    A_ONCHIP_FIFO_MEM_CORE_INTR_ALMOSTFULL|	\
938f89e7dbSRuslan Bukin 	    A_ONCHIP_FIFO_MEM_CORE_INTR_OVERFLOW|	\
948f89e7dbSRuslan Bukin 	    A_ONCHIP_FIFO_MEM_CORE_INTR_UNDERFLOW)
958f89e7dbSRuslan Bukin 
968f89e7dbSRuslan Bukin #endif /* _A_API_H */
978f89e7dbSRuslan Bukin 
988f89e7dbSRuslan Bukin /* end */
99