Commit 4ca7d55e authored by Philippe Gerum's avatar Philippe Gerum
Browse files

drivers/evl: hectic: add stax test helpers



This allows writing user-space tests exercising the stax
serialization.
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
parent 689d01ab
......@@ -16,6 +16,7 @@
#include <evl/thread.h>
#include <evl/flag.h>
#include <evl/file.h>
#include <evl/stax.h>
#include <asm/evl/fptest.h>
#include <uapi/evl/devices/hectic.h>
......@@ -49,6 +50,7 @@ struct rtswitch_context {
struct rtswitch_task *utask;
struct irq_work wake_utask;
struct evl_stax stax;
struct evl_file efile;
};
......@@ -537,6 +539,14 @@ static long hectic_ioctl(struct file *filp, unsigned int cmd,
u_lerr = (typeof(u_lerr))arg;
return copy_to_user(u_lerr, &ctx->error, sizeof(ctx->error)) ?
-EFAULT : 0;
case EVL_HECIOC_LOCK_STAX:
return evl_lock_stax(&ctx->stax);
case EVL_HECIOC_UNLOCK_STAX:
evl_unlock_stax(&ctx->stax);
return 0;
default:
return -ENOTTY;
}
......@@ -570,6 +580,13 @@ static long hectic_oob_ioctl(struct file *filp, unsigned int cmd,
return raw_copy_to_user(u_lerr, &ctx->error, sizeof(ctx->error)) ?
-EFAULT : 0;
case EVL_HECIOC_LOCK_STAX:
return evl_lock_stax(&ctx->stax);
case EVL_HECIOC_UNLOCK_STAX:
evl_unlock_stax(&ctx->stax);
return 0;
default:
return -ENOTTY;
}
......@@ -599,6 +616,7 @@ static int hectic_open(struct inode *inode, struct file *filp)
init_irq_work(&ctx->wake_utask, rtswitch_utask_waker);
evl_init_timer(&ctx->wake_up_delay, timed_wake_up);
evl_init_stax(&ctx->stax);
filp->private_data = ctx;
......@@ -610,6 +628,7 @@ static int hectic_release(struct inode *inode, struct file *filp)
struct rtswitch_context *ctx = filp->private_data;
unsigned int i;
evl_destroy_stax(&ctx->stax);
evl_destroy_timer(&ctx->wake_up_delay);
if (ctx->tasks) {
......
......@@ -10,7 +10,7 @@
#include <linux/types.h>
#include <uapi/evl/sched.h>
#define EVL_ABI_LEVEL 13
#define EVL_ABI_LEVEL 14
#define EVL_CONTROL_DEV "/dev/evl/control"
......
......@@ -41,5 +41,7 @@ struct hectic_error {
#define EVL_HECIOC_GET_SWITCHES_COUNT _IOR(EVL_HECTIC_IOCBASE, 6, __u32)
#define EVL_HECIOC_GET_LAST_ERROR _IOR(EVL_HECTIC_IOCBASE, 7, struct hectic_error)
#define EVL_HECIOC_SET_PAUSE _IOW(EVL_HECTIC_IOCBASE, 8, __u32)
#define EVL_HECIOC_LOCK_STAX _IO(EVL_HECTIC_IOCBASE, 9)
#define EVL_HECIOC_UNLOCK_STAX _IO(EVL_HECTIC_IOCBASE, 10)
#endif /* !_EVL_UAPI_DEVICES_HECTIC_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment