[pok-devel] [39] Add ARINC653 get_sampling_port_status and get_samplig_port_id functions. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/pok-devel Archives
]
Revision: 39
Author: mha
Date: 2012-08-30 10:36:32 +0200 (Thu, 30 Aug 2012)
Log Message:
-----------
Add ARINC653 get_sampling_port_status and get_samplig_port_id functions. Add some check in ARINC samplig port API.
Modified Paths:
--------------
trunk/kernel/include/middleware/port.h
trunk/kernel/middleware/portcreate.c
trunk/kernel/middleware/portsamplingid.c
trunk/libpok/arinc653/sampling.c
Modified: trunk/kernel/include/middleware/port.h
===================================================================
--- trunk/kernel/include/middleware/port.h 2012-08-29 12:45:22 UTC (rev 38)
+++ trunk/kernel/include/middleware/port.h 2012-08-30 08:36:32 UTC (rev 39)
@@ -1,6 +1,6 @@
/*
* POK header
- *
+ *
* The following file is a part of the POK project. Any modification should
* made according to the POK licence. You CANNOT use this file or a part of
* this file is this part of a file for your own project
@@ -9,9 +9,9 @@
*
* Please follow the coding guidelines described in doc/CODING_GUIDELINES
*
- * Copyright (c) 2007-2009 POK team
+ * Copyright (c) 2007-2009 POK team
*
- * Created by julien on Thu Jan 15 23:34:13 2009
+ * Created by julien on Thu Jan 15 23:34:13 2009
*/
/**
@@ -32,80 +32,80 @@
typedef enum
{
- POK_PORT_QUEUEING_DISCIPLINE_FIFO = 1,
- POK_PORT_QUEUEING_DISCIPLINE_PRIORITY = 2
+ POK_PORT_QUEUEING_DISCIPLINE_FIFO = 1,
+ POK_PORT_QUEUEING_DISCIPLINE_PRIORITY = 2
} pok_port_queueing_disciplines_t;
typedef enum
{
- POK_PORT_DIRECTION_IN = 1,
- POK_PORT_DIRECTION_OUT = 2
+ POK_PORT_DIRECTION_IN = 1,
+ POK_PORT_DIRECTION_OUT = 2
} pok_port_directions_t;
typedef pok_queueing_discipline_t pok_port_queueing_discipline_t;
typedef enum
{
- POK_PORT_KIND_QUEUEING = 1,
- POK_PORT_KIND_SAMPLING = 2,
+ POK_PORT_KIND_QUEUEING = 1,
+ POK_PORT_KIND_SAMPLING = 2,
#ifdef POK_NEEDS_PORTS_VIRTUAL
- POK_PORT_KIND_VIRTUAL = 2,
+ POK_PORT_KIND_VIRTUAL = 2,
#endif
- POK_PORT_KIND_INVALID = 10
+ POK_PORT_KIND_INVALID = 10
} pok_port_kinds_t;
typedef struct
{
- pok_port_id_t identifier;
- pok_partition_id_t partition;
- pok_port_size_t index;
- bool_t full;
- pok_port_size_t size;
- pok_port_size_t off_b; /* Offset of the beginning of the buffer */
- pok_port_size_t off_e; /* Offset of the end of the buffer */
- pok_port_direction_t direction;
- pok_port_queueing_discipline_t discipline;
- pok_bool_t ready;
- bool_t empty;
- uint8_t kind;
- uint64_t refresh;
- uint64_t last_receive;
- pok_lockobj_t lock;
- bool_t must_be_flushed;
+ pok_port_id_t identifier;
+ pok_partition_id_t partition;
+ pok_port_size_t index;
+ bool_t full;
+ pok_port_size_t size;
+ pok_port_size_t off_b; /* Offset of the beginning of the buffer */
+ pok_port_size_t off_e; /* Offset of the end of the buffer */
+ pok_port_direction_t direction;
+ pok_port_queueing_discipline_t discipline;
+ pok_bool_t ready;
+ bool_t empty;
+ uint8_t kind;
+ uint64_t refresh;
+ uint64_t last_receive;
+ pok_lockobj_t lock;
+ bool_t must_be_flushed;
}pok_port_t;
#ifdef POK_NEEDS_PORTS_QUEUEING
/* Queueing port functions */
typedef struct
{
- pok_port_size_t size;
- pok_port_direction_t direction;
- uint8_t waiting_processes;
+ pok_port_size_t size;
+ pok_port_direction_t direction;
+ uint8_t waiting_processes;
}pok_port_queueing_status_t;
-pok_ret_t pok_port_queueing_create (char* name,
- const pok_port_size_t size,
- const pok_port_direction_t direction,
- const pok_port_queueing_discipline_t discipline,
- pok_port_id_t* id);
+pok_ret_t pok_port_queueing_create (char* name,
+ const pok_port_size_t size,
+ const pok_port_direction_t direction,
+ const pok_port_queueing_discipline_t discipline,
+ pok_port_id_t* id);
-pok_ret_t pok_port_queueing_receive (const pok_port_id_t id,
- uint64_t timeout,
- const pok_port_size_t maxlen,
- void* data,
- pok_port_size_t* len);
+pok_ret_t pok_port_queueing_receive (const pok_port_id_t id,
+ uint64_t timeout,
+ const pok_port_size_t maxlen,
+ void* data,
+ pok_port_size_t* len);
-pok_ret_t pok_port_queueing_send (const pok_port_id_t id,
- const void* data,
- const pok_port_size_t len,
- uint64_t timeout);
+pok_ret_t pok_port_queueing_send (const pok_port_id_t id,
+ const void* data,
+ const pok_port_size_t len,
+ uint64_t timeout);
pok_ret_t pok_port_queueing_status (const pok_port_id_t id,
- pok_port_queueing_status_t* status);
+ pok_port_queueing_status_t* status);
pok_ret_t pok_port_queueing_id (char* name,
- pok_port_id_t* id);
+ pok_port_id_t* id);
#endif
#ifdef POK_NEEDS_PORTS_SAMPLING
@@ -113,45 +113,45 @@
typedef struct
{
- pok_port_size_t size;
- pok_port_direction_t direction;
- uint64_t refresh;
- bool_t validity;
+ pok_port_size_t size;
+ pok_port_direction_t direction;
+ uint64_t refresh;
+ bool_t validity;
}pok_port_sampling_status_t;
pok_ret_t pok_port_sampling_create (char* name,
- const pok_port_size_t size,
- const pok_port_direction_t direction,
- const uint64_t refresh,
- pok_port_id_t* id);
+ const pok_port_size_t size,
+ const pok_port_direction_t direction,
+ const uint64_t refresh,
+ pok_port_id_t* id);
pok_ret_t pok_port_sampling_write (const pok_port_id_t id,
- const void* data,
- const pok_port_size_t len);
+ const void* data,
+ const pok_port_size_t len);
pok_ret_t pok_port_sampling_read (const pok_port_id_t id,
- void* message,
- pok_port_size_t* len,
- bool_t* valid);
+ void* message,
+ pok_port_size_t* len,
+ bool_t* valid);
pok_ret_t pok_port_sampling_id (char* name,
- pok_port_id_t* id);
+ pok_port_id_t* id);
pok_ret_t pok_port_sampling_status (const pok_port_id_t id,
- pok_port_sampling_status_t* status);
+ pok_port_sampling_status_t* status);
#endif
#if defined (POK_NEEDS_PORTS_SAMPLING) || defined (POK_NEEDS_PORTS_QUEUEING)
/* Generic functions */
-pok_ret_t pok_port_create (char* name,
- const pok_port_size_t size,
- const pok_port_direction_t direction,
- uint8_t kind,
- pok_port_id_t* id);
+pok_ret_t pok_port_create (char* name,
+ const pok_port_size_t size,
+ const pok_port_direction_t direction,
+ uint8_t kind,
+ pok_port_id_t* id);
-pok_ret_t pok_port_transfer (const uint8_t gid_dst,
- const uint8_t gid_src);
+pok_ret_t pok_port_transfer (const uint8_t gid_dst,
+ const uint8_t gid_src);
void pok_port_init(void);
void pok_port_queueing_flushall (void);
@@ -161,12 +161,12 @@
pok_ret_t pok_port_get (const uint32_t gid, void *data, const pok_port_size_t size);
pok_ret_t pok_port_write (const uint8_t gid, const void *data, const pok_port_size_t size);
bool_t pok_own_port (const uint8_t partition, const uint8_t port);
-#endif
+#endif
#ifdef POK_NEEDS_PORTS_VIRTUAL
-pok_ret_t pok_port_virtual_id (char* name,
- pok_port_id_t* id);
+pok_ret_t pok_port_virtual_id (char* name,
+ pok_port_id_t* id);
pok_ret_t pok_port_virtual_nb_destinations (const pok_port_id_t id, uint32_t* result);
pok_ret_t pok_port_virtual_destination (const pok_port_id_t id, const uint32_t n, uint32_t* result);
Modified: trunk/kernel/middleware/portcreate.c
===================================================================
--- trunk/kernel/middleware/portcreate.c 2012-08-29 12:45:22 UTC (rev 38)
+++ trunk/kernel/middleware/portcreate.c 2012-08-30 08:36:32 UTC (rev 39)
@@ -1,6 +1,6 @@
/*
* POK header
- *
+ *
* The following file is a part of the POK project. Any modification should
* made according to the POK licence. You CANNOT use this file or a part of
* this file is this part of a file for your own project
@@ -9,9 +9,9 @@
*
* Please follow the coding guidelines described in doc/CODING_GUIDELINES
*
- * Copyright (c) 2007-2009 POK team
+ * Copyright (c) 2007-2009 POK team
*
- * Created by julien on Thu Jan 15 23:34:13 2009
+ * Created by julien on Thu Jan 15 23:34:13 2009
*/
#if defined (POK_NEEDS_PORTS_SAMPLING) || defined (POK_NEEDS_PORTS_QUEUEING)
@@ -30,104 +30,104 @@
extern pok_port_t pok_ports[POK_CONFIG_NB_PORTS];
extern pok_queue_t pok_queue;
-pok_ret_t pok_port_create (char* name,
- const pok_port_size_t size,
- const pok_port_direction_t direction,
- uint8_t kind, pok_port_id_t* id)
+pok_ret_t pok_port_create (char* name,
+ const pok_port_size_t size,
+ const pok_port_direction_t direction,
+ uint8_t kind, pok_port_id_t* id)
{
- uint8_t gid;
- pok_ret_t ret;
+ uint8_t gid;
+ pok_ret_t ret;
- ret = POK_ERRNO_OK;
+ ret = POK_ERRNO_OK;
- if (size > POK_PORT_MAX_SIZE)
- {
+ if (size > POK_PORT_MAX_SIZE)
+ {
#if (defined POK_NEEDS_PARTITIONS) && (defined POK_NEEDS_ERROR_HANDLING)
- POK_ERROR_CURRENT_PARTITION(POK_ERROR_KIND_PARTITION_CONFIGURATION);
+ POK_ERROR_CURRENT_PARTITION(POK_ERROR_KIND_PARTITION_CONFIGURATION);
#endif
- return POK_ERRNO_PORT;
- }
+ return POK_ERRNO_PORT;
+ }
- if (size > pok_queue.available_size)
- {
+ if (size > pok_queue.available_size)
+ {
#if (defined POK_NEEDS_PARTITIONS) && (defined POK_NEEDS_ERROR_HANDLING)
- POK_ERROR_CURRENT_PARTITION(POK_ERROR_KIND_PARTITION_CONFIGURATION);
+ POK_ERROR_CURRENT_PARTITION(POK_ERROR_KIND_PARTITION_CONFIGURATION);
#endif
- return POK_ERRNO_PORT;
- }
+ return POK_ERRNO_PORT;
+ }
- if ((direction != POK_PORT_DIRECTION_IN) &&
- (direction != POK_PORT_DIRECTION_OUT))
- {
+ if ((direction != POK_PORT_DIRECTION_IN) &&
+ (direction != POK_PORT_DIRECTION_OUT))
+ {
#if (defined POK_NEEDS_PARTITIONS) && (defined POK_NEEDS_ERROR_HANDLING)
- POK_ERROR_CURRENT_PARTITION(POK_ERROR_KIND_PARTITION_CONFIGURATION);
+ POK_ERROR_CURRENT_PARTITION(POK_ERROR_KIND_PARTITION_CONFIGURATION);
#endif
- return POK_ERRNO_PORT;
- }
+ return POK_ERRNO_PORT;
+ }
- switch (kind)
- {
- case POK_PORT_KIND_SAMPLING:
- {
+ switch (kind)
+ {
+ case POK_PORT_KIND_SAMPLING:
+ {
#ifdef POK_NEEDS_PORTS_SAMPLING
- ret = pok_port_sampling_id (name, &gid);
+ ret = pok_port_sampling_id (name, &gid);
#endif
- break;
- }
- case POK_PORT_KIND_QUEUEING:
- {
+ break;
+ }
+ case POK_PORT_KIND_QUEUEING:
+ {
#ifdef POK_NEEDS_PORTS_QUEUEING
- ret = pok_port_queueing_id (name, &gid);
+ ret = pok_port_queueing_id (name, &gid);
#endif
- break;
- }
- default:
- {
- return POK_ERRNO_EINVAL;
- break;
- }
- }
+ break;
+ }
+ default:
+ {
+ return POK_ERRNO_EINVAL;
+ break;
+ }
+ }
- if (ret != POK_ERRNO_OK)
- {
+ if (ret != POK_ERRNO_OK)
+ {
#if (defined POK_NEEDS_PARTITIONS) && (defined POK_NEEDS_ERROR_HANDLING)
- POK_ERROR_CURRENT_PARTITION(POK_ERROR_KIND_PARTITION_INIT);
+ POK_ERROR_CURRENT_PARTITION(POK_ERROR_KIND_PARTITION_INIT);
#endif
- return ret;
- }
-
- if (! pok_own_port (POK_SCHED_CURRENT_PARTITION, gid))
- {
- return POK_ERRNO_PORT;
- }
+ return ret;
+ }
- /*
- * Check if the port was already created
- * If it's already created, we return ERRNO_EXISTS but indicate
- * the right port-id. This should not be taken as an assumption
- * but could help the developper when a partition is restarted.
- */
- if (pok_ports[gid].ready == TRUE)
- {
- *id = gid;
- return POK_ERRNO_EXISTS;
- }
+ if (! pok_own_port (POK_SCHED_CURRENT_PARTITION, gid))
+ {
+ return POK_ERRNO_PORT;
+ }
- pok_ports[gid].index = pok_queue.size - pok_queue.available_size;
- pok_ports[gid].off_b = 0;
- pok_ports[gid].off_e = 0;
- pok_ports[gid].size = size;
- pok_ports[gid].full = FALSE;
- pok_ports[gid].partition = pok_current_partition;
- pok_ports[gid].direction = direction;
- pok_ports[gid].ready = TRUE;
- pok_ports[gid].kind = kind;
+ /*
+ * Check if the port was already created
+ * If it's already created, we return ERRNO_EXISTS but indicate
+ * the right port-id. This should not be taken as an assumption
+ * but could help the developper when a partition is restarted.
+ */
+ if (pok_ports[gid].ready == TRUE)
+ {
+ *id = gid;
+ return POK_ERRNO_EXISTS;
+ }
- pok_queue.available_size = pok_queue.available_size - size;
+ pok_ports[gid].index = pok_queue.size - pok_queue.available_size;
+ pok_ports[gid].off_b = 0;
+ pok_ports[gid].off_e = 0;
+ pok_ports[gid].size = size;
+ pok_ports[gid].full = FALSE;
+ pok_ports[gid].partition = pok_current_partition;
+ pok_ports[gid].direction = direction;
+ pok_ports[gid].ready = TRUE;
+ pok_ports[gid].kind = kind;
- *id = gid;
+ pok_queue.available_size = pok_queue.available_size - size;
- return POK_ERRNO_OK;
+ *id = gid;
+
+ return POK_ERRNO_OK;
}
#endif
Modified: trunk/kernel/middleware/portsamplingid.c
===================================================================
--- trunk/kernel/middleware/portsamplingid.c 2012-08-29 12:45:22 UTC (rev 38)
+++ trunk/kernel/middleware/portsamplingid.c 2012-08-30 08:36:32 UTC (rev 39)
@@ -1,6 +1,6 @@
/*
* POK header
- *
+ *
* The following file is a part of the POK project. Any modification should
* made according to the POK licence. You CANNOT use this file or a part of
* this file is this part of a file for your own project
@@ -9,9 +9,9 @@
*
* Please follow the coding guidelines described in doc/CODING_GUIDELINES
*
- * Copyright (c) 2007-2009 POK team
+ * Copyright (c) 2007-2009 POK team
*
- * Created by julien on Thu Jan 15 23:34:13 2009
+ * Created by julien on Thu Jan 15 23:34:13 2009
*/
@@ -26,23 +26,23 @@
pok_ret_t pok_port_sampling_id (char* name, pok_port_id_t* id)
{
- uint8_t i;
+ uint8_t i;
- for (i = 0; i < POK_CONFIG_NB_PORTS ; i++)
- {
- if ( (strcmp (name, pok_ports_names[i]) == 0) && (pok_ports_kind[i] == POK_PORT_KIND_SAMPLING))
- {
- if (! pok_own_port (POK_SCHED_CURRENT_PARTITION, i))
- {
- return POK_ERRNO_PORT;
- }
+ for (i = 0; i < POK_CONFIG_NB_PORTS ; i++)
+ {
+ if ( (strcmp (name, pok_ports_names[i]) == 0) && (pok_ports_kind[i] == POK_PORT_KIND_SAMPLING))
+ {
+ if (! pok_own_port (POK_SCHED_CURRENT_PARTITION, i))
+ {
+ return POK_ERRNO_PORT;
+ }
- *id = i;
+ *id = i;
- return POK_ERRNO_OK;
- }
- }
- return POK_ERRNO_NOTFOUND;
+ return POK_ERRNO_OK;
+ }
+ }
+ return POK_ERRNO_NOTFOUND;
}
#endif
Modified: trunk/libpok/arinc653/sampling.c
===================================================================
--- trunk/libpok/arinc653/sampling.c 2012-08-29 12:45:22 UTC (rev 38)
+++ trunk/libpok/arinc653/sampling.c 2012-08-30 08:36:32 UTC (rev 39)
@@ -1,6 +1,6 @@
/*
* POK header
- *
+ *
* The following file is a part of the POK project. Any modification should
* made according to the POK licence. You CANNOT use this file or a part of
* this file is this part of a file for your own project
@@ -9,9 +9,9 @@
*
* Please follow the coding guidelines described in doc/CODING_GUIDELINES
*
- * Copyright (c) 2007-2009 POK team
+ * Copyright (c) 2007-2009 POK team
*
- * Created by julien on Thu Jan 15 23:34:13 2009
+ * Created by julien on Thu Jan 15 23:34:13 2009
*/
@@ -21,82 +21,114 @@
#include <middleware/port.h>
#include <arinc653/types.h>
#include <arinc653/sampling.h>
-
-void CREATE_SAMPLING_PORT (
- /*in */ SAMPLING_PORT_NAME_TYPE SAMPLING_PORT_NAME,
- /*in */ MESSAGE_SIZE_TYPE MAX_MESSAGE_SIZE,
- /*in */ PORT_DIRECTION_TYPE PORT_DIRECTION,
- /*in */ SYSTEM_TIME_TYPE REFRESH_PERIOD,
- /*out*/ SAMPLING_PORT_ID_TYPE *SAMPLING_PORT_ID,
- /*out*/ RETURN_CODE_TYPE *RETURN_CODE )
+#include <arinc653/partition.h>
+#include <core/thread.h>
+
+void CREATE_SAMPLING_PORT (
+ /*in */ SAMPLING_PORT_NAME_TYPE SAMPLING_PORT_NAME,
+ /*in */ MESSAGE_SIZE_TYPE MAX_MESSAGE_SIZE,
+ /*in */ PORT_DIRECTION_TYPE PORT_DIRECTION,
+ /*in */ SYSTEM_TIME_TYPE REFRESH_PERIOD,
+ /*out*/ SAMPLING_PORT_ID_TYPE *SAMPLING_PORT_ID,
+ /*out*/ RETURN_CODE_TYPE *RETURN_CODE )
{
- pok_port_direction_t core_direction;
- pok_port_id_t core_id;
- pok_ret_t core_ret;
+ pok_port_direction_t core_direction;
+ pok_port_id_t core_id;
+ pok_ret_t core_ret;
+ pok_thread_attr_t attr;
+ uint32_t process_id;
- switch (PORT_DIRECTION)
- {
- case SOURCE:
- core_direction = POK_PORT_DIRECTION_OUT;
- break;
-
- case DESTINATION:
- core_direction = POK_PORT_DIRECTION_IN;
- break;
+ pok_thread_id(&process_id);
+ core_ret = pok_thread_status (process_id, &attr);
+ if (attr.state == NORMAL)
+ {
+ *RETURN_CODE = INVALID_MODE;
+ return ;
+ }
+ if (MAX_MESSAGE_SIZE <= 0 || REFRESH_PERIOD < 0)
+ {
+ *RETURN_CODE = INVALID_CONFIG;
+ return ;
+ }
- default:
- *RETURN_CODE = INVALID_PARAM;
- return;
- }
+ switch (PORT_DIRECTION)
+ {
+ case SOURCE:
+ core_direction = POK_PORT_DIRECTION_OUT;
+ break;
- core_ret = pok_port_sampling_create (SAMPLING_PORT_NAME, MAX_MESSAGE_SIZE, core_direction, REFRESH_PERIOD, &core_id);
+ case DESTINATION:
+ core_direction = POK_PORT_DIRECTION_IN;
+ break;
- *SAMPLING_PORT_ID = core_id;
+ default:
+ *RETURN_CODE = INVALID_PARAM;
+ return;
+ }
- *RETURN_CODE = core_ret;
+ core_ret = pok_port_sampling_create (SAMPLING_PORT_NAME, MAX_MESSAGE_SIZE, core_direction, REFRESH_PERIOD, &core_id);
+
+ *SAMPLING_PORT_ID = core_id;
+
+ *RETURN_CODE = core_ret;
}
-
-void WRITE_SAMPLING_MESSAGE (
- /*in */ SAMPLING_PORT_ID_TYPE SAMPLING_PORT_ID,
- /*in */ MESSAGE_ADDR_TYPE MESSAGE_ADDR, /* by reference */
- /*in */ MESSAGE_SIZE_TYPE LENGTH,
- /*out*/ RETURN_CODE_TYPE *RETURN_CODE )
+
+void WRITE_SAMPLING_MESSAGE (
+ /*in */ SAMPLING_PORT_ID_TYPE SAMPLING_PORT_ID,
+ /*in */ MESSAGE_ADDR_TYPE MESSAGE_ADDR, /* by reference */
+ /*in */ MESSAGE_SIZE_TYPE LENGTH,
+ /*out*/ RETURN_CODE_TYPE *RETURN_CODE )
{
- pok_ret_t core_ret;
- core_ret = pok_port_sampling_write (SAMPLING_PORT_ID, MESSAGE_ADDR, LENGTH);
- *RETURN_CODE = core_ret;
+ pok_ret_t core_ret;
+
+ if (LENGTH <= 0)
+ {
+ *RETURN_CODE = INVALID_PARAM;
+ return;
+ }
+ core_ret = pok_port_sampling_write (SAMPLING_PORT_ID, MESSAGE_ADDR, LENGTH);
+ *RETURN_CODE = core_ret;
}
-
-void READ_SAMPLING_MESSAGE (
- /*in */ SAMPLING_PORT_ID_TYPE SAMPLING_PORT_ID,
- /*out*/ MESSAGE_ADDR_TYPE MESSAGE_ADDR,
- /*out*/ MESSAGE_SIZE_TYPE *LENGTH,
- /*out*/ VALIDITY_TYPE *VALIDITY,
- /*out*/ RETURN_CODE_TYPE *RETURN_CODE )
+
+void READ_SAMPLING_MESSAGE (
+ /*in */ SAMPLING_PORT_ID_TYPE SAMPLING_PORT_ID,
+ /*out*/ MESSAGE_ADDR_TYPE MESSAGE_ADDR,
+ /*out*/ MESSAGE_SIZE_TYPE *LENGTH,
+ /*out*/ VALIDITY_TYPE *VALIDITY,
+ /*out*/ RETURN_CODE_TYPE *RETURN_CODE )
{
- pok_ret_t core_ret;
- core_ret = pok_port_sampling_read (SAMPLING_PORT_ID, MESSAGE_ADDR, (pok_port_size_t*) LENGTH, (pok_bool_t*) VALIDITY);
- *RETURN_CODE = core_ret;
+ pok_ret_t core_ret;
+ core_ret = pok_port_sampling_read (SAMPLING_PORT_ID, MESSAGE_ADDR, (pok_port_size_t*) LENGTH, (pok_bool_t*) VALIDITY);
+ *RETURN_CODE = core_ret;
}
-
-void GET_SAMPLING_PORT_ID (
- /*in */ SAMPLING_PORT_NAME_TYPE SAMPLING_PORT_NAME,
- /*out*/ SAMPLING_PORT_ID_TYPE *SAMPLING_PORT_ID,
- /*out*/ RETURN_CODE_TYPE *RETURN_CODE )
+
+void GET_SAMPLING_PORT_ID (
+ /*in */ SAMPLING_PORT_NAME_TYPE SAMPLING_PORT_NAME,
+ /*out*/ SAMPLING_PORT_ID_TYPE *SAMPLING_PORT_ID,
+ /*out*/ RETURN_CODE_TYPE *RETURN_CODE )
{
- (void) SAMPLING_PORT_NAME;
- (void) SAMPLING_PORT_ID;
- *RETURN_CODE = NOT_AVAILABLE;
+ pok_ret_t core_ret;
+ pok_port_id_t id;
+
+ core_ret = pok_port_sampling_id(SAMPLING_PORT_NAME, &id);
+ *SAMPLING_PORT_ID = id;
+ *RETURN_CODE = core_ret;
}
-
-void GET_SAMPLING_PORT_STATUS (
- /*in */ SAMPLING_PORT_ID_TYPE SAMPLING_PORT_ID,
- /*out*/ SAMPLING_PORT_STATUS_TYPE *SAMPLING_PORT_STATUS,
- /*out*/ RETURN_CODE_TYPE *RETURN_CODE )
+
+void GET_SAMPLING_PORT_STATUS (
+ /*in */ SAMPLING_PORT_ID_TYPE SAMPLING_PORT_ID,
+ /*out*/ SAMPLING_PORT_STATUS_TYPE *SAMPLING_PORT_STATUS,
+ /*out*/ RETURN_CODE_TYPE *RETURN_CODE )
{
- (void) SAMPLING_PORT_ID;
- (void) SAMPLING_PORT_STATUS;
- *RETURN_CODE = NOT_AVAILABLE;
+ pok_ret_t core_ret;
+ pok_port_sampling_status_t status;
+
+ core_ret = pok_port_sampling_status(SAMPLING_PORT_ID, &status);
+ SAMPLING_PORT_STATUS->REFRESH_PERIOD = status.refresh;
+ SAMPLING_PORT_STATUS->MAX_MESSAGE_SIZE = status.size;
+ SAMPLING_PORT_STATUS->PORT_DIRECTION = status.direction;
+ SAMPLING_PORT_STATUS->LAST_MSG_VALIDITY = status.validity;
+ *RETURN_CODE = core_ret;
}
#endif