From 7b97611ef203a1d2121f59fdaf4676569a802dac Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Mon, 4 Apr 2011 16:24:45 +0000 Subject: [PATCH] dahdi: Use enumeration for maintenance modes. Clarifies that maintstates are mutually exclusive. Signed-off-by: Shaun Ruffell Acked-by: Michael Spiceland Acked-by: Kinsey Moore git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9879 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- include/dahdi/kernel.h | 2 +- include/dahdi/user.h | 35 ++++++++++++++++++----------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h index 0a5eb83..bd39192 100644 --- a/include/dahdi/kernel.h +++ b/include/dahdi/kernel.h @@ -884,7 +884,7 @@ struct dahdi_span { int syncsrc; /*!< current sync src (gets copied here) */ struct dahdi_count count; /*!< Performance and Error counters */ - int maintstat; /*!< Maintenance state */ + enum dahdi_maint_mode maintstat; /*!< Maintenance state */ int mainttimer; /*!< Maintenance timer */ int irqmisses; /*!< Interrupt misses */ diff --git a/include/dahdi/user.h b/include/dahdi/user.h index 0c51b37..1159fbf 100644 --- a/include/dahdi/user.h +++ b/include/dahdi/user.h @@ -327,23 +327,24 @@ enum { #define DAHDI_ALARM_LFA (1 << 9) /* Loss of Frame Alignment */ #define DAHDI_ALARM_LMFA (1 << 10)/* Loss of Multi-Frame Align */ -/* Maintenance modes */ -#define DAHDI_MAINT_NONE 0 /* Normal Mode */ -#define DAHDI_MAINT_LOCALLOOP 1 /* Local Loopback */ -#define DAHDI_MAINT_REMOTELOOP 2 /* Remote Loopback */ -#define DAHDI_MAINT_NETWORKLINELOOP 2 /* Remote Loopback */ -#define DAHDI_MAINT_LOOPUP 3 /* send loopup code */ -#define DAHDI_MAINT_LOOPDOWN 4 /* send loopdown code */ -#define DAHDI_MAINT_FAS_DEFECT 6 /* insert a FAS defect */ -#define DAHDI_MAINT_MULTI_DEFECT 7 /* insert a Multiframe defect */ -#define DAHDI_MAINT_CRC_DEFECT 8 /* insert a FAS defect */ -#define DAHDI_MAINT_CAS_DEFECT 9 /* insert a FAS defect */ -#define DAHDI_MAINT_PRBS_DEFECT 10 /* insert a FAS defect */ -#define DAHDI_MAINT_BIPOLAR_DEFECT 11 /* insert a FAS defect */ -#define DAHDI_MAINT_PRBS 12 /* enable the PRBS gen/mon */ -#define DAHDI_MAINT_NETWORKPAYLOADLOOP 13 /* Remote Loopback */ -#define DAHDI_RESET_COUNTERS 14 /* Clear the error counters */ -#define DAHDI_MAINT_ALARM_SIM 15 /* Simulate alarms */ +enum dahdi_maint_mode { + DAHDI_MAINT_NONE = 0, /* Normal Mode */ + DAHDI_MAINT_LOCALLOOP = 1, /* Local Loopback */ + DAHDI_MAINT_REMOTELOOP = 2, /* Remote Loopback */ + DAHDI_MAINT_NETWORKLINELOOP = 2, /* Remote Loopback */ + DAHDI_MAINT_LOOPUP = 3, /* send loopup code */ + DAHDI_MAINT_LOOPDOWN = 4, /* send loopdown code */ + DAHDI_MAINT_FAS_DEFECT = 6, /* insert a FAS defect */ + DAHDI_MAINT_MULTI_DEFECT = 7, /* insert a Multiframe defect */ + DAHDI_MAINT_CRC_DEFECT = 8, /* insert a FAS defect */ + DAHDI_MAINT_CAS_DEFECT = 9, /* insert a FAS defect */ + DAHDI_MAINT_PRBS_DEFECT = 10, /* insert a FAS defect */ + DAHDI_MAINT_BIPOLAR_DEFECT = 11, /* insert a FAS defect */ + DAHDI_MAINT_PRBS = 12, /* enable the PRBS gen/mon */ + DAHDI_MAINT_NETWORKPAYLOADLOOP = 13, /* Remote Loopback */ + DAHDI_RESET_COUNTERS = 14, /* Clear the error counters */ + DAHDI_MAINT_ALARM_SIM = 15, /* Simulate alarms */ +}; /* Flag Value for IOMUX, read avail */ #define DAHDI_IOMUX_READ 1