Compare commits

...

4 commits

Author SHA1 Message Date
Solomon Peachy
d6d7d560a0 FS#13689: Updated Korean Translation (Hoseok Seo)
Change-Id: I3ff0bcc5f885804f12293fde674b56336900c713
2025-11-17 13:02:09 -05:00
Dana Conrad
896cceee24 usbaudio: triage panic from splash()
Do the check in gui_wps_show() to avoid calling splash()
from anything other than the main thread

Change-Id: Icc1c6f287d82dc6e73b7cae9c75c18be73b82d48
2025-11-17 10:55:04 -05:00
Solomon Peachy
bc7bc4e8ac storage: report physical sector multiplier via storage_get_info()
Show this in in the info dump when we can't find a filesystem to mount
in main() plus in the ipod bootloaders

Change-Id: I3b437ae0032b17f29c0dd94043743f14d2b2f3ad
2025-11-17 08:57:43 -05:00
Solomon Peachy
44b5220f22 ata: Unify more of the ATA drivers into the common code
The goal of this was to have the ipod6g's ata driver report
proper vendor/model information from storage_info()

Change-Id: I64c1aee87c817cac23c90e062333a4ba3545dfaf
2025-11-17 08:29:56 -05:00
10 changed files with 191 additions and 90 deletions

View file

@ -65,6 +65,10 @@
#include "skin_engine/wps_internals.h"
#include "open_plugin.h"
#ifdef USB_ENABLE_AUDIO
#include "usbstack/usb_audio.h"
#endif
#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */
/* 3% of 30min file == 54s step size */
#define MIN_FF_REWIND_STEP 500
@ -713,6 +717,13 @@ static inline int action_wpsab_single(long button)
*/
long gui_wps_show(void)
{
/* NOTE: if USBAudio ever gets its own DSP channel, this block can go away! */
#ifdef USB_ENABLE_AUDIO
if (usb_audio_get_active())
{
splash(HZ*2, ID2P(LANG_USB_DAC_ACTIVE));
}
#endif
long button = 0;
bool restore = true;
bool exit = false;

View file

@ -16930,3 +16930,71 @@
*: "모든 트랙을 앨범별로 정렬"
</voice>
</phrase>
<phrase>
id: LANG_USB_DAC
desc: in settings_menu
user: core
<source>
*: none
usbdac: "USB-DAC"
</source>
<dest>
*: none
usbdac: "USB-DAC"
</dest>
<voice>
*: none
usbdac: "USB-DAC"
</voice>
</phrase>
<phrase>
id: LANG_WHILE_USB_CHARGE_ONLY
desc: in settings_menu
user: core
<source>
*: none
usbdac: "While In USB Charge-Only Mode"
</source>
<dest>
*: none
usbdac: "USB 충전 전용 모드 동안"
</dest>
<voice>
*: none
usbdac: "USB 충전 전용 모드 동안"
</voice>
</phrase>
<phrase>
id: LANG_WHILE_MASS_STORAGE_USB_ONLY
desc: in settings_menu
user: core
<source>
*: none
usbdac: "While In USB Mass-Storage Mode"
</source>
<dest>
*: none
usbdac: "USB 대용량 저장 모드 동안"
</dest>
<voice>
*: none
usbdac: "USB 대용량 저장 모드 동안"
</voice>
</phrase>
<phrase>
id: LANG_USB_DAC_ACTIVE
desc: for splash
user: core
<source>
*: none
usbdac: "USB-DAC Active"
</source>
<dest>
*: none
usbdac: "USB-DAC 활성"
</dest>
<voice>
*: none
usbdac: "USB-DAC 활성"
</voice>
</phrase>

View file

@ -647,6 +647,15 @@ static void init(void)
#endif
lcd_puts(0, line++, rbversion);
#ifdef STORAGE_GET_INFO
struct storage_info sinfo;
storage_get_info(0, &sinfo);
#ifdef MAX_PHYS_SECTOR_SIZE
lcd_putsf(0, line++, "id: '%s' s:%u*%u", sinfo.product, sinfo.sector_size, sinfo.phys_sector_mult);
#else
lcd_putsf(0, line++, "id: '%s' s:%u", sinfo.product, sinfo.sector_size);
#endif
#endif
struct partinfo pinfo;
for (int i = 0 ; i < NUM_VOLUMES ; i++) {
disk_partinfo(i, &pinfo);

View file

@ -2984,11 +2984,14 @@ static void audio_on_track_changed(void)
static void audio_start_playback(const struct audio_resume_info *resume_info,
unsigned int flags)
{
/* NOTE: if USBAudio ever gets its own DSP channel, this block can go away! */
/*
* Refuse to start playback if usb audio is active. See gui_wps_show() for
* a splash message to the user.
* NOTE: if USBAudio ever gets its own DSP channel, this block can go away!
*/
#ifdef USB_ENABLE_AUDIO
if (usb_audio_get_active())
{
splash(HZ*2, ID2P(LANG_USB_DAC_ACTIVE));
queue_reply(&audio_queue, 0);
return;
}

View file

@ -643,10 +643,10 @@ static void dump_bootflash(void)
lcd_clear_display();
lcd_set_foreground(LCD_WHITE);
line = 0;
uint8_t page[FLASH_PAGE_SIZE];
printf("Total pages: %d", FLASH_PAGES);
bootflash_init(SPI_PORT);
for (int i = 0; i < FLASH_PAGES; i++) {
@ -720,12 +720,12 @@ static void devel_menu(void)
lcd_set_foreground(LCD_RBYELLOW);
line = 0;
printf("Development menu");
for (size_t i = 0; i < items_count; i++) {
lcd_set_foreground(i == selected_item ? LCD_GREEN : LCD_WHITE);
printf(items[i]);
}
while (button_status() != BUTTON_NONE);
bool done = false;
@ -911,6 +911,15 @@ void main(void)
rc = disk_mount_all();
if (rc <= 0) {
#ifdef STORAGE_GET_INFO
struct storage_info sinfo;
storage_get_info(0, &sinfo);
#ifdef MAX_PHYS_SECTOR_SIZE
printf("id: '%s' s:%u*%u", sinfo.product, sinfo.sector_size, sinfo.phys_sector_mult);
#else
printf("id: '%s' s:%u", sinfo.product, sinfo.sector_size);
#endif
#endif
struct partinfo pinfo;
printf("No partition found");
for (int i = 0 ; i < NUM_VOLUMES ; i++) {

View file

@ -34,6 +34,7 @@
#include "ata.h"
#include "file_internal.h"
#include "disk.h"
#include "storage.h"
#include "font.h"
#include "adc.h"
#include "backlight.h"
@ -364,6 +365,15 @@ void* main(void)
rc = disk_mount_all();
if (rc<=0)
{
#ifdef STORAGE_GET_INFO
struct storage_info sinfo;
storage_get_info(0, &sinfo);
#ifdef MAX_PHYS_SECTOR_SIZE
printf("id: '%s' s:%u*%u", sinfo.product, sinfo.sector_size, sinfo.phys_sector_mult);
#else
printf("id: '%s' s:%u", sinfo.product, sinfo.sector_size);
#endif
#endif
for (int i = 0 ; i < NUM_VOLUMES ; i++) {
disk_partinfo(i, &pinfo);
if (pinfo.type)

View file

@ -20,6 +20,63 @@
/* This is intended to be #included into the ATA driver */
static sector_t total_sectors;
static uint32_t log_sector_size;
static uint16_t identify_info[ATA_IDENTIFY_WORDS] STORAGE_ALIGN_ATTR;
#ifdef HAVE_LBA48
static bool ata_lba48 = false; /* set for 48 bit addressing */
#endif
static bool canflush = true;
static int spinup_time = 0;
static struct mutex ata_mutex SHAREDBSS_ATTR;
#ifdef MAX_PHYS_SECTOR_SIZE
static uint16_t phys_sector_mult = 1;
#endif
int ata_spinup_time(void)
{
return spinup_time;
}
#ifdef STORAGE_GET_INFO
void ata_get_info(IF_MD(int drive,)struct storage_info *info)
{
unsigned short *src,*dest;
static char vendor[8];
static char product[16];
static char revision[4];
#ifdef HAVE_MULTIDRIVE
(void)drive; /* unused for now */
#endif
int i;
info->sector_size = log_sector_size;
info->num_sectors = total_sectors;
#ifdef MAX_PHYS_SECTOR_SIZE
info->phys_sector_mult = phys_sector_mult;
#endif
src = (unsigned short*)&identify_info[27];
dest = (unsigned short*)vendor;
for (i=0;i<4;i++)
dest[i] = htobe16(src[i]);
info->vendor=vendor;
src = (unsigned short*)&identify_info[31];
dest = (unsigned short*)product;
for (i=0;i<8;i++)
dest[i] = htobe16(src[i]);
info->product=product;
src = (unsigned short*)&identify_info[23];
dest = (unsigned short*)revision;
for (i=0;i<2;i++)
dest[i] = htobe16(src[i]);
info->revision=revision;
}
#endif
#ifdef MAX_PHYS_SECTOR_SIZE
#ifdef MAX_VARIABLE_LOG_SECTOR
@ -39,7 +96,11 @@ struct sector_cache_entry {
};
/* buffer for reading and writing large physical sectors */
static struct sector_cache_entry sector_cache STORAGE_ALIGN_ATTR;
static uint16_t phys_sector_mult = 1;
static int ata_transfer_sectors(uint64_t start,
int incount,
void* inbuf,
int write);
static int cache_sector(sector_t sector)
{

View file

@ -90,32 +90,22 @@ enum {
static int ata_state = ATA_BOOT;
static struct mutex ata_mutex SHAREDBSS_ATTR;
static int ata_device; /* device 0 (master) or 1 (slave) */
static int spinup_time = 0;
#if (CONFIG_LED == LED_REAL)
static bool ata_led_enabled = true;
static bool ata_led_on = false;
#endif
static long sleep_timeout = 5*HZ;
#ifdef HAVE_LBA48
static bool ata_lba48 = false; /* set for 48 bit addressing */
#endif
static bool canflush = true;
static long last_disk_activity = -1;
#ifdef HAVE_ATA_POWER_OFF
static long power_off_tick = 0;
#endif
static sector_t total_sectors;
static uint32_t log_sector_size;
static uint8_t multisectors; /* number of supported multisectors */
static unsigned short identify_info[ATA_IDENTIFY_WORDS] STORAGE_ALIGN_ATTR;
#ifdef HAVE_ATA_DMA
static int dma_mode = 0;
#endif
@ -147,6 +137,8 @@ static inline bool ata_power_off_timed_out(void)
#endif
}
#include "ata-common.c"
#ifndef ATA_TARGET_POLLING
static ICODE_ATTR int wait_for_bsy(void)
{
@ -594,8 +586,6 @@ static int ata_transfer_sectors(uint64_t start,
return ret;
}
#include "ata-common.c"
#ifndef MAX_PHYS_SECTOR_SIZE
int ata_read_sectors(IF_MD(int drive,)
sector_t start,
@ -1218,46 +1208,6 @@ long ata_last_disk_activity(void)
return last_disk_activity;
}
int ata_spinup_time(void)
{
return spinup_time;
}
#ifdef STORAGE_GET_INFO
void ata_get_info(IF_MD(int drive,)struct storage_info *info)
{
unsigned short *src,*dest;
static char vendor[8];
static char product[16];
static char revision[4];
#ifdef HAVE_MULTIDRIVE
(void)drive; /* unused for now */
#endif
int i;
info->sector_size = log_sector_size;
info->num_sectors = total_sectors;
src = (unsigned short*)&identify_info[27];
dest = (unsigned short*)vendor;
for (i=0;i<4;i++)
dest[i] = htobe16(src[i]);
info->vendor=vendor;
src = (unsigned short*)&identify_info[31];
dest = (unsigned short*)product;
for (i=0;i<8;i++)
dest[i] = htobe16(src[i]);
info->product=product;
src = (unsigned short*)&identify_info[23];
dest = (unsigned short*)revision;
for (i=0;i<2;i++)
dest[i] = htobe16(src[i]);
info->revision=revision;
}
#endif
#ifdef HAVE_ATA_DMA
/* Returns last DMA mode as set by set_features() */
int ata_get_dma_mode(void)

View file

@ -108,6 +108,9 @@ struct storage_info
{
unsigned int sector_size;
sector_t num_sectors;
#ifdef MAX_PHYS_SECTOR_SIZE
uint16_t phys_sector_mult;
#endif
char *vendor;
char *product;
char *revision;

View file

@ -65,21 +65,14 @@
/** static, private data **/
static uint8_t ceata_taskfile[16] STORAGE_ALIGN_ATTR;
static uint16_t identify_info[ATA_IDENTIFY_WORDS] STORAGE_ALIGN_ATTR;
static bool ceata;
static bool ata_lba48;
static bool ata_dma;
static uint64_t ata_total_sectors;
static uint32_t log_sector_size;
static struct mutex ata_mutex;
static struct semaphore ata_wakeup;
static long ata_last_activity_value = -1;
static long ata_sleep_timeout = 7 * HZ;
static bool ata_powered;
static bool canflush = true;
static struct semaphore mmc_wakeup;
static struct semaphore mmc_comp_wakeup;
static int spinup_time = 0;
#ifdef HAVE_ATA_DMA
static int dma_mode = 0;
static uint32_t ata_dma_flags;
@ -90,6 +83,8 @@ static const bool ata_error_srst = true;
static int ata_reset(void);
#include "ata-common.c"
static uint16_t ata_read_cbr(uint32_t volatile* reg)
{
while (!(ATA_PIO_READY & 2));
@ -758,10 +753,10 @@ static int ata_power_up(void)
spinup_time = current_tick - spinup_start;
ata_total_sectors = (identify_info[61] << 16) | identify_info[60];
if (ceata || (identify_info[83] & BIT(10) && ata_total_sectors == 0x0FFFFFFF))
total_sectors = (identify_info[61] << 16) | identify_info[60];
if (ceata || (identify_info[83] & BIT(10) && total_sectors == 0x0FFFFFFF))
{
ata_total_sectors = ((uint64_t)identify_info[103] << 48) |
total_sectors = ((uint64_t)identify_info[103] << 48) |
((uint64_t)identify_info[102] << 32) |
((uint64_t)identify_info[101] << 16) |
identify_info[100];
@ -902,11 +897,11 @@ static int ata_rw_chunk(uint64_t sector, uint32_t cnt, void* buffer, bool write)
return rc;
}
static int ata_transfer_sectors(uint64_t sector, uint32_t count, void* buffer, bool write)
static int ata_transfer_sectors(uint64_t sector, int count, void* buffer, int write)
{
if (!ata_powered)
ata_power_up();
if (sector + count > ata_total_sectors)
if (sector + count > total_sectors)
RET_ERR(0);
ata_set_active();
if (ata_dma && write)
@ -1014,8 +1009,6 @@ static int ata_reset(void)
return rc;
}
#include "ata-common.c"
#ifndef MAX_PHYS_SECTOR_SIZE
int ata_read_sectors(IF_MD(int drive,) sector_t start, int incount,
void* inbuf)
@ -1134,17 +1127,6 @@ void ata_spin(void)
ata_set_active();
}
#ifdef STORAGE_GET_INFO
void ata_get_info(IF_MD(int drive,) struct storage_info *info)
{
info->sector_size = log_sector_size;
info->num_sectors = ata_total_sectors;
info->vendor = "Apple";
info->product = "iPod Classic";
info->revision = "1.0";
}
#endif
long ata_last_disk_activity(void)
{
return ata_last_activity_value;
@ -1158,7 +1140,7 @@ int ata_init(void)
semaphore_init(&mmc_comp_wakeup, 1, 0);
ceata = PDAT(11) & BIT(1);
ata_powered = false;
ata_total_sectors = 0;
total_sectors = 0;
/* get identify_info */
mutex_lock(&ata_mutex);
@ -1255,11 +1237,6 @@ unsigned short* ata_get_identify(void)
return identify_info;
}
int ata_spinup_time(void)
{
return spinup_time;
}
#ifdef HAVE_ATA_DMA
int ata_get_dma_mode(void)
{