Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/ar9271/hw.c

    rb7fd2a0 r582a0b8  
    4949 *
    5050 * @return EOK if succeed, ETIMEOUT on timeout,
    51  *         error code otherwise.
     51 *         negative error code otherwise.
    5252 *
    5353 */
    54 static errno_t hw_read_wait(ar9271_t *ar9271, uint32_t offset, uint32_t mask,
     54static int hw_read_wait(ar9271_t *ar9271, uint32_t offset, uint32_t mask,
    5555    uint32_t value)
    5656{
     
    6767}
    6868
    69 static errno_t hw_reset_power_on(ar9271_t *ar9271)
     69static int hw_reset_power_on(ar9271_t *ar9271)
    7070{
    7171        wmi_reg_t buffer[] = {
     
    9393        wmi_reg_write(ar9271->htc_device, AR9271_RTC_RESET, 1);
    9494       
    95         errno_t rc = hw_read_wait(ar9271,
     95        int rc = hw_read_wait(ar9271,
    9696            AR9271_RTC_STATUS,
    9797            AR9271_RTC_STATUS_MASK,
     
    105105}
    106106
    107 static errno_t hw_set_reset(ar9271_t *ar9271, bool cold)
     107static int hw_set_reset(ar9271_t *ar9271, bool cold)
    108108{
    109109        uint32_t reset_value = AR9271_RTC_RC_MAC_WARM;
     
    135135        wmi_reg_write(ar9271->htc_device, AR9271_RTC_RC, 0);
    136136       
    137         errno_t rc = hw_read_wait(ar9271, AR9271_RTC_RC, AR9271_RTC_RC_MASK, 0);
     137        int rc = hw_read_wait(ar9271, AR9271_RTC_RC, AR9271_RTC_RC_MASK, 0);
    138138        if (rc != EOK) {
    139139                usb_log_error("Failed to wait for RTC RC register.\n");
     
    148148}
    149149
    150 static errno_t hw_addr_init(ar9271_t *ar9271)
     150static int hw_addr_init(ar9271_t *ar9271)
    151151{
    152152        uint32_t value;
     
    164164        nic_t *nic = nic_get_from_ddf_dev(ar9271->ddf_dev);
    165165       
    166         errno_t rc = nic_report_address(nic, &ar9271_address);
     166        int rc = nic_report_address(nic, &ar9271_address);
    167167        if (rc != EOK) {
    168168                usb_log_error("Failed to report NIC HW address.\n");
     
    173173}
    174174
    175 static errno_t hw_gpio_set_output(ar9271_t *ar9271, uint32_t gpio, uint32_t type)
     175static int hw_gpio_set_output(ar9271_t *ar9271, uint32_t gpio, uint32_t type)
    176176{
    177177        uint32_t address;
     
    204204}
    205205
    206 static errno_t hw_gpio_set_value(ar9271_t *ar9271, uint32_t gpio, uint32_t value)
     206static int hw_gpio_set_value(ar9271_t *ar9271, uint32_t gpio, uint32_t value)
    207207{
    208208        wmi_reg_set_clear_bit(ar9271->htc_device, AR9271_GPIO_IN_OUT,
     
    215215 * @param ar9271 Device structure.
    216216 *
    217  * @return EOK if succeed, error code otherwise.
     217 * @return EOK if succeed, negative error code otherwise.
    218218 *
    219219 */
    220 static errno_t hw_init_proc(ar9271_t *ar9271)
    221 {
    222         errno_t rc = hw_reset_power_on(ar9271);
     220static int hw_init_proc(ar9271_t *ar9271)
     221{
     222        int rc = hw_reset_power_on(ar9271);
    223223        if (rc != EOK) {
    224224                usb_log_error("Failed to HW reset power on.\n");
     
    241241}
    242242
    243 static errno_t hw_init_led(ar9271_t *ar9271)
    244 {
    245         errno_t rc = hw_gpio_set_output(ar9271, AR9271_LED_PIN,
     243static int hw_init_led(ar9271_t *ar9271)
     244{
     245        int rc = hw_gpio_set_output(ar9271, AR9271_LED_PIN,
    246246            AR9271_GPIO_OUT_MUX_AS_OUT);
    247247        if (rc != EOK) {
     
    259259}
    260260
    261 static errno_t hw_activate_phy(ar9271_t *ar9271)
     261static int hw_activate_phy(ar9271_t *ar9271)
    262262{
    263263        wmi_reg_write(ar9271->htc_device, AR9271_PHY_ACTIVE, 1);
     
    267267}
    268268
    269 static errno_t hw_set_operating_mode(ar9271_t *ar9271,
     269static int hw_set_operating_mode(ar9271_t *ar9271,
    270270    ieee80211_operating_mode_t op_mode)
    271271{
     
    295295}
    296296
    297 static errno_t hw_reset_operating_mode(ar9271_t *ar9271)
    298 {
    299         errno_t rc = hw_set_operating_mode(ar9271, IEEE80211_OPMODE_STATION);
     297static int hw_reset_operating_mode(ar9271_t *ar9271)
     298{
     299        int rc = hw_set_operating_mode(ar9271, IEEE80211_OPMODE_STATION);
    300300        if (rc != EOK) {
    301301                usb_log_error("Failed to set opmode to station.\n");
     
    306306}
    307307
    308 static errno_t hw_noise_floor_calibration(ar9271_t *ar9271)
     308static int hw_noise_floor_calibration(ar9271_t *ar9271)
    309309{
    310310        uint32_t value;
     
    325325            AR9271_AGC_CONTROL_NF_CALIB);
    326326       
    327         errno_t rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,
     327        int rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,
    328328            AR9271_AGC_CONTROL_NF_CALIB, 0);
    329329        if (rc != EOK) {
     
    344344}
    345345
    346 static errno_t hw_set_freq(ar9271_t *ar9271, uint16_t freq)
     346static int hw_set_freq(ar9271_t *ar9271, uint16_t freq)
    347347{
    348348        /* Not supported channel frequency. */
     
    373373}
    374374
    375 errno_t hw_freq_switch(ar9271_t *ar9271, uint16_t freq)
     375int hw_freq_switch(ar9271_t *ar9271, uint16_t freq)
    376376{
    377377        wmi_reg_write(ar9271->htc_device, AR9271_PHY_RFBUS_KILL, 0x1);
    378378       
    379         errno_t rc = hw_read_wait(ar9271, AR9271_PHY_RFBUS_GRANT, 0x1, 0x1);
     379        int rc = hw_read_wait(ar9271, AR9271_PHY_RFBUS_GRANT, 0x1, 0x1);
    380380        if (rc != EOK) {
    381381                usb_log_error("Failed to kill RF bus.\n");
     
    407407}
    408408
    409 errno_t hw_set_rx_filter(ar9271_t *ar9271, bool assoc)
     409int hw_set_rx_filter(ar9271_t *ar9271, bool assoc)
    410410{
    411411        uint32_t additional_bits = 0;
     
    425425}
    426426
    427 errno_t hw_set_bssid(ar9271_t *ar9271)
     427int hw_set_bssid(ar9271_t *ar9271)
    428428{
    429429        ieee80211_dev_t *ieee80211_dev = ar9271->ieee80211_dev;
     
    445445}
    446446
    447 errno_t hw_rx_init(ar9271_t *ar9271)
     447int hw_rx_init(ar9271_t *ar9271)
    448448{
    449449        wmi_reg_write(ar9271->htc_device, AR9271_COMMAND,
    450450            AR9271_COMMAND_RX_ENABLE);
    451451       
    452         errno_t rc = hw_set_rx_filter(ar9271, false);
     452        int rc = hw_set_rx_filter(ar9271, false);
    453453        if (rc != EOK) {
    454454                usb_log_error("Failed to set RX filtering.\n");
     
    465465}
    466466
    467 static errno_t hw_init_pll(ar9271_t *ar9271)
     467static int hw_init_pll(ar9271_t *ar9271)
    468468{
    469469        /* Some magic here (set for 2GHz channels). But VERY important :-) */
     
    510510}
    511511
    512 static errno_t hw_calibration(ar9271_t *ar9271)
     512static int hw_calibration(ar9271_t *ar9271)
    513513{
    514514        wmi_reg_set_bit(ar9271->htc_device, AR9271_CARRIER_LEAK_CONTROL,
     
    523523            AR9271_AGC_CONTROL_CALIB);
    524524       
    525         errno_t rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,
     525        int rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,
    526526            AR9271_AGC_CONTROL_CALIB, 0);
    527527        if (rc != EOK) {
     
    540540}
    541541
    542 errno_t hw_reset(ar9271_t *ar9271)
     542int hw_reset(ar9271_t *ar9271)
    543543{
    544544        /* Set physical layer as deactivated. */
     
    559559                hw_set_reset(ar9271, true);
    560560       
    561         errno_t rc = hw_init_pll(ar9271);
     561        int rc = hw_init_pll(ar9271);
    562562        if (rc != EOK) {
    563563                usb_log_error("Failed to init PLL.\n");
     
    636636 * @param ar9271 Device structure.
    637637 *
    638  * @return EOK if succeed, error code otherwise.
     638 * @return EOK if succeed, negative error code otherwise.
    639639 */
    640 errno_t hw_init(ar9271_t *ar9271)
    641 {
    642         errno_t rc = hw_init_proc(ar9271);
     640int hw_init(ar9271_t *ar9271)
     641{
     642        int rc = hw_init_proc(ar9271);
    643643        if (rc != EOK) {
    644644                usb_log_error("Failed to HW reset device.\n");
Note: See TracChangeset for help on using the changeset viewer.