18 #ifdef POK_NEEDS_ARINC653_SAMPLING
21 #include <middleware/port.h>
22 #include <arinc653/types.h>
23 #include <arinc653/sampling.h>
25 void CREATE_SAMPLING_PORT (
26 SAMPLING_PORT_NAME_TYPE SAMPLING_PORT_NAME,
27 MESSAGE_SIZE_TYPE MAX_MESSAGE_SIZE,
28 PORT_DIRECTION_TYPE PORT_DIRECTION,
29 SYSTEM_TIME_TYPE REFRESH_PERIOD,
30 SAMPLING_PORT_ID_TYPE *SAMPLING_PORT_ID,
31 RETURN_CODE_TYPE *RETURN_CODE )
33 pok_port_direction_t core_direction;
34 pok_port_id_t core_id;
37 switch (PORT_DIRECTION)
40 core_direction = POK_PORT_DIRECTION_OUT;
44 core_direction = POK_PORT_DIRECTION_IN;
48 *RETURN_CODE = INVALID_PARAM;
52 core_ret = pok_port_sampling_create (SAMPLING_PORT_NAME, MAX_MESSAGE_SIZE, core_direction, REFRESH_PERIOD, &core_id);
54 *SAMPLING_PORT_ID = core_id;
56 *RETURN_CODE = core_ret;
59 void WRITE_SAMPLING_MESSAGE (
60 SAMPLING_PORT_ID_TYPE SAMPLING_PORT_ID,
61 MESSAGE_ADDR_TYPE MESSAGE_ADDR,
62 MESSAGE_SIZE_TYPE LENGTH,
63 RETURN_CODE_TYPE *RETURN_CODE )
66 core_ret = pok_port_sampling_write (SAMPLING_PORT_ID, MESSAGE_ADDR, LENGTH);
67 *RETURN_CODE = core_ret;
70 void READ_SAMPLING_MESSAGE (
71 SAMPLING_PORT_ID_TYPE SAMPLING_PORT_ID,
72 MESSAGE_ADDR_TYPE MESSAGE_ADDR,
73 MESSAGE_SIZE_TYPE *LENGTH,
74 VALIDITY_TYPE *VALIDITY,
75 RETURN_CODE_TYPE *RETURN_CODE )
78 core_ret = pok_port_sampling_read (SAMPLING_PORT_ID, MESSAGE_ADDR, (pok_port_size_t*) LENGTH, (pok_bool_t*) VALIDITY);
79 *RETURN_CODE = core_ret;
82 void GET_SAMPLING_PORT_ID (
83 SAMPLING_PORT_NAME_TYPE SAMPLING_PORT_NAME,
84 SAMPLING_PORT_ID_TYPE *SAMPLING_PORT_ID,
85 RETURN_CODE_TYPE *RETURN_CODE )
87 (void) SAMPLING_PORT_NAME;
88 (void) SAMPLING_PORT_ID;
89 *RETURN_CODE = NOT_AVAILABLE;
92 void GET_SAMPLING_PORT_STATUS (
93 SAMPLING_PORT_ID_TYPE SAMPLING_PORT_ID,
95 RETURN_CODE_TYPE *RETURN_CODE )
97 (void) SAMPLING_PORT_ID;
98 (void) SAMPLING_PORT_STATUS;
99 *RETURN_CODE = NOT_AVAILABLE;