summaryrefslogtreecommitdiff
path: root/cleopatre/plcdrv/arm/src/hal.c
diff options
context:
space:
mode:
Diffstat (limited to 'cleopatre/plcdrv/arm/src/hal.c')
-rw-r--r--cleopatre/plcdrv/arm/src/hal.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/cleopatre/plcdrv/arm/src/hal.c b/cleopatre/plcdrv/arm/src/hal.c
index 0bbeb7f83d..7d29f78bc2 100644
--- a/cleopatre/plcdrv/arm/src/hal.c
+++ b/cleopatre/plcdrv/arm/src/hal.c
@@ -13,6 +13,7 @@
* this layer provide all Hardware Abstraction:
* registers, interrupts.
*/
+#include <stdio.h>
#ifndef __UTESTS__
#include "mailbox.h"
@@ -87,7 +88,7 @@ void set_A2Lt_interrupt(struct halctx *ctx)
if(ctx == NULL)
return;
else
- *ctx->A2L_it |= A2LT_MASK;
+ *ctx->A2L_it |= A2L_IT;
}// set_A2Lt_interrupt
/**
@@ -100,7 +101,7 @@ void set_L2Aa_interrupt(struct halctx *ctx)
if(ctx == NULL)
return;
else
- *ctx->A2L_it |= A2LA_MASK;
+ *ctx->A2L_it |= A2L_IT_ACK;
}// set_L2Aa_interrupt
/**
@@ -113,7 +114,7 @@ void set_L2Aa_interrupt(struct halctx *ctx)
if(ctx == NULL)
return;
else
- *ctx->L2A_it = L2AT_MASK;
+ *ctx->L2A_it = L2A_IT;
}// clr_L2At_interrupt
/**
@@ -126,7 +127,7 @@ void clr_A2La_interrupt(struct halctx *ctx)
if(ctx == NULL)
return;
else
- *ctx->L2A_it = L2AA_MASK;
+ *ctx->L2A_it = L2A_IT_ACK;
}//clr_A2La_interrupt
/**
@@ -139,7 +140,7 @@ void A2La_it_enable(struct halctx *ctx)
if(ctx == NULL)
return;
else
- *ctx->L2A_it_mask &= ~L2AA_EN_MASK;
+ *ctx->L2A_it_mask &= ~L2A_IT_ACK;
}// A2La_it_enable
/**
@@ -152,7 +153,7 @@ void L2At_it_enable(struct halctx *ctx)
if(ctx == NULL)
return;
else
- *ctx->L2A_it_mask &= ~L2AT_EN_MASK;
+ *ctx->L2A_it_mask &= ~L2A_IT;
}// L2At_it_enable
/**
@@ -165,7 +166,7 @@ void A2La_it_disable(struct halctx *ctx)
if(ctx == NULL)
return;
else
- *ctx->L2A_it_mask |= L2AA_EN_MASK;
+ *ctx->L2A_it_mask |= L2A_IT_ACK;
}// A2La_it_disable
/**
@@ -178,7 +179,7 @@ void L2At_it_disable(struct halctx *ctx)
if(ctx == NULL)
return;
else
- *ctx->L2A_it_mask |= L2AT_EN_MASK;
+ *ctx->L2A_it_mask |= L2A_IT;
}// L2At_it_disable
/**
@@ -215,10 +216,12 @@ int halmbx_A2Lmail_status_queue(struct halctx *ctx)
if(ctx == NULL)
return -1;
- space = ((*ctx->A2L_head - *ctx->A2L_tail) & A2L_RING_MASK);
+ space = ((*ctx->A2L_tail - *ctx->A2L_head) & A2L_RING_MASK);
if((space != 0) && (space <= MAX_MSG_SIZE))
return FULL;
+ else if ((space != 0) && (space <= (MAX_MSG_SIZE*2)))
+ return NEARLY_FULL;
else
return NOT_FULL;
}// halmbx_A2Lmail_status_queue
@@ -237,10 +240,12 @@ int halmbx_L2Amail_status_queue(struct halctx *ctx)
if(ctx == NULL)
return -1;
- space = ((*ctx->L2A_head - *ctx->L2A_tail) & L2A_RING_MASK);
+ space = ((*ctx->L2A_tail - *ctx->L2A_head) & L2A_RING_MASK);
if((space != 0) && (space <= MAX_MSG_SIZE))
return FULL;
+ else if ((space != 0) && (space <= (MAX_MSG_SIZE*2)))
+ return NEARLY_FULL;
else
return NOT_FULL;
}// halmbx_L2Amail_status_queue
@@ -264,7 +269,7 @@ int halmbx_copy_to_ring(struct halctx *ctx, uint32_t *message, int size)
return -1;
//Check size range and alignment on 32bits
- if(size > A2L_RING_SIZE || size == 0 || size & 0x3)
+ if(size > MAX_MSG_SIZE || size == 0 || size & 0x3)
return -1;
//Check pointer and alignment on 32bits
if(message == NULL || ((uint32_t)message & 0x3))
@@ -312,7 +317,7 @@ int halmbx_copy_from_ring(struct halctx *ctx, uint32_t *message, int size)
return -1;
//Check size range and alignment on 32bits
- if(size > L2A_RING_SIZE || size == 0 || size & 0x3)
+ if(size > MAX_MSG_SIZE || size == 0 || size & 0x3)
return -1;
//Check pointer and alignment on 32bits
if(message == NULL || ((uint32_t)message & 0x3))