motorcontroldemo_035/Vsrc/V_UserMemory.c
2019-07-29 08:17:46 +03:00

133 lines
3.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 V_UserMemory.c
\brief Ðàáîòà ñ ïîëüçîâàòåëüñêîé ýíåðãîíåçàâèñèìîé ïàìÿòüþ 1921BK01 (ñì. TUserMemory)
\author Ëàøêåâè÷ Ì.Ì., Øïàê Ä.Ì.
\version v 1.0 18/12/2014
*/
/** \addtogroup TUserMemory */
/*@{*/
#include <V_UserMemory.h>
#include "DSP.h"
//!Èíèöèàëèçàöèÿ
//!Èíèöèàëèçàöèÿ USERMEMORY
//! \memberof TUserMemory
void USERMEMORY_Init(TUserMemory *p)
{
I2C->CTL1_bit.ENABLE = 1;
I2C->CTL1_bit.SCLFRQ = 63; // Divider: 100 000 000 / (63 * 4) ~ 400 êÃö
I2C->CTL3_bit.SCLFRQ = 0; // Divider
}
//! Ïðîâåðêà, íå íóæíî ëè ñìåíèòü ñòðàíèöó
//! Ïðîâåðÿåò òåêóùèé àäðåñ íà ôëåøêå, ñ êîòîðûì ðàáîòàåò ïîëüçîâàòåëü. Åñëè àäðåñ âûøåë èç òåêóùåé ñòðàíèöû, ñòðàíèöà çàïèñûâàåòñÿ íà ôëåø è ÷èòàåòñÿ â RAM íîâûé
//! \memberof TUserMemory
void USERMEMORY_UpdateCurrentPage(TUserMemory *p, Uint16 spiaddr)
{
}
//! Çàïèñü â ïàìÿòü
//!Ìåäëåííàÿ ôóíêöèÿ, çàïèñûâàþùàÿ íà flash çàäàííûå äàííûå.
//!Ðàáîòàåò ñ çàêåøèðîâàííûìè â îïåðàòèâêå äàííûìè, à ôèçè÷åñê ïèøåò íà ôëåø òîëüêî åñëè àäðåñ âûëåç çà ãðàíèöû òåêóùåé ñòðàíèöû
//! Àäðåñ âî ôëåøå spiaddr, àäðåñ 16òè ðàçðÿäíûõ äàííûõ ïîëüçîâàòåëÿ startaddr, ðàçìåð data_length. Âñå â áàéòàõ
//! Ïðè âûïîëåíèè îïåðàöèè startaddr èíêðåìåíòèðóåòñÿ, à spiaddr íåò
//! \memberof TUserMemory
void USERMEMORY_Write(TUserMemory *p)
{
}
//! ×òåíèå èç ïàìÿòè
//!Ìåäëåííàÿ ôóíêöèÿ, ñ÷èòûâàþùàÿ èç flash çàäàííûå äàííûå. Ïîäðîáíîñòè ñì. TUserMemory.
//! Àäðåñ âî ôëåøå spiaddr, àäðåñ àäðåñ 16òè ðàçðÿäíûõ äàííûõ ïîëüçîâàòåëÿ startaddr, ðàçìåð data_length. Âñå â áàéòàõ.
//! Ïðè âûïîëåíèè îïåðàöèè startaddr èíêðåìåíòèðóåòñÿ, à spiaddr íåò
//! \memberof TUserMemory
void USERMEMORY_Read(TUserMemory *p)
{
}
//! Çàïèñûâàåò ñòðàíèöó äàííûå íà ôëåøêó èç êåøà (èç îïåðàòèâêè îäíó ñòðàíèöó)
//! \memberof TUserMemory
void USERMEMORY_WriteFromCache(TUserMemory *p, int16 pageNum)
{
}
//! ×èòàåò ñòðàíèöó äàííûõ èç ôëåøà â êåø (â îïåðàòèâêó)
//! \memberof TUserMemory
void USERMEMORY_ReadToCache(TUserMemory *p, int16 pageNum)
{
}
//! Ñòåðåòü âñþ ôëåøêó (áóäóò FF)
//! \memberof TUserMemory
void USERMEMORY_Full_Erase(TUserMemory *p){
}
//! Ñáðîñèòü êåø èç îïåðàòèâêè íà ôëåøêó
//! \memberof TUserMemory
void USERMEMORY_Flush(TUserMemory *p){
}
//! Ìåäëåííûé ôîíîâûé ïîñòîÿííûé ðàñ÷åò - íóæåí ïîêà äëÿ ñèñòåìàòè÷åñêîãî ñáðîñà êåøà íà ôëåøêó ïî âðåìåíè
//! \memberof TUserMemory
void USERMEMORY_slow_calc(TUserMemory *p){
// }
}
//! Ìèëëèñåêóíäíûé ðàñ÷åò - íóæåí ïîêà äëÿ ñèñòåìàòè÷åñêîãî ñáðîñà êåøà íà ôëåøêó ïî âðåìåíè
//! \memberof TUserMemory
void USERMEMORY_ms_calc(TUserMemory *p){
}
/*@}*/