Changeset a931b7b in mainline for uspace/drv/nic/ar9271/ar9271.c
- Timestamp:
- 2015-04-13T20:48:33Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cc575ef9
- Parents:
- 053fc2b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/ar9271/ar9271.c
r053fc2b ra931b7b 440 440 uint32_t key[5]; 441 441 uint32_t key_type; 442 uint32_t reg_ptr ;442 uint32_t reg_ptr, mic_reg_ptr; 443 443 void *data_start; 444 444 … … 465 465 if(key_conf->flags & IEEE80211_KEY_FLAG_TYPE_PAIRWISE) { 466 466 reg_ptr = AR9271_KEY_TABLE_STA; 467 mic_reg_ptr = AR9271_KEY_TABLE_MIC_STA; 467 468 } else { 468 469 reg_ptr = AR9271_KEY_TABLE_GRP; 470 mic_reg_ptr = AR9271_KEY_TABLE_MIC_GRP; 469 471 } 470 472 471 if(key_conf->suite == IEEE80211_SECURITY_SUITE_TKIP) { 472 // TODO 473 } else { 474 data_start = (void *) key_conf->data; 475 476 key[0] = uint32_t_le2host( 477 *((uint32_t *) data_start)); 478 key[1] = uint16_t_le2host( 479 *((uint16_t *) (data_start + 4))); 480 key[2] = uint32_t_le2host( 481 *((uint32_t *) (data_start + 6))); 482 key[3] = uint16_t_le2host( 483 *((uint16_t *) (data_start + 10))); 484 key[4] = uint32_t_le2host( 485 *((uint32_t *) (data_start + 12))); 486 487 if(key_conf->suite == IEEE80211_SECURITY_SUITE_WEP40 || 488 key_conf->suite == IEEE80211_SECURITY_SUITE_WEP104) { 489 key[4] &= 0xFF; 490 } 491 492 wmi_reg_write(ar9271->htc_device, reg_ptr + 0, key[0]); 493 wmi_reg_write(ar9271->htc_device, reg_ptr + 4, key[1]); 494 wmi_reg_write(ar9271->htc_device, reg_ptr + 8, key[2]); 495 wmi_reg_write(ar9271->htc_device, reg_ptr + 12, key[3]); 496 wmi_reg_write(ar9271->htc_device, reg_ptr + 16, key[4]); 497 wmi_reg_write(ar9271->htc_device, reg_ptr + 20, 498 key_type); 473 data_start = (void *) key_conf->data; 474 475 key[0] = uint32_t_le2host( 476 *((uint32_t *) data_start)); 477 key[1] = uint16_t_le2host( 478 *((uint16_t *) (data_start + 4))); 479 key[2] = uint32_t_le2host( 480 *((uint32_t *) (data_start + 6))); 481 key[3] = uint16_t_le2host( 482 *((uint16_t *) (data_start + 10))); 483 key[4] = uint32_t_le2host( 484 *((uint32_t *) (data_start + 12))); 485 486 if(key_conf->suite == IEEE80211_SECURITY_SUITE_WEP40 || 487 key_conf->suite == IEEE80211_SECURITY_SUITE_WEP104) { 488 key[4] &= 0xFF; 499 489 } 490 491 wmi_reg_write(ar9271->htc_device, reg_ptr + 0, key[0]); 492 wmi_reg_write(ar9271->htc_device, reg_ptr + 4, key[1]); 493 wmi_reg_write(ar9271->htc_device, reg_ptr + 8, key[2]); 494 wmi_reg_write(ar9271->htc_device, reg_ptr + 12, key[3]); 495 wmi_reg_write(ar9271->htc_device, reg_ptr + 16, key[4]); 496 wmi_reg_write(ar9271->htc_device, reg_ptr + 20, key_type); 500 497 501 498 uint32_t macL, macH; … … 516 513 wmi_reg_write(ar9271->htc_device, reg_ptr + 24, macL); 517 514 wmi_reg_write(ar9271->htc_device, reg_ptr + 28, macH); 515 516 /* Setup MIC keys for TKIP. */ 517 if(key_conf->suite == IEEE80211_SECURITY_SUITE_TKIP) { 518 uint32_t mic[5]; 519 uint8_t *gen_mic = 520 data_start + IEEE80211_TKIP_RX_MIC_OFFSET; 521 uint8_t *tx_mic; 522 if(key_conf->flags & IEEE80211_KEY_FLAG_TYPE_GROUP) { 523 tx_mic = gen_mic; 524 } else { 525 tx_mic = data_start + 526 IEEE80211_TKIP_TX_MIC_OFFSET; 527 } 528 529 mic[0] = uint32_t_le2host( 530 *((uint32_t *) gen_mic)); 531 mic[1] = uint16_t_le2host( 532 *((uint16_t *) (tx_mic + 2))) & 0xFFFF; 533 mic[2] = uint32_t_le2host( 534 *((uint32_t *) (gen_mic + 4))); 535 mic[3] = uint16_t_le2host( 536 *((uint16_t *) tx_mic)) & 0xFFFF; 537 mic[4] = uint32_t_le2host( 538 *((uint32_t *) (tx_mic + 4))); 539 540 wmi_reg_write(ar9271->htc_device, mic_reg_ptr + 0, 541 mic[0]); 542 wmi_reg_write(ar9271->htc_device, mic_reg_ptr + 4, 543 mic[1]); 544 wmi_reg_write(ar9271->htc_device, mic_reg_ptr + 8, 545 mic[2]); 546 wmi_reg_write(ar9271->htc_device, mic_reg_ptr + 12, 547 mic[3]); 548 wmi_reg_write(ar9271->htc_device, mic_reg_ptr + 16, 549 mic[4]); 550 wmi_reg_write(ar9271->htc_device, mic_reg_ptr + 20, 551 AR9271_KEY_TABLE_TYPE_CLR); 552 553 wmi_reg_write(ar9271->htc_device, mic_reg_ptr + 24, 0); 554 wmi_reg_write(ar9271->htc_device, mic_reg_ptr + 28, 0); 555 } 518 556 519 557 if(key_conf->flags & IEEE80211_KEY_FLAG_TYPE_GROUP)
Note:
See TracChangeset
for help on using the changeset viewer.