This is not a Jaguar specific Question/Solution. This is a general C question I had that got answered on the C programming forums regarding this I thought i would share here.
I understand that the left side is a pointer assignment. I understand that the right side is some sort of bitwise OR operation. I do not understand what it is meant to assign to the pointer. This has me totally confused. To me it seems like its ORing every bits in multiple values and then assigning end result to the pointer.
Such code is usually used when you want to pack multiple values into a single integer type: char, short, int, etc. It's common, for example, in lower level code like drivers, where many hardware registers use a similar mechanism; and in microcontrollers with limited resources since you don't want to use an entire int for each option when just 1 bit will do.
It might make more sense if you looked at the definitions for SRCENX, UPDA1, UPDA2, PATDSEL, etc and wrote out their binary values. You'll probably notice that there are no overlapping bits in any of them. So for example, you might see
#define SRCENX 0x01 // 0000 0001
#define UPDA1 0x02 // 0000 0010
#define UPDA2 0x04 // 0000 0100
#define FOO 0x08 // 0000 8000
#define PATDSEL 0x10 // 0001 0000
Often, these values represent individual options for something. They are not mutually exclusive, and you want to be able to set any combination of them. Thus, you bitwise-OR each option you want to set to 1. You can set a bit to 0 by bitwise-ANDing it with it's bitwise inverse:
*B_CMD &= ~FOO; // disable foo option by setting it's bit to 0
Or you can toggle it by using XOR.
Sometimes you'll also see something similar, except an option will have multiple bits set. For example, an option that uses 2 bits can support up to four values. You'll often see something like this
#define BAR 0xC0 // 1100 0000
#define BAR_VAL0 0x00 // 0000 0000
#define BAR_VAL1 0x40 // 0100 0000
#define BAR_VAL2 0x80 // 1000 0000
#define BAR_VAL3 0xC0 // 1100 0000
In that case, you would clear the bits then OR in the value you want.
cmd &= ~BAR; // clear BAR bits
cmd |= BAR_VAL1; // set BAR option to VAL1
Hope that's clear enough.