summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNélio Laranjeiro2012-10-22 14:02:09 +0200
committerNélio Laranjeiro2012-10-22 14:42:41 +0200
commit05fc34228ac276ff2d5b9259ae9c82ddc34470eb (patch)
tree7b3fc2660dc023e04f91dd3cb4e1f65d0b7d7de7
parentae8772d73010c1977c979c3d993d6b852a50e8f9 (diff)
parent650637ae30911fae7cf04e0168f4333cb4134e00 (diff)
Merge branch 'master-t3414-ilram' into eoc-drv-t3414-ilram
-rw-r--r--cesar/bsu/src/bsu.c7
-rw-r--r--cesar/bufmgr/src/bufmgr.c2
-rw-r--r--cesar/ce/fcall/src/fcall.c17
-rw-r--r--cesar/ce/rx/src/measure.c4
-rw-r--r--cesar/ce/rx/src/rx.c4
-rw-r--r--cesar/cl/mbx/src/mbx.c2
-rw-r--r--cesar/cl/src/cl.c12
-rw-r--r--cesar/common/std.h1
-rwxr-xr-xcesar/common/tools/lram-size4
-rw-r--r--cesar/cp/av/cco/action/src/cco_action.c2
-rw-r--r--cesar/cp/av/sta/mgr/src/sta_mgr.c4
-rw-r--r--cesar/cp/beacon/src/beacon.c8
-rw-r--r--cesar/cp/cco/bw/src/bw.c2
-rw-r--r--cesar/cp/cco/region/src/region.c2
-rw-r--r--cesar/cp/cl_interf/src/cl_interf.c2
-rw-r--r--cesar/cp/fsm/src/events.c6
-rw-r--r--cesar/cp/msg/src/msg.c19
-rw-r--r--cesar/cp/sta/mgr/src/net.c5
-rw-r--r--cesar/ecos/packages/hal/sparc/arch/current/src/hal_boot.c42
-rw-r--r--cesar/ecos/packages/hal/sparc/arch/current/src/sparc.ld14
-rw-r--r--cesar/ecos/packages/hal/sparc/leon/current/include/pkgconf/mlt_sparc_leon_ahbram.ldi2
-rw-r--r--cesar/ecos/packages/hal/sparc/leon/current/include/pkgconf/mlt_sparc_leon_ram.ldi2
-rw-r--r--cesar/hal/arch/Config1
-rw-r--r--cesar/hal/arch/Module1
-rw-r--r--cesar/hal/arch/arch.h17
-rw-r--r--cesar/hal/arch/dlink/Module1
-rw-r--r--cesar/hal/arch/dlink/dlink.h78
-rw-r--r--cesar/hal/arch/dlink/src/dlink.c128
-rw-r--r--cesar/hal/arch/dlink/test/Makefile17
-rw-r--r--cesar/hal/arch/dlink/test/ecos.ecc.sh5
-rw-r--r--cesar/hal/arch/dlink/test/src/test_dlink.c37
-rw-r--r--cesar/hal/arch/dlink/test/src/test_dlink_host.c124
-rw-r--r--cesar/hal/arch/dlink/test/src/test_dlink_sparc.c175
-rw-r--r--cesar/hal/arch/inc/regs_addr.h4
-rw-r--r--cesar/hal/arch/inc/sparc.h36
-rw-r--r--cesar/hal/arch/platform.h4
-rw-r--r--cesar/hal/phy/test/phy/src/basic.c13
-rw-r--r--cesar/hal/phy/test/phy/src/test_phy.c17
-rw-r--r--cesar/hal/timer/src/timer.c2
-rw-r--r--cesar/lib/callbacks.h39
-rw-r--r--cesar/lib/src/restrack.c4
-rw-r--r--cesar/mac/pbproc/src/fsm.c10
-rw-r--r--cesar/mac/pbproc/src/fsm_rx_beacon.c2
-rw-r--r--cesar/mac/pbproc/src/fsm_rx_data.c10
-rw-r--r--cesar/mac/pbproc/src/fsm_rx_sound.c2
-rw-r--r--cesar/mac/pbproc/src/fsm_top.c4
-rw-r--r--cesar/mac/pbproc/src/fsm_tx_data.c14
-rw-r--r--cesar/mac/pbproc/src/fsm_tx_rts_cts.c4
-rw-r--r--cesar/mac/pbproc/src/fsm_tx_sound.c4
-rw-r--r--cesar/mac/pbproc/src/pbproc.c20
-rw-r--r--cesar/mac/sar/src/sar.c17
-rw-r--r--cesar/projects/eoc/master-Config.mse5003
-rw-r--r--cesar/projects/eoc/slave-Config.mse5001
-rw-r--r--cesar/projects/plc/Config.mse5001
-rw-r--r--cesar/tools/sniffer_phy/src/lhle.c10
-rw-r--r--cesar/tools/sniffer_phy/src/lowlevel.c11
-rw-r--r--cesar/tools/sniffer_phy/src/mme.c3
-rw-r--r--common/tests/tests4
58 files changed, 871 insertions, 115 deletions
diff --git a/cesar/bsu/src/bsu.c b/cesar/bsu/src/bsu.c
index ec5a3e7353..4ef5012ebd 100644
--- a/cesar/bsu/src/bsu.c
+++ b/cesar/bsu/src/bsu.c
@@ -970,10 +970,11 @@ bsu_init (bsu_aclf_t *aclf, mac_config_t *mac_config, phy_t *phy,
ctx->poweron.beacon.vf.nm = MAC_NM_CSMA_ONLY;
bsu_ntb_init (&ctx->poweron.sync);
/* Initialise the SAR callback. */
- sar_init_beacon_cb (sar, ctx, (sar_beacon_cb_t) bsu_beacon_recv);
+ sar_init_beacon_cb (
+ sar, ctx, (sar_beacon_cb_t) CALLBACK (bsu_beacon_recv));
/* Initialise timer events. */
- hal_timer_instance_init (timer, &ctx->timer, ctx,
- bsu_timer_event_process);
+ hal_timer_instance_init (
+ timer, &ctx->timer, ctx, CALLBACK (bsu_timer_event_process));
ctx->activate = false;
ctx->is_sta = BSU_UPDATE_STA_TYPE_STA;
for (i = 0; i < COUNT (ctx->mfs_beacons); i++)
diff --git a/cesar/bufmgr/src/bufmgr.c b/cesar/bufmgr/src/bufmgr.c
index 73ff9d8e7b..989a0db2a3 100644
--- a/cesar/bufmgr/src/bufmgr.c
+++ b/cesar/bufmgr/src/bufmgr.c
@@ -166,7 +166,7 @@ bufmgr_init (ipmbox_t *ipmbox)
hal_arch_sem_init (&ctx->sem, 0);
/* Register a callback for empty_buf IT. */
ipmbox_register_empty_buf_cb (ipmbox, ctx,
- (ipmbox_empty_buf_cb_t) bufmgr_handle_new_buf);
+ (ipmbox_empty_buf_cb_t) CALLBACK (bufmgr_handle_new_buf));
bufmgr_trace_init (ctx);
return ctx;
}
diff --git a/cesar/ce/fcall/src/fcall.c b/cesar/ce/fcall/src/fcall.c
index 590a4633d9..fdaa02546c 100644
--- a/cesar/ce/fcall/src/fcall.c
+++ b/cesar/ce/fcall/src/fcall.c
@@ -46,14 +46,15 @@ ce_fcall_init (cesar_t *cesar)
fcall = my_station.fcall;
#endif
- dbg_check (
- fcall_register (fcall, "ce_configure_bl_nsr_margin",
- &ce_fcall_configure_bl_nsr_margin, cesar->ce_rx)
- == 0);
- dbg_check (
- fcall_register (fcall, "ce_configure_bl_ber_margin",
- &ce_fcall_configure_bl_ber_margin, cesar->ce_rx)
- == 0);
+ int ret;
+ ret = fcall_register (fcall, "ce_configure_bl_nsr_margin",
+ CALLBACK (ce_fcall_configure_bl_nsr_margin),
+ cesar->ce_rx);
+ dbg_check (ret == 0);
+ ret = fcall_register (fcall, "ce_configure_bl_ber_margin",
+ CALLBACK (ce_fcall_configure_bl_ber_margin),
+ cesar->ce_rx);
+ dbg_check (ret == 0);
}
int
diff --git a/cesar/ce/rx/src/measure.c b/cesar/ce/rx/src/measure.c
index 46a6df0964..dd24298a18 100644
--- a/cesar/ce/rx/src/measure.c
+++ b/cesar/ce/rx/src/measure.c
@@ -111,9 +111,9 @@ ce_rx_measure_init (ce_rx_t *ce_rx, sar_t *sar, pbproc_t *pbproc)
/* Initialize allocator for the mailbox. */
slab_cache_init (&ce_rx->measure_cache, "ce_rx_measure",
sizeof (ce_rx_measure_mbox_t),
- &ce_rx_measure_cache_destructor);
+ CALLBACK (ce_rx_measure_cache_destructor));
/* Register our callback to get measures. */
- sar_init_measurement_cb (sar, ce_rx_measure_sar_cb, ce_rx);
+ sar_init_measurement_cb (sar, CALLBACK (ce_rx_measure_sar_cb), ce_rx);
/* Ask the PBProc to give us the channel data. */
/* Create channel data configuration for the whole NOISE NRJ with the
diff --git a/cesar/ce/rx/src/rx.c b/cesar/ce/rx/src/rx.c
index b6dddc3851..e4d33eca28 100644
--- a/cesar/ce/rx/src/rx.c
+++ b/cesar/ce/rx/src/rx.c
@@ -187,7 +187,7 @@ ce_rx_init (mac_store_t *mac_store, sar_t *sar, pbproc_t *pbproc,
cyg_clock_to_counter (ce_rx.real_time_clock_handle,
&ce_rx.real_time_counter);
cyg_alarm_create (ce_rx.real_time_counter,
- ce_rx_timer_prevent_tone_map_expiration,
+ CALLBACK (ce_rx_timer_prevent_tone_map_expiration),
(cyg_addrword_t) &ce_rx,
&ce_rx.alarm_handler, &ce_rx.alarm);
@@ -199,7 +199,7 @@ ce_rx_init (mac_store_t *mac_store, sar_t *sar, pbproc_t *pbproc,
period);
/* Create the ECos thread. */
- cyg_thread_create (CE_RX_THREAD_PRIORITY, &ce_rx_thread,
+ cyg_thread_create (CE_RX_THREAD_PRIORITY, CALLBACK (ce_rx_thread),
(cyg_addrword_t) &ce_rx, CE_RX_THREAD_NAME,
ce_rx.thread_stack, CE_RX_THREAD_STACK_SIZE,
&ce_rx.thread_handler, &ce_rx.thread);
diff --git a/cesar/cl/mbx/src/mbx.c b/cesar/cl/mbx/src/mbx.c
index d0439b0893..4723c719ad 100644
--- a/cesar/cl/mbx/src/mbx.c
+++ b/cesar/cl/mbx/src/mbx.c
@@ -58,7 +58,7 @@ cl_mbx_init (ipmbox_t *ipmbox)
ctx->user_data = 0;
ctx->ipmbox = ipmbox;
ipmbox_register_rx_mbx_cb (
- ipmbox, ctx, (ipmbox_rx_cb_t) cl_mbx_ipmbox_mbx_recv);
+ ipmbox, ctx, (ipmbox_rx_cb_t) CALLBACK (cl_mbx_ipmbox_mbx_recv));
#if HLE_TOOLS
/* Initialise hle tools. */
ctx->hle_tools = hle_tools_init (ipmbox);
diff --git a/cesar/cl/src/cl.c b/cesar/cl/src/cl.c
index 0e83440b9c..ba8d4d958a 100644
--- a/cesar/cl/src/cl.c
+++ b/cesar/cl/src/cl.c
@@ -79,7 +79,7 @@ cl_init (mac_store_t *mac_store, sar_t *sar, mac_config_t *mac_config,
/* Initialize IPMbox. */
cl_global.ipmbox = ipmbox;
ipmbox_register_rx_data_cb (
- ipmbox, &cl_global, (ipmbox_rx_cb_t) cl_ipmbox_data_recv);
+ ipmbox, &cl_global, (ipmbox_rx_cb_t) CALLBACK (cl_ipmbox_data_recv));
/* Initialise Mbx cl sub module. */
cl_global.mbx = cl_mbx_init (ipmbox);
@@ -90,8 +90,8 @@ cl_init (mac_store_t *mac_store, sar_t *sar, mac_config_t *mac_config,
/* Initialize SAR */
cl_global.sar = sar;
sar_init_reassembly_callbacks (cl_global.sar,
- (sar_reassembly_cb_t) cl_sar_data_recv,
- (sar_reassembly_cb_t) cl_sar_mme_recv,
+ (sar_reassembly_cb_t) CALLBACK (cl_sar_data_recv),
+ (sar_reassembly_cb_t) CALLBACK (cl_sar_mme_recv),
&cl_global);
/* Initialize the cl_mactotei table */
@@ -118,8 +118,10 @@ cl_init (mac_store_t *mac_store, sar_t *sar, mac_config_t *mac_config,
CL_TRACE (INIT, phy_date ());
/* Initialize packet sequence check. */
- lib_seq_check_init (&ctx->seq_check_rx_ctx, cl_lib_seq_check_rx_cb, ctx);
- lib_seq_check_init (&ctx->seq_check_tx_ctx, cl_lib_seq_check_tx_cb, ctx);
+ lib_seq_check_init (
+ &ctx->seq_check_rx_ctx, CALLBACK (cl_lib_seq_check_rx_cb), ctx);
+ lib_seq_check_init (
+ &ctx->seq_check_tx_ctx, CALLBACK (cl_lib_seq_check_tx_cb), ctx);
#if CONFIG_STATS
/* Register statistics. */
diff --git a/cesar/common/std.h b/cesar/common/std.h
index 35fddc0951..7ca5daf9fb 100644
--- a/cesar/common/std.h
+++ b/cesar/common/std.h
@@ -27,6 +27,7 @@
#include "lib/types.h"
#include "lib/utils.h"
#include "lib/dbg.h"
+#include "lib/callbacks.h"
#else
# error "common/std.h should be included only once in non header files."
diff --git a/cesar/common/tools/lram-size b/cesar/common/tools/lram-size
index 6cccc33540..2860e5a320 100755
--- a/cesar/common/tools/lram-size
+++ b/cesar/common/tools/lram-size
@@ -24,7 +24,7 @@ GetOptions (
pod2usage (1) if $help;
@ARGV == 1 or pod2usage (2);
$details or $total or $total_stderr or pod2usage (2);
-@rams = qw(ilram dlram_data dlram_bss interrupt_stack) unless @rams;
+@rams = qw(ilram ilram2 dlram_data dlram_bss interrupt_stack) unless @rams;
my $file = shift @ARGV;
@@ -97,6 +97,8 @@ if ($total || $total_stderr)
{
exists $rams{'ilram'} && $rams{'ilram'} > 32 * 1024
and die "ERROR: ilram too big.\n";
+ exists $rams{'ilram2'} && $rams{'ilram2'} + $rams{'ilram'} > 64 * 1024
+ and die "ERROR: ilram2 too big.\n";
exists $rams{'dlram_data'} && exists $rams{'dlram_bss'}
&& exists $rams{'interrupt_stack'}
&& $rams{'dlram_data'} + $rams{'dlram_bss'} + $rams{'interrupt_stack'}
diff --git a/cesar/cp/av/cco/action/src/cco_action.c b/cesar/cp/av/cco/action/src/cco_action.c
index 6ed05a7047..081fd5825d 100644
--- a/cesar/cp/av/cco/action/src/cco_action.c
+++ b/cesar/cp/av/cco/action/src/cco_action.c
@@ -300,7 +300,7 @@ cp_av_cco_action_init (cp_t *ctx)
/* Initialise the SET. */
heap_init (&ctx->cco_action.selection_heap,
- cp_av_cco_action_cco_selection__less);
+ CALLBACK (cp_av_cco_action_cco_selection__less));
/* Create default region. */
cp_av_cco_region_default (ctx);
}
diff --git a/cesar/cp/av/sta/mgr/src/sta_mgr.c b/cesar/cp/av/sta/mgr/src/sta_mgr.c
index cba9b9de25..9b4f99c1e4 100644
--- a/cesar/cp/av/sta/mgr/src/sta_mgr.c
+++ b/cesar/cp/av/sta/mgr/src/sta_mgr.c
@@ -48,10 +48,10 @@ cp_av_sta_mgr_init (cp_t *ctx)
slab_cache_init (&ctx->sta_mgr.sta_slab_cache,
"Station cache",
sizeof (cp_sta_private_t),
- (slab_object_destructor_t) cp_sta_uninit);
+ (slab_object_destructor_t) CALLBACK (cp_sta_uninit));
// Initialise the set of station sorted by mac addresses.
- set_init (&ctx->sta_mgr.stas, cp_sta_mgr_sta_mac_address_less);
+ set_init (&ctx->sta_mgr.stas, CALLBACK (cp_sta_mgr_sta_mac_address_less));
}
static void
diff --git a/cesar/cp/beacon/src/beacon.c b/cesar/cp/beacon/src/beacon.c
index f53f304bbe..058410cf7a 100644
--- a/cesar/cp/beacon/src/beacon.c
+++ b/cesar/cp/beacon/src/beacon.c
@@ -315,7 +315,7 @@ cp_beacon_sta_compute_schedules (cp_t *ctx, bsu_beacon_t *beacon)
set_t set_schedules;
cp_cco_bw_alloc_t *sched;
- set_init (&set_schedules, cp_cco_bw_alloc_less);
+ set_init (&set_schedules, CALLBACK (cp_cco_bw_alloc_less));
for (i = 0; i < beacon->bmis.nps.ns; i++)
{
@@ -353,7 +353,7 @@ cp_beacon_sta_compute_schedules (cp_t *ctx, bsu_beacon_t *beacon)
cp_cco_region_alloc_t *region;
set_t set_regions;
- set_init (&set_regions, cp_cco_region_alloc_less);
+ set_init (&set_regions, CALLBACK (cp_cco_region_alloc_less));
for (i = 0; i < beacon->bmis.region.nb; i++)
{
@@ -534,11 +534,11 @@ cp_beacon_init (cp_t *ctx)
// Initialise the instance of the leon timer.
hal_timer_instance_init (
ctx->hal_timer, &ctx->beacon.leon_timer, ctx,
- (hal_timer_instance_cb_t) cp_beacon_timer_expires);
+ (hal_timer_instance_cb_t) CALLBACK (cp_beacon_timer_expires));
/* Setup beacon indicator. */
GPIO_SETUP (LED_BEACON_TX_RX, GPIO_DIRECTION_OUT);
GPIO_SET (LED_BEACON_TX_RX, 0);
- bsu_init_beacon_cb (cp_beacon_receive, ctx);
+ bsu_init_beacon_cb (CALLBACK (cp_beacon_receive), ctx);
/* Store the current date for SPOC update coefficients. */
ctx->beacon.spoc_update_date = phy_date ();
/* Initialise tunable parameters. */
diff --git a/cesar/cp/cco/bw/src/bw.c b/cesar/cp/cco/bw/src/bw.c
index 939c798a1e..6c83a2c512 100644
--- a/cesar/cp/cco/bw/src/bw.c
+++ b/cesar/cp/cco/bw/src/bw.c
@@ -86,7 +86,7 @@ cp_cco_bw_init (cp_t *ctx)
sizeof (cp_cco_bw_alloc_t), NULL);
/* Initialise the list. */
- set_init (&ctx->bw.alloc_list, cp_cco_bw_alloc_less);
+ set_init (&ctx->bw.alloc_list, CALLBACK (cp_cco_bw_alloc_less));
}
void
diff --git a/cesar/cp/cco/region/src/region.c b/cesar/cp/cco/region/src/region.c
index 09c2162a00..ee5f2663f2 100644
--- a/cesar/cp/cco/region/src/region.c
+++ b/cesar/cp/cco/region/src/region.c
@@ -42,7 +42,7 @@ cp_cco_region_init (cp_t *ctx)
memset (&ctx->region, 0, sizeof (cp_cco_region_t));
/* Initialise the set. */
- set_init (&ctx->region.region_list, cp_cco_region_alloc_less);
+ set_init (&ctx->region.region_list, CALLBACK (cp_cco_region_alloc_less));
/* Initialise the slab. */
slab_cache_init (&ctx->region.slab, "Region manager Slab cache",
sizeof (cp_cco_region_alloc_t), NULL);
diff --git a/cesar/cp/cl_interf/src/cl_interf.c b/cesar/cp/cl_interf/src/cl_interf.c
index 1f9dcc9f74..82961aca58 100644
--- a/cesar/cp/cl_interf/src/cl_interf.c
+++ b/cesar/cp/cl_interf/src/cl_interf.c
@@ -51,7 +51,7 @@ cp_cl_interf_init (cp_t *ctx)
// Initialise the call backs.
interface_callback_init (ctx->interface,
- cp_cl_interf_rx_mme,
+ CALLBACK (cp_cl_interf_rx_mme),
ctx);
// Initialise the cache.
diff --git a/cesar/cp/fsm/src/events.c b/cesar/cp/fsm/src/events.c
index f074e9f90a..820f341adc 100644
--- a/cesar/cp/fsm/src/events.c
+++ b/cesar/cp/fsm/src/events.c
@@ -223,12 +223,12 @@ cp_fsm_event_init (cp_t *ctx)
NULL);
slab_cache_init (&ctx->fsm.event_mme_cache, "event_mme",
sizeof (cp_fsm_event_mme_t),
- cp_fsm_event_mme_destructor);
+ CALLBACK (cp_fsm_event_mme_destructor));
slab_cache_init (&ctx->fsm.event_sta_cache, "event_sta",
sizeof (cp_fsm_event_sta_t),
- cp_fsm_event_sta_destructor);
+ CALLBACK (cp_fsm_event_sta_destructor));
slab_cache_init (&ctx->fsm.event_beacon_cache, "event_beacon",
sizeof (cp_fsm_event_beacon_t),
- cp_fsm_event_beacon_destructor);
+ CALLBACK (cp_fsm_event_beacon_destructor));
}
diff --git a/cesar/cp/msg/src/msg.c b/cesar/cp/msg/src/msg.c
index 41f38c2c6e..09833a415c 100644
--- a/cesar/cp/msg/src/msg.c
+++ b/cesar/cp/msg/src/msg.c
@@ -486,13 +486,15 @@ cp_msg_init (cp_t *ctx)
{
dbg_assert (ctx);
- slab_cache_init (&ctx->msg.mme_tx_slab_cache, "MME TX",
- sizeof (cp_mme_tx_t),
- (slab_object_destructor_t) cp_msg_mme_tx_destructor);
-
- slab_cache_init (&ctx->msg.mme_rx_slab_cache, "MME RX",
- sizeof (cp_mme_rx_t),
- (slab_object_destructor_t) cp_msg_mme_rx_destructor);
+ slab_cache_init (
+ &ctx->msg.mme_tx_slab_cache, "MME TX",
+ sizeof (cp_mme_tx_t),
+ (slab_object_destructor_t) CALLBACK (cp_msg_mme_tx_destructor));
+
+ slab_cache_init (
+ &ctx->msg.mme_rx_slab_cache, "MME RX",
+ sizeof (cp_mme_rx_t),
+ (slab_object_destructor_t) CALLBACK (cp_msg_mme_rx_destructor));
ctx->msg.fmsn = 1;
}
@@ -713,7 +715,8 @@ cp_msg_mme_init (cp_t *ctx, cp_mme_peer_t *peer, mmtype_t mmtype,
dbg_assert (mme);
bitstream_init_buffer_cb (
&mme->bitstream,
- (bitstream_buffer_cb_t) cp_msg_mme_tx_change_buffer, mme);
+ (bitstream_buffer_cb_t) CALLBACK (cp_msg_mme_tx_change_buffer),
+ mme);
}
return mme;
diff --git a/cesar/cp/sta/mgr/src/net.c b/cesar/cp/sta/mgr/src/net.c
index 750be5515d..4b9c560aa4 100644
--- a/cesar/cp/sta/mgr/src/net.c
+++ b/cesar/cp/sta/mgr/src/net.c
@@ -124,8 +124,9 @@ cp_net_init (cp_t *ctx, cp_net_t *net)
net->num_associated_stas = 0;
net->hm = MAC_COEXISTENCE_FULL_HYBRID_MODE;
net->beacon_recv_date = 0;
- set_init (&net->associated_stas, cp_net_station_assoc_less);
- set_init (&net->unassociated_stas, cp_net_station_unassoc_less);
+ set_init (&net->associated_stas, CALLBACK (cp_net_station_assoc_less));
+ set_init (&net->unassociated_stas,
+ CALLBACK (cp_net_station_unassoc_less));
}
void
diff --git a/cesar/ecos/packages/hal/sparc/arch/current/src/hal_boot.c b/cesar/ecos/packages/hal/sparc/arch/current/src/hal_boot.c
index 7f1d261999..fcbfb273db 100644
--- a/cesar/ecos/packages/hal/sparc/arch/current/src/hal_boot.c
+++ b/cesar/ecos/packages/hal/sparc/arch/current/src/hal_boot.c
@@ -55,6 +55,8 @@
#include CYGHWR_MEMORY_LAYOUT_H
#include "hal/boot_params/boot_params_copy.h"
+#include "hal/arch/dlink/dlink.h"
+#include "hal/arch/platform.h"
/*------------------------------------------------------------------------*/
/* calling this is our raison d'etre: */
@@ -100,6 +102,7 @@ void hal_zero_bss(void)
}
#ifdef CYG_HAL_LOCALRAM
+
void hal_init_localram(void)
{
extern long __ilram_source;
@@ -118,6 +121,45 @@ void hal_init_localram(void)
while( dw < endw )
*dw++ = *sw++;
+ /* In newer chips we have a ILRAM size twice bigger. */
+ if (!arch_is_spc300 ())
+ {
+ extern long _stext;
+ extern long _etext;
+ extern long __ilram2_start;
+ extern long __ilram2_end;
+ extern long __callbacks_start;
+ extern long __callbacks_end;
+
+ long *pstext = &_stext;
+ long *petext = &_etext;
+ long *ilram2_start = &__ilram2_start;
+ long *ilram2_end = &__ilram2_end;
+ long ilram2_size = (long) (ilram2_end - ilram2_start);
+ long *ilram2_real_start = &__ilram_end;
+ long *ilram2_real_end = &__ilram_end + ilram2_size;
+ long *ilram_start = &__ilram_start;
+ long *ilram_end = &__ilram_end;
+ long *cb_start = &__callbacks_start;
+ long *cb_end = &__callbacks_end;
+
+ hal_arch_dlink_copy_ram_to_ilram (
+ ilram2_real_start, ilram2_real_end, ilram2_start, ilram2_end);
+
+ /* Patch the TEXT call to the ILRAM2 section to the ILRAM section. */
+ hal_arch_dlink_patch_ram_call_inst (
+ pstext, petext, ilram2_start, ilram2_end, ilram2_real_start);
+
+ hal_arch_dlink_patch_ram_call_inst (
+ ilram_start, ilram_end, ilram2_start,
+ ilram2_end, ilram2_real_start);
+
+ /* Patch callbacks section. */
+ hal_arch_dlink_patch_callbacks (
+ cb_start, cb_end, ilram2_start,
+ ilram2_end, ilram2_real_start);
+ }
+
long long *s = &__dlram_data_source;
long long *d = &__dlram_data_start;
long long *end = &__dlram_data_end;
diff --git a/cesar/ecos/packages/hal/sparc/arch/current/src/sparc.ld b/cesar/ecos/packages/hal/sparc/arch/current/src/sparc.ld
index 8e5cd1c654..aae319ffef 100644
--- a/cesar/ecos/packages/hal/sparc/arch/current/src/sparc.ld
+++ b/cesar/ecos/packages/hal/sparc/arch/current/src/sparc.ld
@@ -62,6 +62,13 @@ GROUP(libtarget.a libgcc.a)
__ilram_end = ABSOLUTE (.); } \
> _region_
+#define SECTION_ilram2(_region_, _vma_, _lma_) \
+ .ilram2 _vma_ : _lma_ \
+ { __ilram2_start = ABSOLUTE (.); \
+ KEEP (*(.ilram2)); \
+ __ilram2_end = ABSOLUTE (.); } \
+ > _region_
+
#define SECTION_dlram_data(_region_, _vma_, _lma_) \
.dlram_data _vma_ : _lma_ \
{ . = ALIGN (8); \
@@ -71,6 +78,13 @@ GROUP(libtarget.a libgcc.a)
__dlram_data_end = ABSOLUTE (.); } \
> _region_
+#define SECTION_callbacks(_region_, _vma_, _lma_) \
+ .callbacks _vma_ : _lma_ \
+ { __callbacks_start = ABSOLUTE (.); \
+ KEEP (*(.callbacks)); \
+ __callbacks_end = ABSOLUTE (.); } \
+ > _region_
+
#define SECTION_dlram_bss(_region_, _vma_, _lma_) \
.dlram_bss _vma_ : _lma_ \
{ . = ALIGN (8); \
diff --git a/cesar/ecos/packages/hal/sparc/leon/current/include/pkgconf/mlt_sparc_leon_ahbram.ldi b/cesar/ecos/packages/hal/sparc/leon/current/include/pkgconf/mlt_sparc_leon_ahbram.ldi
index 75dc63f9b5..3742dd7f6a 100644
--- a/cesar/ecos/packages/hal/sparc/leon/current/include/pkgconf/mlt_sparc_leon_ahbram.ldi
+++ b/cesar/ecos/packages/hal/sparc/leon/current/include/pkgconf/mlt_sparc_leon_ahbram.ldi
@@ -20,6 +20,8 @@ SECTIONS
SECTION_gcc_except_table (ahbram, ALIGN (0x1), LMA_EQ_VMA)
SECTION_data (ahbram, ALIGN (0x1), LMA_EQ_VMA)
SECTION_private (ahbram, ALIGN (0x4), LMA_EQ_VMA)
+ SECTION_ilram2 (ahbram, , LMA_EQ_VMA)
+ SECTION_callbacks (ahbram, ,LMA_EQ_VMA)
SECTION_bss (ahbram, ALIGN (0x8) (NOLOAD), LMA_EQ_VMA)
#ifdef CYG_HAL_LOCALRAM
// Will be overwritten by bss.
diff --git a/cesar/ecos/packages/hal/sparc/leon/current/include/pkgconf/mlt_sparc_leon_ram.ldi b/cesar/ecos/packages/hal/sparc/leon/current/include/pkgconf/mlt_sparc_leon_ram.ldi
index 7245ca3cdb..30b6fc206c 100644
--- a/cesar/ecos/packages/hal/sparc/leon/current/include/pkgconf/mlt_sparc_leon_ram.ldi
+++ b/cesar/ecos/packages/hal/sparc/leon/current/include/pkgconf/mlt_sparc_leon_ram.ldi
@@ -19,6 +19,8 @@ SECTIONS
SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA)
SECTION_data (ram, ALIGN (0x1), LMA_EQ_VMA)
SECTION_private (ram, ALIGN (0x4), LMA_EQ_VMA)
+ SECTION_ilram2 (ram, , LMA_EQ_VMA)
+ SECTION_callbacks (ram, ,LMA_EQ_VMA)
SECTION_bss (ram, ALIGN (0x8) (NOLOAD), LMA_EQ_VMA)
#ifdef CYG_HAL_LOCALRAM
// Will be overwritten by bss.
diff --git a/cesar/hal/arch/Config b/cesar/hal/arch/Config
index 5d46bd1570..7d8dbbee7f 100644
--- a/cesar/hal/arch/Config
+++ b/cesar/hal/arch/Config
@@ -1 +1,2 @@
CONFIG_ARCH_ILRAM_PRIO = 5
+CONFIG_ARCH_ILRAM2_PRIO = 0
diff --git a/cesar/hal/arch/Module b/cesar/hal/arch/Module
index 3d606f52cb..dcac4337c2 100644
--- a/cesar/hal/arch/Module
+++ b/cesar/hal/arch/Module
@@ -1,5 +1,6 @@
ifeq ($($(BUILD_TYPE_VAR)),sparc)
SOURCES := sparc.c sparc_stack.S
+MODULES += hal/arch/dlink
else
SOURCES :=
endif
diff --git a/cesar/hal/arch/arch.h b/cesar/hal/arch/arch.h
index 12c6f89acd..19c96382d7 100644
--- a/cesar/hal/arch/arch.h
+++ b/cesar/hal/arch/arch.h
@@ -21,6 +21,13 @@
#define ARCH_ILRAM
/**
+ * Put in the instruction local ram section.
+ *
+ * Should be put between function return type and function name.
+ */
+#define ARCH_ILRAM2
+
+/**
* Put in the instruction local ram section, with lower priority.
* \param prio function priority
*
@@ -31,6 +38,16 @@
#define ARCH_ILRAM_PRIO(prio)
/**
+ * Put in the instruction local ram section, with lower priority.
+ * \param prio function priority
+ *
+ * Should be put between function return type and function name. Function
+ * will be included in local ram only if priority is lower than the
+ * configured limit.
+ */
+#define ARCH_ILRAM2_PRIO(prio)
+
+/**
* Put in the data local ram section.
*/
#define ARCH_DLRAM_DATA
diff --git a/cesar/hal/arch/dlink/Module b/cesar/hal/arch/dlink/Module
new file mode 100644
index 0000000000..0a55d4d7ef
--- /dev/null
+++ b/cesar/hal/arch/dlink/Module
@@ -0,0 +1 @@
+SOURCES := dlink.c
diff --git a/cesar/hal/arch/dlink/dlink.h b/cesar/hal/arch/dlink/dlink.h
new file mode 100644
index 0000000000..38c8045ac3
--- /dev/null
+++ b/cesar/hal/arch/dlink/dlink.h
@@ -0,0 +1,78 @@
+#ifndef hal_arch_dlink_dlink_h
+#define hal_arch_dlink_dlink_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file hal/arch/dlink/dlink.h
+ * \brief Handle dynamic link patch section
+ * \ingroup hal_arch_dlink
+ *
+ * Function to modify call instruction of the copied ILRAM section from RAM to
+ * ILRAM and callbacks to point to the function in ILRAM.
+ */
+
+/**
+ * Copy the code from RAM to local RAM and fix call offset.
+ * \param ils the ilram destination start address
+ * \param ile the ilram destination end address
+ * \param rams the begin of instructions from RAM to copy
+ * \param rame the end of instructions from RAM to copy
+ *
+ * This function should modify the call instructions which points to an
+ * address function which are outside the copied instructions.
+ *
+ * \note: SPARC call instruction:
+ * bits 31-30 = 0b01 = Call
+ * bits 29-0 = PC relative shifted address.
+ *
+ * The new address is PC + <relative @> * 4
+ */
+void
+hal_arch_dlink_copy_ram_to_ilram (
+ unsigned long *ils, unsigned long *ile,
+ unsigned long *rams, unsigned long *rame);
+
+/**
+ * Modify SPARC call instruction in RAM memory to point to ILRAM.
+ * \param sw the source word to start to read from
+ * \param endw the end word to stop
+ * \param zb the begin zone to modify the call instruction
+ * \param ze the end zone to modify the call instruction
+ * \param zn the new zone base address to use
+ *
+ * This function should modify the call instructions which points to an
+ * address function which has moved from RAM to ILRAM.
+ *
+ * \note: SPARC call instruction:
+ * bits 31-30 = 0b01 = Call
+ * bits 29-0 = PC relative shifted address.
+ *
+ * The new address is PC + <relative @> * 4
+ */
+void
+hal_arch_dlink_patch_ram_call_inst (
+ unsigned long *sw, unsigned long *endw,
+ unsigned long *zb, unsigned long *ze, unsigned long *zn);
+
+/**
+ * Patch callbacks section
+ * \param sw the source word to start to read from
+ * \param endw the end word to stop
+ * \param zb the begin zone to modify the call instruction
+ * \param ze the end zone to modify the call instruction
+ * \param zn the new zone base address to use
+ *
+ * Search addresses which can be in ILRAM2 and modify the associated
+ * callbacks.
+ */
+void
+hal_arch_dlink_patch_callbacks (
+ unsigned long *sw, unsigned long *endw,
+ unsigned long *zb, unsigned long *ze, unsigned long *zn);
+
+#endif /* hal_arch_dlink_dlink_h */
diff --git a/cesar/hal/arch/dlink/src/dlink.c b/cesar/hal/arch/dlink/src/dlink.c
new file mode 100644
index 0000000000..ac552a5b24
--- /dev/null
+++ b/cesar/hal/arch/dlink/src/dlink.c
@@ -0,0 +1,128 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file hal/arch/dlink/src/dlink.c
+ * \brief Handle dynamic link patch section
+ * \ingroup hal_arch_dlink
+ */
+#include "common/std.h"
+
+/** Sparc CALL instruction OP code. */
+#define HAL_ARCH_DLINK_SPARC_CALL_OP_CODE 0x40000000
+/** Sparc CALL instruction OP code MASK. */
+#define HAL_ARCH_DLINK_SPARC_CALL_OP_CODE_MASK 0xc0000000
+/** Sparc CALL instruction bits offset */
+#define HAL_ARCH_DLINK_IS_SPARC_CALL_INST_OFFSET 2
+/** Sparc CALL instruction address offset to jump to. */
+#define HAL_ARCH_DLINK_SPARC_CALL_ADDR(inst) \
+ ((inst) << HAL_ARCH_DLINK_IS_SPARC_CALL_INST_OFFSET)
+
+
+#ifdef __sparc__
+/**
+ * Flush an address.
+ * \param addr the address to flush.
+ */
+static inline void
+hal_arch_dlink_flush_addr (unsigned long *addr)
+{
+ __asm__ __volatile__ ("flush %0"
+ : /* No outputs */
+ : "r" (addr)
+ : "memory");
+}
+#else /* !__sparc__*/
+# define hal_arch_dlink_flush_addr(arg)
+#endif
+
+void
+hal_arch_dlink_copy_ram_to_ilram (
+ unsigned long *ils, unsigned long *ile,
+ unsigned long *rams, unsigned long *rame)
+{
+ unsigned long *addr;
+ unsigned long addr_offset;
+ unsigned long *ilram_in_ram_start = rams;
+ unsigned long *ilram_in_ram_end = rame;
+ dbg_assert (rams < rame);
+ dbg_assert (ils < ile);
+ for ( ; ils < ile; ils++, rams++ )
+ {
+ *ils = *rams;
+ /* Seek the call instruction. */
+ if ((*rams & HAL_ARCH_DLINK_SPARC_CALL_OP_CODE_MASK)
+ == HAL_ARCH_DLINK_SPARC_CALL_OP_CODE)
+ {
+ addr_offset = HAL_ARCH_DLINK_SPARC_CALL_ADDR(*rams);
+ /* To have the real address, it need to add the current PC which
+ * corresponds to the current rams. */
+ addr = (unsigned long*) (addr_offset + (unsigned long) rams);
+ if (addr < ilram_in_ram_start || addr > ilram_in_ram_end)
+ {
+ addr_offset = (unsigned long) addr - (unsigned long) ils;
+ *ils = HAL_ARCH_DLINK_SPARC_CALL_OP_CODE
+ | (addr_offset >> HAL_ARCH_DLINK_IS_SPARC_CALL_INST_OFFSET);
+ hal_arch_dlink_flush_addr (ils);
+ }
+ }
+ /* Clean the rams zone. */
+ *rams = 0;
+ }
+}
+
+void
+hal_arch_dlink_patch_ram_call_inst (
+ unsigned long *sw, unsigned long *endw, unsigned long *zb,
+ unsigned long *ze, unsigned long *zn)
+{
+ unsigned long zone_offset = (unsigned long) zn - (unsigned long) zb;
+ unsigned long *addr;
+ unsigned long addr_offset;
+ dbg_assert (sw < endw);
+ dbg_assert (zb < ze);
+ for ( ; sw < endw; sw++ )
+ {
+ /* Seek the call instruction. */
+ if ((*sw & HAL_ARCH_DLINK_SPARC_CALL_OP_CODE_MASK)
+ == HAL_ARCH_DLINK_SPARC_CALL_OP_CODE)
+ {
+ addr_offset = HAL_ARCH_DLINK_SPARC_CALL_ADDR(*sw);
+ /* To have the real address, it need to add the current PC which
+ * corresponds to the current sw. */
+ addr = (unsigned long*) (addr_offset + (unsigned long) sw);
+ if (addr >= zb && addr < ze)
+ {
+ /* Patch with the new address. */
+ addr_offset = zone_offset + addr_offset;
+ *sw = HAL_ARCH_DLINK_SPARC_CALL_OP_CODE
+ | (addr_offset >> HAL_ARCH_DLINK_IS_SPARC_CALL_INST_OFFSET);
+ hal_arch_dlink_flush_addr (sw);
+ }
+ }
+ }
+}
+
+void
+hal_arch_dlink_patch_callbacks (
+ unsigned long *sw, unsigned long *endw,
+ unsigned long *zb, unsigned long *ze, unsigned long *zn)
+{
+ unsigned long addr_offset;
+ dbg_assert (sw < endw);
+ dbg_assert (zb < ze);
+ for ( ; sw < endw; sw++ )
+ {
+ if ((unsigned long*) *sw >= zb && (unsigned long*) *sw < ze)
+ {
+ addr_offset = *sw - (unsigned long) zb;
+ /* Patch with the new address. */
+ *sw = (unsigned long) zn + addr_offset;
+ hal_arch_dlink_flush_addr (sw);
+ }
+ }
+}
diff --git a/cesar/hal/arch/dlink/test/Makefile b/cesar/hal/arch/dlink/test/Makefile
new file mode 100644
index 0000000000..9d6884bbe3
--- /dev/null
+++ b/cesar/hal/arch/dlink/test/Makefile
@@ -0,0 +1,17 @@
+BASE = ../../../..
+
+TARGET = sparc
+ECOS = y
+
+COMMON_SOURCES = test_dlink.c test_dlink_host.c
+COMMON_MODULES = lib
+
+HOST_PROGRAMS = test_dlink
+test_dlink_SOURCES = $(COMMON_SOURCES)
+test_dlink_MODULES = $(COMMON_MODULES) hal/arch/dlink
+
+TARGET_PROGRAMS = test_sparc_dlink
+test_sparc_dlink_SOURCES = $(COMMON_SOURCES) test_dlink_sparc.c
+test_sparc_dlink_MODULES = $(COMMON_MODULES) hal/arch
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/hal/arch/dlink/test/ecos.ecc.sh b/cesar/hal/arch/dlink/test/ecos.ecc.sh
new file mode 100644
index 0000000000..db2208c6cc
--- /dev/null
+++ b/cesar/hal/arch/dlink/test/ecos.ecc.sh
@@ -0,0 +1,5 @@
+config=${1:-ecos-gen.ecc}
+ecosconfig --config=$config new sparc_leon default
+cat >> $config <<'EOF'
+EOF
+ecosconfig --config=$config check
diff --git a/cesar/hal/arch/dlink/test/src/test_dlink.c b/cesar/hal/arch/dlink/test/src/test_dlink.c
new file mode 100644
index 0000000000..b4ab32812e
--- /dev/null
+++ b/cesar/hal/arch/dlink/test/src/test_dlink.c
@@ -0,0 +1,37 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file hal/arch/dlink/test/src/test_dlink.c
+ * \brief Unit test for dynamic link functions
+ * \ingroup hal_arch_dlink
+ */
+#include "common/std.h"
+#include "lib/test.h"
+
+void
+test_suite_dlink_host (test_t test);
+
+#ifdef __sparc__
+
+void
+test_suite_dlink_sparc (test_t test);
+
+#endif /* !__sparc__ */
+
+int
+main (int argc, char **argv)
+{
+ test_t test;
+ test_init (test, argc, argv);
+ test_suite_dlink_host (test);
+#ifdef __sparc__
+ test_suite_dlink_sparc (test);
+#endif /* !__sparc__ */
+ test_result (test);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
diff --git a/cesar/hal/arch/dlink/test/src/test_dlink_host.c b/cesar/hal/arch/dlink/test/src/test_dlink_host.c
new file mode 100644
index 0000000000..d9318a8f23
--- /dev/null
+++ b/cesar/hal/arch/dlink/test/src/test_dlink_host.c
@@ -0,0 +1,124 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file hal/arch/dlink/test/src/test_dlink_host.c
+ * \brief Test dynamic link functions.
+ * \ingroup hal_arch_dlink
+ */
+#include "common/std.h"
+#include "lib/utils.h"
+#include "lib/test.h"
+#include "hal/arch/dlink/dlink.h"
+
+void
+test_dlink_host_copy_ram_to_ilram__prepare_section (
+ unsigned long *mem, int size)
+{
+ int i;
+ for (i = 0; i < size; i++)
+ {
+ if (i < 3)
+ mem[i] = 0x40000000 + i;
+ else
+ mem[i] = 0x40000100 + i;
+ }
+}
+
+void
+test_dlink_host_copy_ram_to_ilram (test_t test)
+{
+ unsigned long mem_src [10], mem_dst [10];
+ test_begin (test, "Copy from one zone to another")
+ {
+ unsigned long *addr;
+ unsigned long *src_start = mem_src;
+ unsigned long *src_end = &mem_src[COUNT (mem_src)];
+ unsigned long *dst_start = mem_dst;
+ unsigned long *dst_end = &mem_dst[COUNT (mem_dst)];
+ test_dlink_host_copy_ram_to_ilram__prepare_section (
+ mem_src, COUNT (mem_src));
+ /* Call the function. */
+ hal_arch_dlink_copy_ram_to_ilram (dst_start, dst_end, src_start, src_end);
+ /* Restore the mem_src. */
+ test_dlink_host_copy_ram_to_ilram__prepare_section (
+ mem_src, COUNT (mem_src));
+ /* verify. */
+ unsigned long *sw, *dw;
+ bool addr_outside_zone = false;
+ bool addr_inside_zone = false;
+ unsigned long addr_offset;
+ for (sw = src_start, dw = dst_start; sw < src_end; sw++, dw++)
+ {
+ addr = (unsigned long*) ((unsigned long) sw + (*sw << 2));
+ if (addr < src_start || addr >= src_end)
+ {
+ addr_offset = (unsigned long) addr - (unsigned long) dw;
+ test_fail_unless ((unsigned long) *dw << 2 == addr_offset);
+ addr_outside_zone = true;
+ }
+ else
+ {
+ test_fail_unless (*sw == *dw);
+ addr_inside_zone = true;
+ }
+ }
+ test_fail_unless (addr_inside_zone);
+ test_fail_unless (addr_outside_zone);
+ }
+ test_end;
+}
+
+
+void
+test_dlink_host_patch_ram_call_inst (test_t test)
+{
+ unsigned long mem [10];
+ test_begin (test, "Patch call to ilram zone")
+ {
+ unsigned long i;
+ unsigned long *start = mem;
+ unsigned long *end = &mem[COUNT(mem)];
+ unsigned long *zb = (unsigned long*) 0x400001c;
+ unsigned long *ze = (unsigned long*) 0x4000100;
+ unsigned long *zn = (unsigned long*) 0x7000000;
+
+ unsigned long *sw;
+ unsigned long offset;
+ for (i = 0, sw = start; sw < end; sw++, i++)
+ {
+ offset = (unsigned long) zb - (unsigned long) sw;
+ *sw = 0x40000000 | ((offset + i * 4) >> 2);
+ }
+ /* Call the function. */
+ hal_arch_dlink_patch_ram_call_inst (start, end, zb, ze, zn);
+ /* verify. */
+ unsigned long addr;
+ for (sw = start; sw < end; sw++)
+ {
+ addr = (unsigned long) sw + (*sw << 2);
+ test_fail_unless (addr >= (unsigned long) zn
+ && addr < (unsigned long) zn + 0x10000);
+ }
+ }
+ test_end;
+}
+
+void
+test_case_dlink_host_memory_copy (test_t test)
+{
+ test_case_begin (test, "Verify copy and patch functions");
+ test_dlink_host_copy_ram_to_ilram (test);
+ test_dlink_host_patch_ram_call_inst (test);
+}
+
+void
+test_suite_dlink_host (test_t test)
+{
+ test_suite_begin (test, "dlink host");
+ test_case_dlink_host_memory_copy (test);
+}
diff --git a/cesar/hal/arch/dlink/test/src/test_dlink_sparc.c b/cesar/hal/arch/dlink/test/src/test_dlink_sparc.c
new file mode 100644
index 0000000000..e089805eb6
--- /dev/null
+++ b/cesar/hal/arch/dlink/test/src/test_dlink_sparc.c
@@ -0,0 +1,175 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file hal/arch/dlink/test/src/test_dlink_sparc.c
+ * \brief Functions to test on sparc processor.
+ * \ingroup hal_arch_dlink
+ */
+#include "common/std.h"
+#include "lib/test.h"
+#include "lib/utils.h"
+#include "hal/arch/arch.h"
+#include "hal/arch/dlink/dlink.h"
+
+typedef void (*func_cb) (test_t test);
+
+unsigned long ARCH_ILRAM
+test_dlink_sparc_ilram_get_pc (void)
+{
+ /* Get caller program counter. */
+ unsigned long pc = 0;
+ __asm__ __volatile__ ("mov %%o7, %0" : "=r" (pc));
+ return pc;
+}
+
+void ARCH_ILRAM2
+test_dlink_sparc_ilram_check_pc (test_t test)
+{
+ test_within (test);
+ unsigned long pc = test_dlink_sparc_ilram_get_pc ();
+ test_fail_unless (pc >= 0x70000000 && pc <= 0x71000000);
+}
+
+void ARCH_ILRAM2
+test_dlink_sparc_ilram_verify_pc_from_ilram2 (test_t test)
+{
+ test_begin (test, "should be in ilram")
+ {
+ test_dlink_sparc_ilram_check_pc (test);
+ }
+ test_end;
+}
+
+void ARCH_ILRAM
+test_dlink_sparc_ilram_verify_pc_from_ilram (test_t test)
+{
+ test_begin (test, "should be in ilram")
+ {
+ test_dlink_sparc_ilram_check_pc (test);
+ }
+ test_end;
+}
+
+void
+test_case_dlink_sparc_ilram (test_t test)
+{
+ /* Copy the ILRAM2 function to ILRAM. */
+ extern unsigned long __ilram2_start;
+ extern unsigned long __ilram2_end;
+ extern unsigned long __ilram_start;
+ extern unsigned long __ilram_end;
+ extern unsigned long _stext;
+ extern unsigned long _etext;
+ extern unsigned long __callbacks_start;
+ extern unsigned long __callbacks_end;
+
+ unsigned long *pstext = (unsigned long*) &_stext;
+ unsigned long *petext = (unsigned long*) &_etext;
+ unsigned long *ilram2_start = (unsigned long*) &__ilram2_start;
+ unsigned long *ilram2_end = (unsigned long*) &__ilram2_end;
+ unsigned long ilram2_size = (unsigned long) (ilram2_end - ilram2_start);
+ unsigned long *ilram2_real_start = (unsigned long*) &__ilram_end;
+ unsigned long *ilram2_real_end = (unsigned long*) &__ilram_end
+ + ilram2_size;
+ unsigned long *ilram_start = (unsigned long*) &__ilram_start;
+ unsigned long *ilram_end = (unsigned long*) &__ilram_end;
+ unsigned long *cb_start = (unsigned long*) &__callbacks_start;
+ unsigned long *cb_end = (unsigned long*) &__callbacks_end;
+
+ test_case_begin (test, "Call function from ilram to ilram2");
+
+ if (arch_is_spc300 ())
+ {
+ hal_arch_dlink_copy_ram_to_ilram (
+ ilram2_real_start, ilram2_real_end, ilram2_start, ilram2_end);
+
+ /* Patch the TEXT call to the ILRAM2 section to the ILRAM section. */
+ hal_arch_dlink_patch_ram_call_inst (
+ pstext, petext, ilram2_start, ilram2_end, ilram2_real_start);
+
+ hal_arch_dlink_patch_ram_call_inst (
+ ilram_start, ilram_end, ilram2_start,
+ ilram2_end, ilram2_real_start);
+
+ hal_arch_dlink_patch_callbacks (
+ cb_start, cb_end, ilram2_start,
+ ilram2_end, ilram2_real_start);
+ }
+
+ /* Proceed the test. */
+ test_dlink_sparc_ilram_verify_pc_from_ilram2 (test);
+ test_dlink_sparc_ilram_verify_pc_from_ilram (test);
+}
+
+void ARCH_ILRAM2
+test_dlink_sparc_switch_a (test_t test, char c)
+{
+ test_within (test);
+ test_fail_unless (c == 'a');
+}
+
+void ARCH_ILRAM2
+test_dlink_sparc_switch_b (test_t test, char c)
+{
+ test_within (test);
+ test_fail_unless (c == 'b');
+}
+
+void ARCH_ILRAM2
+test_dlink_sparc_switch (test_t test)
+{
+ char c;
+ for (c = 'a'; c < 'c'; c++)
+ {
+ switch (c)
+ {
+ case 'a':
+ test_dlink_sparc_switch_a (test, c);
+ break;
+ case 'b':
+ test_dlink_sparc_switch_b (test, c);
+ break;
+ }
+ }
+}
+
+void
+test_case_dlink_sparc_switch (test_t test)
+{
+ test_case_begin (test, "Switch case");
+ test_dlink_sparc_switch (test);
+}
+
+void ARCH_ILRAM2
+test_dlink_sparc_callback (test_t test)
+{
+ test_within (test);
+ unsigned long pc = test_dlink_sparc_ilram_get_pc ();
+ test_fail_unless (pc >= 0x70000000 && pc <= 0x71000000);
+}
+
+void ARCH_ILRAM2
+test_case_dlink_sparc_callback (test_t test)
+{
+ test_case_begin (test, "Callbacks");
+ test_begin (test, "Callback must be in ILRAM")
+ {
+ func_cb f = CALLBACK (test_dlink_sparc_callback);
+ (*f) (test);
+ }
+ test_end;
+}
+
+void
+test_suite_dlink_sparc (test_t test)
+{
+ test_suite_begin (test, "Code from ilram2 section to ilram");
+ test_case_dlink_sparc_ilram (test);
+ test_case_dlink_sparc_switch (test);
+ test_case_dlink_sparc_callback (test);
+}
diff --git a/cesar/hal/arch/inc/regs_addr.h b/cesar/hal/arch/inc/regs_addr.h
index 2c5f34f706..79e0e25163 100644
--- a/cesar/hal/arch/inc/regs_addr.h
+++ b/cesar/hal/arch/inc/regs_addr.h
@@ -16,8 +16,8 @@
#define ARCH_SYS_APB_BASE_ADDR 0xc8000000
#define ARCH_MARIA_RB_BASE_ADDR (ARCH_SYS_APB_BASE_ADDR + 0x040000)
-#define ARCH_MARIA_RB_REG(addr) (* (volatile u32 *) (ARCH_MARIA_RB_BASE_ADDR + (addr)))
-#define ARCH_MARIA_RB_CONST_REG(addr) (* (u32 *) (ARCH_MARIA_RB_BASE_ADDR + (addr)))
+#define ARCH_MARIA_RB_REG(addr) (* (volatile unsigned long*) (ARCH_MARIA_RB_BASE_ADDR + (addr)))
+#define ARCH_MARIA_RB_CONST_REG(addr) (* (unsigned long *) (ARCH_MARIA_RB_BASE_ADDR + (addr)))
/* This one is not supposed to be changed after startup, drop volatile. */
#define ARCH_MARIA_RB_LEON_ADD_START ARCH_MARIA_RB_CONST_REG (0x120)
diff --git a/cesar/hal/arch/inc/sparc.h b/cesar/hal/arch/inc/sparc.h
index 0ef826bef7..ab3e75a47c 100644
--- a/cesar/hal/arch/inc/sparc.h
+++ b/cesar/hal/arch/inc/sparc.h
@@ -19,32 +19,60 @@
#if defined (ECOS) && ECOS
# include "config/arch/ilram.h"
+# include "config/arch/ilram2.h"
# undef ARCH_ILRAM
# define ARCH_ILRAM __attribute__ ((section (".ilram")))
+# undef ARCH_ILRAM2
+# define ARCH_ILRAM2 __attribute__ ((section (".ilram2")))
+
# undef ARCH_ILRAM_PRIO
# define ARCH_ILRAM_PRIO(prio) PASTE (ARCH_ILRAM_PRIO_, prio)
+# undef ARCH_ILRAM2_PRIO
+# define ARCH_ILRAM2_PRIO(prio) PASTE (ARCH_ILRAM2_PRIO_, prio)
+
# if CONFIG_ARCH_ILRAM_PRIO >= 3
# define ARCH_ILRAM_PRIO_3 ARCH_ILRAM
# else
-# define ARCH_ILRAM_PRIO_3
+# define ARCH_ILRAM_PRIO_3 ARCH_ILRAM2_PRIO_3
# endif
# if CONFIG_ARCH_ILRAM_PRIO >= 2
# define ARCH_ILRAM_PRIO_2 ARCH_ILRAM
# else
-# define ARCH_ILRAM_PRIO_2
+# define ARCH_ILRAM_PRIO_2 ARCH_ILRAM2_PRIO_2
# endif
# if CONFIG_ARCH_ILRAM_PRIO >= 1
# define ARCH_ILRAM_PRIO_1 ARCH_ILRAM
# else
-# define ARCH_ILRAM_PRIO_1
+# define ARCH_ILRAM_PRIO_1 ARCH_ILRAM2_PRIO_1
# endif
# if CONFIG_ARCH_ILRAM_PRIO >= 0
# define ARCH_ILRAM_PRIO_0 ARCH_ILRAM
# else
-# define ARCH_ILRAM_PRIO_0
+# define ARCH_ILRAM_PRIO_0 ARCH_ILRAM2
+# endif
+
+# if CONFIG_ARCH_ILRAM2_PRIO > 3
+# define ARCH_ILRAM2_PRIO_3 ARCH_ILRAM2
+# else
+# define ARCH_ILRAM2_PRIO_3
+# endif
+# if CONFIG_ARCH_ILRAM2_PRIO > 2
+# define ARCH_ILRAM2_PRIO_2 ARCH_ILRAM2
+# else
+# define ARCH_ILRAM2_PRIO_2
+# endif
+# if CONFIG_ARCH_ILRAM2_PRIO > 1
+# define ARCH_ILRAM2_PRIO_1 ARCH_ILRAM2
+# else
+# define ARCH_ILRAM2_PRIO_1
+# endif
+# if CONFIG_ARCH_ILRAM2_PRIO > 0
+# define ARCH_ILRAM2_PRIO_0 ARCH_ILRAM2
+# else
+# define ARCH_ILRAM2_PRIO_0
# endif
# undef ARCH_DLRAM_DATA
diff --git a/cesar/hal/arch/platform.h b/cesar/hal/arch/platform.h
index 9cbc82d7ca..0fba9c9a54 100644
--- a/cesar/hal/arch/platform.h
+++ b/cesar/hal/arch/platform.h
@@ -14,7 +14,9 @@
*/
#include "hal/arch/inc/regs_addr.h"
+#if !defined (__sparc__)
BEGIN_DECLS
+#endif /* !defined (__sparc__) */
/**
* Return true if the platform is SPC300.
@@ -36,6 +38,8 @@ arch_is_mse500 (void)
return ARCH_MARIA_RB_DEVICE_ID;
}
+#if !defined (__sparc__)
END_DECLS
+#endif /* !defined (__sparc__) */
#endif /* hal_arch_platform_h */
diff --git a/cesar/hal/phy/test/phy/src/basic.c b/cesar/hal/phy/test/phy/src/basic.c
index 8f35daa7e4..74f59a5321 100644
--- a/cesar/hal/phy/test/phy/src/basic.c
+++ b/cesar/hal/phy/test/phy/src/basic.c
@@ -34,12 +34,17 @@ test_phy_basic (test_t t, test_phy_t *ctx, test_phy_msg_basic_t *msg)
test_begin (t, "init")
{
phy_uninit (ctx->phy);
- ctx->phy = phy_init (ctx, test_phy_rx_fc_cb, test_phy_access_cb,
- test_phy_access_conf_cb, test_phy_pbdma_cb,
- test_phy_tx_false_alarm_cb, test_phy_deferred_cb);
+ ctx->phy = phy_init (ctx,
+ CALLBACK (test_phy_rx_fc_cb),
+ CALLBACK (test_phy_access_cb),
+ CALLBACK (test_phy_access_conf_cb),
+ CALLBACK (test_phy_pbdma_cb),
+ CALLBACK (test_phy_tx_false_alarm_cb),
+ CALLBACK (test_phy_deferred_cb));
phy_set_tonemask (ctx->phy, ctx->tonemask,
ctx->tonemask_carrier_nb);
- phy_extra_timer_init (ctx->phy, ctx, test_phy_extra_timer_cb);
+ phy_extra_timer_init (ctx->phy, ctx,
+ CALLBACK (test_phy_extra_timer_cb));
test_phy_check_error (t, ctx);
} test_end;
}
diff --git a/cesar/hal/phy/test/phy/src/test_phy.c b/cesar/hal/phy/test/phy/src/test_phy.c
index edf884434d..8e9012b454 100644
--- a/cesar/hal/phy/test/phy/src/test_phy.c
+++ b/cesar/hal/phy/test/phy/src/test_phy.c
@@ -530,11 +530,15 @@ test_phy_thread (cyg_addrword_t data)
test_phy_t *ctx = (void *) data;
dbg_assert (ctx);
/* Initialise Phy. */
- ctx->phy = phy_init (ctx, test_phy_rx_fc_cb, test_phy_access_cb,
- test_phy_access_conf_cb, test_phy_pbdma_cb,
- test_phy_tx_false_alarm_cb, test_phy_deferred_cb);
+ ctx->phy = phy_init (ctx,
+ CALLBACK (test_phy_rx_fc_cb),
+ CALLBACK (test_phy_access_cb),
+ CALLBACK (test_phy_access_conf_cb),
+ CALLBACK (test_phy_pbdma_cb),
+ CALLBACK (test_phy_tx_false_alarm_cb),
+ CALLBACK (test_phy_deferred_cb));
phy_set_tonemask (ctx->phy, ctx->tonemask, ctx->tonemask_carrier_nb);
- phy_extra_timer_init (ctx->phy, ctx, test_phy_extra_timer_cb);
+ phy_extra_timer_init (ctx->phy, ctx, CALLBACK (test_phy_extra_timer_cb));
/* Handle messages. */
test_phy_msg_t *msg;
while ((msg = cyg_mbox_get (ctx->mbox)))
@@ -659,8 +663,9 @@ cyg_user_start (void)
interface_t *interface =
interface_init (cl, cl_mbx_get (cl), INVALID_PTR,
&mac_config, bufmgr);
- interface_callback_init (interface, cp_mme_recv, interface);
- ipmbox_register_rx_data_cb (ipmbox, INVALID_PTR, cl_ipmbox_data_recv);
+ interface_callback_init (interface, CALLBACK (cp_mme_recv), interface);
+ ipmbox_register_rx_data_cb (ipmbox, INVALID_PTR,
+ CALLBACK (cl_ipmbox_data_recv));
ipmbox_activate (ipmbox, true);
fcall = interface->fcall->fcall_ctx;
#else /* !CONFIG_FCALL_MME */
diff --git a/cesar/hal/timer/src/timer.c b/cesar/hal/timer/src/timer.c
index e97f9eb88f..c8c0444b9a 100644
--- a/cesar/hal/timer/src/timer.c
+++ b/cesar/hal/timer/src/timer.c
@@ -28,7 +28,7 @@ hal_timer_init (void)
(leon_timer_cb_t) hal_timer_instance_process);
// initialise the heap.
- heap_init (&hal_timer_global.heap, hal_timer_instance_lesser);
+ heap_init (&hal_timer_global.heap, CALLBACK (hal_timer_instance_lesser));
hal_timer_global.current_instance = NULL;
diff --git a/cesar/lib/callbacks.h b/cesar/lib/callbacks.h
new file mode 100644
index 0000000000..8987d4a30f
--- /dev/null
+++ b/cesar/lib/callbacks.h
@@ -0,0 +1,39 @@
+#ifndef lib_callbacks_h
+#define lib_callbacks_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file lib/callbacks.h
+ * \brief Macro to use to register callbacks.
+ * \ingroup lib
+ */
+
+#if defined (ECOS) && ECOS && defined (__sparc__)
+
+/**
+ * Insert the callback function in the variable in section callback
+ * \param f the function.
+ * \return the variable to the pointed function.
+ */
+# define CALLBACK(f) \
+ ({ static typeof (f) * volatile p \
+ __attribute__ ((section (".callbacks"))) = &(f); \
+ p; })
+
+#else /* !defined (ECOS) && ECOS && (__sparc__) */
+
+/**
+ * Return the callback function
+ * \param f the function.
+ * \return the variable to the pointed function.
+ */
+# define CALLBACK(f) (f)
+
+#endif
+
+#endif /* lib_callbacks_h */
diff --git a/cesar/lib/src/restrack.c b/cesar/lib/src/restrack.c
index 2c85e66172..8112c63fbf 100644
--- a/cesar/lib/src/restrack.c
+++ b/cesar/lib/src/restrack.c
@@ -105,7 +105,7 @@ restrack_get_instance (void)
restrack_t *ctx = &restrack_global;
if (!ctx->inited)
{
- set_init (&ctx->resources_set, restrack_resource_less);
+ set_init (&ctx->resources_set, CALLBACK (restrack_resource_less));
ctx->inited = true;
}
if (!ctx->atexit_done)
@@ -130,7 +130,7 @@ restrack_resource_new (void *resource, const char *function, int line)
r->references = 0;
r->creator_function = function;
r->creator_line = line;
- set_init (&r->changes_set, restrack_resource_change_less);
+ set_init (&r->changes_set, CALLBACK (restrack_resource_change_less));
return r;
}
diff --git a/cesar/mac/pbproc/src/fsm.c b/cesar/mac/pbproc/src/fsm.c
index abff472235..fac73cc0d5 100644
--- a/cesar/mac/pbproc/src/fsm.c
+++ b/cesar/mac/pbproc/src/fsm.c
@@ -86,10 +86,12 @@ pbproc_fsm_init (pbproc_t *ctx, pbproc_fsm_deferred_cb_t deferred_cb)
ctx->fsm.current_state = PBPROC_FSM_STATE_IDLE;
for (i = 0; i < PBPROC_FSM_STATE_NB; i++)
{
- ctx->fsm.states[i].rx_fc_cb = pbproc_fsm_unexpected_rx_fc;
- ctx->fsm.states[i].access_cb = pbproc_fsm_unexpected_access;
- ctx->fsm.states[i].access_conf_cb = pbproc_fsm_unexpected_access_conf;
- ctx->fsm.states[i].pbdma_cb = pbproc_fsm_unexpected_pbdma;
+ ctx->fsm.states[i].rx_fc_cb = CALLBACK (pbproc_fsm_unexpected_rx_fc);
+ ctx->fsm.states[i].access_cb =
+ CALLBACK (pbproc_fsm_unexpected_access);
+ ctx->fsm.states[i].access_conf_cb =
+ CALLBACK (pbproc_fsm_unexpected_access_conf);
+ ctx->fsm.states[i].pbdma_cb = CALLBACK (pbproc_fsm_unexpected_pbdma);
}
ctx->fsm.deferred_cb = deferred_cb;
ctx->fsm.schedule_deferred = false;
diff --git a/cesar/mac/pbproc/src/fsm_rx_beacon.c b/cesar/mac/pbproc/src/fsm_rx_beacon.c
index 47b780ea50..bc20135b8b 100644
--- a/cesar/mac/pbproc/src/fsm_rx_beacon.c
+++ b/cesar/mac/pbproc/src/fsm_rx_beacon.c
@@ -23,7 +23,7 @@ pbproc_frbe_init (pbproc_t *ctx)
{
dbg_assert (ctx);
ctx->fsm.states[PBPROC_FSM_STATE_RX_BEACON].pbdma_cb =
- pbproc_frbe__rx_beacon__pbdma;
+ CALLBACK (pbproc_frbe__rx_beacon__pbdma);
}
void
diff --git a/cesar/mac/pbproc/src/fsm_rx_data.c b/cesar/mac/pbproc/src/fsm_rx_data.c
index 86c27842d5..288d3eba2b 100644
--- a/cesar/mac/pbproc/src/fsm_rx_data.c
+++ b/cesar/mac/pbproc/src/fsm_rx_data.c
@@ -81,15 +81,15 @@ pbproc_frda_init (pbproc_t *ctx)
{
dbg_assert (ctx);
ctx->fsm.states[PBPROC_FSM_STATE_RX_DATA_WACK].pbdma_cb =
- pbproc_frda__rx_data_wack__pbdma;
+ CALLBACK (pbproc_frda__rx_data_wack__pbdma);
ctx->fsm.states[PBPROC_FSM_STATE_RX_DATA_WACK_LAST_PB].pbdma_cb =
- pbproc_frda__rx_data_wack_last_pb__pbdma;
+ CALLBACK (pbproc_frda__rx_data_wack_last_pb__pbdma);
ctx->fsm.states[PBPROC_FSM_STATE_RX_DATA_WOACK].pbdma_cb =
- pbproc_frda__rx_data_woack__pbdma;
+ CALLBACK (pbproc_frda__rx_data_woack__pbdma);
ctx->fsm.states[PBPROC_FSM_STATE_RX_BURST].rx_fc_cb =
- pbproc_frda__rx_burst__rx_fc;
+ CALLBACK (pbproc_frda__rx_burst__rx_fc);
ctx->fsm.states[PBPROC_FSM_STATE_RX_BURST].access_cb =
- pbproc_frda__rx_burst__access;
+ CALLBACK (pbproc_frda__rx_burst__access);
}
#define PB_EOC_SKIP_LEVEL1 1
diff --git a/cesar/mac/pbproc/src/fsm_rx_sound.c b/cesar/mac/pbproc/src/fsm_rx_sound.c
index 5998ed4e46..1dcecad8b2 100644
--- a/cesar/mac/pbproc/src/fsm_rx_sound.c
+++ b/cesar/mac/pbproc/src/fsm_rx_sound.c
@@ -30,7 +30,7 @@ pbproc_frso_init (pbproc_t *ctx)
{
dbg_assert (ctx);
ctx->fsm.states[PBPROC_FSM_STATE_RX_SOUND].pbdma_cb =
- pbproc_frso__rx_sound__pbdma;
+ CALLBACK (pbproc_frso__rx_sound__pbdma);
}
void ARCH_ILRAM_PRIO (2)
diff --git a/cesar/mac/pbproc/src/fsm_top.c b/cesar/mac/pbproc/src/fsm_top.c
index c940cd803a..04102eff1b 100644
--- a/cesar/mac/pbproc/src/fsm_top.c
+++ b/cesar/mac/pbproc/src/fsm_top.c
@@ -31,9 +31,9 @@ pbproc_ftop_init (pbproc_t *ctx)
{
dbg_assert (ctx);
ctx->fsm.states[PBPROC_FSM_STATE_IDLE].rx_fc_cb =
- pbproc_ftop__idle__rx_fc;
+ CALLBACK (pbproc_ftop__idle__rx_fc);
ctx->fsm.states[PBPROC_FSM_STATE_IDLE].access_cb =
- pbproc_ftop__idle__access;
+ CALLBACK (pbproc_ftop__idle__access);
}
/**
diff --git a/cesar/mac/pbproc/src/fsm_tx_data.c b/cesar/mac/pbproc/src/fsm_tx_data.c
index eea4a4567f..e966a64136 100644
--- a/cesar/mac/pbproc/src/fsm_tx_data.c
+++ b/cesar/mac/pbproc/src/fsm_tx_data.c
@@ -27,19 +27,19 @@ pbproc_ftda_init (pbproc_t *ctx)
{
dbg_assert (ctx);
ctx->fsm.states[PBPROC_FSM_STATE_TX_WAIT_ACCESS_CONF].rx_fc_cb =
- pbproc_ftda__tx_wait_access_conf__rx_fc;
+ CALLBACK (pbproc_ftda__tx_wait_access_conf__rx_fc);
ctx->fsm.states[PBPROC_FSM_STATE_TX_WAIT_ACCESS_CONF].access_cb =
- pbproc_ftda__tx_wait_access_conf__access;
+ CALLBACK (pbproc_ftda__tx_wait_access_conf__access);
ctx->fsm.states[PBPROC_FSM_STATE_TX_WAIT_ACCESS_CONF].access_conf_cb =
- pbproc_ftda__tx_wait_access_conf__access_conf;
+ CALLBACK (pbproc_ftda__tx_wait_access_conf__access_conf);
ctx->fsm.states[PBPROC_FSM_STATE_TX_WAIT_SACKD].rx_fc_cb =
- pbproc_ftda__tx_wait_sackd__rx_fc;
+ CALLBACK (pbproc_ftda__tx_wait_sackd__rx_fc);
ctx->fsm.states[PBPROC_FSM_STATE_TX_WAIT_SACKD].access_cb =
- pbproc_ftda__tx_wait_sackd__access;
+ CALLBACK (pbproc_ftda__tx_wait_sackd__access);
ctx->fsm.states[PBPROC_FSM_STATE_TX_WAIT_TX_END].pbdma_cb =
- pbproc_ftda__tx_wait_tx_end__pbdma;
+ CALLBACK (pbproc_ftda__tx_wait_tx_end__pbdma);
ctx->fsm.states[PBPROC_FSM_STATE_TX_BURST].access_conf_cb =
- pbproc_ftda__tx_burst__access_conf;
+ CALLBACK (pbproc_ftda__tx_burst__access_conf);
}
void ARCH_ILRAM
diff --git a/cesar/mac/pbproc/src/fsm_tx_rts_cts.c b/cesar/mac/pbproc/src/fsm_tx_rts_cts.c
index bcfdded11d..792ca3add5 100644
--- a/cesar/mac/pbproc/src/fsm_tx_rts_cts.c
+++ b/cesar/mac/pbproc/src/fsm_tx_rts_cts.c
@@ -27,9 +27,9 @@ pbproc_ftrc_init (pbproc_t *ctx)
{
dbg_assert (ctx);
ctx->fsm.states[PBPROC_FSM_STATE_TX_WAIT_CTS].rx_fc_cb =
- pbproc_ftrc__tx_wait_cts__rx_fc;
+ CALLBACK (pbproc_ftrc__tx_wait_cts__rx_fc);
ctx->fsm.states[PBPROC_FSM_STATE_TX_WAIT_CTS].access_cb =
- pbproc_ftrc__tx_wait_cts__access;
+ CALLBACK (pbproc_ftrc__tx_wait_cts__access);
}
void ARCH_ILRAM
diff --git a/cesar/mac/pbproc/src/fsm_tx_sound.c b/cesar/mac/pbproc/src/fsm_tx_sound.c
index cfe25a2270..32efc47651 100644
--- a/cesar/mac/pbproc/src/fsm_tx_sound.c
+++ b/cesar/mac/pbproc/src/fsm_tx_sound.c
@@ -27,9 +27,9 @@ pbproc_ftso_init (pbproc_t *ctx)
{
dbg_assert (ctx);
ctx->fsm.states[PBPROC_FSM_STATE_TX_SOUND_WAIT_ACK].rx_fc_cb =
- pbproc_ftso__tx_sound_wait_ack__rx_fc;
+ CALLBACK (pbproc_ftso__tx_sound_wait_ack__rx_fc);
ctx->fsm.states[PBPROC_FSM_STATE_TX_SOUND_WAIT_ACK].access_cb =
- pbproc_ftso__tx_sound_wait_ack__access;
+ CALLBACK (pbproc_ftso__tx_sound_wait_ack__access);
}
void ARCH_ILRAM_PRIO (2)
diff --git a/cesar/mac/pbproc/src/pbproc.c b/cesar/mac/pbproc/src/pbproc.c
index 06dc01974a..0c6dfacaac 100644
--- a/cesar/mac/pbproc/src/pbproc.c
+++ b/cesar/mac/pbproc/src/pbproc.c
@@ -216,13 +216,17 @@ pbproc_init (mac_config_t *config, mac_store_t *store)
ctx->config = config;
ctx->store = store;
ctx->phy =
- phy_init (ctx, (phy_rx_fc_cb_t) pbproc_fsm_handle_rx_fc_event,
- (phy_access_cb_t) pbproc_fsm_handle_access_event,
- (phy_access_conf_cb_t) pbproc_fsm_handle_access_conf_event,
- (phy_pbdma_cb_t) pbproc_fsm_handle_pbdma_event,
- (phy_tx_false_alarm_cb_t) pbproc_fsm_handle_tx_false_alarm_event,
- (phy_deferred_cb_t) pbproc_fsm_handle_deferred);
- phy_extra_timer_init (ctx->phy, ctx, pbproc_spoc_update_cb);
+ phy_init (
+ ctx,
+ (phy_rx_fc_cb_t) CALLBACK (pbproc_fsm_handle_rx_fc_event),
+ (phy_access_cb_t) CALLBACK (pbproc_fsm_handle_access_event),
+ (phy_access_conf_cb_t) CALLBACK (
+ pbproc_fsm_handle_access_conf_event),
+ (phy_pbdma_cb_t) CALLBACK (pbproc_fsm_handle_pbdma_event),
+ (phy_tx_false_alarm_cb_t) CALLBACK (
+ pbproc_fsm_handle_tx_false_alarm_event),
+ (phy_deferred_cb_t) CALLBACK (pbproc_fsm_handle_deferred));
+ phy_extra_timer_init (ctx->phy, ctx, CALLBACK (pbproc_spoc_update_cb));
ctx->ca = ca_init (ctx->phy, config, store, PBPROC_ANTICIP_TCK);
pbproc_trace_init (ctx);
ctx->user_data = NULL;
@@ -254,7 +258,7 @@ pbproc_init (mac_config_t *config, mac_store_t *store)
ctx->chandata_nb = 0;
ctx->chandata_data = false;
/* Initialise FSM. */
- pbproc_fsm_init (ctx, pbproc_deferred);
+ pbproc_fsm_init (ctx, CALLBACK (pbproc_deferred));
pbproc_ftop_init (ctx);
pbproc_fhfc_init (ctx);
pbproc_frda_init (ctx);
diff --git a/cesar/mac/sar/src/sar.c b/cesar/mac/sar/src/sar.c
index 3ee536bec6..9a14320b9d 100644
--- a/cesar/mac/sar/src/sar.c
+++ b/cesar/mac/sar/src/sar.c
@@ -95,12 +95,13 @@ sar_init (mac_store_t *mac_store, pbproc_t *pbproc, ca_t *ca,
/* Buffer manager. */
ctx->bufmgr = bufmgr;
bufmgr_client_register (
- bufmgr, (bufmgr_callback_t) sar_buffer_available, ctx);
+ bufmgr, (bufmgr_callback_t) CALLBACK (sar_buffer_available), ctx);
/* reassembly */
slist_init (ctx->reassembly.jobs_pending_list., bare);
/* pbproc */
ctx->pbproc_ctx = pbproc;
- pbproc_init_cb (pbproc, ctx, sar_mpdu_process, sar_beacon_receive);
+ pbproc_init_cb (pbproc, ctx, CALLBACK (sar_mpdu_process),
+ CALLBACK (sar_beacon_receive));
/* Init the bridgedma context by giving the functions to call back when
* a job had been bridge. */
ctx->bridgedma_ctx = phy_bridgedma_init (ctx, NULL, NULL);
@@ -109,15 +110,15 @@ sar_init (mac_store_t *mac_store, pbproc_t *pbproc, ca_t *ca,
/** Trace system. */
sar_trace_init(ctx);
/* Initialize sequence checker. */
- lib_seq_check_init (&ctx->seq, sar_lib_seq_check_cb, ctx);
+ lib_seq_check_init (&ctx->seq, CALLBACK (sar_lib_seq_check_cb), ctx);
sar_stats_init (&ctx->stats);
#if CONFIG_SAR_PB_STATS
sar_pb_stats_init (&ctx->pb_stats);
- lib_stats_set_stat_callback ("SAR_PB_STATS_LOAD",
- (lib_stats_cb_r_t) sar_pb_stats_load_read_cb,
- (lib_stats_cb_w_t) sar_pb_stats_load_write_cb,
- LIB_STATS_1_BYTE,
- LIB_STATS_DEBUG);
+ lib_stats_set_stat_callback (
+ "SAR_PB_STATS_LOAD",
+ (lib_stats_cb_r_t) CALLBACK (sar_pb_stats_load_read_cb),
+ (lib_stats_cb_w_t) CALLBACK (sar_pb_stats_load_write_cb),
+ LIB_STATS_1_BYTE, LIB_STATS_DEBUG);
#endif
lib_rnd_init (&ctx->rnd_gen, seed ^ 0x19257164);
diff --git a/cesar/projects/eoc/master-Config.mse500 b/cesar/projects/eoc/master-Config.mse500
index a6e49742d1..43efdaba4b 100644
--- a/cesar/projects/eoc/master-Config.mse500
+++ b/cesar/projects/eoc/master-Config.mse500
@@ -1,5 +1,6 @@
-set eoc-master
set eoc-board
+set eoc-master
+CONFIG_ARCH_ILRAM2_PRIO = 5
CONFIG_ARCH_ILRAM_PRIO = 1
CONFIG_BLK_SLACK = 512
CONFIG_DEBUG_CLAIM = n
diff --git a/cesar/projects/eoc/slave-Config.mse500 b/cesar/projects/eoc/slave-Config.mse500
index deba1afa7a..c6874463da 100644
--- a/cesar/projects/eoc/slave-Config.mse500
+++ b/cesar/projects/eoc/slave-Config.mse500
@@ -1,5 +1,6 @@
set eoc-slave
set eoc-board
+CONFIG_ARCH_ILRAM2_PRIO = 5
CONFIG_ARCH_ILRAM_PRIO = 1
CONFIG_BLK_SLACK = 512
CONFIG_DEBUG_CLAIM = n
diff --git a/cesar/projects/plc/Config.mse500 b/cesar/projects/plc/Config.mse500
index a158210cd0..0df3482fa8 100644
--- a/cesar/projects/plc/Config.mse500
+++ b/cesar/projects/plc/Config.mse500
@@ -2,3 +2,4 @@ set plc
set plc-board
CONFIG_STATS_ON_FATAL = y
CONFIG_PHY_AES_ALWAYS_BYPASSED = y
+CONFIG_ARCH_ILRAM2_PRIO = 5
diff --git a/cesar/tools/sniffer_phy/src/lhle.c b/cesar/tools/sniffer_phy/src/lhle.c
index 1913b6b2ef..4a86a6d9a7 100644
--- a/cesar/tools/sniffer_phy/src/lhle.c
+++ b/cesar/tools/sniffer_phy/src/lhle.c
@@ -127,10 +127,12 @@ lhle_init (sniffer_phy_t *ctx)
{
/* Initialise and activate IPMBox. */
ctx->lhle.ipmbox = ipmbox_init ();
- ipmbox_register_rx_data_cb (ctx->lhle.ipmbox, ctx, lhle_ipmbox_recv_data);
- ipmbox_register_rx_mbx_cb (ctx->lhle.ipmbox, ctx, lhle_ipmbox_recv_mbx);
- ipmbox_register_empty_buf_cb (ctx->lhle.ipmbox, ctx,
- lhle_ipmbox_empty_buf);
+ ipmbox_register_rx_data_cb (
+ ctx->lhle.ipmbox, ctx, CALLBACK (lhle_ipmbox_recv_data);
+ ipmbox_register_rx_mbx_cb (
+ ctx->lhle.ipmbox, ctx, CALLBACK (lhle_ipmbox_recv_mbx));
+ ipmbox_register_empty_buf_cb (
+ ctx->lhle.ipmbox, ctx, CALLBACK (lhle_ipmbox_empty_buf));
ipmbox_activate (ctx->lhle.ipmbox, true);
#if HLE_TOOLS
/* Initialise hle/tools. */
diff --git a/cesar/tools/sniffer_phy/src/lowlevel.c b/cesar/tools/sniffer_phy/src/lowlevel.c
index c39aeb4d95..d0079cf814 100644
--- a/cesar/tools/sniffer_phy/src/lowlevel.c
+++ b/cesar/tools/sniffer_phy/src/lowlevel.c
@@ -271,10 +271,13 @@ lowlevel_init (sniffer_phy_t *ctx)
tonemask_default (ctx->lowlevel.tonemask_info->tonemask);
tonemask_update (ctx->lowlevel.tonemask_info);
/* Initialise Phy. */
- ctx->lowlevel.phy = phy_init (ctx, lowlevel_rx_fc_cb, lowlevel_access_cb,
- lowlevel_access_conf_cb, lowlevel_pbdma_cb,
- lowlevel_tx_false_alarm_cb,
- lowlevel_deferred_cb);
+ ctx->lowlevel.phy = phy_init (ctx,
+ CALLBACK (lowlevel_rx_fc_cb),
+ CALLBACK (lowlevel_access_cb),
+ CALLBACK (lowlevel_access_conf_cb),
+ CALLBACK (lowlevel_pbdma_cb),
+ CALLBACK (lowlevel_tx_false_alarm_cb),
+ CALLBACK (lowlevel_deferred_cb));
/* Allocate pool. */
blk_t *first, *last;
first = blk_alloc_desc_range (LOWLEVEL_POOL_SIZE, &last);
diff --git a/cesar/tools/sniffer_phy/src/mme.c b/cesar/tools/sniffer_phy/src/mme.c
index 5c98e78946..ce0ab52ce6 100644
--- a/cesar/tools/sniffer_phy/src/mme.c
+++ b/cesar/tools/sniffer_phy/src/mme.c
@@ -370,7 +370,8 @@ mme_handle (sniffer_phy_t *ctx, const u8 *buffer, uint length)
/* Setup MME buffer. */
mme_buffer_t mme;
bitstream_read_init (&mme.bitstream, buffer, length);
- bitstream_init_buffer_cb (&mme.bitstream, mme_handle_underflow, &mme);
+ bitstream_init_buffer_cb (&mme.bitstream, CALLBACK (mme_handle_underflow),
+ &mme);
mme.buffer = NULL;
/* Decode. */
mme_handle_decode (ctx, &mme);
diff --git a/common/tests/tests b/common/tests/tests
index 720367586d..d855fa6976 100644
--- a/common/tests/tests
+++ b/common/tests/tests
@@ -602,3 +602,7 @@ P2P_throughput: PYTHONPATH=. python test/P2P_throughput/P2P_throughput.py
cesar/tools/sniffer_phy:
make
run: ./obj/test_mme
+
+cesar/hal/arch/dlink/test:
+make
+dlink: ./obj/test_dlink