AnsweredAssumed Answered

BME operation

Question asked by Daniele Cortellazzi on Dec 23, 2014
Latest reply on Jan 15, 2015 by Daniele Cortellazzi

Hi all,

 

i have to do this operation for write a pixel value on a LCD, i'm tring to do this faster.

I want to change this command:

     tmp_pixel = (buff[pointer] << 8) | buff[pointer+1];//elaboro i dati letti convertendoli in 16bit

with:

  BME_BITFIELD_INSERT(&tmp_pixel, 8, 7) = buff[pointer];

  BME_BITFIELD_INSERT(&tmp_pixel, 0, 7) = buff[pointer+1];

but every time i have an error PE_ISR(Cpu_Interrupt)

 

the macro is this:

 

  /******************************************************************************

    * macro used to generate hardcoded bit field insert address (BFI).

    *

    *******************************************************************************/

   /*****************************************************************************//*!

         *

         * @brief  generates BME bitfield insert operation addresss (hardcoded 32-bit address).

         *       

         * @param[in]   ADDR  32-bit address.

         * @param[in]   bit      bit number, 0-based.

         * @param[in]   width  bitfield width, 1-based.

         * 

         * @return  hardcoded 32-bit address.

         *

         * @ Pass/ Fail criteria: none.

         *

      *****************************************************************************/   

    #define BME_BITFIELD_INSERT(ADDR,bit,width)        (*(volatile uint32_t *)(((uint32_t)ADDR)   \

                                  | (BME_OPCODE_BITFIELD <<26)  \

                                  | ((bit)<<23) | ((width-1))<<19))   

 

Thanks

Outcomes