/*
* This file was automatically generated using Avlos.
* https://github.com/tinymovr/avlos
*
* Any changes to this file will be overwritten when
* content is regenerated.
*/

#pragma once

{%- for include in includes %}
#include {{ include | as_include }}
{%- endfor %}

typedef enum
{
    AVLOS_RET_NOACTION,
    AVLOS_RET_READ = 1,
    AVLOS_RET_WRITE = 2,
    AVLOS_RET_CALL = 3
} Avlos_Return;

typedef enum
{
    AVLOS_CMD_WRITE,
    AVLOS_CMD_READ = 1
} Avlos_Command;

{%- for ep in instance | bitmask_eps %}

typedef enum
{
    {%- set comma = joiner(", ") %}
    {{ ep.full_name | replace(".", "_") | upper }}_NONE = 0,
    {%- for flag in ep.bitmask %}{{ comma() }}
    {{ ep.full_name | replace(".", "_") | upper }}_{{ flag.name }} = (1 << {{ loop.index0 }})
    {%- endfor %}
} {{ ep.full_name | replace(".", "_") }}_flags;
{%- endfor %}

extern uint32_t avlos_proto_hash;
extern uint8_t (*avlos_endpoints[{{ instance | endpoints | length }}])(uint8_t * buffer, uint8_t * buffer_len, Avlos_Command cmd);
extern uint32_t _avlos_get_proto_hash(void);

{%- for attr in instance | endpoints %}

/*
* avlos_{{attr.full_name | replace(".", "_") }}
*
* {{ attr.summary }}
*
* @param buffer
* @param buffer_len
*/
uint8_t avlos_{{attr.full_name | replace(".", "_") }}(uint8_t * buffer, uint8_t * buffer_len, Avlos_Command cmd);

{%- endfor %}