Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | /* uart.h - Nordic BLE UART based Bluetooth driver */
/*
* Copyright (c) 2015-2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* IPC Uart power management driver.
*/
extern struct driver ipc_uart_ns16550_driver;
int nble_open(void);
/**
* This function triggers the sending of PDU buffer over UART.
*
* This constructs an IPC message header and triggers the sending of it and
* message buffer. If a transmission is already ongoing, it will fail.
* In this case upper layer needs to queue the message buffer.
*
* @param dev structure of the opened device
* @param handle structure of opened IPC uart channel
* @param len length of message to send
* @param p_data message buffer to send
*
* @return IPC_UART_ERROR_OK TX has been initiated, IPC_UART_TX_BUSY a
* transmission is already going, message needs to be queued
*
* @note This function needs to be executed with (UART) irq off to avoid
* preemption from uart_ipc_isr causing state variable corruption.
* It also called from uart_ipc_isr() to send the next IPC message.
*/
int ipc_uart_ns16550_send_pdu(struct device *dev, void *handle, int len,
void *p_data);
/**
* This function registers a callback function being called on TX start/end.
*
* This constructs an IPC message header and triggers the sending of it and
* message buffer. If a transmission is already ongoing, it will fail. In
* this case upper layer needs to queue the message buffer.
*
* @param dev structure of the opened device
* @param cb callback function for OOB sleep mode handling called at tx start
* and end
* @param param parameter passed to cb when being called
*/
void ipc_uart_ns16550_set_tx_cb(struct device *dev, void (*cb)(bool, void*),
void *param);
/**
* Opens a UART channel for QRK/BLE Core IPC, and defines the callback function
* for receiving IPC messages.
*
* @param channel IPC channel ID to use
* @param cb Callback to handle messages
*
* @return
* - Pointer to channel structure if success,
* - NULL if opening fails.
*/
void *ipc_uart_channel_open(int channel, int (*cb)(int chan, int request,
int len, void *data));
/**
* The frame is a message.
*/
#define IPC_MSG_TYPE_MESSAGE 0x1
/**
* Requests to free a message.
*/
#define IPC_MSG_TYPE_FREE 0x2
/**
* Sets the MessageBox as synchronized.
*/
#define IPC_MSG_TYPE_SYNC 0x3
/**
* Allocates a port.
*
* This request is always flowing from a slave to the master.
*/
#define IPC_REQUEST_ALLOC_PORT 0x10
/**
* Registers a service.
*
* This request is always flowing from a slave to the master.
*/
#define IPC_REQUEST_REGISTER_SERVICE 0x11
/**
* Unregisters a service.
*/
#define IPC_REQUEST_DEREGISTER_SERVICE 0x12
/**
* The message is for test commands engine.
*/
#define IPC_REQUEST_REG_TCMD_ENGINE 0x13
/**
* Registers a Service Manager Proxy to the Service Manager.
*
* This request always flow from a slave to the master.
*/
#define IPC_REQUEST_REGISTER_PROXY 0x14
/**
* Notifies a panic (for log dump).
*/
#define IPC_PANIC_NOTIFICATION 0x15
/**
* The message is for power management.
*/
#define IPC_REQUEST_POWER_MANAGEMENT 0x16
/**
* Sends the log of a slave to the master (for log aggregation).
*/
#define IPC_REQUEST_LOGGER 0x17
/**
* The message is for power management (deep sleep).
*/
#define IPC_REQUEST_INFRA_PM 0x18
|