TI-RTOS Drivers  tidrivers_cc13xx_cc26xx_2_20_00_08
Display.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
155 #ifndef ti_mw_display__include
156 #define ti_mw_display__include
157 
158 #ifdef __cplusplus
159 extern "C" {
160 #endif
161 
162 #include <stdint.h>
163 
164 /* -----------------------------------------------------------------------------
165  * Constants
166  * ------------------------------------------------------------------------------
167  */
176 #define Display_Type_ANY 0xFFFFFFFF
177 #define Display_Type_LCD 0x80000000
178 #define Display_Type_UART 0x40000000
179 #define Display_Type_LOG 0x20000000
180 #define Display_Type_ITM 0x10000000
181 #define Display_Type_GRLIB 0x00100000
185 #define Display_MAXINDEX 15
186 
204 #define DISPLAY_CMD_RESERVED 32
205 
218 #define DISPLAY_STATUS_RESERVED -32
219 
233 #define DISPLAY_STATUS_SUCCESS 0
234 
241 #define DISPLAY_STATUS_ERROR -1
242 
250 #define DISPLAY_STATUS_UNDEFINEDCMD -2
251 
271 #define DISPLAY_CMD_TRANSPORT_CLOSE 0
272 
281 #define DISPLAY_CMD_TRANSPORT_OPEN 1
282 
286 /* -----------------------------------------------------------------------------
287  * Macros
288  * ------------------------------------------------------------------------------
289  */
290 #define Display_clearLine(handle, n) Display_clearLines(handle, n, 0)
291 #define Display_isIndex(i) (i <= Display_MAXINDEX)
292 #define Display_isMetaType(i) (i > Display_MAXINDEX)
293 
294 #if !defined(Display_DISABLE_ALL) || (!Display_DISABLE_ALL)
295 
296 # define Display_open(id, params) \
297  Display_doOpen(id, params)
298 
300 # define Display_Params_init(params) \
301  Display_doParamsInit(params)
302 
304 # define Display_clear(handle) \
305  Display_doClear(handle)
306 
308 # define Display_clearLines(handle, fromLine, toLine) \
309  Display_doClearLines(handle, fromLine, toLine)
310 
312 # define Display_print0(handle, line, col, fmt) \
313  Display_print5(handle, line, col, (uintptr_t)(fmt), 0, 0, 0, 0, 0)
314 
316 # define Display_print1(handle, line, col, fmt, a0) \
317  Display_print5(handle, line, col, (uintptr_t)(fmt), (uintptr_t)(a0), 0, 0, 0, 0)
318 
320 # define Display_print2(handle, line, col, fmt, a0, a1) \
321  Display_print5(handle, line, col, (uintptr_t)(fmt), (uintptr_t)(a0), (uintptr_t)(a1), 0, 0, 0)
322 
324 # define Display_print3(handle, line, col, fmt, a0, a1, a2) \
325  Display_print5(handle, line, col, (uintptr_t)(fmt), (uintptr_t)(a0), (uintptr_t)(a1), (uintptr_t)(a2), 0, 0)
326 
328 # define Display_print4(handle, line, col, fmt, a0, a1, a2, a3) \
329  Display_print5(handle, line, col, (uintptr_t)(fmt), (uintptr_t)(a0), (uintptr_t)(a1), (uintptr_t)(a2), (uintptr_t)(a3), 0)
330 
332 # define Display_print5(handle, line, col, fmt, a0, a1, a2, a3, a4) \
333  Display_doPut5(handle, line, col, (uintptr_t)(fmt), (uintptr_t)(a0), (uintptr_t)(a1), (uintptr_t)(a2), (uintptr_t)(a3), (uintptr_t)(a4))
334 
336 # define Display_control(handle, cmd, arg) \
337  Display_doControl(handle, cmd, arg)
338 
340 # define Display_close(handle) \
341  Display_doClose(handle)
342 #else
343 # define Display_open(id, params) NULL
344 # define Display_Params_init(params)
345 # define Display_clear(handle)
346 # define Display_clearLines(handle, fromLine, toLine)
347 # define Display_print0(handle, line, col, fmt)
348 # define Display_print1(handle, line, col, fmt, a0)
349 # define Display_print2(handle, line, col, fmt, a0, a1)
350 # define Display_print3(handle, line, col, fmt, a0, a1, a2)
351 # define Display_print4(handle, line, col, fmt, a0, a1, a2, a3)
352 # define Display_print5(handle, line, col, fmt, a0, a1, a2, a3, a4)
353 # define Display_control(handle, cmd, arg) NULL
354 # define Display_close(handle)
355 #endif
356 
357 /* -----------------------------------------------------------------------------
358  * Typedefs
359  * ------------------------------------------------------------------------------
360  */
365 
366 
371 {
377 
386 typedef struct Display_Params
387 {
388  Display_LineClearMode lineClearMode; /* Default clear entire line */
390 
395 typedef Display_Handle (*Display_openFxn)(Display_Handle handle,
396  Display_Params *params);
401 typedef void (*Display_clearFxn)(Display_Handle handle);
402 
407 typedef void (*Display_clearLinesFxn)(Display_Handle handle,
408  uint8_t fromLine,
409  uint8_t toLine);
410 
415 typedef void (*Display_put5Fxn)(Display_Handle handle,
416  uint8_t line,
417  uint8_t column,
418  uintptr_t fmt,
419  uintptr_t a0, uintptr_t a1,
420  uintptr_t a2, uintptr_t a3,
421  uintptr_t a4);
422 
428 
433 typedef int (*Display_controlFxn)(Display_Handle handle,
434  unsigned int cmd,
435  void *arg);
440 typedef unsigned int (*Display_getTypeFxn)(void);
441 
447 typedef struct Display_FxnTable
448 {
457 
469 typedef struct Display_Config
470 {
473 
475  void *object;
476 
478  void const *hwAttrs;
480 
481 
482 /* -----------------------------------------------------------------------------
483  * Functions
484  * ------------------------------------------------------------------------------
485  */
510 Display_Handle Display_doOpen(uint32_t id, Display_Params *params);
511 
520 
528 void Display_doClear(Display_Handle handle);
529 
539 void Display_doClearLines(Display_Handle handle, uint8_t fromLine, uint8_t toLine);
540 
556 void Display_doPut5(Display_Handle handle, uint8_t line, uint8_t column, uintptr_t fmt,
557  uintptr_t a0, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4);
558 
564 void Display_doClose(Display_Handle handle);
565 
601 void Display_doControl(Display_Handle handle, unsigned int cmd, void *arg);
602 #ifdef __cplusplus
603 }
604 #endif
605 
606 #endif //ti_mw_display__include
void Display_doClose(Display_Handle handle)
Closes selected Display implementations.
struct Display_Config * Display_Handle
A handle for specific Display implementations.
Definition: Display.h:364
struct Display_Config Display_Config
Display Global configuration.
void(* Display_clearLinesFxn)(Display_Handle handle, uint8_t fromLine, uint8_t toLine)
A function pointer to a specific implementation of Display_clearLines().
Definition: Display.h:407
void Display_doParamsInit(Display_Params *params)
Initializes parameter structure with default parameters.
Display_put5Fxn put5Fxn
Definition: Display.h:452
void * object
Definition: Display.h:475
Display_Handle(* Display_openFxn)(Display_Handle handle, Display_Params *params)
A function pointer to a specific implementation of Display_open().
Definition: Display.h:395
unsigned int(* Display_getTypeFxn)(void)
A function pointer to a specific implementation of Display_getType().
Definition: Display.h:440
void Display_doClear(Display_Handle handle)
Calls the clear fxn of all opened Display implementations.
Display Parameters.
Definition: Display.h:386
void const * hwAttrs
Definition: Display.h:478
Definition: Display.h:372
void Display_doControl(Display_Handle handle, unsigned int cmd, void *arg)
Function performs implementation specific features on a given Display_Handle.
void(* Display_put5Fxn)(Display_Handle handle, uint8_t line, uint8_t column, uintptr_t fmt, uintptr_t a0, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4)
A function pointer to a specific implementation of Display_put5().
Definition: Display.h:415
Display_clearFxn clearFxn
Definition: Display.h:450
Display_controlFxn controlFxn
Definition: Display.h:454
void(* Display_clearFxn)(Display_Handle handle)
A function pointer to a specific implementation of Display_clear().
Definition: Display.h:401
Definition: Display.h:374
The definition of a Display function table that contains the required set of functions to control a s...
Definition: Display.h:447
void Display_doPut5(Display_Handle handle, uint8_t line, uint8_t column, uintptr_t fmt, uintptr_t a0, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4)
Calls the output function of all opened Display implementations.
Display_openFxn openFxn
Definition: Display.h:449
Definition: Display.h:373
Display_getTypeFxn getTypeFxn
Definition: Display.h:455
void Display_doClearLines(Display_Handle handle, uint8_t fromLine, uint8_t toLine)
Calls the clearLines fxn of all opened Display implementations.
struct Display_FxnTable Display_FxnTable
The definition of a Display function table that contains the required set of functions to control a s...
Display_LineClearMode lineClearMode
Definition: Display.h:388
Display_Handle Display_doOpen(uint32_t id, Display_Params *params)
Initialize all the selected Display implementations.
Display Global configuration.
Definition: Display.h:469
struct Display_Params Display_Params
Display Parameters.
Display_FxnTable const * fxnTablePtr
Definition: Display.h:472
int(* Display_controlFxn)(Display_Handle handle, unsigned int cmd, void *arg)
A function pointer to a driver specific implementation of Display_control().
Definition: Display.h:433
Display_closeFxn closeFxn
Definition: Display.h:453
Display_LineClearMode
How to treat existing elements on a line when writing text.
Definition: Display.h:370
Definition: Display.h:375
Display_clearLinesFxn clearLinesFxn
Definition: Display.h:451
void(* Display_closeFxn)(Display_Handle)
A function pointer to a specific implementation of Display_close().
Definition: Display.h:427
Copyright 2016, Texas Instruments Incorporated