Skip to content

Commit

Permalink
Update to DP5
Browse files Browse the repository at this point in the history
Change-Id: I80a710287573a4698bd5ce5c6897ce8c18ca1c32
  • Loading branch information
mangini committed Aug 10, 2017
1 parent fbec25a commit ce7845d
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 15 deletions.
2 changes: 1 addition & 1 deletion BUILD_NUMBER
@@ -1 +1 @@
nyc-iot-release@4098522 NIH40K
OIR1.170720.015
44 changes: 38 additions & 6 deletions armeabi-v7a/include/pio/i2s_device.h
Expand Up @@ -29,12 +29,18 @@ __BEGIN_DECLS
/// @{

/// Possible encodings
typedef enum APcmEncoding {
APCM_ENCODING_8_BIT,
APCM_ENCODING_16_BIT,
APCM_ENCODING_24_BIT,
APCM_ENCODING_32_BIT
} APcmEncoding;
typedef enum AI2sEncoding {
AI2S_ENCODING_PCM_8_BIT,
AI2S_ENCODING_PCM_16_BIT,
AI2S_ENCODING_PCM_24_BIT,
AI2S_ENCODING_PCM_32_BIT
} AI2sEncoding;

/// Flags to specify I2s bus direction.
typedef enum AI2sFlags {
AI2S_FLAG_DIRECTION_IN = 1 << 0,
AI2S_FLAG_DIRECTION_OUT = 1 << 1
} AI2sFlags;

typedef struct AI2sDevice AI2sDevice;

Expand All @@ -61,6 +67,32 @@ int AI2sDevice_write(const AI2sDevice* i2s,
int AI2sDevice_read(
const AI2sDevice* i2s, void* data, int offset, int size, int* bytes_read);

/// Gets the timestamp when a specific sample entered the kernel.
/// @param i2s Pointer to the AI2s struct.
/// @param frame_position Output indicating number of frames read.
/// @param nano_time Output indicating time (ns) when the frame was read.
/// @param success Output indicating success (1) or failure (0).
/// @return 0 on success, errno on error. This will only be nonzero on a fatal
/// error such as the I2S device couldn't be found; in the normal case
/// that a timestamp isn't available the success param will be used.
int AI2sDevice_getInputTimestamp(const AI2sDevice* i2s,
int64_t* frame_position,
int64_t* nano_time,
int* success);

/// Gets the timestamp when a specific sample exited the kernel.
/// @param i2s Pointer to the AI2s struct.
/// @param frame_position Output indicating number of frames written.
/// @param nano_time Output indicating time (ns) when the frame was written.
/// @param success Output indicating success (1) or failure (0).
/// @return 0 on success, errno on error. This will only be nonzero on a fatal
/// error such as the I2S device couldn't be found; in the normal case
/// that a timestamp isn't available the success param will be used.
int AI2sDevice_getOutputTimestamp(const AI2sDevice* i2s,
int64_t* frame_position,
int64_t* nano_time,
int* success);

/// Destroys an AI2s struct.
/// @param i2s Pointer to the AI2s struct.
void AI2sDevice_delete(AI2sDevice* i2s);
Expand Down
4 changes: 3 additions & 1 deletion armeabi-v7a/include/pio/peripheral_manager_client.h
Expand Up @@ -142,14 +142,16 @@ char** APeripheralManagerClient_listI2sDevices(
/// @param encoding Device pcm encoding.
/// @param channels Number of channels.
/// @param rate Device rate in Hz.
/// @param flags Specify device supporting input, output or both.
/// @param dev Output pointer to the AI2sDevice struct. Empty on error.
/// @return 0 on success, errno on error
int APeripheralManagerClient_openI2sDevice(
const APeripheralManagerClient* client,
const char* name,
APcmEncoding encoding,
AI2sEncoding encoding,
int channels,
int rate,
int flags,
AI2sDevice** dev);

/// Creates a new client.
Expand Down
Binary file modified armeabi-v7a/lib/libandroidthings.so
Binary file not shown.
44 changes: 38 additions & 6 deletions x86/include/pio/i2s_device.h
Expand Up @@ -29,12 +29,18 @@ __BEGIN_DECLS
/// @{

/// Possible encodings
typedef enum APcmEncoding {
APCM_ENCODING_8_BIT,
APCM_ENCODING_16_BIT,
APCM_ENCODING_24_BIT,
APCM_ENCODING_32_BIT
} APcmEncoding;
typedef enum AI2sEncoding {
AI2S_ENCODING_PCM_8_BIT,
AI2S_ENCODING_PCM_16_BIT,
AI2S_ENCODING_PCM_24_BIT,
AI2S_ENCODING_PCM_32_BIT
} AI2sEncoding;

/// Flags to specify I2s bus direction.
typedef enum AI2sFlags {
AI2S_FLAG_DIRECTION_IN = 1 << 0,
AI2S_FLAG_DIRECTION_OUT = 1 << 1
} AI2sFlags;

typedef struct AI2sDevice AI2sDevice;

Expand All @@ -61,6 +67,32 @@ int AI2sDevice_write(const AI2sDevice* i2s,
int AI2sDevice_read(
const AI2sDevice* i2s, void* data, int offset, int size, int* bytes_read);

/// Gets the timestamp when a specific sample entered the kernel.
/// @param i2s Pointer to the AI2s struct.
/// @param frame_position Output indicating number of frames read.
/// @param nano_time Output indicating time (ns) when the frame was read.
/// @param success Output indicating success (1) or failure (0).
/// @return 0 on success, errno on error. This will only be nonzero on a fatal
/// error such as the I2S device couldn't be found; in the normal case
/// that a timestamp isn't available the success param will be used.
int AI2sDevice_getInputTimestamp(const AI2sDevice* i2s,
int64_t* frame_position,
int64_t* nano_time,
int* success);

/// Gets the timestamp when a specific sample exited the kernel.
/// @param i2s Pointer to the AI2s struct.
/// @param frame_position Output indicating number of frames written.
/// @param nano_time Output indicating time (ns) when the frame was written.
/// @param success Output indicating success (1) or failure (0).
/// @return 0 on success, errno on error. This will only be nonzero on a fatal
/// error such as the I2S device couldn't be found; in the normal case
/// that a timestamp isn't available the success param will be used.
int AI2sDevice_getOutputTimestamp(const AI2sDevice* i2s,
int64_t* frame_position,
int64_t* nano_time,
int* success);

/// Destroys an AI2s struct.
/// @param i2s Pointer to the AI2s struct.
void AI2sDevice_delete(AI2sDevice* i2s);
Expand Down
4 changes: 3 additions & 1 deletion x86/include/pio/peripheral_manager_client.h
Expand Up @@ -142,14 +142,16 @@ char** APeripheralManagerClient_listI2sDevices(
/// @param encoding Device pcm encoding.
/// @param channels Number of channels.
/// @param rate Device rate in Hz.
/// @param flags Specify device supporting input, output or both.
/// @param dev Output pointer to the AI2sDevice struct. Empty on error.
/// @return 0 on success, errno on error
int APeripheralManagerClient_openI2sDevice(
const APeripheralManagerClient* client,
const char* name,
APcmEncoding encoding,
AI2sEncoding encoding,
int channels,
int rate,
int flags,
AI2sDevice** dev);

/// Creates a new client.
Expand Down
Binary file modified x86/lib/libandroidthings.so
Binary file not shown.

0 comments on commit ce7845d

Please sign in to comment.