comparison src/cs/services/atp/atp_uart_api.c @ 0:4e78acac3d88

src/{condat,cs,gpf,nucleus}: import from Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:23:26 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4e78acac3d88
1 /********************************************************************************/
2 /* */
3 /* File Name: atp_uart_api.c */
4 /* */
5 /* Purpose: This file contains the external functions related to */
6 /* the ATP-UART interface. */
7 /* */
8 /* Note: None. */
9 /* */
10 /* Revision History: */
11 /* 10/04/01 Pascal Pompei */
12 /* - Create. */
13 /* */
14 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved. */
15 /* */
16 /********************************************************************************/
17 #include "atp/atp_uart_i.h"
18 #include "rvm/rvm_use_id_list.h"
19
20
21 /********************************************************************************/
22 /* */
23 /* Function Name: atp_uart_open_com_port */
24 /* */
25 /* Purpose: This function instructs the ATP-UART interface to open */
26 /* the COM port. */
27 /* */
28 /* Input Parameters: */
29 /* com_port - Contains the COM port number. */
30 /* baud_rate - Contains the baud rate (in bits per second). */
31 /* */
32 /* Output Parameters: None. */
33 /* */
34 /* Global Parameters: None. */
35 /* */
36 /* Note: None. */
37 /* */
38 /* Revision History: */
39 /* 10/04/01 Pascal Pompei */
40 /* - Create. */
41 /* */
42 /********************************************************************************/
43 T_ATP_UART_ERROR_CODES atp_uart_open_com_port (T_ATP_UART_COM_PORT com_port,
44 T_ATP_UART_BAUD_RATE baud_rate)
45 {
46 /* Declare a local variable. */
47 T_ATP_UART_OPEN_COM_PORT *open_com_port_p = NULL;
48
49 /******************** atp_uart_open_com_port function begins ********************/
50
51 /* Allocate memory required to instruct the ATP-UART interface to open the */
52 /* COM port. If insufficient resources, then report an internal memory */
53 /* error and abort. */
54 if (rvf_get_buf (gbl_atp_uart_ctrl_blk_p->mb_id, \
55 sizeof (T_ATP_UART_OPEN_COM_PORT), \
56 (T_RVF_BUFFER **) (&open_com_port_p)) == RVF_RED)
57 {
58 rvf_send_trace (" ATP-UART (api). Insufficient resources ",
59 41,
60 NULL_PARAM,
61 RV_TRACE_LEVEL_WARNING,
62 ATP_USE_ID);
63 return (RV_MEMORY_ERR);
64 }
65
66 /* Fill the 'ATP-UART Open COM Port' header up. */
67 (open_com_port_p->os_header).msg_id = ATP_UART_OPEN_COM_PORT;
68 (open_com_port_p->os_header).src_addr_id = RVF_INVALID_ADDR_ID;
69 (open_com_port_p->os_header).callback_func = NULL;
70
71 /* Fill the 'ATP-UART Open COM Port' payload up. */
72 open_com_port_p->com_port = com_port;
73 open_com_port_p->baud_rate = baud_rate;
74
75 /* Send the 'ATP-UART Open COM Port' notification to the ATP-UART */
76 /* interface. */
77 return (rvf_send_msg (gbl_atp_uart_ctrl_blk_p->addr_id, \
78 open_com_port_p));
79
80 } /******************* End of atp_uart_open_com_port function *******************/
81
82
83 /********************************************************************************/
84 /* */
85 /* Function Name: atp_uart_start_gsm */
86 /* */
87 /* Purpose: This function instructs the ATP-UART interface to */
88 /* initiate using the GSM protocol stack. */
89 /* */
90 /* Input Parameters: None. */
91 /* */
92 /* Output Parameters: None. */
93 /* */
94 /* Global Parameters: None. */
95 /* */
96 /* Note: The GSM protocol stack is initialized by invoking the */
97 /* following AT commands: */
98 /* AT+CFUN=1 : Set Phone Functionality (Full), */
99 /* AT+COPS=0 : Operator Selection. */
100 /* */
101 /* Revision History: */
102 /* 09/26/02 Pascal Pompei */
103 /* - Create. */
104 /* */
105 /********************************************************************************/
106 T_ATP_UART_ERROR_CODES atp_uart_start_gsm (void)
107 {
108 /* Declare a local variable. */
109 T_ATP_UART_START_GSM *start_gsm_p = NULL;
110
111 /********************** atp_uart_start_gsm function begins **********************/
112
113 /* Allocate memory required to instruct the ATP-UART interface to initiate */
114 /* using the GSM protocol stack. If insufficient resources, then report an */
115 /* internal memory error and abort. */
116 if (rvf_get_buf (gbl_atp_uart_ctrl_blk_p->mb_id, \
117 sizeof (T_ATP_UART_START_GSM), \
118 (T_RVF_BUFFER **) (&start_gsm_p)) == RVF_RED)
119 {
120 rvf_send_trace (" ATP-UART (api). Insufficient resources ",
121 41,
122 NULL_PARAM,
123 RV_TRACE_LEVEL_WARNING,
124 ATP_USE_ID);
125 return (RV_MEMORY_ERR);
126 }
127
128 /* Fill the 'ATP-UART Start GSM' header up. */
129 (start_gsm_p->os_header).msg_id = ATP_UART_START_GSM;
130 (start_gsm_p->os_header).src_addr_id = RVF_INVALID_ADDR_ID;
131 (start_gsm_p->os_header).callback_func = NULL;
132
133 /* Send the 'ATP-UART Start GSM' notification to the ATP-UART interface. */
134 return (rvf_send_msg (gbl_atp_uart_ctrl_blk_p->addr_id, \
135 start_gsm_p));
136
137 } /********************* End of atp_uart_start_gsm function *********************/