86 lines
3.3 KiB
C
Executable File
86 lines
3.3 KiB
C
Executable File
/****************************************************************************
|
|
|
|
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
|
|
|
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
|
be copied by any method or incorporated into another program without
|
|
the express written consent of Aerospace C.Power. This Information or any portion
|
|
thereof remains the property of Aerospace C.Power. The Information contained herein
|
|
is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
|
liability for its use in any way and conveys no license or title under
|
|
any patent or copyright and makes no representation or warranty that this
|
|
Information is free from patent or copyright infringement.
|
|
|
|
****************************************************************************/
|
|
#ifndef IOT_DNN_API_H
|
|
#define IOT_DNN_API_H
|
|
|
|
/* os shim includes */
|
|
#include "os_types_api.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/** \defgroup dnn APIs
|
|
* @brief dnn APIs
|
|
* These functions could be used for dnn calculation, feature must be of
|
|
* type int16, height of feature should be 1, width of feature should be
|
|
* no larger than 16(i.e. at most 16 audios can be proceeded by calling
|
|
* one dnn driver function), channel of features should be no larger than 4096
|
|
* If the width of feature is less than 16, (16 - width of feature)
|
|
* zeros will be padded on every row so that every row of the feature
|
|
* occupies 32bytes in DDR.
|
|
*
|
|
*
|
|
*/
|
|
|
|
/** @addtogroup dnn_APIs
|
|
* @{
|
|
*/
|
|
|
|
/* @brief dnn_driver() - run a dnn net!
|
|
* @param config: the array storing the config
|
|
* @param fi_start_addr: where the 1st data of input is put,
|
|
* the input should be put successively
|
|
* @param wi_start_addr: where the 1st data of weight is put,
|
|
* the weight should be put successively
|
|
* @param fo_start_addr: where the 1st data of output is put,
|
|
* the input would be put successively
|
|
* @param audio_num: how many pieces of audios need calculating
|
|
* in one dnn process, this number should between 1 and 16
|
|
* @param pause_again_layer: the number of the layers after whose completion
|
|
* the computing process will be paused, should be set to 0
|
|
* when no pause is needed
|
|
* @param non_linear: non linear algorithm in the net, there should be only
|
|
* one kind of non linear algorithm in the net
|
|
*/
|
|
void dnn_driver(volatile uint32_t *config, uint32_t fi_start_addr,
|
|
uint32_t wi_start_addr, uint32_t fo_start_addr,
|
|
uint8_t audio_num, uint8_t pause_layer, uint8_t non_linear);
|
|
|
|
/* @brief dnn_recover() - recover a paused dnn computing process
|
|
* @param pause_again_layer: the number of the layers after whose completion
|
|
* the computing process will be paused again, should be set
|
|
* to 0 when no pause is needed
|
|
*/
|
|
void dnn_recover(uint8_t pause_again_layer);
|
|
|
|
/* @brief dnn_get_cycles() - get how many cycles for trans and cal in the last
|
|
* dnn calculation
|
|
* @param trans_cycle: where the trans cycle is put
|
|
* @param cal_cycle: where the calculate cycle is put
|
|
*/
|
|
void dnn_get_cycles(uint32_t *trans_cycle, uint32_t *cal_cycle);
|
|
|
|
/**
|
|
* @}
|
|
*/
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // IOT_DNN_API_H
|