Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78705a40 authored by Gidon Studinski's avatar Gidon Studinski
Browse files

wigig_sensing: add GET_NUM_AVAIL_BURSTS ioctl



WIGIG_SENSING_IOCTL_GET_NUM_AVAIL_BURSTS returns the number of available
bursts in the drivers buffer.

Change-Id: I474770a817393e1b64831886803d65a3f76d92e0
Signed-off-by: default avatarGidon Studinski <gidons@codeaurora.org>
parent b85c804b
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -629,6 +629,16 @@ static int wigig_sensing_ioc_get_num_dropped_bursts(
	return ctx->dropped_bursts;
	return ctx->dropped_bursts;
}
}


static int wigig_sensing_ioc_get_num_avail_bursts(
	struct wigig_sensing_ctx *ctx)
{
	if (ctx->stm.burst_size)
		return circ_cnt(&ctx->cir_data.b, ctx->cir_data.size_bytes) /
			ctx->stm.burst_size;
	else
		return 0;
}

static int wigig_sensing_ioc_get_event(struct wigig_sensing_ctx *ctx)
static int wigig_sensing_ioc_get_event(struct wigig_sensing_ctx *ctx)
{
{
	return 0;
	return 0;
@@ -814,6 +824,10 @@ static long wigig_sensing_ioctl(struct file *file, unsigned int cmd,
		pr_info("Received WIGIG_SENSING_IOCTL_GET_EVENT command\n");
		pr_info("Received WIGIG_SENSING_IOCTL_GET_EVENT command\n");
		rc = wigig_sensing_ioc_get_event(ctx);
		rc = wigig_sensing_ioc_get_event(ctx);
		break;
		break;
	case WIGIG_SENSING_IOCTL_GET_NUM_AVAIL_BURSTS:
		pr_info("Received WIGIG_SENSING_IOCTL_GET_NUM_AVAIL_BURSTS command\n");
		rc = wigig_sensing_ioc_get_num_avail_bursts(ctx);
		break;
	default:
	default:
		rc = -EINVAL;
		rc = -EINVAL;
		break;
		break;
+9 −1
Original line number Original line Diff line number Diff line
@@ -39,6 +39,7 @@ enum wigig_sensing_event {
#define WIGIG_SENSING_IOCTL_CLEAR_DATA             (3)
#define WIGIG_SENSING_IOCTL_CLEAR_DATA             (3)
#define WIGIG_SENSING_IOCTL_GET_NUM_DROPPED_BURSTS (4)
#define WIGIG_SENSING_IOCTL_GET_NUM_DROPPED_BURSTS (4)
#define WIGIG_SENSING_IOCTL_GET_EVENT              (5)
#define WIGIG_SENSING_IOCTL_GET_EVENT              (5)
#define WIGIG_SENSING_IOCTL_GET_NUM_AVAIL_BURSTS   (6)


/**
/**
 * Set auto recovery, which means that the system will go back to search mode
 * Set auto recovery, which means that the system will go back to search mode
@@ -89,4 +90,11 @@ enum wigig_sensing_event {
	_IOR(WIGIG_SENSING_IOC_MAGIC, WIGIG_SENSING_IOCTL_GET_EVENT, \
	_IOR(WIGIG_SENSING_IOC_MAGIC, WIGIG_SENSING_IOCTL_GET_EVENT, \
	     sizeof(enum wigig_sensing_event))
	     sizeof(enum wigig_sensing_event))


#endif /* ____WIGIG_SENSING_UAPI_H__ */
/**
 * Get number of available bursts in the data buffer
 */
#define WIGIG_SENSING_IOC_GET_NUM_AVAIL_BURSTS \
	_IOR(WIGIG_SENSING_IOC_MAGIC, WIGIG_SENSING_IOCTL_GET_NUM_AVAIL_BURSTS,\
	     sizeof(uint32_t))

#endif /* __WIGIG_SENSING_UAPI_H__ */