Commit 6d468668 authored by Ben Avison's avatar Ben Avison
Browse files

Cross-compilable

* Use ASM2TXT facility to simplify makefile
* Add missing .gitignore
* Enable GitLab CI, and deal with the warnings generated
parent 0a3dcdf2
Pipeline #3103 passed with stages
in 1 minute and 23 seconds
/aif/
/aof/
/gpa/
/h/ADFSHdr
/i/
/linked/
/Makefile.d
/o/
/objs/
/od/
/rm/
variables:
WHITESPACE_WHITELIST: "./doc/ADFS"
include:
- project: 'Support/CI'
file: '/ADFS4.yml'
......@@ -9,7 +9,8 @@ CMHGDEPENDS = command module
OBJS = ata base command discop drive globals message miscop module swi
LIBS = ${SYNCLIB}
ROMCDEFINES = -DROM_MODULE
CLEAN_DEPEND = extra_clean
ASM2TXT = ADFSErr hdr
#CFLAGS += -DDEBUG_ENABLED
......@@ -18,31 +19,4 @@ CLEAN_DEPEND = extra_clean
include CModule
expasmc.ADFSErr: hdr.ADFSErr
${HDR2H} hdr.ADFSErr ${C_EXP_HDR:.h=}.h.ADFSErr
expasm.ADFSErr: hdr.ADFSErr
${CP} hdr.ADFSErr ${EXP_HDR}.ADFSErr ${CPFLAGS}
hdr.ADFSErr: o.ADFSErr
${LD} -bin -o $@ o.ADFSErr
SetType $@ Text
ifeq (,${MAKE_VERSION})
# RISC OS / amu case
clean::
@IfThere hdr.ADFSErr Then ${ECHO} ${RM} hdr.ADFSErr
@IfThere hdr.ADFSErr Then ${RM} hdr.ADFSErr
else
# Posix / gmake case
clean::
${NOP}
endif
# Dynamic dependencies:
......@@ -28,6 +28,7 @@
*/
#include <string.h>
#include <inttypes.h>
#include "swis.h"
#include "Global/NewErrors.h"
......@@ -135,17 +136,17 @@ static low_level_error_t transfer_with_retries(uint32_t reason,
(dr->deviceid << ATAOp_DeviceIDShift) |
(dr->cpid << ATAOp_CPIDShift) |
(reason << ATAOp_TransShift);
dprintf("ATAOp: flags %08X, command %02X, ptr %p, len %u -> ",
dprintf("ATAOp: flags %08X, command %02X, ptr %p, len %zu -> ",
flags, p.command, ptr->block, *transfer_length);
e.oserror = ata_op_fg_data(flags, 11, &p, ptr->block, *transfer_length, OP_TIMEOUT, &not_transferred);
if (e.oserror && e.oserror->errnum == ErrorNumber_TooComplex)
{
/* Special case: hit capability limit in controller, so recalculate */
dprintf("TooComplex: limit = %u\n", not_transferred);
dprintf("TooComplex: limit = %zu\n", not_transferred);
*transfer_length = not_transferred;
break; /* No retries for this one */
}
dprintf("%s: not_transferred = %u\n", e.oserror ? e.oserror->errmess : "OK", not_transferred);
dprintf("%s: not_transferred = %zu\n", e.oserror ? e.oserror->errmess : "OK", not_transferred);
/* Advance buffer pointer or scatter list (as appropriate) according to
* however many bytes we successfully transferred */
......@@ -303,7 +304,7 @@ low_level_error_t discop(uint32_t reason,
if (*disc_address + *fg_length > dr->capacity || !IS_SECTOR_ALIGNED(*disc_address, dr->sector_size))
{
dprintf("Disc address range :%u/%016llX-%016llX, limit %016llX, %ssector aligned\n",
dprintf("Disc address range :%u/%016"PRIX64"-%016"PRIX64", limit %016"PRIX64", %ssector aligned\n",
drive, *disc_address, *disc_address + *fg_length, dr->capacity, IS_SECTOR_ALIGNED(*disc_address, dr->sector_size) ? "is " : "not ");
e.number = BadParmsErr;
goto exit;
......@@ -359,7 +360,7 @@ low_level_error_t discop(uint32_t reason,
uint64_t end_down = ROUND_DOWN_64(*disc_address + *fg_length, dr->log2_sector_size);
uint64_t end_up = ROUND_UP_64(*disc_address + *fg_length, dr->log2_sector_size);
uint32_t chunk_size = dr->lba48 ? 65536 << dr->log2_sector_size : 256 << dr->log2_sector_size;
dprintf("%016llX/%016llX/%016llX, chunk=%08X\n", *disc_address, end_down, end_up, chunk_size);
dprintf("%016"PRIX64"/%016"PRIX64"/%016"PRIX64", chunk=%08X\n", *disc_address, end_down, end_up, chunk_size);
block_or_scatter_t ptr_for_verify_ops;
if (reason == DiscOp_Verify)
{
......@@ -378,7 +379,7 @@ low_level_error_t discop(uint32_t reason,
* driver is unaware of the sector size, so may have suggested an
* invalid transfer length).
*/
remain = remain & ~((1<<dr->log2_sector_size)-1);
remain = remain & ~((1<<dr->log2_sector_size)-1);
if (!remain)
{
/* Something's gone wrong, give up now */
......
......@@ -79,9 +79,11 @@ const char *message_lookup_buffer(const char *token, char *buffer, size_t buflen
return e->errmess;
}
#if 0
_kernel_oserror *message_copy(const _kernel_oserror *error)
{
m_ErrorBuf.errnum = error->errnum;
strcpy(m_ErrorBuf.errmess, error->errmess);
return &m_ErrorBuf;
}
#endif
......@@ -43,7 +43,7 @@ low_level_error_t miscop_mount(uint32_t drive, uint32_t byte_address, uint8_t *
uint64_t disc_address = (uint64_t) byte_address & LegacyDiscAddress_ByteOffset_Mask;
IGNORE(disc_record);
dprintf("Mount - from :%u/%08X to %p, length %u, disc record %p\n",
dprintf("Mount - from :%u/%08X to %p, length %zu, disc record %p\n",
drive, byte_address, buffer, length, (void *) disc_record);
e = discop(DiscOp_ReadSecs, ATAOp_DisableEscape, drive, &disc_address, (block_or_scatter_t *) &buffer, &length);
......
......@@ -59,6 +59,7 @@
* ResourceFS resource file data block */
extern void *Resources(void);
// cppcheck-suppress unusedFunction
_kernel_oserror *module_initialise(const char *cmd_tail, int podule_base, void *pw)
{
_kernel_oserror *e;
......@@ -206,6 +207,7 @@ failed_init:
return e;
}
// cppcheck-suppress unusedFunction
_kernel_oserror *module_finalise(int fatal, int podule, void *pw)
{
IGNORE(fatal);
......@@ -226,6 +228,7 @@ _kernel_oserror *module_finalise(int fatal, int podule, void *pw)
return 0;
}
// cppcheck-suppress unusedFunction
_kernel_oserror *module_command(const char *arg_string, int argc, int cmd_no, void *pw)
{
IGNORE(pw);
......@@ -308,6 +311,7 @@ _kernel_oserror *module_command(const char *arg_string, int argc, int cmd_no, vo
return NULL;
}
// cppcheck-suppress unusedFunction
_kernel_oserror *module_swi(int swi_offset, _kernel_swi_regs *r, void *pw)
{
IGNORE(r);
......@@ -390,11 +394,12 @@ _kernel_oserror *module_swi(int swi_offset, _kernel_swi_regs *r, void *pw)
return NULL;
}
// cppcheck-suppress unusedFunction
_kernel_oserror *module_miscop_handler(_kernel_swi_regs *r, void *pw)
{
IGNORE(pw);
dprintf("MiscOp %u\n", r->r[0]);
dprintf("MiscOp %u\n", (unsigned) r->r[0]);
switch (r->r[0])
{
......@@ -431,6 +436,7 @@ _kernel_oserror *module_miscop_handler(_kernel_swi_regs *r, void *pw)
}
}
// cppcheck-suppress unusedFunction
_kernel_oserror *module_discop_handler(_kernel_swi_regs *r, void *pw)
{
_kernel_oserror *e;
......@@ -442,12 +448,12 @@ _kernel_oserror *module_discop_handler(_kernel_swi_regs *r, void *pw)
IGNORE(pw);
dprintf("DiscOp %u, flags %03X, disc address %u/%08X, buffer %08X, length %u\n",
r->r[1] & DiscOp_Op_Mask,
(unsigned) r->r[1] & DiscOp_Op_Mask,
r->r[1] &~ DiscOp_Op_Mask,
drive,
r->r[2] & LegacyDiscAddress_SectorOffset_Mask,
r->r[3],
r->r[4]);
(unsigned) r->r[4]);
reason = r->r[1] & DiscOp_Op_Mask;
switch (reason)
......
......@@ -240,9 +240,9 @@ _kernel_oserror *swi_ide_user_op(uint32_t flags, uint8_t *param, uint8_t *buffer
else
{
/* Issue a command */
uint8_t *device_param = param + (flags & ADFSIDEUserOp_LBA48 ? 9 : 5);
uint8_t *device_param = param + ((flags & ADFSIDEUserOp_LBA48) ? 9 : 5);
bool slave = *device_param & DEVICE_DEV;
uint32_t plength = flags & ADFSIDEUserOp_LBA48 ? 11 : 7;
uint32_t plength = (flags & ADFSIDEUserOp_LBA48) ? 11 : 7;
e = validate_address(param, plength, true, true);
if (!e && (flags & (ADFSIDEUserOp_TransRead | ADFSIDEUserOp_TransWrite)) != 0)
e = validate_address(buffer, length, flags & ADFSIDEUserOp_TransWrite, flags & ADFSIDEUserOp_TransRead);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment