SSL_ProgCounterTest.c 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**********************************************************************
  2. * © 2010 Microchip Technology Inc.
  3. *
  4. * FileName: SSL_ProgCounterTest.c
  5. * Dependencies: Header (.h) files if applicable, see below
  6. * Processor: PIC1´8FXXX
  7. * Compiler: C18 v3.41
  8. *
  9. * SOFTWARE LICENSE AGREEMENT:
  10. * Microchip Technology Inc. (“Microchip”) licenses this software to you
  11. * solely for use with Microchip dsPIC® digital signal controller
  12. * products. The software is owned by Microchip and is protected under
  13. * applicable copyright laws. All rights reserved.
  14. *
  15. * SOFTWARE IS PROVIDED “AS IS.” MICROCHIP EXPRESSLY DISCLAIMS ANY
  16. * WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING BUT NOT
  17. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  18. * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL MICROCHIP
  19. * BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR CONSEQUENTIAL
  20. * DAMAGES, LOST PROFITS OR LOST data, HARM TO YOUR EQUIPMENT, COST OF
  21. * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS
  22. * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF),
  23. * ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER SIMILAR COSTS.
  24. *
  25. * REVISION HISTORY:
  26. *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  27. * Author Date Comments on this revision
  28. *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  29. * CT 09/27/2007 First release of source file
  30. * Mike Cahill 11/11/2010 Updated for HI-TECH v9.80
  31. * MVL 02/22/2011 Tested with HI-TECH v9.81
  32. * VR KIT 07/11/2012 Downgrade to C18 v3.41
  33. * Version 1.03
  34. *
  35. *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  36. * ADDITIONAL NOTES:
  37. *
  38. **********************************************************************/
  39. #include "SSL_ProgCounterTest.h"
  40. uint16_t returnAddress,tempAddress;
  41. int16_t ProgramCounterResult;
  42. uint16_t SSL_PCtest( void )
  43. {
  44. //store Address of SSL_TestFunction1
  45. tempAddress= (unsigned int)&SSL_TestFunction1;
  46. // Branch to SSL_TestFunction1
  47. returnAddress=SSL_TestFunction1();
  48. // Test if the addresses match
  49. if( tempAddress != returnAddress)
  50. return PROGRAM_COUNTER_TEST_FAIL;
  51. // store Address of SSL_TestFunction2
  52. tempAddress= (long )&SSL_TestFunction2;
  53. // Branch to SSL_TestFunction2
  54. returnAddress=SSL_TestFunction2();
  55. // Test if the addresses match
  56. if( tempAddress != returnAddress)
  57. return PROGRAM_COUNTER_TEST_FAIL;
  58. return PROGRAM_COUNTER_TEST_PASS;
  59. }
  60. #pragma code my_code=0x400
  61. uint16_t SSL_TestFunction1( void )
  62. {
  63. return ( uint16_t )&SSL_TestFunction1;
  64. }
  65. #pragma code my_code1=0x500
  66. uint16_t SSL_TestFunction2(void)
  67. {
  68. return ( uint16_t )&SSL_TestFunction2;
  69. }