summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cesar/hal/phy/Module3
-rw-r--r--cesar/hal/phy/inc/hlut.h48
-rw-r--r--cesar/hal/phy/inc/regs_addr.h69
-rw-r--r--cesar/hal/phy/src/hlut.c95
-rw-r--r--cesar/hal/phy/src/phy.c4
5 files changed, 217 insertions, 2 deletions
diff --git a/cesar/hal/phy/Module b/cesar/hal/phy/Module
index 12c40d3957..a8b438757c 100644
--- a/cesar/hal/phy/Module
+++ b/cesar/hal/phy/Module
@@ -1,4 +1,5 @@
-SOURCES := access.c pbdma.c phy.c pratic.c rx.c tx.c resys.c vsr.S bridgedma.c
+SOURCES := access.c pbdma.c phy.c pratic.c rx.c tx.c resys.c vsr.S \
+ bridgedma.c hlut.c
MODULES := hal/phy/spoc
ifeq ($(CONFIG_TRACE),y)
diff --git a/cesar/hal/phy/inc/hlut.h b/cesar/hal/phy/inc/hlut.h
new file mode 100644
index 0000000000..3981960166
--- /dev/null
+++ b/cesar/hal/phy/inc/hlut.h
@@ -0,0 +1,48 @@
+#ifndef phy_inc_hlut_h
+#define phy_inc_hlut_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file hal/phy/inc/hlut.h
+ * \brief Table parameters and registers for HLUT.
+ * \ingroup hal_phy
+ *
+ * This values are only useful on MSE500. This table should not change
+ * between boards.
+ * Only three parameters may change between boards:
+ * - span
+ * - offset
+ * - threshold
+ *
+ * For now those three parameters should be updated by the internal.conf file.
+ */
+
+/** Default value for the HLUT span. */
+#define PHY_HLUT_SPAN_DEFAULT 0
+/** Default value for the HLUT threshold. */
+#define PHY_HLUT_THRESHOLD_DEFAULT 0
+/** Default value for the HLUT offset. */
+#define PHY_HLUT_OFFSET_DEFAULT 0
+
+BEGIN_DECLS
+
+/**
+ * Initialise the HLUT.
+ */
+void
+phy_hlut_init (void);
+
+/**
+ * Set the tunable parameters in the registers.
+ */
+void
+phy_hlut_set_tunable (void);
+
+END_DECLS
+
+#endif /* phy_inc_hlut_h */
diff --git a/cesar/hal/phy/inc/regs_addr.h b/cesar/hal/phy/inc/regs_addr.h
index c12a472e90..755099e457 100644
--- a/cesar/hal/phy/inc/regs_addr.h
+++ b/cesar/hal/phy/inc/regs_addr.h
@@ -401,4 +401,71 @@
#define PHY_DSPSS_MIA_SF_QAM256 (* (volatile uint32_t *)0xA0004C28)
#define PHY_DSPSS_MIA_SF_QAM1024 (* (volatile uint32_t *)0xA0004C2C)
-
+#define PHY_DSPSS_MAGIC_HLUT_SPAN (* (volatile uint32_t *)0xAA000000)
+#define PHY_DSPSS_MAGIC_HLUT_OFFSET (* (volatile uint32_t *)0xAA000004)
+#define PHY_DSPSS_MAGIC_HLUT_THRESHOLD (* (volatile uint32_t *)0xAA000008)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_n ( (volatile uint32_t *)0xAA00000C)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_0 (* (volatile uint32_t *)0xAA00000C)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_1 (* (volatile uint32_t *)0xAA000010)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_2 (* (volatile uint32_t *)0xAA000014)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_3 (* (volatile uint32_t *)0xAA000018)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_4 (* (volatile uint32_t *)0xAA00001C)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_5 (* (volatile uint32_t *)0xAA000020)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_6 (* (volatile uint32_t *)0xAA000024)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_7 (* (volatile uint32_t *)0xAA000028)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_8 (* (volatile uint32_t *)0xAA00002C)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_9 (* (volatile uint32_t *)0xAA000030)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_10 (* (volatile uint32_t *)0xAA000034)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_11 (* (volatile uint32_t *)0xAA000038)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_12 (* (volatile uint32_t *)0xAA00003C)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_13 (* (volatile uint32_t *)0xAA000040)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_14 (* (volatile uint32_t *)0xAA000044)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_15 (* (volatile uint32_t *)0xAA000048)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_16 (* (volatile uint32_t *)0xAA00004C)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_17 (* (volatile uint32_t *)0xAA000050)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_18 (* (volatile uint32_t *)0xAA000054)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_19 (* (volatile uint32_t *)0xAA000058)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_20 (* (volatile uint32_t *)0xAA00005C)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_21 (* (volatile uint32_t *)0xAA000060)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_22 (* (volatile uint32_t *)0xAA000064)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_23 (* (volatile uint32_t *)0xAA000068)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_24 (* (volatile uint32_t *)0xAA00006C)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_25 (* (volatile uint32_t *)0xAA000070)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_26 (* (volatile uint32_t *)0xAA000074)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_27 (* (volatile uint32_t *)0xAA000078)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_28 (* (volatile uint32_t *)0xAA00007C)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_29 (* (volatile uint32_t *)0xAA000080)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_30 (* (volatile uint32_t *)0xAA000084)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_31 (* (volatile uint32_t *)0xAA000088)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_32 (* (volatile uint32_t *)0xAA00008C)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_33 (* (volatile uint32_t *)0xAA000090)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_34 (* (volatile uint32_t *)0xAA000094)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_35 (* (volatile uint32_t *)0xAA000098)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_36 (* (volatile uint32_t *)0xAA00009C)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_37 (* (volatile uint32_t *)0xAA0000A0)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_38 (* (volatile uint32_t *)0xAA0000A4)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_39 (* (volatile uint32_t *)0xAA0000A8)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_40 (* (volatile uint32_t *)0xAA0000AC)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_41 (* (volatile uint32_t *)0xAA0000B0)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_42 (* (volatile uint32_t *)0xAA0000B4)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_43 (* (volatile uint32_t *)0xAA0000B8)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_44 (* (volatile uint32_t *)0xAA0000BC)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_45 (* (volatile uint32_t *)0xAA0000C0)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_46 (* (volatile uint32_t *)0xAA0000C4)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_47 (* (volatile uint32_t *)0xAA0000C8)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_48 (* (volatile uint32_t *)0xAA0000CC)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_49 (* (volatile uint32_t *)0xAA0000D0)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_50 (* (volatile uint32_t *)0xAA0000D4)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_51 (* (volatile uint32_t *)0xAA0000D8)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_52 (* (volatile uint32_t *)0xAA0000DC)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_53 (* (volatile uint32_t *)0xAA0000E0)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_54 (* (volatile uint32_t *)0xAA0000E4)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_55 (* (volatile uint32_t *)0xAA0000E8)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_56 (* (volatile uint32_t *)0xAA0000EC)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_57 (* (volatile uint32_t *)0xAA0000F0)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_58 (* (volatile uint32_t *)0xAA0000F4)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_59 (* (volatile uint32_t *)0xAA0000F8)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_60 (* (volatile uint32_t *)0xAA0000FC)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_61 (* (volatile uint32_t *)0xAA000100)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_62 (* (volatile uint32_t *)0xAA000104)
+#define PHY_DSPSS_MAGIC_HLUT_TABLE_63 (* (volatile uint32_t *)0xAA000108)
diff --git a/cesar/hal/phy/src/hlut.c b/cesar/hal/phy/src/hlut.c
new file mode 100644
index 0000000000..da3a3b78ef
--- /dev/null
+++ b/cesar/hal/phy/src/hlut.c
@@ -0,0 +1,95 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file hal/phy/src/hlut.c
+ * \brief Table parameters and registers for HLUT.
+ * \ingroup hal_phy
+ */
+#include "common/std.h"
+#include "lib/stats.h"
+#include "hal/arch/platform.h"
+#include "hal/phy/inc/regs.h"
+#include "hal/phy/inc/hlut.h"
+
+/** HLUT tunable parameters. */
+struct hlut_tunable_parameters_t
+{
+ /** HLUT span variable. */
+ u32 span;
+ /** HLUT offset variable. */
+ u32 offset;
+ /** HLUT threshold variable. */
+ u32 threshold;
+};
+typedef struct hlut_tunable_parameters_t hlut_tunable_parameters_t;
+
+/** Global tunable parameters. */
+static hlut_tunable_parameters_t hlut_tunable_params = {
+ PHY_HLUT_SPAN_DEFAULT,
+ PHY_HLUT_THRESHOLD_DEFAULT,
+ PHY_HLUT_OFFSET_DEFAULT,
+};
+
+/**
+ * Initialise the tunable parameters settable by the lib stats.
+ */
+static inline void
+phy_hlut_stats_init (void)
+{
+#if CONFIG_STATS
+ lib_stats_set_stat_value_notype ("HLUT_SPAN",
+ &hlut_tunable_params.span,
+ LIB_STATS_ACCESS_WRITE_ONLY,
+ LIB_STATS_DEBUG);
+ lib_stats_set_stat_value_notype ("HLUT_OFFSET",
+ &hlut_tunable_params.offset,
+ LIB_STATS_ACCESS_WRITE_ONLY,
+ LIB_STATS_DEBUG);
+ lib_stats_set_stat_value_notype ("HLUT_THRESHOLD",
+ &hlut_tunable_params.threshold,
+ LIB_STATS_ACCESS_WRITE_ONLY,
+ LIB_STATS_DEBUG);
+#endif /* CONFIG_STATS */
+}
+
+void
+phy_hlut_init (void)
+{
+ /* This is not valid on SPC300. */
+ if (arch_is_mse500 ())
+ {
+ /** HLUT table parameters for the gain function. */
+ static const u32 phy_hlut_table[] = {
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 41, 41, 41, 41, 41, 41,
+ 41, 41, 41, 41, 41, 41, 41, 41,
+ 41, 41, 41, 41, 41, 41, 41, 41
+ };
+ uint i;
+ /* Set the MAGIC HLUT parameters. */
+ for (i = 0; i < COUNT (phy_hlut_table); i++)
+ PHY_DSPSS_MAGIC_HLUT_TABLE_n[i] = phy_hlut_table[i];
+ phy_hlut_stats_init ();
+ }
+}
+
+void
+phy_hlut_set_tunable (void)
+{
+ /* This is not valid on SPC300. */
+ if (arch_is_mse500 ())
+ {
+ PHY_DSPSS_MAGIC_HLUT_SPAN = hlut_tunable_params.span;
+ PHY_DSPSS_MAGIC_HLUT_OFFSET = hlut_tunable_params.offset;
+ PHY_DSPSS_MAGIC_HLUT_THRESHOLD = hlut_tunable_params.threshold;
+ }
+}
diff --git a/cesar/hal/phy/src/phy.c b/cesar/hal/phy/src/phy.c
index 56cfbce972..80375398bb 100644
--- a/cesar/hal/phy/src/phy.c
+++ b/cesar/hal/phy/src/phy.c
@@ -17,6 +17,7 @@
#include "inc/context.h"
#include "inc/regs.h"
#include "inc/resys.h"
+#include "inc/hlut.h"
#include "hal/phy/spoc/spoc.h"
@@ -674,6 +675,8 @@ phy_init (void *user_data, phy_rx_fc_cb_t rx_fc_cb, phy_access_cb_t access_cb,
phy_init_stats (ctx);
/* Register tunable parameters. */
phy_init_tunable_param (ctx);
+ /* Initialise the HLUT. */
+ phy_hlut_init ();
/* Done. */
return ctx;
}
@@ -817,6 +820,7 @@ phy_set_tunable_param (phy_t *ctx, const u32 *tonemask, uint carrier_nb)
| BF_FILL (
PHY_DSPSS_CHANNEL_ESTIM_COEF,
(COEF_RES_DELTA, phy_tunable.delta_res_coef_internal));
+ phy_hlut_set_tunable ();
}
static void