///////////////////////////////////////////////////////////////////////////// // This hook is called after startup to initialize the application ///////////////////////////////////////////////////////////////////////////// void APP_Init(void) { // initialize all LEDs MIOS32_BOARD_LED_Init(0xffffffff); // turn off gate LED MIOS32_BOARD_LED_Set(1, 0); // create semaphores xSDCardSemaphore = xSemaphoreCreateRecursiveMutex(); // initialize file functions FILE_Init(0); // initialize MIDI handler SEQ_MIDI_OUT_Init(0); // initialize sequencer SEQ_Init(0); // install MIDI Rx callback function MIOS32_MIDI_DirectRxCallback_Init(NOTIFY_MIDI_Rx); // install sequencer task xTaskCreate(TASK_SEQ, (signed portCHAR *)"SEQ", configMINIMAL_STACK_SIZE, NULL, PRIORITY_TASK_SEQ, NULL); }
/** NOTE: both IP address and port are in host byte order */ STATIC File * SocketOpen2(IPaddr addr, Port port) { Socket sock = INVALID_SOCKET; if (SOCKET_GetTcp(0,&sock)) { if (SOCKET_Connect(sock, addr, port)) { SocketFile * s = MEM_New(SocketFile); if (s) { Bool ok; StrBuf32 nameBuf; STRBUF_InitBufXXX(&nameBuf); STRBUF_Format(&nameBuf.sb, TEXT(IPADDR_FORMAT)TEXT_(":%hu"), HOST_IPADDR_FORMAT_ARG(addr),port); memset(s, 0, sizeof(*s)); ok = FILE_Init(&s->file, nameBuf.sb.s, False, &SocketIO); STRBUF_Destroy(&nameBuf.sb); if (ok) { s->sock = sock; s->eof = False; return &s->file; } } shutdown(sock, SHUT_RDWR); } closesocket(sock); } return NULL; }
///////////////////////////////////////////////////////////////////////////// // Initialisation ///////////////////////////////////////////////////////////////////////////// s32 SYNTH_FILE_Init(u32 mode) { s32 status = 0; strcpy(sd_card_msg, "SD Card?"); // 12 chars maximum status |= FILE_Init(0); status |= SYNTH_FILE_B_Init(0); return status; }
///////////////////////////////////////////////////////////////////////////// //! Initialisation ///////////////////////////////////////////////////////////////////////////// s32 MBNG_FILE_Init(u32 mode) { s32 status = 0; strcpy(sd_card_msg, "SD Card?"); // 12 chars maximum status |= FILE_Init(0); status |= MBNG_FILE_C_Init(0); status |= MBNG_FILE_L_Init(0); status |= MBNG_FILE_S_Init(0); status |= MBNG_FILE_R_Init(0); return status; }
/** * This is an exported function that associates a "socket file" with an * open socket. If this call fails, the caller is responsible for closing * the socket. If this cal succeeds, then the socket will be closed by * FILE_Close() */ File * FILE_AttachToSocket(Socket sock) { SocketFile * sf = MEM_New(SocketFile); if (sf) { memset(sf, 0, sizeof(*sf)); sf->sock = sock; sf->eof = False; if (FILE_Init(&sf->file, TEXT("socket"), True, &SocketIO)) { return &sf->file; } MEM_Free(sf); } return NULL; }
int Init_CD_Driver(void) { #ifdef DEBUG_CD debug_SCD_file = fopen("SCD.log", "w"); #endif // ASPI support ASPI_Init(); // if (ASPI_Init() == 0) // { // MessageBox(NULL, "No CD Drive or ASPI not correctly initialised\nTry to upgrade your ASPI drivers", "Warning", MB_ICONWARNING); // } // FILE ISO support FILE_Init(); return 0; }
/** * Creates a new Zip IO context. * Compresses output data and decompresses input data. */ File * FILE_Zip(File * f, int flags) { ASSERT(f); ASSERT(!(flags & (~0x000f))); if (f) { Zip * zf = MEM_New(Zip); if (zf) { memset(zf, 0, sizeof(*zf)); if (FILE_Init(&zf->file, TEXT("zip"), True, &ZipIO)) { zf->f = f; zf->bufsize = Z_BUFSIZE; if (flags & FILE_ZIP_IN) zf->zflags |= ZIP_IN; if (flags & FILE_ZIP_OUT) zf->zflags |= ZIP_OUT; if (flags & FILE_ZIP_ZHDR) zf->zflags |= ZIP_ZHDR; if (flags & FILE_ZIP_GZIP) zf->zflags |= ZIP_GZIP; return &zf->file; } MEM_Free(zf); } } return NULL; }