PAN1080 Peripheral API
pan_acc.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 Panchip Technology Corp. All rights reserved.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
14 *****************************************************************************/
15#ifndef __PAN_ACC_H__
16#define __PAN_ACC_H__
17
23#ifdef __cplusplus
24extern "C"
25{
26#endif
27
28
35__STATIC_INLINE void ACC_SetDivCalcCycle(ACC_T *acc,uint32_t cnt)
36{
37 acc->ACC_MULT_DIV_SEL = ((acc->ACC_MULT_DIV_SEL & ~ACC_MULT_DIV_SEL_CALC_CYCLE_Msk) | (cnt << ACC_MULT_DIV_SEL_CALC_CYCLE_Pos));
38}
45__STATIC_INLINE void ACC_EnableDivider(ACC_T *acc,FunctionalState NewState)
46{
47 (NewState != DISABLE)?(acc->ACC_MULT_DIV_SEL |= ACC_MULT_DIV_SEL_DIV_EN_Msk):(acc->ACC_MULT_DIV_SEL &= ~ACC_MULT_DIV_SEL_DIV_EN_Msk);
48}
49
56__STATIC_INLINE void ACC_SetMultCalcCycle(ACC_T *acc,uint32_t cnt)
57{
58 acc->ACC_LOGIC_SELECT = ((acc->ACC_LOGIC_SELECT & ~ACC_LOGIC_SEL_CALC_CYCLE_Msk) | (cnt << ACC_LOGIC_SEL_CALC_CYCLE_Pos));
59}
66__STATIC_INLINE void ACC_EnableMultiplier(ACC_T *acc,FunctionalState NewState)
67{
68 (NewState != DISABLE)?(acc->ACC_LOGIC_SELECT |= ACC_LOGIC_SEL_MULT_EN_Msk):(acc->ACC_LOGIC_SELECT &= ~ACC_LOGIC_SEL_MULT_EN_Msk);
69}
70
77__STATIC_INLINE void ACC_EnableInt(ACC_T *acc,FunctionalState NewState)
78{
79 (NewState != DISABLE)?(acc->ACC_INT |= ACC_INT_INT_EN_Msk):(acc->ACC_INT &= ~ACC_INT_INT_EN_Msk);
80}
81
90__STATIC_INLINE bool ACC_StatusFlag(ACC_T *acc,uint32_t flag)
91{
92 return (ACC->ACC_INT & flag) ? (true) : (false);
93}
94
103__STATIC_INLINE void ACC_ClearStatus(ACC_T *acc,uint32_t flag)
104{
105 ACC->ACC_INT |= flag;
106}
107
117void ACC_StartMultCalc(ACC_T *acc,
118 const uint32_t *left,
119 const uint32_t *right,
120 uint8_t num_words,
121 uint8_t cycle);
122
130void ACC_GetMultResult(ACC_T *acc,uint8_t num_words,uint32_t *result);
131
140uint32_t ACC_DivisionCalculate(ACC_T *acc,uint32_t divisor, uint32_t dividend,uint8_t cycle);
141
145#ifdef __cplusplus
146}
147#endif
148
149#endif /* __PAN_ACC_H__ */
150
void ACC_StartMultCalc(ACC_T *acc, const uint32_t *left, const uint32_t *right, uint8_t num_words, uint8_t cycle)
This function is used to start multiplier.
__STATIC_INLINE void ACC_SetDivCalcCycle(ACC_T *acc, uint32_t cnt)
This function set acc divider calculate cycle cnt.
Definition: pan_acc.h:35
__STATIC_INLINE void ACC_ClearStatus(ACC_T *acc, uint32_t flag)
This function used to clear acc interrupt status.
Definition: pan_acc.h:103
__STATIC_INLINE void ACC_SetMultCalcCycle(ACC_T *acc, uint32_t cnt)
This function set calculate cycle cnt.
Definition: pan_acc.h:56
__STATIC_INLINE bool ACC_StatusFlag(ACC_T *acc, uint32_t flag)
This function used to check acc interrupt status.
Definition: pan_acc.h:90
__STATIC_INLINE void ACC_EnableMultiplier(ACC_T *acc, FunctionalState NewState)
This function used to enable multiplying unit.
Definition: pan_acc.h:66
void ACC_GetMultResult(ACC_T *acc, uint8_t num_words, uint32_t *result)
This function is used to get multiplier result.
uint32_t ACC_DivisionCalculate(ACC_T *acc, uint32_t divisor, uint32_t dividend, uint8_t cycle)
This function is used to start divider.
__STATIC_INLINE void ACC_EnableInt(ACC_T *acc, FunctionalState NewState)
This function used to enable acc interrupt.
Definition: pan_acc.h:77
__STATIC_INLINE void ACC_EnableDivider(ACC_T *acc, FunctionalState NewState)
This function used to enable divider.
Definition: pan_acc.h:45