예제 #1
0
파일: network.c 프로젝트: m1ch3l4/libraries
void network_send_end(uint16_t len, uint8_t *buf) {
    if (len > 0)
    {
        enc28j60PacketSendReset();
        enc28j60WriteBuffer(len,buf);
    }
    enc28j60PacketSendEnd();
}
예제 #2
0
/******************************************************************************
 * Function:        void SOCKETWriteBuffer(unsigned char* _buf, unsigned int _size, unsigned int _start)
 *
 * PreCondition:    none
 *
 * Input:           *_buf:  buffer to write data 
 *                  _size:  amount data to write
 *                  _start: socket's buffer start address
 *
 * Output:          None
 *
 * Side Effects:    None
 *
 * Overview:        Writes bytes to Socket RX/TX Buffer space
 *
 * Note:            None
 *****************************************************************************/
void SOCKETWriteBuffer(unsigned char* _buf, unsigned int _size, unsigned int _start)
{
    // Set the write pointer to start of socket buffer area
    enc28j60Write(EWRPTL, low(_start));
    enc28j60Write(EWRPTH, high(_start));
    
    // copy the packet into the socket buffer
    enc28j60WriteBuffer(_size, _buf);
    
}
예제 #3
0
void vram_write(U8 pointer, U8 *data, U8 len)
{
	// Check the lenght
	if(len >= vramBUF_len)
		return;
		
	// Set the write pointer to start of transmit buffer area
	enc28j60WriteWord(EWRPTL, vramBUF_start + pointer);

	// Load data into the ENC28J60 RAM
	enc28j60WriteBuffer(len, data);
}
예제 #4
0
/******************************************************************************
 * Function:        void MACWriteTXBufferOffset(unsigned char* _buf, unsigned int _size, unsigned int offset_len)
 *
 * PreCondition:    none
 *
 * Input:           *_buf: buffer to write data 
 *                  _size: amount data to write
 *                  offset:memory pointer to write data
 *
 * Output:          None
 *
 * Side Effects:    None
 *
 * Overview:        Writes bytes to TX Buffer space and skips offset
 *
 * Note:            None
 *****************************************************************************/
void MACWriteTXBufferOffset(unsigned char* _buf, unsigned int _size, unsigned int offset_len)
{
    // calc offset
    unsigned int offsetStart  = TXSTART_INIT + offset_len;
    unsigned int offsetEnd    = offsetStart + _size; 
    
    // Set the write pointer to start of transmit buffer area
    enc28j60Write(EWRPTL, low(offsetStart));
    enc28j60Write(EWRPTH, high(offsetStart));
    
    // Set the TXND pointer to correspond to the packet size given
    enc28j60Write(ETXNDL, low(offsetEnd));
    enc28j60Write(ETXNDH, high(offsetEnd));
    
    // write per-packet control byte (0x00 means use macon3 settings)
    enc28j60WriteOp(ENC28J60_WRITE_BUF_MEM, 0, 0x00);
    
    // copy the packet into the transmit buffer
    enc28j60WriteBuffer(_size, _buf);
}