1bf215546Sopenharmony_ci/* This file is generated by venus-protocol. See vn_protocol_driver.h. */ 2bf215546Sopenharmony_ci 3bf215546Sopenharmony_ci/* 4bf215546Sopenharmony_ci * Copyright 2020 Google LLC 5bf215546Sopenharmony_ci * SPDX-License-Identifier: MIT 6bf215546Sopenharmony_ci */ 7bf215546Sopenharmony_ci 8bf215546Sopenharmony_ci#ifndef VN_PROTOCOL_DRIVER_CS_H 9bf215546Sopenharmony_ci#define VN_PROTOCOL_DRIVER_CS_H 10bf215546Sopenharmony_ci 11bf215546Sopenharmony_ci#include <assert.h> 12bf215546Sopenharmony_ci 13bf215546Sopenharmony_ci/* 14bf215546Sopenharmony_ci * These types/functions are expected 15bf215546Sopenharmony_ci * 16bf215546Sopenharmony_ci * struct vn_cs_encoder 17bf215546Sopenharmony_ci * vn_cs_encoder_get_len 18bf215546Sopenharmony_ci * vn_cs_encoder_reserve 19bf215546Sopenharmony_ci * vn_cs_encoder_write 20bf215546Sopenharmony_ci * 21bf215546Sopenharmony_ci * struct vn_cs_decoder 22bf215546Sopenharmony_ci * vn_cs_decoder_set_fatal 23bf215546Sopenharmony_ci * vn_cs_decoder_read 24bf215546Sopenharmony_ci * vn_cs_decoder_peek 25bf215546Sopenharmony_ci * 26bf215546Sopenharmony_ci * vn_cs_handle_load_id 27bf215546Sopenharmony_ci * vn_cs_handle_store_id 28bf215546Sopenharmony_ci */ 29bf215546Sopenharmony_ci#include "vn_cs.h" 30bf215546Sopenharmony_ci 31bf215546Sopenharmony_cistatic inline void 32bf215546Sopenharmony_civn_encode(struct vn_cs_encoder *enc, size_t size, const void *data, size_t data_size) 33bf215546Sopenharmony_ci{ 34bf215546Sopenharmony_ci assert(size % 4 == 0); 35bf215546Sopenharmony_ci /* TODO check if the generated code is optimal */ 36bf215546Sopenharmony_ci vn_cs_encoder_write(enc, size, data, data_size); 37bf215546Sopenharmony_ci} 38bf215546Sopenharmony_ci 39bf215546Sopenharmony_cistatic inline void 40bf215546Sopenharmony_civn_decode(struct vn_cs_decoder *dec, size_t size, void *data, size_t data_size) 41bf215546Sopenharmony_ci{ 42bf215546Sopenharmony_ci assert(size % 4 == 0); 43bf215546Sopenharmony_ci vn_cs_decoder_read(dec, size, data, data_size); 44bf215546Sopenharmony_ci} 45bf215546Sopenharmony_ci 46bf215546Sopenharmony_ci#endif /* VN_PROTOCOL_DRIVER_CS_H */ 47