Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make syscall internal implementation visibility consistent #12220

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions include/aio_comparator.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ struct aio_cmp_driver_api {
*/
__syscall int aio_cmp_disable(struct device *dev, u8_t index);

static inline int _impl_aio_cmp_disable(struct device *dev, u8_t index)
{
const struct aio_cmp_driver_api *api = dev->driver_api;

return api->disable(dev, index);
}

/**
* @brief Configure and enable a particular comparator.
*
Expand Down Expand Up @@ -95,14 +88,6 @@ static inline int aio_cmp_configure(struct device *dev, u8_t index,
*/
__syscall int aio_cmp_get_pending_int(struct device *dev);

static inline int _impl_aio_cmp_get_pending_int(struct device *dev)
{
struct aio_cmp_driver_api *api;

api = (struct aio_cmp_driver_api *)dev->driver_api;
return api->get_pending_int(dev);
}

#ifdef __cplusplus
}
#endif
Expand Down
43 changes: 0 additions & 43 deletions include/can.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,6 @@ struct can_driver_api {
__syscall int can_send(struct device *dev, struct can_msg *msg,
s32_t timeout, can_tx_callback_t callback_isr);

static inline int _impl_can_send(struct device *dev, struct can_msg *msg,
s32_t timeout, can_tx_callback_t callback_isr)
{
const struct can_driver_api *api = dev->driver_api;

return api->send(dev, msg, timeout, callback_isr);
}

/*
* Derived can APIs -- all implemented in terms of can_send()
*/
Expand Down Expand Up @@ -327,49 +319,14 @@ static inline int can_write(struct device *dev, u8_t *data, u8_t length,
__syscall int can_attach_msgq(struct device *dev, struct k_msgq *msg_q,
const struct can_filter *filter);

static inline int _impl_can_attach_msgq(struct device *dev,
struct k_msgq *msg_q,
const struct can_filter *filter)
{
const struct can_driver_api *api = dev->driver_api;

return api->attach_msgq(dev, msg_q, filter);
}


__syscall int can_attach_isr(struct device *dev, can_rx_callback_t isr,
const struct can_filter *filter);
static inline int _impl_can_attach_isr(struct device *dev,
can_rx_callback_t isr,
const struct can_filter *filter)
{
const struct can_driver_api *api = dev->driver_api;

return api->attach_isr(dev, isr, filter);
}


__syscall void can_detach(struct device *dev, int filter_id);

static inline void _impl_can_detach(struct device *dev, int filter_id)
{
const struct can_driver_api *api = dev->driver_api;

return api->detach(dev, filter_id);
}


__syscall int can_configure(struct device *dev, enum can_mode mode,
u32_t bitrate);

static inline int _impl_can_configure(struct device *dev, enum can_mode mode,
u32_t bitrate)
{
const struct can_driver_api *api = dev->driver_api;

return api->configure(dev, mode, bitrate);
}

#ifdef __cplusplus
}
#endif
Expand Down
29 changes: 0 additions & 29 deletions include/counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,6 @@ struct counter_driver_api {
*/
__syscall int counter_start(struct device *dev);

static inline int _impl_counter_start(struct device *dev)
{
const struct counter_driver_api *api = dev->driver_api;

return api->start(dev);
}

/**
* @brief Stop counter device.
* @param dev Pointer to the device structure for the driver instance.
Expand All @@ -76,13 +69,6 @@ static inline int _impl_counter_start(struct device *dev)
*/
__syscall int counter_stop(struct device *dev);

static inline int _impl_counter_stop(struct device *dev)
{
const struct counter_driver_api *api = dev->driver_api;

return api->stop(dev);
}

/**
* @brief Read current counter value.
* @param dev Pointer to the device structure for the driver instance.
Expand All @@ -91,13 +77,6 @@ static inline int _impl_counter_stop(struct device *dev)
*/
__syscall u32_t counter_read(struct device *dev);

static inline u32_t _impl_counter_read(struct device *dev)
{
const struct counter_driver_api *api = dev->driver_api;

return api->read(dev);
}

/**
* @brief Set an alarm.
* @param dev Pointer to the device structure for the driver instance.
Expand Down Expand Up @@ -137,14 +116,6 @@ static inline int counter_set_alarm(struct device *dev,
*/
__syscall int counter_get_pending_int(struct device *dev);

static inline int _impl_counter_get_pending_int(struct device *dev)
{
struct counter_driver_api *api;

api = (struct counter_driver_api *)dev->driver_api;
return api->get_pending_int(dev);
}

#ifdef __cplusplus
}
#endif
Expand Down
16 changes: 0 additions & 16 deletions include/dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,6 @@ static inline int dma_reload(struct device *dev, u32_t channel,
*/
__syscall int dma_start(struct device *dev, u32_t channel);

static inline int _impl_dma_start(struct device *dev, u32_t channel)
{
const struct dma_driver_api *api =
(const struct dma_driver_api *)dev->driver_api;

return api->start(dev, channel);
}

/**
* @brief Stops the DMA transfer and disables the channel.
*
Expand All @@ -262,14 +254,6 @@ static inline int _impl_dma_start(struct device *dev, u32_t channel)
*/
__syscall int dma_stop(struct device *dev, u32_t channel);

static inline int _impl_dma_stop(struct device *dev, u32_t channel)
{
const struct dma_driver_api *api =
(const struct dma_driver_api *)dev->driver_api;

return api->stop(dev, channel);
}

/**
* @brief Look-up generic width index to be used in registers
*
Expand Down
11 changes: 0 additions & 11 deletions include/entropy.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,6 @@ __syscall int entropy_get_entropy(struct device *dev,
u8_t *buffer,
u16_t length);

static inline int _impl_entropy_get_entropy(struct device *dev,
u8_t *buffer,
u16_t length)
{
const struct entropy_driver_api *api = dev->driver_api;

__ASSERT(api->get_entropy != NULL,
"Callback pointer should not be NULL");
return api->get_entropy(dev, buffer, length);
}

/* Busy-wait for random data to be ready */
#define ENTROPY_BUSYWAIT BIT(0)

Expand Down
39 changes: 0 additions & 39 deletions include/flash.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,6 @@ struct flash_driver_api {
__syscall int flash_read(struct device *dev, off_t offset, void *data,
size_t len);

static inline int _impl_flash_read(struct device *dev, off_t offset, void *data,
size_t len)
{
const struct flash_driver_api *api = dev->driver_api;

return api->read(dev, offset, data, len);
}

/**
* @brief Write buffer into flash memory.
*
Expand All @@ -118,14 +110,6 @@ static inline int _impl_flash_read(struct device *dev, off_t offset, void *data,
__syscall int flash_write(struct device *dev, off_t offset, const void *data,
size_t len);

static inline int _impl_flash_write(struct device *dev, off_t offset,
const void *data, size_t len)
{
const struct flash_driver_api *api = dev->driver_api;

return api->write(dev, offset, data, len);
}

/**
* @brief Erase part or all of a flash memory
*
Expand All @@ -149,14 +133,6 @@ static inline int _impl_flash_write(struct device *dev, off_t offset,
*/
__syscall int flash_erase(struct device *dev, off_t offset, size_t size);

static inline int _impl_flash_erase(struct device *dev, off_t offset,
size_t size)
{
const struct flash_driver_api *api = dev->driver_api;

return api->erase(dev, offset, size);
}

/**
* @brief Enable or disable write protection for a flash memory
*
Expand All @@ -175,14 +151,6 @@ static inline int _impl_flash_erase(struct device *dev, off_t offset,
*/
__syscall int flash_write_protection_set(struct device *dev, bool enable);

static inline int _impl_flash_write_protection_set(struct device *dev,
bool enable)
{
const struct flash_driver_api *api = dev->driver_api;

return api->write_protection(dev, enable);
}

struct flash_pages_info {
off_t start_offset; /* offset from the base of flash address */
size_t size;
Expand Down Expand Up @@ -263,13 +231,6 @@ void flash_page_foreach(struct device *dev, flash_page_cb cb, void *data);
*/
__syscall size_t flash_get_write_block_size(struct device *dev);

static inline size_t _impl_flash_get_write_block_size(struct device *dev)
{
const struct flash_driver_api *api = dev->driver_api;

return api->write_block_size;
}

#ifdef __cplusplus
}
#endif
Expand Down
55 changes: 0 additions & 55 deletions include/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,62 +127,18 @@ struct gpio_driver_api {
__syscall int gpio_config(struct device *port, int access_op, u32_t pin,
int flags);

static inline int _impl_gpio_config(struct device *port, int access_op,
u32_t pin, int flags)
{
const struct gpio_driver_api *api =
(const struct gpio_driver_api *)port->driver_api;

return api->config(port, access_op, pin, flags);
}

__syscall int gpio_write(struct device *port, int access_op, u32_t pin,
u32_t value);

static inline int _impl_gpio_write(struct device *port, int access_op,
u32_t pin, u32_t value)
{
const struct gpio_driver_api *api =
(const struct gpio_driver_api *)port->driver_api;

return api->write(port, access_op, pin, value);
}

__syscall int gpio_read(struct device *port, int access_op, u32_t pin,
u32_t *value);

static inline int _impl_gpio_read(struct device *port, int access_op,
u32_t pin, u32_t *value)
{
const struct gpio_driver_api *api =
(const struct gpio_driver_api *)port->driver_api;

return api->read(port, access_op, pin, value);
}

__syscall int gpio_enable_callback(struct device *port, int access_op,
u32_t pin);

static inline int _impl_gpio_enable_callback(struct device *port,
int access_op, u32_t pin)
{
const struct gpio_driver_api *api =
(const struct gpio_driver_api *)port->driver_api;

return api->enable_callback(port, access_op, pin);
}

__syscall int gpio_disable_callback(struct device *port, int access_op,
u32_t pin);

static inline int _impl_gpio_disable_callback(struct device *port,
int access_op, u32_t pin)
{
const struct gpio_driver_api *api =
(const struct gpio_driver_api *)port->driver_api;

return api->disable_callback(port, access_op, pin);
}
/**
* @endcond
*/
Expand Down Expand Up @@ -400,17 +356,6 @@ static inline int gpio_port_disable_callback(struct device *port)
*/
__syscall int gpio_get_pending_int(struct device *dev);

/**
* @internal
*/
static inline int _impl_gpio_get_pending_int(struct device *dev)
{
struct gpio_driver_api *api;

api = (struct gpio_driver_api *)dev->driver_api;
return api->get_pending_int(dev);
}

struct gpio_pin_config {
char *gpio_controller;
u32_t gpio_pin;
Expand Down
Loading