Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
neh.c File Reference
#include <linux/kernel.h>
#include <linux/timer.h>
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/export.h>
#include "uwb-internal.h"

Go to the source code of this file.

Data Structures

struct  uwb_rc_neh
 

Functions

void uwb_rc_neh_put (struct uwb_rc_neh *neh)
 
struct uwb_rc_nehuwb_rc_neh_add (struct uwb_rc *rc, struct uwb_rccb *cmd, u8 expected_type, u16 expected_event, uwb_rc_cmd_cb_f cb, void *arg)
 
void uwb_rc_neh_rm (struct uwb_rc *rc, struct uwb_rc_neh *neh)
 
void uwb_rc_neh_arm (struct uwb_rc *rc, struct uwb_rc_neh *neh)
 
void uwb_rc_neh_grok (struct uwb_rc *rc, void *buf, size_t buf_size)
 
 EXPORT_SYMBOL_GPL (uwb_rc_neh_grok)
 
void uwb_rc_neh_error (struct uwb_rc *rc, int error)
 
 EXPORT_SYMBOL_GPL (uwb_rc_neh_error)
 
void uwb_rc_neh_create (struct uwb_rc *rc)
 
void uwb_rc_neh_destroy (struct uwb_rc *rc)
 

Function Documentation

EXPORT_SYMBOL_GPL ( uwb_rc_neh_grok  )
EXPORT_SYMBOL_GPL ( uwb_rc_neh_error  )
struct uwb_rc_neh* uwb_rc_neh_add ( struct uwb_rc rc,
struct uwb_rccb cmd,
u8  expected_type,
u16  expected_event,
uwb_rc_cmd_cb_f  cb,
void arg 
)
read

uwb_rc_neh_add - add a neh for a radio controller command : the radio controller : the radio controller command : the type of the expected response event : the expected event ID : callback for when the event is received

  • : argument for the callback

Creates a neh and adds it to the list of those waiting for an event. A context ID will be assigned to the command.

Definition at line 209 of file neh.c.

void uwb_rc_neh_arm ( struct uwb_rc rc,
struct uwb_rc_neh neh 
)

uwb_rc_neh_arm - arm an event handler timeout timer

: UWB Radio Controller : Notification/event handler for

The timer is only armed if the neh is active.

Definition at line 290 of file neh.c.

void uwb_rc_neh_create ( struct uwb_rc rc)

Initializes the 's neh subsystem

Definition at line 593 of file neh.c.

void uwb_rc_neh_destroy ( struct uwb_rc rc)

Release's the 's neh subsystem

Definition at line 604 of file neh.c.

void uwb_rc_neh_error ( struct uwb_rc rc,
int  error 
)

The entity that reads from the device notification/event channel has detected an error.

: UWB Radio Controller : Errno error code

Definition at line 548 of file neh.c.

void uwb_rc_neh_grok ( struct uwb_rc rc,
void buf,
size_t  buf_size 
)

Given a buffer with one or more UWB RC events/notifications, break them up and dispatch them.

: UWB Radio Controller : Buffer with the stream of notifications/events : Amount of data in the buffer

Note each notification/event starts always with a 'struct uwb_rceb', so the minimum size if 4 bytes.

The device may pass us events formatted differently than expected. These are first filtered, potentially creating a new event in a new memory location. If a new event is created by the filter it is also freed here.

For each notif/event, tries to guess the size looking at the EST tables, then looks for a neh that is waiting for that event and if found, copies the payload to the neh's buffer and calls it back. If not, the data is ignored.

Note that if we can't find a size description in the EST tables, we still might find a size in the 'neh' handle in uwb_rc_neh_lookup().

Assumptions:

->neh_lock is NOT taken

We keep track of various sizes here: size: contains the size of the buffer that is processed for the incoming event. this buffer may contain events that are not formatted as WHCI. real_size: the actual space taken by this event in the buffer. We need to keep track of the real size of an event to be able to advance the buffer correctly. event_size: the size of the event as expected by the core layer [OR] the size of the event after filtering. if the filtering created a new event in a new memory location then this is effectively the size of a new event buffer

Definition at line 480 of file neh.c.

void uwb_rc_neh_put ( struct uwb_rc_neh neh)

uwb_rc_neh_put - release reference to a neh : the neh

Definition at line 136 of file neh.c.

void uwb_rc_neh_rm ( struct uwb_rc rc,
struct uwb_rc_neh neh 
)

uwb_rc_neh_rm - remove a neh. : the radio controller : the neh to remove

Remove an active neh immediately instead of waiting for the event (or a time out).

Definition at line 270 of file neh.c.