Files | Defines | Functions
HostInterface functions
IoUtil Functions

Transmitting bytes between a host computer an the AVR.
More...

## Files
file | hif.h
| Interface for HostInterface functions.
## Defines
#define | DUMP(sz, ptr) hif_dump(sz,ptr)
#define | FLASH_STRING(x) PSTR(x)
#define | FLASH_STRING_T PGM_P
#define | HIF_AT90USB (21)
#define | HIF_FT245 (20)
#define | HIF_NONE (0)
#define | HIF_PUTS_NEWLINE() hif_puts_p(FLASH_STRING("\n\r"))
#define | HIF_UART_0 (10)
#define | HIF_UART_1 (11)
#define | PRINT(fmt) hif_echo(FLASH_STRING(fmt))
#define | PRINTF(fmt,...) hif_printf(FLASH_STRING(fmt), __VA_ARGS__)
#define | URACOLI_USB_BCD_RELEASE (0x100)
#define | URACOLI_USB_PID (2183)
#define | URACOLI_USB_PRODUCT_NAME L"RZUSBSTICK"
#define | URACOLI_USB_VENDOR_NAME L"URACOLI"
#define | URACOLI_USB_VID (5824)
## Functions
void | hif_dump (uint16_t sz, uint8_t *d)
| Print hexdump of a data array to the interface.
void | hif_echo (FLASH_STRING_T str)
| Print a string to the interface.
uint8_t | hif_get_blk (unsigned char *data, uint8_t max_size)
| Get a block of bytes from the host interface.
int | hif_getc (void)
| Get a charakter byte from the host interface.
void | hif_init (const uint32_t baudrate)
| Initialize host interface.
void | hif_printf (FLASH_STRING_T fmt,...)
| Print a formated string to the interface.
uint8_t | hif_put_blk (unsigned char *data, uint8_t size)
| Send a block of characters to the interface.
int | hif_putc (int c)
| Send a character to the interface.
void | hif_puts (const char *s)
| Send string to the interface.
void | hif_puts_p (const char *progmem_s)
| Send a programm memory string to the interface.

## Detailed Description

Transmitting bytes between a host computer an the AVR.

## Define Documentation

#define DUMP | ( |  | sz,
|  |  | ptr
| ) |  | hif_dump(sz,ptr)

Wrapper macro for hif_dump()

#define HIF_AT90USB (21)

Identifier for HIF type USB/ATmega1287

#define HIF_FT245 (20)

Identifier for HIF type USB/FT245

#define HIF_NONE (0)

Identifier for no host interface

#define HIF_UART_0 (10)

Identifier for HIF type UART 0

#define HIF_UART_1 (11)

Identifier for HIF type UART 1

#define PRINT | ( |  | fmt | ) | hif_echo(FLASH_STRING(fmt))

Wrapper macro for hif_echo()

#define PRINTF | ( |  | fmt,
|  |  | ...
| ) |  | hif_printf(FLASH_STRING(fmt), __VA_ARGS__)

Wrapper macro for hif_printf()

#define URACOLI_USB_PID (2183)

uracoli USB Product ID see also USB_VID_URACOLI

#define URACOLI_USB_VID (5824)

uracoli USB Vendor ID

The pair of the uracoli vendor id, device id are obtained by

- http://www.voti.nl/pids/
- http://www.frank-buss.de/pid.txt

## Function Documentation

void hif_dump | ( | uint16_t | sz,
|  | uint8_t * | d
| ) |  |

Print hexdump of a data array to the interface.

Parameters:

  sz | number of bytes, that will be dumped.
  d | pointer to the data array, that will be dumped.

void hif_echo | ( | FLASH_STRING_T | str | ) |

Print a string to the interface.

Parameters:

  str | string, which is located in flash memory

uint8_t hif_get_blk | ( | unsigned char * | data,
|  | uint8_t | max_size
| ) |  |

Get a block of bytes from the host interface.

Parameters:

  data | buffer where the bytes are stored
  max_size | maximum number of bytes, which can be stored in the buffer.

Returns:
  number of bytes stored in the buffer

int hif_getc | ( | void |  | ) |

Get a charakter byte from the host interface.

Returns:
  The Character or EOF in case of error or end-of-file

void hif_init | ( | const uint32_t | baudrate | ) |

Initialize host interface.

Parameters:

  baudrate | data rate of the interface in bit/s

void hif_printf | ( | FLASH_STRING_T | fmt,
|  |  | ...
| ) |  |

Print a formated string to the interface.

Parameters:

  fmt | format string, which is located in flash memory
  ... | variable argument list

uint8_t hif_put_blk | ( | unsigned char * | data,
|  | uint8_t | size
| ) |  |

Send a block of characters to the interface.

Parameters:

  data | pointer to the data array.
  size | size of the block.

Returns:
  num number of bytes, which was send.

int hif_putc | ( | int | c | ) |

Send a character to the interface.

Parameters:

  data | Character to send

Returns:
  The Character or EOF in case of error

void hif_puts | ( | const char * | s | ) |

Send string to the interface.

Parameters:

  s | pointer to a null terminated string, which is located in RAM.

void hif_puts_p | ( | const char * | progmem_s | ) |

Send a programm memory string to the interface.

Parameters:

  progmem_s | pointer to a null terminated string, which is located in program memory.