ecu.h File Reference
`#include <stdint.h>`
`#include <stdbool.h>`
`#include <osmocom/core/defs.h>`
`#include <osmocom/codec/codec.h>`

Go to the source code of this file.

## Data Structures

struct | osmo_ecu_fr_state
struct | osmo_ecu_state
struct | osmo_ecu_ops

## Enumerations

enum | osmo_ecu_codec { OSMO_ECU_CODEC_HR , OSMO_ECU_CODEC_FR , OSMO_ECU_CODEC_EFR , OSMO_ECU_CODEC_AMR , _NUM_OSMO_ECU_CODECS }

## Functions

void | osmo_ecu_fr_reset (struct osmo_ecu_fr_state *state, const uint8_t *frame) OSMO_DEPRECATED_OUTSIDE("Use generic ECU override ion layer instead")
| To be called when a good frame is received. More...
int | osmo_ecu_fr_conceal (struct osmo_ecu_fr_state *state, uint8_t *frame) OSMO_DEPRECATED_OUTSIDE("Use generic ECU override ion layer instead")
| To be called when a bad frame is received. More...
struct osmo_ecu_state * | osmo_ecu_init (void *ctx, enum osmo_ecu_codec codec)
| initialize an ECU instance for given codec. More...
void | osmo_ecu_destroy (struct osmo_ecu_state *st)
| destroy an ECU instance More...
int | osmo_ecu_frame_in (struct osmo_ecu_state *st, bool bfi, const uint8_t *frame, unsigned int frame_bytes)
| process a received frame a substitute/erroneous frame. More...
int | osmo_ecu_frame_out (struct osmo_ecu_state *st, uint8_t *frame_out)
| generate output data for a substitute/erroneous frame. More...
int | osmo_ecu_register (const struct osmo_ecu_ops *ops, enum osmo_ecu_codec codec)
| register an ECU implementation for a given codec More...

## Enumeration Type Documentation

## osmo_ecu_codec

enum osmo_ecu_codec

Enumerator
OSMO_ECU_CODEC_HR |
OSMO_ECU_CODEC_FR |
OSMO_ECU_CODEC_EFR |
OSMO_ECU_CODEC_AMR |
_NUM_OSMO_ECU_CODECS |

## Function Documentation

## osmo_ecu_destroy()

void osmo_ecu_destroy | ( | struct osmo_ecu_state * | st | ) |

destroy an ECU instance

References ARRAY_SIZE, osmo_ecu_state::codec, osmo_ecu_ops::destroy, and g_ecu_ops.

## osmo_ecu_fr_conceal()

int osmo_ecu_fr_conceal | ( | struct osmo_ecu_fr_state * | state,
|  | uint8_t * | frame
| ) |  |

pure virtual

To be called when a bad frame is received.

This function will then generate a replacement frame that can be used to conceal the dropout.

Parameters

  [in] | state | The state object for the ECU
  [out] | frame | The buffer to fill with GSM_FR_BYTES of replacement frame

Returns
  0 if the frame was sucessfully filled

References conceal_frame(), osmo_ecu_fr_state::frame_backup, GSM_FR_BYTES, and osmo_ecu_fr_state::subsequent_lost_frame.

Referenced by ecu_fr_frame_out().

## osmo_ecu_fr_reset()

void osmo_ecu_fr_reset | ( | struct osmo_ecu_fr_state * | state,
|  | const uint8_t * | frame
| ) |  |

pure virtual

To be called when a good frame is received.

This function will then create a backup of the frame and reset the internal state.

Parameters

  [in] | state | The state object for the ECU
  [out] | frame | The valid frame (GSM_FR_BYTES bytes in RTP payload format)

References osmo_ecu_fr_state::frame_backup, GSM_FR_BYTES, and osmo_ecu_fr_state::subsequent_lost_frame.

Referenced by ecu_fr_frame_in().

## osmo_ecu_frame_in()

int osmo_ecu_frame_in | ( | struct osmo_ecu_state * | st,
|  | bool | bfi,
|  | const uint8_t * | frame,
|  | unsigned int | frame_bytes
| ) |  |

process a received frame a substitute/erroneous frame.

Parameters

  [in] | st | ECU state/instance on which to operate
  [in] | bfi | Bad Frame Indication
  [in] | frame | received codec frame to be processed
  [in] | frame_bytes | number of bytes available in frame

References ARRAY_SIZE, osmo_ecu_state::codec, osmo_ecu_ops::frame_in, and g_ecu_ops.

## osmo_ecu_frame_out()

int osmo_ecu_frame_out | ( | struct osmo_ecu_state * | st,
|  | uint8_t * | frame_out
| ) |  |

generate output data for a substitute/erroneous frame.

Parameters

  [in] | st | ECU state/instance on which to operate
  [out] | frame_out | buffer for generated output frame

Returns
  number of bytes written to frame_out; negative on error

References ARRAY_SIZE, osmo_ecu_state::codec, osmo_ecu_ops::frame_out, and g_ecu_ops.

## osmo_ecu_init()

struct osmo_ecu_state* osmo_ecu_init | ( | void * | ctx,
|  | enum osmo_ecu_codec | codec
| ) |  |

initialize an ECU instance for given codec.

Parameters

  [in] | ctx | talloc context from which to allocate \parma[in] codec codec for which to initialize/create ECU

References ARRAY_SIZE, osmo_ecu_state::codec, g_ecu_ops, and osmo_ecu_ops::init.

## osmo_ecu_register()

int osmo_ecu_register | ( | const struct osmo_ecu_ops * | ops,
|  | enum osmo_ecu_codec | codec
| ) |  |

register an ECU implementation for a given codec

References ARRAY_SIZE, osmo_ecu_state::codec, and g_ecu_ops.

Referenced by __attribute__().