Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00110 #ifndef _FORENSIC_1394_H
00111 #define _FORENSIC_1394_H
00112
00113 #ifdef __cplusplus
00114 extern "C"
00115 {
00116 #endif
00117
00118 #if defined(FORENSIC1394_DECL)
00119
00120 #elif defined(_MSC_VER)
00121 # define FORENSIC1394_DECL __declspec(dllexport)
00122 #elif (__GNUC__ >= 3)
00123 # define FORENSIC1394_DECL __attribute__((visibility("default")))
00124 #else
00125 # define FORENSIC1394_DECL
00126 #endif
00127
00128 #include <stdlib.h>
00129 #include <stdint.h>
00130
00132 typedef struct _forensic1394_bus forensic1394_bus;
00133
00135 typedef struct _forensic1394_dev forensic1394_dev;
00136
00147 typedef struct _forensic1394_req
00148 {
00150 uint64_t addr;
00151
00153 size_t len;
00154
00156 void *buf;
00157 } forensic1394_req;
00158
00165 #define FORENSIC1394_CSR_SZ 256
00166
00184 typedef void (*forensic1394_device_callback) (forensic1394_bus *bus,
00185 forensic1394_dev *dev);
00186
00197 typedef enum
00198 {
00200 FORENSIC1394_RESULT_SUCCESS = 0,
00202 FORENSIC1394_RESULT_OTHER_ERROR = -1,
00204 FORENSIC1394_RESULT_BUS_RESET = -2,
00206 FORENSIC1394_RESULT_NO_PERM = -3,
00208 FORENSIC1394_RESULT_BUSY = -4,
00210 FORENSIC1394_RESULT_IO_ERROR = -5,
00212 FORENSIC1394_RESULT_IO_SIZE = -6,
00214 FORENSIC1394_RESULT_IO_TIMEOUT = -7,
00216 FORENSIC1394_RESULT_END = -8
00217 } forensic1394_result;
00218
00227 FORENSIC1394_DECL forensic1394_bus *forensic1394_alloc(void);
00228
00245 FORENSIC1394_DECL forensic1394_result
00246 forensic1394_enable_sbp2(forensic1394_bus *bus);
00247
00280 FORENSIC1394_DECL forensic1394_dev **
00281 forensic1394_get_devices(forensic1394_bus *bus,
00282 int *ndev,
00283 forensic1394_device_callback ondestroy);
00284
00294 FORENSIC1394_DECL void
00295 forensic1394_destroy(forensic1394_bus *bus);
00296
00308 FORENSIC1394_DECL void *
00309 forensic1394_get_bus_user_data(forensic1394_bus *bus);
00310
00319 FORENSIC1394_DECL void
00320 forensic1394_set_bus_user_data(forensic1394_bus *bus, void *u);
00321
00332 FORENSIC1394_DECL forensic1394_result
00333 forensic1394_open_device(forensic1394_dev *dev);
00334
00342 FORENSIC1394_DECL void
00343 forensic1394_close_device(forensic1394_dev *dev);
00344
00351 FORENSIC1394_DECL int
00352 forensic1394_is_device_open(forensic1394_dev *dev);
00353
00377 FORENSIC1394_DECL forensic1394_result
00378 forensic1394_read_device(forensic1394_dev *dev,
00379 uint64_t addr,
00380 size_t len,
00381 void *buf);
00382
00403 FORENSIC1394_DECL forensic1394_result
00404 forensic1394_read_device_v(forensic1394_dev *dev,
00405 forensic1394_req *req,
00406 size_t nreq);
00407
00426 FORENSIC1394_DECL forensic1394_result
00427 forensic1394_write_device(forensic1394_dev *dev,
00428 uint64_t addr,
00429 size_t len,
00430 void *buf);
00431
00444 FORENSIC1394_DECL forensic1394_result
00445 forensic1394_write_device_v(forensic1394_dev *dev,
00446 const forensic1394_req *req,
00447 size_t nreq);
00448
00459 FORENSIC1394_DECL void
00460 forensic1394_get_device_csr(forensic1394_dev *dev,
00461 uint32_t *rom);
00462
00472 FORENSIC1394_DECL uint16_t
00473 forensic1394_get_device_nodeid(forensic1394_dev *dev);
00474
00484 FORENSIC1394_DECL int64_t
00485 forensic1394_get_device_guid(forensic1394_dev *dev);
00486
00497 FORENSIC1394_DECL const char *
00498 forensic1394_get_device_product_name(forensic1394_dev *dev);
00499
00508 FORENSIC1394_DECL int
00509 forensic1394_get_device_product_id(forensic1394_dev *dev);
00510
00521 FORENSIC1394_DECL const char *
00522 forensic1394_get_device_vendor_name(forensic1394_dev *dev);
00523
00532 FORENSIC1394_DECL int
00533 forensic1394_get_device_vendor_id(forensic1394_dev *dev);
00534
00548 FORENSIC1394_DECL int
00549 forensic1394_get_device_request_size(forensic1394_dev *dev);
00550
00562 FORENSIC1394_DECL void *
00563 forensic1394_get_device_user_data(forensic1394_dev *dev);
00564
00573 FORENSIC1394_DECL void
00574 forensic1394_set_device_user_data(forensic1394_dev *dev, void *u);
00575
00587 FORENSIC1394_DECL const char *
00588 forensic1394_get_result_str(forensic1394_result r);
00589
00590 #ifdef __cplusplus
00591 }
00592 #endif
00593
00594 #endif // _FORENSIC_1394_H