OLD | NEW |
1 /* | 1 //------------------------------------------------------------------------------ |
2 * | 2 // Copyright (c) 2004-2010 Atheros Communications Inc. |
3 * Copyright (c) 2004-2009 Atheros Communications Inc. | 3 // All rights reserved. |
4 * All rights reserved. | |
5 * | |
6 * | |
7 // This program is free software; you can redistribute it and/or modify | |
8 // it under the terms of the GNU General Public License version 2 as | |
9 // published by the Free Software Foundation; | |
10 // | 4 // |
11 // Software distributed under the License is distributed on an "AS | 5 // |
12 // IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | 6 // |
13 // implied. See the License for the specific language governing | 7 // Permission to use, copy, modify, and/or distribute this software for any |
14 // rights and limitations under the License. | 8 // purpose with or without fee is hereby granted, provided that the above |
| 9 // copyright notice and this permission notice appear in all copies. |
| 10 // |
| 11 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 12 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 13 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 14 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 15 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 16 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 17 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 // | 18 // |
16 // | 19 // |
17 * | 20 // |
18 */ | 21 // Author(s): ="Atheros" |
| 22 //------------------------------------------------------------------------------ |
19 | 23 |
20 | 24 |
21 #include "ar6000_drv.h" | 25 #include "ar6000_drv.h" |
22 #include "htc.h" | 26 #include "htc.h" |
23 #include <linux/fs.h> | 27 #include <linux/fs.h> |
24 | 28 |
25 #include "AR6002/hw2.0/hw/gpio_reg.h" | 29 #include "AR6002/hw2.0/hw/gpio_reg.h" |
26 #include "AR6002/hw2.0/hw/si_reg.h" | 30 #include "AR6002/hw2.0/hw/si_reg.h" |
27 | 31 |
28 // | 32 // |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 /* soft mac */ | 64 /* soft mac */ |
61 static int | 65 static int |
62 wmic_ether_aton(const char *orig, A_UINT8 *eth) | 66 wmic_ether_aton(const char *orig, A_UINT8 *eth) |
63 { | 67 { |
64 const char *bufp; | 68 const char *bufp; |
65 int i; | 69 int i; |
66 | 70 |
67 i = 0; | 71 i = 0; |
68 for(bufp = orig; *bufp != '\0'; ++bufp) { | 72 for(bufp = orig; *bufp != '\0'; ++bufp) { |
69 unsigned int val; | 73 unsigned int val; |
70 unsigned char c = *bufp++; | 74 » int h, l; |
71 if (c >= '0' && c <= '9') val = c - '0'; | |
72 else if (c >= 'a' && c <= 'f') val = c - 'a' + 10; | |
73 else if (c >= 'A' && c <= 'F') val = c - 'A' + 10; | |
74 else { | |
75 printk("%s: MAC value is invalid\n", __FUNCTION__); | |
76 break; | |
77 } | |
78 | 75 |
79 val <<= 4; | 76 » h = hex_to_bin(*bufp++); |
80 c = *bufp++; | 77 |
81 if (c >= '0' && c <= '9') val |= c - '0'; | 78 » if (h < 0) { |
82 else if (c >= 'a' && c <= 'f') val |= c - 'a' + 10; | 79 » » printk("%s: MAC value is invalid\n", __FUNCTION__); |
83 else if (c >= 'A' && c <= 'F') val |= c - 'A' + 10; | 80 » » break; |
84 else { | 81 » } |
85 printk("%s: MAC value is invalid\n", __FUNCTION__); | 82 |
86 break; | 83 » l = hex_to_bin(*bufp++); |
87 } | 84 » if (l < 0) { |
| 85 » » printk("%s: MAC value is invalid\n", __FUNCTION__); |
| 86 » » break; |
| 87 » } |
| 88 |
| 89 » val = (h << 4) | l; |
88 | 90 |
89 eth[i] = (unsigned char) (val & 0377); | 91 eth[i] = (unsigned char) (val & 0377); |
90 if(++i == ATH_MAC_LEN) { | 92 if(++i == ATH_MAC_LEN) { |
91 /* That's it. Any trailing junk? */ | 93 /* That's it. Any trailing junk? */ |
92 if (*bufp != '\0') { | 94 if (*bufp != '\0') { |
93 return 0; | 95 return 0; |
94 } | 96 } |
95 return 1; | 97 return 1; |
96 } | 98 } |
97 if (*bufp != ':') | 99 if (*bufp != ':') |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 return; | 393 return; |
392 } | 394 } |
393 | 395 |
394 if (!filp->f_op) { | 396 if (!filp->f_op) { |
395 printk("%s: File Operation Method Error\n", __FUNCTION__); | 397 printk("%s: File Operation Method Error\n", __FUNCTION__); |
396 filp_close(filp, NULL); | 398 filp_close(filp, NULL); |
397 set_fs(oldfs); | 399 set_fs(oldfs); |
398 return; | 400 return; |
399 } | 401 } |
400 | 402 |
401 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) | 403 inode = GET_INODE_FROM_FILEP(filep); |
402 » inode = filp->f_path.dentry->d_inode; | |
403 #else | |
404 » inode = filp->f_dentry->d_inode; | |
405 #endif | |
406 | |
407 if (!inode) { | 404 if (!inode) { |
408 printk("%s: Get inode from filp failed\n", __FUNCTION__); | 405 printk("%s: Get inode from filp failed\n", __FUNCTION__); |
409 filp_close(filp, NULL); | 406 filp_close(filp, NULL); |
410 set_fs(oldfs); | 407 set_fs(oldfs); |
411 return; | 408 return; |
412 } | 409 } |
413 | 410 |
414 printk("%s file offset opsition: %xh\n", __FUNCTION__, (unsigned)filp->f
_pos); | 411 printk("%s file offset opsition: %xh\n", __FUNCTION__, (unsigned)filp->f
_pos); |
415 | 412 |
416 /* file's size */ | 413 /* file's size */ |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 return; | 472 return; |
476 } | 473 } |
477 | 474 |
478 if (!filp->f_op) { | 475 if (!filp->f_op) { |
479 printk("%s: File Operation Method Error\n", __FUNCTION__); | 476 printk("%s: File Operation Method Error\n", __FUNCTION__); |
480 filp_close(filp, NULL); | 477 filp_close(filp, NULL); |
481 set_fs(oldfs); | 478 set_fs(oldfs); |
482 return; | 479 return; |
483 } | 480 } |
484 | 481 |
485 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) | 482 inode = GET_INODE_FROM_FILEP(filep); |
486 » inode = filp->f_path.dentry->d_inode; | |
487 #else | |
488 » inode = filp->f_dentry->d_inode; | |
489 #endif | |
490 if (!inode) { | 483 if (!inode) { |
491 printk("%s: Get inode from filp failed\n", __FUNCTION__); | 484 printk("%s: Get inode from filp failed\n", __FUNCTION__); |
492 filp_close(filp, NULL); | 485 filp_close(filp, NULL); |
493 set_fs(oldfs); | 486 set_fs(oldfs); |
494 return; | 487 return; |
495 } | 488 } |
496 | 489 |
497 printk("%s file offset opsition: %xh\n", __FUNCTION__, (unsigned)filp->f
_pos); | 490 printk("%s file offset opsition: %xh\n", __FUNCTION__, (unsigned)filp->f
_pos); |
498 | 491 |
499 /* file's size */ | 492 /* file's size */ |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 A_UINT32 one = 1; | 565 A_UINT32 one = 1; |
573 BMI_write_mem(HOST_INTEREST_ITEM_ADDRESS(hi_board_data_initialized), | 566 BMI_write_mem(HOST_INTEREST_ITEM_ADDRESS(hi_board_data_initialized), |
574 (A_UINT8 *)&one, sizeof(A_UINT32)); | 567 (A_UINT8 *)&one, sizeof(A_UINT32)); |
575 } | 568 } |
576 | 569 |
577 disable_SI(); | 570 disable_SI(); |
578 } | 571 } |
579 #endif | 572 #endif |
580 /* ATHENV */ | 573 /* ATHENV */ |
581 | 574 |
OLD | NEW |