AR-B6050 Programming Guide Ver. 1.0 Author: Addison.
Revision History Version Author Date Description Rev. 0.1 Addison.Su Rev. 1.0 Addison.Su 2012/4/13 Change the version number. 2012/4/5 The initial version.
i 1. Table of Content Introduction............................................................................................................1 1.1. 2. GPIO and Watchdog ..............................................................................1 1.1.1. Overview........................................................................................1 1.1.2. File Description..............................................................................1 API List and Descriptions.........................
1 1. Introduction 1.1. GPIO and Watchdog 1.1.1. Overview This model provides both a GPIO interface and a Watchdog timer. Users can use the GPIO and Watchdog APIs to configure and to access the GPIO interface and the Watchdog timer. The GPIO has eight ports. Each port can be configured as an input port or an output port. The Watchdog timer can be set to 1~255 seconds. Setting the timer to zero disables the timer. The remaining seconds of the timer to reboot can be read from the timer. 1.1.2.
2 2. API List and Descriptions 2.1. GPIO and Watchdog 2.1.1. GPIO 1. Syntax: Status_t getGpioCapability(uint32_t *pInputs, uint32_t *pOutput ) Description: This function shows the capability of each GPIO port that it is an output port or an input port. Parameters: The returned value which is put at *pInput indicates whether the corresponding GPIO ports are input ports or not. For example, say, the value at *pInput is 0x00000005, it indicates that the ports GPIO0 and GPIO2 are both input ports.
3 is ‘GPIO_ID0’ ~ ‘GPIO_ID32’. For example, say, ‘Id’ is GPIO_ID2, the returned value of *pDirection is 0x1(input port) or 0x0(output port).
4 output port. Return Value: If the function sets the values successfully, it returns STATUS_SUCCESS, any other returned value stands for error. 4. Syntax: Status_t getGpioLevel( uint32_t Id, uint32_t *pLevel ) Description: Get the current state of the GPIO ports. Parameters: The argument ‘Id’ has two formats of parameters. If ‘Id’ is ‘GPIO_ALL’, the returned value at *pLevel shows the state of every GPIO port. A bit ‘1’ at the value of *pLevel stands for a logical high.
5 Return Value: If the function sets the values successfully, it returns STATUS_SUCCESS, any other returned value stands for error. 2.1.2. Watchdog 1. Syntax: Status_t getWtdTimer(uint32_t *pTimer) Description: This function read the value of the watchdog timer. Parameters: The value of the timer is put at the memory which is pointed by the argument ‘pTimer’. Return Value: This function always returns STATUS_SUCCESS. 2.