Qualcomm Interview Question
Software Engineer / DevelopersDepends on Device:
1, Processor is memory-mapped IO. Map the device's register to conventional memory.
* Used appropriate sized and signed type for register: e.g. one byte can be declared as char; two byte can be declared as unsinged short.
*int32_t, Uint32_t declare in <stdint.h>
*Some compilers provide language extensions that will let you position an object at a specified memory address. For example, using the TASKING C166/ST10 C Cross-Compiler's _at attribute you can write a global declaration such as:
unsigned short count _at(0xFF08);
* Use pointer:dual_timers *const timers
= (dual_timers *)0x03FF6000;
2, Processor is port-mapped IO. Map the device's register to seperate memory space.
In this scenario, needing exta library extention, or even assembly language.
e.g. IN and OUT for Intel 80X86
it is very easy to write into any memory location
Uint32_t *addr;
addr = (Uint32_t)0x12345678; //0x12345678 - is any address location
*addr = 0x2341; //0x2341 is the value u want to write
Usually the memory/control registers of the device itself is memory or portmapped to program the device. In some cases, you can directly write/use the CPU's DMA engine to copy chunks of data, then program the device. Sometimes, you can just give the physical memory location and the size, and let the device's DMA chip do it for you.
- Anonymous April 19, 2010It all depends on the device.