/home/hillier_g/checkout/most4linux/most-kernel/most-common.h File Reference

Common types and definitions used in various MOST drivers. More...

Go to the source code of this file.

Data Structures

struct  frame_part
struct  spin_locked_list
struct  rwsema_locked_list

Defines

#define kill_proc_info_as_uid(sig, info, pid, uid, euid)   kill_proc_info_as_uid(sig, info, pid, uid, euid)
#define ker_malloc(m)   kmalloc(m, GFP_KERNEL)
#define SPIN_LOCKED_LIST(name)
#define RWSEMA_LOCKED_LIST(name)
#define is_between_incl(value, a, b)   (((value) >= (a)) && ((value) <= (b)))
#define is_between_excl(value, a, b)   (((value) > (a)) && ((value) < (b)))
#define assert(expression)
#define return_if_fails_dbg(expression)
#define pr_reg_access_debug(fmt, arg...)   rtnrt_debug(fmt,##arg)
#define pr_ioctl_debug(fmt, arg...)   rtnrt_debug(fmt,##arg)
#define pr_devfunc_debug(fmt, arg...)   rtnrt_debug(fmt,##arg)
#define pr_irq_debug(fmt, arg...)   rtnrt_debug(fmt,##arg)
#define pr_rt_irq_debug(fmt, arg...)   rtnrt_debug(fmt,##arg)
#define pr_txbuf_debug(fmt, arg...)   rtnrt_debug(fmt,##arg)
#define pr_rxbuf_debug(fmt, arg...)   rtnrt_debug(fmt,##arg)
#define pr_sync_debug(fmt, arg...)   rtnrt_debug(fmt,##arg)
#define pr_nets_debug(fmt, arg...)   rtnrt_debug(fmt,##arg)
#define pr_alsa_debug(fmt, arg...)   rtnrt_debug(fmt,##arg)
#define pr_measure_debug(fmt, arg...)   rtnrt_debug(fmt,##arg)
#define return_value_if_fails_dbg(expression, value)   do { } while (0)
#define return_if_fails(expression)
#define return_value_if_fails(expression, value)

Typedefs

typedef _Bool bool
typedef unsigned long uintptr_t
typedef long intptr_t

Enumerations

enum  { false = 0, true = 1 }

Functions

static int most_kill (int signo, struct task_struct *p, int data)
static void swap_bytes (u8 *b, int length)


Detailed Description

Common types and definitions used in various MOST drivers.

This has nothing to do with MOST, it could be used in any other drivers. It can also be included in userspace as it defines struct frame_part.

Definition in file most-common.h.


Define Documentation

#define ker_malloc (  )     kmalloc(m, GFP_KERNEL)

Allocate memory, mainly because of usp-test.h

Definition at line 101 of file most-common.h.

Referenced by rxbuf_alloc(), and txbuf_alloc().

#define SPIN_LOCKED_LIST ( name   ) 

Value:

struct spin_locked_list name = {                                        \
        .list       = LIST_HEAD_INIT(name.list),                            \
        .lock       = RTNRT_LOCK_UNLOCKED(name.lock)                        \
    }
Declare a spin_locked_list variable and initialize the list elements statically.

Parameters:
name the name for the variable

Definition at line 125 of file most-common.h.

#define RWSEMA_LOCKED_LIST ( name   ) 

Value:

struct rwsema_locked_list name = {                                      \
        .list       = LIST_HEAD_INIT(name.list),                            \
        .lock       = __RWSEM_INITIALIZER(name.lock)                        \
    };
Declare a rwsema_locked_list variable and initialize the list elements statically

Parameters:
name the name for the variable

Definition at line 151 of file most-common.h.

#define is_between_incl ( value,
a,
 )     (((value) >= (a)) && ((value) <= (b)))

Checks if value is between a and b, i.e. if a <= value <= b.

Parameters:
value the value to check
a the lower bound
b the upper bound
Returns:
true if the condition is met, false otherwise

Definition at line 165 of file most-common.h.

#define is_between_excl ( value,
a,
 )     (((value) > (a)) && ((value) < (b)))

Checks if value is between a and b, i.e. if a < value < b.

Parameters:
value the value to check
a the lower bound
b the upper bound
Returns:
true if the condition is met, false otherwise

Definition at line 176 of file most-common.h.

Referenced by ioctl_irq_set().

#define assert ( expression   ) 

Value:

do {                                                                 \
           if (!(expression)) {                                             \
               rtnrt_err("Assertion \"%s\" failed: file \"%s\", line %d\n", \
                       #expression, __FILE__, __LINE__);                    \
           }                                                                \
       } while (0)
Assetion macro. In contrast to BUG_ON(), only prints an error message but doesn't panic. Works in RT and NRT. Only executed if in DEBUG mode, so expression should not contain any side effects.

Parameters:
expression the expression that should be checked. If expression is true, nothing is done.

Definition at line 218 of file most-common.h.

Referenced by most_sync_int_handler(), most_sync_rt_read_write_begin(), most_sync_rt_read_write_end(), nets_int_handler(), and process_sigsend_handler().

#define return_if_fails_dbg ( expression   ) 

Value:

do {                                                                \
            if (!(expression)) {                                            \
                rtnrt_err("\"%s\" failed: file \"%s\", line %d\n",          \
                       #expression, __FILE__, __LINE__);                    \
                return;                                                     \
            }                                                               \
        } while (0)
If expression fails, returns from the current function and print a debug message. Only evaluated in DEBUG mode, expands to nothing in release mode.

This macro is meant as kind of assertions, i.e. a warning is printed if the condition fails. If it's a normal state that expression fails, use return_if_fails().

Parameters:
expression the expression to check

Definition at line 242 of file most-common.h.

Referenced by most_sync_rt_interrupt_handler().

#define pr_reg_access_debug ( fmt,
arg...   )     rtnrt_debug(fmt,##arg)

Low-level register access debugging

Parameters:
[in] fmt the format string
[in] arg the arguments for the format string

Definition at line 262 of file most-common.h.

Referenced by dma_allocate(), dma_deallocate(), readreg_int(), and writereg_int().

#define pr_ioctl_debug ( fmt,
arg...   )     rtnrt_debug(fmt,##arg)

ioctl() debugging.

Parameters:
[in] fmt the format string
[in] arg the arguments for the format string

Definition at line 276 of file most-common.h.

Referenced by ioctl_irq_reset(), ioctl_irq_set(), ioctl_read_int(), ioctl_read_regblock(), ioctl_read_register(), ioctl_write_regblock(), and ioctl_write_register().

#define pr_devfunc_debug ( fmt,
arg...   )     rtnrt_debug(fmt,##arg)

Device function debugging.

Parameters:
[in] fmt the format string
[in] arg the arguments for the format string

Definition at line 290 of file most-common.h.

Referenced by read_data_8104(), write_data_8104(), and write_map_8104().

#define pr_irq_debug ( fmt,
arg...   )     rtnrt_debug(fmt,##arg)

Debugging in interrupt service routines

Parameters:
[in] fmt the format string
[in] arg the arguments for the format string

Definition at line 304 of file most-common.h.

Referenced by handle_interrupt(), intset(), and most_sync_int_handler().

#define pr_rt_irq_debug ( fmt,
arg...   )     rtnrt_debug(fmt,##arg)

Debugging in real-time interrupt service routines

Parameters:
[in] fmt the format string
[in] arg the arguments for the format string

Definition at line 318 of file most-common.h.

Referenced by most_sync_rt_interrupt_handler().

#define pr_txbuf_debug ( fmt,
arg...   )     rtnrt_debug(fmt,##arg)

Debugging function for txbuf.

Parameters:
[in] fmt the format string
[in] arg the arguments for the format string

Definition at line 332 of file most-common.h.

Referenced by txbuf_alloc(), and txbuf_put().

#define pr_rxbuf_debug ( fmt,
arg...   )     rtnrt_debug(fmt,##arg)

Debugging function for rxbuf.

Parameters:
[in] fmt the format string
[in] arg the arguments for the format string

Definition at line 346 of file most-common.h.

Referenced by rxbuf_alloc(), rxbuf_get(), and rxbuf_put().

#define pr_sync_debug ( fmt,
arg...   )     rtnrt_debug(fmt,##arg)

Debugging function for most-sync.

Parameters:
[in] fmt the format string
[in] arg the arguments for the format string

Definition at line 360 of file most-common.h.

Referenced by most_sync_do_open(), most_sync_do_release(), most_sync_nrt_close(), most_sync_nrt_open(), most_sync_nrt_setup_rx(), most_sync_probe(), most_sync_read(), most_sync_remove(), most_sync_rt_probe(), most_sync_rt_remove(), and most_sync_write().

#define pr_nets_debug ( fmt,
arg...   )     rtnrt_debug(fmt,##arg)

Debugging function for most-netservice.

Parameters:
[in] fmt the format string
[in] arg the arguments for the format string

Definition at line 374 of file most-common.h.

Referenced by most_nets_open(), most_nets_release(), nets_probe(), and nets_remove().

#define pr_alsa_debug ( fmt,
arg...   )     rtnrt_debug(fmt,##arg)

Debugging function for the ALSA driver

Parameters:
[in] fmt the format string
[in] arg the arguments for the format string

Definition at line 388 of file most-common.h.

Referenced by most_alsa_probe(), most_alsa_remove(), snd_most_capture_close(), snd_most_capture_hw_free(), snd_most_capture_hw_params(), snd_most_capture_open(), snd_most_capture_prepare(), snd_most_capture_thread(), snd_most_capture_trigger(), snd_most_playback_close(), snd_most_playback_hw_free(), snd_most_playback_hw_params(), snd_most_playback_open(), snd_most_playback_prepare(), snd_most_playback_thread(), and snd_most_playback_trigger().

#define pr_measure_debug ( fmt,
arg...   )     rtnrt_debug(fmt,##arg)

Prints debug messages that are needed for measurings.

Parameters:
fmt the format string
arg the arguments for the format string

Definition at line 402 of file most-common.h.

#define return_value_if_fails_dbg ( expression,
value   )     do { } while (0)

If expression failes, returns val from the current function and print a debug message. Only evaluated in DEBUG mode, expands to nothing in release mode.

This macro is meant as kind of assertions, i.e. a warning is printed if the condition fails. If it's a normal state that expression fails, use return_value_if_fails().

Parameters:
expression the expression to check
value the value to return

Definition at line 431 of file most-common.h.

Referenced by most_sync_probe(), most_sync_rt_probe(), most_sync_rt_read_write_begin(), nets_probe(), and rxbuf_put().

#define return_if_fails ( expression   ) 

Value:

do {                                                                    \
        if (!(expression)) {                                                \
            return;                                                         \
        }                                                                   \
    } while (0)
If expression fails, return from the current function. This macro should be used if a failure of expression is a valid program state.

Parameters:
expression the expression to check

Definition at line 442 of file most-common.h.

#define return_value_if_fails ( expression,
value   ) 

Value:

do {                                                                  \
          if (!(expression)) {                                              \
              return value;                                                 \
          }                                                                 \
      } while (0)
If expression fails, returns val from the current function. This macro should be used if a failure of expression is a valid program state.

Parameters:
expression the expression to check
value the value to return

Definition at line 457 of file most-common.h.

Referenced by most_sync_read(), and most_sync_write().


Typedef Documentation

typedef _Bool bool

Define a boolean type. Don't include stdbool.h.

Definition at line 85 of file most-common.h.

typedef unsigned long uintptr_t

Define an unsigned integer type that can hold pointers as in C99.

Definition at line 91 of file most-common.h.

typedef long intptr_t

Define a integer type that can hold pointers as in C99.

Definition at line 96 of file most-common.h.


Enumeration Type Documentation

anonymous enum

Define true and false.

Definition at line 77 of file most-common.h.


Function Documentation

static int most_kill ( int  signo,
struct task_struct *  p,
int  data 
) [inline, static]

Sends a signal to a specified process. Calls kill_proc_info_as_uid() internally.

Parameters:
signo the signal number
pid the PID of the current process
data the data value that should be sent with the signal
Returns:
0 on sucess, error code on failure

Definition at line 188 of file most-common.h.

References kill_proc_info_as_uid.

Referenced by process_sigsend_handler().

static void swap_bytes ( u8 *  b,
int  length 
) [inline, static]

Swaps bytes. Needed to convert big endian to little endian. From ./drivers/media/dvb/ttusb-dec/ttusb_dec.c

Parameters:
[in,out] b the bytes to swap
[in] length the length

Definition at line 471 of file most-common.h.

Referenced by snd_most_capture_thread(), and snd_most_playback_thread().


Generated on Fri Mar 9 14:48:58 2007 for MOST Linux Drivers (Linux and RTAI) by  doxygen 1.5.0