Go to the documentation of this file.00001 #ifndef _OWIBUS_H_
00002 #define _OWIBUS_H_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00047 #include <cfg/arch.h>
00048 #include <stdint.h>
00049
00054
00055
00056
00057
00061 #define OWI_READ_ROM 0x33
00062 #define OWI_OVERDRIVE_SKIP_ROM 0x3c
00063 #define OWI_CONVERT_T 0x44
00064 #define OWI_MATCH_ROM 0x55
00065 #define OWI_OVERDRIVE_MATCH_ROM 0x69
00066 #define OWI_SKIP_ROM 0xCC
00067 #define OWI_READ 0xBE
00068 #define OWI_SEARCH_ROM 0xF0
00073 #define OWI_LAST_DEVICE 0x00
00074 #define OWI_SEARCH_FIRST 0xFF
00081 enum OWI_ERRORS {
00082 OWI_SUCCESS = 0,
00083 OWI_PRESENCE_ERR = -1,
00084 OWI_INVALID_HW = -2,
00085 OWI_OUT_OF_MEM = -3,
00086 OWI_HW_ERROR = -4,
00087 OWI_DATA_ERROR = -5,
00088 OWI_NOT_IMPLEMENTED = -6,
00089 };
00090
00096 enum OWIBUS_MODE {
00097 OWI_MODE_NORMAL = 0,
00098 OWI_MODE_OVERDRIVE = 1,
00099 OWI_MODE_NONE = 2,
00100 };
00101
00107 enum STM32_OWITIMER_COMMANDS {
00108 OWI_CMD_RESET = 0,
00109 OWI_CMD_RWBIT = 1,
00110 OWI_CMD_NONE = 2,
00111 };
00112
00118 enum STM32_OWITIMER_PHASES {
00119 OWI_PHASE_SETUP = 0,
00120 OWI_PHASE_SYNC_PULSE = 1,
00121 OWI_PHASE_RW = 2,
00122 OWI_PHASE_RELEASE = 3,
00123 OWI_PHASE_NONE = 4,
00124 };
00125
00129 #define OWI_OVERDRIVE 0x1
00130 #define OWI_PULLUP 0x2
00132 typedef struct _NUTOWIBUS NUTOWIBUS;
00133
00134 #include "owibus_bbif.h"
00135 #include "owibus_uartif.h"
00136
00137
00138 #if defined(MCU_STM32)
00139 #endif
00140
00146 struct _NUTOWIBUS {
00147 uintptr_t owibus_info;
00148 uint32_t mode;
00149 int(*OwiTouchReset) (NUTOWIBUS *);
00150 int(*OwiReadBlock) (NUTOWIBUS *bus, uint8_t *data, uint_fast8_t);
00151 int(*OwiWriteBlock) (NUTOWIBUS *bus, uint8_t *data, uint_fast8_t);
00152 };
00153
00154 int OwiRomSearch(NUTOWIBUS *bus, uint8_t *diff, uint64_t *hid);
00155 int OwiCommand(NUTOWIBUS *bus, uint8_t cmd, uint64_t *hid);
00156 int OwiReadBlock(NUTOWIBUS *bus, uint8_t *data, uint_fast8_t len);
00157 int OwiWriteBlock(NUTOWIBUS *bus, uint8_t *data, uint_fast8_t len);
00158 int OwiSetMode(NUTOWIBUS *bus, uint_fast8_t mode);
00159 int OwiGetMode(NUTOWIBUS *bus);
00160
00163 #endif