??? 06/12/10 07:53 Read: times Msg Score: +2 +2 Good Answer/Helpful |
#176611 - HAL Responding to: ???'s previous message |
Murray R. Van Luyn said:
My problem is this: I make repeated references to the CKCON clock control SFR Yes, making references to specific hardware features is always a problem when you want your code to be hardware-independent! A common approach is to provide a "Hardware Abstraction Layer" (HAL) to "hide" all the hardware-dependent details. I make repeated references to the CKCON clock control SFR register in my code, so as to enable support for the X2 CPU clock operating mode ... I find that some controllers add a second clock control register called CKCON1, and that they inconveniently rename the original CKCON clock So, instead of messing directly with CKCON/CKCON0/CKCON1 your application just calls a HAL function to enable_x2_speed() etc... Then, like Michael says, you can provide sets of HAL functions for your chosen range of processors - and instructions on what each function must do so that your users can make their own, if required... |