1. Adam Hoka
  2. oss4-netbsd


oss4-netbsd / kernel / OS / NetBSD / wrapper / bsddefs.h

 * Purpose: Definitions for routines and variables exported by osscore.c
 * Do not make any modifications to these settings because OSS core modules
 * have been compiled against them. Full rebuild of OSS will be required if 
 * this file is changed.
#define COPYING13 Copyright (C) Hannu Savolainen and Dev Mazumdar 2000-2006. All rights reserved.

#ifdef _KERNEL
#include <sys/param.h>
#include <sys/bus.h>
#include <dev/pci/pcivar.h>

// XXX avoid conflict: I hope it wont break anything!

#if __FreeBSD_version >= 700111
extern int oss_file_set_private (struct thread *p, void *v, size_t l);
extern int oss_file_get_private (void **v);
extern int oss_get_uid (void);

typedef struct device dev_info_t;
typedef long long oss_int64_t;			/* Signed 64 bit integer */
typedef unsigned long long oss_uint64_t;	/* Unsigned 64 bit integer */
typedef unsigned long offset_t;

 * Some integer types
#if defined(__amd64__)
typedef unsigned long long oss_native_word;	/* Same as the address and status register size */
typedef unsigned long oss_native_word;	/* Same as the address and status register size */

#ifdef _KERNEL
struct _oss_device_t
  dev_info_t *dip;
  void *osid;
  void *devc;
  char *name;
  char *hw_info;
  int cardnum;
  int dev_type;
  int instance;
  int available;
  int major;
  char nick[16];
  char modname[16];
  char handle[32];
  int num_audio_engines;
  int num_audioplay, num_audiorec, num_audioduplex;
  int num_mididevs;
  int num_mixerdevs;
  int num_loopdevs;
  int first_mixer;	/* This must be set to -1 by osdev_create() */

  int intrcount;
  int ackcount;
  volatile int refcount;	/* Nonzero means that the device is needed by some other (virtual) driver. */

  bus_space_handle_t bus_space_handles[6]; 	/* I hope that will be enough */
  struct pci_attach_args pa;


typedef struct _netbsd_dma_handle {
  void *kva;
  bus_dma_segment_t seg;
  bus_dmamap_t map;
  size_t size;
  int nseg;
} *oss_dma_handle_t;

extern void cmn_err (int level, char *format, ...);
#define CE_CONT		0
#define CE_NOTE		1
#define CE_WARN		2
#define CE_PANIC	3

typedef int ddi_iblock_cookie_t;

extern void oss_udelay (unsigned long t);

#ifdef _KERNELwhyisthishere
#undef memset
#define memset oss_memset
extern void *oss_memset (void *t, int val, int l);

extern oss_device_t *osdev_create (dev_info_t * dip, int dev_type,
				   int instance, const char *nick,
				   const char *handle);
extern void osdev_delete (oss_device_t * osdev);

extern char *oss_pci_read_devpath (dev_info_t * dip);
extern int pci_read_config_byte (oss_device_t * osdev, offset_t where,
				 unsigned char *val);
extern int pci_read_config_irq (oss_device_t * osdev, offset_t where,
				unsigned char *val);
extern int pci_read_config_word (oss_device_t * osdev, offset_t where,
				 unsigned short *val);
extern int pci_read_config_dword (oss_device_t * osdev, offset_t where,
				  unsigned int *val);
extern int pci_write_config_byte (oss_device_t * osdev, offset_t where,
				  unsigned char val);
extern int pci_write_config_word (oss_device_t * osdev, offset_t where,
				  unsigned short val);
extern int pci_write_config_dword (oss_device_t * osdev, offset_t where,
				   unsigned int val);
#ifndef OSS_CONFIG_H
/* These definitions must match with oss_config.h */
typedef int (*oss_tophalf_handler_t) (struct _oss_device_t * osdev);
typedef void (*oss_bottomhalf_handler_t) (struct _oss_device_t * osdev);

extern int oss_register_interrupts (oss_device_t * osdev, int intrnum,
				    oss_tophalf_handler_t top,
				    oss_bottomhalf_handler_t bottom);
extern void oss_unregister_interrupts (oss_device_t * osdev);

void *oss_contig_malloc (oss_device_t * osdev, int size, oss_uint64_t memlimit,
			 oss_native_word * phaddr, oss_dma_handle_t * handlep);
void oss_contig_free (oss_device_t * osdev, oss_dma_handle_t handle);

extern void oss_register_module (char *name);
extern void oss_unregister_module (char *name);
extern void *oss_find_minor_info (int dev_class, int instance);
extern int oss_find_minor (int dev_class, int instance);
extern void oss_inc_intrcount (oss_device_t * osdev, int claimed);

#define FP_SUPPORT

typedef short fp_env_t[512];
typedef unsigned int fp_flags_t[4];
extern int oss_fp_check (void);
extern void oss_fp_save (short *envbuf, fp_flags_t flags);
extern void oss_fp_restore (short *envbuf, fp_flags_t flags);
#   define FP_SAVE(envbuf, flags)		oss_fp_save(envbuf, flags)
#   define FP_RESTORE(envbuf, flags)		oss_fp_restore(envbuf, flags)