uwba.h revision ff0e937b36dcde1a47ff7b00aa76a491c0dc07a8
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_UWB_UWBA_H
#define _SYS_UWB_UWBA_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* UWBA private header file.
*/
/* For logging. */
#define UWBA_LOG_DEBUG 2
#define UWBA_LOG_LOG 1
#define UWBA_LOG_CONSOLE 0
#define UWB_RAW_BEVENTTYPE_OFFSET 0 /* offset of bEventType */
/*
* Offset of data rates Bits in PHY Capability Bitmap.
* [ECMA, 16.8.16, table 112]
*/
#define UWB_RATE_OFFSET_BASE 16
/* the offset of data rate 53.3Mbps in PHY capability bitmap */
#define UWB_RCCB_NULL_HANDLER ((uwb_rccb_handler_t)0)
#define UWB_STATE_IDLE 0
#define UWB_STATE_BEACON 1
#define UWB_STATE_SCAN 2
/* radio client device */
typedef struct uwba_client_dev {
/* Command result from the radio controller */
typedef struct uwb_cmd_result {
/* Cmd result data from device when cmd is finished. */
typedef struct uwb_cmd_result_wrapper {
/* Length of a uwb cmd_result */
int length;
typedef struct uwb_notif_wrapper {
/* Length of uwb notifcation */
int length;
typedef struct uwba_dev {
/* dip of the uwb radio controller device */
/* Dev and instance */
char *devinst;
/* send cmd to the device */
/* current command block */
/* wait for cmd complete and the cmd result available */
/* filled by uwb_fill_cmd_result in rc driver's cmd call back */
/*
* set to TRUE when start to do cmd ioctl;
* set to FALSE when put_cmd and exit cmd ioctl
*/
/* Device state */
/* Beacon or scan channel */
/* Device address */
/* notifications from radio controller device */
/* the current number of notifications in the notif_list */
int notif_cnt;
/* client radio devices found through beacons by this radio host */
/* the current number of devices in dev_list */
int client_dev_cnt;
/* context id is maintained by uwba */
/* PHY capability bitmap, saved from PHY capability IE */
/* list node of a uwb radio host device */
} uwba_dev_t;
}))
typedef struct uwba_evt_size {
/*
* if zero, means there is no variable buf length member
* in this struct
*/
typedef struct uwba_channel_range {
/* First channel in the specific bandgroup */
/* Length since this first channel in the bandgroup */
#define UWB_RESULT_CODE_SIZE (sizeof (uwb_rceb_result_code_t))
#define UWB_EVT_RCEB_SZ (sizeof (uwb_rceb_t))
/* the size after excluded the rceb head */
#define UWB_EVT_NO_BUF_LEN_OFFSET 0
/* Offset of wBeaconInfoLength in uwb_rceb_beacon_t */
#define UWB_BEACONINFOLEN_OFFSET 10
/* Offset of BeaconInfo from bChannelNumber in uwb_rceb_beacon_t */
#define UWB_BEACONINFO_OFFSET 8
/*
* UWB radio controller device list
*/
void uwba_dev_add_to_list(uwba_dev_t *);
void uwba_dev_rm_from_list(uwba_dev_t *);
void uwba_free_uwb_dev(uwba_dev_t *);
/*
* Context ID operations
*/
void uwba_init_ctxt_id(uwba_dev_t *);
void uwba_fini_ctxt_id(uwba_dev_t *);
/*
* Parse events/notifications from radio controller device
*/
int, uwb_rceb_get_ie_t *);
int, uwb_rceb_beacon_t *);
int, uwb_rceb_bpoie_change_t *);
const char *uwba_event_msg(uint16_t);
/* Turn a little endian byte array to a uint32_t */
{ \
}
/* Turn a uint32_t to a little endian byte array */
{ \
}
/* Turn a little endian byte array to a uint16_t */
{ \
}
/* Turn a uint16_t to alittle endian byte array */
{ \
}
/* Max string length for the driver name and instance number. */
#define UWB_MAXSTRINGLEN 255
#ifdef __cplusplus
}
#endif
#endif /* _SYS_UWB_UWBA_H */