18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/* $Id: cosa.h,v 1.6 1999/01/06 14:02:44 kas Exp $ */
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci/*
58c2ecf20Sopenharmony_ci *  Copyright (C) 1995-1997  Jan "Yenya" Kasprzak <kas@fi.muni.cz>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef COSA_H__
98c2ecf20Sopenharmony_ci#define COSA_H__
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/ioctl.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#ifdef __KERNEL__
148c2ecf20Sopenharmony_ci/* status register - output bits */
158c2ecf20Sopenharmony_ci#define SR_RX_DMA_ENA   0x04    /* receiver DMA enable bit */
168c2ecf20Sopenharmony_ci#define SR_TX_DMA_ENA   0x08    /* transmitter DMA enable bit */
178c2ecf20Sopenharmony_ci#define SR_RST          0x10    /* SRP reset */
188c2ecf20Sopenharmony_ci#define SR_USR_INT_ENA  0x20    /* user interrupt enable bit */
198c2ecf20Sopenharmony_ci#define SR_TX_INT_ENA   0x40    /* transmitter interrupt enable bit */
208c2ecf20Sopenharmony_ci#define SR_RX_INT_ENA   0x80    /* receiver interrupt enable bit */
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/* status register - input bits */
238c2ecf20Sopenharmony_ci#define SR_USR_RQ       0x20    /* user interrupt request pending */
248c2ecf20Sopenharmony_ci#define SR_TX_RDY       0x40    /* transmitter empty (ready) */
258c2ecf20Sopenharmony_ci#define SR_RX_RDY       0x80    /* receiver data ready */
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#define SR_UP_REQUEST   0x02    /* request from SRP to transfer data
288c2ecf20Sopenharmony_ci                                   up to PC */
298c2ecf20Sopenharmony_ci#define SR_DOWN_REQUEST 0x01    /* SRP is able to transfer data down
308c2ecf20Sopenharmony_ci                                   from PC to SRP */
318c2ecf20Sopenharmony_ci#define SR_END_OF_TRANSFER      0x03    /* SRP signalize end of
328c2ecf20Sopenharmony_ci                                           transfer (up or down) */
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define SR_CMD_FROM_SRP_MASK    0x03    /* mask to get SRP command */
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* bits in driver status byte definitions : */
378c2ecf20Sopenharmony_ci#define SR_RDY_RCV      0x01    /* ready to receive packet */
388c2ecf20Sopenharmony_ci#define SR_RDY_SND      0x02    /* ready to send packet */
398c2ecf20Sopenharmony_ci#define SR_CMD_PND      0x04    /* command pending */ /* not currently used */
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* ???? */
428c2ecf20Sopenharmony_ci#define SR_PKT_UP       0x01    /* transfer of packet up in progress */
438c2ecf20Sopenharmony_ci#define SR_PKT_DOWN     0x02    /* transfer of packet down in progress */
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci#define SR_LOAD_ADDR    0x4400  /* SRP microcode load address */
488c2ecf20Sopenharmony_ci#define SR_START_ADDR   0x4400  /* SRP microcode start address */
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#define COSA_LOAD_ADDR    0x400  /* SRP microcode load address */
518c2ecf20Sopenharmony_ci#define COSA_MAX_FIRMWARE_SIZE	0x10000
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci/* ioctls */
548c2ecf20Sopenharmony_cistruct cosa_download {
558c2ecf20Sopenharmony_ci	int addr, len;
568c2ecf20Sopenharmony_ci	char __user *code;
578c2ecf20Sopenharmony_ci};
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci/* Reset the device */
608c2ecf20Sopenharmony_ci#define COSAIORSET	_IO('C',0xf0)
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci/* Start microcode at given address */
638c2ecf20Sopenharmony_ci#define COSAIOSTRT	_IOW('C',0xf1, int)
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci/* Read the block from the device memory */
668c2ecf20Sopenharmony_ci#define COSAIORMEM	_IOWR('C',0xf2, struct cosa_download *)
678c2ecf20Sopenharmony_ci	/* actually the struct cosa_download itself; this is to keep
688c2ecf20Sopenharmony_ci	 * the ioctl number same as in 2.4 in order to keep the user-space
698c2ecf20Sopenharmony_ci	 * utils compatible. */
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci/* Write the block to the device memory (i.e. download the microcode) */
728c2ecf20Sopenharmony_ci#define COSAIODOWNLD	_IOW('C',0xf2, struct cosa_download *)
738c2ecf20Sopenharmony_ci	/* actually the struct cosa_download itself; this is to keep
748c2ecf20Sopenharmony_ci	 * the ioctl number same as in 2.4 in order to keep the user-space
758c2ecf20Sopenharmony_ci	 * utils compatible. */
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci/* Read the device type (one of "srp", "cosa", and "cosa8" for now) */
788c2ecf20Sopenharmony_ci#define COSAIORTYPE	_IOR('C',0xf3, char *)
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci/* Read the device identification string */
818c2ecf20Sopenharmony_ci#define COSAIORIDSTR	_IOR('C',0xf4, char *)
828c2ecf20Sopenharmony_ci/* Maximum length of the identification string. */
838c2ecf20Sopenharmony_ci#define COSA_MAX_ID_STRING 128
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci/* Increment/decrement the module usage count :-) */
868c2ecf20Sopenharmony_ci/* #define COSAIOMINC	_IO('C',0xf5) */
878c2ecf20Sopenharmony_ci/* #define COSAIOMDEC	_IO('C',0xf6) */
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci/* Get the total number of cards installed */
908c2ecf20Sopenharmony_ci#define COSAIONRCARDS	_IO('C',0xf7)
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci/* Get the number of channels on this card */
938c2ecf20Sopenharmony_ci#define COSAIONRCHANS	_IO('C',0xf8)
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci/* Set the driver for the bus-master operations */
968c2ecf20Sopenharmony_ci#define COSAIOBMSET	_IOW('C', 0xf9, unsigned short)
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#define COSA_BM_OFF	0	/* Bus-mastering off - use ISA DMA (default) */
998c2ecf20Sopenharmony_ci#define COSA_BM_ON	1	/* Bus-mastering on - faster but untested */
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci/* Gets the busmaster status */
1028c2ecf20Sopenharmony_ci#define COSAIOBMGET	_IO('C', 0xfa)
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci#endif /* !COSA_H__ */
105