Skip to content

Commit

Permalink
docs: add the comment and version of dcurl API
Browse files Browse the repository at this point in the history
Add the comment and configuration file of Doxygen to generate the API document.
The README.md also adds a badge of the github release version.
At last, the new macros for dcurl version are added.
  • Loading branch information
marktwtn committed Feb 26, 2019
1 parent ea1dfdf commit 6eeb3ae
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated files
build/
docs/html

# Object files
*.o
Expand Down
32 changes: 32 additions & 0 deletions Doxyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "dcurl"
PROJECT_NUMBER = 0.1.0
OUTPUT_DIRECTORY = docs
OPTIMIZE_OUTPUT_FOR_C = YES
#---------------------------------------------------------------------------
# Configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = YES
#---------------------------------------------------------------------------
# Configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = . \
docs \
src
FILE_PATTERNS = dcurl.c \
dcurl.h \
*.md
USE_MDFILE_AS_MAINPAGE = README.md
#---------------------------------------------------------------------------
# Configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = YES
INLINE_SOURCES = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
#---------------------------------------------------------------------------
# Configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Build Status](https://travis-ci.org/DLTcollab/dcurl.svg?branch=dev)](https://travis-ci.org/DLTcollab/dcurl)
![Supported IRI version](https://img.shields.io/badge/Supported%20IRI%20Version-1.6.0-brightgreen.svg)
![Release version](https://img.shields.io/github/release-pre/DLTcollab/dcurl.svg)

Hardware-accelerated implementation for IOTA PearlDiver, which utilizes multi-threaded SIMD, FPGA and GPU.

Expand Down
4 changes: 4 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
#include <stdint.h>
#include <time.h>

#define __DCURL_MAJOR__ 0
#define __DCURL_MINOR__ 1
#define __DCURL_PATCH__ 0

double diff_in_second(struct timespec t1, struct timespec t2);

typedef struct _pow_info PoW_Info;
Expand Down
20 changes: 9 additions & 11 deletions src/dcurl.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#if defined(ENABLE_OPENCL)
#include "pow_cl.h"
#endif
#if defined(ENABLE_FPGA_ACCEL)
#include "pow_fpga_accel.h"
#ifdef __APPLE__
#include <dispatch/dispatch.h>
#else
#include <semaphore.h>
#endif
#include "implcontext.h"
#include "trinary.h"
Expand All @@ -24,11 +23,11 @@
#elif defined(ENABLE_GENERIC)
#include "pow_c.h"
#endif

#ifdef __APPLE__
#include <dispatch/dispatch.h>
#else
#include <semaphore.h>
#if defined(ENABLE_OPENCL)
#include "pow_cl.h"
#endif
#if defined(ENABLE_FPGA_ACCEL)
#include "pow_fpga_accel.h"
#endif

/* check whether dcurl is initialized */
Expand Down Expand Up @@ -98,7 +97,6 @@ void dcurl_destroy()
}
}


int8_t *dcurl_entry(int8_t *trytes, int mwm, int threads)
{
void *pow_ctx = NULL;
Expand Down
36 changes: 36 additions & 0 deletions src/dcurl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,44 @@
#include <stdbool.h>
#include "trinary.h"

/**
* @file dcurl.h
*/

/**
* @brief dcurl initialization.
*
* Register the determined hardware into the list and initialize the
* corresponding resource.
* @return
* - true: initialization succeeded.
* - false: initialization failed.
*/
bool dcurl_init();

/**
* @brief dcurl destruction.
*
* Remove the registered hardware from the list and release the corresponding
* resource.
*/
void dcurl_destroy();

/**
* @brief dcurl execution.
*
* Retrieve the available hardware from the list and use it to do the
* PoW(Proof-of-Work).
* @param [in] trytes The trytes for PoW calculation.
* @param [in] mwm The minimum weight magnitude.
* @param [in] threads
* @parblock
* The thread number of calculating the PoW. It affects CPU only.
*
* 0: use (maximum threads - 1).
* @endparblock
* @return The result of PoW.
*/
int8_t *dcurl_entry(int8_t *trytes, int mwm, int threads);

#endif

0 comments on commit 6eeb3ae

Please sign in to comment.