Home | History | Annotate | Download | only in include
      1  /*
      2   * Copyright (C) 2015 NXP Semiconductors
      3   *
      4   * Licensed under the Apache License, Version 2.0 (the "License");
      5   * you may not use this file except in compliance with the License.
      6   * You may obtain a copy of the License at
      7   *
      8   *      http://www.apache.org/licenses/LICENSE-2.0
      9   *
     10   * Unless required by applicable law or agreed to in writing, software
     11   * distributed under the License is distributed on an "AS IS" BASIS,
     12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13   * See the License for the specific language governing permissions and
     14   * limitations under the License.
     15   */
     16 #ifdef __cplusplus
     17 
     18 extern "C" {
     19 
     20 #endif
     21 
     22 
     23 #ifndef ALALIB_H_
     24 #define ALALIB_H_
     25 
     26 #include <stdio.h>
     27 
     28 #include "IChannel.h"
     29 
     30 /*******************************************************************************
     31 **
     32 ** Function:        ALA_Init
     33 **
     34 ** Description:     Initializes the ALA library and opens the DWP communication channel
     35 **
     36 ** Returns:         SUCCESS if ok.
     37 **
     38 *******************************************************************************/
     39 unsigned char ALA_Init(IChannel *channel);
     40 
     41 /*******************************************************************************
     42 **
     43 ** Function:        ALA_Start
     44 **
     45 ** Description:     Starts the ALA over DWP
     46 **
     47 ** Returns:         SUCCESS if ok.
     48 **
     49 *******************************************************************************/
     50 #if(NXP_LDR_SVC_VER_2 == TRUE)
     51 unsigned char ALA_Start(const char *name, const char *dest, UINT8 *pdata, UINT16 len, UINT8 *respSW);
     52 #else
     53 unsigned char ALA_Start(const char *name, UINT8 *pdata, UINT16 len);
     54 #endif
     55 
     56 /*******************************************************************************
     57 **
     58 ** Function:        ALA_DeInit
     59 **
     60 ** Description:     Deinitializes the ALA Lib
     61 **
     62 ** Returns:         TRUE if ok.
     63 **
     64 *******************************************************************************/
     65 bool ALA_DeInit();
     66 
     67 #if(NXP_LDR_SVC_VER_2 == TRUE)
     68 /*******************************************************************************
     69 **
     70 ** Function:        ALA_lsGetVersion
     71 **
     72 ** Description:     Get the Loader service Applet and cleint version
     73 **
     74 ** Returns:         byte[] array.
     75 **
     76 *******************************************************************************/
     77 unsigned char ALA_lsGetVersion(UINT8 *pVersion);
     78 unsigned char ALA_lsGetStatus(UINT8 *pVersion);
     79 unsigned char ALA_lsGetAppletStatus(UINT8 *pVersion);
     80 #else
     81 void ALA_GetlistofApplets(char *list[], UINT8* num);
     82 
     83 unsigned char ALA_GetCertificateKey(UINT8 *pKey, INT32 *pKeylen);
     84 #endif
     85 
     86 inline int FSCANF_BYTE(FILE *stream, const char *format, void* pVal)
     87 {
     88     int Result = 0;
     89 
     90     if((NULL != stream) && (NULL != format) && (NULL != pVal))
     91     {
     92         unsigned int dwVal;
     93         unsigned char* pTmp = (unsigned char*)pVal;
     94         Result = fscanf(stream, format, &dwVal);
     95 
     96         (*pTmp) = (unsigned char)(dwVal & 0x000000FF);
     97     }
     98     return Result;
     99 }
    100 
    101 #endif /* ALALIB_H_ */
    102 
    103 #ifdef __cplusplus
    104 
    105 }
    106 
    107 #endif
    108