Without looking too close, your use of CLR/SET registers is or will be a problem-
REG_PORT_DIRSET0 |=
These type of registers are designed for atomic needs, which use assignment only (writing 0 to a bit has no effect). The use of |= will end up reading the register first, and will then include using those values to set bits, bits that should be left alone.