NetBurner 3.1
nbWifiSpi.h
Go to the documentation of this file.
1 /*NB_REVISION*/
2 
3 /*NB_COPYRIGHT*/
4 
9 #ifndef __NBWIFISPI_H
10 #define __NBWIFISPI_H
11 
12 #include <buffers.h>
13 #include <nettypes.h>
14 #include <netinterface.h>
15 #include <constants.h>
16 #include <utils.h>
18 
19 namespace NB {
20 
21 class NBWifiSPI : public NBWifi
22 {
23  enum BusDirection {
24  MASTER_RX = 0x0,
25  MASTER_TX = 0x1,
26  };
27  int m_moduleNum; // Select SPI for platforms with multiple SPI
28  int m_csNum; // SPI chip select, or -1 to use a GPIO as a chip select
29  int m_IRQNum; // IRQ number/priority
30  int m_csConnector; // Connector containing the chip select
31  int m_gpioPinNum; // Used only if a GPIO signal is used for SPI chip select
32  OS_SEM BusTransferSem;
33  OS_SEM SlaveReadySem;
34 
35  static void ISR_0();
36  static void ISR_1();
37 
38  void RXTask() override;
39  virtual void SendBusMessage_Core( PoolPtr txMessage ) override;
40  virtual void TransmitBuffer_Core( PoolPtr txBuffer, uint8_t credits ) override;
41 
42  friend class Wifi;
43  friend class NBWifi;
44 
45  public:
46 
47  /* InterfaceBlock virtual functions */
48  void send_func( PoolPtr poolPtr ) override;
49  void kill_if() override;
50  void EnableMulticast( MACADR macAddress, BOOL addAddress ) override;
51  bool LinkActive() override;
52  int LinkSpeed() override;
53  bool LinkDuplex() override;
54  const char* GetInterfaceName() override;
55 
56 
57  void SendCreditRequest() override;
58  void SendCreditReport( uint8_t credits = 0xFF ) override;
59  virtual bool SetBusSpeed( uint32_t busSpeed ) override;
60  NBWifiSPI( int irqNum, int moduleNum, int csNum, int connectorNum, int csGpioPinNum, int resetPinNum, const char * name );
61 };
62 
63 } /* ----- end of namespace NB ----- */
64 
65 #endif /* ----- #ifndef __NBWIFISPI_H ----- */
Semaphores are used to control access to shared resource critical section, or to communicate between ...
Definition: nbrtos.h:318
Definition: dhcpv6_internal.h:34
NetBurner Buffers API.