POK
|
00001 /* 00002 * POK header 00003 * 00004 * The following file is a part of the POK project. Any modification should 00005 * made according to the POK licence. You CANNOT use this file or a part of 00006 * this file is this part of a file for your own project 00007 * 00008 * For more information on the POK licence, please see our LICENCE FILE 00009 * 00010 * Please follow the coding guidelines described in doc/CODING_GUIDELINES 00011 * 00012 * Copyright (c) 2007-2009 POK team 00013 * 00014 * Created by julien on Thu Jan 15 23:34:13 2009 00015 */ 00016 00017 00018 #ifdef POK_NEEDS_ARINC653_BUFFER 00019 #include <arinc653/types.h> 00020 #include <arinc653/buffer.h> 00021 #include <types.h> 00022 #include <middleware/port.h> 00023 #include <middleware/buffer.h> 00024 00025 void CREATE_BUFFER ( 00026 /*in */ BUFFER_NAME_TYPE BUFFER_NAME, 00027 /*in */ MESSAGE_SIZE_TYPE MAX_MESSAGE_SIZE, 00028 /*in */ MESSAGE_RANGE_TYPE MAX_NB_MESSAGE, 00029 /*in */ QUEUING_DISCIPLINE_TYPE QUEUING_DISCIPLINE, 00030 /*out*/ BUFFER_ID_TYPE *BUFFER_ID, 00031 /*out*/ RETURN_CODE_TYPE *RETURN_CODE ) 00032 { 00033 pok_ret_t core_ret; 00034 pok_buffer_id_t core_id; 00035 pok_queueing_discipline_t core_discipline; 00036 00037 switch (QUEUING_DISCIPLINE) 00038 { 00039 case PRIORITY: 00040 core_discipline = POK_PORT_QUEUEING_DISCIPLINE_PRIORITY; 00041 break; 00042 00043 case FIFO: 00044 core_discipline = POK_PORT_QUEUEING_DISCIPLINE_FIFO; 00045 break; 00046 00047 default: 00048 *RETURN_CODE = INVALID_PARAM; 00049 return; 00050 } 00051 00052 core_ret = pok_buffer_create (BUFFER_NAME, MAX_MESSAGE_SIZE * MAX_NB_MESSAGE, MAX_MESSAGE_SIZE, core_discipline, &core_id); 00053 00054 *BUFFER_ID = core_id; 00055 00056 *RETURN_CODE = core_ret; 00057 } 00058 00059 void SEND_BUFFER ( 00060 /*in */ BUFFER_ID_TYPE BUFFER_ID, 00061 /*in */ MESSAGE_ADDR_TYPE MESSAGE_ADDR, /* by reference */ 00062 /*in */ MESSAGE_SIZE_TYPE LENGTH, 00063 /*in */ SYSTEM_TIME_TYPE TIME_OUT, 00064 /*out*/ RETURN_CODE_TYPE *RETURN_CODE ) 00065 { 00066 pok_ret_t core_ret; 00067 core_ret = pok_buffer_send (BUFFER_ID, MESSAGE_ADDR, LENGTH, TIME_OUT); 00068 *RETURN_CODE = core_ret; 00069 } 00070 00071 void RECEIVE_BUFFER ( 00072 /*in */ BUFFER_ID_TYPE BUFFER_ID, 00073 /*in */ SYSTEM_TIME_TYPE TIME_OUT, 00074 /*out*/ MESSAGE_ADDR_TYPE MESSAGE_ADDR, 00075 /*out*/ MESSAGE_SIZE_TYPE *LENGTH, 00076 /*out*/ RETURN_CODE_TYPE *RETURN_CODE ) 00077 { 00078 pok_ret_t core_ret; 00079 pok_port_size_t core_size; 00080 core_ret = pok_buffer_receive (BUFFER_ID, TIME_OUT, MESSAGE_ADDR, &core_size); 00081 *LENGTH = (APEX_INTEGER) core_size; 00082 *RETURN_CODE = core_ret; 00083 } 00084 00085 void GET_BUFFER_ID ( 00086 /*in */ BUFFER_NAME_TYPE BUFFER_NAME, 00087 /*out*/ BUFFER_ID_TYPE *BUFFER_ID, 00088 /*out*/ RETURN_CODE_TYPE *RETURN_CODE ) 00089 { 00090 (void) BUFFER_NAME; 00091 (void) BUFFER_ID; 00092 *RETURN_CODE = NOT_AVAILABLE; 00093 } 00094 00095 void GET_BUFFER_STATUS ( 00096 /*in */ BUFFER_ID_TYPE BUFFER_ID, 00097 /*out*/ BUFFER_STATUS_TYPE *BUFFER_STATUS, 00098 /*out*/ RETURN_CODE_TYPE *RETURN_CODE ) 00099 { 00100 (void) BUFFER_ID; 00101 (void) BUFFER_STATUS; 00102 *RETURN_CODE = NOT_AVAILABLE; 00103 } 00104 00105 #endif