static __inline void send_ctrl_cmd(unsigned int cmd)
{
    unsigned char high_8bit = (cmd>>8)&0x00FF;
	unsigned char low_8bit = cmd&0x00FF;
    spi_send_data(0x2000|high_8bit);
	spi_send_data(0x0000|low_8bit);
}
Beispiel #2
0
void spi_poll(void)
{ /* INTERRUPT CONTEXT CALL*/
    if (!poll_started){
        spi_send_data(POLL_DATA0.data, POLL_DATA0.length, spi_ch0);
        spi_send_data(POLL_DATA1.data, POLL_DATA1.length, spi_ch1);
        spi_send_data(POLL_DATA2.data, POLL_DATA2.length, spi_ch2);
    }
}
Beispiel #3
0
static __inline void send_data_cmd(unsigned int data)
{
  dbg_print("===> [ILI9481_DPI] <%s %s> %s:%d %s(): : data:0x%x \n", __DATE__, __TIME__, __FILE__, __LINE__, __func__, data); 

  unsigned int out = (data & 0xFF)| 0x100;
  spi_send_data(out);
}
Beispiel #4
0
static __inline void send_ctrl_cmd(unsigned int cmd)
{
  dbg_print("===> [ILI9481_DPI] <%s %s> %s:%d %s(): cmd:0x%x \n", __DATE__, __TIME__, __FILE__, __LINE__, __func__,cmd); 

  unsigned int out = (cmd & 0xFF); 
  spi_send_data(out);
}
static __inline void send_data_cmd(unsigned int data)
{
    SET_LSCE_HIGH;
    SET_LSDA_HIGH;
    SET_LSCK_HIGH;

    SET_LSCE_LOW;
    UDELAY(1);

    SET_LSCK_LOW;
    SET_LSDA_HIGH;
    UDELAY(1);

    SET_LSCK_HIGH;
    UDELAY(1);

    spi_send_data(data);

    SET_LSCK_HIGH;
    SET_LSDA_HIGH;
    SET_LSCE_HIGH;
    UDELAY(1);
}
static __inline void send_ctrl_cmd(unsigned int cmd)
{
    SET_LSCE_HIGH;
    SET_LSDA_HIGH;
    SET_LSCK_HIGH;

    SET_LSCE_LOW;
    UDELAY(1);

    SET_LSCK_LOW;
    SET_LSDA_LOW;
    UDELAY(1);

    SET_LSCK_HIGH;
    UDELAY(1);

    spi_send_data(cmd);

    SET_LSCK_HIGH;
    SET_LSDA_HIGH;
    SET_LSCE_HIGH;
    UDELAY(1);
}
Beispiel #7
0
static int write_data (
	uint8 *buff,	/* 512 byte data block to be transmitted */
	uint8 token	/* Data/Stop token */
)
{
	uint8 resp;
	uint16 crc;
	int old;

	if (wait_ready() != 0xFF) 
		return -1;

	spi_send_byte(token);	 /* Xmit data token */
	
	if (token != 0xFD) {	/* Is data token */
	
		dcache_pref_range((uint32)buff, 512);
		crc = net_crc16ccitt(buff, 512, 0);
		
		old = irq_disable();
		
		spi_send_data(buff, 512);
		spi_send_byte((uint8)(crc >> 8));
		spi_send_byte((uint8)crc);
		
		irq_restore(old);
		
		resp = spi_rec_byte();				/* Reсeive data response */
		
		if ((resp & 0x1F) != 0x05) {		/* If not accepted, return with error */
#ifdef SD_DEBUG
			dbglog(DBG_DEBUG, "%s: not accepted: %02x\n", __func__, resp);
#endif
			errno = EIO;
			return -1;
		}
	}
static __inline void send_data_cmd(unsigned int data)
{
    unsigned int out = (DATA_ID  | (data & 0xFF));
    spi_send_data(out);
}
static __inline void send_ctrl_cmd(unsigned int cmd)
{
    unsigned int out = (CTRL_ID | (cmd & 0xFF));
    spi_send_data(out);
}
Beispiel #10
0
static void send_data_cmd(unsigned int data)
{
    unsigned int out = (DEVIE_ID | (0x2 << 16) | data );
    spi_send_data(out);
}
Beispiel #11
0
void send_ctrl_cmd(unsigned int cmd)
{
    unsigned int out = (DEVIE_ID | cmd );
    spi_send_data(out);
}
static __inline void Write_register(unsigned int data) 
{ 
	unsigned int out = ((HX_WR_REGISTER<<16) |(data & 0xFFFF)); 
	spi_send_data(out); 
} 
static __inline void Write_com(unsigned int cmd) 
{ 
	unsigned int out = ((HX_WR_COM<<16) | (cmd & 0xFFFF)); 
	spi_send_data(out); 
} 
static __inline void send_data_cmd(unsigned int data)
{
    unsigned char high_8bit = (data>>8)&0x00FF;
	unsigned char low_8bit = data&0x00FF;
    spi_send_data(0x4000|low_8bit);
}
Beispiel #15
0
/**
 * \ingroup sd_raw
 * Writes raw data to the card.
 *
 * \note If write buffering is enabled, you might have to
 *       call sd_raw_sync() before disconnecting the card
 *       to ensure all remaining data has been written.
 *
 * \param[in] offset The offset where to start writing.
 * \param[in] buffer The buffer containing the data to be written.
 * \param[in] length The number of bytes to write.
 * \returns 0 on failure, 1 on success.
 * \see sd_raw_write_interval, sd_raw_read, sd_raw_read_interval
 */
uint8_t sd_raw_write(uint32_t offset, const uint8_t* buffer, uint16_t length)
{
#if SD_RAW_WRITE_SUPPORT

    if(get_pin_locked())
        return 0;

    uint32_t block_address;
    uint16_t block_offset;
    uint16_t write_length;
    while(length > 0)
    {
        /* determine byte count to write at once */
        block_address = offset & 0xfffffe00;
        block_offset = offset & 0x01ff;
        write_length = 512 - block_offset; /* write up to block border */
        if(write_length > length)
            write_length = length;
        
        /* Merge the data to write with the content of the block.
         * Use the cached block if available.
         */
        if(block_address != raw_block_address)
        {
#if SD_RAW_WRITE_BUFFERING
            if(!sd_raw_sync())
                return 0;
#endif

            if(block_offset || write_length < 512)
            {
                if(!sd_raw_read(block_address, raw_block, sizeof(raw_block)))
                    return 0;
            }
            raw_block_address = block_address;
        }

        if(buffer != raw_block)
        {
            memcpy(raw_block + block_offset, buffer, write_length);

#if SD_RAW_WRITE_BUFFERING
            raw_block_written = 0;

            if(length == write_length)
                return 1;
#endif
        }

        /* address card */
        select_card();

        /* send single block request */
        if(sd_raw_send_command_r1(CMD_WRITE_SINGLE_BLOCK, block_address))
        {
            unselect_card();
            spi_rec_byte();
            return 0;
        }

        /* send start byte */
        spi_send_byte(0xfe);

        /* write byte block */
        spi_send_data(raw_block, 512);

        /* write dummy crc16 */
        spi_send_byte(0xff);
        spi_send_byte(0xff);

        /* wait while card is busy */
/*
        uint16_t i;
        for(i = 0; i < 0x7fff; ++i)
        {
            if(spi_rec_byte() == 0xff)
                break;
        }
        if(i >= 0x7fff)
        {
            unselect_card();
            spi_rec_byte();
            return 0;
        }
*/
		// obiger code reicht bei langsamen Karten nicht aus!
		// daher nachfolgende alte Version mit endlos Warteschleife
		// Wil.
        while(spi_rec_byte() != 0xff);
        spi_rec_byte();

        /* deaddress card */
        unselect_card();

        buffer += write_length;
        offset += write_length;
        length -= write_length;

#if SD_RAW_WRITE_BUFFERING
        raw_block_written = 1;
#endif
    }

    return 1;
#else
    return 0;
#endif
}
static int init_lcd_panel(struct spi_device *spi)
{
	//rm68040
	//IOVCC=VCC=2.8V
	spi_send_cmd(spi, 0x11);
	mdelay(20);
	spi_send_cmd(spi, 0xB4);
	spi_send_data(spi, 0x10);

	spi_send_cmd(spi, 0xD0);
	spi_send_data(spi, 0x07);//02
	spi_send_data(spi, 0x41);
	spi_send_data(spi, 0x1D);//13

	spi_send_cmd(spi, 0xD1);
	spi_send_data(spi, 0x00);//00
	spi_send_data(spi, 0x0e);//0X28
	spi_send_data(spi, 0x0e);//19

	spi_send_cmd(spi, 0xD2);
	spi_send_data(spi, 0x01);
	spi_send_data(spi, 0x11);

	spi_send_cmd(spi, 0xC0);
	spi_send_data(spi, 0x00);
	spi_send_data(spi, 0x3B);
	spi_send_data(spi, 0x00);
	spi_send_data(spi, 0x02);//12
	spi_send_data(spi, 0x11);//01

	spi_send_cmd(spi, 0xC1);
	spi_send_data(spi, 0x10);
	//spi_send_data(spi, 0x11);
	spi_send_data(spi, 0x13);
	spi_send_data(spi, 0x88);

	spi_send_cmd(spi, 0xC5);
	spi_send_data(spi, 0x02);
	//spi_send_data(spi, 0x07);

	spi_send_cmd(spi, 0xC6);
	spi_send_data(spi, 0x03);

	spi_send_cmd(spi, 0xC8);
	spi_send_data(spi, 0x02);
	spi_send_data(spi, 0x46);
	spi_send_data(spi, 0x14);
	spi_send_data(spi, 0x31);
	spi_send_data(spi, 0x0A);
	spi_send_data(spi, 0x04);
	spi_send_data(spi, 0x37);
	spi_send_data(spi, 0x24);
	spi_send_data(spi, 0x57);
	spi_send_data(spi, 0x13);
	spi_send_data(spi, 0x06);
	spi_send_data(spi, 0x0C);

	spi_send_cmd(spi, 0xF3);
	spi_send_data(spi, 0x24);
	spi_send_data(spi, 0x1A);

	spi_send_cmd(spi, 0xF6);
	spi_send_data(spi, 0x80);

	spi_send_cmd(spi, 0xF7);
	spi_send_data(spi, 0x80);

	spi_send_cmd(spi, 0x36);
	spi_send_data(spi, 0x0A);
	//spi_send_data(spi, 0x08);

	spi_send_cmd(spi, 0x3A);
	spi_send_data(spi, 0x66);

	spi_send_cmd(spi, 0x2A);
	spi_send_data(spi, 0x00);
	spi_send_data(spi, 0x00);
	spi_send_data(spi, 0x01);
	spi_send_data(spi, 0x3F);

	spi_send_cmd(spi, 0x2B);
	spi_send_data(spi, 0x00);
	spi_send_data(spi, 0x00);
	spi_send_data(spi, 0x01);
	spi_send_data(spi, 0xDF);

	mdelay(120);
	spi_send_cmd(spi, 0x29);

	//udelay(120000);
	//spi_send_cmd(spi, 0x2C);
	return 0;
}