Functions for Getting Arguments in Signature functions

Defines

#define os_dev_is_flag_read()   (file_p_->f_mode & FMODE_READ)
#define os_dev_is_flag_write()   (file_p_->f_mode & FMODE_WRITE)
#define os_dev_is_flag_nonblock()   (file_p_->f_flags & (O_NONBLOCK | O_NDELAY))
#define os_dev_get_major()   (imajor(inode_p_))
#define os_dev_get_minor()   (iminor(inode_p_))
#define os_dev_get_ioctl_op()   (cmd_)
#define os_dev_get_ioctl_arg()   (data_)
#define os_dev_get_count()   ((unsigned)count_bytes_)
#define os_dev_get_user_buffer()   ((void*)user_buffer_)
#define os_dev_get_file_flags()   (file_p_->f_flags)
#define os_dev_set_user_private(struct_p)   file_p_->private_data = (void*)(struct_p)
#define os_dev_get_user_private()   ((void*)file_p_->private_data)
#define os_dev_get_irq()   N1_

Functions

int os_dev_is_flag_read (void)
int os_dev_is_flag_write (void)
int os_dev_is_flag_nonblock (void)
int os_dev_get_major (void)
int os_dev_get_minor (void)
unsigned os_dev_get_ioctl_op (void)
os_dev_ioctl_arg_t os_dev_get_ioctl_arg (void)
unsigned os_dev_get_count (void)
void * os_dev_get_user_buffer (void)
unsigned os_dev_get_file_flags (void)
void os_dev_set_user_private (void *struct_p)
void * os_dev_get_user_private (void)
int os_dev_get_irq (void)

Define Documentation

#define os_dev_get_count ( void   )     ((unsigned)count_bytes_)

Used in OS_DEV_READ() and OS_DEV_WRITE() routines to access the requested byte count.

Returns:
(unsigned) a count of bytes
#define os_dev_get_file_flags ( void   )     (file_p_->f_flags)

Used in OS_DEV_READ(), OS_DEV_WRITE(), and OS_DEV_IOCTL() routines to get the POSIX flags field for the associated open file).

Returns:
The flags associated with the file.
#define os_dev_get_ioctl_arg ( void   )     (data_)

Used in OS_DEV_IOCTL() to return the associated argument for the desired operation.

Returns:
A value which can be cast to a struct pointer or used as int/long.

Referenced by OS_DEV_IOCTL().

#define os_dev_get_ioctl_op ( void   )     (cmd_)

Used in OS_DEV_IOCTL() to determine which operation the user wants performed.

Returns:
Value of the operation.

Referenced by OS_DEV_IOCTL().

#define os_dev_get_irq ( void   )     N1_

Get the IRQ associated with this call to the OS_DEV_ISR() function.

Returns:
The IRQ (integer) interrupt number.

Referenced by OS_DEV_ISR().

#define os_dev_get_major ( void   )     (imajor(inode_p_))

Used in OS_DEV_OPEN() and OS_DEV_CLOSE() to determine major device being accessed.

#define os_dev_get_minor ( void   )     (iminor(inode_p_))

Used in OS_DEV_OPEN() and OS_DEV_CLOSE() to determine minor device being accessed.

#define os_dev_get_user_buffer ( void   )     ((void*)user_buffer_)

Used in OS_DEV_READ() and OS_DEV_WRITE() routines to return the pointer byte count.

Returns:
char* pointer to user buffer
#define os_dev_get_user_private ( void   )     ((void*)file_p_->private_data)

Get the driver's private structure associated with this file.

May be used during OS_DEV_OPEN(), OS_DEV_READ(), OS_DEV_WRITE(), OS_DEV_IOCTL(), and OS_DEV_CLOSE(). See os_dev_set_user_private().

Returns:
The driver data structure to associate with this user.

Referenced by OS_DEV_CLOSE(), OS_DEV_IOCTL(), and OS_DEV_MMAP().

#define os_dev_is_flag_nonblock ( void   )     (file_p_->f_flags & (O_NONBLOCK | O_NDELAY))

Used in OS_DEV_OPEN(), OS_DEV_CLOSE(), OS_DEV_IOCTL(), OS_DEV_READ() and OS_DEV_WRITE() routines to check whether user is requesting non-blocking I/O.

#define os_dev_is_flag_read ( void   )     (file_p_->f_mode & FMODE_READ)

Used in OS_DEV_OPEN(), OS_DEV_CLOSE(), OS_DEV_IOCTL(), OS_DEV_READ() and OS_DEV_WRITE() routines to check whether user is requesting read (permission)

#define os_dev_is_flag_write ( void   )     (file_p_->f_mode & FMODE_WRITE)

Used in OS_DEV_OPEN(), OS_DEV_CLOSE(), OS_DEV_IOCTL(), OS_DEV_READ() and OS_DEV_WRITE() routines to check whether user is requesting write (permission)

#define os_dev_set_user_private ( struct_p   )     file_p_->private_data = (void*)(struct_p)

Set the driver's private structure associated with this file/open.

Generally used during OS_DEV_OPEN(). See os_dev_get_user_private().

Parameters:
struct_p The driver data structure to associate with this user.

Referenced by OS_DEV_CLOSE(), OS_DEV_IOCTL(), OS_DEV_MMAP(), and OS_DEV_OPEN().


Function Documentation

unsigned os_dev_get_count ( void   ) 

Determine the requested byte count. This should be the size of buffer at os_dev_get_user_buffer(). Usable in OS_DEV_READ() and OS_DEV_WRITE() routines.

Returns:
A count of bytes
unsigned os_dev_get_file_flags ( void   ) 

Get the POSIX flags field for the associated open file. Usable in OS_DEV_READ(), OS_DEV_WRITE(), and OS_DEV_IOCTL() routines.

Returns:
The flags associated with the file.
os_dev_ioctl_arg_t os_dev_get_ioctl_arg ( void   ) 

Retrieve the associated argument for the desired operation. Usable in OS_DEV_IOCTL().

Returns:
A value which can be cast to a struct pointer or used as int/long.
unsigned os_dev_get_ioctl_op ( void   ) 

Determine which operation the user wants performed. Usable in OS_DEV_IOCTL().

Returns:
Value of the operation.
int os_dev_get_irq ( void   ) 

Get the IRQ associated with this call to the OS_DEV_ISR() function.

Returns:
The IRQ (integer) interrupt number.
int os_dev_get_major ( void   ) 

Determine which major device is being accessed. Usable in OS_DEV_OPEN() and OS_DEV_CLOSE().

int os_dev_get_minor ( void   ) 

Determine which minor device is being accessed. Usable in OS_DEV_OPEN() and OS_DEV_CLOSE().

void* os_dev_get_user_buffer ( void   ) 

Get the pointer to the user's data buffer. Usable in OS_DEV_READ(), OS_DEV_WRITE(), and OS_DEV_MMAP() routines.

Returns:
Pointer to user buffer (in user space). See os_copy_to_user() and os_copy_from_user().
void* os_dev_get_user_private ( void   ) 

Get the driver's private structure associated with this file.

May be used during OS_DEV_OPEN(), OS_DEV_READ(), OS_DEV_WRITE(), OS_DEV_IOCTL(), OS_DEV_MMAP(), and OS_DEV_CLOSE(). See also os_dev_set_user_private().

Returns:
The driver data structure to associate with this user.
int os_dev_is_flag_nonblock ( void   ) 

Check whether user is requesting non-blocking I/O. Usable in OS_DEV_OPEN(), OS_DEV_CLOSE(), OS_DEV_IOCTL(), OS_DEV_READ() and OS_DEV_WRITE() routines.

int os_dev_is_flag_read ( void   ) 

Check whether user is requesting read (permission) on the file/device. Usable in OS_DEV_OPEN(), OS_DEV_CLOSE(), OS_DEV_IOCTL(), OS_DEV_READ() and OS_DEV_WRITE() routines.

int os_dev_is_flag_write ( void   ) 

Check whether user is requesting write (permission) on the file/device. Usable in OS_DEV_OPEN(), OS_DEV_CLOSE(), OS_DEV_IOCTL(), OS_DEV_READ() and OS_DEV_WRITE() routines.

void os_dev_set_user_private ( void *  struct_p  ) 

Set the driver's private structure associated with this file/open.

Generally used during OS_DEV_OPEN(). May also be used during OS_DEV_READ(), OS_DEV_WRITE(), OS_DEV_IOCTL(), OS_DEV_MMAP(), and OS_DEV_CLOSE(). See also os_dev_get_user_private().

Parameters:
struct_p The driver data structure to associate with this user.
footer
©  Freescale Semiconductor, Inc., 2007.  All rights reserved.
Freescale Confidential Proprietary
NDA Required
doxygen