comparison src/g23m-aci/gdd_dio/gdd_dio_drxf.c @ 1:d393cd9bb723

src/g23m-*: initial import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 04:40:46 +0000
parents
children
comparison
equal deleted inserted replaced
0:b6a5e36de839 1:d393cd9bb723
1 /*
2 +-----------------------------------------------------------------------------
3 | File : gdd_dio_drxf.c
4 +-----------------------------------------------------------------------------
5 | Copyright 2002 Texas Instruments Berlin, AG
6 | All rights reserved.
7 |
8 | This file is confidential and a trade secret of Texas
9 | Instruments Berlin, AG
10 | The receipt of or possession of this file does not convey
11 | any rights to reproduce or disclose its contents or to
12 | manufacture, use, or sell anything it may describe, in
13 | whole, or in part, without the specific written consent of
14 | Texas Instruments Berlin, AG.
15 +-----------------------------------------------------------------------------
16 | Purpose : This modul is part of the entity gdd_dio and implements the
17 | drx service functions.
18 +-----------------------------------------------------------------------------
19 */
20
21
22 #define ENTITY_GDD_DIO
23
24 /*==== INCLUDES =============================================================*/
25
26 #include "typedefs.h" /* to get Condat data types */
27 #include "vsi.h" /* to get a lot of macros */
28
29 /* GDD stuff */
30 #include "gdd_dio.h" /* to get the global entity definitions */
31 #include "gdd_dio_data.h" /* to get internal data structures */
32
33 #include "gdd_dio_con_mgr.h"
34 #include "gdd_dio_queue.h"
35 #include "gdd_dio_drxf.h"
36 #include "gdd_dio_txf.h"
37
38
39 /*==== CONST ================================================================*/
40
41 /*==== LOCAL VARS ===========================================================*/
42
43 /*==== PRIVATE FUNCTIONS ====================================================*/
44
45 /*==== PUBLIC FUNCTIONS =====================================================*/
46
47
48 GLOBAL void gdd_dio_drx_sig_receive_data(T_GDD_CON_HANDLE con_handle, T_dio_buffer * buf)
49 {
50 T_GDD_DIO_CON_DATA * con_data;
51 GDD_RESULT result;
52
53 TRACE_FUNCTION("[GDD] gdd_dio_drx_sig_receive_data()");
54
55 con_data = get_con_data_from_handle(con_handle);
56
57 result = con_data->rcv_cb(con_handle, (T_GDD_BUF *)buf);
58 if(result EQ GDD_OK)
59 {
60 gdd_dio_send_signal_to_dio(con_data, DRV_SIGTYPE_WRITE);
61 }
62 else
63 {
64 /* Do nothing - the client must come back to use by calling
65 gdd_signal_ready_rcv. */
66 }
67 }
68
69 GLOBAL void gdd_dio_drx_ready_to_rcv(T_GDD_CON_HANDLE con_handle)
70 {
71 T_GDD_DIO_CON_DATA * con_data;
72 T_dio_buffer * buf;
73 GDD_RESULT result;
74
75 TRACE_FUNCTION("[GDD] gdd_dio_drx_ready_to_rcv()");
76
77 con_data = get_con_data_from_handle(con_handle);
78
79 if(gdd_dio_queue_peek_next_for_dequeue(&(con_data->tx_queue), &buf))
80 {
81 /* Send data to client */
82 result = con_data->rcv_cb(con_handle, (T_GDD_BUF *)buf);
83 if(result EQ GDD_OK)
84 {
85 gdd_dio_send_signal_to_dio(con_data, DRV_SIGTYPE_WRITE);
86 }
87 else
88 {
89 /* Do nothing - the client must come back again later by calling
90 gdd_signal_ready_rcv. */
91 }
92 }
93 else
94 {
95 TRACE_ERROR("[GDD] Failed to peek buffer");
96 }
97 }