|   
 
cp_net.h File ReferenceCANpie network functions.  
 More...
 
 
 |  
 Functions |  
| _TvCpStatus  | CpNetBaudrate (_TsCpNet *ptsNetV, _U08 ubBaudSelV) |  
| _TvCpStatus  | CpNetCanMode (_TsCpNet *ptsNetV, _U08 ubModeV) |  
| _TvCpStatus  | CpNetCanState (_TsCpNet *ptsNetV, _TsCpState *ptsStateV) |  
| _TvCpStatus  | CpNetOpen (_U08 ubPhyIfV, _TsCpNet *ptsNetV) |  
| _TvCpStatus  | CpNetClose (_TsCpNet *ptsNetV) |  
| _TvCpStatus  | CpNetInfo (_TsCpPort *ptsPortV, _TsCpHdi *ptsHdiV) |  
| _TvCpStatus  | CpNetMsgRead (_TsCpPort *ptsPortV, _TsCpCanMsg *ptsBufferV, _U32 *pulBufferSizeV) |  
| _TvCpStatus  | CpNetMsgWrite (_TsCpPort *ptsPortV, _TsCpCanMsg *ptsBufferV, _U32 *pulBufferSizeV) |  
| _TvCpStatus  | CpNetStatistic (_TsCpPort *ptsPortV, _TsCpStatistic *ptsStatsV) |  
 
 Detailed Description
The network functions provide the  
 Function Documentation
      
        
          | _TvCpStatus CpNetBaudrate            | 
          ( | 
          _TsCpNet *  | 
           ptsNetV,  | 
         
        
           | 
           | 
          _U08  | 
           ubBaudSelV |   | 
         
        
           | 
          ) | 
           |  |  | 
         
       
 
Set bitrate of CAN controller. 
 
 - Parameters:
 - 
  
     | ptsPortV  | Pointer to CAN port structure  |  
     | ubBaudSelV  | Bitrate selection |  
   
  
- Returns:
 - Error code taken from the CpErr enumeration. If no error occured, the function will return 
CpErr_OK. 
 
This function directly writes to the bit timing registers of the CAN controller. The value for the parameter  ubBaudSelV is taken from the CP_BAUD enumeration. 
  
 
 
      
        
          | _TvCpStatus CpNetCanMode            | 
          ( | 
          _TsCpNet *  | 
           ptsNetV,  | 
         
        
           | 
           | 
          _U08  | 
           ubModeV |   | 
         
        
           | 
          ) | 
           |  |  | 
         
       
 
Set state of CAN controller. 
 
 - Parameters:
 - 
  
     | ptsPortV  | Pointer to CAN port structure  |  
     | ubModeV  | Mode selection |  
   
  
- Returns:
 - Error code taken from the CpErr enumeration. If no error occurred, the function will return 
CpErr_OK. 
 
This function changes the operating mode of the CAN controller. Possible values for mode are defined in the  CP_MODE enumeration. 
  
 
 
      
        
          | _TvCpStatus CpNetCanState            | 
          ( | 
          _TsCpNet *  | 
           ptsNetV,  | 
         
        
           | 
           | 
          _TsCpState *  | 
           ptsStateV |   | 
         
        
           | 
          ) | 
           |  |  | 
         
       
 
Retrieve status of CAN controller. 
 
 - Parameters:
 - 
  
     | ptsPortV  | Pointer to CAN port structure  |  
     | ptsStateV  | Pointer to CAN state structure |  
   
  
- Returns:
 - Error code taken from the CpErr enumeration. If no error occurred, the function will return 
CpErr_OK. 
 
This function retrieved the present state of the CAN controller. Possible values are defined in the  CP_STATE enumeration. The state of the CAN controller is copied to the variable pointer 'ptsStateV'. 
  
 
 
      
        
          | _TvCpStatus CpNetClose            | 
          ( | 
          _TsCpNet *  | 
           ptsNetV           | 
           )  | 
           | 
         
       
 
Release the CAN driver. 
 
 - Parameters:
 - 
  
     | ptsPortV  | Pointer to CAN port structure |  
   
  
- Returns:
 - Error code taken from the CpErr enumeration. If no error occurred, the function will return 
CpErr_OK.  
- See also:
 - CpNetOpen()
 
 
The implementation of this function is dependent on the operating system. Typical tasks might be:  
- 
clear the interrupt vector / routine 
 
- 
close all open paths to the hardware 
 
 
 
 
 
      
        
          | _TvCpStatus CpNetInfo            | 
          ( | 
          _TsCpPort *  | 
           ptsPortV,  | 
         
        
           | 
           | 
          _TsCpHdi *  | 
           ptsHdiV |   | 
         
        
           | 
          ) | 
           |  |  | 
         
       
 
Get hardware description information. 
 
 - Parameters:
 - 
  
     | ptsPortV  | Pointer to CAN port structure  |  
     | ptsHdiV  | Pointer to the Hardware Description Interface structure (_TsCpHdi) |  
   
  
- Returns:
 - Error code taken from the CpErr enumeration. If no error occured, the function will return 
CpErr_OK. 
 
This function retrieves information about the used hardware. 
  
 
 
      
        
          | _TvCpStatus CpNetMsgRead            | 
          ( | 
          _TsCpPort *  | 
           ptsPortV,  | 
         
        
           | 
           | 
          _TsCpCanMsg *  | 
           ptsBufferV,  | 
         
        
           | 
           | 
          _U32 *  | 
           pulBufferSizeV |   | 
         
        
           | 
          ) | 
           |  |  | 
         
       
 
Read a CAN message from controller. 
 
 - Parameters:
 - 
  
     | ptsPortV  | Pointer to CAN port structure  |  
     | ptsBufferV  | Pointer to a CAN message structure  |  
     | pulBufferSizeV  | Pointer to size variable |  
   
  
- Returns:
 - Error code taken from the CpErr enumeration. If no error occured, the function will return 
CpErr_OK. 
 
This function reads the receive queue from a CAN controller. 
  
 
 
      
        
          | _TvCpStatus CpNetMsgWrite            | 
          ( | 
          _TsCpPort *  | 
           ptsPortV,  | 
         
        
           | 
           | 
          _TsCpCanMsg *  | 
           ptsBufferV,  | 
         
        
           | 
           | 
          _U32 *  | 
           pulBufferSizeV |   | 
         
        
           | 
          ) | 
           |  |  | 
         
       
 
Transmit a CAN message. 
 
 - Parameters:
 - 
  
     | ptsPortV  | Pointer to CAN port structure  |  
     | ptsBufferV  | Pointer to a CAN message structure  |  
     | pulBufferSizeV  | Pointer to size variable |  
   
  
- Returns:
 - Error code taken from the CpErr enumeration. If no error occured, the function will return 
CpErr_OK. 
 
This function writes to the transmit queue of a CAN controller. 
  
 
 
      
        
          | _TvCpStatus CpNetOpen            | 
          ( | 
          _U08  | 
           ubPhyIfV,  | 
         
        
           | 
           | 
          _TsCpNet *  | 
           ptsNetV |   | 
         
        
           | 
          ) | 
           |  |  | 
         
       
 
Initialize the CAN driver. 
 
 - Parameters:
 - 
  
     | ubPhyIfV  | CAN channel of the hardware  |  
     | ptsPortV  | Pointer to CAN port structure |  
   
  
- Returns:
 - Error code taken from the CpErr enumeration. If no error occured, the function will return 
CpErr_OK.  
- See also:
 - CpCoreDriverRelease()
 
 
The functions opens the physical CAN interface defined by the parameter  ubPhyIfV. The value for  ubPhyIfV is taken from the enumeration CP_CHANNEL. The function sets up the field members of the CAN port handle  ptsPortV. On success, the function returns CpErr_OK. On failure, the function can return the following values:  
An opened handle to a CAN port must be closed via the  CpNetClose() function. 
  
 
 
      
        
          | _TvCpStatus CpNetStatistic            | 
          ( | 
          _TsCpPort *  | 
           ptsPortV,  | 
         
        
           | 
           | 
          _TsCpStatistic *  | 
           ptsStatsV |   | 
         
        
           | 
          ) | 
           |  |  | 
         
       
 
Read CAN controller statistics. 
 
 - Parameters:
 - 
  
     | ptsPortV  | Pointer to CAN port structure  |  
     | ptsStatsV  | Pointer to statistic data structure |  
   
  
- Returns:
 - Error code taken from the CpErr enumeration. If no error occured, the function will return 
CpErr_OK. 
 
This function copies CAN statistic information to the structure pointed by ptsStatsV. 
  
 
  
 
  
 |