Add atomic operation support

Add the support for the checking of interrupt mask, and add suport for the atomic operations.

In all examples below, there is value defined in the header and accessed by interrupt, access to it needs to be atomic.

```
uint64_t value;		// This value is used somewhere in interrupt
```

Example1: Basic usage of atomic block
```
CM_ATOMIC_BLOCK() {			// interrupts are masked in this block
    value = value * 1024 + 651;	// access value as atomic
}					// interrupts is restored automatically
```

Example 2: Use of return inside block:

```
uint64_t allocval(void)
{
    CM_ATOMIC_BLOCK() {		// interrupts are masked in this block
        value = value * 1024 + 651;	// do long atomic operation
        return value;		// interrupts is restored automatically
    }
}
```

Example 3: Basic usage of atomic context
```
for (int i=0;i < 100; i++) {
    CM_ATOMIC_CONTEXT();		// interrupts are masked in this block
    value += 100;			// access value as atomic
    if ((value % 16) == 0) {
        break;			// restore interrupts and break cycle
    }
}					// interrupts is restored automatically
```

Example 4: Usage of atomic context inside atomic reader fcn.

```
uint64_t getnextval(void)
{
    CM_ATOMIC_CONTEXT();	// interrupts are masked in this context
    value = value + 3;			// do long atomic operation
    return value;				// interrupts is restored automatically
}
```