1 /**
2 * \ingroup MODULMACROS
3 *
4 * \file BlowFuse.c
5 *
6 * \brief Blow JTAG security fuse
7 *
8 */
9 /*
10  * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
11  *
12  *
13  *  Redistribution and use in source and binary forms, with or without
14  *  modification, are permitted provided that the following conditions
15  *  are met:
16  *
17  *    Redistributions of source code must retain the above copyright
18  *    notice, this list of conditions and the following disclaimer.
19  *
20  *    Redistributions in binary form must reproduce the above copyright
21  *    notice, this list of conditions and the following disclaimer in the
22  *    documentation and/or other materials provided with the
23  *    distribution.
24  *
25  *    Neither the name of Texas Instruments Incorporated nor the names of
26  *    its contributors may be used to endorse or promote products derived
27  *    from this software without specific prior written permission.
28  *
29  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  */
41 
42 #include "arch.h"
43 #include "edt.h"
44 #include "hal.h"
45 #include "stream.h"
46 #include "error_def.h"
47 #ifdef DB_PRINT
48 #include "debug.h"
49 #endif
50 
51 /**
52   BlowFuse
53   Blow JTAG security fuse.
54   After calling this function JTAG access is not possible anymore.
55   inData:  <tgtHasTest(8)>
56   outData: -
57   tgtHasTest: specifies if target device has TEST pin or not (bool)
58 */
59 
60 #if defined(MSP430_UIF) || defined(MSP_FET)
HAL_FUNCTION(_hal_BlowFuse)61 HAL_FUNCTION(_hal_BlowFuse)
62 {
63     short ret_value = HALERR_UNDEFINED_ERROR;
64     unsigned char hasTestVpp = 0;
65 
66     if ( STREAM_get_byte(&hasTestVpp) != -1 )
67     {
68         IHIL_BlowFuse(hasTestVpp);
69         ret_value = 0;
70     }
71     return ret_value;
72 }
73 #endif
74 
75 // Fuse blow disabled for of E-FET
76 #ifdef eZ_FET
HAL_FUNCTION(_hal_BlowFuse)77 HAL_FUNCTION(_hal_BlowFuse)
78 {
79     // fuseblow is not supported on eZ-FET
80     return API_CALL_NOT_SUPPORTED;
81 }
82 #endif
83