void wlan_start(unsigned short usPatchesAvailableAtHost) { tSLInformation.NumberOfSentPackets = 0; tSLInformation.NumberOfReleasedPackets = 0; tSLInformation.usRxEventOpcode = 0; tSLInformation.usNumberOfFreeBuffers = 0; tSLInformation.usSlBufferLength = 0; tSLInformation.usBufferSize = 0; tSLInformation.usRxDataPending = 0; tSLInformation.slTransmitDataError = 0; tSLInformation.usEventOrDataReceived = 0; tSLInformation.pucReceivedData = 0; // Allocate the memory for the RX/TX data transactions tSLInformation.pucTxCommandBuffer = (unsigned char *)wlan_tx_buffer; // init spi SpiOpen(SpiReceiveHandler); SimpleLink_Init_Start(usPatchesAvailableAtHost); // Read Buffer's size and finish hci_command_send(HCI_CMND_READ_BUFFER_SIZE, tSLInformation.pucTxCommandBuffer, 0); SimpleLinkWaitEvent(HCI_CMND_READ_BUFFER_SIZE, 0); }
void wlan_start(uint16_t usPatchesAvailableAtHost) { cc3000_lib_lock(); tSLInformation.NumberOfSentPackets = 0; tSLInformation.NumberOfReleasedPackets = 0; tSLInformation.usRxEventOpcode = 0; tSLInformation.usNumberOfFreeBuffers = 0; tSLInformation.usSlBufferLength = 0; tSLInformation.usBufferSize = 0; tSLInformation.usRxDataPending = 0; tSLInformation.slTransmitDataError = 0; tSLInformation.usEventOrDataReceived = 0; tSLInformation.pucReceivedData = 0; /* Init spi */ cc3000_open(SpiReceiveHandler); SimpleLink_Init_Start(usPatchesAvailableAtHost); /* Read Buffer's size and finish */ hci_command_send(HCI_CMND_READ_BUFFER_SIZE, tSLInformation.pucTxCommandBuffer, 0); SimpleLinkWaitEvent(HCI_CMND_READ_BUFFER_SIZE, 0); cc3000_lib_unlock(); }
void wlan_start(unsigned short usPatchesAvailableAtHost) { unsigned long ulSpiIRQState; tSLInformation.NumberOfSentPackets = 0; tSLInformation.NumberOfReleasedPackets = 0; tSLInformation.usRxEventOpcode = 0; tSLInformation.usNumberOfFreeBuffers = 0; tSLInformation.usSlBufferLength = 0; tSLInformation.usBufferSize = 0; tSLInformation.usRxDataPending = 0; tSLInformation.slTransmitDataError = 0; tSLInformation.usEventOrDataReceived = 0; tSLInformation.pucReceivedData = 0; // Allocate the memory for the RX/TX data transactions tSLInformation.pucTxCommandBuffer = (unsigned char *)wlan_tx_buffer; // init spi SpiOpen(SpiReceiveHandler); // Check the IRQ line ulSpiIRQState = tSLInformation.ReadWlanInterruptPin(); // Chip enable: toggle WLAN EN line tSLInformation.WriteWlanPin( WLAN_ENABLE ); if (ulSpiIRQState) { // wait till the IRQ line goes low while(tSLInformation.ReadWlanInterruptPin() != 0) { } } else { // wait till the IRQ line goes high and than low while(tSLInformation.ReadWlanInterruptPin() == 0) { } while(tSLInformation.ReadWlanInterruptPin() != 0) { } } SimpleLink_Init_Start(usPatchesAvailableAtHost); //PORTD |= (1 << PD7) | (1 << PD6); //PORTB |= (1 << PB4); // Read Buffer's size and finish hci_command_send(HCI_CMND_READ_BUFFER_SIZE, tSLInformation.pucTxCommandBuffer, 0); SimpleLinkWaitEvent(HCI_CMND_READ_BUFFER_SIZE, 0); }