summaryrefslogtreecommitdiff
path: root/avr/strerror.c
diff options
context:
space:
mode:
Diffstat (limited to 'avr/strerror.c')
-rw-r--r--avr/strerror.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/avr/strerror.c b/avr/strerror.c
new file mode 100644
index 0000000..199504a
--- /dev/null
+++ b/avr/strerror.c
@@ -0,0 +1,38 @@
+/*
+ * (C) Copyright 2018 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#include "common.h"
+#include "cmd_fat.h"
+
+
+static const FLASH char * const FLASH error_strings[] = {
+ FSTR("Unknown error"),
+ FSTR("Not enough memory"), /* 101 */
+ FSTR("Interrupt"), /* 102 */
+ FSTR("Bus timeout"), /* 103 */
+ FSTR("Unexpected argument"), /* 104 */
+ FSTR("Invalid disk number"), /* 105 */
+ FSTR("Disk already attached"), /* 106 */
+ FSTR("Disk not attached"), /* 107 */
+ FSTR("Error opening file"), /* 108 */
+ FSTR("File already attached to other drive"), /* 109 */
+ FSTR("CPU is running"), /* 110 */
+ FSTR("Invalid argument"), /* 111 */
+ FSTR("Unexpected EOF"), /* 112 */
+
+};
+
+const FLASH char * my_strerror_P(ERRNUM errnum)
+{
+ if (errnum < 100)
+ return fat_rctostr(errnum);
+
+ errnum -= 100;
+ if ((unsigned) errnum >= ARRAY_SIZE(error_strings))
+ errnum = 0;
+
+ return error_strings[errnum];
+}