int CBMAPIDECL cbm_get_debugging_buffer(CBM_FILE HandleDevice, char *buffer, size_t len) { FUNC_ENTER(); cbm_ioctl(HandleDevice, CBMCTRL(I_READDBG), NULL, 0, buffer, len); FUNC_LEAVE_INT(0); }
void CBMAPIDECL opencbm_plugin_unlock(CBM_FILE HandleDevice) { FUNC_ENTER(); cbm_ioctl(HandleDevice, CBMCTRL(PARPORT_UNLOCK), NULL, 0, NULL, 0); FUNC_LEAVE(); }
void cbmarch_unlock(CBM_FILE HandleDevice) { FUNC_ENTER(); cbm_ioctl(HandleDevice, CBMCTRL(PARPORT_UNLOCK), NULL, 0, NULL, 0); FUNC_LEAVE(); }
int cbmarch_get_eoi(CBM_FILE HandleDevice) { CBMT_GET_EOI_OUT result; FUNC_ENTER(); cbm_ioctl(HandleDevice, CBMCTRL(GET_EOI), NULL, 0, &result, sizeof(result)); FUNC_LEAVE_INT(result.Decision); }
int cbmarch_clear_eoi(CBM_FILE HandleDevice) { int returnValue; FUNC_ENTER(); returnValue = cbm_ioctl(HandleDevice, CBMCTRL(CLEAR_EOI), NULL, 0, NULL, 0); FUNC_LEAVE_INT(returnValue); }
int cbmarch_reset(CBM_FILE HandleDevice) { USHORT returnValue; FUNC_ENTER(); returnValue = cbm_ioctl(HandleDevice, CBMCTRL(RESET), NULL, 0, NULL, 0) ? 0 : 1; FUNC_LEAVE_INT(returnValue); }
unsigned char CBMAPIDECL opencbm_plugin_pp_read(CBM_FILE HandleDevice) { CBMT_PP_READ_OUT result; FUNC_ENTER(); cbm_ioctl(HandleDevice, CBMCTRL(PP_READ), NULL, 0, &result, sizeof(result)); FUNC_LEAVE_UCHAR(result.Byte); }
int cbmarch_iec_poll(CBM_FILE HandleDevice) { CBMT_IEC_POLL_OUT result; FUNC_ENTER(); cbm_ioctl(HandleDevice, CBMCTRL(IEC_POLL), NULL, 0, &result, sizeof(result)); FUNC_LEAVE_INT(result.Line); }
int CBMAPIDECL opencbm_plugin_clear_eoi(CBM_FILE HandleDevice) { int returnValue; FUNC_ENTER(); returnValue = cbm_ioctl(HandleDevice, CBMCTRL(CLEAR_EOI), NULL, 0, NULL, 0); FUNC_LEAVE_INT(returnValue); }
int CBMAPIDECL opencbm_plugin_untalk(CBM_FILE HandleDevice) { int returnValue; FUNC_ENTER(); returnValue = cbm_ioctl(HandleDevice, CBMCTRL(UNTALK), NULL, 0, NULL, 0) ? 0 : 1; FUNC_LEAVE_INT(returnValue); }
__u_char cbmarch_parallel_burst_read(CBM_FILE HandleDevice) { CBMT_PARBURST_PREAD_OUT result; FUNC_ENTER(); cbm_ioctl(HandleDevice, CBMCTRL(PARBURST_READ), NULL, 0, &result, sizeof(result)); FUNC_LEAVE_UCHAR(result.Byte); }
int cbmarch_untalk(CBM_FILE HandleDevice) { int returnValue; FUNC_ENTER(); returnValue = cbm_ioctl(HandleDevice, CBMCTRL(UNTALK), NULL, 0, NULL, 0) ? 0 : 1; FUNC_LEAVE_INT(returnValue); }
void CBMAPIDECL opencbm_plugin_iec_set(CBM_FILE HandleDevice, int Line) { CBMT_IEC_SET_IN parameter; FUNC_ENTER(); parameter.Line = (UCHAR) Line; cbm_ioctl(HandleDevice, CBMCTRL(IEC_SET), ¶meter, sizeof(parameter), NULL, 0); FUNC_LEAVE(); }
void CBMAPIDECL opencbm_plugin_pp_write(CBM_FILE HandleDevice, unsigned char Byte) { CBMT_PP_WRITE_IN parameter; FUNC_ENTER(); parameter.Byte = Byte; cbm_ioctl(HandleDevice, CBMCTRL(PP_WRITE), ¶meter, sizeof(parameter), NULL, 0); FUNC_LEAVE(); }
void cbmarch_parallel_burst_write(CBM_FILE HandleDevice, __u_char Value) { CBMT_PARBURST_PWRITE_IN parameter; FUNC_ENTER(); parameter.Byte = Value; cbm_ioctl(HandleDevice, CBMCTRL(PARBURST_WRITE), ¶meter, sizeof(parameter), NULL, 0); FUNC_LEAVE(); }
void cbmarch_pp_write(CBM_FILE HandleDevice, __u_char Byte) { CBMT_PP_WRITE_IN parameter; FUNC_ENTER(); parameter.Byte = Byte; cbm_ioctl(HandleDevice, CBMCTRL(PP_WRITE), ¶meter, sizeof(parameter), NULL, 0); FUNC_LEAVE(); }
void cbmarch_iec_release(CBM_FILE HandleDevice, int Line) { CBMT_IEC_RELEASE_IN parameter; FUNC_ENTER(); parameter.Line = (UCHAR) Line; cbm_ioctl(HandleDevice, CBMCTRL(IEC_RELEASE), ¶meter, sizeof(parameter), NULL, 0); FUNC_LEAVE(); }
/*! \brief Read a byte from the parallel port input register This function reads a byte from the parallel port input register. (STATUS_PORT). It is a helper function for debugging the cable (i.e., for the XCDETECT tool) only! \param HandleDevice A CBM_FILE which contains the file handle of the driver. \return If the routine succeeds, it returns a non-negative value which corresponds to the data in the parallel port input register (status port). If the routine fails, the return value is -1. \remark Do not use this function in anything but a debugging aid tool like XCDETECT! This functions masks some bits off. The bits that are not masked off are defined in PARALLEL_STATUS_PORT_MASK_VALUES. */ int CBMAPIDECL opencbm_plugin_iec_dbg_read(CBM_FILE HandleDevice) { CBMT_IEC_DBG_READ result; int returnValue = -1; FUNC_ENTER(); if ( cbm_ioctl(HandleDevice, CBMCTRL(IEC_DBG_READ), NULL, 0, &result, sizeof(result)) ) { returnValue = result.Value; } FUNC_LEAVE_INT(returnValue); }
void cbmarch_iec_setrelease(CBM_FILE HandleDevice, int Set, int Release) { CBMT_IEC_SETRELEASE_IN parameter; FUNC_ENTER(); parameter.State = (UCHAR) Set; parameter.Line = (UCHAR) Release; cbm_ioctl(HandleDevice, CBMCTRL(IEC_SETRELEASE), ¶meter, sizeof(parameter), NULL, 0); FUNC_LEAVE(); }
VOID CbmInstallUpdate(VOID) { CBM_FILE HandleDevice; FUNC_ENTER(); if (cbmarch_driver_open(&HandleDevice, 0) == 0) { cbm_ioctl(HandleDevice, CBMCTRL(UPDATE), NULL, 0, NULL, 0); cbmarch_driver_close(HandleDevice); } FUNC_LEAVE(); }
int CBMAPIDECL opencbm_plugin_talk(CBM_FILE HandleDevice, unsigned char DeviceAddress, unsigned char SecondaryAddress) { CBMT_TALK_IN parameter; int returnValue; FUNC_ENTER(); parameter.PrimaryAddress = DeviceAddress; parameter.SecondaryAddress = SecondaryAddress; returnValue = cbm_ioctl(HandleDevice, CBMCTRL(TALK), ¶meter, sizeof(parameter), NULL, 0) ? 0 : 1; FUNC_LEAVE_INT(returnValue); }
int CBMAPIDECL opencbm_plugin_reset(CBM_FILE HandleDevice) { USHORT returnValue; FUNC_ENTER(); // // try to cancel any pending io operations. // WaitForIoCompletionCancelAll(); returnValue = cbm_ioctl(HandleDevice, CBMCTRL(RESET), NULL, 0, NULL, 0) ? 0 : 1; FUNC_LEAVE_INT(returnValue); }
/*! \brief Write a byte to the parallel port output register This function writes a byte to the parallel port output register. (CONTROL_PORT). It is a helper function for debugging the cable (i.e., for the XCDETECT tool) only! \param HandleDevice A CBM_FILE which contains the file handle of the driver. \param Value The value to set the control port to \return If the routine succeeds, it returns 0. If the routine fails, it returns -1. \remark Do not use this function in anything but a debugging aid tool like XCDETECT! After this function has been called, it is NOT safe to use the parallel port again unless you close the driver (cbm_driver_close()) and open it again (cbm_driver_open())! This functions masks some bits off. That is, the bits not in the mask are not changed at all. The bits that are not masked off are defined in PARALLEL_CONTROL_PORT_MASK_VALUES. */ int CBMAPIDECL opencbm_plugin_iec_dbg_write(CBM_FILE HandleDevice, unsigned char Value) { CBMT_IEC_DBG_WRITE parameter; int returnValue = -1; FUNC_ENTER(); parameter.Value = Value; if ( cbm_ioctl(HandleDevice, CBMCTRL(IEC_DBG_WRITE), ¶meter, sizeof(parameter), NULL, 0) ) { returnValue = 0; } FUNC_LEAVE_INT(returnValue); }
int cbmarch_talk(CBM_FILE HandleDevice, __u_char DeviceAddress, __u_char SecondaryAddress) { CBMT_TALK_IN parameter; int returnValue; FUNC_ENTER(); parameter.PrimaryAddress = DeviceAddress; parameter.SecondaryAddress = SecondaryAddress; returnValue = cbm_ioctl(HandleDevice, CBMCTRL(TALK), ¶meter, sizeof(parameter), NULL, 0) ? 0 : 1; FUNC_LEAVE_INT(returnValue); }
int CBMAPIDECL opencbm_plugin_iec_wait(CBM_FILE HandleDevice, int Line, int State) { CBMT_IEC_WAIT_IN parameter; CBMT_IEC_WAIT_OUT result; FUNC_ENTER(); parameter.Line = (UCHAR) Line; parameter.State = (UCHAR) State; cbm_ioctl(HandleDevice, CBMCTRL(IEC_WAIT), ¶meter, sizeof(parameter), &result, sizeof(result)); FUNC_LEAVE_INT(result.Line); }
int cbmarch_parallel_burst_write_track(CBM_FILE HandleDevice, __u_char *Buffer, unsigned int Length) { int retval = 0; FUNC_ENTER(); retval = cbm_ioctl(HandleDevice, CBMCTRL(PARBURST_WRITE_TRACK), Buffer, Length, NULL, 0); if (retval == 0) { DBG_WARN((DBG_PREFIX "opencbm: cbm.c: parallel_burst_write_track: ioctl returned with error %u", retval)); } FUNC_LEAVE_INT(retval); }
VOID CbmOutputDebuggingBuffer(VOID) { #define OUTPUT_BUFFER_LEN 0x20000 CHAR *buffer; CBM_FILE HandleDevice; FUNC_ENTER(); buffer = malloc(OUTPUT_BUFFER_LEN); if (buffer && cbmarch_driver_open(&HandleDevice, 0) == 0) { PCHAR p = buffer; PCHAR endLine; cbm_ioctl(HandleDevice, CBMCTRL(I_READDBG), NULL, 0, buffer, OUTPUT_BUFFER_LEN); cbmarch_driver_close(HandleDevice); printf("Output of the debugging buffer:\n\n"); do { endLine = strchr(p, 13); if (endLine) { *endLine = 0; } printf("%s", p); p = endLine + 1; } while (endLine); } if (buffer) { free(buffer); } FUNC_LEAVE(); }
int cbmarch_open(CBM_FILE HandleDevice, __u_char DeviceAddress, __u_char SecondaryAddress) { CBMT_OPEN_IN parameter; int returnValue; FUNC_ENTER(); parameter.PrimaryAddress = DeviceAddress; parameter.SecondaryAddress = SecondaryAddress; if (cbm_ioctl(HandleDevice, CBMCTRL(OPEN), ¶meter, sizeof(parameter), NULL, 0)) { returnValue = 0; } else { returnValue = -1; } FUNC_LEAVE_INT(returnValue); }