Lines Matching refs:popt
71 static int interpret_command_bytes(const char *parg, struct spi_options *popt);
72 static void * prep_write_buffer(struct spi_options *popt);
74 static int _do_data_output(void *pr, struct spi_options *popt);
76 static int set_mode(int hdev, struct spi_options *popt);
77 static int set_speed(int hdev, struct spi_options *popt);
79 static int perform_read(int hdev, struct spi_options *popt);
80 static int perform_write(int hdev, struct spi_options *popt);
81 static int perform_readwrite(int hdev, struct spi_options *popt);
382 interpret_command_bytes(const char *parg, struct spi_options *popt) in interpret_command_bytes() argument
391 popt->pcmd = (uint8_t *)malloc(cbcmd); in interpret_command_bytes()
393 if (!popt->pcmd) in interpret_command_bytes()
396 pcur = popt->pcmd; in interpret_command_bytes()
425 ptemp = realloc(popt->pcmd, cbcmd); in interpret_command_bytes()
435 popt->pcmd = (uint8_t *)ptemp; in interpret_command_bytes()
436 pcur = popt->pcmd + ctr; in interpret_command_bytes()
439 if (popt->lsb) in interpret_command_bytes()
448 popt->ncmd = ctr; /* record num bytes in '-C' argument */ in interpret_command_bytes()
487 set_mode(int hdev, struct spi_options *popt) in set_mode() argument
489 uint32_t fmode = popt->mode; in set_mode()
491 if (popt->mode < 0) /* use default? */ in set_mode()
498 set_speed(int hdev, struct spi_options *popt) in set_speed() argument
500 uint32_t clock_speed = popt->speed; in set_speed()
502 if (popt->speed < 0) in set_speed()
522 prep_write_buffer(struct spi_options *popt) in prep_write_buffer() argument
529 ncmd = popt->ncmd; /* num command bytes (can be zero) */ in prep_write_buffer()
531 if (ncmd == 0 && popt->count == 0) in prep_write_buffer()
535 if (popt->count < 0) { in prep_write_buffer()
539 cbdata = popt->count; in prep_write_buffer()
542 lsb = popt->lsb; /* non-zero if LSB order; else MSB */ in prep_write_buffer()
552 if (popt->pcmd && ncmd > 0) { in prep_write_buffer()
553 memcpy(pdata, popt->pcmd, ncmd); /* copy command bytes */ in prep_write_buffer()
568 if (popt->ASCII) { in prep_write_buffer()
619 if (popt->verbose > 0) { in prep_write_buffer()
627 if (popt->ASCII) in prep_write_buffer()
639 if (popt->count < 0) { in prep_write_buffer()
640 popt->count = cbread; in prep_write_buffer()
658 if (popt->verbose > 0 && popt->count + popt->ncmd) { in prep_write_buffer()
659 if ((popt->count + popt->ncmd) == 1) in prep_write_buffer()
665 popt->count + popt->ncmd, szbytes); in prep_write_buffer()
667 verbose_dump_buffer(pdata, popt->count + popt->ncmd, lsb); in prep_write_buffer()
720 _do_data_output(void *pr, struct spi_options *popt) in _do_data_output() argument
726 pbuf = (uint8_t *)pr + popt->ncmd; /* only the data we want */ in _do_data_output()
727 icount = popt->count; in _do_data_output()
739 if (popt->ncmd != 1) in _do_data_output()
745 if (popt->binary || !popt->ASCII) { in _do_data_output()
746 if (popt->verbose > 0) in _do_data_output()
753 if (popt->verbose > 0) in _do_data_output()
778 else if (popt->verbose > 0 && icount) { in _do_data_output()
781 popt->ncmd, sz_byte2, icount, sz_bytes); in _do_data_output()
784 verbose_dump_buffer(pr, icount + popt->ncmd, popt->lsb); in _do_data_output()
791 perform_read(int hdev, struct spi_options *popt) in perform_read() argument
797 icount = popt->count + popt->ncmd; in perform_read()
810 if (popt->pcmd && popt->ncmd > 0) in perform_read()
811 memcpy(pw, popt->pcmd, popt->ncmd); in perform_read()
822 err = _read_write(hdev, pw, pr, icount, popt->lsb); in perform_read()
824 if (!err && popt->count > 0) in perform_read()
825 err = _do_data_output(pr, popt); in perform_read()
836 perform_write(int hdev, struct spi_options *popt) in perform_write() argument
843 pw = prep_write_buffer(popt); in perform_write()
850 err = _read_write(hdev, pw, NULL, popt->count + popt->ncmd, popt->lsb); in perform_write()
860 perform_readwrite(int hdev, struct spi_options *popt) in perform_readwrite() argument
867 pw = prep_write_buffer(popt); in perform_readwrite()
868 icount = popt->count + popt->ncmd; /* assign after fn call */ in perform_readwrite()
884 err = _read_write(hdev, pw, pr, icount, popt->lsb); in perform_readwrite()
887 err = _do_data_output(pr, popt); in perform_readwrite()