[feat] add new examples

This commit is contained in:
jzlv 2021-06-04 17:56:34 +08:00
parent bc120c8861
commit 0860ef4d6e
169 changed files with 192122 additions and 149 deletions

View file

@ -0,0 +1,6 @@
set(mains main.c)
set(TARGET_REQUIRED_SRC ./GSL61xx.c)
#generate_bin()

View file

@ -0,0 +1,677 @@
#include "GSL61xx.h"
#include "GSL61xxCfg.h"
#include "hal_spi.h"
//#define DET_MEAN
#ifdef DET_MEAN
uint8_t DetMeanDown;
uint8_t DetMeanUp;
#endif
#ifdef TUNE_TEST
uint8_t DD[32];
uint8_t II;
#endif
GSL_FP_Data_T *GSL_FP;
GSL_FP_Data_T GSL_FP_6163 =
{
{
Config_6163_NormalMode,
sizeof(Config_6163_NormalMode) / sizeof(Chip_Config_T),
},
{0xFF000020, 0xFF00002c, 0xFF08000c},
{120, 104, 120 * 104, {10, 20, 40, 56, 70, 80, 112, 140}, {10, 20, 30, 40, 50, 60, 70, 80}},
{0x07, 0xF0, 0x10},
{80, 140, 0, 0, 0},
{0, 0, 0}};
GSL_FP_Data_T GSL_FP_6163_00 =
{
{
Config_6163_NormalMode_00,
sizeof(Config_6163_NormalMode_00) / sizeof(Chip_Config_T),
},
{0xFF000020, 0xFF00002c, 0xFF08000c},
{120, 104, 120 * 104, {10, 20, 40, 56, 70, 80, 112, 140}, {10, 20, 30, 40, 50, 60, 70, 80}},
{0x03, 0xF0, 0x10},
{80, 140, 0, 0, 0},
{0, 0, 0}};
GSL_FP_Data_T GSL_FP_6163_01 =
{
{
Config_6163_NormalMode_01,
sizeof(Config_6163_NormalMode_01) / sizeof(Chip_Config_T),
},
{0xFF000020, 0xFF00002c, 0xFF08000c},
{120, 104, 120 * 104, {10, 20, 40, 56, 70, 80, 112, 140}, {10, 20, 30, 40, 50, 60, 70, 80}},
{0x07, 0xF0, 0x10},
{80, 140, 0, 0, 0},
{0, 0, 0}};
GSL_FP_Data_T GSL_FP_6163_02 =
{
{
Config_6163_NormalMode_02,
sizeof(Config_6163_NormalMode_02) / sizeof(Chip_Config_T),
},
{0xFF000020, 0xFF00002c, 0xFF08000c},
{120, 104, 120 * 104, {10, 20, 40, 56, 70, 80, 112, 140}, {10, 20, 30, 40, 50, 60, 70, 80}},
{0x07, 0xF0, 0x10},
{80, 140, 0, 0, 0},
{0, 0, 0}};
GSL_FP_Data_T GSL_FP_6163_35 =
{
{
Config_6163_NormalMode_35,
sizeof(Config_6163_NormalMode_35) / sizeof(Chip_Config_T),
},
{0xFF000020, 0xFF00002c, 0xFF08000c},
{120, 104, 120 * 104, {10, 20, 40, 56, 70, 80, 112, 140}, {10, 20, 30, 40, 50, 60, 70, 80}},
{0x03, 0xF0, 0x10},
{60, 100, 0, 0, 0},
{0, 0, 0}};
void GSL_FP_GetSetupData(uint32_t ChipID)
{
if (0x35 == ((uint8_t)ChipID))
{
GSL_FP = &GSL_FP_6163_35;
}
else if (0x02 == ((uint8_t)ChipID))
{
GSL_FP = &GSL_FP_6163_02;
}
else if (0x01 == ((uint8_t)ChipID))
{
GSL_FP = &GSL_FP_6163_01;
}
else if (0x00 == ((uint8_t)ChipID))
{
GSL_FP = &GSL_FP_6163_00;
}
else
{
GSL_FP = &GSL_FP_6163;
}
}
uint8_t FP_Spi_WriteRead(uint8_t Data)
{
uint8_t Ret;
struct device *spi = device_find("spi");
spi = device_find("spi");
spi_transmit_receive(spi, &Data, &Ret, 1, 0);
return Ret;
}
void FP_Spi_RegRead(uint8_t Addr, uint32_t *pData)
{
uint8_t Buf[4];
FP_CS_ENABLE();
FP_Spi_WriteRead(Addr);
FP_Spi_WriteRead(0x00);
Buf[0] = FP_Spi_WriteRead(0x00);
Buf[1] = FP_Spi_WriteRead(0x00);
Buf[2] = FP_Spi_WriteRead(0x00);
Buf[3] = FP_Spi_WriteRead(0x00);
*pData = *((uint32_t *)Buf);
FP_CS_DISABLE();
}
void FP_Spi_RegWrite(uint8_t Addr, uint32_t Data)
{
FP_CS_ENABLE();
FP_Spi_WriteRead(Addr);
FP_Spi_WriteRead(0xFF);
FP_Spi_WriteRead((uint8_t)((Data >> 0) & 0xFF));
FP_Spi_WriteRead((uint8_t)((Data >> 8) & 0xFF));
FP_Spi_WriteRead((uint8_t)((Data >> 16) & 0xFF));
FP_Spi_WriteRead((uint8_t)((Data >> 24) & 0xFF));
FP_CS_DISABLE();
}
void FP_Spi_Reg32Write(uint32_t Addr, uint32_t Data)
{
uint32_t Page = Addr / 0x80;
uint32_t Reg = Addr % 0x80;
FP_Spi_RegWrite(0xF0, Page);
FP_Spi_RegWrite((uint8_t)Reg, Data);
}
void GSL_FP_LoadConfig(Chip_Config_T *ChipConfig, uint32_t ConfigLen)
{
uint32_t i;
uint32_t Addr;
uint32_t Data;
Chip_Config_T *Config = ChipConfig;
for (i = 0; i < ConfigLen; i++, Config++)
{
Addr = Config->Addr;
Data = Config->Data;
if (0 == (Addr & 0xff000000))
{
FP_Spi_RegWrite((uint8_t)Addr, Data);
}
else
{
FP_Spi_Reg32Write(Addr, Data);
}
}
}
void GSL_FP_ReadImageData(uint32_t Page, uint8_t Reg, uint8_t *Buf, uint32_t Len)
{
uint32_t i;
FP_Spi_RegWrite(0xF0, Page);
FP_CS_ENABLE();
bflb_platform_delay_us(SPI_DELAY);
FP_Spi_WriteRead(Reg);
FP_Spi_WriteRead(0x00);
FP_Spi_WriteRead(0x00);
bflb_platform_delay_us(10000);
for (i = 0; i < GSL_FP->Sensor.ImageW * 2; i++)
{
FP_Spi_WriteRead(0x00);
}
for (i = 0; i < Len; i++)
{
Buf[i] = FP_Spi_WriteRead(0x00);
}
FP_CS_DISABLE();
bflb_platform_delay_us(SPI_DELAY);
}
void GSL_FP_SensorReset(void)
{
FP_RST_LOW();
bflb_platform_delay_ms(2);
FP_RST_HIGH();
bflb_platform_delay_ms(6);
}
void GSL_FP_CaptureStart(void)
{
FP_Spi_RegWrite(0xBF, 0x00);
FP_Spi_Reg32Write(0xFF080024, 0x2000FFFF);
}
uint32_t GSL_FP_GetCaptureStatus(void)
{
uint32_t Status = 0;
FP_Spi_RegRead(0xBF, &Status);
return Status;
}
void GSL_FP_WaitCaptureEnd(uint32_t bflb_platform_delay_msMS, uint32_t TimeOut)
{
uint32_t TryTime = 0;
bflb_platform_delay_ms(SPI_DELAY);
while (GSL_FP_GetCaptureStatus() != 1)
{
if (TryTime++ > TimeOut)
{
break;
}
bflb_platform_delay_ms(1);
}
}
void GSL_FP_ReadChipID(uint32_t *ChipID)
{
uint8_t i;
uint32_t Buf;
for (i = 0; i < 5; i++)
{
FP_Spi_RegRead(0xFC, &Buf);
if (0x61 == (Buf >> 24))
{
break;
}
bflb_platform_delay_ms(10);
}
*ChipID = Buf;
}
void GSL_FP_SensorSetup(void)
{
int i;
uint32_t ChipID;
Chip_Config_T *Config;
uint32_t ConfigLen;
GSL_FP_ReadChipID(&ChipID);
GSL_FP_GetSetupData(ChipID);
Config = GSL_FP->Config.Config_NormalMode;
ConfigLen = GSL_FP->Config.Config_NormalMode_Len;
for (i = 0; i < ConfigLen; i++, Config++)
{
if (Config->Addr == GSL_FP->Reg.RegGain12)
{
GSL_FP->Detect.DetGain12 = Config->Data;
GSL_FP->Capture.CapGain12 = Config->Data;
}
else if (Config->Addr == GSL_FP->Reg.RegGain34)
{
GSL_FP->Detect.DetGain34 = Config->Data;
GSL_FP->Capture.CapGain34 = Config->Data;
}
else if (Config->Addr == GSL_FP->Reg.RegDac)
{
GSL_FP->Detect.DetDac = Config->Data;
GSL_FP->Capture.CapDac = Config->Data;
}
}
}
uint8_t GSL_FP_GetDacShift(uint32_t Gain12, uint32_t Gain34, uint8_t *Gain12R, uint8_t *Gain34R, uint32_t Ref)
{
uint8_t Gain2 = (uint8_t)((Gain12 >> 16) & 0x7);
uint8_t Gain3 = (uint8_t)(Gain34 & 0x7);
uint8_t Gain4 = (uint8_t)((Gain34 >> 8) & 0x7);
uint8_t Ref2 = (uint8_t)((Ref >> 4) & 0x7);
uint8_t Ref3 = (uint8_t)((Ref >> 8) & 0x7);
uint8_t Ref4 = (uint8_t)((Ref >> 12) & 0x7);
uint32_t DacShift;
DacShift = 374 * (Gain12R[Gain2] * Gain34R[Gain3] * Gain34R[Gain4]) / (Gain12R[Ref2] * Gain34R[Ref3] * Gain34R[Ref4]) / 100;
if (DacShift < 1)
{
DacShift = 1;
}
return (uint8_t)DacShift;
}
void GSL_FP_SensorTune(void)
{
uint32_t DacBase, DacDetect;
uint32_t Temp;
#if 0
GSL_FP->Tune.DacShift = GSL_FP_GetDacShift(GSL_FP->Capture.CapGain12,
GSL_FP->Capture.CapGain34,
GSL_FP->Sensor.Gain12Ratio,
GSL_FP->Sensor.Gain34Ratio,
0x1227);
#endif
DacBase = (GSL_FP->Capture.CapDac << 24) >> 24;
if (DacBase > DAC_TUNE_OFFSET_MIN)
{
GSL_FP->Tune.DacMin = DacBase - DAC_TUNE_OFFSET_MIN;
}
else
{
GSL_FP->Tune.DacMin = 0x00;
}
if (DacBase < 0xFF - DAC_TUNE_OFFSET_MAX)
{
GSL_FP->Tune.DacMax = DacBase + DAC_TUNE_OFFSET_MAX;
}
else
{
GSL_FP->Tune.DacMax = 0xFF;
}
Temp = 200 / GSL_FP->Tune.DacShift;
if (DacBase > Temp)
{
DacDetect = DacBase - Temp;
}
else
{
DacDetect = 0;
}
Temp = (GSL_FP->Detect.DetDac >> 8) << 8;
GSL_FP->Detect.DetDac = Temp + DacDetect;
}
uint8_t GSL_FP_DetectFingerDown(void)
{
uint8_t i, j;
uint8_t Buf[160];
uint8_t Mean;
uint32_t Temp;
uint32_t Page;
uint32_t Reg;
uint32_t ImageW = GSL_FP->Sensor.ImageW;
uint32_t ImageH = GSL_FP->Sensor.ImageH;
uint8_t DownCnt = 0;
FP_Spi_Reg32Write(GSL_FP->Reg.RegDac, GSL_FP->Detect.DetDac);
GSL_FP_CaptureStart();
GSL_FP_WaitCaptureEnd(5, 50);
for (i = 0; i < 4; i++)
{
Temp = (ImageH / 16 + i * (ImageH - ImageH / 8) / 3) * ImageW;
Page = Temp / 0x80;
Reg = Temp % 0x80;
GSL_FP_ReadImageData(Page, (uint8_t)Reg, Buf, ImageW);
for (Temp = 0, j = 0; j < ImageW; j++)
{
Temp += Buf[j];
}
Mean = (uint8_t)(Temp / ImageW);
#ifdef DET_MEAN
if (Mean < DetMeanDown)
DetMeanDown = Mean;
#endif
if (Mean < GSL_FP->Detect.DownThreshold)
{
DownCnt++;
}
if (DownCnt >= 3)
{
return FINGER_DOWN;
}
}
return FINGER_UP;
}
uint8_t GSL_FP_DetectFingerUp(void)
{
uint8_t i, j;
uint8_t Buf[160];
uint8_t Mean;
uint32_t Temp;
uint32_t Page;
uint32_t Reg;
uint32_t ImageW = GSL_FP->Sensor.ImageW;
uint32_t ImageH = GSL_FP->Sensor.ImageH;
uint8_t UpCnt = 0;
FP_Spi_Reg32Write(GSL_FP->Reg.RegDac, GSL_FP->Detect.DetDac);
GSL_FP_CaptureStart();
GSL_FP_WaitCaptureEnd(5, 50);
for (i = 0; i < 4; i++)
{
Temp = (ImageH / 16 + i * (ImageH - ImageH / 8) / 3) * ImageW;
Page = Temp / 0x80;
Reg = Temp % 0x80;
GSL_FP_ReadImageData(Page, (uint8_t)Reg, Buf, ImageW);
for (Temp = 0, j = 0; j < ImageW; j++)
{
Temp += Buf[j];
}
Mean = (uint8_t)(Temp / ImageW);
#ifdef DET_MEAN
if (Mean > DetMeanUp)
DetMeanUp = Mean;
#endif
if (Mean > GSL_FP->Detect.UpThreshold)
{
UpCnt++;
}
if (UpCnt >= 4)
{
return FINGER_UP;
}
}
return FINGER_DOWN;
}
int GSL_FP_DacTune(uint8_t *Image, uint32_t Width, uint32_t Height, uint32_t *TuneDac)
{
int i, j, n;
int Ret = 1;
uint8_t Dac = (uint8_t)((*TuneDac) & 0xFF);
uint8_t DacShift = GSL_FP->Tune.DacShift;
uint8_t DacMax = GSL_FP->Tune.DacMax;
uint8_t DacMin = GSL_FP->Tune.DacMin;
uint8_t DacOffset;
uint32_t StartX, StartY;
uint32_t Temp;
uint32_t Mean = 255;
for (n = 0; n < 5; n++)
{
if (0 == n)
{
StartX = (Width - TUNE_IMAGE_W) / 2;
StartY = (Height - TUNE_IMAGE_H) / 2;
}
else if (1 == n)
{
StartX = (Width - TUNE_IMAGE_W) / 4;
StartY = (Height - TUNE_IMAGE_H) / 4;
}
else if (2 == n)
{
StartX = (Width - TUNE_IMAGE_W) * 3 / 4;
StartY = (Height - TUNE_IMAGE_H) / 4;
}
else if (3 == n)
{
StartX = (Width - TUNE_IMAGE_W) / 4;
StartY = (Height - TUNE_IMAGE_H) * 3 / 4;
}
else if (4 == n)
{
StartX = (Width - TUNE_IMAGE_W) * 3 / 4;
StartY = (Height - TUNE_IMAGE_H) * 3 / 4;
}
Temp = 0;
for (i = 0; i < TUNE_IMAGE_H; i++)
{
for (j = 0; j < TUNE_IMAGE_W; j++)
{
Temp += Image[(StartY + i) * Width + StartX + j];
}
}
Temp /= TUNE_IMAGE_W * TUNE_IMAGE_H;
if (Temp < Mean)
{
Mean = Temp;
}
}
#ifdef TUNE_TEST
DD[II++] = Dac;
DD[II++] = Mean;
#endif
if (Mean < 100)
{
DacOffset = (110 - Mean) / DacShift;
if (DacOffset > DAC_TUNE_STEP_MAX)
DacOffset = DAC_TUNE_STEP_MAX;
else if (DacOffset < 1)
DacOffset = 1;
if (Dac < 0xFF - DacOffset)
Dac += DacOffset;
else
Dac = 0xFF;
}
else if (Mean > 120)
{
DacOffset = (Mean - 110) / DacShift;
if (DacOffset > DAC_TUNE_STEP_MAX)
DacOffset = DAC_TUNE_STEP_MAX;
else if (DacOffset < 1)
DacOffset = 1;
if (Dac > DacOffset)
Dac -= DacOffset;
else
Dac = 0x00;
}
else
{
Ret = 0;
}
if (Dac < DacMin)
Dac = DacMin;
if (Dac > DacMax)
Dac = DacMax;
*TuneDac = ((*TuneDac) & 0xFFFFFF00) + Dac;
return Ret;
}
void GSL_FP_CaptureImage(BYTE *pImageBmp)
{
int Ret;
uint8_t CaptureCnt;
uint32_t TuneDac;
TuneDac = GSL_FP->Capture.CapDac;
for (CaptureCnt = 0; CaptureCnt < DAC_TUNE_CNT_MAX; CaptureCnt++)
{
FP_Spi_Reg32Write(GSL_FP->Reg.RegDac, TuneDac);
GSL_FP_CaptureStart();
GSL_FP_WaitCaptureEnd(5, 50);
GSL_FP_ReadImageData(0, 0, pImageBmp, GSL_FP->Sensor.ImageSize);
Ret = GSL_FP_DacTune(pImageBmp, GSL_FP->Sensor.ImageW, GSL_FP->Sensor.ImageH, &TuneDac);
if (0 == Ret)
{
break;
}
}
GSL_FP->Capture.CapDac = TuneDac;
}
void FP_GPIO_Configuration(void)
{
gpio_set_mode(FP_CS_PIN, GPIO_OUTPUT_PP_MODE);
gpio_set_mode(FP_RESET_PIN, GPIO_OUTPUT_PP_MODE);
}
uint8_t FP_Spi_Init()
{
spi_register(SPI0_INDEX, "spi", DEVICE_OFLAG_RDWR);
struct device *spi = device_find("spi");
spi = device_find("spi");
if (spi)
{
device_open(spi, DEVICE_OFLAG_STREAM_TX | DEVICE_OFLAG_STREAM_RX);
}
return 0;
}
uint8_t GSL61xx_init(void)
{
FP_GPIO_Configuration();
FP_Spi_Init();
FP_CS_DISABLE();
bflb_platform_delay_ms(1);
GSL_FP_SensorReset();
GSL_FP_SensorSetup();
GSL_FP_SensorTune();
FP_RST_LOW();
return 0;
}
BYTE CaptureGSL61xx(BYTE *pImageBmp)
{
uint8_t WaitDownCnt;
/* 6C 63 62 10 D5 6C 63 62 D0 95 */
//memset(pImageBmp, 0xFF, GSL_FP->Capture.ImageSize);
GSL_FP_SensorReset();
GSL_FP_LoadConfig(GSL_FP->Config.Config_NormalMode, GSL_FP->Config.Config_NormalMode_Len);
for (WaitDownCnt = 0; WaitDownCnt < 3; WaitDownCnt++)
{
if (GSL_FP_DetectFingerDown() != 0)
{
break;
}
}
#ifdef TUNE_TEST
for (II = 0; II < 10; II++)
DD[II] = 0;
II = 0;
#endif
GSL_FP_CaptureImage(pImageBmp);
#if 0
{
uint32_t RR;
GSL_FP_ReadChipID(&RR);
pImageBmp[0] = (uint8_t)(RR>>24);
pImageBmp[1] = (uint8_t)(RR>>16);
pImageBmp[2] = (uint8_t)(RR>>8);
pImageBmp[3] = (uint8_t)(RR>>0);
}
#endif
FP_RST_LOW();
#ifdef TUNE_TEST
pImageBmp[0] = GSL_FP->Tune.DacShift;
for (II = 0; II < 10; II++)
pImageBmp[1 + II] = DD[II];
#endif
#ifdef DET_MEAN
pImageBmp[0] = DetMeanDown;
pImageBmp[1] = DetMeanUp;
pImageBmp[2] = 0xFF;
#endif
return 0;
}

View file

@ -0,0 +1,123 @@
#ifndef __GSL61XX__
#define __GSL61XX__
#include "hal_gpio.h"
#include <stdint.h>
#define BYTE uint8_t
#define FP_CS_PIN GPIO_PIN_10
#define FP_RESET_PIN GPIO_PIN_6
#define FP_CS_DISABLE() \
do \
{ \
gpio_write(FP_CS_PIN, 1); \
} while (0)
#define FP_CS_ENABLE() \
do \
{ \
gpio_write(FP_CS_PIN, 0); \
} while (0)
#define FP_RST_HIGH() \
do \
{ \
gpio_write(FP_RESET_PIN, 1); \
} while (0)
#define FP_RST_LOW() \
do \
{ \
gpio_write(FP_RESET_PIN, 0); \
} while (0)
#define SPI_DELAY 5
#define FINGER_UP 0
#define FINGER_DOWN 1
#define TUNE_IMAGE_W 32
#define TUNE_IMAGE_H 32
//#define TUNE_TEST
#ifdef TUNE_TEST
#define DAC_TUNE_OFFSET_MAX 0x80
#define DAC_TUNE_OFFSET_MIN 0x80
#define DAC_TUNE_STEP_MAX 0x08
#define DAC_TUNE_CNT_MAX 5
#else
#define DAC_TUNE_OFFSET_MAX 0x20
#define DAC_TUNE_OFFSET_MIN 0x10
#define DAC_TUNE_STEP_MAX 0x08
#define DAC_TUNE_CNT_MAX 5
#endif
typedef struct Chip_Config
{
uint32_t Addr;
uint32_t Data;
} Chip_Config_T;
typedef struct GSL_FP_Config
{
Chip_Config_T *Config_NormalMode;
uint32_t Config_NormalMode_Len;
} GSL_FP_Config_T;
typedef struct GSL_FP_Register
{
uint32_t RegGain12;
uint32_t RegGain34;
uint32_t RegDac;
} GSL_FP_Register_T;
typedef struct GSL_FP_Sensor
{
uint32_t ImageW;
uint32_t ImageH;
uint32_t ImageSize;
uint8_t Gain12Ratio[8];
uint8_t Gain34Ratio[8];
} GSL_FP_Sensor_T;
typedef struct GSL_FP_Tune
{
uint8_t DacShift;
uint8_t DacMax;
uint8_t DacMin;
} GSL_FP_Tune_T;
typedef struct GSL_FP_Detect
{
uint32_t DownThreshold;
uint32_t UpThreshold;
uint32_t DetGain12;
uint32_t DetGain34;
uint32_t DetDac;
} GSL_FP_Detect_T;
typedef struct GSL_FP_Capture
{
uint32_t CapGain12;
uint32_t CapGain34;
uint32_t CapDac;
} GSL_FP_Capture_T;
typedef struct GSL_FP_Data
{
GSL_FP_Config_T Config;
GSL_FP_Register_T Reg;
GSL_FP_Sensor_T Sensor;
GSL_FP_Tune_T Tune;
GSL_FP_Detect_T Detect;
GSL_FP_Capture_T Capture;
} GSL_FP_Data_T;
uint8_t GSL61xx_init(void);
BYTE CaptureGSL61xx(BYTE *pImageBmp);
void GSL_FP_CaptureImage(BYTE *pImageBmp);
void GSL_FP_ReadChipID(uint32_t *ChipID);
void GSL_FP_ReadImageData(uint32_t Page, uint8_t Reg, uint8_t *Buf, uint32_t Len);
#endif

View file

@ -0,0 +1,305 @@
Chip_Config_T Config_6163_NormalMode[] =
{
{0x000000A0, 0x00000001},
//{0x00000098, 0x20644700},
{0x000000C0, 0x1311431C},
{0x000000C4, 0x00000000},
{0x000000B0, 0x00010055},
{0x000000EC, 0x00000000},
{0x000000A0, 0x00000000},
{0xFF0A00C0, 0x1311431C},
{0xFF0A00C4, 0x00000000},
{0xFF0A00B0, 0x00010055},
{0xFF0A00EC, 0x00000000},
{0x000000E4, 0x00000005},
{0x000000E8, 0x00000043},
{0xFF010008, 0x00000039},
{0xFF000004, 0x00000302},
{0xFF000010, 0x00000601},
{0xFF000014, 0x00000030},
{0xFF000020, 0x00040201}, //0x00010201},
{0xFF00002C, 0x00000201}, //0x00000103},
{0xFF000030, 0x00000000},
{0xFF000034, 0x00000505},
{0xFF000038, 0x00000505},
{0xFF00004C, 0x00015703},
{0xFF000064, 0x00000010},
{0xFF00006C, 0x00000311},
{0xFF000070, 0x13001444},
{0xFF080200, 0x80808080},
{0xFF080204, 0x80808080},
{0xFF080208, 0x80808080},
{0xFF08020C, 0x80808080},
{0xFF080004, 0x00000000},
{0xFF08000C, 0x00130098}, //0x00130085},
{0xFF08001C, 0x01005001},
{0xFF080024, 0x2000FFFF},
{0xFF080030, 0x000F3113},
{0xFF0800A0, 0x10033858},
{0xFF0800A8, 0x00050037},
{0xFF080048, 0x10050005},
{0xFF0800AC, 0x001A006F},
{0xFF0800B0, 0x00370020},
{0xFF0800B8, 0x0034002C},
{0xFF0800C8, 0x004B0013},
{0xFF0800CC, 0x08000100}, //0x04000100},
{0xFF0800D0, 0x0010006D},
{0xFF0800D4, 0xFFFF0143},
{0xFF0800D8, 0x01FFFFFF},
{0xFF080134, 0x00010001},
{0xFF080144, 0x00000000},
{0xFF080178, 0x10006040},
{0xFF080028, 0xD66B1E0F},
{0xFF080054, 0x00000002},
{0xFF080000, 0x04226280},
{0xFF080028, 0x026B000E},
{0xFF080054, 0x00000C8A}, //0x00000CDB},
{0xFF0800A0, 0x10033058}, //0x10033C58},
{0xFF080000, 0x04222280},
};
Chip_Config_T Config_6163_NormalMode_00[] =
{
{0x000000A0, 0x00000001},
//{0x00000098, 0x20644700},
{0x000000C0, 0x1311431C},
{0x000000C4, 0x00000000},
{0x000000B0, 0x00010055},
{0x000000EC, 0x00000000},
{0x000000A0, 0x00000000},
{0xFF0A00C0, 0x1311431C},
{0xFF0A00C4, 0x00000000},
{0xFF0A00B0, 0x00010055},
{0xFF0A00EC, 0x00000000},
{0x000000E4, 0x00000005},
{0x000000E8, 0x00000043},
{0xFF010008, 0x00000039},
{0xFF000004, 0x00000302},
{0xFF000010, 0x00000601},
{0xFF000014, 0x00000030},
{0xFF000020, 0x00010201}, //0x00040201}, //0x00010201},
{0xFF00002C, 0x00000103}, //0x00000201}, //0x00000103},
{0xFF000030, 0x00000000},
{0xFF000034, 0x00000505},
{0xFF000038, 0x00000505},
{0xFF00004C, 0x00015703},
{0xFF000064, 0x00000010},
{0xFF00006C, 0x00000311},
{0xFF000070, 0x13001444},
{0xFF080200, 0x80808080},
{0xFF080204, 0x80808080},
{0xFF080208, 0x80808080},
{0xFF08020C, 0x80808080},
{0xFF080004, 0x00000000},
{0xFF08000C, 0x001300D4}, //0x00130085},
{0xFF08001C, 0x01005001},
{0xFF080024, 0x2000FFFF},
{0xFF080030, 0x000F3113},
{0xFF0800A0, 0x10033858},
{0xFF0800A8, 0x00050037},
{0xFF080048, 0x10050005},
{0xFF0800AC, 0x001A006F},
{0xFF0800B0, 0x00370020},
{0xFF0800B8, 0x0034002C},
{0xFF0800C8, 0x004B0013},
{0xFF0800CC, 0x08000100}, //0x04000100},
{0xFF0800D0, 0x0010006D},
{0xFF0800D4, 0xFFFF0143},
{0xFF0800D8, 0x01FFFFFF},
{0xFF080134, 0x00010001},
{0xFF080144, 0x00000000},
{0xFF080178, 0x10006040},
{0xFF080028, 0xD66B1E0F},
{0xFF080054, 0x00000002},
{0xFF080000, 0x04226280},
{0xFF080028, 0x026B000E},
{0xFF080054, 0x00000C8A}, //0x00000CDB},
{0xFF0800A0, 0x10033058}, //0x10033C58},
{0xFF080000, 0x04222280},
};
Chip_Config_T Config_6163_NormalMode_01[] =
{
{0x000000A0, 0x00000001},
//{0x00000098, 0x20644700},
{0x000000C0, 0x1311431C},
{0x000000C4, 0x00000000},
{0x000000B0, 0x00010055},
{0x000000EC, 0x00000000},
{0x000000A0, 0x00000000},
{0xFF0A00C0, 0x1311431C},
{0xFF0A00C4, 0x00000000},
{0xFF0A00B0, 0x00010055},
{0xFF0A00EC, 0x00000000},
{0x000000E4, 0x00000005},
{0x000000E8, 0x00000043},
{0xFF010008, 0x00000039},
{0xFF000004, 0x00000302},
{0xFF000010, 0x00000601},
{0xFF000014, 0x00000030},
{0xFF000020, 0x00040201}, //0x00010201},
{0xFF00002C, 0x00000201}, //0x00000103},
{0xFF000030, 0x00000000},
{0xFF000034, 0x00000505},
{0xFF000038, 0x00000505},
{0xFF00004C, 0x00015703},
{0xFF000064, 0x00000010},
{0xFF00006C, 0x00000311},
{0xFF000070, 0x13001444},
{0xFF080200, 0x80808080},
{0xFF080204, 0x80808080},
{0xFF080208, 0x80808080},
{0xFF08020C, 0x80808080},
{0xFF080004, 0x00000000},
{0xFF08000C, 0x00130098}, //0x00130085},
{0xFF08001C, 0x01005001},
{0xFF080024, 0x2000FFFF},
{0xFF080030, 0x000F3113},
{0xFF0800A0, 0x10033858},
{0xFF0800A8, 0x00050037},
{0xFF080048, 0x10050005},
{0xFF0800AC, 0x001A006F},
{0xFF0800B0, 0x00370020},
{0xFF0800B8, 0x0034002C},
{0xFF0800C8, 0x004B0013},
{0xFF0800CC, 0x08000100}, //0x04000100},
{0xFF0800D0, 0x0010006D},
{0xFF0800D4, 0xFFFF0143},
{0xFF0800D8, 0x01FFFFFF},
{0xFF080134, 0x00010001},
{0xFF080144, 0x00000000},
{0xFF080178, 0x10006040},
{0xFF080028, 0xD66B1E0F},
{0xFF080054, 0x00000002},
{0xFF080000, 0x04226280},
{0xFF080028, 0x026B000E},
{0xFF080054, 0x00000C8A}, //0x00000CDB},
{0xFF0800A0, 0x10033058}, //0x10033C58},
{0xFF080000, 0x04222280},
};
Chip_Config_T Config_6163_NormalMode_02[] =
{
{0x000000A0, 0x00000001},
//{0x00000098, 0x20644700},
{0x000000C0, 0x1311431C},
{0x000000C4, 0x00000000},
{0x000000B0, 0x00010055},
{0x000000EC, 0x00000000},
{0x000000A0, 0x00000000},
{0xFF0A00C0, 0x1311431C},
{0xFF0A00C4, 0x00000000},
{0xFF0A00B0, 0x00010055},
{0xFF0A00EC, 0x00000000},
{0x000000E4, 0x00000005},
{0x000000E8, 0x00000043},
{0xFF010008, 0x00000039},
{0xFF000004, 0x00000302},
{0xFF000010, 0x00000601},
{0xFF000014, 0x00000030},
{0xFF000020, 0x00040201}, //0x00010201},
{0xFF00002C, 0x00000201}, //0x00000103},
{0xFF000030, 0x00000000},
{0xFF000034, 0x00000505},
{0xFF000038, 0x00000505},
{0xFF00004C, 0x00015703},
{0xFF000064, 0x00000010},
{0xFF00006C, 0x00000311},
{0xFF000070, 0x13001444},
{0xFF080200, 0x80808080},
{0xFF080204, 0x80808080},
{0xFF080208, 0x80808080},
{0xFF08020C, 0x80808080},
{0xFF080004, 0x00000000},
{0xFF08000C, 0x00130098}, //0x00130085},
{0xFF08001C, 0x01005001},
{0xFF080024, 0x2000FFFF},
{0xFF080030, 0x000F3113},
{0xFF0800A0, 0x10033858},
{0xFF0800A8, 0x00050037},
{0xFF080048, 0x10050005},
{0xFF0800AC, 0x001A006F},
{0xFF0800B0, 0x00370020},
{0xFF0800B8, 0x0034002C},
{0xFF0800C8, 0x004B0013},
{0xFF0800CC, 0x08000100}, //0x04000100},
{0xFF0800D0, 0x0010006D},
{0xFF0800D4, 0xFFFF0143},
{0xFF0800D8, 0x01FFFFFF},
{0xFF080134, 0x00010001},
{0xFF080144, 0x00000000},
{0xFF080178, 0x10006040},
{0xFF080028, 0xD66B1E0F},
{0xFF080054, 0x00000002},
{0xFF080000, 0x04226280},
{0xFF080028, 0x026B000E},
{0xFF080054, 0x00000C8A}, //0x00000CDB},
{0xFF0800A0, 0x10033058}, //0x10033C58},
{0xFF080000, 0x04222280},
};
Chip_Config_T Config_6163_NormalMode_35[] =
{
{0x000000A0, 0x00000001},
//{0x00000098, 0x20644700},
{0x000000C0, 0x1311431C},
{0x000000C4, 0x00000000},
{0x000000B0, 0x00010055},
{0x000000EC, 0x00000000},
{0x000000A0, 0x00000000},
{0xFF0A00C0, 0x1311431C},
{0xFF0A00C4, 0x00000000},
{0xFF0A00B0, 0x00010055},
{0xFF0A00EC, 0x00000000},
{0x000000E4, 0x00000005},
{0x000000E8, 0x00000043},
{0xFF010008, 0x00000039},
{0xFF000004, 0x00000302},
{0xFF000010, 0x00000601},
{0xFF000014, 0x00000030},
{0xFF000020, 0x00010201}, //0x00010201},
{0xFF00002C, 0x00000103}, //0x00000103},
{0xFF000030, 0x00000000},
{0xFF000034, 0x00000505},
{0xFF000038, 0x00000505},
{0xFF00004C, 0x00015703},
{0xFF000064, 0x00000010},
{0xFF00006C, 0x00000311},
{0xFF000070, 0x13001444},
{0xFF080200, 0x80808080},
{0xFF080204, 0x80808080},
{0xFF080208, 0x80808080},
{0xFF08020C, 0x80808080},
{0xFF080004, 0x00000000},
{0xFF08000C, 0x001300D4}, //0x001300A0}, //0x001300B7}, //0x00130085},
{0xFF08001C, 0x01005001},
{0xFF080024, 0x2000FFFF},
{0xFF080030, 0x000F3113},
{0xFF0800A0, 0x10033858},
{0xFF0800A8, 0x00050037},
{0xFF080048, 0x10050005},
{0xFF0800AC, 0x001A006F},
{0xFF0800B0, 0x00370020},
{0xFF0800B8, 0x0034002C},
{0xFF0800C8, 0x004B0013},
{0xFF0800CC, 0x08000100}, //0x04000100},
{0xFF0800D0, 0x0010006D},
{0xFF0800D4, 0xFFFF0143},
{0xFF0800D8, 0x01FFFFFF},
{0xFF080134, 0x00010001},
{0xFF080144, 0x00000000},
{0xFF080178, 0x10006040},
{0xFF080028, 0xD66B1E0F},
{0xFF080054, 0x00000002},
{0xFF080000, 0x04226280},
{0xFF080028, 0x006B000E},
{0xFF080054, 0x00000C8A}, //0x00000CDB},
{0xFF0800A0, 0x10033058}, //0x10033C58},
{0xFF080000, 0x04222280},
};

View file

@ -0,0 +1,728 @@
<?xml version="1.0" encoding="UTF-8"?>
<Project Name="spi_gsl161" Version="1" Language="C">
<Description>CPU: RV32IMAFC
Chip: bl70x
Board: bl70x_iot
</Description>
<Dependencies Name="Debug"/>
<VirtualDirectory Name="app">
<File Name="../main.c">
<FileOption/>
</File>
<File Name="../GSL61xx.c">
<FileOption/>
</File>
</VirtualDirectory>
<VirtualDirectory Name="chip">
<VirtualDirectory Name="riscv">
<File Name="../../../../drivers/bl702_driver/startup/interrupt.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/startup/system_bl702.c">
<FileOption/>
</File>
</VirtualDirectory>
<VirtualDirectory Name="startup">
<File Name="../../../../drivers/bl702_driver/startup/GCC/entry.S">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/startup/GCC/start_load.c">
<FileOption/>
</File>
</VirtualDirectory>
</VirtualDirectory>
<VirtualDirectory Name="hal">
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_adc.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_dac.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_dma.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_gpio.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_i2c.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_i2s.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_mtimer.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_pwm.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_spi.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_timer.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_uart.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_usb.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_clock.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_cam.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_mjpeg.c"/>
</VirtualDirectory>
<VirtualDirectory Name="std">
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_acomp.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_adc.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_aon.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_cam.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_clock.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_dac.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_dma.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_ef_ctrl.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_emac.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_glb.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_hbn.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_i2c.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_i2c_gpio_sim.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_i2s.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_ir.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_common.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_kys.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_l1c.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_mjpeg.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_pds.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_psram.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_pwm.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_qdec.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_romapi.c" ExcludeProjConfig="BuildSet">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_romdriver.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sec_dbg.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sec_eng.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sf_cfg.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sf_cfg_ext.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sf_ctrl.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sflash.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sflash_ext.c" ExcludeProjConfig="">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_spi.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_timer.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_uart.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_usb.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_xip_sflash.c">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_xip_sflash_ext.c">
<FileOption/>
</File>
</VirtualDirectory>
<VirtualDirectory Name="board">
<File Name="../../../../bsp/board/bl706_iot/board.c">
<FileOption/>
</File>
<File Name="../../../../bsp/bsp_common/platform/bflb_platform.c">
<FileOption/>
</File>
</VirtualDirectory>
<VirtualDirectory Name="common">
<File Name="../../../../common/device/drv_device.c">
<FileOption/>
</File>
<File Name="../../../../common/memheap/drv_mmheap.c">
<FileOption/>
</File>
<File Name="../../../../common/ring_buffer/ring_buffer.c">
<FileOption/>
</File>
<File Name="../../../../common/soft_crc/softcrc.c">
<FileOption/>
</File>
<VirtualDirectory Name="libc">
<File Name="../../../../common/libc/src/atof.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/atoi.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/atol.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/atoll.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/atox.c" ExcludeProjConfig="BuildSet">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/bsearch.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/common.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/ctype_isalnum.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/ctype_isalpha.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/ctype_isascii.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/ctype_isblank.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/ctype_iscntrl.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/ctype_isdigit.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/ctype_isgraph.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/ctype_islower.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/ctype_isprint.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/ctype_ispunct.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/ctype_isspace.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/ctype_isupper.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/ctype_isxdigit.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/ctype_tolower.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/ctype_toupper.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/ctypes.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/fnmatch.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/jrand48.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/lrand48.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/memccpy.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/memchr.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/memcmp.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/memcpy.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/memmem.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/memrchr.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/memset.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/memswap.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/mrand48.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/nrand48.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/qsort.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/seed48.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/snprintf.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/sprintf.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/srand48.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/sscanf.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/stdlib.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strcasecmp.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strcat.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strchr.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strcmp.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strcpy.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strcspn.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strlcat.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strlcpy.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strlen.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strncasecmp.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strncat.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strncmp.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strncpy.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strnlen.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strntoimax.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strntoumax.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strpbrk.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strrchr.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strsep.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strspn.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strstr.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strtoimax.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strtok.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strtok_r.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strtol.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strtoll.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strtoul.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strtoull.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strtoumax.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strtox.c" ExcludeProjConfig="BuildSet">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/strxspn.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/vsnprintf.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/vsprintf.c">
<FileOption/>
</File>
<File Name="../../../../common/libc/src/vsscanf.c">
<FileOption/>
</File>
</VirtualDirectory>
<File Name="../../../../common/misc/misc.c">
<FileOption/>
</File>
</VirtualDirectory>
<VirtualDirectory Name="script">
<File Name="../../../../tools/openocd/bl70x_gdb.init">
<FileOption/>
</File>
<File Name="../../../../drivers/bl702_driver/regs/bl70x_reg.svc"/>
</VirtualDirectory>
<MonitorProgress>
<DebugLaunch>154</DebugLaunch>
<FlashOperate>104</FlashOperate>
</MonitorProgress>
<VirtualDirectory Name="components">
<VirtualDirectory Name="fatfs">
<File Name="../../../../components/fatfs/diskio.c">
<FileOption/>
</File>
<File Name="../../../../components/fatfs/ff.c">
<FileOption/>
</File>
<File Name="../../../../components/fatfs/ffsystem.c">
<FileOption/>
</File>
<File Name="../../../../components/fatfs/ffunicode.c">
<FileOption/>
</File>
</VirtualDirectory>
<VirtualDirectory Name="shell">
<File Name="../../../../components/shell/drv_shell.c">
<FileOption/>
</File>
</VirtualDirectory>
<VirtualDirectory Name="usb_stack">
<VirtualDirectory Name="class">
<VirtualDirectory Name="cdc">
<File Name="../../../../components/usb_stack/class/cdc/usbd_cdc.c">
<FileOption/>
</File>
</VirtualDirectory>
<VirtualDirectory Name="hid">
<File Name="../../../../components/usb_stack/class/hid/usbd_hid.c">
<FileOption/>
</File>
</VirtualDirectory>
<VirtualDirectory Name="msc">
<File Name="../../../../components/usb_stack/class/msc/usbd_msc.c">
<FileOption/>
</File>
</VirtualDirectory>
</VirtualDirectory>
<VirtualDirectory Name="core">
<File Name="../../../../components/usb_stack/core/usbd_core.c">
<FileOption/>
</File>
</VirtualDirectory>
</VirtualDirectory>
</VirtualDirectory>
<Dependencies Name="BuildSet"/>
<BuildConfigs>
<BuildConfig Name="BuildSet">
<Target>
<ROMBank Selected="1">
<ROM1>
<InUse>no</InUse>
<Start>0x23000000</Start>
<Size>0x100000</Size>
</ROM1>
<ROM2>
<InUse>no</InUse>
<Start>0x22014000</Start>
<Size>0x4000</Size>
</ROM2>
<ROM3>
<InUse>no</InUse>
<Start>0x42018000</Start>
<Size>0x8000</Size>
</ROM3>
<ROM4>
<InUse>no</InUse>
<Start/>
<Size/>
</ROM4>
<ROM5>
<InUse>no</InUse>
<Start/>
<Size/>
</ROM5>
</ROMBank>
<RAMBank>
<RAM1>
<InUse>yes</InUse>
<Start>0x42020000</Start>
<Size>0xc000</Size>
<Init>yes</Init>
</RAM1>
<RAM2>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM2>
<RAM3>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM3>
<RAM4>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM4>
<RAM5>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM5>
</RAMBank>
<CPU>rv32imafc</CPU>
<UseMiniLib>no</UseMiniLib>
<Endian>little</Endian>
<UseHardFloat>no</UseHardFloat>
<UseEnhancedLRW>no</UseEnhancedLRW>
<UseContinueBuild>no</UseContinueBuild>
<UseSemiHost>no</UseSemiHost>
</Target>
<Output>
<OutputName>$(ProjectName)</OutputName>
<Type>Executable</Type>
<CreateHexFile>no</CreateHexFile>
<CreateBinFile>yes</CreateBinFile>
<Preprocessor>no</Preprocessor>
<Disassmeble>yes</Disassmeble>
<CallGraph>no</CallGraph>
<Map>yes</Map>
</Output>
<User>
<BeforeCompile>
<RunUserProg>no</RunUserProg>
<UserProgName/>
</BeforeCompile>
<BeforeMake>
<RunUserProg>no</RunUserProg>
<UserProgName/>
</BeforeMake>
<AfterMake>
<RunUserProg>no</RunUserProg>
<UserProgName>$(ProjectPath)../../../../tools/bflb_flash_tool/bflb_mcu_tool.exe --chipname=bl702 --firmware="D:/BouffaloLabWS/cdk_ws/bl_mcu_sdk/examples/hellowd/Obj/helloworld.bin" </UserProgName>
</AfterMake>
</User>
<Compiler>
<Define>BL702;BL702_EVB;ARCH_RISCV;</Define>
<Undefine/>
<Optim>Optimize more (-O2)</Optim>
<DebugLevel>Default (-g)</DebugLevel>
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl706_iot;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/libc/inc;$(ProjectPath)../../../../common/libc/inc/arm_gcc;$(ProjectPath)../../../../common/libc/inc/bits;$(ProjectPath)../../../../common/libc/inc/sys;$(ProjectPath)../../../../common/libc/src;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl602_driver/regs;$(ProjectPath)../../../../drivers/bl602_driver/std_drv/inc</IncludePath>
<OtherFlags>-fshort-enums -fno-common -fms-extensions -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wall -Wshift-negative-value -Wchar-subscripts -Wformat -Wuninitialized -Winit-self -fno-jump-tables -Wignored-qualifiers -Wswitch-default -Wunused -Wundef -msmall-data-limit=4</OtherFlags>
<Verbose>no</Verbose>
<Ansi>no</Ansi>
<Syntax>no</Syntax>
<Pedantic>no</Pedantic>
<PedanticErr>no</PedanticErr>
<InhibitWarn>no</InhibitWarn>
<AllWarn>yes</AllWarn>
<WarnErr>no</WarnErr>
<OneElfS>yes</OneElfS>
<Fstrict>no</Fstrict>
</Compiler>
<Asm>
<Define/>
<Undefine/>
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl706_iot;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl602_driver/startup;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl602_driver/regs;$(ProjectPath)../../../../drivers/bl602_driver/std_drv/inc</IncludePath>
<OtherFlags/>
<DebugLevel>gdwarf2</DebugLevel>
</Asm>
<Linker>
<Garbage>yes</Garbage>
<Garbage2>yes</Garbage2>
<LDFile>$(ProjectPath)../../../../drivers/bl702_driver/bl702_flash.ld</LDFile>
<LibName>c;gcc</LibName>
<LibPath/>
<OtherFlags/>
<AutoLDFile>no</AutoLDFile>
<LinkType/>
</Linker>
<Debug>
<LoadApplicationAtStartup>yes</LoadApplicationAtStartup>
<Connector>ICE</Connector>
<StopAt>yes</StopAt>
<StopAtText>main</StopAtText>
<InitFile/>
<AfterLoadFile>$(ProjectPath)/../../../../tools/openocd/bl70x_gdb.init</AfterLoadFile>
<AutoRun>yes</AutoRun>
<ResetType>Hard Reset</ResetType>
<SoftResetVal>23000000</SoftResetVal>
<ResetAfterLoad>no</ResetAfterLoad>
<Dumpcore>no</Dumpcore>
<DumpcoreText>$(ProjectPath)/$(ProjectName).cdkcore</DumpcoreText>
<ConfigICE>
<IP>localhost</IP>
<PORT>1025</PORT>
<CPUNumber>0</CPUNumber>
<Clock>2000</Clock>
<Delay>10</Delay>
<WaitReset>50</WaitReset>
<DDC>yes</DDC>
<TRST>no</TRST>
<DebugPrint>no</DebugPrint>
<Connect>Normal</Connect>
<ResetType>Hard Reset</ResetType>
<SoftResetVal>21000000</SoftResetVal>
<RTOSType>Bare Metal</RTOSType>
<DownloadToFlash>yes</DownloadToFlash>
<ResetAfterConnect>yes</ResetAfterConnect>
<GDBName/>
<GDBServerType>Local</GDBServerType>
<OtherFlags>-arch riscv</OtherFlags>
</ConfigICE>
<ConfigSIM>
<SIMTarget/>
<OtherFlags/>
<NoGraphic>yes</NoGraphic>
<Log>no</Log>
<SimTrace>no</SimTrace>
</ConfigSIM>
<ConfigOpenOCD>
<OpenOCDExecutablePath>openocd-bl702</OpenOCDExecutablePath>
<OpenOCDTelnetPortEnable>no</OpenOCDTelnetPortEnable>
<OpenOCDTelnetPort>4444</OpenOCDTelnetPort>
<OpenOCDTclPortEnable>no</OpenOCDTclPortEnable>
<OpenOCDTclPort>6666</OpenOCDTclPort>
<OpenOCDConfigOptions>-f openocd_bl702_evb.cfg</OpenOCDConfigOptions>
</ConfigOpenOCD>
</Debug>
<Flash>
<InitFile/>
<Erase>Erase Sectors</Erase>
<Algorithms Path="">bl702_flasher.elf</Algorithms>
<Program>yes</Program>
<Verify>yes</Verify>
<ResetAndRun>no</ResetAndRun>
<ResetType>Hard Reset</ResetType>
<SoftResetVal/>
<External>no</External>
<Command/>
<Arguments/>
</Flash>
</BuildConfig>
</BuildConfigs>
<DebugSessions>
<watchExpressions/>
<memoryExpressions>;;;</memoryExpressions>
<statistics>;;MHZ;</statistics>
<peripheralTabs>
<Tab disFormat="Hex">glb</Tab>
<Tab disFormat="Hex">uart</Tab>
</peripheralTabs>
<WatchDisplayFormat>1</WatchDisplayFormat>
<LocalDisplayFormat>1</LocalDisplayFormat>
<debugLayout/>
<memoryTabColSizeExpressions>100:8;100:8;100:8;100:8;</memoryTabColSizeExpressions>
</DebugSessions>
<DebugSessions>
<watchExpressions/>
<memoryExpressions>;;;</memoryExpressions>
<statistics>;;MHZ;</statistics>
<peripheralTabs>
<Tab disFormat="Hex">glb</Tab>
<Tab disFormat="Hex">uart</Tab>
</peripheralTabs>
<WatchDisplayFormat>1</WatchDisplayFormat>
<LocalDisplayFormat>1</LocalDisplayFormat>
<debugLayout/>
<memoryTabColSizeExpressions>100:8;100:8;100:8;100:8;</memoryTabColSizeExpressions>
</DebugSessions>
</Project>

View file

@ -0,0 +1,230 @@
/**
* *****************************************************************************
* @file dis_cmd.c
* @version 0.1
* @date 2020-09-30
* @brief
* *****************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2020 Bouffalo Lab</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of Bouffalo Lab nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* *****************************************************************************
*/
#include "ring_buffer.h"
#include "bflb_platform.h"
#include "hal_uart.h"
#include "dis_cmd.h"
#include "GSL61xx.h"
//#undef MSG
//#define MSG(...)
FCSCMD_TypeDef Rx, Tx;
uint8_t image[120 * 104];
uint8_t Run_XOR(uint8_t *buf, uint16_t len)
{
uint16_t i;
uint8_t value;
for (value = 0, i = 0; i < len; i++)
value ^= buf[i];
return value;
}
uint8_t Run_SUM(uint8_t *buf, uint16_t len)
{
uint16_t i;
uint8_t value;
for (value = 0, i = 0; i < len; i++)
value += buf[i];
return (~value);
}
void CMD_Process(PACK_TypeDef *CMD_Pack, PACK_TypeDef *ACK_Pack)
{
static int index = 0;
struct device *uart = device_find("debug_log");
/*TODO ACK Function */
uint8_t CAP_REP[] = {0x3A, 0x02, 0x00, 0x00, 0x00, 0x04, 0x3c, 0x00, 0x78, 0x00, 0x68, 0xA3};
uint8_t TRANSMIT_REP[] = {0x3A, 0x06, 0x00, 0x00, 0x00, 0x02, 0x3e, 0x80, 0x00, 0xff};
uint8_t TRANSMIT_REP2[] = {0x3A, 0x06, 0x00, 0x00, 0x00, 0x04, 0x38, 0x80, 0x00, 0x0e, 0x8b, 0x6A};
uint8_t data_XOR = 0;
uint8_t data_SUM = 0;
switch (CMD_Pack->Cmd1)
{
case CMD_INT:
break;
case CMD_GETINFO:
break;
case CMD_CAPTURE:
/*cap image */
CaptureGSL61xx(image);
//device_write(uart, 0, (uint8_t *)CAP_REP, sizeof(CAP_REP));
for (index = 0; index < 120; index++)
{
device_write(uart, 0, (uint8_t *)&image[index * 104], 104);
}
break;
case CMD_DELETE:
break;
case CMD_TRANSMIT:
device_write(uart, 0, (uint8_t *)TRANSMIT_REP, sizeof(TRANSMIT_REP));
device_write(uart, 0, (uint8_t *)(image + 256 * index), 256);
data_XOR = Run_XOR(image + 256 * index, 256);
data_SUM = Run_SUM(image + 256 * index, 256);
TRANSMIT_REP2[9] = data_XOR;
TRANSMIT_REP2[10] = data_SUM;
TRANSMIT_REP2[11] = Run_SUM(TRANSMIT_REP2, 11);
device_write(uart, 0, (uint8_t *)TRANSMIT_REP2, 12);
index++;
if (index == 49)
{
index = 0;
//memset(image,0,120*104);
//Ring_Buffer_Reset(&uartRB);
GSL61xx_init();
}
break;
case CMD_CONFIG:
break;
case CMD_DEBUG:
break;
default:
break;
}
}
int8_t TASK_Check_CMD(PACK_TypeDef *RxPack, PACK_TypeDef *TxPack)
{
TxPack->Head = RxPack->Head;
TxPack->Cmd1 = RxPack->Cmd1;
TxPack->Len = 0;
/* TODO ExtData deal function */
if (RxPack->Cmd1 == 0x02)
{
RxPack->Len >>= 8;
if (Run_XOR((uint8_t *)RxPack, 6) != RxPack->XOR)
{
TxPack->Cmd2 = ERROR_XOR;
//MSG("error1\r\n");
return -1;
}
else if (Run_SUM((uint8_t *)RxPack, RxPack->Len + 7) != RxPack->SUM)
{
TxPack->Cmd2 = ERROR_SUM;
//MSG("error2\r\n");
return -1;
}
else
return 0;
}
else
{
RxPack->Len >>= 8; //0x0400 -> 0x0004
//MSG("RxPack->Head = 0x%x\r\n ",RxPack->Head);
//MSG("RxPack->Cmd1 = 0x%x\r\n ",RxPack->Cmd1);
//MSG("RxPack->Cmd2 = 0x%x\r\n ",RxPack->Cmd2);
//MSG("RxPack->Len = 0x%x\r\n ",RxPack->Len);
//MSG("RxPack->XOR = 0x%x\r\n ",RxPack->XOR);
//MSG("RxPack->ExtData[0] = 0x%x\r\n ",RxPack->ExtData[0]);
//MSG("RxPack->ExtData[1] = 0x%x\r\n ",RxPack->ExtData[1]);
//MSG("RxPack->ExtData[2] = 0x%x\r\n ",RxPack->ExtData[2]);
//MSG("RxPack->ExtData[3] = 0x%x\r\n ",RxPack->ExtData[3]);
//MSG("RxPack->SUM = 0x%x\r\n ",RxPack->SUM);
if (Run_XOR((uint8_t *)RxPack, 6) != RxPack->XOR)
{
TxPack->Cmd2 = ERROR_XOR;
//MSG("error1\r\n");
return -1;
}
else if (Run_SUM((uint8_t *)RxPack, RxPack->Len + 7) != RxPack->SUM)
{
TxPack->Cmd2 = ERROR_SUM;
//MSG("error2\r\n");
return -1;
}
else
return 0;
}
}
Ring_Buffer_Type uartRB;
void uart_irq_callback(struct device *dev, void *args, uint32_t size, uint32_t state)
{
uint8_t i = 0;
if (state == UART_EVENT_RX_FIFO)
{
Ring_Buffer_Write(&uartRB, (uint8_t *)args, size);
}
else if (state == UART_EVENT_RTO)
{
Ring_Buffer_Write(&uartRB, (uint8_t *)args, size);
}
}
uint8_t ringbuffer[64];
void display_cmd_init(void)
{
struct device *uart = device_find("debug_log");
device_set_callback(uart, uart_irq_callback);
device_control(uart, DEVICE_CTRL_SET_INT, (void *)(UART_RX_FIFO_IT | UART_RTO_IT));
Ring_Buffer_Init(&uartRB, ringbuffer, sizeof(ringbuffer), NULL, NULL);
}
void display_cmd_handle(void)
{
uint16_t ringbuf_len = 0;
ringbuf_len = Ring_Buffer_Read(&uartRB, (uint8_t *)&Rx.Packet, sizeof(Rx.Packet));
if (ringbuf_len != 0)
{
//MSG("ringbuf_len =%d\r\n",ringbuf_len );
if (0 == TASK_Check_CMD(&Rx.Packet, &Tx.Packet))
{
Ring_Buffer_Reset(&uartRB);
CMD_Process(&Rx.Packet, &Tx.Packet);
}
}
}

View file

@ -0,0 +1,93 @@
#ifndef __DISPLAY_CMD__
#define __DISPLAY_CMD__
#include "ring_buffer.h"
extern Ring_Buffer_Type uartRB;
#define EXT_DAT_LEN 4
#define BUF_LEN (EXT_DAT_LEN + 8)
#define CMD_INT 0x00
#define CMD_GETINFO 0x01
#define CMD_CAPTURE 0x02
#define CMD_ENROLL 0x03
#define CMD_ENROLL_EX 0x13
#define CMD_MATCH 0x04
#define CMD_MATCH_SINGLE 0x14
#define CMD_DELETE 0x05
#define CMD_TRANSMIT 0x06
#define CMD_CONFIG 0x07
#define CMD_DEBUG 0x08
#define CMD_INVALID 0xFF
#define SUCCESS_FP 0x0000
#define ERROR_FP 0x8000
#define ERROR_XOR 0x8F01
#define ERROR_SUM 0x8F02
#define ERROR_CMD 0x8F03
#define ERROR_PAR 0x8F04
#define ERROR_TIME 0x8F05
#define ERROR_NO_PAR 0x8F06
#define ERROR_SYS 0x8F07
#define ERROR_VDD1 0x8F09
#define ERROR_VDD2 0x8F0a
#define ERROR_FLASH 0x8F0b
#define FAIL_INITIAL 0x8101
#define FAIL_CALIB 0x8102
#define FAIL_DETECT_FINGER 0x8201
#define FAIL_CAPTURE 0x8202
#define FAIL_CREATE_TMP 0x8203
#define FAIL_BE_ENROLLED 0x8301
#define FAIL_MATCH_TMP1 0x8302
#define FAIL_MATCH_TMP2 0x8303
#define FAIL_TMP_FULL 0x8304
#define FAIL_ENROLL_1 0x8311
#define FAIL_ENROLL_2 0x8312
#define FAIL_NO_TMP 0x8401
#define FAIL_MATCH 0x8402
#define FAIL_MATCH_SUB 0x8403
#define FAIL_RESIDUAL 0x8404
#define FAIL_DELTE 0x8501
#define FAIL_MATCH_C_MAIN 0x9401
#define FAIL_MATCH_C_TMP1 0x9402
#define FAIL_MATCH_C_TMP2 0x9403
#define FAIL_MATCH_MAIN_TMP1 0x9404
#define FAIL_MATCH_MAIN_TMP2 0x9405
#define FAIL_MATCH_TMP1_TMP2 0x9406
#define FAIL_CMOS_TEST 0x8801
typedef struct
{
uint8_t Head;
uint8_t Cmd1;
uint16_t Cmd2;
uint16_t Len;
uint8_t XOR;
uint8_t ExtData[EXT_DAT_LEN];
uint8_t SUM;
} PACK_TypeDef;
typedef struct
{
uint8_t *Data;
uint16_t Len;
} CMDPAR_TypeDef;
typedef union
{
uint8_t Buf[BUF_LEN];
PACK_TypeDef Packet;
} FCSCMD_TypeDef;
void display_cmd_init(void);
void display_cmd_handle(void);
#endif

View file

@ -0,0 +1,5 @@
MISO -- IO12
SCK -- IO11
MOSI -- IO5
CS -- IO10
RST -- IO6

View file

@ -0,0 +1,58 @@
/**
* @file main.c
* @brief
*
* Copyright (c) 2021 Bouffalolab team
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you 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.
*
*/
#include "GSL61xx.h"
uint8_t image[120 * 104];
void main(void)
{
uint32_t id = 0;
uint8_t i = 0;
bflb_platform_init(0);
if (SUCCESS == GSL61xx_init())
{
//GSL_FP_ReadChipID(&id);
//MSG("SPI communicate test success fingerprint id = %d\r\n",id);
}
else
{
//MSG("SPI communicate test failed\r\n");
}
struct device *uart = device_find("debug_log");
CaptureGSL61xx(image);
for (i = 0; i < 120; i++)
{
device_write(uart, 0, (uint8_t *)(&image[i * 104]), 104);
}
while (1)
{
}
BL_CASE_SUCCESS;
}