##// END OF EJS Templates
Improved documentation for apb, uart, lcd drivers.
alexis -
r66:4fad670a419d default
parent child
Show More
@@ -25,13 +25,13 DOXYFILE_ENCODING = UTF-8
25 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded
25 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded
26 # by quotes) that should identify the project.
26 # by quotes) that should identify the project.
27
27
28 PROJECT_NAME = "apb lcd driver"
28 PROJECT_NAME = "VHDL lib Drivers"
29
29
30 # The PROJECT_NUMBER tag can be used to enter a project or revision number.
30 # The PROJECT_NUMBER tag can be used to enter a project or revision number.
31 # This could be handy for archiving the generated documentation or
31 # This could be handy for archiving the generated documentation or
32 # if some version control system is used.
32 # if some version control system is used.
33
33
34 PROJECT_NUMBER = 0.1
34 PROJECT_NUMBER = 0.4
35
35
36 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
36 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
37 # base path where the generated documentation will be put.
37 # base path where the generated documentation will be put.
@@ -22,41 +22,111
22 #ifndef LPP_APB_FUNCTIONS_H
22 #ifndef LPP_APB_FUNCTIONS_H
23 #define LPP_APB_FUNCTIONS_H
23 #define LPP_APB_FUNCTIONS_H
24
24
25 #define APB_TBL_HEAD 0x800FF000
25 #define APB_TBL_HEAD 0x800FF000 /**< Start address of APB devices list on AHB2APB bridge*/
26 #define APB_BASE_ADDRS 0x80000000
26 #define APB_BASE_ADDRS 0x80000000 /**< Start address of APB bus*/
27 #define APB_MAX_DEVICES 256
27 #define APB_MAX_DEVICES 256 /**< Maximun device count on APB bus*/
28
28
29 #include "apb_devices_list.h"
29 #include "apb_devices_list.h"
30
30
31 /** @todo implemente a descriptor structure for any APB device */
31
32 /*! \file lpp_apb_functions.h
33 \brief General purpose APB functions.
34
35 This library is written to work with AHB2APB VHDL module from Gaisler's GRLIB. It help you to find your device
36 on the APB bus by providing scan functions, it extract information such as device Version, IRQ value, Address mask.
37 You can use it to print the APB devices list on your SOC.
38
39 \author Alexis Jeandet
40 \todo implemente a descriptor structure for any APB device
41 */
32
42
33
43
34 /** Structure representing a device descriptor register on Grlib's AHB2APB brige with plug and play feature */
44 /*! \struct apbPnPreg
45 \brief Structure representing a device descriptor register on Grlib's AHB2APB brige with plug and play feature
46 */
35 struct apbPnPreg
47 struct apbPnPreg
36 {
48 {
37 int idReg; /**< id register composed of Vendor ID [31:24], Device ID [23:12], CT [11:10], Version [9:5], IRQ [4:0] */
49 int idReg; /**< \brief id register composed of Vendor ID [31:24], Device ID [23:12], CT [11:10], Version [9:5], IRQ [4:0] */
38 int bar; /**< Bank Address Register composed of Device's ADDRESS [31:20], MASK [14:4], TYPE [3:0] */
50 int bar; /**< \brief Bank Address Register composed of Device's ADDRESS [31:20], MASK [14:4], TYPE [3:0] */
39 };
51 };
40
52
53
54 /*! \struct apbdevinfo
55 \brief Structure holding an APB device informations
56
57 This information are extracted from the descriptor registers on Grlib's AHB2APB brige with plug and play feature
58 */
41 struct apbdevinfo
59 struct apbdevinfo
42 {
60 {
43 int vendorID;
61 int vendorID; /**< \brief Stores the Vendor ID of the current device */
44 int productID;
62 int productID; /**< \brief Stores the Product ID of the current device */
45 int version;
63 int version; /**< \brief Stores the Version of the current device */
46 int irq;
64 int irq; /**< \brief Stores the interrupt Number of the current device */
47 int address;
65 int address; /**< \brief Stores the base address of the current device */
48 int mask;
66 int mask; /**< \brief Stores the address mask of the current device, it gives the address space of this device */
49 };
67 };
50
68
51 /** This Function scans APB devices table and returns counth device according to VID and PID */
69
70
71
72 /*! \fn int* apbgetdevice(int PID,int VID,int count);
73 \brief Find device with given VID/PID
74
75 This Function scans APB devices table and returns counth device according to VID and PID
76
77 \param PID The PID of the device you whant to get.
78 \param VID The VID of the device you whant to get.
79 \param count The number of the device you whant to get. For example if you have 3 UARTS on your SOC you whant
80 to use UART1 so count = 2.
81
82 \return The pointer to the device.
83 */
52 int* apbgetdevice(int PID,int VID,int count);
84 int* apbgetdevice(int PID,int VID,int count);
53 /** This Function scans APB devices table and returns counth device informations according VID and PID */
85
86 /*! \fn void apbgetdeviceinfofromid(int PID,int VID,int count,struct apbdevinfo* devinfo);
87 \brief Record device informations with given VID/PID
88
89 This Function scans APB devices table and returns counth device informations according VID and PID.
90
91 \param PID The PID of the device you whant to get.
92 \param VID The VID of the device you whant to get.
93 \param count The number of the device you whant to get. For example if you have 3 UARTS on your SOC you whant
94 to use UART1 so count = 2.
95 \param devinfo The device information structure to be populated.
96 */
54 void apbgetdeviceinfofromid(int PID,int VID,int count,struct apbdevinfo* devinfo);
97 void apbgetdeviceinfofromid(int PID,int VID,int count,struct apbdevinfo* devinfo);
55
98
99
100 /*! \fn void apbgetdeviceinfofromdevptr(const struct apbPnPreg* dev,struct apbdevinfo* devinfo);
101 \brief Record device informations with given AHB2APB Plugn'Play register.
102
103 This Function extract device informations from the given AHB2APB Plugn'Play register end write them in devinfo.
104
105 \param dev AHB2APB Plugn'Play register corresponding to the device.
106 \param devinfo The device information structure to be populated.
107 */
56 void apbgetdeviceinfofromdevptr(const struct apbPnPreg* dev,struct apbdevinfo* devinfo);
108 void apbgetdeviceinfofromdevptr(const struct apbPnPreg* dev,struct apbdevinfo* devinfo);
57
109
58
110
111
112 /*! \fn void apbprintdeviceinfo(struct apbdevinfo devinfo);
113 \brief Print given device informations in stdout.
114
115 \param devinfo The device information structure to be printed.
116 */
59 void apbprintdeviceinfo(struct apbdevinfo devinfo);
117 void apbprintdeviceinfo(struct apbdevinfo devinfo);
60
118
119
120
121 /*! \fn void apbprintdeviceslist();
122 \brief Print APB devices informations in stdout.
123
124 This function list all devices on APB bus and print theirs informations.
125
126 */
61 void apbprintdeviceslist();
127 void apbprintdeviceslist();
128
129
130
62 #endif // LPP_APB_FUNCTIONS_H
131 #endif // LPP_APB_FUNCTIONS_H
132
@@ -26,7 +26,14
26 #define lcdCharCnt 80
26 #define lcdCharCnt 80
27
27
28
28
29 /** @todo implemente some shift functions */
29 /*! \file apb_lcd_driver.h
30 \brief APB char LCD driver.
31
32 This library is written to work with apb_lcd VHDL module from LPP's VHDlib. It help you to drive char LCD.
33
34 \author Alexis Jeandet
35 \todo implemente some shift functions
36 */
30
37
31
38
32 /*===================================================
39 /*===================================================
@@ -34,30 +41,31
34 ====================================================*/
41 ====================================================*/
35
42
36
43
37
38 /** error type used for most of lcd functions */
39 typedef int lcd_err;
40
41 /** lcd error ennum for higher abstraction level when error decoding */
44 /** lcd error ennum for higher abstraction level when error decoding */
42 enum lcd_error
45 enum lcd_error
43 {
46 {
44 lcd_error_no_error, /**< no error append while function execution */
47 lcd_error_no_error, /**< \brief no error append while function execution */
45 lcd_error_not_ready, /**< the lcd isn't available*/
48 lcd_error_not_ready, /**< \brief the lcd isn't available*/
46 lcd_error_not_openned, /**< the device guiven to the function isn't opened*/
49 lcd_error_not_openned, /**< \brief the device guiven to the function isn't opened*/
47 lcd_error_too_long /**< the string guiven to the lcd is bigger than the lcd frame buffer memory */
50 lcd_error_too_long /**< \brief the string guiven to the lcd is bigger than the lcd frame buffer memory */
48 };
51 };
49
52
53 typedef enum lcd_error lcd_err;
50
54
51 /** for each command sended to the lcd driver a time should be guiven according to the lcd datasheet */
55 /** for each command sended to the lcd driver a time should be guiven according to the lcd datasheet.
56 Don't worry about time, the lcd VHDL module should be aware of oscillator frequency.
57 */
52 enum lcd_CMD_time
58 enum lcd_CMD_time
53 {
59 {
54 lcd_4us = 0x0FF,
60 lcd_4us = 0x0FF,
55 lcd_100us = 0x1FF,
61 lcd_100us = 0x1FF,
56 lcd_4ms = 0x2FF,
62 lcd_4ms = 0x2FF,
57 lcd_20ms = 0x3FF
63 lcd_20ms = 0x3FF
58 };
64 };
59
65
60 /** list of availiable lcd commands use whith an AND mask whith cmd time */
66 /** list of availiable lcd commands use whith an AND mask whith cmd time
67 \todo implemente more commands.
68 */
61 enum lcd_CMD
69 enum lcd_CMD
62 {
70 {
63 CursorON = 0xF0E,
71 CursorON = 0xF0E,
@@ -78,10 +86,24 typedef struct lcd_driver lcd_device;
78 F U N C T I O N S
86 F U N C T I O N S
79 ====================================================*/
87 ====================================================*/
80
88
81 /** says if the lcd is busy */
89 /*! \fn int lcdbusy(lcd_device * lcd);
90 \brief Say if the lcd screen is busy
91
92 \param lcd The lcd device to test.
93 \return True if the lcd is busy.
94 */
82 int lcdbusy(lcd_device * lcd);
95 int lcdbusy(lcd_device * lcd);
83
96
84 /** Opens and returns the counth lcd found on APB bus else NULL */
97
98 /*! \fn lcd_device* lcdopen(int count);
99 \brief Return counth LCD.
100
101 This Function scans APB devices table and returns counth LCD.
102
103 \param count The number of the LCD you whant to get. For example if you have 3 LCD on your SOC you whant
104 to use LCD1 so count = 2.
105 \return The pointer to the device.
106 */
85 lcd_device* lcdopen(int count);
107 lcd_device* lcdopen(int count);
86
108
87 /** Sends a command to the given device, don't forget to guive the time of the cmd */
109 /** Sends a command to the given device, don't forget to guive the time of the cmd */
@@ -18,39 +18,94
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Martin Morlot
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
21 -----------------------------------------------------------------------------*/
22 #ifndef APB_UART_DRIVER_H
22 #ifndef APB_UART_DRIVER_H
23 #define APB_UART_DRIVER_H
23 #define APB_UART_DRIVER_H
24
24
25
25 /*! \file apb_uart_Driver.h
26 #define BaudGenOnDuty 0
26 \brief LPP Uart driver.
27 #define DataSended 0x10
27
28 #define NewData 0x100
28 This library is written to work with LPP_APB_UART VHDL module from LPP's FreeVHDLIB. It help you to print and get
29
29 char or strings over uart.
30
31 \todo Continue documentation
32 \author Martin Morlot
33 */
34
35
36
37 #define BaudGenOnDuty 0
38 #define DataSended 0x10
39 #define NewData 0x100
40
30 /*===================================================
41 /*===================================================
31 T Y P E S D E F
42 T Y P E S D E F
32 ====================================================*/
43 ====================================================*/
33
44
34 struct UART_Driver
45 struct UART_Driver
35 {
46 {
36 int ConfigReg;
47 int ConfigReg;
37 int DataWReg;
48 int DataWReg;
38 int DataRReg;
49 int DataRReg;
39 };
50 };
40
51
41 typedef struct UART_Driver UART_Device;
52 typedef struct UART_Driver UART_Device;
42
53
43
54
44 /*===================================================
55 /*===================================================
45 F U N C T I O N S
56 F U N C T I O N S
46 ====================================================*/
57 ====================================================*/
47
58
48
59 /*! \fn UART_Device* openUART(int count);
49 UART_Device* openUART(int count);
60 \brief Return counth UART.
50 void uartputc(UART_Device* dev,char c);
61
51 void uartputs(UART_Device* dev,char* s);
62 This Function scans APB devices table and returns counth UART.
52 char uartgetc(UART_Device* dev);
63
53 void uartgets(UART_Device* dev,char* s);
64 \param count The number of the UART you whant to get. For example if you have 3 UARTS on your SOC you whant
54
65 to use UART1 so count = 2.
55
66 \return The pointer to the device.
56 #endif
67 */
68 UART_Device* openUART(int count);
69
70 /*! \fn void uartputc(UART_Device* dev,char c);
71 \brief Print char over given UART.
72
73 This Function puts the given char over the given UART.
74
75 \param dev The UART pointer.
76 \param c The char you whant to print.
77 */
78 void uartputc(UART_Device* dev,char c);
79
80 /*! \fn void uartputs(UART_Device* dev,char* s);
81 \brief Print string over given UART.
82
83 This Function puts the given string over the given UART.
84
85 \param dev The UART pointer.
86 \param s The string you whant to print.
87 */
88 void uartputs(UART_Device* dev,char* s);
89
90 /*! \fn char uartgetc(UART_Device* dev);
91 \brief Get char from given UART.
92
93 This Function get char from the given UART.
94
95 \param dev The UART pointer.
96 \return The read char.
97 */
98 char uartgetc(UART_Device* dev);
99
100 /*! \fn void uartgets(UART_Device* dev,char* s);
101 \brief Get string from given UART.
102
103 This Function get string from the given UART.
104
105 \param dev The UART pointer.
106 \param s The read string.
107 */
108 void uartgets(UART_Device* dev,char* s);
109
110
111 #endif
General Comments 0
You need to be logged in to leave comments. Login now