MAX32665 SDK Documentation  0.2
Software Development Kit Overview and API Documentation
maa.h
1 
6 /* ****************************************************************************
7  * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a
10  * copy of this software and associated documentation files (the "Software"),
11  * to deal in the Software without restriction, including without limitation
12  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  * and/or sell copies of the Software, and to permit persons to whom the
14  * Software is furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included
17  * in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
23  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  *
27  * Except as contained in this notice, the name of Maxim Integrated
28  * Products, Inc. shall not be used except as stated in the Maxim Integrated
29  * Products, Inc. Branding Policy.
30  *
31  * The mere transfer of this software does not imply any licenses
32  * of trade secrets, proprietary technology, copyrights, patents,
33  * trademarks, maskwork rights, or any other form of intellectual
34  * property whatsoever. Maxim Integrated Products, Inc. retains all
35  * ownership rights.
36  *
37  * $Date: 2018-09-10 16:20:17 -0500 (Mon, 10 Sep 2018) $
38  * $Revision: 37771 $
39  *
40  *************************************************************************** */
41 
42 #ifndef _MAA_H_
43 #define _MAA_H_
44 
45 #include <stdint.h>
46 #include "tpu_regs.h"
47 #include "mxc_config.h"
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
59 /* ****** MACROS ****** */
60 #define MAA_MAX_SIZE 256 // in bytes
61 #define MAA_MAX_WORD_SIZE 2048 // in bits
62 
63 /***************************************************************************************************************
64  DATA STRUCTURES FOR MAA INITIALIZATION
65 ***************************************************************************************************************/
66 typedef enum {
67  TPU_MAA_EXP = MXC_V_TPU_MAA_CTRL_CLC_EXP, // Select exponentiation operation
68  TPU_MAA_SQ = MXC_V_TPU_MAA_CTRL_CLC_SQ, // Select square operation
69  TPU_MAA_MUL = MXC_V_TPU_MAA_CTRL_CLC_MUL, // Select multiplication operation
70  TPU_MAA_SQMUL = MXC_V_TPU_MAA_CTRL_CLC_SQMUL, // Select square followed by multiplication operation
71  TPU_MAA_ADD = MXC_V_TPU_MAA_CTRL_CLC_ADD, // Select add operation
72  TPU_MAA_SUB = MXC_V_TPU_MAA_CTRL_CLC_SUB // Select subtract operation
73 } tpu_maa_clcsel_t;
74 
75 /***************************************************************************************************************
76  DRIVER EXPOSED API's
77 ***************************************************************************************************************/
81 void MAA_Reset(void);
82 
89 int MAA_Init(unsigned int size);
90 
97 int MAA_Shutdown(void);
98 
115 int MAA_Compute(tpu_maa_clcsel_t clc, char *multiplier, char *multiplicand, char *exp, char *mod, int *result, unsigned int len);
116 
117 #ifdef __cplusplus
118 }
119 #endif
120 
122 #endif /* _MAA_H_ */
#define MXC_V_TPU_MAA_CTRL_CLC_SQMUL
MAA_CTRL_CLC_SQMUL Value.
Definition: tpu_regs.h:374
#define MXC_V_TPU_MAA_CTRL_CLC_EXP
MAA_CTRL_CLC_EXP Value.
Definition: tpu_regs.h:368
#define MXC_V_TPU_MAA_CTRL_CLC_ADD
MAA_CTRL_CLC_ADD Value.
Definition: tpu_regs.h:376
int MAA_Compute(tpu_maa_clcsel_t clc, char *multiplier, char *multiplicand, char *exp, char *mod, int *result, unsigned int len)
MAA operation.
#define MXC_V_TPU_MAA_CTRL_CLC_SQ
MAA_CTRL_CLC_SQ Value.
Definition: tpu_regs.h:370
int MAA_Shutdown(void)
Release MAA.
void MAA_Reset(void)
Reset the TPU accelerator.
#define MXC_V_TPU_MAA_CTRL_CLC_MUL
MAA_CTRL_CLC_MUL Value.
Definition: tpu_regs.h:372
#define MXC_V_TPU_MAA_CTRL_CLC_SUB
MAA_CTRL_CLC_SUB Value.
Definition: tpu_regs.h:378
int MAA_Init(unsigned int size)
Configure MAA operation with appropriate MAA word size.