Skip to content

Commit

Permalink
Astyle fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimmo Vaisanen committed Jan 2, 2020
1 parent 48250c6 commit 59c9d77
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#define S5JS100_BUFF_ALIGNMENT 0


SAMSUNG_S5JS100_L3IP_Driver::SAMSUNG_S5JS100_L3IP_Driver(const char* ifname, int mtu)
SAMSUNG_S5JS100_L3IP_Driver::SAMSUNG_S5JS100_L3IP_Driver(const char *ifname, int mtu)
: _io_device(NULL),
_mtu(mtu)
{
Expand All @@ -49,31 +49,26 @@ bool SAMSUNG_S5JS100_L3IP_Driver::link_out(net_stack_mem_buf_t *buf)
const int total_len = _memory_manager->get_total_len(buf);
net_stack_mem_buf_t *cont_buf = _memory_manager->alloc_heap(total_len, S5JS100_BUFF_ALIGNMENT);

if (cont_buf)
{
if (cont_buf) {
uint8_t *cont_buf_ptr = (uint8_t *)_memory_manager->get_ptr(cont_buf);

/* copy all frames to continuous buffer */
for (net_stack_mem_buf_t *q = buf; q != NULL; q = _memory_manager->get_next(q))
{
for (net_stack_mem_buf_t *q = buf; q != NULL; q = _memory_manager->get_next(q)) {
const uint8_t *ptr = (const uint8_t *)_memory_manager->get_ptr(q);
const uint16_t len = _memory_manager->get_len(q);

memcpy(cont_buf_ptr, ptr, len);
cont_buf_ptr += len;
}

const int sent = _io_device->write((const char*)_memory_manager->get_ptr(cont_buf), total_len);
const int sent = _io_device->write((const char *)_memory_manager->get_ptr(cont_buf), total_len);
tr_debug("link_out (%s): sent %d/%d bytes", _ifname, sent, total_len);
if (sent != total_len)
{
if (sent != total_len) {
result = false;
}

_memory_manager->free(cont_buf);
}
else
{
} else {
tr_error("Unable to allocate buffer for TX data!");
result = false;
}
Expand All @@ -87,14 +82,11 @@ bool SAMSUNG_S5JS100_L3IP_Driver::power_up()
{
_io_device = getModemIoDeviceByName(_ifname);
tr_debug("power_up: io_device = %p", _io_device);
if (_io_device)
{
if (_io_device) {
_io_device->register_ReadCb(read_cb, this);
_l3ip_link_state_cb(true);
return true;
}
else
{
} else {
tr_error("Unable to get modem IO device!");
return false;
}
Expand Down Expand Up @@ -150,8 +142,7 @@ void SAMSUNG_S5JS100_L3IP_Driver::set_all_multicast(bool all)
void SAMSUNG_S5JS100_L3IP_Driver::power_down()
{
tr_debug("power_down");
if (_io_device)
{
if (_io_device) {
_io_device->register_ReadCb(NULL, NULL);
_io_device = NULL;
}
Expand All @@ -167,22 +158,19 @@ void SAMSUNG_S5JS100_L3IP_Driver::read_cb(mio_buf *buf, void *param)
MBED_ASSERT(buf);
MBED_ASSERT(param);

SAMSUNG_S5JS100_L3IP_Driver *driver = (SAMSUNG_S5JS100_L3IP_Driver*)param;
SAMSUNG_S5JS100_L3IP_Driver *driver = (SAMSUNG_S5JS100_L3IP_Driver *)param;
driver->packet_rx(buf);
}

void SAMSUNG_S5JS100_L3IP_Driver::packet_rx(mio_buf * buf)
void SAMSUNG_S5JS100_L3IP_Driver::packet_rx(mio_buf *buf)
{
tr_debug("packet_rx (%s): buf = %p, len = %d, ch = %d", _ifname, buf->data, buf->len, buf->ch);

net_stack_mem_buf_t *read_buf = _memory_manager->alloc_heap(buf->len, S5JS100_BUFF_ALIGNMENT);
if (read_buf)
{
if (read_buf) {
_memory_manager->copy_to_buf(read_buf, buf->data, buf->len);
_l3ip_link_input_cb(read_buf);
}
else
{
} else {
tr_error("Unable to allocate buffer for RX data!");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
#include "L3IP.h"
#include "modem_io_device.h"

class SAMSUNG_S5JS100_L3IP_Driver : public L3IP
{
class SAMSUNG_S5JS100_L3IP_Driver : public L3IP {

public:

Expand Down Expand Up @@ -151,7 +150,7 @@ class SAMSUNG_S5JS100_L3IP_Driver : public L3IP
l3ip_link_state_change_cb_t _l3ip_link_state_cb; /**< Link state change callback */
NetStackMemoryManager *_memory_manager; /**< Memory manager */

ModemIoDevice* _io_device; /**< Handle to modem */
ModemIoDevice *_io_device; /**< Handle to modem */
char _ifname[32]; /**< Interface name */
int _mtu; /**< MTU */
};
Expand Down

0 comments on commit 59c9d77

Please sign in to comment.