kernel: Port remaining syscalls to new API

These calls are not accessible in CI test, nor do they get built on
common platforms (in at least one case I found a typo which proved the
code was truly unused).  These changes are blind, so live in a
separate commit.  But the nature of the port is mechanical, all other
syscalls in the system work fine, and any errors should be easily
corrected.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2019-08-13 11:34:34 -07:00 committed by Anas Nashif
commit 075c94f6e2
15 changed files with 154 additions and 67 deletions

View file

@ -8,7 +8,8 @@
#include <syscall_handler.h> #include <syscall_handler.h>
#include <kernel.h> #include <kernel.h>
Z_SYSCALL_HANDLER(adc_channel_setup, dev, user_channel_cfg) static inline int z_vrfy_adc_channel_setup(struct device *dev,
const struct adc_channel_cfg *user_channel_cfg)
{ {
struct adc_channel_cfg channel_cfg; struct adc_channel_cfg channel_cfg;
@ -19,6 +20,7 @@ Z_SYSCALL_HANDLER(adc_channel_setup, dev, user_channel_cfg)
return z_impl_adc_channel_setup((struct device *)dev, &channel_cfg); return z_impl_adc_channel_setup((struct device *)dev, &channel_cfg);
} }
#include <syscalls/adc_channel_setup_mrsh.c>
static bool copy_sequence(struct adc_sequence *dst, static bool copy_sequence(struct adc_sequence *dst,
struct adc_sequence_options *options, struct adc_sequence_options *options,
@ -45,8 +47,9 @@ static bool copy_sequence(struct adc_sequence *dst,
return true; return true;
} }
static inline int z_vrfy_adc_read(struct device *dev,
const struct adc_sequence *user_sequence)
Z_SYSCALL_HANDLER(adc_read, dev, user_sequence)
{ {
struct adc_sequence sequence; struct adc_sequence sequence;
struct adc_sequence_options options; struct adc_sequence_options options;
@ -62,9 +65,12 @@ Z_SYSCALL_HANDLER(adc_read, dev, user_sequence)
return z_impl_adc_read((struct device *)dev, &sequence); return z_impl_adc_read((struct device *)dev, &sequence);
} }
#include <syscalls/adc_read_mrsh.c>
#ifdef CONFIG_ADC_ASYNC #ifdef CONFIG_ADC_ASYNC
Z_SYSCALL_HANDLER(adc_read_async, dev, user_sequence, async) static inline int z_vrfy_adc_read_async(struct device *dev,
const struct adc_sequence *user_sequence,
struct k_poll_signal *async)
{ {
struct adc_sequence sequence; struct adc_sequence sequence;
struct adc_sequence_options options; struct adc_sequence_options options;
@ -82,4 +88,5 @@ Z_SYSCALL_HANDLER(adc_read_async, dev, user_sequence, async)
return z_impl_adc_read_async((struct device *)dev, &sequence, return z_impl_adc_read_async((struct device *)dev, &sequence,
(struct k_poll_signal *)async); (struct k_poll_signal *)async);
} }
#include <syscalls/adc_read_async_mrsh.c>
#endif /* CONFIG_ADC_ASYNC */ #endif /* CONFIG_ADC_ASYNC */

View file

@ -7,15 +7,21 @@
#include <syscall_handler.h> #include <syscall_handler.h>
#include <drivers/can.h> #include <drivers/can.h>
Z_SYSCALL_HANDLER(can_configure, dev, mode, bitrate) { static inline int z_vrfy_can_configure(struct device *dev, enum can_mode mode,
u32_t bitrate) {
Z_OOPS(Z_SYSCALL_DRIVER_CAN(dev, configure)); Z_OOPS(Z_SYSCALL_DRIVER_CAN(dev, configure));
return z_impl_can_configure((struct device *)dev, (enum can_mode)mode, return z_impl_can_configure((struct device *)dev, (enum can_mode)mode,
(u32_t)bitrate); (u32_t)bitrate);
} }
#include <syscalls/can_configure_mrsh.c>
Z_SYSCALL_HANDLER(can_send, dev, msg, timeout, callback_isr, callback_arg) { static inline int z_vrfy_can_send(struct device *dev,
const struct zcan_frame *msg,
s32_t timeout,
can_tx_callback_t callback_isr,
void *callback_arg) {
Z_OOPS(Z_SYSCALL_DRIVER_CAN(dev, send)); Z_OOPS(Z_SYSCALL_DRIVER_CAN(dev, send));
@ -33,9 +39,11 @@ Z_SYSCALL_HANDLER(can_send, dev, msg, timeout, callback_isr, callback_arg) {
(s32_t)timeout, (can_tx_callback_t) callback_isr, (s32_t)timeout, (can_tx_callback_t) callback_isr,
(void *)callback_arg); (void *)callback_arg);
} }
#include <syscalls/can_send_mrsh.c>
Z_SYSCALL_HANDLER(can_attach_msgq, dev, msgq, filter) { static inline int z_vrfy_can_attach_msgq(struct device *dev,
struct k_msgq *msgq,
const struct zcan_filter *filter) {
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_CAN)); Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_CAN));
Z_OOPS(Z_SYSCALL_MEMORY_READ((struct zcan_filter *)filter, Z_OOPS(Z_SYSCALL_MEMORY_READ((struct zcan_filter *)filter,
@ -46,12 +54,12 @@ Z_SYSCALL_HANDLER(can_attach_msgq, dev, msgq, filter) {
(struct k_msgq *)msgq, (struct k_msgq *)msgq,
(const struct zcan_filter *) filter); (const struct zcan_filter *) filter);
} }
#include <syscalls/can_attach_msgq_mrsh.c>
Z_SYSCALL_HANDLER(can_detach, dev, filter_id) { static inline void z_vrfy_can_detach(struct device *dev, int filter_id)
Z_OOPS(Z_SYSCALL_DRIVER_CAN(dev, detach)); Z_OOPS(Z_SYSCALL_DRIVER_CAN(dev, detach));
z_impl_can_detach((struct device *)dev, (int)filter_id); z_impl_can_detach((struct device *)dev, (int)filter_id);
return 0;
} }
#include <syscalls/can_detach_mrsh.c>

View file

@ -11,7 +11,7 @@
* instance and return an integral value * instance and return an integral value
*/ */
#define COUNTER_HANDLER(name) \ #define COUNTER_HANDLER(name) \
Z_SYSCALL_HANDLER(counter_ ## name, dev) \ static inline int z_vrfy_counter_##name(struct devince *dev) \
{ \ { \
Z_OOPS(Z_SYSCALL_DRIVER_COUNTER(dev, name)); \ Z_OOPS(Z_SYSCALL_DRIVER_COUNTER(dev, name)); \
return z_impl_counter_ ## name((struct device *)dev); \ return z_impl_counter_ ## name((struct device *)dev); \
@ -24,15 +24,26 @@ COUNTER_HANDLER(start)
COUNTER_HANDLER(get_top_value) COUNTER_HANDLER(get_top_value)
COUNTER_HANDLER(get_max_relative_alarm) COUNTER_HANDLER(get_max_relative_alarm)
Z_SYSCALL_HANDLER(counter_get_guard_period, dev, flags) #include <syscalls/counter_get_pending_int_mrsh.c>
#include <syscalls/counter_read_mrsh.c>
#include <syscalls/counter_stop_mrsh.c>
#include <syscalls/counter_start_mrsh.c>
#include <syscalls/counter_get_top_value_mrsh.c>
#include <syscalls/counter_get_max_relative_alarm_mrsh.c>
static inline u32_t z_vrfy_counter_get_guard_period(struct device *dev,
u32_t flags)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_COUNTER(dev, get_guard_period)); Z_OOPS(Z_SYSCALL_DRIVER_COUNTER(dev, get_guard_period));
return z_impl_counter_get_guard_period((struct device *)dev, flags); return z_impl_counter_get_guard_period((struct device *)dev, flags);
} }
#include <syscalls/counter_get_guard_period_mrsh.c>
Z_SYSCALL_HANDLER(counter_set_guard_period, dev, ticks, flags) static inline int z_vrfy_counter_set_guard_period(struct device *dev,
u32_t ticks, u32_t flags)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_COUNTER(dev, set_guard_period)); Z_OOPS(Z_SYSCALL_DRIVER_COUNTER(dev, set_guard_period));
return z_impl_counter_set_guard_period((struct device *)dev, ticks, return z_impl_counter_set_guard_period((struct device *)dev, ticks,
flags); flags);
} }
#include <syscalls/counter_set_guard_period_mrsh.c>

View file

@ -11,15 +11,17 @@
* the validity of the channel ID and returning -errno if it's bogus * the validity of the channel ID and returning -errno if it's bogus
*/ */
Z_SYSCALL_HANDLER(dma_start, dev, channel) static inline int z_vrfy_dma_start(struct device *dev, u32_t channel)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_DMA(dev, start)); Z_OOPS(Z_SYSCALL_DRIVER_DMA(dev, start));
return z_impl_dma_start((struct device *)dev, channel); return z_impl_dma_start((struct device *)dev, channel);
} }
#include <syscalls/dma_start_mrsh.c>
Z_SYSCALL_HANDLER(dma_stop, dev, channel) static inline int z_vrfy_dma_stop(struct device *dev, u32_t channel)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_DMA(dev, stop)); Z_OOPS(Z_SYSCALL_DRIVER_DMA(dev, stop));
return z_impl_dma_stop((struct device *)dev, channel); return z_impl_dma_stop((struct device *)dev, channel);
} }
#include <syscalls/dma_stop_mrsh.c>

View file

@ -7,10 +7,13 @@
#include <drivers/entropy.h> #include <drivers/entropy.h>
#include <syscall_handler.h> #include <syscall_handler.h>
Z_SYSCALL_HANDLER(entropy_get_entropy, dev, buffer, len) static inline int z_vrfy_entropy_get_entropy(struct device *dev,
u8_t *buffer,
u16_t len)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_ENTROPY(dev, get_entropy)); Z_OOPS(Z_SYSCALL_DRIVER_ENTROPY(dev, get_entropy));
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(buffer, len)); Z_OOPS(Z_SYSCALL_MEMORY_WRITE(buffer, len));
return z_impl_entropy_get_entropy((struct device *)dev, (u8_t *)buffer, return z_impl_entropy_get_entropy((struct device *)dev, (u8_t *)buffer,
len); len);
} }
#include <syscalls/entropy_get_entropy_mrsh.c>

View file

@ -7,51 +7,69 @@
#include <syscall_handler.h> #include <syscall_handler.h>
#include <drivers/flash.h> #include <drivers/flash.h>
Z_SYSCALL_HANDLER(flash_read, dev, offset, data, len) static inline int z_vrfy_flash_read(struct device *dev, off_t offset,
void *data, size_t len)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, read)); Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, read));
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(data, len)); Z_OOPS(Z_SYSCALL_MEMORY_WRITE(data, len));
return z_impl_flash_read((struct device *)dev, offset, (void *)data, return z_impl_flash_read((struct device *)dev, offset, (void *)data,
len); len);
} }
#include <syscalls/flash_read_mrsh.c>
Z_SYSCALL_HANDLER(flash_write, dev, offset, data, len) static inline int z_vrfy_flash_write(struct device *dev, off_t offset,
const void *data, size_t len)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, write)); Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, write));
Z_OOPS(Z_SYSCALL_MEMORY_READ(data, len)); Z_OOPS(Z_SYSCALL_MEMORY_READ(data, len));
return z_impl_flash_write((struct device *)dev, offset, return z_impl_flash_write((struct device *)dev, offset,
(const void *)data, len); (const void *)data, len);
} }
#include <syscalls/flash_write_mrsh.c>
Z_SYSCALL_HANDLER(flash_write_protection_set, dev, enable) static inline int z_vrfy_flash_write_protection_set(struct device *dev,
bool enable)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, write_protection)); Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, write_protection));
return z_impl_flash_write_protection_set((struct device *)dev, enable); return z_impl_flash_write_protection_set((struct device *)dev, enable);
} }
#include <syscalls/flash_write_protection_set_mrsh.c>
Z_SYSCALL_HANDLER1_SIMPLE(flash_get_write_block_size, K_OBJ_DRIVER_FLASH, static inline size_t z_vrfy_flash_get_write_block_size(struct device *dev)
struct device *); {
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_FLASH));
return z_impl_flash_get_write_block_size(dev);
}
#include <syscalls/flash_get_write_block_size_mrsh.c>
#ifdef CONFIG_FLASH_PAGE_LAYOUT #ifdef CONFIG_FLASH_PAGE_LAYOUT
Z_SYSCALL_HANDLER(flash_get_page_info_by_offs, dev, offs, info) static inline int z_vrfy_flash_get_page_info_by_offs(struct device *dev,
off_t offs,
struct flash_pages_info *info)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, page_layout)); Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, page_layout));
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(info, sizeof(struct flash_pages_info))); Z_OOPS(Z_SYSCALL_MEMORY_WRITE(info, sizeof(struct flash_pages_info)));
return z_impl_flash_get_page_info_by_offs((struct device *)dev, offs, return z_impl_flash_get_page_info_by_offs((struct device *)dev, offs,
(struct flash_pages_info *)info); (struct flash_pages_info *)info);
} }
#include <syscalls/flash_get_page_info_by_offs_mrsh.c>
Z_SYSCALL_HANDLER(flash_get_page_info_by_idx, dev, idx, info) static inline int z_vrfy_flash_get_page_info_by_idx(struct device *dev,
u32_t idx,
struct flash_pages_info *info)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, page_layout)); Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, page_layout));
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(info, sizeof(struct flash_pages_info))); Z_OOPS(Z_SYSCALL_MEMORY_WRITE(info, sizeof(struct flash_pages_info)));
return z_impl_flash_get_page_info_by_idx((struct device *)dev, idx, return z_impl_flash_get_page_info_by_idx((struct device *)dev, idx,
(struct flash_pages_info *)info); (struct flash_pages_info *)info);
} }
#include <syscalls/flash_get_page_info_by_idx_mrsh.c>
Z_SYSCALL_HANDLER(flash_get_page_count, dev) static inline size_t z_vrfy_flash_get_page_count(struct device *dev);
{ {
Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, page_layout)); Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, page_layout));
return z_impl_flash_get_page_count((struct device *)dev); return z_impl_flash_get_page_count((struct device *)dev);
} }
#include <syscalls/flash_get_page_count_mrsh.c>
#endif #endif

View file

@ -7,9 +7,9 @@
#include <syscall_handler.h> #include <syscall_handler.h>
#include <drivers/hwinfo.h> #include <drivers/hwinfo.h>
Z_SYSCALL_HANDLER(hwinfo_get_device_id, buffer, length) { ssize_t z_vrfy_hwinfo_get_device_id(u8_t *buffer, size_t length) {
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(buffer, length)); Z_OOPS(Z_SYSCALL_MEMORY_WRITE(buffer, length));
return z_impl_hwinfo_get_device_id((u8_t *)buffer, (size_t)length); return z_impl_hwinfo_get_device_id((u8_t *)buffer, (size_t)length);
} }
#include <syscalls/hwinfo_get_device_id_mrsh.c>

View file

@ -9,7 +9,8 @@
#include <drivers/i2s.h> #include <drivers/i2s.h>
Z_SYSCALL_HANDLER(i2s_configure, dev, dir, cfg_ptr) static inline int z_vrfy_i2s_configure(struct device *dev, enum i2s_dir dir,
struct i2s_config *cfg_ptr)
{ {
struct i2s_config config; struct i2s_config config;
int ret = -EINVAL; int ret = -EINVAL;
@ -39,8 +40,10 @@ Z_SYSCALL_HANDLER(i2s_configure, dev, dir, cfg_ptr)
out: out:
return ret; return ret;
} }
#include <syscalls/i2s_configure_mrsh.c>
Z_SYSCALL_HANDLER(i2s_buf_read, dev, buf, size) static inline int z_vrfy_i2s_buf_read(struct device *dev,
void *buf, size_t *size);
{ {
void *mem_block; void *mem_block;
size_t data_size; size_t data_size;
@ -70,8 +73,10 @@ Z_SYSCALL_HANDLER(i2s_buf_read, dev, buf, size)
return ret; return ret;
} }
#include <syscalls/i2s_buf_read_mrsh.c>
Z_SYSCALL_HANDLER(i2s_buf_write, dev, buf, size) static inline int z_vrfy_i2s_buf_write(struct device *dev,
void *buf, size_t size)
{ {
int ret; int ret;
struct i2s_config *tx_cfg; struct i2s_config *tx_cfg;
@ -105,10 +110,13 @@ Z_SYSCALL_HANDLER(i2s_buf_write, dev, buf, size)
return ret; return ret;
} }
#include <syscalls/i2s_buf_write_mrsh.c>
Z_SYSCALL_HANDLER(i2s_trigger, dev, dir, cmd) static inline int z_vrfy_i2s_trigger(struct device *dev, enum i2s_dir dir,
enum i2s_trigger_cmd cmd)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_I2S(dev, trigger)); Z_OOPS(Z_SYSCALL_DRIVER_I2S(dev, trigger));
return z_impl_i2s_trigger((struct device *)dev, dir, cmd); return z_impl_i2s_trigger((struct device *)dev, dir, cmd);
} }
#include <syscalls/i2s_trigger_mrsh.c>

View file

@ -7,28 +7,33 @@
#include <syscall_handler.h> #include <syscall_handler.h>
#include <drivers/ipm.h> #include <drivers/ipm.h>
Z_SYSCALL_HANDLER(ipm_send, dev, wait, id, data, size) static inline int z_vrfy_ipm_send(struct device *dev, int wait, u32_t id,
const void *data, int size)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_IPM(dev, send)); Z_OOPS(Z_SYSCALL_DRIVER_IPM(dev, send));
Z_OOPS(Z_SYSCALL_MEMORY_READ(data, size)); Z_OOPS(Z_SYSCALL_MEMORY_READ(data, size));
return z_impl_ipm_send((struct device *)dev, wait, id, return z_impl_ipm_send((struct device *)dev, wait, id,
(const void *)data, size); (const void *)data, size);
} }
#include <syscalls/ipm_send_mrsh.c>
Z_SYSCALL_HANDLER(ipm_max_data_size_get, dev) static inline int z_vrfy_ipm_max_data_size_get(struct device *dev)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_IPM(dev, max_data_size_get)); Z_OOPS(Z_SYSCALL_DRIVER_IPM(dev, max_data_size_get));
return z_impl_max_data_size_get((struct device *)dev); return z_impl_max_data_size_get((struct device *)dev);
} }
#include <syscalls/ipm_max_data_size_get_mrsh.c>
Z_SYSCALL_HANDLER(ipm_max_id_val_get, dev) static inline u32_t z_vrfy_ipm_max_id_val_get(struct device *dev)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_IPM(dev, max_id_val_get)); Z_OOPS(Z_SYSCALL_DRIVER_IPM(dev, max_id_val_get));
return z_impl_max_id_val_get((struct device *)dev); return z_impl_ipm_max_id_val_get((struct device *)dev);
} }
#include <syscalls/ipm_max_id_val_get_mrsh.c>
Z_SYSCALL_HANDLER(ipm_set_enabled, dev, enable) static inline int z_vrfy_ipm_set_enabled(struct device *dev, int enable)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_IPM(dev, set_enabled)); Z_OOPS(Z_SYSCALL_DRIVER_IPM(dev, set_enabled));
return z_impl_ipm_set_enabled((struct device *)dev, enable); return z_impl_ipm_set_enabled((struct device *)dev, enable);
} }
#include <syscalls/ipm_set_enabled_mrsh.c>

View file

@ -7,27 +7,33 @@
#include <syscall_handler.h> #include <syscall_handler.h>
#include <drivers/led.h> #include <drivers/led.h>
Z_SYSCALL_HANDLER(led_blink, dev, led, delay_on, delay_off) static inline int z_vrfy_led_blink(struct device *dev, u32_t led,
u32_t delay_on, u32_t delay_off)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_LED(dev, blink)); Z_OOPS(Z_SYSCALL_DRIVER_LED(dev, blink));
return z_impl_led_blink((struct device *)dev, led, delay_on, return z_impl_led_blink((struct device *)dev, led, delay_on,
delay_off); delay_off);
} }
#include <syscalls/led_blink_mrsh.c>
Z_SYSCALL_HANDLER(led_set_brightness, dev, led, value) static inline int z_vrfy_led_set_brightness(struct device *dev, u32_t led,
u8_t value)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_LED(dev, set_brightness)); Z_OOPS(Z_SYSCALL_DRIVER_LED(dev, set_brightness));
return z_impl_led_set_brightness((struct device *)dev, led, value); return z_impl_led_set_brightness((struct device *)dev, led, value);
} }
#include <syscalls/led_set_brightness_mrsh.c>
Z_SYSCALL_HANDLER(led_on, dev, led) static inline int z_vrfy_led_on(struct device *dev, u32_t led)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_LED(dev, on)); Z_OOPS(Z_SYSCALL_DRIVER_LED(dev, on));
return z_impl_led_on((struct device *)dev, led); return z_impl_led_on((struct device *)dev, led);
} }
#include <syscalls/led_on_mrsh.c>
Z_SYSCALL_HANDLER(led_off, dev, led) static inline int z_vrfy_led_off(struct device *dev, u32_t led)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_LED(dev, off)); Z_OOPS(Z_SYSCALL_DRIVER_LED(dev, off));
return z_impl_led_off((struct device *)dev, led); return z_impl_led_off((struct device *)dev, led);
} }
#include <syscalls/led_off_mrsh.c>

View file

@ -7,17 +7,21 @@
#include <syscall_handler.h> #include <syscall_handler.h>
#include <drivers/pwm.h> #include <drivers/pwm.h>
Z_SYSCALL_HANDLER(pwm_pin_set_cycles, dev, pwm, period, pulse) static inline int z_vrfy_pwm_pin_set_cycles(struct device *dev, u32_t pwm,
u32_t period, u32_t pulse)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_PWM(dev, pin_set)); Z_OOPS(Z_SYSCALL_DRIVER_PWM(dev, pin_set));
return z_impl_pwm_pin_set_cycles((struct device *)dev, pwm, period, return z_impl_pwm_pin_set_cycles((struct device *)dev, pwm, period,
pulse); pulse);
} }
#include <syscalls/pwm_pin_set_cycles_mrsh.c>
Z_SYSCALL_HANDLER(pwm_get_cycles_per_sec, dev, pwm, cycles) static inline int z_vrfy_pwm_get_cycles_per_sec(struct device *dev, u32_t pwm,
u64_t *cycles)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_PWM(dev, get_cycles_per_sec)); Z_OOPS(Z_SYSCALL_DRIVER_PWM(dev, get_cycles_per_sec));
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(cycles, sizeof(u64_t))); Z_OOPS(Z_SYSCALL_MEMORY_WRITE(cycles, sizeof(u64_t)));
return z_impl_pwm_get_cycles_per_sec((struct device *)dev, return z_impl_pwm_get_cycles_per_sec((struct device *)dev,
pwm, (u64_t *)cycles); pwm, (u64_t *)cycles);
} }
#include <syscalls/pwm_get_cycles_per_sec_mrsh.c>

View file

@ -7,34 +7,41 @@
#include <syscall_handler.h> #include <syscall_handler.h>
#include <drivers/rtc.h> #include <drivers/rtc.h>
Z_SYSCALL_HANDLER(rtc_read, dev) static inline u32_t z_vrfy_rtc_read(struct device *dev)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_RTC(dev, read)); Z_OOPS(Z_SYSCALL_DRIVER_RTC(dev, read));
return z_impl_rtc_read((struct device *)dev); return z_impl_rtc_read((struct device *)dev);
} }
Z_SYSCALL_HANDLER(rtc_enable, dev) static inline void z_vrfy_rtc_enable(struct device *dev)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_RTC(dev, enable)); Z_OOPS(Z_SYSCALL_DRIVER_RTC(dev, enable));
z_impl_rtc_enable((struct device *)dev); z_impl_rtc_enable((struct device *)dev);
return 0; return 0;
} }
Z_SYSCALL_HANDLER(rtc_disable, dev) static inline void z_vrfy_rtc_disable(struct device *dev)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_RTC(dev, disable)); Z_OOPS(Z_SYSCALL_DRIVER_RTC(dev, disable));
z_impl_rtc_disable((struct device *)dev); z_impl_rtc_disable((struct device *)dev);
return 0; return 0;
} }
Z_SYSCALL_HANDLER(rtc_set_alarm, dev, alarm_val) static inline int z_vrfy_rtc_set_alarm(struct device *dev,
const u32_t alarm_val)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_RTC(dev, set_alarm)); Z_OOPS(Z_SYSCALL_DRIVER_RTC(dev, set_alarm));
return z_impl_rtc_set_alarm((struct device *)dev, alarm_val); return z_impl_rtc_set_alarm((struct device *)dev, alarm_val);
} }
Z_SYSCALL_HANDLER(rtc_get_pending_int, dev) static inline int z_vrfy_rtc_get_pending_int(struct device *dev)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_RTC(dev, get_pending_int)); Z_OOPS(Z_SYSCALL_DRIVER_RTC(dev, get_pending_int));
return z_impl_rtc_get_pending_int((struct device *)dev); return z_impl_rtc_get_pending_int((struct device *)dev);
} }
#include <syscalls/rtc_read_mrsh.c>
#include <syscalls/rtc_enable_mrsh.c>
#include <syscalls/rtc_disable_mrsh.c>
#include <syscalls/rtc_set_alarm_mrsh.c>
#include <syscalls/rtc_get_pending_int_mrsh.c>

View file

@ -7,30 +7,40 @@
#include <drivers/sensor.h> #include <drivers/sensor.h>
#include <syscall_handler.h> #include <syscall_handler.h>
Z_SYSCALL_HANDLER(sensor_attr_set, dev, chan, attr, val) static inline int z_vrfy_sensor_attr_set(struct device *dev,
enum sensor_channel chan,
enum sensor_attribute attr,
const struct sensor_value *val)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_SENSOR(dev, attr_set)); Z_OOPS(Z_SYSCALL_DRIVER_SENSOR(dev, attr_set));
Z_OOPS(Z_SYSCALL_MEMORY_READ(val, sizeof(struct sensor_value))); Z_OOPS(Z_SYSCALL_MEMORY_READ(val, sizeof(struct sensor_value)));
return z_impl_sensor_attr_set((struct device *)dev, chan, attr, return z_impl_sensor_attr_set((struct device *)dev, chan, attr,
(const struct sensor_value *)val); (const struct sensor_value *)val);
} }
#include <syscalls/sensor_attr_set_mrsh.c>
Z_SYSCALL_HANDLER(sensor_sample_fetch, dev) static inline int z_vrfy_sensor_sample_fetch(struct device *dev)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_SENSOR(dev, sample_fetch)); Z_OOPS(Z_SYSCALL_DRIVER_SENSOR(dev, sample_fetch));
return z_impl_sensor_sample_fetch((struct device *)dev); return z_impl_sensor_sample_fetch((struct device *)dev);
} }
#include <syscalls/sensor_sample_fetch_mrsh.c>
Z_SYSCALL_HANDLER(sensor_sample_fetch_chan, dev, type) static inline int z_vrfy_sensor_sample_fetch_chan(struct device *dev,
enum sensor_channel type)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_SENSOR(dev, sample_fetch)); Z_OOPS(Z_SYSCALL_DRIVER_SENSOR(dev, sample_fetch));
return z_impl_sensor_sample_fetch_chan((struct device *)dev, type); return z_impl_sensor_sample_fetch_chan((struct device *)dev, type);
} }
#include <syscalls/sensor_sample_fetch_chan_mrsh.c>
Z_SYSCALL_HANDLER(sensor_channel_get, dev, chan, val) static inline int z_vrfy_sensor_channel_get(struct device *dev,
enum sensor_channel chan,
struct sensor_value *val)
{ {
Z_OOPS(Z_SYSCALL_DRIVER_SENSOR(dev, channel_get)); Z_OOPS(Z_SYSCALL_DRIVER_SENSOR(dev, channel_get));
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(val, sizeof(struct sensor_value))); Z_OOPS(Z_SYSCALL_MEMORY_WRITE(val, sizeof(struct sensor_value)));
return z_impl_sensor_channel_get((struct device *)dev, chan, return z_impl_sensor_channel_get((struct device *)dev, chan,
(struct sensor_value *)val); (struct sensor_value *)val);
} }
#include <syscalls/sensor_channel_get_mrsh.c>

View file

@ -13,7 +13,7 @@
*/ */
static void copy_and_check(struct spi_buf_set *bufs, static void copy_and_check(struct spi_buf_set *bufs,
struct spi_buf *buf_copy, struct spi_buf *buf_copy,
int writable, void *ssf) int writable)
{ {
size_t i; size_t i;
@ -53,22 +53,23 @@ static void copy_and_check(struct spi_buf_set *bufs,
static u32_t copy_bufs_and_transceive(struct device *dev, static u32_t copy_bufs_and_transceive(struct device *dev,
const struct spi_config *config, const struct spi_config *config,
struct spi_buf_set *tx_bufs, struct spi_buf_set *tx_bufs,
struct spi_buf_set *rx_bufs, struct spi_buf_set *rx_bufs)
void *ssf)
{ {
struct spi_buf tx_buf_copy[tx_bufs->count ? tx_bufs->count : 1]; struct spi_buf tx_buf_copy[tx_bufs->count ? tx_bufs->count : 1];
struct spi_buf rx_buf_copy[rx_bufs->count ? rx_bufs->count : 1]; struct spi_buf rx_buf_copy[rx_bufs->count ? rx_bufs->count : 1];
copy_and_check(tx_bufs, tx_buf_copy, 0, ssf); copy_and_check(tx_bufs, tx_buf_copy, 0);
copy_and_check(rx_bufs, rx_buf_copy, 1, ssf); copy_and_check(rx_bufs, rx_buf_copy, 1);
return z_impl_spi_transceive((struct device *)dev, config, return z_impl_spi_transceive((struct device *)dev, config,
tx_bufs, rx_bufs); tx_bufs, rx_bufs);
} }
Z_SYSCALL_HANDLER(spi_transceive, dev, config_p, tx_bufs, rx_bufs) static inline int z_vrfy_spi_transceive(struct device *dev,
const struct spi_config *config,
const struct spi_buf_set *tx_bufs,
const struct spi_buf_set *rx_bufs)
{ {
const struct spi_config *config = (const struct spi_config *)config_p;
struct spi_buf_set tx_bufs_copy; struct spi_buf_set tx_bufs_copy;
struct spi_buf_set rx_bufs_copy; struct spi_buf_set rx_bufs_copy;
struct spi_config config_copy; struct spi_config config_copy;
@ -110,21 +111,18 @@ Z_SYSCALL_HANDLER(spi_transceive, dev, config_p, tx_bufs, rx_bufs)
} }
} }
/* ssf is implicit system call stack frame parameter, used by
* _SYSCALL_* APIs when something goes wrong.
*/
return copy_bufs_and_transceive((struct device *)dev, return copy_bufs_and_transceive((struct device *)dev,
&config_copy, &config_copy,
&tx_bufs_copy, &tx_bufs_copy,
&rx_bufs_copy, &rx_bufs_copy);
ssf);
} }
#include <syscalls/spi_transceive_mrsh.c>
Z_SYSCALL_HANDLER(spi_release, dev, config_p) static inline int z_vrfy_spi_release(struct device *dev,
const struct spi_config *config)
{ {
const struct spi_config *config = (const struct spi_config *)config_p;
Z_OOPS(Z_SYSCALL_MEMORY_READ(config, sizeof(*config))); Z_OOPS(Z_SYSCALL_MEMORY_READ(config, sizeof(*config)));
Z_OOPS(Z_SYSCALL_DRIVER_SPI(dev, release)); Z_OOPS(Z_SYSCALL_DRIVER_SPI(dev, release));
return z_impl_spi_release((struct device *)dev, config); return z_impl_spi_release((struct device *)dev, config);
} }
#include <syscalls/spi_release_mrsh.c>

View file

@ -894,7 +894,7 @@ void z_impl_k_thread_deadline_set(k_tid_t tid, int deadline)
} }
#ifdef CONFIG_USERSPACE #ifdef CONFIG_USERSPACE
Z_SYSCALL_HANDLER(k_thread_deadline_set, thread_p, deadline) static inline void z_vrfy_k_thread_deadline_set(k_tid_t tid, int deadline)
{ {
struct k_thread *thread = (struct k_thread *)thread_p; struct k_thread *thread = (struct k_thread *)thread_p;
@ -904,8 +904,8 @@ Z_SYSCALL_HANDLER(k_thread_deadline_set, thread_p, deadline)
(int)deadline)); (int)deadline));
z_impl_k_thread_deadline_set((k_tid_t)thread, deadline); z_impl_k_thread_deadline_set((k_tid_t)thread, deadline);
return 0;
} }
#include <syscalls/k_thread_deadline_set_mrsh.c>
#endif #endif
#endif #endif