motorcontroldemo_028/Vinclude/CANBlockTransferInterface.h
2019-07-29 08:18:57 +03:00

69 lines
2.2 KiB
C

/*!
Copyright 2017 ÀÎ "ÍÈÈÝÒ" è ÎÎÎ "ÍÏÔ ÂÅÊÒÎÐ"
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
\file CANBlockTransferInterface.h
\brief Áëî÷íàÿ ïåðåäà÷à äàííûõ äëÿ CANopen
\author ÎÎÎ "ÍÏÔ Âåêòîð". http://motorcontrol.ru
\version v 2.0 25/03/2016
\defgroup CANOpen_drv Äðàéâåð CANOpen
@{
*/
#ifndef CANBLOCKTRANS_INTERFACE_H
#define CANBLOCKTRANS_INTERFACE_H
#ifdef __cplusplus
extern "C"
{
#endif
#include "DSP.h"
#define CANBT_INTERFACE_FREE 0
#define CANBT_INTERFACE_BUSY 0x8000
#define CANBT_INTERFACE_FLASH_PROG 1
#define CANBT_INTERFACE_DATALOG1 2
#define CANBT_INTERFACE_DATALOG2 3 // èñïîëüçóåòñÿ äëÿ 32-áèòíîãî äàòàëîããåðà
struct SCanBTInterface{
Uint16 alreadyInit; //ïðèçíàê ïåðâîãî âûçîâà äèñêåòíîãî àâòîìàòà.
Uint16 state_shadow;//Òåíåâîå ñîñòîÿíèå.
Uint16 state_prev; //Ïðåäûäóùåå ñîñÿíèå (íà îäèí òàêò)
Uint16 E; //Ôëàã ïåðâîãî âõîæäåíèÿ.
Uint32 time_prev;
Uint64 state_time; //âðåìÿ íàõîæäåíèÿ â òåêóùåì ñîñòîÿíèè, â òèêàõ ïðîöà. Äëÿ 150Ìãö ìàêñèìàëüíîå âðåìÿ îêîëî 4òûñ. ëåò :)
Uint16 BlockTransferCommand;
void (*ms_calc)(volatile struct SCanBTInterface* p, Uint32 time, TCo_OdVars* co_ptr);
void (*slow_calc)(volatile struct SCanBTInterface* p);
};
typedef volatile struct SCanBTInterface TCanBTInterface;
#define T_CANBT_INTERFACE_DEFAULTS {0,CANBT_INTERFACE_FREE,0xFF,1,\
0,0,0,\
SMCanBTInterface_ms,\
SMCanBTInterface_slow}
void SMCanBTInterface_ms(volatile struct SCanBTInterface* p, Uint32 time, TCo_OdVars* co_ptr);
void SMCanBTInterface_slow(volatile struct SCanBTInterface* p);
//êîëáýêè äëß 2700.00
void callback_BTcmd(Uint16 par, Uint16 tag_CANnum);
#ifdef __cplusplus
}
#endif
#endif