Dword Demodulator_writeTunerRegisters ( IN Demodulator* demodulator, IN Byte chip, IN Word registerAddress, IN Byte bufferLength, IN Byte* buffer ) { return (Standard_writeTunerRegisters (demodulator, chip, registerAddress, bufferLength, buffer)); }
/***************************************************************************** ** ** Name: MT_WriteSub ** ** Description: Write values to device using a two-wire serial bus. ** ** Parameters: handle - User-specific I/O parameter that was ** passed to tuner's Open function. ** addr - device serial bus address (value passed ** as parameter to MTxxxx_Open) ** subAddress - serial bus sub-address (Register Address) ** data - pointer to the Data to be written to the ** device ** cnt - number of bytes/registers to be written ** ** Returns: status: ** MT_OK - No errors ** MT_COMM_ERR - Serial bus communications error ** user-defined ** ** Notes: This is a callback function that is called from the ** the tuning algorithm. You MUST provide code for this ** function to write data using the tuner's 2-wire serial ** bus. ** ** The handle parameter is a user-specific argument. ** If additional arguments are needed for the user's ** serial bus read/write functions, this argument can be ** used to supply the necessary information. ** The handle parameter is initialized in the tuner's Open ** function. ** ** Revision History: ** ** SCR Date Author Description ** ------------------------------------------------------------------------- ** N/A 03-25-2004 DAD Original ** *****************************************************************************/ UData_t MT2260_WriteSub(Handle_t handle, UData_t addr, U8Data subAddress, U8Data *data, UData_t cnt) { UData_t status = MT_OK; /* Status to be returned */ /* ** ToDo: Add code here to implement a serial-bus write ** operation to the MTxxxx tuner. If successful, ** return MT_OK. */ PUserData userData; U8Data * buffer; U8Data i; U8Data blocks; U8Data remains; blocks = (U8Data) (cnt / 17); remains = (U8Data) (cnt % 17); userData = (PUserData) handle; buffer = data; for (i = 0; i < blocks; i++) { status = Standard_writeTunerRegisters (userData->demodulator, userData->chip, (unsigned short)subAddress + (unsigned short)i * 17, 17, buffer); if (status) goto exit; buffer += 17; } if (remains) { status = Standard_writeTunerRegisters (userData->demodulator, userData->chip, (unsigned short)subAddress + (unsigned short)i * 17, remains, buffer); if (status) goto exit; } exit: return (status); }