Changeset 727 for trunk/spi.c
- Timestamp:
- Sep 18, 2009 5:50:56 PM (4 years ago)
- File:
-
- 1 edited
-
trunk/spi.c (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/spi.c
r724 r727 119 119 } 120 120 121 int spi_send_multicommand(struct spi_command * spicommands)121 int spi_send_multicommand(struct spi_command *cmds) 122 122 { 123 123 if (!spi_programmer[spi_controller].multicommand) { … … 127 127 } 128 128 129 return spi_programmer[spi_controller].multicommand( spicommands);129 return spi_programmer[spi_controller].multicommand(cmds); 130 130 } 131 131 … … 149 149 } 150 150 151 int default_spi_send_multicommand(struct spi_command * spicommands)151 int default_spi_send_multicommand(struct spi_command *cmds) 152 152 { 153 153 int result = 0; 154 while ((spicommands->writecnt || spicommands->readcnt) && !result) { 155 result = spi_send_command(spicommands->writecnt, spicommands->readcnt, 156 spicommands->writearr, spicommands->readarr); 157 spicommands++; 154 for (; (cmds->writecnt || cmds->readcnt) && !result; cmds++) { 155 result = spi_send_command(cmds->writecnt, cmds->readcnt, 156 cmds->writearr, cmds->readarr); 158 157 } 159 158 return result; … … 495 494 { 496 495 int result; 497 struct spi_command spicommands[] = {496 struct spi_command cmds[] = { 498 497 { 499 498 .writecnt = JEDEC_WREN_OUTSIZE, … … 519 518 } 520 519 521 result = spi_send_multicommand( spicommands);520 result = spi_send_multicommand(cmds); 522 521 if (result) { 523 522 fprintf(stderr, "%s failed during command execution\n", … … 541 540 { 542 541 int result; 543 struct spi_command spicommands[] = {542 struct spi_command cmds[] = { 544 543 { 545 544 .writecnt = JEDEC_WREN_OUTSIZE, … … 565 564 } 566 565 567 result = spi_send_multicommand( spicommands);566 result = spi_send_multicommand(cmds); 568 567 if (result) { 569 568 fprintf(stderr, "%s failed during command execution\n", __func__); … … 597 596 { 598 597 int result; 599 struct spi_command spicommands[] = {598 struct spi_command cmds[] = { 600 599 { 601 600 .writecnt = JEDEC_WREN_OUTSIZE, … … 615 614 }}; 616 615 617 result = spi_send_multicommand( spicommands);616 result = spi_send_multicommand(cmds); 618 617 if (result) { 619 618 fprintf(stderr, "%s failed during command execution\n", … … 641 640 { 642 641 int result; 643 struct spi_command spicommands[] = {642 struct spi_command cmds[] = { 644 643 { 645 644 .writecnt = JEDEC_WREN_OUTSIZE, … … 659 658 }}; 660 659 661 result = spi_send_multicommand( spicommands);660 result = spi_send_multicommand(cmds); 662 661 if (result) { 663 662 fprintf(stderr, "%s failed during command execution\n", __func__); … … 703 702 { 704 703 int result; 705 struct spi_command spicommands[] = {704 struct spi_command cmds[] = { 706 705 { 707 706 .writecnt = JEDEC_WREN_OUTSIZE, … … 721 720 }}; 722 721 723 result = spi_send_multicommand( spicommands);722 result = spi_send_multicommand(cmds); 724 723 if (result) { 725 724 fprintf(stderr, "%s failed during command execution\n", … … 780 779 { 781 780 int result; 782 struct spi_command spicommands[] = {781 struct spi_command cmds[] = { 783 782 { 784 783 .writecnt = JEDEC_EWSR_OUTSIZE, … … 798 797 }}; 799 798 800 result = spi_send_multicommand( spicommands);799 result = spi_send_multicommand(cmds); 801 800 if (result) { 802 801 fprintf(stderr, "%s failed during command execution\n", … … 809 808 { 810 809 int result; 811 struct spi_command spicommands[] = {810 struct spi_command cmds[] = { 812 811 { 813 812 .writecnt = JEDEC_WREN_OUTSIZE, … … 827 826 }}; 828 827 829 result = spi_send_multicommand( spicommands);828 result = spi_send_multicommand(cmds); 830 829 if (result) { 831 830 fprintf(stderr, "%s failed during command execution\n", … … 845 844 (address >> 0) & 0xff, 846 845 }; 847 struct spi_command spicommands[] = {846 struct spi_command cmds[] = { 848 847 { 849 848 .writecnt = JEDEC_WREN_OUTSIZE, … … 874 873 memcpy(&cmd[4], bytes, len); 875 874 876 result = spi_send_multicommand( spicommands);875 result = spi_send_multicommand(cmds); 877 876 if (result) { 878 877 fprintf(stderr, "%s failed during command execution\n",
Note: See TracChangeset
for help on using the changeset viewer.
