Commit c9fb1743 authored by Federico Vaga's avatar Federico Vaga

lib: add strerror function

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent dfedced2
......@@ -229,3 +229,17 @@ float fdelay_read_temperature(struct fdelay_board *userb)
fdelay_sysfs_get(b, "temperature", &t);
return (float)t/16.0;
}
static const char *fdelay_error_string[] = {
};
/**
* It returns the error message associated to the given error code
* @param[in] err error code
*/
const char *fdelay_strerror(int err)
{
if (err < __FDELAY_ERR_MIN || err > __FDELAY_ERR_MAX)
return strerror(err);
return fdelay_error_string[err - __FDELAY_ERR_MIN];
}
......@@ -22,6 +22,11 @@ extern "C" {
#include <stdint.h>
#include "fine-delay.h"
#define __FDELAY_ERR_MIN 4096
enum fmctdc_error_numbers {
__FDELAY_ERR_MAX = __FDELAY_ERR_MIN,
};
/* Convenience macro for converting the physical output connector
numbers (as seen on the mezzanine's front panel) to convention used
by the drive (0..3). We keep 0..3 indexing to maintain library
......@@ -67,6 +72,7 @@ struct fdelay_pulse_ps {
extern int fdelay_init(void);
extern void fdelay_exit(void);
extern const char *fdelay_strerror(int err);
extern struct fdelay_board *fdelay_open(int offset, int dev_id);
extern struct fdelay_board *fdelay_open_by_lun(int lun);
......
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