Select Git revision
labcomm2014_ioctl.h
-
Anders Blomdell authoredAnders Blomdell authored
labcomm2014_ioctl.h 4.01 KiB
/*
labcomm2014_ioctl.h -- labcomm2014 ioctl declarations
Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>
This file is part of LabComm.
LabComm is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
LabComm is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __LABCOMM2014_IOCTL_H___
#define __LABCOMM2014_IOCTL_H___
#include "labcomm2014.h"
/*
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | | | | | |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | | | | |
* | | | | +- number (8)
* | | | +----------------- type (8)
* | | +------------------------------------------- size (13)
* | +----------------------------------------------- direction (2)
* +------------------------------------------------- signature (1)
*
* type 0-31 are reserved for labcomm2014 library use
*/
#define LABCOMM_IOC_NRBITS 8
#define LABCOMM_IOC_TYPEBITS 8
#define LABCOMM_IOC_SIZEBITS 13
#define LABCOMM_IOC_DIRBITS 2
#define LABCOMM_IOC_SIGBITS 1
#define LABCOMM_IOC_NRMASK ((1 << LABCOMM_IOC_NRBITS)-1)
#define LABCOMM_IOC_TYPEMASK ((1 << LABCOMM_IOC_TYPEBITS)-1)
#define LABCOMM_IOC_SIZEMASK ((1 << LABCOMM_IOC_SIZEBITS)-1)
#define LABCOMM_IOC_DIRMASK ((1 << LABCOMM_IOC_DIRBITS)-1)
#define LABCOMM_IOC_SIGMASK ((1 << LABCOMM_IOC_SIGBITS)-1)
#define LABCOMM_IOC_NRSHIFT 0
#define LABCOMM_IOC_TYPESHIFT (LABCOMM_IOC_NRSHIFT+LABCOMM_IOC_NRBITS)
#define LABCOMM_IOC_SIZESHIFT (LABCOMM_IOC_TYPESHIFT+LABCOMM_IOC_TYPEBITS)
#define LABCOMM_IOC_DIRSHIFT (LABCOMM_IOC_SIZESHIFT+LABCOMM_IOC_SIZEBITS)
#define LABCOMM_IOC_SIGSHIFT (LABCOMM_IOC_DIRSHIFT+LABCOMM_IOC_DIRBITS)
#define LABCOMM_IOC_NOSIG 0U
#define LABCOMM_IOC_USESIG 1U
#define LABCOMM_IOC_NONE 0U
#define LABCOMM_IOC_WRITE 1U
#define LABCOMM_IOC_READ 2U
#define LABCOMM_IOC(signature,dir,type,nr,size) \
(((signature) << LABCOMM_IOC_SIGSHIFT) | \
((dir) << LABCOMM_IOC_DIRSHIFT) | \
((size) << LABCOMM_IOC_SIZESHIFT) | \
((type) << LABCOMM_IOC_TYPESHIFT) | \
((nr) << LABCOMM_IOC_NRSHIFT))