Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Impressum cxd2880_devio_spi.c

  Sprache: C
 

// SPDX-License-Identifier: GPL-2.0
/*
 * cxd2880_devio_spi.c
 * Sony CXD2880 DVB-T2/T tuner + demodulator driver
 * I/O interface via SPI
 *
 * Copyright (C) 2016, 2017, 2018 Sony Semiconductor Solutions Corporation
 */


#include "cxd2880_devio_spi.h"

#define BURST_WRITE_MAX 128

static int cxd2880_io_spi_read_reg(struct cxd2880_io *io,
       enum cxd2880_io_tgt tgt,
       u8 sub_address, u8 *data,
       u32 size)
{
 int ret = 0;
 struct cxd2880_spi *spi = NULL;
 u8 send_data[6];
 u8 *read_data_top = data;

 if (!io || !io->if_object || !data)
  return -EINVAL;

 if (sub_address + size > 0x100)
  return -EINVAL;

 spi = io->if_object;

 if (tgt == CXD2880_IO_TGT_SYS)
  send_data[0] = 0x0b;
 else
  send_data[0] = 0x0a;

 send_data[3] = 0;
 send_data[4] = 0;
 send_data[5] = 0;

 while (size > 0) {
  send_data[1] = sub_address;
  if (size > 255)
   send_data[2] = 255;
  else
   send_data[2] = size;

  ret =
      spi->write_read(spi, send_data, sizeof(send_data),
        read_data_top, send_data[2]);
  if (ret)
   return ret;

  sub_address += send_data[2];
  read_data_top += send_data[2];
  size -= send_data[2];
 }

 return ret;
}

static int cxd2880_io_spi_write_reg(struct cxd2880_io *io,
        enum cxd2880_io_tgt tgt,
        u8 sub_address,
        const u8 *data, u32 size)
{
 int ret = 0;
 struct cxd2880_spi *spi = NULL;
 u8 send_data[BURST_WRITE_MAX + 4];
 const u8 *write_data_top = data;

 if (!io || !io->if_object || !data)
  return -EINVAL;

 if (size > BURST_WRITE_MAX)
  return -EINVAL;

 if (sub_address + size > 0x100)
  return -EINVAL;

 spi = io->if_object;

 if (tgt == CXD2880_IO_TGT_SYS)
  send_data[0] = 0x0f;
 else
  send_data[0] = 0x0e;

 while (size > 0) {
  send_data[1] = sub_address;
  if (size > 255)
   send_data[2] = 255;
  else
   send_data[2] = size;

  memcpy(&send_data[3], write_data_top, send_data[2]);

  if (tgt == CXD2880_IO_TGT_SYS) {
   send_data[3 + send_data[2]] = 0x00;
   ret = spi->write(spi, send_data, send_data[2] + 4);
  } else {
   ret = spi->write(spi, send_data, send_data[2] + 3);
  }
  if (ret)
   return ret;

  sub_address += send_data[2];
  write_data_top += send_data[2];
  size -= send_data[2];
 }

 return ret;
}

int cxd2880_io_spi_create(struct cxd2880_io *io,
     struct cxd2880_spi *spi, u8 slave_select)
{
 if (!io || !spi)
  return -EINVAL;

 io->read_regs = cxd2880_io_spi_read_reg;
 io->write_regs = cxd2880_io_spi_write_reg;
 io->write_reg = cxd2880_io_common_write_one_reg;
 io->if_object = spi;
 io->i2c_address_sys = 0;
 io->i2c_address_demod = 0;
 io->slave_select = slave_select;

 return 0;
}

Messung V0.5 in Prozent
C=95 H=88 G=91

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.15Bemerkung:  (vorverarbeitet am  2026-06-05) ¤

*Bot Zugriff






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=655579