mirror of
https://github.com/apache/nuttx.git
synced 2026-06-08 01:42:58 +08:00
wireless/bluetooth: add interrupt_context hander for netsnoop
Signed-off-by: chengkai <chengkai@xiaomi.com>
This commit is contained in:
@@ -27,6 +27,9 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <nuttx/mutex.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
@@ -81,11 +84,18 @@
|
||||
#define SNOOP_DIRECTION_FLAG_SENT 0 /* Direction flag 0 = Sent */
|
||||
#define SNOOP_DIRECTION_FLAG_RECV 1 /* Direction flag 1 = Received */
|
||||
|
||||
#ifndef CONFIG_NET_SNOOP_BUFSIZE
|
||||
# define CONFIG_NET_SNOOP_BUFSIZE 4096
|
||||
#endif
|
||||
struct snoop_s
|
||||
{
|
||||
bool autosync;
|
||||
uint32_t datalink;
|
||||
struct file filep;
|
||||
bool autosync;
|
||||
uint32_t datalink;
|
||||
struct file filep;
|
||||
mutex_t mutex;
|
||||
struct work_s work;
|
||||
uint8_t buf[CONFIG_NET_SNOOP_BUFSIZE];
|
||||
size_t next;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@@ -106,6 +116,17 @@ extern "C"
|
||||
* Description:
|
||||
* This function open snoop file by datalink.
|
||||
*
|
||||
* Input Parameters:
|
||||
* snoop The snoop driver struct
|
||||
* filename Snoop file name
|
||||
* datalink Snoop datalink type, such as SNOOP_DATALINK_TYPE_XX
|
||||
* autosync whether do file_sync when snoop_dump
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success; Negated errno on failure.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int snoop_open(FAR struct snoop_s *snoop, FAR const char *filename,
|
||||
@@ -117,6 +138,18 @@ int snoop_open(FAR struct snoop_s *snoop, FAR const char *filename,
|
||||
* Description:
|
||||
* This function dump nbytes buf data into snoop file.
|
||||
*
|
||||
* Input Parameters:
|
||||
* snoop The snoop driver struct
|
||||
* buf Snoop buffer
|
||||
* nbytes Snoop buffer size
|
||||
* drops cumulative number of dropped packets
|
||||
* flags Packet Flags: 1 hci cmd , eg: btsnoop
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success; Negated errno on failure.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int snoop_dump(FAR struct snoop_s *snoop, FAR const void *buf,
|
||||
@@ -128,6 +161,14 @@ int snoop_dump(FAR struct snoop_s *snoop, FAR const void *buf,
|
||||
* Description:
|
||||
* This function sync snoop buffer.
|
||||
*
|
||||
* Input Parameters:
|
||||
* snoop The snoop driver struct
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success; Negated errno on failure.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int snoop_sync(FAR struct snoop_s *snoop);
|
||||
@@ -138,6 +179,14 @@ int snoop_sync(FAR struct snoop_s *snoop);
|
||||
* Description:
|
||||
* This function close snoop file.
|
||||
*
|
||||
* Input Parameters:
|
||||
* snoop The snoop driver struct
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success; Negated errno on failure.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int snoop_close(FAR struct snoop_s *snoop);
|
||||
|
||||
Reference in New Issue
Block a user