summaryrefslogtreecommitdiff
path: root/cesar
diff options
context:
space:
mode:
authorlaranjeiro2008-06-13 13:01:01 +0000
committerlaranjeiro2008-06-13 13:01:01 +0000
commit687fa940f2da0fb5da20c21f48159570fcc0a634 (patch)
tree35e0d0f0a59a6d4b6202e20875e7db587534c760 /cesar
parentafb68daa6a7ac8bdaf55f0bf9262ca4ef84c0377 (diff)
hal/phy :
* Renamed the bridgedma.c file to bridgedma_soft.c file. * Rename the folder bridgedma-proto to bridgedma_soft git-svn-id: svn+ssh://pessac/svn/cesar/trunk@2324 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar')
-rw-r--r--cesar/common/tests/tests2
-rw-r--r--cesar/hal/phy/Module8
-rw-r--r--cesar/hal/phy/src/bridgedma_soft.c (renamed from cesar/hal/phy/src/bridgedma.c)131
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/Makefile (renamed from cesar/hal/phy/test/bridgedma-proto/Makefile)0
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/sparc-Makefile (renamed from cesar/hal/phy/test/bridgedma-proto/sparc-Makefile)0
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/sparc-ecos.ecc.sh (renamed from cesar/hal/phy/test/bridgedma-proto/sparc-ecos.ecc.sh)0
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/src/bridgedma-crc-test.c (renamed from cesar/hal/phy/test/bridgedma-proto/src/bridgedma-crc-test.c)0
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/src/bridgedma-init-test.c (renamed from cesar/hal/phy/test/bridgedma-proto/src/bridgedma-init-test.c)0
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/src/bridgedma-rx-test.c (renamed from cesar/hal/phy/test/bridgedma-proto/src/bridgedma-rx-test.c)0
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/src/bridgedma-tx-test.c (renamed from cesar/hal/phy/test/bridgedma-proto/src/bridgedma-tx-test.c)0
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/src/data.c (renamed from cesar/hal/phy/test/bridgedma-proto/src/data.c)0
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/src/test_bridgedma.c_old (renamed from cesar/hal/phy/test/bridgedma-proto/src/test_bridgedma.c_old)0
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/synth-Makefile (renamed from cesar/hal/phy/test/bridgedma-proto/synth-Makefile)0
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/synth-ecos.ecc.sh (renamed from cesar/hal/phy/test/bridgedma-proto/synth-ecos.ecc.sh)0
14 files changed, 71 insertions, 70 deletions
diff --git a/cesar/common/tests/tests b/cesar/common/tests/tests
index 42df595d98..b37b04b02d 100644
--- a/cesar/common/tests/tests
+++ b/cesar/common/tests/tests
@@ -314,7 +314,7 @@ interface/fcall/test:
make: make COV=y
./obj/test_interface_fcall
-hal/phy/test/bridgedma-proto/:
+hal/phy/test/bridgedma-soft/:
make: make synth
bridgedma-proto-proto: ./obj/synth/test-bridgedma-proto.elf
bridgedma-proto-tx: ./obj/synth/test-bridgedma-proto-tx.elf
diff --git a/cesar/hal/phy/Module b/cesar/hal/phy/Module
index 5147b2d35a..f8da97f5c0 100644
--- a/cesar/hal/phy/Module
+++ b/cesar/hal/phy/Module
@@ -1,5 +1,11 @@
-SOURCES := access.c pbdma.c phy.c pratic.c rx.c tx.c bridgedma.c
+SOURCES := access.c pbdma.c phy.c pratic.c rx.c tx.c
ifeq ($(CONFIG_TRACE),y)
SOURCES += trace.c
endif
+
+ifeq ($(CONFIG_BRIDGEDMA_SOFT),y)
+SOURCES += bridgedma_soft.c
+else
+SOURCES += bridgedma.c
+endif
diff --git a/cesar/hal/phy/src/bridgedma.c b/cesar/hal/phy/src/bridgedma_soft.c
index e6763afc42..ee94c8a317 100644
--- a/cesar/hal/phy/src/bridgedma.c
+++ b/cesar/hal/phy/src/bridgedma_soft.c
@@ -11,12 +11,9 @@
* \ingroup hal_phy
*
* Add in the config file the CONFIG_BRIDGEDMA_PROTO = y to use this
- * bridgedma, this can be done too in the Makefile with the DEFS flag like
- * DEFS = -DCONFIG_BRIDGEDMA_PROTO
+ * bridgedma.
*/
-#ifdef CONFIG_BRIDGEDMA_PROTO
-
#include <cyg/kernel/kapi.h>
#include "cyg/hal/hal_io.h"
#include "common/std.h"
@@ -42,8 +39,8 @@
static cyg_uint32 _bridgedma_ecos_isr(cyg_vector_t vector, cyg_addrword_t data)
{
- volatile uint* ecos_it_register =
- (uint*) BRIDGEDMA_PROTO_ECOS_IT_DISABLE_REGISTER;
+ volatile uint* ecos_it_register =
+ (uint*) BRIDGEDMA_PROTO_ECOS_IT_DISABLE_REGISTER;
/* nothing to do except calling the bridgedma callback */
phy_bridgedma_t *bridgedma_ctx;
@@ -64,7 +61,7 @@ static cyg_uint32 _bridgedma_ecos_isr(cyg_vector_t vector, cyg_addrword_t data)
}
}
-static void _bridgedma_ecos_dsr(cyg_vector_t vector,
+static void _bridgedma_ecos_dsr(cyg_vector_t vector,
cyg_ucount32 count, cyg_addrword_t data)
{
/* nothing to do except calling the phy dsr */
@@ -88,7 +85,7 @@ phy_bridgedma_init (void *user_data, phy_bridgedma_cb_t bridgedma_cb,
{
static phy_bridgedma_t bridgedma_ctx;
static u32 enc_tab[256];
-
+
memset(&bridgedma_ctx, '\0', sizeof(bridgedma_ctx));
bridgedma_ctx.user_data = user_data;
bridgedma_ctx.bridgedma_cb = bridgedma_cb;
@@ -105,7 +102,7 @@ phy_bridgedma_init (void *user_data, phy_bridgedma_cb_t bridgedma_cb,
bridgedma_ctx.proto_ctx.crc_ctx.reg_init = 0;
bridgedma_ctx.proto_ctx.crc_ctx.table.t32 = enc_tab;
crc_init(&bridgedma_ctx.proto_ctx.crc_ctx);
-
+
/* register ISR et DSR to eCos */
cyg_interrupt_create(BRIDGEDMA_ECOS_IT,
PHY_HAL_INTERRUPT_PRIORITY,
@@ -137,35 +134,35 @@ phy_bridgedma_init (void *user_data, phy_bridgedma_cb_t bridgedma_cb,
void
phy_bridgedma_uninit (phy_bridgedma_t *ctx)
{
- cyg_thread_suspend (ctx->proto_ctx.thread_handle);
+ cyg_thread_suspend (ctx->proto_ctx.thread_handle);
}
/**
* Fragment a mac_frame data into one or several PBs.
- * Mac frame data MUST NOT cross the mac frame buffer boundary
+ * Mac frame data MUST NOT cross the mac frame buffer boundary
* (going at beginning of circular buffer)
* ie: we must have mac_ptr + mac_len <= end_of_mac_buffer
* \param pb_current pointer of pointer to first pb to store data
- * \param pb_data_ptr pointer of pointer to data beginning into first pb
+ * \param pb_data_ptr pointer of pointer to data beginning into first pb
* \param pb_size size of pb data (128 or 512)
* \param mac_ptr pointer to mac_frame data
* \param mac_len length of mac frame data
- * \param direction data copy direction: MACFRAME_TO_PB or PB_TO_MACFRAME
+ * \param direction data copy direction: MACFRAME_TO_PB or PB_TO_MACFRAME
* \return 0
*/
static uint _pb_data_add(
blk_t **pb_current,
unsigned char **pb_data_ptr,
- unsigned int pb_size,
- unsigned char *mac_ptr,
+ unsigned int pb_size,
+ unsigned char *mac_ptr,
unsigned int mac_len,
bridgedma_copy_dir_t direction)
{
unsigned int mac_cnt;
-
+
mac_cnt = 0;
-
+
while((mac_len - mac_cnt) > pb_size - (*pb_data_ptr - (*pb_current)->data))
{
if(direction == MACFRAME_TO_PB)
@@ -182,15 +179,15 @@ static uint _pb_data_add(
dbg_assert(*pb_current);
*pb_data_ptr = (*pb_current)->data;
}
-
+
if(direction == MACFRAME_TO_PB)
bitstream_memcpy(*pb_data_ptr, mac_ptr + mac_cnt, mac_len - mac_cnt);
else
- bitstream_memcpy(mac_ptr + mac_cnt, *pb_data_ptr, mac_len - mac_cnt);
+ bitstream_memcpy(mac_ptr + mac_cnt, *pb_data_ptr, mac_len - mac_cnt);
*pb_data_ptr += mac_len - mac_cnt;
return 0;
}
-
+
/**
* Process 1 job for fragmentation or reassembly
* \param ctx Bridge DMA context
@@ -205,8 +202,8 @@ _job_process(phy_bridgedma_t *ctx, phy_bridgedma_job_t *job)
unsigned long icv_final, icv_compare;
/* variable to write in the ecos raising it. */
- volatile uint* ecos_enable_it =
- (uint*) BRIDGEDMA_PROTO_ECOS_IT_ENABLE_REGISTER;
+ volatile uint* ecos_enable_it =
+ (uint*) BRIDGEDMA_PROTO_ECOS_IT_ENABLE_REGISTER;
ctx->job_current = job;
dbg_assert(job->data_addr);
@@ -221,54 +218,54 @@ _job_process(phy_bridgedma_t *ctx, phy_bridgedma_job_t *job)
if(job->crc_reset)
ctx->proto_ctx.icv_current =
crc_compute_begin(&ctx->proto_ctx.crc_ctx);
-
+
pb_current = job->first_pb_desc;
data_ptr = pb_current->data + job->first_pb_offset;
mac_ptr = job->data_addr;
-
+
if(job->direction == 0)
{
/* segmentation processing */
-
+
if(job->header_len > 0)
{
/* add header */
- _pb_data_add(&pb_current,
- &data_ptr,
- job->segment_len,
+ _pb_data_add(&pb_current,
+ &data_ptr,
+ job->segment_len,
(unsigned char *)&job->mf_header1, /* little endian !!! */
2,
- MACFRAME_TO_PB); /* we are in little endian for simulator... */
+ MACFRAME_TO_PB); /* we are in little endian for simulator... */
if(job->header_len == 6)
{
/* add ATS */
- _pb_data_add(&pb_current,
- &data_ptr,
- job->segment_len,
+ _pb_data_add(&pb_current,
+ &data_ptr,
+ job->segment_len,
((unsigned char *)&job->mf_header1) + 2, /* little endian !!! */
- 4,
+ 4,
MACFRAME_TO_PB); /* we are in little endian for simulator... */
if(!job->crc_error)
- ctx->proto_ctx.icv_current =
+ ctx->proto_ctx.icv_current =
bridgedma_crc_compute_continue_block(
- &ctx->proto_ctx.crc_ctx,
+ &ctx->proto_ctx.crc_ctx,
ctx->proto_ctx.icv_current,
((unsigned char *)&job->mf_header1) + 2, 4);
}
}
-
- /* check if mac data must be separated into 2 parts (circular buffer rollover) */
+
+ /* check if mac data must be separated into 2 parts (circular buffer rollover) */
if((job->eth_buffer_mask != 0)
&& (job->data_addr + job->data_len >= ETH_BUFFER_ADDR(job) + ETH_BUFFER_SIZE(job)))
{
_pb_data_add(&pb_current, &data_ptr, job->segment_len, job->data_addr, ETH_BUFFER_ADDR(job) + ETH_BUFFER_SIZE(job) - job->data_addr, MACFRAME_TO_PB);
if(!job->crc_error)
- ctx->proto_ctx.icv_current =
+ ctx->proto_ctx.icv_current =
bridgedma_crc_compute_continue_block(
&ctx->proto_ctx.crc_ctx,
ctx->proto_ctx.icv_current,
job->data_addr,
- ETH_BUFFER_ADDR(job) + ETH_BUFFER_SIZE(job)
+ ETH_BUFFER_ADDR(job) + ETH_BUFFER_SIZE(job)
- job->data_addr);
_pb_data_add(&pb_current, &data_ptr, job->segment_len, job->data_addr, ((unsigned long)(job->data_addr) + job->data_len) & ETH_BUFFER_MASK(job), MACFRAME_TO_PB);
if(!job->crc_error)
@@ -276,15 +273,15 @@ _job_process(phy_bridgedma_t *ctx, phy_bridgedma_job_t *job)
bridgedma_crc_compute_continue_block(
&ctx->proto_ctx.crc_ctx,
ctx->proto_ctx.icv_current,
- job->data_addr,
- ((unsigned long)(job->data_addr) + job->data_len)
+ job->data_addr,
+ ((unsigned long)(job->data_addr) + job->data_len)
& ETH_BUFFER_MASK(job));
}
else
{
_pb_data_add(&pb_current, &data_ptr, job->segment_len, job->data_addr, job->data_len, MACFRAME_TO_PB);
if(!job->crc_error)
- ctx->proto_ctx.icv_current =
+ ctx->proto_ctx.icv_current =
bridgedma_crc_compute_continue_block(
&ctx->proto_ctx.crc_ctx,
ctx->proto_ctx.icv_current,
@@ -298,7 +295,7 @@ _job_process(phy_bridgedma_t *ctx, phy_bridgedma_job_t *job)
&ctx->proto_ctx.crc_ctx,
ctx->proto_ctx.icv_current);
else
- icv_final = ctx->proto_ctx.icv_substitution;
+ icv_final = ctx->proto_ctx.icv_substitution;
_pb_data_add(&pb_current, &data_ptr, job->segment_len, (unsigned char *)&icv_final, 4, MACFRAME_TO_PB); /* we are in little endian for simulator... */
}
if(job->append_zero)
@@ -313,35 +310,35 @@ _job_process(phy_bridgedma_t *ctx, phy_bridgedma_job_t *job)
if(job->header_len > 0)
{
/* get the mac frame header */
- _pb_data_add(&pb_current,
- &data_ptr,
- job->segment_len,
- (unsigned char *)&job->mf_header1, /* little endian !!! */
- 2,
- PB_TO_MACFRAME); /* we are in little endian for simulator... */
+ _pb_data_add(&pb_current,
+ &data_ptr,
+ job->segment_len,
+ (unsigned char *)&job->mf_header1, /* little endian !!! */
+ 2,
+ PB_TO_MACFRAME); /* we are in little endian for simulator... */
if(job->header_len == 6)
{
/* add ATS */
- _pb_data_add(&pb_current,
- &data_ptr,
- job->segment_len,
- ((unsigned char *)&job->mf_header1) + 2, /* little endian */
- 4,
+ _pb_data_add(&pb_current,
+ &data_ptr,
+ job->segment_len,
+ ((unsigned char *)&job->mf_header1) + 2, /* little endian */
+ 4,
PB_TO_MACFRAME); /* we are in little endian for simulator... */
- ctx->proto_ctx.icv_current =
+ ctx->proto_ctx.icv_current =
bridgedma_crc_compute_continue_block(
&ctx->proto_ctx.crc_ctx,
ctx->proto_ctx.icv_current,
((unsigned char *)&job->mf_header1) + 2, 4);
}
}
-
- /* check if mac data must be separated into 2 parts (circular buffer rollover) */
+
+ /* check if mac data must be separated into 2 parts (circular buffer rollover) */
if((job->eth_buffer_mask != 0)
&& (job->data_addr + job->data_len >= ETH_BUFFER_ADDR(job) + ETH_BUFFER_SIZE(job)))
{
_pb_data_add(&pb_current, &data_ptr, job->segment_len, job->data_addr, ETH_BUFFER_ADDR(job) + ETH_BUFFER_SIZE(job) - job->data_addr, PB_TO_MACFRAME);
- ctx->proto_ctx.icv_current =
+ ctx->proto_ctx.icv_current =
bridgedma_crc_compute_continue_block(
&ctx->proto_ctx.crc_ctx,
ctx->proto_ctx.icv_current,
@@ -358,7 +355,7 @@ _job_process(phy_bridgedma_t *ctx, phy_bridgedma_job_t *job)
else
{
_pb_data_add(&pb_current, &data_ptr, job->segment_len, job->data_addr, job->data_len, PB_TO_MACFRAME);
- ctx->proto_ctx.icv_current =
+ ctx->proto_ctx.icv_current =
bridgedma_crc_compute_continue_block(
&ctx->proto_ctx.crc_ctx,
ctx->proto_ctx.icv_current,
@@ -373,12 +370,12 @@ _job_process(phy_bridgedma_t *ctx, phy_bridgedma_job_t *job)
ctx->proto_ctx.icv_current);
_pb_data_add(&pb_current, &data_ptr, job->segment_len, (unsigned char *)&icv_compare, 4, PB_TO_MACFRAME); /* we are in little endian for simulator... */
job->crc_error = (icv_compare != icv_final);
- }
- }
-
+ }
+ }
+
if(ctx->job_current->job_it)
{
- *ecos_enable_it |= BRIDGEDMA_ECOS_IT_MASK;
+ *ecos_enable_it |= BRIDGEDMA_ECOS_IT_MASK;
cyg_interrupt_unmask(BRIDGEDMA_ECOS_IT);
#ifndef __sparc__
@@ -403,11 +400,11 @@ _job_process(phy_bridgedma_t *ctx, phy_bridgedma_job_t *job)
void
phy_bridgedma_start (phy_bridgedma_t *ctx, phy_bridgedma_job_t *job_first,
phy_bridgedma_job_t *job_last)
-{
+{
dbg_assert(ctx);
dbg_assert(job_first);
dbg_assert(job_last);
-
+
/* check current job processing */
if(ctx->job_first == NULL)
{
@@ -425,7 +422,7 @@ phy_bridgedma_start (phy_bridgedma_t *ctx, phy_bridgedma_job_t *job_first,
ctx->job_last->next = job_first;
ctx->job_last = job_last;
}
-
+
/* Resume the bridge dma thread to process the jobs. */
cyg_thread_resume (ctx->proto_ctx.thread_handle);
}
@@ -457,5 +454,3 @@ phy_bridgedma_proto_process (cyg_addrword_t data)
}
}
}
-
-#endif /* CONFIG_BRIDGEDMA_PROTO */
diff --git a/cesar/hal/phy/test/bridgedma-proto/Makefile b/cesar/hal/phy/test/bridgedma-soft/Makefile
index 5167873e5a..5167873e5a 100644
--- a/cesar/hal/phy/test/bridgedma-proto/Makefile
+++ b/cesar/hal/phy/test/bridgedma-soft/Makefile
diff --git a/cesar/hal/phy/test/bridgedma-proto/sparc-Makefile b/cesar/hal/phy/test/bridgedma-soft/sparc-Makefile
index 11d5430522..11d5430522 100644
--- a/cesar/hal/phy/test/bridgedma-proto/sparc-Makefile
+++ b/cesar/hal/phy/test/bridgedma-soft/sparc-Makefile
diff --git a/cesar/hal/phy/test/bridgedma-proto/sparc-ecos.ecc.sh b/cesar/hal/phy/test/bridgedma-soft/sparc-ecos.ecc.sh
index db2208c6cc..db2208c6cc 100644
--- a/cesar/hal/phy/test/bridgedma-proto/sparc-ecos.ecc.sh
+++ b/cesar/hal/phy/test/bridgedma-soft/sparc-ecos.ecc.sh
diff --git a/cesar/hal/phy/test/bridgedma-proto/src/bridgedma-crc-test.c b/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-crc-test.c
index 6b7d836feb..6b7d836feb 100644
--- a/cesar/hal/phy/test/bridgedma-proto/src/bridgedma-crc-test.c
+++ b/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-crc-test.c
diff --git a/cesar/hal/phy/test/bridgedma-proto/src/bridgedma-init-test.c b/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-init-test.c
index 72bb6051f1..72bb6051f1 100644
--- a/cesar/hal/phy/test/bridgedma-proto/src/bridgedma-init-test.c
+++ b/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-init-test.c
diff --git a/cesar/hal/phy/test/bridgedma-proto/src/bridgedma-rx-test.c b/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-rx-test.c
index e48ce90ccd..e48ce90ccd 100644
--- a/cesar/hal/phy/test/bridgedma-proto/src/bridgedma-rx-test.c
+++ b/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-rx-test.c
diff --git a/cesar/hal/phy/test/bridgedma-proto/src/bridgedma-tx-test.c b/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-tx-test.c
index fdc897c3a5..fdc897c3a5 100644
--- a/cesar/hal/phy/test/bridgedma-proto/src/bridgedma-tx-test.c
+++ b/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-tx-test.c
diff --git a/cesar/hal/phy/test/bridgedma-proto/src/data.c b/cesar/hal/phy/test/bridgedma-soft/src/data.c
index 20a7170cfb..20a7170cfb 100644
--- a/cesar/hal/phy/test/bridgedma-proto/src/data.c
+++ b/cesar/hal/phy/test/bridgedma-soft/src/data.c
diff --git a/cesar/hal/phy/test/bridgedma-proto/src/test_bridgedma.c_old b/cesar/hal/phy/test/bridgedma-soft/src/test_bridgedma.c_old
index 06ab4fe40e..06ab4fe40e 100644
--- a/cesar/hal/phy/test/bridgedma-proto/src/test_bridgedma.c_old
+++ b/cesar/hal/phy/test/bridgedma-soft/src/test_bridgedma.c_old
diff --git a/cesar/hal/phy/test/bridgedma-proto/synth-Makefile b/cesar/hal/phy/test/bridgedma-soft/synth-Makefile
index 43e430838a..43e430838a 100644
--- a/cesar/hal/phy/test/bridgedma-proto/synth-Makefile
+++ b/cesar/hal/phy/test/bridgedma-soft/synth-Makefile
diff --git a/cesar/hal/phy/test/bridgedma-proto/synth-ecos.ecc.sh b/cesar/hal/phy/test/bridgedma-soft/synth-ecos.ecc.sh
index 8253d98c9a..8253d98c9a 100644
--- a/cesar/hal/phy/test/bridgedma-proto/synth-ecos.ecc.sh
+++ b/cesar/hal/phy/test/bridgedma-soft/synth-ecos.ecc.sh