本帖最后由 holddreamair 于 2016-12-16 13:28 编辑
在TI的DSP例程中有下面一段内容:
//Fill all registers with zeros. Writing to each register separately
//for six GPIO modules would make this function *very* long. Fortunately,
//we'd be writing them all with zeros anyway, so this saves a lot of space.
gpioBaseAddr = (Uint32 *)&GpioCtrlRegs;
for (regOffset = 0; regOffset < sizeof(GpioCtrlRegs)/2; regOffset++)
{
gpioBaseAddr[regOffset] = 0x00000000;
}
gpioBaseAddr = (Uint32 *)&GpioDataRegs;
for (regOffset = 0; regOffset < sizeof(GpioDataRegs)/2; regOffset++)
{
gpioBaseAddr[regOffset] = 0x00000000;
}
请问寄存器写0来节省空间是什么意思?
|