LPC1114: "'mask" undeclared using palWritePad

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
bobc
Posts: 10
Joined: Wed Oct 17, 2012 1:36 pm

LPC1114: "'mask" undeclared using palWritePad

Post by bobc »

Hi there,

I am using LPC1114 target, and I am calling palWritePad()

I get the error

error: 'mask' undeclared (first use in this function)

when compiling.

Looking at the code, there appears to be a bug in os/hal/platforms/LPC11xx/pal_lld.h

/**
* @brief Writes a logical state on an output pad.
* @note This function is not meant to be invoked directly by the
* application code.
* @note The @ref PAL provides a default software implementation of this
* functionality, implement this function if can optimize it by using
* special hardware functionalities or special coding.
*
* @param[in] port port identifier
* @param[in] pad pad number within the port
* @param[in] bit logical value, the value must be @p PAL_LOW or
* @p PAL_HIGH
*
* @notapi
*/
#define pal_lld_writepad(port, pad, bit) \
((port)->MASKED_ACCESS[(mask) << (pad)] = (bit) << (pad))


mask is used but is not a parameter. Not sure what the correct code should be, if I can work out the patch I will post it.
bobc
Posts: 10
Joined: Wed Oct 17, 2012 1:36 pm

Re: LPC1114: "'mask" undeclared using palWritePad

Post by bobc »

Ok, looks like a simple fix:

Code: Select all

@@ -266,11 +266,11 @@ typedef LPC_GPIO_TypeDef *ioportid_t;
  *                      @p PAL_HIGH
  *
  * @notapi
  */
 #define pal_lld_writepad(port, pad, bit)                                    \
-  ((port)->MASKED_ACCESS[(mask) << (pad)] = (bit) << (pad))
+  ((port)->MASKED_ACCESS[1 << (pad)] = (bit) << (pad))
 
 /**
  * @brief   Sets a pad logical state to @p PAL_HIGH.
  * @note    The @ref PAL provides a default software implementation of this
  *          functionality, implement this function if can optimize it by using
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: LPC1114: "'mask" undeclared using palWritePad

Post by Giovanni »

Hi,

Thanks for finding and fixing it, I committed the fix on the repository (bug 3586230).

Giovanni
Post Reply