CAPS Universe documentation
1.0.4
All you need to know to be successful
|
Create printer's wire data for SPL2 monochrome laser printers. More...
Data Structures | |
struct | band_info |
Information about one band to be able to process it in parallel. More... | |
struct | worker_info |
Band processing is done in multiple threads. More... | |
Macros | |
#define | LINES_IN_ONE_BAND 128 |
Functions | |
static int | drv_spl2_page_header_write (struct spl2_drv *info, struct caps_drv *drvi, FILE *outstream) |
static int | drv_spl2_write_band_header (unsigned band_no, unsigned dots, size_t data_size, FILE *outstream) |
static int | drv_spl2_page_footer_write (unsigned copies, FILE *outstream) |
static void | drv_spl2_band_exit (struct spl2_band_buffer *band) |
static void | drv_spl2_line_create (size_t dcnt, uint8_t dst[dcnt], size_t scnt, const uint8_t src[scnt], size_t skip) |
static void | drv_spl2_cb_fill (struct band_info *bi, struct caps_drv *drvi, unsigned band_no) |
static struct worker_info * | to_worker_info (void *d) |
static struct band_info * | to_band_info (struct worker_info *wi, unsigned no) |
static void | drv_spl2_buffer_prepare (struct band_info *bi) |
static int | spl2_drv_cb_band_process (void *anonymous_data, unsigned band_no) |
static int | spl2_drv_cb_band_is_ready (void *anonymous_data, unsigned band_no) |
static int | spl2_drv_cb_send (void *anonymous_data, unsigned band_no) |
static struct band_info * | drv_spl2_page_bis_create (size_t cnt, unsigned hw, unsigned dots_per_line, unsigned skip) |
static void | drv_spl2_page_bis_destroy (size_t cnt, struct band_info band_list[cnt]) |
int | ml1640_driver_page_print (struct caps_drv *drvi, void *d) |
Variables | |
static const struct caps_worker_idx | worker |
This covers the following list of monochrome laser printers:
#define LINES_IN_ONE_BAND 128 |
printer accepts data in 'bands', each contains 128 lines of data
|
static |
Write a "page header", a data structure leading page data
[in] | info | |
[in] | raster | Info about the raster for this page |
[in] | outstream | Stream IO to the printer |
0 | On success |
negative | Error codes from fwrite() |
Try to handle the copy feature of this printer. Is it relevant? Is it true, the printer's firmware supports it?
The members .pwidth and .plength carries always the real medium size in dots of the page, but always at 300 DPI (in the original Samsung driver).
|
static |
Write a "band header", a data structure leading one band of data
[in] | band_no | Number of this band |
[in] | dots | Dot count in a line |
[in] | data_size | Size in bytes of the following compressed band data |
[in] | outstream | Where to send the data to |
|
static |
Write a "page footer", a data structure trailing a full page's data
[in] | copies | Copy count of this page (max. USHRT_MAX) |
[in] | outstream | Where to send the data to |
0 | On success |
negative | Error codes from fwrite() |
-EBADF | The printer device seems gone offline |
|
static |
Free resources for band processing
[out] | band | Structure to free |
|
static |
Create a line of dots matching the printer's head requirements
[in] | dcnt | Buffer size in bytes for the print head data in dst |
[out] | dst | Buffer for the print head data |
[in] | scnt | Buffer size in bytes for the source line in src |
[in] | src | Buffer with the source line data |
[in] | skip | Bytes to skip in src |
dcnt
should be the amout of bytes the driver expects for one line of dots (620 byte at 600 DPI for example)
|
static |
Fill the band info's band with LINES_IN_ONE_BAND from the raster image
[out] | bi | The band info to fill (its band's input buffer) |
[in] | drvi | Full job description |
[in] | band_no | Number of the band to fill |
This routine ensures there are always LINES_IN_ONE_BAND in the input buffer. If the raster image has less lines than required to fill a full band, the missing lines are padded with empty data (e.g. white dots, not printed).
Consider the non-printable offset at the left medium edge (depending on the format, line size and resolution!)
Consider the max. line length (depending on the resolution)
|
static |
|
static |
|
static |
Allocate the required memory to fill and rotate one band's data
[in,out] | bi | Band info to work on |
Only the input buffer and the rotation buffer are allocated here, as they are always required. The compression buffer is optional for empty bands.
bi
must be already prepared by a call to drv_spl2_page_bis_create()
|
static |
Do all required steps to process one band
[in,out] | anonymous_data | Our worker info |
[in] | band_no | The band to process in this step |
0 | On success (here: always) |
Callback from a worker thread
Memory optimized band processing. Memory is only allocated on demand and freed again as early as possible (valid only for the input and rotation buffer).
|
static |
Check if a band is processed already
[in,out] | anonymous_data | Our worker info |
[in] | band_no | The band to process in this step |
0 | This band isn't processed yet |
1 | Band is already processed |
Callback from a worker thread. It is called everytime one of the worker threads signal a band as processed. If the band is already processed, this worker thread will call spl2_drv_cb_send() in the next step.
|
static |
Send the data of one band to the printer
[in,out] | anonymous_data | Our worker info |
[in] | band_no | The band to process in this step |
Callback from a worker thread
|
static |
Create the band info structures for the whole page
[in] | cnt | Band count on this page (rounded up) |
[in] | hw | Print head width in monochrome dots |
[in] | dots_per_line | Monochrome raster dots in one source line (from the CAPS framework) |
[in] | skip | Skip monochrome dots from the left of each source line |
Creates an array of band_info structures in order to process them in parallel. A minimal set of variables are initialized, everything else happens in the threads later on (memory allocation aso.).
|
static |
Counterpart to drv_spl2_page_bis_create()
int ml1640_driver_page_print | ( | struct caps_drv * | drvi, |
void * | d | ||
) |
Convert one raw page and print it.
[in] | drvi | Full job description |
[in] | d | The info structure |
0 | On success |
negative | Errno else |
-EBADF | The device seems gone offline |
The image to process is expected as a monochrome bitmap, 8 pixel in one byte.
|
static |