📄 proto.h
字号:
/* * $QNXLicenseC: * Copyright 2007, QNX Software Systems. * * Licensed under the Apache License, Version 2.0 (the "License"). You * may not reproduce, modify or distribute this software except in * compliance with the License. You may obtain a copy of the License * at: http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OF ANY KIND, either express or implied. * * This file may contain contributions from others, either as * contributors under the License or as licensors under other terms. * Please review this entire file for other proprietary rights or license * notices, as well as the QNX Development Suite License Guide at * http://licensing.qnx.com/license-guide/ for other information. * $ */#ifndef __PROTO_H_INCLUDED#define __PROTO_H_INCLUDED#include <assert.h>#include <stdio.h>#include <stdlib.h>#include <stdint.h>#include <string.h>#include <errno.h>#include <unistd.h>#include <sys/neutrino.h>#include <sys/mman.h>#include <hw/inout.h>#include <hw/i2c.h>#include <arm/mx21.h>#include <sys/slog.h>typedef struct _mx21_dev { unsigned physbase; uintptr_t regbase; int irq; int iid; unsigned slave_addr; unsigned options; unsigned stop;} mx21_dev_t;#define MX21_OPT_VERBOSE (1 << 0)#define MX21_OPT_POLLING (1 << 1)void *mx21_init(int argc, char *argv[]);void mx21_fini(void *hdl);void mx21_i2c_enable(mx21_dev_t *dev);void mx21_i2c_disable(mx21_dev_t *dev);int mx21_i2c_start(mx21_dev_t *dev, int read);void mx21_i2c_stop(mx21_dev_t *dev);int mx21_wait_complete(mx21_dev_t *dev, int read);int mx21_options(mx21_dev_t *dev, int argc, char *argv[]);int mx21_set_slave_addr(void *hdl, unsigned int addr, i2c_addrfmt_t fmt);int mx21_set_bus_speed(void *hdl, unsigned int speed, unsigned int *ospeed);int mx21_version_info(i2c_libversion_t *version);int mx21_driver_info(void *hdl, i2c_driver_info_t *info);int mx21_devctl(void *hdl, int cmd, void *msg, int msglen, int *nbytes, int *info);i2c_status_t mx21_recv(void *hdl, void *buf, unsigned int len, unsigned int stop);i2c_status_t mx21_send(void *hdl, void *buf, unsigned int len, unsigned int stop);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -