Skip to content

Commit bb6c335

Browse files
committed
Format all source files
1 parent 320b8be commit bb6c335

40 files changed

+1269
-2012
lines changed

src/applemidi.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
#include "comm_megawifi.h"
66
#include "settings.h"
77

8-
static enum mw_err unpackInvitation(
9-
char* buffer, u16 length, AppleMidiExchangePacket* invite);
8+
static enum mw_err unpackInvitation(char* buffer, u16 length, AppleMidiExchangePacket* invite);
109
static void sendInviteResponse(u8 ch, AppleMidiExchangePacket* invite);
1110

1211
static enum mw_err processInvitation(u8 ch, char* buffer, u16 length)
@@ -24,8 +23,7 @@ static enum mw_err processInvitation(u8 ch, char* buffer, u16 length)
2423
return MW_ERR_NONE;
2524
}
2625

27-
static enum mw_err unpackInvitation(
28-
char* buffer, u16 length, AppleMidiExchangePacket* invite)
26+
static enum mw_err unpackInvitation(char* buffer, u16 length, AppleMidiExchangePacket* invite)
2927
{
3028
if (length < APPLE_MIDI_EXCH_PKT_MIN_LEN) {
3129
return ERR_APPLE_MIDI_EXCH_PKT_TOO_SMALL;
@@ -84,8 +82,7 @@ static enum mw_err unpackTimestampSync(
8482
return MW_ERR_NONE;
8583
}
8684

87-
static void packTimestampSync(
88-
AppleMidiTimeSyncPacket* timeSyncPacket, char* buffer, u16* length)
85+
static void packTimestampSync(AppleMidiTimeSyncPacket* timeSyncPacket, char* buffer, u16* length)
8986
{
9087
*length = 0;
9188
while (*length < TIMESYNC_PKT_LEN) {
@@ -185,12 +182,10 @@ u16 applemidi_lastSequenceNumber(void)
185182

186183
enum mw_err applemidi_sendReceiverFeedback(void)
187184
{
188-
char receiverFeedbackPacket[RECEIVER_FEEDBACK_PACKET_LENGTH]
189-
= { 0xFF, 0xFF, 'R', 'S', (u8)(MEGADRIVE_SSRC >> 24),
190-
(u8)(MEGADRIVE_SSRC >> 16), (u8)(MEGADRIVE_SSRC >> 8),
191-
(u8)MEGADRIVE_SSRC, (u8)(lastSeqNum >> 8), (u8)lastSeqNum, 0, 0 };
185+
char receiverFeedbackPacket[RECEIVER_FEEDBACK_PACKET_LENGTH] = { 0xFF, 0xFF, 'R', 'S',
186+
(u8)(MEGADRIVE_SSRC >> 24), (u8)(MEGADRIVE_SSRC >> 16), (u8)(MEGADRIVE_SSRC >> 8),
187+
(u8)MEGADRIVE_SSRC, (u8)(lastSeqNum >> 8), (u8)lastSeqNum, 0, 0 };
192188

193-
comm_megawifi_send(CH_CONTROL_PORT, receiverFeedbackPacket,
194-
RECEIVER_FEEDBACK_PACKET_LENGTH);
189+
comm_megawifi_send(CH_CONTROL_PORT, receiverFeedbackPacket, RECEIVER_FEEDBACK_PACKET_LENGTH);
195190
return MW_ERR_NONE;
196191
}

src/applemidi.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424

2525
#define APPLE_MIDI_SIGNATURE 0xFFFF
2626

27-
#define PACK_BIG_ENDIAN \
28-
__attribute__((packed, scalar_storage_order("big-endian")))
27+
#define PACK_BIG_ENDIAN __attribute__((packed, scalar_storage_order("big-endian")))
2928

3029
union PACK_BIG_ENDIAN AppleMidiTimeSyncPacket {
3130
u8 byte[TIMESYNC_PKT_LEN];

src/boot/rom_head.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ __attribute__((externally_visible)) const ROMHeader rom_header = {
77
"SEGA SSF ",
88
#endif
99
"(C)ROB H. 2024 ", "MEGA DRIVE MIDI INTERFACE ",
10-
"MEGA DRIVE MIDI INTERFACE ", "GM 00000000-00", 0x000,
11-
"JD ", 0x00000000,
10+
"MEGA DRIVE MIDI INTERFACE ", "GM 00000000-00", 0x000, "JD ",
11+
0x00000000,
1212
#if (ENABLE_BANK_SWITCH != 0)
1313
0x003FFFFF,
1414
#else
1515
0x000FFFFF,
1616
#endif
17-
0xE0FF0000, 0xE0FFFFFF, "RA", 0xF820, 0x00200000, 0x0020FFFF,
18-
" ", " ",
19-
"JUE "
17+
0xE0FF0000, 0xE0FFFFFF, "RA", 0xF820, 0x00200000, 0x0020FFFF, " ",
18+
" ", "JUE "
2019
};

src/comm.c

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,21 @@ struct CommVTable {
2828
void (*write)(u8 data);
2929
};
3030

31-
static const CommVTable Demo_VTable = { comm_demo_init, comm_demo_read_ready,
32-
comm_demo_read, comm_demo_write_ready, comm_demo_write };
31+
static const CommVTable Demo_VTable = { comm_demo_init, comm_demo_read_ready, comm_demo_read,
32+
comm_demo_write_ready, comm_demo_write };
3333

34-
static const CommVTable Everdrive_VTable
35-
= { comm_everdrive_init, comm_everdrive_read_ready, comm_everdrive_read,
36-
comm_everdrive_write_ready, comm_everdrive_write };
34+
static const CommVTable Everdrive_VTable = { comm_everdrive_init, comm_everdrive_read_ready,
35+
comm_everdrive_read, comm_everdrive_write_ready, comm_everdrive_write };
3736

38-
static const CommVTable EverdrivePro_VTable = { comm_everdrive_pro_init,
39-
comm_everdrive_pro_read_ready, comm_everdrive_pro_read,
40-
comm_everdrive_pro_write_ready, comm_everdrive_pro_write };
37+
static const CommVTable EverdrivePro_VTable
38+
= { comm_everdrive_pro_init, comm_everdrive_pro_read_ready, comm_everdrive_pro_read,
39+
comm_everdrive_pro_write_ready, comm_everdrive_pro_write };
4140

42-
static const CommVTable Serial_VTable
43-
= { comm_serial_init, comm_serial_read_ready, comm_serial_read,
44-
comm_serial_write_ready, comm_serial_write };
41+
static const CommVTable Serial_VTable = { comm_serial_init, comm_serial_read_ready,
42+
comm_serial_read, comm_serial_write_ready, comm_serial_write };
4543

46-
static const CommVTable Megawifi_VTable
47-
= { comm_megawifi_init, comm_megawifi_read_ready, comm_megawifi_read,
48-
comm_megawifi_write_ready, comm_megawifi_write };
44+
static const CommVTable Megawifi_VTable = { comm_megawifi_init, comm_megawifi_read_ready,
45+
comm_megawifi_read, comm_megawifi_write_ready, comm_megawifi_write };
4946

5047
static const CommVTable* commTypes[] = {
5148
#if COMM_EVERDRIVE_X7 == 1

src/comm_everdrive_pro.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
#define CMD_USB_WR 0x22
66

77
#define REG_FIFO_DATA *((vu16*)0xA130D0) // fifo data register
8-
#define REG_FIFO_STAT \
9-
*((vu16*)0xA130D2) // fifo status register. shows if fifo can be readed.
8+
#define REG_FIFO_STAT *((vu16*)0xA130D2) // fifo status register. shows if fifo can be readed.
109
#define REG_SYS_STAT *((vu16*)0xA130D4)
1110

1211
#define FIFO_CPU_RXF 0x8000 // fifo flags. system cpu can read

src/comm_megawifi.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ static bool awaitingSend = false;
3535

3636
static MegaWifiStatus status;
3737

38-
static void recv_complete_cb(
39-
enum lsd_status stat, uint8_t ch, char* data, uint16_t len, void* ctx);
38+
static void recv_complete_cb(enum lsd_status stat, uint8_t ch, char* data, uint16_t len, void* ctx);
4039

4140
static enum mw_err associateAp(void)
4241
{
@@ -206,8 +205,7 @@ static void restoreRemoteEndpoint(u8 ch, u32* ip, u16* port)
206205
*port = (ch == CH_CONTROL_PORT) ? remoteControlPort : remoteMidiPort;
207206
}
208207

209-
static void recv_complete_cb(
210-
enum lsd_status stat, uint8_t ch, char* data, uint16_t len, void* ctx)
208+
static void recv_complete_cb(enum lsd_status stat, uint8_t ch, char* data, uint16_t len, void* ctx)
211209
{
212210
(void)ctx;
213211

@@ -261,8 +259,7 @@ void comm_megawifi_tick(void)
261259

262260
awaitingRecv = true;
263261
struct mw_reuse_payload* pkt = (struct mw_reuse_payload* const)recvBuffer;
264-
enum lsd_status stat
265-
= mw_udp_reuse_recv(pkt, MW_BUFLEN, NULL, recv_complete_cb);
262+
enum lsd_status stat = mw_udp_reuse_recv(pkt, MW_BUFLEN, NULL, recv_complete_cb);
266263
if (stat < 0) {
267264
log_warn("MW: mw_udp_reuse_recv() = %d", stat);
268265
awaitingRecv = false;
@@ -304,8 +301,8 @@ void comm_megawifi_send(u8 ch, char* data, u16 len)
304301
#endif
305302

306303
awaitingSend = true;
307-
enum lsd_status stat = mw_udp_reuse_send(
308-
ch, udp, len + REUSE_PAYLOAD_HEADER_LEN, NULL, send_complete_cb);
304+
enum lsd_status stat
305+
= mw_udp_reuse_send(ch, udp, len + REUSE_PAYLOAD_HEADER_LEN, NULL, send_complete_cb);
309306
if (stat < 0) {
310307
log_warn("MW: mw_udp_reuse_send() = %d", stat);
311308
awaitingSend = false;

src/envelopes.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
#include "envelopes.h"
22
#include <types.h>
33

4-
static const u8 ENV_SQUARE_LEAD[]
5-
= { 0x00, EEF_LOOP_START, 0x00, EEF_LOOP_END, 0x01, 0x02, 0x03, 0x04, 0x05,
6-
0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, EEF_END };
4+
static const u8 ENV_SQUARE_LEAD[] = { 0x00, EEF_LOOP_START, 0x00, EEF_LOOP_END, 0x01, 0x02, 0x03,
5+
0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, EEF_END };
76

8-
static const u8 ENVELOPE_0[] = { 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
9-
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
10-
0x01, 0x01, 0x01, EEF_LOOP_START, 0x01, 0x01, 0x11, 0x11, 0x01, 0x01, 0x81,
11-
0x81, EEF_LOOP_END, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
12-
0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, EEF_END };
7+
static const u8 ENVELOPE_0[] = { 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
8+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, EEF_LOOP_START, 0x01,
9+
0x01, 0x11, 0x11, 0x01, 0x01, 0x81, 0x81, EEF_LOOP_END, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
10+
0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, EEF_END };
1311

1412
const u8* ENVELOPES[MIDI_PROGRAMS] = { ENVELOPE_0, ENVELOPE_0, ENVELOPE_0,
1513
/* 3 */ ENVELOPE_0, ENVELOPE_0, ENVELOPE_0, ENVELOPE_0, ENVELOPE_0,

src/ip_util.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ static const char* str_to_uint8(const char* str, uint8_t* result)
2121
// lower than 256
2222
case 3:
2323
if ((str[0] > '2')
24-
|| ((str[0] == '2')
25-
&& ((str[1] > '5') || ((str[1] == '5') && (str[2] > '5')))))
24+
|| ((str[0] == '2') && ((str[1] > '5') || ((str[1] == '5') && (str[2] > '5')))))
2625
return NULL;
2726
else {
2827
*result = ((*str) - '0') * 100;

0 commit comments

Comments
 (0)