OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [ARM7_STR75x_GCC/] [STLibrary/] [inc/] [75x_can.h] - Blame information for rev 577

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 577 jeremybenn
/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
2
* File Name          : 75x_can.h
3
* Author             : MCD Application Team
4
* Date First Issued  : 03/10/2006
5
* Description        : This file contains all the functions prototypes for the
6
*                      CAN bus software library.
7
********************************************************************************
8
* History:
9
* 07/17/2006 : V1.0
10
* 03/10/2006 : V0.1
11
********************************************************************************
12
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
14
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
15
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
16
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
17
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18
*******************************************************************************/
19
 
20
/* Define to prevent recursive inclusion -------------------------------------*/
21
#ifndef __75x_CAN_H
22
#define __75x_CAN_H
23
 
24
/* Includes ------------------------------------------------------------------*/
25
#include "75x_map.h"
26
 
27
/* Exported types ------------------------------------------------------------*/
28
 
29
/* CAN Init structure define */
30
typedef struct
31
{
32
  u8  CAN_ConfigParameters;
33
  u32 CAN_Bitrate;
34
}CAN_InitTypeDef;
35
 
36
/* Exported constants --------------------------------------------------------*/
37
/* Standard bitrates available*/
38
enum
39
{
40
  CAN_BITRATE_100K,
41
  CAN_BITRATE_125K,
42
  CAN_BITRATE_250K,
43
  CAN_BITRATE_500K,
44
  CAN_BITRATE_1M
45
};
46
 
47
/* Control register*/
48
#define CAN_CR_TEST            0x0080
49
#define CAN_CR_CCE             0x0040
50
#define CAN_CR_DAR             0x0020
51
#define CAN_CR_EIE             0x0008
52
#define CAN_CR_SIE             0x0004
53
#define CAN_CR_IE              0x0002
54
#define CAN_CR_INIT            0x0001
55
 
56
/* Status register */
57
#define CAN_SR_BOFF            0x0080
58
#define CAN_SR_EWARN           0x0040
59
#define CAN_SR_EPASS           0x0020
60
#define CAN_SR_RXOK            0x0010
61
#define CAN_SR_TXOK            0x0008
62
#define CAN_SR_LEC             0x0007
63
 
64
/* Test register*/
65
#define CAN_TESTR_RX           0x0080
66
#define CAN_TESTR_TX1          0x0040
67
#define CAN_TESTR_TX0          0x0020
68
#define CAN_TESTR_LBACK        0x0010
69
#define CAN_TESTR_SILENT       0x0008
70
#define CAN_TESTR_BASIC        0x0004
71
 
72
/* IFn / Command Request register*/
73
#define CAN_CRR_BUSY           0x8000
74
 
75
/* IFn / Command Mask register*/
76
#define CAN_CMR_WRRD           0x0080
77
#define CAN_CMR_MASK           0x0040
78
#define CAN_CMR_ARB            0x0020
79
#define CAN_CMR_CONTROL        0x0010
80
#define CAN_CMR_CLRINTPND      0x0008
81
#define CAN_CMR_TXRQSTNEWDAT   0x0004
82
#define CAN_CMR_DATAA          0x0002
83
#define CAN_CMR_DATAB          0x0001
84
 
85
/* IFn / Mask 2 register*/
86
#define CAN_M2R_MXTD           0x8000
87
#define CAN_M2R_MDIR           0x4000
88
 
89
/* IFn / Arbitration 2 register*/
90
#define CAN_A2R_MSGVAL         0x8000
91
#define CAN_A2R_XTD            0x4000
92
#define CAN_A2R_DIR            0x2000
93
 
94
/* IFn / Message Control register*/
95
#define CAN_MCR_NEWDAT         0x8000
96
#define CAN_MCR_MSGLST         0x4000
97
#define CAN_MCR_INTPND         0x2000
98
#define CAN_MCR_UMASK          0x1000
99
#define CAN_MCR_TXIE           0x0800
100
#define CAN_MCR_RXIE           0x0400
101
#define CAN_MCR_RMTEN          0x0200
102
#define CAN_MCR_TXRQST         0x0100
103
#define CAN_MCR_EOB            0x0080
104
 
105
 
106
/* Wake-up modes*/
107
enum
108
{
109
  CAN_WAKEUP_ON_EXT,
110
  CAN_WAKEUP_ON_CAN
111
};
112
 
113
 
114
/* CAN message structure*/
115
typedef struct
116
{
117
  u32 IdType;
118
  u32 Id;
119
  u8 Dlc;
120
  u8 Data[8];
121
} canmsg;
122
 
123
/* Message ID types*/
124
enum
125
{
126
  CAN_STD_ID,
127
  CAN_EXT_ID
128
};
129
 
130
/* Message ID limits*/
131
 
132
#define CAN_LAST_STD_ID ((1<<11) - 1)
133
#define CAN_LAST_EXT_ID ((1L<<29) - 1)
134
 
135
/* Exported functions ------------------------------------------------------- */
136
 
137
void CAN_Init (CAN_InitTypeDef *CAN_InitStruct);
138
void CAN_DeInit (void);
139
void CAN_StructInit(CAN_InitTypeDef *CAN_InitStruct);
140
void CAN_SetBitrate(u32 bitrate);
141
void CAN_SetTiming(u32 tseg1, u32 tseg2, u32 sjw, u32 brp);
142
ErrorStatus CAN_SetUnusedMsgObj(u32 msgobj);
143
ErrorStatus CAN_SetTxMsgObj(u32 msgobj, u32 idType);
144
ErrorStatus CAN_SetRxMsgObj(u32 msgobj, u32 idType, u32 idLow, u32 idHigh, bool singleOrFifoLast);
145
void CAN_InvalidateAllMsgObj(void);
146
ErrorStatus CAN_ReleaseMessage(u32 msgobj);
147
ErrorStatus CAN_SendMessage(u32 msgobj, canmsg* pCanMsg);
148
ErrorStatus CAN_ReceiveMessage(u32 msgobj, bool release, canmsg* pCanMsg);
149
ErrorStatus CAN_WaitEndOfTx(void);
150
ErrorStatus CAN_BasicSendMessage(canmsg* pCanMsg);
151
ErrorStatus CAN_BasicReceiveMessage(canmsg* pCanMsg);
152
void CAN_EnterTestMode(u8 TestMask);
153
void CAN_EnterInitMode(u8 InitMask);
154
void CAN_LeaveInitMode(void);
155
void CAN_LeaveTestMode(void);
156
void CAN_ReleaseTxMessage(u32 msgobj);
157
void CAN_ReleaseRxMessage(u32 msgobj);
158
u32 CAN_IsMessageWaiting(u32 msgobj);
159
u32 CAN_IsTransmitRequested(u32 msgobj);
160
u32 CAN_IsInterruptPending(u32 msgobj);
161
u32 CAN_IsObjectValid(u32 msgobj);
162
 
163
#endif /* __75x_CAN_H */
164
 
165
/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.