1 /****************************************************************************** 2 * 3 * Copyright (C) 1999-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 the PORT API definitions 22 * 23 ******************************************************************************/ 24 #ifndef PORT_API_H 25 #define PORT_API_H 26 27 #include "bt_target.h" 28 29 /***************************************************************************** 30 * Constants and Types 31 ****************************************************************************/ 32 33 /* 34 * Define port settings structure send from the application in the 35 * set settings request, or to the application in the set settings indication. 36 */ 37 typedef struct { 38 #define PORT_BAUD_RATE_2400 0x00 39 #define PORT_BAUD_RATE_4800 0x01 40 #define PORT_BAUD_RATE_7200 0x02 41 #define PORT_BAUD_RATE_9600 0x03 42 #define PORT_BAUD_RATE_19200 0x04 43 #define PORT_BAUD_RATE_38400 0x05 44 #define PORT_BAUD_RATE_57600 0x06 45 #define PORT_BAUD_RATE_115200 0x07 46 #define PORT_BAUD_RATE_230400 0x08 47 48 uint8_t baud_rate; 49 50 #define PORT_5_BITS 0x00 51 #define PORT_6_BITS 0x01 52 #define PORT_7_BITS 0x02 53 #define PORT_8_BITS 0x03 54 55 uint8_t byte_size; 56 57 #define PORT_ONESTOPBIT 0x00 58 #define PORT_ONE5STOPBITS 0x01 59 uint8_t stop_bits; 60 61 #define PORT_PARITY_NO 0x00 62 #define PORT_PARITY_YES 0x01 63 uint8_t parity; 64 65 #define PORT_ODD_PARITY 0x00 66 #define PORT_EVEN_PARITY 0x01 67 #define PORT_MARK_PARITY 0x02 68 #define PORT_SPACE_PARITY 0x03 69 70 uint8_t parity_type; 71 72 #define PORT_FC_OFF 0x00 73 #define PORT_FC_XONXOFF_ON_INPUT 0x01 74 #define PORT_FC_XONXOFF_ON_OUTPUT 0x02 75 #define PORT_FC_CTS_ON_INPUT 0x04 76 #define PORT_FC_CTS_ON_OUTPUT 0x08 77 #define PORT_FC_DSR_ON_INPUT 0x10 78 #define PORT_FC_DSR_ON_OUTPUT 0x20 79 80 uint8_t fc_type; 81 82 uint8_t rx_char1; 83 84 #define PORT_XON_DC1 0x11 85 uint8_t xon_char; 86 87 #define PORT_XOFF_DC3 0x13 88 uint8_t xoff_char; 89 90 } tPORT_STATE; 91 92 /* 93 * Define the callback function prototypes. Parameters are specific 94 * to each event and are described bellow 95 */ 96 typedef int(tPORT_DATA_CALLBACK)(uint16_t port_handle, void* p_data, 97 uint16_t len); 98 99 #define DATA_CO_CALLBACK_TYPE_INCOMING 1 100 #define DATA_CO_CALLBACK_TYPE_OUTGOING_SIZE 2 101 #define DATA_CO_CALLBACK_TYPE_OUTGOING 3 102 typedef int(tPORT_DATA_CO_CALLBACK)(uint16_t port_handle, uint8_t* p_buf, 103 uint16_t len, int type); 104 105 typedef void(tPORT_CALLBACK)(uint32_t code, uint16_t port_handle); 106 107 /* 108 * Define events that registered application can receive in the callback 109 */ 110 111 #define PORT_EV_RXCHAR 0x00000001 /* Any Character received */ 112 #define PORT_EV_RXFLAG 0x00000002 /* Received certain character */ 113 #define PORT_EV_TXEMPTY 0x00000004 /* Transmitt Queue Empty */ 114 #define PORT_EV_CTS 0x00000008 /* CTS changed state */ 115 #define PORT_EV_DSR 0x00000010 /* DSR changed state */ 116 #define PORT_EV_RLSD 0x00000020 /* RLSD changed state */ 117 #define PORT_EV_BREAK 0x00000040 /* BREAK received */ 118 #define PORT_EV_ERR 0x00000080 /* Line status error occurred */ 119 #define PORT_EV_RING 0x00000100 /* Ring signal detected */ 120 #define PORT_EV_CTSS 0x00000400 /* CTS state */ 121 #define PORT_EV_DSRS 0x00000800 /* DSR state */ 122 #define PORT_EV_RLSDS 0x00001000 /* RLSD state */ 123 #define PORT_EV_OVERRUN 0x00002000 /* receiver buffer overrun */ 124 #define PORT_EV_TXCHAR 0x00004000 /* Any character transmitted */ 125 126 /* RFCOMM connection established */ 127 #define PORT_EV_CONNECTED 0x00000200 128 /* Unable to establish connection or disconnected */ 129 #define PORT_EV_CONNECT_ERR 0x00008000 130 /* data flow enabled flag changed by remote */ 131 #define PORT_EV_FC 0x00010000 132 /* data flow enable status true = enabled */ 133 #define PORT_EV_FCS 0x00020000 134 135 /* 136 * To register for events application should provide bitmask with 137 * corresponding bit set 138 */ 139 140 #define PORT_MASK_ALL \ 141 (PORT_EV_RXCHAR | PORT_EV_TXEMPTY | PORT_EV_CTS | PORT_EV_DSR | \ 142 PORT_EV_RLSD | PORT_EV_BREAK | PORT_EV_ERR | PORT_EV_RING | \ 143 PORT_EV_CONNECT_ERR | PORT_EV_DSRS | PORT_EV_CTSS | PORT_EV_RLSDS | \ 144 PORT_EV_RXFLAG | PORT_EV_TXCHAR | PORT_EV_OVERRUN | PORT_EV_FC | \ 145 PORT_EV_FCS | PORT_EV_CONNECTED) 146 147 /* 148 * Define port result codes 149 */ 150 #define PORT_SUCCESS 0 151 152 #define PORT_ERR_BASE 0 153 154 #define PORT_UNKNOWN_ERROR (PORT_ERR_BASE + 1) 155 #define PORT_ALREADY_OPENED (PORT_ERR_BASE + 2) 156 #define PORT_CMD_PENDING (PORT_ERR_BASE + 3) 157 #define PORT_APP_NOT_REGISTERED (PORT_ERR_BASE + 4) 158 #define PORT_NO_MEM (PORT_ERR_BASE + 5) 159 #define PORT_NO_RESOURCES (PORT_ERR_BASE + 6) 160 #define PORT_BAD_BD_ADDR (PORT_ERR_BASE + 7) 161 #define PORT_BAD_HANDLE (PORT_ERR_BASE + 9) 162 #define PORT_NOT_OPENED (PORT_ERR_BASE + 10) 163 #define PORT_LINE_ERR (PORT_ERR_BASE + 11) 164 #define PORT_START_FAILED (PORT_ERR_BASE + 12) 165 #define PORT_PAR_NEG_FAILED (PORT_ERR_BASE + 13) 166 #define PORT_PORT_NEG_FAILED (PORT_ERR_BASE + 14) 167 #define PORT_SEC_FAILED (PORT_ERR_BASE + 15) 168 #define PORT_PEER_CONNECTION_FAILED (PORT_ERR_BASE + 16) 169 #define PORT_PEER_FAILED (PORT_ERR_BASE + 17) 170 #define PORT_PEER_TIMEOUT (PORT_ERR_BASE + 18) 171 #define PORT_CLOSED (PORT_ERR_BASE + 19) 172 #define PORT_TX_FULL (PORT_ERR_BASE + 20) 173 #define PORT_LOCAL_CLOSED (PORT_ERR_BASE + 21) 174 #define PORT_LOCAL_TIMEOUT (PORT_ERR_BASE + 22) 175 #define PORT_TX_QUEUE_DISABLED (PORT_ERR_BASE + 23) 176 #define PORT_PAGE_TIMEOUT (PORT_ERR_BASE + 24) 177 #define PORT_INVALID_SCN (PORT_ERR_BASE + 25) 178 179 #define PORT_ERR_MAX (PORT_ERR_BASE + 26) 180 181 /***************************************************************************** 182 * External Function Declarations 183 ****************************************************************************/ 184 185 /******************************************************************************* 186 * 187 * Function RFCOMM_CreateConnection 188 * 189 * Description RFCOMM_CreateConnection is used from the application to 190 * establish a serial port connection to the peer device, 191 * or allow RFCOMM to accept a connection from the peer 192 * application. 193 * 194 * Parameters: scn - Service Channel Number as registered with 195 * the SDP (server) or obtained using SDP from 196 * the peer device (client). 197 * is_server - true if requesting application is a server 198 * mtu - Maximum frame size the application can accept 199 * bd_addr - address of the peer (client) 200 * mask - specifies events to be enabled. A value 201 * of zero disables all events. 202 * p_handle - OUT pointer to the handle. 203 * p_mgmt_cb - pointer to callback function to receive 204 * connection up/down events. 205 * Notes: 206 * 207 * Server can call this function with the same scn parameter multiple times if 208 * it is ready to accept multiple simulteneous connections. 209 * 210 * DLCI for the connection is (scn * 2 + 1) if client originates connection on 211 * existing none initiator multiplexer channel. Otherwise it is (scn * 2). 212 * For the server DLCI can be changed later if client will be calling it using 213 * (scn * 2 + 1) dlci. 214 * 215 ******************************************************************************/ 216 extern int RFCOMM_CreateConnection(uint16_t uuid, uint8_t scn, bool is_server, 217 uint16_t mtu, const RawAddress& bd_addr, 218 uint16_t* p_handle, 219 tPORT_CALLBACK* p_mgmt_cb); 220 221 /******************************************************************************* 222 * 223 * Function RFCOMM_RemoveConnection 224 * 225 * Description This function is called to close the specified connection. 226 * 227 * Parameters: handle - Handle of the port returned in the Open 228 * 229 ******************************************************************************/ 230 extern int RFCOMM_RemoveConnection(uint16_t handle); 231 232 /******************************************************************************* 233 * 234 * Function RFCOMM_RemoveServer 235 * 236 * Description This function is called to close the server port. 237 * 238 * Parameters: handle - Handle returned in the RFCOMM_CreateConnection 239 * 240 ******************************************************************************/ 241 extern int RFCOMM_RemoveServer(uint16_t handle); 242 243 /******************************************************************************* 244 * 245 * Function PORT_SetEventCallback 246 * 247 * Description Set event callback the specified connection. 248 * 249 * Parameters: handle - Handle of the port returned in the Open 250 * p_callback - address of the callback function which should 251 * be called from the RFCOMM when an event 252 * specified in the mask occurs. 253 * 254 ******************************************************************************/ 255 extern int PORT_SetEventCallback(uint16_t port_handle, 256 tPORT_CALLBACK* p_port_cb); 257 258 /******************************************************************************* 259 * 260 * Function PORT_ClearKeepHandleFlag 261 * 262 * Description Called to clear the keep handle flag, which will cause 263 * not to keep the port handle open when closed 264 * 265 * Parameters: handle - Handle returned in the RFCOMM_CreateConnection 266 * 267 ******************************************************************************/ 268 int PORT_ClearKeepHandleFlag(uint16_t port_handle); 269 270 /******************************************************************************* 271 * 272 * Function PORT_SetEventCallback 273 * 274 * Description Set event data callback the specified connection. 275 * 276 * Parameters: handle - Handle of the port returned in the Open 277 * p_callback - address of the callback function which should 278 * be called from the RFCOMM when a data 279 * packet is received. 280 * 281 ******************************************************************************/ 282 extern int PORT_SetDataCallback(uint16_t port_handle, 283 tPORT_DATA_CALLBACK* p_cb); 284 285 extern int PORT_SetDataCOCallback(uint16_t port_handle, 286 tPORT_DATA_CO_CALLBACK* p_port_cb); 287 /******************************************************************************* 288 * 289 * Function PORT_SetEventMask 290 * 291 * Description This function is called to close the specified connection. 292 * 293 * Parameters: handle - Handle of the port returned in the Open 294 * mask - specifies events to be enabled. A value 295 * of zero disables all events. 296 * 297 ******************************************************************************/ 298 extern int PORT_SetEventMask(uint16_t port_handle, uint32_t mask); 299 300 /******************************************************************************* 301 * 302 * Function PORT_CheckConnection 303 * 304 * Description This function returns PORT_SUCCESS if connection referenced 305 * by handle is up and running 306 * 307 * Parameters: handle - Handle of the port returned in the Open 308 * bd_addr - OUT bd_addr of the peer 309 * p_lcid - OUT L2CAP's LCID 310 * 311 ******************************************************************************/ 312 extern int PORT_CheckConnection(uint16_t handle, RawAddress& bd_addr, 313 uint16_t* p_lcid); 314 315 /******************************************************************************* 316 * 317 * Function PORT_IsOpening 318 * 319 * Description This function returns true if there is any RFCOMM connection 320 * opening in process. 321 * 322 * Parameters: true if any connection opening is found 323 * bd_addr - bd_addr of the peer 324 * 325 ******************************************************************************/ 326 extern bool PORT_IsOpening(RawAddress& bd_addr); 327 328 /******************************************************************************* 329 * 330 * Function PORT_SetState 331 * 332 * Description This function configures connection according to the 333 * specifications in the tPORT_STATE structure. 334 * 335 * Parameters: handle - Handle returned in the RFCOMM_CreateConnection 336 * p_settings - Pointer to a tPORT_STATE structure containing 337 * configuration information for the connection. 338 * 339 ******************************************************************************/ 340 extern int PORT_SetState(uint16_t handle, tPORT_STATE* p_settings); 341 342 /******************************************************************************* 343 * 344 * Function PORT_GetRxQueueCnt 345 * 346 * Description This function return number of buffers on the rx queue. 347 * 348 * Parameters: handle - Handle returned in the RFCOMM_CreateConnection 349 * p_rx_queue_count - Pointer to return queue count in. 350 * 351 ******************************************************************************/ 352 extern int PORT_GetRxQueueCnt(uint16_t handle, uint16_t* p_rx_queue_count); 353 354 /******************************************************************************* 355 * 356 * Function PORT_GetState 357 * 358 * Description This function is called to fill tPORT_STATE structure 359 * with the current control settings for the port 360 * 361 * Parameters: handle - Handle returned in the RFCOMM_CreateConnection 362 * p_settings - Pointer to a tPORT_STATE structure in which 363 * configuration information is returned. 364 * 365 ******************************************************************************/ 366 extern int PORT_GetState(uint16_t handle, tPORT_STATE* p_settings); 367 368 /******************************************************************************* 369 * 370 * Function PORT_Control 371 * 372 * Description This function directs a specified connection to pass control 373 * control information to the peer device. 374 * 375 * Parameters: handle - Handle returned in the RFCOMM_CreateConnection 376 * signal - specify the function to be passed 377 * 378 ******************************************************************************/ 379 #define PORT_SET_DTRDSR 0x01 380 #define PORT_CLR_DTRDSR 0x02 381 #define PORT_SET_CTSRTS 0x03 382 #define PORT_CLR_CTSRTS 0x04 383 #define PORT_SET_RI 0x05 /* DCE only */ 384 #define PORT_CLR_RI 0x06 /* DCE only */ 385 #define PORT_SET_DCD 0x07 /* DCE only */ 386 #define PORT_CLR_DCD 0x08 /* DCE only */ 387 #define PORT_BREAK 0x09 /* Break event */ 388 389 extern int PORT_Control(uint16_t handle, uint8_t signal); 390 391 /******************************************************************************* 392 * 393 * Function PORT_FlowControl 394 * 395 * Description This function directs a specified connection to pass 396 * flow control message to the peer device. Enable flag passed 397 * shows if port can accept more data. 398 * 399 * Parameters: handle - Handle returned in the RFCOMM_CreateConnection 400 * enable - enables data flow 401 * 402 ******************************************************************************/ 403 extern int PORT_FlowControl(uint16_t handle, bool enable); 404 405 /******************************************************************************* 406 * 407 * Function PORT_FlowControl_MaxCredit 408 * 409 * Description This function directs a specified connection to pass 410 * flow control message to the peer device. Enable flag passed 411 * shows if port can accept more data. It also sends max credit 412 * when data flow enabled 413 * 414 * Parameters: handle - Handle returned in the RFCOMM_CreateConnection 415 * enable - enables data flow 416 * 417 ******************************************************************************/ 418 extern int PORT_FlowControl_MaxCredit(uint16_t handle, bool enable); 419 420 /******************************************************************************* 421 * 422 * Function PORT_GetModemStatus 423 * 424 * Description This function retrieves modem control signals. Normally 425 * application will call this function after a callback 426 * function is called with notification that one of signals 427 * has been changed. 428 * 429 * Parameters: handle - Handle returned in the RFCOMM_CreateConnection 430 * callback. 431 * p_signal - specify the pointer to control signals info 432 * 433 ******************************************************************************/ 434 #define PORT_DTRDSR_ON 0x01 435 #define PORT_CTSRTS_ON 0x02 436 #define PORT_RING_ON 0x04 437 #define PORT_DCD_ON 0x08 438 439 /* 440 * Define default initial local modem signals state after connection established 441 */ 442 #define PORT_OBEX_DEFAULT_SIGNAL_STATE \ 443 (PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON) 444 #define PORT_SPP_DEFAULT_SIGNAL_STATE \ 445 (PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON) 446 #define PORT_PPP_DEFAULT_SIGNAL_STATE \ 447 (PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON) 448 #define PORT_DUN_DEFAULT_SIGNAL_STATE (PORT_DTRDSR_ON | PORT_CTSRTS_ON) 449 450 extern int PORT_GetModemStatus(uint16_t handle, uint8_t* p_control_signal); 451 452 /******************************************************************************* 453 * 454 * Function PORT_ClearError 455 * 456 * Description This function retreives information about a communications 457 * error and reports current status of a connection. The 458 * function should be called when an error occures to clear 459 * the connection error flag and to enable additional read 460 * and write operations. 461 * 462 * Parameters: handle - Handle returned in the RFCOMM_CreateConnection 463 * p_errors - pointer of the variable to receive error codes 464 * p_status - pointer to the tPORT_STATUS structur to receive 465 * connection status 466 * 467 ******************************************************************************/ 468 469 #define PORT_ERR_BREAK 0x01 /* Break condition occured on the peer device */ 470 #define PORT_ERR_OVERRUN 0x02 /* Overrun is reported by peer device */ 471 #define PORT_ERR_FRAME 0x04 /* Framing error reported by peer device */ 472 #define PORT_ERR_RXOVER 0x08 /* Input queue overflow occured */ 473 #define PORT_ERR_TXFULL 0x10 /* Output queue overflow occured */ 474 475 typedef struct { 476 #define PORT_FLAG_CTS_HOLD 0x01 /* Tx is waiting for CTS signal */ 477 #define PORT_FLAG_DSR_HOLD 0x02 /* Tx is waiting for DSR signal */ 478 #define PORT_FLAG_RLSD_HOLD 0x04 /* Tx is waiting for RLSD signal */ 479 480 uint16_t flags; 481 uint16_t in_queue_size; /* Number of bytes in the input queue */ 482 uint16_t out_queue_size; /* Number of bytes in the output queue */ 483 uint16_t mtu_size; /* peer MTU size */ 484 } tPORT_STATUS; 485 486 extern int PORT_ClearError(uint16_t handle, uint16_t* p_errors, 487 tPORT_STATUS* p_status); 488 489 /******************************************************************************* 490 * 491 * Function PORT_SendError 492 * 493 * Description This function send a communications error to the peer device 494 * 495 * Parameters: handle - Handle returned in the RFCOMM_CreateConnection 496 * errors - receive error codes 497 * 498 ******************************************************************************/ 499 extern int PORT_SendError(uint16_t handle, uint8_t errors); 500 501 /******************************************************************************* 502 * 503 * Function PORT_GetQueueStatus 504 * 505 * Description This function reports current status of a connection. 506 * 507 * Parameters: handle - Handle returned in the RFCOMM_CreateConnection 508 * p_status - pointer to the tPORT_STATUS structur to receive 509 * connection status 510 * 511 ******************************************************************************/ 512 extern int PORT_GetQueueStatus(uint16_t handle, tPORT_STATUS* p_status); 513 514 /******************************************************************************* 515 * 516 * Function PORT_Purge 517 * 518 * Description This function discards all the data from the output or 519 * input queues of the specified connection. 520 * 521 * Parameters: handle - Handle returned in the RFCOMM_CreateConnection 522 * purge_flags - specify the action to take. 523 * 524 ******************************************************************************/ 525 #define PORT_PURGE_TXCLEAR 0x01 526 #define PORT_PURGE_RXCLEAR 0x02 527 528 extern int PORT_Purge(uint16_t handle, uint8_t purge_flags); 529 530 /******************************************************************************* 531 * 532 * Function PORT_Read 533 * 534 * Description This function returns the pointer to the buffer received 535 * from the peer device. Normally application will call this 536 * function after receiving PORT_EVT_RXCHAR event. 537 * Application calling this function is responsible to free 538 * buffer returned. 539 * 540 * Parameters: handle - Handle returned in the RFCOMM_CreateConnection 541 * callback. 542 * pp_buf - pointer to address of buffer with data, 543 * 544 ******************************************************************************/ 545 extern int PORT_Read(uint16_t handle, BT_HDR** pp_buf); 546 547 /******************************************************************************* 548 * 549 * Function PORT_ReadData 550 * 551 * Description Normally application will call this function after receiving 552 * PORT_EVT_RXCHAR event. 553 * 554 * Parameters: handle - Handle returned in the RFCOMM_CreateConnection 555 * callback. 556 * p_data - Data area 557 * max_len - Byte count requested 558 * p_len - Byte count received 559 * 560 ******************************************************************************/ 561 extern int PORT_ReadData(uint16_t handle, char* p_data, uint16_t max_len, 562 uint16_t* p_len); 563 564 /******************************************************************************* 565 * 566 * Function PORT_Write 567 * 568 * Description This function to send BT buffer to the peer device. 569 * Application should not free the buffer. 570 * 571 * Parameters: handle - Handle returned in the RFCOMM_CreateConnection 572 * p_buf - pointer to the buffer with data, 573 * 574 ******************************************************************************/ 575 extern int PORT_Write(uint16_t handle, BT_HDR* p_buf); 576 577 /******************************************************************************* 578 * 579 * Function PORT_WriteData 580 * 581 * Description This function is called from the legacy application to 582 * send data. 583 * 584 * Parameters: handle - Handle returned in the RFCOMM_CreateConnection 585 * p_data - Data area 586 * max_len - Byte count to write 587 * p_len - Bytes written 588 * 589 ******************************************************************************/ 590 extern int PORT_WriteData(uint16_t handle, const char* p_data, uint16_t max_len, 591 uint16_t* p_len); 592 593 /******************************************************************************* 594 * 595 * Function PORT_WriteDataCO 596 * 597 * Description Normally not GKI aware application will call this function 598 * to send data to the port by callout functions. 599 * 600 * Parameters: handle - Handle returned in the RFCOMM_CreateConnection 601 * 602 ******************************************************************************/ 603 extern int PORT_WriteDataCO(uint16_t handle, int* p_len); 604 605 /******************************************************************************* 606 * 607 * Function PORT_Test 608 * 609 * Description Application can call this function to send RFCOMM Test frame 610 * 611 * Parameters: handle - Handle returned in the RFCOMM_CreateConnection 612 * p_data - Data area 613 * max_len - Byte count requested 614 * 615 ******************************************************************************/ 616 extern int PORT_Test(uint16_t handle, uint8_t* p_data, uint16_t len); 617 618 /******************************************************************************* 619 * 620 * Function RFCOMM_Init 621 * 622 * Description This function is called to initialize RFCOMM layer 623 * 624 ******************************************************************************/ 625 extern void RFCOMM_Init(void); 626 627 /******************************************************************************* 628 * 629 * Function PORT_SetTraceLevel 630 * 631 * Description Set the trace level for RFCOMM. If called with 632 * a value of 0xFF, it simply reads the current trace level. 633 * 634 * Returns the new (current) trace level 635 * 636 ******************************************************************************/ 637 extern uint8_t PORT_SetTraceLevel(uint8_t new_level); 638 639 /******************************************************************************* 640 * 641 * Function PORT_GetResultString 642 * 643 * Description This function returns the human-readable string for a given 644 * result code. 645 * 646 * Returns a pointer to the human-readable string for the given 647 * result. Note that the string returned must not be freed. 648 * 649 ******************************************************************************/ 650 extern const char* PORT_GetResultString(const uint8_t result_code); 651 652 #endif /* PORT_API_H */ 653