/usr/include/x86_64-linux-gnu/aj_serio.h is in liballjoyntcl-dev-1504 15.04b-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | #ifndef _AJ_SERIO_H
#define _AJ_SERIO_H
/**
* @file aj_serio.h
* @defgroup aj_serio Serial Input/Output
* @{
*/
/******************************************************************************
* Copyright AllSeen Alliance. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************************/
#include "aj_target.h"
#include "aj_status.h"
#ifdef __cplusplus
extern "C" {
#endif
#define AJ_SERIO_RX 1 /**< The receive direction (from the wire) of the serial I/O subsystem */
#define AJ_SERIO_TX 2 /**< The transmit direction (to the wire) of the serial I/O subsystem */
/**
* A type for managing serial port configuration
*/
typedef struct _AJ_SerIOConfig {
uint32_t bitrate; /**< bitrate of the port */
uint8_t bits; /**< The number of data bits */
uint8_t stopBits; /**< The number of stop bits */
uint8_t parity; /**< Zero disables parity checking, one means odd and two means even parity */
void* config; /**< Abstracted context for device/platform specific configuration items */
} AJ_SerIOConfig;
/**
* @brief Enable or disable the Serial I/O Subsystem to send or receive frames
*
* The serial I/O subsystem will not begin sending or receiving data until it
* is explicitly told to. This allows for orderly bring-up and shutdown of the
* system.
*
* @param direction Provide AJ_SERIO_RX for the receiver section, AJ_SERIO_TX for the transmitter.
* @param enable Provide true to enable the section, false to disable.
*
* @return
* - AJ_OK If the serial operation completed successfully
*/
AJ_Status AJ_SerialIOEnable(uint32_t direction, uint8_t enable);
/**
* @brief Shutdown the Serial I/O Subsystem
*
* Disable the serial I/O subsystem and return all buffers to the client with
* an appropriated error code. An implied disable of the transmit and receive
* side is done during shutdown.
*/
AJ_Status AJ_SerialIOShutdown(void);
/**
* Function pointer type for an abstracted receive callback function
*
* @param buf The buffer that has a new frame read into it
* @param len The number of bytes actually read
*/
typedef void (*AJ_SerIORxCompleteFunc)(uint8_t* buf, uint16_t len);
/**
* Function pointer type for an abstracted transmit callback function
*
* @param buf The buffer that has had its bytes transmitted out
* @param len The number of bytes actually written
*/
typedef void (*AJ_SerIOTxCompleteFunc)(uint8_t* buf, uint16_t len);
/**
* Function pointer type for an abstracted serial transmit function
*
* @param buf The buffer to be transmitted
* @param len The number of bytes to write
*/
typedef void (*AJ_SerialTxFunc)(uint8_t* buf, uint32_t len);
/**
* @brief Initialize the Serial I/O Subsystem
*
* Given a serial IO config structure as a guide, initialize the serial I/O
* subsystem. Not all combinations of bitrate, data bits and stopbits will be
* legal. Limitations due to the configurability apply.
*
* @param config The configuration to use. NULL implies use a default setting.
* @param rx_cb The function to call when a complete SLIP frame is received
* @param tx_cb The function to call when a frame has been completely transmitted
*
* @return
* - AJ_OK if the serial subsystem was successfully initialized
* - AJ_ERR_UNEXPECTED if one of the parameters is not supported
*/
AJ_Status AJ_SerialIOInit(AJ_SerIOConfig* config);
void AJ_SetRxCB(AJ_SerIORxCompleteFunc rx_cb);
void AJ_SetTxCB(AJ_SerIOTxCompleteFunc tx_cb);
void AJ_SetTxSerialTransmit(AJ_SerialTxFunc tx_func);
void AJ_RX(uint8_t* buf, uint32_t len);
void AJ_PauseRX();
void AJ_ResumeRX();
void AJ_TX(uint8_t* buf, uint32_t len);
void AJ_PauseTX();
void AJ_ResumeTX();
#ifdef __cplusplus
}
#endif
/**
* @}
*/
#endif /* _AJ_SERIO_H */
|