Lines 25-30
Link Here
|
25 |
// Wayne Peart - Our Globespan FAE |
25 |
// Wayne Peart - Our Globespan FAE |
26 |
// Charles Michael Heard - CRC-10 routine |
26 |
// Charles Michael Heard - CRC-10 routine |
27 |
|
27 |
|
|
|
28 |
/* |
29 |
This program is free software: you can redistribute it and/or modify |
30 |
it under the terms of the GNU General Public License as published by |
31 |
the Free Software Foundation, either version 3 of the License, or |
32 |
(at your option) any later version. |
33 |
|
34 |
This program is distributed in the hope that it will be useful, |
35 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
36 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
37 |
GNU General Public License for more details. |
38 |
|
39 |
You should have received a copy of the GNU General Public License |
40 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
41 |
|
42 |
*/ |
28 |
|
43 |
|
29 |
#include <linux/version.h> |
44 |
#include <linux/version.h> |
30 |
|
45 |
|
Lines 339-345
Link Here
|
339 |
// PDEBUG("%X ",(unsigned int)oam_cell[i]); |
354 |
// PDEBUG("%X ",(unsigned int)oam_cell[i]); |
340 |
// } |
355 |
// } |
341 |
//#endif |
356 |
//#endif |
342 |
PDEBUG("oam_cell at address: %X\n", (unsigned int)oam_cell); |
357 |
// PDEBUG("oam_cell at address: %X\n", (unsigned int)oam_cell); |
343 |
|
358 |
|
344 |
size = ATM_CELL_SIZE-1; //52 bytes |
359 |
size = ATM_CELL_SIZE-1; //52 bytes |
345 |
if (size > MAX_TX_DMA) |
360 |
if (size > MAX_TX_DMA) |
Lines 348-354
Link Here
|
348 |
printk(KERN_WARNING "%s: Tx DMA truncated\n", name); |
363 |
printk(KERN_WARNING "%s: Tx DMA truncated\n", name); |
349 |
} |
364 |
} |
350 |
#ifdef DEBUG |
365 |
#ifdef DEBUG |
351 |
PDEBUG("oam_cell at address: %x\n", (unsigned int)oam_cell); |
366 |
// PDEBUG("oam_cell at address: %x\n", (unsigned int)oam_cell); |
352 |
#endif |
367 |
#endif |
353 |
spin_lock(&oam_lock); |
368 |
spin_lock(&oam_lock); |
354 |
memcpy(txb, oam_cell, size); |
369 |
memcpy(txb, oam_cell, size); |
Lines 356-362
Link Here
|
356 |
oam_cell = NULL; |
371 |
oam_cell = NULL; |
357 |
spin_unlock(&oam_lock); |
372 |
spin_unlock(&oam_lock); |
358 |
#ifdef DEBUG |
373 |
#ifdef DEBUG |
359 |
PDEBUG("oam_cell at address: %X\n", (unsigned int)oam_cell); |
374 |
// PDEBUG("oam_cell at address: %X\n", (unsigned int)oam_cell); |
360 |
#endif |
375 |
#endif |
361 |
// todo check for left overs |
376 |
// todo check for left overs |
362 |
cell_ptr = (u32)txb; |
377 |
cell_ptr = (u32)txb; |
Lines 548-554
Link Here
|
548 |
} |
563 |
} |
549 |
else { |
564 |
else { |
550 |
#ifdef DEBUG |
565 |
#ifdef DEBUG |
551 |
PDEBUG("oam_cell not NULL!\n"); |
566 |
// PDEBUG("oam_cell not NULL!\n"); |
552 |
PDEBUG("Skipped memcpy\n"); |
567 |
PDEBUG("Skipped memcpy\n"); |
553 |
#endif |
568 |
#endif |
554 |
} |
569 |
} |
Lines 950-956
Link Here
|
950 |
} |
965 |
} |
951 |
|
966 |
|
952 |
memset(pmodem, 0, sizeof(MODEM_PTR)); |
967 |
memset(pmodem, 0, sizeof(MODEM_PTR)); |
953 |
PDEBUG("oam_cell points to %p\n", oam_cell); |
968 |
// PDEBUG("oam_cell points to %p\n", oam_cell); |
954 |
|
969 |
|
955 |
sprintf(name, "%s%d", PTAG, index); |
970 |
sprintf(name, "%s%d", PTAG, index); |
956 |
|
971 |
|
Lines 1094-1112
Link Here
|
1094 |
|
1109 |
|
1095 |
/* Get MAC address */ // XXX: Todo |
1110 |
/* Get MAC address */ // XXX: Todo |
1096 |
|
1111 |
|
1097 |
/* Start training modem */ |
|
|
1098 |
|
1099 |
/* Create /proc/pulsar/pulsarX */ |
1112 |
/* Create /proc/pulsar/pulsarX */ |
1100 |
sprintf(proc_name, "driver/pulsar/pulsar%d", dev_number); |
1113 |
sprintf(proc_name, "driver/pulsar/pulsar%d", dev_number); |
1101 |
pulsar_proc = create_proc_read_entry(proc_name, 0, NULL,pulsar_read_procmem,NULL); |
1114 |
pulsar_dir = proc_mkdir("driver/pulsar", NULL); |
1102 |
if (pulsar_proc == NULL){ //failed to create proc file, therefore directory /proc/driver/pulsar doesn't exist |
1115 |
if (pulsar_dir) { |
1103 |
pulsar_dir = proc_mkdir("driver/pulsar", NULL); //create the missing directory |
1116 |
pulsar_proc = create_proc_read_entry(proc_name, 0, NULL, pulsar_read_procmem, NULL); |
1104 |
pulsar_proc = create_proc_read_entry(proc_name, 0, NULL,pulsar_read_procmem,NULL); //try to create file again |
1117 |
if (!pulsar_proc) |
1105 |
} |
1118 |
remove_proc_entry("driver/pulsar",NULL); |
1106 |
if ((pulsar_proc == NULL) && (pulsar_dir != NULL)){ |
|
|
1107 |
remove_proc_entry("driver/pulsar",NULL); //still failed, so give up and remove directory. |
1108 |
} |
1119 |
} |
1109 |
|
1120 |
|
|
|
1121 |
/* Start training modem */ |
1110 |
start_training(pmodem); |
1122 |
start_training(pmodem); |
1111 |
err = 0; |
1123 |
err = 0; |
1112 |
goto pulsar_init_exit; |
1124 |
goto pulsar_init_exit; |
Lines 1128-1133
Link Here
|
1128 |
pci_disable_device(pci_dev); |
1140 |
pci_disable_device(pci_dev); |
1129 |
pulsar_init_exit_free: |
1141 |
pulsar_init_exit_free: |
1130 |
pci_set_drvdata(pci_dev, NULL); |
1142 |
pci_set_drvdata(pci_dev, NULL); |
|
|
1143 |
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) |
1144 |
pci_dev_put(pci_dev); |
1145 |
#endif |
1131 |
kfree(txb); |
1146 |
kfree(txb); |
1132 |
kfree(oam_cell); |
1147 |
kfree(oam_cell); |
1133 |
kfree(pmodem->handle); |
1148 |
kfree(pmodem->handle); |
Lines 1175-1180
Link Here
|
1175 |
#endif |
1190 |
#endif |
1176 |
pci_disable_device(pci_dev); |
1191 |
pci_disable_device(pci_dev); |
1177 |
|
1192 |
|
|
|
1193 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) |
1194 |
pci_dev_put(pci_dev); |
1195 |
#endif |
1196 |
|
1178 |
//sarlib_close(vcc_list); |
1197 |
//sarlib_close(vcc_list); |
1179 |
|
1198 |
|
1180 |
/* Remove /proc/driver/pulsar/pulsarX */ |
1199 |
/* Remove /proc/driver/pulsar/pulsarX */ |
Lines 1191-1202
Link Here
|
1191 |
PDEBUG("May Crash Here\n"); |
1210 |
PDEBUG("May Crash Here\n"); |
1192 |
kfree(txb); |
1211 |
kfree(txb); |
1193 |
kfree(oam_cell); |
1212 |
kfree(oam_cell); |
1194 |
PDEBUG("Freed oam_cell\n"); |
1213 |
// PDEBUG("Freed oam_cell\n"); |
1195 |
PDEBUG("oam_cell = %p\n",oam_cell); |
1214 |
// PDEBUG("oam_cell = %p\n",oam_cell); |
1196 |
|
1215 |
|
1197 |
kfree(pmodem->handle); |
1216 |
kfree(pmodem->handle); |
1198 |
kfree(pmodem); |
1217 |
kfree(pmodem); |
1199 |
|
|
|
1200 |
} |
1218 |
} |
1201 |
|
1219 |
|
1202 |
#ifdef PULSAR_NEWPCISTYLE |
1220 |
#ifdef PULSAR_NEWPCISTYLE |
Lines 1230-1249
Link Here
|
1230 |
|
1248 |
|
1231 |
printk(KERN_INFO "%s: PCI ADSL ATM Driver %s Lib %s loaded\n", PTAG, VERSION, getlibver()); |
1249 |
printk(KERN_INFO "%s: PCI ADSL ATM Driver %s Lib %s loaded\n", PTAG, VERSION, getlibver()); |
1232 |
|
1250 |
|
|
|
1251 |
printk(KERN_INFO "%s: Searching for card %d\n", PTAG, dev_number); |
1252 |
|
1253 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) |
1254 |
while ((pci_dev = pci_get_device(VID, DID, pci_dev)) != NULL) { |
1255 |
#else |
1233 |
while ((pci_dev = pci_find_device(VID, DID, pci_dev)) != NULL) { |
1256 |
while ((pci_dev = pci_find_device(VID, DID, pci_dev)) != NULL) { |
|
|
1257 |
#endif |
1234 |
if (dev_found == dev_number) // we've found the one were looking for |
1258 |
if (dev_found == dev_number) // we've found the one were looking for |
1235 |
break; |
1259 |
return pulsar_init_one(pci_dev, NULL); |
|
|
1260 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) |
1261 |
pci_dev_put(pci_dev); |
1262 |
#endif |
1236 |
dev_found++; |
1263 |
dev_found++; |
1237 |
} |
1264 |
} |
1238 |
|
1265 |
|
1239 |
printk(KERN_DEBUG "%s: dev_found = %d, dev_number = %d\n", PTAG, dev_found, dev_number); |
1266 |
printk(KERN_ERR "%s: No card found\n", PTAG); |
1240 |
|
1267 |
return -ENODEV; |
1241 |
if ((pci_dev) && (dev_found == dev_number)) { |
|
|
1242 |
return pulsar_init_one(pci_dev, NULL); |
1243 |
} else { |
1244 |
printk(KERN_ERR "%s: No PCI card found\n", PTAG); |
1245 |
return -ENODEV; |
1246 |
} |
1247 |
#endif |
1268 |
#endif |
1248 |
} |
1269 |
} |
1249 |
|
1270 |
|
Lines 1253-1261
Link Here
|
1253 |
pci_unregister_driver(&pulsar_driver); |
1274 |
pci_unregister_driver(&pulsar_driver); |
1254 |
#else |
1275 |
#else |
1255 |
struct pci_dev *pci_dev = NULL; |
1276 |
struct pci_dev *pci_dev = NULL; |
|
|
1277 |
int dev_found = 0; |
1256 |
|
1278 |
|
1257 |
pci_dev = pci_find_device(VID, DID, pci_dev); // just one device at the moment |
1279 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) |
1258 |
pulsar_remove_one(pci_dev); |
1280 |
while ((pci_dev = pci_get_device(VID, DID, pci_dev)) != NULL) { |
|
|
1281 |
#else |
1282 |
while ((pci_dev = pci_find_device(VID, DID, pci_dev)) != NULL) { |
1283 |
#endif |
1284 |
if (dev_found == dev_number) |
1285 |
pulsar_remove_one(pci_dev); |
1286 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) |
1287 |
else |
1288 |
pci_dev_put(pci_dev); |
1289 |
#endif |
1290 |
dev_found++; |
1291 |
} |
1259 |
#endif |
1292 |
#endif |
1260 |
printk(KERN_INFO "%s: PCI ADSL ATM Driver %s Lib %s unloaded\n", PTAG, VERSION, getlibver()); |
1293 |
printk(KERN_INFO "%s: PCI ADSL ATM Driver %s Lib %s unloaded\n", PTAG, VERSION, getlibver()); |
1261 |
} |
1294 |
} |