Skip to content

snRuntime/api/sync_decls.h

Classes

Name
struct snrt_barrier_t

Functions

Name
volatile uint32_t * snrt_mutex()
void snrt_mutex_acquire(volatile uint32_t * pmtx)
lock a mutex, blocking
void snrt_mutex_ttas_acquire(volatile uint32_t * pmtx)
lock a mutex, blocking
void snrt_mutex_release(volatile uint32_t * pmtx)
Release the mutex.
void snrt_cluster_hw_barrier()
Synchronize cores in a cluster with a hardware barrier.
void snrt_global_barrier()
Synchronize clusters globally with a global software barrier.

Attributes

Name
volatile uint32_t _snrt_mutex
volatile snrt_barrier_t _snrt_barrier

Functions Documentation

function snrt_mutex

inline volatile uint32_t * snrt_mutex()

function snrt_mutex_acquire

inline void snrt_mutex_acquire(
    volatile uint32_t * pmtx
)

lock a mutex, blocking

declare mutex with static volatile uint32_t mtx = 0;

function snrt_mutex_ttas_acquire

inline void snrt_mutex_ttas_acquire(
    volatile uint32_t * pmtx
)

lock a mutex, blocking

test and test-and-set (ttas) implementation of a lock. Declare mutex with static volatile uint32_t mtx = 0;

function snrt_mutex_release

inline void snrt_mutex_release(
    volatile uint32_t * pmtx
)

Release the mutex.

function snrt_cluster_hw_barrier

inline void snrt_cluster_hw_barrier()

Synchronize cores in a cluster with a hardware barrier.

function snrt_global_barrier

inline void snrt_global_barrier()

Synchronize clusters globally with a global software barrier.

Attributes Documentation

variable _snrt_mutex

volatile uint32_t _snrt_mutex;

variable _snrt_barrier

volatile snrt_barrier_t _snrt_barrier;

Source code

// Copyright 2023 ETH Zurich and University of Bologna.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

typedef struct {
    uint32_t volatile cnt;
    uint32_t volatile iteration;
} snrt_barrier_t;

extern volatile uint32_t _snrt_mutex;
extern volatile snrt_barrier_t _snrt_barrier;

inline volatile uint32_t *snrt_mutex();

inline void snrt_mutex_acquire(volatile uint32_t *pmtx);

inline void snrt_mutex_ttas_acquire(volatile uint32_t *pmtx);

inline void snrt_mutex_release(volatile uint32_t *pmtx);

inline void snrt_cluster_hw_barrier();

inline void snrt_global_barrier();

Updated on 2023-06-19 at 09:43:56 +0000