summaryrefslogtreecommitdiff
path: root/cesar/hal/phy/src
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/hal/phy/src')
-rw-r--r--cesar/hal/phy/src/bridgedma.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/cesar/hal/phy/src/bridgedma.c b/cesar/hal/phy/src/bridgedma.c
index fb213b8577..e6763afc42 100644
--- a/cesar/hal/phy/src/bridgedma.c
+++ b/cesar/hal/phy/src/bridgedma.c
@@ -31,9 +31,19 @@
#define ETH_BUFFER_SIZE(job) (ETH_BUFFER_MASK(job) + 1)
#define ETH_BUFFER_ADDR(job) (unsigned char *)((unsigned long)job->data_addr & ~ETH_BUFFER_MASK(job))
+
+#ifdef __sparc__
+ #define bridgedma_crc_compute_continue_block crc_compute_continue_block_le
+ #define bridgedma_crc_compute_block crc_compute_block_le
+#else
+ #define bridgedma_crc_compute_continue_block crc_compute_continue_block
+ #define bridgedma_crc_compute_block crc_compute_block
+#endif
+
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;
@@ -45,7 +55,7 @@ static cyg_uint32 _bridgedma_ecos_isr(cyg_vector_t vector, cyg_addrword_t data)
bridgedma_ctx = (phy_bridgedma_t *)data;
if((*bridgedma_ctx->bridgedma_cb)(bridgedma_ctx->user_data,
- *((u32 *)((void *)&bridgedma_ctx->status))))
+ *((u32 *)((void *)&bridgedma_ctx->status))))
return CYG_ISR_CALL_DSR; // Cause DSR to be run
else
{
@@ -54,7 +64,8 @@ static cyg_uint32 _bridgedma_ecos_isr(cyg_vector_t vector, cyg_addrword_t data)
}
}
-static void _bridgedma_ecos_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data)
+static void _bridgedma_ecos_dsr(cyg_vector_t vector,
+ cyg_ucount32 count, cyg_addrword_t data)
{
/* nothing to do except calling the phy dsr */
phy_bridgedma_t *bridgedma_ctx;
@@ -131,7 +142,8 @@ phy_bridgedma_uninit (phy_bridgedma_t *ctx)
/**
* Fragment a mac_frame data into one or several PBs.
- * Mac frame data MUST NOT cross the mac frame buffer boundary (going at beginning of circular buffer)
+ * 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
@@ -193,11 +205,13 @@ _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);
- dbg_assert((job->header_len == 0) || (job->header_len == 2) || (job->header_len == 6));
+ dbg_assert((job->header_len == 0) || (job->header_len == 2) ||
+ (job->header_len == 6));
dbg_assert((job->data_len >= 60) && (job->data_len <= 1518));
dbg_assert(job->first_pb_desc);
dbg_assert(job->first_pb_offset < job->segment_len);
@@ -236,7 +250,7 @@ _job_process(phy_bridgedma_t *ctx, phy_bridgedma_job_t *job)
MACFRAME_TO_PB); /* we are in little endian for simulator... */
if(!job->crc_error)
ctx->proto_ctx.icv_current =
- crc_compute_continue_block(
+ bridgedma_crc_compute_continue_block(
&ctx->proto_ctx.crc_ctx,
ctx->proto_ctx.icv_current,
((unsigned char *)&job->mf_header1) + 2, 4);
@@ -250,7 +264,7 @@ _job_process(phy_bridgedma_t *ctx, phy_bridgedma_job_t *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 =
- crc_compute_continue_block(
+ bridgedma_crc_compute_continue_block(
&ctx->proto_ctx.crc_ctx,
ctx->proto_ctx.icv_current,
job->data_addr,
@@ -259,7 +273,7 @@ _job_process(phy_bridgedma_t *ctx, phy_bridgedma_job_t *job)
_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)
ctx->proto_ctx.icv_current =
- crc_compute_continue_block(
+ bridgedma_crc_compute_continue_block(
&ctx->proto_ctx.crc_ctx,
ctx->proto_ctx.icv_current,
job->data_addr,
@@ -271,7 +285,7 @@ _job_process(phy_bridgedma_t *ctx, phy_bridgedma_job_t *job)
_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 =
- crc_compute_continue_block(
+ bridgedma_crc_compute_continue_block(
&ctx->proto_ctx.crc_ctx,
ctx->proto_ctx.icv_current,
job->data_addr, job->data_len);
@@ -315,7 +329,7 @@ _job_process(phy_bridgedma_t *ctx, phy_bridgedma_job_t *job)
4,
PB_TO_MACFRAME); /* we are in little endian for simulator... */
ctx->proto_ctx.icv_current =
- crc_compute_continue_block(
+ bridgedma_crc_compute_continue_block(
&ctx->proto_ctx.crc_ctx,
ctx->proto_ctx.icv_current,
((unsigned char *)&job->mf_header1) + 2, 4);
@@ -328,7 +342,7 @@ _job_process(phy_bridgedma_t *ctx, phy_bridgedma_job_t *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 =
- crc_compute_continue_block(
+ bridgedma_crc_compute_continue_block(
&ctx->proto_ctx.crc_ctx,
ctx->proto_ctx.icv_current,
job->data_addr,
@@ -336,7 +350,7 @@ _job_process(phy_bridgedma_t *ctx, phy_bridgedma_job_t *job)
- job->data_addr);
_pb_data_add(&pb_current, &data_ptr, job->segment_len, (unsigned char *)((unsigned long)job->data_addr & ~ETH_BUFFER_MASK(job)), ((unsigned long)(job->data_addr) + job->data_len) & ETH_BUFFER_MASK(job), PB_TO_MACFRAME);
ctx->proto_ctx.icv_current =
- crc_compute_continue_block(
+ bridgedma_crc_compute_continue_block(
&ctx->proto_ctx.crc_ctx,
ctx->proto_ctx.icv_current,
(unsigned char *)((unsigned long)job->data_addr & ~ETH_BUFFER_MASK(job)), ((unsigned long)(job->data_addr) + job->data_len) & ETH_BUFFER_MASK(job));
@@ -345,7 +359,7 @@ _job_process(phy_bridgedma_t *ctx, phy_bridgedma_job_t *job)
{
_pb_data_add(&pb_current, &data_ptr, job->segment_len, job->data_addr, job->data_len, PB_TO_MACFRAME);
ctx->proto_ctx.icv_current =
- crc_compute_continue_block(
+ bridgedma_crc_compute_continue_block(
&ctx->proto_ctx.crc_ctx,
ctx->proto_ctx.icv_current,
job->data_addr,