This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TMS320F28375D: Accessing HW Registers with CLA using Driverlib

Part Number: TMS320F28375D


Tool/software: TI C/C++ Compiler

Hi all, 

What's the clean way to access hardware registers from the CLA? When using the HWREG Macro, the compiler throws an "invalid type conversion" warning.

Is it safe to use this?

#define HWREG_CLA(x)     (*((volatile uint32_t *)((uint16_t)(x))))

This fixes the compiler error since the CLA has 16 bit address space (and pointers).

Best Regards

Falk

  • Hi Falk,

    This is good. In this statement, you are converting the address to 16-bits (good) and then de-referencing it for a 32-bit access (good). If it is a 16-bit register, you can use

    #define HWREG_CLA(x) (*((volatile uint16_t *)((uint16_t)(x))))

    Hope this helps!
    sal