Changeset a9bd960c in mainline


Ignore:
Timestamp:
2006-06-02T17:46:21Z (18 years ago)
Author:
Josef Cejka <malyzelenyhnus@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e87e18f
Parents:
f1b4e74
Message:

Added doxygen comments.
Console now supports SET_STYLE call.

Location:
console
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • console/console.c

    rf1b4e74 ra9bd960c  
    299299                        sync_send_2(fb_info.phone, FB_FLUSH, 0, 0, NULL, NULL);         
    300300                        break;
     301                case CONSOLE_SET_STYLE:
     302                       
     303                        arg1 = IPC_GET_ARG1(call);
     304                        arg2 = IPC_GET_ARG2(call);
     305                        screenbuffer_set_style(&(connections[consnum]),arg1, arg2);
     306                        if (consnum == active_console)
     307                                nsend_call_2(fb_info.phone, FB_SET_STYLE, arg1, arg2);
     308                               
     309                        break;
    301310                case CONSOLE_GETCHAR:
    302311                        if (keybuffer_empty(&(connections[consnum].keybuffer))) {
  • console/console.h

    rf1b4e74 ra9bd960c  
    3232#define CONSOLE_COUNT 12
    3333
    34 #define CONSOLE_GETCHAR 1026
    35 #define CONSOLE_PUTCHAR 1027
    36 #define CONSOLE_CLEAR   1028
    37 #define CONSOLE_GOTO    1029
    38 #define CONSOLE_GETSIZE 1030
    39 #define CONSOLE_FLUSH   1031
     34#define CONSOLE_GETCHAR         1026
     35#define CONSOLE_PUTCHAR         1027
     36#define CONSOLE_CLEAR           1028
     37#define CONSOLE_GOTO            1029
     38#define CONSOLE_GETSIZE         1030
     39#define CONSOLE_FLUSH           1031
     40#define CONSOLE_SET_STYLE       1032
    4041
    4142#endif
  • console/screenbuffer.c

    rf1b4e74 ra9bd960c  
    3131#include <unistd.h>
    3232
    33 /** Get field from buffer that corresponds to character at position x,y at screen
    34  *
     33/** Store one character to screenbuffer. Its position is determined by scr->position_x and scr->position_y.
     34 * @param scr   screenbuffer
     35 * @param c     stored character
    3536 */
    36 
    37 int screenbuffer_putchar(screenbuffer_t *scr, char c)
     37void screenbuffer_putchar(screenbuffer_t *scr, char c)
    3838{
    3939        keyfield_t *field;
     
    4343        field->character = c;
    4444        field->style = scr->style;
    45        
    46         return 1;
    4745}
    4846
     47/** Initilize screenbuffer. Allocate space for screen content in accordance to given size.
     48 * @param scr           initialized screenbuffer
     49 * @param size_x       
     50 * @param size_y
     51 */
    4952screenbuffer_t *screenbuffer_init(screenbuffer_t *scr, int size_x, int size_y)
    5053{
     
    103106{
    104107        scr->position_x = x % scr->size_x;
    105         scr->position_y = y  % scr->size_y;
     108        scr->position_y = y % scr->size_y;
    106109}
    107110
     111void screenbuffer_set_style(screenbuffer_t *scr, unsigned int fg_color, unsigned int bg_color)
     112{
     113        scr->style.fg_color = fg_color;
     114        scr->style.bg_color = bg_color;
     115}
     116
  • console/screenbuffer.h

    rf1b4e74 ra9bd960c  
    3131
    3232
    33 #define DEFAULT_FOREGROUND_COLOR 0xffffff
    34 #define DEFAULT_BACKGROUND_COLOR 0x00003f
     33#define DEFAULT_FOREGROUND_COLOR 0xffffff       /**< default console foreground color */
     34#define DEFAULT_BACKGROUND_COLOR 0x00003f       /**< default console background color */
    3535
    3636typedef struct {
     
    3939} style_t;
    4040
    41 /** One field at screen. It contain one character and its attributes. */
     41/** One field on screen. It contain one character and its attributes. */
    4242typedef struct {
    4343        char character;                 /**< Character itself */
     
    5555} screenbuffer_t;
    5656
     57/** Returns keyfield for position on screen. Screenbuffer->buffer is cyclic buffer so we must couted in index of the topmost line.
     58 * @param scr   screenbuffer
     59 * @oaram x     position on screen
     60 * @param y     position on screen
     61 * @return      keyfield structure with character and its attributes on x,y
     62 */
    5763static inline keyfield_t *get_field_at(screenbuffer_t *scr, unsigned int x, unsigned int y)
    5864{
     
    6066}
    6167
     68/** Compares two styles.
     69 * @param s1 first style
     70 * @param s2 second style
     71 * @return nonzero on equality
     72 */
    6273static inline int style_same(style_t s1, style_t s2)
    6374{
     
    6677
    6778
    68 int screenbuffer_putchar(screenbuffer_t *scr, char c);
     79void screenbuffer_putchar(screenbuffer_t *scr, char c);
    6980screenbuffer_t *screenbuffer_init(screenbuffer_t *scr, int size_x, int size_y);
    7081
     
    7384void screenbuffer_copy_buffer(screenbuffer_t *scr, keyfield_t *dest);
    7485void screenbuffer_goto(screenbuffer_t *scr, unsigned int x, unsigned int y);
     86void screenbuffer_set_style(screenbuffer_t *scr, unsigned int fg_color, unsigned int bg_color);
    7587
    7688#endif
Note: See TracChangeset for help on using the changeset viewer.