NanoStack lib for Cortex-M4
Dependents: mbedEndpointNetwork mbedEndpointNetworkMJK
Fork of Nanostack_lib by
inc/randlib/randLIB.h@11:1b7aaf37a131, 2014-06-25 (annotated)
- Committer:
- jusu_81
- Date:
- Wed Jun 25 21:05:58 2014 +0000
- Revision:
- 11:1b7aaf37a131
- Parent:
- 4:c449bead5cf3
- Child:
- 12:acef6f596835
Added C++ & C Extern C sectors to hedaer files.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mika Karjalainen |
4:c449bead5cf3 | 1 | |
Mika Karjalainen |
4:c449bead5cf3 | 2 | /** |
Mika Karjalainen |
4:c449bead5cf3 | 3 | * \file randLIB.h |
Mika Karjalainen |
4:c449bead5cf3 | 4 | * \brief Pseudo Random Library API: |
Mika Karjalainen |
4:c449bead5cf3 | 5 | * |
Mika Karjalainen |
4:c449bead5cf3 | 6 | * |
Mika Karjalainen |
4:c449bead5cf3 | 7 | * \section net-boot Network Bootstrap Control API: |
Mika Karjalainen |
4:c449bead5cf3 | 8 | * - randLIB_seed_random(), Set seed for pseudo random |
Mika Karjalainen |
4:c449bead5cf3 | 9 | * - randLIB_get_8bit(), Generate 8-bit random number |
Mika Karjalainen |
4:c449bead5cf3 | 10 | * - randLIB_get_16bit(),Generate 16-bit random number |
Mika Karjalainen |
4:c449bead5cf3 | 11 | * - randLIB_get_32bit(),Generate 32-bit random number |
Mika Karjalainen |
4:c449bead5cf3 | 12 | * - randLIB_get_n_bytes_random(), Generate n-bytes random numbers |
Mika Karjalainen |
4:c449bead5cf3 | 13 | * |
Mika Karjalainen |
4:c449bead5cf3 | 14 | */ |
Mika Karjalainen |
4:c449bead5cf3 | 15 | |
Mika Karjalainen |
4:c449bead5cf3 | 16 | #ifndef RANDLIB_H_ |
Mika Karjalainen |
4:c449bead5cf3 | 17 | #define RANDLIB_H_ |
jusu_81 | 11:1b7aaf37a131 | 18 | #ifdef __cplusplus |
jusu_81 | 11:1b7aaf37a131 | 19 | extern "C" { |
jusu_81 | 11:1b7aaf37a131 | 20 | #endif |
Mika Karjalainen |
4:c449bead5cf3 | 21 | /** |
Mika Karjalainen |
4:c449bead5cf3 | 22 | * \brief Init seed for Pseudo Random. |
Mika Karjalainen |
4:c449bead5cf3 | 23 | * |
Mika Karjalainen |
4:c449bead5cf3 | 24 | * \return None |
Mika Karjalainen |
4:c449bead5cf3 | 25 | * |
Mika Karjalainen |
4:c449bead5cf3 | 26 | */ |
Mika Karjalainen |
4:c449bead5cf3 | 27 | extern void randLIB_seed_random(void); |
Mika Karjalainen |
4:c449bead5cf3 | 28 | |
Mika Karjalainen |
4:c449bead5cf3 | 29 | /** |
Mika Karjalainen |
4:c449bead5cf3 | 30 | * \brief Generate 8-bit random number. |
Mika Karjalainen |
4:c449bead5cf3 | 31 | * |
Mika Karjalainen |
4:c449bead5cf3 | 32 | * \param None |
Mika Karjalainen |
4:c449bead5cf3 | 33 | * \return 8-bit random number |
Mika Karjalainen |
4:c449bead5cf3 | 34 | * |
Mika Karjalainen |
4:c449bead5cf3 | 35 | */ |
Mika Karjalainen |
4:c449bead5cf3 | 36 | extern uint8_t randLIB_get_8bit(void); |
Mika Karjalainen |
4:c449bead5cf3 | 37 | |
Mika Karjalainen |
4:c449bead5cf3 | 38 | /** |
Mika Karjalainen |
4:c449bead5cf3 | 39 | * \brief Generate 16-bit random number. |
Mika Karjalainen |
4:c449bead5cf3 | 40 | * |
Mika Karjalainen |
4:c449bead5cf3 | 41 | * \param None |
Mika Karjalainen |
4:c449bead5cf3 | 42 | * \return 16-bit random number |
Mika Karjalainen |
4:c449bead5cf3 | 43 | * |
Mika Karjalainen |
4:c449bead5cf3 | 44 | */ |
Mika Karjalainen |
4:c449bead5cf3 | 45 | extern uint16_t randLIB_get_16bit(void); |
Mika Karjalainen |
4:c449bead5cf3 | 46 | |
Mika Karjalainen |
4:c449bead5cf3 | 47 | /** |
Mika Karjalainen |
4:c449bead5cf3 | 48 | * \brief Generate 32-bit random number. |
Mika Karjalainen |
4:c449bead5cf3 | 49 | * |
Mika Karjalainen |
4:c449bead5cf3 | 50 | * \param None |
Mika Karjalainen |
4:c449bead5cf3 | 51 | * \return 16-bit random number |
Mika Karjalainen |
4:c449bead5cf3 | 52 | * |
Mika Karjalainen |
4:c449bead5cf3 | 53 | */ |
Mika Karjalainen |
4:c449bead5cf3 | 54 | extern uint32_t randLIB_get_32bit(void); |
Mika Karjalainen |
4:c449bead5cf3 | 55 | |
Mika Karjalainen |
4:c449bead5cf3 | 56 | /** |
Mika Karjalainen |
4:c449bead5cf3 | 57 | * \brief Generate n-bytes random numbers. |
Mika Karjalainen |
4:c449bead5cf3 | 58 | * |
Mika Karjalainen |
4:c449bead5cf3 | 59 | * \param data_ptr pointer where random will be stored |
Mika Karjalainen |
4:c449bead5cf3 | 60 | * \param eight_bit_boundary how many bytes need random |
Mika Karjalainen |
4:c449bead5cf3 | 61 | * \return 0 process valid |
Mika Karjalainen |
4:c449bead5cf3 | 62 | * \return -1 Unsupported Parameters |
Mika Karjalainen |
4:c449bead5cf3 | 63 | * |
Mika Karjalainen |
4:c449bead5cf3 | 64 | */ |
Mika Karjalainen |
4:c449bead5cf3 | 65 | extern int8_t randLIB_get_n_bytes_random(uint8_t *data_ptr, uint8_t eight_bit_boundary); |
jusu_81 | 11:1b7aaf37a131 | 66 | #ifdef __cplusplus |
jusu_81 | 11:1b7aaf37a131 | 67 | } |
jusu_81 | 11:1b7aaf37a131 | 68 | #endif |
Mika Karjalainen |
4:c449bead5cf3 | 69 | |
Mika Karjalainen |
4:c449bead5cf3 | 70 | #endif /* RANDLIB_H_ */ |