1 /* 2 /* 3 /*Copyright (C) 2015 The Android Open Source Project 4 /* 5 /*Licensed under the Apache License, Version 2.0 (the "License"); 6 /*you may not use this file except in compliance with the License. 7 /*You may obtain a copy of the License at 8 /* 9 /* http://www.apache.org/licenses/LICENSE-2.0 10 /* 11 /*Unless required by applicable law or agreed to in writing, software 12 /*distributed under the License is distributed on an "AS IS" BASIS, 13 /*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 /*See the License for the specific language governing permissions and 15 /*limitations under the License. 16 */ 17 * 18 * This file was copied from https://github.com/devttys0/libmpsse.git (sha1 19 * f1a6744b), and modified to suite the Chromium OS project. 20 */ 21 22 #ifndef TRUNKS_FTDI_SUPPORT_H_ 23 #define TRUNKS_FTDI_SUPPORT_H_ 24 25 #include "trunks/ftdi/mpsse.h" 26 27 int raw_write(struct mpsse_context* mpsse, uint8_t* buf, int size); 28 int raw_read(struct mpsse_context* mpsse, uint8_t* buf, int size); 29 void set_timeouts(struct mpsse_context* mpsse, int timeout); 30 uint16_t freq2div(uint32_t system_clock, uint32_t freq); 31 uint32_t div2freq(uint32_t system_clock, uint16_t div); 32 uint8_t* build_block_buffer(struct mpsse_context* mpsse, 33 uint8_t cmd, 34 const uint8_t* data, 35 int size, 36 int* buf_size); 37 int set_bits_high(struct mpsse_context* mpsse, int port); 38 int set_bits_low(struct mpsse_context* mpsse, int port); 39 int gpio_write(struct mpsse_context* mpsse, int pin, int direction); 40 int is_valid_context(struct mpsse_context* mpsse); 41 42 #endif /* TRUNKS_FTDI_SUPPORT_H_ */ 43