Add some code for option -m to print capabilities.
@@ -80,7 +80,9 @@ struct mdev_ctx {
static struct mdev_ctx master_ctx;
#define MODE_SHOW_ACTION 0x0001
-#define MODE_2 0x0002
+#define MODE_SHOW_NVME 0x0002
+#define MODE_SHOW_CARD 0x0004
+#define MODE_SHOW_SDRAM 0x0008
/*
* Open AFU Master Device
@@ -357,6 +359,29 @@ _snap_m_init_exit:
return rc;
}
+static void snap_show_cap(void *handle, int mode)
+{
+ unsigned long val;
+
+ if (MODE_SHOW_NVME == (MODE_SHOW_NVME & mode)) {
+ snap_card_ioctl(handle, GET_NVME_ENABLED, (unsigned long)&val);
+ if (1 == val)
+ VERBOSE0("NVME ");
+ }
+ if (MODE_SHOW_SDRAM == (MODE_SHOW_SDRAM & mode)) {
+ snap_card_ioctl(handle, GET_SDRAM_SIZE, (unsigned long)&val);
+ if (0 != val)
+ VERBOSE0("%d ", (int)val);
+ }
+ if (MODE_SHOW_CARD == (MODE_SHOW_CARD & mode)) {
+ snap_card_ioctl(handle, GET_CARD_TYPE, (unsigned long)&val);
+ switch (val) {
+ case 0: VERBOSE0("KU3 "); break;
+ case 1: VERBOSE0("FGT "); break;
+ }
+ }
+}
+
static int snap_do_master(struct mdev_ctx *mctx)
{
int dt = mctx->dt;
@@ -393,7 +418,9 @@ static void help(char *prog)
"\t-d, --daemon Start in Daemon process (background)\n"
"\t-m, --mode Mode:\n"
"\t 1 = Show Action number only\n"
- "\t 2 = Not Used for now\n"
+ "\t 2 = Show NVME if enabled\n"
+ "\t 3 = Show SDRAM Size in MB\n"
+ "\t 4 = Show Card\n"
"\t-f, --log-file <file> Log File name when running in -d "
"(daemon)\n"
"\n"
@@ -488,10 +515,12 @@ int main(int argc, char *argv[])
mode = strtoul(optarg, NULL, 0);
switch (mode) {
case 1: mctx->mode |= MODE_SHOW_ACTION; break;
- case 2: mctx->mode |= MODE_2; break;
+ case 2: mctx->mode |= MODE_SHOW_NVME; break;
+ case 3: mctx->mode |= MODE_SHOW_SDRAM; break;
+ case 4: mctx->mode |= MODE_SHOW_CARD; break;
default:
fprintf(stderr, "Please provide correct "
- "Mode Option (1..2)\n");
+ "Mode Option (1..4)\n");
exit(EXIT_FAILURE);
}
break;
@@ -577,6 +606,10 @@ int main(int argc, char *argv[])
snap_version(mctx->handle);
/* Init Master */
rc = snap_m_init(mctx->handle, mctx->mode);
+
+ /* Show Capabilities for diffrent modes */
+ snap_show_cap(mctx->handle, mctx->mode);
+
//if (0 != rc)
goto __main_exit; /* Exit here.... for now */
