Commit e84f5e59 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Eicon driver indent

Use Linux kernel coding style (no code changes).

(Armin Schindler)
parent d37734b2
......@@ -5,14 +5,13 @@
#define DIVA_UM_IDI_ADAPTER_REMOVED 0x00000001
typedef struct _diva_um_idi_adapter {
diva_entity_link_t link;
DESCRIPTOR d;
int adapter_nr;
diva_entity_queue_t entity_q; /* entities linked to this adapter */
dword status;
typedef struct _diva_um_idi_adapter {
diva_entity_link_t link;
DESCRIPTOR d;
int adapter_nr;
diva_entity_queue_t entity_q; /* entities linked to this adapter */
dword status;
} diva_um_idi_adapter_t;
#endif
This diff is collapsed.
......@@ -10,7 +10,7 @@
* of the GNU General Public License, incorporated herein by reference.
*/
#ifndef __CAPIFUNC_H__
#ifndef __CAPIFUNC_H__
#define __CAPIFUNC_H__
#define MAX_DESCRIPTORS 32
......
......@@ -31,20 +31,20 @@
EXPORT_NO_SYMBOLS;
static char *main_revision = "$Revision: 1.1.2.2 $";
static char *DRIVERNAME = "Eicon DIVA - CAPI Interface driver (http://www.melware.net)";
static char *main_revision = "$Revision: 1.1.2.11 $";
static char *DRIVERNAME =
"Eicon DIVA - CAPI Interface driver (http://www.melware.net)";
static char *DRIVERLNAME = "divacapi";
MODULE_DESCRIPTION( "CAPI driver for Eicon DIVA cards");
MODULE_AUTHOR( "Cytronics & Melware, Eicon Networks");
MODULE_SUPPORTED_DEVICE( "CAPI and DIVA card drivers");
MODULE_DESCRIPTION("CAPI driver for Eicon DIVA cards");
MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
MODULE_SUPPORTED_DEVICE("CAPI and DIVA card drivers");
MODULE_LICENSE("GPL");
/*
* get revision number from revision string
*/
static char *
getrev(const char *revision)
static char *getrev(const char *revision)
{
char *rev;
char *p;
......@@ -52,7 +52,8 @@ getrev(const char *revision)
rev = p + 2;
p = strchr(rev, '$');
*--p = 0;
} else rev = "1.0";
} else
rev = "1.0";
return rev;
}
......@@ -60,86 +61,85 @@ getrev(const char *revision)
/*
* sleep for some milliseconds
*/
void
diva_os_sleep (dword mSec)
void diva_os_sleep(dword mSec)
{
unsigned long timeout = HZ * mSec / 1000 + 1;
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(timeout);
}
/*
* wait for some milliseconds
*/
void
diva_os_wait (dword mSec)
*/
void diva_os_wait(dword mSec)
{
mdelay (mSec);
}
mdelay(mSec);
}
/*
* alloc memory
*/
void* diva_os_malloc (unsigned long flags, unsigned long size)
void *diva_os_malloc(unsigned long flags, unsigned long size)
{
void* ret = NULL;
if (size) {
ret = (void *)vmalloc((unsigned int)size);
}
return(ret);
void *ret = NULL;
if (size) {
ret = (void *) vmalloc((unsigned int) size);
}
return (ret);
}
/*
* free memory
*/
void diva_os_free(unsigned long unused, void* ptr)
void diva_os_free(unsigned long unused, void *ptr)
{
if (ptr) {
vfree(ptr);
}
if (ptr) {
vfree(ptr);
}
}
/*
* alloc a message buffer
*/
diva_os_message_buffer_s *
diva_os_alloc_message_buffer(unsigned long size, void **data_buf)
diva_os_message_buffer_s *diva_os_alloc_message_buffer(unsigned long size,
void **data_buf)
{
diva_os_message_buffer_s *dmb = alloc_skb(size, GFP_ATOMIC);
if (dmb) {
*data_buf = skb_put(dmb, size);
}
return(dmb);
diva_os_message_buffer_s *dmb = alloc_skb(size, GFP_ATOMIC);
if (dmb) {
*data_buf = skb_put(dmb, size);
}
return (dmb);
}
/*
* free a message buffer
*/
void diva_os_free_message_buffer(diva_os_message_buffer_s *dmb)
void diva_os_free_message_buffer(diva_os_message_buffer_s * dmb)
{
kfree_skb(dmb);
}
kfree_skb(dmb);
}
/*
* proc function for controller info
*/
static int diva_ctl_read_proc(char *page, char **start, off_t off,int count, int *eof, struct capi_ctr *ctrl)
static int diva_ctl_read_proc(char *page, char **start, off_t off,
int count, int *eof, struct capi_ctr *ctrl)
{
diva_card *card = (diva_card *)ctrl->driverdata;
int len = 0;
len += sprintf(page+len, "%s\n", ctrl->name);
len += sprintf(page+len, "Serial No. : %s\n", ctrl->serial);
len += sprintf(page+len, "Id : %d\n", card->Id);
len += sprintf(page+len, "Channels : %d\n", card->d.channels);
if (off + count >= len)
*eof = 1;
if (len < off)
return 0;
*start = page + off;
return((count < len-off) ? count : len-off);
diva_card *card = (diva_card *) ctrl->driverdata;
int len = 0;
len += sprintf(page + len, "%s\n", ctrl->name);
len += sprintf(page + len, "Serial No. : %s\n", ctrl->serial);
len += sprintf(page + len, "Id : %d\n", card->Id);
len += sprintf(page + len, "Channels : %d\n", card->d.channels);
if (off + count >= len)
*eof = 1;
if (len < off)
return 0;
*start = page + off;
return ((count < len - off) ? count : len - off);
}
/*
......@@ -147,52 +147,50 @@ static int diva_ctl_read_proc(char *page, char **start, off_t off,int count, int
*/
void diva_os_set_controller_struct(struct capi_ctr *ctrl)
{
ctrl->driver_name = DRIVERLNAME;
ctrl->load_firmware = 0;
ctrl->reset_ctr = 0;
ctrl->ctr_read_proc = diva_ctl_read_proc;
SET_MODULE_OWNER(ctrl);
ctrl->driver_name = DRIVERLNAME;
ctrl->load_firmware = 0;
ctrl->reset_ctr = 0;
ctrl->ctr_read_proc = diva_ctl_read_proc;
SET_MODULE_OWNER(ctrl);
}
/*
* module init
*/
static int DIVA_INIT_FUNCTION
divacapi_init(void)
static int DIVA_INIT_FUNCTION divacapi_init(void)
{
char tmprev[32];
int ret = 0;
char tmprev[32];
int ret = 0;
MOD_INC_USE_COUNT;
MOD_INC_USE_COUNT;
sprintf(DRIVERRELEASE, "%d.%d%s", DRRELMAJOR, DRRELMINOR, DRRELEXTRA);
sprintf(DRIVERRELEASE, "%d.%d%s", DRRELMAJOR, DRRELMINOR,
DRRELEXTRA);
printk(KERN_INFO "%s\n", DRIVERNAME);
printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE);
strcpy(tmprev, main_revision);
printk("%s Build: %s(%s)\n", getrev(tmprev),
diva_capi_common_code_build, DIVA_BUILD);
printk(KERN_INFO "%s\n", DRIVERNAME);
printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE);
strcpy(tmprev, main_revision);
printk("%s Build: %s(%s)\n", getrev(tmprev),
diva_capi_common_code_build, DIVA_BUILD);
if (!(init_capifunc()))
{
printk(KERN_ERR "%s: failed init capi_driver.\n", DRIVERLNAME);
ret = -EIO;
if (!(init_capifunc())) {
printk(KERN_ERR "%s: failed init capi_driver.\n",
DRIVERLNAME);
ret = -EIO;
}
MOD_DEC_USE_COUNT;
return ret;
MOD_DEC_USE_COUNT;
return ret;
}
/*
* module exit
*/
static void DIVA_EXIT_FUNCTION
divacapi_exit(void)
static void DIVA_EXIT_FUNCTION divacapi_exit(void)
{
finit_capifunc();
printk(KERN_INFO "%s: module unloaded.\n", DRIVERLNAME);
finit_capifunc();
printk(KERN_INFO "%s: module unloaded.\n", DRIVERLNAME);
}
module_init(divacapi_init);
module_exit(divacapi_exit);
......@@ -22,7 +22,7 @@
#define DBG_DEFAULT (DBG_MINIMUM + DL_XLOG + DL_REG)
extern void DIVA_DIDD_Read (void *, int);
extern void DIVA_DIDD_Read(void *, int);
extern char *DRIVERRELEASE;
static dword notify_handle;
static DESCRIPTOR _DAdapter;
......@@ -30,73 +30,65 @@ static DESCRIPTOR _DAdapter;
/*
* didd callback function
*/
static void *
didd_callback(void *context, DESCRIPTOR* adapter, int removal)
static void *didd_callback(void *context, DESCRIPTOR * adapter,
int removal)
{
if (adapter->type == IDI_DADAPTER)
{
DBG_ERR(("Notification about IDI_DADAPTER change ! Oops."))
return(NULL);
}
else if (adapter->type == IDI_DIMAINT)
{
if (removal) {
DbgDeregister();
if (adapter->type == IDI_DADAPTER) {
DBG_ERR(("Notification about IDI_DADAPTER change ! Oops."))
return (NULL);
} else if (adapter->type == IDI_DIMAINT) {
if (removal) {
DbgDeregister();
} else {
DbgRegister("DIDD", DRIVERRELEASE, DBG_DEFAULT);
DbgRegister("DIDD", DRIVERRELEASE, DBG_DEFAULT);
}
}
return(NULL);
}
return (NULL);
}
/*
* connect to didd
*/
static int DIVA_INIT_FUNCTION
connect_didd(void)
static int DIVA_INIT_FUNCTION connect_didd(void)
{
int x = 0;
int dadapter = 0;
IDI_SYNC_REQ req;
DESCRIPTOR DIDD_Table[MAX_DESCRIPTORS];
int x = 0;
int dadapter = 0;
IDI_SYNC_REQ req;
DESCRIPTOR DIDD_Table[MAX_DESCRIPTORS];
DIVA_DIDD_Read(DIDD_Table, sizeof(DIDD_Table));
DIVA_DIDD_Read(DIDD_Table, sizeof(DIDD_Table));
for (x = 0; x < MAX_DESCRIPTORS; x++)
{
if (DIDD_Table[x].type == IDI_DADAPTER)
{ /* DADAPTER found */
dadapter = 1;
memcpy(&_DAdapter, &DIDD_Table[x], sizeof(_DAdapter));
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc = IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
req.didd_notify.info.callback = didd_callback;
req.didd_notify.info.context = 0;
_DAdapter.request((ENTITY *)&req);
if (req.didd_notify.e.Rc != 0xff)
return(0);
notify_handle = req.didd_notify.info.handle;
}
else if (DIDD_Table[x].type == IDI_DIMAINT)
{ /* MAINT found */
DbgRegister("DIDD", DRIVERRELEASE, DBG_DEFAULT);
}
}
return(dadapter);
for (x = 0; x < MAX_DESCRIPTORS; x++) {
if (DIDD_Table[x].type == IDI_DADAPTER) { /* DADAPTER found */
dadapter = 1;
memcpy(&_DAdapter, &DIDD_Table[x], sizeof(_DAdapter));
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc =
IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
req.didd_notify.info.callback = didd_callback;
req.didd_notify.info.context = 0;
_DAdapter.request((ENTITY *) & req);
if (req.didd_notify.e.Rc != 0xff)
return (0);
notify_handle = req.didd_notify.info.handle;
} else if (DIDD_Table[x].type == IDI_DIMAINT) { /* MAINT found */
DbgRegister("DIDD", DRIVERRELEASE, DBG_DEFAULT);
}
}
return (dadapter);
}
/*
* disconnect from didd
*/
static void DIVA_EXIT_FUNCTION
disconnect_didd(void)
static void DIVA_EXIT_FUNCTION disconnect_didd(void)
{
IDI_SYNC_REQ req;
IDI_SYNC_REQ req;
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc = IDI_SYNC_REQ_DIDD_REMOVE_ADAPTER_NOTIFY;
req.didd_notify.info.handle = notify_handle;
_DAdapter.request((ENTITY *)&req);
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc = IDI_SYNC_REQ_DIDD_REMOVE_ADAPTER_NOTIFY;
req.didd_notify.info.handle = notify_handle;
_DAdapter.request((ENTITY *) & req);
}
/*
......@@ -104,14 +96,14 @@ disconnect_didd(void)
*/
int DIVA_INIT_FUNCTION diddfunc_init(void)
{
diva_didd_load_time_init();
diva_didd_load_time_init();
if(!connect_didd()) {
DBG_ERR(("init: failed to connect to DIDD."))
diva_didd_load_time_finit();
return(0);
}
return(1);
if (!connect_didd()) {
DBG_ERR(("init: failed to connect to DIDD."))
diva_didd_load_time_finit();
return (0);
}
return (1);
}
/*
......@@ -119,8 +111,7 @@ int DIVA_INIT_FUNCTION diddfunc_init(void)
*/
void DIVA_EXIT_FUNCTION diddfunc_finit(void)
{
DbgDeregister();
disconnect_didd();
diva_didd_load_time_finit();
DbgDeregister();
disconnect_didd();
diva_didd_load_time_finit();
}
This diff is collapsed.
/* $Id: diva.h,v 1.1.2.2 2002/10/02 14:38:37 armin Exp $ */
/* $Id: diva.h,v 1.1.2.2 2001/02/08 12:25:43 armin Exp $ */
#ifndef __DIVA_XDI_OS_PART_H__
#define __DIVA_XDI_OS_PART_H__
int divasa_xdi_driver_entry (void);
void divasa_xdi_driver_unload (void);
void* diva_driver_add_card (void* pdev, unsigned long CardOrdinal);
void diva_driver_remove_card (void* pdiva);
int divasa_xdi_driver_entry(void);
void divasa_xdi_driver_unload(void);
void *diva_driver_add_card(void *pdev, unsigned long CardOrdinal);
void diva_driver_remove_card(void *pdiva);
typedef int (*divas_xdi_copy_to_user_fn_t)(void* os_handle, void* dst,
const void* src, int length);
typedef int (*divas_xdi_copy_to_user_fn_t) (void *os_handle, void *dst,
const void *src, int length);
typedef int (*divas_xdi_copy_from_user_fn_t)(void* os_handle, void* dst,
const void* src, int length);
typedef int (*divas_xdi_copy_from_user_fn_t) (void *os_handle, void *dst,
const void *src, int length);
int diva_xdi_read (void* adapter, void* os_handle, void* dst,
int max_length, divas_xdi_copy_to_user_fn_t cp_fn);
int diva_xdi_read(void *adapter, void *os_handle, void *dst,
int max_length, divas_xdi_copy_to_user_fn_t cp_fn);
int diva_xdi_write (void* adapter, void* os_handle, const void* src,
int length, divas_xdi_copy_from_user_fn_t cp_fn);
int diva_xdi_write(void *adapter, void *os_handle, const void *src,
int length, divas_xdi_copy_from_user_fn_t cp_fn);
void* diva_xdi_open_adapter (void* os_handle, const void* src,
int length, divas_xdi_copy_from_user_fn_t cp_fn);
void *diva_xdi_open_adapter(void *os_handle, const void *src,
int length,
divas_xdi_copy_from_user_fn_t cp_fn);
void diva_xdi_close_adapter (void* adapter, void* os_handle);
void diva_xdi_close_adapter(void *adapter, void *os_handle);
#endif
/* $Id: diva_didd.c,v 1.1.2.2 2002/10/02 14:38:37 armin Exp $
/* $Id: diva_didd.c,v 1.1.2.6 2001/05/01 15:48:05 armin Exp $
*
* DIDD Interface module for Eicon active cards.
*
......@@ -23,18 +23,19 @@
#include "divasync.h"
#include "did_vers.h"
static char *main_revision = "$Revision: 1.1.2.2 $";
static char *main_revision = "$Revision: 1.1.2.6 $";
static char *DRIVERNAME = "Eicon DIVA - DIDD table (http://www.melware.net)";
static char *DRIVERNAME =
"Eicon DIVA - DIDD table (http://www.melware.net)";
static char *DRIVERLNAME = "divadidd";
char *DRIVERRELEASE = "2.0";
static char *dir_in_proc_net = "isdn";
static char *main_proc_dir = "eicon";
MODULE_DESCRIPTION( "DIDD table driver for diva drivers");
MODULE_AUTHOR( "Cytronics & Melware, Eicon Networks");
MODULE_SUPPORTED_DEVICE( "Eicon diva drivers");
MODULE_DESCRIPTION("DIDD table driver for diva drivers");
MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
MODULE_SUPPORTED_DEVICE("Eicon diva drivers");
MODULE_LICENSE("GPL");
#define MAX_DESCRIPTORS 32
......@@ -45,7 +46,7 @@ MODULE_LICENSE("GPL");
extern int diddfunc_init(void);
extern void diddfunc_finit(void);
extern void DIVA_DIDD_Read (void *, int);
extern void DIVA_DIDD_Read(void *, int);
static struct proc_dir_entry *proc_net_isdn;
static struct proc_dir_entry *proc_didd;
......@@ -54,8 +55,7 @@ struct proc_dir_entry *proc_net_isdn_eicon = NULL;
EXPORT_SYMBOL_NOVERS(DIVA_DIDD_Read);
EXPORT_SYMBOL_NOVERS(proc_net_isdn_eicon);
static char *
getrev(const char *revision)
static char *getrev(const char *revision)
{
char *rev;
char *p;
......@@ -63,106 +63,112 @@ getrev(const char *revision)
rev = p + 2;
p = strchr(rev, '$');
*--p = 0;
} else rev = "1.0";
} else
rev = "1.0";
return rev;
}
static int
proc_read(char *page, char **start, off_t off, int count, int *eof, void *data)
proc_read(char *page, char **start, off_t off, int count, int *eof,
void *data)
{
int len = 0;
char tmprev[32];
strcpy(tmprev, main_revision);
len += sprintf(page+len, "%s\n", DRIVERNAME);
len += sprintf(page+len, "name : %s\n", DRIVERLNAME);
len += sprintf(page+len, "release : %s\n", DRIVERRELEASE);
len += sprintf(page+len, "build : %s(%s)\n",
diva_didd_common_code_build, DIVA_BUILD);
len += sprintf(page+len, "revision : %s\n", getrev(tmprev));
if (off + count >= len)
*eof = 1;
if (len < off)
return 0;
*start = page + off;
return((count < len-off) ? count : len-off);
int len = 0;
char tmprev[32];
strcpy(tmprev, main_revision);
len += sprintf(page + len, "%s\n", DRIVERNAME);
len += sprintf(page + len, "name : %s\n", DRIVERLNAME);
len += sprintf(page + len, "release : %s\n", DRIVERRELEASE);
len += sprintf(page + len, "build : %s(%s)\n",
diva_didd_common_code_build, DIVA_BUILD);
len += sprintf(page + len, "revision : %s\n", getrev(tmprev));
if (off + count >= len)
*eof = 1;
if (len < off)
return 0;
*start = page + off;
return ((count < len - off) ? count : len - off);
}
static int DIVA_INIT_FUNCTION create_proc(void)
{
struct proc_dir_entry *pe;
for (pe = proc_net->subdir; pe; pe = pe->next) {
if (!memcmp(dir_in_proc_net, pe->name, pe->namelen)) {
proc_net_isdn = pe;
break;
}
}
if (!proc_net_isdn) {
proc_net_isdn = create_proc_entry(dir_in_proc_net, S_IFDIR, proc_net);
}
proc_net_isdn_eicon = create_proc_entry(main_proc_dir, S_IFDIR, proc_net_isdn);
if(proc_net_isdn_eicon) {
if((proc_didd = create_proc_entry(DRIVERLNAME, S_IFREG | S_IRUGO, proc_net_isdn_eicon))) {
proc_didd->read_proc = proc_read;
}
return(1);
}
return(0);
struct proc_dir_entry *pe;
for (pe = proc_net->subdir; pe; pe = pe->next) {
if (!memcmp(dir_in_proc_net, pe->name, pe->namelen)) {
proc_net_isdn = pe;
break;
}
}
if (!proc_net_isdn) {
proc_net_isdn =
create_proc_entry(dir_in_proc_net, S_IFDIR, proc_net);
}
proc_net_isdn_eicon =
create_proc_entry(main_proc_dir, S_IFDIR, proc_net_isdn);
if (proc_net_isdn_eicon) {
if (
(proc_didd =
create_proc_entry(DRIVERLNAME, S_IFREG | S_IRUGO,
proc_net_isdn_eicon))) {
proc_didd->read_proc = proc_read;
}
return (1);
}
return (0);
}
static void DIVA_EXIT_FUNCTION remove_proc(void)
{
remove_proc_entry(DRIVERLNAME, proc_net_isdn_eicon);
remove_proc_entry(main_proc_dir, proc_net_isdn);
remove_proc_entry(DRIVERLNAME, proc_net_isdn_eicon);
remove_proc_entry(main_proc_dir, proc_net_isdn);
if ((proc_net_isdn) && (!proc_net_isdn->subdir)){
remove_proc_entry(dir_in_proc_net, proc_net);
}
if ((proc_net_isdn) && (!proc_net_isdn->subdir)) {
remove_proc_entry(dir_in_proc_net, proc_net);
}
}
static int DIVA_INIT_FUNCTION
divadidd_init(void)
static int DIVA_INIT_FUNCTION divadidd_init(void)
{
char tmprev[32];
int ret = 0;
MOD_INC_USE_COUNT;
printk(KERN_INFO "%s\n", DRIVERNAME);
printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE);
strcpy(tmprev, main_revision);
printk("%s Build:%s(%s)\n", getrev(tmprev),
diva_didd_common_code_build, DIVA_BUILD);
if (!create_proc()) {
printk(KERN_ERR "%s: could not create proc entry\n", DRIVERLNAME);
ret = -EIO;
goto out;
}
if(!diddfunc_init()) {
printk(KERN_ERR "%s: failed to connect to DIDD.\n", DRIVERLNAME);
remove_proc();
ret = -EIO;
goto out;
}
out:
MOD_DEC_USE_COUNT;
return (ret);
char tmprev[32];
int ret = 0;
MOD_INC_USE_COUNT;
printk(KERN_INFO "%s\n", DRIVERNAME);
printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE);
strcpy(tmprev, main_revision);
printk("%s Build:%s(%s)\n", getrev(tmprev),
diva_didd_common_code_build, DIVA_BUILD);
if (!create_proc()) {
printk(KERN_ERR "%s: could not create proc entry\n",
DRIVERLNAME);
ret = -EIO;
goto out;
}
if (!diddfunc_init()) {
printk(KERN_ERR "%s: failed to connect to DIDD.\n",
DRIVERLNAME);
remove_proc();
ret = -EIO;
goto out;
}
out:
MOD_DEC_USE_COUNT;
return (ret);
}
void DIVA_EXIT_FUNCTION
divadidd_exit(void)
void DIVA_EXIT_FUNCTION divadidd_exit(void)
{
diddfunc_finit();
remove_proc();
printk(KERN_INFO "%s: module unloaded.\n", DRIVERLNAME);
diddfunc_finit();
remove_proc();
printk(KERN_INFO "%s: module unloaded.\n", DRIVERLNAME);
}
module_init(divadidd_init);
module_exit(divadidd_exit);
/* $Id: diva_pci.h,v 1.1.2.2 2002/10/02 14:38:37 armin Exp $ */
/* $Id: diva_pci.h,v 1.1.2.2 2001/02/12 20:23:46 armin Exp $ */
#ifndef __DIVA_PCI_INTERFACE_H__
#define __DIVA_PCI_INTERFACE_H__
void* divasa_remap_pci_bar (unsigned long bar,
unsigned long area_length);
void divasa_unmap_pci_bar (void* bar);
unsigned long divasa_get_pci_irq (unsigned char bus,
unsigned char func,
void* pci_dev_handle);
unsigned long divasa_get_pci_bar (unsigned char bus,
unsigned char func,
int bar,
void* pci_dev_handle);
byte diva_os_get_pci_bus (void* pci_dev_handle);
byte diva_os_get_pci_func (void* pci_dev_handle);
void *divasa_remap_pci_bar(unsigned long bar, unsigned long area_length);
void divasa_unmap_pci_bar(void *bar);
unsigned long divasa_get_pci_irq(unsigned char bus,
unsigned char func, void *pci_dev_handle);
unsigned long divasa_get_pci_bar(unsigned char bus,
unsigned char func,
int bar, void *pci_dev_handle);
byte diva_os_get_pci_bus(void *pci_dev_handle);
byte diva_os_get_pci_func(void *pci_dev_handle);
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* $Id: dlist.c,v 1.1.2.2 2002/10/02 14:38:37 armin Exp $ */
/* $Id: dlist.c,v 1.1.2.2 2001/02/11 14:40:41 armin Exp $ */
#include "platform.h"
#include "dlist.h"
......@@ -7,102 +7,92 @@
** Initialize linked list
*/
void
diva_q_init (diva_entity_queue_t* q)
void diva_q_init(diva_entity_queue_t * q)
{
memset (q, 0x00, sizeof(*q));
memset(q, 0x00, sizeof(*q));
}
/*
** Remove element from linked list
*/
void
diva_q_remove (diva_entity_queue_t* q, diva_entity_link_t* what)
void diva_q_remove(diva_entity_queue_t * q, diva_entity_link_t * what)
{
if(!what->prev) {
if ((q->head = what->next)) {
q->head->prev = 0;
} else {
q->tail = 0;
}
} else if (!what->next) {
q->tail = what->prev;
q->tail->next = 0;
} else {
what->prev->next = what->next;
what->next->prev = what->prev;
}
what->prev = what->next = 0;
if (!what->prev) {
if ((q->head = what->next)) {
q->head->prev = 0;
} else {
q->tail = 0;
}
} else if (!what->next) {
q->tail = what->prev;
q->tail->next = 0;
} else {
what->prev->next = what->next;
what->next->prev = what->prev;
}
what->prev = what->next = 0;
}
/*
** Add element to the tail of linked list
*/
void
diva_q_add_tail (diva_entity_queue_t* q, diva_entity_link_t* what)
void diva_q_add_tail(diva_entity_queue_t * q, diva_entity_link_t * what)
{
what->next = 0;
if (!q->head) {
what->prev = 0;
q->head = q->tail = what;
} else {
what->prev = q->tail;
q->tail->next = what;
q->tail = what;
}
what->next = 0;
if (!q->head) {
what->prev = 0;
q->head = q->tail = what;
} else {
what->prev = q->tail;
q->tail->next = what;
q->tail = what;
}
}
diva_entity_link_t*
diva_q_find (const diva_entity_queue_t* q, const void* what,
diva_q_cmp_fn_t cmp_fn)
diva_entity_link_t *diva_q_find(const diva_entity_queue_t * q,
const void *what, diva_q_cmp_fn_t cmp_fn)
{
diva_entity_link_t* diva_current = q->head;
diva_entity_link_t *diva_current = q->head;
while (diva_current) {
if (!(*cmp_fn)(what, diva_current)) {
break;
}
diva_current = diva_current->next;
}
while (diva_current) {
if (!(*cmp_fn) (what, diva_current)) {
break;
}
diva_current = diva_current->next;
}
return (diva_current);
return (diva_current);
}
diva_entity_link_t*
diva_q_get_head (diva_entity_queue_t* q)
diva_entity_link_t *diva_q_get_head(diva_entity_queue_t * q)
{
return (q->head);
return (q->head);
}
diva_entity_link_t*
diva_q_get_tail (diva_entity_queue_t* q)
diva_entity_link_t *diva_q_get_tail(diva_entity_queue_t * q)
{
return (q->tail);
return (q->tail);
}
diva_entity_link_t*
diva_q_get_next (diva_entity_link_t* what)
diva_entity_link_t *diva_q_get_next(diva_entity_link_t * what)
{
return ((what) ? what->next : 0);
return ((what) ? what->next : 0);
}
diva_entity_link_t*
diva_q_get_prev (diva_entity_link_t* what)
diva_entity_link_t *diva_q_get_prev(diva_entity_link_t * what)
{
return ((what) ? what->prev : 0);
return ((what) ? what->prev : 0);
}
int
diva_q_get_nr_of_entries (const diva_entity_queue_t* q)
int diva_q_get_nr_of_entries(const diva_entity_queue_t * q)
{
int i = 0;
const diva_entity_link_t* diva_current = q->head;
int i = 0;
const diva_entity_link_t *diva_current = q->head;
while (diva_current) {
i++;
diva_current = diva_current->next;
}
while (diva_current) {
i++;
diva_current = diva_current->next;
}
return (i);
return (i);
}
/* $Id: dlist.h,v 1.1.2.2 2002/10/02 14:38:37 armin Exp $ */
/* $Id: dlist.h,v 1.1.2.2 2001/02/08 12:25:43 armin Exp $ */
#ifndef __DIVA_LINK_H__
#define __DIVA_LINK_H__
struct _diva_entity_link;
typedef struct _diva_entity_link {
struct _diva_entity_link* prev;
struct _diva_entity_link* next;
struct _diva_entity_link *prev;
struct _diva_entity_link *next;
} diva_entity_link_t;
typedef struct _diva_entity_queue {
diva_entity_link_t* head;
diva_entity_link_t* tail;
diva_entity_link_t *head;
diva_entity_link_t *tail;
} diva_entity_queue_t;
typedef int (*diva_q_cmp_fn_t)(const void* what,
const diva_entity_link_t*);
typedef int (*diva_q_cmp_fn_t) (const void *what,
const diva_entity_link_t *);
void diva_q_remove (diva_entity_queue_t* q, diva_entity_link_t* what);
void diva_q_add_tail (diva_entity_queue_t* q, diva_entity_link_t* what);
diva_entity_link_t* diva_q_find (const diva_entity_queue_t* q,
const void* what, diva_q_cmp_fn_t cmp_fn);
void diva_q_remove(diva_entity_queue_t * q, diva_entity_link_t * what);
void diva_q_add_tail(diva_entity_queue_t * q, diva_entity_link_t * what);
diva_entity_link_t *diva_q_find(const diva_entity_queue_t * q,
const void *what, diva_q_cmp_fn_t cmp_fn);
diva_entity_link_t* diva_q_get_head (diva_entity_queue_t* q);
diva_entity_link_t* diva_q_get_tail (diva_entity_queue_t* q);
diva_entity_link_t* diva_q_get_next (diva_entity_link_t* what);
diva_entity_link_t* diva_q_get_prev (diva_entity_link_t* what);
int diva_q_get_nr_of_entries (const diva_entity_queue_t* q);
void diva_q_init (diva_entity_queue_t* q);
diva_entity_link_t *diva_q_get_head(diva_entity_queue_t * q);
diva_entity_link_t *diva_q_get_tail(diva_entity_queue_t * q);
diva_entity_link_t *diva_q_get_next(diva_entity_link_t * what);
diva_entity_link_t *diva_q_get_prev(diva_entity_link_t * what);
int diva_q_get_nr_of_entries(const diva_entity_queue_t * q);
void diva_q_init(diva_entity_queue_t * q);
#endif
This diff is collapsed.
/* $Id: dqueue.h,v 1.1.2.2 2002/10/02 14:38:37 armin Exp $ */
/* $Id: dqueue.h,v 1.1.2.2 2001/02/08 12:25:43 armin Exp $ */
#ifndef _DIVA_USER_MODE_IDI_DATA_QUEUE_H__
#define _DIVA_USER_MODE_IDI_DATA_QUEUE_H__
#define DIVA_UM_IDI_MAX_MSGS 64
#define DIVA_UM_IDI_MAX_MSGS 64
typedef struct _diva_um_idi_data_queue {
int segments;
int max_length;
int read;
int write;
int count;
int segment_pending;
void* data[DIVA_UM_IDI_MAX_MSGS];
int length[DIVA_UM_IDI_MAX_MSGS];
int segments;
int max_length;
int read;
int write;
int count;
int segment_pending;
void *data[DIVA_UM_IDI_MAX_MSGS];
int length[DIVA_UM_IDI_MAX_MSGS];
} diva_um_idi_data_queue_t;
int diva_data_q_init(diva_um_idi_data_queue_t* q,
int max_length,
int max_segments);
int diva_data_q_finit(diva_um_idi_data_queue_t* q);
int diva_data_q_get_max_length (const diva_um_idi_data_queue_t* q);
void* diva_data_q_get_segment4write (diva_um_idi_data_queue_t* q);
void diva_data_q_ack_segment4write (diva_um_idi_data_queue_t* q, int length);
const void* diva_data_q_get_segment4read (const diva_um_idi_data_queue_t* q);
int diva_data_q_get_segment_length (const diva_um_idi_data_queue_t* q);
void diva_data_q_ack_segment4read (diva_um_idi_data_queue_t* q);
int diva_data_q_init(diva_um_idi_data_queue_t * q,
int max_length, int max_segments);
int diva_data_q_finit(diva_um_idi_data_queue_t * q);
int diva_data_q_get_max_length(const diva_um_idi_data_queue_t * q);
void *diva_data_q_get_segment4write(diva_um_idi_data_queue_t * q);
void diva_data_q_ack_segment4write(diva_um_idi_data_queue_t * q,
int length);
const void *diva_data_q_get_segment4read(const diva_um_idi_data_queue_t *
q);
int diva_data_q_get_segment_length(const diva_um_idi_data_queue_t * q);
void diva_data_q_ack_segment4read(diva_um_idi_data_queue_t * q);
#endif
/* $Id: dsp_tst.h,v 1.1.2.2 2002/10/02 14:38:37 armin Exp $ */
/* $Id: dsp_tst.h,v 1.1.2.2 2001/02/08 12:25:43 armin Exp $ */
#ifndef __DIVA_PRI_HOST_TEST_DSPS_H__
#define __DIVA_PRI_HOST_TEST_DSPS_H__
......@@ -18,7 +18,7 @@
#define DSP10_PORT (0x840)
#define DSP11_PORT (0x848)
#define DSP12_PORT (0x850)
#define DSP13_PORT (0x858)
#define DSP13_PORT (0x858)
#define DSP14_PORT (0x860)
#define DSP15_PORT (0x868)
#define DSP16_PORT (0x870)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* $Id: os_4bri.h,v 1.1.2.2 2002/10/02 14:38:38 armin Exp $ */
/* $Id: os_4bri.h,v 1.1.2.2 2001/02/08 12:25:44 armin Exp $ */
#ifndef __DIVA_OS_4_BRI_H__
#define __DIVA_OS_4_BRI_H__
int diva_4bri_init_card (diva_os_xdi_adapter_t* a);
int diva_4bri_init_card(diva_os_xdi_adapter_t * a);
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* $Id: platform.h,v 1.1.2.2 2002/10/02 14:38:38 armin Exp $
/* $Id: platform.h,v 1.1.2.6 2001/05/01 15:48:05 armin Exp $
*
* platform.h
*
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment