wdtcon.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* wdtcon.h -- Lock/unlock TriCore's ENDINIT bit and modify WDTCON0.
  2. Copyright (C) 2000 - 2013 HighTec EDV-Systeme GmbH.
  3. This file is part of GCC.
  4. GCC is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. GCC is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. Under Section 7 of GPL version 3, you are granted additional
  13. permissions described in the GCC Runtime Library Exception, version
  14. 3.1, as published by the Free Software Foundation.
  15. You should have received a copy of the GNU General Public License and
  16. a copy of the GCC Runtime Library Exception along with this program;
  17. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  18. <http://www.gnu.org/licenses/>. */
  19. #ifndef __wdtcon_h
  20. #define __wdtcon_h
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* To modify ENDINIT-protected registers, use the following sequence:
  25. unlock_wdtcon (); // reset ENDINIT bit
  26. write new value(s) to desired register(s)
  27. lock_wdtcon (); // set ENDINIT bit
  28. Another way would be:
  29. WDT_Passwd (); // prepare WDTCON0 for write access
  30. WDT_Modify (0, 0x1); // reset ENDINIT bit
  31. write new value(s) to desired register(s)
  32. WDT_Passwd ();
  33. WDT_Modify (1, 0x1); // set ENDINIT bit
  34. The basic difference between the two approaches is that WDT_Modify()
  35. allows to manipulate every bit in WDTCON0 at the same time, while
  36. (un)lock_wdtcon() only (re)sets the ENDINIT bit.
  37. On multi core targets (like TC27x) the functions WDT_Passwd and
  38. WDT_Modify are not implemented.
  39. */
  40. extern void lock_wdtcon (void);
  41. extern void unlock_wdtcon (void);
  42. extern void WDT_Passwd (void);
  43. extern void WDT_Modify (unsigned long modify, unsigned long mask);
  44. /* functions for handling multi core targets' safety watchdog */
  45. extern void lock_safety_wdtcon (void);
  46. extern void unlock_safety_wdtcon (void);
  47. #ifdef __cplusplus
  48. }
  49. #endif
  50. #endif /* __wdtcon_h */