gloin34 wrote on Thursday, May 29, 2008:
Hello,
I want to send part of my code;
void Usart_c_irq_handler(void)
{
xSemaphoreParameters *pxParameters;
volatile unsigned portLONG *pulSharedVariable, ulExpectedValue;
static portBASE_TYPE xHigherPriorityTaskWoken;
xSemaphoreGiveFromISR( pxParameters->xSemaphore, &xHigherPriorityTaskWoken );
}
static void vUsart0( void *pvParameters )
{
volatile unsigned long pio_pdsr;
AT91PS_USART USART_pt = AT91C_BASE_US0;
unsigned int status;
xSemaphoreParameters *pxParameters;
volatile unsigned portLONG *pulSharedVariable, ulExpectedValue;
for( ;; )
{
if( xSemaphoreTake( pxParameters->xSemaphore, 100 ) == pdTRUE )
{
//* get Usart status register
status = USART_pt->US_CSR;
if ( status & AT91C_US_RXRDY){
//* Get byte and send
AT91F_US_PutChar (USART_pt, AT91F_US_GetChar(USART_pt));
}
if ( status & AT91C_US_OVRE) {
//* clear US_RXRDY
AT91F_US_GetChar(USART_pt);
AT91F_US_PutChar (USART_pt, ‘O’);
}
//* Check error
if ( status & AT91C_US_PARE) {
AT91F_US_PutChar (USART_pt, ‘P’);
}
if ( status & AT91C_US_FRAME) {
AT91F_US_PutChar (USART_pt, ‘F’);
}
if ( status & AT91C_US_TIMEOUT){
USART_pt->US_CR = AT91C_US_STTTO;
AT91F_US_PutChar (USART_pt, ‘T’);
}
//* Reset the satus bit
USART_pt->US_CR = AT91C_US_RSTSTA;
}
}
}
void vSemTask( unsigned portBASE_TYPE uxPriority )
{
AT91PS_USART USART_pt = AT91C_BASE_US0;
unsigned int status;
xSemaphoreParameters *pxFirstSemaphoreParameters;
const portTickType xBlockTime = ( portTickType ) 100;
/* Create the structure used to pass parameters to the first two tasks. */
pxFirstSemaphoreParameters = ( xSemaphoreParameters * ) pvPortMalloc( sizeof( xSemaphoreParameters ) );
if( pxFirstSemaphoreParameters->xSemaphore != NULL )
{
/* Create the variable which is to be shared by the first two tasks. */
pxFirstSemaphoreParameters->pulSharedVariable = ( unsigned portLONG * ) pvPortMalloc( sizeof( unsigned portLONG ) );
if( pxFirstSemaphoreParameters->xSemaphore != NULL )
{
/* Initialise the share variable to the value the tasks expect. */
*( pxFirstSemaphoreParameters->pulSharedVariable ) = semtstNON_BLOCKING_EXPECTED_VALUE;
/* The first two tasks do not block on semaphore calls. */
pxFirstSemaphoreParameters->xBlockTime = ( portTickType ) 0;
/* Spawn the first two tasks. As they poll they operate at the idle priority. */
xTaskCreate( vUsart0, ( signed portCHAR * ) "PolSEM1", semtstSTACK_SIZE, ( void * ) pxFirstSemaphoreParameters, uxPriority, ( xTaskHandle * ) NULL );
}
}
}
with this code I m trying to get a binary semaphore, and let it run vUsart0 task. I m getting "Error[Pe167]: argument of type "long *" is incompatible with parameter of type "signed long"
Could someone enlighten me?
Regards,
Cirith