AT-NFC 2.1 (win) AT-NFC kernel set

Functions
HAL Memory Management

HAL Memory Management API declarations. More...

## Functions
KER_INT32S | hal_mem_cmp (KER_CTX_PARAM const KER_VOID *pvBuffer1, const KER_VOID *pvBuffer2, KER_INT16U usCount)
| Compare memory buffers. More...
KER_VOID * | hal_mem_set (KER_CTX_PARAM KER_VOID *pvDestBuffer, KER_INT16U usDestBufferSize, KER_BYTE btValue, KER_INT16U usCount)
| Reset memory buffer with specified value. More...
KER_INT32U | hal_mem_cpy (KER_CTX_PARAM KER_VOID *pvDestBuffer, KER_INT16U usDestBufferSize, const KER_VOID *pvSourceBuffer, KER_INT16U usSourceBufferSize)
| Copy one memory buffer to another. More...
KER_VOID * | hal_mem_move (KER_CTX_PARAM KER_VOID *pvDestBuffer, KER_INT16U usDestBufferSize, KER_VOID *pvSourceBuffer, KER_INT16U usSourceBufferSize)
| Copy one memory buffer to another (event if buffer overlaped) More...
KER_INT32U | hal_mem_add (KER_CTX_PARAM KER_VOID *pvDestBuffer, KER_INT16U usDestBufferSize, KER_INT16U usDestBufferOffset, const KER_VOID *pvSourceBuffer, KER_INT16U usSourceBufferSize)
| Add memory buffer to existing buffer with offset. More...
KER_INT32U KER_CDECL | hal_sprintf (KER_CTX_PARAM KER_CHAR *pchDestBuffer, KER_INT16U usDestBufferSize, const KER_CHAR *pchFormat,...)
| sprintf_s analog More...
KER_VOID * | hal_alloc_mem (KER_CTX_PARAM KER_INT16U usBufferSize)
| allocate memory buffer More...
KER_BOOL | hal_release_mem (KER_CTX_PARAM KER_VOID *pBuffer)
| release previously allocated memory buffer More...
KER_BOOL | hal_release_mem_ex (KER_CTX_PARAM KER_VOID *pBuffer, KER_INT16U usBufferSize)
| release previously allocated memory buffer (reset it firstly for PCI SSS) More...

## Detailed Description

HAL Memory Management API declarations.

This functions should be implemented by terminal application

## Function Documentation

## ◆ hal_alloc_mem()

KER_VOID* hal_alloc_mem | ( | KER_CTX_PARAM KER_INT16U | usBufferSize | ) |

allocate memory buffer

Parameters

  [in] | usBufferSize | requested buffer size in bytes

Returns
  Pointer to allocated buffer.

Warning
  Allocated buffer should be released by hal_release_mem

## ◆ hal_mem_add()

KER_INT32U hal_mem_add | ( | KER_CTX_PARAM KER_VOID * | pvDestBuffer,
|  | KER_INT16U | usDestBufferSize,
|  | KER_INT16U | usDestBufferOffset,
|  | const KER_VOID * | pvSourceBuffer,
|  | KER_INT16U | usSourceBufferSize
| ) |  |

Add memory buffer to existing buffer with offset.

Parameters

  [out] | pvDestBuffer | Buffer to copy to
  [in] | usDestBufferSize | DestBuffer size in bytes
  [in] | usDestBufferOffset | DestBuffer offset to add in bytes
  [in] | pvSourceBuffer | Buffer to copy from
  [in] | usSourceBufferSize | SourceBuffer size in bytes

Returns
  Result length in bytes

## ◆ hal_mem_cmp()

KER_INT32S hal_mem_cmp | ( | KER_CTX_PARAM const KER_VOID * | pvBuffer1,
|  | const KER_VOID * | pvBuffer2,
|  | KER_INT16U | usCount
| ) |  |

Compare memory buffers.

Parameters

  [in] | pvBuffer1 | Buffer1 to compare
  [in] | pvBuffer2 | Buffer2 to compare
  [in] | usCount | count of bytes to compare

Return values

  0 | Buffers equal
  <0 | Buffer1 less than Buffer2
  >0 | Buffer1 more than Buffer2

## ◆ hal_mem_cpy()

KER_INT32U hal_mem_cpy | ( | KER_CTX_PARAM KER_VOID * | pvDestBuffer,
|  | KER_INT16U | usDestBufferSize,
|  | const KER_VOID * | pvSourceBuffer,
|  | KER_INT16U | usSourceBufferSize
| ) |  |

Copy one memory buffer to another.

Parameters

  [out] | pvDestBuffer | Buffer to copy to
  [in] | usDestBufferSize | DestBuffer size in bytes
  [in] | pvSourceBuffer | Buffer to copy from
  [in] | usSourceBufferSize | SourceBuffer size in bytes

Returns
  Result length in bytes

## ◆ hal_mem_move()

KER_VOID* hal_mem_move | ( | KER_CTX_PARAM KER_VOID * | pvDestBuffer,
|  | KER_INT16U | usDestBufferSize,
|  | KER_VOID * | pvSourceBuffer,
|  | KER_INT16U | usSourceBufferSize
| ) |  |

Copy one memory buffer to another (event if buffer overlaped)

Parameters

  [out] | pvDestBuffer | Buffer to copy to
  [in] | usDestBufferSize | DestBuffer size in bytes
  [in] | pvSourceBuffer | Buffer to copy from
  [in] | usSourceBufferSize | SourceBuffer size in bytes

Returns
  Pointer to result buffer
  KER_NULL - failure

## ◆ hal_mem_set()

KER_VOID* hal_mem_set | ( | KER_CTX_PARAM KER_VOID * | pvDestBuffer,
|  | KER_INT16U | usDestBufferSize,
|  | KER_BYTE | btValue,
|  | KER_INT16U | usCount
| ) |  |

Reset memory buffer with specified value.

Parameters

  [out] | pvDestBuffer | Buffer to copy to
  [in] | usDestBufferSize | DestBuffer size in bytes
  [in] | btValue | value to set
  [in] | usCount | count of bytes to set

Returns
  The value of pvDestBuffer

## ◆ hal_release_mem()

KER_BOOL hal_release_mem | ( | KER_CTX_PARAM KER_VOID * | pBuffer | ) |

release previously allocated memory buffer

Parameters

  [in] | pBuffer | previously allocated by hal_alloc_mem memory buffer

Returns
  KER_TRUE Success.
  KER_FALSE Failure. Execution failed due to invalid param or memory error.

## ◆ hal_release_mem_ex()

KER_BOOL hal_release_mem_ex | ( | KER_CTX_PARAM KER_VOID * | pBuffer,
|  | KER_INT16U | usBufferSize
| ) |  |

release previously allocated memory buffer (reset it firstly for PCI SSS)

Parameters

  [in] | pBuffer | previously allocated by hal_alloc_mem memory buffer
  [in] | usBufferSize | previously allocated by hal_alloc_mem memory buffer size

Returns
  KER_TRUE Success.
  KER_FALSE Failure. Execution failed due to invalid param or memory error.

## ◆ hal_sprintf()

KER_INT32U KER_CDECL hal_sprintf | ( | KER_CTX_PARAM KER_CHAR * | pchDestBuffer,
|  | KER_INT16U | usDestBufferSize,
|  | const KER_CHAR * | pchFormat,
|  |  | ...
| ) |  |

sprintf_s analog

Parameters

  [out] | pchDestBuffer | Buffer to sprintf_s to
  [in] | usDestBufferSize | DestBuffer size in bytes
  [in] | pchFormat | format string (as for sprintf_s)

Returns
  Number of characters written, not including 0-terminated character.