1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-01 18:55:36 +00:00
Commit Graph

238 Commits

Author SHA1 Message Date
Con Kolivas
7ef11e2b3d Set the read and write threads for avalon to not cancel within libusb functions and wait for the threads to pthread_join on shutdown. 2013-05-27 21:02:32 +10:00
Con Kolivas
7506e499b9 Offset needs to be incremented after avalon reads. 2013-05-27 20:37:21 +10:00
Con Kolivas
7748c46943 Make the avalon_read function parse the ftdi responses appopriately. 2013-05-27 20:29:35 +10:00
Con Kolivas
2a222ecffa Use the avalon read timeout to completion if no data has been read. 2013-05-27 20:04:12 +10:00
Con Kolivas
e255f74763 wait_avalon_ready should only be used before writes. 2013-05-27 19:55:02 +10:00
Con Kolivas
51a44fa779 Ask for the correct amount to read in avalon get results. 2013-05-27 17:52:34 +10:00
Con Kolivas
0316592b95 Spawn the avalon read thread first with info->reset set to discard any data till work is adequately queued. 2013-05-27 17:48:54 +10:00
Con Kolivas
6ce6cd547e Use direct usb read commands to avoid ftdi data being automatically cut off in avalon reads. 2013-05-27 17:42:51 +10:00
Con Kolivas
b73ab48814 Do a simple usb_read_once for the avalon result from a reset command. 2013-05-27 17:28:49 +10:00
Con Kolivas
f1ffe9860b Make sure avalon is ready to receive more usb commands before sending them. 2013-05-27 17:18:49 +10:00
Con Kolivas
a32e521d0a Implement avalon_ready and avalon_wait_ready functions for when usb is ready to receive commands. 2013-05-27 17:17:42 +10:00
Con Kolivas
7ad8af19b9 avalon_read should not loop but just return whatever it has succeeded in reading. 2013-05-27 17:08:06 +10:00
Con Kolivas
2c633fdbe4 Set avalon_info to device data void struct. 2013-05-27 15:54:07 +10:00
Con Kolivas
c478b302ce Specify avalon in avalon_reset. 2013-05-27 15:48:54 +10:00
Con Kolivas
269a8de977 First pass rewriting serialdev into direct usb dev for avalon driver. 2013-05-27 15:43:22 +10:00
Con Kolivas
9650bfd6a3 Compile usbutils into avalon driver. 2013-05-27 14:58:08 +10:00
Con Kolivas
8595f3bd74 Check results come in at least at 2/3 the rate they should be on avalon and if not, reset it. 2013-05-27 13:41:57 +10:00
Con Kolivas
91edf84c60 Give a warning but don't reset if the avalon buffer is full early. 2013-05-27 12:39:32 +10:00
Con Kolivas
abfaf36112 Discard any reads obtained from the avalon get results thread during a reset. 2013-05-27 12:30:13 +10:00
Con Kolivas
c1dd052596 Differentiate initial reset in avalon from subsequent ones. 2013-05-27 12:20:34 +10:00
Con Kolivas
589e08772e Perform a mandatory reset if the avalon buffer signals it's full before it has queued its normal quota of work. 2013-05-27 11:11:44 +10:00
Con Kolivas
b790153990 Wait till buffer is cleared after sending idle tasks to avalon before returning from avalon_idle. 2013-05-27 01:33:54 +10:00
Con Kolivas
f164446282 Lock qlock mutex during reset from read thread in avalon to prevent more work being sent till the reset is over. 2013-05-27 01:32:31 +10:00
Con Kolivas
499b25068c Reset avalon if we continue to be unable to send all the work items. 2013-05-27 01:29:57 +10:00
Con Kolivas
b2b594b80e Revert "Don't reset result counter to zero if it's negative in avalon on just one successful share."
This reverts commit ce0a9cd3a4.

This wasn't the problem.
2013-05-27 00:53:24 +10:00
Con Kolivas
ce0a9cd3a4 Don't reset result counter to zero if it's negative in avalon on just one successful share. 2013-05-27 00:28:56 +10:00
Con Kolivas
4c3fe39e94 Add avalon reset response to debugging output. 2013-05-26 21:50:31 +10:00
Con Kolivas
d0132a7702 Do a wait_avalon_ready before sending a reset code. 2013-05-26 21:34:53 +10:00
Con Kolivas
1f493d6462 Iterate over spare bytes in the avalon result returned from a reset request trying to find the beginning of the reset. 2013-05-26 21:30:55 +10:00
Con Kolivas
467d149785 Idle avalon after reset. 2013-05-26 21:21:11 +10:00
Con Kolivas
1ef027c444 Check for nothing but consecutive bad results on avalon and reset the FPGA if it happens. 2013-05-26 21:14:17 +10:00
Con Kolivas
e90cf62af1 Unset the work restart flag sooner in avalon_flush_work to avoid re-entering the flush work function and just reset the queued counter instead of rotating the array to avoid runs of no valid work. 2013-05-26 17:07:27 +10:00
Con Kolivas
0a9d7ca6b3 Implement an avalon_flush_work function for work restarts. 2013-05-26 16:46:43 +10:00
Con Kolivas
3c39d75fc9 Shut down avalon read and write threads and idle the miners on closing it. 2013-05-26 16:26:42 +10:00
Con Kolivas
db7c72b892 Rotate avalon array to reset the queued count before releasing the lock so work will always be available on next pass. 2013-05-26 14:59:05 +10:00
Con Kolivas
66e27a10c5 Move avalon read thread start till after conditional wait, store idle status in avalon_info and use it to determine whether an error is appropriate or not. 2013-05-26 14:37:45 +10:00
Con Kolivas
0763070cb0 Wait till the avalon_send_tasks thread has filled the avalon with idle work before starting the avalon_get_results thread. 2013-05-26 14:29:28 +10:00
Con Kolivas
7cf154bfa5 Use AVA_GETS_OK macro in avalon_read. 2013-05-26 14:23:14 +10:00
Con Kolivas
ebf885520d Do all writes on avalon with a select() timeout to prevent indefinite blocking and loop if less than desired is written. 2013-05-26 14:18:21 +10:00
Con Kolivas
596784aaf3 Check explicitly that ava_buffer_full equals the macro. 2013-05-26 14:08:21 +10:00
Con Kolivas
e9e6ad821d Send initial reset as an avalon task to remove avalon_write function. 2013-05-26 13:58:12 +10:00
Con Kolivas
e27ca54408 avalon_clear_readbuf is no longer required. 2013-05-26 13:53:02 +10:00
Con Kolivas
7dc3485fc2 Check for 2 stray bytes on avalon reset. 2013-05-26 13:39:42 +10:00
Con Kolivas
629feb5f3f Create a separate thread for handling all work and idle submission to the avalon which messages the scanhash function it has completed to update statistics. 2013-05-26 13:16:19 +10:00
Con Kolivas
c87f4c303f Give the avalon get results thread name the device number as well. 2013-05-26 09:04:24 +10:00
Con Kolivas
4076e6b36e Make sure we're not adjusting temps on every successful work retrieval on avalon. 2013-05-26 08:57:02 +10:00
Con Kolivas
4784ecce75 Count missing work items from behind a successful work read in avalon as well. 2013-05-26 08:55:03 +10:00
Con Kolivas
70a3e885e0 Change message for work not found in avalon parser. 2013-05-26 08:42:41 +10:00
Con Kolivas
fba70ff593 Simplify debugging and only discard from avalon read buffer if at least one full result has been discarded. 2013-05-26 01:51:20 +10:00
Con Kolivas
7324a33b55 Only display discarded bytes in avalon if they're not used as nonces. 2013-05-26 01:38:51 +10:00
Con Kolivas
be3224f933 Only loop once through avalon_parse_results, but do so after timeouts as well. 2013-05-26 01:33:32 +10:00
Con Kolivas
1f08809a7f Only debug and move ram if spare bytes exist in avalon buffer. 2013-05-26 01:31:20 +10:00
Con Kolivas
9f59e9a6d6 Remove off by one error. 2013-05-26 01:30:03 +10:00
Con Kolivas
0a82b255eb Inverted logic. 2013-05-26 01:25:43 +10:00
Con Kolivas
b6b1abb5d9 Add more debugging to avalon reads. 2013-05-26 01:24:14 +10:00
Con Kolivas
ab73935875 Convert unsigned size_ts to ints for parsing avalon messages. 2013-05-26 01:17:05 +10:00
Con Kolivas
bb06c2f01b Cope with not finding nonces in avalon parsing gracefully by not overflowing buffers. 2013-05-26 01:05:26 +10:00
Con Kolivas
e9429f3886 Adjust avalon temp values on one lot of valid nonces from the parser. 2013-05-26 00:52:20 +10:00
Con Kolivas
7404446781 Created a threaded message parser for avalon reads. 2013-05-26 00:43:23 +10:00
Con Kolivas
ff44696a20 Avalon_wait_write is not effective during resets so do it after going idle. 2013-05-25 23:21:11 +10:00
Con Kolivas
4794ce702e Send only a single byte reset. 2013-05-25 23:11:45 +10:00
Con Kolivas
e2c4379290 Repeat going idle after avalon reset, and wait for write ready before sending each reset request instead of some arbitrary sleep time. 2013-05-25 22:21:02 +10:00
Con Kolivas
a1cec2cdaf Revert "Send full avalon init task for reset."
This reverts commit fa1bca3118.

No difference.
2013-05-25 22:16:10 +10:00
Con Kolivas
fa1bca3118 Send full avalon init task for reset. 2013-05-25 16:09:46 +10:00
Con Kolivas
c7b1b03085 Timeouts on avalon_read and avalon_write should be 100ms. 2013-05-25 16:04:42 +10:00
Con Kolivas
4ddbe24135 Don't close avalon after detecting it until we're cleaning up, instead using reset for comms failures. 2013-05-25 15:52:08 +10:00
Con Kolivas
18710b14d2 Check for avalon_wait_write before sending reset command. 2013-05-25 15:18:31 +10:00
Con Kolivas
0e071c98f6 Sleep in avalon_write_ready. 2013-05-25 15:07:10 +10:00
Con Kolivas
674539bddc Make avalon_wait_write a bool function and check its return value. 2013-05-25 15:03:02 +10:00
Con Kolivas
290666a124 Show how many idle tasks are sent to avalon if it aborts on buffer full. 2013-05-25 14:54:00 +10:00
Con Kolivas
8b1a247106 Reset avalon->device_fd after it is closed. 2013-05-25 14:48:23 +10:00
Con Kolivas
a640164381 Create an avalon_wait_write function that is used before sending avalon idle command. 2013-05-25 14:42:38 +10:00
Con Kolivas
764f7cc403 Avoid repeating avalon_idle in do_avalon_close and extra sleep. 2013-05-25 14:38:33 +10:00
Con Kolivas
ee4d72e338 Pass fd to avalon_idle. 2013-05-25 14:05:52 +10:00
Con Kolivas
664fd5b4a1 Revert "Change to setting avalon_task to being the pointer for avalon_idle."
This reverts commit 91a82cd81f.
2013-05-25 14:03:45 +10:00
Con Kolivas
91a82cd81f Change to setting avalon_task to being the pointer for avalon_idle. 2013-05-25 13:38:00 +10:00
Con Kolivas
e2578033cb Do avalon_reset after info structure is set up. 2013-05-25 13:27:54 +10:00
Con Kolivas
930317e123 Rework avalon reset sequence to include idling of chips and waiting for them to go idle followed by 2nd reset and then checking result. 2013-05-25 13:25:38 +10:00
Con Kolivas
569a6f65a0 Do a non-blocking read of anything in the avalon buffer after opening the device. 2013-05-25 12:11:26 +10:00
Con Kolivas
6baa23cf62 Assign the avalon info data to the device_data in cgpu_info. 2013-05-25 12:01:12 +10:00
Con Kolivas
69bdc6f988 Fix warnings in avalon driver. 2013-05-03 22:28:37 +10:00
Con Kolivas
ed65653ca6 Simplify the many lines passed as API data in the avalon driver now that the API does not need persistent storage for the name. 2013-05-02 17:32:04 +10:00
Con Kolivas
d08bdfd69f Add extra matching work count data in API for Avalon with 4 modules. 2013-05-02 17:03:31 +10:00
Con Kolivas
5b702bc0da Fix warning on building avalon on win32 2013-04-21 19:36:37 +10:00
Con Kolivas
849567cb35 Use cgtime in driver-avalon.c 2013-04-21 19:19:22 +10:00
James Z.M. Gao
5ba07b9a03 Merge remote-tracking branch 'upstream/master' 2013-04-19 09:03:41 +08:00
Xiangfu
8e8313c974 fliter out the wrong result from adjust fan code 2013-04-19 08:57:07 +08:00
James Z.M. Gao
50cf25942e compile avalon driver on win32 and win64 2013-04-19 08:54:36 +08:00
Con Kolivas
fdfb77e7c2 Unconditionally test for many wrong results on avalon and reset to avoid passing a corrupt avalon result to temperature code. 2013-04-16 22:41:45 +10:00
Con Kolivas
dbab07a12d Only reset an avalon device with no results when there are no results consecutively. 2013-04-15 20:30:02 +10:00
Con Kolivas
c62b985c04 Wrap result wrong tests in avalon scanhash in unlikely() and only consider a hash count of zero wrong if a restart wasn't issued. 2013-04-10 18:42:50 +10:00
Xiangfu
874b25f979 avalon: if result_wrong >= get_work_count jump out the read loop 2013-04-10 14:10:40 +08:00
Xiangfu
dd1c8bd198 fix the fan control on max temp2/3 2013-04-08 23:55:16 +08:00
Xiangfu
f68930138d for some reason network down. one simple cgminer command:
"cgminer -o 127.0.0.1:8888 -O fa:ke --avalon-options 115200:32:10:50:256"
can idle the avalon for safe power and protect chip
2013-04-08 23:41:49 +08:00
Xiangfu
d57a4e0c27 if hash_count == 0; reinit avalon, fix the 0MHS bug
use the max value of temp1 and temp2 for fan control
2013-04-08 23:41:33 +08:00
Con Kolivas
6c5c6e99a3 Reinstate the matching_work_count per subdevice on avalon based on the work subid. 2013-04-08 22:42:31 +10:00
Con Kolivas
c2a6392a9d Avalon driver is missing the drv_id. 2013-04-08 22:29:32 +10:00
Con Kolivas
0c35f67aa9 Make the avalon array size a macro. 2013-04-08 15:36:18 +10:00
Con Kolivas
8a90b5dd10 Use replacement of work items in the avalon buffer as needed instead of flushing them. 2013-04-08 15:05:30 +10:00
Con Kolivas
1c4d1ac863 Reinstate wrong work count to reset avalon regardless and display number of wrong results. 2013-04-08 14:08:54 +10:00
Con Kolivas
47309e1a18 Revert "The result_wrong measurement for avalon is continually leading to false positives so remove it."
This reverts commit 08c0ac290c.
2013-04-08 14:04:38 +10:00
Con Kolivas
af65870244 select() on serial usb in avalon does not work properly with zero timeout. 2013-04-08 12:01:16 +10:00
Con Kolivas
08c0ac290c The result_wrong measurement for avalon is continually leading to false positives so remove it. 2013-04-08 11:59:32 +10:00
Con Kolivas
64ecfa53a9 Revert "Use only 2 queued work arrays in avalon."
This reverts commit 0ea9d68d67.

This was leading to failure to find work items on block changes.
2013-04-08 11:32:24 +10:00
Con Kolivas
af6111fb55 Use no timeout on further reads in avalon_gets 2013-04-08 11:22:25 +10:00
Con Kolivas
ad55fbf906 Do sequential reads in avalon_get_reset to cope with partial reads. 2013-04-08 11:20:10 +10:00
Con Kolivas
385f1cd8d4 Show read discrepancy in avalon_get_reset. 2013-04-08 10:39:16 +10:00
Con Kolivas
4e2b107642 Reuse avalon_get_work_count variable. 2013-04-08 10:37:48 +10:00
Con Kolivas
fb34cb1784 Check for AVA_GETS_RESTART when deciding if avalon has messed up. 2013-04-08 10:34:47 +10:00
Con Kolivas
8b0531fb2b Make the detection of all wrong results on avalon much more conservative to avoid false positives on work restarts. 2013-04-08 10:13:15 +10:00
Con Kolivas
c6b9a3eeea Show error codes on select and read fail in avalon. 2013-04-08 09:48:23 +10:00
Con Kolivas
5e3474b0c8 If we get a restart message in avalon_gets still check if there's a receive message to parse first without a timeout before returning AVA_GETS_RESTART. 2013-04-08 09:04:10 +10:00
Con Kolivas
0ea9d68d67 Use only 2 queued work arrays in avalon. 2013-04-08 08:28:53 +10:00
Con Kolivas
afd6f42703 avalon_gets is always called from the one call site so inline it. 2013-04-07 16:09:26 +10:00
Con Kolivas
3671b2c310 The read_count is unused by the avalon get result code and no longer required for avalon reset so simplify code removing it. 2013-04-07 15:48:35 +10:00
Con Kolivas
dec90b96ad Use a separate avalon_get_reset function for resetting avalon instead of using avalon_get_result. 2013-04-07 15:35:36 +10:00
Con Kolivas
ea70300a59 The current hash count returned by avalon scanhash is just an obfuscated utility counter so make it explicit. 2013-04-07 15:03:08 +10:00
Con Kolivas
53a047d007 Check for a restart before a timeout in message parsing code in avalon. 2013-04-07 14:53:36 +10:00
Con Kolivas
0da8868799 We should check for a restart message before checking for a timeout in avalon scanhash. 2013-04-07 14:45:54 +10:00
Con Kolivas
8e69d75f36 Store the subid for the work item in avalon. 2013-04-07 11:59:14 +10:00
Con Kolivas
d9ba82c607 Fix record_temp_fan function in avalon driver. Patch by Xiangfu <xiangfu@openmobilefree.net> 2013-04-07 02:21:29 +10:00
Con Kolivas
8b2b9b3d3e Remove inappropriate memset of struct avalon result which was corrupting fan values. 2013-04-07 02:06:21 +10:00
Con Kolivas
809fec91a6 Only do_avalon_close once on multiple errors. 2013-04-06 18:27:38 +11:00
Con Kolivas
689f744b62 Reset the result_wrong count on block change in avalon scanhash to prevent false positives for all nonces failed. 2013-04-06 18:12:45 +11:00
Con Kolivas
dd1a0d636a Rotate the avalon work array and free work on AVA_SEND_BUFFER_EMPTY as well. 2013-04-06 15:09:07 +11:00
Con Kolivas
5f041e1a72 Don't get any work if our queue is already full in avalon_fill. 2013-04-06 12:51:59 +11:00
Con Kolivas
b2106b3aed Free avalon->works in the event we call avalon_prepare on failure to initialise. 2013-04-06 11:18:21 +11:00
Con Kolivas
be5a20c8d6 Fix warnings. 2013-04-06 02:29:21 +11:00
Con Kolivas
67be00e41e Create an array of 4 lots of work for avalon and cycle through them. 2013-04-06 02:25:48 +11:00
Con Kolivas
6752c24750 Remove unused per unit matching work count for avalon. 2013-04-06 01:42:45 +11:00
Con Kolivas
7dda3e4402 Rename the confusing avalon_info pointer. 2013-04-06 01:34:40 +11:00
Con Kolivas
2f75a5d89e Simplify avalon scanhash code using the new find_queued_work_bymidstate function. Partially works only. 2013-04-06 01:03:21 +11:00
Con Kolivas
2f371f13f5 Use correct struct device_drv for avalon_drv. 2013-04-05 20:26:29 +11:00
Con Kolivas
23fa953bfc Check enough work is queued before queueing more in avalon_fill. 2013-04-05 18:51:20 +11:00
Con Kolivas
f0806c6828 Actually put the work in the avalon queue. 2013-04-05 18:34:05 +11:00
Con Kolivas
180230220f Rneame avalon_api to avalon_drv. 2013-04-05 18:31:20 +11:00
Con Kolivas
71bae003bc First draft of port of avalon driver to new cgminer queued infrastructure. 2013-04-05 14:52:07 +11:00
Con Kolivas
dea35d3349 Add Makefile entry for driver-avalon. 2013-04-05 13:32:09 +11:00