AM263Px MCU+ SDK: Bind unibase to a specific platform

| AM263Px MCU+ SDK 26.00.00 |

Files | Functions | Typedefs | Macros
Bind unibase to a specific platform
APIs for Unibase Binding

## Introduction

## Files
file | unibase_binding.h
| functions to bind unibase to a specific platform

## Functions
int | ubb_memory_out_init (char *mem, int size)
| initialize the internal memory_out function More...
int | ubb_memory_out_close (void)
| de-initialize memory_out function More...
char * | ubb_memory_out_buffer (void)
| return the memory pointer of memory_out More...
int | ubb_memory_out_lastline (char **str, int *size)
| return the most recent output line in memory_out More...
int | ubb_memory_out_alldata (char **rstr, int *size)
| return the all written line data in the buffer More...
int | ubb_memory_file_out (const char *fname)
| write the data in memory_out buffer into a file More...
void | ubb_default_initpara (unibase_init_para_t *init_para)
| return the default initialization parameters supported in the binding layer More...
void | ubb_set_gptp_gettime64 (get64ts_t func)
| set gptptime function for ub_gptp_gettime64 More...
void | ubb_unibase_easyinit (void)
| initialize unibase with 'ubb_default_initpara' More...

## Typedefs
typedef uint64_t(* | get64ts_t) (void)

## Macros
#define | UBB_DEFAULT_DEBUG_LOG_MEMORY (64*1024)
| ubb_memory_out_init uses this value to allocate internal buffer when 'mem' parameter is NULL. More...
#define | UBB_MEMOUT_ENDMARK "---###---"
| ubb_memory_out always add this end mark at the end of printing. More...
#define | UBB_DEFAULT_LOG_INITSTR "4,ubase:45"
| ubb_default_initpara uses this string as 'ub_log_initstr' More...
#define | UBB_GETENV getenv
| get a string from an environment variable More...

## Macro Definition Documentation

## ◆ UBB_DEFAULT_DEBUG_LOG_MEMORY

#define UBB_DEFAULT_DEBUG_LOG_MEMORY (64*1024)

ubb_memory_out_init uses this value to allocate internal buffer when 'mem' parameter is NULL.

## ◆ UBB_MEMOUT_ENDMARK

#define UBB_MEMOUT_ENDMARK "---###---"

ubb_memory_out always add this end mark at the end of printing.

## ◆ UBB_DEFAULT_LOG_INITSTR

#define UBB_DEFAULT_LOG_INITSTR "4,ubase:45"

ubb_default_initpara uses this string as 'ub_log_initstr'

## ◆ UBB_GETENV

#define UBB_GETENV getenv

get a string from an environment variable

## Typedef Documentation

## ◆ get64ts_t

typedef uint64_t(* get64ts_t) (void)

## Function Documentation

## ◆ ubb_memory_out_init()

int ubb_memory_out_init | ( | char * | mem,
|  | int | size
| ) |  |

initialize the internal memory_out function

Parameters

  mem | use this memory as a buffer for memory_out. if mem is NULL, allocate memory internally for 'size' bytes
  size | size of memory to be used for memory_out

Returns
  0 on success, -1 on error

Note
  if this is not explicitly called, it is called internally with mem=NULL and size=UBB_DEFAULT_DEBUG_LOG_MEMORY

## ◆ ubb_memory_out_close()

int ubb_memory_out_close | ( | void |  | ) |

de-initialize memory_out function

Returns
  0 on success, -1 on error

Note
  this must be called whichever case of the explicit call or the internal call of 'ubb_memory_out_init'

## ◆ ubb_memory_out_buffer()

char* ubb_memory_out_buffer | ( | void |  | ) |

return the memory pointer of memory_out

Returns
  memory pointer

## ◆ ubb_memory_out_lastline()

int ubb_memory_out_lastline | ( | char ** | str,
|  | int * | size
| ) |  |

return the most recent output line in memory_out

Parameters

  str | pointer of string pointer to return result string
  size | pointer of integer pointer to return result size

Returns
  0 on success, -1 on error

## ◆ ubb_memory_out_alldata()

int ubb_memory_out_alldata | ( | char ** | rstr,
|  | int * | size
| ) |  |

return the all written line data in the buffer

Parameters

  rstr | allocated pointer of the returned data
  size | size of the returned data

Returns
  0 on success, -1 on error

Note
  returned pointer in *str must be freed by the caller. the allocation size is the same as the size in ubb_memory_out_init

## ◆ ubb_memory_file_out()

int ubb_memory_file_out | ( | const char * | fname | ) |

write the data in memory_out buffer into a file

Parameters

  fname | file name

Returns
  0 on success, -1 on error

## ◆ ubb_default_initpara()

void ubb_default_initpara | ( | unibase_init_para_t * | init_para | ) |

return the default initialization parameters supported in the binding layer

Parameters

  init_para | pointer of unibase initialization parameter

## ◆ ubb_set_gptp_gettime64()

void ubb_set_gptp_gettime64 | ( | get64ts_t | func | ) |

set gptptime function for ub_gptp_gettime64

Parameters

  func | a function which returns 64-bit gptp time

## ◆ ubb_unibase_easyinit()

void ubb_unibase_easyinit | ( | void |  | ) |

initialize unibase with 'ubb_default_initpara'

Note
  ubb_memory_out is initialize with no memory. To use memory logging, 'ubb_memory_out_init' needs to be called separately