All,
So I've been writing my Cortex M monitor and using this library, which
eventually I hope to publish to github but in the mean time a question has
come up for me.
So I'm writing SD Card support into my monitor, and its still a bit thin in
the library so I've not too many style suggestions to go by. But this is
the current question.
So in ./include/libopencm3/stm32/sdio.h there is a define:
/* CLKDIV: Clock divide factor */
#define SDIO_CLKCR_CLKDIV_SHIFT 0
#define SDIO_CLKCR_CLKDIV_MSK (0xFF << SDIO_CLKCR_CLKDIV_SHIFT)
And I want to set the Clock Divisor to 0x76. So do I do this ?
tmp = SDIO_CLKCR;
tmp &= ~SDIO_CLKCR_CLKDIV_MSK;
tmp |= (0x76) << SDO_CLKCR_CLKDIV_SHIFT;
Seems a bit verbose.
Not that I'm a huge fan of ST Micro's use of structure construction to
place bits in the field of course, that seems a bit cleaner in their code.
But if that is what is expected in libopencm3 code I'm ok with it.
--Chuck
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
libopencm3-devel mailing list
libopencm3-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libopencm3-devel