+int mf624_done()
+{
+ if (mfst) {
+ if (--mfst_refcnt == 0) {
+ close(mfst->device_fd);
+ bar_mapping_destroy(&mfst->bar0);
+ bar_mapping_destroy(&mfst->bar2);
+ bar_mapping_destroy(&mfst->bar4);
+ free(mfst);
+ mfst = NULL;
+ }
+ }
+
+ return 0;
+}
+
+
+/**
+ * Check whether MF624 card is initialized.
+ *
+ * @param S
+ *
+ * @return Zero if MF624 is initialized, -1 othewise.
+ */
+int mf624_check(SimStruct *S)
+{
+ if (mfst==NULL) {
+ if (S) ssSetErrorStatus(S, "MF624 is not initialized");
+ return -1;
+ }
+ else
+ return 0;
+}
+