首页 > 技术知识 > 正文

ATBM6441 SDK修改:

1,初始化GPIO,并设置为中断。

2,中断触发唤醒,

wakeup_host_reason = WAKEUP_TYPE_PIR; //WAKEUP_TYPE_CONNECT

HI_WakeupBT_Process(Wakeup_Gpio_Data_Get(),0);

T31则WiFi 驱动修改:

Index: hal_apollo/atbm_ioctl_ext.h

===================================================================

— hal_apollo/atbm_ioctl_ext.h (revision 1850)

+++ hal_apollo/atbm_ioctl_ext.h (revision 1851)

@@ -1,7 +1,7 @@

#ifndef ATBM_IOCTL_EXT_H

#define ATBM_IOCTL_EXT_H

-#define PRIV_VERSION  “2020-1125-1825”

+#define PRIV_VERSION  “2020-1208-1347”

#define ATBM_IOCTL          (121)

Index: hal_apollo/main.c

===================================================================

— hal_apollo/main.c (revision 1850)

+++ hal_apollo/main.c (revision 1851)

@@ -144,7 +144,8 @@

mutex_lock(&hw_priv->conf_mutex);

list_for_each_entry(event, &list, link) {

if ((event->evt.eventId != WSM_EVENT_HOST_RMMOD)

– && (event->evt.eventId != WSM_EVENT_HOST_INSMOD)){

+ && (event->evt.eventId != WSM_EVENT_HOST_INSMOD)

+ && (event->evt.eventId != WSM_EVENT_HOST_WAKEUP_REASON)){

priv = __ABwifi_hwpriv_to_vifpriv(hw_priv, event->if_id);

if (!priv) {

printk( “[CQM] Event for non existing interface, ignoring.\n”);

@@ -219,6 +220,12 @@

atbm_ioctl_driver_async(1);

break;

}

+ case WSM_EVENT_HOST_WAKEUP_REASON:

+ {

+ u8 reason = *((u8 *)event->evt.buffer);

+ atbm_ioctl_wakeup_async(reason);

+ break;

+ }

}

}

mutex_unlock(&hw_priv->conf_mutex);

Index: hal_apollo/wsm.c

===================================================================

— hal_apollo/wsm.c (revision 1850)

+++ hal_apollo/wsm.c (revision 1851)

@@ -208,7 +208,8 @@

eventid=__le32_to_cpu(WSM_GET32(buf));

if ((eventid != WSM_EVENT_HOST_RMMOD)

– && (eventid != WSM_EVENT_HOST_INSMOD)){

+ && (eventid != WSM_EVENT_HOST_INSMOD)

+ && (eventid != WSM_EVENT_HOST_WAKEUP_REASON)){

priv = ABwifi_hwpriv_to_vifpriv(hw_priv, interface_link_id);

if (unlikely(!priv)) {

Index: hal_apollo/wsm.h

===================================================================

— hal_apollo/wsm.h (revision 1850)

+++ hal_apollo/wsm.h (revision 1851)

@@ -422,6 +422,9 @@

/*HOST insmod*/

#define WSM_EVENT_HOST_INSMOD (11)

+/*HOST wakeup reason*/

+#define WSM_EVENT_HOST_WAKEUP_REASON (12)

+

/* MAC Addr Filter */

#define WSM_MIB_ID_MAC_ADDR_FILTER 0x1030

Index: hal_apollo/atbm_ioctl.c

===================================================================

— hal_apollo/atbm_ioctl.c (revision 1850)

+++ hal_apollo/atbm_ioctl.c (revision 1851)

@@ -24,7 +24,7 @@

struct status_async{

u8 is_connected;

– u8 type; /* 0: connect msg, 1: driver msg, 2:scan complete*/

+ u8 type; /* 0: connect msg, 1: driver msg, 2:scan complete, 3:wakeup host reason*/

u8 driver_mode; /* 0: rmmod, 1: insmod*/

u8 reserved[1];

struct HostConnectEvent event;

@@ -70,6 +70,13 @@

kill_fasync (&connect_async, SIGIO, POLL_IN);

}

+void atbm_ioctl_wakeup_async(int reason)

+{

+ status.type = 3;

+ status.driver_mode = reason;

+ kill_fasync (&connect_async, SIGIO, POLL_IN);

+}

+

static int atbm_wsm_ps(struct atbm_common *hw_priv, unsigned int data)

{

int ret = 0;

Index: hal_apollo/atbm_ioctl.h

===================================================================

— hal_apollo/atbm_ioctl.h (revision 1850)

+++ hal_apollo/atbm_ioctl.h (revision 1851)

@@ -14,6 +14,7 @@

void atbm_ioctl_connect_async(struct HostConnectEvent *event, char is_connected);

void atbm_ioctl_driver_async(int insmod);

+void atbm_ioctl_wakeup_async(int reason);

int atbm_ioctl_add(void);

void atbm_ioctl_free(void);

Index: tools/atbm_tool.h

===================================================================

— tools/atbm_tool.h (revision 1850)

+++ tools/atbm_tool.h (revision 1851)

@@ -269,7 +269,7 @@

struct status_async{

u8 is_connected;

– u8 type; /*0: connect msg; 1: rmmod; 2: scan complete*/

+ u8 type; /*0: connect msg; 1: rmmod; 2: scan complet, 3:wakeup host reasone*/

u8 driver_mode; /* 0: rmmod, 1: insmod*/

u8 reserved[1];

struct HostConnectEvent event;

@@ -351,6 +351,12 @@

CHECK_MAX

}check_type;

+enum{

+ WAKEUP_IO,

+ WAKEUP_NETWORK,

+ WAKEUP_CONNECT,

+ WAKEUP_KEEPALIVE

+};

#endif /* ATBM_TOOL_H */

Index: tools/tools.c

===================================================================

— tools/tools.c (revision 1850)

+++ tools/tools.c (revision 1851)

@@ -2290,6 +2290,26 @@

printf(“Scan Completed…\n”);

printf(“CTRL-EVENT-SCAN-RESULTS\n”);

}

+ else if (status.type == 3)

+ {

+ switch (status.driver_mode){

+ case WAKEUP_IO:

+ printf(“IO wakeup\n”);

+ break;

+ case WAKEUP_NETWORK:

+ printf(“NETWORK wakeup\n”);

+ break;

+ case WAKEUP_CONNECT:

+ printf(“AP RECONNECT wakeup\n”);

+ break;

+ case WAKEUP_KEEPALIVE:

+ printf(“KEEPALIVE wakeup\n”);

+ break;

+ default:

+ printf(“UNKNOWN wakeup\n”);

+ break;

+ }

+ }

}

sem_post(&sem_status);

猜你喜欢