diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-05-03 23:06:02 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-05-03 23:06:02 +0000 |
commit | 2dd60aaf18e98b0e9d3c06bd9dce5f1128fa55ad (patch) | |
tree | 1a1cd28888f191e6ce83bcbbe539124e2529c90b /xpp/slic.c | |
parent | 8c4db4e3acd9a7626e709af0494055487b589719 (diff) |
xpp driver release 1.1.0 (first part of commit)
* FPGA firmware now loaded from PC (for newer models)
* Driver for the FXO module
* Moved most userspace files to the subdirectory utils (see also next commit)
* Explicit license for firmware files
* Optionally avoid auto-registration
* Initializations parameters to chips given from userspace
* And did I mention bugfixes?
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1021 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/slic.c')
-rw-r--r-- | xpp/slic.c | 49 |
1 files changed, 48 insertions, 1 deletions
@@ -1,6 +1,6 @@ /* * Written by Oron Peled <oron@actcom.co.il> - * Copyright (C) 2004-2005, Xorcom + * Copyright (C) 2004-2006, Xorcom * * All rights reserved. * @@ -30,6 +30,9 @@ static const char rcsid[] = "$Id$"; extern int print_dbg; #include "zap_debug.h" + +DEF_PARM(charp,initialize_registers, "/usr/share/zaptel/initialize_registers", "The script to initialize detected cards slics"); + #else #include <stdio.h> #endif @@ -120,6 +123,50 @@ void dump_slic_cmd(const char msg[], slic_cmd_t *sc) #ifdef __KERNEL__ +#define MAX_ENV_STR 20 + +int run_initialize_registers(xpd_t *xpd) +{ + int ret; + xbus_t *xbus; + char busstr[MAX_ENV_STR]; + char xpdstr[MAX_ENV_STR]; + char typestr[MAX_ENV_STR]; + char revstr[MAX_ENV_STR]; + char *argv[] = { + initialize_registers, + NULL + }; + char *envp[] = { + busstr, + xpdstr, + typestr, + revstr, + NULL + }; + + BUG_ON(!xpd); + xbus = xpd->xbus; + if(!initialize_registers || !initialize_registers[0]) { + NOTICE("%s/%s: No runtime register initialization\n", xbus->busname, xpd->xpdname); + return 0; + } + DBG("%s/%s: running: '%s'\n", xbus->busname, xpd->xpdname, initialize_registers); + snprintf(busstr, MAX_ENV_STR, "XPD_BUS=%s", xbus->busname); + snprintf(xpdstr, MAX_ENV_STR, "XPD_NAME=%s", xpd->xpdname); + snprintf(typestr, MAX_ENV_STR, "XPD_TYPE=%d", xpd->type); + snprintf(revstr, MAX_ENV_STR, "XPD_REVISION=%d", xpd->revision); + DBG("%s/%s: type=%d revision=%d\n", xbus->busname, xpd->xpdname, xpd->type, xpd->revision); + ret = call_usermodehelper(initialize_registers, argv, envp, 1); + if(ret != 0) { + ERR("%s/%s: Failed running '%s' (errno %d, sig=%d)\n", + xbus->busname, xpd->xpdname, initialize_registers, + ((unsigned)ret >> 8) & 0xFF, ret & 0xFF); + ret = -EFAULT; + } + return ret; +} + EXPORT_SYMBOL(slic_cmd_direct_write); EXPORT_SYMBOL(slic_cmd_direct_read); EXPORT_SYMBOL(slic_cmd_indirect_write); |