1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-20 06:45:10 +03:00

[Horus] Cosmetics

This commit is contained in:
Bertrand Songis 2016-02-20 19:15:22 +01:00
parent f926b85611
commit fe3efb9483
6 changed files with 92 additions and 102 deletions

View file

@ -240,31 +240,31 @@ const uint8_t * const LBM_MAINVIEWS_ICONS[] = {
* Model selection screen bitmaps * Model selection screen bitmaps
*/ */
const uint8_t LBM_LIBRARY_ICON[] __DMA = { const uint8_t LBM_LIBRARY_ICON[] = {
#include "mask_library.lbm" #include "mask_library.lbm"
}; };
const uint8_t LBM_LIBRARY_SLOT[] __DMA = { const uint8_t LBM_LIBRARY_SLOT[] = {
#include "mask_library_slot.lbm" #include "mask_library_slot.lbm"
}; };
const uint8_t LBM_LIBRARY_CURSOR[] __DMA = { const uint8_t LBM_LIBRARY_CURSOR[] = {
#include "mask_library_category_index.lbm" #include "mask_library_category_index.lbm"
}; };
const uint8_t LBM_SCORE0[] __DMA = { const uint8_t LBM_SCORE0[] = {
#include "mask_library_score_0.lbm" #include "mask_library_score_0.lbm"
}; };
const uint8_t LBM_SCORE1[] __DMA = { const uint8_t LBM_SCORE1[] = {
#include "mask_library_score_1.lbm" #include "mask_library_score_1.lbm"
}; };
const uint8_t LBM_STAR0[] __DMA = { const uint8_t LBM_STAR0[] = {
#include "mask_library_star_0.lbm" #include "mask_library_star_0.lbm"
}; };
const uint8_t LBM_STAR1[] __DMA = { const uint8_t LBM_STAR1[] = {
#include "mask_library_star_1.lbm" #include "mask_library_star_1.lbm"
}; };
@ -272,15 +272,15 @@ const uint8_t LBM_STAR1[] __DMA = {
* Calibration screen * Calibration screen
*/ */
const uint8_t LBM_HORUS[] __DMA = { const uint8_t LBM_HORUS[] = {
#include "alpha_horus.lbm" #include "alpha_horus.lbm"
}; };
const uint8_t LBM_STICK_BACKGROUND[] __DMA = { const uint8_t LBM_STICK_BACKGROUND[] = {
#include "alpha_stick_background.lbm" #include "alpha_stick_background.lbm"
}; };
const uint8_t LBM_STICK_POINTER[] __DMA = { const uint8_t LBM_STICK_POINTER[] = {
#include "alpha_stick_pointer.lbm" #include "alpha_stick_pointer.lbm"
}; };
@ -288,83 +288,83 @@ const uint8_t LBM_STICK_POINTER[] __DMA = {
* Other * Other
*/ */
const uint8_t LBM_ASTERISK[] __DMA = { const uint8_t LBM_ASTERISK[] = {
#include "alpha_asterisk.lbm" #include "alpha_asterisk.lbm"
}; };
const uint8_t LBM_POINT[] __DMA = { const uint8_t LBM_POINT[] = {
#include "mask_point.lbm" #include "mask_point.lbm"
}; };
const uint8_t LBM_CURVE_POINT[] __DMA = { const uint8_t LBM_CURVE_POINT[] = {
#include "mask_cvpoint.lbm" #include "mask_cvpoint.lbm"
}; };
const uint8_t LBM_CURVE_POINT_CENTER[] __DMA = { const uint8_t LBM_CURVE_POINT_CENTER[] = {
#include "mask_cvpoint_center.lbm" #include "mask_cvpoint_center.lbm"
}; };
const uint8_t LBM_CURVE_COORD_SHADOW[] __DMA = { const uint8_t LBM_CURVE_COORD_SHADOW[] = {
#include "mask_coord_shadow.lbm" #include "mask_coord_shadow.lbm"
}; };
const uint8_t LBM_SHUTDOWN[] __DMA = { const uint8_t LBM_SHUTDOWN[] = {
#include "alpha_shutdown.lbm" #include "alpha_shutdown.lbm"
}; };
const uint8_t LBM_SLEEP[] __DMA = { const uint8_t LBM_SLEEP[] __ALIGNED = {
#include "bmp_sleep.lbm" #include "bmp_sleep.lbm"
}; };
const uint8_t LBM_SHUTDOWN_CIRCLE[] __DMA = { const uint8_t LBM_SHUTDOWN_CIRCLE[] = {
#include "mask_shutdown_circle.lbm" #include "mask_shutdown_circle.lbm"
}; };
const uint8_t LBM_SLIDER_BAR_LEFT[] __DMA = { const uint8_t LBM_SLIDER_BAR_LEFT[] __ALIGNED = {
#include "bar_left.lbm" #include "bar_left.lbm"
}; };
const uint8_t LBM_SLIDER_BAR_RIGHT[] __DMA = { const uint8_t LBM_SLIDER_BAR_RIGHT[] __ALIGNED = {
#include "bar_right.lbm" #include "bar_right.lbm"
}; };
const uint8_t LBM_SLIDER_POINT_OUT[] __DMA = { const uint8_t LBM_SLIDER_POINT_OUT[] __ALIGNED = {
#include "point_out.lbm" #include "point_out.lbm"
}; };
const uint8_t LBM_SLIDER_POINT_MID[] __DMA = { const uint8_t LBM_SLIDER_POINT_MID[] __ALIGNED = {
#include "point_mid.lbm" #include "point_mid.lbm"
}; };
const uint8_t LBM_SLIDER_POINT_IN[] __DMA = { const uint8_t LBM_SLIDER_POINT_IN[] __ALIGNED = {
#include "point_in.lbm" #include "point_in.lbm"
}; };
const uint8_t LBM_CARROUSSEL_LEFT[] __DMA = { const uint8_t LBM_CARROUSSEL_LEFT[] = {
#include "mask_carroussel_left.lbm" #include "mask_carroussel_left.lbm"
}; };
const uint8_t LBM_CARROUSSEL_RIGHT[] __DMA = { const uint8_t LBM_CARROUSSEL_RIGHT[] = {
#include "mask_carroussel_right.lbm" #include "mask_carroussel_right.lbm"
}; };
const uint8_t LBM_BUTTON_ON[] __DMA = { const uint8_t LBM_BUTTON_ON[] = {
#include "alpha_button_on.lbm" #include "alpha_button_on.lbm"
}; };
const uint8_t LBM_BUTTON_OFF[] __DMA = { const uint8_t LBM_BUTTON_OFF[] = {
#include "alpha_button_off.lbm" #include "alpha_button_off.lbm"
}; };
const uint8_t LBM_SWIPE_CIRCLE[] __DMA = { const uint8_t LBM_SWIPE_CIRCLE[] = {
#include "mask_swipe_circle.lbm" #include "mask_swipe_circle.lbm"
}; };
const uint8_t LBM_SWIPE_LEFT[] __DMA = { const uint8_t LBM_SWIPE_LEFT[] = {
#include "mask_swipe_left.lbm" #include "mask_swipe_left.lbm"
}; };
const uint8_t LBM_SWIPE_RIGHT[] __DMA = { const uint8_t LBM_SWIPE_RIGHT[] = {
#include "mask_swipe_right.lbm" #include "mask_swipe_right.lbm"
}; };

View file

@ -20,7 +20,7 @@
#include "../../opentx.h" #include "../../opentx.h"
const uint8_t LBM_SPLASH[] __DMA = { const uint8_t LBM_SPLASH[] __ALIGNED = {
#include "bmp_splash.lbm" #include "bmp_splash.lbm"
}; };

View file

@ -20,11 +20,11 @@
#include "opentx.h" #include "opentx.h"
const uint8_t LBM_TOPMENU_BMP_OPENTX[] __DMA = { const uint8_t LBM_TOPMENU_BMP_OPENTX[] __ALIGNED = {
#include "bmp_topmenu_opentx.lbm" #include "bmp_topmenu_opentx.lbm"
}; };
const uint8_t LBM_THEME_DARKBLUE[] __DMA = { const uint8_t LBM_THEME_DARKBLUE[] __ALIGNED = {
#include "bmp_darkblue.lbm" #include "bmp_darkblue.lbm"
}; };

View file

@ -24,11 +24,11 @@ const uint8_t LBM_TOPMENU_MASK_OPENTX[] = {
#include "mask_topmenu_opentx.lbm" #include "mask_topmenu_opentx.lbm"
}; };
const uint8_t LBM_MAINVIEW_BACKGROUND[] = { const uint8_t LBM_MAINVIEW_BACKGROUND[] __ALIGNED = {
#include "bmp_background.lbm" #include "bmp_background.lbm"
}; };
const uint8_t LBM_THEME_DEFAULT[] __DMA = { const uint8_t LBM_THEME_DEFAULT[] __ALIGNED = {
#include "bmp_default.lbm" #include "bmp_default.lbm"
}; };

View file

@ -203,14 +203,14 @@
#define ROTARY_ENCODER_NAVIGATION #define ROTARY_ENCODER_NAVIGATION
#endif #endif
#define __ALIGNED __attribute__((aligned(32)))
#if defined(SIMU) #if defined(SIMU)
#define __DMA #define __DMA
#elif defined(PCBSKY9X)
#define __DMA __attribute__((aligned(32)))
#elif defined(STM32F4) #elif defined(STM32F4)
#define __DMA __attribute__((section(".ram"), aligned(32))) #define __DMA __attribute__((section(".ram"), aligned(32)))
#else #else
#define __DMA __attribute__((aligned(32))) #define __DMA __ALIGNED
#endif #endif
#if defined(SIMU) || defined(CPUARM) || GCC_VERSION < 472 #if defined(SIMU) || defined(CPUARM) || GCC_VERSION < 472

View file

@ -66,7 +66,7 @@ int ff_del_syncobj (_SYNC_t mutex)
/* Inidialize a Drive */ /* Inidialize a Drive */
DSTATUS disk_initialize ( DSTATUS disk_initialize (
BYTE drv /* Physical drive nmuber (0..) */ BYTE drv /* Physical drive nmuber (0..) */
) )
{ {
DSTATUS stat = 0; DSTATUS stat = 0;
@ -76,8 +76,8 @@ DSTATUS disk_initialize (
{ {
stat |= STA_NOINIT; stat |= STA_NOINIT;
} }
/*-------------------------- SD Init ----------------------------- */ /*-------------------------- SD Init ----------------------------- */
if (SD_Init() != SD_OK) if (SD_Init() != SD_OK)
{ {
TRACE("SD_Init() failed"); TRACE("SD_Init() failed");
@ -87,23 +87,23 @@ DSTATUS disk_initialize (
return(stat); return(stat);
} }
DWORD scratch[BLOCK_SIZE / 4] __DMA;
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
/* Return Disk Status */ /* Return Disk Status */
DSTATUS disk_status ( DSTATUS disk_status (
BYTE drv /* Physical drive nmuber (0..) */ BYTE drv /* Physical drive nmuber (0..) */
) )
{ {
DSTATUS stat = 0; DSTATUS stat = 0;
if (SD_Detect() != SD_PRESENT) if (SD_Detect() != SD_PRESENT)
stat |= STA_NODISK; stat |= STA_NODISK;
// STA_NOTINIT - Subsystem not initailized // STA_NOTINIT - Subsystem not initailized
// STA_PROTECTED - Write protected, MMC/SD switch if available // STA_PROTECTED - Write protected, MMC/SD switch if available
return(stat); return(stat);
} }
@ -113,28 +113,23 @@ uint32_t sdReadRetries = 0;
/* Read Sector(s) */ /* Read Sector(s) */
DRESULT disk_read ( DRESULT disk_read (
BYTE drv, /* Physical drive nmuber (0..) */ BYTE drv, /* Physical drive nmuber (0..) */
BYTE *buff, /* Data buffer to store read data */ BYTE *buff, /* Data buffer to store read data */
DWORD sector, /* Sector address (LBA) */ DWORD sector, /* Sector address (LBA) */
UINT count /* Number of sectors to read (1..255) */ UINT count /* Number of sectors to read (1..255) */
) )
{ {
DRESULT res = RES_OK; DRESULT res = RES_OK;
SD_Error Status; SD_Error Status;
// TRACE("disk_read %d %p %10d %d", drv, buff, sector, count); // TRACE("disk_read %d %p %10d %d", drv, buff, sector, count);
if (SD_Detect() != SD_PRESENT) { if (SD_Detect() != SD_PRESENT) {
TRACE("SD_Detect() != SD_PRESENT"); TRACE("SD_Detect() != SD_PRESENT");
return RES_NOTRDY; return RES_NOTRDY;
} }
if ((DWORD)buff & 3) // DMA Alignment failure, do single up to aligned buffer if ((DWORD)buff < 0x20000000 || (DWORD)buff >= 0x20030000 || ((DWORD)buff & 3)) {
{
TRACE("DMA Alignment failure, align buffer");
DWORD scratch[BLOCK_SIZE / 4]; // Alignment assured, you'll need a sufficiently big stack
while(count--) { while(count--) {
res = disk_read(drv, (BYTE *)scratch, sector++, 1); res = disk_read(drv, (BYTE *)scratch, sector++, 1);
@ -198,63 +193,58 @@ DRESULT disk_read (
#if _READONLY == 0 #if _READONLY == 0
DRESULT disk_write ( DRESULT disk_write (
BYTE drv, /* Physical drive nmuber (0..) */ BYTE drv, /* Physical drive nmuber (0..) */
const BYTE *buff, /* Data to be written */ const BYTE *buff, /* Data to be written */
DWORD sector, /* Sector address (LBA) */ DWORD sector, /* Sector address (LBA) */
UINT count /* Number of sectors to write (1..255) */ UINT count /* Number of sectors to write (1..255) */
) )
{ {
SD_Error Status; SD_Error Status;
DRESULT res = RES_OK; DRESULT res = RES_OK;
// TRACE("disk_write %d %p %10d %d", drv, buff, sector, count); // TRACE("disk_write %d %p %10d %d", drv, buff, sector, count);
if (SD_Detect() != SD_PRESENT)
return(RES_NOTRDY);
if ((DWORD)buff & 3) // DMA Alignment failure, do single up to aligned buffer if (SD_Detect() != SD_PRESENT)
{ return(RES_NOTRDY);
DWORD scratch[BLOCK_SIZE / 4]; // Alignment assured, you'll need a sufficiently big stack
while(count--) if ((DWORD)buff < 0x20000000 || (DWORD)buff >= 0x20030000 || ((DWORD)buff & 3)) {
{ while(count--) {
memcpy(scratch, buff, BLOCK_SIZE); memcpy(scratch, buff, BLOCK_SIZE);
res = disk_write(drv, (BYTE *)scratch, sector++, 1); res = disk_write(drv, (BYTE *)scratch, sector++, 1);
if (res != RES_OK) if (res != RES_OK)
break; break;
buff += BLOCK_SIZE; buff += BLOCK_SIZE;
} }
return(res);
}
return(res); if (count == 1) {
} Status = SD_WriteBlock((uint8_t *)buff, sector, BLOCK_SIZE); // 4GB Compliant
}
else {
Status = SD_WriteMultiBlocks((uint8_t *)buff, sector, BLOCK_SIZE, count); // 4GB Compliant
}
if (count == 1) { if (Status == SD_OK)
Status = SD_WriteBlock((uint8_t *)buff, sector, BLOCK_SIZE); // 4GB Compliant {
} SDTransferState State;
else {
Status = SD_WriteMultiBlocks((uint8_t *)buff, sector, BLOCK_SIZE, count); // 4GB Compliant
}
if (Status == SD_OK) Status = SD_WaitWriteOperation(); // Check if the Transfer is finished
{
SDTransferState State;
Status = SD_WaitWriteOperation(); // Check if the Transfer is finished while((State = SD_GetStatus()) == SD_TRANSFER_BUSY); // BUSY, OK (DONE), ERROR (FAIL)
while((State = SD_GetStatus()) == SD_TRANSFER_BUSY); // BUSY, OK (DONE), ERROR (FAIL) if ((State == SD_TRANSFER_ERROR) || (Status != SD_OK))
res = RES_ERROR;
}
else {
res = RES_ERROR;
}
if ((State == SD_TRANSFER_ERROR) || (Status != SD_OK)) // TRACE("result=%d", res);
res = RES_ERROR; return res;
}
else {
res = RES_ERROR;
}
// TRACE("result=%d", res);
return res;
} }
#endif /* _READONLY */ #endif /* _READONLY */
@ -265,9 +255,9 @@ DRESULT disk_write (
/* Miscellaneous Functions */ /* Miscellaneous Functions */
DRESULT disk_ioctl ( DRESULT disk_ioctl (
BYTE drv, /* Physical drive nmuber (0..) */ BYTE drv, /* Physical drive nmuber (0..) */
BYTE ctrl, /* Control code */ BYTE ctrl, /* Control code */
void *buff /* Buffer to send/receive control data */ void *buff /* Buffer to send/receive control data */
) )
{ {
DRESULT res; DRESULT res;