baseaddr and length are supposed to be 64 bits wide, how do you expect to do that in 16 bit C(I'll give you a clue, those ints are 16 bit.)? In my opinion, this is one of the few screw ups in C, there is no way to define a variable of a specified width.