Lines Matching +full:fifo +full:- +full:threshold

4  * SPDX-License-Identifier: Apache-2.0
30 uint8_t threshold; member
37 (CONFIG_ENTROPY_SMARTBOND_ISR_POOL_SIZE - 1)) == 0,
41 (CONFIG_ENTROPY_SMARTBOND_THR_POOL_SIZE - 1)) == 0,
54 /* TRNG FIFO definitions are not in DA1469x.h */
86 CRG_TOP->CLK_AMBA_REG |= CRG_TOP_CLK_AMBA_REG_TRNG_CLK_ENABLE_Msk; in trng_enable()
87 TRNG->TRNG_CTRL_REG = TRNG_TRNG_CTRL_REG_TRNG_ENABLE_Msk; in trng_enable()
95 CRG_TOP->CLK_AMBA_REG &= ~CRG_TOP_CLK_AMBA_REG_TRNG_CLK_ENABLE_Msk; in trng_enable()
96 TRNG->TRNG_CTRL_REG = 0; in trng_enable()
106 return TRNG->TRNG_FIFOLVL_REG & FIFO_COUNT_MASK; in trng_available()
117 int retval = -EAGAIN; in random_word_get()
139 uint32_t last = rngp->last; in rng_pool_get()
140 uint32_t mask = rngp->mask; in rng_pool_get()
147 first = rngp->first_alloc; in rng_pool_get()
150 * The other_read_in_progress is non-zero if rngp->first_read != first, in rng_pool_get()
151 * which means that lower-priority code (which was interrupted by this in rng_pool_get()
154 other_read_in_progress = (rngp->first_read ^ first); in rng_pool_get()
156 available = (last - first) & mask; in rng_pool_get()
165 rngp->first_alloc = (first + len) & mask; in rng_pool_get()
168 while (likely(len--)) { in rng_pool_get()
169 *dst++ = rngp->buffer[first]; in rng_pool_get()
180 rngp->first_read = rngp->first_alloc; in rng_pool_get()
184 len = dst - buf; in rng_pool_get()
185 available = available - len; in rng_pool_get()
186 if (available <= rngp->threshold) { in rng_pool_get()
195 uint8_t first = rngp->first_read; in rng_pool_put()
196 uint8_t last = rngp->last; in rng_pool_put()
197 uint8_t mask = rngp->mask; in rng_pool_put()
200 if (((last - first) & mask) == mask) { in rng_pool_put()
201 return -ENOBUFS; in rng_pool_put()
204 rngp->buffer[last] = byte; in rng_pool_put()
205 rngp->last = (last + 1) & mask; in rng_pool_put()
226 static void rng_pool_init(struct rng_pool *rngp, uint16_t size, uint8_t threshold) in rng_pool_init() argument
228 rngp->first_alloc = 0U; in rng_pool_init()
229 rngp->first_read = 0U; in rng_pool_init()
230 rngp->last = 0U; in rng_pool_init()
231 rngp->mask = size - 1; in rng_pool_init()
232 rngp->threshold = threshold; in rng_pool_init()
246 /* Nothing in FIFO -> nothing to do */ in smartbond_trng_isr()
251 /* Put bytes in ISR FIFO first */ in smartbond_trng_isr()
255 /* Put leftovers in thread FIFO */ in smartbond_trng_isr()
263 /* Bytes did not fit in isr nor thread FIFO, disable TRNG for now */ in smartbond_trng_isr()
275 __ASSERT_NO_MSG(&entropy_smartbond_data == dev->data); in entropy_smartbond_get_entropy()
290 len -= bytes; in entropy_smartbond_get_entropy()
304 __ASSERT_NO_MSG(&entropy_smartbond_data == dev->data); in entropy_smartbond_get_entropy_isr()
322 * RNG event will set the Cortex-M single-bit event register in entropy_smartbond_get_entropy_isr()
336 * SEV-On-Pend feature must be enabled (enabled in entropy_smartbond_get_entropy_isr()
354 buf[--len] = *ptr++; in entropy_smartbond_get_entropy_isr()
380 * are below the defined ISR and thread FIFO's thresholds. in entropy_smartbond_pm_action()
391 ret = -ENOTSUP; in entropy_smartbond_pm_action()
405 __ASSERT_NO_MSG(&entropy_smartbond_data == dev->data); in entropy_smartbond_init()