Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
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...

List of 34 messages in thread
TopicAuthorDate
Conditional SFR Declaration?            01/01/70 00:00      
   ReDef            01/01/70 00:00      
   Preprocessor -vs- Compiler            01/01/70 00:00      
      Thanks...            01/01/70 00:00      
   A Loosely Related Query?            01/01/70 00:00      
      .h file            01/01/70 00:00      
         Yep, that works!            01/01/70 00:00      
            I would not            01/01/70 00:00      
               Good question...            01/01/70 00:00      
            A Rethink...            01/01/70 00:00      
               I don't know ... but            01/01/70 00:00      
                  Agree with Michael            01/01/70 00:00      
                  An overthink.            01/01/70 00:00      
               #including #includes            01/01/70 00:00      
                  totally?            01/01/70 00:00      
                     re: really?            01/01/70 00:00      
   Still no luck...            01/01/70 00:00      
      Like I said before....            01/01/70 00:00      
      HAL            01/01/70 00:00      
      just curious            01/01/70 00:00      
         Nicely workable solution found...            01/01/70 00:00      
            Post vandalised!            01/01/70 00:00      
               What do you mean ...            01/01/70 00:00      
                  I mean this...            01/01/70 00:00      
                     Vandalism Highly Doubted            01/01/70 00:00      
                        Thanks Michael.            01/01/70 00:00      
      Define a new sfr?            01/01/70 00:00      
         RE: This assumes that location 0x8E is always the register            01/01/70 00:00      
         Simplest Solution?            01/01/70 00:00      
            I think HAL is less risky?            01/01/70 00:00      
               HAL very interesting...            01/01/70 00:00      
                  RE: might not be so immediately well understood            01/01/70 00:00      
                     Ah, now I see...            01/01/70 00:00      
                        No, you don't need a HAL header file for each variant!            01/01/70 00:00      

Back to Subject List