It is the 1683rd of March 2020 (aka the 8th of October 2024)
You are 3.237.15.145,
pleased to meet you!
mailto:blog-at-heyrick-dot-eu
RISC OS source mods
This is mostly for me, to remind me how to tweak the RISC OS code when I update the source files to the current version (I do this every few months so I'm not too out of step). However, the modifications may be useful to you too, if you build your own version of RISC OS.
#1 Support CET/CEST timezone in UK territory.
As previously described, provides direct support for Western European time in the standard UK territory. Because creating a new territory and linking it into the system is a huge pain in the ass when you only want to tweak something that Territory should have kept its nose out of in the first place.
In the file ...castle.RiscOS.Sources.Internat.Territory.Module.s.UK, change line 55 from:
As previously described, the localtime() function uses the SWI Territory_ReadTimeZones to determine the current timezone offset from GMT. This was, unfortunately, the wrong call to make so will only ever return the offset of the first timezone in a multi-timezone setting. In other words, if you apply the above patch and select CET/CEST as your timezone, localtime() will just blindly go ahead and return values for GMT/BST.
Starting from line 257 of ...castle.RiscOS.Sources.Lib.RISC_OSLib.c.time, change:
territory = __locales[N_LC_TIME];
if (!territory) {
r.r[0] = -1; /* If C locale use current configured territory */
} else {
r.r[0] = TERRITORY_EXTRACT(territory);
r.r[1] = TERRITORY_TZ_EXTRACT(territory);
r.r[4] = TERRITORY_TZ_API_EXT; /* If not supported, never mind */
}
if (_kernel_swi(Territory_ReadTimeZones, &r, &r) == NULL) {
v = (dst == 0x8000) ? r.r[3] : r.r[2];
t += v / 100; /* centiseconds -> seconds */
}
to be:
territory = __locales[N_LC_TIME];
if ( !territory )
{
// If C locale, use the currently configured timezone
// of the currently configured territory
r.r[2] = 0; // make sure it does not say "ZONE"
_kernel_swi(Territory_ReadCurrentTimeZone, &r, &r);
t += (r.r[1] / 100); // centiseconds -> seconds
}
else
{
// Custom locale - work it out from the specified
// timezone and DST setting
r.r[0] = TERRITORY_EXTRACT(territory);
r.r[1] = TERRITORY_TZ_EXTRACT(territory);
r.r[4] = TERRITORY_TZ_API_EXT; /* If not supported, never mind */
if (_kernel_swi(Territory_ReadTimeZones, &r, &r) == NULL)
{
v = (dst == 0x8000) ? r.r[3] : r.r[2];
t += v / 100; /* centiseconds -> seconds */
}
}
#3 Adjust-click on Switcher icon opens system configuration
In ...castle.RiscOS.Sources.Desktop.Switcher.s.Switcher, from line 4332, delete the code between click_select and power_click (checking for h_powerdown, h_shutdown, h_savedbox, h_switcher and iconbar_handle) and place the following code there instead:
click_select
LDR R0,[R1,#b_window]
CMP R0,#iconbar_whandle
BEQ openswitcher
BNE click_common
click_adjust
LDR R0,[R1,#b_window]
CMP R0,#iconbar_whandle
BEQ goconfig
; it's not a click on the iconbar icon so try our windows
; for this we treat select and adjust click the same
click_common
LDR R14,h_powerdown ; was it the power down dialogue
TEQ R0,R14
BEQ power_click
LDR R14,h_shutdown ; click in restart dialogue?
TEQ R0,R14
BEQ restart
LDR R14,h_savedbox
TEQ R0,R14
BEQ dbox_click
LDR R14,h_switcher ; click in task window?
TEQ R0,R14 ; no => assume iconbar icon
BEQ switcher_click
Pull "PC" ; ignore it if none of these
Original hack by Rick Murray, optimised by Fred Graute.
#4 Double the size of the RAMdisc
Older source:
In ...castle.RiscOS.Sources.Kernel.s.NewReset, around line 1304, you should see:
MOV r5, #128*1024*1024 ; A trade off between [...etc...]
Change the "128" to a larger value, such as 256. Note that it must be a value that can be represented by a MOV instruction.
Newer source:
In ...castle.RiscOS.Sources.Kernel.hdr.Options, around line 317, you should see:
MaxRAMFS_Size SETA 128 ; Max size available for RAM Disc
Change the "128" to a larger value, such as "256". As above, it is multiplied by 1024*1024, so it must eventually be a value that can be represented by a MOV instruction.
Please be aware that the ARM has only 4GiB of logical address space, and the RAMdisc "claims" the amount requested permanently. If the RAMdisc remains unused, then no memory is claimed or mapped in, but that much space is always allocated in the logical memory map. For this reason, the largest sensible RAMdisc size is possibly 256MiB or 320MiB, depending on how much physical memory you have on-board. RAMdisc would be a candidate for being implemented differently, some day...
#5 Run IIC at a decent speed
By default, RISC OS runs its IIC bus at 100kHz. This means approximately 12.5KiB/sec. This is '80s tech. This is sloooow.
Given that the IIC bus runs at 3.3V, if you are using 3.3V hardware, then that hardware is probably new enough to run at the faster 400kHz speed (~50KiB/sec). Compatibility problems ought to be minimal, the Fast Mode was introduced in 1992 - that's twenty two years ago.
To do this on a RaspberryPi, go to ...mixed.RiscOS.Sources.HAL.BCM2836.s.IIC and change lines 54 and 55 from:
; IIC divider to give 100 kHz
IICDivider * 2496
to:
; IIC divider to give ~400 kHz
IICDivider * 624
For the OMAP3 hardware (Beagle boards), you will want to look at the relevant HAL code. OMAP3 sets the speed around line 127, though I've not looked to see what values are required.
You don't need to modify OMAP4 (Panda) hardware, it already runs at 400kHz.
You should leave Iyonix and IOMD hardware running at 100kHz. If any machine is likely to interface with old (slow) hardware, it's the RiscPC... moreso given that there is no hardware IIC controller on either device, it's all done by directly bashing two lines on the IOMD (RiscPC) and whatever the I/O chip in the Iyonix is - about as technically advanced as the original Archimedes!
Your comments:
Please note that while I check this page every so often, I am not able to control what users write; therefore I disclaim all liability for unpleasant and/or infringing and/or defamatory material. Undesired content will be removed as soon as it is noticed. By leaving a comment, you agree not to post material that is illegal or in bad taste, and you should be aware that the time and your IP address are both recorded, should it be necessary to find out who you are. Oh, and don't bother trying to inline HTML. I'm not that stupid! ☺ ADDING COMMENTS DOES NOT WORK IF READING TRANSLATED VERSIONS.
You can now follow comment additions with the comment RSS feed. This is distinct from the b.log RSS feed, so you can subscribe to one or both as you wish.
This web page is licenced for your personal, private, non-commercial use only. No automated processing by advertising systems is permitted.
RIPA notice: No consent is given for interception of page transmission.