@@ -1,3 +1,7 @@
|
||||
2020-06-23 NIIBE Yutaka <gniibe@fsij.org>
|
||||
|
||||
* chopstx.c (chopstx_critical): New.
|
||||
|
||||
2019-12-27 NIIBE Yutaka <gniibe@fsij.org>
|
||||
|
||||
* contrib/spi-st.c (check_transmit, put_data): Fix handling
|
||||
|
||||
22
chopstx.c
22
chopstx.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* chopstx.c - Threads and only threads.
|
||||
*
|
||||
* Copyright (C) 2013, 2014, 2015, 2016, 2017, 2018, 2019
|
||||
* Copyright (C) 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020
|
||||
* Flying Stone Technology
|
||||
* Author: NIIBE Yutaka <gniibe@fsij.org>
|
||||
*
|
||||
@@ -1700,3 +1700,23 @@ chopstx_conf_idle (int enable_sleep)
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* chopstx_critical - Construct a critical section
|
||||
* @func: function to be called
|
||||
* @arg: argument to function
|
||||
*
|
||||
* Run the function @func with @arg under CPU schedule lock.
|
||||
* Return void * pointer.
|
||||
*/
|
||||
void *
|
||||
chopstx_critical (void *func (void *), void *arg)
|
||||
{
|
||||
void *p;
|
||||
|
||||
chx_cpu_sched_lock ();
|
||||
p = func (arg);
|
||||
chx_cpu_sched_unlock ();
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
* chopstx.h - Threads and only threads.
|
||||
*
|
||||
* Copyright (C) 2013, 2016, 2017, 2018 Flying Stone Technology
|
||||
* Copyright (C) 2013, 2016, 2017, 2018, 2020
|
||||
* Flying Stone Technology
|
||||
* Author: NIIBE Yutaka <gniibe@fsij.org>
|
||||
*
|
||||
* This file is a part of Chopstx, a thread library for embedded.
|
||||
@@ -161,3 +162,5 @@ int chopstx_poll (uint32_t *usec_p, int n,
|
||||
struct chx_poll_head *const pd_array[]);
|
||||
|
||||
int chopstx_conf_idle (int enable_sleep);
|
||||
|
||||
void *chopstx_critical (void *func (void *), void *arg);
|
||||
|
||||
Reference in New Issue
Block a user