nci_hmsgs.c revision e9df6ba5a8fcccf306a80b1670b423be8fe7746a
1/******************************************************************************
2 *
3 *  Copyright (C) 2010-2012 Broadcom Corporation
4 *
5 *  Licensed under the Apache License, Version 2.0 (the "License");
6 *  you may not use this file except in compliance with the License.
7 *  You may obtain a copy of the License at:
8 *
9 *  http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *  Unless required by applicable law or agreed to in writing, software
12 *  distributed under the License is distributed on an "AS IS" BASIS,
13 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *  See the License for the specific language governing permissions and
15 *  limitations under the License.
16 *
17 ******************************************************************************/
18
19/******************************************************************************
20 *
21 *  This file contains function of the NCI unit to format and send NCI
22 *  commands (for DH).
23 *
24 ******************************************************************************/
25#include <string.h>
26#include "nfc_target.h"
27
28#if NFC_INCLUDED == TRUE
29#include "nci_defs.h"
30#include "nci_hmsgs.h"
31#include "nfc_api.h"
32#include "nfc_int.h"
33
34/*******************************************************************************
35**
36** Function         nci_snd_core_reset
37**
38** Description      compose and send CORE RESET command to command queue
39**
40** Returns          status
41**
42*******************************************************************************/
43UINT8 nci_snd_core_reset (UINT8 reset_type)
44{
45    BT_HDR *p;
46    UINT8 *pp;
47
48    if ((p = NCI_GET_CMD_BUF (NCI_CORE_PARAM_SIZE_RESET)) == NULL)
49        return (NCI_STATUS_FAILED);
50
51    p->event            = BT_EVT_TO_NFC_NCI;
52    p->len              = NCI_MSG_HDR_SIZE + NCI_CORE_PARAM_SIZE_RESET;
53    p->offset           = NCI_MSG_OFFSET_SIZE;
54    p->layer_specific   = 0;
55    pp                  = (UINT8 *) (p + 1) + p->offset;
56
57    NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_CORE);
58    NCI_MSG_BLD_HDR1 (pp, NCI_MSG_CORE_RESET);
59    UINT8_TO_STREAM (pp, NCI_CORE_PARAM_SIZE_RESET);
60    UINT8_TO_STREAM (pp, reset_type);
61
62    nfc_ncif_send_cmd (p);
63    return (NCI_STATUS_OK);
64}
65
66/*******************************************************************************
67**
68** Function         nci_snd_core_init
69**
70** Description      compose and send CORE INIT command to command queue
71**
72** Returns          status
73**
74*******************************************************************************/
75UINT8 nci_snd_core_init (void)
76{
77    BT_HDR *p;
78    UINT8 *pp;
79
80    if ((p = NCI_GET_CMD_BUF (NCI_CORE_PARAM_SIZE_INIT)) == NULL)
81        return (NCI_STATUS_FAILED);
82
83    p->event            = BT_EVT_TO_NFC_NCI;
84    p->len              = NCI_MSG_HDR_SIZE + NCI_CORE_PARAM_SIZE_INIT;
85    p->offset           = NCI_MSG_OFFSET_SIZE;
86    p->layer_specific   = 0;
87    pp                  = (UINT8 *) (p + 1) + p->offset;
88
89    NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_CORE);
90    NCI_MSG_BLD_HDR1 (pp, NCI_MSG_CORE_INIT);
91    UINT8_TO_STREAM (pp, NCI_CORE_PARAM_SIZE_INIT);
92
93    nfc_ncif_send_cmd (p);
94    return (NCI_STATUS_OK);
95}
96
97/*******************************************************************************
98**
99** Function         nci_snd_core_get_config
100**
101** Description      compose and send CORE GET_CONFIG command to command queue
102**
103** Returns          status
104**
105*******************************************************************************/
106UINT8 nci_snd_core_get_config (UINT8 *param_ids, UINT8 num_ids)
107{
108    BT_HDR *p;
109    UINT8 *pp;
110
111    if ((p = NCI_GET_CMD_BUF (num_ids)) == NULL)
112        return (NCI_STATUS_FAILED);
113
114    p->event            = BT_EVT_TO_NFC_NCI;
115    p->len              = NCI_MSG_HDR_SIZE + num_ids + 1;
116    p->offset           = NCI_MSG_OFFSET_SIZE;
117    p->layer_specific   = 0;
118    pp                  = (UINT8 *) (p + 1) + p->offset;
119
120    NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_CORE);
121    NCI_MSG_BLD_HDR1 (pp, NCI_MSG_CORE_GET_CONFIG);
122    UINT8_TO_STREAM (pp, (UINT8) (num_ids + 1));
123    UINT8_TO_STREAM (pp, num_ids);
124    ARRAY_TO_STREAM (pp, param_ids, num_ids);
125
126    nfc_ncif_send_cmd (p);
127    return (NCI_STATUS_OK);
128}
129
130/*******************************************************************************
131**
132** Function         nci_snd_core_set_config
133**
134** Description      compose and send CORE SET_CONFIG command to command queue
135**
136** Returns          status
137**
138*******************************************************************************/
139UINT8 nci_snd_core_set_config (UINT8 *p_param_tlvs, UINT8 tlv_size)
140{
141    BT_HDR *p;
142    UINT8 *pp;
143    UINT8  num = 0, ulen, len, *pt;
144
145    if ((p = NCI_GET_CMD_BUF (tlv_size + 1)) == NULL)
146        return (NCI_STATUS_FAILED);
147
148    p->event    = BT_EVT_TO_NFC_NCI;
149    p->len      = NCI_MSG_HDR_SIZE + tlv_size + 1;
150    p->offset   = NCI_MSG_OFFSET_SIZE;
151    pp          = (UINT8 *) (p + 1) + p->offset;
152
153    NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_CORE);
154    NCI_MSG_BLD_HDR1 (pp, NCI_MSG_CORE_SET_CONFIG);
155    UINT8_TO_STREAM (pp, (UINT8) (tlv_size + 1));
156    len         = tlv_size;
157    pt          = p_param_tlvs;
158    while (len > 1)
159    {
160        len     -= 2;
161        pt++;
162        num++;
163        ulen     = *pt++;
164        pt      += ulen;
165        if (len >= ulen)
166        {
167            len -= ulen;
168        }
169        else
170        {
171            GKI_freebuf (p);
172            return NCI_STATUS_FAILED;
173        }
174    }
175
176    UINT8_TO_STREAM (pp, num);
177    ARRAY_TO_STREAM (pp, p_param_tlvs, tlv_size);
178    nfc_ncif_send_cmd (p);
179
180    return (NCI_STATUS_OK);
181}
182
183/*******************************************************************************
184**
185** Function         nci_snd_core_conn_create
186**
187** Description      compose and send CORE CONN_CREATE command to command queue
188**
189** Returns          status
190**
191*******************************************************************************/
192UINT8 nci_snd_core_conn_create (UINT8 dest_type, UINT8 num_tlv, UINT8 tlv_size, UINT8 *p_param_tlvs)
193{
194    BT_HDR *p;
195    UINT8 *pp;
196    UINT8 size = NCI_CORE_PARAM_SIZE_CON_CREATE+tlv_size;
197
198    if ((p = NCI_GET_CMD_BUF (size)) == NULL)
199        return (NCI_STATUS_FAILED);
200
201    p->event            = BT_EVT_TO_NFC_NCI;
202    p->len              = NCI_MSG_HDR_SIZE + NCI_CORE_PARAM_SIZE_CON_CREATE;
203    p->offset           = NCI_MSG_OFFSET_SIZE;
204    p->layer_specific   = 0;
205    pp                  = (UINT8 *) (p + 1) + p->offset;
206
207    NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_CORE);
208    NCI_MSG_BLD_HDR1 (pp, NCI_MSG_CORE_CONN_CREATE);
209    UINT8_TO_STREAM (pp, size);
210    UINT8_TO_STREAM (pp, dest_type);
211    UINT8_TO_STREAM (pp, num_tlv);
212    if (tlv_size)
213    {
214        ARRAY_TO_STREAM (pp, p_param_tlvs, tlv_size);
215        p->len         += tlv_size;
216    }
217
218    nfc_ncif_send_cmd (p);
219    return (NCI_STATUS_OK);
220}
221
222/*******************************************************************************
223**
224** Function         nci_snd_core_conn_close
225**
226** Description      compose and send CORE CONN_CLOSE command to command queue
227**
228** Returns          status
229**
230*******************************************************************************/
231UINT8 nci_snd_core_conn_close (UINT8 conn_id)
232{
233    BT_HDR *p;
234    UINT8 *pp;
235
236    if ((p = NCI_GET_CMD_BUF (NCI_CORE_PARAM_SIZE_CON_CLOSE)) == NULL)
237        return (NCI_STATUS_FAILED);
238
239    p->event            = BT_EVT_TO_NFC_NCI;
240    p->len              = NCI_MSG_HDR_SIZE + NCI_CORE_PARAM_SIZE_CON_CLOSE;
241    p->offset           = NCI_MSG_OFFSET_SIZE;
242    p->layer_specific   = 0;
243    pp                  = (UINT8 *) (p + 1) + p->offset;
244
245    NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_CORE);
246    NCI_MSG_BLD_HDR1 (pp, NCI_MSG_CORE_CONN_CLOSE);
247    UINT8_TO_STREAM (pp, NCI_CORE_PARAM_SIZE_CON_CLOSE);
248    UINT8_TO_STREAM (pp, conn_id);
249
250    nfc_ncif_send_cmd (p);
251    return (NCI_STATUS_OK);
252}
253
254
255#if (NFC_NFCEE_INCLUDED == TRUE)
256#if (NFC_RW_ONLY == FALSE)
257/*******************************************************************************
258**
259** Function         nci_snd_nfcee_discover
260**
261** Description      compose and send NFCEE Management NFCEE_DISCOVER command
262**                  to command queue
263**
264** Returns          status
265**
266*******************************************************************************/
267UINT8 nci_snd_nfcee_discover (UINT8 discover_action)
268{
269    BT_HDR *p;
270    UINT8 *pp;
271
272    if ((p = NCI_GET_CMD_BUF (NCI_PARAM_SIZE_DISCOVER_NFCEE)) == NULL)
273        return (NCI_STATUS_FAILED);
274
275    p->event            = BT_EVT_TO_NFC_NCI;
276    p->len              = NCI_MSG_HDR_SIZE + NCI_PARAM_SIZE_DISCOVER_NFCEE;
277    p->offset           = NCI_MSG_OFFSET_SIZE;
278    p->layer_specific   = 0;
279    pp                  = (UINT8 *) (p + 1) + p->offset;
280
281    NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_EE_MANAGE);
282    NCI_MSG_BLD_HDR1 (pp, NCI_MSG_NFCEE_DISCOVER);
283    UINT8_TO_STREAM (pp, NCI_PARAM_SIZE_DISCOVER_NFCEE);
284    UINT8_TO_STREAM (pp, discover_action);
285
286    nfc_ncif_send_cmd (p);
287    return (NCI_STATUS_OK);
288}
289
290/*******************************************************************************
291**
292** Function         nci_snd_nfcee_mode_set
293**
294** Description      compose and send NFCEE Management NFCEE MODE SET command
295**                  to command queue
296**
297** Returns          status
298**
299*******************************************************************************/
300UINT8 nci_snd_nfcee_mode_set (UINT8 nfcee_id, UINT8 nfcee_mode)
301{
302    BT_HDR *p;
303    UINT8 *pp;
304
305    if ((p = NCI_GET_CMD_BUF (NCI_CORE_PARAM_SIZE_NFCEE_MODE_SET)) == NULL)
306        return (NCI_STATUS_FAILED);
307
308    p->event            = BT_EVT_TO_NFC_NCI;
309    p->len              = NCI_MSG_HDR_SIZE + NCI_CORE_PARAM_SIZE_NFCEE_MODE_SET;
310    p->offset           = NCI_MSG_OFFSET_SIZE;
311    p->layer_specific   = 0;
312    pp                  = (UINT8 *) (p + 1) + p->offset;
313
314    NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_EE_MANAGE);
315    NCI_MSG_BLD_HDR1 (pp, NCI_MSG_NFCEE_MODE_SET);
316    UINT8_TO_STREAM (pp, NCI_CORE_PARAM_SIZE_NFCEE_MODE_SET);
317    UINT8_TO_STREAM (pp, nfcee_id);
318    UINT8_TO_STREAM (pp, nfcee_mode);
319
320    nfc_ncif_send_cmd (p);
321    return (NCI_STATUS_OK);
322}
323#endif
324#endif
325
326/*******************************************************************************
327**
328** Function         nci_snd_discover_cmd
329**
330** Description      compose and send RF Management DISCOVER command to command queue
331**
332** Returns          status
333**
334*******************************************************************************/
335UINT8 nci_snd_discover_cmd (UINT8 num, tNCI_DISCOVER_PARAMS *p_param)
336{
337    BT_HDR *p;
338    UINT8 *pp, *p_size, *p_start;
339    int xx;
340    int size;
341
342    size   = num * sizeof (tNCI_DISCOVER_PARAMS) + 1;
343    if ((p = NCI_GET_CMD_BUF (size)) == NULL)
344        return (NCI_STATUS_FAILED);
345
346    p->event            = BT_EVT_TO_NFC_NCI;
347    p->offset           = NCI_MSG_OFFSET_SIZE;
348    p->layer_specific   = 0;
349    pp                  = (UINT8 *) (p + 1) + p->offset;
350
351    NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_RF_MANAGE);
352    NCI_MSG_BLD_HDR1 (pp, NCI_MSG_RF_DISCOVER);
353    p_size  = pp;
354    pp++;
355    p_start = pp;
356    UINT8_TO_STREAM (pp, num);
357    for (xx=0; xx<num; xx++)
358    {
359        UINT8_TO_STREAM (pp, p_param[xx].type);
360        UINT8_TO_STREAM (pp, p_param[xx].frequency);
361    }
362    *p_size = (UINT8) (pp - p_start);
363    p->len  = NCI_MSG_HDR_SIZE + *p_size;
364
365    nfc_ncif_send_cmd (p);
366    return (NCI_STATUS_OK);
367}
368
369/*******************************************************************************
370**
371** Function         nci_snd_discover_select_cmd
372**
373** Description      compose and send RF Management DISCOVER SELECT command
374**                  to command queue
375**
376** Returns          status
377**
378*******************************************************************************/
379UINT8 nci_snd_discover_select_cmd (UINT8 rf_disc_id, UINT8 protocol, UINT8 rf_interface)
380{
381    BT_HDR *p;
382    UINT8 *pp;
383
384    if ((p = NCI_GET_CMD_BUF (NCI_DISCOVER_PARAM_SIZE_SELECT)) == NULL)
385        return (NCI_STATUS_FAILED);
386
387    p->event            = BT_EVT_TO_NFC_NCI;
388    p->len              = NCI_MSG_HDR_SIZE + NCI_DISCOVER_PARAM_SIZE_SELECT;
389    p->offset           = NCI_MSG_OFFSET_SIZE;
390    p->layer_specific   = 0;
391    pp                  = (UINT8 *) (p + 1) + p->offset;
392
393    NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_RF_MANAGE);
394    NCI_MSG_BLD_HDR1 (pp, NCI_MSG_RF_DISCOVER_SELECT);
395    UINT8_TO_STREAM (pp, NCI_DISCOVER_PARAM_SIZE_SELECT);
396    UINT8_TO_STREAM (pp, rf_disc_id);
397    UINT8_TO_STREAM (pp, protocol);
398    UINT8_TO_STREAM (pp, rf_interface);
399
400    nfc_ncif_send_cmd (p);
401    return (NCI_STATUS_OK);
402}
403
404/*******************************************************************************
405**
406** Function         nci_snd_deactivate_cmd
407**
408** Description      compose and send RF Management DEACTIVATE command
409**                  to command queue
410**
411** Returns          status
412**
413*******************************************************************************/
414UINT8 nci_snd_deactivate_cmd (UINT8 de_act_type )
415{
416    BT_HDR *p;
417    UINT8 *pp;
418
419    if ((p = NCI_GET_CMD_BUF (NCI_DISCOVER_PARAM_SIZE_DEACT)) == NULL)
420        return (NCI_STATUS_FAILED);
421
422    p->event            = BT_EVT_TO_NFC_NCI;
423    p->len              = NCI_MSG_HDR_SIZE + NCI_DISCOVER_PARAM_SIZE_DEACT;
424    p->offset           = NCI_MSG_OFFSET_SIZE;
425    p->layer_specific   = 0;
426    pp                  = (UINT8 *) (p + 1) + p->offset;
427
428    NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_RF_MANAGE);
429    NCI_MSG_BLD_HDR1 (pp, NCI_MSG_RF_DEACTIVATE);
430    UINT8_TO_STREAM (pp, NCI_DISCOVER_PARAM_SIZE_DEACT);
431    UINT8_TO_STREAM (pp, de_act_type);
432
433    nfc_ncif_send_cmd (p);
434    return (NCI_STATUS_OK);
435}
436
437/*******************************************************************************
438**
439** Function         nci_snd_discover_map_cmd
440**
441** Description      compose and send RF Management DISCOVER MAP command
442**                  to command queue
443**
444** Returns          status
445**
446*******************************************************************************/
447UINT8 nci_snd_discover_map_cmd (UINT8 num, tNCI_DISCOVER_MAPS *p_maps)
448{
449    BT_HDR *p;
450    UINT8 *pp, *p_size, *p_start;
451    int xx;
452    int size;
453
454    size = num * sizeof (tNCI_DISCOVER_MAPS) + 1;
455
456    if ((p = NCI_GET_CMD_BUF (size)) == NULL)
457        return (NCI_STATUS_FAILED);
458
459    p->event            = BT_EVT_TO_NFC_NCI;
460    p->offset           = NCI_MSG_OFFSET_SIZE;
461    p->layer_specific   = 0;
462    pp                  = (UINT8 *) (p + 1) + p->offset;
463
464    NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_RF_MANAGE);
465    NCI_MSG_BLD_HDR1 (pp, NCI_MSG_RF_DISCOVER_MAP);
466    p_size  = pp;
467    pp++;
468    p_start = pp;
469    UINT8_TO_STREAM (pp, num);
470    for (xx = 0; xx < num; xx++)
471    {
472        UINT8_TO_STREAM (pp, p_maps[xx].protocol);
473        UINT8_TO_STREAM (pp, p_maps[xx].mode);
474        UINT8_TO_STREAM (pp, p_maps[xx].intf_type);
475    }
476    *p_size = (UINT8) (pp - p_start);
477    p->len  = NCI_MSG_HDR_SIZE + *p_size;
478    nfc_ncif_send_cmd (p);
479    return (NCI_STATUS_OK);
480}
481/*******************************************************************************
482**
483** Function         nci_snd_t3t_polling
484**
485** Description      compose and send RF Management T3T POLLING command
486**                  to command queue
487**
488** Returns          status
489**
490*******************************************************************************/
491UINT8 nci_snd_t3t_polling (UINT16 system_code, UINT8 rc, UINT8 tsn)
492{
493    BT_HDR *p;
494    UINT8 *pp;
495
496    if ((p = NCI_GET_CMD_BUF (NCI_RF_PARAM_SIZE_T3T_POLLING)) == NULL)
497        return (NCI_STATUS_FAILED);
498
499    p->event            = BT_EVT_TO_NFC_NCI;
500    p->len              = NCI_MSG_HDR_SIZE + NCI_RF_PARAM_SIZE_T3T_POLLING;
501    p->offset           = NCI_MSG_OFFSET_SIZE;
502    p->layer_specific   = 0;
503    pp                  = (UINT8 *) (p + 1) + p->offset;
504
505    NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_RF_MANAGE);
506    NCI_MSG_BLD_HDR1 (pp, NCI_MSG_RF_T3T_POLLING);
507    UINT8_TO_STREAM (pp, NCI_RF_PARAM_SIZE_T3T_POLLING);
508    UINT16_TO_BE_STREAM (pp, system_code);
509    UINT8_TO_STREAM (pp, rc);
510    UINT8_TO_STREAM (pp, tsn);
511
512    nfc_ncif_send_cmd (p);
513    return (NCI_STATUS_OK);
514}
515
516/*******************************************************************************
517**
518** Function         nci_snd_parameter_update_cmd
519**
520** Description      compose and send RF Management RF Communication Parameter
521**                  Update commandto command queue
522**
523** Returns          status
524**
525*******************************************************************************/
526UINT8 nci_snd_parameter_update_cmd (UINT8 *p_param_tlvs, UINT8 tlv_size)
527{
528    BT_HDR *p;
529    UINT8 *pp;
530    UINT8  num = 0, ulen, len, *pt;
531
532    if ((p = NCI_GET_CMD_BUF (tlv_size + 1)) == NULL)
533        return (NCI_STATUS_FAILED);
534
535    p->event    = BT_EVT_TO_NFC_NCI;
536    p->len      = NCI_MSG_HDR_SIZE + tlv_size + 1;
537    p->offset   = NCI_MSG_OFFSET_SIZE;
538    pp          = (UINT8 *) (p + 1) + p->offset;
539
540    NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_RF_MANAGE);
541    NCI_MSG_BLD_HDR1 (pp, NCI_MSG_RF_PARAMETER_UPDATE);
542    UINT8_TO_STREAM (pp, (UINT8) (tlv_size + 1));
543    len         = tlv_size;
544    pt          = p_param_tlvs;
545    while (len > 1)
546    {
547        len     -= 2;
548        pt++;
549        num++;
550        ulen     = *pt++;
551        pt      += ulen;
552        if (len >= ulen)
553        {
554            len -= ulen;
555        }
556        else
557        {
558            GKI_freebuf (p);
559            return NCI_STATUS_FAILED;
560        }
561    }
562
563    UINT8_TO_STREAM (pp, num);
564    ARRAY_TO_STREAM (pp, p_param_tlvs, tlv_size);
565    nfc_ncif_send_cmd (p);
566
567    return (NCI_STATUS_OK);
568}
569
570#if (NFC_NFCEE_INCLUDED == TRUE)
571#if (NFC_RW_ONLY == FALSE)
572/*******************************************************************************
573**
574** Function         nci_snd_set_routing_cmd
575**
576** Description      compose and send RF Management SET_LISTEN_MODE_ROUTING command
577**                  to command queue
578**
579** Returns          status
580**
581*******************************************************************************/
582UINT8 nci_snd_set_routing_cmd (BOOLEAN more, UINT8 target_handle, UINT8 num_tlv, UINT8 tlv_size, UINT8 *p_param_tlvs)
583{
584    BT_HDR *p;
585    UINT8 *pp;
586    UINT8 size = tlv_size + 2;
587
588    if (tlv_size == 0)
589    {
590        /* just to terminate routing table
591         * 2 bytes (more=FALSE and num routing entries=0) */
592        size = 2;
593    }
594
595    if ((p = NCI_GET_CMD_BUF(size)) == NULL)
596        return (NCI_STATUS_FAILED);
597
598    p->event            = BT_EVT_TO_NFC_NCI;
599    p->offset           = NCI_MSG_OFFSET_SIZE;
600    p->len              = NCI_MSG_HDR_SIZE + size;
601    p->layer_specific   = 0;
602    pp                  = (UINT8 *) (p + 1) + p->offset;
603
604    NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_RF_MANAGE);
605    NCI_MSG_BLD_HDR1 (pp, NCI_MSG_RF_SET_ROUTING);
606    UINT8_TO_STREAM (pp, size);
607    UINT8_TO_STREAM (pp, more);
608    if (size == 2)
609    {
610        UINT8_TO_STREAM (pp, 0);
611    }
612    else
613    {
614        UINT8_TO_STREAM (pp, num_tlv);
615        ARRAY_TO_STREAM (pp, p_param_tlvs, tlv_size);
616    }
617    nfc_ncif_send_cmd (p);
618
619    return (NCI_STATUS_OK);
620}
621
622/*******************************************************************************
623**
624** Function         nci_snd_get_routing_cmd
625**
626** Description      compose and send RF Management GET_LISTEN_MODE_ROUTING command
627**                  to command queue
628**
629** Returns          status
630**
631*******************************************************************************/
632UINT8 nci_snd_get_routing_cmd (void)
633{
634    BT_HDR *p;
635    UINT8 *pp;
636    UINT8   param_size = 0;
637
638    if ((p = NCI_GET_CMD_BUF (param_size)) == NULL)
639        return (NCI_STATUS_FAILED);
640
641    p->event            = BT_EVT_TO_NFC_NCI;
642    p->len              = NCI_MSG_HDR_SIZE + param_size;
643    p->offset           = NCI_MSG_OFFSET_SIZE;
644    p->layer_specific   = 0;
645    pp                  = (UINT8 *) (p + 1) + p->offset;
646
647    NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_RF_MANAGE);
648    NCI_MSG_BLD_HDR1 (pp, NCI_MSG_RF_GET_ROUTING);
649    UINT8_TO_STREAM (pp, param_size);
650
651    nfc_ncif_send_cmd (p);
652    return (NCI_STATUS_OK);
653}
654#endif
655#endif
656
657
658#endif /* NFC_INCLUDED == TRUE*/
659