mirror of
https://github.com/eggman/ameba-gcc-sample-rtos.git
synced 2024-11-22 03:44:15 +00:00
add sdk header file
This commit is contained in:
commit
c6c1e22690
76 changed files with 29776 additions and 0 deletions
663
sdk/component/common/api/wifi/wifi_conf.h
Normal file
663
sdk/component/common/api/wifi/wifi_conf.h
Normal file
|
@ -0,0 +1,663 @@
|
||||||
|
//----------------------------------------------------------------------------//
|
||||||
|
#ifndef __WIFI_API_H
|
||||||
|
#define __WIFI_API_H
|
||||||
|
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "wifi_constants.h"
|
||||||
|
#include "wifi_structures.h"
|
||||||
|
#include "wifi_util.h"
|
||||||
|
#include "wifi_ind.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* Macros
|
||||||
|
******************************************************/
|
||||||
|
|
||||||
|
#define RTW_ENABLE_API_INFO
|
||||||
|
|
||||||
|
#ifdef RTW_ENABLE_API_INFO
|
||||||
|
#define RTW_API_INFO(args) do {printf args;} while(0)
|
||||||
|
#else
|
||||||
|
#define RTW_API_INFO(args)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
|
||||||
|
#define CMP_MAC( a, b ) (((a[0])==(b[0]))&& \
|
||||||
|
((a[1])==(b[1]))&& \
|
||||||
|
((a[2])==(b[2]))&& \
|
||||||
|
((a[3])==(b[3]))&& \
|
||||||
|
((a[4])==(b[4]))&& \
|
||||||
|
((a[5])==(b[5])))
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* Constants
|
||||||
|
******************************************************/
|
||||||
|
#define SCAN_LONGEST_WAIT_TIME (4500)
|
||||||
|
|
||||||
|
|
||||||
|
#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
|
||||||
|
|
||||||
|
#define PSCAN_ENABLE 0x01 //enable for partial channel scan
|
||||||
|
#define PSCAN_FAST_SURVEY 0x02 //set to select scan time to FAST_SURVEY_TO, otherwise SURVEY_TO
|
||||||
|
#define PSCAN_SIMPLE_CONFIG 0x04 //set to select scan time to FAST_SURVEY_TO and resend probe request
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* Type Definitions
|
||||||
|
******************************************************/
|
||||||
|
|
||||||
|
/** Scan result callback function pointer type
|
||||||
|
*
|
||||||
|
* @param result_ptr : A pointer to the pointer that indicates where to put the next scan result
|
||||||
|
* @param user_data : User provided data
|
||||||
|
*/
|
||||||
|
typedef void (*rtw_scan_result_callback_t)( rtw_scan_result_t** result_ptr, void* user_data );
|
||||||
|
typedef rtw_result_t (*rtw_scan_result_handler_t)( rtw_scan_handler_result_t* malloced_scan_result );
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* Structures
|
||||||
|
******************************************************/
|
||||||
|
typedef struct {
|
||||||
|
char *buf;
|
||||||
|
int buf_len;
|
||||||
|
} scan_buf_arg;
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* Structures
|
||||||
|
******************************************************/
|
||||||
|
typedef struct internal_scan_handler{
|
||||||
|
rtw_scan_result_t** pap_details;
|
||||||
|
rtw_scan_result_t * ap_details;
|
||||||
|
int scan_cnt;
|
||||||
|
rtw_bool_t scan_complete;
|
||||||
|
unsigned char max_ap_size;
|
||||||
|
rtw_scan_result_handler_t gscan_result_handler;
|
||||||
|
#if SCAN_USE_SEMAPHORE
|
||||||
|
void *scan_semaphore;
|
||||||
|
#else
|
||||||
|
int scan_running;
|
||||||
|
#endif
|
||||||
|
void* user_data;
|
||||||
|
unsigned int scan_start_time;
|
||||||
|
} internal_scan_handler_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
rtw_network_info_t network_info;
|
||||||
|
void *join_sema;
|
||||||
|
} internal_join_result_t;
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* Function Declarations
|
||||||
|
******************************************************/
|
||||||
|
/**
|
||||||
|
* Initialises Realtek WiFi API System
|
||||||
|
*
|
||||||
|
* - Initialises the required parts of the software platform
|
||||||
|
* i.e. worker, event registering, semaphore, etc.
|
||||||
|
*
|
||||||
|
* - Initialises the RTW API thread which handles the asynchronous event
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS if initialization is successful, RTW_ERROR otherwise
|
||||||
|
*/
|
||||||
|
int wifi_manager_init(void);
|
||||||
|
|
||||||
|
/** Joins a Wi-Fi network
|
||||||
|
*
|
||||||
|
* Scans for, associates and authenticates with a Wi-Fi network.
|
||||||
|
* On successful return, the system is ready to send data packets.
|
||||||
|
*
|
||||||
|
* @param[in] ssid : A null terminated string containing the SSID name of the network to join
|
||||||
|
* @param[in] security_type : Authentication type:
|
||||||
|
* - RTW_SECURITY_OPEN - Open Security
|
||||||
|
* - RTW_SECURITY_WEP_PSK - WEP Security with open authentication
|
||||||
|
* - RTW_SECURITY_WEP_SHARED - WEP Security with shared authentication
|
||||||
|
* - RTW_SECURITY_WPA_TKIP_PSK - WPA Security
|
||||||
|
* - RTW_SECURITY_WPA2_AES_PSK - WPA2 Security using AES cipher
|
||||||
|
* - RTW_SECURITY_WPA2_TKIP_PSK - WPA2 Security using TKIP cipher
|
||||||
|
* - RTW_SECURITY_WPA2_MIXED_PSK - WPA2 Security using AES and/or TKIP ciphers
|
||||||
|
* @param[in] password : A byte array containing either the
|
||||||
|
* cleartext security key for WPA/WPA2
|
||||||
|
* secured networks, or a pointer to
|
||||||
|
* an array of rtw_wep_key_t
|
||||||
|
* structures for WEP secured networks
|
||||||
|
* @param[in] ssid_len : The length of the SSID in
|
||||||
|
* bytes.
|
||||||
|
* @param[in] password_len : The length of the security_key in
|
||||||
|
* bytes.
|
||||||
|
* @param[in] key_id : The index of the wep key.
|
||||||
|
* @param[in] semaphore : A user provided semaphore that is flagged when the join is complete
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : when the system is joined and ready
|
||||||
|
* to send data packets
|
||||||
|
* RTW_ERROR : if an error occurred
|
||||||
|
*/
|
||||||
|
int wifi_connect(
|
||||||
|
char *ssid,
|
||||||
|
rtw_security_t security_type,
|
||||||
|
char *password,
|
||||||
|
int ssid_len,
|
||||||
|
int password_len,
|
||||||
|
int key_id,
|
||||||
|
void *semaphore);
|
||||||
|
|
||||||
|
int wifi_connect_bssid(
|
||||||
|
unsigned char bssid[ETH_ALEN],
|
||||||
|
char *ssid,
|
||||||
|
rtw_security_t security_type,
|
||||||
|
char *password,
|
||||||
|
int bssid_len,
|
||||||
|
int ssid_len,
|
||||||
|
int password_len,
|
||||||
|
int key_id,
|
||||||
|
void *semaphore);
|
||||||
|
|
||||||
|
/** Disassociates from a Wi-Fi network.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : On successful disassociation from
|
||||||
|
* the AP
|
||||||
|
* RTW_ERROR : If an error occurred
|
||||||
|
*/
|
||||||
|
int wifi_disconnect(void);
|
||||||
|
|
||||||
|
/** Check if the interface specified is up.
|
||||||
|
*
|
||||||
|
* @return RTW_TRUE : If it's up
|
||||||
|
* RTW_FALSE : If it's not
|
||||||
|
*/
|
||||||
|
|
||||||
|
int wifi_is_connected_to_ap(void);
|
||||||
|
/*check if wifi has connected to AP before dhcp
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS:if conneced
|
||||||
|
RTW_ERROR :if not connect
|
||||||
|
*/
|
||||||
|
|
||||||
|
int wifi_is_up(rtw_interface_t interface);
|
||||||
|
|
||||||
|
/** Determines if a particular interface is ready to transceive ethernet packets
|
||||||
|
*
|
||||||
|
* @param Radio interface to check, options are
|
||||||
|
* RTW_STA_INTERFACE, RTW_AP_INTERFACE
|
||||||
|
* @return RTW_SUCCESS : if the interface is ready to
|
||||||
|
* transceive ethernet packets
|
||||||
|
* @return RTW_NOTFOUND : no AP with a matching SSID was
|
||||||
|
* found
|
||||||
|
* @return RTW_NOT_AUTHENTICATED: a matching AP was found but
|
||||||
|
* it won't let you
|
||||||
|
* authenticate. This can
|
||||||
|
* occur if this device is
|
||||||
|
* in the block list on the
|
||||||
|
* AP.
|
||||||
|
* @return RTW_NOT_KEYED: the device has authenticated and
|
||||||
|
* associated but has not completed
|
||||||
|
* the key exchange. This can occur
|
||||||
|
* if the passphrase is incorrect.
|
||||||
|
* @return RTW_ERROR : if the interface is not ready to
|
||||||
|
* transceive ethernet packets
|
||||||
|
*/
|
||||||
|
int wifi_is_ready_to_transceive(rtw_interface_t interface);
|
||||||
|
|
||||||
|
/** ----------------------------------------------------------------------
|
||||||
|
* WARNING : This function is for internal use only!
|
||||||
|
* ----------------------------------------------------------------------
|
||||||
|
* This function sets the current Media Access Control (MAC) address of the
|
||||||
|
* 802.11 device.
|
||||||
|
*
|
||||||
|
* @param[in] mac Wi-Fi MAC address
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_set_mac_address(char * mac);
|
||||||
|
|
||||||
|
/** Retrieves the current Media Access Control (MAC) address
|
||||||
|
* (or Ethernet hardware address) of the 802.11 device
|
||||||
|
*
|
||||||
|
* @param mac Pointer to a variable that the current MAC address will be written to
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_get_mac_address(char * mac);
|
||||||
|
|
||||||
|
/** Enables powersave mode
|
||||||
|
*
|
||||||
|
* @return @ref rtw_result_t
|
||||||
|
*/
|
||||||
|
int wifi_enable_powersave(void);
|
||||||
|
|
||||||
|
/** Disables 802.11 power save mode
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if power save mode was successfully
|
||||||
|
* disabled
|
||||||
|
* RTW_ERROR : if power save mode was not successfully
|
||||||
|
* disabled
|
||||||
|
*/
|
||||||
|
int wifi_disable_powersave(void);
|
||||||
|
|
||||||
|
/** Gets the tx power in index units
|
||||||
|
*
|
||||||
|
* @param dbm : The variable to receive the tx power in index.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if successful
|
||||||
|
* RTW_ERROR : if not successful
|
||||||
|
*/
|
||||||
|
int wifi_get_txpower(int *poweridx);
|
||||||
|
|
||||||
|
/** Sets the tx power in index units
|
||||||
|
*
|
||||||
|
* @param dbm : The desired tx power in index.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if tx power was successfully set
|
||||||
|
* RTW_ERROR : if tx power was not successfully set
|
||||||
|
*/
|
||||||
|
int wifi_set_txpower(int poweridx);
|
||||||
|
|
||||||
|
/** Get the associated clients with SoftAP
|
||||||
|
*
|
||||||
|
* @param client_list_buffer : the location where the client
|
||||||
|
* list will be stored
|
||||||
|
* @param buffer_length : the buffer length.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if result was successfully get
|
||||||
|
* RTW_ERROR : if result was not successfully get
|
||||||
|
*/
|
||||||
|
int wifi_get_associated_client_list(void * client_list_buffer, unsigned short buffer_length);
|
||||||
|
|
||||||
|
/** Get the SoftAP information
|
||||||
|
*
|
||||||
|
* @param ap_info : the location where the AP info will be
|
||||||
|
* stored
|
||||||
|
* @param security : the security type.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if result was successfully get
|
||||||
|
* RTW_ERROR : if result was not successfully get
|
||||||
|
*/
|
||||||
|
int wifi_get_ap_info(rtw_bss_info_t * ap_info, rtw_security_t* security);
|
||||||
|
|
||||||
|
/** Set the country code to driver to determine the channel set
|
||||||
|
*
|
||||||
|
* @param country_code : the country code.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if result was successfully set
|
||||||
|
* RTW_ERROR : if result was not successfully set
|
||||||
|
*/
|
||||||
|
int wifi_set_country(rtw_country_code_t country_code);
|
||||||
|
|
||||||
|
/** Retrieve the latest RSSI value
|
||||||
|
*
|
||||||
|
* @param rssi: The location where the RSSI value will be stored
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if the RSSI was succesfully retrieved
|
||||||
|
* RTW_ERROR : if the RSSI was not retrieved
|
||||||
|
*/
|
||||||
|
int wifi_get_rssi(int *pRSSI);
|
||||||
|
|
||||||
|
/** Set the current channel on STA interface
|
||||||
|
*
|
||||||
|
* @param channel : The desired channel
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if the channel was successfully set
|
||||||
|
* RTW_ERROR : if the channel was not successfully
|
||||||
|
* set
|
||||||
|
*/
|
||||||
|
int wifi_set_channel(int channel);
|
||||||
|
|
||||||
|
/** Get the current channel on STA interface
|
||||||
|
*
|
||||||
|
* @param channel : A pointer to the variable where the
|
||||||
|
* channel value will be written
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if the channel was successfully read
|
||||||
|
* RTW_ERROR : if the channel was not successfully
|
||||||
|
* read
|
||||||
|
*/
|
||||||
|
int wifi_get_channel(int *channel);
|
||||||
|
|
||||||
|
/** Registers interest in a multicast address
|
||||||
|
* Once a multicast address has been registered, all packets detected on the
|
||||||
|
* medium destined for that address are forwarded to the host.
|
||||||
|
* Otherwise they are ignored.
|
||||||
|
*
|
||||||
|
* @param mac: Ethernet MAC address
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if the address was registered
|
||||||
|
* successfully
|
||||||
|
* RTW_ERROR : if the address was not registered
|
||||||
|
*/
|
||||||
|
int wifi_register_multicast_address(rtw_mac_t *mac);
|
||||||
|
|
||||||
|
/** Unregisters interest in a multicast address
|
||||||
|
* Once a multicast address has been unregistered, all packets detected on the
|
||||||
|
* medium destined for that address are ignored.
|
||||||
|
*
|
||||||
|
* @param mac: Ethernet MAC address
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if the address was unregistered
|
||||||
|
* successfully
|
||||||
|
* RTW_ERROR : if the address was not unregistered
|
||||||
|
*/
|
||||||
|
int wifi_unregister_multicast_address(rtw_mac_t *mac);
|
||||||
|
|
||||||
|
int wifi_rf_on(void);
|
||||||
|
int wifi_rf_off(void);
|
||||||
|
|
||||||
|
/** Turn on the Wi-Fi device
|
||||||
|
*
|
||||||
|
* - Bring the Wireless interface "Up"
|
||||||
|
* - Initialises the driver thread which arbitrates access
|
||||||
|
* to the SDIO/SPI bus
|
||||||
|
*
|
||||||
|
* @param mode: wifi work mode
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if the WiFi chip was initialised
|
||||||
|
* successfully
|
||||||
|
* RTW_ERROR : if the WiFi chip was not initialised
|
||||||
|
* successfully
|
||||||
|
*/
|
||||||
|
int wifi_on(rtw_mode_t mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turn off the Wi-Fi device
|
||||||
|
*
|
||||||
|
* - Bring the Wireless interface "Down"
|
||||||
|
* - De-Initialises the driver thread which arbitrates access
|
||||||
|
* to the SDIO/SPI bus
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS if deinitialization is successful,
|
||||||
|
* RTW_ERROR otherwise
|
||||||
|
*/
|
||||||
|
int wifi_off(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set IPS/LPS mode
|
||||||
|
*
|
||||||
|
* @param[in] ips_mode : The desired IPS mode. It become effective when wlan enter ips.
|
||||||
|
* @param[in] lps_mode : The desired LPS mode. It become effective when wlan enter lps.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS if setting LPS mode successful
|
||||||
|
* RTW_ERROR otherwise
|
||||||
|
*/
|
||||||
|
int wifi_set_power_mode(unsigned char ips_mode, unsigned char lps_mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TDMA parameters
|
||||||
|
*
|
||||||
|
* @param[in] slot_period : We separate TBTT into 2 or 3 slots.
|
||||||
|
* If we separate TBTT into 2 slots, then slot_period should be larger or equal to 50ms.
|
||||||
|
* It means 2 slot period is
|
||||||
|
* slot_period, 100-slot_period
|
||||||
|
* If we separate TBTT into 3 slots, then slot_period should be less or equal to 33ms.
|
||||||
|
* It means 3 slot period is
|
||||||
|
* 100 - 2 * slot_period, slot_period, slot_period
|
||||||
|
* @param[in] rfon_period_len_1: rf on period of slot 1
|
||||||
|
* @param[in] rfon_period_len_2: rf on period of slot 2
|
||||||
|
* @param[in] rfon_period_len_3: rf on period of slot 3
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS if setting TDMA parameters successful
|
||||||
|
* RTW_ERROR otherwise
|
||||||
|
*/
|
||||||
|
int wifi_set_tdma_param(unsigned char slot_period, unsigned char rfon_period_len_1, unsigned char rfon_period_len_2, unsigned char rfon_period_len_3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set LPS DTIM
|
||||||
|
*
|
||||||
|
* @param[in] dtim : In LPS, the package can be buffered at AP side.
|
||||||
|
* STA leave LPS until dtim count of packages buffered at AP side.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS if setting LPS dtim successful
|
||||||
|
* RTW_ERROR otherwise
|
||||||
|
*/
|
||||||
|
int wifi_set_lps_dtim(unsigned char dtim);
|
||||||
|
|
||||||
|
/** Starts an infrastructure WiFi network
|
||||||
|
*
|
||||||
|
* @warning If a STA interface is active when this function is called, the softAP will\n
|
||||||
|
* start on the same channel as the STA. It will NOT use the channel provided!
|
||||||
|
*
|
||||||
|
* @param[in] ssid : A null terminated string containing
|
||||||
|
* the SSID name of the network to join
|
||||||
|
* @param[in] security_type : Authentication type: \n
|
||||||
|
* - RTW_SECURITY_OPEN - Open Security \n
|
||||||
|
* - RTW_SECURITY_WPA_TKIP_PSK - WPA Security \n
|
||||||
|
* - RTW_SECURITY_WPA2_AES_PSK - WPA2 Security using AES cipher \n
|
||||||
|
* - RTW_SECURITY_WPA2_MIXED_PSK - WPA2 Security using AES and/or TKIP ciphers \n
|
||||||
|
* - WEP security is NOT IMPLEMENTED. It is NOT SECURE! \n
|
||||||
|
* @param[in] password : A byte array containing the cleartext
|
||||||
|
* security key for the network
|
||||||
|
* @param[in] ssid_len : The length of the SSID in
|
||||||
|
* bytes.
|
||||||
|
* @param[in] password_len : The length of the security_key in
|
||||||
|
* bytes.
|
||||||
|
* @param[in] channel : 802.11 channel number
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if successfully creates an AP
|
||||||
|
* RTW_ERROR : if an error occurred
|
||||||
|
*/
|
||||||
|
int wifi_start_ap(
|
||||||
|
char *ssid,
|
||||||
|
rtw_security_t security_type,
|
||||||
|
char *password,
|
||||||
|
int ssid_len,
|
||||||
|
int password_len,
|
||||||
|
int channel);
|
||||||
|
|
||||||
|
/** Initiates a scan to search for 802.11 networks.
|
||||||
|
*
|
||||||
|
* The scan progressively accumulates results over time, and
|
||||||
|
* may take between 1 and 3 seconds to complete. The results of
|
||||||
|
* the scan will be individually provided to the callback
|
||||||
|
* function. Note: The callback function will be executed in
|
||||||
|
* the context of the RTW thread.
|
||||||
|
*
|
||||||
|
* @param[in] scan_type : Specifies whether the scan should
|
||||||
|
* be Active, Passive or scan
|
||||||
|
* Prohibited channels
|
||||||
|
* @param[in] bss_type : Specifies whether the scan should
|
||||||
|
* search for Infrastructure
|
||||||
|
* networks (those using an Access
|
||||||
|
* Point), Ad-hoc networks, or both
|
||||||
|
* types.
|
||||||
|
* @param result_ptr[in] : Scan specific ssid. The first 4
|
||||||
|
* bytes is ssid lenth, and ssid name
|
||||||
|
* append after it.
|
||||||
|
* If no specific ssid need to scan,
|
||||||
|
* PLEASE CLEAN result_ptr before pass
|
||||||
|
* it into parameter.
|
||||||
|
* @param result_ptr[out] : a pointer to a pointer to a result
|
||||||
|
* storage structure.
|
||||||
|
*
|
||||||
|
* @note : When scanning specific channels, devices with a
|
||||||
|
* strong signal strength on nearby channels may be
|
||||||
|
* detected
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_scan(rtw_scan_type_t scan_type,
|
||||||
|
rtw_bss_type_t bss_type,
|
||||||
|
void* result_ptr);
|
||||||
|
|
||||||
|
/** Initiates a scan to search for 802.11 networks, a higher
|
||||||
|
* level API based on wifi_scan to simplify the scan
|
||||||
|
* operation.
|
||||||
|
*
|
||||||
|
* The scan results will be list by the order of RSSI.
|
||||||
|
* It may demand hundreds bytes memory during scan
|
||||||
|
* processing according to the quantity of AP nearby.
|
||||||
|
*
|
||||||
|
* @param results_handler[in] : the callback function which
|
||||||
|
* will receive and process the result data.
|
||||||
|
* @param user_data[in] : user specific data that will be
|
||||||
|
* passed directly to the callback function
|
||||||
|
*
|
||||||
|
* @note : Callback must not use blocking functions, since it is
|
||||||
|
* called from the context of the RTW thread.
|
||||||
|
* @note : The callback, user_data variables will
|
||||||
|
* be referenced after the function returns. Those
|
||||||
|
* variables must remain valid until the scan is
|
||||||
|
* complete.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_scan_networks(rtw_scan_result_handler_t results_handler, void* user_data);
|
||||||
|
int wifi_scan_networks_with_ssid(rtw_scan_result_handler_t results_handler, void* user_data, char* ssid, int ssid_len);
|
||||||
|
|
||||||
|
/** Set the partical scan
|
||||||
|
*
|
||||||
|
* @param channel_list[in] : the channel set the scan will
|
||||||
|
* stay on
|
||||||
|
* @param pscan_config[in] : the pscan_config of the channel set
|
||||||
|
*
|
||||||
|
* @param length[in] : the channel list length
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_set_pscan_chan(__u8 * channel_list,__u8 * pscan_config, __u8 length);
|
||||||
|
|
||||||
|
/** Get the network information
|
||||||
|
*
|
||||||
|
* @param ifname[in] : the name of the interface we are care
|
||||||
|
* @param pSetting[in] : the location where the network
|
||||||
|
* information will be stored
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_get_setting(const char *ifname,rtw_wifi_setting_t *pSetting);
|
||||||
|
|
||||||
|
/** Show the network information
|
||||||
|
*
|
||||||
|
* @param ifname[in] : the name of the interface we are care
|
||||||
|
* @param pSetting[in] : the location where the network
|
||||||
|
* information was stored
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_show_setting(const char *ifname,rtw_wifi_setting_t *pSetting);
|
||||||
|
|
||||||
|
/** Set the network mode according to the data rate it's
|
||||||
|
* supported
|
||||||
|
*
|
||||||
|
* @param mode[in] : the network mode
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_set_network_mode(rtw_network_mode_t mode);
|
||||||
|
|
||||||
|
/** Set the chip to worke in the promisc mode
|
||||||
|
*
|
||||||
|
* @param enabled[in] : enabled can be set 0, 1 and 2. if enabled is zero, disable the promisc, else enable the promisc.
|
||||||
|
* 0 means disable the promisc
|
||||||
|
* 1 means enable the promisc
|
||||||
|
* 2 means enable the promisc special for length is used
|
||||||
|
* @param callback[in] : the callback function which will
|
||||||
|
* receive and process the netowork data.
|
||||||
|
* @param len_used[in] : specify if the the promisc length is
|
||||||
|
* used.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_set_promisc(rtw_rcr_level_t enabled, void (*callback)(unsigned char*, unsigned int, void*), unsigned char len_used);
|
||||||
|
|
||||||
|
/** Set the wps phase
|
||||||
|
*
|
||||||
|
* @param is_trigger_wps[in] : to trigger wps function or not
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_set_wps_phase(unsigned char is_trigger_wps);
|
||||||
|
|
||||||
|
/** Restarts an infrastructure WiFi network
|
||||||
|
*
|
||||||
|
* @warning If a STA interface is active when this function is called, the softAP will\n
|
||||||
|
* start on the same channel as the STA. It will NOT use the channel provided!
|
||||||
|
*
|
||||||
|
* @param[in] ssid : A null terminated string containing
|
||||||
|
* the SSID name of the network to join
|
||||||
|
* @param[in] security_type : Authentication type: \n
|
||||||
|
* - RTW_SECURITY_OPEN - Open Security \n
|
||||||
|
* - RTW_SECURITY_WPA_TKIP_PSK - WPA Security \n
|
||||||
|
* - RTW_SECURITY_WPA2_AES_PSK - WPA2 Security using AES cipher \n
|
||||||
|
* - RTW_SECURITY_WPA2_MIXED_PSK - WPA2 Security using AES and/or TKIP ciphers \n
|
||||||
|
* - WEP security is NOT IMPLEMENTED. It is NOT SECURE! \n
|
||||||
|
* @param[in] password : A byte array containing the cleartext
|
||||||
|
* security key for the network
|
||||||
|
* @param[in] ssid_len : The length of the SSID in
|
||||||
|
* bytes.
|
||||||
|
* @param[in] password_len : The length of the security_key in
|
||||||
|
* bytes.
|
||||||
|
* @param[in] channel : 802.11 channel number
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if successfully creates an AP
|
||||||
|
* RTW_ERROR : if an error occurred
|
||||||
|
*/
|
||||||
|
int wifi_restart_ap(
|
||||||
|
unsigned char *ssid,
|
||||||
|
rtw_security_t security_type,
|
||||||
|
unsigned char *password,
|
||||||
|
int ssid_len,
|
||||||
|
int password_len,
|
||||||
|
int channel);
|
||||||
|
|
||||||
|
int wifi_config_autoreconnect(__u8 mode, __u8 retyr_times, __u16 timeout);
|
||||||
|
int wifi_set_autoreconnect(__u8 mode);
|
||||||
|
int wifi_get_autoreconnect(__u8 *mode);
|
||||||
|
int wifi_get_last_error( void );
|
||||||
|
/** Present device disconnect reason while connecting
|
||||||
|
*
|
||||||
|
*@return RTW_NO_ERROR = 0,
|
||||||
|
* RTW_NONE_NETWORK = 1,
|
||||||
|
* RTW_CONNECT_FAIL = 2,
|
||||||
|
* RTW_WRONG_PASSWORD = 3 ,
|
||||||
|
* RTW_DHCP_FAIL = 4,
|
||||||
|
* RTW_UNKNOWN, initial status
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_CUSTOM_IE
|
||||||
|
#ifndef BIT
|
||||||
|
#define BIT(x) ((__u32)1 << (x))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _CUSTOM_IE_TYPE_
|
||||||
|
#define _CUSTOM_IE_TYPE_
|
||||||
|
enum CUSTOM_IE_TYPE{
|
||||||
|
PROBE_REQ = BIT(0),
|
||||||
|
PROBE_RSP = BIT(1),
|
||||||
|
BEACON = BIT(2),
|
||||||
|
};
|
||||||
|
#endif /* _CUSTOM_IE_TYPE_ */
|
||||||
|
|
||||||
|
/* ie format
|
||||||
|
* +-----------+--------+-----------------------+
|
||||||
|
* |element ID | length | content in length byte|
|
||||||
|
* +-----------+--------+-----------------------+
|
||||||
|
*
|
||||||
|
* type: refer to CUSTOM_IE_TYPE
|
||||||
|
*/
|
||||||
|
#ifndef _CUS_IE_
|
||||||
|
#define _CUS_IE_
|
||||||
|
typedef struct _cus_ie{
|
||||||
|
__u8 *ie;
|
||||||
|
__u8 type;
|
||||||
|
}cus_ie, *p_cus_ie;
|
||||||
|
#endif /* _CUS_IE_ */
|
||||||
|
|
||||||
|
int wifi_add_custom_ie(void *cus_ie, int ie_num);
|
||||||
|
|
||||||
|
int wifi_update_custom_ie(void *cus_ie, int ie_index);
|
||||||
|
|
||||||
|
int wifi_del_custom_ie(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_PROMISC
|
||||||
|
void wifi_init_packet_filter(void);
|
||||||
|
int wifi_add_packet_filter(unsigned char filter_id, rtw_packet_filter_pattern_t *patt, rtw_packet_filter_rule_e rule);
|
||||||
|
int wifi_enable_packet_filter(unsigned char filter_id);
|
||||||
|
int wifi_disable_packet_filter(unsigned char filter_id);
|
||||||
|
int wifi_remove_packet_filter(unsigned char filter_id);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // __WIFI_API_H
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------//
|
52
sdk/component/common/api/wifi/wifi_ind.h
Normal file
52
sdk/component/common/api/wifi/wifi_ind.h
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
#ifndef _WIFI_INDICATE_H
|
||||||
|
#define _WIFI_INDICATE_H
|
||||||
|
#include "wifi_conf.h"
|
||||||
|
#if 0 //move to wifi_constants.h
|
||||||
|
typedef enum _WIFI_EVENT_INDICATE{
|
||||||
|
WIFI_EVENT_CONNECT = 0,
|
||||||
|
WIFI_EVENT_DISCONNECT = 1,
|
||||||
|
WIFI_EVENT_FOURWAY_HANDSHAKE_DONE = 2,
|
||||||
|
WIFI_EVENT_SCAN_RESULT_REPORT = 3,
|
||||||
|
WIFI_EVENT_SCAN_DONE = 4,
|
||||||
|
WIFI_EVENT_RECONNECTION_FAIL = 5,
|
||||||
|
WIFI_EVENT_SEND_ACTION_DONE = 6,
|
||||||
|
WIFI_EVENT_RX_MGNT = 7,
|
||||||
|
WIFI_EVENT_STA_ASSOC = 8,
|
||||||
|
WIFI_EVENT_STA_DISASSOC = 9,
|
||||||
|
WIFI_EVENT_WPS_FINISH = 10,
|
||||||
|
WIFI_EVENT_EAPOL_RECVD = 11,
|
||||||
|
WIFI_EVENT_NO_NETWORK = 12,
|
||||||
|
WIFI_EVENT_BEACON_AFTER_DHCP = 13,
|
||||||
|
WIFI_EVENT_MAX,
|
||||||
|
}WIFI_EVENT_INDICATE;
|
||||||
|
#endif
|
||||||
|
typedef void (*rtw_event_handler_t)(char *buf, int buf_len, int flags, void* handler_user_data );
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
// WIFI_EVENT_INDICATE event_cmd;
|
||||||
|
rtw_event_handler_t handler;
|
||||||
|
void* handler_user_data;
|
||||||
|
} event_list_elem_t;
|
||||||
|
|
||||||
|
void init_event_callback_list(void);
|
||||||
|
extern void wifi_indication( WIFI_EVENT_INDICATE event, char *buf, int buf_len, int flags);
|
||||||
|
/** Register the event listener
|
||||||
|
*
|
||||||
|
* @param[in] event_cmds : The event command number indicated
|
||||||
|
* @param[in] handler_func : the callback function which will
|
||||||
|
* receive and process the event
|
||||||
|
* @param[in] handler_user_data : user specific data that will be
|
||||||
|
* passed directly to the callback function
|
||||||
|
*
|
||||||
|
* @note : Set the same event_cmds with empty handler_func will
|
||||||
|
* unregister the event_cmds
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if successfully registers the event
|
||||||
|
* RTW_ERROR : if an error occurred
|
||||||
|
*/
|
||||||
|
extern void wifi_reg_event_handler(unsigned int event_cmds, rtw_event_handler_t handler_func, void *handler_user_data);
|
||||||
|
extern void wifi_unreg_event_handler(unsigned int event_cmds, rtw_event_handler_t handler_func);
|
||||||
|
|
||||||
|
#endif //_WIFI_INDICATE_H
|
||||||
|
|
67
sdk/component/common/api/wifi/wifi_util.h
Normal file
67
sdk/component/common/api/wifi/wifi_util.h
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
#ifndef _UTIL_H
|
||||||
|
#define _UTIL_H
|
||||||
|
|
||||||
|
#include <wireless.h>
|
||||||
|
#include <wlan_intf.h>
|
||||||
|
#include <wifi_constants.h>
|
||||||
|
#include "wifi_structures.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int wext_get_ssid(const char *ifname, __u8 *ssid);
|
||||||
|
int wext_set_ssid(const char *ifname, const __u8 *ssid, __u16 ssid_len);
|
||||||
|
int wext_set_bssid(const char *ifname, const __u8 *bssid);
|
||||||
|
int wext_get_bssid(const char *ifname, __u8 *bssid);
|
||||||
|
int wext_set_auth_param(const char *ifname, __u16 idx, __u32 value);
|
||||||
|
int wext_set_key_ext(const char *ifname, __u16 alg, const __u8 *addr, int key_idx, int set_tx, const __u8 *seq, __u16 seq_len, __u8 *key, __u16 key_len);
|
||||||
|
int wext_get_enc_ext(const char *ifname, __u16 *alg, __u8 *key_idx, __u8 *passphrase);
|
||||||
|
int wext_set_passphrase(const char *ifname, const __u8 *passphrase, __u16 passphrase_len);
|
||||||
|
int wext_get_passphrase(const char *ifname, __u8 *passphrase);
|
||||||
|
int wext_set_mode(const char *ifname, int mode);
|
||||||
|
int wext_get_mode(const char *ifname, int *mode);
|
||||||
|
int wext_set_ap_ssid(const char *ifname, const __u8 *ssid, __u16 ssid_len);
|
||||||
|
int wext_set_country(const char *ifname, rtw_country_code_t country_code);
|
||||||
|
int wext_get_rssi(const char *ifname, int *rssi);
|
||||||
|
int wext_set_channel(const char *ifname, __u8 ch);
|
||||||
|
int wext_get_channel(const char *ifname, __u8 *ch);
|
||||||
|
int wext_register_multicast_address(const char *ifname, rtw_mac_t *mac);
|
||||||
|
int wext_unregister_multicast_address(const char *ifname, rtw_mac_t *mac);
|
||||||
|
int wext_set_scan(const char *ifname, char *buf, __u16 buf_len, __u16 flags);
|
||||||
|
int wext_get_scan(const char *ifname, char *buf, __u16 buf_len);
|
||||||
|
int wext_set_mac_address(const char *ifname, char * mac);
|
||||||
|
int wext_get_mac_address(const char *ifname, char * mac);
|
||||||
|
int wext_enable_powersave(const char *ifname, __u8 lps_mode, __u8 ips_mode);
|
||||||
|
int wext_disable_powersave(const char *ifname);
|
||||||
|
int wext_set_tdma_param(const char *ifname, __u8 slot_period, __u8 rfon_period_len_1, __u8 rfon_period_len_2, __u8 rfon_period_len_3);
|
||||||
|
int wext_set_lps_dtim(const char *ifname, __u8 lps_dtim);
|
||||||
|
int wext_get_tx_power(const char *ifname, __u8 *poweridx);
|
||||||
|
int wext_set_txpower(const char *ifname, int poweridx);
|
||||||
|
int wext_get_associated_client_list(const char *ifname, void * client_list_buffer, __u16 buffer_length);
|
||||||
|
int wext_get_ap_info(const char *ifname, rtw_bss_info_t * ap_info, rtw_security_t* security);
|
||||||
|
int wext_mp_command(const char *ifname, char *cmd, int show_msg);
|
||||||
|
int wext_private_command(const char *ifname, char *cmd, int show_msg);
|
||||||
|
int wext_private_command_with_retval(const char *ifname, char *cmd, char *ret_buf, int ret_len);
|
||||||
|
void wext_wlan_indicate(unsigned int cmd, union iwreq_data *wrqu, char *extra);
|
||||||
|
int wext_set_pscan_channel(const char *ifname, __u8 *ch, __u8 *pscan_config, __u8 length);
|
||||||
|
int wext_set_autoreconnect(const char *ifname, __u8 mode, __u8 retyr_times, __u16 timeout);
|
||||||
|
int wext_get_autoreconnect(const char *ifname, __u8 *mode);
|
||||||
|
#ifdef CONFIG_CUSTOM_IE
|
||||||
|
int wext_add_custom_ie(const char *ifname, void * cus_ie, int ie_num);
|
||||||
|
int wext_update_custom_ie(const char *ifname, void * cus_ie, int ie_index);
|
||||||
|
int wext_del_custom_ie(const char *ifname);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define wext_handshake_done rltk_wlan_handshake_done
|
||||||
|
|
||||||
|
#ifdef CONFIG_P2P_NEW
|
||||||
|
int wext_send_mgnt(const char *ifname, char *buf, __u16 buf_len, __u16 flags);
|
||||||
|
#endif
|
||||||
|
int wext_set_gen_ie(const char *ifname, char *buf, __u16 buf_len, __u16 flags);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _UTIL_H */
|
|
@ -0,0 +1,35 @@
|
||||||
|
#ifndef _SDIO_HOST_H
|
||||||
|
#define _SDIO_HOST_H
|
||||||
|
#include "basic_types.h"
|
||||||
|
|
||||||
|
typedef enum{
|
||||||
|
SDIO_INIT_NONE = -1,
|
||||||
|
SDIO_INIT_FAIL = 0,
|
||||||
|
SDIO_INIT_OK = 1,
|
||||||
|
SDIO_SD_NONE = 2,
|
||||||
|
SDIO_SD_OK = 3,
|
||||||
|
}_sdio_init_s;
|
||||||
|
|
||||||
|
|
||||||
|
s8 sdio_init_host(void); // init sdio host interface
|
||||||
|
void sdio_deinit_host(void);
|
||||||
|
|
||||||
|
s8 sdio_sd_init(void); // init sd card through sdio
|
||||||
|
void sdio_sd_deinit(void); //de-init sd card through sdio
|
||||||
|
s8 sdio_sd_status(void);
|
||||||
|
u32 sdio_sd_getCapacity(void);
|
||||||
|
s8 sdio_sd_getProtection(void);
|
||||||
|
#ifdef ARDUINO_SDK
|
||||||
|
// protected is c++ keyword
|
||||||
|
s8 sdio_sd_setProtection(bool protection);
|
||||||
|
#else
|
||||||
|
s8 sdio_sd_setProtection(bool protected);
|
||||||
|
#endif
|
||||||
|
s8 sdio_sd_getCSD(u8* CSD);
|
||||||
|
s8 sdio_sd_isReady();
|
||||||
|
|
||||||
|
|
||||||
|
s8 sdio_read_blocks(u32 sector, u8 *buffer, u32 count);
|
||||||
|
s8 sdio_write_blocks(u32 sector, const u8 *buffer, u32 count);
|
||||||
|
|
||||||
|
#endif
|
369
sdk/component/common/drivers/wlan/realtek/include/autoconf.h
Normal file
369
sdk/component/common/drivers/wlan/realtek/include/autoconf.h
Normal file
|
@ -0,0 +1,369 @@
|
||||||
|
#ifndef WLANCONFIG_H
|
||||||
|
#define WLANCONFIG_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Include user defined options first. Anything not defined in these files
|
||||||
|
* will be set to standard values. Override anything you dont like!
|
||||||
|
*/
|
||||||
|
#if defined(CONFIG_PLATFORM_8195A) || defined(CONFIG_PLATFORM_8711B)
|
||||||
|
#include "platform_opts.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_PLATFORM_8195A) || defined(CONFIG_PLATFORM_8711B)
|
||||||
|
#define CONFIG_PLATFORM_AMEBA_X
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define PLATFORM_FREERTOS 1
|
||||||
|
#define CONFIG_GSPI_HCI
|
||||||
|
#else
|
||||||
|
#define CONFIG_LX_HCI
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_INIC_EN
|
||||||
|
#define CONFIG_INIC_EN 0 //For iNIC project
|
||||||
|
#if CONFIG_INIC_EN
|
||||||
|
#define CONFIG_LWIP_LAYER 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define CONFIG_LITTLE_ENDIAN
|
||||||
|
#define CONFIG_80211N_HT
|
||||||
|
//#define CONFIG_RECV_REORDERING_CTRL
|
||||||
|
#define RTW_NOTCH_FILTER 0
|
||||||
|
#define CONFIG_EMBEDDED_FWIMG 1
|
||||||
|
#define CONFIG_PHY_SETTING_WITH_ODM
|
||||||
|
#if !defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define CONFIG_ODM_REFRESH_RAMASK
|
||||||
|
#define HAL_MAC_ENABLE 1
|
||||||
|
#define HAL_BB_ENABLE 1
|
||||||
|
#define HAL_RF_ENABLE 1
|
||||||
|
#endif
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
/* Patch when dynamic mechanism is not ready */
|
||||||
|
//#define CONFIG_DM_PATCH
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//#define CONFIG_DEBUG
|
||||||
|
//#define CONFIG_DEBUG_RTL871X
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define CONFIG_MEM_MONITOR MEM_MONITOR_SIMPLE
|
||||||
|
#define WLAN_INTF_DBG 0
|
||||||
|
#define CONFIG_DEBUG_DYNAMIC
|
||||||
|
//#define DBG_TX 1
|
||||||
|
//#define DBG_XMIT_BUF 1
|
||||||
|
//#define DBG_XMIT_BUF_EXT 1
|
||||||
|
#define DBG_TX_DROP_FRAME
|
||||||
|
#else
|
||||||
|
#define CONFIG_MEM_MONITOR MEM_MONITOR_LEAK
|
||||||
|
//#define CONFIG_TRACE_SKB
|
||||||
|
//#define WLAN_INTF_DBG
|
||||||
|
#endif // CONFIG_PLATFORM_AMEBA_X
|
||||||
|
|
||||||
|
//#define CONFIG_DONT_CARE_TP
|
||||||
|
//#define CONFIG_MEMORY_ACCESS_ALIGNED
|
||||||
|
#define CONFIG_POWER_SAVING
|
||||||
|
#ifdef CONFIG_POWER_SAVING
|
||||||
|
#define CONFIG_IPS
|
||||||
|
#define CONFIG_LPS
|
||||||
|
//#define CONFIG_LPS_LCLK
|
||||||
|
#define CONFIG_LPS_32K
|
||||||
|
#define TDMA_POWER_SAVING
|
||||||
|
#define CONFIG_WAIT_PS_ACK
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#if !defined(CONFIG_PLATFORM_8711B)
|
||||||
|
#define CONFIG_USE_TCM_HEAP 1 /* USE TCM HEAP */
|
||||||
|
#endif
|
||||||
|
#define CONFIG_RECV_TASKLET_THREAD
|
||||||
|
#define CONFIG_XMIT_TASKLET_THREAD
|
||||||
|
#else
|
||||||
|
#define CONFIG_XMIT_THREAD_MODE
|
||||||
|
#endif // CONFIG_PLATFORM_AMEBA_X
|
||||||
|
//#define CONFIG_RECV_THREAD_MODE /* Wlan IRQ Polling Mode*/
|
||||||
|
//#define CONFIG_ISR_THREAD_MODE_POLLING /* Wlan IRQ Polling Mode*/
|
||||||
|
|
||||||
|
//1 Chris
|
||||||
|
#ifndef CONFIG_SDIO_HCI
|
||||||
|
#define CONFIG_ISR_THREAD_MODE_INTERRUPT /* Wlan IRQ Interrupt Mode*/
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_ISR_THREAD_MODE_POLLING) && defined(CONFIG_ISR_THREAD_MODE_INTERRUPT)
|
||||||
|
#error "CONFIG_ISR_THREAD_MODE_POLLING and CONFIG_ISR_THREAD_MODE_INTERRUPT are mutually exclusive. "
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
/* CRC DMEM optimized mode consume 1k less SRM memory consumption */
|
||||||
|
#define CRC_IMPLEMENTATION_MODE CRC_IMPLEMENTATION_DMEM_OPTIMIZED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* AES DMEM optimized mode comsume 10k less memory compare to
|
||||||
|
IMEM optimized mode AES_IMPLEMENTATION_IMEM_OPTIMIZED */
|
||||||
|
#define AES_IMPLEMENTATION_MODE AES_IMPLEMENTATION_DMEM_OPTIMIZED
|
||||||
|
|
||||||
|
#define USE_SKB_AS_XMITBUF 1
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define USE_XMIT_EXTBUFF 1
|
||||||
|
#else
|
||||||
|
#define USE_XMIT_EXTBUFF 0
|
||||||
|
#endif
|
||||||
|
#define USE_MUTEX_FOR_SPINLOCK 1
|
||||||
|
#define SUPPORT_5G_CHANNEL 0
|
||||||
|
#define SUPPORT_ONLY_HT_1T 1
|
||||||
|
#define SUPPORT_FAKE_EFUSE 0
|
||||||
|
|
||||||
|
#define CONFIG_AUTO_RECONNECT 1
|
||||||
|
#define ENABLE_HWPDN_PIN
|
||||||
|
#define SUPPORT_SCAN_BUF 1
|
||||||
|
#if !defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define BE_I_CUT 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For WPA2 */
|
||||||
|
#define CONFIG_INCLUDE_WPA_PSK
|
||||||
|
#ifdef CONFIG_INCLUDE_WPA_PSK
|
||||||
|
#define CONFIG_MULTIPLE_WPA_STA
|
||||||
|
//#define CONFIG_WPA2_PREAUTH
|
||||||
|
#define PSK_SUPPORT_TKIP 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For promiscuous mode */
|
||||||
|
#define CONFIG_PROMISC
|
||||||
|
|
||||||
|
#define PROMISC_DENY_PAIRWISE 0
|
||||||
|
|
||||||
|
/* For Simple Link */
|
||||||
|
#ifndef CONFIG_INCLUDE_SIMPLE_CONFIG
|
||||||
|
//#define CONFIG_INCLUDE_SIMPLE_CONFIG 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// for probe request with custom vendor specific IE
|
||||||
|
#define CONFIG_CUSTOM_IE
|
||||||
|
|
||||||
|
#if !defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
/* For multicast */
|
||||||
|
#define CONFIG_MULTICAST
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For STA+AP Concurrent MODE */
|
||||||
|
#if !defined(CONFIG_PLATFORM_8711B)
|
||||||
|
#define CONFIG_CONCURRENT_MODE
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_CONCURRENT_MODE
|
||||||
|
#if defined(CONFIG_PLATFORM_8195A)
|
||||||
|
#define CONFIG_RUNTIME_PORT_SWITCH
|
||||||
|
#endif
|
||||||
|
#define NET_IF_NUM 2
|
||||||
|
#else
|
||||||
|
#define NET_IF_NUM 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* For WPS and P2P */
|
||||||
|
#ifndef CONFIG_WPS
|
||||||
|
#define CONFIG_WPS
|
||||||
|
#if defined(CONFIG_WPS)
|
||||||
|
#define CONFIG_ENABLE_WPS 1
|
||||||
|
#endif
|
||||||
|
#if 0//def CONFIG_WPS
|
||||||
|
#define CONFIG_WPS_AP
|
||||||
|
#define CONFIG_P2P_NEW
|
||||||
|
#if (!defined(SUPPORT_SCAN_BUF)||!defined(CONFIG_WPS_AP)) && defined(CONFIG_P2P_NEW)
|
||||||
|
#error "If CONFIG_P2P_NEW, need to SUPPORT_SCAN_BUF"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define CONFIG_NEW_SIGNAL_STAT_PROCESS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For AP_MODE */
|
||||||
|
#define CONFIG_AP_MODE
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define AP_STA_NUM 3 //2014/10/27 modify to 3
|
||||||
|
#define USE_DEDICATED_BCN_TX 0
|
||||||
|
#if USE_DEDICATED_BCN_TX
|
||||||
|
#error "WLAN driver for Ameba should not enable USE_DEDICATED_BCN_TX"
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
extern unsigned int g_ap_sta_num;
|
||||||
|
#define AP_STA_NUM g_ap_sta_num
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_AP_MODE
|
||||||
|
#define CONFIG_NATIVEAP_MLME
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define CONFIG_INTERRUPT_BASED_TXBCN
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_INTERRUPT_BASED_TXBCN
|
||||||
|
//#define CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
|
||||||
|
#define CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
|
||||||
|
#endif
|
||||||
|
// #define CONFIG_GK_REKEY
|
||||||
|
#if !defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define USE_DEDICATED_BCN_TX 1
|
||||||
|
#endif
|
||||||
|
#if CONFIG_INIC_EN
|
||||||
|
#define REPORT_STA_EVENT
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#if !defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define USE_DEDICATED_BCN_TX 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_AP_MODE) && defined(CONFIG_GK_REKEY) && !defined(CONFIG_MULTIPLE_WPA_STA)
|
||||||
|
#error "If CONFIG_GK_REKEY when CONFIG_AP_MODE, need to CONFIG_MULTIPLE_WPA_STA"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#if !defined(CONFIG_AP_MODE) && defined(CONFIG_CONCURRENT_MODE)
|
||||||
|
#error "If CONFIG_CONCURRENT_MODEE, need to CONFIG_AP_MODE"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For efuse or flash config */
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define CONFIG_RW_PHYSICAL_EFUSE 0 // Mask efuse user blocks
|
||||||
|
#define CONFIG_HIDE_PROTECT_EFUSE 1
|
||||||
|
#define CONFIG_ADAPTOR_INFO_CACHING_FLASH 1
|
||||||
|
#define CHECK_FLASH_VALID_MASK 1
|
||||||
|
/* For K-free */
|
||||||
|
#if !defined(CONFIG_PLATFORM_8711B)
|
||||||
|
#define CONFIG_RF_GAIN_OFFSET
|
||||||
|
#endif
|
||||||
|
#endif // CONFIG_PLATFORM_AMEBA_X
|
||||||
|
|
||||||
|
/* For MP_MODE */
|
||||||
|
//#define CONFIG_MP_INCLUDED
|
||||||
|
#ifdef CONFIG_MP_INCLUDED
|
||||||
|
#define MP_DRIVER 1
|
||||||
|
#define CONFIG_MP_IWPRIV_SUPPORT
|
||||||
|
// #define HAL_EFUSE_MEMORY
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define MP_REG_TEST
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define MP_DRIVER 0
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
//Control wifi mcu function
|
||||||
|
#define CONFIG_LITTLE_WIFI_MCU_FUNCTION_THREAD
|
||||||
|
#define CONFIG_ODM_REFRESH_RAMASK
|
||||||
|
#endif
|
||||||
|
#endif // #ifdef CONFIG_MP_INCLUDED
|
||||||
|
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#if defined(CONFIG_PLATFORM_8195A)
|
||||||
|
#define CONFIG_RTL8195A
|
||||||
|
#endif
|
||||||
|
#if defined(CONFIG_PLATFORM_8711B)
|
||||||
|
#define CONFIG_RTL8711B
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define CONFIG_RTL8188E
|
||||||
|
#endif
|
||||||
|
#define RTL8192C_SUPPORT 0
|
||||||
|
#define RTL8192CE_SUPPORT 0
|
||||||
|
#define RTL8192CU_SUPPORT 0
|
||||||
|
#define RTL8192D_SUPPORT 0
|
||||||
|
#define RTL8192DE_SUPPORT 0
|
||||||
|
#define RTL8192DU_SUPPORT 0
|
||||||
|
#define RTL8723A_SUPPORT 0
|
||||||
|
#define RTL8723AU_SUPPORT 0
|
||||||
|
#define RTL8723AS_SUPPORT 0
|
||||||
|
#define RTL8192E_SUPPORT 0
|
||||||
|
#define RTL8812A_SUPPORT 0
|
||||||
|
#define RTL8821A_SUPPORT 0
|
||||||
|
#define RTL8723B_SUPPORT 0
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define RTL8195A_SUPPORT 1
|
||||||
|
#define RTL8188E_SUPPORT 0
|
||||||
|
#else
|
||||||
|
#define RTL8188E_SUPPORT 1
|
||||||
|
#define RTL8195A_SUPPORT 0
|
||||||
|
#endif
|
||||||
|
#define TEST_CHIP_SUPPORT 0
|
||||||
|
|
||||||
|
#define RTL8188E_FOR_TEST_CHIP 0
|
||||||
|
#define RTL8188E_FPGA_TRUE_PHY_VERIFICATION 0
|
||||||
|
|
||||||
|
// for Debug message
|
||||||
|
#define DBG 0
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#if(DBG == 0)
|
||||||
|
#define ROM_E_RTW_MSG 1
|
||||||
|
/* For DM debug*/
|
||||||
|
// BB
|
||||||
|
#define DBG_RX_INFO 1
|
||||||
|
#define DBG_TX_RATE 1 // DebugComponents: bit9
|
||||||
|
#define DBG_DM_RA 1 // DebugComponents: bit9
|
||||||
|
#define DBG_DM_DIG 1 // DebugComponents: bit0
|
||||||
|
// RF
|
||||||
|
#define DBG_PWR_TRACKING 1 // DebugComponents: bit24
|
||||||
|
#define DBG_RF_IQK 1 // DebugComponents: bit26
|
||||||
|
// Common
|
||||||
|
#define DBG_PWR_INDEX 1 // DebugComponents: bit30
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For DM support */
|
||||||
|
#define RATE_ADAPTIVE_SUPPORT 1
|
||||||
|
#define CONFIG_RTW_ADAPTIVITY_EN 0
|
||||||
|
#define RTW_ADAPTIVITY_MODE_NORMAL 0
|
||||||
|
#define RTW_ADAPTIVITY_MODE_CARRIER_SENSE 1
|
||||||
|
#define CONFIG_RTW_ADAPTIVITY_MODE RTW_ADAPTIVITY_MODE_CARRIER_SENSE
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define CONFIG_POWER_TRAINING_WIL 0 // in RA
|
||||||
|
#else
|
||||||
|
#define POWER_BY_RATE_SUPPORT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define RTL8195A_FOR_TEST_CHIP 0
|
||||||
|
|
||||||
|
//#define CONFIG_WIFI_TEST 1
|
||||||
|
//#define CONFIG_MAC_LOOPBACK_DRIVER 1
|
||||||
|
//#define CONFIG_WLAN_HAL_TEST 1
|
||||||
|
//#define SKB_PRE_ALLOCATE_TX 1
|
||||||
|
#define SKB_PRE_ALLOCATE_RX 0
|
||||||
|
#define TX_CHECK_DSEC_ALWAYS 1
|
||||||
|
#define CONFIG_DBG_DISABLE_RDU_INTERRUPT
|
||||||
|
//#define CONFIG_WLAN_HAL_RX_TASK
|
||||||
|
#if (SKB_PRE_ALLOCATE_RX == 1)
|
||||||
|
#define EXCHANGE_LXBUS_RX_SKB 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//Enable mac loopback for test mode (Ameba)
|
||||||
|
//#define ENABLE_MAC_LB_FOR_TEST_MODE // for test mode
|
||||||
|
#ifdef ENABLE_MAC_LB_FOR_TEST_MODE
|
||||||
|
#define CONFIG_SUDO_PHY_SETTING
|
||||||
|
#define INT_HANDLE_IN_ISR 1
|
||||||
|
#define CONFIG_LWIP_LAYER 0
|
||||||
|
#define CONFIG_WLAN_HAL_TEST
|
||||||
|
#define CONFIG_WLAN_HAL_RX_TASK
|
||||||
|
#define CONFIG_MAC_LOOPBACK_DRIVER_RTL8195A 1
|
||||||
|
//#define CONFIG_TWO_MAC_TEST_MODE
|
||||||
|
#define DISABLE_BB_RF 1
|
||||||
|
#else
|
||||||
|
//#define CONFIG_TWO_MAC_DRIVER //for mornal driver; two mac
|
||||||
|
#ifdef CONFIG_TWO_MAC_DRIVER
|
||||||
|
#define CONFIG_SUDO_PHY_SETTING
|
||||||
|
#define DISABLE_BB_RF 1
|
||||||
|
#else
|
||||||
|
#define HAL_MAC_ENABLE 1
|
||||||
|
#define HAL_BB_ENABLE 1
|
||||||
|
#define HAL_RF_ENABLE 1
|
||||||
|
#define DISABLE_BB_RF 0
|
||||||
|
#endif
|
||||||
|
//#define INT_HANDLE_IN_ISR 1
|
||||||
|
#endif
|
||||||
|
#endif // CONFIG_PLATFORM_AMEBA_X
|
||||||
|
|
||||||
|
#ifndef CONFIG_LWIP_LAYER
|
||||||
|
#define CONFIG_LWIP_LAYER 1
|
||||||
|
#endif
|
||||||
|
#define CONFIG_MAC_ADDRESS 0
|
||||||
|
//fast reconnection
|
||||||
|
//#define CONFIG_FAST_RECONNECTION 1
|
||||||
|
#endif //WLANCONFIG_H
|
|
@ -0,0 +1,425 @@
|
||||||
|
#ifndef _WIFI_CONSTANTS_H
|
||||||
|
#define _WIFI_CONSTANTS_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define WEP_ENABLED 0x0001
|
||||||
|
#define TKIP_ENABLED 0x0002
|
||||||
|
#define AES_ENABLED 0x0004
|
||||||
|
#define WSEC_SWFLAG 0x0008
|
||||||
|
|
||||||
|
#define SHARED_ENABLED 0x00008000
|
||||||
|
#define WPA_SECURITY 0x00200000
|
||||||
|
#define WPA2_SECURITY 0x00400000
|
||||||
|
#define WPS_ENABLED 0x10000000
|
||||||
|
|
||||||
|
#define RTW_MAX_PSK_LEN (64)
|
||||||
|
#define RTW_MIN_PSK_LEN (8)
|
||||||
|
|
||||||
|
#define MCSSET_LEN 16
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
RTW_SUCCESS = 0, /**< Success */
|
||||||
|
RTW_PENDING = 1, /**< Pending */
|
||||||
|
RTW_TIMEOUT = 2, /**< Timeout */
|
||||||
|
RTW_PARTIAL_RESULTS = 3, /**< Partial results */
|
||||||
|
RTW_INVALID_KEY = 4, /**< Invalid key */
|
||||||
|
RTW_DOES_NOT_EXIST = 5, /**< Does not exist */
|
||||||
|
RTW_NOT_AUTHENTICATED = 6, /**< Not authenticated */
|
||||||
|
RTW_NOT_KEYED = 7, /**< Not keyed */
|
||||||
|
RTW_IOCTL_FAIL = 8, /**< IOCTL fail */
|
||||||
|
RTW_BUFFER_UNAVAILABLE_TEMPORARY = 9, /**< Buffer unavailable temporarily */
|
||||||
|
RTW_BUFFER_UNAVAILABLE_PERMANENT = 10, /**< Buffer unavailable permanently */
|
||||||
|
RTW_WPS_PBC_OVERLAP = 11, /**< WPS PBC overlap */
|
||||||
|
RTW_CONNECTION_LOST = 12, /**< Connection lost */
|
||||||
|
|
||||||
|
RTW_ERROR = -1, /**< Generic Error */
|
||||||
|
RTW_BADARG = -2, /**< Bad Argument */
|
||||||
|
RTW_BADOPTION = -3, /**< Bad option */
|
||||||
|
RTW_NOTUP = -4, /**< Not up */
|
||||||
|
RTW_NOTDOWN = -5, /**< Not down */
|
||||||
|
RTW_NOTAP = -6, /**< Not AP */
|
||||||
|
RTW_NOTSTA = -7, /**< Not STA */
|
||||||
|
RTW_BADKEYIDX = -8, /**< BAD Key Index */
|
||||||
|
RTW_RADIOOFF = -9, /**< Radio Off */
|
||||||
|
RTW_NOTBANDLOCKED = -10, /**< Not band locked */
|
||||||
|
RTW_NOCLK = -11, /**< No Clock */
|
||||||
|
RTW_BADRATESET = -12, /**< BAD Rate valueset */
|
||||||
|
RTW_BADBAND = -13, /**< BAD Band */
|
||||||
|
RTW_BUFTOOSHORT = -14, /**< Buffer too short */
|
||||||
|
RTW_BUFTOOLONG = -15, /**< Buffer too long */
|
||||||
|
RTW_BUSY = -16, /**< Busy */
|
||||||
|
RTW_NOTASSOCIATED = -17, /**< Not Associated */
|
||||||
|
RTW_BADSSIDLEN = -18, /**< Bad SSID len */
|
||||||
|
RTW_OUTOFRANGECHAN = -19, /**< Out of Range Channel */
|
||||||
|
RTW_BADCHAN = -20, /**< Bad Channel */
|
||||||
|
RTW_BADADDR = -21, /**< Bad Address */
|
||||||
|
RTW_NORESOURCE = -22, /**< Not Enough Resources */
|
||||||
|
RTW_UNSUPPORTED = -23, /**< Unsupported */
|
||||||
|
RTW_BADLEN = -24, /**< Bad length */
|
||||||
|
RTW_NOTREADY = -25, /**< Not Ready */
|
||||||
|
RTW_EPERM = -26, /**< Not Permitted */
|
||||||
|
RTW_NOMEM = -27, /**< No Memory */
|
||||||
|
RTW_ASSOCIATED = -28, /**< Associated */
|
||||||
|
RTW_RANGE = -29, /**< Not In Range */
|
||||||
|
RTW_NOTFOUND = -30, /**< Not Found */
|
||||||
|
RTW_WME_NOT_ENABLED = -31, /**< WME Not Enabled */
|
||||||
|
RTW_TSPEC_NOTFOUND = -32, /**< TSPEC Not Found */
|
||||||
|
RTW_ACM_NOTSUPPORTED = -33, /**< ACM Not Supported */
|
||||||
|
RTW_NOT_WME_ASSOCIATION = -34, /**< Not WME Association */
|
||||||
|
RTW_SDIO_ERROR = -35, /**< SDIO Bus Error */
|
||||||
|
RTW_WLAN_DOWN = -36, /**< WLAN Not Accessible */
|
||||||
|
RTW_BAD_VERSION = -37, /**< Incorrect version */
|
||||||
|
RTW_TXFAIL = -38, /**< TX failure */
|
||||||
|
RTW_RXFAIL = -39, /**< RX failure */
|
||||||
|
RTW_NODEVICE = -40, /**< Device not present */
|
||||||
|
RTW_UNFINISHED = -41, /**< To be finished */
|
||||||
|
RTW_NONRESIDENT = -42, /**< access to nonresident overlay */
|
||||||
|
RTW_DISABLED = -43 /**< Disabled in this build */
|
||||||
|
} rtw_result_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_SECURITY_OPEN = 0, /**< Open security */
|
||||||
|
RTW_SECURITY_WEP_PSK = WEP_ENABLED, /**< WEP Security with open authentication */
|
||||||
|
RTW_SECURITY_WEP_SHARED = ( WEP_ENABLED | SHARED_ENABLED ), /**< WEP Security with shared authentication */
|
||||||
|
RTW_SECURITY_WPA_TKIP_PSK = ( WPA_SECURITY | TKIP_ENABLED ), /**< WPA Security with TKIP */
|
||||||
|
RTW_SECURITY_WPA_AES_PSK = ( WPA_SECURITY | AES_ENABLED ), /**< WPA Security with AES */
|
||||||
|
RTW_SECURITY_WPA2_AES_PSK = ( WPA2_SECURITY | AES_ENABLED ), /**< WPA2 Security with AES */
|
||||||
|
RTW_SECURITY_WPA2_TKIP_PSK = ( WPA2_SECURITY | TKIP_ENABLED ), /**< WPA2 Security with TKIP */
|
||||||
|
RTW_SECURITY_WPA2_MIXED_PSK = ( WPA2_SECURITY | AES_ENABLED | TKIP_ENABLED ), /**< WPA2 Security with AES & TKIP */
|
||||||
|
RTW_SECURITY_WPA_WPA2_MIXED = ( WPA_SECURITY | WPA2_SECURITY ), /**< WPA/WPA2 Security */
|
||||||
|
|
||||||
|
RTW_SECURITY_WPS_OPEN = WPS_ENABLED, /**< WPS with open security */
|
||||||
|
RTW_SECURITY_WPS_SECURE = (WPS_ENABLED | AES_ENABLED), /**< WPS with AES security */
|
||||||
|
|
||||||
|
RTW_SECURITY_UNKNOWN = -1, /**< May be returned by scan function if security is unknown. Do not pass this to the join function! */
|
||||||
|
|
||||||
|
RTW_SECURITY_FORCE_32_BIT = 0x7fffffff /**< Exists only to force rtw_security_t type to 32 bits */
|
||||||
|
} rtw_security_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_ENCRYPTION_UNKNOWN = 0,
|
||||||
|
RTW_ENCRYPTION_OPEN = 1,
|
||||||
|
RTW_ENCRYPTION_WEP40 = 2,
|
||||||
|
RTW_ENCRYPTION_WPA_TKIP = 3,
|
||||||
|
RTW_ENCRYPTION_WPA_AES = 4,
|
||||||
|
RTW_ENCRYPTION_WPA2_TKIP = 5,
|
||||||
|
RTW_ENCRYPTION_WPA2_AES = 6,
|
||||||
|
RTW_ENCRYPTION_WPA2_MIXED = 7,
|
||||||
|
RTW_ENCRYPTION_WEP104 = 9,
|
||||||
|
RTW_ENCRYPTION_UNDEF = 0xFF,
|
||||||
|
} rtw_encryption_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_FALSE = 0,
|
||||||
|
RTW_TRUE = 1
|
||||||
|
} rtw_bool_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_802_11_BAND_5GHZ = 0, /**< Denotes 5GHz radio band */
|
||||||
|
RTW_802_11_BAND_2_4GHZ = 1 /**< Denotes 2.4GHz radio band */
|
||||||
|
} rtw_802_11_band_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
|
||||||
|
|
||||||
|
/* SPECIAL */
|
||||||
|
RTW_COUNTRY_WORLD,
|
||||||
|
RTW_COUNTRY_EU,
|
||||||
|
|
||||||
|
/* JAPANESE */
|
||||||
|
RTW_COUNTRY_JP,
|
||||||
|
|
||||||
|
/* FCC , 19 countries*/
|
||||||
|
RTW_COUNTRY_AS,
|
||||||
|
RTW_COUNTRY_BM,
|
||||||
|
RTW_COUNTRY_CA,
|
||||||
|
RTW_COUNTRY_DM,
|
||||||
|
RTW_COUNTRY_DO,
|
||||||
|
RTW_COUNTRY_FM,
|
||||||
|
RTW_COUNTRY_GD,
|
||||||
|
RTW_COUNTRY_GT,
|
||||||
|
RTW_COUNTRY_GU,
|
||||||
|
RTW_COUNTRY_HT,
|
||||||
|
RTW_COUNTRY_MH,
|
||||||
|
RTW_COUNTRY_MP,
|
||||||
|
RTW_COUNTRY_NI,
|
||||||
|
RTW_COUNTRY_PA,
|
||||||
|
RTW_COUNTRY_PR,
|
||||||
|
RTW_COUNTRY_PW,
|
||||||
|
RTW_COUNTRY_TW,
|
||||||
|
RTW_COUNTRY_US,
|
||||||
|
RTW_COUNTRY_VI,
|
||||||
|
|
||||||
|
/* others, ETSI */
|
||||||
|
RTW_COUNTRY_AD,
|
||||||
|
RTW_COUNTRY_AE,
|
||||||
|
RTW_COUNTRY_AF,
|
||||||
|
RTW_COUNTRY_AI,
|
||||||
|
RTW_COUNTRY_AL,
|
||||||
|
RTW_COUNTRY_AM,
|
||||||
|
RTW_COUNTRY_AN,
|
||||||
|
RTW_COUNTRY_AR,
|
||||||
|
RTW_COUNTRY_AT,
|
||||||
|
RTW_COUNTRY_AU,
|
||||||
|
RTW_COUNTRY_AW,
|
||||||
|
RTW_COUNTRY_AZ,
|
||||||
|
RTW_COUNTRY_BA,
|
||||||
|
RTW_COUNTRY_BB,
|
||||||
|
RTW_COUNTRY_BD,
|
||||||
|
RTW_COUNTRY_BE,
|
||||||
|
RTW_COUNTRY_BF,
|
||||||
|
RTW_COUNTRY_BG,
|
||||||
|
RTW_COUNTRY_BH,
|
||||||
|
RTW_COUNTRY_BL,
|
||||||
|
RTW_COUNTRY_BN,
|
||||||
|
RTW_COUNTRY_BO,
|
||||||
|
RTW_COUNTRY_BR,
|
||||||
|
RTW_COUNTRY_BS,
|
||||||
|
RTW_COUNTRY_BT,
|
||||||
|
RTW_COUNTRY_BY,
|
||||||
|
RTW_COUNTRY_BZ,
|
||||||
|
RTW_COUNTRY_CF,
|
||||||
|
RTW_COUNTRY_CH,
|
||||||
|
RTW_COUNTRY_CI,
|
||||||
|
RTW_COUNTRY_CL,
|
||||||
|
RTW_COUNTRY_CN,
|
||||||
|
RTW_COUNTRY_CO,
|
||||||
|
RTW_COUNTRY_CR,
|
||||||
|
RTW_COUNTRY_CX,
|
||||||
|
RTW_COUNTRY_CY,
|
||||||
|
RTW_COUNTRY_CZ,
|
||||||
|
RTW_COUNTRY_DE,
|
||||||
|
RTW_COUNTRY_DK,
|
||||||
|
RTW_COUNTRY_DZ,
|
||||||
|
RTW_COUNTRY_EC,
|
||||||
|
RTW_COUNTRY_EE,
|
||||||
|
RTW_COUNTRY_EG,
|
||||||
|
RTW_COUNTRY_ES,
|
||||||
|
RTW_COUNTRY_ET,
|
||||||
|
RTW_COUNTRY_FI,
|
||||||
|
RTW_COUNTRY_FR,
|
||||||
|
RTW_COUNTRY_GB,
|
||||||
|
RTW_COUNTRY_GE,
|
||||||
|
RTW_COUNTRY_GF,
|
||||||
|
RTW_COUNTRY_GH,
|
||||||
|
RTW_COUNTRY_GL,
|
||||||
|
RTW_COUNTRY_GP,
|
||||||
|
RTW_COUNTRY_GR,
|
||||||
|
RTW_COUNTRY_GY,
|
||||||
|
RTW_COUNTRY_HK,
|
||||||
|
RTW_COUNTRY_HN,
|
||||||
|
RTW_COUNTRY_HR,
|
||||||
|
RTW_COUNTRY_HU,
|
||||||
|
RTW_COUNTRY_ID,
|
||||||
|
RTW_COUNTRY_IE,
|
||||||
|
RTW_COUNTRY_IL,
|
||||||
|
RTW_COUNTRY_IN,
|
||||||
|
RTW_COUNTRY_IQ,
|
||||||
|
RTW_COUNTRY_IR,
|
||||||
|
RTW_COUNTRY_IS,
|
||||||
|
RTW_COUNTRY_IT,
|
||||||
|
RTW_COUNTRY_JM,
|
||||||
|
RTW_COUNTRY_JO,
|
||||||
|
RTW_COUNTRY_KE,
|
||||||
|
RTW_COUNTRY_KH,
|
||||||
|
RTW_COUNTRY_KN,
|
||||||
|
RTW_COUNTRY_KP,
|
||||||
|
RTW_COUNTRY_KR,
|
||||||
|
RTW_COUNTRY_KW,
|
||||||
|
RTW_COUNTRY_KY,
|
||||||
|
RTW_COUNTRY_KZ,
|
||||||
|
RTW_COUNTRY_LA,
|
||||||
|
RTW_COUNTRY_LB,
|
||||||
|
RTW_COUNTRY_LC,
|
||||||
|
RTW_COUNTRY_LI,
|
||||||
|
RTW_COUNTRY_LK,
|
||||||
|
RTW_COUNTRY_LR,
|
||||||
|
RTW_COUNTRY_LS,
|
||||||
|
RTW_COUNTRY_LT,
|
||||||
|
RTW_COUNTRY_LU,
|
||||||
|
RTW_COUNTRY_LV,
|
||||||
|
RTW_COUNTRY_MA,
|
||||||
|
RTW_COUNTRY_MC,
|
||||||
|
RTW_COUNTRY_MD,
|
||||||
|
RTW_COUNTRY_ME,
|
||||||
|
RTW_COUNTRY_MF,
|
||||||
|
RTW_COUNTRY_MK,
|
||||||
|
RTW_COUNTRY_MN,
|
||||||
|
RTW_COUNTRY_MO,
|
||||||
|
RTW_COUNTRY_MQ,
|
||||||
|
RTW_COUNTRY_MR,
|
||||||
|
RTW_COUNTRY_MT,
|
||||||
|
RTW_COUNTRY_MU,
|
||||||
|
RTW_COUNTRY_MV,
|
||||||
|
RTW_COUNTRY_MW,
|
||||||
|
RTW_COUNTRY_MX,
|
||||||
|
RTW_COUNTRY_MY,
|
||||||
|
RTW_COUNTRY_NG,
|
||||||
|
RTW_COUNTRY_NL,
|
||||||
|
RTW_COUNTRY_NO,
|
||||||
|
RTW_COUNTRY_NP,
|
||||||
|
RTW_COUNTRY_NZ,
|
||||||
|
RTW_COUNTRY_OM,
|
||||||
|
RTW_COUNTRY_PE,
|
||||||
|
RTW_COUNTRY_PF,
|
||||||
|
RTW_COUNTRY_PG,
|
||||||
|
RTW_COUNTRY_PH,
|
||||||
|
RTW_COUNTRY_PK,
|
||||||
|
RTW_COUNTRY_PL,
|
||||||
|
RTW_COUNTRY_PM,
|
||||||
|
RTW_COUNTRY_PT,
|
||||||
|
RTW_COUNTRY_PY,
|
||||||
|
RTW_COUNTRY_QA,
|
||||||
|
RTW_COUNTRY_RS,
|
||||||
|
RTW_COUNTRY_RU,
|
||||||
|
RTW_COUNTRY_RW,
|
||||||
|
RTW_COUNTRY_SA,
|
||||||
|
RTW_COUNTRY_SE,
|
||||||
|
RTW_COUNTRY_SG,
|
||||||
|
RTW_COUNTRY_SI,
|
||||||
|
RTW_COUNTRY_SK,
|
||||||
|
RTW_COUNTRY_SN,
|
||||||
|
RTW_COUNTRY_SR,
|
||||||
|
RTW_COUNTRY_SV,
|
||||||
|
RTW_COUNTRY_SY,
|
||||||
|
RTW_COUNTRY_TC,
|
||||||
|
RTW_COUNTRY_TD,
|
||||||
|
RTW_COUNTRY_TG,
|
||||||
|
RTW_COUNTRY_TH,
|
||||||
|
RTW_COUNTRY_TN,
|
||||||
|
RTW_COUNTRY_TR,
|
||||||
|
RTW_COUNTRY_TT,
|
||||||
|
RTW_COUNTRY_TZ,
|
||||||
|
RTW_COUNTRY_UA,
|
||||||
|
RTW_COUNTRY_UG,
|
||||||
|
RTW_COUNTRY_UY,
|
||||||
|
RTW_COUNTRY_UZ,
|
||||||
|
RTW_COUNTRY_VC,
|
||||||
|
RTW_COUNTRY_VE,
|
||||||
|
RTW_COUNTRY_VN,
|
||||||
|
RTW_COUNTRY_VU,
|
||||||
|
RTW_COUNTRY_WF,
|
||||||
|
RTW_COUNTRY_WS,
|
||||||
|
RTW_COUNTRY_YE,
|
||||||
|
RTW_COUNTRY_YT,
|
||||||
|
RTW_COUNTRY_ZA,
|
||||||
|
RTW_COUNTRY_ZW,
|
||||||
|
|
||||||
|
RTW_COUNTRY_MAX
|
||||||
|
|
||||||
|
}rtw_country_code_t;
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_MODE_NONE = 0,
|
||||||
|
RTW_MODE_STA,
|
||||||
|
RTW_MODE_AP,
|
||||||
|
RTW_MODE_STA_AP,
|
||||||
|
RTW_MODE_PROMISC,
|
||||||
|
RTW_MODE_P2P
|
||||||
|
}rtw_mode_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_SCAN_FULL = 0,
|
||||||
|
RTW_SCAN_SOCIAL,
|
||||||
|
RTW_SCAN_ONE
|
||||||
|
}rtw_scan_mode_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_LINK_DISCONNECTED = 0,
|
||||||
|
RTW_LINK_CONNECTED
|
||||||
|
} rtw_link_status_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_SCAN_TYPE_ACTIVE = 0x00, /**< Actively scan a network by sending 802.11 probe(s) */
|
||||||
|
RTW_SCAN_TYPE_PASSIVE = 0x01, /**< Passively scan a network by listening for beacons from APs */
|
||||||
|
RTW_SCAN_TYPE_PROHIBITED_CHANNELS = 0x04 /**< Passively scan on channels not enabled by the country code */
|
||||||
|
} rtw_scan_type_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_BSS_TYPE_INFRASTRUCTURE = 0, /**< Denotes infrastructure network */
|
||||||
|
RTW_BSS_TYPE_ADHOC = 1, /**< Denotes an 802.11 ad-hoc IBSS network */
|
||||||
|
RTW_BSS_TYPE_ANY = 2, /**< Denotes either infrastructure or ad-hoc network */
|
||||||
|
|
||||||
|
RTW_BSS_TYPE_UNKNOWN = -1 /**< May be returned by scan function if BSS type is unknown. Do not pass this to the Join function */
|
||||||
|
} rtw_bss_type_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_SCAN_COMMAMD = 0x01
|
||||||
|
} rtw_scan_command_t;
|
||||||
|
|
||||||
|
typedef enum{
|
||||||
|
COMMAND1 = 0x01
|
||||||
|
}rtw_command_type;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_WPS_TYPE_DEFAULT = 0x0000,
|
||||||
|
RTW_WPS_TYPE_USER_SPECIFIED = 0x0001,
|
||||||
|
RTW_WPS_TYPE_MACHINE_SPECIFIED = 0x0002,
|
||||||
|
RTW_WPS_TYPE_REKEY = 0x0003,
|
||||||
|
RTW_WPS_TYPE_PUSHBUTTON = 0x0004,
|
||||||
|
RTW_WPS_TYPE_REGISTRAR_SPECIFIED = 0x0005,
|
||||||
|
RTW_WPS_TYPE_NONE = 0x0006
|
||||||
|
} rtw_wps_type_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_NETWORK_B = 1,
|
||||||
|
RTW_NETWORK_BG = 3,
|
||||||
|
RTW_NETWORK_BGN = 11
|
||||||
|
} rtw_network_mode_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_STA_INTERFACE = 0, /**< STA or Client Interface */
|
||||||
|
RTW_AP_INTERFACE = 1, /**< softAP Interface */
|
||||||
|
} rtw_interface_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enumeration of packet filter rules
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
RTW_POSITIVE_MATCHING = 0, /**< Specifies that a filter should match a given pattern */
|
||||||
|
RTW_NEGATIVE_MATCHING = 1 /**< Specifies that a filter should NOT match a given pattern */
|
||||||
|
} rtw_packet_filter_rule_e;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_PROMISC_DISABLE = 0, /**< disable the promisc */
|
||||||
|
RTW_PROMISC_ENABLE = 1, /**< fetch all ethernet packets */
|
||||||
|
RTW_PROMISC_ENABLE_1 = 2, /**< fetch only B/M packets */
|
||||||
|
RTW_PROMISC_ENABLE_2 = 3, /**< fetch all 802.11 packets*/
|
||||||
|
RTW_PROMISC_ENABLE_3 = 4, /**< fetch only B/M 802.11 packets*/
|
||||||
|
} rtw_rcr_level_t;
|
||||||
|
|
||||||
|
typedef enum{
|
||||||
|
RTW_NO_ERROR = 0,
|
||||||
|
RTW_NONE_NETWORK = 1,
|
||||||
|
RTW_CONNECT_FAIL = 2,
|
||||||
|
RTW_WRONG_PASSWORD = 3 ,
|
||||||
|
RTW_DHCP_FAIL = 4,
|
||||||
|
RTW_UNKNOWN,
|
||||||
|
}rtw_connect_error_flag_t;
|
||||||
|
|
||||||
|
typedef enum _WIFI_EVENT_INDICATE{
|
||||||
|
WIFI_EVENT_CONNECT = 0,
|
||||||
|
WIFI_EVENT_DISCONNECT = 1,
|
||||||
|
WIFI_EVENT_FOURWAY_HANDSHAKE_DONE = 2,
|
||||||
|
WIFI_EVENT_SCAN_RESULT_REPORT = 3,
|
||||||
|
WIFI_EVENT_SCAN_DONE = 4,
|
||||||
|
WIFI_EVENT_RECONNECTION_FAIL = 5,
|
||||||
|
WIFI_EVENT_SEND_ACTION_DONE = 6,
|
||||||
|
WIFI_EVENT_RX_MGNT = 7,
|
||||||
|
WIFI_EVENT_STA_ASSOC = 8,
|
||||||
|
WIFI_EVENT_STA_DISASSOC = 9,
|
||||||
|
WIFI_EVENT_WPS_FINISH = 10,
|
||||||
|
WIFI_EVENT_EAPOL_RECVD = 11,
|
||||||
|
WIFI_EVENT_NO_NETWORK = 12,
|
||||||
|
WIFI_EVENT_BEACON_AFTER_DHCP = 13,
|
||||||
|
WIFI_EVENT_MAX,
|
||||||
|
}WIFI_EVENT_INDICATE;
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* _WIFI_CONSTANTS_H */
|
|
@ -0,0 +1,159 @@
|
||||||
|
#ifndef _WIFI_STRUCTURES_H
|
||||||
|
#define _WIFI_STRUCTURES_H
|
||||||
|
|
||||||
|
//#include <freertos/freertos_service.h>
|
||||||
|
#include "wifi_constants.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#pragma pack(1)
|
||||||
|
#endif
|
||||||
|
typedef struct rtw_ssid {
|
||||||
|
unsigned char len; /**< SSID length */
|
||||||
|
unsigned char val[33]; /**< SSID name (AP name) */
|
||||||
|
} rtw_ssid_t;
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#pragma pack()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#pragma pack(1)
|
||||||
|
#endif
|
||||||
|
typedef struct rtw_mac {
|
||||||
|
unsigned char octet[6]; /**< Unique 6-byte MAC address */
|
||||||
|
} rtw_mac_t;
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#pragma pack()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct rtw_ap_info {
|
||||||
|
rtw_ssid_t ssid;
|
||||||
|
rtw_security_t security_type;
|
||||||
|
unsigned char *password;
|
||||||
|
int password_len;
|
||||||
|
int channel;
|
||||||
|
}rtw_ap_info_t;
|
||||||
|
|
||||||
|
typedef struct rtw_network_info {
|
||||||
|
rtw_ssid_t ssid;
|
||||||
|
rtw_mac_t bssid;
|
||||||
|
rtw_security_t security_type;
|
||||||
|
unsigned char *password;
|
||||||
|
int password_len;
|
||||||
|
int key_id;
|
||||||
|
}rtw_network_info_t;
|
||||||
|
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#pragma pack(1)
|
||||||
|
#endif
|
||||||
|
typedef struct rtw_scan_result {
|
||||||
|
rtw_ssid_t SSID; /**< Service Set Identification (i.e. Name of Access Point) */
|
||||||
|
rtw_mac_t BSSID; /**< Basic Service Set Identification (i.e. MAC address of Access Point) */
|
||||||
|
signed short signal_strength; /**< Receive Signal Strength Indication in dBm. <-90=Very poor, >-30=Excellent */
|
||||||
|
rtw_bss_type_t bss_type; /**< Network type */
|
||||||
|
rtw_security_t security; /**< Security type */
|
||||||
|
rtw_wps_type_t wps_type; /**< WPS type */
|
||||||
|
unsigned int channel; /**< Radio channel that the AP beacon was received on */
|
||||||
|
rtw_802_11_band_t band; /**< Radio band */
|
||||||
|
} rtw_scan_result_t;
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#pragma pack()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct rtw_scan_handler_result {
|
||||||
|
rtw_scan_result_t ap_details;
|
||||||
|
rtw_bool_t scan_complete;
|
||||||
|
void* user_data;
|
||||||
|
|
||||||
|
} rtw_scan_handler_result_t;
|
||||||
|
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#pragma pack(1)
|
||||||
|
#endif
|
||||||
|
typedef struct rtw_wifi_setting {
|
||||||
|
rtw_mode_t mode;
|
||||||
|
unsigned char ssid[33];
|
||||||
|
unsigned char channel;
|
||||||
|
rtw_security_t security_type;
|
||||||
|
unsigned char password[65];
|
||||||
|
unsigned char key_idx;
|
||||||
|
}rtw_wifi_setting_t;
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#pragma pack()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct rtw_wifi_config {
|
||||||
|
unsigned int boot_mode;
|
||||||
|
unsigned char ssid[32];
|
||||||
|
unsigned char ssid_len;
|
||||||
|
unsigned char security_type;
|
||||||
|
unsigned char password[65];
|
||||||
|
unsigned char password_len;
|
||||||
|
unsigned char channel;
|
||||||
|
} rtw_wifi_config_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
unsigned int count; /**< Number of MAC addresses in the list */
|
||||||
|
rtw_mac_t mac_list[1]; /**< Variable length array of MAC addresses */
|
||||||
|
} rtw_maclist_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned int version; /* version field */
|
||||||
|
unsigned int length; /* byte length of data in this record, */
|
||||||
|
/* starting at version and including IEs */
|
||||||
|
rtw_mac_t BSSID;
|
||||||
|
unsigned short beacon_period; /* units are Kusec */
|
||||||
|
unsigned short capability; /* Capability information */
|
||||||
|
unsigned char SSID_len;
|
||||||
|
unsigned char SSID[32];
|
||||||
|
unsigned char channel;
|
||||||
|
// struct {
|
||||||
|
// uint32_t count; /* # rates in this set */
|
||||||
|
// uint8_t rates[16]; /* rates in 500kbps units w/hi bit set if basic */
|
||||||
|
// } rateset; /* supported rates */
|
||||||
|
// rtw_chanspec_t chanspec; /* chanspec for bss */
|
||||||
|
unsigned short atim_window; /* units are Kusec */
|
||||||
|
unsigned char dtim_period; /* DTIM period */
|
||||||
|
signed short RSSI; /* receive signal strength (in dBm) */
|
||||||
|
|
||||||
|
unsigned char n_cap; /* BSS is 802.11N Capable */
|
||||||
|
unsigned int nbss_cap; /* 802.11N BSS Capabilities (based on HT_CAP_*) */
|
||||||
|
unsigned char basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */
|
||||||
|
|
||||||
|
unsigned short ie_offset; /* offset at which IEs start, from beginning */
|
||||||
|
unsigned int ie_length; /* byte length of Information Elements */
|
||||||
|
} rtw_bss_info_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned short offset; /**< Offset in bytes to start filtering (referenced to the start of the ethernet packet) */
|
||||||
|
unsigned short mask_size; /**< Size of the mask in bytes */
|
||||||
|
unsigned char* mask; /**< Pattern mask bytes to be ANDed with the pattern eg. "\xff00" (must be in network byte order) */
|
||||||
|
unsigned char* pattern; /**< Pattern bytes used to filter eg. "\x0800" (must be in network byte order) */
|
||||||
|
} rtw_packet_filter_pattern_t;
|
||||||
|
|
||||||
|
typedef struct ieee80211_frame_info{
|
||||||
|
unsigned short i_fc;
|
||||||
|
unsigned short i_dur;
|
||||||
|
unsigned char i_addr1[6];
|
||||||
|
unsigned char i_addr2[6];
|
||||||
|
unsigned char i_addr3[6];
|
||||||
|
unsigned short i_seq;
|
||||||
|
unsigned char bssid[6];
|
||||||
|
unsigned char encrypt;
|
||||||
|
signed char rssi;
|
||||||
|
}ieee80211_frame_info_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char filter_id;
|
||||||
|
rtw_packet_filter_pattern_t patt;
|
||||||
|
rtw_packet_filter_rule_e rule;
|
||||||
|
unsigned char enable;
|
||||||
|
}rtw_packet_filter_info_t;
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _WIFI_STRUCTURES_H */
|
1207
sdk/component/common/drivers/wlan/realtek/src/osdep/wireless.h
Normal file
1207
sdk/component/common/drivers/wlan/realtek/src/osdep/wireless.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,65 @@
|
||||||
|
#ifndef __WLAN_INTF_H__
|
||||||
|
#define __WLAN_INTF_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
#include <autoconf.h>
|
||||||
|
|
||||||
|
#include <wireless.h>
|
||||||
|
#include "wifi_constants.h"
|
||||||
|
|
||||||
|
#ifndef WLAN0_IDX
|
||||||
|
#define WLAN0_IDX 0
|
||||||
|
#endif
|
||||||
|
#ifndef WLAN1_IDX
|
||||||
|
#define WLAN1_IDX 1
|
||||||
|
#endif
|
||||||
|
#ifndef WLAN_UNDEF
|
||||||
|
#define WLAN_UNDEF -1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/***********************************************************/
|
||||||
|
/*
|
||||||
|
struct sk_buff {
|
||||||
|
// These two members must be first.
|
||||||
|
struct sk_buff *next; // Next buffer in list
|
||||||
|
struct sk_buff *prev; // Previous buffer in list
|
||||||
|
|
||||||
|
struct sk_buff_head *list; // List we are on
|
||||||
|
unsigned char *head; // Head of buffer
|
||||||
|
unsigned char *data; // Data head pointer
|
||||||
|
unsigned char *tail; // Tail pointer
|
||||||
|
unsigned char *end; //End pointer
|
||||||
|
struct net_device *dev; //Device we arrived on/are leaving by
|
||||||
|
unsigned int len; // Length of actual data
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
/************************************************************/
|
||||||
|
|
||||||
|
//----- ------------------------------------------------------------------
|
||||||
|
// Wlan Interface opened for upper layer
|
||||||
|
//----- ------------------------------------------------------------------
|
||||||
|
int rltk_wlan_init(int idx_wlan, rtw_mode_t mode); //return 0: success. -1:fail
|
||||||
|
void rltk_wlan_deinit(void);
|
||||||
|
void rltk_wlan_start(int idx_wlan);
|
||||||
|
void rltk_wlan_statistic(unsigned char idx);
|
||||||
|
unsigned char rltk_wlan_running(unsigned char idx); // interface is up. 0: interface is down
|
||||||
|
int rltk_wlan_control(unsigned long cmd, void *data);
|
||||||
|
int rltk_wlan_handshake_done(void);
|
||||||
|
int rltk_wlan_rf_on(void);
|
||||||
|
int rltk_wlan_rf_off(void);
|
||||||
|
int rltk_wlan_check_bus(void);
|
||||||
|
int rltk_wlan_wireless_mode(unsigned char mode);
|
||||||
|
int rltk_wlan_set_wps_phase(unsigned char is_trigger_wps);
|
||||||
|
int rtw_ps_enable(int enable);
|
||||||
|
int rltk_wlan_is_connected_to_ap(void);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif //#ifndef __WLAN_INTF_H__
|
816
sdk/component/os/freertos/cmsis_os.h
Normal file
816
sdk/component/os/freertos/cmsis_os.h
Normal file
|
@ -0,0 +1,816 @@
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* $Date: 5. February 2013
|
||||||
|
* $Revision: V1.02
|
||||||
|
*
|
||||||
|
* Project: CMSIS-RTOS API
|
||||||
|
* Title: cmsis_os.h template header file
|
||||||
|
*
|
||||||
|
* Version 0.02
|
||||||
|
* Initial Proposal Phase
|
||||||
|
* Version 0.03
|
||||||
|
* osKernelStart added, optional feature: main started as thread
|
||||||
|
* osSemaphores have standard behavior
|
||||||
|
* osTimerCreate does not start the timer, added osTimerStart
|
||||||
|
* osThreadPass is renamed to osThreadYield
|
||||||
|
* Version 1.01
|
||||||
|
* Support for C++ interface
|
||||||
|
* - const attribute removed from the osXxxxDef_t typedef's
|
||||||
|
* - const attribute added to the osXxxxDef macros
|
||||||
|
* Added: osTimerDelete, osMutexDelete, osSemaphoreDelete
|
||||||
|
* Added: osKernelInitialize
|
||||||
|
* Version 1.02
|
||||||
|
* Control functions for short timeouts in microsecond resolution:
|
||||||
|
* Added: osKernelSysTick, osKernelSysTickFrequency, osKernelSysTickMicroSec
|
||||||
|
* Removed: osSignalGet
|
||||||
|
*----------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 ARM LIMITED
|
||||||
|
* All rights reserved.
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* - Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* - Neither the name of ARM nor the names of its contributors may be used
|
||||||
|
* to endorse or promote products derived from this software without
|
||||||
|
* specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "timers.h"
|
||||||
|
#include "queue.h"
|
||||||
|
#include "semphr.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define FREERTOS_VERSION 0x00080001 // bits[31:16] main version, bits[15:0] sub-version
|
||||||
|
|
||||||
|
#if FREERTOS_VERSION >= 0x00080000
|
||||||
|
#define configSignalManagementSupport 1
|
||||||
|
#else
|
||||||
|
#define configSignalManagementSupport 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if configSignalManagementSupport
|
||||||
|
#include "event_groups.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
\page cmsis_os_h Header File Template: cmsis_os.h
|
||||||
|
|
||||||
|
The file \b cmsis_os.h is a template header file for a CMSIS-RTOS compliant Real-Time Operating System (RTOS).
|
||||||
|
Each RTOS that is compliant with CMSIS-RTOS shall provide a specific \b cmsis_os.h header file that represents
|
||||||
|
its implementation.
|
||||||
|
|
||||||
|
The file cmsis_os.h contains:
|
||||||
|
- CMSIS-RTOS API function definitions
|
||||||
|
- struct definitions for parameters and return types
|
||||||
|
- status and priority values used by CMSIS-RTOS API functions
|
||||||
|
- macros for defining threads and other kernel objects
|
||||||
|
|
||||||
|
|
||||||
|
<b>Name conventions and header file modifications</b>
|
||||||
|
|
||||||
|
All definitions are prefixed with \b os to give an unique name space for CMSIS-RTOS functions.
|
||||||
|
Definitions that are prefixed \b os_ are not used in the application code but local to this header file.
|
||||||
|
All definitions and functions that belong to a module are grouped and have a common prefix, i.e. \b osThread.
|
||||||
|
|
||||||
|
Definitions that are marked with <b>CAN BE CHANGED</b> can be adapted towards the needs of the actual CMSIS-RTOS implementation.
|
||||||
|
These definitions can be specific to the underlying RTOS kernel.
|
||||||
|
|
||||||
|
Definitions that are marked with <b>MUST REMAIN UNCHANGED</b> cannot be altered. Otherwise the CMSIS-RTOS implementation is no longer
|
||||||
|
compliant to the standard. Note that some functions are optional and need not to be provided by every CMSIS-RTOS implementation.
|
||||||
|
|
||||||
|
|
||||||
|
<b>Function calls from interrupt service routines</b>
|
||||||
|
|
||||||
|
The following CMSIS-RTOS functions can be called from threads and interrupt service routines (ISR):
|
||||||
|
- \ref osSignalSet
|
||||||
|
- \ref osSemaphoreRelease
|
||||||
|
- \ref osPoolAlloc, \ref osPoolCAlloc, \ref osPoolFree
|
||||||
|
- \ref osMessagePut, \ref osMessageGet
|
||||||
|
- \ref osMailAlloc, \ref osMailCAlloc, \ref osMailGet, \ref osMailPut, \ref osMailFree
|
||||||
|
|
||||||
|
Functions that cannot be called from an ISR are verifying the interrupt status and return in case that they are called
|
||||||
|
from an ISR context the status code \b osErrorISR. In some implementations this condition might be caught using the HARD FAULT vector.
|
||||||
|
|
||||||
|
Some CMSIS-RTOS implementations support CMSIS-RTOS function calls from multiple ISR at the same time.
|
||||||
|
If this is impossible, the CMSIS-RTOS rejects calls by nested ISR functions with the status code \b osErrorISRRecursive.
|
||||||
|
|
||||||
|
|
||||||
|
<b>Define and reference object definitions</b>
|
||||||
|
|
||||||
|
With <b>\#define osObjectsExternal</b> objects are defined as external symbols. This allows to create a consistent header file
|
||||||
|
that is used throughout a project as shown below:
|
||||||
|
|
||||||
|
<i>Header File</i>
|
||||||
|
\code
|
||||||
|
#include <cmsis_os.h> // CMSIS RTOS header file
|
||||||
|
|
||||||
|
// Thread definition
|
||||||
|
extern void thread_sample (void const *argument); // function prototype
|
||||||
|
osThreadDef (thread_sample, osPriorityBelowNormal, 1, 100);
|
||||||
|
|
||||||
|
// Pool definition
|
||||||
|
osPoolDef(MyPool, 10, long);
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
|
||||||
|
This header file defines all objects when included in a C/C++ source file. When <b>\#define osObjectsExternal</b> is
|
||||||
|
present before the header file, the objects are defined as external symbols. A single consistent header file can therefore be
|
||||||
|
used throughout the whole project.
|
||||||
|
|
||||||
|
<i>Example</i>
|
||||||
|
\code
|
||||||
|
#include "osObjects.h" // Definition of the CMSIS-RTOS objects
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
\code
|
||||||
|
#define osObjectExternal // Objects will be defined as external symbols
|
||||||
|
#include "osObjects.h" // Reference to the CMSIS-RTOS objects
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _CMSIS_OS_H
|
||||||
|
#define _CMSIS_OS_H
|
||||||
|
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osCMSIS identifies the CMSIS-RTOS API version.
|
||||||
|
#define osCMSIS 0x10002 ///< API version (main [31:16] .sub [15:0])
|
||||||
|
|
||||||
|
/// \note CAN BE CHANGED: \b osCMSIS_KERNEL identifies the underlying RTOS kernel and version number.
|
||||||
|
#define osCMSIS_KERNEL 0x10000 ///< RTOS identification and version (main [31:16] .sub [15:0])
|
||||||
|
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osKernelSystemId shall be consistent in every CMSIS-RTOS.
|
||||||
|
#define osKernelSystemId "KERNEL V1.00" ///< RTOS identification string
|
||||||
|
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osFeature_xxx shall be consistent in every CMSIS-RTOS.
|
||||||
|
#define osFeature_MainThread 1 ///< main thread 1=main can be thread, 0=not available
|
||||||
|
#define osFeature_Pool 1 ///< Memory Pools: 1=available, 0=not available
|
||||||
|
#define osFeature_MailQ 1 ///< Mail Queues: 1=available, 0=not available
|
||||||
|
#define osFeature_MessageQ 1 ///< Message Queues: 1=available, 0=not available
|
||||||
|
#define osFeature_Signals 8 ///< maximum number of Signal Flags available per thread
|
||||||
|
#define osFeature_Semaphore 30 ///< maximum count for \ref osSemaphoreCreate function
|
||||||
|
#define osFeature_Wait 1 ///< osWait function: 1=available, 0=not available
|
||||||
|
#define osFeature_SysTick 1 ///< osKernelSysTick functions: 1=available, 0=not available
|
||||||
|
|
||||||
|
//#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// ==== Enumeration, structures, defines ====
|
||||||
|
|
||||||
|
/// Priority used for thread control.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osPriority shall be consistent in every CMSIS-RTOS.
|
||||||
|
typedef enum {
|
||||||
|
osPriorityIdle = -3, ///< priority: idle (lowest)
|
||||||
|
osPriorityLow = -2, ///< priority: low
|
||||||
|
osPriorityBelowNormal = -1, ///< priority: below normal
|
||||||
|
osPriorityNormal = 0, ///< priority: normal (default)
|
||||||
|
osPriorityAboveNormal = +1, ///< priority: above normal
|
||||||
|
osPriorityHigh = +2, ///< priority: high
|
||||||
|
osPriorityRealtime = +3, ///< priority: realtime (highest)
|
||||||
|
osPriorityError = 0x84 ///< system cannot determine priority or thread has illegal priority
|
||||||
|
} osPriority;
|
||||||
|
|
||||||
|
/// Timeout value.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osWaitForever shall be consistent in every CMSIS-RTOS.
|
||||||
|
#define osWaitForever 0xFFFFFFFF ///< wait forever timeout value
|
||||||
|
|
||||||
|
/// Status code values returned by CMSIS-RTOS functions.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osStatus shall be consistent in every CMSIS-RTOS.
|
||||||
|
typedef enum {
|
||||||
|
osOK = 0, ///< function completed; no error or event occurred.
|
||||||
|
osEventSignal = 0x08, ///< function completed; signal event occurred.
|
||||||
|
osEventMessage = 0x10, ///< function completed; message event occurred.
|
||||||
|
osEventMail = 0x20, ///< function completed; mail event occurred.
|
||||||
|
osEventTimeout = 0x40, ///< function completed; timeout occurred.
|
||||||
|
osErrorParameter = 0x80, ///< parameter error: a mandatory parameter was missing or specified an incorrect object.
|
||||||
|
osErrorResource = 0x81, ///< resource not available: a specified resource was not available.
|
||||||
|
osErrorTimeoutResource = 0xC1, ///< resource not available within given time: a specified resource was not available within the timeout period.
|
||||||
|
osErrorISR = 0x82, ///< not allowed in ISR context: the function cannot be called from interrupt service routines.
|
||||||
|
osErrorISRRecursive = 0x83, ///< function called multiple times from ISR with same object.
|
||||||
|
osErrorPriority = 0x84, ///< system cannot determine priority or thread has illegal priority.
|
||||||
|
osErrorNoMemory = 0x85, ///< system is out of memory: it was impossible to allocate or reserve memory for the operation.
|
||||||
|
osErrorValue = 0x86, ///< value of a parameter is out of range.
|
||||||
|
osErrorOS = 0xFF, ///< unspecified RTOS error: run-time error but no other error message fits.
|
||||||
|
os_status_reserved = 0x7FFFFFFF ///< prevent from enum down-size compiler optimization.
|
||||||
|
} osStatus;
|
||||||
|
|
||||||
|
|
||||||
|
/// Timer type value for the timer definition.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b os_timer_type shall be consistent in every CMSIS-RTOS.
|
||||||
|
typedef enum {
|
||||||
|
osTimerOnce = 0, ///< one-shot timer
|
||||||
|
osTimerPeriodic = 1 ///< repeating timer
|
||||||
|
} os_timer_type;
|
||||||
|
|
||||||
|
/// Entry point of a thread.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b os_pthread shall be consistent in every CMSIS-RTOS.
|
||||||
|
typedef void (*os_pthread) (void const *argument);
|
||||||
|
|
||||||
|
/// Entry point of a timer call back function.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b os_ptimer shall be consistent in every CMSIS-RTOS.
|
||||||
|
typedef void (*os_ptimer) (void const *argument);
|
||||||
|
|
||||||
|
// >>> the following data type definitions may shall adapted towards a specific RTOS
|
||||||
|
|
||||||
|
/// Thread ID identifies the thread (pointer to a thread control block).
|
||||||
|
/// \note CAN BE CHANGED: \b os_thread_cb is implementation specific in every CMSIS-RTOS.
|
||||||
|
typedef xTaskHandle osThreadId;
|
||||||
|
|
||||||
|
/// Timer ID identifies the timer (pointer to a timer control block).
|
||||||
|
/// \note CAN BE CHANGED: \b os_timer_cb is implementation specific in every CMSIS-RTOS.
|
||||||
|
typedef xTimerHandle osTimerId;
|
||||||
|
|
||||||
|
/// Mutex ID identifies the mutex (pointer to a mutex control block).
|
||||||
|
/// \note CAN BE CHANGED: \b os_mutex_cb is implementation specific in every CMSIS-RTOS.
|
||||||
|
typedef xSemaphoreHandle osMutexId;
|
||||||
|
|
||||||
|
/// Semaphore ID identifies the semaphore (pointer to a semaphore control block).
|
||||||
|
/// \note CAN BE CHANGED: \b os_semaphore_cb is implementation specific in every CMSIS-RTOS.
|
||||||
|
typedef xSemaphoreHandle osSemaphoreId;
|
||||||
|
|
||||||
|
/// Pool ID identifies the memory pool (pointer to a memory pool control block).
|
||||||
|
/// \note CAN BE CHANGED: \b os_pool_cb is implementation specific in every CMSIS-RTOS.
|
||||||
|
typedef struct os_pool_cb *osPoolId;
|
||||||
|
|
||||||
|
/// Message ID identifies the message queue (pointer to a message queue control block).
|
||||||
|
/// \note CAN BE CHANGED: \b os_messageQ_cb is implementation specific in every CMSIS-RTOS.
|
||||||
|
typedef xQueueHandle osMessageQId;
|
||||||
|
|
||||||
|
/// Mail ID identifies the mail queue (pointer to a mail queue control block).
|
||||||
|
/// \note CAN BE CHANGED: \b os_mailQ_cb is implementation specific in every CMSIS-RTOS.
|
||||||
|
typedef struct os_mailQ_cb *osMailQId;
|
||||||
|
|
||||||
|
|
||||||
|
/// Thread Definition structure contains startup information of a thread.
|
||||||
|
/// \note CAN BE CHANGED: \b os_thread_def is implementation specific in every CMSIS-RTOS.
|
||||||
|
typedef struct os_thread_def {
|
||||||
|
os_pthread pthread; ///< start address of thread function
|
||||||
|
osPriority tpriority; ///< initial thread priority
|
||||||
|
uint32_t instances; ///< maximum number of instances of that thread function
|
||||||
|
uint32_t stacksize; ///< stack size requirements in bytes; 0 is default stack size
|
||||||
|
char * name;
|
||||||
|
} osThreadDef_t;
|
||||||
|
|
||||||
|
/// Timer Definition structure contains timer parameters.
|
||||||
|
/// \note CAN BE CHANGED: \b os_timer_def is implementation specific in every CMSIS-RTOS.
|
||||||
|
struct os_timer_custom {
|
||||||
|
void *argument;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct os_timer_def {
|
||||||
|
os_ptimer ptimer; ///< start address of a timer function
|
||||||
|
struct os_timer_custom *custom;
|
||||||
|
} osTimerDef_t;
|
||||||
|
|
||||||
|
/// Mutex Definition structure contains setup information for a mutex.
|
||||||
|
/// \note CAN BE CHANGED: \b os_mutex_def is implementation specific in every CMSIS-RTOS.
|
||||||
|
typedef struct os_mutex_def {
|
||||||
|
uint32_t dummy; ///< dummy value.
|
||||||
|
} osMutexDef_t;
|
||||||
|
|
||||||
|
/// Semaphore Definition structure contains setup information for a semaphore.
|
||||||
|
/// \note CAN BE CHANGED: \b os_semaphore_def is implementation specific in every CMSIS-RTOS.
|
||||||
|
typedef struct os_semaphore_def {
|
||||||
|
uint32_t dummy; ///< dummy value.
|
||||||
|
} osSemaphoreDef_t;
|
||||||
|
|
||||||
|
/// Definition structure for memory block allocation
|
||||||
|
/// \note CAN BE CHANGED: \b os_pool_def is implementation specific in every CMSIS-RTOS.
|
||||||
|
typedef struct os_pool_def {
|
||||||
|
uint32_t pool_sz; ///< number of items (elements) in the pool
|
||||||
|
uint32_t item_sz; ///< size of an item
|
||||||
|
void *pool; ///< pointer to memory for pool
|
||||||
|
} osPoolDef_t;
|
||||||
|
|
||||||
|
/// Definition structure for message queue.
|
||||||
|
/// \note CAN BE CHANGED: \b os_messageQ_def is implementation specific in every CMSIS-RTOS.
|
||||||
|
typedef struct os_messageQ_def {
|
||||||
|
uint32_t queue_sz; ///< number of elements in the queue
|
||||||
|
uint32_t item_sz; ///< size of an item
|
||||||
|
void *pool; ///< memory array for messages
|
||||||
|
} osMessageQDef_t;
|
||||||
|
|
||||||
|
/// Definition structure for mail queue
|
||||||
|
/// \note CAN BE CHANGED: \b os_mailQ_def is implementation specific in every CMSIS-RTOS.
|
||||||
|
typedef struct os_mailQ_def {
|
||||||
|
uint32_t queue_sz; ///< number of elements in the queue
|
||||||
|
uint32_t item_sz; ///< size of an item
|
||||||
|
struct os_mailQ_cb **cb;
|
||||||
|
} osMailQDef_t;
|
||||||
|
|
||||||
|
/// Event structure contains detailed information about an event.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b os_event shall be consistent in every CMSIS-RTOS.
|
||||||
|
/// However the struct may be extended at the end.
|
||||||
|
typedef struct {
|
||||||
|
osStatus status; ///< status code: event or error information
|
||||||
|
union {
|
||||||
|
uint32_t v; ///< message as 32-bit value
|
||||||
|
void *p; ///< message or mail as void pointer
|
||||||
|
int32_t signals; ///< signal flags
|
||||||
|
} value; ///< event value
|
||||||
|
union {
|
||||||
|
osMailQId mail_id; ///< mail id obtained by \ref osMailCreate
|
||||||
|
osMessageQId message_id; ///< message id obtained by \ref osMessageCreate
|
||||||
|
} def; ///< event definition
|
||||||
|
} osEvent;
|
||||||
|
|
||||||
|
|
||||||
|
// ==== Kernel Control Functions ====
|
||||||
|
|
||||||
|
/// Initialize the RTOS Kernel for creating objects.
|
||||||
|
/// \return status code that indicates the execution status of the function.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osKernelInitialize shall be consistent in every CMSIS-RTOS.
|
||||||
|
osStatus osKernelInitialize (void);
|
||||||
|
|
||||||
|
/// Start the RTOS Kernel.
|
||||||
|
/// \return status code that indicates the execution status of the function.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osKernelStart shall be consistent in every CMSIS-RTOS.
|
||||||
|
osStatus osKernelStart (void);
|
||||||
|
|
||||||
|
/// Check if the RTOS kernel is already started.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osKernelRunning shall be consistent in every CMSIS-RTOS.
|
||||||
|
/// \return 0 RTOS is not started, 1 RTOS is started.
|
||||||
|
int32_t osKernelRunning(void);
|
||||||
|
|
||||||
|
#if (defined (osFeature_SysTick) && (osFeature_SysTick != 0)) // System Timer available
|
||||||
|
|
||||||
|
/// Get the RTOS kernel system timer counter
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osKernelSysTick shall be consistent in every CMSIS-RTOS.
|
||||||
|
/// \return RTOS kernel system timer as 32-bit value
|
||||||
|
uint32_t osKernelSysTick (void);
|
||||||
|
|
||||||
|
/// The RTOS kernel system timer frequency in Hz
|
||||||
|
/// \note Reflects the system timer setting and is typically defined in a configuration file.
|
||||||
|
#define osKernelSysTickFrequency configTICK_RATE_HZ
|
||||||
|
|
||||||
|
/// Convert a microseconds value to a RTOS kernel system timer value.
|
||||||
|
/// \param microsec time value in microseconds.
|
||||||
|
/// \return time value normalized to the \ref osKernelSysTickFrequency
|
||||||
|
#define osKernelSysTickMicroSec(microsec) (((uint64_t)microsec * (osKernelSysTickFrequency)) / 1000000)
|
||||||
|
|
||||||
|
#endif // System Timer available
|
||||||
|
|
||||||
|
// ==== Thread Management ====
|
||||||
|
|
||||||
|
/// Create a Thread Definition with function, priority, and stack requirements.
|
||||||
|
/// \param name name of the thread function.
|
||||||
|
/// \param priority initial priority of the thread function.
|
||||||
|
/// \param instances number of possible thread instances.
|
||||||
|
/// \param stacksz stack size (in bytes) requirements for the thread function.
|
||||||
|
/// \note CAN BE CHANGED: The parameters to \b osThreadDef shall be consistent but the
|
||||||
|
/// macro body is implementation specific in every CMSIS-RTOS.
|
||||||
|
#if defined (osObjectsExternal) // object is external
|
||||||
|
#define osThreadDef(name, priority, instances, stacksz) \
|
||||||
|
extern const osThreadDef_t os_thread_def_##name
|
||||||
|
#else // define the object
|
||||||
|
#define osThreadDef(name, priority, instances, stacksz) \
|
||||||
|
const osThreadDef_t os_thread_def_##name = \
|
||||||
|
{ (name), (priority), (instances), (stacksz), #name }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// Access a Thread definition.
|
||||||
|
/// \param name name of the thread definition object.
|
||||||
|
/// \note CAN BE CHANGED: The parameter to \b osThread shall be consistent but the
|
||||||
|
/// macro body is implementation specific in every CMSIS-RTOS.
|
||||||
|
#define osThread(name) \
|
||||||
|
&os_thread_def_##name
|
||||||
|
|
||||||
|
/// Create a thread and add it to Active Threads and set it to state READY.
|
||||||
|
/// \param[in] thread_def thread definition referenced with \ref osThread.
|
||||||
|
/// \param[in] argument pointer that is passed to the thread function as start argument.
|
||||||
|
/// \return thread ID for reference by other functions or NULL in case of error.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osThreadCreate shall be consistent in every CMSIS-RTOS.
|
||||||
|
osThreadId osThreadCreate (const osThreadDef_t *thread_def, void *argument);
|
||||||
|
|
||||||
|
/// Return the thread ID of the current running thread.
|
||||||
|
/// \return thread ID for reference by other functions or NULL in case of error.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osThreadGetId shall be consistent in every CMSIS-RTOS.
|
||||||
|
osThreadId osThreadGetId (void);
|
||||||
|
|
||||||
|
/// Terminate execution of a thread and remove it from Active Threads.
|
||||||
|
/// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
|
||||||
|
/// \return status code that indicates the execution status of the function.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osThreadTerminate shall be consistent in every CMSIS-RTOS.
|
||||||
|
osStatus osThreadTerminate (osThreadId thread_id);
|
||||||
|
|
||||||
|
/// Pass control to next thread that is in state \b READY.
|
||||||
|
/// \return status code that indicates the execution status of the function.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osThreadYield shall be consistent in every CMSIS-RTOS.
|
||||||
|
osStatus osThreadYield (void);
|
||||||
|
|
||||||
|
/// Change priority of an active thread.
|
||||||
|
/// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
|
||||||
|
/// \param[in] priority new priority value for the thread function.
|
||||||
|
/// \return status code that indicates the execution status of the function.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osThreadSetPriority shall be consistent in every CMSIS-RTOS.
|
||||||
|
osStatus osThreadSetPriority (osThreadId thread_id, osPriority priority);
|
||||||
|
|
||||||
|
/// Get current priority of an active thread.
|
||||||
|
/// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
|
||||||
|
/// \return current priority value of the thread function.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osThreadGetPriority shall be consistent in every CMSIS-RTOS.
|
||||||
|
osPriority osThreadGetPriority (osThreadId thread_id);
|
||||||
|
|
||||||
|
|
||||||
|
// ==== Generic Wait Functions ====
|
||||||
|
|
||||||
|
/// Wait for Timeout (Time Delay).
|
||||||
|
/// \param[in] millisec time delay value
|
||||||
|
/// \return status code that indicates the execution status of the function.
|
||||||
|
osStatus osDelay (uint32_t millisec);
|
||||||
|
|
||||||
|
#if (defined (osFeature_Wait) && (osFeature_Wait != 0)) // Generic Wait available
|
||||||
|
|
||||||
|
/// Wait for Signal, Message, Mail, or Timeout.
|
||||||
|
/// \param[in] millisec timeout value or 0 in case of no time-out
|
||||||
|
/// \return event that contains signal, message, or mail information or error code.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osWait shall be consistent in every CMSIS-RTOS.
|
||||||
|
osEvent osWait (uint32_t millisec);
|
||||||
|
|
||||||
|
#endif // Generic Wait available
|
||||||
|
|
||||||
|
|
||||||
|
// ==== Timer Management Functions ====
|
||||||
|
/// Define a Timer object.
|
||||||
|
/// \param name name of the timer object.
|
||||||
|
/// \param function name of the timer call back function.
|
||||||
|
/// \note CAN BE CHANGED: The parameter to \b osTimerDef shall be consistent but the
|
||||||
|
/// macro body is implementation specific in every CMSIS-RTOS.
|
||||||
|
#if defined (osObjectsExternal) // object is external
|
||||||
|
#define osTimerDef(name, function) \
|
||||||
|
extern const osTimerDef_t os_timer_def_##name; \
|
||||||
|
extern struct os_timer_custom os_timer_custome_##name
|
||||||
|
#else // define the object
|
||||||
|
#define osTimerDef(name, function) \
|
||||||
|
struct os_timer_custom os_timer_custom_##name; \
|
||||||
|
const osTimerDef_t os_timer_def_##name = \
|
||||||
|
{ (function), (&os_timer_custom_##name) }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// Access a Timer definition.
|
||||||
|
/// \param name name of the timer object.
|
||||||
|
/// \note CAN BE CHANGED: The parameter to \b osTimer shall be consistent but the
|
||||||
|
/// macro body is implementation specific in every CMSIS-RTOS.
|
||||||
|
#define osTimer(name) \
|
||||||
|
&os_timer_def_##name
|
||||||
|
|
||||||
|
/// Create a timer.
|
||||||
|
/// \param[in] timer_def timer object referenced with \ref osTimer.
|
||||||
|
/// \param[in] type osTimerOnce for one-shot or osTimerPeriodic for periodic behavior.
|
||||||
|
/// \param[in] argument argument to the timer call back function.
|
||||||
|
/// \return timer ID for reference by other functions or NULL in case of error.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osTimerCreate shall be consistent in every CMSIS-RTOS.
|
||||||
|
osTimerId osTimerCreate (const osTimerDef_t *timer_def, os_timer_type type, void *argument);
|
||||||
|
|
||||||
|
/// Start or restart a timer.
|
||||||
|
/// \param[in] timer_id timer ID obtained by \ref osTimerCreate.
|
||||||
|
/// \param[in] millisec time delay value of the timer.
|
||||||
|
/// \return status code that indicates the execution status of the function.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osTimerStart shall be consistent in every CMSIS-RTOS.
|
||||||
|
osStatus osTimerStart (osTimerId timer_id, uint32_t millisec);
|
||||||
|
|
||||||
|
/// Stop the timer.
|
||||||
|
/// \param[in] timer_id timer ID obtained by \ref osTimerCreate.
|
||||||
|
/// \return status code that indicates the execution status of the function.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osTimerStop shall be consistent in every CMSIS-RTOS.
|
||||||
|
osStatus osTimerStop (osTimerId timer_id);
|
||||||
|
|
||||||
|
/// Delete a timer that was created by \ref osTimerCreate.
|
||||||
|
/// \param[in] timer_id timer ID obtained by \ref osTimerCreate.
|
||||||
|
/// \return status code that indicates the execution status of the function.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osTimerDelete shall be consistent in every CMSIS-RTOS.
|
||||||
|
osStatus osTimerDelete (osTimerId timer_id);
|
||||||
|
|
||||||
|
|
||||||
|
// ==== Signal Management ====
|
||||||
|
|
||||||
|
/// Set the specified Signal Flags of an active thread.
|
||||||
|
/// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
|
||||||
|
/// \param[in] signals specifies the signal flags of the thread that should be set.
|
||||||
|
/// \return previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osSignalSet shall be consistent in every CMSIS-RTOS.
|
||||||
|
int32_t osSignalSet (osThreadId thread_id, int32_t signals);
|
||||||
|
|
||||||
|
/// Clear the specified Signal Flags of an active thread.
|
||||||
|
/// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
|
||||||
|
/// \param[in] signals specifies the signal flags of the thread that shall be cleared.
|
||||||
|
/// \return previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osSignalClear shall be consistent in every CMSIS-RTOS.
|
||||||
|
int32_t osSignalClear (osThreadId thread_id, int32_t signals);
|
||||||
|
|
||||||
|
/// Wait for one or more Signal Flags to become signaled for the current \b RUNNING thread.
|
||||||
|
/// \param[in] signals wait until all specified signal flags set or 0 for any single signal flag.
|
||||||
|
/// \param[in] millisec timeout value or 0 in case of no time-out.
|
||||||
|
/// \return event flag information or error code.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osSignalWait shall be consistent in every CMSIS-RTOS.
|
||||||
|
osEvent osSignalWait (int32_t signals, uint32_t millisec);
|
||||||
|
|
||||||
|
|
||||||
|
// ==== Mutex Management ====
|
||||||
|
|
||||||
|
/// Define a Mutex.
|
||||||
|
/// \param name name of the mutex object.
|
||||||
|
/// \note CAN BE CHANGED: The parameter to \b osMutexDef shall be consistent but the
|
||||||
|
/// macro body is implementation specific in every CMSIS-RTOS.
|
||||||
|
#if defined (osObjectsExternal) // object is external
|
||||||
|
#define osMutexDef(name) \
|
||||||
|
extern const osMutexDef_t os_mutex_def_##name
|
||||||
|
#else // define the object
|
||||||
|
#define osMutexDef(name) \
|
||||||
|
const osMutexDef_t os_mutex_def_##name = { 0 }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// Access a Mutex definition.
|
||||||
|
/// \param name name of the mutex object.
|
||||||
|
/// \note CAN BE CHANGED: The parameter to \b osMutex shall be consistent but the
|
||||||
|
/// macro body is implementation specific in every CMSIS-RTOS.
|
||||||
|
#define osMutex(name) \
|
||||||
|
&os_mutex_def_##name
|
||||||
|
|
||||||
|
/// Create and Initialize a Mutex object.
|
||||||
|
/// \param[in] mutex_def mutex definition referenced with \ref osMutex.
|
||||||
|
/// \return mutex ID for reference by other functions or NULL in case of error.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osMutexCreate shall be consistent in every CMSIS-RTOS.
|
||||||
|
osMutexId osMutexCreate (const osMutexDef_t *mutex_def);
|
||||||
|
|
||||||
|
/// Wait until a Mutex becomes available.
|
||||||
|
/// \param[in] mutex_id mutex ID obtained by \ref osMutexCreate.
|
||||||
|
/// \param[in] millisec timeout value or 0 in case of no time-out.
|
||||||
|
/// \return status code that indicates the execution status of the function.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osMutexWait shall be consistent in every CMSIS-RTOS.
|
||||||
|
osStatus osMutexWait (osMutexId mutex_id, uint32_t millisec);
|
||||||
|
|
||||||
|
/// Release a Mutex that was obtained by \ref osMutexWait.
|
||||||
|
/// \param[in] mutex_id mutex ID obtained by \ref osMutexCreate.
|
||||||
|
/// \return status code that indicates the execution status of the function.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osMutexRelease shall be consistent in every CMSIS-RTOS.
|
||||||
|
osStatus osMutexRelease (osMutexId mutex_id);
|
||||||
|
|
||||||
|
/// Delete a Mutex that was created by \ref osMutexCreate.
|
||||||
|
/// \param[in] mutex_id mutex ID obtained by \ref osMutexCreate.
|
||||||
|
/// \return status code that indicates the execution status of the function.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osMutexDelete shall be consistent in every CMSIS-RTOS.
|
||||||
|
osStatus osMutexDelete (osMutexId mutex_id);
|
||||||
|
|
||||||
|
|
||||||
|
// ==== Semaphore Management Functions ====
|
||||||
|
|
||||||
|
#if (defined (osFeature_Semaphore) && (osFeature_Semaphore != 0)) // Semaphore available
|
||||||
|
|
||||||
|
/// Define a Semaphore object.
|
||||||
|
/// \param name name of the semaphore object.
|
||||||
|
/// \note CAN BE CHANGED: The parameter to \b osSemaphoreDef shall be consistent but the
|
||||||
|
/// macro body is implementation specific in every CMSIS-RTOS.
|
||||||
|
#if defined (osObjectsExternal) // object is external
|
||||||
|
#define osSemaphoreDef(name) \
|
||||||
|
extern const osSemaphoreDef_t os_semaphore_def_##name
|
||||||
|
#else // define the object
|
||||||
|
#define osSemaphoreDef(name) \
|
||||||
|
const osSemaphoreDef_t os_semaphore_def_##name = { 0 }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// Access a Semaphore definition.
|
||||||
|
/// \param name name of the semaphore object.
|
||||||
|
/// \note CAN BE CHANGED: The parameter to \b osSemaphore shall be consistent but the
|
||||||
|
/// macro body is implementation specific in every CMSIS-RTOS.
|
||||||
|
#define osSemaphore(name) \
|
||||||
|
&os_semaphore_def_##name
|
||||||
|
|
||||||
|
/// Create and Initialize a Semaphore object used for managing resources.
|
||||||
|
/// \param[in] semaphore_def semaphore definition referenced with \ref osSemaphore.
|
||||||
|
/// \param[in] count number of available resources.
|
||||||
|
/// \return semaphore ID for reference by other functions or NULL in case of error.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osSemaphoreCreate shall be consistent in every CMSIS-RTOS.
|
||||||
|
osSemaphoreId osSemaphoreCreate (const osSemaphoreDef_t *semaphore_def, int32_t count);
|
||||||
|
|
||||||
|
/// Wait until a Semaphore token becomes available.
|
||||||
|
/// \param[in] semaphore_id semaphore object referenced with \ref osSemaphoreCreate.
|
||||||
|
/// \param[in] millisec timeout value or 0 in case of no time-out.
|
||||||
|
/// \return number of available tokens, or -1 in case of incorrect parameters.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osSemaphoreWait shall be consistent in every CMSIS-RTOS.
|
||||||
|
int32_t osSemaphoreWait (osSemaphoreId semaphore_id, uint32_t millisec);
|
||||||
|
|
||||||
|
/// Release a Semaphore token.
|
||||||
|
/// \param[in] semaphore_id semaphore object referenced with \ref osSemaphoreCreate.
|
||||||
|
/// \return status code that indicates the execution status of the function.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osSemaphoreRelease shall be consistent in every CMSIS-RTOS.
|
||||||
|
osStatus osSemaphoreRelease (osSemaphoreId semaphore_id);
|
||||||
|
|
||||||
|
/// Delete a Semaphore that was created by \ref osSemaphoreCreate.
|
||||||
|
/// \param[in] semaphore_id semaphore object referenced with \ref osSemaphoreCreate.
|
||||||
|
/// \return status code that indicates the execution status of the function.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osSemaphoreDelete shall be consistent in every CMSIS-RTOS.
|
||||||
|
osStatus osSemaphoreDelete (osSemaphoreId semaphore_id);
|
||||||
|
|
||||||
|
#endif // Semaphore available
|
||||||
|
|
||||||
|
|
||||||
|
// ==== Memory Pool Management Functions ====
|
||||||
|
|
||||||
|
#if (defined (osFeature_Pool) && (osFeature_Pool != 0)) // Memory Pool Management available
|
||||||
|
|
||||||
|
/// \brief Define a Memory Pool.
|
||||||
|
/// \param name name of the memory pool.
|
||||||
|
/// \param no maximum number of blocks (objects) in the memory pool.
|
||||||
|
/// \param type data type of a single block (object).
|
||||||
|
/// \note CAN BE CHANGED: The parameter to \b osPoolDef shall be consistent but the
|
||||||
|
/// macro body is implementation specific in every CMSIS-RTOS.
|
||||||
|
#if defined (osObjectsExternal) // object is external
|
||||||
|
#define osPoolDef(name, no, type) \
|
||||||
|
extern const osPoolDef_t os_pool_def_##name
|
||||||
|
#else // define the object
|
||||||
|
#define osPoolDef(name, no, type) \
|
||||||
|
const osPoolDef_t os_pool_def_##name = \
|
||||||
|
{ (no), sizeof(type), NULL }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// \brief Access a Memory Pool definition.
|
||||||
|
/// \param name name of the memory pool
|
||||||
|
/// \note CAN BE CHANGED: The parameter to \b osPool shall be consistent but the
|
||||||
|
/// macro body is implementation specific in every CMSIS-RTOS.
|
||||||
|
#define osPool(name) \
|
||||||
|
&os_pool_def_##name
|
||||||
|
|
||||||
|
/// Create and Initialize a memory pool.
|
||||||
|
/// \param[in] pool_def memory pool definition referenced with \ref osPool.
|
||||||
|
/// \return memory pool ID for reference by other functions or NULL in case of error.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osPoolCreate shall be consistent in every CMSIS-RTOS.
|
||||||
|
osPoolId osPoolCreate (const osPoolDef_t *pool_def);
|
||||||
|
|
||||||
|
/// Allocate a memory block from a memory pool.
|
||||||
|
/// \param[in] pool_id memory pool ID obtain referenced with \ref osPoolCreate.
|
||||||
|
/// \return address of the allocated memory block or NULL in case of no memory available.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osPoolAlloc shall be consistent in every CMSIS-RTOS.
|
||||||
|
void *osPoolAlloc (osPoolId pool_id);
|
||||||
|
|
||||||
|
/// Allocate a memory block from a memory pool and set memory block to zero.
|
||||||
|
/// \param[in] pool_id memory pool ID obtain referenced with \ref osPoolCreate.
|
||||||
|
/// \return address of the allocated memory block or NULL in case of no memory available.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osPoolCAlloc shall be consistent in every CMSIS-RTOS.
|
||||||
|
void *osPoolCAlloc (osPoolId pool_id);
|
||||||
|
|
||||||
|
/// Return an allocated memory block back to a specific memory pool.
|
||||||
|
/// \param[in] pool_id memory pool ID obtain referenced with \ref osPoolCreate.
|
||||||
|
/// \param[in] block address of the allocated memory block that is returned to the memory pool.
|
||||||
|
/// \return status code that indicates the execution status of the function.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osPoolFree shall be consistent in every CMSIS-RTOS.
|
||||||
|
osStatus osPoolFree (osPoolId pool_id, void *block);
|
||||||
|
|
||||||
|
#endif // Memory Pool Management available
|
||||||
|
|
||||||
|
|
||||||
|
// ==== Message Queue Management Functions ====
|
||||||
|
|
||||||
|
#if (defined (osFeature_MessageQ) && (osFeature_MessageQ != 0)) // Message Queues available
|
||||||
|
|
||||||
|
/// \brief Create a Message Queue Definition.
|
||||||
|
/// \param name name of the queue.
|
||||||
|
/// \param queue_sz maximum number of messages in the queue.
|
||||||
|
/// \param type data type of a single message element (for debugger).
|
||||||
|
/// \note CAN BE CHANGED: The parameter to \b osMessageQDef shall be consistent but the
|
||||||
|
/// macro body is implementation specific in every CMSIS-RTOS.
|
||||||
|
#if defined (osObjectsExternal) // object is external
|
||||||
|
#define osMessageQDef(name, queue_sz, type) \
|
||||||
|
extern const osMessageQDef_t os_messageQ_def_##name
|
||||||
|
#else // define the object
|
||||||
|
#define osMessageQDef(name, queue_sz, type) \
|
||||||
|
const osMessageQDef_t os_messageQ_def_##name = \
|
||||||
|
{ (queue_sz), sizeof (type) }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// \brief Access a Message Queue Definition.
|
||||||
|
/// \param name name of the queue
|
||||||
|
/// \note CAN BE CHANGED: The parameter to \b osMessageQ shall be consistent but the
|
||||||
|
/// macro body is implementation specific in every CMSIS-RTOS.
|
||||||
|
#define osMessageQ(name) \
|
||||||
|
&os_messageQ_def_##name
|
||||||
|
|
||||||
|
/// Create and Initialize a Message Queue.
|
||||||
|
/// \param[in] queue_def queue definition referenced with \ref osMessageQ.
|
||||||
|
/// \param[in] thread_id thread ID (obtained by \ref osThreadCreate or \ref osThreadGetId) or NULL.
|
||||||
|
/// \return message queue ID for reference by other functions or NULL in case of error.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osMessageCreate shall be consistent in every CMSIS-RTOS.
|
||||||
|
osMessageQId osMessageCreate (const osMessageQDef_t *queue_def, osThreadId thread_id);
|
||||||
|
|
||||||
|
/// Put a Message to a Queue.
|
||||||
|
/// \param[in] queue_id message queue ID obtained with \ref osMessageCreate.
|
||||||
|
/// \param[in] info message information.
|
||||||
|
/// \param[in] millisec timeout value or 0 in case of no time-out.
|
||||||
|
/// \return status code that indicates the execution status of the function.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osMessagePut shall be consistent in every CMSIS-RTOS.
|
||||||
|
osStatus osMessagePut (osMessageQId queue_id, uint32_t info, uint32_t millisec);
|
||||||
|
|
||||||
|
/// Get a Message or Wait for a Message from a Queue.
|
||||||
|
/// \param[in] queue_id message queue ID obtained with \ref osMessageCreate.
|
||||||
|
/// \param[in] millisec timeout value or 0 in case of no time-out.
|
||||||
|
/// \return event information that includes status code.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osMessageGet shall be consistent in every CMSIS-RTOS.
|
||||||
|
osEvent osMessageGet (osMessageQId queue_id, uint32_t millisec);
|
||||||
|
|
||||||
|
#endif // Message Queues available
|
||||||
|
|
||||||
|
|
||||||
|
// ==== Mail Queue Management Functions ====
|
||||||
|
|
||||||
|
#if (defined (osFeature_MailQ) && (osFeature_MailQ != 0)) // Mail Queues available
|
||||||
|
|
||||||
|
/// \brief Create a Mail Queue Definition.
|
||||||
|
/// \param name name of the queue
|
||||||
|
/// \param queue_sz maximum number of messages in queue
|
||||||
|
/// \param type data type of a single message element
|
||||||
|
/// \note CAN BE CHANGED: The parameter to \b osMailQDef shall be consistent but the
|
||||||
|
/// macro body is implementation specific in every CMSIS-RTOS.
|
||||||
|
#if defined (osObjectsExternal) // object is external
|
||||||
|
#define osMailQDef(name, queue_sz, type) \
|
||||||
|
extern struct os_mailQ_cb *os_mailQ_cb_##name; \
|
||||||
|
extern const osMailQDef_t os_mailQ_def_##name;
|
||||||
|
#else // define the object
|
||||||
|
#define osMailQDef(name, queue_sz, type) \
|
||||||
|
struct os_mailQ_cb *os_mailQ_cb_##name; \
|
||||||
|
const osMailQDef_t os_mailQ_def_##name = \
|
||||||
|
{ (queue_sz), sizeof (type), (&os_mailQ_cb_##name) }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// \brief Access a Mail Queue Definition.
|
||||||
|
/// \param name name of the queue
|
||||||
|
/// \note CAN BE CHANGED: The parameter to \b osMailQ shall be consistent but the
|
||||||
|
/// macro body is implementation specific in every CMSIS-RTOS.
|
||||||
|
#define osMailQ(name) \
|
||||||
|
&os_mailQ_def_##name
|
||||||
|
|
||||||
|
/// Create and Initialize mail queue.
|
||||||
|
/// \param[in] queue_def reference to the mail queue definition obtain with \ref osMailQ
|
||||||
|
/// \param[in] thread_id thread ID (obtained by \ref osThreadCreate or \ref osThreadGetId) or NULL.
|
||||||
|
/// \return mail queue ID for reference by other functions or NULL in case of error.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osMailCreate shall be consistent in every CMSIS-RTOS.
|
||||||
|
osMailQId osMailCreate (const osMailQDef_t *queue_def, osThreadId thread_id);
|
||||||
|
|
||||||
|
/// Allocate a memory block from a mail.
|
||||||
|
/// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
|
||||||
|
/// \param[in] millisec timeout value or 0 in case of no time-out
|
||||||
|
/// \return pointer to memory block that can be filled with mail or NULL in case of error.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osMailAlloc shall be consistent in every CMSIS-RTOS.
|
||||||
|
void *osMailAlloc (osMailQId queue_id, uint32_t millisec);
|
||||||
|
|
||||||
|
/// Allocate a memory block from a mail and set memory block to zero.
|
||||||
|
/// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
|
||||||
|
/// \param[in] millisec timeout value or 0 in case of no time-out
|
||||||
|
/// \return pointer to memory block that can be filled with mail or NULL in case of error.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osMailCAlloc shall be consistent in every CMSIS-RTOS.
|
||||||
|
void *osMailCAlloc (osMailQId queue_id, uint32_t millisec);
|
||||||
|
|
||||||
|
/// Put a mail to a queue.
|
||||||
|
/// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
|
||||||
|
/// \param[in] mail memory block previously allocated with \ref osMailAlloc or \ref osMailCAlloc.
|
||||||
|
/// \return status code that indicates the execution status of the function.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osMailPut shall be consistent in every CMSIS-RTOS.
|
||||||
|
osStatus osMailPut (osMailQId queue_id, void *mail);
|
||||||
|
|
||||||
|
/// Get a mail from a queue.
|
||||||
|
/// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
|
||||||
|
/// \param[in] millisec timeout value or 0 in case of no time-out
|
||||||
|
/// \return event that contains mail information or error code.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osMailGet shall be consistent in every CMSIS-RTOS.
|
||||||
|
osEvent osMailGet (osMailQId queue_id, uint32_t millisec);
|
||||||
|
|
||||||
|
/// Free a memory block from a mail.
|
||||||
|
/// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
|
||||||
|
/// \param[in] mail pointer to the memory block that was obtained with \ref osMailGet.
|
||||||
|
/// \return status code that indicates the execution status of the function.
|
||||||
|
/// \note MUST REMAIN UNCHANGED: \b osMailFree shall be consistent in every CMSIS-RTOS.
|
||||||
|
osStatus osMailFree (osMailQId queue_id, void *mail);
|
||||||
|
|
||||||
|
#endif // Mail Queues available
|
||||||
|
|
||||||
|
#define malloc(size) pvPortMalloc(size)
|
||||||
|
#define free(pbuf) vPortFree(pbuf)
|
||||||
|
extern void *calloc_freertos(size_t nelements, size_t elementSize);
|
||||||
|
#define calloc(nelements, elementSize) calloc_freertos(nelements, elementSize)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // _CMSIS_OS_H
|
112
sdk/component/os/freertos/freertos_pmu.h
Normal file
112
sdk/component/os/freertos/freertos_pmu.h
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
#ifndef __FREERTOS_PMU_H_
|
||||||
|
#define __FREERTOS_PMU_H_
|
||||||
|
|
||||||
|
#include "sleep_ex_api.h"
|
||||||
|
|
||||||
|
#define BIT(n) (1<<n)
|
||||||
|
// wakelock for system usage
|
||||||
|
#define WAKELOCK_OS BIT(0)
|
||||||
|
#define WAKELOCK_WLAN BIT(1)
|
||||||
|
#define WAKELOCK_LOGUART BIT(2)
|
||||||
|
#define WAKELOCK_SDIO_DEVICE BIT(3)
|
||||||
|
|
||||||
|
// wakelock for user defined
|
||||||
|
#define WAKELOCK_USER_BASE BIT(16)
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
#define DEFAULT_WAKELOCK (0)
|
||||||
|
#else
|
||||||
|
// default locked by OS and not to sleep until OS release wakelock in somewhere
|
||||||
|
#define DEFAULT_WAKELOCK (WAKELOCK_OS)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define DEFAULT_WAKEUP_EVENT (SLEEP_WAKEUP_BY_STIMER | SLEEP_WAKEUP_BY_GTIMER | SLEEP_WAKEUP_BY_GPIO_INT | SLEEP_WAKEUP_BY_WLAN)
|
||||||
|
|
||||||
|
typedef void (*freertos_sleep_callback)( unsigned int );
|
||||||
|
|
||||||
|
/** Acquire wakelock
|
||||||
|
*
|
||||||
|
* A wakelock is a 32-bit map. Each module own 1 bit in this bit map.
|
||||||
|
* FreeRTOS tickless reference the wakelock and decide that if it can or cannot enter sleep state.
|
||||||
|
* If any module acquire and hold a bit in wakelock, then the whole system won't enter sleep state.
|
||||||
|
*
|
||||||
|
* If wakelock is not equals to 0, then the system won't enter sleep.
|
||||||
|
*
|
||||||
|
* @param lock_id : The bit which is attempt to add into wakelock
|
||||||
|
*/
|
||||||
|
void acquire_wakelock(uint32_t lock_id);
|
||||||
|
|
||||||
|
/** Release wakelock
|
||||||
|
*
|
||||||
|
* If wakelock equals to 0, then the system may enter sleep state if it is in idle state.
|
||||||
|
*
|
||||||
|
* @param lock_id : The bit which is attempt to remove from wakelock
|
||||||
|
*/
|
||||||
|
void release_wakelock(uint32_t lock_id);
|
||||||
|
|
||||||
|
/** Get current wakelock bit map value
|
||||||
|
*
|
||||||
|
* @return : the current wakelock bit map value
|
||||||
|
*/
|
||||||
|
uint32_t get_wakelock_status();
|
||||||
|
|
||||||
|
#if (configGENERATE_RUN_TIME_STATS == 1)
|
||||||
|
|
||||||
|
/** Get text report that contain the statics of wakelock holding time
|
||||||
|
*
|
||||||
|
* Each time a module acquries or releases wakelock, a holding time is calculated and sum up to a table.
|
||||||
|
* It is for debug that which module is power saving killer.
|
||||||
|
*
|
||||||
|
* @param pcWriteBuffer : The char buffer that contain the report
|
||||||
|
*/
|
||||||
|
void get_wakelock_hold_stats( char *pcWriteBuffer );
|
||||||
|
|
||||||
|
/** Recalculate the wakelock statics
|
||||||
|
*
|
||||||
|
* By default the wakelock statics is calculated from system boot up.
|
||||||
|
* If we want to debug power saving killer from a specified timestamp, we can reset the statics.
|
||||||
|
*/
|
||||||
|
void clean_wakelock_stat();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void add_wakeup_event(uint32_t event);
|
||||||
|
void del_wakeup_event(uint32_t event);
|
||||||
|
|
||||||
|
/** Register sleep callback
|
||||||
|
*
|
||||||
|
* Pre-sleep callbacks are called before entering sleep.
|
||||||
|
* Post-sleep callbacks are called after resume.
|
||||||
|
*
|
||||||
|
* @param is_pre_sleep : Indicate the sleep_cb is for pre-sleep or post-sleep
|
||||||
|
* @param sleep_cb : The callback function which is called before/after sleep
|
||||||
|
* @param module : The callback is assigned according to the bit specify in bit field of param module
|
||||||
|
* The bit 15 (0x00008000) is used for unspecified callback.
|
||||||
|
*/
|
||||||
|
void register_sleep_callback_by_module( unsigned char is_pre_sleep, freertos_sleep_callback sleep_cb, uint32_t module );
|
||||||
|
|
||||||
|
/** Register unspecified pre sleep callback
|
||||||
|
*
|
||||||
|
* Pre-sleep callbacks are called before entering sleep.
|
||||||
|
*
|
||||||
|
* @param pre_sleep_cb : The callback function which is called before sleep
|
||||||
|
* It is registed in bit 15 (0x00008000) of module list
|
||||||
|
*/
|
||||||
|
void register_pre_sleep_callback( freertos_sleep_callback pre_sleep_cb );
|
||||||
|
|
||||||
|
/** Register unspecified post sleep callback
|
||||||
|
*
|
||||||
|
* Post-sleep callbacks are called before entering sleep.
|
||||||
|
*
|
||||||
|
* @param post_sleep_cb : The callback function which is called after sleep
|
||||||
|
* It is registed in bit 15 (0x00008000) of module list
|
||||||
|
*/
|
||||||
|
void register_post_sleep_callback( freertos_sleep_callback post_sleep_cb );
|
||||||
|
|
||||||
|
/** Set PLL reserved or not when sleep is called
|
||||||
|
*
|
||||||
|
* @param reserve: true for sleep with PLL reserve
|
||||||
|
*/
|
||||||
|
void set_pll_reserved(unsigned char reserve);
|
||||||
|
|
||||||
|
#endif
|
241
sdk/component/os/freertos/freertos_service.h
Normal file
241
sdk/component/os/freertos/freertos_service.h
Normal file
|
@ -0,0 +1,241 @@
|
||||||
|
#ifndef _FREERTOS_SERVICE_H_
|
||||||
|
#define _FREERTOS_SERVICE_H_
|
||||||
|
|
||||||
|
//----- ------------------------------------------------------------------
|
||||||
|
// Include Files
|
||||||
|
//----- ------------------------------------------------------------------
|
||||||
|
//#include "wireless.h"
|
||||||
|
#include "dlist.h"
|
||||||
|
|
||||||
|
// --------------------------------------------
|
||||||
|
// Platform dependent include file
|
||||||
|
// --------------------------------------------
|
||||||
|
#if defined(CONFIG_PLATFORM_8195A) || defined(CONFIG_PLATFORM_8711B)
|
||||||
|
#include "platform/platform_stdlib.h"
|
||||||
|
extern VOID RtlUdelayOS(u32 us);
|
||||||
|
#else
|
||||||
|
// other MCU may use standard library
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if (defined CONFIG_GSPI_HCI || defined CONFIG_SDIO_HCI) || defined(CONFIG_LX_HCI)
|
||||||
|
/* For SPI interface transfer and us delay implementation */
|
||||||
|
#if !defined(CONFIG_PLATFORM_8195A) && !defined(CONFIG_PLATFORM_8711B)
|
||||||
|
#include <rtwlan_bsp.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// --------------------------------------------
|
||||||
|
// Platform dependent type define
|
||||||
|
// --------------------------------------------
|
||||||
|
#if !defined(CONFIG_PLATFORM_8195A) && !defined(CONFIG_PLATFORM_8711B)
|
||||||
|
typedef unsigned char u8;
|
||||||
|
typedef unsigned short u16;
|
||||||
|
typedef unsigned int u32;
|
||||||
|
typedef signed char s8;
|
||||||
|
typedef signed short s16;
|
||||||
|
typedef signed int s32;
|
||||||
|
typedef signed long long s64;
|
||||||
|
typedef unsigned long long u64;
|
||||||
|
typedef unsigned int uint;
|
||||||
|
typedef signed int sint;
|
||||||
|
|
||||||
|
#ifndef bool
|
||||||
|
typedef int bool;
|
||||||
|
#define true 1
|
||||||
|
#define false 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define IN
|
||||||
|
#define OUT
|
||||||
|
#define VOID void
|
||||||
|
#define NDIS_OID uint
|
||||||
|
#define NDIS_STATUS uint
|
||||||
|
#ifndef PVOID
|
||||||
|
typedef void * PVOID;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef unsigned int __kernel_size_t;
|
||||||
|
typedef int __kernel_ssize_t;
|
||||||
|
typedef __kernel_size_t SIZE_T;
|
||||||
|
typedef __kernel_ssize_t SSIZE_T;
|
||||||
|
|
||||||
|
#endif //CONFIG_PLATFORM_8195A
|
||||||
|
|
||||||
|
#define FIELD_OFFSET(s,field) ((SSIZE_T)&((s*)(0))->field)
|
||||||
|
|
||||||
|
// os types
|
||||||
|
typedef char osdepCHAR;
|
||||||
|
typedef float osdepFLOAT;
|
||||||
|
typedef double osdepDOUBLE;
|
||||||
|
typedef long osdepLONG;
|
||||||
|
typedef short osdepSHORT;
|
||||||
|
typedef unsigned long osdepSTACK_TYPE;
|
||||||
|
typedef long osdepBASE_TYPE;
|
||||||
|
typedef unsigned long osdepTickType;
|
||||||
|
|
||||||
|
typedef void* _timerHandle;
|
||||||
|
typedef void* _sema;
|
||||||
|
typedef void* _mutex;
|
||||||
|
typedef void* _lock;
|
||||||
|
typedef void* _queueHandle;
|
||||||
|
typedef void* _xqueue;
|
||||||
|
typedef struct timer_list _timer;
|
||||||
|
|
||||||
|
typedef struct sk_buff _pkt;
|
||||||
|
typedef unsigned char _buffer;
|
||||||
|
|
||||||
|
#ifndef __LIST_H
|
||||||
|
#warning "DLIST_NOT_DEFINE!!!!!!"
|
||||||
|
struct list_head {
|
||||||
|
struct list_head *next, *prev;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct __queue {
|
||||||
|
struct list_head queue;
|
||||||
|
_lock lock;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct __queue _queue;
|
||||||
|
typedef struct list_head _list;
|
||||||
|
typedef unsigned long _irqL;
|
||||||
|
|
||||||
|
typedef void* _thread_hdl_;
|
||||||
|
typedef void thread_return;
|
||||||
|
typedef void* thread_context;
|
||||||
|
|
||||||
|
#define ATOMIC_T atomic_t
|
||||||
|
#define HZ configTICK_RATE_HZ
|
||||||
|
|
||||||
|
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
|
||||||
|
/* emulate a modern version */
|
||||||
|
#define LINUX_VERSION_CODE KERNEL_VERSION(2, 6, 17)
|
||||||
|
|
||||||
|
static __inline _list *get_next(_list *list)
|
||||||
|
{
|
||||||
|
return list->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline _list *get_list_head(_queue *queue)
|
||||||
|
{
|
||||||
|
return (&(queue->queue));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define LIST_CONTAINOR(ptr, type, member) \
|
||||||
|
((type *)((char *)(ptr)-(SIZE_T)((char *)&((type *)ptr)->member - (char *)ptr)))
|
||||||
|
//#define container_of(p,t,n) (t*)((p)-&(((t*)0)->n))
|
||||||
|
#define container_of(ptr, type, member) \
|
||||||
|
((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))
|
||||||
|
#define TASK_PRORITY_LOW 1
|
||||||
|
#define TASK_PRORITY_MIDDLE 2
|
||||||
|
#define TASK_PRORITY_HIGH 3
|
||||||
|
#define TASK_PRORITY_SUPER 4
|
||||||
|
|
||||||
|
#define TIMER_MAX_DELAY 0xFFFFFFFF
|
||||||
|
|
||||||
|
void save_and_cli(void);
|
||||||
|
void restore_flags(void);
|
||||||
|
void cli(void);
|
||||||
|
|
||||||
|
//----- ------------------------------------------------------------------
|
||||||
|
// Common Definition
|
||||||
|
//----- ------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define __init
|
||||||
|
#define __exit
|
||||||
|
#define __devinit
|
||||||
|
#define __devexit
|
||||||
|
|
||||||
|
#define KERN_ERR
|
||||||
|
#define KERN_INFO
|
||||||
|
#define KERN_NOTICE
|
||||||
|
|
||||||
|
#define GFP_KERNEL 1
|
||||||
|
#define GFP_ATOMIC 1
|
||||||
|
|
||||||
|
#define SET_MODULE_OWNER(some_struct) do { } while (0)
|
||||||
|
#define SET_NETDEV_DEV(dev, obj) do { } while (0)
|
||||||
|
#define register_netdev(dev) (0)
|
||||||
|
#define unregister_netdev(dev) do { } while (0)
|
||||||
|
#define netif_queue_stopped(dev) (0)
|
||||||
|
#define netif_wake_queue(dev) do { } while (0)
|
||||||
|
#define printk printf
|
||||||
|
|
||||||
|
#define DBG_ERR(...) do { printf("\n\r[%s] ", __FUNCTION__); printf(__VA_ARGS__); } while(0)
|
||||||
|
#if WLAN_INTF_DBG
|
||||||
|
#define DBG_TRACE(fmt, args...) printf("\n\r[%s] " fmt, __FUNCTION__, ## args)
|
||||||
|
#define DBG_INFO(fmt, args...) printf("\n\r[%s] " fmt, __FUNCTION__, ## args)
|
||||||
|
#else
|
||||||
|
#define DBG_TRACE(fmt, args...)
|
||||||
|
#define DBG_INFO(fmt, args...)
|
||||||
|
#endif
|
||||||
|
#define HALT() do { cli(); for(;;);} while(0)
|
||||||
|
#define ASSERT(x) do { \
|
||||||
|
if((x) == 0) \
|
||||||
|
printf("\n\rAssert(" #x ") failed on line %d in file %s", __LINE__, __FILE__); \
|
||||||
|
HALT(); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#undef DBG_ASSERT
|
||||||
|
#define DBG_ASSERT(x, msg) do { \
|
||||||
|
if((x) == 0) \
|
||||||
|
printf("\n\r%s, Assert(" #x ") failed on line %d in file %s", msg, __LINE__, __FILE__); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
//----- ------------------------------------------------------------------
|
||||||
|
// Atomic Operation
|
||||||
|
//----- ------------------------------------------------------------------
|
||||||
|
#if !defined(CONFIG_PLATFORM_8195A) && !defined(CONFIG_PLATFORM_8711B) // for 8195A, it is defined in ..system../basic_types.h
|
||||||
|
typedef struct { volatile int counter; } atomic_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* atomic_read - read atomic variable
|
||||||
|
* @v: pointer of type atomic_t
|
||||||
|
*
|
||||||
|
* Atomically reads the value of @v. Note that the guaranteed
|
||||||
|
* useful range of an atomic_t is only 24 bits.
|
||||||
|
*/
|
||||||
|
#define atomic_read(v) ((v)->counter)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* atomic_set - set atomic variable
|
||||||
|
* @v: pointer of type atomic_t
|
||||||
|
* @i: required value
|
||||||
|
*
|
||||||
|
* Atomically sets the value of @v to @i. Note that the guaranteed
|
||||||
|
* useful range of an atomic_t is only 24 bits.
|
||||||
|
*/
|
||||||
|
#define atomic_set(v,i) ((v)->counter = (i))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These inlines deal with timer wrapping correctly. You are
|
||||||
|
* strongly encouraged to use them
|
||||||
|
* 1. Because people otherwise forget
|
||||||
|
* 2. Because if the timer wrap changes in future you wont have to
|
||||||
|
* alter your driver code.
|
||||||
|
*
|
||||||
|
* time_after(a,b) returns true if the time a is after time b.
|
||||||
|
*
|
||||||
|
* Do this with "<0" and ">=0" to only test the sign of the result. A
|
||||||
|
* good compiler would generate better code (and a really good compiler
|
||||||
|
* wouldn't care). Gcc is currently neither.
|
||||||
|
*/
|
||||||
|
#define time_after(a,b) ((long)(b) - (long)(a) < 0)
|
||||||
|
#define time_before(a,b) time_after(b,a)
|
||||||
|
|
||||||
|
#define time_after_eq(a,b) ((long)(a) - (long)(b) >= 0)
|
||||||
|
#define time_before_eq(a,b) time_after_eq(b,a)
|
||||||
|
|
||||||
|
|
||||||
|
extern void rtw_init_listhead(_list *list);
|
||||||
|
extern u32 rtw_is_list_empty(_list *phead);
|
||||||
|
extern void rtw_list_insert_head(_list *plist, _list *phead);
|
||||||
|
extern void rtw_list_insert_tail(_list *plist, _list *phead);
|
||||||
|
extern void rtw_list_delete(_list *plist);
|
||||||
|
|
||||||
|
#endif /* _FREERTOS_SERVICE_H_ */
|
|
@ -0,0 +1,762 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||||
|
All rights reserved
|
||||||
|
|
||||||
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS provides completely free yet professionally developed, *
|
||||||
|
* robust, strictly quality controlled, supported, and cross *
|
||||||
|
* platform software that has become a de facto standard. *
|
||||||
|
* *
|
||||||
|
* Help yourself get started quickly and support the FreeRTOS *
|
||||||
|
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||||
|
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||||
|
* *
|
||||||
|
* Thank you! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||||
|
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||||
|
>>! obliged to provide the source code for proprietary components !<<
|
||||||
|
>>! outside of the FreeRTOS kernel. !<<
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||||
|
link: http://www.freertos.org/a00114.html
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||||
|
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||||
|
licenses offer ticketed support, indemnification and middleware.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INC_FREERTOS_H
|
||||||
|
#define INC_FREERTOS_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Include the generic headers required for the FreeRTOS port being used.
|
||||||
|
*/
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If stdint.h cannot be located then:
|
||||||
|
* + If using GCC ensure the -nostdint options is *not* being used.
|
||||||
|
* + Ensure the project's include path includes the directory in which your
|
||||||
|
* compiler stores stdint.h.
|
||||||
|
* + Set any compiler options necessary for it to support C99, as technically
|
||||||
|
* stdint.h is only mandatory with C99 (FreeRTOS does not require C99 in any
|
||||||
|
* other way).
|
||||||
|
* + The FreeRTOS download includes a simple stdint.h definition that can be
|
||||||
|
* used in cases where none is provided by the compiler. The files only
|
||||||
|
* contains the typedefs required to build FreeRTOS. Read the instructions
|
||||||
|
* in FreeRTOS/source/stdint.readme for more information.
|
||||||
|
*/
|
||||||
|
#include <stdint.h> /* READ COMMENT ABOVE. */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Application specific configuration options. */
|
||||||
|
#include "FreeRTOSConfig.h"
|
||||||
|
|
||||||
|
/* Basic FreeRTOS definitions. */
|
||||||
|
#include "projdefs.h"
|
||||||
|
|
||||||
|
/* Definitions specific to the port being used. */
|
||||||
|
#include "portable.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check all the required application specific macros have been defined.
|
||||||
|
* These macros are application specific and (as downloaded) are defined
|
||||||
|
* within FreeRTOSConfig.h.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef configMINIMAL_STACK_SIZE
|
||||||
|
#error Missing definition: configMINIMAL_STACK_SIZE must be defined in FreeRTOSConfig.h. configMINIMAL_STACK_SIZE defines the size (in words) of the stack allocated to the idle task. Refer to the demo project provided for your port for a suitable value.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configMAX_PRIORITIES
|
||||||
|
#error Missing definition: configMAX_PRIORITIES must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_PREEMPTION
|
||||||
|
#error Missing definition: configUSE_PREEMPTION must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_IDLE_HOOK
|
||||||
|
#error Missing definition: configUSE_IDLE_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_TICK_HOOK
|
||||||
|
#error Missing definition: configUSE_TICK_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_CO_ROUTINES
|
||||||
|
#error Missing definition: configUSE_CO_ROUTINES must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_vTaskPrioritySet
|
||||||
|
#error Missing definition: INCLUDE_vTaskPrioritySet must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_uxTaskPriorityGet
|
||||||
|
#error Missing definition: INCLUDE_uxTaskPriorityGet must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_vTaskDelete
|
||||||
|
#error Missing definition: INCLUDE_vTaskDelete must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_vTaskSuspend
|
||||||
|
#error Missing definition: INCLUDE_vTaskSuspend must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_vTaskDelayUntil
|
||||||
|
#error Missing definition: INCLUDE_vTaskDelayUntil must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_vTaskDelay
|
||||||
|
#error Missing definition: INCLUDE_vTaskDelay must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_16_BIT_TICKS
|
||||||
|
#error Missing definition: configUSE_16_BIT_TICKS must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if configUSE_CO_ROUTINES != 0
|
||||||
|
#ifndef configMAX_CO_ROUTINE_PRIORITIES
|
||||||
|
#error configMAX_CO_ROUTINE_PRIORITIES must be greater than or equal to 1.
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configMAX_PRIORITIES
|
||||||
|
#error configMAX_PRIORITIES must be defined to be greater than or equal to 1.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xTaskGetIdleTaskHandle
|
||||||
|
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xTimerGetTimerDaemonTaskHandle
|
||||||
|
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xQueueGetMutexHolder
|
||||||
|
#define INCLUDE_xQueueGetMutexHolder 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xSemaphoreGetMutexHolder
|
||||||
|
#define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_pcTaskGetTaskName
|
||||||
|
#define INCLUDE_pcTaskGetTaskName 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_APPLICATION_TASK_TAG
|
||||||
|
#define configUSE_APPLICATION_TASK_TAG 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_uxTaskGetStackHighWaterMark
|
||||||
|
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_eTaskGetState
|
||||||
|
#define INCLUDE_eTaskGetState 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_RECURSIVE_MUTEXES
|
||||||
|
#define configUSE_RECURSIVE_MUTEXES 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_MUTEXES
|
||||||
|
#define configUSE_MUTEXES 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_TIMERS
|
||||||
|
#define configUSE_TIMERS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_COUNTING_SEMAPHORES
|
||||||
|
#define configUSE_COUNTING_SEMAPHORES 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_ALTERNATIVE_API
|
||||||
|
#define configUSE_ALTERNATIVE_API 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portCRITICAL_NESTING_IN_TCB
|
||||||
|
#define portCRITICAL_NESTING_IN_TCB 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configMAX_TASK_NAME_LEN
|
||||||
|
#define configMAX_TASK_NAME_LEN 16
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configIDLE_SHOULD_YIELD
|
||||||
|
#define configIDLE_SHOULD_YIELD 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if configMAX_TASK_NAME_LEN < 1
|
||||||
|
#error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xTaskResumeFromISR
|
||||||
|
#define INCLUDE_xTaskResumeFromISR 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xEventGroupSetBitFromISR
|
||||||
|
#define INCLUDE_xEventGroupSetBitFromISR 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xTimerPendFunctionCall
|
||||||
|
#define INCLUDE_xTimerPendFunctionCall 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configASSERT
|
||||||
|
#define configASSERT( x )
|
||||||
|
#define configASSERT_DEFINED 0
|
||||||
|
#else
|
||||||
|
#define configASSERT_DEFINED 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The timers module relies on xTaskGetSchedulerState(). */
|
||||||
|
#if configUSE_TIMERS == 1
|
||||||
|
|
||||||
|
#ifndef configTIMER_TASK_PRIORITY
|
||||||
|
#error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined.
|
||||||
|
#endif /* configTIMER_TASK_PRIORITY */
|
||||||
|
|
||||||
|
#ifndef configTIMER_QUEUE_LENGTH
|
||||||
|
#error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined.
|
||||||
|
#endif /* configTIMER_QUEUE_LENGTH */
|
||||||
|
|
||||||
|
#ifndef configTIMER_TASK_STACK_DEPTH
|
||||||
|
#error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined.
|
||||||
|
#endif /* configTIMER_TASK_STACK_DEPTH */
|
||||||
|
|
||||||
|
#endif /* configUSE_TIMERS */
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xTaskGetSchedulerState
|
||||||
|
#define INCLUDE_xTaskGetSchedulerState 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xTaskGetCurrentTaskHandle
|
||||||
|
#define INCLUDE_xTaskGetCurrentTaskHandle 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef portSET_INTERRUPT_MASK_FROM_ISR
|
||||||
|
#define portSET_INTERRUPT_MASK_FROM_ISR() 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
|
||||||
|
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portCLEAN_UP_TCB
|
||||||
|
#define portCLEAN_UP_TCB( pxTCB ) ( void ) pxTCB
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portPRE_TASK_DELETE_HOOK
|
||||||
|
#define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxYieldPending )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portSETUP_TCB
|
||||||
|
#define portSETUP_TCB( pxTCB ) ( void ) pxTCB
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configQUEUE_REGISTRY_SIZE
|
||||||
|
#define configQUEUE_REGISTRY_SIZE 0U
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ( configQUEUE_REGISTRY_SIZE < 1 )
|
||||||
|
#define vQueueAddToRegistry( xQueue, pcName )
|
||||||
|
#define vQueueUnregisterQueue( xQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portPOINTER_SIZE_TYPE
|
||||||
|
#define portPOINTER_SIZE_TYPE uint32_t
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Remove any unused trace macros. */
|
||||||
|
#ifndef traceSTART
|
||||||
|
/* Used to perform any necessary initialisation - for example, open a file
|
||||||
|
into which trace is to be written. */
|
||||||
|
#define traceSTART()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceEND
|
||||||
|
/* Use to close a trace, for example close a file into which trace has been
|
||||||
|
written. */
|
||||||
|
#define traceEND()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_SWITCHED_IN
|
||||||
|
/* Called after a task has been selected to run. pxCurrentTCB holds a pointer
|
||||||
|
to the task control block of the selected task. */
|
||||||
|
#define traceTASK_SWITCHED_IN()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceINCREASE_TICK_COUNT
|
||||||
|
/* Called before stepping the tick count after waking from tickless idle
|
||||||
|
sleep. */
|
||||||
|
#define traceINCREASE_TICK_COUNT( x )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceLOW_POWER_IDLE_BEGIN
|
||||||
|
/* Called immediately before entering tickless idle. */
|
||||||
|
#define traceLOW_POWER_IDLE_BEGIN()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceLOW_POWER_IDLE_END
|
||||||
|
/* Called when returning to the Idle task after a tickless idle. */
|
||||||
|
#define traceLOW_POWER_IDLE_END()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_SWITCHED_OUT
|
||||||
|
/* Called before a task has been selected to run. pxCurrentTCB holds a pointer
|
||||||
|
to the task control block of the task being switched out. */
|
||||||
|
#define traceTASK_SWITCHED_OUT()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_PRIORITY_INHERIT
|
||||||
|
/* Called when a task attempts to take a mutex that is already held by a
|
||||||
|
lower priority task. pxTCBOfMutexHolder is a pointer to the TCB of the task
|
||||||
|
that holds the mutex. uxInheritedPriority is the priority the mutex holder
|
||||||
|
will inherit (the priority of the task that is attempting to obtain the
|
||||||
|
muted. */
|
||||||
|
#define traceTASK_PRIORITY_INHERIT( pxTCBOfMutexHolder, uxInheritedPriority )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_PRIORITY_DISINHERIT
|
||||||
|
/* Called when a task releases a mutex, the holding of which had resulted in
|
||||||
|
the task inheriting the priority of a higher priority task.
|
||||||
|
pxTCBOfMutexHolder is a pointer to the TCB of the task that is releasing the
|
||||||
|
mutex. uxOriginalPriority is the task's configured (base) priority. */
|
||||||
|
#define traceTASK_PRIORITY_DISINHERIT( pxTCBOfMutexHolder, uxOriginalPriority )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceBLOCKING_ON_QUEUE_RECEIVE
|
||||||
|
/* Task is about to block because it cannot read from a
|
||||||
|
queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
|
||||||
|
upon which the read was attempted. pxCurrentTCB points to the TCB of the
|
||||||
|
task that attempted the read. */
|
||||||
|
#define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceBLOCKING_ON_QUEUE_SEND
|
||||||
|
/* Task is about to block because it cannot write to a
|
||||||
|
queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
|
||||||
|
upon which the write was attempted. pxCurrentTCB points to the TCB of the
|
||||||
|
task that attempted the write. */
|
||||||
|
#define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configCHECK_FOR_STACK_OVERFLOW
|
||||||
|
#define configCHECK_FOR_STACK_OVERFLOW 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The following event macros are embedded in the kernel API calls. */
|
||||||
|
|
||||||
|
#ifndef traceMOVED_TASK_TO_READY_STATE
|
||||||
|
#define traceMOVED_TASK_TO_READY_STATE( pxTCB )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_CREATE
|
||||||
|
#define traceQUEUE_CREATE( pxNewQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_CREATE_FAILED
|
||||||
|
#define traceQUEUE_CREATE_FAILED( ucQueueType )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceCREATE_MUTEX
|
||||||
|
#define traceCREATE_MUTEX( pxNewQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceCREATE_MUTEX_FAILED
|
||||||
|
#define traceCREATE_MUTEX_FAILED()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceGIVE_MUTEX_RECURSIVE
|
||||||
|
#define traceGIVE_MUTEX_RECURSIVE( pxMutex )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
|
||||||
|
#define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTAKE_MUTEX_RECURSIVE
|
||||||
|
#define traceTAKE_MUTEX_RECURSIVE( pxMutex )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
|
||||||
|
#define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceCREATE_COUNTING_SEMAPHORE
|
||||||
|
#define traceCREATE_COUNTING_SEMAPHORE()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
|
||||||
|
#define traceCREATE_COUNTING_SEMAPHORE_FAILED()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_SEND
|
||||||
|
#define traceQUEUE_SEND( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_SEND_FAILED
|
||||||
|
#define traceQUEUE_SEND_FAILED( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_RECEIVE
|
||||||
|
#define traceQUEUE_RECEIVE( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_PEEK
|
||||||
|
#define traceQUEUE_PEEK( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_PEEK_FROM_ISR
|
||||||
|
#define traceQUEUE_PEEK_FROM_ISR( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_RECEIVE_FAILED
|
||||||
|
#define traceQUEUE_RECEIVE_FAILED( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_SEND_FROM_ISR
|
||||||
|
#define traceQUEUE_SEND_FROM_ISR( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_SEND_FROM_ISR_FAILED
|
||||||
|
#define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_RECEIVE_FROM_ISR
|
||||||
|
#define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
|
||||||
|
#define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_PEEK_FROM_ISR_FAILED
|
||||||
|
#define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_DELETE
|
||||||
|
#define traceQUEUE_DELETE( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_CREATE
|
||||||
|
#define traceTASK_CREATE( pxNewTCB )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_CREATE_FAILED
|
||||||
|
#define traceTASK_CREATE_FAILED()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_DELETE
|
||||||
|
#define traceTASK_DELETE( pxTaskToDelete )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_DELAY_UNTIL
|
||||||
|
#define traceTASK_DELAY_UNTIL()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_DELAY
|
||||||
|
#define traceTASK_DELAY()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_PRIORITY_SET
|
||||||
|
#define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_SUSPEND
|
||||||
|
#define traceTASK_SUSPEND( pxTaskToSuspend )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_RESUME
|
||||||
|
#define traceTASK_RESUME( pxTaskToResume )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_RESUME_FROM_ISR
|
||||||
|
#define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_INCREMENT_TICK
|
||||||
|
#define traceTASK_INCREMENT_TICK( xTickCount )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTIMER_CREATE
|
||||||
|
#define traceTIMER_CREATE( pxNewTimer )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTIMER_CREATE_FAILED
|
||||||
|
#define traceTIMER_CREATE_FAILED()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTIMER_COMMAND_SEND
|
||||||
|
#define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTIMER_EXPIRED
|
||||||
|
#define traceTIMER_EXPIRED( pxTimer )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTIMER_COMMAND_RECEIVED
|
||||||
|
#define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceMALLOC
|
||||||
|
#define traceMALLOC( pvAddress, uiSize )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceFREE
|
||||||
|
#define traceFREE( pvAddress, uiSize )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceEVENT_GROUP_CREATE
|
||||||
|
#define traceEVENT_GROUP_CREATE( xEventGroup )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceEVENT_GROUP_CREATE_FAILED
|
||||||
|
#define traceEVENT_GROUP_CREATE_FAILED()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceEVENT_GROUP_SYNC_BLOCK
|
||||||
|
#define traceEVENT_GROUP_SYNC_BLOCK( xEventGroup, uxBitsToSet, uxBitsToWaitFor )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceEVENT_GROUP_SYNC_END
|
||||||
|
#define traceEVENT_GROUP_SYNC_END( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) xTimeoutOccurred
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceEVENT_GROUP_WAIT_BITS_BLOCK
|
||||||
|
#define traceEVENT_GROUP_WAIT_BITS_BLOCK( xEventGroup, uxBitsToWaitFor )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceEVENT_GROUP_WAIT_BITS_END
|
||||||
|
#define traceEVENT_GROUP_WAIT_BITS_END( xEventGroup, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) xTimeoutOccurred
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceEVENT_GROUP_CLEAR_BITS
|
||||||
|
#define traceEVENT_GROUP_CLEAR_BITS( xEventGroup, uxBitsToClear )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR
|
||||||
|
#define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceEVENT_GROUP_SET_BITS
|
||||||
|
#define traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceEVENT_GROUP_SET_BITS_FROM_ISR
|
||||||
|
#define traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceEVENT_GROUP_DELETE
|
||||||
|
#define traceEVENT_GROUP_DELETE( xEventGroup )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef tracePEND_FUNC_CALL
|
||||||
|
#define tracePEND_FUNC_CALL(xFunctionToPend, pvParameter1, ulParameter2, ret)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef tracePEND_FUNC_CALL_FROM_ISR
|
||||||
|
#define tracePEND_FUNC_CALL_FROM_ISR(xFunctionToPend, pvParameter1, ulParameter2, ret)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_REGISTRY_ADD
|
||||||
|
#define traceQUEUE_REGISTRY_ADD(xQueue, pcQueueName)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configGENERATE_RUN_TIME_STATS
|
||||||
|
#define configGENERATE_RUN_TIME_STATS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ( configGENERATE_RUN_TIME_STATS == 1 )
|
||||||
|
|
||||||
|
#ifndef configUSE_STATS_FORMATTING_FUNCTIONS
|
||||||
|
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
|
||||||
|
#error If configGENERATE_RUN_TIME_STATS is defined then portCONFIGURE_TIMER_FOR_RUN_TIME_STATS must also be defined. portCONFIGURE_TIMER_FOR_RUN_TIME_STATS should call a port layer function to setup a peripheral timer/counter that can then be used as the run time counter time base.
|
||||||
|
#endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
|
||||||
|
|
||||||
|
#ifndef portGET_RUN_TIME_COUNTER_VALUE
|
||||||
|
#ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
|
||||||
|
#error If configGENERATE_RUN_TIME_STATS is defined then either portGET_RUN_TIME_COUNTER_VALUE or portALT_GET_RUN_TIME_COUNTER_VALUE must also be defined. See the examples provided and the FreeRTOS web site for more information.
|
||||||
|
#endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
|
||||||
|
#endif /* portGET_RUN_TIME_COUNTER_VALUE */
|
||||||
|
|
||||||
|
#endif /* configGENERATE_RUN_TIME_STATS */
|
||||||
|
|
||||||
|
#ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
|
||||||
|
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_MALLOC_FAILED_HOOK
|
||||||
|
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portPRIVILEGE_BIT
|
||||||
|
#define portPRIVILEGE_BIT ( ( UBaseType_t ) 0x00 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portYIELD_WITHIN_API
|
||||||
|
#define portYIELD_WITHIN_API portYIELD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef pvPortMallocAligned
|
||||||
|
#define pvPortMallocAligned( x, puxStackBuffer ) ( ( ( puxStackBuffer ) == NULL ) ? ( pvPortMalloc( ( x ) ) ) : ( puxStackBuffer ) )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef vPortFreeAligned
|
||||||
|
#define vPortFreeAligned( pvBlockToFree ) vPortFree( pvBlockToFree )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portSUPPRESS_TICKS_AND_SLEEP
|
||||||
|
#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
|
||||||
|
#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
|
||||||
|
#error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_TICKLESS_IDLE
|
||||||
|
#define configUSE_TICKLESS_IDLE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configPRE_SLEEP_PROCESSING
|
||||||
|
#define configPRE_SLEEP_PROCESSING( x )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configPOST_SLEEP_PROCESSING
|
||||||
|
#define configPOST_SLEEP_PROCESSING( x )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_QUEUE_SETS
|
||||||
|
#define configUSE_QUEUE_SETS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portTASK_USES_FLOATING_POINT
|
||||||
|
#define portTASK_USES_FLOATING_POINT()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_TIME_SLICING
|
||||||
|
#define configUSE_TIME_SLICING 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
|
||||||
|
#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_NEWLIB_REENTRANT
|
||||||
|
#define configUSE_NEWLIB_REENTRANT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_STATS_FORMATTING_FUNCTIONS
|
||||||
|
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portASSERT_IF_INTERRUPT_PRIORITY_INVALID
|
||||||
|
#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_TRACE_FACILITY
|
||||||
|
#define configUSE_TRACE_FACILITY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef mtCOVERAGE_TEST_MARKER
|
||||||
|
#define mtCOVERAGE_TEST_MARKER()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portASSERT_IF_IN_ISR
|
||||||
|
#define portASSERT_IF_IN_ISR()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
|
||||||
|
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Definitions to allow backward compatibility with FreeRTOS versions prior to
|
||||||
|
V8 if desired. */
|
||||||
|
#ifndef configENABLE_BACKWARD_COMPATIBILITY
|
||||||
|
#define configENABLE_BACKWARD_COMPATIBILITY 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if configENABLE_BACKWARD_COMPATIBILITY == 1
|
||||||
|
#define eTaskStateGet eTaskGetState
|
||||||
|
#define portTickType TickType_t
|
||||||
|
#define xTaskHandle TaskHandle_t
|
||||||
|
#define xQueueHandle QueueHandle_t
|
||||||
|
#define xSemaphoreHandle SemaphoreHandle_t
|
||||||
|
#define xQueueSetHandle QueueSetHandle_t
|
||||||
|
#define xQueueSetMemberHandle QueueSetMemberHandle_t
|
||||||
|
#define xTimeOutType TimeOut_t
|
||||||
|
#define xMemoryRegion MemoryRegion_t
|
||||||
|
#define xTaskParameters TaskParameters_t
|
||||||
|
#define xTaskStatusType TaskStatus_t
|
||||||
|
#define xTimerHandle TimerHandle_t
|
||||||
|
#define xCoRoutineHandle CoRoutineHandle_t
|
||||||
|
#define pdTASK_HOOK_CODE TaskHookFunction_t
|
||||||
|
#define portTICK_RATE_MS portTICK_PERIOD_MS
|
||||||
|
|
||||||
|
/* Backward compatibility within the scheduler code only - these definitions
|
||||||
|
are not really required but are included for completeness. */
|
||||||
|
#define tmrTIMER_CALLBACK TimerCallbackFunction_t
|
||||||
|
#define pdTASK_CODE TaskFunction_t
|
||||||
|
#define xListItem ListItem_t
|
||||||
|
#define xList List_t
|
||||||
|
#endif /* configENABLE_BACKWARD_COMPATIBILITY */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* INC_FREERTOS_H */
|
||||||
|
|
|
@ -0,0 +1,758 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||||
|
All rights reserved
|
||||||
|
|
||||||
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS provides completely free yet professionally developed, *
|
||||||
|
* robust, strictly quality controlled, supported, and cross *
|
||||||
|
* platform software that has become a de facto standard. *
|
||||||
|
* *
|
||||||
|
* Help yourself get started quickly and support the FreeRTOS *
|
||||||
|
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||||
|
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||||
|
* *
|
||||||
|
* Thank you! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||||
|
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||||
|
>>! obliged to provide the source code for proprietary components !<<
|
||||||
|
>>! outside of the FreeRTOS kernel. !<<
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||||
|
link: http://www.freertos.org/a00114.html
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||||
|
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||||
|
licenses offer ticketed support, indemnification and middleware.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CO_ROUTINE_H
|
||||||
|
#define CO_ROUTINE_H
|
||||||
|
|
||||||
|
#ifndef INC_FREERTOS_H
|
||||||
|
#error "include FreeRTOS.h must appear in source files before include croutine.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "list.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Used to hide the implementation of the co-routine control block. The
|
||||||
|
control block structure however has to be included in the header due to
|
||||||
|
the macro implementation of the co-routine functionality. */
|
||||||
|
typedef void * CoRoutineHandle_t;
|
||||||
|
|
||||||
|
/* Defines the prototype to which co-routine functions must conform. */
|
||||||
|
typedef void (*crCOROUTINE_CODE)( CoRoutineHandle_t, UBaseType_t );
|
||||||
|
|
||||||
|
typedef struct corCoRoutineControlBlock
|
||||||
|
{
|
||||||
|
crCOROUTINE_CODE pxCoRoutineFunction;
|
||||||
|
ListItem_t xGenericListItem; /*< List item used to place the CRCB in ready and blocked queues. */
|
||||||
|
ListItem_t xEventListItem; /*< List item used to place the CRCB in event lists. */
|
||||||
|
UBaseType_t uxPriority; /*< The priority of the co-routine in relation to other co-routines. */
|
||||||
|
UBaseType_t uxIndex; /*< Used to distinguish between co-routines when multiple co-routines use the same co-routine function. */
|
||||||
|
uint16_t uxState; /*< Used internally by the co-routine implementation. */
|
||||||
|
} CRCB_t; /* Co-routine control block. Note must be identical in size down to uxPriority with TCB_t. */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* croutine. h
|
||||||
|
*<pre>
|
||||||
|
BaseType_t xCoRoutineCreate(
|
||||||
|
crCOROUTINE_CODE pxCoRoutineCode,
|
||||||
|
UBaseType_t uxPriority,
|
||||||
|
UBaseType_t uxIndex
|
||||||
|
);</pre>
|
||||||
|
*
|
||||||
|
* Create a new co-routine and add it to the list of co-routines that are
|
||||||
|
* ready to run.
|
||||||
|
*
|
||||||
|
* @param pxCoRoutineCode Pointer to the co-routine function. Co-routine
|
||||||
|
* functions require special syntax - see the co-routine section of the WEB
|
||||||
|
* documentation for more information.
|
||||||
|
*
|
||||||
|
* @param uxPriority The priority with respect to other co-routines at which
|
||||||
|
* the co-routine will run.
|
||||||
|
*
|
||||||
|
* @param uxIndex Used to distinguish between different co-routines that
|
||||||
|
* execute the same function. See the example below and the co-routine section
|
||||||
|
* of the WEB documentation for further information.
|
||||||
|
*
|
||||||
|
* @return pdPASS if the co-routine was successfully created and added to a ready
|
||||||
|
* list, otherwise an error code defined with ProjDefs.h.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// Co-routine to be created.
|
||||||
|
void vFlashCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
|
||||||
|
{
|
||||||
|
// Variables in co-routines must be declared static if they must maintain value across a blocking call.
|
||||||
|
// This may not be necessary for const variables.
|
||||||
|
static const char cLedToFlash[ 2 ] = { 5, 6 };
|
||||||
|
static const TickType_t uxFlashRates[ 2 ] = { 200, 400 };
|
||||||
|
|
||||||
|
// Must start every co-routine with a call to crSTART();
|
||||||
|
crSTART( xHandle );
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// This co-routine just delays for a fixed period, then toggles
|
||||||
|
// an LED. Two co-routines are created using this function, so
|
||||||
|
// the uxIndex parameter is used to tell the co-routine which
|
||||||
|
// LED to flash and how int32_t to delay. This assumes xQueue has
|
||||||
|
// already been created.
|
||||||
|
vParTestToggleLED( cLedToFlash[ uxIndex ] );
|
||||||
|
crDELAY( xHandle, uxFlashRates[ uxIndex ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Must end every co-routine with a call to crEND();
|
||||||
|
crEND();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function that creates two co-routines.
|
||||||
|
void vOtherFunction( void )
|
||||||
|
{
|
||||||
|
uint8_t ucParameterToPass;
|
||||||
|
TaskHandle_t xHandle;
|
||||||
|
|
||||||
|
// Create two co-routines at priority 0. The first is given index 0
|
||||||
|
// so (from the code above) toggles LED 5 every 200 ticks. The second
|
||||||
|
// is given index 1 so toggles LED 6 every 400 ticks.
|
||||||
|
for( uxIndex = 0; uxIndex < 2; uxIndex++ )
|
||||||
|
{
|
||||||
|
xCoRoutineCreate( vFlashCoRoutine, 0, uxIndex );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xCoRoutineCreate xCoRoutineCreate
|
||||||
|
* \ingroup Tasks
|
||||||
|
*/
|
||||||
|
BaseType_t xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, UBaseType_t uxPriority, UBaseType_t uxIndex );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* croutine. h
|
||||||
|
*<pre>
|
||||||
|
void vCoRoutineSchedule( void );</pre>
|
||||||
|
*
|
||||||
|
* Run a co-routine.
|
||||||
|
*
|
||||||
|
* vCoRoutineSchedule() executes the highest priority co-routine that is able
|
||||||
|
* to run. The co-routine will execute until it either blocks, yields or is
|
||||||
|
* preempted by a task. Co-routines execute cooperatively so one
|
||||||
|
* co-routine cannot be preempted by another, but can be preempted by a task.
|
||||||
|
*
|
||||||
|
* If an application comprises of both tasks and co-routines then
|
||||||
|
* vCoRoutineSchedule should be called from the idle task (in an idle task
|
||||||
|
* hook).
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// This idle task hook will schedule a co-routine each time it is called.
|
||||||
|
// The rest of the idle task will execute between co-routine calls.
|
||||||
|
void vApplicationIdleHook( void )
|
||||||
|
{
|
||||||
|
vCoRoutineSchedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alternatively, if you do not require any other part of the idle task to
|
||||||
|
// execute, the idle task hook can call vCoRoutineScheduler() within an
|
||||||
|
// infinite loop.
|
||||||
|
void vApplicationIdleHook( void )
|
||||||
|
{
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
vCoRoutineSchedule();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup vCoRoutineSchedule vCoRoutineSchedule
|
||||||
|
* \ingroup Tasks
|
||||||
|
*/
|
||||||
|
void vCoRoutineSchedule( void );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* croutine. h
|
||||||
|
* <pre>
|
||||||
|
crSTART( CoRoutineHandle_t xHandle );</pre>
|
||||||
|
*
|
||||||
|
* This macro MUST always be called at the start of a co-routine function.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// Co-routine to be created.
|
||||||
|
void vACoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
|
||||||
|
{
|
||||||
|
// Variables in co-routines must be declared static if they must maintain value across a blocking call.
|
||||||
|
static int32_t ulAVariable;
|
||||||
|
|
||||||
|
// Must start every co-routine with a call to crSTART();
|
||||||
|
crSTART( xHandle );
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// Co-routine functionality goes here.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Must end every co-routine with a call to crEND();
|
||||||
|
crEND();
|
||||||
|
}</pre>
|
||||||
|
* \defgroup crSTART crSTART
|
||||||
|
* \ingroup Tasks
|
||||||
|
*/
|
||||||
|
#define crSTART( pxCRCB ) switch( ( ( CRCB_t * )( pxCRCB ) )->uxState ) { case 0:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* croutine. h
|
||||||
|
* <pre>
|
||||||
|
crEND();</pre>
|
||||||
|
*
|
||||||
|
* This macro MUST always be called at the end of a co-routine function.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// Co-routine to be created.
|
||||||
|
void vACoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
|
||||||
|
{
|
||||||
|
// Variables in co-routines must be declared static if they must maintain value across a blocking call.
|
||||||
|
static int32_t ulAVariable;
|
||||||
|
|
||||||
|
// Must start every co-routine with a call to crSTART();
|
||||||
|
crSTART( xHandle );
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// Co-routine functionality goes here.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Must end every co-routine with a call to crEND();
|
||||||
|
crEND();
|
||||||
|
}</pre>
|
||||||
|
* \defgroup crSTART crSTART
|
||||||
|
* \ingroup Tasks
|
||||||
|
*/
|
||||||
|
#define crEND() }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These macros are intended for internal use by the co-routine implementation
|
||||||
|
* only. The macros should not be used directly by application writers.
|
||||||
|
*/
|
||||||
|
#define crSET_STATE0( xHandle ) ( ( CRCB_t * )( xHandle ) )->uxState = (__LINE__ * 2); return; case (__LINE__ * 2):
|
||||||
|
#define crSET_STATE1( xHandle ) ( ( CRCB_t * )( xHandle ) )->uxState = ((__LINE__ * 2)+1); return; case ((__LINE__ * 2)+1):
|
||||||
|
|
||||||
|
/**
|
||||||
|
* croutine. h
|
||||||
|
*<pre>
|
||||||
|
crDELAY( CoRoutineHandle_t xHandle, TickType_t xTicksToDelay );</pre>
|
||||||
|
*
|
||||||
|
* Delay a co-routine for a fixed period of time.
|
||||||
|
*
|
||||||
|
* crDELAY can only be called from the co-routine function itself - not
|
||||||
|
* from within a function called by the co-routine function. This is because
|
||||||
|
* co-routines do not maintain their own stack.
|
||||||
|
*
|
||||||
|
* @param xHandle The handle of the co-routine to delay. This is the xHandle
|
||||||
|
* parameter of the co-routine function.
|
||||||
|
*
|
||||||
|
* @param xTickToDelay The number of ticks that the co-routine should delay
|
||||||
|
* for. The actual amount of time this equates to is defined by
|
||||||
|
* configTICK_RATE_HZ (set in FreeRTOSConfig.h). The constant portTICK_PERIOD_MS
|
||||||
|
* can be used to convert ticks to milliseconds.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// Co-routine to be created.
|
||||||
|
void vACoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
|
||||||
|
{
|
||||||
|
// Variables in co-routines must be declared static if they must maintain value across a blocking call.
|
||||||
|
// This may not be necessary for const variables.
|
||||||
|
// We are to delay for 200ms.
|
||||||
|
static const xTickType xDelayTime = 200 / portTICK_PERIOD_MS;
|
||||||
|
|
||||||
|
// Must start every co-routine with a call to crSTART();
|
||||||
|
crSTART( xHandle );
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// Delay for 200ms.
|
||||||
|
crDELAY( xHandle, xDelayTime );
|
||||||
|
|
||||||
|
// Do something here.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Must end every co-routine with a call to crEND();
|
||||||
|
crEND();
|
||||||
|
}</pre>
|
||||||
|
* \defgroup crDELAY crDELAY
|
||||||
|
* \ingroup Tasks
|
||||||
|
*/
|
||||||
|
#define crDELAY( xHandle, xTicksToDelay ) \
|
||||||
|
if( ( xTicksToDelay ) > 0 ) \
|
||||||
|
{ \
|
||||||
|
vCoRoutineAddToDelayedList( ( xTicksToDelay ), NULL ); \
|
||||||
|
} \
|
||||||
|
crSET_STATE0( ( xHandle ) );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
crQUEUE_SEND(
|
||||||
|
CoRoutineHandle_t xHandle,
|
||||||
|
QueueHandle_t pxQueue,
|
||||||
|
void *pvItemToQueue,
|
||||||
|
TickType_t xTicksToWait,
|
||||||
|
BaseType_t *pxResult
|
||||||
|
)</pre>
|
||||||
|
*
|
||||||
|
* The macro's crQUEUE_SEND() and crQUEUE_RECEIVE() are the co-routine
|
||||||
|
* equivalent to the xQueueSend() and xQueueReceive() functions used by tasks.
|
||||||
|
*
|
||||||
|
* crQUEUE_SEND and crQUEUE_RECEIVE can only be used from a co-routine whereas
|
||||||
|
* xQueueSend() and xQueueReceive() can only be used from tasks.
|
||||||
|
*
|
||||||
|
* crQUEUE_SEND can only be called from the co-routine function itself - not
|
||||||
|
* from within a function called by the co-routine function. This is because
|
||||||
|
* co-routines do not maintain their own stack.
|
||||||
|
*
|
||||||
|
* See the co-routine section of the WEB documentation for information on
|
||||||
|
* passing data between tasks and co-routines and between ISR's and
|
||||||
|
* co-routines.
|
||||||
|
*
|
||||||
|
* @param xHandle The handle of the calling co-routine. This is the xHandle
|
||||||
|
* parameter of the co-routine function.
|
||||||
|
*
|
||||||
|
* @param pxQueue The handle of the queue on which the data will be posted.
|
||||||
|
* The handle is obtained as the return value when the queue is created using
|
||||||
|
* the xQueueCreate() API function.
|
||||||
|
*
|
||||||
|
* @param pvItemToQueue A pointer to the data being posted onto the queue.
|
||||||
|
* The number of bytes of each queued item is specified when the queue is
|
||||||
|
* created. This number of bytes is copied from pvItemToQueue into the queue
|
||||||
|
* itself.
|
||||||
|
*
|
||||||
|
* @param xTickToDelay The number of ticks that the co-routine should block
|
||||||
|
* to wait for space to become available on the queue, should space not be
|
||||||
|
* available immediately. The actual amount of time this equates to is defined
|
||||||
|
* by configTICK_RATE_HZ (set in FreeRTOSConfig.h). The constant
|
||||||
|
* portTICK_PERIOD_MS can be used to convert ticks to milliseconds (see example
|
||||||
|
* below).
|
||||||
|
*
|
||||||
|
* @param pxResult The variable pointed to by pxResult will be set to pdPASS if
|
||||||
|
* data was successfully posted onto the queue, otherwise it will be set to an
|
||||||
|
* error defined within ProjDefs.h.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// Co-routine function that blocks for a fixed period then posts a number onto
|
||||||
|
// a queue.
|
||||||
|
static void prvCoRoutineFlashTask( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
|
||||||
|
{
|
||||||
|
// Variables in co-routines must be declared static if they must maintain value across a blocking call.
|
||||||
|
static BaseType_t xNumberToPost = 0;
|
||||||
|
static BaseType_t xResult;
|
||||||
|
|
||||||
|
// Co-routines must begin with a call to crSTART().
|
||||||
|
crSTART( xHandle );
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// This assumes the queue has already been created.
|
||||||
|
crQUEUE_SEND( xHandle, xCoRoutineQueue, &xNumberToPost, NO_DELAY, &xResult );
|
||||||
|
|
||||||
|
if( xResult != pdPASS )
|
||||||
|
{
|
||||||
|
// The message was not posted!
|
||||||
|
}
|
||||||
|
|
||||||
|
// Increment the number to be posted onto the queue.
|
||||||
|
xNumberToPost++;
|
||||||
|
|
||||||
|
// Delay for 100 ticks.
|
||||||
|
crDELAY( xHandle, 100 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Co-routines must end with a call to crEND().
|
||||||
|
crEND();
|
||||||
|
}</pre>
|
||||||
|
* \defgroup crQUEUE_SEND crQUEUE_SEND
|
||||||
|
* \ingroup Tasks
|
||||||
|
*/
|
||||||
|
#define crQUEUE_SEND( xHandle, pxQueue, pvItemToQueue, xTicksToWait, pxResult ) \
|
||||||
|
{ \
|
||||||
|
*( pxResult ) = xQueueCRSend( ( pxQueue) , ( pvItemToQueue) , ( xTicksToWait ) ); \
|
||||||
|
if( *( pxResult ) == errQUEUE_BLOCKED ) \
|
||||||
|
{ \
|
||||||
|
crSET_STATE0( ( xHandle ) ); \
|
||||||
|
*pxResult = xQueueCRSend( ( pxQueue ), ( pvItemToQueue ), 0 ); \
|
||||||
|
} \
|
||||||
|
if( *pxResult == errQUEUE_YIELD ) \
|
||||||
|
{ \
|
||||||
|
crSET_STATE1( ( xHandle ) ); \
|
||||||
|
*pxResult = pdPASS; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* croutine. h
|
||||||
|
* <pre>
|
||||||
|
crQUEUE_RECEIVE(
|
||||||
|
CoRoutineHandle_t xHandle,
|
||||||
|
QueueHandle_t pxQueue,
|
||||||
|
void *pvBuffer,
|
||||||
|
TickType_t xTicksToWait,
|
||||||
|
BaseType_t *pxResult
|
||||||
|
)</pre>
|
||||||
|
*
|
||||||
|
* The macro's crQUEUE_SEND() and crQUEUE_RECEIVE() are the co-routine
|
||||||
|
* equivalent to the xQueueSend() and xQueueReceive() functions used by tasks.
|
||||||
|
*
|
||||||
|
* crQUEUE_SEND and crQUEUE_RECEIVE can only be used from a co-routine whereas
|
||||||
|
* xQueueSend() and xQueueReceive() can only be used from tasks.
|
||||||
|
*
|
||||||
|
* crQUEUE_RECEIVE can only be called from the co-routine function itself - not
|
||||||
|
* from within a function called by the co-routine function. This is because
|
||||||
|
* co-routines do not maintain their own stack.
|
||||||
|
*
|
||||||
|
* See the co-routine section of the WEB documentation for information on
|
||||||
|
* passing data between tasks and co-routines and between ISR's and
|
||||||
|
* co-routines.
|
||||||
|
*
|
||||||
|
* @param xHandle The handle of the calling co-routine. This is the xHandle
|
||||||
|
* parameter of the co-routine function.
|
||||||
|
*
|
||||||
|
* @param pxQueue The handle of the queue from which the data will be received.
|
||||||
|
* The handle is obtained as the return value when the queue is created using
|
||||||
|
* the xQueueCreate() API function.
|
||||||
|
*
|
||||||
|
* @param pvBuffer The buffer into which the received item is to be copied.
|
||||||
|
* The number of bytes of each queued item is specified when the queue is
|
||||||
|
* created. This number of bytes is copied into pvBuffer.
|
||||||
|
*
|
||||||
|
* @param xTickToDelay The number of ticks that the co-routine should block
|
||||||
|
* to wait for data to become available from the queue, should data not be
|
||||||
|
* available immediately. The actual amount of time this equates to is defined
|
||||||
|
* by configTICK_RATE_HZ (set in FreeRTOSConfig.h). The constant
|
||||||
|
* portTICK_PERIOD_MS can be used to convert ticks to milliseconds (see the
|
||||||
|
* crQUEUE_SEND example).
|
||||||
|
*
|
||||||
|
* @param pxResult The variable pointed to by pxResult will be set to pdPASS if
|
||||||
|
* data was successfully retrieved from the queue, otherwise it will be set to
|
||||||
|
* an error code as defined within ProjDefs.h.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// A co-routine receives the number of an LED to flash from a queue. It
|
||||||
|
// blocks on the queue until the number is received.
|
||||||
|
static void prvCoRoutineFlashWorkTask( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
|
||||||
|
{
|
||||||
|
// Variables in co-routines must be declared static if they must maintain value across a blocking call.
|
||||||
|
static BaseType_t xResult;
|
||||||
|
static UBaseType_t uxLEDToFlash;
|
||||||
|
|
||||||
|
// All co-routines must start with a call to crSTART().
|
||||||
|
crSTART( xHandle );
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// Wait for data to become available on the queue.
|
||||||
|
crQUEUE_RECEIVE( xHandle, xCoRoutineQueue, &uxLEDToFlash, portMAX_DELAY, &xResult );
|
||||||
|
|
||||||
|
if( xResult == pdPASS )
|
||||||
|
{
|
||||||
|
// We received the LED to flash - flash it!
|
||||||
|
vParTestToggleLED( uxLEDToFlash );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
crEND();
|
||||||
|
}</pre>
|
||||||
|
* \defgroup crQUEUE_RECEIVE crQUEUE_RECEIVE
|
||||||
|
* \ingroup Tasks
|
||||||
|
*/
|
||||||
|
#define crQUEUE_RECEIVE( xHandle, pxQueue, pvBuffer, xTicksToWait, pxResult ) \
|
||||||
|
{ \
|
||||||
|
*( pxResult ) = xQueueCRReceive( ( pxQueue) , ( pvBuffer ), ( xTicksToWait ) ); \
|
||||||
|
if( *( pxResult ) == errQUEUE_BLOCKED ) \
|
||||||
|
{ \
|
||||||
|
crSET_STATE0( ( xHandle ) ); \
|
||||||
|
*( pxResult ) = xQueueCRReceive( ( pxQueue) , ( pvBuffer ), 0 ); \
|
||||||
|
} \
|
||||||
|
if( *( pxResult ) == errQUEUE_YIELD ) \
|
||||||
|
{ \
|
||||||
|
crSET_STATE1( ( xHandle ) ); \
|
||||||
|
*( pxResult ) = pdPASS; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* croutine. h
|
||||||
|
* <pre>
|
||||||
|
crQUEUE_SEND_FROM_ISR(
|
||||||
|
QueueHandle_t pxQueue,
|
||||||
|
void *pvItemToQueue,
|
||||||
|
BaseType_t xCoRoutinePreviouslyWoken
|
||||||
|
)</pre>
|
||||||
|
*
|
||||||
|
* The macro's crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() are the
|
||||||
|
* co-routine equivalent to the xQueueSendFromISR() and xQueueReceiveFromISR()
|
||||||
|
* functions used by tasks.
|
||||||
|
*
|
||||||
|
* crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() can only be used to
|
||||||
|
* pass data between a co-routine and and ISR, whereas xQueueSendFromISR() and
|
||||||
|
* xQueueReceiveFromISR() can only be used to pass data between a task and and
|
||||||
|
* ISR.
|
||||||
|
*
|
||||||
|
* crQUEUE_SEND_FROM_ISR can only be called from an ISR to send data to a queue
|
||||||
|
* that is being used from within a co-routine.
|
||||||
|
*
|
||||||
|
* See the co-routine section of the WEB documentation for information on
|
||||||
|
* passing data between tasks and co-routines and between ISR's and
|
||||||
|
* co-routines.
|
||||||
|
*
|
||||||
|
* @param xQueue The handle to the queue on which the item is to be posted.
|
||||||
|
*
|
||||||
|
* @param pvItemToQueue A pointer to the item that is to be placed on the
|
||||||
|
* queue. The size of the items the queue will hold was defined when the
|
||||||
|
* queue was created, so this many bytes will be copied from pvItemToQueue
|
||||||
|
* into the queue storage area.
|
||||||
|
*
|
||||||
|
* @param xCoRoutinePreviouslyWoken This is included so an ISR can post onto
|
||||||
|
* the same queue multiple times from a single interrupt. The first call
|
||||||
|
* should always pass in pdFALSE. Subsequent calls should pass in
|
||||||
|
* the value returned from the previous call.
|
||||||
|
*
|
||||||
|
* @return pdTRUE if a co-routine was woken by posting onto the queue. This is
|
||||||
|
* used by the ISR to determine if a context switch may be required following
|
||||||
|
* the ISR.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// A co-routine that blocks on a queue waiting for characters to be received.
|
||||||
|
static void vReceivingCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
|
||||||
|
{
|
||||||
|
char cRxedChar;
|
||||||
|
BaseType_t xResult;
|
||||||
|
|
||||||
|
// All co-routines must start with a call to crSTART().
|
||||||
|
crSTART( xHandle );
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// Wait for data to become available on the queue. This assumes the
|
||||||
|
// queue xCommsRxQueue has already been created!
|
||||||
|
crQUEUE_RECEIVE( xHandle, xCommsRxQueue, &uxLEDToFlash, portMAX_DELAY, &xResult );
|
||||||
|
|
||||||
|
// Was a character received?
|
||||||
|
if( xResult == pdPASS )
|
||||||
|
{
|
||||||
|
// Process the character here.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// All co-routines must end with a call to crEND().
|
||||||
|
crEND();
|
||||||
|
}
|
||||||
|
|
||||||
|
// An ISR that uses a queue to send characters received on a serial port to
|
||||||
|
// a co-routine.
|
||||||
|
void vUART_ISR( void )
|
||||||
|
{
|
||||||
|
char cRxedChar;
|
||||||
|
BaseType_t xCRWokenByPost = pdFALSE;
|
||||||
|
|
||||||
|
// We loop around reading characters until there are none left in the UART.
|
||||||
|
while( UART_RX_REG_NOT_EMPTY() )
|
||||||
|
{
|
||||||
|
// Obtain the character from the UART.
|
||||||
|
cRxedChar = UART_RX_REG;
|
||||||
|
|
||||||
|
// Post the character onto a queue. xCRWokenByPost will be pdFALSE
|
||||||
|
// the first time around the loop. If the post causes a co-routine
|
||||||
|
// to be woken (unblocked) then xCRWokenByPost will be set to pdTRUE.
|
||||||
|
// In this manner we can ensure that if more than one co-routine is
|
||||||
|
// blocked on the queue only one is woken by this ISR no matter how
|
||||||
|
// many characters are posted to the queue.
|
||||||
|
xCRWokenByPost = crQUEUE_SEND_FROM_ISR( xCommsRxQueue, &cRxedChar, xCRWokenByPost );
|
||||||
|
}
|
||||||
|
}</pre>
|
||||||
|
* \defgroup crQUEUE_SEND_FROM_ISR crQUEUE_SEND_FROM_ISR
|
||||||
|
* \ingroup Tasks
|
||||||
|
*/
|
||||||
|
#define crQUEUE_SEND_FROM_ISR( pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken ) xQueueCRSendFromISR( ( pxQueue ), ( pvItemToQueue ), ( xCoRoutinePreviouslyWoken ) )
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* croutine. h
|
||||||
|
* <pre>
|
||||||
|
crQUEUE_SEND_FROM_ISR(
|
||||||
|
QueueHandle_t pxQueue,
|
||||||
|
void *pvBuffer,
|
||||||
|
BaseType_t * pxCoRoutineWoken
|
||||||
|
)</pre>
|
||||||
|
*
|
||||||
|
* The macro's crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() are the
|
||||||
|
* co-routine equivalent to the xQueueSendFromISR() and xQueueReceiveFromISR()
|
||||||
|
* functions used by tasks.
|
||||||
|
*
|
||||||
|
* crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() can only be used to
|
||||||
|
* pass data between a co-routine and and ISR, whereas xQueueSendFromISR() and
|
||||||
|
* xQueueReceiveFromISR() can only be used to pass data between a task and and
|
||||||
|
* ISR.
|
||||||
|
*
|
||||||
|
* crQUEUE_RECEIVE_FROM_ISR can only be called from an ISR to receive data
|
||||||
|
* from a queue that is being used from within a co-routine (a co-routine
|
||||||
|
* posted to the queue).
|
||||||
|
*
|
||||||
|
* See the co-routine section of the WEB documentation for information on
|
||||||
|
* passing data between tasks and co-routines and between ISR's and
|
||||||
|
* co-routines.
|
||||||
|
*
|
||||||
|
* @param xQueue The handle to the queue on which the item is to be posted.
|
||||||
|
*
|
||||||
|
* @param pvBuffer A pointer to a buffer into which the received item will be
|
||||||
|
* placed. The size of the items the queue will hold was defined when the
|
||||||
|
* queue was created, so this many bytes will be copied from the queue into
|
||||||
|
* pvBuffer.
|
||||||
|
*
|
||||||
|
* @param pxCoRoutineWoken A co-routine may be blocked waiting for space to become
|
||||||
|
* available on the queue. If crQUEUE_RECEIVE_FROM_ISR causes such a
|
||||||
|
* co-routine to unblock *pxCoRoutineWoken will get set to pdTRUE, otherwise
|
||||||
|
* *pxCoRoutineWoken will remain unchanged.
|
||||||
|
*
|
||||||
|
* @return pdTRUE an item was successfully received from the queue, otherwise
|
||||||
|
* pdFALSE.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// A co-routine that posts a character to a queue then blocks for a fixed
|
||||||
|
// period. The character is incremented each time.
|
||||||
|
static void vSendingCoRoutine( CoRoutineHandle_t xHandle, UBaseType_t uxIndex )
|
||||||
|
{
|
||||||
|
// cChar holds its value while this co-routine is blocked and must therefore
|
||||||
|
// be declared static.
|
||||||
|
static char cCharToTx = 'a';
|
||||||
|
BaseType_t xResult;
|
||||||
|
|
||||||
|
// All co-routines must start with a call to crSTART().
|
||||||
|
crSTART( xHandle );
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// Send the next character to the queue.
|
||||||
|
crQUEUE_SEND( xHandle, xCoRoutineQueue, &cCharToTx, NO_DELAY, &xResult );
|
||||||
|
|
||||||
|
if( xResult == pdPASS )
|
||||||
|
{
|
||||||
|
// The character was successfully posted to the queue.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Could not post the character to the queue.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable the UART Tx interrupt to cause an interrupt in this
|
||||||
|
// hypothetical UART. The interrupt will obtain the character
|
||||||
|
// from the queue and send it.
|
||||||
|
ENABLE_RX_INTERRUPT();
|
||||||
|
|
||||||
|
// Increment to the next character then block for a fixed period.
|
||||||
|
// cCharToTx will maintain its value across the delay as it is
|
||||||
|
// declared static.
|
||||||
|
cCharToTx++;
|
||||||
|
if( cCharToTx > 'x' )
|
||||||
|
{
|
||||||
|
cCharToTx = 'a';
|
||||||
|
}
|
||||||
|
crDELAY( 100 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// All co-routines must end with a call to crEND().
|
||||||
|
crEND();
|
||||||
|
}
|
||||||
|
|
||||||
|
// An ISR that uses a queue to receive characters to send on a UART.
|
||||||
|
void vUART_ISR( void )
|
||||||
|
{
|
||||||
|
char cCharToTx;
|
||||||
|
BaseType_t xCRWokenByPost = pdFALSE;
|
||||||
|
|
||||||
|
while( UART_TX_REG_EMPTY() )
|
||||||
|
{
|
||||||
|
// Are there any characters in the queue waiting to be sent?
|
||||||
|
// xCRWokenByPost will automatically be set to pdTRUE if a co-routine
|
||||||
|
// is woken by the post - ensuring that only a single co-routine is
|
||||||
|
// woken no matter how many times we go around this loop.
|
||||||
|
if( crQUEUE_RECEIVE_FROM_ISR( pxQueue, &cCharToTx, &xCRWokenByPost ) )
|
||||||
|
{
|
||||||
|
SEND_CHARACTER( cCharToTx );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}</pre>
|
||||||
|
* \defgroup crQUEUE_RECEIVE_FROM_ISR crQUEUE_RECEIVE_FROM_ISR
|
||||||
|
* \ingroup Tasks
|
||||||
|
*/
|
||||||
|
#define crQUEUE_RECEIVE_FROM_ISR( pxQueue, pvBuffer, pxCoRoutineWoken ) xQueueCRReceiveFromISR( ( pxQueue ), ( pvBuffer ), ( pxCoRoutineWoken ) )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function is intended for internal use by the co-routine macros only.
|
||||||
|
* The macro nature of the co-routine implementation requires that the
|
||||||
|
* prototype appears here. The function should not be used by application
|
||||||
|
* writers.
|
||||||
|
*
|
||||||
|
* Removes the current co-routine from its ready list and places it in the
|
||||||
|
* appropriate delayed list.
|
||||||
|
*/
|
||||||
|
void vCoRoutineAddToDelayedList( TickType_t xTicksToDelay, List_t *pxEventList );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function is intended for internal use by the queue implementation only.
|
||||||
|
* The function should not be used by application writers.
|
||||||
|
*
|
||||||
|
* Removes the highest priority co-routine from the event list and places it in
|
||||||
|
* the pending ready list.
|
||||||
|
*/
|
||||||
|
BaseType_t xCoRoutineRemoveFromEventList( const List_t *pxEventList );
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* CO_ROUTINE_H */
|
|
@ -0,0 +1,726 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||||
|
All rights reserved
|
||||||
|
|
||||||
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS provides completely free yet professionally developed, *
|
||||||
|
* robust, strictly quality controlled, supported, and cross *
|
||||||
|
* platform software that has become a de facto standard. *
|
||||||
|
* *
|
||||||
|
* Help yourself get started quickly and support the FreeRTOS *
|
||||||
|
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||||
|
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||||
|
* *
|
||||||
|
* Thank you! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||||
|
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||||
|
>>! obliged to provide the source code for proprietary components !<<
|
||||||
|
>>! outside of the FreeRTOS kernel. !<<
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||||
|
link: http://www.freertos.org/a00114.html
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||||
|
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||||
|
licenses offer ticketed support, indemnification and middleware.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef EVENT_GROUPS_H
|
||||||
|
#define EVENT_GROUPS_H
|
||||||
|
|
||||||
|
#ifndef INC_FREERTOS_H
|
||||||
|
#error "include FreeRTOS.h" must appear in source files before "include event_groups.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "timers.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An event group is a collection of bits to which an application can assign a
|
||||||
|
* meaning. For example, an application may create an event group to convey
|
||||||
|
* the status of various CAN bus related events in which bit 0 might mean "A CAN
|
||||||
|
* message has been received and is ready for processing", bit 1 might mean "The
|
||||||
|
* application has queued a message that is ready for sending onto the CAN
|
||||||
|
* network", and bit 2 might mean "It is time to send a SYNC message onto the
|
||||||
|
* CAN network" etc. A task can then test the bit values to see which events
|
||||||
|
* are active, and optionally enter the Blocked state to wait for a specified
|
||||||
|
* bit or a group of specified bits to be active. To continue the CAN bus
|
||||||
|
* example, a CAN controlling task can enter the Blocked state (and therefore
|
||||||
|
* not consume any processing time) until either bit 0, bit 1 or bit 2 are
|
||||||
|
* active, at which time the bit that was actually active would inform the task
|
||||||
|
* which action it had to take (process a received message, send a message, or
|
||||||
|
* send a SYNC).
|
||||||
|
*
|
||||||
|
* The event groups implementation contains intelligence to avoid race
|
||||||
|
* conditions that would otherwise occur were an application to use a simple
|
||||||
|
* variable for the same purpose. This is particularly important with respect
|
||||||
|
* to when a bit within an event group is to be cleared, and when bits have to
|
||||||
|
* be set and then tested atomically - as is the case where event groups are
|
||||||
|
* used to create a synchronisation point between multiple tasks (a
|
||||||
|
* 'rendezvous').
|
||||||
|
*
|
||||||
|
* \defgroup EventGroup
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* event_groups.h
|
||||||
|
*
|
||||||
|
* Type by which event groups are referenced. For example, a call to
|
||||||
|
* xEventGroupCreate() returns an EventGroupHandle_t variable that can then
|
||||||
|
* be used as a parameter to other event group functions.
|
||||||
|
*
|
||||||
|
* \defgroup EventGroupHandle_t EventGroupHandle_t
|
||||||
|
* \ingroup EventGroup
|
||||||
|
*/
|
||||||
|
typedef void * EventGroupHandle_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The type that holds event bits always matches TickType_t - therefore the
|
||||||
|
* number of bits it holds is set by configUSE_16_BIT_TICKS (16 bits if set to 1,
|
||||||
|
* 32 bits if set to 0.
|
||||||
|
*
|
||||||
|
* \defgroup EventBits_t EventBits_t
|
||||||
|
* \ingroup EventGroup
|
||||||
|
*/
|
||||||
|
typedef TickType_t EventBits_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* event_groups.h
|
||||||
|
*<pre>
|
||||||
|
EventGroupHandle_t xEventGroupCreate( void );
|
||||||
|
</pre>
|
||||||
|
*
|
||||||
|
* Create a new event group. This function cannot be called from an interrupt.
|
||||||
|
*
|
||||||
|
* Although event groups are not related to ticks, for internal implementation
|
||||||
|
* reasons the number of bits available for use in an event group is dependent
|
||||||
|
* on the configUSE_16_BIT_TICKS setting in FreeRTOSConfig.h. If
|
||||||
|
* configUSE_16_BIT_TICKS is 1 then each event group contains 8 usable bits (bit
|
||||||
|
* 0 to bit 7). If configUSE_16_BIT_TICKS is set to 0 then each event group has
|
||||||
|
* 24 usable bits (bit 0 to bit 23). The EventBits_t type is used to store
|
||||||
|
* event bits within an event group.
|
||||||
|
*
|
||||||
|
* @return If the event group was created then a handle to the event group is
|
||||||
|
* returned. If there was insufficient FreeRTOS heap available to create the
|
||||||
|
* event group then NULL is returned. See http://www.freertos.org/a00111.html
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// Declare a variable to hold the created event group.
|
||||||
|
EventGroupHandle_t xCreatedEventGroup;
|
||||||
|
|
||||||
|
// Attempt to create the event group.
|
||||||
|
xCreatedEventGroup = xEventGroupCreate();
|
||||||
|
|
||||||
|
// Was the event group created successfully?
|
||||||
|
if( xCreatedEventGroup == NULL )
|
||||||
|
{
|
||||||
|
// The event group was not created because there was insufficient
|
||||||
|
// FreeRTOS heap available.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// The event group was created.
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xEventGroupCreate xEventGroupCreate
|
||||||
|
* \ingroup EventGroup
|
||||||
|
*/
|
||||||
|
EventGroupHandle_t xEventGroupCreate( void ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* event_groups.h
|
||||||
|
*<pre>
|
||||||
|
EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
|
||||||
|
const EventBits_t uxBitsToWaitFor,
|
||||||
|
const BaseType_t xClearOnExit,
|
||||||
|
const BaseType_t xWaitForAllBits,
|
||||||
|
const TickType_t xTicksToWait );
|
||||||
|
</pre>
|
||||||
|
*
|
||||||
|
* [Potentially] block to wait for one or more bits to be set within a
|
||||||
|
* previously created event group.
|
||||||
|
*
|
||||||
|
* This function cannot be called from an interrupt.
|
||||||
|
*
|
||||||
|
* @param xEventGroup The event group in which the bits are being tested. The
|
||||||
|
* event group must have previously been created using a call to
|
||||||
|
* xEventGroupCreate().
|
||||||
|
*
|
||||||
|
* @param uxBitsToWaitFor A bitwise value that indicates the bit or bits to test
|
||||||
|
* inside the event group. For example, to wait for bit 0 and/or bit 2 set
|
||||||
|
* uxBitsToWaitFor to 0x05. To wait for bits 0 and/or bit 1 and/or bit 2 set
|
||||||
|
* uxBitsToWaitFor to 0x07. Etc.
|
||||||
|
*
|
||||||
|
* @param xClearOnExit If xClearOnExit is set to pdTRUE then any bits within
|
||||||
|
* uxBitsToWaitFor that are set within the event group will be cleared before
|
||||||
|
* xEventGroupWaitBits() returns if the wait condition was met (if the function
|
||||||
|
* returns for a reason other than a timeout). If xClearOnExit is set to
|
||||||
|
* pdFALSE then the bits set in the event group are not altered when the call to
|
||||||
|
* xEventGroupWaitBits() returns.
|
||||||
|
*
|
||||||
|
* @param xWaitForAllBits If xWaitForAllBits is set to pdTRUE then
|
||||||
|
* xEventGroupWaitBits() will return when either all the bits in uxBitsToWaitFor
|
||||||
|
* are set or the specified block time expires. If xWaitForAllBits is set to
|
||||||
|
* pdFALSE then xEventGroupWaitBits() will return when any one of the bits set
|
||||||
|
* in uxBitsToWaitFor is set or the specified block time expires. The block
|
||||||
|
* time is specified by the xTicksToWait parameter.
|
||||||
|
*
|
||||||
|
* @param xTicksToWait The maximum amount of time (specified in 'ticks') to wait
|
||||||
|
* for one/all (depending on the xWaitForAllBits value) of the bits specified by
|
||||||
|
* uxBitsToWaitFor to become set.
|
||||||
|
*
|
||||||
|
* @return The value of the event group at the time either the bits being waited
|
||||||
|
* for became set, or the block time expired. Test the return value to know
|
||||||
|
* which bits were set. If xEventGroupWaitBits() returned because its timeout
|
||||||
|
* expired then not all the bits being waited for will be set. If
|
||||||
|
* xEventGroupWaitBits() returned because the bits it was waiting for were set
|
||||||
|
* then the returned value is the event group value before any bits were
|
||||||
|
* automatically cleared in the case that xClearOnExit parameter was set to
|
||||||
|
* pdTRUE.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
#define BIT_0 ( 1 << 0 )
|
||||||
|
#define BIT_4 ( 1 << 4 )
|
||||||
|
|
||||||
|
void aFunction( EventGroupHandle_t xEventGroup )
|
||||||
|
{
|
||||||
|
EventBits_t uxBits;
|
||||||
|
const TickType_t xTicksToWait = 100 / portTICK_PERIOD_MS;
|
||||||
|
|
||||||
|
// Wait a maximum of 100ms for either bit 0 or bit 4 to be set within
|
||||||
|
// the event group. Clear the bits before exiting.
|
||||||
|
uxBits = xEventGroupWaitBits(
|
||||||
|
xEventGroup, // The event group being tested.
|
||||||
|
BIT_0 | BIT_4, // The bits within the event group to wait for.
|
||||||
|
pdTRUE, // BIT_0 and BIT_4 should be cleared before returning.
|
||||||
|
pdFALSE, // Don't wait for both bits, either bit will do.
|
||||||
|
xTicksToWait ); // Wait a maximum of 100ms for either bit to be set.
|
||||||
|
|
||||||
|
if( ( uxBits & ( BIT_0 | BIT_4 ) ) == ( BIT_0 | BIT_4 ) )
|
||||||
|
{
|
||||||
|
// xEventGroupWaitBits() returned because both bits were set.
|
||||||
|
}
|
||||||
|
else if( ( uxBits & BIT_0 ) != 0 )
|
||||||
|
{
|
||||||
|
// xEventGroupWaitBits() returned because just BIT_0 was set.
|
||||||
|
}
|
||||||
|
else if( ( uxBits & BIT_4 ) != 0 )
|
||||||
|
{
|
||||||
|
// xEventGroupWaitBits() returned because just BIT_4 was set.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// xEventGroupWaitBits() returned because xTicksToWait ticks passed
|
||||||
|
// without either BIT_0 or BIT_4 becoming set.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xEventGroupWaitBits xEventGroupWaitBits
|
||||||
|
* \ingroup EventGroup
|
||||||
|
*/
|
||||||
|
EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToWaitFor, const BaseType_t xClearOnExit, const BaseType_t xWaitForAllBits, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* event_groups.h
|
||||||
|
*<pre>
|
||||||
|
EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear );
|
||||||
|
</pre>
|
||||||
|
*
|
||||||
|
* Clear bits within an event group. This function cannot be called from an
|
||||||
|
* interrupt.
|
||||||
|
*
|
||||||
|
* @param xEventGroup The event group in which the bits are to be cleared.
|
||||||
|
*
|
||||||
|
* @param uxBitsToClear A bitwise value that indicates the bit or bits to clear
|
||||||
|
* in the event group. For example, to clear bit 3 only, set uxBitsToClear to
|
||||||
|
* 0x08. To clear bit 3 and bit 0 set uxBitsToClear to 0x09.
|
||||||
|
*
|
||||||
|
* @return The value of the event group before the specified bits were cleared.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
#define BIT_0 ( 1 << 0 )
|
||||||
|
#define BIT_4 ( 1 << 4 )
|
||||||
|
|
||||||
|
void aFunction( EventGroupHandle_t xEventGroup )
|
||||||
|
{
|
||||||
|
EventBits_t uxBits;
|
||||||
|
|
||||||
|
// Clear bit 0 and bit 4 in xEventGroup.
|
||||||
|
uxBits = xEventGroupClearBits(
|
||||||
|
xEventGroup, // The event group being updated.
|
||||||
|
BIT_0 | BIT_4 );// The bits being cleared.
|
||||||
|
|
||||||
|
if( ( uxBits & ( BIT_0 | BIT_4 ) ) == ( BIT_0 | BIT_4 ) )
|
||||||
|
{
|
||||||
|
// Both bit 0 and bit 4 were set before xEventGroupClearBits() was
|
||||||
|
// called. Both will now be clear (not set).
|
||||||
|
}
|
||||||
|
else if( ( uxBits & BIT_0 ) != 0 )
|
||||||
|
{
|
||||||
|
// Bit 0 was set before xEventGroupClearBits() was called. It will
|
||||||
|
// now be clear.
|
||||||
|
}
|
||||||
|
else if( ( uxBits & BIT_4 ) != 0 )
|
||||||
|
{
|
||||||
|
// Bit 4 was set before xEventGroupClearBits() was called. It will
|
||||||
|
// now be clear.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Neither bit 0 nor bit 4 were set in the first place.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xEventGroupClearBits xEventGroupClearBits
|
||||||
|
* \ingroup EventGroup
|
||||||
|
*/
|
||||||
|
EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* event_groups.h
|
||||||
|
*<pre>
|
||||||
|
BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet );
|
||||||
|
</pre>
|
||||||
|
*
|
||||||
|
* A version of xEventGroupClearBits() that can be called from an interrupt.
|
||||||
|
*
|
||||||
|
* Setting bits in an event group is not a deterministic operation because there
|
||||||
|
* are an unknown number of tasks that may be waiting for the bit or bits being
|
||||||
|
* set. FreeRTOS does not allow nondeterministic operations to be performed
|
||||||
|
* while interrupts are disabled, so protects event groups that are accessed
|
||||||
|
* from tasks by suspending the scheduler rather than disabling interrupts. As
|
||||||
|
* a result event groups cannot be accessed directly from an interrupt service
|
||||||
|
* routine. Therefore xEventGroupClearBitsFromISR() sends a message to the
|
||||||
|
* timer task to have the clear operation performed in the context of the timer
|
||||||
|
* task.
|
||||||
|
*
|
||||||
|
* @param xEventGroup The event group in which the bits are to be cleared.
|
||||||
|
*
|
||||||
|
* @param uxBitsToClear A bitwise value that indicates the bit or bits to clear.
|
||||||
|
* For example, to clear bit 3 only, set uxBitsToClear to 0x08. To clear bit 3
|
||||||
|
* and bit 0 set uxBitsToClear to 0x09.
|
||||||
|
*
|
||||||
|
* @return If the request to execute the function was posted successfully then
|
||||||
|
* pdPASS is returned, otherwise pdFALSE is returned. pdFALSE will be returned
|
||||||
|
* if the timer service queue was full.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
#define BIT_0 ( 1 << 0 )
|
||||||
|
#define BIT_4 ( 1 << 4 )
|
||||||
|
|
||||||
|
// An event group which it is assumed has already been created by a call to
|
||||||
|
// xEventGroupCreate().
|
||||||
|
EventGroupHandle_t xEventGroup;
|
||||||
|
|
||||||
|
void anInterruptHandler( void )
|
||||||
|
{
|
||||||
|
// Clear bit 0 and bit 4 in xEventGroup.
|
||||||
|
xResult = xEventGroupClearBitsFromISR(
|
||||||
|
xEventGroup, // The event group being updated.
|
||||||
|
BIT_0 | BIT_4 ); // The bits being set.
|
||||||
|
|
||||||
|
if( xResult == pdPASS )
|
||||||
|
{
|
||||||
|
// The message was posted successfully.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xEventGroupSetBitsFromISR xEventGroupSetBitsFromISR
|
||||||
|
* \ingroup EventGroup
|
||||||
|
*/
|
||||||
|
#if( configUSE_TRACE_FACILITY == 1 )
|
||||||
|
BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet );
|
||||||
|
#else
|
||||||
|
#define xEventGroupClearBitsFromISR( xEventGroup, uxBitsToClear ) xTimerPendFunctionCallFromISR( vEventGroupClearBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToClear, NULL )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* event_groups.h
|
||||||
|
*<pre>
|
||||||
|
EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet );
|
||||||
|
</pre>
|
||||||
|
*
|
||||||
|
* Set bits within an event group.
|
||||||
|
* This function cannot be called from an interrupt. xEventGroupSetBitsFromISR()
|
||||||
|
* is a version that can be called from an interrupt.
|
||||||
|
*
|
||||||
|
* Setting bits in an event group will automatically unblock tasks that are
|
||||||
|
* blocked waiting for the bits.
|
||||||
|
*
|
||||||
|
* @param xEventGroup The event group in which the bits are to be set.
|
||||||
|
*
|
||||||
|
* @param uxBitsToSet A bitwise value that indicates the bit or bits to set.
|
||||||
|
* For example, to set bit 3 only, set uxBitsToSet to 0x08. To set bit 3
|
||||||
|
* and bit 0 set uxBitsToSet to 0x09.
|
||||||
|
*
|
||||||
|
* @return The value of the event group at the time the call to
|
||||||
|
* xEventGroupSetBits() returns. There are two reasons why the returned value
|
||||||
|
* might have the bits specified by the uxBitsToSet parameter cleared. First,
|
||||||
|
* if setting a bit results in a task that was waiting for the bit leaving the
|
||||||
|
* blocked state then it is possible the bit will be cleared automatically
|
||||||
|
* (see the xClearBitOnExit parameter of xEventGroupWaitBits()). Second, any
|
||||||
|
* unblocked (or otherwise Ready state) task that has a priority above that of
|
||||||
|
* the task that called xEventGroupSetBits() will execute and may change the
|
||||||
|
* event group value before the call to xEventGroupSetBits() returns.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
#define BIT_0 ( 1 << 0 )
|
||||||
|
#define BIT_4 ( 1 << 4 )
|
||||||
|
|
||||||
|
void aFunction( EventGroupHandle_t xEventGroup )
|
||||||
|
{
|
||||||
|
EventBits_t uxBits;
|
||||||
|
|
||||||
|
// Set bit 0 and bit 4 in xEventGroup.
|
||||||
|
uxBits = xEventGroupSetBits(
|
||||||
|
xEventGroup, // The event group being updated.
|
||||||
|
BIT_0 | BIT_4 );// The bits being set.
|
||||||
|
|
||||||
|
if( ( uxBits & ( BIT_0 | BIT_4 ) ) == ( BIT_0 | BIT_4 ) )
|
||||||
|
{
|
||||||
|
// Both bit 0 and bit 4 remained set when the function returned.
|
||||||
|
}
|
||||||
|
else if( ( uxBits & BIT_0 ) != 0 )
|
||||||
|
{
|
||||||
|
// Bit 0 remained set when the function returned, but bit 4 was
|
||||||
|
// cleared. It might be that bit 4 was cleared automatically as a
|
||||||
|
// task that was waiting for bit 4 was removed from the Blocked
|
||||||
|
// state.
|
||||||
|
}
|
||||||
|
else if( ( uxBits & BIT_4 ) != 0 )
|
||||||
|
{
|
||||||
|
// Bit 4 remained set when the function returned, but bit 0 was
|
||||||
|
// cleared. It might be that bit 0 was cleared automatically as a
|
||||||
|
// task that was waiting for bit 0 was removed from the Blocked
|
||||||
|
// state.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Neither bit 0 nor bit 4 remained set. It might be that a task
|
||||||
|
// was waiting for both of the bits to be set, and the bits were
|
||||||
|
// cleared as the task left the Blocked state.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xEventGroupSetBits xEventGroupSetBits
|
||||||
|
* \ingroup EventGroup
|
||||||
|
*/
|
||||||
|
EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* event_groups.h
|
||||||
|
*<pre>
|
||||||
|
BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken );
|
||||||
|
</pre>
|
||||||
|
*
|
||||||
|
* A version of xEventGroupSetBits() that can be called from an interrupt.
|
||||||
|
*
|
||||||
|
* Setting bits in an event group is not a deterministic operation because there
|
||||||
|
* are an unknown number of tasks that may be waiting for the bit or bits being
|
||||||
|
* set. FreeRTOS does not allow nondeterministic operations to be performed in
|
||||||
|
* interrupts or from critical sections. Therefore xEventGroupSetBitFromISR()
|
||||||
|
* sends a message to the timer task to have the set operation performed in the
|
||||||
|
* context of the timer task - where a scheduler lock is used in place of a
|
||||||
|
* critical section.
|
||||||
|
*
|
||||||
|
* @param xEventGroup The event group in which the bits are to be set.
|
||||||
|
*
|
||||||
|
* @param uxBitsToSet A bitwise value that indicates the bit or bits to set.
|
||||||
|
* For example, to set bit 3 only, set uxBitsToSet to 0x08. To set bit 3
|
||||||
|
* and bit 0 set uxBitsToSet to 0x09.
|
||||||
|
*
|
||||||
|
* @param pxHigherPriorityTaskWoken As mentioned above, calling this function
|
||||||
|
* will result in a message being sent to the timer daemon task. If the
|
||||||
|
* priority of the timer daemon task is higher than the priority of the
|
||||||
|
* currently running task (the task the interrupt interrupted) then
|
||||||
|
* *pxHigherPriorityTaskWoken will be set to pdTRUE by
|
||||||
|
* xEventGroupSetBitsFromISR(), indicating that a context switch should be
|
||||||
|
* requested before the interrupt exits. For that reason
|
||||||
|
* *pxHigherPriorityTaskWoken must be initialised to pdFALSE. See the
|
||||||
|
* example code below.
|
||||||
|
*
|
||||||
|
* @return If the request to execute the function was posted successfully then
|
||||||
|
* pdPASS is returned, otherwise pdFALSE is returned. pdFALSE will be returned
|
||||||
|
* if the timer service queue was full.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
#define BIT_0 ( 1 << 0 )
|
||||||
|
#define BIT_4 ( 1 << 4 )
|
||||||
|
|
||||||
|
// An event group which it is assumed has already been created by a call to
|
||||||
|
// xEventGroupCreate().
|
||||||
|
EventGroupHandle_t xEventGroup;
|
||||||
|
|
||||||
|
void anInterruptHandler( void )
|
||||||
|
{
|
||||||
|
BaseType_t xHigherPriorityTaskWoken, xResult;
|
||||||
|
|
||||||
|
// xHigherPriorityTaskWoken must be initialised to pdFALSE.
|
||||||
|
xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
|
// Set bit 0 and bit 4 in xEventGroup.
|
||||||
|
xResult = xEventGroupSetBitsFromISR(
|
||||||
|
xEventGroup, // The event group being updated.
|
||||||
|
BIT_0 | BIT_4 // The bits being set.
|
||||||
|
&xHigherPriorityTaskWoken );
|
||||||
|
|
||||||
|
// Was the message posted successfully?
|
||||||
|
if( xResult == pdPASS )
|
||||||
|
{
|
||||||
|
// If xHigherPriorityTaskWoken is now set to pdTRUE then a context
|
||||||
|
// switch should be requested. The macro used is port specific and
|
||||||
|
// will be either portYIELD_FROM_ISR() or portEND_SWITCHING_ISR() -
|
||||||
|
// refer to the documentation page for the port being used.
|
||||||
|
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xEventGroupSetBitsFromISR xEventGroupSetBitsFromISR
|
||||||
|
* \ingroup EventGroup
|
||||||
|
*/
|
||||||
|
#if( configUSE_TRACE_FACILITY == 1 )
|
||||||
|
BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken );
|
||||||
|
#else
|
||||||
|
#define xEventGroupSetBitsFromISR( xEventGroup, uxBitsToSet, pxHigherPriorityTaskWoken ) xTimerPendFunctionCallFromISR( vEventGroupSetBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToSet, pxHigherPriorityTaskWoken )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* event_groups.h
|
||||||
|
*<pre>
|
||||||
|
EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup,
|
||||||
|
const EventBits_t uxBitsToSet,
|
||||||
|
const EventBits_t uxBitsToWaitFor,
|
||||||
|
TickType_t xTicksToWait );
|
||||||
|
</pre>
|
||||||
|
*
|
||||||
|
* Atomically set bits within an event group, then wait for a combination of
|
||||||
|
* bits to be set within the same event group. This functionality is typically
|
||||||
|
* used to synchronise multiple tasks, where each task has to wait for the other
|
||||||
|
* tasks to reach a synchronisation point before proceeding.
|
||||||
|
*
|
||||||
|
* This function cannot be used from an interrupt.
|
||||||
|
*
|
||||||
|
* The function will return before its block time expires if the bits specified
|
||||||
|
* by the uxBitsToWait parameter are set, or become set within that time. In
|
||||||
|
* this case all the bits specified by uxBitsToWait will be automatically
|
||||||
|
* cleared before the function returns.
|
||||||
|
*
|
||||||
|
* @param xEventGroup The event group in which the bits are being tested. The
|
||||||
|
* event group must have previously been created using a call to
|
||||||
|
* xEventGroupCreate().
|
||||||
|
*
|
||||||
|
* @param uxBitsToSet The bits to set in the event group before determining
|
||||||
|
* if, and possibly waiting for, all the bits specified by the uxBitsToWait
|
||||||
|
* parameter are set.
|
||||||
|
*
|
||||||
|
* @param uxBitsToWaitFor A bitwise value that indicates the bit or bits to test
|
||||||
|
* inside the event group. For example, to wait for bit 0 and bit 2 set
|
||||||
|
* uxBitsToWaitFor to 0x05. To wait for bits 0 and bit 1 and bit 2 set
|
||||||
|
* uxBitsToWaitFor to 0x07. Etc.
|
||||||
|
*
|
||||||
|
* @param xTicksToWait The maximum amount of time (specified in 'ticks') to wait
|
||||||
|
* for all of the bits specified by uxBitsToWaitFor to become set.
|
||||||
|
*
|
||||||
|
* @return The value of the event group at the time either the bits being waited
|
||||||
|
* for became set, or the block time expired. Test the return value to know
|
||||||
|
* which bits were set. If xEventGroupSync() returned because its timeout
|
||||||
|
* expired then not all the bits being waited for will be set. If
|
||||||
|
* xEventGroupSync() returned because all the bits it was waiting for were
|
||||||
|
* set then the returned value is the event group value before any bits were
|
||||||
|
* automatically cleared.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// Bits used by the three tasks.
|
||||||
|
#define TASK_0_BIT ( 1 << 0 )
|
||||||
|
#define TASK_1_BIT ( 1 << 1 )
|
||||||
|
#define TASK_2_BIT ( 1 << 2 )
|
||||||
|
|
||||||
|
#define ALL_SYNC_BITS ( TASK_0_BIT | TASK_1_BIT | TASK_2_BIT )
|
||||||
|
|
||||||
|
// Use an event group to synchronise three tasks. It is assumed this event
|
||||||
|
// group has already been created elsewhere.
|
||||||
|
EventGroupHandle_t xEventBits;
|
||||||
|
|
||||||
|
void vTask0( void *pvParameters )
|
||||||
|
{
|
||||||
|
EventBits_t uxReturn;
|
||||||
|
TickType_t xTicksToWait = 100 / portTICK_PERIOD_MS;
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// Perform task functionality here.
|
||||||
|
|
||||||
|
// Set bit 0 in the event flag to note this task has reached the
|
||||||
|
// sync point. The other two tasks will set the other two bits defined
|
||||||
|
// by ALL_SYNC_BITS. All three tasks have reached the synchronisation
|
||||||
|
// point when all the ALL_SYNC_BITS are set. Wait a maximum of 100ms
|
||||||
|
// for this to happen.
|
||||||
|
uxReturn = xEventGroupSync( xEventBits, TASK_0_BIT, ALL_SYNC_BITS, xTicksToWait );
|
||||||
|
|
||||||
|
if( ( uxReturn & ALL_SYNC_BITS ) == ALL_SYNC_BITS )
|
||||||
|
{
|
||||||
|
// All three tasks reached the synchronisation point before the call
|
||||||
|
// to xEventGroupSync() timed out.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void vTask1( void *pvParameters )
|
||||||
|
{
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// Perform task functionality here.
|
||||||
|
|
||||||
|
// Set bit 1 in the event flag to note this task has reached the
|
||||||
|
// synchronisation point. The other two tasks will set the other two
|
||||||
|
// bits defined by ALL_SYNC_BITS. All three tasks have reached the
|
||||||
|
// synchronisation point when all the ALL_SYNC_BITS are set. Wait
|
||||||
|
// indefinitely for this to happen.
|
||||||
|
xEventGroupSync( xEventBits, TASK_1_BIT, ALL_SYNC_BITS, portMAX_DELAY );
|
||||||
|
|
||||||
|
// xEventGroupSync() was called with an indefinite block time, so
|
||||||
|
// this task will only reach here if the syncrhonisation was made by all
|
||||||
|
// three tasks, so there is no need to test the return value.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void vTask2( void *pvParameters )
|
||||||
|
{
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// Perform task functionality here.
|
||||||
|
|
||||||
|
// Set bit 2 in the event flag to note this task has reached the
|
||||||
|
// synchronisation point. The other two tasks will set the other two
|
||||||
|
// bits defined by ALL_SYNC_BITS. All three tasks have reached the
|
||||||
|
// synchronisation point when all the ALL_SYNC_BITS are set. Wait
|
||||||
|
// indefinitely for this to happen.
|
||||||
|
xEventGroupSync( xEventBits, TASK_2_BIT, ALL_SYNC_BITS, portMAX_DELAY );
|
||||||
|
|
||||||
|
// xEventGroupSync() was called with an indefinite block time, so
|
||||||
|
// this task will only reach here if the syncrhonisation was made by all
|
||||||
|
// three tasks, so there is no need to test the return value.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</pre>
|
||||||
|
* \defgroup xEventGroupSync xEventGroupSync
|
||||||
|
* \ingroup EventGroup
|
||||||
|
*/
|
||||||
|
EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, const EventBits_t uxBitsToWaitFor, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* event_groups.h
|
||||||
|
*<pre>
|
||||||
|
EventBits_t xEventGroupGetBits( EventGroupHandle_t xEventGroup );
|
||||||
|
</pre>
|
||||||
|
*
|
||||||
|
* Returns the current value of the bits in an event group. This function
|
||||||
|
* cannot be used from an interrupt.
|
||||||
|
*
|
||||||
|
* @param xEventGroup The event group being queried.
|
||||||
|
*
|
||||||
|
* @return The event group bits at the time xEventGroupGetBits() was called.
|
||||||
|
*
|
||||||
|
* \defgroup xEventGroupGetBits xEventGroupGetBits
|
||||||
|
* \ingroup EventGroup
|
||||||
|
*/
|
||||||
|
#define xEventGroupGetBits( xEventGroup ) xEventGroupClearBits( xEventGroup, 0 )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* event_groups.h
|
||||||
|
*<pre>
|
||||||
|
EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup );
|
||||||
|
</pre>
|
||||||
|
*
|
||||||
|
* A version of xEventGroupGetBits() that can be called from an ISR.
|
||||||
|
*
|
||||||
|
* @param xEventGroup The event group being queried.
|
||||||
|
*
|
||||||
|
* @return The event group bits at the time xEventGroupGetBitsFromISR() was called.
|
||||||
|
*
|
||||||
|
* \defgroup xEventGroupGetBitsFromISR xEventGroupGetBitsFromISR
|
||||||
|
* \ingroup EventGroup
|
||||||
|
*/
|
||||||
|
EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* event_groups.h
|
||||||
|
*<pre>
|
||||||
|
void xEventGroupDelete( EventGroupHandle_t xEventGroup );
|
||||||
|
</pre>
|
||||||
|
*
|
||||||
|
* Delete an event group that was previously created by a call to
|
||||||
|
* xEventGroupCreate(). Tasks that are blocked on the event group will be
|
||||||
|
* unblocked and obtain 0 as the event group's value.
|
||||||
|
*
|
||||||
|
* @param xEventGroup The event group being deleted.
|
||||||
|
*/
|
||||||
|
void vEventGroupDelete( EventGroupHandle_t xEventGroup );
|
||||||
|
|
||||||
|
/* For internal use only. */
|
||||||
|
void vEventGroupSetBitsCallback( void *pvEventGroup, const uint32_t ulBitsToSet );
|
||||||
|
void vEventGroupClearBitsCallback( void *pvEventGroup, const uint32_t ulBitsToClear );
|
||||||
|
|
||||||
|
#if (configUSE_TRACE_FACILITY == 1)
|
||||||
|
UBaseType_t uxEventGroupGetNumber( void* xEventGroup );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* EVENT_GROUPS_H */
|
||||||
|
|
||||||
|
|
403
sdk/component/os/freertos/freertos_v8.1.2/Source/include/list.h
Normal file
403
sdk/component/os/freertos/freertos_v8.1.2/Source/include/list.h
Normal file
|
@ -0,0 +1,403 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||||
|
All rights reserved
|
||||||
|
|
||||||
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS provides completely free yet professionally developed, *
|
||||||
|
* robust, strictly quality controlled, supported, and cross *
|
||||||
|
* platform software that has become a de facto standard. *
|
||||||
|
* *
|
||||||
|
* Help yourself get started quickly and support the FreeRTOS *
|
||||||
|
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||||
|
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||||
|
* *
|
||||||
|
* Thank you! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||||
|
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||||
|
>>! obliged to provide the source code for proprietary components !<<
|
||||||
|
>>! outside of the FreeRTOS kernel. !<<
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||||
|
link: http://www.freertos.org/a00114.html
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||||
|
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||||
|
licenses offer ticketed support, indemnification and middleware.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is the list implementation used by the scheduler. While it is tailored
|
||||||
|
* heavily for the schedulers needs, it is also available for use by
|
||||||
|
* application code.
|
||||||
|
*
|
||||||
|
* list_ts can only store pointers to list_item_ts. Each ListItem_t contains a
|
||||||
|
* numeric value (xItemValue). Most of the time the lists are sorted in
|
||||||
|
* descending item value order.
|
||||||
|
*
|
||||||
|
* Lists are created already containing one list item. The value of this
|
||||||
|
* item is the maximum possible that can be stored, it is therefore always at
|
||||||
|
* the end of the list and acts as a marker. The list member pxHead always
|
||||||
|
* points to this marker - even though it is at the tail of the list. This
|
||||||
|
* is because the tail contains a wrap back pointer to the true head of
|
||||||
|
* the list.
|
||||||
|
*
|
||||||
|
* In addition to it's value, each list item contains a pointer to the next
|
||||||
|
* item in the list (pxNext), a pointer to the list it is in (pxContainer)
|
||||||
|
* and a pointer to back to the object that contains it. These later two
|
||||||
|
* pointers are included for efficiency of list manipulation. There is
|
||||||
|
* effectively a two way link between the object containing the list item and
|
||||||
|
* the list item itself.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* \page ListIntroduction List Implementation
|
||||||
|
* \ingroup FreeRTOSIntro
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef LIST_H
|
||||||
|
#define LIST_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The list structure members are modified from within interrupts, and therefore
|
||||||
|
* by rights should be declared volatile. However, they are only modified in a
|
||||||
|
* functionally atomic way (within critical sections of with the scheduler
|
||||||
|
* suspended) and are either passed by reference into a function or indexed via
|
||||||
|
* a volatile variable. Therefore, in all use cases tested so far, the volatile
|
||||||
|
* qualifier can be omitted in order to provide a moderate performance
|
||||||
|
* improvement without adversely affecting functional behaviour. The assembly
|
||||||
|
* instructions generated by the IAR, ARM and GCC compilers when the respective
|
||||||
|
* compiler's options were set for maximum optimisation has been inspected and
|
||||||
|
* deemed to be as intended. That said, as compiler technology advances, and
|
||||||
|
* especially if aggressive cross module optimisation is used (a use case that
|
||||||
|
* has not been exercised to any great extend) then it is feasible that the
|
||||||
|
* volatile qualifier will be needed for correct optimisation. It is expected
|
||||||
|
* that a compiler removing essential code because, without the volatile
|
||||||
|
* qualifier on the list structure members and with aggressive cross module
|
||||||
|
* optimisation, the compiler deemed the code unnecessary will result in
|
||||||
|
* complete and obvious failure of the scheduler. If this is ever experienced
|
||||||
|
* then the volatile qualifier can be inserted in the relevant places within the
|
||||||
|
* list structures by simply defining configLIST_VOLATILE to volatile in
|
||||||
|
* FreeRTOSConfig.h (as per the example at the bottom of this comment block).
|
||||||
|
* If configLIST_VOLATILE is not defined then the preprocessor directives below
|
||||||
|
* will simply #define configLIST_VOLATILE away completely.
|
||||||
|
*
|
||||||
|
* To use volatile list structure members then add the following line to
|
||||||
|
* FreeRTOSConfig.h (without the quotes):
|
||||||
|
* "#define configLIST_VOLATILE volatile"
|
||||||
|
*/
|
||||||
|
#ifndef configLIST_VOLATILE
|
||||||
|
#define configLIST_VOLATILE
|
||||||
|
#endif /* configSUPPORT_CROSS_MODULE_OPTIMISATION */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
* Definition of the only type of object that a list can contain.
|
||||||
|
*/
|
||||||
|
struct xLIST_ITEM
|
||||||
|
{
|
||||||
|
configLIST_VOLATILE TickType_t xItemValue; /*< The value being listed. In most cases this is used to sort the list in descending order. */
|
||||||
|
struct xLIST_ITEM * configLIST_VOLATILE pxNext; /*< Pointer to the next ListItem_t in the list. */
|
||||||
|
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious; /*< Pointer to the previous ListItem_t in the list. */
|
||||||
|
void * pvOwner; /*< Pointer to the object (normally a TCB) that contains the list item. There is therefore a two way link between the object containing the list item and the list item itself. */
|
||||||
|
void * configLIST_VOLATILE pvContainer; /*< Pointer to the list in which this list item is placed (if any). */
|
||||||
|
};
|
||||||
|
typedef struct xLIST_ITEM ListItem_t; /* For some reason lint wants this as two separate definitions. */
|
||||||
|
|
||||||
|
struct xMINI_LIST_ITEM
|
||||||
|
{
|
||||||
|
configLIST_VOLATILE TickType_t xItemValue;
|
||||||
|
struct xLIST_ITEM * configLIST_VOLATILE pxNext;
|
||||||
|
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;
|
||||||
|
};
|
||||||
|
typedef struct xMINI_LIST_ITEM MiniListItem_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Definition of the type of queue used by the scheduler.
|
||||||
|
*/
|
||||||
|
typedef struct xLIST
|
||||||
|
{
|
||||||
|
configLIST_VOLATILE UBaseType_t uxNumberOfItems;
|
||||||
|
ListItem_t * configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */
|
||||||
|
MiniListItem_t xListEnd; /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */
|
||||||
|
} List_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Access macro to set the owner of a list item. The owner of a list item
|
||||||
|
* is the object (usually a TCB) that contains the list item.
|
||||||
|
*
|
||||||
|
* \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
#define listSET_LIST_ITEM_OWNER( pxListItem, pxOwner ) ( ( pxListItem )->pvOwner = ( void * ) ( pxOwner ) )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Access macro to get the owner of a list item. The owner of a list item
|
||||||
|
* is the object (usually a TCB) that contains the list item.
|
||||||
|
*
|
||||||
|
* \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
#define listGET_LIST_ITEM_OWNER( pxListItem ) ( ( pxListItem )->pvOwner )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Access macro to set the value of the list item. In most cases the value is
|
||||||
|
* used to sort the list in descending order.
|
||||||
|
*
|
||||||
|
* \page listSET_LIST_ITEM_VALUE listSET_LIST_ITEM_VALUE
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
#define listSET_LIST_ITEM_VALUE( pxListItem, xValue ) ( ( pxListItem )->xItemValue = ( xValue ) )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Access macro to retrieve the value of the list item. The value can
|
||||||
|
* represent anything - for example the priority of a task, or the time at
|
||||||
|
* which a task should be unblocked.
|
||||||
|
*
|
||||||
|
* \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
#define listGET_LIST_ITEM_VALUE( pxListItem ) ( ( pxListItem )->xItemValue )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Access macro to retrieve the value of the list item at the head of a given
|
||||||
|
* list.
|
||||||
|
*
|
||||||
|
* \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
#define listGET_ITEM_VALUE_OF_HEAD_ENTRY( pxList ) ( ( ( pxList )->xListEnd ).pxNext->xItemValue )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the list item at the head of the list.
|
||||||
|
*
|
||||||
|
* \page listGET_HEAD_ENTRY listGET_HEAD_ENTRY
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
#define listGET_HEAD_ENTRY( pxList ) ( ( ( pxList )->xListEnd ).pxNext )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the list item at the head of the list.
|
||||||
|
*
|
||||||
|
* \page listGET_NEXT listGET_NEXT
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
#define listGET_NEXT( pxListItem ) ( ( pxListItem )->pxNext )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the list item that marks the end of the list
|
||||||
|
*
|
||||||
|
* \page listGET_END_MARKER listGET_END_MARKER
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
#define listGET_END_MARKER( pxList ) ( ( ListItem_t const * ) ( &( ( pxList )->xListEnd ) ) )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Access macro to determine if a list contains any items. The macro will
|
||||||
|
* only have the value true if the list is empty.
|
||||||
|
*
|
||||||
|
* \page listLIST_IS_EMPTY listLIST_IS_EMPTY
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
#define listLIST_IS_EMPTY( pxList ) ( ( BaseType_t ) ( ( pxList )->uxNumberOfItems == ( UBaseType_t ) 0 ) )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Access macro to return the number of items in the list.
|
||||||
|
*/
|
||||||
|
#define listCURRENT_LIST_LENGTH( pxList ) ( ( pxList )->uxNumberOfItems )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Access function to obtain the owner of the next entry in a list.
|
||||||
|
*
|
||||||
|
* The list member pxIndex is used to walk through a list. Calling
|
||||||
|
* listGET_OWNER_OF_NEXT_ENTRY increments pxIndex to the next item in the list
|
||||||
|
* and returns that entry's pxOwner parameter. Using multiple calls to this
|
||||||
|
* function it is therefore possible to move through every item contained in
|
||||||
|
* a list.
|
||||||
|
*
|
||||||
|
* The pxOwner parameter of a list item is a pointer to the object that owns
|
||||||
|
* the list item. In the scheduler this is normally a task control block.
|
||||||
|
* The pxOwner parameter effectively creates a two way link between the list
|
||||||
|
* item and its owner.
|
||||||
|
*
|
||||||
|
* @param pxTCB pxTCB is set to the address of the owner of the next list item.
|
||||||
|
* @param pxList The list from which the next item owner is to be returned.
|
||||||
|
*
|
||||||
|
* \page listGET_OWNER_OF_NEXT_ENTRY listGET_OWNER_OF_NEXT_ENTRY
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
#define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList ) \
|
||||||
|
{ \
|
||||||
|
List_t * const pxConstList = ( pxList ); \
|
||||||
|
/* Increment the index to the next item and return the item, ensuring */ \
|
||||||
|
/* we don't return the marker used at the end of the list. */ \
|
||||||
|
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
|
||||||
|
if( ( void * ) ( pxConstList )->pxIndex == ( void * ) &( ( pxConstList )->xListEnd ) ) \
|
||||||
|
{ \
|
||||||
|
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
|
||||||
|
} \
|
||||||
|
( pxTCB ) = ( pxConstList )->pxIndex->pvOwner; \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Access function to obtain the owner of the first entry in a list. Lists
|
||||||
|
* are normally sorted in ascending item value order.
|
||||||
|
*
|
||||||
|
* This function returns the pxOwner member of the first item in the list.
|
||||||
|
* The pxOwner parameter of a list item is a pointer to the object that owns
|
||||||
|
* the list item. In the scheduler this is normally a task control block.
|
||||||
|
* The pxOwner parameter effectively creates a two way link between the list
|
||||||
|
* item and its owner.
|
||||||
|
*
|
||||||
|
* @param pxList The list from which the owner of the head item is to be
|
||||||
|
* returned.
|
||||||
|
*
|
||||||
|
* \page listGET_OWNER_OF_HEAD_ENTRY listGET_OWNER_OF_HEAD_ENTRY
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
#define listGET_OWNER_OF_HEAD_ENTRY( pxList ) ( (&( ( pxList )->xListEnd ))->pxNext->pvOwner )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check to see if a list item is within a list. The list item maintains a
|
||||||
|
* "container" pointer that points to the list it is in. All this macro does
|
||||||
|
* is check to see if the container and the list match.
|
||||||
|
*
|
||||||
|
* @param pxList The list we want to know if the list item is within.
|
||||||
|
* @param pxListItem The list item we want to know if is in the list.
|
||||||
|
* @return pdTRUE if the list item is in the list, otherwise pdFALSE.
|
||||||
|
*/
|
||||||
|
#define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( BaseType_t ) ( ( pxListItem )->pvContainer == ( void * ) ( pxList ) ) )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the list a list item is contained within (referenced from).
|
||||||
|
*
|
||||||
|
* @param pxListItem The list item being queried.
|
||||||
|
* @return A pointer to the List_t object that references the pxListItem
|
||||||
|
*/
|
||||||
|
#define listLIST_ITEM_CONTAINER( pxListItem ) ( ( pxListItem )->pvContainer )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This provides a crude means of knowing if a list has been initialised, as
|
||||||
|
* pxList->xListEnd.xItemValue is set to portMAX_DELAY by the vListInitialise()
|
||||||
|
* function.
|
||||||
|
*/
|
||||||
|
#define listLIST_IS_INITIALISED( pxList ) ( ( pxList )->xListEnd.xItemValue == portMAX_DELAY )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Must be called before a list is used! This initialises all the members
|
||||||
|
* of the list structure and inserts the xListEnd item into the list as a
|
||||||
|
* marker to the back of the list.
|
||||||
|
*
|
||||||
|
* @param pxList Pointer to the list being initialised.
|
||||||
|
*
|
||||||
|
* \page vListInitialise vListInitialise
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
void vListInitialise( List_t * const pxList );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Must be called before a list item is used. This sets the list container to
|
||||||
|
* null so the item does not think that it is already contained in a list.
|
||||||
|
*
|
||||||
|
* @param pxItem Pointer to the list item being initialised.
|
||||||
|
*
|
||||||
|
* \page vListInitialiseItem vListInitialiseItem
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
void vListInitialiseItem( ListItem_t * const pxItem );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Insert a list item into a list. The item will be inserted into the list in
|
||||||
|
* a position determined by its item value (descending item value order).
|
||||||
|
*
|
||||||
|
* @param pxList The list into which the item is to be inserted.
|
||||||
|
*
|
||||||
|
* @param pxNewListItem The item that is to be placed in the list.
|
||||||
|
*
|
||||||
|
* \page vListInsert vListInsert
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Insert a list item into a list. The item will be inserted in a position
|
||||||
|
* such that it will be the last item within the list returned by multiple
|
||||||
|
* calls to listGET_OWNER_OF_NEXT_ENTRY.
|
||||||
|
*
|
||||||
|
* The list member pvIndex is used to walk through a list. Calling
|
||||||
|
* listGET_OWNER_OF_NEXT_ENTRY increments pvIndex to the next item in the list.
|
||||||
|
* Placing an item in a list using vListInsertEnd effectively places the item
|
||||||
|
* in the list position pointed to by pvIndex. This means that every other
|
||||||
|
* item within the list will be returned by listGET_OWNER_OF_NEXT_ENTRY before
|
||||||
|
* the pvIndex parameter again points to the item being inserted.
|
||||||
|
*
|
||||||
|
* @param pxList The list into which the item is to be inserted.
|
||||||
|
*
|
||||||
|
* @param pxNewListItem The list item to be inserted into the list.
|
||||||
|
*
|
||||||
|
* \page vListInsertEnd vListInsertEnd
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove an item from a list. The list item has a pointer to the list that
|
||||||
|
* it is in, so only the list item need be passed into the function.
|
||||||
|
*
|
||||||
|
* @param uxListRemove The item to be removed. The item will remove itself from
|
||||||
|
* the list pointed to by it's pxContainer parameter.
|
||||||
|
*
|
||||||
|
* @return The number of items that remain in the list after the list item has
|
||||||
|
* been removed.
|
||||||
|
*
|
||||||
|
* \page uxListRemove uxListRemove
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove );
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,153 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||||
|
All rights reserved
|
||||||
|
|
||||||
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS provides completely free yet professionally developed, *
|
||||||
|
* robust, strictly quality controlled, supported, and cross *
|
||||||
|
* platform software that has become a de facto standard. *
|
||||||
|
* *
|
||||||
|
* Help yourself get started quickly and support the FreeRTOS *
|
||||||
|
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||||
|
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||||
|
* *
|
||||||
|
* Thank you! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||||
|
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||||
|
>>! obliged to provide the source code for proprietary components !<<
|
||||||
|
>>! outside of the FreeRTOS kernel. !<<
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||||
|
link: http://www.freertos.org/a00114.html
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||||
|
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||||
|
licenses offer ticketed support, indemnification and middleware.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MPU_WRAPPERS_H
|
||||||
|
#define MPU_WRAPPERS_H
|
||||||
|
|
||||||
|
/* This file redefines API functions to be called through a wrapper macro, but
|
||||||
|
only for ports that are using the MPU. */
|
||||||
|
#ifdef portUSING_MPU_WRAPPERS
|
||||||
|
|
||||||
|
/* MPU_WRAPPERS_INCLUDED_FROM_API_FILE will be defined when this file is
|
||||||
|
included from queue.c or task.c to prevent it from having an effect within
|
||||||
|
those files. */
|
||||||
|
#ifndef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||||
|
|
||||||
|
#define xTaskGenericCreate MPU_xTaskGenericCreate
|
||||||
|
#define vTaskAllocateMPURegions MPU_vTaskAllocateMPURegions
|
||||||
|
#define vTaskDelete MPU_vTaskDelete
|
||||||
|
#define vTaskDelayUntil MPU_vTaskDelayUntil
|
||||||
|
#define vTaskDelay MPU_vTaskDelay
|
||||||
|
#define uxTaskPriorityGet MPU_uxTaskPriorityGet
|
||||||
|
#define vTaskPrioritySet MPU_vTaskPrioritySet
|
||||||
|
#define eTaskGetState MPU_eTaskGetState
|
||||||
|
#define vTaskSuspend MPU_vTaskSuspend
|
||||||
|
#define vTaskResume MPU_vTaskResume
|
||||||
|
#define vTaskSuspendAll MPU_vTaskSuspendAll
|
||||||
|
#define xTaskResumeAll MPU_xTaskResumeAll
|
||||||
|
#define xTaskGetTickCount MPU_xTaskGetTickCount
|
||||||
|
#define uxTaskGetNumberOfTasks MPU_uxTaskGetNumberOfTasks
|
||||||
|
#define vTaskList MPU_vTaskList
|
||||||
|
#define vTaskGetRunTimeStats MPU_vTaskGetRunTimeStats
|
||||||
|
#define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag
|
||||||
|
#define xTaskGetApplicationTaskTag MPU_xTaskGetApplicationTaskTag
|
||||||
|
#define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook
|
||||||
|
#define uxTaskGetStackHighWaterMark MPU_uxTaskGetStackHighWaterMark
|
||||||
|
#define xTaskGetCurrentTaskHandle MPU_xTaskGetCurrentTaskHandle
|
||||||
|
#define xTaskGetSchedulerState MPU_xTaskGetSchedulerState
|
||||||
|
#define xTaskGetIdleTaskHandle MPU_xTaskGetIdleTaskHandle
|
||||||
|
#define uxTaskGetSystemState MPU_uxTaskGetSystemState
|
||||||
|
|
||||||
|
#define xQueueGenericCreate MPU_xQueueGenericCreate
|
||||||
|
#define xQueueCreateMutex MPU_xQueueCreateMutex
|
||||||
|
#define xQueueGiveMutexRecursive MPU_xQueueGiveMutexRecursive
|
||||||
|
#define xQueueTakeMutexRecursive MPU_xQueueTakeMutexRecursive
|
||||||
|
#define xQueueCreateCountingSemaphore MPU_xQueueCreateCountingSemaphore
|
||||||
|
#define xQueueGenericSend MPU_xQueueGenericSend
|
||||||
|
#define xQueueAltGenericSend MPU_xQueueAltGenericSend
|
||||||
|
#define xQueueAltGenericReceive MPU_xQueueAltGenericReceive
|
||||||
|
#define xQueueGenericReceive MPU_xQueueGenericReceive
|
||||||
|
#define uxQueueMessagesWaiting MPU_uxQueueMessagesWaiting
|
||||||
|
#define vQueueDelete MPU_vQueueDelete
|
||||||
|
#define xQueueGenericReset MPU_xQueueGenericReset
|
||||||
|
#define xQueueCreateSet MPU_xQueueCreateSet
|
||||||
|
#define xQueueSelectFromSet MPU_xQueueSelectFromSet
|
||||||
|
#define xQueueAddToSet MPU_xQueueAddToSet
|
||||||
|
#define xQueueRemoveFromSet MPU_xQueueRemoveFromSet
|
||||||
|
#define xQueuePeekFromISR MPU_xQueuePeekFromISR
|
||||||
|
#define xQueueGetMutexHolder MPU_xQueueGetMutexHolder
|
||||||
|
|
||||||
|
#define pvPortMalloc MPU_pvPortMalloc
|
||||||
|
#define vPortFree MPU_vPortFree
|
||||||
|
#define xPortGetFreeHeapSize MPU_xPortGetFreeHeapSize
|
||||||
|
#define vPortInitialiseBlocks MPU_vPortInitialiseBlocks
|
||||||
|
|
||||||
|
#if configQUEUE_REGISTRY_SIZE > 0
|
||||||
|
#define vQueueAddToRegistry MPU_vQueueAddToRegistry
|
||||||
|
#define vQueueUnregisterQueue MPU_vQueueUnregisterQueue
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Remove the privileged function macro. */
|
||||||
|
#define PRIVILEGED_FUNCTION
|
||||||
|
|
||||||
|
#else /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
|
||||||
|
|
||||||
|
/* Ensure API functions go in the privileged execution section. */
|
||||||
|
#define PRIVILEGED_FUNCTION __attribute__((section("privileged_functions")))
|
||||||
|
#define PRIVILEGED_DATA __attribute__((section("privileged_data")))
|
||||||
|
|
||||||
|
#endif /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
|
||||||
|
|
||||||
|
#else /* portUSING_MPU_WRAPPERS */
|
||||||
|
|
||||||
|
#define PRIVILEGED_FUNCTION
|
||||||
|
#define PRIVILEGED_DATA
|
||||||
|
#define portUSING_MPU_WRAPPERS 0
|
||||||
|
|
||||||
|
#endif /* portUSING_MPU_WRAPPERS */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* MPU_WRAPPERS_H */
|
||||||
|
|
|
@ -0,0 +1,426 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||||
|
All rights reserved
|
||||||
|
|
||||||
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS provides completely free yet professionally developed, *
|
||||||
|
* robust, strictly quality controlled, supported, and cross *
|
||||||
|
* platform software that has become a de facto standard. *
|
||||||
|
* *
|
||||||
|
* Help yourself get started quickly and support the FreeRTOS *
|
||||||
|
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||||
|
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||||
|
* *
|
||||||
|
* Thank you! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||||
|
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||||
|
>>! obliged to provide the source code for proprietary components !<<
|
||||||
|
>>! outside of the FreeRTOS kernel. !<<
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||||
|
link: http://www.freertos.org/a00114.html
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||||
|
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||||
|
licenses offer ticketed support, indemnification and middleware.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------
|
||||||
|
* Portable layer API. Each function must be defined for each port.
|
||||||
|
*----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef PORTABLE_H
|
||||||
|
#define PORTABLE_H
|
||||||
|
|
||||||
|
/* Include the macro file relevant to the port being used.
|
||||||
|
NOTE: The following definitions are *DEPRECATED* as it is preferred to instead
|
||||||
|
just add the path to the correct portmacro.h header file to the compiler's
|
||||||
|
include path. */
|
||||||
|
#ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT
|
||||||
|
#include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h"
|
||||||
|
typedef void ( __interrupt __far *pxISR )();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef OPEN_WATCOM_FLASH_LITE_186_PORT
|
||||||
|
#include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h"
|
||||||
|
typedef void ( __interrupt __far *pxISR )();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_MEGA_AVR
|
||||||
|
#include "../portable/GCC/ATMega323/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef IAR_MEGA_AVR
|
||||||
|
#include "../portable/IAR/ATMega323/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MPLAB_PIC24_PORT
|
||||||
|
#include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MPLAB_DSPIC_PORT
|
||||||
|
#include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MPLAB_PIC18F_PORT
|
||||||
|
#include "../../Source/portable/MPLAB/PIC18F/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MPLAB_PIC32MX_PORT
|
||||||
|
#include "../../Source/portable/MPLAB/PIC32MX/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _FEDPICC
|
||||||
|
#include "libFreeRTOS/Include/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SDCC_CYGNAL
|
||||||
|
#include "../../Source/portable/SDCC/Cygnal/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_ARM7
|
||||||
|
#include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_ARM7_ECLIPSE
|
||||||
|
#include "portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ROWLEY_LPC23xx
|
||||||
|
#include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef IAR_MSP430
|
||||||
|
#include "..\..\Source\portable\IAR\MSP430\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_MSP430
|
||||||
|
#include "../../Source/portable/GCC/MSP430F449/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ROWLEY_MSP430
|
||||||
|
#include "../../Source/portable/Rowley/MSP430F449/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ARM7_LPC21xx_KEIL_RVDS
|
||||||
|
#include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SAM7_GCC
|
||||||
|
#include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SAM7_IAR
|
||||||
|
#include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SAM9XE_IAR
|
||||||
|
#include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef LPC2000_IAR
|
||||||
|
#include "..\..\Source\portable\IAR\LPC2000\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef STR71X_IAR
|
||||||
|
#include "..\..\Source\portable\IAR\STR71x\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef STR75X_IAR
|
||||||
|
#include "..\..\Source\portable\IAR\STR75x\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef STR75X_GCC
|
||||||
|
#include "..\..\Source\portable\GCC\STR75x\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef STR91X_IAR
|
||||||
|
#include "..\..\Source\portable\IAR\STR91x\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_H8S
|
||||||
|
#include "../../Source/portable/GCC/H8S2329/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_AT91FR40008
|
||||||
|
#include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef RVDS_ARMCM3_LM3S102
|
||||||
|
#include "../../Source/portable/RVDS/ARM_CM3/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_ARMCM3_LM3S102
|
||||||
|
#include "../../Source/portable/GCC/ARM_CM3/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_ARMCM3
|
||||||
|
#include "../../Source/portable/GCC/ARM_CM3/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef IAR_ARM_CM3
|
||||||
|
#include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef IAR_ARMCM3_LM
|
||||||
|
#include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HCS12_CODE_WARRIOR
|
||||||
|
#include "../../Source/portable/CodeWarrior/HCS12/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MICROBLAZE_GCC
|
||||||
|
#include "../../Source/portable/GCC/MicroBlaze/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TERN_EE
|
||||||
|
#include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_HCS12
|
||||||
|
#include "../../Source/portable/GCC/HCS12/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_MCF5235
|
||||||
|
#include "../../Source/portable/GCC/MCF5235/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COLDFIRE_V2_GCC
|
||||||
|
#include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COLDFIRE_V2_CODEWARRIOR
|
||||||
|
#include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_PPC405
|
||||||
|
#include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_PPC440
|
||||||
|
#include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _16FX_SOFTUNE
|
||||||
|
#include "..\..\Source\portable\Softune\MB96340\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef BCC_INDUSTRIAL_PC_PORT
|
||||||
|
/* A short file name has to be used in place of the normal
|
||||||
|
FreeRTOSConfig.h when using the Borland compiler. */
|
||||||
|
#include "frconfig.h"
|
||||||
|
#include "..\portable\BCC\16BitDOS\PC\prtmacro.h"
|
||||||
|
typedef void ( __interrupt __far *pxISR )();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef BCC_FLASH_LITE_186_PORT
|
||||||
|
/* A short file name has to be used in place of the normal
|
||||||
|
FreeRTOSConfig.h when using the Borland compiler. */
|
||||||
|
#include "frconfig.h"
|
||||||
|
#include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h"
|
||||||
|
typedef void ( __interrupt __far *pxISR )();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#ifdef __AVR32_AVR32A__
|
||||||
|
#include "portmacro.h"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __ICCAVR32__
|
||||||
|
#ifdef __CORE__
|
||||||
|
#if __CORE__ == __AVR32A__
|
||||||
|
#include "portmacro.h"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __91467D
|
||||||
|
#include "portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __96340
|
||||||
|
#include "portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __IAR_V850ES_Fx3__
|
||||||
|
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __IAR_V850ES_Jx3__
|
||||||
|
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __IAR_V850ES_Jx3_L__
|
||||||
|
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __IAR_V850ES_Jx2__
|
||||||
|
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __IAR_V850ES_Hx2__
|
||||||
|
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __IAR_78K0R_Kx3__
|
||||||
|
#include "../../Source/portable/IAR/78K0R/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __IAR_78K0R_Kx3L__
|
||||||
|
#include "../../Source/portable/IAR/78K0R/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Catch all to ensure portmacro.h is included in the build. Newer demos
|
||||||
|
have the path as part of the project options, rather than as relative from
|
||||||
|
the project location. If portENTER_CRITICAL() has not been defined then
|
||||||
|
portmacro.h has not yet been included - as every portmacro.h provides a
|
||||||
|
portENTER_CRITICAL() definition. Check the demo application for your demo
|
||||||
|
to find the path to the correct portmacro.h file. */
|
||||||
|
#ifndef portENTER_CRITICAL
|
||||||
|
#include "portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if portBYTE_ALIGNMENT == 8
|
||||||
|
#define portBYTE_ALIGNMENT_MASK ( 0x0007U )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if portBYTE_ALIGNMENT == 4
|
||||||
|
#define portBYTE_ALIGNMENT_MASK ( 0x0003 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if portBYTE_ALIGNMENT == 2
|
||||||
|
#define portBYTE_ALIGNMENT_MASK ( 0x0001 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if portBYTE_ALIGNMENT == 1
|
||||||
|
#define portBYTE_ALIGNMENT_MASK ( 0x0000 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portBYTE_ALIGNMENT_MASK
|
||||||
|
#error "Invalid portBYTE_ALIGNMENT definition"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portNUM_CONFIGURABLE_REGIONS
|
||||||
|
#define portNUM_CONFIGURABLE_REGIONS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "mpu_wrappers.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Setup the stack of a new task so it is ready to be placed under the
|
||||||
|
* scheduler control. The registers have to be placed on the stack in
|
||||||
|
* the order that the port expects to find them.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#if( portUSING_MPU_WRAPPERS == 1 )
|
||||||
|
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION;
|
||||||
|
#else
|
||||||
|
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Used by heap_5.c. */
|
||||||
|
typedef struct HeapRegion
|
||||||
|
{
|
||||||
|
uint8_t *pucStartAddress;
|
||||||
|
size_t xSizeInBytes;
|
||||||
|
} HeapRegion_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Used to define multiple heap regions for use by heap_5.c. This function
|
||||||
|
* must be called before any calls to pvPortMalloc() - not creating a task,
|
||||||
|
* queue, semaphore, mutex, software timer, event group, etc. will result in
|
||||||
|
* pvPortMalloc being called.
|
||||||
|
*
|
||||||
|
* pxHeapRegions passes in an array of HeapRegion_t structures - each of which
|
||||||
|
* defines a region of memory that can be used as the heap. The array is
|
||||||
|
* terminated by a HeapRegions_t structure that has a size of 0. The region
|
||||||
|
* with the lowest start address must appear first in the array.
|
||||||
|
*/
|
||||||
|
void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions );
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Map to the memory management routines required for the port.
|
||||||
|
*/
|
||||||
|
void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;
|
||||||
|
void vPortFree( void *pv ) PRIVILEGED_FUNCTION;
|
||||||
|
void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;
|
||||||
|
size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;
|
||||||
|
size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Setup the hardware ready for the scheduler to take control. This generally
|
||||||
|
* sets up a tick interrupt and sets timers for the correct tick frequency.
|
||||||
|
*/
|
||||||
|
BaseType_t xPortStartScheduler( void ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Undo any hardware/ISR setup that was performed by xPortStartScheduler() so
|
||||||
|
* the hardware is left in its original condition after the scheduler stops
|
||||||
|
* executing.
|
||||||
|
*/
|
||||||
|
void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The structures and methods of manipulating the MPU are contained within the
|
||||||
|
* port layer.
|
||||||
|
*
|
||||||
|
* Fills the xMPUSettings structure with the memory region information
|
||||||
|
* contained in xRegions.
|
||||||
|
*/
|
||||||
|
#if( portUSING_MPU_WRAPPERS == 1 )
|
||||||
|
struct xMEMORY_REGION;
|
||||||
|
void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint16_t usStackDepth ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* PORTABLE_H */
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||||
|
All rights reserved
|
||||||
|
|
||||||
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS provides completely free yet professionally developed, *
|
||||||
|
* robust, strictly quality controlled, supported, and cross *
|
||||||
|
* platform software that has become a de facto standard. *
|
||||||
|
* *
|
||||||
|
* Help yourself get started quickly and support the FreeRTOS *
|
||||||
|
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||||
|
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||||
|
* *
|
||||||
|
* Thank you! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||||
|
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||||
|
>>! obliged to provide the source code for proprietary components !<<
|
||||||
|
>>! outside of the FreeRTOS kernel. !<<
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||||
|
link: http://www.freertos.org/a00114.html
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||||
|
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||||
|
licenses offer ticketed support, indemnification and middleware.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PROJDEFS_H
|
||||||
|
#define PROJDEFS_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Defines the prototype to which task functions must conform. Defined in this
|
||||||
|
* file to ensure the type is known before portable.h is included.
|
||||||
|
*/
|
||||||
|
typedef void (*TaskFunction_t)( void * );
|
||||||
|
|
||||||
|
/* Converts a time in milliseconds to a time in ticks. */
|
||||||
|
#define pdMS_TO_TICKS( xTimeInMs ) ( ( ( TickType_t ) ( xTimeInMs ) * configTICK_RATE_HZ ) / ( TickType_t ) 1000 )
|
||||||
|
|
||||||
|
#define pdFALSE ( ( BaseType_t ) 0 )
|
||||||
|
#define pdTRUE ( ( BaseType_t ) 1 )
|
||||||
|
|
||||||
|
#define pdPASS ( pdTRUE )
|
||||||
|
#define pdFAIL ( pdFALSE )
|
||||||
|
#define errQUEUE_EMPTY ( ( BaseType_t ) 0 )
|
||||||
|
#define errQUEUE_FULL ( ( BaseType_t ) 0 )
|
||||||
|
|
||||||
|
/* Error definitions. */
|
||||||
|
#define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 )
|
||||||
|
#define errQUEUE_BLOCKED ( -4 )
|
||||||
|
#define errQUEUE_YIELD ( -5 )
|
||||||
|
|
||||||
|
#endif /* PROJDEFS_H */
|
||||||
|
|
||||||
|
|
||||||
|
|
1687
sdk/component/os/freertos/freertos_v8.1.2/Source/include/queue.h
Normal file
1687
sdk/component/os/freertos/freertos_v8.1.2/Source/include/queue.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,840 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||||
|
All rights reserved
|
||||||
|
|
||||||
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS provides completely free yet professionally developed, *
|
||||||
|
* robust, strictly quality controlled, supported, and cross *
|
||||||
|
* platform software that has become a de facto standard. *
|
||||||
|
* *
|
||||||
|
* Help yourself get started quickly and support the FreeRTOS *
|
||||||
|
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||||
|
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||||
|
* *
|
||||||
|
* Thank you! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||||
|
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||||
|
>>! obliged to provide the source code for proprietary components !<<
|
||||||
|
>>! outside of the FreeRTOS kernel. !<<
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||||
|
link: http://www.freertos.org/a00114.html
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||||
|
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||||
|
licenses offer ticketed support, indemnification and middleware.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SEMAPHORE_H
|
||||||
|
#define SEMAPHORE_H
|
||||||
|
|
||||||
|
#ifndef INC_FREERTOS_H
|
||||||
|
#error "include FreeRTOS.h" must appear in source files before "include semphr.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "queue.h"
|
||||||
|
|
||||||
|
typedef QueueHandle_t SemaphoreHandle_t;
|
||||||
|
|
||||||
|
#define semBINARY_SEMAPHORE_QUEUE_LENGTH ( ( uint8_t ) 1U )
|
||||||
|
#define semSEMAPHORE_QUEUE_ITEM_LENGTH ( ( uint8_t ) 0U )
|
||||||
|
#define semGIVE_BLOCK_TIME ( ( TickType_t ) 0U )
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>vSemaphoreCreateBinary( SemaphoreHandle_t xSemaphore )</pre>
|
||||||
|
*
|
||||||
|
* This old vSemaphoreCreateBinary() macro is now deprecated in favour of the
|
||||||
|
* xSemaphoreCreateBinary() function. Note that binary semaphores created using
|
||||||
|
* the vSemaphoreCreateBinary() macro are created in a state such that the
|
||||||
|
* first call to 'take' the semaphore would pass, whereas binary semaphores
|
||||||
|
* created using xSemaphoreCreateBinary() are created in a state such that the
|
||||||
|
* the semaphore must first be 'given' before it can be 'taken'.
|
||||||
|
*
|
||||||
|
* <i>Macro</i> that implements a semaphore by using the existing queue mechanism.
|
||||||
|
* The queue length is 1 as this is a binary semaphore. The data size is 0
|
||||||
|
* as we don't want to actually store any data - we just want to know if the
|
||||||
|
* queue is empty or full.
|
||||||
|
*
|
||||||
|
* This type of semaphore can be used for pure synchronisation between tasks or
|
||||||
|
* between an interrupt and a task. The semaphore need not be given back once
|
||||||
|
* obtained, so one task/interrupt can continuously 'give' the semaphore while
|
||||||
|
* another continuously 'takes' the semaphore. For this reason this type of
|
||||||
|
* semaphore does not use a priority inheritance mechanism. For an alternative
|
||||||
|
* that does use priority inheritance see xSemaphoreCreateMutex().
|
||||||
|
*
|
||||||
|
* @param xSemaphore Handle to the created semaphore. Should be of type SemaphoreHandle_t.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
SemaphoreHandle_t xSemaphore = NULL;
|
||||||
|
|
||||||
|
void vATask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// Semaphore cannot be used before a call to vSemaphoreCreateBinary ().
|
||||||
|
// This is a macro so pass the variable in directly.
|
||||||
|
vSemaphoreCreateBinary( xSemaphore );
|
||||||
|
|
||||||
|
if( xSemaphore != NULL )
|
||||||
|
{
|
||||||
|
// The semaphore was created successfully.
|
||||||
|
// The semaphore can now be used.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup vSemaphoreCreateBinary vSemaphoreCreateBinary
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define vSemaphoreCreateBinary( xSemaphore ) \
|
||||||
|
{ \
|
||||||
|
( xSemaphore ) = xQueueGenericCreate( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE ); \
|
||||||
|
if( ( xSemaphore ) != NULL ) \
|
||||||
|
{ \
|
||||||
|
( void ) xSemaphoreGive( ( xSemaphore ) ); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>SemaphoreHandle_t xSemaphoreCreateBinary( void )</pre>
|
||||||
|
*
|
||||||
|
* The old vSemaphoreCreateBinary() macro is now deprecated in favour of this
|
||||||
|
* xSemaphoreCreateBinary() function. Note that binary semaphores created using
|
||||||
|
* the vSemaphoreCreateBinary() macro are created in a state such that the
|
||||||
|
* first call to 'take' the semaphore would pass, whereas binary semaphores
|
||||||
|
* created using xSemaphoreCreateBinary() are created in a state such that the
|
||||||
|
* the semaphore must first be 'given' before it can be 'taken'.
|
||||||
|
*
|
||||||
|
* Function that creates a semaphore by using the existing queue mechanism.
|
||||||
|
* The queue length is 1 as this is a binary semaphore. The data size is 0
|
||||||
|
* as nothing is actually stored - all that is important is whether the queue is
|
||||||
|
* empty or full (the binary semaphore is available or not).
|
||||||
|
*
|
||||||
|
* This type of semaphore can be used for pure synchronisation between tasks or
|
||||||
|
* between an interrupt and a task. The semaphore need not be given back once
|
||||||
|
* obtained, so one task/interrupt can continuously 'give' the semaphore while
|
||||||
|
* another continuously 'takes' the semaphore. For this reason this type of
|
||||||
|
* semaphore does not use a priority inheritance mechanism. For an alternative
|
||||||
|
* that does use priority inheritance see xSemaphoreCreateMutex().
|
||||||
|
*
|
||||||
|
* @return Handle to the created semaphore.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
SemaphoreHandle_t xSemaphore = NULL;
|
||||||
|
|
||||||
|
void vATask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// Semaphore cannot be used before a call to vSemaphoreCreateBinary ().
|
||||||
|
// This is a macro so pass the variable in directly.
|
||||||
|
xSemaphore = xSemaphoreCreateBinary();
|
||||||
|
|
||||||
|
if( xSemaphore != NULL )
|
||||||
|
{
|
||||||
|
// The semaphore was created successfully.
|
||||||
|
// The semaphore can now be used.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup vSemaphoreCreateBinary vSemaphoreCreateBinary
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define xSemaphoreCreateBinary() xQueueGenericCreate( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>xSemaphoreTake(
|
||||||
|
* SemaphoreHandle_t xSemaphore,
|
||||||
|
* TickType_t xBlockTime
|
||||||
|
* )</pre>
|
||||||
|
*
|
||||||
|
* <i>Macro</i> to obtain a semaphore. The semaphore must have previously been
|
||||||
|
* created with a call to vSemaphoreCreateBinary(), xSemaphoreCreateMutex() or
|
||||||
|
* xSemaphoreCreateCounting().
|
||||||
|
*
|
||||||
|
* @param xSemaphore A handle to the semaphore being taken - obtained when
|
||||||
|
* the semaphore was created.
|
||||||
|
*
|
||||||
|
* @param xBlockTime The time in ticks to wait for the semaphore to become
|
||||||
|
* available. The macro portTICK_PERIOD_MS can be used to convert this to a
|
||||||
|
* real time. A block time of zero can be used to poll the semaphore. A block
|
||||||
|
* time of portMAX_DELAY can be used to block indefinitely (provided
|
||||||
|
* INCLUDE_vTaskSuspend is set to 1 in FreeRTOSConfig.h).
|
||||||
|
*
|
||||||
|
* @return pdTRUE if the semaphore was obtained. pdFALSE
|
||||||
|
* if xBlockTime expired without the semaphore becoming available.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
SemaphoreHandle_t xSemaphore = NULL;
|
||||||
|
|
||||||
|
// A task that creates a semaphore.
|
||||||
|
void vATask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// Create the semaphore to guard a shared resource.
|
||||||
|
vSemaphoreCreateBinary( xSemaphore );
|
||||||
|
}
|
||||||
|
|
||||||
|
// A task that uses the semaphore.
|
||||||
|
void vAnotherTask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// ... Do other things.
|
||||||
|
|
||||||
|
if( xSemaphore != NULL )
|
||||||
|
{
|
||||||
|
// See if we can obtain the semaphore. If the semaphore is not available
|
||||||
|
// wait 10 ticks to see if it becomes free.
|
||||||
|
if( xSemaphoreTake( xSemaphore, ( TickType_t ) 10 ) == pdTRUE )
|
||||||
|
{
|
||||||
|
// We were able to obtain the semaphore and can now access the
|
||||||
|
// shared resource.
|
||||||
|
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// We have finished accessing the shared resource. Release the
|
||||||
|
// semaphore.
|
||||||
|
xSemaphoreGive( xSemaphore );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We could not obtain the semaphore and can therefore not access
|
||||||
|
// the shared resource safely.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xSemaphoreTake xSemaphoreTake
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define xSemaphoreTake( xSemaphore, xBlockTime ) xQueueGenericReceive( ( QueueHandle_t ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* xSemaphoreTakeRecursive(
|
||||||
|
* SemaphoreHandle_t xMutex,
|
||||||
|
* TickType_t xBlockTime
|
||||||
|
* )
|
||||||
|
*
|
||||||
|
* <i>Macro</i> to recursively obtain, or 'take', a mutex type semaphore.
|
||||||
|
* The mutex must have previously been created using a call to
|
||||||
|
* xSemaphoreCreateRecursiveMutex();
|
||||||
|
*
|
||||||
|
* configUSE_RECURSIVE_MUTEXES must be set to 1 in FreeRTOSConfig.h for this
|
||||||
|
* macro to be available.
|
||||||
|
*
|
||||||
|
* This macro must not be used on mutexes created using xSemaphoreCreateMutex().
|
||||||
|
*
|
||||||
|
* A mutex used recursively can be 'taken' repeatedly by the owner. The mutex
|
||||||
|
* doesn't become available again until the owner has called
|
||||||
|
* xSemaphoreGiveRecursive() for each successful 'take' request. For example,
|
||||||
|
* if a task successfully 'takes' the same mutex 5 times then the mutex will
|
||||||
|
* not be available to any other task until it has also 'given' the mutex back
|
||||||
|
* exactly five times.
|
||||||
|
*
|
||||||
|
* @param xMutex A handle to the mutex being obtained. This is the
|
||||||
|
* handle returned by xSemaphoreCreateRecursiveMutex();
|
||||||
|
*
|
||||||
|
* @param xBlockTime The time in ticks to wait for the semaphore to become
|
||||||
|
* available. The macro portTICK_PERIOD_MS can be used to convert this to a
|
||||||
|
* real time. A block time of zero can be used to poll the semaphore. If
|
||||||
|
* the task already owns the semaphore then xSemaphoreTakeRecursive() will
|
||||||
|
* return immediately no matter what the value of xBlockTime.
|
||||||
|
*
|
||||||
|
* @return pdTRUE if the semaphore was obtained. pdFALSE if xBlockTime
|
||||||
|
* expired without the semaphore becoming available.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
SemaphoreHandle_t xMutex = NULL;
|
||||||
|
|
||||||
|
// A task that creates a mutex.
|
||||||
|
void vATask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// Create the mutex to guard a shared resource.
|
||||||
|
xMutex = xSemaphoreCreateRecursiveMutex();
|
||||||
|
}
|
||||||
|
|
||||||
|
// A task that uses the mutex.
|
||||||
|
void vAnotherTask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// ... Do other things.
|
||||||
|
|
||||||
|
if( xMutex != NULL )
|
||||||
|
{
|
||||||
|
// See if we can obtain the mutex. If the mutex is not available
|
||||||
|
// wait 10 ticks to see if it becomes free.
|
||||||
|
if( xSemaphoreTakeRecursive( xSemaphore, ( TickType_t ) 10 ) == pdTRUE )
|
||||||
|
{
|
||||||
|
// We were able to obtain the mutex and can now access the
|
||||||
|
// shared resource.
|
||||||
|
|
||||||
|
// ...
|
||||||
|
// For some reason due to the nature of the code further calls to
|
||||||
|
// xSemaphoreTakeRecursive() are made on the same mutex. In real
|
||||||
|
// code these would not be just sequential calls as this would make
|
||||||
|
// no sense. Instead the calls are likely to be buried inside
|
||||||
|
// a more complex call structure.
|
||||||
|
xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );
|
||||||
|
xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );
|
||||||
|
|
||||||
|
// The mutex has now been 'taken' three times, so will not be
|
||||||
|
// available to another task until it has also been given back
|
||||||
|
// three times. Again it is unlikely that real code would have
|
||||||
|
// these calls sequentially, but instead buried in a more complex
|
||||||
|
// call structure. This is just for illustrative purposes.
|
||||||
|
xSemaphoreGiveRecursive( xMutex );
|
||||||
|
xSemaphoreGiveRecursive( xMutex );
|
||||||
|
xSemaphoreGiveRecursive( xMutex );
|
||||||
|
|
||||||
|
// Now the mutex can be taken by other tasks.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We could not obtain the mutex and can therefore not access
|
||||||
|
// the shared resource safely.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xSemaphoreTakeRecursive xSemaphoreTakeRecursive
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define xSemaphoreTakeRecursive( xMutex, xBlockTime ) xQueueTakeMutexRecursive( ( xMutex ), ( xBlockTime ) )
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* xSemaphoreAltTake() is an alternative version of xSemaphoreTake().
|
||||||
|
*
|
||||||
|
* The source code that implements the alternative (Alt) API is much
|
||||||
|
* simpler because it executes everything from within a critical section.
|
||||||
|
* This is the approach taken by many other RTOSes, but FreeRTOS.org has the
|
||||||
|
* preferred fully featured API too. The fully featured API has more
|
||||||
|
* complex code that takes longer to execute, but makes much less use of
|
||||||
|
* critical sections. Therefore the alternative API sacrifices interrupt
|
||||||
|
* responsiveness to gain execution speed, whereas the fully featured API
|
||||||
|
* sacrifices execution speed to ensure better interrupt responsiveness.
|
||||||
|
*/
|
||||||
|
#define xSemaphoreAltTake( xSemaphore, xBlockTime ) xQueueAltGenericReceive( ( QueueHandle_t ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>xSemaphoreGive( SemaphoreHandle_t xSemaphore )</pre>
|
||||||
|
*
|
||||||
|
* <i>Macro</i> to release a semaphore. The semaphore must have previously been
|
||||||
|
* created with a call to vSemaphoreCreateBinary(), xSemaphoreCreateMutex() or
|
||||||
|
* xSemaphoreCreateCounting(). and obtained using sSemaphoreTake().
|
||||||
|
*
|
||||||
|
* This macro must not be used from an ISR. See xSemaphoreGiveFromISR () for
|
||||||
|
* an alternative which can be used from an ISR.
|
||||||
|
*
|
||||||
|
* This macro must also not be used on semaphores created using
|
||||||
|
* xSemaphoreCreateRecursiveMutex().
|
||||||
|
*
|
||||||
|
* @param xSemaphore A handle to the semaphore being released. This is the
|
||||||
|
* handle returned when the semaphore was created.
|
||||||
|
*
|
||||||
|
* @return pdTRUE if the semaphore was released. pdFALSE if an error occurred.
|
||||||
|
* Semaphores are implemented using queues. An error can occur if there is
|
||||||
|
* no space on the queue to post a message - indicating that the
|
||||||
|
* semaphore was not first obtained correctly.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
SemaphoreHandle_t xSemaphore = NULL;
|
||||||
|
|
||||||
|
void vATask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// Create the semaphore to guard a shared resource.
|
||||||
|
vSemaphoreCreateBinary( xSemaphore );
|
||||||
|
|
||||||
|
if( xSemaphore != NULL )
|
||||||
|
{
|
||||||
|
if( xSemaphoreGive( xSemaphore ) != pdTRUE )
|
||||||
|
{
|
||||||
|
// We would expect this call to fail because we cannot give
|
||||||
|
// a semaphore without first "taking" it!
|
||||||
|
}
|
||||||
|
|
||||||
|
// Obtain the semaphore - don't block if the semaphore is not
|
||||||
|
// immediately available.
|
||||||
|
if( xSemaphoreTake( xSemaphore, ( TickType_t ) 0 ) )
|
||||||
|
{
|
||||||
|
// We now have the semaphore and can access the shared resource.
|
||||||
|
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// We have finished accessing the shared resource so can free the
|
||||||
|
// semaphore.
|
||||||
|
if( xSemaphoreGive( xSemaphore ) != pdTRUE )
|
||||||
|
{
|
||||||
|
// We would not expect this call to fail because we must have
|
||||||
|
// obtained the semaphore to get here.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xSemaphoreGive xSemaphoreGive
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define xSemaphoreGive( xSemaphore ) xQueueGenericSend( ( QueueHandle_t ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>xSemaphoreGiveRecursive( SemaphoreHandle_t xMutex )</pre>
|
||||||
|
*
|
||||||
|
* <i>Macro</i> to recursively release, or 'give', a mutex type semaphore.
|
||||||
|
* The mutex must have previously been created using a call to
|
||||||
|
* xSemaphoreCreateRecursiveMutex();
|
||||||
|
*
|
||||||
|
* configUSE_RECURSIVE_MUTEXES must be set to 1 in FreeRTOSConfig.h for this
|
||||||
|
* macro to be available.
|
||||||
|
*
|
||||||
|
* This macro must not be used on mutexes created using xSemaphoreCreateMutex().
|
||||||
|
*
|
||||||
|
* A mutex used recursively can be 'taken' repeatedly by the owner. The mutex
|
||||||
|
* doesn't become available again until the owner has called
|
||||||
|
* xSemaphoreGiveRecursive() for each successful 'take' request. For example,
|
||||||
|
* if a task successfully 'takes' the same mutex 5 times then the mutex will
|
||||||
|
* not be available to any other task until it has also 'given' the mutex back
|
||||||
|
* exactly five times.
|
||||||
|
*
|
||||||
|
* @param xMutex A handle to the mutex being released, or 'given'. This is the
|
||||||
|
* handle returned by xSemaphoreCreateMutex();
|
||||||
|
*
|
||||||
|
* @return pdTRUE if the semaphore was given.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
SemaphoreHandle_t xMutex = NULL;
|
||||||
|
|
||||||
|
// A task that creates a mutex.
|
||||||
|
void vATask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// Create the mutex to guard a shared resource.
|
||||||
|
xMutex = xSemaphoreCreateRecursiveMutex();
|
||||||
|
}
|
||||||
|
|
||||||
|
// A task that uses the mutex.
|
||||||
|
void vAnotherTask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// ... Do other things.
|
||||||
|
|
||||||
|
if( xMutex != NULL )
|
||||||
|
{
|
||||||
|
// See if we can obtain the mutex. If the mutex is not available
|
||||||
|
// wait 10 ticks to see if it becomes free.
|
||||||
|
if( xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 ) == pdTRUE )
|
||||||
|
{
|
||||||
|
// We were able to obtain the mutex and can now access the
|
||||||
|
// shared resource.
|
||||||
|
|
||||||
|
// ...
|
||||||
|
// For some reason due to the nature of the code further calls to
|
||||||
|
// xSemaphoreTakeRecursive() are made on the same mutex. In real
|
||||||
|
// code these would not be just sequential calls as this would make
|
||||||
|
// no sense. Instead the calls are likely to be buried inside
|
||||||
|
// a more complex call structure.
|
||||||
|
xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );
|
||||||
|
xSemaphoreTakeRecursive( xMutex, ( TickType_t ) 10 );
|
||||||
|
|
||||||
|
// The mutex has now been 'taken' three times, so will not be
|
||||||
|
// available to another task until it has also been given back
|
||||||
|
// three times. Again it is unlikely that real code would have
|
||||||
|
// these calls sequentially, it would be more likely that the calls
|
||||||
|
// to xSemaphoreGiveRecursive() would be called as a call stack
|
||||||
|
// unwound. This is just for demonstrative purposes.
|
||||||
|
xSemaphoreGiveRecursive( xMutex );
|
||||||
|
xSemaphoreGiveRecursive( xMutex );
|
||||||
|
xSemaphoreGiveRecursive( xMutex );
|
||||||
|
|
||||||
|
// Now the mutex can be taken by other tasks.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We could not obtain the mutex and can therefore not access
|
||||||
|
// the shared resource safely.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xSemaphoreGiveRecursive xSemaphoreGiveRecursive
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define xSemaphoreGiveRecursive( xMutex ) xQueueGiveMutexRecursive( ( xMutex ) )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* xSemaphoreAltGive() is an alternative version of xSemaphoreGive().
|
||||||
|
*
|
||||||
|
* The source code that implements the alternative (Alt) API is much
|
||||||
|
* simpler because it executes everything from within a critical section.
|
||||||
|
* This is the approach taken by many other RTOSes, but FreeRTOS.org has the
|
||||||
|
* preferred fully featured API too. The fully featured API has more
|
||||||
|
* complex code that takes longer to execute, but makes much less use of
|
||||||
|
* critical sections. Therefore the alternative API sacrifices interrupt
|
||||||
|
* responsiveness to gain execution speed, whereas the fully featured API
|
||||||
|
* sacrifices execution speed to ensure better interrupt responsiveness.
|
||||||
|
*/
|
||||||
|
#define xSemaphoreAltGive( xSemaphore ) xQueueAltGenericSend( ( QueueHandle_t ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>
|
||||||
|
xSemaphoreGiveFromISR(
|
||||||
|
SemaphoreHandle_t xSemaphore,
|
||||||
|
BaseType_t *pxHigherPriorityTaskWoken
|
||||||
|
)</pre>
|
||||||
|
*
|
||||||
|
* <i>Macro</i> to release a semaphore. The semaphore must have previously been
|
||||||
|
* created with a call to vSemaphoreCreateBinary() or xSemaphoreCreateCounting().
|
||||||
|
*
|
||||||
|
* Mutex type semaphores (those created using a call to xSemaphoreCreateMutex())
|
||||||
|
* must not be used with this macro.
|
||||||
|
*
|
||||||
|
* This macro can be used from an ISR.
|
||||||
|
*
|
||||||
|
* @param xSemaphore A handle to the semaphore being released. This is the
|
||||||
|
* handle returned when the semaphore was created.
|
||||||
|
*
|
||||||
|
* @param pxHigherPriorityTaskWoken xSemaphoreGiveFromISR() will set
|
||||||
|
* *pxHigherPriorityTaskWoken to pdTRUE if giving the semaphore caused a task
|
||||||
|
* to unblock, and the unblocked task has a priority higher than the currently
|
||||||
|
* running task. If xSemaphoreGiveFromISR() sets this value to pdTRUE then
|
||||||
|
* a context switch should be requested before the interrupt is exited.
|
||||||
|
*
|
||||||
|
* @return pdTRUE if the semaphore was successfully given, otherwise errQUEUE_FULL.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
\#define LONG_TIME 0xffff
|
||||||
|
\#define TICKS_TO_WAIT 10
|
||||||
|
SemaphoreHandle_t xSemaphore = NULL;
|
||||||
|
|
||||||
|
// Repetitive task.
|
||||||
|
void vATask( void * pvParameters )
|
||||||
|
{
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// We want this task to run every 10 ticks of a timer. The semaphore
|
||||||
|
// was created before this task was started.
|
||||||
|
|
||||||
|
// Block waiting for the semaphore to become available.
|
||||||
|
if( xSemaphoreTake( xSemaphore, LONG_TIME ) == pdTRUE )
|
||||||
|
{
|
||||||
|
// It is time to execute.
|
||||||
|
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// We have finished our task. Return to the top of the loop where
|
||||||
|
// we will block on the semaphore until it is time to execute
|
||||||
|
// again. Note when using the semaphore for synchronisation with an
|
||||||
|
// ISR in this manner there is no need to 'give' the semaphore back.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Timer ISR
|
||||||
|
void vTimerISR( void * pvParameters )
|
||||||
|
{
|
||||||
|
static uint8_t ucLocalTickCount = 0;
|
||||||
|
static BaseType_t xHigherPriorityTaskWoken;
|
||||||
|
|
||||||
|
// A timer tick has occurred.
|
||||||
|
|
||||||
|
// ... Do other time functions.
|
||||||
|
|
||||||
|
// Is it time for vATask () to run?
|
||||||
|
xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
ucLocalTickCount++;
|
||||||
|
if( ucLocalTickCount >= TICKS_TO_WAIT )
|
||||||
|
{
|
||||||
|
// Unblock the task by releasing the semaphore.
|
||||||
|
xSemaphoreGiveFromISR( xSemaphore, &xHigherPriorityTaskWoken );
|
||||||
|
|
||||||
|
// Reset the count so we release the semaphore again in 10 ticks time.
|
||||||
|
ucLocalTickCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xHigherPriorityTaskWoken != pdFALSE )
|
||||||
|
{
|
||||||
|
// We can force a context switch here. Context switching from an
|
||||||
|
// ISR uses port specific syntax. Check the demo task for your port
|
||||||
|
// to find the syntax required.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xSemaphoreGiveFromISR xSemaphoreGiveFromISR
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define xSemaphoreGiveFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( ( QueueHandle_t ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ), queueSEND_TO_BACK )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>
|
||||||
|
xSemaphoreTakeFromISR(
|
||||||
|
SemaphoreHandle_t xSemaphore,
|
||||||
|
BaseType_t *pxHigherPriorityTaskWoken
|
||||||
|
)</pre>
|
||||||
|
*
|
||||||
|
* <i>Macro</i> to take a semaphore from an ISR. The semaphore must have
|
||||||
|
* previously been created with a call to vSemaphoreCreateBinary() or
|
||||||
|
* xSemaphoreCreateCounting().
|
||||||
|
*
|
||||||
|
* Mutex type semaphores (those created using a call to xSemaphoreCreateMutex())
|
||||||
|
* must not be used with this macro.
|
||||||
|
*
|
||||||
|
* This macro can be used from an ISR, however taking a semaphore from an ISR
|
||||||
|
* is not a common operation. It is likely to only be useful when taking a
|
||||||
|
* counting semaphore when an interrupt is obtaining an object from a resource
|
||||||
|
* pool (when the semaphore count indicates the number of resources available).
|
||||||
|
*
|
||||||
|
* @param xSemaphore A handle to the semaphore being taken. This is the
|
||||||
|
* handle returned when the semaphore was created.
|
||||||
|
*
|
||||||
|
* @param pxHigherPriorityTaskWoken xSemaphoreTakeFromISR() will set
|
||||||
|
* *pxHigherPriorityTaskWoken to pdTRUE if taking the semaphore caused a task
|
||||||
|
* to unblock, and the unblocked task has a priority higher than the currently
|
||||||
|
* running task. If xSemaphoreTakeFromISR() sets this value to pdTRUE then
|
||||||
|
* a context switch should be requested before the interrupt is exited.
|
||||||
|
*
|
||||||
|
* @return pdTRUE if the semaphore was successfully taken, otherwise
|
||||||
|
* pdFALSE
|
||||||
|
*/
|
||||||
|
#define xSemaphoreTakeFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueReceiveFromISR( ( QueueHandle_t ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ) )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>SemaphoreHandle_t xSemaphoreCreateMutex( void )</pre>
|
||||||
|
*
|
||||||
|
* <i>Macro</i> that implements a mutex semaphore by using the existing queue
|
||||||
|
* mechanism.
|
||||||
|
*
|
||||||
|
* Mutexes created using this macro can be accessed using the xSemaphoreTake()
|
||||||
|
* and xSemaphoreGive() macros. The xSemaphoreTakeRecursive() and
|
||||||
|
* xSemaphoreGiveRecursive() macros should not be used.
|
||||||
|
*
|
||||||
|
* This type of semaphore uses a priority inheritance mechanism so a task
|
||||||
|
* 'taking' a semaphore MUST ALWAYS 'give' the semaphore back once the
|
||||||
|
* semaphore it is no longer required.
|
||||||
|
*
|
||||||
|
* Mutex type semaphores cannot be used from within interrupt service routines.
|
||||||
|
*
|
||||||
|
* See vSemaphoreCreateBinary() for an alternative implementation that can be
|
||||||
|
* used for pure synchronisation (where one task or interrupt always 'gives' the
|
||||||
|
* semaphore and another always 'takes' the semaphore) and from within interrupt
|
||||||
|
* service routines.
|
||||||
|
*
|
||||||
|
* @return xSemaphore Handle to the created mutex semaphore. Should be of type
|
||||||
|
* SemaphoreHandle_t.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
SemaphoreHandle_t xSemaphore;
|
||||||
|
|
||||||
|
void vATask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// Semaphore cannot be used before a call to xSemaphoreCreateMutex().
|
||||||
|
// This is a macro so pass the variable in directly.
|
||||||
|
xSemaphore = xSemaphoreCreateMutex();
|
||||||
|
|
||||||
|
if( xSemaphore != NULL )
|
||||||
|
{
|
||||||
|
// The semaphore was created successfully.
|
||||||
|
// The semaphore can now be used.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup vSemaphoreCreateMutex vSemaphoreCreateMutex
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define xSemaphoreCreateMutex() xQueueCreateMutex( queueQUEUE_TYPE_MUTEX )
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>SemaphoreHandle_t xSemaphoreCreateRecursiveMutex( void )</pre>
|
||||||
|
*
|
||||||
|
* <i>Macro</i> that implements a recursive mutex by using the existing queue
|
||||||
|
* mechanism.
|
||||||
|
*
|
||||||
|
* Mutexes created using this macro can be accessed using the
|
||||||
|
* xSemaphoreTakeRecursive() and xSemaphoreGiveRecursive() macros. The
|
||||||
|
* xSemaphoreTake() and xSemaphoreGive() macros should not be used.
|
||||||
|
*
|
||||||
|
* A mutex used recursively can be 'taken' repeatedly by the owner. The mutex
|
||||||
|
* doesn't become available again until the owner has called
|
||||||
|
* xSemaphoreGiveRecursive() for each successful 'take' request. For example,
|
||||||
|
* if a task successfully 'takes' the same mutex 5 times then the mutex will
|
||||||
|
* not be available to any other task until it has also 'given' the mutex back
|
||||||
|
* exactly five times.
|
||||||
|
*
|
||||||
|
* This type of semaphore uses a priority inheritance mechanism so a task
|
||||||
|
* 'taking' a semaphore MUST ALWAYS 'give' the semaphore back once the
|
||||||
|
* semaphore it is no longer required.
|
||||||
|
*
|
||||||
|
* Mutex type semaphores cannot be used from within interrupt service routines.
|
||||||
|
*
|
||||||
|
* See vSemaphoreCreateBinary() for an alternative implementation that can be
|
||||||
|
* used for pure synchronisation (where one task or interrupt always 'gives' the
|
||||||
|
* semaphore and another always 'takes' the semaphore) and from within interrupt
|
||||||
|
* service routines.
|
||||||
|
*
|
||||||
|
* @return xSemaphore Handle to the created mutex semaphore. Should be of type
|
||||||
|
* SemaphoreHandle_t.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
SemaphoreHandle_t xSemaphore;
|
||||||
|
|
||||||
|
void vATask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// Semaphore cannot be used before a call to xSemaphoreCreateMutex().
|
||||||
|
// This is a macro so pass the variable in directly.
|
||||||
|
xSemaphore = xSemaphoreCreateRecursiveMutex();
|
||||||
|
|
||||||
|
if( xSemaphore != NULL )
|
||||||
|
{
|
||||||
|
// The semaphore was created successfully.
|
||||||
|
// The semaphore can now be used.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup vSemaphoreCreateMutex vSemaphoreCreateMutex
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define xSemaphoreCreateRecursiveMutex() xQueueCreateMutex( queueQUEUE_TYPE_RECURSIVE_MUTEX )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>SemaphoreHandle_t xSemaphoreCreateCounting( UBaseType_t uxMaxCount, UBaseType_t uxInitialCount )</pre>
|
||||||
|
*
|
||||||
|
* <i>Macro</i> that creates a counting semaphore by using the existing
|
||||||
|
* queue mechanism.
|
||||||
|
*
|
||||||
|
* Counting semaphores are typically used for two things:
|
||||||
|
*
|
||||||
|
* 1) Counting events.
|
||||||
|
*
|
||||||
|
* In this usage scenario an event handler will 'give' a semaphore each time
|
||||||
|
* an event occurs (incrementing the semaphore count value), and a handler
|
||||||
|
* task will 'take' a semaphore each time it processes an event
|
||||||
|
* (decrementing the semaphore count value). The count value is therefore
|
||||||
|
* the difference between the number of events that have occurred and the
|
||||||
|
* number that have been processed. In this case it is desirable for the
|
||||||
|
* initial count value to be zero.
|
||||||
|
*
|
||||||
|
* 2) Resource management.
|
||||||
|
*
|
||||||
|
* In this usage scenario the count value indicates the number of resources
|
||||||
|
* available. To obtain control of a resource a task must first obtain a
|
||||||
|
* semaphore - decrementing the semaphore count value. When the count value
|
||||||
|
* reaches zero there are no free resources. When a task finishes with the
|
||||||
|
* resource it 'gives' the semaphore back - incrementing the semaphore count
|
||||||
|
* value. In this case it is desirable for the initial count value to be
|
||||||
|
* equal to the maximum count value, indicating that all resources are free.
|
||||||
|
*
|
||||||
|
* @param uxMaxCount The maximum count value that can be reached. When the
|
||||||
|
* semaphore reaches this value it can no longer be 'given'.
|
||||||
|
*
|
||||||
|
* @param uxInitialCount The count value assigned to the semaphore when it is
|
||||||
|
* created.
|
||||||
|
*
|
||||||
|
* @return Handle to the created semaphore. Null if the semaphore could not be
|
||||||
|
* created.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
SemaphoreHandle_t xSemaphore;
|
||||||
|
|
||||||
|
void vATask( void * pvParameters )
|
||||||
|
{
|
||||||
|
SemaphoreHandle_t xSemaphore = NULL;
|
||||||
|
|
||||||
|
// Semaphore cannot be used before a call to xSemaphoreCreateCounting().
|
||||||
|
// The max value to which the semaphore can count should be 10, and the
|
||||||
|
// initial value assigned to the count should be 0.
|
||||||
|
xSemaphore = xSemaphoreCreateCounting( 10, 0 );
|
||||||
|
|
||||||
|
if( xSemaphore != NULL )
|
||||||
|
{
|
||||||
|
// The semaphore was created successfully.
|
||||||
|
// The semaphore can now be used.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xSemaphoreCreateCounting xSemaphoreCreateCounting
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define xSemaphoreCreateCounting( uxMaxCount, uxInitialCount ) xQueueCreateCountingSemaphore( ( uxMaxCount ), ( uxInitialCount ) )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>void vSemaphoreDelete( SemaphoreHandle_t xSemaphore );</pre>
|
||||||
|
*
|
||||||
|
* Delete a semaphore. This function must be used with care. For example,
|
||||||
|
* do not delete a mutex type semaphore if the mutex is held by a task.
|
||||||
|
*
|
||||||
|
* @param xSemaphore A handle to the semaphore to be deleted.
|
||||||
|
*
|
||||||
|
* \defgroup vSemaphoreDelete vSemaphoreDelete
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define vSemaphoreDelete( xSemaphore ) vQueueDelete( ( QueueHandle_t ) ( xSemaphore ) )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr.h
|
||||||
|
* <pre>TaskHandle_t xSemaphoreGetMutexHolder( SemaphoreHandle_t xMutex );</pre>
|
||||||
|
*
|
||||||
|
* If xMutex is indeed a mutex type semaphore, return the current mutex holder.
|
||||||
|
* If xMutex is not a mutex type semaphore, or the mutex is available (not held
|
||||||
|
* by a task), return NULL.
|
||||||
|
*
|
||||||
|
* Note: This is a good way of determining if the calling task is the mutex
|
||||||
|
* holder, but not a good way of determining the identity of the mutex holder as
|
||||||
|
* the holder may change between the function exiting and the returned value
|
||||||
|
* being tested.
|
||||||
|
*/
|
||||||
|
#define xSemaphoreGetMutexHolder( xSemaphore ) xQueueGetMutexHolder( ( xSemaphore ) )
|
||||||
|
|
||||||
|
#endif /* SEMAPHORE_H */
|
||||||
|
|
||||||
|
|
1570
sdk/component/os/freertos/freertos_v8.1.2/Source/include/task.h
Normal file
1570
sdk/component/os/freertos/freertos_v8.1.2/Source/include/task.h
Normal file
File diff suppressed because it is too large
Load diff
1121
sdk/component/os/freertos/freertos_v8.1.2/Source/include/timers.h
Normal file
1121
sdk/component/os/freertos/freertos_v8.1.2/Source/include/timers.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
include $(MAKE_INCLUDE_GEN)
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
|
|
||||||
|
MODULE_IFLAGS =
|
||||||
|
|
||||||
|
|
||||||
|
#*****************************************************************************#
|
||||||
|
# Object FILE LIST #
|
||||||
|
#*****************************************************************************#
|
||||||
|
OBJS = port.o
|
||||||
|
ifeq ($(CONFIG_RELEASE_BUILD),y)
|
||||||
|
OBJS =
|
||||||
|
else
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
#*****************************************************************************#
|
||||||
|
# RULES TO GENERATE TARGETS #
|
||||||
|
#*****************************************************************************#
|
||||||
|
|
||||||
|
# Define the Rules to build the core targets
|
||||||
|
all: CORE_TARGETS COPY_RAM_OBJS
|
||||||
|
|
||||||
|
|
||||||
|
#*****************************************************************************#
|
||||||
|
# GENERATE OBJECT FILE
|
||||||
|
#*****************************************************************************#
|
||||||
|
CORE_TARGETS: $(OBJS)
|
||||||
|
|
||||||
|
-include $(DEPS)
|
|
@ -0,0 +1,197 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||||
|
All rights reserved
|
||||||
|
|
||||||
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS provides completely free yet professionally developed, *
|
||||||
|
* robust, strictly quality controlled, supported, and cross *
|
||||||
|
* platform software that has become a de facto standard. *
|
||||||
|
* *
|
||||||
|
* Help yourself get started quickly and support the FreeRTOS *
|
||||||
|
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||||
|
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||||
|
* *
|
||||||
|
* Thank you! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||||
|
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||||
|
>>! obliged to provide the source code for proprietary components !<<
|
||||||
|
>>! outside of the FreeRTOS kernel. !<<
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||||
|
link: http://www.freertos.org/a00114.html
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||||
|
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||||
|
licenses offer ticketed support, indemnification and middleware.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef PORTMACRO_H
|
||||||
|
#define PORTMACRO_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "rtl8195a.h"
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------
|
||||||
|
* Port specific definitions.
|
||||||
|
*
|
||||||
|
* The settings in this file configure FreeRTOS correctly for the
|
||||||
|
* given hardware and compiler.
|
||||||
|
*
|
||||||
|
* These settings should not be altered.
|
||||||
|
*-----------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Type definitions. */
|
||||||
|
#define portCHAR char
|
||||||
|
#define portFLOAT float
|
||||||
|
#define portDOUBLE double
|
||||||
|
#define portLONG long
|
||||||
|
#define portSHORT short
|
||||||
|
#define portSTACK_TYPE uint32_t
|
||||||
|
#define portBASE_TYPE long
|
||||||
|
|
||||||
|
typedef portSTACK_TYPE StackType_t;
|
||||||
|
typedef long BaseType_t;
|
||||||
|
typedef unsigned long UBaseType_t;
|
||||||
|
|
||||||
|
#if( configUSE_16_BIT_TICKS == 1 )
|
||||||
|
typedef uint16_t TickType_t;
|
||||||
|
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||||
|
#else
|
||||||
|
typedef uint32_t TickType_t;
|
||||||
|
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||||
|
#endif
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Architecture specifics. */
|
||||||
|
#define portSTACK_GROWTH ( -1 )
|
||||||
|
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||||
|
#define portBYTE_ALIGNMENT 8
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Scheduler utilities. */
|
||||||
|
extern void vPortYield( void );
|
||||||
|
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
|
||||||
|
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
|
||||||
|
#define portYIELD() vPortYield()
|
||||||
|
#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT
|
||||||
|
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Critical section management. */
|
||||||
|
extern void vPortEnterCritical( void );
|
||||||
|
extern void vPortExitCritical( void );
|
||||||
|
extern uint32_t ulPortSetInterruptMask( void );
|
||||||
|
extern void vPortClearInterruptMask( uint32_t ulNewMaskValue );
|
||||||
|
#define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetInterruptMask()
|
||||||
|
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortClearInterruptMask(x)
|
||||||
|
#define portDISABLE_INTERRUPTS() ulPortSetInterruptMask()
|
||||||
|
#define portENABLE_INTERRUPTS() vPortClearInterruptMask(0)
|
||||||
|
#define portENTER_CRITICAL() vPortEnterCritical()
|
||||||
|
#define portEXIT_CRITICAL() vPortExitCritical()
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Task function macros as described on the FreeRTOS.org WEB site. These are
|
||||||
|
not necessary for to use this port. They are defined so the common demo files
|
||||||
|
(which build with all the ports) will build. */
|
||||||
|
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
|
||||||
|
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Tickless idle/low power functionality. */
|
||||||
|
#ifndef portSUPPRESS_TICKS_AND_SLEEP
|
||||||
|
extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime );
|
||||||
|
#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime )
|
||||||
|
#endif
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Architecture specific optimisations. */
|
||||||
|
#ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
|
||||||
|
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1
|
||||||
|
|
||||||
|
/* Generic helper function. */
|
||||||
|
__attribute__( ( always_inline ) ) static inline uint8_t ucPortCountLeadingZeros( uint32_t ulBitmap )
|
||||||
|
{
|
||||||
|
uint8_t ucReturn;
|
||||||
|
|
||||||
|
__asm volatile ( "clz %0, %1" : "=r" ( ucReturn ) : "r" ( ulBitmap ) );
|
||||||
|
return ucReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check the configuration. */
|
||||||
|
#if( configMAX_PRIORITIES > 32 )
|
||||||
|
#error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 difference priorities as tasks that share a priority will time slice.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Store/clear the ready priorities in a bit map. */
|
||||||
|
#define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
|
||||||
|
#define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - ucPortCountLeadingZeros( ( uxReadyPriorities ) ) )
|
||||||
|
|
||||||
|
#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef configASSERT
|
||||||
|
void vPortValidateInterruptPriority( void );
|
||||||
|
#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() vPortValidateInterruptPriority()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* portNOP() is not required by this port. */
|
||||||
|
#define portNOP()
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* PORTMACRO_H */
|
||||||
|
|
1661
sdk/component/soc/realtek/8195a/cmsis/core_cm3.h
Normal file
1661
sdk/component/soc/realtek/8195a/cmsis/core_cm3.h
Normal file
File diff suppressed because it is too large
Load diff
636
sdk/component/soc/realtek/8195a/cmsis/core_cmFunc.h
Normal file
636
sdk/component/soc/realtek/8195a/cmsis/core_cmFunc.h
Normal file
|
@ -0,0 +1,636 @@
|
||||||
|
/**************************************************************************//**
|
||||||
|
* @file core_cmFunc.h
|
||||||
|
* @brief CMSIS Cortex-M Core Function Access Header File
|
||||||
|
* @version V3.20
|
||||||
|
* @date 25. February 2013
|
||||||
|
*
|
||||||
|
* @note
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
/* Copyright (c) 2009 - 2013 ARM LIMITED
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
- Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
- Neither the name of ARM nor the names of its contributors may be used
|
||||||
|
to endorse or promote products derived from this software without
|
||||||
|
specific prior written permission.
|
||||||
|
*
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __CORE_CMFUNC_H
|
||||||
|
#define __CORE_CMFUNC_H
|
||||||
|
|
||||||
|
|
||||||
|
/* ########################### Core Function Access ########################### */
|
||||||
|
/** \ingroup CMSIS_Core_FunctionInterface
|
||||||
|
\defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/
|
||||||
|
/* ARM armcc specific functions */
|
||||||
|
|
||||||
|
#if (__ARMCC_VERSION < 400677)
|
||||||
|
#error "Please use ARM Compiler Toolchain V4.0.677 or later!"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* intrinsic void __enable_irq(); */
|
||||||
|
/* intrinsic void __disable_irq(); */
|
||||||
|
|
||||||
|
/** \brief Get Control Register
|
||||||
|
|
||||||
|
This function returns the content of the Control Register.
|
||||||
|
|
||||||
|
\return Control Register value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_CONTROL(void)
|
||||||
|
{
|
||||||
|
register uint32_t __regControl __ASM("control");
|
||||||
|
return(__regControl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Set Control Register
|
||||||
|
|
||||||
|
This function writes the given value to the Control Register.
|
||||||
|
|
||||||
|
\param [in] control Control Register value to set
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __set_CONTROL(uint32_t control)
|
||||||
|
{
|
||||||
|
register uint32_t __regControl __ASM("control");
|
||||||
|
__regControl = control;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Get IPSR Register
|
||||||
|
|
||||||
|
This function returns the content of the IPSR Register.
|
||||||
|
|
||||||
|
\return IPSR Register value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_IPSR(void)
|
||||||
|
{
|
||||||
|
register uint32_t __regIPSR __ASM("ipsr");
|
||||||
|
return(__regIPSR);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Get APSR Register
|
||||||
|
|
||||||
|
This function returns the content of the APSR Register.
|
||||||
|
|
||||||
|
\return APSR Register value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_APSR(void)
|
||||||
|
{
|
||||||
|
register uint32_t __regAPSR __ASM("apsr");
|
||||||
|
return(__regAPSR);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Get xPSR Register
|
||||||
|
|
||||||
|
This function returns the content of the xPSR Register.
|
||||||
|
|
||||||
|
\return xPSR Register value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_xPSR(void)
|
||||||
|
{
|
||||||
|
register uint32_t __regXPSR __ASM("xpsr");
|
||||||
|
return(__regXPSR);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Get Process Stack Pointer
|
||||||
|
|
||||||
|
This function returns the current value of the Process Stack Pointer (PSP).
|
||||||
|
|
||||||
|
\return PSP Register value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_PSP(void)
|
||||||
|
{
|
||||||
|
register uint32_t __regProcessStackPointer __ASM("psp");
|
||||||
|
return(__regProcessStackPointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Set Process Stack Pointer
|
||||||
|
|
||||||
|
This function assigns the given value to the Process Stack Pointer (PSP).
|
||||||
|
|
||||||
|
\param [in] topOfProcStack Process Stack Pointer value to set
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
|
||||||
|
{
|
||||||
|
register uint32_t __regProcessStackPointer __ASM("psp");
|
||||||
|
__regProcessStackPointer = topOfProcStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Get Main Stack Pointer
|
||||||
|
|
||||||
|
This function returns the current value of the Main Stack Pointer (MSP).
|
||||||
|
|
||||||
|
\return MSP Register value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_MSP(void)
|
||||||
|
{
|
||||||
|
register uint32_t __regMainStackPointer __ASM("msp");
|
||||||
|
return(__regMainStackPointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Set Main Stack Pointer
|
||||||
|
|
||||||
|
This function assigns the given value to the Main Stack Pointer (MSP).
|
||||||
|
|
||||||
|
\param [in] topOfMainStack Main Stack Pointer value to set
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
|
||||||
|
{
|
||||||
|
register uint32_t __regMainStackPointer __ASM("msp");
|
||||||
|
__regMainStackPointer = topOfMainStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Get Priority Mask
|
||||||
|
|
||||||
|
This function returns the current state of the priority mask bit from the Priority Mask Register.
|
||||||
|
|
||||||
|
\return Priority Mask value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_PRIMASK(void)
|
||||||
|
{
|
||||||
|
register uint32_t __regPriMask __ASM("primask");
|
||||||
|
return(__regPriMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Set Priority Mask
|
||||||
|
|
||||||
|
This function assigns the given value to the Priority Mask Register.
|
||||||
|
|
||||||
|
\param [in] priMask Priority Mask
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
|
||||||
|
{
|
||||||
|
register uint32_t __regPriMask __ASM("primask");
|
||||||
|
__regPriMask = (priMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if (__CORTEX_M >= 0x03)
|
||||||
|
|
||||||
|
/** \brief Enable FIQ
|
||||||
|
|
||||||
|
This function enables FIQ interrupts by clearing the F-bit in the CPSR.
|
||||||
|
Can only be executed in Privileged modes.
|
||||||
|
*/
|
||||||
|
#define __enable_fault_irq __enable_fiq
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Disable FIQ
|
||||||
|
|
||||||
|
This function disables FIQ interrupts by setting the F-bit in the CPSR.
|
||||||
|
Can only be executed in Privileged modes.
|
||||||
|
*/
|
||||||
|
#define __disable_fault_irq __disable_fiq
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Get Base Priority
|
||||||
|
|
||||||
|
This function returns the current value of the Base Priority register.
|
||||||
|
|
||||||
|
\return Base Priority register value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_BASEPRI(void)
|
||||||
|
{
|
||||||
|
register uint32_t __regBasePri __ASM("basepri");
|
||||||
|
return(__regBasePri);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Set Base Priority
|
||||||
|
|
||||||
|
This function assigns the given value to the Base Priority register.
|
||||||
|
|
||||||
|
\param [in] basePri Base Priority value to set
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __set_BASEPRI(uint32_t basePri)
|
||||||
|
{
|
||||||
|
register uint32_t __regBasePri __ASM("basepri");
|
||||||
|
__regBasePri = (basePri & 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Get Fault Mask
|
||||||
|
|
||||||
|
This function returns the current value of the Fault Mask register.
|
||||||
|
|
||||||
|
\return Fault Mask register value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_FAULTMASK(void)
|
||||||
|
{
|
||||||
|
register uint32_t __regFaultMask __ASM("faultmask");
|
||||||
|
return(__regFaultMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Set Fault Mask
|
||||||
|
|
||||||
|
This function assigns the given value to the Fault Mask register.
|
||||||
|
|
||||||
|
\param [in] faultMask Fault Mask value to set
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
|
||||||
|
{
|
||||||
|
register uint32_t __regFaultMask __ASM("faultmask");
|
||||||
|
__regFaultMask = (faultMask & (uint32_t)1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* (__CORTEX_M >= 0x03) */
|
||||||
|
|
||||||
|
|
||||||
|
#if (__CORTEX_M == 0x04)
|
||||||
|
|
||||||
|
/** \brief Get FPSCR
|
||||||
|
|
||||||
|
This function returns the current value of the Floating Point Status/Control register.
|
||||||
|
|
||||||
|
\return Floating Point Status/Control register value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_FPSCR(void)
|
||||||
|
{
|
||||||
|
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
|
||||||
|
register uint32_t __regfpscr __ASM("fpscr");
|
||||||
|
return(__regfpscr);
|
||||||
|
#else
|
||||||
|
return(0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Set FPSCR
|
||||||
|
|
||||||
|
This function assigns the given value to the Floating Point Status/Control register.
|
||||||
|
|
||||||
|
\param [in] fpscr Floating Point Status/Control value to set
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
|
||||||
|
{
|
||||||
|
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
|
||||||
|
register uint32_t __regfpscr __ASM("fpscr");
|
||||||
|
__regfpscr = (fpscr);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* (__CORTEX_M == 0x04) */
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/
|
||||||
|
/* IAR iccarm specific functions */
|
||||||
|
|
||||||
|
#include <cmsis_iar.h>
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/
|
||||||
|
/* TI CCS specific functions */
|
||||||
|
|
||||||
|
#include <cmsis_ccs.h>
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/
|
||||||
|
/* GNU gcc specific functions */
|
||||||
|
|
||||||
|
/** \brief Enable IRQ Interrupts
|
||||||
|
|
||||||
|
This function enables IRQ interrupts by clearing the I-bit in the CPSR.
|
||||||
|
Can only be executed in Privileged modes.
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_irq(void)
|
||||||
|
{
|
||||||
|
__ASM volatile ("cpsie i" : : : "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Disable IRQ Interrupts
|
||||||
|
|
||||||
|
This function disables IRQ interrupts by setting the I-bit in the CPSR.
|
||||||
|
Can only be executed in Privileged modes.
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_irq(void)
|
||||||
|
{
|
||||||
|
__ASM volatile ("cpsid i" : : : "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Get Control Register
|
||||||
|
|
||||||
|
This function returns the content of the Control Register.
|
||||||
|
|
||||||
|
\return Control Register value
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_CONTROL(void)
|
||||||
|
{
|
||||||
|
uint32_t result;
|
||||||
|
|
||||||
|
__ASM volatile ("MRS %0, control" : "=r" (result) );
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Set Control Register
|
||||||
|
|
||||||
|
This function writes the given value to the Control Register.
|
||||||
|
|
||||||
|
\param [in] control Control Register value to set
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_CONTROL(uint32_t control)
|
||||||
|
{
|
||||||
|
__ASM volatile ("MSR control, %0" : : "r" (control) : "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Get IPSR Register
|
||||||
|
|
||||||
|
This function returns the content of the IPSR Register.
|
||||||
|
|
||||||
|
\return IPSR Register value
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_IPSR(void)
|
||||||
|
{
|
||||||
|
uint32_t result;
|
||||||
|
|
||||||
|
__ASM volatile ("MRS %0, ipsr" : "=r" (result) );
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Get APSR Register
|
||||||
|
|
||||||
|
This function returns the content of the APSR Register.
|
||||||
|
|
||||||
|
\return APSR Register value
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_APSR(void)
|
||||||
|
{
|
||||||
|
uint32_t result;
|
||||||
|
|
||||||
|
__ASM volatile ("MRS %0, apsr" : "=r" (result) );
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Get xPSR Register
|
||||||
|
|
||||||
|
This function returns the content of the xPSR Register.
|
||||||
|
|
||||||
|
\return xPSR Register value
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_xPSR(void)
|
||||||
|
{
|
||||||
|
uint32_t result;
|
||||||
|
|
||||||
|
__ASM volatile ("MRS %0, xpsr" : "=r" (result) );
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Get Process Stack Pointer
|
||||||
|
|
||||||
|
This function returns the current value of the Process Stack Pointer (PSP).
|
||||||
|
|
||||||
|
\return PSP Register value
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PSP(void)
|
||||||
|
{
|
||||||
|
register uint32_t result;
|
||||||
|
|
||||||
|
__ASM volatile ("MRS %0, psp\n" : "=r" (result) );
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Set Process Stack Pointer
|
||||||
|
|
||||||
|
This function assigns the given value to the Process Stack Pointer (PSP).
|
||||||
|
|
||||||
|
\param [in] topOfProcStack Process Stack Pointer value to set
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
|
||||||
|
{
|
||||||
|
__ASM volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) : "sp");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Get Main Stack Pointer
|
||||||
|
|
||||||
|
This function returns the current value of the Main Stack Pointer (MSP).
|
||||||
|
|
||||||
|
\return MSP Register value
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_MSP(void)
|
||||||
|
{
|
||||||
|
register uint32_t result;
|
||||||
|
|
||||||
|
__ASM volatile ("MRS %0, msp\n" : "=r" (result) );
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Set Main Stack Pointer
|
||||||
|
|
||||||
|
This function assigns the given value to the Main Stack Pointer (MSP).
|
||||||
|
|
||||||
|
\param [in] topOfMainStack Main Stack Pointer value to set
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
|
||||||
|
{
|
||||||
|
__ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Get Priority Mask
|
||||||
|
|
||||||
|
This function returns the current state of the priority mask bit from the Priority Mask Register.
|
||||||
|
|
||||||
|
\return Priority Mask value
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PRIMASK(void)
|
||||||
|
{
|
||||||
|
uint32_t result;
|
||||||
|
|
||||||
|
__ASM volatile ("MRS %0, primask" : "=r" (result) );
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Set Priority Mask
|
||||||
|
|
||||||
|
This function assigns the given value to the Priority Mask Register.
|
||||||
|
|
||||||
|
\param [in] priMask Priority Mask
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
|
||||||
|
{
|
||||||
|
__ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if (__CORTEX_M >= 0x03)
|
||||||
|
|
||||||
|
/** \brief Enable FIQ
|
||||||
|
|
||||||
|
This function enables FIQ interrupts by clearing the F-bit in the CPSR.
|
||||||
|
Can only be executed in Privileged modes.
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_fault_irq(void)
|
||||||
|
{
|
||||||
|
__ASM volatile ("cpsie f" : : : "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Disable FIQ
|
||||||
|
|
||||||
|
This function disables FIQ interrupts by setting the F-bit in the CPSR.
|
||||||
|
Can only be executed in Privileged modes.
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_fault_irq(void)
|
||||||
|
{
|
||||||
|
__ASM volatile ("cpsid f" : : : "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Get Base Priority
|
||||||
|
|
||||||
|
This function returns the current value of the Base Priority register.
|
||||||
|
|
||||||
|
\return Base Priority register value
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_BASEPRI(void)
|
||||||
|
{
|
||||||
|
uint32_t result;
|
||||||
|
|
||||||
|
__ASM volatile ("MRS %0, basepri_max" : "=r" (result) );
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Set Base Priority
|
||||||
|
|
||||||
|
This function assigns the given value to the Base Priority register.
|
||||||
|
|
||||||
|
\param [in] basePri Base Priority value to set
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_BASEPRI(uint32_t value)
|
||||||
|
{
|
||||||
|
__ASM volatile ("MSR basepri, %0" : : "r" (value) : "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Get Fault Mask
|
||||||
|
|
||||||
|
This function returns the current value of the Fault Mask register.
|
||||||
|
|
||||||
|
\return Fault Mask register value
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FAULTMASK(void)
|
||||||
|
{
|
||||||
|
uint32_t result;
|
||||||
|
|
||||||
|
__ASM volatile ("MRS %0, faultmask" : "=r" (result) );
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Set Fault Mask
|
||||||
|
|
||||||
|
This function assigns the given value to the Fault Mask register.
|
||||||
|
|
||||||
|
\param [in] faultMask Fault Mask value to set
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
|
||||||
|
{
|
||||||
|
__ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* (__CORTEX_M >= 0x03) */
|
||||||
|
|
||||||
|
|
||||||
|
#if (__CORTEX_M == 0x04)
|
||||||
|
|
||||||
|
/** \brief Get FPSCR
|
||||||
|
|
||||||
|
This function returns the current value of the Floating Point Status/Control register.
|
||||||
|
|
||||||
|
\return Floating Point Status/Control register value
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FPSCR(void)
|
||||||
|
{
|
||||||
|
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
|
||||||
|
uint32_t result;
|
||||||
|
|
||||||
|
/* Empty asm statement works as a scheduling barrier */
|
||||||
|
__ASM volatile ("");
|
||||||
|
__ASM volatile ("VMRS %0, fpscr" : "=r" (result) );
|
||||||
|
__ASM volatile ("");
|
||||||
|
return(result);
|
||||||
|
#else
|
||||||
|
return(0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Set FPSCR
|
||||||
|
|
||||||
|
This function assigns the given value to the Floating Point Status/Control register.
|
||||||
|
|
||||||
|
\param [in] fpscr Floating Point Status/Control value to set
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
|
||||||
|
{
|
||||||
|
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
|
||||||
|
/* Empty asm statement works as a scheduling barrier */
|
||||||
|
__ASM volatile ("");
|
||||||
|
__ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc");
|
||||||
|
__ASM volatile ("");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* (__CORTEX_M == 0x04) */
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/
|
||||||
|
/* TASKING carm specific functions */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The CMSIS functions have been implemented as intrinsics in the compiler.
|
||||||
|
* Please use "carm -?i" to get an up to date list of all instrinsics,
|
||||||
|
* Including the CMSIS ones.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*@} end of CMSIS_Core_RegAccFunctions */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __CORE_CMFUNC_H */
|
688
sdk/component/soc/realtek/8195a/cmsis/core_cmInstr.h
Normal file
688
sdk/component/soc/realtek/8195a/cmsis/core_cmInstr.h
Normal file
|
@ -0,0 +1,688 @@
|
||||||
|
/**************************************************************************//**
|
||||||
|
* @file core_cmInstr.h
|
||||||
|
* @brief CMSIS Cortex-M Core Instruction Access Header File
|
||||||
|
* @version V3.20
|
||||||
|
* @date 05. March 2013
|
||||||
|
*
|
||||||
|
* @note
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
/* Copyright (c) 2009 - 2013 ARM LIMITED
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
- Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
- Neither the name of ARM nor the names of its contributors may be used
|
||||||
|
to endorse or promote products derived from this software without
|
||||||
|
specific prior written permission.
|
||||||
|
*
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __CORE_CMINSTR_H
|
||||||
|
#define __CORE_CMINSTR_H
|
||||||
|
|
||||||
|
|
||||||
|
/* ########################## Core Instruction Access ######################### */
|
||||||
|
/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
|
||||||
|
Access to dedicated instructions
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/
|
||||||
|
/* ARM armcc specific functions */
|
||||||
|
|
||||||
|
#if (__ARMCC_VERSION < 400677)
|
||||||
|
#error "Please use ARM Compiler Toolchain V4.0.677 or later!"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief No Operation
|
||||||
|
|
||||||
|
No Operation does nothing. This instruction can be used for code alignment purposes.
|
||||||
|
*/
|
||||||
|
#define __NOP __nop
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Wait For Interrupt
|
||||||
|
|
||||||
|
Wait For Interrupt is a hint instruction that suspends execution
|
||||||
|
until one of a number of events occurs.
|
||||||
|
*/
|
||||||
|
#define __WFI __wfi
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Wait For Event
|
||||||
|
|
||||||
|
Wait For Event is a hint instruction that permits the processor to enter
|
||||||
|
a low-power state until one of a number of events occurs.
|
||||||
|
*/
|
||||||
|
#define __WFE __wfe
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Send Event
|
||||||
|
|
||||||
|
Send Event is a hint instruction. It causes an event to be signaled to the CPU.
|
||||||
|
*/
|
||||||
|
#define __SEV __sev
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Instruction Synchronization Barrier
|
||||||
|
|
||||||
|
Instruction Synchronization Barrier flushes the pipeline in the processor,
|
||||||
|
so that all instructions following the ISB are fetched from cache or
|
||||||
|
memory, after the instruction has been completed.
|
||||||
|
*/
|
||||||
|
#define __ISB() __isb(0xF)
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Data Synchronization Barrier
|
||||||
|
|
||||||
|
This function acts as a special kind of Data Memory Barrier.
|
||||||
|
It completes when all explicit memory accesses before this instruction complete.
|
||||||
|
*/
|
||||||
|
#define __DSB() __dsb(0xF)
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Data Memory Barrier
|
||||||
|
|
||||||
|
This function ensures the apparent order of the explicit memory operations before
|
||||||
|
and after the instruction, without ensuring their completion.
|
||||||
|
*/
|
||||||
|
#define __DMB() __dmb(0xF)
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Reverse byte order (32 bit)
|
||||||
|
|
||||||
|
This function reverses the byte order in integer value.
|
||||||
|
|
||||||
|
\param [in] value Value to reverse
|
||||||
|
\return Reversed value
|
||||||
|
*/
|
||||||
|
#define __REV __rev
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Reverse byte order (16 bit)
|
||||||
|
|
||||||
|
This function reverses the byte order in two unsigned short values.
|
||||||
|
|
||||||
|
\param [in] value Value to reverse
|
||||||
|
\return Reversed value
|
||||||
|
*/
|
||||||
|
#ifndef __NO_EMBEDDED_ASM
|
||||||
|
__attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value)
|
||||||
|
{
|
||||||
|
rev16 r0, r0
|
||||||
|
bx lr
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** \brief Reverse byte order in signed short value
|
||||||
|
|
||||||
|
This function reverses the byte order in a signed short value with sign extension to integer.
|
||||||
|
|
||||||
|
\param [in] value Value to reverse
|
||||||
|
\return Reversed value
|
||||||
|
*/
|
||||||
|
#ifndef __NO_EMBEDDED_ASM
|
||||||
|
__attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int32_t __REVSH(int32_t value)
|
||||||
|
{
|
||||||
|
revsh r0, r0
|
||||||
|
bx lr
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Rotate Right in unsigned value (32 bit)
|
||||||
|
|
||||||
|
This function Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
|
||||||
|
|
||||||
|
\param [in] value Value to rotate
|
||||||
|
\param [in] value Number of Bits to rotate
|
||||||
|
\return Rotated value
|
||||||
|
*/
|
||||||
|
#define __ROR __ror
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Breakpoint
|
||||||
|
|
||||||
|
This function causes the processor to enter Debug state.
|
||||||
|
Debug tools can use this to investigate system state when the instruction at a particular address is reached.
|
||||||
|
|
||||||
|
\param [in] value is ignored by the processor.
|
||||||
|
If required, a debugger can use it to store additional information about the breakpoint.
|
||||||
|
*/
|
||||||
|
#define __BKPT(value) __breakpoint(value)
|
||||||
|
|
||||||
|
|
||||||
|
#if (__CORTEX_M >= 0x03)
|
||||||
|
|
||||||
|
/** \brief Reverse bit order of value
|
||||||
|
|
||||||
|
This function reverses the bit order of the given value.
|
||||||
|
|
||||||
|
\param [in] value Value to reverse
|
||||||
|
\return Reversed value
|
||||||
|
*/
|
||||||
|
#define __RBIT __rbit
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief LDR Exclusive (8 bit)
|
||||||
|
|
||||||
|
This function performs a exclusive LDR command for 8 bit value.
|
||||||
|
|
||||||
|
\param [in] ptr Pointer to data
|
||||||
|
\return value of type uint8_t at (*ptr)
|
||||||
|
*/
|
||||||
|
#define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr))
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief LDR Exclusive (16 bit)
|
||||||
|
|
||||||
|
This function performs a exclusive LDR command for 16 bit values.
|
||||||
|
|
||||||
|
\param [in] ptr Pointer to data
|
||||||
|
\return value of type uint16_t at (*ptr)
|
||||||
|
*/
|
||||||
|
#define __LDREXH(ptr) ((uint16_t) __ldrex(ptr))
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief LDR Exclusive (32 bit)
|
||||||
|
|
||||||
|
This function performs a exclusive LDR command for 32 bit values.
|
||||||
|
|
||||||
|
\param [in] ptr Pointer to data
|
||||||
|
\return value of type uint32_t at (*ptr)
|
||||||
|
*/
|
||||||
|
#define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr))
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief STR Exclusive (8 bit)
|
||||||
|
|
||||||
|
This function performs a exclusive STR command for 8 bit values.
|
||||||
|
|
||||||
|
\param [in] value Value to store
|
||||||
|
\param [in] ptr Pointer to location
|
||||||
|
\return 0 Function succeeded
|
||||||
|
\return 1 Function failed
|
||||||
|
*/
|
||||||
|
#define __STREXB(value, ptr) __strex(value, ptr)
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief STR Exclusive (16 bit)
|
||||||
|
|
||||||
|
This function performs a exclusive STR command for 16 bit values.
|
||||||
|
|
||||||
|
\param [in] value Value to store
|
||||||
|
\param [in] ptr Pointer to location
|
||||||
|
\return 0 Function succeeded
|
||||||
|
\return 1 Function failed
|
||||||
|
*/
|
||||||
|
#define __STREXH(value, ptr) __strex(value, ptr)
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief STR Exclusive (32 bit)
|
||||||
|
|
||||||
|
This function performs a exclusive STR command for 32 bit values.
|
||||||
|
|
||||||
|
\param [in] value Value to store
|
||||||
|
\param [in] ptr Pointer to location
|
||||||
|
\return 0 Function succeeded
|
||||||
|
\return 1 Function failed
|
||||||
|
*/
|
||||||
|
#define __STREXW(value, ptr) __strex(value, ptr)
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Remove the exclusive lock
|
||||||
|
|
||||||
|
This function removes the exclusive lock which is created by LDREX.
|
||||||
|
|
||||||
|
*/
|
||||||
|
#define __CLREX __clrex
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Signed Saturate
|
||||||
|
|
||||||
|
This function saturates a signed value.
|
||||||
|
|
||||||
|
\param [in] value Value to be saturated
|
||||||
|
\param [in] sat Bit position to saturate to (1..32)
|
||||||
|
\return Saturated value
|
||||||
|
*/
|
||||||
|
#define __SSAT __ssat
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Unsigned Saturate
|
||||||
|
|
||||||
|
This function saturates an unsigned value.
|
||||||
|
|
||||||
|
\param [in] value Value to be saturated
|
||||||
|
\param [in] sat Bit position to saturate to (0..31)
|
||||||
|
\return Saturated value
|
||||||
|
*/
|
||||||
|
#define __USAT __usat
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Count leading zeros
|
||||||
|
|
||||||
|
This function counts the number of leading zeros of a data value.
|
||||||
|
|
||||||
|
\param [in] value Value to count the leading zeros
|
||||||
|
\return number of leading zeros in value
|
||||||
|
*/
|
||||||
|
#define __CLZ __clz
|
||||||
|
|
||||||
|
#endif /* (__CORTEX_M >= 0x03) */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/
|
||||||
|
/* IAR iccarm specific functions */
|
||||||
|
|
||||||
|
#include <cmsis_iar.h>
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/
|
||||||
|
/* TI CCS specific functions */
|
||||||
|
|
||||||
|
#include <cmsis_ccs.h>
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/
|
||||||
|
/* GNU gcc specific functions */
|
||||||
|
|
||||||
|
/* Define macros for porting to both thumb1 and thumb2.
|
||||||
|
* For thumb1, use low register (r0-r7), specified by constrant "l"
|
||||||
|
* Otherwise, use general registers, specified by constrant "r" */
|
||||||
|
#if defined (__thumb__) && !defined (__thumb2__)
|
||||||
|
#define __CMSIS_GCC_OUT_REG(r) "=l" (r)
|
||||||
|
#define __CMSIS_GCC_USE_REG(r) "l" (r)
|
||||||
|
#else
|
||||||
|
#define __CMSIS_GCC_OUT_REG(r) "=r" (r)
|
||||||
|
#define __CMSIS_GCC_USE_REG(r) "r" (r)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** \brief No Operation
|
||||||
|
|
||||||
|
No Operation does nothing. This instruction can be used for code alignment purposes.
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE void __NOP(void)
|
||||||
|
{
|
||||||
|
__ASM volatile ("nop");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Wait For Interrupt
|
||||||
|
|
||||||
|
Wait For Interrupt is a hint instruction that suspends execution
|
||||||
|
until one of a number of events occurs.
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE void __WFI(void)
|
||||||
|
{
|
||||||
|
__ASM volatile ("wfi");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Wait For Event
|
||||||
|
|
||||||
|
Wait For Event is a hint instruction that permits the processor to enter
|
||||||
|
a low-power state until one of a number of events occurs.
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE void __WFE(void)
|
||||||
|
{
|
||||||
|
__ASM volatile ("wfe");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Send Event
|
||||||
|
|
||||||
|
Send Event is a hint instruction. It causes an event to be signaled to the CPU.
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE void __SEV(void)
|
||||||
|
{
|
||||||
|
__ASM volatile ("sev");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Instruction Synchronization Barrier
|
||||||
|
|
||||||
|
Instruction Synchronization Barrier flushes the pipeline in the processor,
|
||||||
|
so that all instructions following the ISB are fetched from cache or
|
||||||
|
memory, after the instruction has been completed.
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE void __ISB(void)
|
||||||
|
{
|
||||||
|
__ASM volatile ("isb");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Data Synchronization Barrier
|
||||||
|
|
||||||
|
This function acts as a special kind of Data Memory Barrier.
|
||||||
|
It completes when all explicit memory accesses before this instruction complete.
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE void __DSB(void)
|
||||||
|
{
|
||||||
|
__ASM volatile ("dsb");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Data Memory Barrier
|
||||||
|
|
||||||
|
This function ensures the apparent order of the explicit memory operations before
|
||||||
|
and after the instruction, without ensuring their completion.
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE void __DMB(void)
|
||||||
|
{
|
||||||
|
__ASM volatile ("dmb");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Reverse byte order (32 bit)
|
||||||
|
|
||||||
|
This function reverses the byte order in integer value.
|
||||||
|
|
||||||
|
\param [in] value Value to reverse
|
||||||
|
\return Reversed value
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __REV(uint32_t value)
|
||||||
|
{
|
||||||
|
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
|
||||||
|
return __builtin_bswap32(value);
|
||||||
|
#else
|
||||||
|
uint32_t result;
|
||||||
|
|
||||||
|
__ASM volatile ("rev %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
|
||||||
|
return(result);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Reverse byte order (16 bit)
|
||||||
|
|
||||||
|
This function reverses the byte order in two unsigned short values.
|
||||||
|
|
||||||
|
\param [in] value Value to reverse
|
||||||
|
\return Reversed value
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __REV16(uint32_t value)
|
||||||
|
{
|
||||||
|
uint32_t result;
|
||||||
|
|
||||||
|
__ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Reverse byte order in signed short value
|
||||||
|
|
||||||
|
This function reverses the byte order in a signed short value with sign extension to integer.
|
||||||
|
|
||||||
|
\param [in] value Value to reverse
|
||||||
|
\return Reversed value
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE int32_t __REVSH(int32_t value)
|
||||||
|
{
|
||||||
|
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
|
||||||
|
return (short)__builtin_bswap16(value);
|
||||||
|
#else
|
||||||
|
uint32_t result;
|
||||||
|
|
||||||
|
__ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
|
||||||
|
return(result);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Rotate Right in unsigned value (32 bit)
|
||||||
|
|
||||||
|
This function Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
|
||||||
|
|
||||||
|
\param [in] value Value to rotate
|
||||||
|
\param [in] value Number of Bits to rotate
|
||||||
|
\return Rotated value
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
|
||||||
|
{
|
||||||
|
return (op1 >> op2) | (op1 << (32 - op2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Breakpoint
|
||||||
|
|
||||||
|
This function causes the processor to enter Debug state.
|
||||||
|
Debug tools can use this to investigate system state when the instruction at a particular address is reached.
|
||||||
|
|
||||||
|
\param [in] value is ignored by the processor.
|
||||||
|
If required, a debugger can use it to store additional information about the breakpoint.
|
||||||
|
*/
|
||||||
|
#define __BKPT(value) __ASM volatile ("bkpt "#value)
|
||||||
|
|
||||||
|
|
||||||
|
#if (__CORTEX_M >= 0x03)
|
||||||
|
|
||||||
|
/** \brief Reverse bit order of value
|
||||||
|
|
||||||
|
This function reverses the bit order of the given value.
|
||||||
|
|
||||||
|
\param [in] value Value to reverse
|
||||||
|
\return Reversed value
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
|
||||||
|
{
|
||||||
|
uint32_t result;
|
||||||
|
|
||||||
|
__ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) );
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief LDR Exclusive (8 bit)
|
||||||
|
|
||||||
|
This function performs a exclusive LDR command for 8 bit value.
|
||||||
|
|
||||||
|
\param [in] ptr Pointer to data
|
||||||
|
\return value of type uint8_t at (*ptr)
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint8_t __LDREXB(volatile uint8_t *addr)
|
||||||
|
{
|
||||||
|
uint32_t result;
|
||||||
|
|
||||||
|
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
|
||||||
|
__ASM volatile ("ldrexb %0, %1" : "=r" (result) : "Q" (*addr) );
|
||||||
|
#else
|
||||||
|
/* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
|
||||||
|
accepted by assembler. So has to use following less efficient pattern.
|
||||||
|
*/
|
||||||
|
__ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
|
||||||
|
#endif
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief LDR Exclusive (16 bit)
|
||||||
|
|
||||||
|
This function performs a exclusive LDR command for 16 bit values.
|
||||||
|
|
||||||
|
\param [in] ptr Pointer to data
|
||||||
|
\return value of type uint16_t at (*ptr)
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint16_t __LDREXH(volatile uint16_t *addr)
|
||||||
|
{
|
||||||
|
uint32_t result;
|
||||||
|
|
||||||
|
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
|
||||||
|
__ASM volatile ("ldrexh %0, %1" : "=r" (result) : "Q" (*addr) );
|
||||||
|
#else
|
||||||
|
/* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
|
||||||
|
accepted by assembler. So has to use following less efficient pattern.
|
||||||
|
*/
|
||||||
|
__ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
|
||||||
|
#endif
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief LDR Exclusive (32 bit)
|
||||||
|
|
||||||
|
This function performs a exclusive LDR command for 32 bit values.
|
||||||
|
|
||||||
|
\param [in] ptr Pointer to data
|
||||||
|
\return value of type uint32_t at (*ptr)
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __LDREXW(volatile uint32_t *addr)
|
||||||
|
{
|
||||||
|
uint32_t result;
|
||||||
|
|
||||||
|
__ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) );
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief STR Exclusive (8 bit)
|
||||||
|
|
||||||
|
This function performs a exclusive STR command for 8 bit values.
|
||||||
|
|
||||||
|
\param [in] value Value to store
|
||||||
|
\param [in] ptr Pointer to location
|
||||||
|
\return 0 Function succeeded
|
||||||
|
\return 1 Function failed
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr)
|
||||||
|
{
|
||||||
|
uint32_t result;
|
||||||
|
|
||||||
|
__ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) );
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief STR Exclusive (16 bit)
|
||||||
|
|
||||||
|
This function performs a exclusive STR command for 16 bit values.
|
||||||
|
|
||||||
|
\param [in] value Value to store
|
||||||
|
\param [in] ptr Pointer to location
|
||||||
|
\return 0 Function succeeded
|
||||||
|
\return 1 Function failed
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr)
|
||||||
|
{
|
||||||
|
uint32_t result;
|
||||||
|
|
||||||
|
__ASM volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) );
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief STR Exclusive (32 bit)
|
||||||
|
|
||||||
|
This function performs a exclusive STR command for 32 bit values.
|
||||||
|
|
||||||
|
\param [in] value Value to store
|
||||||
|
\param [in] ptr Pointer to location
|
||||||
|
\return 0 Function succeeded
|
||||||
|
\return 1 Function failed
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr)
|
||||||
|
{
|
||||||
|
uint32_t result;
|
||||||
|
|
||||||
|
__ASM volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) );
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Remove the exclusive lock
|
||||||
|
|
||||||
|
This function removes the exclusive lock which is created by LDREX.
|
||||||
|
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE void __CLREX(void)
|
||||||
|
{
|
||||||
|
__ASM volatile ("clrex" ::: "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Signed Saturate
|
||||||
|
|
||||||
|
This function saturates a signed value.
|
||||||
|
|
||||||
|
\param [in] value Value to be saturated
|
||||||
|
\param [in] sat Bit position to saturate to (1..32)
|
||||||
|
\return Saturated value
|
||||||
|
*/
|
||||||
|
#define __SSAT(ARG1,ARG2) \
|
||||||
|
({ \
|
||||||
|
uint32_t __RES, __ARG1 = (ARG1); \
|
||||||
|
__ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
|
||||||
|
__RES; \
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Unsigned Saturate
|
||||||
|
|
||||||
|
This function saturates an unsigned value.
|
||||||
|
|
||||||
|
\param [in] value Value to be saturated
|
||||||
|
\param [in] sat Bit position to saturate to (0..31)
|
||||||
|
\return Saturated value
|
||||||
|
*/
|
||||||
|
#define __USAT(ARG1,ARG2) \
|
||||||
|
({ \
|
||||||
|
uint32_t __RES, __ARG1 = (ARG1); \
|
||||||
|
__ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
|
||||||
|
__RES; \
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Count leading zeros
|
||||||
|
|
||||||
|
This function counts the number of leading zeros of a data value.
|
||||||
|
|
||||||
|
\param [in] value Value to count the leading zeros
|
||||||
|
\return number of leading zeros in value
|
||||||
|
*/
|
||||||
|
__attribute__( ( always_inline ) ) __STATIC_INLINE uint8_t __CLZ(uint32_t value)
|
||||||
|
{
|
||||||
|
uint32_t result;
|
||||||
|
|
||||||
|
__ASM volatile ("clz %0, %1" : "=r" (result) : "r" (value) );
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* (__CORTEX_M >= 0x03) */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/
|
||||||
|
/* TASKING carm specific functions */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The CMSIS functions have been implemented as intrinsics in the compiler.
|
||||||
|
* Please use "carm -?i" to get an up to date list of all intrinsics,
|
||||||
|
* Including the CMSIS ones.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*@}*/ /* end of group CMSIS_Core_InstructionInterface */
|
||||||
|
|
||||||
|
#endif /* __CORE_CMINSTR_H */
|
843
sdk/component/soc/realtek/8195a/cmsis/device/diag.h
Normal file
843
sdk/component/soc/realtek/8195a/cmsis/device/diag.h
Normal file
|
@ -0,0 +1,843 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _DIAG_H_
|
||||||
|
#define _DIAG_H_
|
||||||
|
|
||||||
|
#include "platform_autoconf.h"
|
||||||
|
#include "basic_types.h"
|
||||||
|
|
||||||
|
#include <stddef.h> /* for size_t */
|
||||||
|
|
||||||
|
extern u32 ConfigDebugErr;
|
||||||
|
extern u32 ConfigDebugInfo;
|
||||||
|
extern u32 ConfigDebugWarn;
|
||||||
|
|
||||||
|
extern u32 CfgSysDebugErr;
|
||||||
|
extern u32 CfgSysDebugInfo;
|
||||||
|
extern u32 CfgSysDebugWarn;
|
||||||
|
|
||||||
|
#define DBG_ERR_MSG_ON(x) (ConfigDebugErr |= (x))
|
||||||
|
#define DBG_WARN_MSG_ON(x) (ConfigDebugWarn |= (x))
|
||||||
|
#define DBG_INFO_MSG_ON(x) (ConfigDebugInfo |= (x))
|
||||||
|
|
||||||
|
#define DBG_ERR_MSG_OFF(x) (ConfigDebugErr &= ~(x))
|
||||||
|
#define DBG_WARN_MSG_OFF(x) (ConfigDebugWarn &= ~(x))
|
||||||
|
#define DBG_INFO_MSG_OFF(x) (ConfigDebugInfo &= ~(x))
|
||||||
|
|
||||||
|
// Define debug group
|
||||||
|
#define _DBG_BOOT_ 0x00000001
|
||||||
|
#define _DBG_GDMA_ 0x00000002
|
||||||
|
#define _DBG_GPIO_ 0x00000004
|
||||||
|
#define _DBG_TIMER_ 0x00000008
|
||||||
|
#define _DBG_I2C_ 0x00000010
|
||||||
|
#define _DBG_I2S_ 0x00000020
|
||||||
|
#define _DBG_MII_ 0x00000040
|
||||||
|
#define _DBG_NFC_ 0x00000080
|
||||||
|
#define _DBG_PCM_ 0x00000100
|
||||||
|
#define _DBG_PWM_ 0x00000200
|
||||||
|
#define _DBG_SDIO_ 0x00000400
|
||||||
|
#define _DBG_SSI_ 0x00000800
|
||||||
|
#define _DBG_SPI_FLASH_ 0x00001000
|
||||||
|
#define _DBG_SDR_ 0x00002000
|
||||||
|
#define _DBG_UART_ 0x00004000
|
||||||
|
#define _DBG_USB_OTG_ 0x00008000
|
||||||
|
#define _DBG_USB_CORE_ 0x00010000
|
||||||
|
#define _DBG_CRYPTO_ 0x00020000
|
||||||
|
#define _DBG_ADC_ 0x00040000
|
||||||
|
#define _DBG_DAC_ 0x00080000
|
||||||
|
|
||||||
|
#define _DBG_MISC_ 0x40000000
|
||||||
|
#define _DBG_FAULT_ 0x80000000
|
||||||
|
|
||||||
|
typedef enum _SYSTEM_DBG_DEFINE_ {
|
||||||
|
_SYSDBG_MISC_ = 1<<0,
|
||||||
|
_SYSDBG_MAILBOX_ = 1<<1,
|
||||||
|
_SYSDBG_TIMER_ = 1<<2
|
||||||
|
|
||||||
|
} SYSTEM_DBG;
|
||||||
|
|
||||||
|
extern
|
||||||
|
_LONG_CALL_ROM_ u32
|
||||||
|
DiagPrintf(
|
||||||
|
IN const char *fmt, ...
|
||||||
|
);
|
||||||
|
|
||||||
|
u32
|
||||||
|
DiagSPrintf(
|
||||||
|
IN u8 *buf,
|
||||||
|
IN const char *fmt, ...
|
||||||
|
);
|
||||||
|
|
||||||
|
int
|
||||||
|
prvDiagPrintf(
|
||||||
|
IN const char *fmt, ...
|
||||||
|
);
|
||||||
|
|
||||||
|
int
|
||||||
|
prvDiagSPrintf(
|
||||||
|
IN char *buf,
|
||||||
|
IN const char *fmt, ...
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
#define _DbgDump DiagPrintf
|
||||||
|
|
||||||
|
#define DRIVER_PREFIX "RTL8195A[Driver]: "
|
||||||
|
#define HAL_PREFIX "RTL8195A[HAL]: "
|
||||||
|
#define DMA_PREFIX "RTL8195A[DMA]: "
|
||||||
|
#define SDIO_PREFIX "RTL8195A[SDIO]"
|
||||||
|
#define MBOX_PREFIX "[OS-MBOX]"
|
||||||
|
#define TIMER_PREFIX "[OS-TMR]"
|
||||||
|
|
||||||
|
#define BOOT_ERR_PREFIX "[BOOT Err]"
|
||||||
|
#define BOOT_WARN_PREFIX "[BOOT Wrn]"
|
||||||
|
#define BOOT_INFO_PREFIX "[BOOT Inf]"
|
||||||
|
|
||||||
|
#define GDMA_ERR_PREFIX "[GDMA Err]"
|
||||||
|
#define GDMA_WARN_PREFIX "[GDMA Wrn]"
|
||||||
|
#define GDMA_INFO_PREFIX "[GDMA Inf]"
|
||||||
|
|
||||||
|
#define GPIO_ERR_PREFIX "[GPIO Err]"
|
||||||
|
#define GPIO_WARN_PREFIX "[GPIO Wrn]"
|
||||||
|
#define GPIO_INFO_PREFIX "[GPIO Inf]"
|
||||||
|
|
||||||
|
#define TIMER_ERR_PREFIX "[TIMR Err]"
|
||||||
|
#define TIMER_WARN_PREFIX "[TIMR Wrn]"
|
||||||
|
#define TIMER_INFO_PREFIX "[TIMR Inf]"
|
||||||
|
|
||||||
|
#define I2C_ERR_PREFIX "[I2C Err]"
|
||||||
|
#define I2C_WARN_PREFIX "[I2C Wrn]"
|
||||||
|
#define I2C_INFO_PREFIX "[I2C Inf]"
|
||||||
|
|
||||||
|
#define I2S_ERR_PREFIX "[I2S Err]"
|
||||||
|
#define I2S_WARN_PREFIX "[I2S Wrn]"
|
||||||
|
#define I2S_INFO_PREFIX "[I2S Inf]"
|
||||||
|
|
||||||
|
#define MII_ERR_PREFIX "[MII Err]"
|
||||||
|
#define MII_WARN_PREFIX "[MII Wrn]"
|
||||||
|
#define MII_INFO_PREFIX "[MII Inf]"
|
||||||
|
|
||||||
|
#define NFC_ERR_PREFIX "[NFC Err]"
|
||||||
|
#define NFC_WARN_PREFIX "[NFC Wrn]"
|
||||||
|
#define NFC_INFO_PREFIX "[NFC Inf]"
|
||||||
|
|
||||||
|
#define PCM_ERR_PREFIX "[PCM Err]"
|
||||||
|
#define PCM_WARN_PREFIX "[PCM Wrn]"
|
||||||
|
#define PCM_INFO_PREFIX "[PCM Inf]"
|
||||||
|
|
||||||
|
#define PWM_ERR_PREFIX "[PWM Err]"
|
||||||
|
#define PWM_WARN_PREFIX "[PWM Wrn]"
|
||||||
|
#define PWM_INFO_PREFIX "[PWM Inf]"
|
||||||
|
|
||||||
|
#define SSI_ERR_PREFIX "[SSI Err]"
|
||||||
|
#define SSI_WARN_PREFIX "[SSI Wrn]"
|
||||||
|
#define SSI_INFO_PREFIX "[SSI Inf]"
|
||||||
|
|
||||||
|
#define SDIO_ERR_PREFIX "[SDIO Err]"
|
||||||
|
#define SDIO_WARN_PREFIX "[SDIO Wrn]"
|
||||||
|
#define SDIO_INFO_PREFIX "[SDIO Inf]"
|
||||||
|
|
||||||
|
#define SPIF_ERR_PREFIX "[SPIF Err]"
|
||||||
|
#define SPIF_WARN_PREFIX "[SPIF Wrn]"
|
||||||
|
#define SPIF_INFO_PREFIX "[SPIF Inf]"
|
||||||
|
|
||||||
|
#define SDR_ERR_PREFIX "[SDR Err]"
|
||||||
|
#define SDR_WARN_PREFIX "[SDR Wrn]"
|
||||||
|
#define SDR_INFO_PREFIX "[SDR Inf]"
|
||||||
|
|
||||||
|
#define UART_ERR_PREFIX "[UART Err]"
|
||||||
|
#define UART_WARN_PREFIX "[UART Wrn]"
|
||||||
|
#define UART_INFO_PREFIX "[UART Inf]"
|
||||||
|
|
||||||
|
#define USB_ERR_PREFIX "[USB Err]"
|
||||||
|
#define USB_WARN_PREFIX "[USB Wrn]"
|
||||||
|
#define USB_INFO_PREFIX "[USB Inf]"
|
||||||
|
|
||||||
|
#define IPSEC_ERR_PREFIX "[CRYP Err]"
|
||||||
|
#define IPSEC_WARN_PREFIX "[CRYP Wrn]"
|
||||||
|
#define IPSEC_INFO_PREFIX "[CRYP Inf]"
|
||||||
|
|
||||||
|
#define ADC_ERR_PREFIX "[ADC Err]"
|
||||||
|
#define ADC_WARN_PREFIX "[ADC Wrn]"
|
||||||
|
#define ADC_INFO_PREFIX "[ADC Inf]"
|
||||||
|
|
||||||
|
#define DAC_ERR_PREFIX "[DAC Err]"
|
||||||
|
#define DAC_WARN_PREFIX "[DAC Wrn]"
|
||||||
|
#define DAC_INFO_PREFIX "[DAC Inf]"
|
||||||
|
|
||||||
|
#define MISC_ERR_PREFIX "[MISC Err]"
|
||||||
|
#define MISC_WARN_PREFIX "[MISC Wrn]"
|
||||||
|
#define MISC_INFO_PREFIX "[MISC Inf]"
|
||||||
|
|
||||||
|
#define OTG_ERR_PREFIX "[OTG Err]"
|
||||||
|
#define OTG_WARN_PREFIX "[OTG Wrn]"
|
||||||
|
#define OTG_INFO_PREFIX "[OTG Inf]"
|
||||||
|
|
||||||
|
#define OTG_PREFIX "RTL8195A[OTG]: "
|
||||||
|
#define OTG_PREFIX_LVL "RTL8195A[OTG_LVL_%2x]: "
|
||||||
|
|
||||||
|
//#ifdef
|
||||||
|
#define CONFIG_DEBUG_ERROR 1
|
||||||
|
#define CONFIG_DEBUG_WARN 1
|
||||||
|
#define CONFIG_DEBUG_INFO 1
|
||||||
|
|
||||||
|
#ifndef likely
|
||||||
|
#define likely(x) (x)
|
||||||
|
#define unlikely(x) (x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_LOG
|
||||||
|
|
||||||
|
#if CONFIG_DEBUG_ERROR // if Build-In Debug Error Message
|
||||||
|
|
||||||
|
#define DBG_BOOT_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_BOOT_)) \
|
||||||
|
_DbgDump("\r"BOOT_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_GDMA_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_GDMA_)) \
|
||||||
|
_DbgDump("\r"GDMA_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_GPIO_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_GPIO_)) \
|
||||||
|
_DbgDump("\r"GPIO_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_TIMER_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_TIMER_)) \
|
||||||
|
_DbgDump("\r"TIMER_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_I2C_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_I2C_)) \
|
||||||
|
_DbgDump("\r"I2C_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_I2S_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_I2S_)) \
|
||||||
|
_DbgDump("\r"I2S_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_MII_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_MII_)) \
|
||||||
|
_DbgDump("\r"MII_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_NFC_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_NFC_)) \
|
||||||
|
_DbgDump("\r"NFC_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_PCM_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_PCM_)) \
|
||||||
|
_DbgDump("\r"PCM_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_PWM_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_PWM_)) \
|
||||||
|
_DbgDump("\r"PWM_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_SSI_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_SSI_)) \
|
||||||
|
_DbgDump("\r"SSI_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_SDIO_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_SDIO_)) \
|
||||||
|
_DbgDump("\r"SDIO_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_SPIF_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_SPI_FLASH_)) \
|
||||||
|
_DbgDump("\r"SPIF_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_SDR_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_SDR_)) \
|
||||||
|
_DbgDump("\r"SDR_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_UART_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_UART_)) \
|
||||||
|
_DbgDump("\r"UART_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_USBOTG_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_USB_OTG_)) \
|
||||||
|
_DbgDump("\r" __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_USBCOR_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_USB_CORE_)) \
|
||||||
|
_DbgDump("\r"USB_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_CRYPTO_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_CRYPTO_)) \
|
||||||
|
_DbgDump("\r"IPSEC_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_ADC_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_ADC_)) \
|
||||||
|
_DbgDump("\r"ADC_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_DAC_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_DAC_)) \
|
||||||
|
_DbgDump("\r"DAC_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define MSG_MBOX_ERR(...) do {\
|
||||||
|
if (likely(CfgSysDebugErr & _SYSDBG_MAILBOX_)) \
|
||||||
|
_DbgDump("\r"MBOX_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define MSG_TIMER_ERR(...) do {\
|
||||||
|
if (likely(CfgSysDebugErr & _SYSDBG_TIMER_)) \
|
||||||
|
_DbgDump("\r"TIMER_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_8195A_OTG(...) do{\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_USB_OTG_)) \
|
||||||
|
_DbgDump("\r"OTG_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_8195A_OTG_INFO(...) do{\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_USB_OTG_)) \
|
||||||
|
_DbgDump("\r"OTG_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_8195A_OTG_WARN(...) do{\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_USB_OTG_)) \
|
||||||
|
_DbgDump("\r"OTG_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_8195A_OTG_ERR(...) do{\
|
||||||
|
if (unlikely(ConfigDebugErr & _DBG_USB_OTG_)) \
|
||||||
|
_DbgDump("\r"OTG_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_8195A_OTG_LVL(LVL,...) do{\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_USB_OTG_)){ \
|
||||||
|
_DbgDump("\r"OTG_PREFIX_LVL,LVL);\
|
||||||
|
_DbgDump(__VA_ARGS__);\
|
||||||
|
}\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_MISC_ERR(...) do {\
|
||||||
|
if (likely(ConfigDebugErr & _DBG_MISC_)) \
|
||||||
|
_DbgDump("\r"MISC_ERR_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#else // else of "#if CONFIG_DEBUG_ERROR"
|
||||||
|
|
||||||
|
#define DBG_BOOT_ERR(...)
|
||||||
|
#define DBG_GDMA_ERR(...)
|
||||||
|
#define DBG_GPIO_ERR(...)
|
||||||
|
#define DBG_TIMER_ERR(...)
|
||||||
|
#define DBG_I2C_ERR(...)
|
||||||
|
#define DBG_I2S_ERR(...)
|
||||||
|
#define DBG_MII_ERR(...)
|
||||||
|
#define DBG_NFC_ERR(...)
|
||||||
|
#define DBG_PCM_ERR(...)
|
||||||
|
#define DBG_PWM_ERR(...)
|
||||||
|
#define DBG_SSI_ERR(...)
|
||||||
|
#define DBG_SDIO_ERR(...)
|
||||||
|
#define DBG_SPIF_ERR(...)
|
||||||
|
#define DBG_SDR_ERR(...)
|
||||||
|
#define DBG_UART_ERR(...)
|
||||||
|
#define DBG_USBOTG_ERR(...)
|
||||||
|
#define DBG_USBCOR_ERR(...)
|
||||||
|
#define DBG_CRYPTO_ERR(...)
|
||||||
|
#define DBG_ADC_ERR(...)
|
||||||
|
#define DBG_DAC_ERR(...)
|
||||||
|
|
||||||
|
#define MSG_MBOX_ERR(...)
|
||||||
|
#define MSG_TIMER_ERR(...)
|
||||||
|
#define DBG_8195A_OTG(...)
|
||||||
|
#define DBG_8195A_OTG_LVL(LVL,...)
|
||||||
|
#define DBG_8195A_OTG_INFO(...)
|
||||||
|
#define DBG_8195A_OTG_WARN(...)
|
||||||
|
#define DBG_8195A_OTG_ERR(...)
|
||||||
|
|
||||||
|
|
||||||
|
#endif // end of else of "#if CONFIG_DEBUG_ERROR"
|
||||||
|
|
||||||
|
// =============================================================
|
||||||
|
|
||||||
|
#if CONFIG_DEBUG_WARN // if Build-In Debug Warring Message
|
||||||
|
|
||||||
|
#define DBG_BOOT_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn& _DBG_BOOT_)) \
|
||||||
|
_DbgDump("\r"BOOT_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_GDMA_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_GDMA_)) \
|
||||||
|
_DbgDump("\r"GDMA_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_GPIO_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_GPIO_)) \
|
||||||
|
_DbgDump("\r"GPIO_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_TIMER_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_TIMER_)) \
|
||||||
|
_DbgDump("\r"TIMER_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_I2C_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_I2C_)) \
|
||||||
|
_DbgDump("\r"I2C_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_I2S_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_I2S_)) \
|
||||||
|
_DbgDump("\r"I2S_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_MII_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_MII_)) \
|
||||||
|
_DbgDump("\r"MII_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_NFC_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_NFC_)) \
|
||||||
|
_DbgDump("\r"NFC_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_PCM_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_PCM_)) \
|
||||||
|
_DbgDump("\r"PCM_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_PWM_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_PWM_)) \
|
||||||
|
_DbgDump("\r"PWM_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_SSI_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_SSI_)) \
|
||||||
|
_DbgDump("\r"SSI_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_SDIO_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_SDIO_)) \
|
||||||
|
_DbgDump("\r"SDIO_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_SPIF_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_SPI_FLASH_)) \
|
||||||
|
_DbgDump("\r"SPIF_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_SDR_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_SDR_)) \
|
||||||
|
_DbgDump("\r"SDR_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_UART_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_UART_)) \
|
||||||
|
_DbgDump("\r"UART_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_USBOTG_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_USB_OTG_)) \
|
||||||
|
_DbgDump("\r" __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_USBCOR_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_USB_CORE_)) \
|
||||||
|
_DbgDump("\r"USB_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_CRYPTO_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_CRYPTO_)) \
|
||||||
|
_DbgDump("\r"IPSEC_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_ADC_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_ADC_)) \
|
||||||
|
_DbgDump("\r"ADC_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_DAC_WARN(...) do {\
|
||||||
|
if (unlikely(ConfigDebugWarn & _DBG_DAC_)) \
|
||||||
|
_DbgDump("\r"DAC_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define MSG_MBOX_WARN(...) do {\
|
||||||
|
if (unlikely(CfgSysDebugWarn& _SYSDBG_MAILBOX_)) \
|
||||||
|
_DbgDump("\r"MBOX_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define MSG_TIMER_WARN(...) do {\
|
||||||
|
if (unlikely(CfgSysDebugWarn & _SYSDBG_TIMER_)) \
|
||||||
|
_DbgDump("\r"TIMER_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_MISC_WARN(...) do {\
|
||||||
|
if (likely(ConfigDebugWarn & _DBG_MISC_)) \
|
||||||
|
_DbgDump("\r"MISC_WARN_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#else // else of "#if CONFIG_DEBUG_WARN"
|
||||||
|
|
||||||
|
#define DBG_BOOT_WARN(...)
|
||||||
|
#define DBG_GDMA_WARN(...)
|
||||||
|
#define DBG_GPIO_WARN(...)
|
||||||
|
#define DBG_TIMER_WARN(...)
|
||||||
|
#define DBG_I2C_WARN(...)
|
||||||
|
#define DBG_I2S_WARN(...)
|
||||||
|
#define DBG_MII_WARN(...)
|
||||||
|
#define DBG_NFC_WARN(...)
|
||||||
|
#define DBG_PCM_WARN(...)
|
||||||
|
#define DBG_PWM_WARN(...)
|
||||||
|
#define DBG_SSI_WARN(...)
|
||||||
|
#define DBG_SDIO_WARN(...)
|
||||||
|
#define DBG_SPIF_WARN(...)
|
||||||
|
#define DBG_SDR_WARN(...)
|
||||||
|
#define DBG_UART_WARN(...)
|
||||||
|
#define DBG_USBOTG_WARN(...)
|
||||||
|
#define DBG_USBCOR_WARN(...)
|
||||||
|
#define DBG_CRYPTO_WARN(...)
|
||||||
|
#define DBG_ADC_WARN(...)
|
||||||
|
#define DBG_DAC_WARN(...)
|
||||||
|
#define DBG_MISC_WARN(...)
|
||||||
|
|
||||||
|
#define MSG_MBOX_WARN(...)
|
||||||
|
#define MSG_TIMER_WARN(...)
|
||||||
|
|
||||||
|
#endif // end of else of "#if CONFIG_DEBUG_WARN"
|
||||||
|
|
||||||
|
// =============================================================
|
||||||
|
|
||||||
|
#if CONFIG_DEBUG_INFO // if Build-In Debug Information Message
|
||||||
|
|
||||||
|
#define DBG_BOOT_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_BOOT_)) \
|
||||||
|
_DbgDump("\r"BOOT_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_GDMA_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_GDMA_)) \
|
||||||
|
_DbgDump("\r"GDMA_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_GPIO_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_GPIO_)) \
|
||||||
|
_DbgDump("\r"GPIO_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_TIMER_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_TIMER_)) \
|
||||||
|
_DbgDump("\r"TIMER_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_I2C_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_I2C_)) \
|
||||||
|
_DbgDump("\r"I2C_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_I2S_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_I2S_)) \
|
||||||
|
_DbgDump("\r"I2S_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_MII_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_MII_)) \
|
||||||
|
_DbgDump("\r"MII_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_NFC_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_NFC_)) \
|
||||||
|
_DbgDump("\r"NFC_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_PCM_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_PCM_)) \
|
||||||
|
_DbgDump("\r"PCM_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_PWM_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_PWM_)) \
|
||||||
|
_DbgDump("\r"PWM_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_SSI_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_SSI_)) \
|
||||||
|
_DbgDump("\r"SSI_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_SDIO_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_SDIO_)) \
|
||||||
|
_DbgDump("\r"SDIO_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_SPIF_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_SPI_FLASH_)) \
|
||||||
|
_DbgDump("\r"SPIF_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_SDR_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_SDR_)) \
|
||||||
|
_DbgDump("\r"SDR_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_UART_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_UART_)) \
|
||||||
|
_DbgDump("\r"UART_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_USBOTG_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_USB_OTG_)) \
|
||||||
|
_DbgDump("\r" __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_USBCOR_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_USB_CORE_)) \
|
||||||
|
_DbgDump("\r"USB_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_CRYPTO_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_CRYPTO_)) \
|
||||||
|
_DbgDump("\r"IPSEC_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_ADC_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_ADC_)) \
|
||||||
|
_DbgDump("\r"ADC_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_DAC_INFO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugInfo & _DBG_DAC_)) \
|
||||||
|
_DbgDump("\r"DAC_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define MSG_MBOX_INFO(...) do {\
|
||||||
|
if (unlikely(CfgSysDebugInfo & _SYSDBG_MAILBOX_)) \
|
||||||
|
_DbgDump("\r"MBOX_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define MSG_TIMER_INFO(...) do {\
|
||||||
|
if (unlikely(CfgSysDebugInfo & _SYSDBG_TIMER_)) \
|
||||||
|
_DbgDump("\r"TIMER_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_MISC_INFO(...) do {\
|
||||||
|
if (likely(ConfigDebugInfo & _DBG_MISC_)) \
|
||||||
|
_DbgDump("\r"MISC_INFO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#else // else of "#if CONFIG_DEBUG_INFO"
|
||||||
|
|
||||||
|
#define DBG_BOOT_INFO(...)
|
||||||
|
#define DBG_GDMA_INFO(...)
|
||||||
|
#define DBG_GPIO_INFO(...)
|
||||||
|
#define DBG_TIMER_INFO(...)
|
||||||
|
#define DBG_I2C_INFO(...)
|
||||||
|
#define DBG_I2S_INFO(...)
|
||||||
|
#define DBG_MII_INFO(...)
|
||||||
|
#define DBG_NFC_INFO(...)
|
||||||
|
#define DBG_PCM_INFO(...)
|
||||||
|
#define DBG_PWM_INFO(...)
|
||||||
|
#define DBG_SSI_INFO(...)
|
||||||
|
#define DBG_SDIO_INFO(...)
|
||||||
|
#define DBG_SPIF_INFO(...)
|
||||||
|
#define DBG_SDR_INFO(...)
|
||||||
|
#define DBG_UART_INFO(...)
|
||||||
|
#define DBG_USBOTG_INFO(...)
|
||||||
|
#define DBG_USBCOR_INFO(...)
|
||||||
|
#define DBG_CRYPTO_INFO(...)
|
||||||
|
#define DBG_ADC_INFO(...)
|
||||||
|
#define DBG_DAC_INFO(...)
|
||||||
|
#define DBG_MISC_INFO(...)
|
||||||
|
|
||||||
|
#define MSG_MBOX_INFO(...)
|
||||||
|
#define MSG_TIMER_INFO(...)
|
||||||
|
|
||||||
|
#endif // end of else of "#if CONFIG_DEBUG_INFO"
|
||||||
|
|
||||||
|
#define DBG_8195A_DRIVER(...) do {\
|
||||||
|
if (unlikely(ConfigDebugErr & (_DBG_I2S_|_DBG_PCM_|_DBG_TIMER_))) \
|
||||||
|
_DbgDump("\r"DRIVER_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_8195A_HAL(...) do {\
|
||||||
|
if (unlikely(ConfigDebugErr & (_DBG_SDR_|_DBG_MISC_))) \
|
||||||
|
_DbgDump("\r"HAL_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_8195A_DMA(...) do {\
|
||||||
|
if (unlikely(ConfigDebugErr & _DBG_GDMA_)) \
|
||||||
|
_DbgDump("\r"DMA_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_8195A_SDIO(...) do {\
|
||||||
|
if (unlikely(ConfigDebugErr & _DBG_SDIO_)) \
|
||||||
|
_DbgDump("\r"SDIO_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_8195A(...) do {\
|
||||||
|
if (unlikely(ConfigDebugErr & _DBG_MISC_)) \
|
||||||
|
_DbgDump("\r" __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define MONITOR_LOG(...) do {\
|
||||||
|
if (unlikely(ConfigDebugErr & _DBG_MISC_)) \
|
||||||
|
_DbgDump( __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_ERROR_LOG(...) do {\
|
||||||
|
if (unlikely(ConfigDebugErr & _DBG_FAULT_)) \
|
||||||
|
_DbgDump( __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define DBG_ASSERT(x) do {\
|
||||||
|
if (unlikely(!(x))) \
|
||||||
|
_DbgDump("Assertion: %s:%s, %d\n", __FILE__, __func__, __LINE__);\
|
||||||
|
}while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __ICCARM__
|
||||||
|
#define DBG_ASSERT(x) do {\
|
||||||
|
if (unlikely(!(x))) \
|
||||||
|
_DbgDump("Assertion: %s:%s, %d\n", __FILE__, __func__, __LINE__);\
|
||||||
|
}while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else // else of "#if CONFIG_DEBUG_LOG"
|
||||||
|
#define DBG_8195A_DRIVER(...)
|
||||||
|
|
||||||
|
#define DBG_8195A_HAL(...)
|
||||||
|
|
||||||
|
#define DBG_8195A(...)
|
||||||
|
|
||||||
|
#define DBG_8195A_DMA(...)
|
||||||
|
|
||||||
|
#define MONITOR_LOG(...)
|
||||||
|
|
||||||
|
#define DBG_ERROR_LOG(...)
|
||||||
|
|
||||||
|
#define DBG_8195A_SDIO(...)
|
||||||
|
|
||||||
|
#define DBG_BOOT_ERR(...)
|
||||||
|
#define DBG_GDMA_ERR(...)
|
||||||
|
#define DBG_GPIO_ERR(...)
|
||||||
|
#define DBG_TIMER_ERR(...)
|
||||||
|
#define DBG_I2C_ERR(...)
|
||||||
|
#define DBG_I2S_ERR(...)
|
||||||
|
#define DBG_MII_ERR(...)
|
||||||
|
#define DBG_NFC_ERR(...)
|
||||||
|
#define DBG_PCM_ERR(...)
|
||||||
|
#define DBG_PWM_ERR(...)
|
||||||
|
#define DBG_SSI_ERR(...)
|
||||||
|
#define DBG_SDIO_ERR(...)
|
||||||
|
#define DBG_SPIF_ERR(...)
|
||||||
|
#define DBG_SDR_ERR(...)
|
||||||
|
#define DBG_UART_ERR(...)
|
||||||
|
#define DBG_USBOTG_ERR(...)
|
||||||
|
#define DBG_USBCOR_ERR(...)
|
||||||
|
#define DBG_CRYPTO_ERR(...)
|
||||||
|
#define DBG_ADC_ERR(...)
|
||||||
|
#define DBG_DAC_ERR(...)
|
||||||
|
#define MSG_MBOX_ERR(...)
|
||||||
|
#define MSG_TIMER_ERR(...)
|
||||||
|
|
||||||
|
#define DBG_BOOT_WARN(...)
|
||||||
|
#define DBG_GDMA_WARN(...)
|
||||||
|
#define DBG_GPIO_WARN(...)
|
||||||
|
#define DBG_TIMER_WARN(...)
|
||||||
|
#define DBG_I2C_WARN(...)
|
||||||
|
#define DBG_I2S_WARN(...)
|
||||||
|
#define DBG_MII_WARN(...)
|
||||||
|
#define DBG_NFC_WARN(...)
|
||||||
|
#define DBG_PCM_WARN(...)
|
||||||
|
#define DBG_PWM_WARN(...)
|
||||||
|
#define DBG_SSI_WARN(...)
|
||||||
|
#define DBG_SDIO_WARN(...)
|
||||||
|
#define DBG_SPIF_WARN(...)
|
||||||
|
#define DBG_SDR_WARN(...)
|
||||||
|
#define DBG_UART_WARN(...)
|
||||||
|
#define DBG_USBOTG_WARN(...)
|
||||||
|
#define DBG_USBCOR_WARN(...)
|
||||||
|
#define DBG_CRYPTO_WARN(...)
|
||||||
|
#define DBG_ADC_WARN(...)
|
||||||
|
#define DBG_DAC_WARN(...)
|
||||||
|
#define MSG_MBOX_WARN(...)
|
||||||
|
#define MSG_TIMER_WARN(...)
|
||||||
|
|
||||||
|
#define DBG_BOOT_INFO(...)
|
||||||
|
#define DBG_GDMA_INFO(...)
|
||||||
|
#define DBG_GPIO_INFO(...)
|
||||||
|
#define DBG_TIMER_INFO(...)
|
||||||
|
#define DBG_I2C_INFO(...)
|
||||||
|
#define DBG_I2S_INFO(...)
|
||||||
|
#define DBG_MII_INFO(...)
|
||||||
|
#define DBG_NFC_INFO(...)
|
||||||
|
#define DBG_PCM_INFO(...)
|
||||||
|
#define DBG_PWM_INFO(...)
|
||||||
|
#define DBG_SSI_INFO(...)
|
||||||
|
#define DBG_SDIO_INFO(...)
|
||||||
|
#define DBG_SPIF_INFO(...)
|
||||||
|
#define DBG_SDR_INFO(...)
|
||||||
|
#define DBG_UART_INFO(...)
|
||||||
|
#define DBG_USBOTG_INFO(...)
|
||||||
|
#define DBG_USBCOR_INFO(...)
|
||||||
|
#define DBG_CRYPTO_INFO(...)
|
||||||
|
#define DBG_ADC_INFO(...)
|
||||||
|
#define DBG_DAC_INFO(...)
|
||||||
|
|
||||||
|
#define MSG_MBOX_INFO(...)
|
||||||
|
#define MSG_TIMER_INFO(...)
|
||||||
|
|
||||||
|
#define DBG_ASSERT(x)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ANSI_COLOR_GREEN "\x1b[32m"
|
||||||
|
#define ANSI_COLOR_CYAN "\x1b[36m"
|
||||||
|
#define ANSI_COLOR_YELLOW "\x1b[33m"
|
||||||
|
#define ANSI_COLOR_MAGENTA "\x1b[35m"
|
||||||
|
#define ANSI_COLOR_RED "\x1b[31m"
|
||||||
|
#define ANSI_COLOR_BLUE "\x1b[34m"
|
||||||
|
#define ANSI_COLOR_RESET "\x1b[0m"
|
||||||
|
|
||||||
|
#define IDENT_ONE_SPACE " "
|
||||||
|
#define IDENT_TWO_SPACE " "
|
||||||
|
#define IDENT_FOUR_SPACE " "
|
||||||
|
#define IDENT_SIX_SPACE " "
|
||||||
|
#define IDENT_EIGHT_SPACE " "
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_LOG
|
||||||
|
typedef enum _DBG_CFG_TYPE_ {
|
||||||
|
DBG_CFG_ERR=0,
|
||||||
|
DBG_CFG_WARN=1,
|
||||||
|
DBG_CFG_INFO=2
|
||||||
|
} DBG_CFG_TYPE;
|
||||||
|
|
||||||
|
typedef struct _DBG_CFG_CMD_ {
|
||||||
|
u8 cmd_name[16];
|
||||||
|
u32 cmd_type;
|
||||||
|
} DBG_CFG_CMD, *PDBG_CFG_CMD;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum _CONSOLE_OP_STAGE_ {
|
||||||
|
ROM_STAGE = 0,
|
||||||
|
RAM_STAGE = 1
|
||||||
|
}CONSOLE_OP_STAGE;
|
||||||
|
|
||||||
|
#endif //_DIAG_H_
|
319
sdk/component/soc/realtek/8195a/fwlib/hal_adc.h
Normal file
319
sdk/component/soc/realtek/8195a/fwlib/hal_adc.h
Normal file
|
@ -0,0 +1,319 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HAL_ADC_H_
|
||||||
|
#define _HAL_ADC_H_
|
||||||
|
|
||||||
|
#include "rtl8195a.h"
|
||||||
|
#include "rtl8195a_adc.h"
|
||||||
|
#include "hal_gdma.h"
|
||||||
|
|
||||||
|
//================ ADC Configuration =========================
|
||||||
|
#define ADC_INTR_OP_TYPE 1
|
||||||
|
#define ADC_DMA_OP_TYPE 1
|
||||||
|
|
||||||
|
// ADC SAL management macros
|
||||||
|
#define SAL_ADC_USER_CB_NUM (sizeof(SAL_ADC_USER_CB) / sizeof(PSAL_ADC_USERCB_ADPT))
|
||||||
|
|
||||||
|
// ADC used module.
|
||||||
|
// Please set the ADC module flag to 1 to enable the related
|
||||||
|
#define ADC0_USED 1
|
||||||
|
#define ADC1_USED 1
|
||||||
|
#define ADC2_USED 1
|
||||||
|
#define ADC3_USED 1
|
||||||
|
|
||||||
|
|
||||||
|
//================ Debug MSG Definition =======================
|
||||||
|
#define ADC_PREFIX "RTL8195A[adc]: "
|
||||||
|
#define ADC_PREFIX_LVL " [ADC_DBG]: "
|
||||||
|
|
||||||
|
typedef enum _ADC_DBG_LVL_ {
|
||||||
|
HAL_ADC_LVL = 0x01,
|
||||||
|
SAL_ADC_LVL = 0x02,
|
||||||
|
VERI_ADC_LVL = 0x04,
|
||||||
|
}ADC_DBG_LVL,*PADC_DBG_LVL;
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_LOG
|
||||||
|
#ifdef CONFIG_DEBUG_LOG_ADC_HAL
|
||||||
|
|
||||||
|
#define DBG_8195A_ADC(...) do{ \
|
||||||
|
_DbgDump("\r"ADC_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
|
||||||
|
#define ADCDBGLVL 0xFF
|
||||||
|
#define DBG_8195A_ADC_LVL(LVL,...) do{\
|
||||||
|
if (LVL&ADCDBGLVL){\
|
||||||
|
_DbgDump("\r"ADC_PREFIX_LVL __VA_ARGS__);\
|
||||||
|
}\
|
||||||
|
}while(0)
|
||||||
|
#else
|
||||||
|
#define DBG_ADC_LOG_PERD 100
|
||||||
|
#define DBG_8195A_ADC(...)
|
||||||
|
#define DBG_8195A_ADC_LVL(...)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//================ ADC HAL Related Enumeration ==================
|
||||||
|
// ADC Module Selection
|
||||||
|
typedef enum _ADC_MODULE_SEL_ {
|
||||||
|
ADC0_SEL = 0x0,
|
||||||
|
ADC1_SEL = 0x1,
|
||||||
|
ADC2_SEL = 0x2,
|
||||||
|
ADC3_SEL = 0x3,
|
||||||
|
}ADC_MODULE_SEL,*PADC_MODULE_SEL;
|
||||||
|
|
||||||
|
// ADC module status
|
||||||
|
typedef enum _ADC_MODULE_STATUS_ {
|
||||||
|
ADC_DISABLE = 0x0,
|
||||||
|
ADC_ENABLE = 0x1,
|
||||||
|
}ADC_MODULE_STATUS, *PADC_MODULE_STATUS;
|
||||||
|
|
||||||
|
// ADC Data Endian
|
||||||
|
typedef enum _ADC_DATA_ENDIAN_ {
|
||||||
|
ADC_DATA_ENDIAN_LITTLE = 0x0,
|
||||||
|
ADC_DATA_ENDIAN_BIG = 0x1,
|
||||||
|
}ADC_DATA_ENDIAN,*PADC_DATA_ENDIAN;
|
||||||
|
|
||||||
|
// ADC Debug Select
|
||||||
|
typedef enum _ADC_DEBUG_SEL_ {
|
||||||
|
ADC_DBG_SEL_DISABLE = 0x0,
|
||||||
|
ADC_DBG_SEL_ENABLE = 0x1,
|
||||||
|
}ADC_DEBUG_SEL,*PADC_DEBUG_SEL;
|
||||||
|
|
||||||
|
typedef enum _ADC_COMPARE_SET_ {
|
||||||
|
ADC_COMP_SMALLER_THAN = 0x0,
|
||||||
|
ADC_COMP_GREATER_THAN = 0x1,
|
||||||
|
}ADC_COMPARE_SET, *PADC_COMPARE_SET;
|
||||||
|
|
||||||
|
// ADC feature status
|
||||||
|
typedef enum _ADC_FEATURE_STATUS_{
|
||||||
|
ADC_FEATURE_DISABLED = 0,
|
||||||
|
ADC_FEATURE_ENABLED = 1,
|
||||||
|
}ADC_FEATURE_STATUS,*PADC_FEATURE_STATUS;
|
||||||
|
|
||||||
|
// ADC operation type
|
||||||
|
typedef enum _ADC_OP_TYPE_ {
|
||||||
|
ADC_RDREG_TYPE = 0x0,
|
||||||
|
ADC_DMA_TYPE = 0x1,
|
||||||
|
ADC_INTR_TYPE = 0x2,
|
||||||
|
}ADC_OP_TYPE, *PADC_OP_TYPE;
|
||||||
|
|
||||||
|
// ADC device status
|
||||||
|
typedef enum _ADC_DEVICE_STATUS_ {
|
||||||
|
ADC_STS_UNINITIAL = 0x00,
|
||||||
|
ADC_STS_INITIALIZED = 0x01,
|
||||||
|
ADC_STS_IDLE = 0x02,
|
||||||
|
|
||||||
|
ADC_STS_TX_READY = 0x03,
|
||||||
|
ADC_STS_TX_ING = 0x04,
|
||||||
|
|
||||||
|
ADC_STS_RX_READY = 0x05,
|
||||||
|
ADC_STS_RX_ING = 0x06,
|
||||||
|
|
||||||
|
ADC_STS_ERROR = 0x07,
|
||||||
|
ADC_STS_FULL = 0x08,
|
||||||
|
}ADC_DEVICE_STATUS, *PADC_DEVICE_STATUS;
|
||||||
|
|
||||||
|
// ADC error type
|
||||||
|
typedef enum _ADC_ERR_TYPE_ {
|
||||||
|
ADC_ERR_FIFO_RD_ERROR = 0x40, //ADC FIFO read error
|
||||||
|
}ADC_ERR_TYPE, *PADC_ERR_TYPE;
|
||||||
|
|
||||||
|
// ADC initial status
|
||||||
|
typedef enum _ADC_INITAIL_STATUS_ {
|
||||||
|
ADC0_INITED = 0x1,
|
||||||
|
ADC1_INITED = 0x2,
|
||||||
|
ADC2_INITED = 0x4,
|
||||||
|
ADC3_INITED = 0x8,
|
||||||
|
}ADC_INITAIL_STATUS, *PADC_INITAIL_STATUS;
|
||||||
|
|
||||||
|
|
||||||
|
//================ ADC HAL Data Structure ======================
|
||||||
|
// ADC HAL initial data structure
|
||||||
|
typedef struct _HAL_ADC_INIT_DAT_ {
|
||||||
|
u8 ADCIdx; //ADC index used
|
||||||
|
u8 ADCEn; //ADC module enable
|
||||||
|
u8 ADCEndian; //ADC endian selection,
|
||||||
|
//but actually it's for 32-bit ADC data swap control
|
||||||
|
//1'b0: no swap,
|
||||||
|
//1'b1: swap the upper 16-bit and the lower 16-bit
|
||||||
|
u8 ADCBurstSz; //ADC DMA operation threshold
|
||||||
|
|
||||||
|
u8 ADCCompOnly; //ADC compare mode only enable (without FIFO enable)
|
||||||
|
u8 ADCOneShotEn; //ADC one-shot mode enable
|
||||||
|
u8 ADCOverWREn; //ADC overwrite mode enable
|
||||||
|
u8 ADCOneShotTD; //ADC one shot mode threshold
|
||||||
|
|
||||||
|
u16 ADCCompCtrl; //ADC compare mode control,
|
||||||
|
//1'b0:less than the compare threshold
|
||||||
|
//1'b1:greater than the compare threshod
|
||||||
|
u16 ADCCompTD; //ADC compare mode threshold
|
||||||
|
|
||||||
|
u8 ADCDataRate; //ADC down sample data rate,
|
||||||
|
u8 ADCAudioEn; //ADC audio mode enable
|
||||||
|
u8 ADCEnManul; //ADC enable manually
|
||||||
|
u8 ADCDbgSel;
|
||||||
|
|
||||||
|
u32 RSVD0;
|
||||||
|
|
||||||
|
u32 *ADCData; //ADC data pointer
|
||||||
|
u32 ADCPWCtrl; //ADC0 power control
|
||||||
|
u32 ADCIntrMSK; //ADC Interrupt Mask
|
||||||
|
u32 ADCAnaParAd3; //ADC analog parameter 3
|
||||||
|
u32 ADCInInput; //ADC Input is internal?
|
||||||
|
}HAL_ADC_INIT_DAT,*PHAL_ADC_INIT_DAT;
|
||||||
|
|
||||||
|
// ADC HAL Operations
|
||||||
|
typedef struct _HAL_ADC_OP_ {
|
||||||
|
RTK_STATUS (*HalADCInit) (VOID *Data); //HAL ADC initialization
|
||||||
|
RTK_STATUS (*HalADCDeInit) (VOID *Data); //HAL ADC de-initialization
|
||||||
|
RTK_STATUS (*HalADCEnable) (VOID *Data); //HAL ADC de-initialization
|
||||||
|
u32 (*HalADCReceive) (VOID *Data); //HAL ADC receive
|
||||||
|
RTK_STATUS (*HalADCIntrCtrl) (VOID *Data); //HAL ADC interrupt control
|
||||||
|
u32 (*HalADCReadReg) (VOID *Data, u8 ADCReg);//HAL ADC read register
|
||||||
|
}HAL_ADC_OP, *PHAL_ADC_OP;
|
||||||
|
|
||||||
|
// ADC user callback adapter
|
||||||
|
typedef struct _SAL_ADC_USERCB_ADPT_ {
|
||||||
|
VOID (*USERCB) (VOID *Data);
|
||||||
|
u32 USERData;
|
||||||
|
}SAL_ADC_USERCB_ADPT, *PSAL_ADC_USERCB_ADPT;
|
||||||
|
|
||||||
|
// ADC user callback structure
|
||||||
|
typedef struct _SAL_ADC_USER_CB_ {
|
||||||
|
PSAL_ADC_USERCB_ADPT pTXCB; //ADC Transmit Callback
|
||||||
|
PSAL_ADC_USERCB_ADPT pTXCCB; //ADC Transmit Complete Callback
|
||||||
|
PSAL_ADC_USERCB_ADPT pRXCB; //ADC Receive Callback
|
||||||
|
PSAL_ADC_USERCB_ADPT pRXCCB; //ADC Receive Complete Callback
|
||||||
|
PSAL_ADC_USERCB_ADPT pRDREQCB; //ADC Read Request Callback
|
||||||
|
PSAL_ADC_USERCB_ADPT pERRCB; //ADC Error Callback
|
||||||
|
PSAL_ADC_USERCB_ADPT pDMATXCB; //ADC DMA Transmit Callback
|
||||||
|
PSAL_ADC_USERCB_ADPT pDMATXCCB; //ADC DMA Transmit Complete Callback
|
||||||
|
PSAL_ADC_USERCB_ADPT pDMARXCB; //ADC DMA Receive Callback
|
||||||
|
PSAL_ADC_USERCB_ADPT pDMARXCCB; //ADC DMA Receive Complete Callback
|
||||||
|
}SAL_ADC_USER_CB, *PSAL_ADC_USER_CB;
|
||||||
|
|
||||||
|
// ADC Transmit Buffer
|
||||||
|
typedef struct _SAL_ADC_TRANSFER_BUF_ {
|
||||||
|
u32 DataLen; //ADC Transmfer Length
|
||||||
|
u32 *pDataBuf; //ADC Transfer Buffer Pointer
|
||||||
|
u32 RSVD; //
|
||||||
|
}SAL_ADC_TRANSFER_BUF,*PSAL_ADC_TRANSFER_BUF;
|
||||||
|
|
||||||
|
typedef struct _SAL_ADC_DMA_USER_DEF_ {
|
||||||
|
|
||||||
|
u8 TxDatSrcWdth;
|
||||||
|
u8 TxDatDstWdth;
|
||||||
|
u8 TxDatSrcBstSz;
|
||||||
|
u8 TxDatDstBstSz;
|
||||||
|
|
||||||
|
u8 TxChNo;
|
||||||
|
u8 LlpCtrl;
|
||||||
|
u16 RSVD0;
|
||||||
|
|
||||||
|
u32 MaxMultiBlk;
|
||||||
|
u32 pLlix;
|
||||||
|
u32 pBlockSizeList;
|
||||||
|
}SAL_ADC_DMA_USER_DEF, *PSAL_ADC_DMA_USER_DEF;
|
||||||
|
|
||||||
|
// Software API Level ADC Handler
|
||||||
|
typedef struct _SAL_ADC_HND_ {
|
||||||
|
u8 DevNum; //ADC device number
|
||||||
|
u8 PinMux; //ADC pin mux seletion
|
||||||
|
u8 OpType; //ADC operation type selection
|
||||||
|
volatile u8 DevSts; //ADC device status
|
||||||
|
|
||||||
|
u32 ADCExd; //ADC extended options:
|
||||||
|
//bit 0: example
|
||||||
|
//bit 31~bit 1: Reserved
|
||||||
|
u32 ErrType; //
|
||||||
|
u32 TimeOut; //ADC IO Timeout count
|
||||||
|
|
||||||
|
PHAL_ADC_INIT_DAT pInitDat; //Pointer to ADC initial data struct
|
||||||
|
PSAL_ADC_TRANSFER_BUF pRXBuf; //Pointer to ADC TX buffer
|
||||||
|
PSAL_ADC_USER_CB pUserCB; //Pointer to ADC User Callback
|
||||||
|
}SAL_ADC_HND, *PSAL_ADC_HND;
|
||||||
|
|
||||||
|
// ADC SAL handle private
|
||||||
|
typedef struct _SAL_ADC_HND_PRIV_ {
|
||||||
|
VOID **ppSalADCHnd; //Pointer to SAL_ADC_HND pointer
|
||||||
|
SAL_ADC_HND SalADCHndPriv; //Private SAL_ADC_HND
|
||||||
|
}SAL_ADC_HND_PRIV, *PSAL_ADC_HND_PRIV;
|
||||||
|
|
||||||
|
//ADC SAL management adapter
|
||||||
|
typedef struct _SAL_ADC_MNGT_ADPT_ {
|
||||||
|
PSAL_ADC_HND_PRIV pSalHndPriv; //Pointer to SAL_ADC_HND
|
||||||
|
PHAL_ADC_INIT_DAT pHalInitDat; //Pointer to HAL ADC initial data( HAL_ADC_INIT_DAT )
|
||||||
|
PHAL_ADC_OP pHalOp; //Pointer to HAL ADC operation( HAL_ADC_OP )
|
||||||
|
VOID (*pHalOpInit)(VOID*);//Pointer to HAL ADC initialize function
|
||||||
|
|
||||||
|
PIRQ_HANDLE pIrqHnd; //Pointer to IRQ handler in SAL layer( IRQ_HANDLE )
|
||||||
|
VOID (*pSalIrqFunc)(VOID*); //Used for SAL ADC interrupt function
|
||||||
|
|
||||||
|
PSAL_ADC_DMA_USER_DEF pDMAConf; //Pointer to DAC User Define DMA config
|
||||||
|
PHAL_GDMA_ADAPTER pHalGdmaAdp;
|
||||||
|
PHAL_GDMA_OP pHalGdmaOp;
|
||||||
|
PIRQ_HANDLE pIrqGdmaHnd;
|
||||||
|
VOID (*pHalGdmaOpInit)(VOID*); //Pointer to HAL DAC initialize function
|
||||||
|
PSAL_ADC_USER_CB pUserCB; //Pointer to SAL user callbacks (SAL_ADC_USER_CB )
|
||||||
|
VOID (*pSalDMAIrqFunc)(VOID*); //Used for SAL DAC interrupt function
|
||||||
|
}SAL_ADC_MNGT_ADPT, *PSAL_ADC_MNGT_ADPT;
|
||||||
|
|
||||||
|
|
||||||
|
//================ ADC HAL Function Prototype ===================
|
||||||
|
// ADC HAL inline function
|
||||||
|
// For checking I2C input index valid or not
|
||||||
|
static inline RTK_STATUS
|
||||||
|
RtkADCIdxChk(
|
||||||
|
IN u8 ADCIdx
|
||||||
|
)
|
||||||
|
{
|
||||||
|
#if !ADC0_USED
|
||||||
|
if (ADCIdx == ADC0_SEL)
|
||||||
|
return _EXIT_FAILURE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !ADC1_USED
|
||||||
|
if (ADCIdx == ADC1_SEL)
|
||||||
|
return _EXIT_FAILURE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !ADC2_USED
|
||||||
|
if (ADCIdx == ADC2_SEL)
|
||||||
|
return _EXIT_FAILURE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !ADC3_USED
|
||||||
|
if (ADCIdx == ADC3_SEL)
|
||||||
|
return _EXIT_FAILURE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return _EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID HalADCOpInit(IN VOID *Data);
|
||||||
|
PSAL_ADC_HND RtkADCGetSalHnd(IN u8 DACIdx);
|
||||||
|
RTK_STATUS RtkADCFreeSalHnd(IN PSAL_ADC_HND pSalADCHND);
|
||||||
|
RTK_STATUS RtkADCLoadDefault(IN VOID *Data);
|
||||||
|
RTK_STATUS RtkADCInit(IN VOID *Data);
|
||||||
|
RTK_STATUS RtkADCDeInit(IN VOID *Data);
|
||||||
|
//RTK_STATUS RtkADCReceive(IN VOID *Data);
|
||||||
|
u32 RtkADCReceive(IN VOID *Data);
|
||||||
|
u32 RtkADCReceiveBuf(IN VOID *Data,IN u32 *pBuf);
|
||||||
|
|
||||||
|
PSAL_ADC_MNGT_ADPT RtkADCGetMngtAdpt(IN u8 ADCIdx);
|
||||||
|
RTK_STATUS RtkADCFreeMngtAdpt(IN PSAL_ADC_MNGT_ADPT pSalADCMngtAdpt);
|
||||||
|
VOID ADCISRHandle(IN VOID *Data);
|
||||||
|
VOID ADCGDMAISRHandle(IN VOID *Data);
|
||||||
|
HAL_Status RtkADCDisablePS(IN VOID *Data);
|
||||||
|
HAL_Status RtkADCEnablePS(IN VOID *Data);
|
||||||
|
|
||||||
|
#endif
|
126
sdk/component/soc/realtek/8195a/fwlib/hal_api.h
Normal file
126
sdk/component/soc/realtek/8195a/fwlib/hal_api.h
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
#ifndef _HAL_API_H_
|
||||||
|
#define _HAL_API_H_
|
||||||
|
|
||||||
|
#include "basic_types.h"
|
||||||
|
#include "hal_irqn.h"
|
||||||
|
|
||||||
|
#define HAL_READ32(base, addr) \
|
||||||
|
rtk_le32_to_cpu(*((volatile u32*)(base + addr)))
|
||||||
|
|
||||||
|
#define HAL_WRITE32(base, addr, value32) \
|
||||||
|
((*((volatile u32*)(base + addr))) = rtk_cpu_to_le32(value32))
|
||||||
|
|
||||||
|
|
||||||
|
#define HAL_READ16(base, addr) \
|
||||||
|
rtk_le16_to_cpu(*((volatile u16*)(base + addr)))
|
||||||
|
|
||||||
|
#define HAL_WRITE16(base, addr, value) \
|
||||||
|
((*((volatile u16*)(base + addr))) = rtk_cpu_to_le16(value))
|
||||||
|
|
||||||
|
|
||||||
|
#define HAL_READ8(base, addr) \
|
||||||
|
(*((volatile u8*)(base + addr)))
|
||||||
|
|
||||||
|
#define HAL_WRITE8(base, addr, value) \
|
||||||
|
((*((volatile u8*)(base + addr))) = value)
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// These "extern _LONG_CALL_" function declaration are for RAM code building only
|
||||||
|
// For ROM code building, thses code should be marked off
|
||||||
|
extern _LONG_CALL_ u8
|
||||||
|
HalPinCtrlRtl8195A(
|
||||||
|
IN u32 Function,
|
||||||
|
IN u32 PinLocation,
|
||||||
|
IN BOOL Operation
|
||||||
|
);
|
||||||
|
|
||||||
|
extern _LONG_CALL_ VOID
|
||||||
|
HalSerialPutcRtl8195a(
|
||||||
|
IN u8 c
|
||||||
|
);
|
||||||
|
|
||||||
|
extern _LONG_CALL_ u8
|
||||||
|
HalSerialGetcRtl8195a(
|
||||||
|
IN BOOL PullMode
|
||||||
|
);
|
||||||
|
|
||||||
|
extern _LONG_CALL_ u32
|
||||||
|
HalSerialGetIsrEnRegRtl8195a(VOID);
|
||||||
|
|
||||||
|
extern _LONG_CALL_ VOID
|
||||||
|
HalSerialSetIrqEnRegRtl8195a (
|
||||||
|
IN u32 SetValue
|
||||||
|
);
|
||||||
|
|
||||||
|
extern _LONG_CALL_ VOID
|
||||||
|
VectorTableInitForOSRtl8195A(
|
||||||
|
IN VOID *PortSVC,
|
||||||
|
IN VOID *PortPendSVH,
|
||||||
|
IN VOID *PortSysTick
|
||||||
|
);
|
||||||
|
|
||||||
|
extern _LONG_CALL_ BOOL
|
||||||
|
VectorIrqRegisterRtl8195A(
|
||||||
|
IN PIRQ_HANDLE pIrqHandle
|
||||||
|
);
|
||||||
|
|
||||||
|
extern _LONG_CALL_ BOOL
|
||||||
|
VectorIrqUnRegisterRtl8195A(
|
||||||
|
IN PIRQ_HANDLE pIrqHandle
|
||||||
|
);
|
||||||
|
|
||||||
|
extern _LONG_CALL_ VOID
|
||||||
|
VectorIrqEnRtl8195A(
|
||||||
|
IN PIRQ_HANDLE pIrqHandle
|
||||||
|
);
|
||||||
|
|
||||||
|
extern _LONG_CALL_ VOID
|
||||||
|
VectorIrqDisRtl8195A(
|
||||||
|
IN PIRQ_HANDLE pIrqHandle
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern BOOLEAN SpicFlashInitRtl8195A(u8 SpicBitMode);
|
||||||
|
extern VOID InitWDGIRQ(VOID);
|
||||||
|
|
||||||
|
#define PinCtrl HalPinCtrlRtl8195A
|
||||||
|
|
||||||
|
#define DiagPutChar HalSerialPutcRtl8195a
|
||||||
|
#define DiagGetChar HalSerialGetcRtl8195a
|
||||||
|
#define DiagGetIsrEnReg HalSerialGetIsrEnRegRtl8195a
|
||||||
|
#define DiagSetIsrEnReg HalSerialSetIrqEnRegRtl8195a
|
||||||
|
|
||||||
|
#define InterruptForOSInit VectorTableInitForOSRtl8195A
|
||||||
|
#define InterruptRegister VectorIrqRegisterRtl8195A
|
||||||
|
#define InterruptUnRegister VectorIrqUnRegisterRtl8195A
|
||||||
|
|
||||||
|
#define InterruptEn VectorIrqEnRtl8195A
|
||||||
|
#define InterruptDis VectorIrqDisRtl8195A
|
||||||
|
|
||||||
|
#define SpicFlashInit SpicFlashInitRtl8195A
|
||||||
|
#define Calibration32k En32KCalibration
|
||||||
|
#define WDGInit InitWDGIRQ
|
||||||
|
|
||||||
|
typedef enum _HAL_Status
|
||||||
|
{
|
||||||
|
HAL_OK = 0x00,
|
||||||
|
HAL_BUSY = 0x01,
|
||||||
|
HAL_TIMEOUT = 0x02,
|
||||||
|
HAL_ERR_PARA = 0x03, // error with invaild parameters
|
||||||
|
HAL_ERR_MEM = 0x04, // error with memory allocation failed
|
||||||
|
HAL_ERR_HW = 0x05, // error with hardware error
|
||||||
|
|
||||||
|
HAL_ERR_UNKNOWN = 0xee // unknown error
|
||||||
|
|
||||||
|
} HAL_Status;
|
||||||
|
|
||||||
|
|
||||||
|
#endif //_HAL_API_H_
|
17
sdk/component/soc/realtek/8195a/fwlib/hal_common.h
Normal file
17
sdk/component/soc/realtek/8195a/fwlib/hal_common.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HAL_COMMON_H_
|
||||||
|
#define _HAL_COMMON_H_
|
||||||
|
|
||||||
|
//================= Function Prototype START ===================
|
||||||
|
HAL_Status HalCommonInit(void);
|
||||||
|
//================= Function Prototype END ===================
|
||||||
|
|
||||||
|
#endif
|
313
sdk/component/soc/realtek/8195a/fwlib/hal_dac.h
Normal file
313
sdk/component/soc/realtek/8195a/fwlib/hal_dac.h
Normal file
|
@ -0,0 +1,313 @@
|
||||||
|
//======================================================
|
||||||
|
// Routines to access hardware
|
||||||
|
//
|
||||||
|
// Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
//
|
||||||
|
// This module is a confidential and proprietary property of RealTek and
|
||||||
|
// possession or use of this module requires written permission of RealTek.
|
||||||
|
//======================================================
|
||||||
|
#ifndef _HAL_DAC_H_
|
||||||
|
#define _HAL_DAC_H_
|
||||||
|
|
||||||
|
#include "rtl8195a.h"
|
||||||
|
#include "rtl8195a_dac.h"
|
||||||
|
#include "hal_api.h"
|
||||||
|
#include "hal_gdma.h"
|
||||||
|
|
||||||
|
//================ DAC Configuration =========================
|
||||||
|
#define DAC_INTR_OP_TYPE 1
|
||||||
|
#define DAC_DMA_OP_TYPE 1
|
||||||
|
|
||||||
|
// DAC SAL management macros
|
||||||
|
#define SAL_DAC_USER_CB_NUM (sizeof(SAL_DAC_USER_CB) / sizeof(PSAL_DAC_USERCB_ADPT))
|
||||||
|
|
||||||
|
// DAC SAL used module.
|
||||||
|
// Please set the DAC module flag to 1 to enable the related DAC module functions.
|
||||||
|
#define DAC0_USED 1
|
||||||
|
#define DAC1_USED 1
|
||||||
|
|
||||||
|
|
||||||
|
//================ Debug MSG Definition =======================
|
||||||
|
#define DAC_PREFIX "RTL8195A[dac]: "
|
||||||
|
#define DAC_PREFIX_LVL " [DAC_DBG]: "
|
||||||
|
|
||||||
|
typedef enum _DAC_DBG_LVL_ {
|
||||||
|
HAL_DAC_LVL = 0x00,
|
||||||
|
SAL_DAC_LVL = 0x02,
|
||||||
|
VERI_DAC_LVL = 0x04,
|
||||||
|
}DAC_DBG_LVL,*PDAC_DBG_LVL;
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_LOG
|
||||||
|
#ifdef CONFIG_DEBUG_LOG_DAC_HAL
|
||||||
|
|
||||||
|
#define DBG_8195A_DAC(...) do{ \
|
||||||
|
_DbgDump("\r"DAC_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
|
||||||
|
#define DACDBGLVL 0xFF
|
||||||
|
#define DBG_8195A_DAC_LVL(LVL,...) do{\
|
||||||
|
if (LVL&DACDBGLVL){\
|
||||||
|
_DbgDump("\r"DAC_PREFIX_LVL __VA_ARGS__);\
|
||||||
|
}\
|
||||||
|
}while(0)
|
||||||
|
#else
|
||||||
|
#define DBG_DAC_LOG_PERD 100
|
||||||
|
#define DBG_8195A_DAC(...)
|
||||||
|
#define DBG_8195A_DAC_LVL(...)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//================ DAC HAL Related Enumeration ==================
|
||||||
|
// DAC Module Selection
|
||||||
|
typedef enum _DAC_MODULE_SEL_ {
|
||||||
|
DAC0_SEL = 0x0,
|
||||||
|
DAC1_SEL = 0x1,
|
||||||
|
}DAC_MODULE_SEL,*PDAC_MODULE_SEL;
|
||||||
|
|
||||||
|
// DAC module status
|
||||||
|
typedef enum _DAC_MODULE_STATUS_ {
|
||||||
|
DAC_DISABLE = 0x0,
|
||||||
|
DAC_ENABLE = 0x1,
|
||||||
|
}DAC_MODULE_STATUS, *PDAC_MODULE_STATUS;
|
||||||
|
|
||||||
|
// DAC Data Rate
|
||||||
|
typedef enum _DAC_DATA_RATE_ {
|
||||||
|
DAC_DATA_RATE_10K = 0x0,
|
||||||
|
DAC_DATA_RATE_250K = 0x1,
|
||||||
|
}DAC_DATA_RATE,*PDAC_DATA_RATE;
|
||||||
|
|
||||||
|
// DAC Data Endian
|
||||||
|
typedef enum _DAC_DATA_ENDIAN_ {
|
||||||
|
DAC_DATA_ENDIAN_LITTLE = 0x0,
|
||||||
|
DAC_DATA_ENDIAN_BIG = 0x1,
|
||||||
|
}DAC_DATA_ENDIAN,*PDAC_DATA_ENDIAN;
|
||||||
|
|
||||||
|
// DAC Debug Select
|
||||||
|
typedef enum _DAC_DEBUG_SEL_ {
|
||||||
|
DAC_DBG_SEL_DISABLE = 0x0,
|
||||||
|
DAC_DBG_SEL_ENABLE = 0x1,
|
||||||
|
}DAC_DEBUG_SEL,*PDAC_DEBUG_SEL;
|
||||||
|
|
||||||
|
// DAC Dsc Debug Select
|
||||||
|
typedef enum _DAC_DSC_DEBUG_SEL_ {
|
||||||
|
DAC_DSC_DBG_SEL_DISABLE = 0x0,
|
||||||
|
DAC_DSC_DBG_SEL_ENABLE = 0x1,
|
||||||
|
}DAC_DSC_DEBUG_SEL,*PDAC_DSC_DEBUG_SEL;
|
||||||
|
|
||||||
|
|
||||||
|
// DAC Bypass Dsc Debug Select
|
||||||
|
typedef enum _DAC_BYPASS_DSC_SEL_ {
|
||||||
|
DAC_BYPASS_DSC_SEL_DISABLE = 0x0,
|
||||||
|
DAC_BYPASS_DSC_SEL_ENABLE = 0x1,
|
||||||
|
}DAC_BYPASS_DSC_SEL,*PDAC_BYPASS_DSC_SEL;
|
||||||
|
|
||||||
|
// DAC feature status
|
||||||
|
typedef enum _DAC_FEATURE_STATUS_{
|
||||||
|
DAC_FEATURE_DISABLED = 0,
|
||||||
|
DAC_FEATURE_ENABLED = 1,
|
||||||
|
}DAC_FEATURE_STATUS,*PDAC_FEATURE_STATUS;
|
||||||
|
|
||||||
|
// DAC operation type
|
||||||
|
typedef enum _DAC_OP_TYPE_ {
|
||||||
|
DAC_POLL_TYPE = 0x0,
|
||||||
|
DAC_DMA_TYPE = 0x1,
|
||||||
|
DAC_INTR_TYPE = 0x2,
|
||||||
|
}DAC_OP_TYPE, *PDAC_OP_TYPE;
|
||||||
|
|
||||||
|
// DAC device status
|
||||||
|
typedef enum _DAC_Device_STATUS_ {
|
||||||
|
DAC_STS_UNINITIAL = 0x00,
|
||||||
|
DAC_STS_INITIALIZED = 0x01,
|
||||||
|
DAC_STS_IDLE = 0x02,
|
||||||
|
|
||||||
|
DAC_STS_TX_READY = 0x03,
|
||||||
|
DAC_STS_TX_ING = 0x04,
|
||||||
|
|
||||||
|
DAC_STS_RX_READY = 0x05,
|
||||||
|
DAC_STS_RX_ING = 0x06,
|
||||||
|
|
||||||
|
DAC_STS_ERROR = 0x07,
|
||||||
|
}DAC_Device_STATUS, *PDAC_Device_STATUS;
|
||||||
|
|
||||||
|
//DAC device error type
|
||||||
|
typedef enum _DAC_ERR_TYPE_ {
|
||||||
|
DAC_ERR_FIFO_OVER = 0x04, //DAC FIFO overflow.
|
||||||
|
DAC_ERR_FIFO_STOP = 0x08, //DAC FIFO is completely empty, and it will be stopped automatically.
|
||||||
|
DAC_ERR_FIFO_WRFAIL = 0x10, //When DAC is NOT enabled, a write operation attempts to access DAC register.
|
||||||
|
DAC_ERR_FIFO_DSC_OVER0 = 0x20,
|
||||||
|
DAC_ERR_FIFO_DSC_OVER1 = 0x40,
|
||||||
|
}DAC_ERR_TYPE, *PDAC_ERR_TYPE;
|
||||||
|
|
||||||
|
// DAC data input method
|
||||||
|
typedef enum _DAC_INPUT_TYPE_{
|
||||||
|
DAC_INPUT_SINGLE_WR = 0x1, //DAC input by using single register write
|
||||||
|
DAC_INPUT_DMA_ONEBLK = 0x2, //DAC input by using single DMA block
|
||||||
|
DAC_INPUT_DMA_LLP = 0x3, //DAC input by using DMA linked list mode
|
||||||
|
}DAC_INPUT_TYPE,*PDAC_INPUT_TYPE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//======================================================
|
||||||
|
// DAC HAL initial data structure
|
||||||
|
typedef struct _HAL_DAC_INIT_DAT_ {
|
||||||
|
u8 DACIdx; //DAC index used
|
||||||
|
u8 DACEn; //DAC module enable
|
||||||
|
u8 DACDataRate; //DAC data rate, 1'b0:10KHz, 1'b1:250KHz
|
||||||
|
u8 DACEndian; //DAC endian selection,
|
||||||
|
//but actually it's for 32-bit DAC data swap control
|
||||||
|
//1'b0: no swap,
|
||||||
|
//1'b1: swap the upper 16-bit and the lower 16-bit
|
||||||
|
u8 DACFilterSet; //DAC filter settle
|
||||||
|
u8 DACBurstSz; //DAC burst size
|
||||||
|
u8 DACDbgSel; //DAC debug sel
|
||||||
|
u8 DACDscDbgSel; //DAC debug dsc sel
|
||||||
|
|
||||||
|
u8 DACBPDsc; //DAC bypass delta sigma for loopback
|
||||||
|
u8 DACDeltaSig; //DAC bypass value of delta sigma
|
||||||
|
u16 RSVD1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
u32 *DACData; //DAC data pointer
|
||||||
|
u32 DACPWCtrl; //DAC0 and DAC1 power control
|
||||||
|
u32 DACAnaCtrl0; //DAC anapar_da control 0
|
||||||
|
u32 DACAnaCtrl1; //DAC anapar_da control 1
|
||||||
|
u32 DACIntrMSK; //DAC Interrupt Mask
|
||||||
|
}HAL_DAC_INIT_DAT,*PHAL_DAC_INIT_DAT;
|
||||||
|
|
||||||
|
// DAC HAL Operations
|
||||||
|
typedef struct _HAL_DAC_OP_ {
|
||||||
|
RTK_STATUS (*HalDACInit) (VOID *Data); //HAL DAC initialization
|
||||||
|
RTK_STATUS (*HalDACDeInit) (VOID *Data); //HAL DAC de-initialization
|
||||||
|
RTK_STATUS (*HalDACEnable) (VOID *Data); //HAL DAC de-initialization
|
||||||
|
u8 (*HalDACSend) (VOID *Data); //HAL DAC receive
|
||||||
|
RTK_STATUS (*HalDACIntrCtrl) (VOID *Data); //HAL DAC interrupt control
|
||||||
|
u32 (*HalDACReadReg) (VOID *Data, u8 DACReg);//HAL DAC read register
|
||||||
|
}HAL_DAC_OP, *PHAL_DAC_OP;
|
||||||
|
|
||||||
|
// DAC user callback adapter
|
||||||
|
typedef struct _SAL_DAC_USERCB_ADPT_ {
|
||||||
|
VOID (*USERCB) (VOID *Data);
|
||||||
|
u32 USERData;
|
||||||
|
}SAL_DAC_USERCB_ADPT, *PSAL_DAC_USERCB_ADPT;
|
||||||
|
|
||||||
|
// DAC user callback structure
|
||||||
|
typedef struct _SAL_DAC_USER_CB_ {
|
||||||
|
PSAL_DAC_USERCB_ADPT pTXCB; //DAC Transmit Callback
|
||||||
|
PSAL_DAC_USERCB_ADPT pTXCCB; //DAC Transmit Complete Callback
|
||||||
|
PSAL_DAC_USERCB_ADPT pRXCB; //DAC Receive Callback
|
||||||
|
PSAL_DAC_USERCB_ADPT pRXCCB; //DAC Receive Complete Callback
|
||||||
|
PSAL_DAC_USERCB_ADPT pRDREQCB; //DAC Read Request Callback
|
||||||
|
PSAL_DAC_USERCB_ADPT pERRCB; //DAC Error Callback
|
||||||
|
PSAL_DAC_USERCB_ADPT pDMATXCB; //DAC DMA Transmit Callback
|
||||||
|
PSAL_DAC_USERCB_ADPT pDMATXCCB; //DAC DMA Transmit Complete Callback
|
||||||
|
PSAL_DAC_USERCB_ADPT pDMARXCB; //DAC DMA Receive Callback
|
||||||
|
PSAL_DAC_USERCB_ADPT pDMARXCCB; //DAC DMA Receive Complete Callback
|
||||||
|
}SAL_DAC_USER_CB, *PSAL_DAC_USER_CB;
|
||||||
|
|
||||||
|
// DAC Transmit Buffer
|
||||||
|
typedef struct _SAL_DAC_TRANSFER_BUF_ {
|
||||||
|
u32 DataLen; //DAC Transmfer Length
|
||||||
|
u32 *pDataBuf; //DAC Transfer Buffer Pointer
|
||||||
|
u32 RSVD; //
|
||||||
|
}SAL_DAC_TRANSFER_BUF,*PSAL_DAC_TRANSFER_BUF;
|
||||||
|
|
||||||
|
typedef struct _SAL_DAC_DMA_USER_DEF_ {
|
||||||
|
|
||||||
|
u8 TxDatSrcWdth;
|
||||||
|
u8 TxDatDstWdth;
|
||||||
|
u8 TxDatSrcBstSz;
|
||||||
|
u8 TxDatDstBstSz;
|
||||||
|
|
||||||
|
u8 TxChNo;
|
||||||
|
u8 LlpCtrl;
|
||||||
|
u16 RSVD0;
|
||||||
|
|
||||||
|
u32 MaxMultiBlk;
|
||||||
|
u32 pLlix;
|
||||||
|
u32 pBlockSizeList;
|
||||||
|
}SAL_DAC_DMA_USER_DEF, *PSAL_DAC_DMA_USER_DEF;
|
||||||
|
|
||||||
|
// Software API Level DAC Handler
|
||||||
|
typedef struct _SAL_DAC_HND_ {
|
||||||
|
u8 DevNum; //DAC device number
|
||||||
|
u8 PinMux; //DAC pin mux seletion
|
||||||
|
u8 OpType; //DAC operation type selection
|
||||||
|
volatile u8 DevSts; //DAC device status
|
||||||
|
|
||||||
|
u8 DACInType; //DAC input type
|
||||||
|
u8 RSVD0;
|
||||||
|
u16 RSVD1;
|
||||||
|
|
||||||
|
u32 DACExd; //DAC extended options:
|
||||||
|
//bit 0: example
|
||||||
|
//bit 31~bit 1: Reserved
|
||||||
|
u32 ErrType; //
|
||||||
|
u32 TimeOut; //DAC IO Timeout count
|
||||||
|
|
||||||
|
PHAL_DAC_INIT_DAT pInitDat; //Pointer to DAC initial data struct
|
||||||
|
PSAL_DAC_TRANSFER_BUF pTXBuf; //Pointer to DAC TX buffer
|
||||||
|
PSAL_DAC_USER_CB pUserCB; //Pointer to DAC User Callback
|
||||||
|
PSAL_DAC_DMA_USER_DEF pDMAConf; //Pointer to DAC User Define DMA Config
|
||||||
|
}SAL_DAC_HND, *PSAL_DAC_HND;
|
||||||
|
|
||||||
|
// DAC SAL handle private
|
||||||
|
typedef struct _SAL_DAC_HND_PRIV_ {
|
||||||
|
VOID **ppSalDACHnd; //Pointer to SAL_DAC_HND pointer
|
||||||
|
SAL_DAC_HND SalDACHndPriv; //Private SAL_DAC_HND
|
||||||
|
}SAL_DAC_HND_PRIV, *PSAL_DAC_HND_PRIV;
|
||||||
|
|
||||||
|
//DAC SAL management adapter
|
||||||
|
typedef struct _SAL_DAC_MNGT_ADPT_ {
|
||||||
|
PSAL_DAC_HND_PRIV pSalHndPriv; //Pointer to SAL_DAC_HND
|
||||||
|
PHAL_DAC_INIT_DAT pHalInitDat; //Pointer to HAL DAC initial data( HAL_I2C_INIT_DAT )
|
||||||
|
PHAL_DAC_OP pHalOp; //Pointer to HAL DAC operation( HAL_DAC_OP )
|
||||||
|
VOID (*pHalOpInit)(VOID*); //Pointer to HAL DAC initialize function
|
||||||
|
PIRQ_HANDLE pIrqHnd; //Pointer to IRQ handler in SAL layer( IRQ_HANDLE )
|
||||||
|
PSAL_DAC_USER_CB pUserCB; //Pointer to SAL user callbacks (SAL_DAC_USER_CB )
|
||||||
|
VOID (*pSalIrqFunc)(VOID*); //Used for SAL DAC interrupt function
|
||||||
|
|
||||||
|
PSAL_DAC_DMA_USER_DEF pDMAConf; //Pointer to DAC User Define DMA config
|
||||||
|
PHAL_GDMA_ADAPTER pHalGdmaAdp;
|
||||||
|
PHAL_GDMA_OP pHalGdmaOp;
|
||||||
|
VOID (*pHalGdmaOpInit)(VOID*); //Pointer to HAL DAC initialize function
|
||||||
|
PIRQ_HANDLE pIrqGdmaHnd;
|
||||||
|
VOID (*pSalDMAIrqFunc)(VOID*); //Used for SAL DAC interrupt function
|
||||||
|
}SAL_DAC_MNGT_ADPT, *PSAL_DAC_MNGT_ADPT;
|
||||||
|
|
||||||
|
|
||||||
|
//================ DAC HAL Function Prototype ===================
|
||||||
|
// DAC HAL inline function
|
||||||
|
// For checking DAC input index valid or not
|
||||||
|
static inline RTK_STATUS
|
||||||
|
RtkDACIdxChk(
|
||||||
|
IN u8 DACIdx
|
||||||
|
)
|
||||||
|
{
|
||||||
|
#if !DAC0_USED
|
||||||
|
if (DACIdx == DAC0_SEL)
|
||||||
|
return _EXIT_FAILURE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !DAC1_USED
|
||||||
|
if (DACIdx == DAC1_SEL)
|
||||||
|
return _EXIT_FAILURE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return _EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID HalDACOpInit(IN VOID *Data);
|
||||||
|
RTK_STATUS RtkDACLoadDefault(IN VOID *Data);
|
||||||
|
RTK_STATUS RtkDACInit(IN VOID *Data);
|
||||||
|
RTK_STATUS RtkDACDeInit(IN VOID *Data);
|
||||||
|
RTK_STATUS RtkDACSend(IN VOID *Data);
|
||||||
|
PSAL_DAC_HND RtkDACGetSalHnd(IN u8 DACIdx);
|
||||||
|
RTK_STATUS RtkDACFreeSalHnd(IN PSAL_DAC_HND pSalDACHND);
|
||||||
|
PSAL_DAC_MNGT_ADPT RtkDACGetMngtAdpt(IN u8 DACIdx);
|
||||||
|
RTK_STATUS RtkDACFreeMngtAdpt(IN PSAL_DAC_MNGT_ADPT pSalDACMngtAdpt);
|
||||||
|
|
||||||
|
#endif
|
107
sdk/component/soc/realtek/8195a/fwlib/hal_diag.h
Normal file
107
sdk/component/soc/realtek/8195a/fwlib/hal_diag.h
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HAL_DIAG_H_
|
||||||
|
#define _HAL_DIAG_H_
|
||||||
|
|
||||||
|
|
||||||
|
//Register offset
|
||||||
|
#define UART_REV_BUF_OFF 0x00
|
||||||
|
#define UART_TRAN_HOLD_OFF 0x00
|
||||||
|
#define UART_DLH_OFF 0x04
|
||||||
|
#define UART_DLL_OFF 0x00
|
||||||
|
#define UART_INTERRUPT_EN_REG_OFF 0x04
|
||||||
|
#define UART_INTERRUPT_IDEN_REG_OFF 0x08
|
||||||
|
#define UART_FIFO_CTL_REG_OFF 0x08
|
||||||
|
#define UART_LINE_CTL_REG_OFF 0x0c
|
||||||
|
#define UART_MODEM_CTL_REG_OFF 0x10
|
||||||
|
#define UART_LINE_STATUS_REG_OFF 0x14
|
||||||
|
#define UART_MODEM_STATUS_REG_OFF 0x18
|
||||||
|
#define UART_FIFO_ACCESS_REG_OFF 0x70
|
||||||
|
#define UART_STATUS_REG_OFF 0x7c
|
||||||
|
#define UART_TFL_OFF 0x80
|
||||||
|
#define UART_RFL_OFF 0x84
|
||||||
|
|
||||||
|
|
||||||
|
//Buad rate
|
||||||
|
#define UART_BAUD_RATE_2400 2400
|
||||||
|
#define UART_BAUD_RATE_4800 4800
|
||||||
|
#define UART_BAUD_RATE_9600 9600
|
||||||
|
#define UART_BAUD_RATE_19200 19200
|
||||||
|
#define UART_BAUD_RATE_38400 38400
|
||||||
|
#define UART_BAUD_RATE_57600 57600
|
||||||
|
#define UART_BAUD_RATE_115200 115200
|
||||||
|
#define UART_BAUD_RATE_921600 921600
|
||||||
|
#define UART_BAUD_RATE_1152000 1152000
|
||||||
|
|
||||||
|
#define UART_PARITY_ENABLE 0x08
|
||||||
|
#define UART_PARITY_DISABLE 0
|
||||||
|
|
||||||
|
#define UART_DATA_LEN_5BIT 0x0
|
||||||
|
#define UART_DATA_LEN_6BIT 0x1
|
||||||
|
#define UART_DATA_LEN_7BIT 0x2
|
||||||
|
#define UART_DATA_LEN_8BIT 0x3
|
||||||
|
|
||||||
|
#define UART_STOP_1BIT 0x0
|
||||||
|
#define UART_STOP_2BIT 0x4
|
||||||
|
|
||||||
|
|
||||||
|
#define HAL_UART_READ32(addr) HAL_READ32(LOG_UART_REG_BASE, addr)
|
||||||
|
#define HAL_UART_WRITE32(addr, value) HAL_WRITE32(LOG_UART_REG_BASE, addr, value)
|
||||||
|
#define HAL_UART_READ16(addr) HAL_READ16(LOG_UART_REG_BASE, addr)
|
||||||
|
#define HAL_UART_WRITE16(addr, value) HAL_WRITE16(LOG_UART_REG_BASE, addr, value)
|
||||||
|
#define HAL_UART_READ8(addr) HAL_READ8(LOG_UART_REG_BASE, addr)
|
||||||
|
#define HAL_UART_WRITE8(addr, value) HAL_WRITE8(LOG_UART_REG_BASE, addr, value)
|
||||||
|
|
||||||
|
typedef struct _LOG_UART_ADAPTER_ {
|
||||||
|
u32 BaudRate;
|
||||||
|
u32 FIFOControl;
|
||||||
|
u32 IntEnReg;
|
||||||
|
u8 Parity;
|
||||||
|
u8 Stop;
|
||||||
|
u8 DataLength;
|
||||||
|
}LOG_UART_ADAPTER, *PLOG_UART_ADAPTER;
|
||||||
|
|
||||||
|
typedef struct _COMMAND_TABLE_ {
|
||||||
|
const u8* cmd;
|
||||||
|
u16 ArgvCnt;
|
||||||
|
u32 (*func)(u16 argc, u8* argv[]);
|
||||||
|
const u8* msg;
|
||||||
|
}COMMAND_TABLE, *PCOMMAND_TABLE;
|
||||||
|
|
||||||
|
//VOID
|
||||||
|
//HalLogUartHandle(void);
|
||||||
|
|
||||||
|
|
||||||
|
extern _LONG_CALL_ROM_ u32
|
||||||
|
HalLogUartInit(
|
||||||
|
IN LOG_UART_ADAPTER UartAdapter
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
extern _LONG_CALL_ROM_ VOID
|
||||||
|
HalSerialPutcRtl8195a(
|
||||||
|
IN u8 c
|
||||||
|
);
|
||||||
|
|
||||||
|
extern _LONG_CALL_ROM_ u8
|
||||||
|
HalSerialGetcRtl8195a(
|
||||||
|
IN BOOL PullMode
|
||||||
|
);
|
||||||
|
|
||||||
|
extern _LONG_CALL_ROM_ u32
|
||||||
|
HalSerialGetIsrEnRegRtl8195a(VOID);
|
||||||
|
|
||||||
|
extern _LONG_CALL_ROM_ VOID
|
||||||
|
HalSerialSetIrqEnRegRtl8195a (
|
||||||
|
IN u32 SetValue
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
#endif//_HAL_DIAG_H_
|
22
sdk/component/soc/realtek/8195a/fwlib/hal_efuse.h
Normal file
22
sdk/component/soc/realtek/8195a/fwlib/hal_efuse.h
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HAL_EFUSE_H_
|
||||||
|
#define _HAL_EFUSE_H_
|
||||||
|
|
||||||
|
_LONG_CALL_ROM_ extern VOID HalEFUSEPowerSwitch8195AROM(IN u8 bWrite, IN u8 PwrState, IN u8 L25OutVoltage);
|
||||||
|
_LONG_CALL_ extern u32 HALEFUSEOneByteReadROM(IN u32 CtrlSetting, IN u16 Addr, OUT u8 *Data, IN u8 L25OutVoltage);
|
||||||
|
_LONG_CALL_ extern u32 HALEFUSEOneByteWriteROM(IN u32 CtrlSetting, IN u16 Addr, IN u8 Data, IN u8 L25OutVoltage);
|
||||||
|
|
||||||
|
#define EFUSERead8 HALEFUSEOneByteReadROM
|
||||||
|
#define EFUSEWrite8 HALEFUSEOneByteWriteROM
|
||||||
|
|
||||||
|
#define L25EOUTVOLTAGE 7
|
||||||
|
#endif
|
||||||
|
|
141
sdk/component/soc/realtek/8195a/fwlib/hal_gdma.h
Normal file
141
sdk/component/soc/realtek/8195a/fwlib/hal_gdma.h
Normal file
|
@ -0,0 +1,141 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HAL_GDMA_H_
|
||||||
|
#define _HAL_GDMA_H_
|
||||||
|
|
||||||
|
#include "rtl8195a_gdma.h"
|
||||||
|
|
||||||
|
typedef struct _GDMA_CH_LLI_ELE_ {
|
||||||
|
u32 Sarx;
|
||||||
|
u32 Darx;
|
||||||
|
u32 Llpx;
|
||||||
|
u32 CtlxLow;
|
||||||
|
u32 CtlxUp;
|
||||||
|
u32 Temp;
|
||||||
|
}GDMA_CH_LLI_ELE, *PGDMA_CH_LLI_ELE;
|
||||||
|
#if 1
|
||||||
|
#if 0
|
||||||
|
typedef struct _GDMA_CH_LLI_ {
|
||||||
|
PGDMA_CH_LLI_ELE pLliEle;
|
||||||
|
PGDMA_CH_LLI pNextLli;
|
||||||
|
}GDMA_CH_LLI, *PGDMA_CH_LLI;
|
||||||
|
|
||||||
|
typedef struct _BLOCK_SIZE_LIST_ {
|
||||||
|
u32 BlockSize;
|
||||||
|
PBLOCK_SIZE_LIST pNextBlockSiz;
|
||||||
|
}BLOCK_SIZE_LIST, *PBLOCK_SIZE_LIST;
|
||||||
|
#else
|
||||||
|
struct GDMA_CH_LLI {
|
||||||
|
PGDMA_CH_LLI_ELE pLliEle;
|
||||||
|
struct GDMA_CH_LLI *pNextLli;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct BLOCK_SIZE_LIST {
|
||||||
|
u32 BlockSize;
|
||||||
|
struct BLOCK_SIZE_LIST *pNextBlockSiz;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
typedef struct _HAL_GDMA_ADAPTER_ {
|
||||||
|
u32 ChSar;
|
||||||
|
u32 ChDar;
|
||||||
|
GDMA_CHANNEL_NUM ChEn;
|
||||||
|
GDMA_CTL_REG GdmaCtl;
|
||||||
|
GDMA_CFG_REG GdmaCfg;
|
||||||
|
u32 PacketLen;
|
||||||
|
u32 BlockLen;
|
||||||
|
u32 MuliBlockCunt;
|
||||||
|
u32 MaxMuliBlock;
|
||||||
|
struct GDMA_CH_LLI *pLlix;
|
||||||
|
struct BLOCK_SIZE_LIST *pBlockSizeList;
|
||||||
|
|
||||||
|
PGDMA_CH_LLI_ELE pLli;
|
||||||
|
u32 NextPlli;
|
||||||
|
u8 TestItem;
|
||||||
|
u8 ChNum;
|
||||||
|
u8 GdmaIndex;
|
||||||
|
u8 IsrCtrl:1;
|
||||||
|
u8 GdmaOnOff:1;
|
||||||
|
u8 Llpctrl:1;
|
||||||
|
u8 Lli0:1;
|
||||||
|
u8 Rsvd4to7:4;
|
||||||
|
u8 GdmaIsrType;
|
||||||
|
}HAL_GDMA_ADAPTER, *PHAL_GDMA_ADAPTER;
|
||||||
|
|
||||||
|
typedef struct _HAL_GDMA_CHNL_ {
|
||||||
|
u8 GdmaIndx;
|
||||||
|
u8 GdmaChnl;
|
||||||
|
u8 IrqNum;
|
||||||
|
u8 Reserved;
|
||||||
|
}HAL_GDMA_CHNL, *PHAL_GDMA_CHNL;
|
||||||
|
|
||||||
|
typedef struct _HAL_GDMA_BLOCK_ {
|
||||||
|
u32 SrcAddr;
|
||||||
|
u32 DstAddr;
|
||||||
|
u32 BlockLength;
|
||||||
|
u32 SrcOffset;
|
||||||
|
u32 DstOffset;
|
||||||
|
}HAL_GDMA_BLOCK, *PHAL_GDMA_BLOCK;
|
||||||
|
|
||||||
|
typedef struct _HAL_GDMA_OP_ {
|
||||||
|
VOID (*HalGdmaOnOff)(VOID *Data);
|
||||||
|
BOOL (*HalGdamChInit)(VOID *Data);
|
||||||
|
BOOL (*HalGdmaChSeting)(VOID *Data);
|
||||||
|
BOOL (*HalGdmaChBlockSeting)(VOID *Data);
|
||||||
|
VOID (*HalGdmaChDis)(VOID *Data);
|
||||||
|
VOID (*HalGdmaChEn)(VOID *Data);
|
||||||
|
VOID (*HalGdmaChIsrEnAndDis) (VOID *Data);
|
||||||
|
u8 (*HalGdmaChIsrClean)(VOID *Data);
|
||||||
|
VOID (*HalGdmaChCleanAutoSrc)(VOID *Data);
|
||||||
|
VOID (*HalGdmaChCleanAutoDst)(VOID *Data);
|
||||||
|
}HAL_GDMA_OP, *PHAL_GDMA_OP;
|
||||||
|
|
||||||
|
typedef struct _HAL_GDMA_OBJ_ {
|
||||||
|
HAL_GDMA_ADAPTER HalGdmaAdapter;
|
||||||
|
IRQ_HANDLE GdmaIrqHandle;
|
||||||
|
volatile GDMA_CH_LLI_ELE GdmaChLli[16];
|
||||||
|
struct GDMA_CH_LLI Lli[16];
|
||||||
|
struct BLOCK_SIZE_LIST BlockSizeList[16];
|
||||||
|
u8 Busy; // is transfering
|
||||||
|
u8 BlockNum;
|
||||||
|
} HAL_GDMA_OBJ, *PHAL_GDMA_OBJ;
|
||||||
|
|
||||||
|
VOID HalGdmaOpInit(IN VOID *Data);
|
||||||
|
VOID HalGdmaOn(PHAL_GDMA_ADAPTER pHalGdmaAdapter);
|
||||||
|
VOID HalGdmaOff(PHAL_GDMA_ADAPTER pHalGdmaAdapter);
|
||||||
|
BOOL HalGdmaChInit(PHAL_GDMA_ADAPTER pHalGdmaAdapter);
|
||||||
|
VOID HalGdmaChDis(PHAL_GDMA_ADAPTER pHalGdmaAdapter);
|
||||||
|
VOID HalGdmaChEn(PHAL_GDMA_ADAPTER pHalGdmaAdapter);
|
||||||
|
BOOL HalGdmaChSeting(PHAL_GDMA_ADAPTER pHalGdmaAdapter);
|
||||||
|
BOOL HalGdmaChBlockSeting(PHAL_GDMA_ADAPTER pHalGdmaAdapter);
|
||||||
|
VOID HalGdmaChIsrEn(PHAL_GDMA_ADAPTER pHalGdmaAdapter);
|
||||||
|
VOID HalGdmaChIsrDis(PHAL_GDMA_ADAPTER pHalGdmaAdapter);
|
||||||
|
u8 HalGdmaChIsrClean(PHAL_GDMA_ADAPTER pHalGdmaAdapter);
|
||||||
|
VOID HalGdmaChCleanAutoSrc(PHAL_GDMA_ADAPTER pHalGdmaAdapter);
|
||||||
|
VOID HalGdmaChCleanAutoDst(PHAL_GDMA_ADAPTER pHalGdmaAdapter);
|
||||||
|
|
||||||
|
extern HAL_Status HalGdmaChnlRegister (u8 GdmaIdx, u8 ChnlNum);
|
||||||
|
extern VOID HalGdmaChnlUnRegister (u8 GdmaIdx, u8 ChnlNum);
|
||||||
|
extern PHAL_GDMA_CHNL HalGdmaChnlAlloc (HAL_GDMA_CHNL *pChnlOption);
|
||||||
|
extern VOID HalGdmaChnlFree (HAL_GDMA_CHNL *pChnl);
|
||||||
|
extern BOOL HalGdmaMemCpyInit(PHAL_GDMA_OBJ pHalGdmaObj);
|
||||||
|
extern VOID HalGdmaMemCpyDeInit(PHAL_GDMA_OBJ pHalGdmaObj);
|
||||||
|
extern VOID* HalGdmaMemCpy(PHAL_GDMA_OBJ pHalGdmaObj, void* pDest, void* pSrc, u32 len);
|
||||||
|
extern VOID HalGdmaMemAggr(PHAL_GDMA_OBJ pHalGdmaObj, PHAL_GDMA_BLOCK pHalGdmaBlock);
|
||||||
|
extern BOOL HalGdmaMemCpyAggrInit(PHAL_GDMA_OBJ pHalGdmaObj);
|
||||||
|
|
||||||
|
extern const HAL_GDMA_OP _HalGdmaOp;
|
||||||
|
extern const HAL_GDMA_CHNL GDMA_Chnl_Option[];
|
||||||
|
extern const HAL_GDMA_CHNL GDMA_Multi_Block_Chnl_Option[];
|
||||||
|
extern const u16 HalGdmaChnlEn[6];
|
||||||
|
|
||||||
|
#endif
|
236
sdk/component/soc/realtek/8195a/fwlib/hal_gpio.h
Normal file
236
sdk/component/soc/realtek/8195a/fwlib/hal_gpio.h
Normal file
|
@ -0,0 +1,236 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HAL_GPIO_H_
|
||||||
|
#define _HAL_GPIO_H_
|
||||||
|
|
||||||
|
#define HAL_GPIO_PIN_INT_MODE 0x80
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
_PORT_A = 0,
|
||||||
|
_PORT_B = 1,
|
||||||
|
_PORT_C = 2,
|
||||||
|
_PORT_D = 3,
|
||||||
|
_PORT_E = 4,
|
||||||
|
_PORT_F = 5,
|
||||||
|
_PORT_G = 6,
|
||||||
|
_PORT_H = 7,
|
||||||
|
_PORT_I = 8,
|
||||||
|
_PORT_J = 9,
|
||||||
|
_PORT_K = 10,
|
||||||
|
|
||||||
|
_PORT_MAX
|
||||||
|
} HAL_GPIO_PORT_NAME;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
_PA_0 = (_PORT_A<<4|0),
|
||||||
|
_PA_1 = (_PORT_A<<4|1),
|
||||||
|
_PA_2 = (_PORT_A<<4|2),
|
||||||
|
_PA_3 = (_PORT_A<<4|3),
|
||||||
|
_PA_4 = (_PORT_A<<4|4),
|
||||||
|
_PA_5 = (_PORT_A<<4|5),
|
||||||
|
_PA_6 = (_PORT_A<<4|6),
|
||||||
|
_PA_7 = (_PORT_A<<4|7),
|
||||||
|
|
||||||
|
_PB_0 = (_PORT_B<<4|0),
|
||||||
|
_PB_1 = (_PORT_B<<4|1),
|
||||||
|
_PB_2 = (_PORT_B<<4|2),
|
||||||
|
_PB_3 = (_PORT_B<<4|3),
|
||||||
|
_PB_4 = (_PORT_B<<4|4),
|
||||||
|
_PB_5 = (_PORT_B<<4|5),
|
||||||
|
_PB_6 = (_PORT_B<<4|6),
|
||||||
|
_PB_7 = (_PORT_B<<4|7),
|
||||||
|
|
||||||
|
_PC_0 = (_PORT_C<<4|0),
|
||||||
|
_PC_1 = (_PORT_C<<4|1),
|
||||||
|
_PC_2 = (_PORT_C<<4|2),
|
||||||
|
_PC_3 = (_PORT_C<<4|3),
|
||||||
|
_PC_4 = (_PORT_C<<4|4),
|
||||||
|
_PC_5 = (_PORT_C<<4|5),
|
||||||
|
_PC_6 = (_PORT_C<<4|6),
|
||||||
|
_PC_7 = (_PORT_C<<4|7),
|
||||||
|
_PC_8 = (_PORT_C<<4|8),
|
||||||
|
_PC_9 = (_PORT_C<<4|9),
|
||||||
|
|
||||||
|
_PD_0 = (_PORT_D<<4|0),
|
||||||
|
_PD_1 = (_PORT_D<<4|1),
|
||||||
|
_PD_2 = (_PORT_D<<4|2),
|
||||||
|
_PD_3 = (_PORT_D<<4|3),
|
||||||
|
_PD_4 = (_PORT_D<<4|4),
|
||||||
|
_PD_5 = (_PORT_D<<4|5),
|
||||||
|
_PD_6 = (_PORT_D<<4|6),
|
||||||
|
_PD_7 = (_PORT_D<<4|7),
|
||||||
|
_PD_8 = (_PORT_D<<4|8),
|
||||||
|
_PD_9 = (_PORT_D<<4|9),
|
||||||
|
|
||||||
|
_PE_0 = (_PORT_E<<4|0),
|
||||||
|
_PE_1 = (_PORT_E<<4|1),
|
||||||
|
_PE_2 = (_PORT_E<<4|2),
|
||||||
|
_PE_3 = (_PORT_E<<4|3),
|
||||||
|
_PE_4 = (_PORT_E<<4|4),
|
||||||
|
_PE_5 = (_PORT_E<<4|5),
|
||||||
|
_PE_6 = (_PORT_E<<4|6),
|
||||||
|
_PE_7 = (_PORT_E<<4|7),
|
||||||
|
_PE_8 = (_PORT_E<<4|8),
|
||||||
|
_PE_9 = (_PORT_E<<4|9),
|
||||||
|
_PE_A = (_PORT_E<<4|10),
|
||||||
|
|
||||||
|
_PF_0 = (_PORT_F<<4|0),
|
||||||
|
_PF_1 = (_PORT_F<<4|1),
|
||||||
|
_PF_2 = (_PORT_F<<4|2),
|
||||||
|
_PF_3 = (_PORT_F<<4|3),
|
||||||
|
_PF_4 = (_PORT_F<<4|4),
|
||||||
|
_PF_5 = (_PORT_F<<4|5),
|
||||||
|
// _PF_6 = (_PORT_F<<4|6),
|
||||||
|
// _PF_7 = (_PORT_F<<4|7),
|
||||||
|
|
||||||
|
_PG_0 = (_PORT_G<<4|0),
|
||||||
|
_PG_1 = (_PORT_G<<4|1),
|
||||||
|
_PG_2 = (_PORT_G<<4|2),
|
||||||
|
_PG_3 = (_PORT_G<<4|3),
|
||||||
|
_PG_4 = (_PORT_G<<4|4),
|
||||||
|
_PG_5 = (_PORT_G<<4|5),
|
||||||
|
_PG_6 = (_PORT_G<<4|6),
|
||||||
|
_PG_7 = (_PORT_G<<4|7),
|
||||||
|
|
||||||
|
_PH_0 = (_PORT_H<<4|0),
|
||||||
|
_PH_1 = (_PORT_H<<4|1),
|
||||||
|
_PH_2 = (_PORT_H<<4|2),
|
||||||
|
_PH_3 = (_PORT_H<<4|3),
|
||||||
|
_PH_4 = (_PORT_H<<4|4),
|
||||||
|
_PH_5 = (_PORT_H<<4|5),
|
||||||
|
_PH_6 = (_PORT_H<<4|6),
|
||||||
|
_PH_7 = (_PORT_H<<4|7),
|
||||||
|
|
||||||
|
_PI_0 = (_PORT_I<<4|0),
|
||||||
|
_PI_1 = (_PORT_I<<4|1),
|
||||||
|
_PI_2 = (_PORT_I<<4|2),
|
||||||
|
_PI_3 = (_PORT_I<<4|3),
|
||||||
|
_PI_4 = (_PORT_I<<4|4),
|
||||||
|
_PI_5 = (_PORT_I<<4|5),
|
||||||
|
_PI_6 = (_PORT_I<<4|6),
|
||||||
|
_PI_7 = (_PORT_I<<4|7),
|
||||||
|
|
||||||
|
_PJ_0 = (_PORT_J<<4|0),
|
||||||
|
_PJ_1 = (_PORT_J<<4|1),
|
||||||
|
_PJ_2 = (_PORT_J<<4|2),
|
||||||
|
_PJ_3 = (_PORT_J<<4|3),
|
||||||
|
_PJ_4 = (_PORT_J<<4|4),
|
||||||
|
_PJ_5 = (_PORT_J<<4|5),
|
||||||
|
_PJ_6 = (_PORT_J<<4|6),
|
||||||
|
// _PJ_7 = (_PORT_J<<4|7),
|
||||||
|
|
||||||
|
_PK_0 = (_PORT_K<<4|0),
|
||||||
|
_PK_1 = (_PORT_K<<4|1),
|
||||||
|
_PK_2 = (_PORT_K<<4|2),
|
||||||
|
_PK_3 = (_PORT_K<<4|3),
|
||||||
|
_PK_4 = (_PORT_K<<4|4),
|
||||||
|
_PK_5 = (_PORT_K<<4|5),
|
||||||
|
_PK_6 = (_PORT_K<<4|6),
|
||||||
|
// _PK_7 = (_PORT_K<<4|7),
|
||||||
|
|
||||||
|
// Not connected
|
||||||
|
_PIN_NC = (int)0xFFFFFFFF
|
||||||
|
} HAL_PIN_NAME;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
GPIO_PIN_LOW = 0,
|
||||||
|
GPIO_PIN_HIGH = 1,
|
||||||
|
GPIO_PIN_ERR = 2 // read Pin error
|
||||||
|
} HAL_GPIO_PIN_STATE;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DIN_PULL_NONE = 0, //floating or high impedance ?
|
||||||
|
DIN_PULL_LOW = 1,
|
||||||
|
DIN_PULL_HIGH = 2,
|
||||||
|
|
||||||
|
DOUT_PUSH_PULL = 3,
|
||||||
|
DOUT_OPEN_DRAIN = 4,
|
||||||
|
|
||||||
|
INT_LOW = (5|HAL_GPIO_PIN_INT_MODE), // Interrupt Low level trigger
|
||||||
|
INT_HIGH = (6|HAL_GPIO_PIN_INT_MODE), // Interrupt High level trigger
|
||||||
|
INT_FALLING = (7|HAL_GPIO_PIN_INT_MODE), // Interrupt Falling edge trigger
|
||||||
|
INT_RISING = (8|HAL_GPIO_PIN_INT_MODE) // Interrupt Rising edge trigger
|
||||||
|
} HAL_GPIO_PIN_MODE;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
GPIO_PORT_A = 0,
|
||||||
|
GPIO_PORT_B = 1,
|
||||||
|
GPIO_PORT_C = 2,
|
||||||
|
GPIO_PORT_D = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
hal_PullNone = 0,
|
||||||
|
hal_PullUp = 1,
|
||||||
|
hal_PullDown = 2,
|
||||||
|
hal_OpenDrain = 3,
|
||||||
|
hal_PullDefault = hal_PullNone
|
||||||
|
} HAL_PinMode;
|
||||||
|
|
||||||
|
typedef struct _HAL_GPIO_PORT_ {
|
||||||
|
u32 out_data; // to write the GPIO port
|
||||||
|
u32 in_data; // to read the GPIO port
|
||||||
|
u32 dir; // config each pin direction
|
||||||
|
}HAL_GPIO_PORT, *PHAL_GPIO_PORT;
|
||||||
|
|
||||||
|
#define HAL_GPIO_PIN_NAME(port,pin) (((port)<<5)|(pin))
|
||||||
|
#define HAL_GPIO_GET_PORT_BY_NAME(x) ((x>>5) & 0x03)
|
||||||
|
#define HAL_GPIO_GET_PIN_BY_NAME(x) (x & 0x1f)
|
||||||
|
|
||||||
|
typedef struct _HAL_GPIO_PIN_ {
|
||||||
|
HAL_GPIO_PIN_MODE pin_mode;
|
||||||
|
u32 pin_name; // Pin: [7:5]: port number, [4:0]: pin number
|
||||||
|
}HAL_GPIO_PIN, *PHAL_GPIO_PIN;
|
||||||
|
|
||||||
|
typedef struct _HAL_GPIO_OP_ {
|
||||||
|
#if defined(__ICCARM__)
|
||||||
|
void* dummy;
|
||||||
|
#endif
|
||||||
|
}HAL_GPIO_OP, *PHAL_GPIO_OP;
|
||||||
|
|
||||||
|
typedef void (*GPIO_IRQ_FUN)(VOID *Data, u32 Id);
|
||||||
|
typedef void (*GPIO_USER_IRQ_FUN)(u32 Id);
|
||||||
|
|
||||||
|
typedef struct _HAL_GPIO_ADAPTER_ {
|
||||||
|
IRQ_HANDLE IrqHandle; // GPIO HAL IRQ Handle
|
||||||
|
GPIO_USER_IRQ_FUN UserIrqHandler; // GPIO IRQ Handler
|
||||||
|
GPIO_IRQ_FUN PortA_IrqHandler[32]; // The interrupt handler triggered by Port A[x]
|
||||||
|
VOID *PortA_IrqData[32];
|
||||||
|
VOID (*EnterCritical)(void);
|
||||||
|
VOID (*ExitCritical)(void);
|
||||||
|
u32 Local_Gpio_Dir[3]; // to record direction setting: 0- IN, 1- Out
|
||||||
|
u8 Gpio_Func_En; // Is GPIO HW function enabled ?
|
||||||
|
u8 Locked;
|
||||||
|
}HAL_GPIO_ADAPTER, *PHAL_GPIO_ADAPTER;
|
||||||
|
|
||||||
|
u32
|
||||||
|
HAL_GPIO_GetPinName(
|
||||||
|
u32 chip_pin
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HAL_GPIO_PullCtrl(
|
||||||
|
u32 pin,
|
||||||
|
u32 mode
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HAL_GPIO_Init(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HAL_GPIO_Irq_Init(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif // end of "#define _HAL_GPIO_H_"
|
||||||
|
|
585
sdk/component/soc/realtek/8195a/fwlib/hal_i2c.h
Normal file
585
sdk/component/soc/realtek/8195a/fwlib/hal_i2c.h
Normal file
|
@ -0,0 +1,585 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HAL_I2C_H_ //#ifndef _HAL_I2C_H_
|
||||||
|
#define _HAL_I2C_H_
|
||||||
|
|
||||||
|
#include "rtl8195a_i2c.h"
|
||||||
|
#include "hal_gdma.h"
|
||||||
|
|
||||||
|
//================= I2C CONFIGURATION START ==================
|
||||||
|
// I2C SAL User Configuration Flags
|
||||||
|
|
||||||
|
// I2C SAL operation types
|
||||||
|
#define I2C_POLL_OP_TYPE 1
|
||||||
|
#define I2C_INTR_OP_TYPE 1
|
||||||
|
#define I2C_DMA_OP_TYPE 1
|
||||||
|
|
||||||
|
// I2C supports user register address
|
||||||
|
#define I2C_USER_REG_ADDR 1 //I2C User specific register address by using
|
||||||
|
//the first I2C data as the register
|
||||||
|
//address
|
||||||
|
|
||||||
|
// I2C SAL used module. Please set the I2C module flag to 1 to enable the related
|
||||||
|
// I2C module functions.
|
||||||
|
#define I2C0_USED 1
|
||||||
|
#define I2C1_USED 1
|
||||||
|
#define I2C2_USED 1
|
||||||
|
#define I2C3_USED 1
|
||||||
|
//================= I2C CONFIGURATION END ===================
|
||||||
|
|
||||||
|
|
||||||
|
//================= I2C HAL START ==========================
|
||||||
|
// I2C debug output
|
||||||
|
#define I2C_PREFIX "RTL8195A[i2c]: "
|
||||||
|
#define I2C_PREFIX_LVL " [i2c_DBG]: "
|
||||||
|
|
||||||
|
typedef enum _I2C_DBG_LVL_ {
|
||||||
|
HAL_I2C_LVL = 0x01,
|
||||||
|
SAL_I2C_LVL = 0x02,
|
||||||
|
VERI_I2C_LVL = 0x03,
|
||||||
|
}I2C_DBG_LVL,*PI2C_DBG_LVL;
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_LOG
|
||||||
|
#ifdef CONFIG_DEBUG_LOG_I2C_HAL
|
||||||
|
#define DBG_I2C_LOG_PERD 100
|
||||||
|
|
||||||
|
#define I2CDBGLVL 0xFF
|
||||||
|
#define DBG_8195A_I2C(...) do{ \
|
||||||
|
_DbgDump("\r"I2C_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define DBG_8195A_I2C_LVL(LVL,...) do{\
|
||||||
|
if (LVL&I2CDBGLVL){\
|
||||||
|
_DbgDump("\r"I2C_PREFIX_LVL __VA_ARGS__);\
|
||||||
|
}\
|
||||||
|
}while(0)
|
||||||
|
#else
|
||||||
|
#define DBG_I2C_LOG_PERD 100
|
||||||
|
#define DBG_8195A_I2C(...)
|
||||||
|
#define DBG_8195A_I2C_LVL(...)
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define DBG_I2C_LOG_PERD 100
|
||||||
|
#define DBG_8195A_I2C(...)
|
||||||
|
#define DBG_8195A_I2C_LVL(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//======================================================
|
||||||
|
// I2C HAL related enumeration
|
||||||
|
// I2C Module Selection
|
||||||
|
typedef enum _I2C_MODULE_SEL_ {
|
||||||
|
I2C0_SEL = 0x0,
|
||||||
|
I2C1_SEL = 0x1,
|
||||||
|
I2C2_SEL = 0x2,
|
||||||
|
I2C3_SEL = 0x3,
|
||||||
|
}I2C_MODULE_SEL,*PI2C_MODULE_SEL;
|
||||||
|
|
||||||
|
// I2C HAL initial data structure
|
||||||
|
typedef struct _HAL_I2C_INIT_DAT_ {
|
||||||
|
u8 I2CIdx; //I2C index used
|
||||||
|
u8 I2CEn; //I2C module enable
|
||||||
|
u8 I2CMaster; //Master or Slave mode
|
||||||
|
u8 I2CAddrMod; //I2C addressing mode(7-bit, 10-bit)
|
||||||
|
|
||||||
|
u8 I2CSpdMod; //I2C speed mode(Standard, Fast, High)
|
||||||
|
u8 I2CSetup; //I2C SDA setup time
|
||||||
|
u8 I2CRXTL; //I2C RX FIFO Threshold
|
||||||
|
u8 I2CTXTL; //I2C TX FIFO Threshold
|
||||||
|
|
||||||
|
u8 I2CBusLd; //I2C bus load (pf) for high speed mode
|
||||||
|
u8 I2CReSTR; //I2C restart support
|
||||||
|
u8 I2CGC; //I2C general support
|
||||||
|
u8 I2CStartB; //I2C start byte support
|
||||||
|
|
||||||
|
u8 I2CSlvNoAck; //I2C slave no ack support
|
||||||
|
u8 I2CDMACtrl; //I2C DMA feature support
|
||||||
|
u8 I2CCmd; //I2C Command
|
||||||
|
u8 I2CDataLen; //I2C Data Length
|
||||||
|
|
||||||
|
u8 I2CSlvAckGC; //I2C slave acks to General Call
|
||||||
|
u8 I2CStop; //I2C issues STOP bit or not
|
||||||
|
u16 RSVD0;
|
||||||
|
|
||||||
|
u8 *I2CRWData; //I2C Read/Write data pointer
|
||||||
|
|
||||||
|
u16 I2CIntrMSK; //I2C Interrupt Mask
|
||||||
|
u16 I2CIntrClr; //I2C Interrupt register to clear
|
||||||
|
|
||||||
|
u16 I2CAckAddr; //I2C target address in I2C Master mode,
|
||||||
|
//ack address in I2C Slave mode
|
||||||
|
u16 I2CSdaHd; //I2C SDA hold time
|
||||||
|
|
||||||
|
u32 I2CClk; //I2C bus clock (in kHz)
|
||||||
|
|
||||||
|
u8 I2CTxDMARqLv; //I2C TX DMA Empty Level
|
||||||
|
u8 I2CRxDMARqLv; //I2C RX DMA Full Level
|
||||||
|
u16 RSVD1; //Reserved
|
||||||
|
}HAL_I2C_INIT_DAT,*PHAL_I2C_INIT_DAT;
|
||||||
|
|
||||||
|
// I2C HAL Operations
|
||||||
|
typedef struct _HAL_I2C_OP_ {
|
||||||
|
HAL_Status (*HalI2CInit) (VOID *Data); //HAL I2C initialization
|
||||||
|
HAL_Status (*HalI2CDeInit) (VOID *Data); //HAL I2C de-initialization
|
||||||
|
HAL_Status (*HalI2CSend) (VOID *Data); //HAL I2C send
|
||||||
|
u8 (*HalI2CReceive) (VOID *Data); //HAL I2C receive
|
||||||
|
HAL_Status (*HalI2CEnable) (VOID *Data); //HAL I2C enable module
|
||||||
|
HAL_Status (*HalI2CIntrCtrl) (VOID *Data); //HAL I2C interrupt control
|
||||||
|
u32 (*HalI2CReadReg) (VOID *Data, u8 I2CReg);//HAL I2C read register
|
||||||
|
HAL_Status (*HalI2CWriteReg) (VOID *Data, u8 I2CReg, u32 RegVal);//HAL I2C write register
|
||||||
|
HAL_Status (*HalI2CSetCLK) (VOID *Data); //HAL I2C set bus clock
|
||||||
|
HAL_Status (*HalI2CMassSend) (VOID *Data); //HAL I2C mass send
|
||||||
|
HAL_Status (*HalI2CClrIntr) (VOID *Data); //HAL I2C clear interrupts
|
||||||
|
HAL_Status (*HalI2CClrAllIntr) (VOID *Data); //HAL I2C clear all interrupts
|
||||||
|
HAL_Status (*HalI2CDMACtrl) (VOID *Data); //HAL I2C DMA control
|
||||||
|
}HAL_I2C_OP, *PHAL_I2C_OP;
|
||||||
|
//================= I2C HAL END ===========================
|
||||||
|
|
||||||
|
|
||||||
|
//================= I2C SAL START ==========================
|
||||||
|
//I2C SAL Macros
|
||||||
|
|
||||||
|
//======================================================
|
||||||
|
// I2C SAL related enumerations
|
||||||
|
// I2C Extend Features
|
||||||
|
typedef enum _I2C_EXD_SUPPORT_{
|
||||||
|
I2C_EXD_RESTART = 0x1, //BIT_0, RESTART bit
|
||||||
|
I2C_EXD_GENCALL = 0x2, //BIT_1, Master generates General Call. All "send" operations generate General Call addresss
|
||||||
|
I2C_EXD_STARTB = 0x4, //BIT_2, Using START BYTE, instead of START Bit
|
||||||
|
I2C_EXD_SLVNOACK = 0x8, //BIT_3, Slave no ack to master
|
||||||
|
I2C_EXD_BUS400PF = 0x10, //BIT_4, I2C bus loading is 400pf
|
||||||
|
I2C_EXD_SLVACKGC = 0x20, //BIT_5, Slave acks to a General Call
|
||||||
|
I2C_EXD_USER_REG = 0x40, //BIT_6, Using User Register Address
|
||||||
|
I2C_EXD_USER_TWOB = 0x80, //BIT_7, User Register Address is 2-byte
|
||||||
|
I2C_EXD_MTR_ADDR_RTY= 0x100, //BIT_8, Master retries to send start condition and Slave address when the slave doesn't ack
|
||||||
|
// the address.
|
||||||
|
I2C_EXD_MTR_ADDR_UPD= 0x200, //BIT_9, Master dynamically updates slave address
|
||||||
|
I2C_EXD_MTR_HOLD_BUS= 0x400, //BIT_10, Master doesn't generate STOP when the FIFO is empty. This would make Master hold
|
||||||
|
// the bus.
|
||||||
|
}I2C_EXD_SUPPORT,*PI2C_EXD_SUPPORT;
|
||||||
|
|
||||||
|
// I2C operation type
|
||||||
|
typedef enum _I2C_OP_TYPE_ {
|
||||||
|
I2C_POLL_TYPE = 0x0,
|
||||||
|
I2C_DMA_TYPE = 0x1,
|
||||||
|
I2C_INTR_TYPE = 0x2,
|
||||||
|
}I2C_OP_TYPE, *PI2C_OP_TYPE;
|
||||||
|
|
||||||
|
// I2C pinmux selection
|
||||||
|
typedef enum _I2C_PINMUX_ {
|
||||||
|
I2C_PIN_S0 = 0x0,
|
||||||
|
I2C_PIN_S1 = 0x1,
|
||||||
|
I2C_PIN_S2 = 0x2,
|
||||||
|
I2C_PIN_S3 = 0x3, //Only valid for I2C0 and I2C3
|
||||||
|
}I2C_PINMUX, *PI2C_PINMUX;
|
||||||
|
|
||||||
|
// I2C module status
|
||||||
|
typedef enum _I2C_MODULE_STATUS_ {
|
||||||
|
I2C_DISABLE = 0x0,
|
||||||
|
I2C_ENABLE = 0x1,
|
||||||
|
}I2C_MODULE_STATUS, *PI2C_MODULE_STATUS;
|
||||||
|
|
||||||
|
// I2C device status
|
||||||
|
typedef enum _I2C_Device_STATUS_ {
|
||||||
|
I2C_STS_UNINITIAL = 0x00,
|
||||||
|
I2C_STS_INITIALIZED = 0x01,
|
||||||
|
I2C_STS_IDLE = 0x02,
|
||||||
|
|
||||||
|
I2C_STS_TX_READY = 0x03,
|
||||||
|
I2C_STS_TX_ING = 0x04,
|
||||||
|
|
||||||
|
I2C_STS_RX_READY = 0x05,
|
||||||
|
I2C_STS_RX_ING = 0x06,
|
||||||
|
|
||||||
|
I2C_STS_ERROR = 0x10,
|
||||||
|
I2C_STS_TIMEOUT = 0x11,
|
||||||
|
}I2C_Device_STATUS, *PI2C_Device_STATUS;
|
||||||
|
|
||||||
|
// I2C feature status
|
||||||
|
typedef enum _I2C_FEATURE_STATUS_{
|
||||||
|
I2C_FEATURE_DISABLED = 0,
|
||||||
|
I2C_FEATURE_ENABLED = 1,
|
||||||
|
}I2C_FEATURE_STATUS,*PI2C_FEATURE_STATUS;
|
||||||
|
|
||||||
|
// I2C device mode
|
||||||
|
typedef enum _I2C_DEV_MODE_ {
|
||||||
|
I2C_SLAVE_MODE = 0x0,
|
||||||
|
I2C_MASTER_MODE = 0x1,
|
||||||
|
}I2C_DEV_MODE, *PI2C_DEV_MODE;
|
||||||
|
|
||||||
|
// I2C Bus Transmit/Receive
|
||||||
|
typedef enum _I2C_DIRECTION_ {
|
||||||
|
I2C_ONLY_TX = 0x1,
|
||||||
|
I2C_ONLY_RX = 0x2,
|
||||||
|
I2C_TXRX = 0x3,
|
||||||
|
}I2C_DIRECTION, *PI2C_DIRECTION;
|
||||||
|
|
||||||
|
//I2C DMA module number
|
||||||
|
typedef enum _I2C_DMA_MODULE_SEL_ {
|
||||||
|
I2C_DMA_MODULE_0 = 0x0,
|
||||||
|
I2C_DMA_MODULE_1 = 0x1
|
||||||
|
}I2C_DMA_MODULE_SEL, *PI2C_DMA_MODULE_SEL;
|
||||||
|
|
||||||
|
// I2C0 DMA peripheral number
|
||||||
|
typedef enum _I2C0_DMA_PERI_NUM_ {
|
||||||
|
I2C0_DMA_TX_NUM = 0x8,
|
||||||
|
I2C0_DMA_RX_NUM = 0x9,
|
||||||
|
}I2C0_DMA_PERI_NUM,*PI2C0_DMA_PERI_NUM;
|
||||||
|
|
||||||
|
// I2C1 DMA peripheral number
|
||||||
|
typedef enum _I2C1_DMA_PERI_NUM_ {
|
||||||
|
I2C1_DMA_TX_NUM = 0xA,
|
||||||
|
I2C1_DMA_RX_NUM = 0xB,
|
||||||
|
}I2C1_DMA_PERI_NUM,*PI2C1_DMA_PERI_NUM;
|
||||||
|
|
||||||
|
// I2C0 DMA module used
|
||||||
|
typedef enum _I2C0_DMA_MODULE_ {
|
||||||
|
I2C0_DMA0 = 0x0,
|
||||||
|
I2C0_DMA1 = 0x1,
|
||||||
|
}I2C0_DMA_MODULE,*PI2C0_DMA_MODULE;
|
||||||
|
|
||||||
|
// I2C0 DMA module used
|
||||||
|
typedef enum _I2C1_DMA_MODULE_ {
|
||||||
|
I2C1_DMA0 = 0x0,
|
||||||
|
I2C1_DMA1 = 0x1,
|
||||||
|
}I2C1_DMA_MODULE,*PI2C1_DMA_MODULE;
|
||||||
|
|
||||||
|
// I2C command type
|
||||||
|
typedef enum _I2C_COMMAND_TYPE_ {
|
||||||
|
I2C_WRITE_CMD = 0x0,
|
||||||
|
I2C_READ_CMD = 0x1,
|
||||||
|
}I2C_COMMAND_TYPE,*PI2C_COMMAND_TYPE;
|
||||||
|
|
||||||
|
// I2C STOP BIT
|
||||||
|
typedef enum _I2C_STOP_TYPE_ {
|
||||||
|
I2C_STOP_DIS = 0x0,
|
||||||
|
I2C_STOP_EN = 0x1,
|
||||||
|
}I2C_STOP_TYPE, *PI2C_STOP_TYPE;
|
||||||
|
|
||||||
|
// I2C error type
|
||||||
|
typedef enum _I2C_ERR_TYPE_ {
|
||||||
|
I2C_ERR_RX_UNDER = 0x01, //I2C RX FIFO Underflow
|
||||||
|
I2C_ERR_RX_OVER = 0x02, //I2C RX FIFO Overflow
|
||||||
|
I2C_ERR_TX_OVER = 0x04, //I2C TX FIFO Overflow
|
||||||
|
I2C_ERR_TX_ABRT = 0x08, //I2C TX terminated
|
||||||
|
I2C_ERR_SLV_TX_NACK = 0x10, //I2C slave transmission terminated by master NACK,
|
||||||
|
//but there are data in slave TX FIFO
|
||||||
|
I2C_ERR_USER_REG_TO = 0x20,
|
||||||
|
|
||||||
|
I2C_ERR_RX_CMD_TO = 0x21,
|
||||||
|
I2C_ERR_RX_FF_TO = 0x22,
|
||||||
|
I2C_ERR_TX_CMD_TO = 0x23,
|
||||||
|
I2C_ERR_TX_FF_TO = 0x24,
|
||||||
|
|
||||||
|
I2C_ERR_TX_ADD_TO = 0x25,
|
||||||
|
I2C_ERR_RX_ADD_TO = 0x26,
|
||||||
|
}I2C_ERR_TYPE, *PI2C_ERR_TYPE;
|
||||||
|
|
||||||
|
// I2C Time Out type
|
||||||
|
typedef enum _I2C_TIMEOUT_TYPE_ {
|
||||||
|
I2C_TIMEOOUT_DISABLE = 0x00,
|
||||||
|
I2C_TIMEOOUT_ENDLESS = 0xFFFFFFFF,
|
||||||
|
}I2C_TIMEOUT_TYPE, *PI2C_TIMEOUT_TYPE;
|
||||||
|
|
||||||
|
//======================================================
|
||||||
|
// SAL I2C related data structures
|
||||||
|
// I2C user callback adapter
|
||||||
|
typedef struct _SAL_I2C_USERCB_ADPT_ {
|
||||||
|
VOID (*USERCB) (VOID *Data);
|
||||||
|
u32 USERData;
|
||||||
|
}SAL_I2C_USERCB_ADPT, *PSAL_I2C_USERCB_ADPT;
|
||||||
|
|
||||||
|
// I2C user callback structure
|
||||||
|
typedef struct _SAL_I2C_USER_CB_ {
|
||||||
|
PSAL_I2C_USERCB_ADPT pTXCB; //I2C Transmit Callback
|
||||||
|
PSAL_I2C_USERCB_ADPT pTXCCB; //I2C Transmit Complete Callback
|
||||||
|
PSAL_I2C_USERCB_ADPT pRXCB; //I2C Receive Callback
|
||||||
|
PSAL_I2C_USERCB_ADPT pRXCCB; //I2C Receive Complete Callback
|
||||||
|
PSAL_I2C_USERCB_ADPT pRDREQCB; //I2C Read Request Callback
|
||||||
|
PSAL_I2C_USERCB_ADPT pERRCB; //I2C Error Callback
|
||||||
|
PSAL_I2C_USERCB_ADPT pDMATXCB; //I2C DMA Transmit Callback
|
||||||
|
PSAL_I2C_USERCB_ADPT pDMATXCCB; //I2C DMA Transmit Complete Callback
|
||||||
|
PSAL_I2C_USERCB_ADPT pDMARXCB; //I2C DMA Receive Callback
|
||||||
|
PSAL_I2C_USERCB_ADPT pDMARXCCB; //I2C DMA Receive Complete Callback
|
||||||
|
PSAL_I2C_USERCB_ADPT pGENCALLCB; //I2C General Call Callback
|
||||||
|
}SAL_I2C_USER_CB, *PSAL_I2C_USER_CB;
|
||||||
|
|
||||||
|
// I2C Transmit Buffer
|
||||||
|
typedef struct _SAL_I2C_TRANSFER_BUF_ {
|
||||||
|
u16 DataLen; //I2C Transmfer Length
|
||||||
|
u16 TargetAddr; //I2C Target Address. It's only valid in Master Mode.
|
||||||
|
u32 RegAddr; //I2C Register Address. It's only valid in Master Mode.
|
||||||
|
u32 RSVD; //
|
||||||
|
u8 *pDataBuf; //I2C Transfer Buffer Pointer
|
||||||
|
}SAL_I2C_TRANSFER_BUF,*PSAL_I2C_TRANSFER_BUF;
|
||||||
|
|
||||||
|
typedef struct _SAL_I2C_DMA_USER_DEF_ {
|
||||||
|
u8 TxDatSrcWdth;
|
||||||
|
u8 TxDatDstWdth;
|
||||||
|
u8 TxDatSrcBstSz;
|
||||||
|
u8 TxDatDstBstSz;
|
||||||
|
u8 TxChNo;
|
||||||
|
u8 RSVD0;
|
||||||
|
u16 RSVD1;
|
||||||
|
u8 RxDatSrcWdth;
|
||||||
|
u8 RxDatDstWdth;
|
||||||
|
u8 RxDatSrcBstSz;
|
||||||
|
u8 RxDatDstBstSz;
|
||||||
|
u8 RxChNo;
|
||||||
|
u8 RSVD2;
|
||||||
|
u16 RSVD3;
|
||||||
|
}SAL_I2C_DMA_USER_DEF, *PSAL_I2C_DMA_USER_DEF;
|
||||||
|
|
||||||
|
// RTK I2C OP
|
||||||
|
typedef struct _RTK_I2C_OP_ {
|
||||||
|
HAL_Status (*Init) (VOID *Data);
|
||||||
|
HAL_Status (*DeInit) (VOID *Data);
|
||||||
|
HAL_Status (*Send) (VOID *Data);
|
||||||
|
HAL_Status (*Receive) (VOID *Data);
|
||||||
|
HAL_Status (*IoCtrl) (VOID *Data);
|
||||||
|
HAL_Status (*PowerCtrl) (VOID *Data);
|
||||||
|
}RTK_I2C_OP, *PRTK_I2C_OP;
|
||||||
|
|
||||||
|
// Software API Level I2C Handler
|
||||||
|
typedef struct _SAL_I2C_HND_ {
|
||||||
|
u8 DevNum; //I2C device number
|
||||||
|
u8 PinMux; //I2C pin mux seletion
|
||||||
|
u8 OpType; //I2C operation type selection
|
||||||
|
volatile u8 DevSts; //I2C device status
|
||||||
|
|
||||||
|
u8 I2CMaster; //I2C Master or Slave mode
|
||||||
|
u8 I2CAddrMod; //I2C 7-bit or 10-bit mode
|
||||||
|
u8 I2CSpdMod; //I2C SS/ FS/ HS speed mode
|
||||||
|
u8 I2CAckAddr; //I2C target address in Master
|
||||||
|
//mode or ack address in Slave
|
||||||
|
//mode
|
||||||
|
|
||||||
|
u16 I2CClk; //I2C bus clock
|
||||||
|
u8 MasterRead; //I2C Master Read Supported,
|
||||||
|
//An Address will be sent before
|
||||||
|
//read data back.
|
||||||
|
|
||||||
|
u8 I2CDmaSel; //I2C DMA module select
|
||||||
|
// 0 for DMA0,
|
||||||
|
// 1 for DMA1
|
||||||
|
u8 I2CTxDMARqLv; //I2C TX DMA Empty Level
|
||||||
|
u8 I2CRxDMARqLv; //I2C RX DMA Full Level
|
||||||
|
u16 RSVD0; //Reserved
|
||||||
|
|
||||||
|
u32 AddRtyTimeOut; //I2C TimeOut Value for master send address retry
|
||||||
|
//(Originally Reserved.)
|
||||||
|
|
||||||
|
u32 I2CExd; //I2C extended options:
|
||||||
|
//bit 0: I2C RESTART supported,
|
||||||
|
// 0 for NOT supported,
|
||||||
|
// 1 for supported
|
||||||
|
//bit 1: I2C General Call supported
|
||||||
|
// 0 for NOT supported,
|
||||||
|
// 1 for supported
|
||||||
|
//bit 2: I2C START Byte supported
|
||||||
|
// 0 for NOT supported,
|
||||||
|
// 1 for supported
|
||||||
|
//bit 3: I2C Slave-No-Ack
|
||||||
|
// supported
|
||||||
|
// 0 for NOT supported,
|
||||||
|
// 1 for supported
|
||||||
|
//bit 4: I2C bus loading,
|
||||||
|
// 0 for 100pf,
|
||||||
|
// 1 for 400pf
|
||||||
|
//bit 5: I2C slave ack to General
|
||||||
|
// Call
|
||||||
|
//bit 6: I2C User register address
|
||||||
|
//bit 7: I2C 2-Byte User register
|
||||||
|
// address
|
||||||
|
//bit 8: I2C slave address no ack retry,
|
||||||
|
// It's only for Master mode,
|
||||||
|
// when slave doesn't ack the
|
||||||
|
// address
|
||||||
|
//bit 31~bit 8: Reserved
|
||||||
|
u32 ErrType; //
|
||||||
|
u32 TimeOut; //I2C IO Timeout count, in ms
|
||||||
|
|
||||||
|
PHAL_I2C_INIT_DAT pInitDat; //Pointer to I2C initial data struct
|
||||||
|
PSAL_I2C_TRANSFER_BUF pTXBuf; //Pointer to I2C TX buffer
|
||||||
|
PSAL_I2C_TRANSFER_BUF pRXBuf; //Pointer to I2C RX buffer
|
||||||
|
PSAL_I2C_USER_CB pUserCB; //Pointer to I2C User Callback
|
||||||
|
PSAL_I2C_DMA_USER_DEF pDMAConf; //Pointer to I2C User Define DMA config
|
||||||
|
}SAL_I2C_HND, *PSAL_I2C_HND;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//======================================================
|
||||||
|
// I2C SAL Function Prototypes
|
||||||
|
|
||||||
|
// For checking I2C input index valid or not
|
||||||
|
static inline HAL_Status
|
||||||
|
RtkI2CIdxChk(
|
||||||
|
IN u8 I2CIdx
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (I2CIdx > I2C3_SEL)
|
||||||
|
return HAL_ERR_UNKNOWN;
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
//For checking I2C operation type valid or not
|
||||||
|
static inline HAL_Status
|
||||||
|
RtkI2COpTypeChk(
|
||||||
|
IN VOID *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
PSAL_I2C_HND pSalI2CHND = (PSAL_I2C_HND) Data;
|
||||||
|
|
||||||
|
if (pSalI2CHND->OpType == I2C_POLL_TYPE)
|
||||||
|
return HAL_ERR_UNKNOWN;
|
||||||
|
|
||||||
|
if (pSalI2CHND->OpType == I2C_DMA_TYPE)
|
||||||
|
return HAL_ERR_UNKNOWN;
|
||||||
|
|
||||||
|
if (pSalI2CHND->OpType == I2C_INTR_TYPE)
|
||||||
|
return HAL_ERR_UNKNOWN;
|
||||||
|
|
||||||
|
pSalI2CHND = pSalI2CHND;
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
//For checking I2C DMA available or not
|
||||||
|
static inline HAL_Status
|
||||||
|
RtkI2CDMAChk(
|
||||||
|
IN VOID *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
PSAL_I2C_HND pSalI2CHND = (PSAL_I2C_HND) Data;
|
||||||
|
|
||||||
|
if (pSalI2CHND->OpType == I2C_DMA_TYPE) {
|
||||||
|
if (pSalI2CHND->DevNum >= I2C2_SEL)
|
||||||
|
return HAL_ERR_UNKNOWN;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return HAL_ERR_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
//For checking I2C DMA available or not
|
||||||
|
static inline HAL_Status
|
||||||
|
RtkI2CDMAInitChk(
|
||||||
|
IN VOID *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
PSAL_I2C_HND pSalI2CHND = (PSAL_I2C_HND) Data;
|
||||||
|
|
||||||
|
if (pSalI2CHND->OpType != I2C_DMA_TYPE) {
|
||||||
|
return HAL_ERR_UNKNOWN;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//======================================================
|
||||||
|
//SAL I2C management function prototype
|
||||||
|
_LONG_CALL_ROM_ HAL_Status RtkI2CLoadDefault(IN VOID *Data);
|
||||||
|
_LONG_CALL_ROM_ HAL_Status RtkI2CInit(IN VOID *Data);
|
||||||
|
_LONG_CALL_ROM_ HAL_Status RtkI2CDeInit(IN VOID *Data);
|
||||||
|
_LONG_CALL_ROM_ HAL_Status RtkI2CSend(IN VOID *Data);
|
||||||
|
_LONG_CALL_ROM_ HAL_Status RtkI2CReceive(IN VOID *Data);
|
||||||
|
_LONG_CALL_ROM_ VOID RtkSalI2COpInit(IN VOID *Data);
|
||||||
|
_LONG_CALL_ROM_ HAL_Status RtkI2CSendUserAddr(IN VOID *Data,IN u8 MtrWr);
|
||||||
|
_LONG_CALL_ROM_ HAL_Status RtkI2CIoCtrl(IN VOID *Data);
|
||||||
|
_LONG_CALL_ROM_ HAL_Status RtkI2CPowerCtrl(IN VOID *Data);
|
||||||
|
_LONG_CALL_ HAL_Status RtkI2CInitForPS(IN VOID *Data);
|
||||||
|
_LONG_CALL_ HAL_Status RtkI2CDeInitForPS(IN VOID *Data);
|
||||||
|
_LONG_CALL_ HAL_Status RtkI2CDisablePS(IN VOID *Data);
|
||||||
|
_LONG_CALL_ HAL_Status RtkI2CEnablePS(IN VOID *Data);
|
||||||
|
//================= I2C SAL END ===========================
|
||||||
|
|
||||||
|
|
||||||
|
//================= I2C SAL MANAGEMENT START =================
|
||||||
|
// I2C SAL management macros
|
||||||
|
#define SAL_USER_CB_NUM (sizeof(SAL_I2C_USER_CB) / sizeof(PSAL_I2C_USERCB_ADPT))
|
||||||
|
|
||||||
|
//======================================================
|
||||||
|
// I2C SAL management data structures
|
||||||
|
// I2C SAL handle private
|
||||||
|
typedef struct _SAL_I2C_HND_PRIV_ {
|
||||||
|
VOID **ppSalI2CHnd; //Pointer to SAL_I2C_HND pointer
|
||||||
|
SAL_I2C_HND SalI2CHndPriv; //Private SAL_I2C_HND
|
||||||
|
}SAL_I2C_HND_PRIV, *PSAL_I2C_HND_PRIV;
|
||||||
|
|
||||||
|
//I2C SAL management adapter
|
||||||
|
typedef struct _SAL_I2C_MNGT_ADPT_ {
|
||||||
|
PSAL_I2C_HND_PRIV pSalHndPriv; //Pointer to SAL_I2C_HND
|
||||||
|
PHAL_I2C_INIT_DAT pHalInitDat; //Pointer to HAL I2C initial data( HAL_I2C_INIT_DAT )
|
||||||
|
PHAL_I2C_OP pHalOp; //Pointer to HAL I2C operation( HAL_I2C_OP )
|
||||||
|
VOID (*pHalOpInit)(VOID*); //Pointer to HAL I2C initialize function
|
||||||
|
PIRQ_HANDLE pIrqHnd; //Pointer to IRQ handler in SAL layer( IRQ_HANDLE )
|
||||||
|
PSAL_I2C_USER_CB pUserCB; //Pointer to SAL user callbacks (SAL_I2C_USER_CB )
|
||||||
|
volatile u32 MstRDCmdCnt; //Used for Master Read command count
|
||||||
|
volatile u32 InnerTimeOut; //Used for SAL internal timeout count
|
||||||
|
VOID (*pSalIrqFunc)(VOID*); //Used for SAL I2C interrupt function
|
||||||
|
|
||||||
|
PSAL_I2C_DMA_USER_DEF pDMAConf; //Pointer to I2C User Define DMA config
|
||||||
|
PHAL_GDMA_ADAPTER pHalTxGdmaAdp; //Pointer to HAL_GDMA_ADAPTER
|
||||||
|
PHAL_GDMA_ADAPTER pHalRxGdmaAdp; //Pointer to HAL_GDMA_ADAPTER
|
||||||
|
PHAL_GDMA_OP pHalGdmaOp; //Pointer to HAL_GDMA_OP
|
||||||
|
VOID (*pHalGdmaOpInit)(VOID*); //Pointer to HAL I2C initialize function
|
||||||
|
PIRQ_HANDLE pIrqTxGdmaHnd; //Pointer to IRQ handler for Tx GDMA
|
||||||
|
PIRQ_HANDLE pIrqRxGdmaHnd; //Pointer to IRQ handler for Rx GDMA
|
||||||
|
VOID (*pSalDMATxIrqFunc)(VOID*); //Used for SAL I2C interrupt function
|
||||||
|
VOID (*pSalDMARxIrqFunc)(VOID*); //Used for SAL I2C interrupt function
|
||||||
|
u32 RSVD; //Reserved
|
||||||
|
}SAL_I2C_MNGT_ADPT, *PSAL_I2C_MNGT_ADPT;
|
||||||
|
|
||||||
|
//======================================================
|
||||||
|
//SAL I2C management function prototype
|
||||||
|
PSAL_I2C_MNGT_ADPT RtkI2CGetMngtAdpt(IN u8 I2CIdx);
|
||||||
|
HAL_Status RtkI2CFreeMngtAdpt(IN PSAL_I2C_MNGT_ADPT pSalI2CMngtAdpt);
|
||||||
|
PSAL_I2C_HND RtkI2CGetSalHnd(IN u8 I2CIdx);
|
||||||
|
HAL_Status RtkI2CFreeSalHnd(IN PSAL_I2C_HND pSalI2CHND);
|
||||||
|
u32 RtkSalI2CSts(IN VOID *Data);
|
||||||
|
|
||||||
|
extern _LONG_CALL_ VOID I2CISRHandle(IN VOID *Data);
|
||||||
|
extern _LONG_CALL_ VOID I2CTXGDMAISRHandle(IN VOID *Data);
|
||||||
|
extern _LONG_CALL_ VOID I2CRXGDMAISRHandle(IN VOID *Data);
|
||||||
|
extern HAL_Status I2CIsTimeout (IN u32 StartCount, IN u32 TimeoutCnt);
|
||||||
|
extern HAL_TIMER_OP HalTimerOp;
|
||||||
|
//======================================================
|
||||||
|
// Function Prototypes
|
||||||
|
_LONG_CALL_ VOID HalI2COpInit(IN VOID *Data);
|
||||||
|
//================= I2C SAL MANAGEMENT END ==================
|
||||||
|
|
||||||
|
//================= Rtl8195a I2C V02 function prototype ============
|
||||||
|
_LONG_CALL_ VOID HalI2COpInitV02(IN VOID *Data);
|
||||||
|
_LONG_CALL_ VOID I2CISRHandleV02(IN VOID *Data);
|
||||||
|
_LONG_CALL_ HAL_Status RtkI2CSendV02(IN VOID *Data);
|
||||||
|
_LONG_CALL_ HAL_Status RtkI2CReceiveV02(IN VOID *Data);
|
||||||
|
_LONG_CALL_ VOID RtkSalI2COpInitV02(IN VOID *Data);
|
||||||
|
//================= Rtl8195a I2C V02 function prototype END==========
|
||||||
|
|
||||||
|
//======================================================
|
||||||
|
//SAL I2C patch function prototype
|
||||||
|
HAL_Status RtkI2CSend_Patch(IN VOID *Data);
|
||||||
|
HAL_Status RtkI2CReceive_Patch(IN VOID *Data);
|
||||||
|
VOID HalI2COpInit_Patch(IN VOID *Data);
|
||||||
|
VOID I2CISRHandle_Patch(IN VOID *Data);
|
||||||
|
|
||||||
|
#ifndef CONFIG_RELEASE_BUILD_LIBRARIES
|
||||||
|
#define RtkI2CSend RtkI2CSend_Patch
|
||||||
|
#define RtkI2CReceive RtkI2CReceive_Patch
|
||||||
|
#endif
|
||||||
|
HAL_Status RtkI2CSend_Patch(IN VOID *Data);
|
||||||
|
HAL_Status RtkI2CReceive_Patch(IN VOID *Data);
|
||||||
|
//================= I2C SAL END ===========================
|
||||||
|
|
||||||
|
#endif //#ifndef _HAL_I2C_H_
|
347
sdk/component/soc/realtek/8195a/fwlib/hal_i2s.h
Normal file
347
sdk/component/soc/realtek/8195a/fwlib/hal_i2s.h
Normal file
|
@ -0,0 +1,347 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HAL_I2S_H_
|
||||||
|
#define _HAL_I2S_H_
|
||||||
|
|
||||||
|
#include "rtl8195a_i2s.h"
|
||||||
|
|
||||||
|
/* User Define Flags */
|
||||||
|
|
||||||
|
#define I2S_MAX_ID 1 // valid I2S index 0 ~ I2S_MAX_ID
|
||||||
|
|
||||||
|
/**********************************************************************/
|
||||||
|
/* I2S HAL initial data structure */
|
||||||
|
typedef struct _HAL_I2S_INIT_DAT_ {
|
||||||
|
u8 I2SIdx; /*I2S index used*/
|
||||||
|
u8 I2SEn; /*I2S module enable tx/rx/tx+rx*/
|
||||||
|
u8 I2SMaster; /*I2S Master or Slave mode*/
|
||||||
|
u8 I2SWordLen; /*I2S Word length 16 or 24bits*/
|
||||||
|
|
||||||
|
u8 I2SChNum; /*I2S Channel number mono or stereo*/
|
||||||
|
u8 I2SPageNum; /*I2S Page Number 2~4*/
|
||||||
|
u16 I2SPageSize; /*I2S page Size 1~4096 word*/
|
||||||
|
|
||||||
|
u8 *I2STxData; /*I2S Tx data pointer*/
|
||||||
|
|
||||||
|
u8 *I2SRxData; /*I2S Rx data pointer*/
|
||||||
|
|
||||||
|
u32 I2STxIntrMSK; /*I2S Tx Interrupt Mask*/
|
||||||
|
u32 I2STxIntrClr; /*I2S Tx Interrupt register to clear */
|
||||||
|
|
||||||
|
u32 I2SRxIntrMSK; /*I2S Rx Interrupt Mask*/
|
||||||
|
u32 I2SRxIntrClr; /*I2S Rx Interrupt register to clear*/
|
||||||
|
|
||||||
|
u16 I2STxIdx; /*I2S TX page index */
|
||||||
|
u16 I2SRxIdx; /*I2S RX page index */
|
||||||
|
|
||||||
|
u16 I2SHWTxIdx; /*I2S HW TX page index */
|
||||||
|
u16 I2SHWRxIdx; /*I2S HW RX page index */
|
||||||
|
|
||||||
|
|
||||||
|
u16 I2SRate; /*I2S sample rate*/
|
||||||
|
u8 I2STRxAct; /*I2S tx rx act*/
|
||||||
|
}HAL_I2S_INIT_DAT, *PHAL_I2S_INIT_DAT;
|
||||||
|
|
||||||
|
/**********************************************************************/
|
||||||
|
/* I2S Data Structures */
|
||||||
|
/* I2S Module Selection */
|
||||||
|
typedef enum _I2S_MODULE_SEL_ {
|
||||||
|
I2S0_SEL = 0x0,
|
||||||
|
I2S1_SEL = 0x1,
|
||||||
|
}I2S_MODULE_SEL,*PI2S_MODULE_SEL;
|
||||||
|
/*
|
||||||
|
typedef struct _HAL_I2S_ADAPTER_ {
|
||||||
|
u32 Enable:1;
|
||||||
|
I2S_CTL_REG I2sCtl;
|
||||||
|
I2S_SETTING_REG I2sSetting;
|
||||||
|
u32 abc;
|
||||||
|
u8 I2sIndex;
|
||||||
|
}HAL_I2S_ADAPTER, *PHAL_I2S_ADAPTER;
|
||||||
|
*/
|
||||||
|
/* I2S HAL Operations */
|
||||||
|
typedef struct _HAL_I2S_OP_ {
|
||||||
|
RTK_STATUS (*HalI2SInit) (VOID *Data);
|
||||||
|
RTK_STATUS (*HalI2SDeInit) (VOID *Data);
|
||||||
|
RTK_STATUS (*HalI2STx) (VOID *Data, u8 *pBuff);
|
||||||
|
RTK_STATUS (*HalI2SRx) (VOID *Data, u8 *pBuff);
|
||||||
|
RTK_STATUS (*HalI2SEnable) (VOID *Data);
|
||||||
|
RTK_STATUS (*HalI2SIntrCtrl) (VOID *Data);
|
||||||
|
u32 (*HalI2SReadReg) (VOID *Data, u8 I2SReg);
|
||||||
|
RTK_STATUS (*HalI2SSetRate) (VOID *Data);
|
||||||
|
RTK_STATUS (*HalI2SSetWordLen) (VOID *Data);
|
||||||
|
RTK_STATUS (*HalI2SSetChNum) (VOID *Data);
|
||||||
|
RTK_STATUS (*HalI2SSetPageNum) (VOID *Data);
|
||||||
|
RTK_STATUS (*HalI2SSetPageSize) (VOID *Data);
|
||||||
|
|
||||||
|
RTK_STATUS (*HalI2SClrIntr) (VOID *Data);
|
||||||
|
RTK_STATUS (*HalI2SClrAllIntr) (VOID *Data);
|
||||||
|
RTK_STATUS (*HalI2SDMACtrl) (VOID *Data);
|
||||||
|
/*
|
||||||
|
VOID (*HalI2sOnOff)(VOID *Data);
|
||||||
|
BOOL (*HalI2sInit)(VOID *Data);
|
||||||
|
BOOL (*HalI2sSetting)(VOID *Data);
|
||||||
|
BOOL (*HalI2sEn)(VOID *Data);
|
||||||
|
BOOL (*HalI2sIsrEnAndDis) (VOID *Data);
|
||||||
|
BOOL (*HalI2sDumpReg)(VOID *Data);
|
||||||
|
BOOL (*HalI2s)(VOID *Data);
|
||||||
|
*/
|
||||||
|
}HAL_I2S_OP, *PHAL_I2S_OP;
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************/
|
||||||
|
|
||||||
|
/* I2S Pinmux Selection */
|
||||||
|
#if 0
|
||||||
|
typedef enum _I2S0_PINMUX_ {
|
||||||
|
I2S0_TO_S0 = 0x0,
|
||||||
|
I2S0_TO_S1 = 0x1,
|
||||||
|
I2S0_TO_S2 = 0x2,
|
||||||
|
}I2S0_PINMUX, *PI2S0_PINMUX;
|
||||||
|
|
||||||
|
typedef enum _I2S1_PINMUX_ {
|
||||||
|
I2S1_TO_S0 = 0x0,
|
||||||
|
I2S1_TO_S1 = 0x1,
|
||||||
|
}I2S1_PINMUX, *PI2S1_PINMUX;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum _I2S_PINMUX_ {
|
||||||
|
I2S_S0 = 0,
|
||||||
|
I2S_S1 = 1,
|
||||||
|
I2S_S2 = 2,
|
||||||
|
I2S_S3 = 3
|
||||||
|
}I2S_PINMUX, *PI2S_PINMUX;
|
||||||
|
|
||||||
|
|
||||||
|
/* I2S Module Status */
|
||||||
|
typedef enum _I2S_MODULE_STATUS_ {
|
||||||
|
I2S_DISABLE = 0x0,
|
||||||
|
I2S_ENABLE = 0x1,
|
||||||
|
}I2S_MODULE_STATUS, *PI2S_MODULE_STATUS;
|
||||||
|
|
||||||
|
|
||||||
|
/* I2S Device Status */
|
||||||
|
typedef enum _I2S_Device_STATUS_ {
|
||||||
|
I2S_STS_UNINITIAL = 0x00,
|
||||||
|
I2S_STS_INITIALIZED = 0x01,
|
||||||
|
I2S_STS_IDLE = 0x02,
|
||||||
|
|
||||||
|
I2S_STS_TX_READY = 0x03,
|
||||||
|
I2S_STS_TX_ING = 0x04,
|
||||||
|
|
||||||
|
I2S_STS_RX_READY = 0x05,
|
||||||
|
I2S_STS_RX_ING = 0x06,
|
||||||
|
|
||||||
|
I2S_STS_TRX_READY = 0x07,
|
||||||
|
I2S_STS_TRX_ING = 0x08,
|
||||||
|
|
||||||
|
I2S_STS_ERROR = 0x09,
|
||||||
|
}I2S_Device_STATUS, *PI2S_Device_STATUS;
|
||||||
|
|
||||||
|
|
||||||
|
/* I2S Feature Status */
|
||||||
|
typedef enum _I2S_FEATURE_STATUS_{
|
||||||
|
I2S_FEATURE_DISABLED = 0,
|
||||||
|
I2S_FEATURE_ENABLED = 1,
|
||||||
|
}I2S_FEATURE_STATUS,*PI2S_FEATURE_STATUS;
|
||||||
|
|
||||||
|
/* I2S Device Mode */
|
||||||
|
typedef enum _I2S_DEV_MODE_ {
|
||||||
|
I2S_MASTER_MODE = 0x0,
|
||||||
|
I2S_SLAVE_MODE = 0x1
|
||||||
|
}I2S_DEV_MODE, *PI2S_DEV_MODE;
|
||||||
|
|
||||||
|
/* I2S Word Length */
|
||||||
|
typedef enum _I2S_WORD_LEN_ {
|
||||||
|
I2S_WL_16 = 0x0,
|
||||||
|
I2S_WL_24 = 0x1,
|
||||||
|
}I2S_WORD_LEN, *PI2S_WORD_LEN;
|
||||||
|
|
||||||
|
/* I2S Bus Transmit/Receive */
|
||||||
|
typedef enum _I2S_DIRECTION_ {
|
||||||
|
I2S_ONLY_RX = 0x0,
|
||||||
|
I2S_ONLY_TX = 0x1,
|
||||||
|
I2S_TXRX = 0x2
|
||||||
|
}I2S_DIRECTION, *PI2S_DIRECTION;
|
||||||
|
|
||||||
|
/* I2S Channel number */
|
||||||
|
typedef enum _I2S_CH_NUM_ {
|
||||||
|
I2S_CH_STEREO = 0x0,
|
||||||
|
I2S_CH_RSVD = 0x1,
|
||||||
|
I2S_CH_MONO = 0x2
|
||||||
|
}I2S_CH_NUM, *PI2S_CH_NUM;
|
||||||
|
|
||||||
|
/* I2S Page number */
|
||||||
|
typedef enum _I2S_PAGE_NUM_ {
|
||||||
|
I2S_1PAGE = 0x0,
|
||||||
|
I2S_2PAGE = 0x1,
|
||||||
|
I2S_3PAGE = 0x2,
|
||||||
|
I2S_4PAGE = 0x3
|
||||||
|
}I2S_PAGE_NUM, *PI2S_PAGE_NUM;
|
||||||
|
|
||||||
|
/* I2S Sample rate*/
|
||||||
|
typedef enum _I2S_SAMPLE_RATE_ {
|
||||||
|
I2S_SR_8KHZ = 0x00, // /12
|
||||||
|
I2S_SR_16KHZ = 0x01, // /6
|
||||||
|
I2S_SR_24KHZ = 0x02, // /4
|
||||||
|
I2S_SR_32KHZ = 0x03, // /3
|
||||||
|
I2S_SR_48KHZ = 0x05, // /2
|
||||||
|
I2S_SR_96KHZ = 0x06, // x1, base 96kHz
|
||||||
|
I2S_SR_7p35KHZ = 0x10,
|
||||||
|
I2S_SR_11p02KHZ = 0x11,
|
||||||
|
I2S_SR_22p05KHZ = 0x12,
|
||||||
|
I2S_SR_29p4KHZ = 0x13,
|
||||||
|
I2S_SR_44p1KHZ = 0x15,
|
||||||
|
I2S_SR_88p2KHZ = 0x16 // x1, base 88200Hz
|
||||||
|
}I2S_SAMPLE_RATE, *PI2S_SAMPLE_RATE;
|
||||||
|
|
||||||
|
/* I2S TX interrupt mask/status */
|
||||||
|
typedef enum _I2S_TX_IMR_ {
|
||||||
|
I2S_TX_INT_PAGE0_OK = (1<<0),
|
||||||
|
I2S_TX_INT_PAGE1_OK = (1<<1),
|
||||||
|
I2S_TX_INT_PAGE2_OK = (1<<2),
|
||||||
|
I2S_TX_INT_PAGE3_OK = (1<<3),
|
||||||
|
I2S_TX_INT_FULL = (1<<4),
|
||||||
|
I2S_TX_INT_EMPTY = (1<<5)
|
||||||
|
} I2S_TX_IMR, *PI2S_TX_IMR;
|
||||||
|
|
||||||
|
/* I2S RX interrupt mask/status */
|
||||||
|
typedef enum _I2S_RX_IMR_ {
|
||||||
|
I2S_RX_INT_PAGE0_OK = (1<<0),
|
||||||
|
I2S_RX_INT_PAGE1_OK = (1<<1),
|
||||||
|
I2S_RX_INT_PAGE2_OK = (1<<2),
|
||||||
|
I2S_RX_INT_PAGE3_OK = (1<<3),
|
||||||
|
I2S_RX_INT_EMPTY = (1<<4),
|
||||||
|
I2S_RX_INT_FULL = (1<<5)
|
||||||
|
} I2S_RX_IMR, *PI2S_RX_IMR;
|
||||||
|
|
||||||
|
/* I2S User Callbacks */
|
||||||
|
typedef struct _SAL_I2S_USER_CB_{
|
||||||
|
VOID (*TXCB) (VOID *Data);
|
||||||
|
VOID (*TXCCB) (VOID *Data);
|
||||||
|
VOID (*RXCB) (VOID *Data);
|
||||||
|
VOID (*RXCCB) (VOID *Data);
|
||||||
|
VOID (*RDREQCB) (VOID *Data);
|
||||||
|
VOID (*ERRCB) (VOID *Data);
|
||||||
|
VOID (*GENCALLCB) (VOID *Data);
|
||||||
|
}SAL_I2S_USER_CB,*PSAL_I2S_USER_CB;
|
||||||
|
|
||||||
|
typedef struct _I2S_USER_CB_{
|
||||||
|
VOID (*TxCCB)(uint32_t id, char *pbuf);
|
||||||
|
u32 TxCBId;
|
||||||
|
VOID (*RxCCB)(uint32_t id, char *pbuf);
|
||||||
|
u32 RxCBId;
|
||||||
|
}I2S_USER_CB,*PI2S_USER_CB;
|
||||||
|
|
||||||
|
/* Software API Level I2S Handler */
|
||||||
|
typedef struct _HAL_I2S_ADAPTER_{
|
||||||
|
u8 DevNum; //I2S device number
|
||||||
|
u8 PinMux; //I2S pin mux seletion
|
||||||
|
u8 RSVD0; //Reserved
|
||||||
|
volatile u8 DevSts; //I2S device status
|
||||||
|
|
||||||
|
u32 RSVD2; //Reserved
|
||||||
|
u32 I2SExd; //I2S extended options:
|
||||||
|
//bit 0: I2C RESTART supported,
|
||||||
|
// 0 for NOT supported,
|
||||||
|
// 1 for supported
|
||||||
|
//bit 1: I2C General Call supported
|
||||||
|
// 0 for NOT supported,
|
||||||
|
// 1 for supported
|
||||||
|
//bit 2: I2C START Byte supported
|
||||||
|
// 0 for NOT supported,
|
||||||
|
// 1 for supported
|
||||||
|
//bit 3: I2C Slave-No-Ack
|
||||||
|
// supported
|
||||||
|
// 0 for NOT supported,
|
||||||
|
// 1 for supported
|
||||||
|
//bit 4: I2C bus loading,
|
||||||
|
// 0 for 100pf,
|
||||||
|
// 1 for 400pf
|
||||||
|
//bit 5: I2C slave ack to General
|
||||||
|
// Call
|
||||||
|
//bit 6: I2C User register address
|
||||||
|
//bit 7: I2C 2-Byte User register
|
||||||
|
// address
|
||||||
|
//bit 31~bit 8: Reserved
|
||||||
|
u32 ErrType; //
|
||||||
|
u32 TimeOut; //I2S IO Timeout count
|
||||||
|
|
||||||
|
PHAL_I2S_INIT_DAT pInitDat; //Pointer to I2S initial data struct
|
||||||
|
I2S_USER_CB UserCB; //Pointer to I2S User Callback
|
||||||
|
IRQ_HANDLE IrqHandle; // Irq Handler
|
||||||
|
|
||||||
|
u32* TxPageList[4]; // The Tx DAM buffer: pointer of each page
|
||||||
|
u32* RxPageList[4]; // The Tx DAM buffer: pointer of each page
|
||||||
|
}HAL_I2S_ADAPTER, *PHAL_I2S_ADAPTER;
|
||||||
|
|
||||||
|
typedef struct _HAL_I2S_DEF_SETTING_{
|
||||||
|
u8 I2SMaster; // Master or Slave mode
|
||||||
|
u8 DevSts; //I2S device status
|
||||||
|
u8 I2SChNum; //I2S Channel number mono or stereo
|
||||||
|
u8 I2SPageNum; //I2S Page number 2~4
|
||||||
|
u8 I2STRxAct; //I2S tx rx act, tx only or rx only or tx+rx
|
||||||
|
u8 I2SWordLen; //I2S Word length 16bit or 24bit
|
||||||
|
u16 I2SPageSize; //I2S Page size 1~4096 word
|
||||||
|
|
||||||
|
u16 I2SRate; //I2S sample rate 8k ~ 96khz
|
||||||
|
|
||||||
|
u32 I2STxIntrMSK; /*I2S Tx Interrupt Mask*/
|
||||||
|
u32 I2SRxIntrMSK; /*I2S Rx Interrupt Mask*/
|
||||||
|
}HAL_I2S_DEF_SETTING, *PHAL_I2S_DEF_SETTING;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************/
|
||||||
|
HAL_Status
|
||||||
|
RtkI2SLoadDefault(IN VOID *Adapter, IN VOID *Setting);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
RtkI2SInit(IN VOID *Data);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
RtkI2SDeInit(IN VOID *Data);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
RtkI2SEnable(IN VOID *Data);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
RtkI2SDisable(IN VOID *Data);
|
||||||
|
|
||||||
|
extern HAL_Status
|
||||||
|
HalI2SInit( IN VOID *Data);
|
||||||
|
|
||||||
|
extern VOID
|
||||||
|
HalI2SDeInit( IN VOID *Data);
|
||||||
|
|
||||||
|
extern HAL_Status
|
||||||
|
HalI2SDisable( IN VOID *Data);
|
||||||
|
|
||||||
|
extern HAL_Status
|
||||||
|
HalI2SEnable( IN VOID *Data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
VOID I2S0ISRHandle(VOID *Data);
|
||||||
|
VOID I2S1ISRHandle(VOID *Data);
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************/
|
||||||
|
|
||||||
|
VOID HalI2SOpInit(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
112
sdk/component/soc/realtek/8195a/fwlib/hal_irqn.h
Normal file
112
sdk/component/soc/realtek/8195a/fwlib/hal_irqn.h
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HAL_IRQN_H_
|
||||||
|
#define _HAL_IRQN_H_
|
||||||
|
|
||||||
|
#define PERIPHERAL_IRQ_BASE_NUM 64
|
||||||
|
|
||||||
|
typedef enum _IRQn_Type_ {
|
||||||
|
#if 0
|
||||||
|
/****** Cortex-M3 Processor Exceptions Numbers ********/
|
||||||
|
NON_MASKABLE_INT_IRQ = -14,
|
||||||
|
HARD_FAULT_IRQ = -13,
|
||||||
|
MEM_MANAGE_FAULT_IRQ = -12,
|
||||||
|
BUS_FAULT_IRQ = -11,
|
||||||
|
USAGE_FAULT_IRQ = -10,
|
||||||
|
SVCALL_IRQ = -5,
|
||||||
|
DEBUG_MONITOR_IRQ = -4,
|
||||||
|
PENDSVC_IRQ = -2,
|
||||||
|
SYSTICK_IRQ = -1,
|
||||||
|
#else
|
||||||
|
/****** Cortex-M3 Processor Exceptions Numbers ********/
|
||||||
|
NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
|
||||||
|
HardFault_IRQn = -13, /*!< 3 Hard Fault, all classes of Fault */
|
||||||
|
MemoryManagement_IRQn = -12, /*!< 4 Cortex-M3 Memory Management Interrupt */
|
||||||
|
BusFault_IRQn = -11, /*!< 5 Cortex-M3 Bus Fault Interrupt */
|
||||||
|
UsageFault_IRQn = -10, /*!< 6 Cortex-M3 Usage Fault Interrupt */
|
||||||
|
SVCall_IRQn = -5, /*!< 11 Cortex-M3 SV Call Interrupt */
|
||||||
|
DebugMonitor_IRQn = -4, /*!< 12 Cortex-M3 Debug Monitor Interrupt */
|
||||||
|
PendSV_IRQn = -2, /*!< 14 Cortex-M3 Pend SV Interrupt */
|
||||||
|
SysTick_IRQn = -1, /*!< 15 Cortex-M3 System Tick Interrupt */
|
||||||
|
#endif
|
||||||
|
/****** RTL8195A Specific Interrupt Numbers ************/
|
||||||
|
SYSTEM_ON_IRQ = 0,
|
||||||
|
WDG_IRQ = 1,
|
||||||
|
TIMER0_IRQ = 2,
|
||||||
|
TIMER1_IRQ = 3,
|
||||||
|
I2C3_IRQ = 4,
|
||||||
|
TIMER2_7_IRQ = 5,
|
||||||
|
SPI0_IRQ = 6,
|
||||||
|
GPIO_IRQ = 7,
|
||||||
|
UART0_IRQ = 8,
|
||||||
|
SPI_FLASH_IRQ = 9,
|
||||||
|
USB_OTG_IRQ = 10,
|
||||||
|
SDIO_HOST_IRQ = 11,
|
||||||
|
SDIO_DEVICE_IRQ = 12,
|
||||||
|
I2S0_PCM0_IRQ = 13,
|
||||||
|
I2S1_PCM1_IRQ = 14,
|
||||||
|
WL_DMA_IRQ = 15,
|
||||||
|
WL_PROTOCOL_IRQ = 16,
|
||||||
|
CRYPTO_IRQ = 17,
|
||||||
|
GMAC_IRQ = 18,
|
||||||
|
PERIPHERAL_IRQ = 19,
|
||||||
|
GDMA0_CHANNEL0_IRQ = 20,
|
||||||
|
GDMA0_CHANNEL1_IRQ = 21,
|
||||||
|
GDMA0_CHANNEL2_IRQ = 22,
|
||||||
|
GDMA0_CHANNEL3_IRQ = 23,
|
||||||
|
GDMA0_CHANNEL4_IRQ = 24,
|
||||||
|
GDMA0_CHANNEL5_IRQ = 25,
|
||||||
|
GDMA1_CHANNEL0_IRQ = 26,
|
||||||
|
GDMA1_CHANNEL1_IRQ = 27,
|
||||||
|
GDMA1_CHANNEL2_IRQ = 28,
|
||||||
|
GDMA1_CHANNEL3_IRQ = 29,
|
||||||
|
GDMA1_CHANNEL4_IRQ = 30,
|
||||||
|
GDMA1_CHANNEL5_IRQ = 31,
|
||||||
|
|
||||||
|
/****** RTL8195A Peripheral Interrupt Numbers ************/
|
||||||
|
I2C0_IRQ = 64,// 0 + 64,
|
||||||
|
I2C1_IRQ = 65,// 1 + 64,
|
||||||
|
I2C2_IRQ = 66,// 2 + 64,
|
||||||
|
SPI1_IRQ = 72,// 8 + 64,
|
||||||
|
SPI2_IRQ = 73,// 9 + 64,
|
||||||
|
UART1_IRQ = 80,// 16 + 64,
|
||||||
|
UART2_IRQ = 81,// 17 + 64,
|
||||||
|
UART_LOG_IRQ = 88,// 24 + 64,
|
||||||
|
ADC_IRQ = 89,// 25 + 64,
|
||||||
|
DAC0_IRQ = 91,// 27 + 64,
|
||||||
|
DAC1_IRQ = 92,// 28 + 64,
|
||||||
|
//RXI300_IRQ = 93// 29 + 64
|
||||||
|
LP_EXTENSION_IRQ = 93,// 29+64
|
||||||
|
|
||||||
|
PTA_TRX_IRQ = 95,// 31+64
|
||||||
|
RXI300_IRQ = 96,// 0+32 + 64
|
||||||
|
NFC_IRQ = 97// 1+32+64
|
||||||
|
} IRQn_Type, *PIRQn_Type;
|
||||||
|
|
||||||
|
|
||||||
|
typedef VOID (*HAL_VECTOR_FUN) (VOID);
|
||||||
|
|
||||||
|
typedef enum _VECTOR_TABLE_TYPE_{
|
||||||
|
DEDECATED_VECTRO_TABLE,
|
||||||
|
PERIPHERAL_VECTOR_TABLE
|
||||||
|
}VECTOR_TABLE_TYPE, *PVECTOR_TABLE_TYPE;
|
||||||
|
|
||||||
|
|
||||||
|
typedef u32 (*IRQ_FUN)(VOID *Data);
|
||||||
|
|
||||||
|
typedef struct _IRQ_HANDLE_ {
|
||||||
|
IRQ_FUN IrqFun;
|
||||||
|
IRQn_Type IrqNum;
|
||||||
|
u32 Data;
|
||||||
|
u32 Priority;
|
||||||
|
}IRQ_HANDLE, *PIRQ_HANDLE;
|
||||||
|
|
||||||
|
|
||||||
|
#endif //_HAL_IRQN_H_
|
150
sdk/component/soc/realtek/8195a/fwlib/hal_log_uart.h
Normal file
150
sdk/component/soc/realtek/8195a/fwlib/hal_log_uart.h
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HAL_LOG_UART_H_
|
||||||
|
#define _HAL_LOG_UART_H_
|
||||||
|
|
||||||
|
#include "hal_diag.h"
|
||||||
|
|
||||||
|
#define LOG_UART_WAIT_FOREVER 0xffffffff
|
||||||
|
|
||||||
|
// Define Line Control Register Bits
|
||||||
|
typedef enum {
|
||||||
|
LCR_DLS_5B = 0, // Data Length: 5 bits
|
||||||
|
LCR_DLS_6B = BIT(0), // Data Length: 6 bits
|
||||||
|
LCR_DLS_7B = BIT(1), // Data Length: 7 bits
|
||||||
|
LCR_DLS_8B = (BIT(1)|BIT(0)), // Data Length: 7 bits
|
||||||
|
|
||||||
|
LCR_STOP_1B = 0, // Number of stop bits: 1
|
||||||
|
LCR_STOP_2B = BIT(2), // Number of stop bits: 1.5(data len=5) or 2
|
||||||
|
|
||||||
|
LCR_PARITY_NONE = 0, // Parity Enable: 0
|
||||||
|
LCR_PARITY_ODD = BIT(3), // Parity Enable: 1, Even Parity: 0
|
||||||
|
LCR_PARITY_EVEN = (BIT(4)|BIT(3)), // Parity Enable: 1, Even Parity: 1
|
||||||
|
|
||||||
|
LCR_BC = BIT(6), // Break Control Bit
|
||||||
|
LCR_DLAB = BIT(7) // Divisor Latch Access Bit
|
||||||
|
} LOG_UART_LINE_CTRL;
|
||||||
|
|
||||||
|
// define Log UART Interrupt Indication ID
|
||||||
|
/*
|
||||||
|
IIR[3:0]:
|
||||||
|
0000 = modem status
|
||||||
|
0001 = no interrupt pending
|
||||||
|
0010 = THR empty
|
||||||
|
0100 = received data available
|
||||||
|
0110 = receiver line status
|
||||||
|
0111 = busy detect
|
||||||
|
1100 = character timeout
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
IIR_MODEM_STATUS = 0, //Clear to send or data set ready or ring indicator or data carrier detect.
|
||||||
|
IIR_NO_PENDING = 1,
|
||||||
|
IIR_THR_EMPTY = 2, // TX FIFO level lower than threshold or FIFO empty
|
||||||
|
IIR_RX_RDY = 4, // RX data ready
|
||||||
|
IIR_RX_LINE_STATUS = 6, // Overrun/parity/framing errors or break interrupt
|
||||||
|
IIR_BUSY = 7,
|
||||||
|
IIR_CHAR_TIMEOUT = 12 // timeout: Rx dara ready but no read
|
||||||
|
} LOG_UART_INT_ID;
|
||||||
|
|
||||||
|
// Define Interrupt Enable Bit
|
||||||
|
typedef enum {
|
||||||
|
IER_ERBFI = BIT(0), // Enable Received Data Available Interrupt
|
||||||
|
IER_ETBEI = BIT(1), // Enable Transmit Holding Register Empty Interrupt
|
||||||
|
IER_ELSI = BIT(2), // Enable Receiver Line Status Interrupt
|
||||||
|
IER_EDSSI = BIT(3), // Enable Modem Status Interrupt
|
||||||
|
IER_PTIME = BIT(7) // Programmable THRE Interrupt Mode Enable
|
||||||
|
} LOG_UART_INT_EN;
|
||||||
|
|
||||||
|
// Define Line Status Bit
|
||||||
|
typedef enum {
|
||||||
|
LSR_DR = BIT(0), // Data Ready bit
|
||||||
|
LSR_OE = BIT(1), // Overrun error bit
|
||||||
|
LSR_PE = BIT(2), // Parity Error bit
|
||||||
|
LSR_FE = BIT(3), // Framing Error bit
|
||||||
|
LSR_BI = BIT(4), // Break Interrupt bit
|
||||||
|
LSR_THRE = BIT(5), // Transmit Holding Register Empty bit(IER_PTIME=0)
|
||||||
|
LSR_FIFOF = BIT(5), // Transmit FIFO Full bit(IER_PTIME=1)
|
||||||
|
LSR_TEMT = BIT(6), // Transmitter Empty bit
|
||||||
|
LSR_RFE = BIT(7) // Receiver FIFO Error bit
|
||||||
|
} LOG_UART_LINE_STATUS;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
LOG_UART_RST_TX_FIFO = 0x01,
|
||||||
|
LOG_UART_RST_RX_FIFO = 0x02
|
||||||
|
};
|
||||||
|
|
||||||
|
#define LOG_UART_TX_FIFO_DEPTH 16
|
||||||
|
#define LOG_UART_RX_FIFO_DEPTH 16
|
||||||
|
|
||||||
|
// Define FIFO Control Register Bits
|
||||||
|
typedef enum {
|
||||||
|
FCR_FIFO_EN = BIT(0), // FIFO Enable.
|
||||||
|
FCR_RST_RX = BIT(1), // RCVR FIFO Reset, self clear
|
||||||
|
FCR_RST_TX = BIT(2), // XMIT FIFO Reset, self clear
|
||||||
|
FCR_TX_TRIG_EMP = 0, // TX Empty Trigger: FIFO empty
|
||||||
|
FCR_TX_TRIG_2CH = BIT(4), // TX Empty Trigger: 2 characters in the FIFO
|
||||||
|
FCR_TX_TRIG_QF = BIT(5), // TX Empty Trigger: FIFO 1/4 full
|
||||||
|
FCR_TX_TRIG_HF = (BIT(5)|BIT(4)), // TX Empty Trigger: FIFO 1/2 full
|
||||||
|
FCR_TX_TRIG_MASK = (BIT(5)|BIT(4)), // TX Empty Trigger Bit Mask
|
||||||
|
FCR_RX_TRIG_1CH = 0, // RCVR Trigger: 1 character in the FIFO
|
||||||
|
FCR_RX_TRIG_QF = BIT(6), // RCVR Trigger: FIFO 1/4 full
|
||||||
|
FCR_RX_TRIG_HF = BIT(7), // RCVR Trigger: FIFO 1/2 full
|
||||||
|
FCR_RX_TRIG_AF = (BIT(7)|BIT(6)), // RCVR Trigger: FIFO 2 less than full
|
||||||
|
FCR_RX_TRIG_MASK = (BIT(7)|BIT(6)) // RCVR Trigger bits Mask
|
||||||
|
} LOG_UART_FIFO_CTRL;
|
||||||
|
|
||||||
|
typedef struct _HAL_LOG_UART_ADAPTER_ {
|
||||||
|
u32 BaudRate;
|
||||||
|
u32 FIFOControl;
|
||||||
|
u32 IntEnReg;
|
||||||
|
u8 Parity;
|
||||||
|
u8 Stop;
|
||||||
|
u8 DataLength;
|
||||||
|
|
||||||
|
u8 LineStatus;
|
||||||
|
volatile u32 TxCount; // how many byte to TX
|
||||||
|
volatile u32 RxCount; // how many bytes to RX
|
||||||
|
volatile u8 *pTxBuf;
|
||||||
|
volatile u8 *pRxBuf;
|
||||||
|
u8 *pTxStartAddr;
|
||||||
|
u8 *pRxStartAddr;
|
||||||
|
|
||||||
|
IRQ_HANDLE IrqHandle;
|
||||||
|
VOID (*LineStatusCallback)(VOID *para, u8 status); // User Line Status interrupt callback
|
||||||
|
VOID (*TxCompCallback)(VOID *para); // User Tx complete callback
|
||||||
|
VOID (*RxCompCallback)(VOID *para); // User Rx complete callback
|
||||||
|
VOID *LineStatusCbPara; // the argument for LineStatusCallback
|
||||||
|
VOID *TxCompCbPara; // the argument for TxCompCallback
|
||||||
|
VOID *RxCompCbPara; // the argument for RxCompCallback
|
||||||
|
|
||||||
|
void (*api_irq_handler)(u32 id, LOG_UART_INT_ID event);
|
||||||
|
u32 api_irq_id;
|
||||||
|
}HAL_LOG_UART_ADAPTER, *PHAL_LOG_UART_ADAPTER;
|
||||||
|
|
||||||
|
VOID HalLogUartIrqHandle(VOID * Data);
|
||||||
|
VOID HalLogUartSetBaudRate(HAL_LOG_UART_ADAPTER *pUartAdapter);
|
||||||
|
VOID HalLogUartSetLineCtrl(HAL_LOG_UART_ADAPTER *pUartAdapter);
|
||||||
|
VOID HalLogUartSetIntEn(HAL_LOG_UART_ADAPTER *pUartAdapter);
|
||||||
|
u32 HalLogUartInitSetting(HAL_LOG_UART_ADAPTER *pUartAdapter);
|
||||||
|
u32 HalLogUartRecv(HAL_LOG_UART_ADAPTER *pUartAdapter,
|
||||||
|
u8 *pRxData, u32 Length, u32 TimeoutMS);
|
||||||
|
u32 HalLogUartSend(HAL_LOG_UART_ADAPTER *pUartAdapter,
|
||||||
|
u8 *pTxData, u32 Length, u32 TimeoutMS);
|
||||||
|
HAL_Status HalLogUartIntSend(HAL_LOG_UART_ADAPTER *pUartAdapter,
|
||||||
|
u8 *pTxData, u32 Length);
|
||||||
|
HAL_Status HalLogUartIntRecv(HAL_LOG_UART_ADAPTER *pUartAdapter,
|
||||||
|
u8 *pRxData, u32 Length);
|
||||||
|
VOID HalLogUartAbortIntSend(HAL_LOG_UART_ADAPTER *pUartAdapter);
|
||||||
|
VOID HalLogUartAbortIntRecv(HAL_LOG_UART_ADAPTER *pUartAdapter);
|
||||||
|
HAL_Status HalLogUartRstFIFO(HAL_LOG_UART_ADAPTER *pUartAdapter, u8 RstCtrl);
|
||||||
|
VOID HalLogUartEnable(HAL_LOG_UART_ADAPTER *pUartAdapter);
|
||||||
|
VOID HalLogUartDisable(HAL_LOG_UART_ADAPTER *pUartAdapter);
|
||||||
|
|
||||||
|
#endif
|
30
sdk/component/soc/realtek/8195a/fwlib/hal_misc.h
Normal file
30
sdk/component/soc/realtek/8195a/fwlib/hal_misc.h
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _MISC_H_
|
||||||
|
#define _MISC_H_
|
||||||
|
|
||||||
|
#include <basic_types.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_TIMER_MODULE
|
||||||
|
extern _LONG_CALL_ u32 HalDelayUs(u32 us);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern _LONG_CALL_ u32 HalGetCpuClk(VOID);
|
||||||
|
extern _LONG_CALL_ u8 HalGetRomInfo(VOID);
|
||||||
|
|
||||||
|
extern _LONG_CALL_ void *_memset( void *s, int c, SIZE_T n );
|
||||||
|
extern _LONG_CALL_ void *_memcpy( void *s1, const void *s2, SIZE_T n );
|
||||||
|
extern _LONG_CALL_ int _memcmp( const void *av, const void *bv, SIZE_T len );
|
||||||
|
|
||||||
|
extern _LONG_CALL_ SIZE_T _strlen(const char *s);
|
||||||
|
extern _LONG_CALL_ int _strcmp(const char *cs, const char *ct);
|
||||||
|
|
||||||
|
|
||||||
|
#endif //_MISC_H_
|
22
sdk/component/soc/realtek/8195a/fwlib/hal_nfc.h
Normal file
22
sdk/component/soc/realtek/8195a/fwlib/hal_nfc.h
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HAL_NFC_H_
|
||||||
|
#define _HAL_NFC_H_
|
||||||
|
|
||||||
|
#include "rtl8195a_nfc.h"
|
||||||
|
|
||||||
|
|
||||||
|
VOID HalNFCOpInit(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
451
sdk/component/soc/realtek/8195a/fwlib/hal_peri_on.h
Normal file
451
sdk/component/soc/realtek/8195a/fwlib/hal_peri_on.h
Normal file
|
@ -0,0 +1,451 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HAL_PERI_ON_H_
|
||||||
|
#define _HAL_PERI_ON_H_
|
||||||
|
|
||||||
|
#define MASK_ALLON 0xFFFFFFFF
|
||||||
|
|
||||||
|
#define HAL_PERI_ON_READ32(addr) HAL_READ32(PERI_ON_BASE, addr)
|
||||||
|
#define HAL_PERI_ON_WRITE32(addr, value) HAL_WRITE32(PERI_ON_BASE, addr, value)
|
||||||
|
#define HAL_PERI_ON_READ16(addr) HAL_READ16(PERI_ON_BASE, addr)
|
||||||
|
#define HAL_PERI_ON_WRITE16(addr, value) HAL_WRITE16(PERI_ON_BASE, addr, value)
|
||||||
|
#define HAL_PERI_ON_READ8(addr) HAL_READ8(PERI_ON_BASE, addr)
|
||||||
|
#define HAL_PERI_ON_WRITE8(addr, value) HAL_WRITE8(PERI_ON_BASE, addr, value)
|
||||||
|
#define HAL_PERL_ON_FUNC_CTRL(addr,value,ctrl) \
|
||||||
|
HAL_PERI_ON_WRITE32(addr, ((HAL_PERI_ON_READ32(addr) & (~value))|((MASK_ALLON - ctrl + 1) & value)))
|
||||||
|
#define HAL_PERL_ON_PIN_SEL(addr,mask,value) \
|
||||||
|
HAL_PERI_ON_WRITE32(addr, ((HAL_PERI_ON_READ32(addr) & (~mask)) | value))
|
||||||
|
|
||||||
|
//40 REG_SYS_REGU_CTRL0
|
||||||
|
#define LDO25M_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_SYS_REGU_CTRL0, BIT_SYS_REGU_LDO25M_EN, ctrl)
|
||||||
|
|
||||||
|
//A0 SYS_DEBUG_CTRL
|
||||||
|
#define DEBUG_PIN_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_SYS_DEBUG_CTRL, BIT_SYS_DBG_PIN_EN, ctrl)
|
||||||
|
|
||||||
|
//A4 SYS_PINMUX_CTRL
|
||||||
|
#define SIC_PIN_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_SYS_PINMUX_CTRL, BIT_SIC_PIN_EN, ctrl)
|
||||||
|
#define EEPROM_PIN_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_SYS_PINMUX_CTRL, BIT_EEPROM_PIN_EN, ctrl)
|
||||||
|
|
||||||
|
|
||||||
|
//210 SOV_FUNC_EN
|
||||||
|
#define LXBUS_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_SOC_FUNC_EN, BIT_SOC_LXBUS_EN, ctrl)
|
||||||
|
#define FLASH_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(SPI_FLASH_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_FUNC_EN, BIT_SOC_FLASH_EN, ctrl);}
|
||||||
|
|
||||||
|
#define MEM_CTRL_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(SDR_SDRAM_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_FUNC_EN, BIT_SOC_MEM_CTRL_EN, ctrl);}
|
||||||
|
|
||||||
|
#define LOC_UART_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(LOG_UART_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_FUNC_EN, BIT_SOC_LOG_UART_EN, ctrl);}
|
||||||
|
|
||||||
|
#define GDMA0_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(GDMA0_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_FUNC_EN, BIT_SOC_GDMA0_EN, ctrl);}
|
||||||
|
|
||||||
|
#define GDMA1_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(GDMA1_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_FUNC_EN, BIT_SOC_GDMA1_EN, ctrl);}
|
||||||
|
|
||||||
|
#define GTIMER_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(TIMER_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_FUNC_EN, BIT_SOC_GTIMER_EN, ctrl);}
|
||||||
|
|
||||||
|
#define SECURITY_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(CRYPTO_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_FUNC_EN, BIT_SOC_SECURITY_ENGINE_EN, ctrl);}
|
||||||
|
|
||||||
|
//214 SOC_HCI_COM_FUNC_EN
|
||||||
|
#define SDIOD_ON_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(SDIO_DEVICE_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_HCI_COM_FUNC_EN, BIT_SOC_HCI_SDIOD_ON_EN, ctrl);}
|
||||||
|
|
||||||
|
#define SDIOD_OFF_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(SDIO_DEVICE_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_HCI_COM_FUNC_EN, BIT_SOC_HCI_SDIOD_OFF_EN, ctrl);}
|
||||||
|
|
||||||
|
#define SDIOH_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(SDIO_HOST_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_HCI_COM_FUNC_EN, BIT_SOC_HCI_SDIOH_EN, ctrl);}
|
||||||
|
|
||||||
|
#define SDIO_ON_RST_MASK(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_SOC_HCI_COM_FUNC_EN, BIT_SOC_HCI_SDIOD_ON_RST_MUX, ctrl)
|
||||||
|
#define OTG_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(USB_OTG_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_HCI_COM_FUNC_EN, BIT_SOC_HCI_OTG_EN, ctrl);}
|
||||||
|
|
||||||
|
#define OTG_RST_MASK(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_SOC_HCI_COM_FUNC_EN, BIT_SOC_HCI_OTG_RST_MUX, ctrl)
|
||||||
|
#define MII_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(MII_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_HCI_COM_FUNC_EN, BIT_SOC_HCI_MII_EN, ctrl);}
|
||||||
|
|
||||||
|
#define MII_MUX_SEL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_SOC_HCI_COM_FUNC_EN, BIT_SOC_HCI_SM_SEL, ctrl)
|
||||||
|
#define WL_MACON_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(WIFI_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_HCI_COM_FUNC_EN, BIT_SOC_HCI_WL_MACON_EN, ctrl);}
|
||||||
|
|
||||||
|
//218 SOC_PERI_FUNC0_EN
|
||||||
|
#define UART0_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(UART0_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_FUNC0_EN, BIT_PERI_UART0_EN, ctrl);}
|
||||||
|
|
||||||
|
#define UART1_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(UART1_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_FUNC0_EN, BIT_PERI_UART1_EN, ctrl);}
|
||||||
|
|
||||||
|
#define UART2_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(UART2_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_FUNC0_EN, BIT_PERI_UART2_EN, ctrl);}
|
||||||
|
|
||||||
|
#define SPI0_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(SPI0_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_FUNC0_EN, BIT_PERI_SPI0_EN, ctrl);}
|
||||||
|
|
||||||
|
#define SPI1_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(SPI1_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_FUNC0_EN, BIT_PERI_SPI1_EN, ctrl);}
|
||||||
|
|
||||||
|
#define SPI2_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(SPI2_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_FUNC0_EN, BIT_PERI_SPI2_EN, ctrl);}
|
||||||
|
|
||||||
|
#define I2C0_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(I2C0_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_FUNC0_EN, BIT_PERI_I2C0_EN, ctrl);}
|
||||||
|
|
||||||
|
#define I2C1_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(I2C1_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_FUNC0_EN, BIT_PERI_I2C1_EN, ctrl);}
|
||||||
|
|
||||||
|
#define I2C2_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(I2C2_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_FUNC0_EN, BIT_PERI_I2C2_EN, ctrl);}
|
||||||
|
|
||||||
|
#define I2C3_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(I2C3_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_FUNC0_EN, BIT_PERI_I2C3_EN, ctrl);}
|
||||||
|
|
||||||
|
#define I2S0_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(I2S0_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_FUNC0_EN, BIT_PERI_I2S0_EN, ctrl);}
|
||||||
|
|
||||||
|
#define I2S1_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(I2S1_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_FUNC0_EN, BIT_PERI_I2S1_EN, ctrl);}
|
||||||
|
|
||||||
|
#define PCM0_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(PCM0_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_FUNC0_EN, BIT_PERI_PCM0_EN, ctrl);}
|
||||||
|
|
||||||
|
#define PCM1_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(PCM1_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_FUNC0_EN, BIT_PERI_PCM1_EN, ctrl);}
|
||||||
|
|
||||||
|
//21C SOC_PERI_FUNC1_EN
|
||||||
|
#define ADC0_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(ADC_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_FUNC1_EN, BIT_PERI_ADC0_EN, ctrl);}
|
||||||
|
|
||||||
|
#define DAC0_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(DAC_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_FUNC1_EN, BIT_PERI_DAC0_EN, ctrl);}
|
||||||
|
|
||||||
|
#define DAC1_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(DAC_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_FUNC1_EN, BIT_PERI_DAC1_EN, ctrl);}
|
||||||
|
|
||||||
|
#define GPIO_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(GPIO_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_FUNC1_EN, BIT_PERI_GPIO_EN, ctrl);}
|
||||||
|
|
||||||
|
//220 SOC_PERI_BD_FUNC0_EN
|
||||||
|
#define UART0_BD_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(UART0_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_BD_FUNC0_EN, BIT_PERI_UART0_BD_EN, ctrl);}
|
||||||
|
|
||||||
|
#define UART1_BD_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(UART1_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_BD_FUNC0_EN, BIT_PERI_UART1_BD_EN, ctrl);}
|
||||||
|
|
||||||
|
#define UART2_BD_FCTRL(ctrl) { \
|
||||||
|
if (!ctrl) { \
|
||||||
|
HAL_READ32(UART2_REG_BASE,0);\
|
||||||
|
}\
|
||||||
|
HAL_PERL_ON_FUNC_CTRL(REG_SOC_PERI_BD_FUNC0_EN, BIT_PERI_UART2_BD_EN, ctrl);}
|
||||||
|
|
||||||
|
//230 PESOC_CLK_CTRL
|
||||||
|
#define ACTCK_CPU_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_CKE_PLFM, ctrl)
|
||||||
|
#define ACTCK_TRACE_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_ACTCK_TRACE_EN, ctrl)
|
||||||
|
#define SLPCK_TRACE_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_SLPCK_TRACE_EN, ctrl)
|
||||||
|
#define ACTCK_VENDOR_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_ACTCK_VENDOR_REG_EN, ctrl)
|
||||||
|
#define SLPCK_VENDOR_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_SLPCK_VENDOR_REG_EN, ctrl)
|
||||||
|
#define ACTCK_FLASH_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_ACTCK_FLASH_EN, ctrl)
|
||||||
|
#define SLPCK_FLASH_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_SLPCK_FLASH_EN, ctrl)
|
||||||
|
#define ACTCK_SDR_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_ACTCK_SDR_EN, ctrl)
|
||||||
|
#define SLPCK_SDR_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_SLPCK_SDR_EN, ctrl)
|
||||||
|
#define ACTCK_LOG_UART_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_ACTCK_LOG_UART_EN, ctrl)
|
||||||
|
#define SLPCK_LOG_UART_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_SLPCK_LOG_UART_EN, ctrl)
|
||||||
|
#define ACTCK_TIMER_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_ACTCK_TIMER_EN, ctrl)
|
||||||
|
#define SLPCK_TIMER_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_SLPCK_TIMER_EN, ctrl)
|
||||||
|
#define ACTCK_GDMA0_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_ACTCK_GDMA0_EN, ctrl)
|
||||||
|
#define SLPCK_GDMA0_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_SLPCK_GDMA0_EN, ctrl)
|
||||||
|
#define ACTCK_GDMA1_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_ACTCK_GDMA1_EN, ctrl)
|
||||||
|
#define SLPCK_GDMA1_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_SLPCK_GDMA1_EN, ctrl)
|
||||||
|
#define ACTCK_GPIO_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_ACTCK_GPIO_EN, ctrl)
|
||||||
|
#define SLPCK_GPIO_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_SLPCK_GPIO_EN, ctrl)
|
||||||
|
#define ACTCK_BTCMD_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_ACTCK_BTCMD_EN, ctrl)
|
||||||
|
#define SLPCK_BTCMD_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_CLK_CTRL, BIT_SOC_SLPCK_BTCMD_EN, ctrl)
|
||||||
|
|
||||||
|
//234 PESOC_PERI_CLK_CTRL0
|
||||||
|
#define ACTCK_UART0_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL0, BIT_SOC_ACTCK_UART0_EN, ctrl)
|
||||||
|
#define SLPCK_UART0_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL0, BIT_SOC_SLPCK_UART0_EN, ctrl)
|
||||||
|
#define ACTCK_UART1_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL0, BIT_SOC_ACTCK_UART1_EN, ctrl)
|
||||||
|
#define SLPCK_UART1_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL0, BIT_SOC_SLPCK_UART1_EN, ctrl)
|
||||||
|
#define ACTCK_UART2_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL0, BIT_SOC_ACTCK_UART2_EN, ctrl)
|
||||||
|
#define SLPCK_UART2_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL0, BIT_SOC_SLPCK_UART2_EN, ctrl)
|
||||||
|
#define ACTCK_SPI0_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL0, BIT_SOC_ACTCK_SPI0_EN, ctrl)
|
||||||
|
#define SLPCK_SPI0_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL0, BIT_SOC_SLPCK_SPI0_EN, ctrl)
|
||||||
|
#define ACTCK_SPI1_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL0, BIT_SOC_ACTCK_SPI1_EN, ctrl)
|
||||||
|
#define SLPCK_SPI1_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL0, BIT_SOC_SLPCK_SPI1_EN, ctrl)
|
||||||
|
#define ACTCK_SPI2_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL0, BIT_SOC_ACTCK_SPI2_EN, ctrl)
|
||||||
|
#define SLPCK_SPI2_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL0, BIT_SOC_SLPCK_SPI2_EN, ctrl)
|
||||||
|
|
||||||
|
//238 PESOC_PERI_CLK_CTRL1
|
||||||
|
#define ACTCK_I2C0_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL1, BIT_SOC_ACTCK_I2C0_EN, ctrl)
|
||||||
|
#define SLPCK_I2C0_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL1, BIT_SOC_SLPCK_I2C0_EN, ctrl)
|
||||||
|
#define ACTCK_I2C1_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL1, BIT_SOC_ACTCK_I2C1_EN, ctrl)
|
||||||
|
#define SLPCK_I2C1_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL1, BIT_SOC_SLPCK_I2C1_EN, ctrl)
|
||||||
|
#define ACTCK_I2C2_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL1, BIT_SOC_ACTCK_I2C2_EN, ctrl)
|
||||||
|
#define SLPCK_I2C2_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL1, BIT_SOC_SLPCK_I2C2_EN, ctrl)
|
||||||
|
#define ACTCK_I2C3_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL1, BIT_SOC_ACTCK_I2C3_EN, ctrl)
|
||||||
|
#define SLPCK_I2C3_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL1, BIT_SOC_SLPCK_I2C3_EN, ctrl)
|
||||||
|
#define ACTCK_I2S_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL1, BIT_SOC_ACTCK_I2S_EN, ctrl)
|
||||||
|
#define SLPCK_I2S_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL1, BIT_SOC_SLPCK_I2S_EN, ctrl)
|
||||||
|
#define ACTCK_PCM_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL1, BIT_SOC_ACTCK_PCM_EN, ctrl)
|
||||||
|
#define SLPCK_PCM_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL1, BIT_SOC_SLPCK_PCM_EN, ctrl)
|
||||||
|
#define ACTCK_ADC_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL1, BIT_SOC_ACTCK_ADC_EN, ctrl)
|
||||||
|
#define SLPCK_ADC_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL1, BIT_SOC_SLPCK_ADC_EN, ctrl)
|
||||||
|
#define ACTCK_DAC_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL1, BIT_SOC_ACTCK_DAC_EN, ctrl)
|
||||||
|
#define SLPCK_DAC_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CLK_CTRL1, BIT_SOC_SLPCK_DAC_EN, ctrl)
|
||||||
|
|
||||||
|
//240 PESOC_HCI_CLK_CTRL0
|
||||||
|
#define ACTCK_SDIOD_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_HCI_CLK_CTRL0, BIT_SOC_ACTCK_SDIO_DEV_EN, ctrl)
|
||||||
|
#define SLPCK_SDIOD_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_HCI_CLK_CTRL0, BIT_SOC_SLPCK_SDIO_DEV_EN, ctrl)
|
||||||
|
#define ACTCK_SDIOH_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_HCI_CLK_CTRL0, BIT_SOC_ACTCK_SDIO_HST_EN, ctrl)
|
||||||
|
#define SLPCK_SDIOH_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_HCI_CLK_CTRL0, BIT_SOC_SLPCK_SDIO_HST_EN, ctrl)
|
||||||
|
#define ACTCK_OTG_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_HCI_CLK_CTRL0, BIT_SOC_ACTCK_OTG_EN, ctrl)
|
||||||
|
#define SLPCK_OTG_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_HCI_CLK_CTRL0, BIT_SOC_SLPCK_OTG_EN, ctrl)
|
||||||
|
#define ACTCK_MII_MPHY_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_HCI_CLK_CTRL0, BIT_SOC_ACTCK_MII_MPHY_EN, ctrl)
|
||||||
|
#define SLPCK_MII_MPHY_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_HCI_CLK_CTRL0, BIT_SOC_SLPCK_MII_MPHY_EN, ctrl)
|
||||||
|
|
||||||
|
//244 PESOC_COM_CLK_CTRL1
|
||||||
|
#define ACTCK_WL_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_COM_CLK_CTRL1, BIT_SOC_ACTCK_WL_EN, ctrl)
|
||||||
|
#define SLPCK_WL_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_COM_CLK_CTRL1, BIT_SOC_SLPCK_WL_EN, ctrl)
|
||||||
|
#define ACTCK_SEC_ENG_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_COM_CLK_CTRL1, BIT_SOC_ACTCK_SECURITY_ENG_EN, ctrl)
|
||||||
|
#define SLPCK_SEC_ENG_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_COM_CLK_CTRL1, BIT_SOC_SLPCK_SECURITY_ENG_EN, ctrl)
|
||||||
|
#define ACTCK_NFC_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_COM_CLK_CTRL1, BIT_SOC_ACTCK_NFC_EN, ctrl)
|
||||||
|
#define SLPCK_NFC_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_COM_CLK_CTRL1, BIT_SOC_SLPCK_NFC_EN, ctrl)
|
||||||
|
#define NFC_CAL_CCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_COM_CLK_CTRL1, BIT_SOC_NFC_CAL_EN, ctrl)
|
||||||
|
|
||||||
|
//250 REG_PERI_CLK_SEL
|
||||||
|
#define TRACE_CLK_SEL(num) HAL_PERL_ON_PIN_SEL(REG_PESOC_CLK_SEL, (BIT_MASK_PESOC_TRACE_CK_SEL << BIT_SHIFT_PESOC_TRACE_CK_SEL), BIT_PESOC_TRACE_CK_SEL(num))
|
||||||
|
#define FLASH_CLK_SEL(num) HAL_PERL_ON_PIN_SEL(REG_PESOC_CLK_SEL, (BIT_MASK_PESOC_FLASH_CK_SEL << BIT_SHIFT_PESOC_FLASH_CK_SEL), BIT_PESOC_FLASH_CK_SEL(num))
|
||||||
|
#define SDR_CLK_SEL(num) HAL_PERL_ON_PIN_SEL(REG_PESOC_CLK_SEL, (BIT_MASK_PESOC_SDR_CK_SEL << BIT_SHIFT_PESOC_SDR_CK_SEL), BIT_PESOC_SDR_CK_SEL(num))
|
||||||
|
#define I2C_SCLK_SEL(num) HAL_PERL_ON_PIN_SEL(REG_PESOC_CLK_SEL, (BIT_MASK_PESOC_PERI_SCLK_SEL << BIT_SHIFT_PESOC_PERI_SCLK_SEL), BIT_PESOC_PERI_SCLK_SEL(num))
|
||||||
|
|
||||||
|
//270 REG_OSC32K_CTRL
|
||||||
|
#define OSC32K_CKGEN_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_OSC32K_CTRL, BIT_32K_POW_CKGEN_EN, ctrl)
|
||||||
|
|
||||||
|
//280 REG_UART_MUX_CTRL
|
||||||
|
#define UART0_PIN_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_UART_MUX_CTRL, BIT_UART0_PIN_EN, ctrl)
|
||||||
|
#define UART0_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_UART_MUX_CTRL, (BIT_MASK_UART0_PIN_SEL << BIT_SHIFT_UART0_PIN_SEL), BIT_UART0_PIN_SEL(num))
|
||||||
|
#define UART1_PIN_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_UART_MUX_CTRL, BIT_UART1_PIN_EN, ctrl)
|
||||||
|
#define UART1_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_UART_MUX_CTRL, (BIT_MASK_UART1_PIN_SEL << BIT_SHIFT_UART1_PIN_SEL), BIT_UART1_PIN_SEL(num))
|
||||||
|
#define UART2_PIN_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_UART_MUX_CTRL, BIT_UART2_PIN_EN, ctrl)
|
||||||
|
#define UART2_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_UART_MUX_CTRL, (BIT_MASK_UART2_PIN_SEL << BIT_SHIFT_UART2_PIN_SEL), BIT_UART2_PIN_SEL(num))
|
||||||
|
|
||||||
|
//284 REG_SPI_MUX_CTRL
|
||||||
|
#define SPI0_PIN_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_SPI_MUX_CTRL, BIT_SPI0_PIN_EN, ctrl)
|
||||||
|
#define SPI0_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_SPI_MUX_CTRL, (BIT_MASK_SPI0_PIN_SEL << BIT_SHIFT_SPI0_PIN_SEL), BIT_SPI0_PIN_SEL(num))
|
||||||
|
#define SPI1_PIN_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_SPI_MUX_CTRL, BIT_SPI1_PIN_EN, ctrl)
|
||||||
|
#define SPI1_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_SPI_MUX_CTRL, (BIT_MASK_SPI1_PIN_SEL << BIT_SHIFT_SPI1_PIN_SEL), BIT_SPI1_PIN_SEL(num))
|
||||||
|
#define SPI2_PIN_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_SPI_MUX_CTRL, BIT_SPI2_PIN_EN, ctrl)
|
||||||
|
#define SPI2_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_SPI_MUX_CTRL, (BIT_MASK_SPI2_PIN_SEL << BIT_SHIFT_SPI2_PIN_SEL), BIT_SPI2_PIN_SEL(num))
|
||||||
|
#define SPI0_MULTI_CS_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_SPI_MUX_CTRL, BIT_SPI0_MULTI_CS_EN, ctrl)
|
||||||
|
|
||||||
|
//288 REG_I2C_MUX_CTRL
|
||||||
|
#define I2C0_PIN_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_I2C_MUX_CTRL, BIT_I2C0_PIN_EN, ctrl)
|
||||||
|
#define I2C0_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_I2C_MUX_CTRL, (BIT_MASK_I2C0_PIN_SEL << BIT_SHIFT_I2C0_PIN_SEL), BIT_I2C0_PIN_SEL(num))
|
||||||
|
#define I2C1_PIN_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_I2C_MUX_CTRL, BIT_I2C1_PIN_EN, ctrl)
|
||||||
|
#define I2C1_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_I2C_MUX_CTRL, (BIT_MASK_I2C1_PIN_SEL << BIT_SHIFT_I2C1_PIN_SEL), BIT_I2C1_PIN_SEL(num))
|
||||||
|
#define I2C2_PIN_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_I2C_MUX_CTRL, BIT_I2C2_PIN_EN, ctrl)
|
||||||
|
#define I2C2_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_I2C_MUX_CTRL, (BIT_MASK_I2C2_PIN_SEL << BIT_SHIFT_I2C2_PIN_SEL), BIT_I2C2_PIN_SEL(num))
|
||||||
|
#define I2C3_PIN_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_I2C_MUX_CTRL, BIT_I2C3_PIN_EN, ctrl)
|
||||||
|
#define I2C3_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_I2C_MUX_CTRL, (BIT_MASK_I2C3_PIN_SEL << BIT_SHIFT_I2C3_PIN_SEL), BIT_I2C3_PIN_SEL(num))
|
||||||
|
|
||||||
|
//28C REG_I2S_MUX_CTRL
|
||||||
|
#define I2S0_PIN_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_I2S_MUX_CTRL, BIT_I2S0_PIN_EN, ctrl)
|
||||||
|
#define I2S0_MCK_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_I2S_MUX_CTRL, BIT_I2S0_MCK_EN, ctrl)
|
||||||
|
#define I2S0_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_I2S_MUX_CTRL, (BIT_MASK_I2S0_PIN_SEL << BIT_SHIFT_I2S0_PIN_SEL), BIT_I2S0_PIN_SEL(num))
|
||||||
|
#define I2S1_PIN_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_I2S_MUX_CTRL, BIT_I2S1_PIN_EN, ctrl)
|
||||||
|
#define I2S1_MCK_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_I2S_MUX_CTRL, BIT_I2S1_MCK_EN, ctrl)
|
||||||
|
#define I2S1_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_I2S_MUX_CTRL, (BIT_MASK_I2S1_PIN_SEL << BIT_SHIFT_I2S1_PIN_SEL), BIT_I2S1_PIN_SEL(num))
|
||||||
|
#define PCM0_PIN_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_I2S_MUX_CTRL, BIT_PCM0_PIN_EN, ctrl)
|
||||||
|
#define PCM0_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_I2S_MUX_CTRL, (BIT_MASK_PCM0_PIN_SEL << BIT_SHIFT_PCM0_PIN_SEL), BIT_PCM0_PIN_SEL(num))
|
||||||
|
#define PCM1_PIN_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_I2S_MUX_CTRL, BIT_PCM1_PIN_EN, ctrl)
|
||||||
|
#define PCM1_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_I2S_MUX_CTRL, (BIT_MASK_PCM1_PIN_SEL << BIT_SHIFT_PCM1_PIN_SEL), BIT_PCM1_PIN_SEL(num))
|
||||||
|
|
||||||
|
//2A0 HCI_PINMUX_CTRL
|
||||||
|
#define SDIOD_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_HCI_PINMUX_CTRL, BIT_HCI_SDIOD_PIN_EN, ctrl)
|
||||||
|
#define SDIOH_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_HCI_PINMUX_CTRL, BIT_HCI_SDIOH_PIN_EN, ctrl)
|
||||||
|
#define MII_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_HCI_PINMUX_CTRL, BIT_HCI_MII_PIN_EN, ctrl)
|
||||||
|
|
||||||
|
//2A4 WL_PINMUX_CTRL
|
||||||
|
#define LED_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_WL_PINMUX_CTRL, BIT_WL_LED_PIN_EN, ctrl)
|
||||||
|
#define LED_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_WL_PINMUX_CTRL, (BIT_MASK_WL_LED_PIN_SEL << BIT_SHIFT_WL_LED_PIN_SEL), BIT_WL_LED_PIN_SEL(num))
|
||||||
|
#define ANT0_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_WL_PINMUX_CTRL, BIT_WL_ANT0_PIN_EN, ctrl)
|
||||||
|
#define ANT1_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_WL_PINMUX_CTRL, BIT_WL_ANT1_PIN_EN, ctrl)
|
||||||
|
#define BTCOEX_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_WL_PINMUX_CTRL, BIT_WL_BTCOEX_PIN_EN, ctrl)
|
||||||
|
#define BTCMD_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_WL_PINMUX_CTRL, BIT_WL_BTCMD_PIN_EN, ctrl)
|
||||||
|
#define NFC_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_WL_PINMUX_CTRL, BIT_NFC_PIN_EN, ctrl)
|
||||||
|
|
||||||
|
//2AC PWM_PINMUX_CTRL
|
||||||
|
#define PWM0_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PWM_PINMUX_CTRL, BIT_PWM0_PIN_EN, ctrl)
|
||||||
|
#define PWM0_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_PWM_PINMUX_CTRL, (BIT_MASK_PWM0_PIN_SEL << BIT_SHIFT_PWM0_PIN_SEL), BIT_PWM0_PIN_SEL(num))
|
||||||
|
#define PWM1_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PWM_PINMUX_CTRL, BIT_PWM1_PIN_EN, ctrl)
|
||||||
|
#define PWM1_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_PWM_PINMUX_CTRL, (BIT_MASK_PWM1_PIN_SEL << BIT_SHIFT_PWM1_PIN_SEL), BIT_PWM1_PIN_SEL(num))
|
||||||
|
#define PWM2_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PWM_PINMUX_CTRL, BIT_PWM2_PIN_EN, ctrl)
|
||||||
|
#define PWM2_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_PWM_PINMUX_CTRL, (BIT_MASK_PWM2_PIN_SEL << BIT_SHIFT_PWM2_PIN_SEL), BIT_PWM2_PIN_SEL(num))
|
||||||
|
#define PWM3_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PWM_PINMUX_CTRL, BIT_PWM3_PIN_EN, ctrl)
|
||||||
|
#define PWM3_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_PWM_PINMUX_CTRL, (BIT_MASK_PWM3_PIN_SEL << BIT_SHIFT_PWM3_PIN_SEL), BIT_PWM3_PIN_SEL(num))
|
||||||
|
#define ETE0_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PWM_PINMUX_CTRL, BIT_ETE0_PIN_EN, ctrl)
|
||||||
|
#define ETE0_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_PWM_PINMUX_CTRL, (BIT_MASK_ETE0_PIN_SEL << BIT_SHIFT_ETE0_PIN_SEL), BIT_ETE0_PIN_SEL(num))
|
||||||
|
#define ETE1_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PWM_PINMUX_CTRL, BIT_ETE1_PIN_EN, ctrl)
|
||||||
|
#define ETE1_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_PWM_PINMUX_CTRL, (BIT_MASK_ETE1_PIN_SEL << BIT_SHIFT_ETE1_PIN_SEL), BIT_ETE1_PIN_SEL(num))
|
||||||
|
#define ETE2_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PWM_PINMUX_CTRL, BIT_ETE2_PIN_EN, ctrl)
|
||||||
|
#define ETE2_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_PWM_PINMUX_CTRL, (BIT_MASK_ETE2_PIN_SEL << BIT_SHIFT_ETE2_PIN_SEL), BIT_ETE2_PIN_SEL(num))
|
||||||
|
#define ETE3_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PWM_PINMUX_CTRL, BIT_ETE3_PIN_EN, ctrl)
|
||||||
|
#define ETE3_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_PWM_PINMUX_CTRL, (BIT_MASK_ETE3_PIN_SEL << BIT_SHIFT_ETE3_PIN_SEL), BIT_ETE3_PIN_SEL(num))
|
||||||
|
|
||||||
|
//2C0 CPU_PERIPHERAL_CTRL
|
||||||
|
#define SPI_FLASH_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_CPU_PERIPHERAL_CTRL, BIT_SPI_FLSH_PIN_EN, ctrl)
|
||||||
|
#define SPI_FLASH_PIN_SEL(num) HAL_PERL_ON_PIN_SEL(REG_CPU_PERIPHERAL_CTRL, (BIT_MASK_SPI_FLSH_PIN_SEL << BIT_SHIFT_SPI_FLSH_PIN_SEL), BIT_SPI_FLSH_PIN_SEL(num))
|
||||||
|
#define SDR_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_CPU_PERIPHERAL_CTRL, BIT_SDR_PIN_EN, ctrl)
|
||||||
|
#define TRACE_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_CPU_PERIPHERAL_CTRL, BIT_TRACE_PIN_EN, ctrl)
|
||||||
|
#define LOG_UART_PIN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_CPU_PERIPHERAL_CTRL, BIT_LOG_UART_PIN_EN, ctrl)
|
||||||
|
#define LOG_UART_IR_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_CPU_PERIPHERAL_CTRL, BIT_LOG_UART_IR_EN, ctrl)
|
||||||
|
|
||||||
|
//300 REG_PESOC_MEM_CTRL
|
||||||
|
#define SDR_DDL_FCTRL(ctrl) HAL_PERL_ON_PIN_SEL(REG_PESOC_MEM_CTRL, (BIT_MASK_PESOC_SDR_DDL_CTRL << BIT_SHIFT_PESOC_SDR_DDL_CTRL), BIT_PESOC_SDR_DDL_CTRL(ctrl))
|
||||||
|
#define FLASH_DDL_FCTRL(ctrl) HAL_PERL_ON_PIN_SEL(REG_PESOC_MEM_CTRL, (BIT_MASK_PESOC_FLASH_DDL_CTRL << BIT_SHIFT_PESOC_FLASH_DDL_CTRL), BIT_PESOC_FLASH_DDL_CTRL(ctrl))
|
||||||
|
|
||||||
|
//304 REG_PESOC_SOC_CTRL
|
||||||
|
#define SRAM_MUX_CFG(num) HAL_PERL_ON_PIN_SEL(REG_PESOC_SOC_CTRL, (BIT_MASK_PESOC_SRAM_MUX_CFG << BIT_SHIFT_PESOC_SRAM_MUX_CFG), BIT_PESOC_SRAM_MUX_CFG(num))
|
||||||
|
#define LX_WL_SWAP_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_SOC_CTRL, BIT_PESOC_LX_WL_SWAP_SEL, ctrl)
|
||||||
|
#define LX_MST_SWAP_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_SOC_CTRL, BIT_PESOC_LX_MST_SWAP_SEL, ctrl)
|
||||||
|
#define LX_SLV_SWAP_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_SOC_CTRL, BIT_PESOC_LX_SLV_SWAP_SEL, ctrl)
|
||||||
|
#define MII_LX_WRAPPER_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_SOC_CTRL, BIT_PESOC_MII_LX_WRAPPER_EN, ctrl)
|
||||||
|
#define MII_LX_MST_SWAP_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_SOC_CTRL, BIT_PESOC_MII_LX_MST_SWAP_SEL, ctrl)
|
||||||
|
#define MII_LX_SLV_SWAP_CTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_SOC_CTRL, BIT_PESOC_MII_LX_SLV_SWAP_SEL, ctrl)
|
||||||
|
#define GDMA_CFG(num) HAL_PERL_ON_PIN_SEL(REG_PESOC_SOC_CTRL, (BIT_MASK_PESOC_GDMA_CFG << BIT_SHIFT_PESOC_GDMA_CFG), BIT_PESOC_GDMA_CFG(num))
|
||||||
|
|
||||||
|
//308 PESOC_PERI_CTRL
|
||||||
|
#define SPI_RN_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PESOC_PERI_CTRL, BIT_SOC_FUNC_SPI_RN, ctrl)
|
||||||
|
|
||||||
|
//320 GPIO_SHTDN_CTRL
|
||||||
|
#define GPIO_GPA_SHTDN_N_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_GPIO_SHTDN_CTRL, BIT_GPIO_GPA_SHTDN_N, ctrl)
|
||||||
|
#define GPIO_GPB_SHTDN_N_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_GPIO_SHTDN_CTRL, BIT_GPIO_GPB_SHTDN_N, ctrl)
|
||||||
|
#define GPIO_GPC_SHTDN_N_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_GPIO_SHTDN_CTRL, BIT_GPIO_GPC_SHTDN_N, ctrl)
|
||||||
|
#define GPIO_GPD_SHTDN_N_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_GPIO_SHTDN_CTRL, BIT_GPIO_GPD_SHTDN_N, ctrl)
|
||||||
|
#define GPIO_GPE_SHTDN_N_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_GPIO_SHTDN_CTRL, BIT_GPIO_GPE_SHTDN_N, ctrl)
|
||||||
|
#define GPIO_GPF_SHTDN_N_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_GPIO_SHTDN_CTRL, BIT_GPIO_GPF_SHTDN_N, ctrl)
|
||||||
|
#define GPIO_GPG_SHTDN_N_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_GPIO_SHTDN_CTRL, BIT_GPIO_GPG_SHTDN_N, ctrl)
|
||||||
|
#define GPIO_GPH_SHTDN_N_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_GPIO_SHTDN_CTRL, BIT_GPIO_GPH_SHTDN_N, ctrl)
|
||||||
|
#define GPIO_GPI_SHTDN_N_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_GPIO_SHTDN_CTRL, BIT_GPIO_GPI_SHTDN_N, ctrl)
|
||||||
|
#define GPIO_GPJ_SHTDN_N_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_GPIO_SHTDN_CTRL, BIT_GPIO_GPJ_SHTDN_N, ctrl)
|
||||||
|
#define GPIO_GPK_SHTDN_N_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_GPIO_SHTDN_CTRL, BIT_GPIO_GPK_SHTDN_N, ctrl)
|
||||||
|
|
||||||
|
//374
|
||||||
|
#define EGTIM_FCTRL(ctrl) HAL_PERL_ON_FUNC_CTRL(REG_PERI_EGTIM_CTRL, BIT_PERI_EGTIM_EN, ctrl)
|
||||||
|
#define EGTIM_RSIG_SEL(num) HAL_PERL_ON_PIN_SEL(REG_PERI_EGTIM_CTRL, (BIT_MASK_PERI_EGTIM_REF_SIG_SEL << BIT_SHIFT_PERI_EGTIM_REF_SIG_SEL), BIT_PERI_EGTIM_REF_SIG_SEL(num))
|
||||||
|
#define EGTIME_PIN_G0_OPT_SEL(num) HAL_PERL_ON_PIN_SEL(REG_PERI_EGTIM_CTRL, (BIT_MASK_PERI_EGTIM_PIN_GROUP0_OPT_SEL << BIT_SHIFT_PERI_EGTIM_PIN_GROUP0_OPT_SEL), BIT_PERI_EGTIM_PIN_GROUP0_OPT_SEL(num))
|
||||||
|
#define EGTIME_PIN_G1_OPT_SEL(num) HAL_PERL_ON_PIN_SEL(REG_PERI_EGTIM_CTRL, (BIT_MASK_PERI_EGTIM_PIN_GROUP1_OPT_SEL << BIT_SHIFT_PERI_EGTIM_PIN_GROUP1_OPT_SEL), BIT_PERI_EGTIM_PIN_GROUP1_OPT_SEL(num))
|
||||||
|
#define EGTIME_PIN_G2_OPT_SEL(num) HAL_PERL_ON_PIN_SEL(REG_PERI_EGTIM_CTRL, (BIT_MASK_PERI_EGTIM_PIN_GROUP2_OPT_SEL << BIT_SHIFT_PERI_EGTIM_PIN_GROUP2_OPT_SEL), BIT_PERI_EGTIM_PIN_GROUP2_OPT_SEL(num))
|
||||||
|
|
||||||
|
|
||||||
|
#endif //_HAL_PERI_ON_H_
|
||||||
|
|
64
sdk/component/soc/realtek/8195a/fwlib/hal_pinmux.h
Normal file
64
sdk/component/soc/realtek/8195a/fwlib/hal_pinmux.h
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
#ifndef _HAL_PINMUX_
|
||||||
|
#define _HAL_PINMUX_
|
||||||
|
|
||||||
|
|
||||||
|
//Function Index
|
||||||
|
#define UART0 0
|
||||||
|
#define UART1 1
|
||||||
|
#define UART2 2
|
||||||
|
#define SPI0 8
|
||||||
|
#define SPI1 9
|
||||||
|
#define SPI2 10
|
||||||
|
#define SPI0_MCS 15
|
||||||
|
#define I2C0 16
|
||||||
|
#define I2C1 17
|
||||||
|
#define I2C2 18
|
||||||
|
#define I2C3 19
|
||||||
|
#define I2S0 24
|
||||||
|
#define I2S1 25
|
||||||
|
#define PCM0 28
|
||||||
|
#define PCM1 29
|
||||||
|
#define ADC0 32
|
||||||
|
#define DAC0 36
|
||||||
|
#define DAC1 37
|
||||||
|
#define SDIOD 64
|
||||||
|
#define SDIOH 65
|
||||||
|
#define USBOTG 66
|
||||||
|
#define MII 88
|
||||||
|
#define WL_LED 96
|
||||||
|
#define WL_ANT0 104
|
||||||
|
#define WL_ANT1 105
|
||||||
|
#define WL_BTCOEX 108
|
||||||
|
#define WL_BTCMD 109
|
||||||
|
#define NFC 112
|
||||||
|
#define PWM0 160
|
||||||
|
#define PWM1 161
|
||||||
|
#define PWM2 162
|
||||||
|
#define PWM3 163
|
||||||
|
#define ETE0 164
|
||||||
|
#define ETE1 165
|
||||||
|
#define ETE2 166
|
||||||
|
#define ETE3 167
|
||||||
|
#define EGTIM 168
|
||||||
|
#define SPI_FLASH 196
|
||||||
|
#define SDR 200
|
||||||
|
#define JTAG 216
|
||||||
|
#define TRACE 217
|
||||||
|
#define LOG_UART 220
|
||||||
|
#define LOG_UART_IR 221
|
||||||
|
#define SIC 224
|
||||||
|
#define EEPROM 225
|
||||||
|
#define DEBUG 226
|
||||||
|
|
||||||
|
//Location Index(Pin Mux Selection)
|
||||||
|
#define S0 0
|
||||||
|
#define S1 1
|
||||||
|
#define S2 2
|
||||||
|
#define S3 3
|
||||||
|
|
||||||
|
_LONG_CALL_ u8
|
||||||
|
HalPinCtrlRtl8195A(
|
||||||
|
IN u32 Function,
|
||||||
|
IN u32 PinLocation,
|
||||||
|
IN BOOL Operation);
|
||||||
|
#endif //_HAL_PINMUX_
|
102
sdk/component/soc/realtek/8195a/fwlib/hal_platform.h
Normal file
102
sdk/component/soc/realtek/8195a/fwlib/hal_platform.h
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _HAL_PLATFORM_
|
||||||
|
#define _HAL_PLATFORM_
|
||||||
|
|
||||||
|
#define ROMVERSION 0x03
|
||||||
|
#define ROMINFORMATION (ROMVERSION)
|
||||||
|
|
||||||
|
#define SYSTEM_CLK PLATFORM_CLOCK
|
||||||
|
|
||||||
|
#define SDR_SDRAM_BASE 0x30000000
|
||||||
|
#define SYSTEM_CTRL_BASE 0x40000000
|
||||||
|
#define PERI_ON_BASE 0x40000000
|
||||||
|
#define VENDOR_REG_BASE 0x40002800
|
||||||
|
#define SPI_FLASH_BASE 0x98000000
|
||||||
|
#define SDR_CTRL_BASE 0x40005000
|
||||||
|
|
||||||
|
#define PERIPHERAL_IRQ_STATUS 0x04
|
||||||
|
#define PERIPHERAL_IRQ_MODE 0x08
|
||||||
|
#define PERIPHERAL_IRQ_EN 0x0C
|
||||||
|
#define LP_PERI_EXT_IRQ_STATUS 0x24
|
||||||
|
#define LP_PERI_EXT_IRQ_MODE 0x28
|
||||||
|
#define LP_PERI_EXT_IRQ_EN 0x2C
|
||||||
|
|
||||||
|
#define PERIPHERAL_IRQ_ALL_LEVEL 0
|
||||||
|
|
||||||
|
#define TIMER_CLK 32*1000
|
||||||
|
|
||||||
|
//3 Peripheral IP Base Address
|
||||||
|
#define GPIO_REG_BASE 0x40001000
|
||||||
|
#define TIMER_REG_BASE 0x40002000
|
||||||
|
#define NFC_INTERFACE_BASE 0x40002400
|
||||||
|
#define LOG_UART_REG_BASE 0x40003000
|
||||||
|
#define I2C2_REG_BASE 0x40003400
|
||||||
|
#define I2C3_REG_BASE 0x40003800
|
||||||
|
#define SPI_FLASH_CTRL_BASE 0x40006000
|
||||||
|
#define ADC_REG_BASE 0x40010000
|
||||||
|
#define DAC_REG_BASE 0x40011000
|
||||||
|
#define UART0_REG_BASE 0x40040000
|
||||||
|
#define UART1_REG_BASE 0x40040400
|
||||||
|
#define UART2_REG_BASE 0x40040800
|
||||||
|
#define SPI0_REG_BASE 0x40042000
|
||||||
|
#define SPI1_REG_BASE 0x40042400
|
||||||
|
#define SPI2_REG_BASE 0x40042800
|
||||||
|
#define I2C0_REG_BASE 0x40044000
|
||||||
|
#define I2C1_REG_BASE 0x40044400
|
||||||
|
#define SDIO_DEVICE_REG_BASE 0x40050000
|
||||||
|
#define MII_REG_BASE 0x40050000
|
||||||
|
#define SDIO_HOST_REG_BASE 0x40058000
|
||||||
|
#define GDMA0_REG_BASE 0x40060000
|
||||||
|
#define GDMA1_REG_BASE 0x40061000
|
||||||
|
#define I2S0_REG_BASE 0x40062000
|
||||||
|
#define I2S1_REG_BASE 0x40063000
|
||||||
|
#define PCM0_REG_BASE 0x40064000
|
||||||
|
#define PCM1_REG_BASE 0x40065000
|
||||||
|
#define CRYPTO_REG_BASE 0x40070000
|
||||||
|
#define WIFI_REG_BASE 0x40080000
|
||||||
|
#define USB_OTG_REG_BASE 0x400C0000
|
||||||
|
|
||||||
|
#define GDMA1_REG_OFF 0x1000
|
||||||
|
#define I2S1_REG_OFF 0x1000
|
||||||
|
#define PCM1_REG_OFF 0x1000
|
||||||
|
#define SSI_REG_OFF 0x400
|
||||||
|
#define RUART_REG_OFF 0x400
|
||||||
|
|
||||||
|
#define CPU_CLK_TYPE_NO 6
|
||||||
|
|
||||||
|
enum _BOOT_TYPE_ {
|
||||||
|
BOOT_FROM_FLASH = 0,
|
||||||
|
BOOT_FROM_SDIO = 1,
|
||||||
|
BOOT_FROM_USB = 2,
|
||||||
|
BOOT_FROM_RSVD = 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum _EFUSE_CPU_CLK_ {
|
||||||
|
#if 1
|
||||||
|
CLK_200M = 0,
|
||||||
|
CLK_100M = 1,
|
||||||
|
CLK_50M = 2,
|
||||||
|
CLK_25M = 3,
|
||||||
|
CLK_12_5M = 4,
|
||||||
|
CLK_4M = 5,
|
||||||
|
#else
|
||||||
|
CLK_25M = 0,
|
||||||
|
CLK_200M = 1,
|
||||||
|
CLK_100M = 2,
|
||||||
|
CLK_50M = 3,
|
||||||
|
CLK_12_5M = 4,
|
||||||
|
CLK_4M = 5,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //_HAL_PLATFORM_
|
57
sdk/component/soc/realtek/8195a/fwlib/hal_pwm.h
Normal file
57
sdk/component/soc/realtek/8195a/fwlib/hal_pwm.h
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HAL_PWM_H_
|
||||||
|
#define _HAL_PWM_H_
|
||||||
|
|
||||||
|
#define MAX_PWM_CTRL_PIN 4
|
||||||
|
// the minimum tick time for G-timer is 61 us (clock source = 32768Hz, reload value=1 and reload takes extra 1T)
|
||||||
|
//#define GTIMER_TICK_US 31 // micro-second, 1000000/32768 ~= 30.5
|
||||||
|
#define MIN_GTIMER_TIMEOUT 61 // in micro-sec, use this value to set the g-timer to generate tick for PWM. 61=(1000000/32768)*2
|
||||||
|
#define PWM_GTIMER_TICK_TIME 61 // in micro-sec, use this value to set the g-timer to generate tick for PWM. 61=(1000000/32768)*2
|
||||||
|
|
||||||
|
typedef struct _HAL_PWM_ADAPTER_ {
|
||||||
|
u8 pwm_id; // the PWM ID, 0~3
|
||||||
|
u8 sel; // PWM Pin selection, 0~3
|
||||||
|
u8 gtimer_id; // using G-Timer ID, there are 7 G-timer, but we prefer to use timer 3~6
|
||||||
|
u8 enable; // is enabled
|
||||||
|
// u32 timer_value; // the G-Timer auto-reload value, source clock is 32768Hz, reload will takes extra 1 tick. To set the time of a tick of PWM
|
||||||
|
u32 tick_time; // the tick time for the G-timer
|
||||||
|
u32 period; // the period of a PWM control cycle, in PWM tick
|
||||||
|
u32 pulsewidth; // the pulse width in a period of a PWM control cycle, in PWM tick. To control the ratio
|
||||||
|
// float duty_ratio; // the dyty ratio = pulswidth/period
|
||||||
|
}HAL_PWM_ADAPTER, *PHAL_PWM_ADAPTER;
|
||||||
|
|
||||||
|
|
||||||
|
extern HAL_Status
|
||||||
|
HAL_Pwm_Init(
|
||||||
|
u32 pwm_id,
|
||||||
|
u32 sel
|
||||||
|
);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
HAL_Pwm_Enable(
|
||||||
|
u32 pwm_id
|
||||||
|
);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
HAL_Pwm_Disable(
|
||||||
|
u32 pwm_id
|
||||||
|
);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
HAL_Pwm_SetDuty(
|
||||||
|
u32 pwm_id,
|
||||||
|
u32 period,
|
||||||
|
u32 pulse_width
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
278
sdk/component/soc/realtek/8195a/fwlib/hal_soc_ps_monitor.h
Normal file
278
sdk/component/soc/realtek/8195a/fwlib/hal_soc_ps_monitor.h
Normal file
|
@ -0,0 +1,278 @@
|
||||||
|
#ifndef _HAL_SOCPWR_
|
||||||
|
#define _HAL_SOCPWR_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define MAX_BACKUP_SIZE 129
|
||||||
|
#define MAXFUNC 10
|
||||||
|
#define FSTREG 0xFF
|
||||||
|
|
||||||
|
#define REG_VDR_ANACK_CAL_CTRL 0xA0
|
||||||
|
|
||||||
|
#define PS_MASK 0xFFFFFFFF
|
||||||
|
|
||||||
|
//pwr state
|
||||||
|
#define HWACT 0
|
||||||
|
#define HWCG 1
|
||||||
|
#define HWINACT 2
|
||||||
|
#define UNDEF 3
|
||||||
|
#define ALLMET 0xff
|
||||||
|
|
||||||
|
//SLP
|
||||||
|
#define SLP_STIMER BIT0
|
||||||
|
#define SLP_GTIMER BIT1
|
||||||
|
#define SLP_GPIO BIT2
|
||||||
|
#define SLP_WL BIT3
|
||||||
|
#define SLP_NFC BIT4
|
||||||
|
#define SLP_SDIO BIT5
|
||||||
|
#define SLP_USB BIT6
|
||||||
|
#define SLP_TIMER33 BIT7
|
||||||
|
|
||||||
|
//DSTBY
|
||||||
|
#define DSTBY_STIMER BIT0
|
||||||
|
#define DSTBY_NFC BIT1
|
||||||
|
#define DSTBY_TIMER33 BIT2
|
||||||
|
#define DSTBY_GPIO BIT3
|
||||||
|
|
||||||
|
//DS wake event
|
||||||
|
#define DS_TIMER33 BIT0
|
||||||
|
#define DS_GPIO BIT1
|
||||||
|
|
||||||
|
enum power_state_idx{
|
||||||
|
ACT = 0,
|
||||||
|
WFE = 1,
|
||||||
|
WFI = 2,
|
||||||
|
SNOOZE = 3,
|
||||||
|
SLPCG = 4,
|
||||||
|
SLPPG = 5,
|
||||||
|
DSTBY = 6,
|
||||||
|
DSLP = 7,
|
||||||
|
INACT = 8,
|
||||||
|
MAXSTATE = 9
|
||||||
|
};
|
||||||
|
|
||||||
|
enum clk_idx{
|
||||||
|
ANACK = 0,
|
||||||
|
A33CK = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _power_state_{
|
||||||
|
u8 FuncIdx;
|
||||||
|
u8 PowerState;
|
||||||
|
}POWER_STATE, *pPOWER_STATE;
|
||||||
|
|
||||||
|
typedef struct _reg_power_state_{
|
||||||
|
u8 FuncIdx;
|
||||||
|
u8 PwrState;
|
||||||
|
}REG_POWER_STATE, *pPREG_POWER_STATE;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
typedef struct _power_state_{
|
||||||
|
u8 FuncIdx;
|
||||||
|
u8 PowerState;
|
||||||
|
u32 ReqDuration;
|
||||||
|
u32 RegCount;
|
||||||
|
u32 RemainDuration;
|
||||||
|
}POWER_STATE, *pPOWER_STATE;
|
||||||
|
|
||||||
|
typedef struct _reg_power_state_{
|
||||||
|
u8 FuncIdx;
|
||||||
|
u8 PwrState;
|
||||||
|
u32 ReqDuration;
|
||||||
|
//u8 StateIdx;
|
||||||
|
}REG_POWER_STATE, *pPREG_POWER_STATE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct _power_mgn_{
|
||||||
|
u8 ActFuncCount;
|
||||||
|
POWER_STATE PwrState[MAXFUNC];
|
||||||
|
u8 CurrentState;
|
||||||
|
u8 SDREn;
|
||||||
|
u32 MSPbackup[MAX_BACKUP_SIZE];
|
||||||
|
u32 CPURegbackup[25];
|
||||||
|
u32 CPUPSP;
|
||||||
|
u32 WakeEventFlag;
|
||||||
|
BOOL SleepFlag;
|
||||||
|
//u32 CPUReg[13];
|
||||||
|
//u32 MSBackUp[128];
|
||||||
|
}Power_Mgn, *pPower_Mgn;
|
||||||
|
|
||||||
|
typedef struct _SYS_ADAPTER_ {
|
||||||
|
u8 function;
|
||||||
|
}SYS_ADAPTER, *PSYS_ADAPTER;
|
||||||
|
|
||||||
|
extern Power_Mgn PwrAdapter;
|
||||||
|
|
||||||
|
u8 ChangeSoCPwrState(
|
||||||
|
IN u8 RequestState,
|
||||||
|
IN u32 ReqCount
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID PrintCPU(VOID);
|
||||||
|
void WakeFromSLPPG(void);
|
||||||
|
VOID SOCPSTestApp(VOID *Data);
|
||||||
|
|
||||||
|
|
||||||
|
__inline static VOID
|
||||||
|
CPURegBackUp(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
#if defined (__ICCARM__)
|
||||||
|
// TODO: IAR has different way using assembly
|
||||||
|
#elif defined (__GNUC__)
|
||||||
|
//backup cpu reg
|
||||||
|
#if 0
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
"PUSH {PSR, PC, LR, R12,R3,R2,R1,R0}\n"
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
#if 0
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
"PUSH {r0,r1,r2,r3,r4}\n"
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
|
||||||
|
"MOV %0, r0\n"
|
||||||
|
:"=r"(PwrAdapter.CPURegbackup[0])
|
||||||
|
::"memory"
|
||||||
|
);
|
||||||
|
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
"MOV %0, r1\n"
|
||||||
|
:"=r"(PwrAdapter.CPURegbackup[1])
|
||||||
|
::"memory"
|
||||||
|
);
|
||||||
|
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
"MOV %0, r2\n"
|
||||||
|
:"=r"(PwrAdapter.CPURegbackup[2])
|
||||||
|
::"memory"
|
||||||
|
);
|
||||||
|
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
"MOV %0, r3\n"
|
||||||
|
:"=r"(PwrAdapter.CPURegbackup[3])
|
||||||
|
::"memory"
|
||||||
|
);
|
||||||
|
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
"MOV %0, r4\n"
|
||||||
|
:"=r"(PwrAdapter.CPURegbackup[4])
|
||||||
|
::"memory"
|
||||||
|
);
|
||||||
|
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
"MOV %0, r5\n"
|
||||||
|
:"=r"(PwrAdapter.CPURegbackup[5])
|
||||||
|
::"memory"
|
||||||
|
);
|
||||||
|
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
"MOV %0, r6\n"
|
||||||
|
:"=r"(PwrAdapter.CPURegbackup[6])
|
||||||
|
::"memory"
|
||||||
|
);
|
||||||
|
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
"MOV %0, r7\n"
|
||||||
|
:"=r"(PwrAdapter.CPURegbackup[7])
|
||||||
|
::"memory"
|
||||||
|
);
|
||||||
|
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
"MOV %0, r8\n"
|
||||||
|
:"=r"(PwrAdapter.CPURegbackup[8])
|
||||||
|
::"memory"
|
||||||
|
);
|
||||||
|
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
"MOV %0, r9\n"
|
||||||
|
:"=r"(PwrAdapter.CPURegbackup[9])
|
||||||
|
::"memory"
|
||||||
|
);
|
||||||
|
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
"MOV %0, r10\n"
|
||||||
|
:"=r"(PwrAdapter.CPURegbackup[10])
|
||||||
|
::"memory"
|
||||||
|
);
|
||||||
|
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
"MOV %0, r11\n"
|
||||||
|
:"=r"(PwrAdapter.CPURegbackup[11])
|
||||||
|
::"memory"
|
||||||
|
);
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
"MOV %0, r12\n"
|
||||||
|
:"=r"(PwrAdapter.CPURegbackup[12])
|
||||||
|
::"memory"
|
||||||
|
);
|
||||||
|
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
"MOV %0, r13\n"
|
||||||
|
:"=r"(PwrAdapter.CPURegbackup[13])
|
||||||
|
::"memory"
|
||||||
|
);
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
//"MOV %0, r14\n"
|
||||||
|
"LDR %0, =SLPPG_WAKEUP_POINT\n"
|
||||||
|
"ADD %0, #1\n"
|
||||||
|
:"=r"(PwrAdapter.CPURegbackup[14])
|
||||||
|
::"memory"
|
||||||
|
);
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
"LDR %0, =SLPPG_WAKEUP_POINT\n"
|
||||||
|
"ADD %0, #1\n"
|
||||||
|
:"=r"(PwrAdapter.CPURegbackup[15])
|
||||||
|
::"memory"
|
||||||
|
);
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
"MRS %0, PSR\n"
|
||||||
|
:"=r"(PwrAdapter.CPURegbackup[16])
|
||||||
|
::"memory"
|
||||||
|
);
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
asm volatile
|
||||||
|
(
|
||||||
|
"mov %0, r13\n"
|
||||||
|
"MOV %1, PC\n"
|
||||||
|
"MRS %2, CONTROL\n"
|
||||||
|
"MRS %3, PSP\n"
|
||||||
|
"MRS %4, MSP\n"
|
||||||
|
:"=r"(PwrAdapter.CPURegbackup[24]),"=r"(PwrAdapter.CPURegbackup[23]),"=r"(PwrAdapter.CPURegbackup[22]),"=r"(PwrAdapter.CPURegbackup[21]),"=r"(PwrAdapter.CPURegbackup[20])
|
||||||
|
::"memory"
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_SOC_PS_VERIFY
|
||||||
|
PrintCPU();
|
||||||
|
#endif //#ifdef CONFIG_SOC_PS_VERIFY
|
||||||
|
#endif //#elif defined (__GNUC__)
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID RegPowerState(REG_POWER_STATE RegPwrState);
|
||||||
|
|
||||||
|
#endif //_HAL_SOCPWR_
|
254
sdk/component/soc/realtek/8195a/fwlib/hal_spi_flash.h
Normal file
254
sdk/component/soc/realtek/8195a/fwlib/hal_spi_flash.h
Normal file
|
@ -0,0 +1,254 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _HAL_SPIFLASH__
|
||||||
|
#define _HAL_SPIFLASH__
|
||||||
|
//======================================================
|
||||||
|
// Header files
|
||||||
|
|
||||||
|
#define SPIC_CALIBRATION_IN_NVM 1 // if store the SPIC calibration data in the NVM
|
||||||
|
#ifndef CONFIG_IMAGE_SEPARATE // Store SPIC Calibration only for seprated image
|
||||||
|
#undef SPIC_CALIBRATION_IN_NVM
|
||||||
|
#define SPIC_CALIBRATION_IN_NVM 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//======================================================
|
||||||
|
// Definition
|
||||||
|
#define HAL_SPI_WRITE32(addr, value32) HAL_WRITE32(SPI_FLASH_CTRL_BASE, addr, value32)
|
||||||
|
#define HAL_SPI_WRITE16(addr, value16) HAL_WRITE16(SPI_FLASH_CTRL_BASE, addr, value16)
|
||||||
|
#define HAL_SPI_WRITE8(addr, value8) HAL_WRITE8(SPI_FLASH_CTRL_BASE, addr, value8)
|
||||||
|
#define HAL_SPI_READ32(addr) HAL_READ32(SPI_FLASH_CTRL_BASE, addr)
|
||||||
|
#define HAL_SPI_READ16(addr) HAL_READ16(SPI_FLASH_CTRL_BASE, addr)
|
||||||
|
#define HAL_SPI_READ8(addr) HAL_READ8(SPI_FLASH_CTRL_BASE, addr)
|
||||||
|
|
||||||
|
typedef struct _SPIC_PARA_MODE_ {
|
||||||
|
u8 Valid:1; // valid
|
||||||
|
u8 CpuClk:3; // CPU clock
|
||||||
|
u8 BitMode:2; // Bit mode
|
||||||
|
u8 Reserved:2; // reserved
|
||||||
|
} SPIC_PARA_MODE, *PSPIC_PARA_MODE;
|
||||||
|
|
||||||
|
typedef struct _SPIC_INIT_PARA_ {
|
||||||
|
u8 BaudRate;
|
||||||
|
u8 RdDummyCyle;
|
||||||
|
u8 DelayLine;
|
||||||
|
union {
|
||||||
|
u8 Rsvd;
|
||||||
|
u8 Valid;
|
||||||
|
SPIC_PARA_MODE Mode;
|
||||||
|
};
|
||||||
|
#if defined(E_CUT_ROM_DOMAIN) || (!defined(CONFIG_RELEASE_BUILD_LIBRARIES))
|
||||||
|
u8 id[3];
|
||||||
|
u8 flashtype;
|
||||||
|
#endif
|
||||||
|
}SPIC_INIT_PARA, *PSPIC_INIT_PARA;
|
||||||
|
|
||||||
|
|
||||||
|
enum _SPIC_BIT_MODE_ {
|
||||||
|
SpicOneBitMode = 0,
|
||||||
|
SpicDualBitMode = 1,
|
||||||
|
SpicQuadBitMode = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
//======================================================
|
||||||
|
// Flash type used
|
||||||
|
#define FLASH_OTHERS 0
|
||||||
|
#define FLASH_MXIC 1
|
||||||
|
#define FLASH_WINBOND 2
|
||||||
|
#define FLASH_MICRON 3
|
||||||
|
|
||||||
|
#define FLASH_MXIC_MX25L4006E 1
|
||||||
|
#define FLASH_MXIC_MX25L8073E 0
|
||||||
|
|
||||||
|
// The below parts are based on the flash characteristics
|
||||||
|
//====== Flash Command Definition ======
|
||||||
|
#if FLASH_MXIC_MX25L4006E
|
||||||
|
#define FLASH_CMD_WREN 0x06 //write enable
|
||||||
|
#define FLASH_CMD_WRDI 0x04 //write disable
|
||||||
|
#define FLASH_CMD_WRSR 0x01 //write status register
|
||||||
|
#define FLASH_CMD_RDID 0x9F //read idenfication
|
||||||
|
#define FLASH_CMD_RDSR 0x05 //read status register
|
||||||
|
#define FLASH_CMD_READ 0x03 //read data
|
||||||
|
#define FLASH_CMD_FREAD 0x0B //fast read data
|
||||||
|
#define FLASH_CMD_RDSFDP 0x5A //Read SFDP
|
||||||
|
#define FLASH_CMD_RES 0xAB //Read Electronic ID
|
||||||
|
#define FLASH_CMD_REMS 0x90 //Read Electronic Manufacturer & Device ID
|
||||||
|
#define FLASH_CMD_DREAD 0x3B //Double Output Mode command
|
||||||
|
#define FLASH_CMD_SE 0x20 //Sector Erase
|
||||||
|
#define FLASH_CMD_BE 0xD8 //Block Erase(or 0x52)
|
||||||
|
#define FLASH_CMD_CE 0x60 //Chip Erase(or 0xC7)
|
||||||
|
#define FLASH_CMD_PP 0x02 //Page Program
|
||||||
|
#define FLASH_CMD_DP 0xB9 //Deep Power Down
|
||||||
|
#define FLASH_CMD_RDP 0xAB //Release from Deep Power-Down
|
||||||
|
#elif FLASH_MXIC_MX25L8073E
|
||||||
|
#define FLASH_CMD_WREN 0x06 //write enable
|
||||||
|
#define FLASH_CMD_WRDI 0x04 //write disable
|
||||||
|
#define FLASH_CMD_WRSR 0x01 //write status register
|
||||||
|
#define FLASH_CMD_RDID 0x9F //read idenfication
|
||||||
|
#define FLASH_CMD_RDSR 0x05 //read status register
|
||||||
|
#define FLASH_CMD_READ 0x03 //read data
|
||||||
|
#define FLASH_CMD_FREAD 0x0B //fast read data
|
||||||
|
#define FLASH_CMD_RDSFDP 0x5A //Read SFDP
|
||||||
|
#define FLASH_CMD_RES 0xAB //Read Electronic ID
|
||||||
|
#define FLASH_CMD_REMS 0x90 //Read Electronic Manufacturer & Device ID
|
||||||
|
#define FLASH_CMD_DREAD 0x3B //Double Output Mode command
|
||||||
|
#define FLASH_CMD_SE 0x20 //Sector Erase
|
||||||
|
#define FLASH_CMD_BE 0x52 //Block Erase
|
||||||
|
#define FLASH_CMD_CE 0x60 //Chip Erase(or 0xC7)
|
||||||
|
#define FLASH_CMD_PP 0x02 //Page Program
|
||||||
|
#define FLASH_CMD_DP 0xB9 //Deep Power Down
|
||||||
|
#define FLASH_CMD_RDP 0xAB //Release from Deep Power-Down
|
||||||
|
#define FLASH_CMD_2READ 0xBB // 2 x I/O read command
|
||||||
|
#define FLASH_CMD_4READ 0xEB // 4 x I/O read command
|
||||||
|
#define FLASH_CMD_QREAD 0x6B // 1I / 4O read command
|
||||||
|
#define FLASH_CMD_4PP 0x38 //quad page program
|
||||||
|
#define FLASH_CMD_FF 0xFF //Release Read Enhanced
|
||||||
|
#define FLASH_CMD_REMS2 0xEF // read ID for 2x I/O mode
|
||||||
|
#define FLASH_CMD_REMS4 0xDF // read ID for 4x I/O mode
|
||||||
|
#define FLASH_CMD_ENSO 0xB1 // enter secured OTP
|
||||||
|
#define FLASH_CMD_EXSO 0xC1 // exit secured OTP
|
||||||
|
#define FLASH_CMD_RDSCUR 0x2B // read security register
|
||||||
|
#define FLASH_CMD_WRSCUR 0x2F // write security register
|
||||||
|
#else
|
||||||
|
#define FLASH_CMD_WREN 0x06 //write enable
|
||||||
|
#define FLASH_CMD_WRDI 0x04 //write disable
|
||||||
|
#define FLASH_CMD_WRSR 0x01 //write status register
|
||||||
|
#define FLASH_CMD_RDID 0x9F //read idenfication
|
||||||
|
#define FLASH_CMD_RDSR 0x05 //read status register
|
||||||
|
#define FLASH_CMD_READ 0x03 //read data
|
||||||
|
#define FLASH_CMD_FREAD 0x0B //fast read data
|
||||||
|
#define FLASH_CMD_RDSFDP 0x5A //Read SFDP
|
||||||
|
#define FLASH_CMD_RES 0xAB //Read Electronic ID
|
||||||
|
#define FLASH_CMD_REMS 0x90 //Read Electronic Manufacturer & Device ID
|
||||||
|
#define FLASH_CMD_DREAD 0x3B //Double Output Mode command
|
||||||
|
#define FLASH_CMD_SE 0x20 //Sector Erase
|
||||||
|
#define FLASH_CMD_BE 0x52 //Block Erase
|
||||||
|
#define FLASH_CMD_CE 0x60 //Chip Erase(or 0xC7)
|
||||||
|
#define FLASH_CMD_PP 0x02 //Page Program
|
||||||
|
#define FLASH_CMD_DP 0xB9 //Deep Power Down
|
||||||
|
#define FLASH_CMD_RDP 0xAB //Release from Deep Power-Down
|
||||||
|
#define FLASH_CMD_2READ 0xBB // 2 x I/O read command
|
||||||
|
#define FLASH_CMD_4READ 0xEB // 4 x I/O read command
|
||||||
|
#define FLASH_CMD_QREAD 0x6B // 1I / 4O read command
|
||||||
|
#define FLASH_CMD_4PP 0x38 //quad page program
|
||||||
|
#define FLASH_CMD_FF 0xFF //Release Read Enhanced
|
||||||
|
#define FLASH_CMD_REMS2 0xEF // read ID for 2x I/O mode
|
||||||
|
#define FLASH_CMD_REMS4 0xDF // read ID for 4x I/O mode
|
||||||
|
#define FLASH_CMD_ENSO 0xB1 // enter secured OTP
|
||||||
|
#define FLASH_CMD_EXSO 0xC1 // exit secured OTP
|
||||||
|
#define FLASH_CMD_RDSCUR 0x2B // read security register
|
||||||
|
#define FLASH_CMD_WRSCUR 0x2F // write security register
|
||||||
|
#endif //#if FLASH_MXIC_MX25L4006E
|
||||||
|
// ============================
|
||||||
|
|
||||||
|
// ===== Flash Parameter Definition =====
|
||||||
|
#if FLASH_MXIC_MX25L4006E
|
||||||
|
#define FLASH_RD_2IO_EN 0
|
||||||
|
#define FLASH_RD_2O_EN 1
|
||||||
|
#define FLASH_RD_4IO_EN 0
|
||||||
|
#define FLASH_RD_4O_EN 0
|
||||||
|
#define FLASH_WR_2IO_EN 0
|
||||||
|
#define FLASH_WR_2O_EN 0
|
||||||
|
#define FLASH_WR_4IO_EN 0
|
||||||
|
#define FLASH_WR_4O_EN 0
|
||||||
|
|
||||||
|
#define FLASH_DM_CYCLE_2O 0x08
|
||||||
|
#define FLASH_VLD_DUAL_CMDS (BIT_WR_BLOCKING | BIT_RD_DUAL_I)
|
||||||
|
#define FLASH_VLD_QUAD_CMDS (0)
|
||||||
|
|
||||||
|
#elif FLASH_MXIC_MX25L8073E //This flash model is just for prototype, if you want to use it,
|
||||||
|
//the code MUST be rechecked according to the flash spec.
|
||||||
|
#define FLASH_RD_2IO_EN 1
|
||||||
|
#define FLASH_RD_2O_EN 0
|
||||||
|
#define FLASH_RD_4IO_EN 1
|
||||||
|
#define FLASH_RD_4O_EN 0
|
||||||
|
#define FLASH_WR_2IO_EN 1
|
||||||
|
#define FLASH_WR_2O_EN 0
|
||||||
|
#define FLASH_WR_4IO_EN 1
|
||||||
|
#define FLASH_WR_4O_EN 0
|
||||||
|
|
||||||
|
#define FLASH_DM_CYCLE_2O 0x08
|
||||||
|
#define FLASH_DM_CYCLE_2IO 0x04
|
||||||
|
#define FLASH_DM_CYCLE_4O 0x08
|
||||||
|
#define FLASH_DM_CYCLE_4IO 0x04
|
||||||
|
|
||||||
|
#define FLASH_VLD_DUAL_CMDS (BIT_WR_BLOCKING | BIT_RD_DUAL_IO)
|
||||||
|
#define FLASH_VLD_QUAD_CMDS (BIT_WR_BLOCKING | BIT_WR_QUAD_II | BIT_RD_QUAD_IO)
|
||||||
|
#else
|
||||||
|
#define FLASH_RD_2IO_EN 1
|
||||||
|
#define FLASH_RD_2O_EN 0
|
||||||
|
#define FLASH_RD_4IO_EN 1
|
||||||
|
#define FLASH_RD_4O_EN 0
|
||||||
|
#define FLASH_WR_2IO_EN 1
|
||||||
|
#define FLASH_WR_2O_EN 0
|
||||||
|
#define FLASH_WR_4IO_EN 1
|
||||||
|
#define FLASH_WR_4O_EN 0
|
||||||
|
|
||||||
|
#define FLASH_DM_CYCLE_2O 0x08
|
||||||
|
#define FLASH_DM_CYCLE_2IO 0x04
|
||||||
|
#define FLASH_DM_CYCLE_4O 0x08
|
||||||
|
#define FLASH_DM_CYCLE_4IO 0x04
|
||||||
|
|
||||||
|
#define FLASH_VLD_DUAL_CMDS (BIT_WR_BLOCKING | BIT_RD_DUAL_IO)
|
||||||
|
#define FLASH_VLD_QUAD_CMDS (BIT_WR_BLOCKING | BIT_WR_QUAD_II | BIT_RD_QUAD_IO)
|
||||||
|
#endif
|
||||||
|
#if 0
|
||||||
|
//======================================================
|
||||||
|
// Function prototype
|
||||||
|
BOOLEAN SpicFlashInitRtl8195A(u8 SpicBitMode);
|
||||||
|
|
||||||
|
_LONG_CALL_
|
||||||
|
extern VOID SpicLoadInitParaFromClockRtl8195A(u8 CpuClkMode, u8 BaudRate, PSPIC_INIT_PARA pSpicInitPara);
|
||||||
|
|
||||||
|
// spi-flash controller initialization
|
||||||
|
_LONG_CALL_
|
||||||
|
extern VOID SpicInitRtl8195A(u8 InitBaudRate, u8 SpicBitMode);
|
||||||
|
|
||||||
|
// wait sr[0] = 0, wait transmission done
|
||||||
|
_LONG_CALL_
|
||||||
|
extern VOID SpicWaitBusyDoneRtl8195A(VOID);
|
||||||
|
|
||||||
|
// wait spi-flash status register[0] = 0
|
||||||
|
//_LONG_CALL_
|
||||||
|
//extern VOID SpicWaitWipDoneRtl8195A(SPIC_INIT_PARA SpicInitPara);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//======================================================
|
||||||
|
// ROM Function prototype
|
||||||
|
_LONG_CALL_ VOID SpiFlashAppV02(IN VOID *Data);
|
||||||
|
_LONG_CALL_ROM_ VOID SpicInitRtl8195AV02(IN u8 InitBaudRate,IN u8 SpicBitMode);
|
||||||
|
|
||||||
|
_LONG_CALL_ROM_ VOID SpicEraseFlashRtl8195AV02(VOID);
|
||||||
|
|
||||||
|
_LONG_CALL_ROM_ VOID SpicLoadInitParaFromClockRtl8195AV02(IN u8 CpuClkMode,IN u8 BaudRate,IN PSPIC_INIT_PARA pSpicInitPara);
|
||||||
|
|
||||||
|
|
||||||
|
VOID SpicBlockEraseFlashRtl8195A(IN u32 Address);
|
||||||
|
VOID SpicSectorEraseFlashRtl8195A(IN u32 Address);
|
||||||
|
VOID SpicDieEraseFlashRtl8195A(IN u32 Address);
|
||||||
|
VOID SpicWriteProtectFlashRtl8195A(IN u32 Protect);
|
||||||
|
VOID SpicWaitWipDoneRefinedRtl8195A(IN SPIC_INIT_PARA SpicInitPara);
|
||||||
|
VOID SpicWaitOperationDoneRtl8195A(IN SPIC_INIT_PARA SpicInitPara);
|
||||||
|
VOID SpicRxCmdRefinedRtl8195A(IN u8 cmd,IN SPIC_INIT_PARA SpicInitPara);
|
||||||
|
u8 SpicGetFlashStatusRefinedRtl8195A(IN SPIC_INIT_PARA SpicInitPara);
|
||||||
|
VOID SpicInitRefinedRtl8195A(IN u8 InitBaudRate,IN u8 SpicBitMode);
|
||||||
|
u32 SpicWaitWipRtl8195A(VOID);
|
||||||
|
u32 SpicOneBitCalibrationRtl8195A(IN u8 SysCpuClk);
|
||||||
|
VOID SpicDisableRtl8195A(VOID);
|
||||||
|
VOID SpicDeepPowerDownFlashRtl8195A(VOID);
|
||||||
|
VOID SpicUserProgramRtl8195A(IN u8 * data, IN SPIC_INIT_PARA SpicInitPara, IN u32 addr, IN u32 * LengthInfo);
|
||||||
|
|
||||||
|
#if SPIC_CALIBRATION_IN_NVM
|
||||||
|
VOID SpicNVMCalLoad(u8 BitMode, u8 CpuClk);
|
||||||
|
VOID SpicNVMCalLoadAll(void);
|
||||||
|
VOID SpicNVMCalStore(u8 BitMode, u8 CpuClk);
|
||||||
|
#endif // #if SPIC_CALIBRATION_IN_NVM
|
||||||
|
|
||||||
|
#endif //_HAL_SPIFLASH__
|
309
sdk/component/soc/realtek/8195a/fwlib/hal_ssi.h
Normal file
309
sdk/component/soc/realtek/8195a/fwlib/hal_ssi.h
Normal file
|
@ -0,0 +1,309 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HAL_SSI_H_
|
||||||
|
#define _HAL_SSI_H_
|
||||||
|
|
||||||
|
#include "rtl8195a_ssi.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LOG Configurations
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern u32 SSI_DBG_CONFIG;
|
||||||
|
extern uint8_t SPI0_IS_AS_SLAVE;
|
||||||
|
|
||||||
|
|
||||||
|
#define SSI_DBG_ENTRANCE(...) do {\
|
||||||
|
if (unlikely(SSI_DBG_CONFIG & DBG_TYPE_ENTRANCE)) \
|
||||||
|
DBG_SSI_INFO(IDENT_FOUR_SPACE ANSI_COLOR_GREEN __VA_ARGS__ ANSI_COLOR_RESET); \
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define SSI_DBG_INIT(...) do {\
|
||||||
|
if (unlikely(SSI_DBG_CONFIG & DBG_TYPE_INIT)) \
|
||||||
|
DBG_SSI_INFO(IDENT_FOUR_SPACE __VA_ARGS__); \
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define SSI_DBG_INIT_V(...) do {\
|
||||||
|
if (unlikely(SSI_DBG_CONFIG & DBG_TYPE_INIT_V)) \
|
||||||
|
DBG_SSI_INFO(IDENT_FOUR_SPACE __VA_ARGS__); \
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define SSI_DBG_INIT_VV(...) do {\
|
||||||
|
if (unlikely(SSI_DBG_CONFIG & DBG_TYPE_INIT_VV)) \
|
||||||
|
DBG_SSI_INFO(IDENT_FOUR_SPACE __VA_ARGS__); \
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define SSI_DBG_PINMUX(...) do {\
|
||||||
|
if (unlikely(SSI_DBG_CONFIG & DBG_TYPE_PINMUX)) \
|
||||||
|
DBG_SSI_INFO(IDENT_FOUR_SPACE __VA_ARGS__); \
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define SSI_DBG_ENDIS(...) do {\
|
||||||
|
if (unlikely(SSI_DBG_CONFIG & DBG_TYPE_ENDIS)) \
|
||||||
|
DBG_SSI_INFO(IDENT_FOUR_SPACE __VA_ARGS__); \
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define SSI_DBG_INT(...) do {\
|
||||||
|
if (unlikely(SSI_DBG_CONFIG & DBG_TYPE_INT)) \
|
||||||
|
DBG_SSI_INFO(IDENT_FOUR_SPACE __VA_ARGS__); \
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define SSI_DBG_INT_V(...) do {\
|
||||||
|
if (unlikely(SSI_DBG_CONFIG & DBG_TYPE_INT_V)) \
|
||||||
|
DBG_SSI_INFO(IDENT_FOUR_SPACE __VA_ARGS__); \
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define SSI_DBG_INT_HNDLR(...) do {\
|
||||||
|
if (unlikely(SSI_DBG_CONFIG & DBG_TYPE_INT_HNDLR)) \
|
||||||
|
DBG_SSI_INFO(IDENT_FOUR_SPACE __VA_ARGS__); \
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define SSI_DBG_INT_READ(...) do {\
|
||||||
|
if (unlikely(SSI_DBG_CONFIG & DBG_TYPE_INT_READ)) \
|
||||||
|
DBG_SSI_INFO(IDENT_FOUR_SPACE __VA_ARGS__); \
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define SSI_DBG_INT_WRITE(...) do {\
|
||||||
|
if (unlikely(SSI_DBG_CONFIG & DBG_TYPE_INT_WRITE)) \
|
||||||
|
DBG_SSI_INFO(IDENT_FOUR_SPACE __VA_ARGS__); \
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define SSI_DBG_STATUS(...) do {\
|
||||||
|
if (unlikely(SSI_DBG_CONFIG & DBG_TYPE_STATUS)) \
|
||||||
|
DBG_SSI_INFO(IDENT_FOUR_SPACE __VA_ARGS__); \
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define SSI_DBG_FIFO(...) do {\
|
||||||
|
if (unlikely(SSI_DBG_CONFIG & DBG_TYPE_FIFO)) \
|
||||||
|
DBG_SSI_INFO(IDENT_FOUR_SPACE __VA_ARGS__); \
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define SSI_DBG_READ(...) do {\
|
||||||
|
if (unlikely(SSI_DBG_CONFIG & DBG_TYPE_READ)) \
|
||||||
|
DBG_SSI_INFO(IDENT_FOUR_SPACE __VA_ARGS__); \
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define SSI_DBG_WRITE(...) do {\
|
||||||
|
if (unlikely(SSI_DBG_CONFIG & DBG_TYPE_WRITE)) \
|
||||||
|
DBG_SSI_INFO(IDENT_FOUR_SPACE __VA_ARGS__); \
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#define SSI_DBG_SLV_CTRL(...) do {\
|
||||||
|
if (unlikely(SSI_DBG_CONFIG & DBG_TYPE_SLV_CTRL)) \
|
||||||
|
DBG_SSI_INFO(IDENT_FOUR_SPACE __VA_ARGS__); \
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
typedef enum _SSI_DBG_TYPE_LIST_ {
|
||||||
|
DBG_TYPE_ENTRANCE = 1 << 0,
|
||||||
|
DBG_TYPE_INIT = 1 << 1,
|
||||||
|
DBG_TYPE_INIT_V = 1 << 2,
|
||||||
|
DBG_TYPE_INIT_VV = 1 << 3,
|
||||||
|
DBG_TYPE_PINMUX = 1 << 4,
|
||||||
|
DBG_TYPE_ENDIS = 1 << 5,
|
||||||
|
DBG_TYPE_INT = 1 << 6,
|
||||||
|
DBG_TYPE_INT_V = 1 << 7,
|
||||||
|
DBG_TYPE_INT_HNDLR = 1 << 8,
|
||||||
|
DBG_TYPE_INT_READ = 1 << 9,
|
||||||
|
DBG_TYPE_INT_WRITE = 1 << 10,
|
||||||
|
DBG_TYPE_STATUS = 1 << 11,
|
||||||
|
DBG_TYPE_FIFO = 1 << 12,
|
||||||
|
DBG_TYPE_READ = 1 << 13,
|
||||||
|
DBG_TYPE_WRITE = 1 << 14,
|
||||||
|
DBG_TYPE_SLV_CTRL = 1 << 15
|
||||||
|
} SSI_DBG_TYPE_LIST, *PSSI_DBG_TYPE_LIST;
|
||||||
|
|
||||||
|
typedef struct _SSI_DMA_CONFIG_ {
|
||||||
|
VOID *pHalGdmaOp;
|
||||||
|
VOID *pTxHalGdmaAdapter;
|
||||||
|
VOID *pRxHalGdmaAdapter;
|
||||||
|
u8 RxDmaBurstSize;
|
||||||
|
u8 TxDmaBurstSize;
|
||||||
|
u8 RxDmaEnable;
|
||||||
|
u8 TxDmaEnable;
|
||||||
|
IRQ_HANDLE RxGdmaIrqHandle;
|
||||||
|
IRQ_HANDLE TxGdmaIrqHandle;
|
||||||
|
}SSI_DMA_CONFIG, *PSSI_DMA_CONFIG;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DesignWare SSI Configurations
|
||||||
|
*/
|
||||||
|
typedef struct _HAL_SSI_ADAPTOR_ {
|
||||||
|
SSI_DMA_CONFIG DmaConfig;
|
||||||
|
IRQ_HANDLE IrqHandle;
|
||||||
|
//
|
||||||
|
VOID (*RxCompCallback)(VOID *Para);
|
||||||
|
VOID *RxCompCbPara;
|
||||||
|
VOID *RxData;
|
||||||
|
VOID (*TxCompCallback)(VOID *Para);
|
||||||
|
VOID *TxCompCbPara;
|
||||||
|
VOID *TxData;
|
||||||
|
u32 DmaRxDataLevel;
|
||||||
|
u32 DmaTxDataLevel;
|
||||||
|
u32 InterruptPriority;
|
||||||
|
u32 RxLength;
|
||||||
|
u32 RxLengthRemainder;
|
||||||
|
u32 RxThresholdLevel;
|
||||||
|
u32 TxLength;
|
||||||
|
u32 TxThresholdLevel;
|
||||||
|
u32 SlaveSelectEnable;
|
||||||
|
//
|
||||||
|
u16 ClockDivider;
|
||||||
|
u16 DataFrameNumber;
|
||||||
|
//
|
||||||
|
u8 ControlFrameSize;
|
||||||
|
u8 DataFrameFormat;
|
||||||
|
u8 DataFrameSize;
|
||||||
|
u8 DmaControl;
|
||||||
|
u8 Index;
|
||||||
|
u8 InterruptMask;
|
||||||
|
u8 MicrowireDirection;
|
||||||
|
u8 MicrowireHandshaking;
|
||||||
|
u8 MicrowireTransferMode;
|
||||||
|
u8 PinmuxSelect;
|
||||||
|
u8 Role;
|
||||||
|
u8 SclkPhase;
|
||||||
|
u8 SclkPolarity;
|
||||||
|
u8 SlaveOutputEnable;
|
||||||
|
u8 TransferMode;
|
||||||
|
u8 TransferMechanism;
|
||||||
|
|
||||||
|
// Extend
|
||||||
|
u32 Reserved1;
|
||||||
|
u8 DefaultRxThresholdLevel;
|
||||||
|
}HAL_SSI_ADAPTOR, *PHAL_SSI_ADAPTOR;
|
||||||
|
|
||||||
|
typedef struct _HAL_SSI_OP_{
|
||||||
|
HAL_Status (*HalSsiPinmuxEnable)(VOID *Adaptor);
|
||||||
|
HAL_Status (*HalSsiPinmuxDisable)(VOID *Adaptor);
|
||||||
|
HAL_Status (*HalSsiEnable)(VOID *Adaptor);
|
||||||
|
HAL_Status (*HalSsiDisable)(VOID *Adaptor);
|
||||||
|
HAL_Status (*HalSsiInit)(VOID *Adaptor);
|
||||||
|
HAL_Status (*HalSsiSetSclkPolarity)(VOID *Adaptor);
|
||||||
|
HAL_Status (*HalSsiSetSclkPhase)(VOID *Adaptor);
|
||||||
|
HAL_Status (*HalSsiWrite)(VOID *Adaptor, u32 value);
|
||||||
|
HAL_Status (*HalSsiLoadSetting)(VOID *Adaptor, VOID *Setting);
|
||||||
|
HAL_Status (*HalSsiSetInterruptMask)(VOID *Adaptor);
|
||||||
|
HAL_Status (*HalSsiSetDeviceRole)(VOID *Adaptor, u32 Role);
|
||||||
|
HAL_Status (*HalSsiInterruptEnable)(VOID *Adaptor);
|
||||||
|
HAL_Status (*HalSsiInterruptDisable)(VOID *Adaptor);
|
||||||
|
HAL_Status (*HalSsiReadInterrupt)(VOID *Adaptor, VOID *RxData, u32 Length);
|
||||||
|
HAL_Status (*HalSsiSetRxFifoThresholdLevel)(VOID *Adaptor);
|
||||||
|
HAL_Status (*HalSsiSetTxFifoThresholdLevel)(VOID *Adaptor);
|
||||||
|
HAL_Status (*HalSsiWriteInterrupt)(VOID *Adaptor, u8 *TxData, u32 Length);
|
||||||
|
HAL_Status (*HalSsiSetSlaveEnableRegister)(VOID *Adaptor, u32 SlaveIndex);
|
||||||
|
u32 (*HalSsiBusy)(VOID *Adaptor);
|
||||||
|
u32 (*HalSsiReadable)(VOID *Adaptor);
|
||||||
|
u32 (*HalSsiWriteable)(VOID *Adaptor);
|
||||||
|
u32 (*HalSsiGetInterruptMask)(VOID *Adaptor);
|
||||||
|
u32 (*HalSsiGetRxFifoLevel)(VOID *Adaptor);
|
||||||
|
u32 (*HalSsiGetTxFifoLevel)(VOID *Adaptor);
|
||||||
|
u32 (*HalSsiGetStatus)(VOID *Adaptor);
|
||||||
|
u32 (*HalSsiGetInterruptStatus)(VOID *Adaptor);
|
||||||
|
u32 (*HalSsiRead)(VOID *Adaptor);
|
||||||
|
u32 (*HalSsiGetRawInterruptStatus)(VOID *Adaptor);
|
||||||
|
u32 (*HalSsiGetSlaveEnableRegister)(VOID *Adaptor);
|
||||||
|
}HAL_SSI_OP, *PHAL_SSI_OP;
|
||||||
|
|
||||||
|
typedef struct _DW_SSI_DEFAULT_SETTING_ {
|
||||||
|
VOID (*RxCompCallback)(VOID *Para);
|
||||||
|
VOID *RxCompCbPara;
|
||||||
|
VOID *RxData;
|
||||||
|
VOID (*TxCompCallback)(VOID *Para);
|
||||||
|
VOID *TxCompCbPara;
|
||||||
|
VOID *TxData;
|
||||||
|
u32 DmaRxDataLevel;
|
||||||
|
u32 DmaTxDataLevel;
|
||||||
|
u32 InterruptPriority;
|
||||||
|
u32 RxLength;
|
||||||
|
u32 RxLengthRemainder;
|
||||||
|
u32 RxThresholdLevel;
|
||||||
|
u32 TxLength;
|
||||||
|
u32 TxThresholdLevel;
|
||||||
|
u32 SlaveSelectEnable;
|
||||||
|
//
|
||||||
|
u16 ClockDivider;
|
||||||
|
u16 DataFrameNumber;
|
||||||
|
//
|
||||||
|
u8 ControlFrameSize;
|
||||||
|
u8 DataFrameFormat;
|
||||||
|
u8 DataFrameSize;
|
||||||
|
u8 DmaControl;
|
||||||
|
//u8 Index;
|
||||||
|
u8 InterruptMask;
|
||||||
|
u8 MicrowireDirection;
|
||||||
|
u8 MicrowireHandshaking;
|
||||||
|
u8 MicrowireTransferMode;
|
||||||
|
//u8 PinmuxSelect;
|
||||||
|
//u8 Role;
|
||||||
|
u8 SclkPhase;
|
||||||
|
u8 SclkPolarity;
|
||||||
|
u8 SlaveOutputEnable;
|
||||||
|
u8 TransferMode;
|
||||||
|
u8 TransferMechanism;
|
||||||
|
} DW_SSI_DEFAULT_SETTING, *PDW_SSI_DEFAULT_SETTING;
|
||||||
|
|
||||||
|
|
||||||
|
struct spi_s {
|
||||||
|
HAL_SSI_ADAPTOR spi_adp;
|
||||||
|
HAL_SSI_OP spi_op;
|
||||||
|
u32 irq_handler;
|
||||||
|
u32 irq_id;
|
||||||
|
u32 dma_en;
|
||||||
|
u32 state;
|
||||||
|
u8 sclk;
|
||||||
|
#ifdef CONFIG_GDMA_EN
|
||||||
|
HAL_GDMA_ADAPTER spi_gdma_adp_tx;
|
||||||
|
HAL_GDMA_ADAPTER spi_gdma_adp_rx;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
VOID HalSsiOpInit(VOID *Adaptor);
|
||||||
|
static __inline__ VOID HalSsiSetSclk(
|
||||||
|
IN PHAL_SSI_ADAPTOR pHalSsiAdapter,
|
||||||
|
IN u32 ClkRate)
|
||||||
|
{
|
||||||
|
HalSsiSetSclkRtl8195a((VOID*)pHalSsiAdapter, ClkRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
HAL_Status HalSsiInit(VOID * Data);
|
||||||
|
HAL_Status HalSsiDeInit(VOID * Data);
|
||||||
|
HAL_Status HalSsiEnable(VOID * Data);
|
||||||
|
HAL_Status HalSsiDisable(VOID * Data);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CONFIG_GDMA_EN
|
||||||
|
HAL_Status HalSsiTxGdmaInit(PHAL_SSI_OP pHalSsiOp, PHAL_SSI_ADAPTOR pHalSsiAdapter);
|
||||||
|
VOID HalSsiTxGdmaDeInit(PHAL_SSI_ADAPTOR pHalSsiAdapter);
|
||||||
|
HAL_Status HalSsiRxGdmaInit(PHAL_SSI_OP pHalSsiOp, PHAL_SSI_ADAPTOR pHalSsiAdapter);
|
||||||
|
VOID HalSsiRxGdmaDeInit(PHAL_SSI_ADAPTOR pHalSsiAdapter);
|
||||||
|
|
||||||
|
static __inline__ VOID
|
||||||
|
HalSsiDmaInit(
|
||||||
|
IN PHAL_SSI_ADAPTOR pHalSsiAdapter
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HalSsiDmaInitRtl8195a((void *)pHalSsiAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline__ HAL_Status HalSsiDmaSend(VOID *Adapter, u8 *pTxData, u32 Length)
|
||||||
|
{
|
||||||
|
return (HalSsiDmaSendRtl8195a(Adapter, pTxData, Length));
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline__ HAL_Status HalSsiDmaRecv(VOID *Adapter, u8 *pRxData, u32 Length)
|
||||||
|
{
|
||||||
|
return (HalSsiDmaRecvRtl8195a(Adapter, pRxData, Length));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // end of "#ifdef CONFIG_GDMA_EN"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
58
sdk/component/soc/realtek/8195a/fwlib/hal_timer.h
Normal file
58
sdk/component/soc/realtek/8195a/fwlib/hal_timer.h
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HAL_TIMER_H_
|
||||||
|
#define _HAL_TIMER_H_
|
||||||
|
#include "basic_types.h"
|
||||||
|
#include "hal_platform.h"
|
||||||
|
#include "rtl8195a_timer.h"
|
||||||
|
|
||||||
|
#define GTIMER_CLK_HZ (32768)
|
||||||
|
#define GTIMER_TICK_US (1000000/GTIMER_CLK_HZ)
|
||||||
|
|
||||||
|
typedef enum _TIMER_MODE_ {
|
||||||
|
FREE_RUN_MODE = 0,
|
||||||
|
USER_DEFINED = 1
|
||||||
|
}TIMER_MODE, *PTIMER_MODE;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _TIMER_ADAPTER_ {
|
||||||
|
|
||||||
|
u32 TimerLoadValueUs;
|
||||||
|
u32 TimerIrqPriority;
|
||||||
|
TIMER_MODE TimerMode;
|
||||||
|
IRQ_HANDLE IrqHandle;
|
||||||
|
u8 TimerId;
|
||||||
|
u8 IrqDis;
|
||||||
|
|
||||||
|
}TIMER_ADAPTER, *PTIMER_ADAPTER;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _HAL_TIMER_OP_ {
|
||||||
|
u32 (*HalGetTimerId)(u32 *TimerId);
|
||||||
|
BOOL (*HalTimerInit)(VOID *Data);
|
||||||
|
u32 (*HalTimerReadCount)(u32 TimerId);
|
||||||
|
VOID (*HalTimerIrqClear)(u32 TimerId);
|
||||||
|
VOID (*HalTimerDis)(u32 TimerId);
|
||||||
|
VOID (*HalTimerEn)(u32 TimerId);
|
||||||
|
VOID (*HalTimerDumpReg)(u32 TimerId);
|
||||||
|
}HAL_TIMER_OP, *PHAL_TIMER_OP;
|
||||||
|
|
||||||
|
VOID HalTimerOpInit_Patch(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//======================================================
|
||||||
|
// ROM Function prototype
|
||||||
|
_LONG_CALL_ VOID HalTimerOpInitV02(IN VOID *Data);
|
||||||
|
|
||||||
|
#define HalTimerOpInit HalTimerOpInit_Patch
|
||||||
|
|
||||||
|
#endif
|
204
sdk/component/soc/realtek/8195a/fwlib/hal_uart.h
Normal file
204
sdk/component/soc/realtek/8195a/fwlib/hal_uart.h
Normal file
|
@ -0,0 +1,204 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HAL_UART_H_
|
||||||
|
#define _HAL_UART_H_
|
||||||
|
|
||||||
|
#include "rtl8195a_uart.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RUART Configurations
|
||||||
|
*/
|
||||||
|
#define UART_WAIT_FOREVER 0xffffffff
|
||||||
|
|
||||||
|
typedef struct _UART_DMA_CONFIG_ {
|
||||||
|
u8 TxDmaEnable;
|
||||||
|
u8 RxDmaEnable;
|
||||||
|
u8 TxDmaBurstSize;
|
||||||
|
u8 RxDmaBurstSize;
|
||||||
|
VOID *pHalGdmaOp;
|
||||||
|
VOID *pTxHalGdmaAdapter;
|
||||||
|
VOID *pRxHalGdmaAdapter;
|
||||||
|
IRQ_HANDLE TxGdmaIrqHandle;
|
||||||
|
IRQ_HANDLE RxGdmaIrqHandle;
|
||||||
|
}UART_DMA_CONFIG, *PUART_DMA_CONFIG;
|
||||||
|
|
||||||
|
typedef struct _HAL_RUART_ADAPTER_ {
|
||||||
|
u32 BaudRate;
|
||||||
|
u32 FlowControl;
|
||||||
|
u32 FifoControl;
|
||||||
|
u32 Interrupts;
|
||||||
|
u32 TxCount; // how many byte to TX
|
||||||
|
u32 RxCount; // how many bytes to RX
|
||||||
|
u8 *pTxBuf;
|
||||||
|
u8 *pRxBuf;
|
||||||
|
HAL_UART_State State; // UART state
|
||||||
|
u8 Status; // Transfer Status
|
||||||
|
u8 Locked; // is UART locked for operation
|
||||||
|
u8 UartIndex;
|
||||||
|
u8 WordLen; // word length select: 0 -> 7 bits, 1 -> 8 bits
|
||||||
|
u8 StopBit; // word length select: 0 -> 1 stop bit, 1 -> 2 stop bit
|
||||||
|
u8 Parity; // parity check enable
|
||||||
|
u8 ParityType; // parity check type
|
||||||
|
u8 StickParity;
|
||||||
|
u8 ModemStatus; // the modem status
|
||||||
|
u8 DmaEnable;
|
||||||
|
u8 TestCaseNumber;
|
||||||
|
u8 PinmuxSelect;
|
||||||
|
BOOL PullMode;
|
||||||
|
IRQ_HANDLE IrqHandle;
|
||||||
|
PUART_DMA_CONFIG DmaConfig;
|
||||||
|
VOID (*ModemStatusInd)(VOID *pAdapter); // modem status indication interrupt handler
|
||||||
|
VOID (*TxTDCallback)(VOID *pAdapter); // User Tx Done callback function
|
||||||
|
VOID (*RxDRCallback)(VOID *pAdapter); // User Rx Data ready callback function
|
||||||
|
VOID (*TxCompCallback)(VOID *para); // User Tx complete callback function
|
||||||
|
VOID (*RxCompCallback)(VOID *para); // User Rx complete callback function
|
||||||
|
VOID *TxTDCbPara; // the pointer agrument for TxTDCallback
|
||||||
|
VOID *RxDRCbPara; // the pointer agrument for RxDRCallback
|
||||||
|
VOID *TxCompCbPara; // the pointer argument for TxCompCbPara
|
||||||
|
VOID *RxCompCbPara; // the pointer argument for RxCompCallback
|
||||||
|
VOID (*EnterCritical)(void);
|
||||||
|
VOID (*ExitCritical)(void);
|
||||||
|
|
||||||
|
//1 New member only can be added below: members above must be fixed for ROM code
|
||||||
|
u32 *pDefaultBaudRateTbl; // point to the table of pre-defined baud rate
|
||||||
|
u8 *pDefaultOvsrRTbl; // point to the table of OVSR for pre-defined baud rate
|
||||||
|
u16 *pDefaultDivTbl; // point to the table of DIV for pre-defined baud rate
|
||||||
|
u8 *pDefOvsrAdjBitTbl_10; // point to the table of OVSR-Adj bits for 10 bits
|
||||||
|
u8 *pDefOvsrAdjBitTbl_9; // point to the table of OVSR-Adj bits for 9 bits
|
||||||
|
u8 *pDefOvsrAdjBitTbl_8; // point to the table of OVSR-Adj bits for 8 bits
|
||||||
|
u16 *pDefOvsrAdjTbl_10; // point to the table of OVSR-Adj for pre-defined baud rate
|
||||||
|
u16 *pDefOvsrAdjTbl_9; // point to the table of OVSR-Adj for pre-defined baud rate
|
||||||
|
u16 *pDefOvsrAdjTbl_8; // point to the table of OVSR-Adj for pre-defined baud rate
|
||||||
|
u32 BaudRateUsing; // Current using Baud-Rate
|
||||||
|
|
||||||
|
#if CONFIG_CHIP_E_CUT
|
||||||
|
u8 TxState;
|
||||||
|
u8 RxState;
|
||||||
|
u32 TxInitSize; // how many byte to TX at atart
|
||||||
|
u32 RxInitSize; // how many bytes to RX at start
|
||||||
|
|
||||||
|
VOID (*RuartEnterCritical)(VOID *para); // enter critical: disable UART interrupt
|
||||||
|
VOID (*RuartExitCritical)(VOID *para); // exit critical: re-enable UART interrupt
|
||||||
|
VOID (*TaskYield)(VOID *para); // User Task Yield: do a context switch while waitting
|
||||||
|
VOID *TaskYieldPara; // the agrument (pointer) for TaskYield
|
||||||
|
#endif // #if CONFIG_CHIP_E_CUT
|
||||||
|
}HAL_RUART_ADAPTER, *PHAL_RUART_ADAPTER;
|
||||||
|
|
||||||
|
typedef struct _HAL_RUART_OP_ {
|
||||||
|
VOID (*HalRuartAdapterLoadDef)(VOID *pAdp, u8 UartIdx); // Load UART adapter default setting
|
||||||
|
VOID (*HalRuartTxGdmaLoadDef)(VOID *pAdp, VOID *pCfg); // Load TX GDMA default setting
|
||||||
|
VOID (*HalRuartRxGdmaLoadDef)(VOID *pAdp, VOID *pCfg); // Load RX GDMA default setting
|
||||||
|
HAL_Status (*HalRuartResetRxFifo)(VOID *Data);
|
||||||
|
HAL_Status (*HalRuartInit)(VOID *Data);
|
||||||
|
VOID (*HalRuartDeInit)(VOID *Data);
|
||||||
|
HAL_Status (*HalRuartPutC)(VOID *Data, u8 TxData);
|
||||||
|
u32 (*HalRuartSend)(VOID *Data, u8 *pTxData, u32 Length, u32 Timeout);
|
||||||
|
HAL_Status (*HalRuartIntSend)(VOID *Data, u8 *pTxData, u32 Length);
|
||||||
|
HAL_Status (*HalRuartDmaSend)(VOID *Data, u8 *pTxData, u32 Length);
|
||||||
|
HAL_Status (*HalRuartStopSend)(VOID *Data);
|
||||||
|
HAL_Status (*HalRuartGetC)(VOID *Data, u8 *pRxByte);
|
||||||
|
u32 (*HalRuartRecv)(VOID *Data, u8 *pRxData, u32 Length, u32 Timeout);
|
||||||
|
HAL_Status (*HalRuartIntRecv)(VOID *Data, u8 *pRxData, u32 Length);
|
||||||
|
HAL_Status (*HalRuartDmaRecv)(VOID *Data, u8 *pRxData, u32 Length);
|
||||||
|
HAL_Status (*HalRuartStopRecv)(VOID *Data);
|
||||||
|
u8 (*HalRuartGetIMR)(VOID *Data);
|
||||||
|
VOID (*HalRuartSetIMR)(VOID *Data);
|
||||||
|
u32 (*HalRuartGetDebugValue)(VOID *Data, u32 DbgSel);
|
||||||
|
VOID (*HalRuartDmaInit)(VOID *Data);
|
||||||
|
VOID (*HalRuartRTSCtrl)(VOID *Data, BOOLEAN RtsCtrl);
|
||||||
|
VOID (*HalRuartRegIrq)(VOID *Data);
|
||||||
|
VOID (*HalRuartIntEnable)(VOID *Data);
|
||||||
|
VOID (*HalRuartIntDisable)(VOID *Data);
|
||||||
|
}HAL_RUART_OP, *PHAL_RUART_OP;
|
||||||
|
|
||||||
|
typedef struct _RUART_DATA_ {
|
||||||
|
PHAL_RUART_ADAPTER pHalRuartAdapter;
|
||||||
|
BOOL PullMode;
|
||||||
|
u8 BinaryData;
|
||||||
|
u8 SendBuffer;
|
||||||
|
u8 RecvBuffer;
|
||||||
|
}RUART_DATA, *PRUART_DATA;
|
||||||
|
|
||||||
|
typedef struct _RUART_ADAPTER_ {
|
||||||
|
PHAL_RUART_OP pHalRuartOp;
|
||||||
|
PHAL_RUART_ADAPTER pHalRuartAdapter;
|
||||||
|
PUART_DMA_CONFIG pHalRuartDmaCfg;
|
||||||
|
}RUART_ADAPTER, *PRUART_ADAPTER;
|
||||||
|
|
||||||
|
extern VOID
|
||||||
|
HalRuartOpInit(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
extern HAL_Status
|
||||||
|
HalRuartTxGdmaInit(
|
||||||
|
PHAL_RUART_OP pHalRuartOp,
|
||||||
|
PHAL_RUART_ADAPTER pHalRuartAdapter,
|
||||||
|
PUART_DMA_CONFIG pUartGdmaConfig
|
||||||
|
);
|
||||||
|
|
||||||
|
extern VOID
|
||||||
|
HalRuartTxGdmaDeInit(
|
||||||
|
PUART_DMA_CONFIG pUartGdmaConfig
|
||||||
|
);
|
||||||
|
|
||||||
|
extern HAL_Status
|
||||||
|
HalRuartRxGdmaInit(
|
||||||
|
PHAL_RUART_OP pHalRuartOp,
|
||||||
|
PHAL_RUART_ADAPTER pHalRuartAdapter,
|
||||||
|
PUART_DMA_CONFIG pUartGdmaConfig
|
||||||
|
);
|
||||||
|
|
||||||
|
extern VOID
|
||||||
|
HalRuartRxGdmaDeInit(
|
||||||
|
PUART_DMA_CONFIG pUartGdmaConfig
|
||||||
|
);
|
||||||
|
|
||||||
|
extern HAL_Status
|
||||||
|
HalRuartResetTxFifo(
|
||||||
|
VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
extern HAL_Status
|
||||||
|
HalRuartSetBaudRate(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
extern HAL_Status
|
||||||
|
HalRuartInit(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
extern VOID
|
||||||
|
HalRuartDeInit(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
extern HAL_Status
|
||||||
|
HalRuartDisable(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
extern HAL_Status
|
||||||
|
HalRuartEnable(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
HalRuartFlowCtrl(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
extern const HAL_RUART_OP _HalRuartOp;
|
||||||
|
extern HAL_Status RuartLock (PHAL_RUART_ADAPTER pHalRuartAdapter);
|
||||||
|
extern VOID RuartUnLock (PHAL_RUART_ADAPTER pHalRuartAdapter);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
15
sdk/component/soc/realtek/8195a/fwlib/hal_usb.h
Normal file
15
sdk/component/soc/realtek/8195a/fwlib/hal_usb.h
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HAL_USB_H_
|
||||||
|
#define _HAL_USB_H_
|
||||||
|
|
||||||
|
#include "rtl8195a_usb.h"
|
||||||
|
|
||||||
|
#endif //_HAL_USB_H_
|
252
sdk/component/soc/realtek/8195a/fwlib/hal_util.h
Normal file
252
sdk/component/soc/realtek/8195a/fwlib/hal_util.h
Normal file
|
@ -0,0 +1,252 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
#ifndef _HAL_UTIL_H_
|
||||||
|
#define _HAL_UTIL_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Simple doubly linked list implementation.
|
||||||
|
*
|
||||||
|
* Some of the internal functions ("__xxx") are useful when
|
||||||
|
* manipulating whole lists rather than single entries, as
|
||||||
|
* sometimes we already know the next/prev entries and we can
|
||||||
|
* generate better code by using them directly rather than
|
||||||
|
* using the generic single-entry routines.
|
||||||
|
*/
|
||||||
|
struct LIST_HEADER {
|
||||||
|
struct LIST_HEADER *Next, *Prev;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct LIST_HEADER _LIST;
|
||||||
|
|
||||||
|
//#define RTL_LIST_HEAD_INIT(name) { &(name), &(name) }
|
||||||
|
|
||||||
|
#define RTL_INIT_LIST_HEAD(ptr) do { \
|
||||||
|
(ptr)->Next = (ptr); (ptr)->Prev = (ptr); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Insert a new entry between two known consecutive entries.
|
||||||
|
*
|
||||||
|
* This is only for internal list manipulation where we know
|
||||||
|
* the prev/next entries already!
|
||||||
|
*/
|
||||||
|
static __inline__ VOID
|
||||||
|
__List_Add(
|
||||||
|
IN struct LIST_HEADER * New,
|
||||||
|
IN struct LIST_HEADER * Prev,
|
||||||
|
IN struct LIST_HEADER * Next
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Next->Prev = New;
|
||||||
|
New->Next = Next;
|
||||||
|
New->Prev = Prev;
|
||||||
|
Prev->Next = New;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Delete a list entry by making the prev/next entries
|
||||||
|
* point to each other.
|
||||||
|
*
|
||||||
|
* This is only for internal list manipulation where we know
|
||||||
|
* the prev/next entries already!
|
||||||
|
*/
|
||||||
|
static __inline__ VOID
|
||||||
|
__List_Del(
|
||||||
|
IN struct LIST_HEADER * Prev,
|
||||||
|
IN struct LIST_HEADER * Next
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Next->Prev = Prev;
|
||||||
|
Prev->Next = Next;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ListDel - deletes entry from list.
|
||||||
|
* @entry: the element to delete from the list.
|
||||||
|
* Note: list_empty on entry does not return true after this, the entry is in an undefined state.
|
||||||
|
*/
|
||||||
|
static __inline__ VOID
|
||||||
|
ListDel(
|
||||||
|
IN struct LIST_HEADER *Entry
|
||||||
|
)
|
||||||
|
{
|
||||||
|
__List_Del(Entry->Prev, Entry->Next);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ListDelInit - deletes entry from list and reinitialize it.
|
||||||
|
* @entry: the element to delete from the list.
|
||||||
|
*/
|
||||||
|
static __inline__ VOID
|
||||||
|
ListDelInit(
|
||||||
|
IN struct LIST_HEADER *Entry
|
||||||
|
)
|
||||||
|
{
|
||||||
|
__List_Del(Entry->Prev, Entry->Next);
|
||||||
|
RTL_INIT_LIST_HEAD(Entry);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ListEmpty - tests whether a list is empty
|
||||||
|
* @head: the list to test.
|
||||||
|
*/
|
||||||
|
static __inline__ u32
|
||||||
|
ListEmpty(
|
||||||
|
IN struct LIST_HEADER *Head
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return Head->Next == Head;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ListSplice - join two lists
|
||||||
|
* @list: the new list to add.
|
||||||
|
* @head: the place to add it in the first list.
|
||||||
|
*/
|
||||||
|
static __inline__ VOID
|
||||||
|
ListSplice(
|
||||||
|
IN struct LIST_HEADER *List,
|
||||||
|
IN struct LIST_HEADER *Head
|
||||||
|
)
|
||||||
|
{
|
||||||
|
struct LIST_HEADER *First = List->Next;
|
||||||
|
|
||||||
|
if (First != List) {
|
||||||
|
struct LIST_HEADER *Last = List->Prev;
|
||||||
|
struct LIST_HEADER *At = Head->Next;
|
||||||
|
|
||||||
|
First->Prev = Head;
|
||||||
|
Head->Next = First;
|
||||||
|
|
||||||
|
Last->Next = At;
|
||||||
|
At->Prev = Last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline__ VOID
|
||||||
|
ListAdd(
|
||||||
|
IN struct LIST_HEADER *New,
|
||||||
|
IN struct LIST_HEADER *head
|
||||||
|
)
|
||||||
|
{
|
||||||
|
__List_Add(New, head, head->Next);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static __inline__ VOID
|
||||||
|
ListAddTail(
|
||||||
|
IN struct LIST_HEADER *New,
|
||||||
|
IN struct LIST_HEADER *head
|
||||||
|
)
|
||||||
|
{
|
||||||
|
__List_Add(New, head->Prev, head);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline VOID
|
||||||
|
RtlInitListhead(
|
||||||
|
IN _LIST *list
|
||||||
|
)
|
||||||
|
{
|
||||||
|
RTL_INIT_LIST_HEAD(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
For the following list_xxx operations,
|
||||||
|
caller must guarantee the atomic context.
|
||||||
|
Otherwise, there will be racing condition.
|
||||||
|
*/
|
||||||
|
static __inline u32
|
||||||
|
RtlIsListEmpty(
|
||||||
|
IN _LIST *phead
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (ListEmpty(phead))
|
||||||
|
return _TRUE;
|
||||||
|
else
|
||||||
|
return _FALSE;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline VOID
|
||||||
|
RtlListInsertHead(
|
||||||
|
IN _LIST *plist,
|
||||||
|
IN _LIST *phead
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ListAdd(plist, phead);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline VOID
|
||||||
|
RtlListInsertTail(
|
||||||
|
IN _LIST *plist,
|
||||||
|
IN _LIST *phead
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ListAddTail(plist, phead);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static __inline _LIST
|
||||||
|
*RtlListGetNext(
|
||||||
|
IN _LIST *plist
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return plist->Next;
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline VOID
|
||||||
|
RtlListDelete(
|
||||||
|
IN _LIST *plist
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ListDelInit(plist);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define RTL_LIST_CONTAINOR(ptr, type, member) \
|
||||||
|
((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))
|
||||||
|
|
||||||
|
#ifndef CONTAINER_OF
|
||||||
|
#define CONTAINER_OF(ptr, type, member) \
|
||||||
|
((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
#define list_entry(ptr, type, member) \
|
||||||
|
CONTAINER_OF(ptr, type, member)
|
||||||
|
|
||||||
|
#define list_first_entry(ptr, type, member) \
|
||||||
|
list_entry((ptr)->Next, type, member)
|
||||||
|
|
||||||
|
#define list_next_entry(pos, member, type) \
|
||||||
|
list_entry((pos)->member.Next, type, member)
|
||||||
|
|
||||||
|
#define list_for_each_entry(pos, head, member, type) \
|
||||||
|
for (pos = list_first_entry(head, type, member); \
|
||||||
|
&pos->member != (head); \
|
||||||
|
pos = list_next_entry(pos, member, type))
|
||||||
|
#define list_for_each(pos, head) \
|
||||||
|
for (pos = (head)->Next; pos != (head); pos = pos->Next)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BIT
|
||||||
|
#define BIT(x) ( 1 << (x))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif //_HAL_UTIL_H_
|
53
sdk/component/soc/realtek/8195a/fwlib/hal_vector_table.h
Normal file
53
sdk/component/soc/realtek/8195a/fwlib/hal_vector_table.h
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _HAL_VECTOR_TABLE_H_
|
||||||
|
#define _HAL_VECTOR_TABLE_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
extern _LONG_CALL_ROM_ VOID
|
||||||
|
VectorTableInitRtl8195A(
|
||||||
|
IN u32 StackP
|
||||||
|
);
|
||||||
|
|
||||||
|
extern _LONG_CALL_ROM_ VOID
|
||||||
|
VectorTableInitForOSRtl8195A(
|
||||||
|
IN VOID *PortSVC,
|
||||||
|
IN VOID *PortPendSVH,
|
||||||
|
IN VOID *PortSysTick
|
||||||
|
);
|
||||||
|
|
||||||
|
extern _LONG_CALL_ROM_ BOOL
|
||||||
|
VectorIrqRegisterRtl8195A(
|
||||||
|
IN PIRQ_HANDLE pIrqHandle
|
||||||
|
);
|
||||||
|
|
||||||
|
extern _LONG_CALL_ROM_ BOOL
|
||||||
|
VectorIrqUnRegisterRtl8195A(
|
||||||
|
IN PIRQ_HANDLE pIrqHandle
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
extern _LONG_CALL_ROM_ VOID
|
||||||
|
VectorIrqEnRtl8195A(
|
||||||
|
IN PIRQ_HANDLE pIrqHandle
|
||||||
|
);
|
||||||
|
|
||||||
|
extern _LONG_CALL_ROM_ VOID
|
||||||
|
VectorIrqDisRtl8195A(
|
||||||
|
IN PIRQ_HANDLE pIrqHandle
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
extern _LONG_CALL_ROM_ VOID
|
||||||
|
HalPeripheralIntrHandle(VOID);
|
||||||
|
#endif //_HAL_VECTOR_TABLE_H_
|
158
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a.h
Normal file
158
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a.h
Normal file
|
@ -0,0 +1,158 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
#ifndef _HAL_8195A_H_
|
||||||
|
#define _HAL_8195A_H_
|
||||||
|
|
||||||
|
#include "platform_autoconf.h"
|
||||||
|
#include "basic_types.h"
|
||||||
|
#include "section_config.h"
|
||||||
|
#include "rtl8195a_sys_on.h"
|
||||||
|
#include "rtl8195a_peri_on.h"
|
||||||
|
#include "hal_platform.h"
|
||||||
|
#include "hal_pinmux.h"
|
||||||
|
#include "hal_api.h"
|
||||||
|
#include "hal_peri_on.h"
|
||||||
|
#include "hal_misc.h"
|
||||||
|
#include "hal_irqn.h"
|
||||||
|
#include "hal_vector_table.h"
|
||||||
|
#include "hal_diag.h"
|
||||||
|
#include "hal_spi_flash.h"
|
||||||
|
#include "hal_timer.h"
|
||||||
|
#include "hal_util.h"
|
||||||
|
#include "hal_efuse.h"
|
||||||
|
#include "hal_soc_ps_monitor.h"
|
||||||
|
#include "diag.h"
|
||||||
|
#include "hal_common.h"
|
||||||
|
#include "hal_soc_ps_monitor.h"
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
-- Cortex M3 Core Configuration
|
||||||
|
---------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @addtogroup Cortex_Core_Configuration Cortex M0 Core Configuration
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define __CM3_REV 0x0200 /**< Core revision r0p0 */
|
||||||
|
#define __MPU_PRESENT 1 /**< Defines if an MPU is present or not */
|
||||||
|
#define __NVIC_PRIO_BITS 4 /**< Number of priority bits implemented in the NVIC */
|
||||||
|
#define __Vendor_SysTickConfig 1 /**< Vendor specific implementation of SysTickConfig is defined */
|
||||||
|
|
||||||
|
#include "core_cm3.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_TIMER_EN
|
||||||
|
#include "hal_timer.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_GDMA_EN
|
||||||
|
#include "hal_gdma.h"
|
||||||
|
#include "rtl8195a_gdma.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_GPIO_EN
|
||||||
|
#include "hal_gpio.h"
|
||||||
|
#include "rtl8195a_gpio.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SPI_COM_EN
|
||||||
|
#include "hal_ssi.h"
|
||||||
|
#include "rtl8195a_ssi.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_UART_EN
|
||||||
|
#include "hal_uart.h"
|
||||||
|
#include "rtl8195a_uart.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_I2C_EN
|
||||||
|
#include "hal_i2c.h"
|
||||||
|
#include "rtl8195a_i2c.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_PCM_EN
|
||||||
|
#include "hal_pcm.h"
|
||||||
|
#include "rtl8195a_pcm.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_PWM_EN
|
||||||
|
#include "hal_pwm.h"
|
||||||
|
#include "rtl8195a_pwm.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_I2S_EN
|
||||||
|
#include "hal_i2s.h"
|
||||||
|
#include "rtl8195a_i2s.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_DAC_EN
|
||||||
|
#include "hal_dac.h"
|
||||||
|
#include "rtl8195a_dac.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ADC_EN
|
||||||
|
#include "hal_adc.h"
|
||||||
|
#include "rtl8195a_adc.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SDR_EN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SPIC_EN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SDIO_DEVICE_EN
|
||||||
|
#include "hal_sdio.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_NFC_EN
|
||||||
|
#include "hal_nfc.h"
|
||||||
|
#include "rtl8195a_nfc.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_WDG
|
||||||
|
#include "rtl8195a_wdt.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_USB_EN
|
||||||
|
#include "hal_usb.h"
|
||||||
|
#include "rtl8195a_usb.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "hal_log_uart.h"
|
||||||
|
|
||||||
|
// firmware information, located at the header of Image2
|
||||||
|
#define FW_VERSION (0x0100)
|
||||||
|
#define FW_SUBVERSION (0x0001)
|
||||||
|
#define FW_CHIP_ID (0x8195)
|
||||||
|
#define FW_CHIP_VER (0x01)
|
||||||
|
#define FW_BUS_TYPE (0x01) // the iNIC firmware type: USB/SDIO
|
||||||
|
#define FW_INFO_RSV1 (0x00) // the firmware information reserved
|
||||||
|
#define FW_INFO_RSV2 (0x00) // the firmware information reserved
|
||||||
|
#define FW_INFO_RSV3 (0x00) // the firmware information reserved
|
||||||
|
#define FW_INFO_RSV4 (0x00) // the firmware information reserved
|
||||||
|
|
||||||
|
#define FLASH_RESERVED_DATA_BASE 0x8000 // reserve 32K for Image1
|
||||||
|
#define FLASH_SYSTEM_DATA_ADDR 0x9000 // reserve 32K+4K for Image1 + Reserved data
|
||||||
|
// Flash Map for Calibration data
|
||||||
|
#define FLASH_CAL_DATA_BASE 0xA000
|
||||||
|
#define FLASH_CAL_DATA_ADDR(_offset) (FLASH_CAL_DATA_BASE + _offset)
|
||||||
|
#define FLASH_CAL_DATA_SIZE 0x1000
|
||||||
|
#define FLASH_SECTOR_SIZE 0x1000
|
||||||
|
// SPIC Calibration Data
|
||||||
|
#define FLASH_SPIC_PARA_OFFSET 0x80
|
||||||
|
#define FLASH_SPIC_PARA_BASE (FLASH_SYSTEM_DATA_ADDR+FLASH_SPIC_PARA_OFFSET)
|
||||||
|
// SDRC Calibration Data
|
||||||
|
#define FLASH_SDRC_PARA_OFFSET 0x180
|
||||||
|
#define FLASH_SDRC_PARA_BASE (FLASH_SYSTEM_DATA_ADDR+FLASH_SDRC_PARA_OFFSET)
|
||||||
|
// ADC Calibration Data
|
||||||
|
#define FLASH_ADC_PARA_OFFSET 0x200
|
||||||
|
#define FLASH_ADC_PARA_BASE (FLASH_SYSTEM_DATA_ADDR+FLASH_ADC_PARA_OFFSET)
|
||||||
|
|
||||||
|
#endif //_HAL_8195A_H_
|
350
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_adc.h
Normal file
350
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_adc.h
Normal file
|
@ -0,0 +1,350 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _RTL8195A_ADC_H_
|
||||||
|
#define _RTL8195A_ADC_H_
|
||||||
|
|
||||||
|
|
||||||
|
//================ Register Bit Field ==========================
|
||||||
|
//2 REG_ADC_FIFO_READ
|
||||||
|
|
||||||
|
#define BIT_SHIFT_ADC_FIFO_RO 0
|
||||||
|
#define BIT_MASK_ADC_FIFO_RO 0xffffffffL
|
||||||
|
#define BIT_ADC_FIFO_RO(x) (((x) & BIT_MASK_ADC_FIFO_RO) << BIT_SHIFT_ADC_FIFO_RO)
|
||||||
|
#define BIT_CTRL_ADC_FIFO_RO(x) (((x) & BIT_MASK_ADC_FIFO_RO) << BIT_SHIFT_ADC_FIFO_RO)
|
||||||
|
#define BIT_GET_ADC_FIFO_RO(x) (((x) >> BIT_SHIFT_ADC_FIFO_RO) & BIT_MASK_ADC_FIFO_RO)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_ADC_CONTROL
|
||||||
|
|
||||||
|
#define BIT_SHIFT_ADC_DBG_SEL 24
|
||||||
|
#define BIT_MASK_ADC_DBG_SEL 0x7
|
||||||
|
#define BIT_ADC_DBG_SEL(x) (((x) & BIT_MASK_ADC_DBG_SEL) << BIT_SHIFT_ADC_DBG_SEL)
|
||||||
|
#define BIT_CTRL_ADC_DBG_SEL(x) (((x) & BIT_MASK_ADC_DBG_SEL) << BIT_SHIFT_ADC_DBG_SEL)
|
||||||
|
#define BIT_GET_ADC_DBG_SEL(x) (((x) >> BIT_SHIFT_ADC_DBG_SEL) & BIT_MASK_ADC_DBG_SEL)
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_ADC_THRESHOLD 16
|
||||||
|
#define BIT_MASK_ADC_THRESHOLD 0x3f
|
||||||
|
#define BIT_ADC_THRESHOLD(x) (((x) & BIT_MASK_ADC_THRESHOLD) << BIT_SHIFT_ADC_THRESHOLD)
|
||||||
|
#define BIT_CTRL_ADC_THRESHOLD(x) (((x) & BIT_MASK_ADC_THRESHOLD) << BIT_SHIFT_ADC_THRESHOLD)
|
||||||
|
#define BIT_GET_ADC_THRESHOLD(x) (((x) >> BIT_SHIFT_ADC_THRESHOLD) & BIT_MASK_ADC_THRESHOLD)
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_ADC_BURST_SIZE 8
|
||||||
|
#define BIT_MASK_ADC_BURST_SIZE 0x1f
|
||||||
|
#define BIT_ADC_BURST_SIZE(x) (((x) & BIT_MASK_ADC_BURST_SIZE) << BIT_SHIFT_ADC_BURST_SIZE)
|
||||||
|
#define BIT_CTRL_ADC_BURST_SIZE(x) (((x) & BIT_MASK_ADC_BURST_SIZE) << BIT_SHIFT_ADC_BURST_SIZE)
|
||||||
|
#define BIT_GET_ADC_BURST_SIZE(x) (((x) >> BIT_SHIFT_ADC_BURST_SIZE) & BIT_MASK_ADC_BURST_SIZE)
|
||||||
|
|
||||||
|
#define BIT_ADC_ENDIAN BIT(3)
|
||||||
|
#define BIT_SHIFT_ADC_ENDIAN 3
|
||||||
|
#define BIT_MASK_ADC_ENDIAN 0x1
|
||||||
|
#define BIT_CTRL_ADC_ENDIAN(x) (((x) & BIT_MASK_ADC_ENDIAN) << BIT_SHIFT_ADC_ENDIAN)
|
||||||
|
|
||||||
|
#define BIT_ADC_OVERWRITE BIT(2)
|
||||||
|
#define BIT_SHIFT_ADC_OVERWRITE 2
|
||||||
|
#define BIT_MASK_ADC_OVERWRITE 0x1
|
||||||
|
#define BIT_CTRL_ADC_OVERWRITE(x) (((x) & BIT_MASK_ADC_OVERWRITE) << BIT_SHIFT_ADC_OVERWRITE)
|
||||||
|
|
||||||
|
#define BIT_ADC_ONESHOT BIT(1)
|
||||||
|
#define BIT_SHIFT_ADC_ONESHOT 1
|
||||||
|
#define BIT_MASK_ADC_ONESHOT 0x1
|
||||||
|
#define BIT_CTRL_ADC_ONESHOT(x) (((x) & BIT_MASK_ADC_ONESHOT) << BIT_SHIFT_ADC_ONESHOT)
|
||||||
|
|
||||||
|
#define BIT_ADC_COMP_ONLY BIT(0)
|
||||||
|
#define BIT_SHIFT_ADC_COMP_ONLY 0
|
||||||
|
#define BIT_MASK_ADC_COMP_ONLY 0x1
|
||||||
|
#define BIT_CTRL_ADC_COMP_ONLY(x) (((x) & BIT_MASK_ADC_COMP_ONLY) << BIT_SHIFT_ADC_COMP_ONLY)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_ADC_INTR_EN
|
||||||
|
#define BIT_ADC_AWAKE_CPU_EN BIT(7)
|
||||||
|
#define BIT_SHIFT_ADC_AWAKE_CPU_EN 7
|
||||||
|
#define BIT_MASK_ADC_AWAKE_CPU_EN 0x1
|
||||||
|
#define BIT_CTRL_ADC_AWAKE_CPU_EN(x) (((x) & BIT_MASK_ADC_AWAKE_CPU_EN) << BIT_SHIFT_ADC_AWAKE_CPU_EN)
|
||||||
|
|
||||||
|
#define BIT_ADC_FIFO_RD_ERROR_EN BIT(6)
|
||||||
|
#define BIT_SHIFT_ADC_FIFO_RD_ERROR_EN 6
|
||||||
|
#define BIT_MASK_ADC_FIFO_RD_ERROR_EN 0x1
|
||||||
|
#define BIT_CTRL_ADC_FIFO_RD_ERROR_EN(x) (((x) & BIT_MASK_ADC_FIFO_RD_ERROR_EN) << BIT_SHIFT_ADC_FIFO_RD_ERROR_EN)
|
||||||
|
|
||||||
|
#define BIT_ADC_FIFO_RD_REQ_EN BIT(5)
|
||||||
|
#define BIT_SHIFT_ADC_FIFO_RD_REQ_EN 5
|
||||||
|
#define BIT_MASK_ADC_FIFO_RD_REQ_EN 0x1
|
||||||
|
#define BIT_CTRL_ADC_FIFO_RD_REQ_EN(x) (((x) & BIT_MASK_ADC_FIFO_RD_REQ_EN) << BIT_SHIFT_ADC_FIFO_RD_REQ_EN)
|
||||||
|
|
||||||
|
#define BIT_ADC_FIFO_FULL_EN BIT(4)
|
||||||
|
#define BIT_SHIFT_ADC_FIFO_FULL_EN 4
|
||||||
|
#define BIT_MASK_ADC_FIFO_FULL_EN 0x1
|
||||||
|
#define BIT_CTRL_ADC_FIFO_FULL_EN(x) (((x) & BIT_MASK_ADC_FIFO_FULL_EN) << BIT_SHIFT_ADC_FIFO_FULL_EN)
|
||||||
|
|
||||||
|
#define BIT_ADC_COMP_3_EN BIT(3)
|
||||||
|
#define BIT_SHIFT_ADC_COMP_3_EN 3
|
||||||
|
#define BIT_MASK_ADC_COMP_3_EN 0x1
|
||||||
|
#define BIT_CTRL_ADC_COMP_3_EN(x) (((x) & BIT_MASK_ADC_COMP_3_EN) << BIT_SHIFT_ADC_COMP_3_EN)
|
||||||
|
|
||||||
|
#define BIT_ADC_COMP_2_EN BIT(2)
|
||||||
|
#define BIT_SHIFT_ADC_COMP_2_EN 2
|
||||||
|
#define BIT_MASK_ADC_COMP_2_EN 0x1
|
||||||
|
#define BIT_CTRL_ADC_COMP_2_EN(x) (((x) & BIT_MASK_ADC_COMP_2_EN) << BIT_SHIFT_ADC_COMP_2_EN)
|
||||||
|
|
||||||
|
#define BIT_ADC_COMP_1_EN BIT(1)
|
||||||
|
#define BIT_SHIFT_ADC_COMP_1_EN 1
|
||||||
|
#define BIT_MASK_ADC_COMP_1_EN 0x1
|
||||||
|
#define BIT_CTRL_ADC_COMP_1_EN(x) (((x) & BIT_MASK_ADC_COMP_1_EN) << BIT_SHIFT_ADC_COMP_1_EN)
|
||||||
|
|
||||||
|
#define BIT_ADC_COMP_0_EN BIT(0)
|
||||||
|
#define BIT_SHIFT_ADC_COMP_0_EN 0
|
||||||
|
#define BIT_MASK_ADC_COMP_0_EN 0x1
|
||||||
|
#define BIT_CTRL_ADC_COMP_0_EN(x) (((x) & BIT_MASK_ADC_COMP_0_EN) << BIT_SHIFT_ADC_COMP_0_EN)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_ADC_INTR_STS
|
||||||
|
#define BIT_ADC_FIFO_THRESHOLD BIT(7)
|
||||||
|
#define BIT_SHIFT_ADC_FIFO_THRESHOLD 7
|
||||||
|
#define BIT_MASK_ADC_FIFO_THRESHOLD 0x1
|
||||||
|
#define BIT_CTRL_ADC_FIFO_THRESHOLD(x) (((x) & BIT_MASK_ADC_FIFO_THRESHOLD) << BIT_SHIFT_ADC_FIFO_THRESHOLD)
|
||||||
|
|
||||||
|
#define BIT_ADC_FIFO_RD_ERROR_ST BIT(6)
|
||||||
|
#define BIT_SHIFT_ADC_FIFO_RD_ERROR_ST 6
|
||||||
|
#define BIT_MASK_ADC_FIFO_RD_ERROR_ST 0x1
|
||||||
|
#define BIT_CTRL_ADC_FIFO_RD_ERROR_ST(x) (((x) & BIT_MASK_ADC_FIFO_RD_ERROR_ST) << BIT_SHIFT_ADC_FIFO_RD_ERROR_ST)
|
||||||
|
|
||||||
|
#define BIT_ADC_FIFO_RD_REQ_ST BIT(5)
|
||||||
|
#define BIT_SHIFT_ADC_FIFO_RD_REQ_ST 5
|
||||||
|
#define BIT_MASK_ADC_FIFO_RD_REQ_ST 0x1
|
||||||
|
#define BIT_CTRL_ADC_FIFO_RD_REQ_ST(x) (((x) & BIT_MASK_ADC_FIFO_RD_REQ_ST) << BIT_SHIFT_ADC_FIFO_RD_REQ_ST)
|
||||||
|
|
||||||
|
#define BIT_ADC_FIFO_FULL_ST BIT(4)
|
||||||
|
#define BIT_SHIFT_ADC_FIFO_FULL_ST 4
|
||||||
|
#define BIT_MASK_ADC_FIFO_FULL_ST 0x1
|
||||||
|
#define BIT_CTRL_ADC_FIFO_FULL_ST(x) (((x) & BIT_MASK_ADC_FIFO_FULL_ST) << BIT_SHIFT_ADC_FIFO_FULL_ST)
|
||||||
|
|
||||||
|
#define BIT_ADC_COMP_3_ST BIT(3)
|
||||||
|
#define BIT_SHIFT_ADC_COMP_3_ST 3
|
||||||
|
#define BIT_MASK_ADC_COMP_3_ST 0x1
|
||||||
|
#define BIT_CTRL_ADC_COMP_3_ST(x) (((x) & BIT_MASK_ADC_COMP_3_ST) << BIT_SHIFT_ADC_COMP_3_ST)
|
||||||
|
|
||||||
|
#define BIT_ADC_COMP_2_ST BIT(2)
|
||||||
|
#define BIT_SHIFT_ADC_COMP_2_ST 2
|
||||||
|
#define BIT_MASK_ADC_COMP_2_ST 0x1
|
||||||
|
#define BIT_CTRL_ADC_COMP_2_ST(x) (((x) & BIT_MASK_ADC_COMP_2_ST) << BIT_SHIFT_ADC_COMP_2_ST)
|
||||||
|
|
||||||
|
#define BIT_ADC_COMP_1_ST BIT(1)
|
||||||
|
#define BIT_SHIFT_ADC_COMP_1_ST 1
|
||||||
|
#define BIT_MASK_ADC_COMP_1_ST 0x1
|
||||||
|
#define BIT_CTRL_ADC_COMP_1_ST(x) (((x) & BIT_MASK_ADC_COMP_1_ST) << BIT_SHIFT_ADC_COMP_1_ST)
|
||||||
|
|
||||||
|
#define BIT_ADC_COMP_0_ST BIT(0)
|
||||||
|
#define BIT_SHIFT_ADC_COMP_0_ST 0
|
||||||
|
#define BIT_MASK_ADC_COMP_0_ST 0x1
|
||||||
|
#define BIT_CTRL_ADC_COMP_0_ST(x) (((x) & BIT_MASK_ADC_COMP_0_ST) << BIT_SHIFT_ADC_COMP_0_ST)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_ADC_COMP_VALUE_L
|
||||||
|
|
||||||
|
#define BIT_SHIFT_ADC_COMP_TH_1 16
|
||||||
|
#define BIT_MASK_ADC_COMP_TH_1 0xffff
|
||||||
|
#define BIT_ADC_COMP_TH_1(x) (((x) & BIT_MASK_ADC_COMP_TH_1) << BIT_SHIFT_ADC_COMP_TH_1)
|
||||||
|
#define BIT_CTRL_ADC_COMP_TH_1(x) (((x) & BIT_MASK_ADC_COMP_TH_1) << BIT_SHIFT_ADC_COMP_TH_1)
|
||||||
|
#define BIT_GET_ADC_COMP_TH_1(x) (((x) >> BIT_SHIFT_ADC_COMP_TH_1) & BIT_MASK_ADC_COMP_TH_1)
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_ADC_COMP_TH_0 0
|
||||||
|
#define BIT_MASK_ADC_COMP_TH_0 0xffff
|
||||||
|
#define BIT_ADC_COMP_TH_0(x) (((x) & BIT_MASK_ADC_COMP_TH_0) << BIT_SHIFT_ADC_COMP_TH_0)
|
||||||
|
#define BIT_CTRL_ADC_COMP_TH_0(x) (((x) & BIT_MASK_ADC_COMP_TH_0) << BIT_SHIFT_ADC_COMP_TH_0)
|
||||||
|
#define BIT_GET_ADC_COMP_TH_0(x) (((x) >> BIT_SHIFT_ADC_COMP_TH_0) & BIT_MASK_ADC_COMP_TH_0)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_ADC_COMP_VALUE_H
|
||||||
|
|
||||||
|
#define BIT_SHIFT_ADC_COMP_TH_3 16
|
||||||
|
#define BIT_MASK_ADC_COMP_TH_3 0xffff
|
||||||
|
#define BIT_ADC_COMP_TH_3(x) (((x) & BIT_MASK_ADC_COMP_TH_3) << BIT_SHIFT_ADC_COMP_TH_3)
|
||||||
|
#define BIT_CTRL_ADC_COMP_TH_3(x) (((x) & BIT_MASK_ADC_COMP_TH_3) << BIT_SHIFT_ADC_COMP_TH_3)
|
||||||
|
#define BIT_GET_ADC_COMP_TH_3(x) (((x) >> BIT_SHIFT_ADC_COMP_TH_3) & BIT_MASK_ADC_COMP_TH_3)
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_ADC_COMP_TH_2 0
|
||||||
|
#define BIT_MASK_ADC_COMP_TH_2 0xffff
|
||||||
|
#define BIT_ADC_COMP_TH_2(x) (((x) & BIT_MASK_ADC_COMP_TH_2) << BIT_SHIFT_ADC_COMP_TH_2)
|
||||||
|
#define BIT_CTRL_ADC_COMP_TH_2(x) (((x) & BIT_MASK_ADC_COMP_TH_2) << BIT_SHIFT_ADC_COMP_TH_2)
|
||||||
|
#define BIT_GET_ADC_COMP_TH_2(x) (((x) >> BIT_SHIFT_ADC_COMP_TH_2) & BIT_MASK_ADC_COMP_TH_2)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_ADC_COMP_SET
|
||||||
|
|
||||||
|
#define BIT_SHIFT_ADC_GREATER_THAN 0
|
||||||
|
#define BIT_MASK_ADC_GREATER_THAN 0xf
|
||||||
|
#define BIT_ADC_GREATER_THAN(x) (((x) & BIT_MASK_ADC_GREATER_THAN) << BIT_SHIFT_ADC_GREATER_THAN)
|
||||||
|
#define BIT_CTRL_ADC_GREATER_THAN(x) (((x) & BIT_MASK_ADC_GREATER_THAN) << BIT_SHIFT_ADC_GREATER_THAN)
|
||||||
|
#define BIT_GET_ADC_GREATER_THAN(x) (((x) >> BIT_SHIFT_ADC_GREATER_THAN) & BIT_MASK_ADC_GREATER_THAN)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_ADC_POWER
|
||||||
|
|
||||||
|
#define BIT_SHIFT_ADC_PWR_CUT_CNTR 16
|
||||||
|
#define BIT_MASK_ADC_PWR_CUT_CNTR 0xff
|
||||||
|
#define BIT_ADC_PWR_CUT_CNTR(x) (((x) & BIT_MASK_ADC_PWR_CUT_CNTR) << BIT_SHIFT_ADC_PWR_CUT_CNTR)
|
||||||
|
#define BIT_CTRL_ADC_PWR_CUT_CNTR(x) (((x) & BIT_MASK_ADC_PWR_CUT_CNTR) << BIT_SHIFT_ADC_PWR_CUT_CNTR)
|
||||||
|
#define BIT_GET_ADC_PWR_CUT_CNTR(x) (((x) >> BIT_SHIFT_ADC_PWR_CUT_CNTR) & BIT_MASK_ADC_PWR_CUT_CNTR)
|
||||||
|
|
||||||
|
#define BIT_ADC_FIFO_ON_ST BIT(11)
|
||||||
|
#define BIT_SHIFT_ADC_FIFO_ON_ST 11
|
||||||
|
#define BIT_MASK_ADC_FIFO_ON_ST 0x1
|
||||||
|
#define BIT_CTRL_ADC_FIFO_ON_ST(x) (((x) & BIT_MASK_ADC_FIFO_ON_ST) << BIT_SHIFT_ADC_FIFO_ON_ST)
|
||||||
|
|
||||||
|
#define BIT_ADC_ISO_ON_ST BIT(10)
|
||||||
|
#define BIT_SHIFT_ADC_ISO_ON_ST 10
|
||||||
|
#define BIT_MASK_ADC_ISO_ON_ST 0x1
|
||||||
|
#define BIT_CTRL_ADC_ISO_ON_ST(x) (((x) & BIT_MASK_ADC_ISO_ON_ST) << BIT_SHIFT_ADC_ISO_ON_ST)
|
||||||
|
|
||||||
|
#define BIT_ADC_PWR33_ON_ST BIT(9)
|
||||||
|
#define BIT_SHIFT_ADC_PWR33_ON_ST 9
|
||||||
|
#define BIT_MASK_ADC_PWR33_ON_ST 0x1
|
||||||
|
#define BIT_CTRL_ADC_PWR33_ON_ST(x) (((x) & BIT_MASK_ADC_PWR33_ON_ST) << BIT_SHIFT_ADC_PWR33_ON_ST)
|
||||||
|
|
||||||
|
#define BIT_ADC_PWR12_ON_ST BIT(8)
|
||||||
|
#define BIT_SHIFT_ADC_PWR12_ON_ST 8
|
||||||
|
#define BIT_MASK_ADC_PWR12_ON_ST 0x1
|
||||||
|
#define BIT_CTRL_ADC_PWR12_ON_ST(x) (((x) & BIT_MASK_ADC_PWR12_ON_ST) << BIT_SHIFT_ADC_PWR12_ON_ST)
|
||||||
|
|
||||||
|
#define BIT_ADC_ISO_MANUAL BIT(3)
|
||||||
|
#define BIT_SHIFT_ADC_ISO_MANUAL 3
|
||||||
|
#define BIT_MASK_ADC_ISO_MANUAL 0x1
|
||||||
|
#define BIT_CTRL_ADC_ISO_MANUAL(x) (((x) & BIT_MASK_ADC_ISO_MANUAL) << BIT_SHIFT_ADC_ISO_MANUAL)
|
||||||
|
|
||||||
|
#define BIT_ADC_PWR33_MANUAL BIT(2)
|
||||||
|
#define BIT_SHIFT_ADC_PWR33_MANUAL 2
|
||||||
|
#define BIT_MASK_ADC_PWR33_MANUAL 0x1
|
||||||
|
#define BIT_CTRL_ADC_PWR33_MANUAL(x) (((x) & BIT_MASK_ADC_PWR33_MANUAL) << BIT_SHIFT_ADC_PWR33_MANUAL)
|
||||||
|
|
||||||
|
#define BIT_ADC_PWR12_MANUAL BIT(1)
|
||||||
|
#define BIT_SHIFT_ADC_PWR12_MANUAL 1
|
||||||
|
#define BIT_MASK_ADC_PWR12_MANUAL 0x1
|
||||||
|
#define BIT_CTRL_ADC_PWR12_MANUAL(x) (((x) & BIT_MASK_ADC_PWR12_MANUAL) << BIT_SHIFT_ADC_PWR12_MANUAL)
|
||||||
|
|
||||||
|
#define BIT_ADC_PWR_AUTO BIT(0)
|
||||||
|
#define BIT_SHIFT_ADC_PWR_AUTO 0
|
||||||
|
#define BIT_MASK_ADC_PWR_AUTO 0x1
|
||||||
|
#define BIT_CTRL_ADC_PWR_AUTO(x) (((x) & BIT_MASK_ADC_PWR_AUTO) << BIT_SHIFT_ADC_PWR_AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_ADC_ANAPAR_AD0
|
||||||
|
|
||||||
|
#define BIT_SHIFT_ADC_ANAPAR_AD0 2
|
||||||
|
#define BIT_MASK_ADC_ANAPAR_AD0 0x3fffffff
|
||||||
|
#define BIT_ADC_ANAPAR_AD0(x) (((x) & BIT_MASK_ADC_ANAPAR_AD0) << BIT_SHIFT_ADC_ANAPAR_AD0)
|
||||||
|
#define BIT_CTRL_ADC_ANAPAR_AD0(x) (((x) & BIT_MASK_ADC_ANAPAR_AD0) << BIT_SHIFT_ADC_ANAPAR_AD0)
|
||||||
|
#define BIT_GET_ADC_ANAPAR_AD0(x) (((x) >> BIT_SHIFT_ADC_ANAPAR_AD0) & BIT_MASK_ADC_ANAPAR_AD0)
|
||||||
|
|
||||||
|
#define BIT_ADC_AUDIO_EN BIT(1)
|
||||||
|
#define BIT_SHIFT_ADC_AUDIO_EN 1
|
||||||
|
#define BIT_MASK_ADC_AUDIO_EN 0x1
|
||||||
|
#define BIT_CTRL_ADC_AUDIO_EN(x) (((x) & BIT_MASK_ADC_AUDIO_EN) << BIT_SHIFT_ADC_AUDIO_EN)
|
||||||
|
|
||||||
|
#define BIT_ADC_EN_MANUAL BIT(0)
|
||||||
|
#define BIT_SHIFT_ADC_EN_MANUAL 0
|
||||||
|
#define BIT_MASK_ADC_EN_MANUAL 0x1
|
||||||
|
#define BIT_CTRL_ADC_EN_MANUAL(x) (((x) & BIT_MASK_ADC_EN_MANUAL) << BIT_SHIFT_ADC_EN_MANUAL)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_ADC_ANAPAR_AD1
|
||||||
|
|
||||||
|
#define BIT_SHIFT_ADC_ANAPAR_AD1 0
|
||||||
|
#define BIT_MASK_ADC_ANAPAR_AD1 0xffffffffL
|
||||||
|
#define BIT_ADC_ANAPAR_AD1(x) (((x) & BIT_MASK_ADC_ANAPAR_AD1) << BIT_SHIFT_ADC_ANAPAR_AD1)
|
||||||
|
#define BIT_CTRL_ADC_ANAPAR_AD1(x) (((x) & BIT_MASK_ADC_ANAPAR_AD1) << BIT_SHIFT_ADC_ANAPAR_AD1)
|
||||||
|
#define BIT_GET_ADC_ANAPAR_AD1(x) (((x) >> BIT_SHIFT_ADC_ANAPAR_AD1) & BIT_MASK_ADC_ANAPAR_AD1)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_ADC_ANAPAR_AD2
|
||||||
|
|
||||||
|
#define BIT_SHIFT_ADC_ANAPAR_AD2 0
|
||||||
|
#define BIT_MASK_ADC_ANAPAR_AD2 0xffffffffL
|
||||||
|
#define BIT_ADC_ANAPAR_AD2(x) (((x) & BIT_MASK_ADC_ANAPAR_AD2) << BIT_SHIFT_ADC_ANAPAR_AD2)
|
||||||
|
#define BIT_CTRL_ADC_ANAPAR_AD2(x) (((x) & BIT_MASK_ADC_ANAPAR_AD2) << BIT_SHIFT_ADC_ANAPAR_AD2)
|
||||||
|
#define BIT_GET_ADC_ANAPAR_AD2(x) (((x) >> BIT_SHIFT_ADC_ANAPAR_AD2) & BIT_MASK_ADC_ANAPAR_AD2)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_ADC_ANAPAR_AD3
|
||||||
|
|
||||||
|
#define BIT_SHIFT_ADC_ANAPAR_AD3 0
|
||||||
|
#define BIT_MASK_ADC_ANAPAR_AD3 0xffffffffL
|
||||||
|
#define BIT_ADC_ANAPAR_AD3(x) (((x) & BIT_MASK_ADC_ANAPAR_AD3) << BIT_SHIFT_ADC_ANAPAR_AD3)
|
||||||
|
#define BIT_CTRL_ADC_ANAPAR_AD3(x) (((x) & BIT_MASK_ADC_ANAPAR_AD3) << BIT_SHIFT_ADC_ANAPAR_AD3)
|
||||||
|
#define BIT_GET_ADC_ANAPAR_AD3(x) (((x) >> BIT_SHIFT_ADC_ANAPAR_AD3) & BIT_MASK_ADC_ANAPAR_AD3)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_ADC_ANAPAR_AD4
|
||||||
|
|
||||||
|
#define BIT_SHIFT_ADC_ANAPAR_AD4 0
|
||||||
|
#define BIT_MASK_ADC_ANAPAR_AD4 0xffffffffL
|
||||||
|
#define BIT_ADC_ANAPAR_AD4(x) (((x) & BIT_MASK_ADC_ANAPAR_AD4) << BIT_SHIFT_ADC_ANAPAR_AD4)
|
||||||
|
#define BIT_CTRL_ADC_ANAPAR_AD4(x) (((x) & BIT_MASK_ADC_ANAPAR_AD4) << BIT_SHIFT_ADC_ANAPAR_AD4)
|
||||||
|
#define BIT_GET_ADC_ANAPAR_AD4(x) (((x) >> BIT_SHIFT_ADC_ANAPAR_AD4) & BIT_MASK_ADC_ANAPAR_AD4)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_ADC_ANAPAR_AD5
|
||||||
|
|
||||||
|
#define BIT_SHIFT_ADC_ANAPAR_AD5 0
|
||||||
|
#define BIT_MASK_ADC_ANAPAR_AD5 0xffffffffL
|
||||||
|
#define BIT_ADC_ANAPAR_AD5(x) (((x) & BIT_MASK_ADC_ANAPAR_AD5) << BIT_SHIFT_ADC_ANAPAR_AD5)
|
||||||
|
#define BIT_CTRL_ADC_ANAPAR_AD5(x) (((x) & BIT_MASK_ADC_ANAPAR_AD5) << BIT_SHIFT_ADC_ANAPAR_AD5)
|
||||||
|
#define BIT_GET_ADC_ANAPAR_AD5(x) (((x) >> BIT_SHIFT_ADC_ANAPAR_AD5) & BIT_MASK_ADC_ANAPAR_AD5)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_ADC_CALI_DATA
|
||||||
|
|
||||||
|
#define BIT_SHIFT_ADC_CALI_DATA_6 16
|
||||||
|
#define BIT_MASK_ADC_CALI_DATA_6 0xffff
|
||||||
|
#define BIT_ADC_CALI_DATA_6(x) (((x) & BIT_MASK_ADC_CALI_DATA_6) << BIT_SHIFT_ADC_CALI_DATA_6)
|
||||||
|
#define BIT_CTRL_ADC_CALI_DATA_6(x) (((x) & BIT_MASK_ADC_CALI_DATA_6) << BIT_SHIFT_ADC_CALI_DATA_6)
|
||||||
|
#define BIT_GET_ADC_CALI_DATA_6(x) (((x) >> BIT_SHIFT_ADC_CALI_DATA_6) & BIT_MASK_ADC_CALI_DATA_6)
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_ADC_CALI_DATA_0 0
|
||||||
|
#define BIT_MASK_ADC_CALI_DATA_0 0xffff
|
||||||
|
#define BIT_ADC_CALI_DATA_0(x) (((x) & BIT_MASK_ADC_CALI_DATA_0) << BIT_SHIFT_ADC_CALI_DATA_0)
|
||||||
|
#define BIT_CTRL_ADC_CALI_DATA_0(x) (((x) & BIT_MASK_ADC_CALI_DATA_0) << BIT_SHIFT_ADC_CALI_DATA_0)
|
||||||
|
#define BIT_GET_ADC_CALI_DATA_0(x) (((x) >> BIT_SHIFT_ADC_CALI_DATA_0) & BIT_MASK_ADC_CALI_DATA_0)
|
||||||
|
|
||||||
|
//================ Register Reg Field =========================
|
||||||
|
#define REG_ADC_FIFO_READ 0x0000
|
||||||
|
#define REG_ADC_CONTROL 0x0004
|
||||||
|
#define REG_ADC_INTR_EN 0x0008
|
||||||
|
#define REG_ADC_INTR_STS 0x000C
|
||||||
|
#define REG_ADC_COMP_VALUE_L 0x0010
|
||||||
|
#define REG_ADC_COMP_VALUE_H 0x0014
|
||||||
|
#define REG_ADC_COMP_SET 0x0018
|
||||||
|
#define REG_ADC_POWER 0x001C
|
||||||
|
#define REG_ADC_ANAPAR_AD0 0x0020
|
||||||
|
#define REG_ADC_ANAPAR_AD1 0x0024
|
||||||
|
#define REG_ADC_ANAPAR_AD2 0x0028
|
||||||
|
#define REG_ADC_ANAPAR_AD3 0x002C
|
||||||
|
#define REG_ADC_ANAPAR_AD4 0x0030
|
||||||
|
#define REG_ADC_ANAPAR_AD5 0x0034
|
||||||
|
#define REG_ADC_CALI_DATA 0x0038
|
||||||
|
|
||||||
|
//================ ADC HAL related enumeration ==================
|
||||||
|
|
||||||
|
//================ ADC Function Prototypes =====================
|
||||||
|
#define HAL_ADC_WRITE32(addr, value) HAL_WRITE32(ADC_REG_BASE,addr,value)
|
||||||
|
#define HAL_ADC_READ32(addr) HAL_READ32(ADC_REG_BASE,addr)
|
||||||
|
|
||||||
|
RTK_STATUS HalADCInit8195a(IN VOID *Data);
|
||||||
|
RTK_STATUS HalADCDeInit8195a(IN VOID *Data);
|
||||||
|
RTK_STATUS HalADCEnableRtl8195a(IN VOID *Data);
|
||||||
|
RTK_STATUS HalADCIntrCtrl8195a(IN VOID *Data);
|
||||||
|
u32 HalADCReceiveRtl8195a(IN VOID *Data);
|
||||||
|
u32 HalADCReadRegRtl8195a(IN VOID *Data,IN u8 I2CReg);
|
||||||
|
|
||||||
|
#endif
|
294
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_dac.h
Normal file
294
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_dac.h
Normal file
|
@ -0,0 +1,294 @@
|
||||||
|
#ifndef _RTL8195A_DAC_H_
|
||||||
|
#define _RTL8195A_DAC_H_
|
||||||
|
|
||||||
|
//================ Register Bit Field ==========================
|
||||||
|
//2 REG_DAC0_FIFO_WR
|
||||||
|
|
||||||
|
#define BIT_SHIFT_DAC0_FIFO_WO 0
|
||||||
|
#define BIT_MASK_DAC0_FIFO_WO 0xffffffffL
|
||||||
|
#define BIT_DAC0_FIFO_WO(x) (((x) & BIT_MASK_DAC0_FIFO_WO) << BIT_SHIFT_DAC0_FIFO_WO)
|
||||||
|
#define BIT_CTRL_DAC0_FIFO_WO(x) (((x) & BIT_MASK_DAC0_FIFO_WO) << BIT_SHIFT_DAC0_FIFO_WO)
|
||||||
|
#define BIT_GET_DAC0_FIFO_WO(x) (((x) >> BIT_SHIFT_DAC0_FIFO_WO) & BIT_MASK_DAC0_FIFO_WO)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DAC_CTRL
|
||||||
|
|
||||||
|
#define BIT_SHIFT_DAC_DELTA_SIGMA 25
|
||||||
|
#define BIT_MASK_DAC_DELTA_SIGMA 0x7
|
||||||
|
#define BIT_DAC_DELTA_SIGMA(x) (((x) & BIT_MASK_DAC_DELTA_SIGMA) << BIT_SHIFT_DAC_DELTA_SIGMA)
|
||||||
|
#define BIT_CTRL_DAC_DELTA_SIGMA(x) (((x) & BIT_MASK_DAC_DELTA_SIGMA) << BIT_SHIFT_DAC_DELTA_SIGMA)
|
||||||
|
#define BIT_GET_DAC_DELTA_SIGMA(x) (((x) >> BIT_SHIFT_DAC_DELTA_SIGMA) & BIT_MASK_DAC_DELTA_SIGMA)
|
||||||
|
|
||||||
|
#define BIT_DAC_BYPASS_DSC BIT(24)
|
||||||
|
#define BIT_SHIFT_DAC_BYPASS_DSC 24
|
||||||
|
#define BIT_MASK_DAC_BYPASS_DSC 0x1
|
||||||
|
#define BIT_CTRL_DAC_BYPASS_DSC(x) (((x) & BIT_MASK_DAC_BYPASS_DSC) << BIT_SHIFT_DAC_BYPASS_DSC)
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_DAC_DSC_DBG_SEL 19
|
||||||
|
#define BIT_MASK_DAC_DSC_DBG_SEL 0x3
|
||||||
|
#define BIT_DAC_DSC_DBG_SEL(x) (((x) & BIT_MASK_DAC_DSC_DBG_SEL) << BIT_SHIFT_DAC_DSC_DBG_SEL)
|
||||||
|
#define BIT_CTRL_DAC_DSC_DBG_SEL(x) (((x) & BIT_MASK_DAC_DSC_DBG_SEL) << BIT_SHIFT_DAC_DSC_DBG_SEL)
|
||||||
|
#define BIT_GET_DAC_DSC_DBG_SEL(x) (((x) >> BIT_SHIFT_DAC_DSC_DBG_SEL) & BIT_MASK_DAC_DSC_DBG_SEL)
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_DAC_DBG_SEL 16
|
||||||
|
#define BIT_MASK_DAC_DBG_SEL 0x7
|
||||||
|
#define BIT_DAC_DBG_SEL(x) (((x) & BIT_MASK_DAC_DBG_SEL) << BIT_SHIFT_DAC_DBG_SEL)
|
||||||
|
#define BIT_CTRL_DAC_DBG_SEL(x) (((x) & BIT_MASK_DAC_DBG_SEL) << BIT_SHIFT_DAC_DBG_SEL)
|
||||||
|
#define BIT_GET_DAC_DBG_SEL(x) (((x) >> BIT_SHIFT_DAC_DBG_SEL) & BIT_MASK_DAC_DBG_SEL)
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_DAC_BURST_SIZE 8
|
||||||
|
#define BIT_MASK_DAC_BURST_SIZE 0xf
|
||||||
|
#define BIT_DAC_BURST_SIZE(x) (((x) & BIT_MASK_DAC_BURST_SIZE) << BIT_SHIFT_DAC_BURST_SIZE)
|
||||||
|
#define BIT_CTRL_DAC_BURST_SIZE(x) (((x) & BIT_MASK_DAC_BURST_SIZE) << BIT_SHIFT_DAC_BURST_SIZE)
|
||||||
|
#define BIT_GET_DAC_BURST_SIZE(x) (((x) >> BIT_SHIFT_DAC_BURST_SIZE) & BIT_MASK_DAC_BURST_SIZE)
|
||||||
|
|
||||||
|
#define BIT_DAC_FILTER_SETTLE BIT(4)
|
||||||
|
#define BIT_SHIFT_DAC_FILTER_SETTLE 4
|
||||||
|
#define BIT_MASK_DAC_FILTER_SETTLE 0x1
|
||||||
|
#define BIT_CTRL_DAC_FILTER_SETTLE(x) (((x) & BIT_MASK_DAC_FILTER_SETTLE) << BIT_SHIFT_DAC_FILTER_SETTLE)
|
||||||
|
|
||||||
|
#define BIT_DAC_OV_OPTION BIT(3)
|
||||||
|
#define BIT_SHIFT_DAC_OV_OPTION 3
|
||||||
|
#define BIT_MASK_DAC_OV_OPTION 0x1
|
||||||
|
#define BIT_CTRL_DAC_OV_OPTION(x) (((x) & BIT_MASK_DAC_OV_OPTION) << BIT_SHIFT_DAC_OV_OPTION)
|
||||||
|
|
||||||
|
#define BIT_DAC_ENDIAN BIT(2)
|
||||||
|
#define BIT_SHIFT_DAC_ENDIAN 2
|
||||||
|
#define BIT_MASK_DAC_ENDIAN 0x1
|
||||||
|
#define BIT_CTRL_DAC_ENDIAN(x) (((x) & BIT_MASK_DAC_ENDIAN) << BIT_SHIFT_DAC_ENDIAN)
|
||||||
|
|
||||||
|
#define BIT_DAC_SPEED BIT(1)
|
||||||
|
#define BIT_SHIFT_DAC_SPEED 1
|
||||||
|
#define BIT_MASK_DAC_SPEED 0x1
|
||||||
|
#define BIT_CTRL_DAC_SPEED(x) (((x) & BIT_MASK_DAC_SPEED) << BIT_SHIFT_DAC_SPEED)
|
||||||
|
|
||||||
|
#define BIT_DAC_FIFO_EN BIT(0)
|
||||||
|
#define BIT_SHIFT_DAC_FIFO_EN 0
|
||||||
|
#define BIT_MASK_DAC_FIFO_EN 0x1
|
||||||
|
#define BIT_CTRL_DAC_FIFO_EN(x) (((x) & BIT_MASK_DAC_FIFO_EN) << BIT_SHIFT_DAC_FIFO_EN)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DAC_INTR_CTRL
|
||||||
|
#define BIT_DAC_DSC_OVERFLOW1_EN BIT(6)
|
||||||
|
#define BIT_SHIFT_DAC_DSC_OVERFLOW1_EN 6
|
||||||
|
#define BIT_MASK_DAC_DSC_OVERFLOW1_EN 0x1
|
||||||
|
#define BIT_CTRL_DAC_DSC_OVERFLOW1_EN(x) (((x) & BIT_MASK_DAC_DSC_OVERFLOW1_EN) << BIT_SHIFT_DAC_DSC_OVERFLOW1_EN)
|
||||||
|
|
||||||
|
#define BIT_DAC_DSC_OVERFLOW0_EN BIT(5)
|
||||||
|
#define BIT_SHIFT_DAC_DSC_OVERFLOW0_EN 5
|
||||||
|
#define BIT_MASK_DAC_DSC_OVERFLOW0_EN 0x1
|
||||||
|
#define BIT_CTRL_DAC_DSC_OVERFLOW0_EN(x) (((x) & BIT_MASK_DAC_DSC_OVERFLOW0_EN) << BIT_SHIFT_DAC_DSC_OVERFLOW0_EN)
|
||||||
|
|
||||||
|
#define BIT_DAC__WRITE_ERROR_EN BIT(4)
|
||||||
|
#define BIT_SHIFT_DAC__WRITE_ERROR_EN 4
|
||||||
|
#define BIT_MASK_DAC__WRITE_ERROR_EN 0x1
|
||||||
|
#define BIT_CTRL_DAC__WRITE_ERROR_EN(x) (((x) & BIT_MASK_DAC__WRITE_ERROR_EN) << BIT_SHIFT_DAC__WRITE_ERROR_EN)
|
||||||
|
|
||||||
|
#define BIT_DAC_FIFO_STOP_EN BIT(3)
|
||||||
|
#define BIT_SHIFT_DAC_FIFO_STOP_EN 3
|
||||||
|
#define BIT_MASK_DAC_FIFO_STOP_EN 0x1
|
||||||
|
#define BIT_CTRL_DAC_FIFO_STOP_EN(x) (((x) & BIT_MASK_DAC_FIFO_STOP_EN) << BIT_SHIFT_DAC_FIFO_STOP_EN)
|
||||||
|
|
||||||
|
#define BIT_DAC_FIFO_OVERFLOW_EN BIT(2)
|
||||||
|
#define BIT_SHIFT_DAC_FIFO_OVERFLOW_EN 2
|
||||||
|
#define BIT_MASK_DAC_FIFO_OVERFLOW_EN 0x1
|
||||||
|
#define BIT_CTRL_DAC_FIFO_OVERFLOW_EN(x) (((x) & BIT_MASK_DAC_FIFO_OVERFLOW_EN) << BIT_SHIFT_DAC_FIFO_OVERFLOW_EN)
|
||||||
|
|
||||||
|
#define BIT_DAC_FIFO_WR_REQ_EN BIT(1)
|
||||||
|
#define BIT_SHIFT_DAC_FIFO_WR_REQ_EN 1
|
||||||
|
#define BIT_MASK_DAC_FIFO_WR_REQ_EN 0x1
|
||||||
|
#define BIT_CTRL_DAC_FIFO_WR_REQ_EN(x) (((x) & BIT_MASK_DAC_FIFO_WR_REQ_EN) << BIT_SHIFT_DAC_FIFO_WR_REQ_EN)
|
||||||
|
|
||||||
|
#define BIT_DAC_FIFO_FULL_EN BIT(0)
|
||||||
|
#define BIT_SHIFT_DAC_FIFO_FULL_EN 0
|
||||||
|
#define BIT_MASK_DAC_FIFO_FULL_EN 0x1
|
||||||
|
#define BIT_CTRL_DAC_FIFO_FULL_EN(x) (((x) & BIT_MASK_DAC_FIFO_FULL_EN) << BIT_SHIFT_DAC_FIFO_FULL_EN)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DAC_INTR_STS
|
||||||
|
#define BIT_DAC_DSC_OVERFLOW1_ST BIT(6)
|
||||||
|
#define BIT_SHIFT_DAC_DSC_OVERFLOW1_ST 6
|
||||||
|
#define BIT_MASK_DAC_DSC_OVERFLOW1_ST 0x1
|
||||||
|
#define BIT_CTRL_DAC_DSC_OVERFLOW1_ST(x) (((x) & BIT_MASK_DAC_DSC_OVERFLOW1_ST) << BIT_SHIFT_DAC_DSC_OVERFLOW1_ST)
|
||||||
|
|
||||||
|
#define BIT_DAC_DSC_OVERFLOW0_ST BIT(5)
|
||||||
|
#define BIT_SHIFT_DAC_DSC_OVERFLOW0_ST 5
|
||||||
|
#define BIT_MASK_DAC_DSC_OVERFLOW0_ST 0x1
|
||||||
|
#define BIT_CTRL_DAC_DSC_OVERFLOW0_ST(x) (((x) & BIT_MASK_DAC_DSC_OVERFLOW0_ST) << BIT_SHIFT_DAC_DSC_OVERFLOW0_ST)
|
||||||
|
|
||||||
|
#define BIT_DAC__WRITE_ERROR_ST BIT(4)
|
||||||
|
#define BIT_SHIFT_DAC__WRITE_ERROR_ST 4
|
||||||
|
#define BIT_MASK_DAC__WRITE_ERROR_ST 0x1
|
||||||
|
#define BIT_CTRL_DAC__WRITE_ERROR_ST(x) (((x) & BIT_MASK_DAC__WRITE_ERROR_ST) << BIT_SHIFT_DAC__WRITE_ERROR_ST)
|
||||||
|
|
||||||
|
#define BIT_DAC_FIFO_STOP_ST BIT(3)
|
||||||
|
#define BIT_SHIFT_DAC_FIFO_STOP_ST 3
|
||||||
|
#define BIT_MASK_DAC_FIFO_STOP_ST 0x1
|
||||||
|
#define BIT_CTRL_DAC_FIFO_STOP_ST(x) (((x) & BIT_MASK_DAC_FIFO_STOP_ST) << BIT_SHIFT_DAC_FIFO_STOP_ST)
|
||||||
|
|
||||||
|
#define BIT_DAC_FIFO_OVERFLOW_ST BIT(2)
|
||||||
|
#define BIT_SHIFT_DAC_FIFO_OVERFLOW_ST 2
|
||||||
|
#define BIT_MASK_DAC_FIFO_OVERFLOW_ST 0x1
|
||||||
|
#define BIT_CTRL_DAC_FIFO_OVERFLOW_ST(x) (((x) & BIT_MASK_DAC_FIFO_OVERFLOW_ST) << BIT_SHIFT_DAC_FIFO_OVERFLOW_ST)
|
||||||
|
|
||||||
|
#define BIT_DAC_FIFO_WR_REQ_ST BIT(1)
|
||||||
|
#define BIT_SHIFT_DAC_FIFO_WR_REQ_ST 1
|
||||||
|
#define BIT_MASK_DAC_FIFO_WR_REQ_ST 0x1
|
||||||
|
#define BIT_CTRL_DAC_FIFO_WR_REQ_ST(x) (((x) & BIT_MASK_DAC_FIFO_WR_REQ_ST) << BIT_SHIFT_DAC_FIFO_WR_REQ_ST)
|
||||||
|
|
||||||
|
#define BIT_DAC_FIFO_FULL_ST BIT(0)
|
||||||
|
#define BIT_SHIFT_DAC_FIFO_FULL_ST 0
|
||||||
|
#define BIT_MASK_DAC_FIFO_FULL_ST 0x1
|
||||||
|
#define BIT_CTRL_DAC_FIFO_FULL_ST(x) (((x) & BIT_MASK_DAC_FIFO_FULL_ST) << BIT_SHIFT_DAC_FIFO_FULL_ST)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DAC_PWR_CTRL
|
||||||
|
|
||||||
|
#define BIT_SHIFT_DAC_PWR_CUT_CNTR 16
|
||||||
|
#define BIT_MASK_DAC_PWR_CUT_CNTR 0xff
|
||||||
|
#define BIT_DAC_PWR_CUT_CNTR(x) (((x) & BIT_MASK_DAC_PWR_CUT_CNTR) << BIT_SHIFT_DAC_PWR_CUT_CNTR)
|
||||||
|
#define BIT_CTRL_DAC_PWR_CUT_CNTR(x) (((x) & BIT_MASK_DAC_PWR_CUT_CNTR) << BIT_SHIFT_DAC_PWR_CUT_CNTR)
|
||||||
|
#define BIT_GET_DAC_PWR_CUT_CNTR(x) (((x) >> BIT_SHIFT_DAC_PWR_CUT_CNTR) & BIT_MASK_DAC_PWR_CUT_CNTR)
|
||||||
|
|
||||||
|
#define BIT_ST_DAC_FIFO_ON BIT(11)
|
||||||
|
#define BIT_SHIFT_ST_DAC_FIFO_ON 11
|
||||||
|
#define BIT_MASK_ST_DAC_FIFO_ON 0x1
|
||||||
|
#define BIT_CTRL_ST_DAC_FIFO_ON(x) (((x) & BIT_MASK_ST_DAC_FIFO_ON) << BIT_SHIFT_ST_DAC_FIFO_ON)
|
||||||
|
|
||||||
|
#define BIT_ST_DAC_ISO_ON BIT(10)
|
||||||
|
#define BIT_SHIFT_ST_DAC_ISO_ON 10
|
||||||
|
#define BIT_MASK_ST_DAC_ISO_ON 0x1
|
||||||
|
#define BIT_CTRL_ST_DAC_ISO_ON(x) (((x) & BIT_MASK_ST_DAC_ISO_ON) << BIT_SHIFT_ST_DAC_ISO_ON)
|
||||||
|
|
||||||
|
#define BIT_ST_DAC_PWR33_ON BIT(9)
|
||||||
|
#define BIT_SHIFT_ST_DAC_PWR33_ON 9
|
||||||
|
#define BIT_MASK_ST_DAC_PWR33_ON 0x1
|
||||||
|
#define BIT_CTRL_ST_DAC_PWR33_ON(x) (((x) & BIT_MASK_ST_DAC_PWR33_ON) << BIT_SHIFT_ST_DAC_PWR33_ON)
|
||||||
|
|
||||||
|
#define BIT_ST_DAC_PWR12_ON BIT(8)
|
||||||
|
#define BIT_SHIFT_ST_DAC_PWR12_ON 8
|
||||||
|
#define BIT_MASK_ST_DAC_PWR12_ON 0x1
|
||||||
|
#define BIT_CTRL_ST_DAC_PWR12_ON(x) (((x) & BIT_MASK_ST_DAC_PWR12_ON) << BIT_SHIFT_ST_DAC_PWR12_ON)
|
||||||
|
|
||||||
|
#define BIT_DAC_ISO_MANU BIT(3)
|
||||||
|
#define BIT_SHIFT_DAC_ISO_MANU 3
|
||||||
|
#define BIT_MASK_DAC_ISO_MANU 0x1
|
||||||
|
#define BIT_CTRL_DAC_ISO_MANU(x) (((x) & BIT_MASK_DAC_ISO_MANU) << BIT_SHIFT_DAC_ISO_MANU)
|
||||||
|
|
||||||
|
#define BIT_DAC_PWR33_MANU BIT(2)
|
||||||
|
#define BIT_SHIFT_DAC_PWR33_MANU 2
|
||||||
|
#define BIT_MASK_DAC_PWR33_MANU 0x1
|
||||||
|
#define BIT_CTRL_DAC_PWR33_MANU(x) (((x) & BIT_MASK_DAC_PWR33_MANU) << BIT_SHIFT_DAC_PWR33_MANU)
|
||||||
|
|
||||||
|
#define BIT_DAC_PWR12_MANU BIT(1)
|
||||||
|
#define BIT_SHIFT_DAC_PWR12_MANU 1
|
||||||
|
#define BIT_MASK_DAC_PWR12_MANU 0x1
|
||||||
|
#define BIT_CTRL_DAC_PWR12_MANU(x) (((x) & BIT_MASK_DAC_PWR12_MANU) << BIT_SHIFT_DAC_PWR12_MANU)
|
||||||
|
|
||||||
|
#define BIT_DAC_PWR_AUTO BIT(0)
|
||||||
|
#define BIT_SHIFT_DAC_PWR_AUTO 0
|
||||||
|
#define BIT_MASK_DAC_PWR_AUTO 0x1
|
||||||
|
#define BIT_CTRL_DAC_PWR_AUTO(x) (((x) & BIT_MASK_DAC_PWR_AUTO) << BIT_SHIFT_DAC_PWR_AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DAC_ANAPAR_DA0
|
||||||
|
|
||||||
|
#define BIT_SHIFT_PWR_ALL_CNTR 12
|
||||||
|
#define BIT_MASK_PWR_ALL_CNTR 0xfffff
|
||||||
|
#define BIT_PWR_ALL_CNTR(x) (((x) & BIT_MASK_PWR_ALL_CNTR) << BIT_SHIFT_PWR_ALL_CNTR)
|
||||||
|
#define BIT_CTRL_PWR_ALL_CNTR(x) (((x) & BIT_MASK_PWR_ALL_CNTR) << BIT_SHIFT_PWR_ALL_CNTR)
|
||||||
|
#define BIT_GET_PWR_ALL_CNTR(x) (((x) >> BIT_SHIFT_PWR_ALL_CNTR) & BIT_MASK_PWR_ALL_CNTR)
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_PWR_FUP_CNTR 0
|
||||||
|
#define BIT_MASK_PWR_FUP_CNTR 0xfff
|
||||||
|
#define BIT_PWR_FUP_CNTR(x) (((x) & BIT_MASK_PWR_FUP_CNTR) << BIT_SHIFT_PWR_FUP_CNTR)
|
||||||
|
#define BIT_CTRL_PWR_FUP_CNTR(x) (((x) & BIT_MASK_PWR_FUP_CNTR) << BIT_SHIFT_PWR_FUP_CNTR)
|
||||||
|
#define BIT_GET_PWR_FUP_CNTR(x) (((x) >> BIT_SHIFT_PWR_FUP_CNTR) & BIT_MASK_PWR_FUP_CNTR)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DAC_ANAPAR_DA1
|
||||||
|
#define BIT_FUP_EN BIT(31)
|
||||||
|
#define BIT_SHIFT_FUP_EN 31
|
||||||
|
#define BIT_MASK_FUP_EN 0x1
|
||||||
|
#define BIT_CTRL_FUP_EN(x) (((x) & BIT_MASK_FUP_EN) << BIT_SHIFT_FUP_EN)
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_ANAPAR_DA 8
|
||||||
|
#define BIT_MASK_ANAPAR_DA 0x7fffff
|
||||||
|
#define BIT_ANAPAR_DA(x) (((x) & BIT_MASK_ANAPAR_DA) << BIT_SHIFT_ANAPAR_DA)
|
||||||
|
#define BIT_CTRL_ANAPAR_DA(x) (((x) & BIT_MASK_ANAPAR_DA) << BIT_SHIFT_ANAPAR_DA)
|
||||||
|
#define BIT_GET_ANAPAR_DA(x) (((x) >> BIT_SHIFT_ANAPAR_DA) & BIT_MASK_ANAPAR_DA)
|
||||||
|
|
||||||
|
#define BIT_D_POW_DACVREF BIT(7)
|
||||||
|
#define BIT_SHIFT_D_POW_DACVREF 7
|
||||||
|
#define BIT_MASK_D_POW_DACVREF 0x1
|
||||||
|
#define BIT_CTRL_D_POW_DACVREF(x) (((x) & BIT_MASK_D_POW_DACVREF) << BIT_SHIFT_D_POW_DACVREF)
|
||||||
|
|
||||||
|
#define BIT_D_POW_VREF2 BIT(6)
|
||||||
|
#define BIT_SHIFT_D_POW_VREF2 6
|
||||||
|
#define BIT_MASK_D_POW_VREF2 0x1
|
||||||
|
#define BIT_CTRL_D_POW_VREF2(x) (((x) & BIT_MASK_D_POW_VREF2) << BIT_SHIFT_D_POW_VREF2)
|
||||||
|
|
||||||
|
#define BIT_D_POW_MBIAS BIT(5)
|
||||||
|
#define BIT_SHIFT_D_POW_MBIAS 5
|
||||||
|
#define BIT_MASK_D_POW_MBIAS 0x1
|
||||||
|
#define BIT_CTRL_D_POW_MBIAS(x) (((x) & BIT_MASK_D_POW_MBIAS) << BIT_SHIFT_D_POW_MBIAS)
|
||||||
|
|
||||||
|
#define BIT_D_POW_DIV4 BIT(4)
|
||||||
|
#define BIT_SHIFT_D_POW_DIV4 4
|
||||||
|
#define BIT_MASK_D_POW_DIV4 0x1
|
||||||
|
#define BIT_CTRL_D_POW_DIV4(x) (((x) & BIT_MASK_D_POW_DIV4) << BIT_SHIFT_D_POW_DIV4)
|
||||||
|
|
||||||
|
#define BIT_D_POW_DF1SE_R BIT(3)
|
||||||
|
#define BIT_SHIFT_D_POW_DF1SE_R 3
|
||||||
|
#define BIT_MASK_D_POW_DF1SE_R 0x1
|
||||||
|
#define BIT_CTRL_D_POW_DF1SE_R(x) (((x) & BIT_MASK_D_POW_DF1SE_R) << BIT_SHIFT_D_POW_DF1SE_R)
|
||||||
|
|
||||||
|
#define BIT_D_POW_DF2SE_L BIT(2)
|
||||||
|
#define BIT_SHIFT_D_POW_DF2SE_L 2
|
||||||
|
#define BIT_MASK_D_POW_DF2SE_L 0x1
|
||||||
|
#define BIT_CTRL_D_POW_DF2SE_L(x) (((x) & BIT_MASK_D_POW_DF2SE_L) << BIT_SHIFT_D_POW_DF2SE_L)
|
||||||
|
|
||||||
|
#define BIT_D_POW_DAC_R BIT(1)
|
||||||
|
#define BIT_SHIFT_D_POW_DAC_R 1
|
||||||
|
#define BIT_MASK_D_POW_DAC_R 0x1
|
||||||
|
#define BIT_CTRL_D_POW_DAC_R(x) (((x) & BIT_MASK_D_POW_DAC_R) << BIT_SHIFT_D_POW_DAC_R)
|
||||||
|
|
||||||
|
#define BIT_D_POW_DAC_L BIT(0)
|
||||||
|
#define BIT_SHIFT_D_POW_DAC_L 0
|
||||||
|
#define BIT_MASK_D_POW_DAC_L 0x1
|
||||||
|
#define BIT_CTRL_D_POW_DAC_L(x) (((x) & BIT_MASK_D_POW_DAC_L) << BIT_SHIFT_D_POW_DAC_L)
|
||||||
|
|
||||||
|
|
||||||
|
//================ Register Reg Field =========================
|
||||||
|
#define REG_DAC0_FIFO_WR 0x0000
|
||||||
|
#define REG_DAC_CTRL 0x0004
|
||||||
|
#define REG_DAC_INTR_CTRL 0x0008
|
||||||
|
#define REG_DAC_INTR_STS 0x000C
|
||||||
|
#define REG_DAC_PWR_CTRL 0x0010
|
||||||
|
#define REG_DAC_ANAPAR_DA0 0x0014
|
||||||
|
#define REG_DAC_ANAPAR_DA1 0x0018
|
||||||
|
|
||||||
|
|
||||||
|
//================ DAC HAL related enumeration ==================
|
||||||
|
|
||||||
|
|
||||||
|
//================ DAC HAL Macro ===========================
|
||||||
|
#define HAL_DAC_WRITE32(dacidx, addr, value) HAL_WRITE32(DAC_REG_BASE+dacidx*0x800 \
|
||||||
|
,addr,value)
|
||||||
|
#define HAL_DAC_READ32(dacidx, addr) HAL_READ32(DAC_REG_BASE+dacidx*0x800,addr)
|
||||||
|
|
||||||
|
|
||||||
|
//================ DAC Function Prototypes =====================
|
||||||
|
RTK_STATUS HalDACInit8195a(IN VOID *Data);
|
||||||
|
RTK_STATUS HalDACDeInit8195a(IN VOID *Data);
|
||||||
|
RTK_STATUS HalDACEnableRtl8195a(IN VOID *Data);
|
||||||
|
RTK_STATUS HalDACIntrCtrl8195a(IN VOID *Data);
|
||||||
|
u8 HalDACSendRtl8195a(IN VOID *Data);
|
||||||
|
u32 HalDACReadRegRtl8195a(IN VOID *Data,IN u8 I2CReg);
|
||||||
|
|
||||||
|
#endif
|
522
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_gdma.h
Normal file
522
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_gdma.h
Normal file
|
@ -0,0 +1,522 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _RTL8195A_GDMA_H_
|
||||||
|
#define _RTL8195A_GDMA_H_
|
||||||
|
|
||||||
|
// Define GDMA Handshake interface with peripheral, 0 -> GDMA0, 1-> GDMA1
|
||||||
|
// Set this Hnadshake interface map to register REG_PESOC_SOC_CTRL
|
||||||
|
#define GDMA_HANDSHAKE_UART0_TX 0
|
||||||
|
#define GDMA_HANDSHAKE_UART0_RX 1
|
||||||
|
#define GDMA_HANDSHAKE_UART1_TX 2
|
||||||
|
#define GDMA_HANDSHAKE_UART1_RX 3
|
||||||
|
#define GDMA_HANDSHAKE_UART2_TX 14 // Only on GDMA 0, hardware fixed
|
||||||
|
#define GDMA_HANDSHAKE_UART2_RX 14 // Only on GDMA 1, hardware fixed
|
||||||
|
|
||||||
|
#define GDMA_HANDSHAKE_SSI0_TX 4
|
||||||
|
#define GDMA_HANDSHAKE_SSI0_RX 5
|
||||||
|
#define GDMA_HANDSHAKE_SSI1_TX 6
|
||||||
|
#define GDMA_HANDSHAKE_SSI1_RX 7
|
||||||
|
#define GDMA_HANDSHAKE_SSI2_TX 15 // Only on GDMA 0, hardware fixed
|
||||||
|
#define GDMA_HANDSHAKE_SSI2_RX 15 // Only on GDMA 1, hardware fixed
|
||||||
|
|
||||||
|
#define GDMA_HANDSHAKE_I2C0_TX 8
|
||||||
|
#define GDMA_HANDSHAKE_I2C0_RX 9
|
||||||
|
#define GDMA_HANDSHAKE_I2C1_TX 10
|
||||||
|
#define GDMA_HANDSHAKE_I2C1_RX 11
|
||||||
|
|
||||||
|
#define GDMA_HANDSHAKE_ADC 12
|
||||||
|
#define GDMA_HANDSHAKE_DAC0 13 // Only on GDMA 0, hardware fixed
|
||||||
|
#define GDMA_HANDSHAKE_DAC1 13 // Only on GDMA 1, hardware fixed
|
||||||
|
|
||||||
|
#define HAL_GDMAX_READ32(GdmaIndex, addr) \
|
||||||
|
HAL_READ32(GDMA0_REG_BASE+ (GdmaIndex*GDMA1_REG_OFF), addr)
|
||||||
|
#define HAL_GDMAX_WRITE32(GdmaIndex, addr, value) \
|
||||||
|
HAL_WRITE32((GDMA0_REG_BASE+ (GdmaIndex*GDMA1_REG_OFF)), addr, value)
|
||||||
|
#define HAL_GDMAX_READ16(GdmaIndex, addr) \
|
||||||
|
HAL_READ16(GDMA0_REG_BASE+ (GdmaIndex*GDMA1_REG_OFF), addr)
|
||||||
|
#define HAL_GDMAX_WRITE16(GdmaIndex, addr, value) \
|
||||||
|
HAL_WRITE16(GDMA0_REG_BASE+ (GdmaIndex*GDMA1_REG_OFF), addr, value)
|
||||||
|
#define HAL_GDMAX_READ8(GdmaIndex, addr) \
|
||||||
|
HAL_READ8(GDMA0_REG_BASE+ (GdmaIndex*GDMA1_REG_OFF), addr)
|
||||||
|
#define HAL_GDMAX_WRITE8(GdmaIndex, addr, value) \
|
||||||
|
HAL_WRITE8(GDMA0_REG_BASE+ (GdmaIndex*GDMA1_REG_OFF), addr, value)
|
||||||
|
|
||||||
|
|
||||||
|
#define GDMA_CH_MAX 0x06
|
||||||
|
|
||||||
|
#define REG_GDMA_CH_OFF 0x058
|
||||||
|
#define REG_GDMA_CH_SAR 0x000
|
||||||
|
#define REG_GDMA_CH_DAR 0x008
|
||||||
|
#define REG_GDMA_CH_LLP 0x010
|
||||||
|
#define REG_GDMA_CH_CTL 0x018
|
||||||
|
#define REG_GDMA_CH_SSTAT 0x020
|
||||||
|
#define REG_GDMA_CH_DSTAT 0x028
|
||||||
|
#define REG_GDMA_CH_SSTATAR 0x030
|
||||||
|
#define REG_GDMA_CH_DSTATAR 0x038
|
||||||
|
#define REG_GDMA_CH_CFG 0x040
|
||||||
|
#define REG_GDMA_CH_SGR 0x048
|
||||||
|
#define REG_GDMA_CH_DSR 0x050
|
||||||
|
|
||||||
|
//3 Interrupt Registers
|
||||||
|
#define REG_GDMA_RAW_INT_BASE 0x2C0
|
||||||
|
#define REG_GDMA_RAW_INT_TFR 0x2C0
|
||||||
|
#define REG_GDMA_RAW_INT_BLOCK 0x2c8
|
||||||
|
#define REG_GDMA_RAW_INT_SRC_TRAN 0x2D0
|
||||||
|
#define REG_GDMA_RAW_INT_DST_TRAN 0x2D8
|
||||||
|
#define REG_GDMA_RAW_INT_ERR 0x2E0
|
||||||
|
|
||||||
|
#define REG_GDMA_STATUS_INT_BASE 0x2E8
|
||||||
|
#define REG_GDMA_STATUS_INT_TFR 0x2E8
|
||||||
|
#define REG_GDMA_STATUS_INT_BLOCK 0x2F0
|
||||||
|
#define REG_GDMA_STATUS_INT_SRC_TRAN 0x2F8
|
||||||
|
#define REG_GDMA_STATUS_INT_DST_TRAN 0x300
|
||||||
|
#define REG_GDMA_STATUS_INT_ERR 0x308
|
||||||
|
|
||||||
|
#define REG_GDMA_MASK_INT_BASE 0x310
|
||||||
|
#define REG_GDMA_MASK_INT_TFR 0x310
|
||||||
|
#define REG_GDMA_MASK_INT_BLOCK 0x318
|
||||||
|
#define REG_GDMA_MASK_INT_SRC_TRAN 0x320
|
||||||
|
#define REG_GDMA_MASK_INT_DST_TRAN 0x328
|
||||||
|
#define REG_GDMA_MASK_INT_INT_ERR 0x330
|
||||||
|
|
||||||
|
#define REG_GDMA_CLEAR_INT_BASE 0x338
|
||||||
|
#define REG_GDMA_CLEAR_INT_TFR 0x338
|
||||||
|
#define REG_GDMA_CLEAR_INT_BLOCK 0x340
|
||||||
|
#define REG_GDMA_CLEAR_INT_SRC_TRAN 0x348
|
||||||
|
#define REG_GDMA_CLEAR_INT_DST_TRAN 0x350
|
||||||
|
#define REG_GDMA_CLEAR_INT_ERR 0x358
|
||||||
|
#define REG_GDMA_STATUS_INT 0x360
|
||||||
|
|
||||||
|
//3 Software handshaking Registers
|
||||||
|
#define REG_GDMA_REQ_SRC 0x368
|
||||||
|
#define REG_GDMA_REQ_DST 0x370
|
||||||
|
#define REG_GDMA_REQ_SGL_REQ 0x378
|
||||||
|
#define REG_GDMA_REQ_DST_REQ 0x380
|
||||||
|
#define REG_GDMA_REQ_LST_SRC 0x388
|
||||||
|
#define REG_GDMA_REQ_LST_DST 0x390
|
||||||
|
|
||||||
|
//3 Miscellaneous Registers
|
||||||
|
#define REG_GDMA_DMAC_CFG 0x398
|
||||||
|
#define REG_GDMA_CH_EN 0x3A0
|
||||||
|
#define REG_GDMA_DMA_ID 0x3A8
|
||||||
|
#define REG_GDMA_DMA_TEST 0x3B0
|
||||||
|
#define REG_GDMA_DMA_COM_PARAMS6 0x3C8
|
||||||
|
#define REG_GDMA_DMA_COM_PARAMS5 0x3D0
|
||||||
|
#define REG_GDMA_DMA_COM_PARAMS4 0x3D8
|
||||||
|
#define REG_GDMA_DMA_COM_PARAMS3 0x3E0
|
||||||
|
#define REG_GDMA_DMA_COM_PARAMS2 0x3E8
|
||||||
|
#define REG_GDMA_DMA_COM_PARAMS1 0x3F0
|
||||||
|
#define REG_GDMA_DMA_COM_PARAMS0 0x3F8
|
||||||
|
|
||||||
|
//3 CTL Register Bit Control
|
||||||
|
#define BIT_SHIFT_CTLX_LO_INT_EN 0
|
||||||
|
#define BIT_MASK_CTLX_LO_INT_EN 0x1
|
||||||
|
#define BIT_CTLX_LO_INT_EN(x)(((x) & BIT_MASK_CTLX_LO_INT_EN) << BIT_SHIFT_CTLX_LO_INT_EN)
|
||||||
|
#define BIT_INVC_CTLX_LO_INT_EN (~(BIT_MASK_CTLX_LO_INT_EN << BIT_SHIFT_CTLX_LO_INT_EN))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_LO_DST_TR_WIDTH 1
|
||||||
|
#define BIT_MASK_CTLX_LO_DST_TR_WIDTH 0x7
|
||||||
|
#define BIT_CTLX_LO_DST_TR_WIDTH(x) (((x) & BIT_MASK_CTLX_LO_DST_TR_WIDTH) << BIT_SHIFT_CTLX_LO_DST_TR_WIDTH)
|
||||||
|
#define BIT_INVC_CTLX_LO_DST_TR_WIDTH (~(BIT_MASK_CTLX_LO_DST_TR_WIDTH << BIT_SHIFT_CTLX_LO_DST_TR_WIDTH))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_LO_SRC_TR_WIDTH 4
|
||||||
|
#define BIT_MASK_CTLX_LO_SRC_TR_WIDTH 0x7
|
||||||
|
#define BIT_CTLX_LO_SRC_TR_WIDTH(x) (((x) & BIT_MASK_CTLX_LO_SRC_TR_WIDTH) << BIT_SHIFT_CTLX_LO_SRC_TR_WIDTH)
|
||||||
|
#define BIT_INVC_CTLX_LO_SRC_TR_WIDTH (~(BIT_MASK_CTLX_LO_SRC_TR_WIDTH << BIT_SHIFT_CTLX_LO_SRC_TR_WIDTH))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_LO_DINC 7
|
||||||
|
#define BIT_MASK_CTLX_LO_DINC 0x3
|
||||||
|
#define BIT_CTLX_LO_DINC(x)(((x) & BIT_MASK_CTLX_LO_DINC) << BIT_SHIFT_CTLX_LO_DINC)
|
||||||
|
#define BIT_INVC_CTLX_LO_DINC (~(BIT_MASK_CTLX_LO_DINC << BIT_SHIFT_CTLX_LO_DINC))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_LO_SINC 9
|
||||||
|
#define BIT_MASK_CTLX_LO_SINC 0x3
|
||||||
|
#define BIT_CTLX_LO_SINC(x)(((x) & BIT_MASK_CTLX_LO_SINC) << BIT_SHIFT_CTLX_LO_SINC)
|
||||||
|
#define BIT_INVC_CTLX_LO_SINC (~(BIT_MASK_CTLX_LO_SINC << BIT_SHIFT_CTLX_LO_SINC))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_LO_DEST_MSIZE 11
|
||||||
|
#define BIT_MASK_CTLX_LO_DEST_MSIZE 0x7
|
||||||
|
#define BIT_CTLX_LO_DEST_MSIZE(x)(((x) & BIT_MASK_CTLX_LO_DEST_MSIZE) << BIT_SHIFT_CTLX_LO_DEST_MSIZE)
|
||||||
|
#define BIT_INVC_CTLX_LO_DEST_MSIZE (~(BIT_MASK_CTLX_LO_DEST_MSIZE << BIT_SHIFT_CTLX_LO_DEST_MSIZE))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_LO_SRC_MSIZE 14
|
||||||
|
#define BIT_MASK_CTLX_LO_SRC_MSIZE 0x7
|
||||||
|
#define BIT_CTLX_LO_SRC_MSIZE(x)(((x) & BIT_MASK_CTLX_LO_SRC_MSIZE) << BIT_SHIFT_CTLX_LO_SRC_MSIZE)
|
||||||
|
#define BIT_INVC_CTLX_LO_SRC_MSIZE (~(BIT_MASK_CTLX_LO_SRC_MSIZE << BIT_SHIFT_CTLX_LO_SRC_MSIZE))
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_LO_SRC_GATHER_EN 17
|
||||||
|
#define BIT_MASK_CTLX_LO_SRC_GATHER_EN 0x1
|
||||||
|
#define BIT_CTLX_LO_SRC_GATHER_EN(x)(((x) & BIT_MASK_CTLX_LO_SRC_GATHER_EN) << BIT_SHIFT_CTLX_LO_SRC_GATHER_EN)
|
||||||
|
#define BIT_INVC_CTLX_LO_SRC_GATHER_EN (~(BIT_MASK_CTLX_LO_SRC_GATHER_EN << BIT_SHIFT_CTLX_LO_SRC_GATHER_EN))
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_LO_DST_SCATTER_EN 18
|
||||||
|
#define BIT_MASK_CTLX_LO_DST_SCATTER_EN 0x1
|
||||||
|
#define BIT_CTLX_LO_DST_SCATTER_EN(x)(((x) & BIT_MASK_CTLX_LO_DST_SCATTER_EN) << BIT_SHIFT_CTLX_LO_DST_SCATTER_EN)
|
||||||
|
#define BIT_INVC_CTLX_LO_DST_SCATTER_EN (~(BIT_MASK_CTLX_LO_DST_SCATTER_EN << BIT_SHIFT_CTLX_LO_DST_SCATTER_EN))
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_LO_TT_FC 20
|
||||||
|
#define BIT_MASK_CTLX_LO_TT_FC 0x7
|
||||||
|
#define BIT_CTLX_LO_TT_FC(x)(((x) & BIT_MASK_CTLX_LO_TT_FC) << BIT_SHIFT_CTLX_LO_TT_FC)
|
||||||
|
#define BIT_INVC_CTLX_LO_TT_FC (~(BIT_MASK_CTLX_LO_TT_FC << BIT_SHIFT_CTLX_LO_TT_FC))
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_LO_DMS 23
|
||||||
|
#define BIT_MASK_CTLX_LO_DMS 0x3
|
||||||
|
#define BIT_CTLX_LO_DMS(x)(((x) & BIT_MASK_CTLX_LO_DMS) << BIT_MASK_CTLX_LO_DMS)
|
||||||
|
#define BIT_INVC_CTLX_LO_DMS (~(BIT_MASK_CTLX_LO_DMS << BIT_SHIFT_CTLX_LO_DMS))
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_LO_SMS 25
|
||||||
|
#define BIT_MASK_CTLX_LO_SMS 0x3
|
||||||
|
#define BIT_CTLX_LO_SMS(x)(((x) & BIT_MASK_CTLX_LO_SMS) << BIT_SHIFT_CTLX_LO_SMS)
|
||||||
|
#define BIT_INVC_CTLX_LO_SMS (~(BIT_MASK_CTLX_LO_SMS << BIT_SHIFT_CTLX_LO_SMS))
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_LO_LLP_DST_EN 27
|
||||||
|
#define BIT_MASK_CTLX_LO_LLP_DST_EN 0x1
|
||||||
|
#define BIT_CTLX_LO_LLP_DST_EN(x)(((x) & BIT_MASK_CTLX_LO_LLP_DST_EN) << BIT_SHIFT_CTLX_LO_LLP_DST_EN)
|
||||||
|
#define BIT_INVC_CTLX_LO_LLP_DST_EN (~(BIT_MASK_CTLX_LO_LLP_DST_EN << BIT_SHIFT_CTLX_LO_LLP_DST_EN))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_LO_LLP_SRC_EN 28
|
||||||
|
#define BIT_MASK_CTLX_LO_LLP_SRC_EN 0x1
|
||||||
|
#define BIT_CTLX_LO_LLP_SRC_EN(x)(((x) & BIT_MASK_CTLX_LO_LLP_SRC_EN) << BIT_SHIFT_CTLX_LO_LLP_SRC_EN)
|
||||||
|
#define BIT_INVC_CTLX_LO_LLP_SRC_EN (~(BIT_MASK_CTLX_LO_LLP_SRC_EN << BIT_SHIFT_CTLX_LO_LLP_SRC_EN))
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_UP_BLOCK_BS 0
|
||||||
|
#define BIT_MASK_CTLX_UP_BLOCK_BS 0xFFF
|
||||||
|
#define BIT_CTLX_UP_BLOCK_BS(x)(((x) & BIT_MASK_CTLX_UP_BLOCK_BS) << BIT_SHIFT_CTLX_UP_BLOCK_BS)
|
||||||
|
#define BIT_INVC_CTLX_UP_BLOCK_BS (~(BIT_MASK_CTLX_UP_BLOCK_BS << BIT_SHIFT_CTLX_UP_BLOCK_BS))
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_UP_DONE 12
|
||||||
|
#define BIT_MASK_CTLX_UP_DONE 0x1
|
||||||
|
#define BIT_CTLX_UP_DONE(x)(((x) & BIT_MASK_CTLX_UP_DONE) << BIT_SHIFT_CTLX_UP_DONE)
|
||||||
|
#define BIT_INVC_CTLX_UP_DONE (~(BIT_MASK_CTLX_UP_DONE << BIT_SHIFT_CTLX_UP_DONE))
|
||||||
|
|
||||||
|
|
||||||
|
//3 CFG Register Bit Control
|
||||||
|
#define BIT_SHIFT_CFGX_LO_CH_PRIOR 5
|
||||||
|
#define BIT_MASK_CFGX_LO_CH_PRIOR 0x7
|
||||||
|
#define BIT_CFGX_LO_CH_PRIOR(x)(((x) & BIT_MASK_CFGX_LO_CH_PRIOR) << BIT_SHIFT_CFGX_LO_CH_PRIOR)
|
||||||
|
#define BIT_INVC_CFGX_LO_CH_PRIOR (~(BIT_MASK_CFGX_LO_CH_PRIOR << BIT_SHIFT_CFGX_LO_CH_PRIOR))
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_LO_CH_SUSP 8
|
||||||
|
#define BIT_MASK_CFGX_LO_CH_SUSP 0x1
|
||||||
|
#define BIT_CFGX_LO_CH_SUSP(x)(((x) & BIT_MASK_CFGX_LO_CH_SUSP) << BIT_SHIFT_CFGX_LO_CH_SUSP)
|
||||||
|
#define BIT_INVC_CFGX_LO_CH_SUSP (~(BIT_MASK_CFGX_LO_CH_SUSP << BIT_SHIFT_CFGX_LO_CH_SUSP))
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_LO_FIFO_EMPTY 9
|
||||||
|
#define BIT_MASK_CFGX_LO_FIFO_EMPTY 0x1
|
||||||
|
#define BIT_CFGX_LO_FIFO_EMPTY(x)(((x) & BIT_MASK_CFGX_LO_FIFO_EMPTY) << BIT_SHIFT_CFGX_LO_FIFO_EMPTY)
|
||||||
|
#define BIT_INVC_CFGX_LO_FIFO_EMPTY (~(BIT_MASK_CFGX_LO_FIFO_EMPTY << BIT_SHIFT_CFGX_LO_FIFO_EMPTY))
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_LO_HS_SEL_DST 10
|
||||||
|
#define BIT_MASK_CFGX_LO_HS_SEL_DST 0x1
|
||||||
|
#define BIT_CFGX_LO_HS_SEL_DST(x)(((x) & BIT_MASK_CFGX_LO_HS_SEL_DST) << BIT_SHIFT_CFGX_LO_HS_SEL_DST)
|
||||||
|
#define BIT_INVC_CFGX_LO_HS_SEL_DST (~(BIT_MASK_CFGX_LO_HS_SEL_DST << BIT_SHIFT_CFGX_LO_HS_SEL_DST))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_LO_HS_SEL_SRC 11
|
||||||
|
#define BIT_MASK_CFGX_LO_HS_SEL_SRC 0x1
|
||||||
|
#define BIT_CFGX_LO_HS_SEL_SRC(x)(((x) & BIT_MASK_CFGX_LO_HS_SEL_SRC) << BIT_SHIFT_CFGX_LO_HS_SEL_SRC)
|
||||||
|
#define BIT_INVC_CFGX_LO_HS_SEL_SRC (~(BIT_MASK_CFGX_LO_HS_SEL_SRC << BIT_SHIFT_CFGX_LO_HS_SEL_SRC))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_LO_LOCK_CH_L 12
|
||||||
|
#define BIT_MASK_CFGX_LO_LOCK_CH_L 0x3
|
||||||
|
#define BIT_CFGX_LO_LOCK_CH_L(x)(((x) & BIT_MASK_CFGX_LO_LOCK_CH_L) << BIT_SHIFT_CFGX_LO_LOCK_CH_L)
|
||||||
|
#define BIT_INVC_CFGX_LO_LOCK_CH_L (~(BIT_MASK_CFGX_LO_LOCK_CH_L << BIT_SHIFT_CFGX_LO_LOCK_CH_L))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_LO_LOCK_B_L 14
|
||||||
|
#define BIT_MASK_CFGX_LO_LOCK_B_L 0x3
|
||||||
|
#define BIT_CFGX_LO_LOCK_B_L(x)(((x) & BIT_MASK_CFGX_LO_LOCK_B_L) << BIT_SHIFT_CFGX_LO_LOCK_B_L)
|
||||||
|
#define BIT_INVC_CFGX_LO_LOCK_B_L (~(BIT_MASK_CFGX_LO_LOCK_B_L << BIT_SHIFT_CFGX_LO_LOCK_B_L))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_LO_LOCK_CH 16
|
||||||
|
#define BIT_MASK_CFGX_LO_LOCK_CH 0x1
|
||||||
|
#define BIT_CFGX_LO_LOCK_CH(x)(((x) & BIT_MASK_CFGX_LO_LOCK_CH) << BIT_SHIFT_CFGX_LO_LOCK_CH)
|
||||||
|
#define BIT_INVC_CFGX_LO_LOCK_CH (~(BIT_MASK_CFGX_LO_LOCK_CH << BIT_SHIFT_CFGX_LO_LOCK_CH))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_LO_LOCK_B 17
|
||||||
|
#define BIT_MASK_CFGX_LO_LOCK_B 0x1
|
||||||
|
#define BIT_CFGX_LO_LOCK_B(x)(((x) & BIT_MASK_CFGX_LO_LOCK_B) << BIT_SHIFT_CFGX_LO_LOCK_B)
|
||||||
|
#define BIT_INVC_CFGX_LO_LOCK_B (~(BIT_MASK_CFGX_LO_LOCK_B << BIT_SHIFT_CFGX_LO_LOCK_B))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_LO_DST_HS_POL 18
|
||||||
|
#define BIT_MASK_CFGX_LO_DST_HS_POL 0x1
|
||||||
|
#define BIT_CFGX_LO_DST_HS_POL(x)(((x) & BIT_MASK_CFGX_LO_DST_HS_POL) << BIT_SHIFT_CFGX_LO_DST_HS_POL)
|
||||||
|
#define BIT_INVC_CFGX_LO_DST_HS_POL (~(BIT_MASK_CFGX_LO_DST_HS_POL << BIT_SHIFT_CFGX_LO_DST_HS_POL))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_LO_SRC_HS_POL 19
|
||||||
|
#define BIT_MASK_CFGX_LO_SRC_HS_POL 0x1
|
||||||
|
#define BIT_CFGX_LO_SRC_HS_POL(x)(((x) & BIT_MASK_CFGX_LO_SRC_HS_POL) << BIT_SHIFT_CFGX_LO_SRC_HS_POL)
|
||||||
|
#define BIT_INVC_CFGX_LO_SRC_HS_POL (~(BIT_MASK_CFGX_LO_SRC_HS_POL << BIT_SHIFT_CFGX_LO_SRC_HS_POL))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_LO_MAX_ABRST 20
|
||||||
|
#define BIT_MASK_CFGX_LO_MAX_ABRST 0x3FF
|
||||||
|
#define BIT_CFGX_LO_MAX_ABRST(x)(((x) & BIT_MASK_CFGX_LO_MAX_ABRST) << BIT_SHIFT_CFGX_LO_MAX_ABRST)
|
||||||
|
#define BIT_INVC_CFGX_LO_MAX_ABRST (~(BIT_MASK_CFGX_LO_MAX_ABRST << BIT_SHIFT_CFGX_LO_MAX_ABRST))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_LO_RELOAD_SRC 30
|
||||||
|
#define BIT_MASK_CFGX_LO_RELOAD_SRC 0x1
|
||||||
|
#define BIT_CFGX_LO_RELOAD_SRC(x)(((x) & BIT_MASK_CFGX_LO_RELOAD_SRC) << BIT_SHIFT_CFGX_LO_RELOAD_SRC)
|
||||||
|
#define BIT_INVC_CFGX_LO_RELOAD_SRC (~(BIT_MASK_CFGX_LO_RELOAD_SRC << BIT_SHIFT_CFGX_LO_RELOAD_SRC))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_LO_RELOAD_DST 31
|
||||||
|
#define BIT_MASK_CFGX_LO_RELOAD_DST 0x1
|
||||||
|
#define BIT_CFGX_LO_RELOAD_DST(x)(((x) & BIT_MASK_CFGX_LO_RELOAD_DST) << BIT_SHIFT_CFGX_LO_RELOAD_DST)
|
||||||
|
#define BIT_INVC_CFGX_LO_RELOAD_DST (~(BIT_MASK_CFGX_LO_RELOAD_DST << BIT_SHIFT_CFGX_LO_RELOAD_DST))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_UP_FCMODE 0
|
||||||
|
#define BIT_MASK_CFGX_UP_FCMODE 0x1
|
||||||
|
#define BIT_CFGX_UP_FCMODE(x)(((x) & BIT_MASK_CFGX_UP_FCMODE) << BIT_SHIFT_CFGX_UP_FCMODE)
|
||||||
|
#define BIT_INVC_CFGX_UP_FCMODE (~(BIT_MASK_CFGX_UP_FCMODE << BIT_SHIFT_CFGX_UP_FCMODE))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_UP_FIFO_MODE 1
|
||||||
|
#define BIT_MASK_CFGX_UP_FIFO_MODE 0x1
|
||||||
|
#define BIT_CFGX_UP_FIFO_MODE(x)(((x) & BIT_MASK_CFGX_UP_FIFO_MODE) << BIT_SHIFT_CFGX_UP_FIFO_MODE)
|
||||||
|
#define BIT_INVC_CFGX_UP_FIFO_MODE (~(BIT_MASK_CFGX_UP_FIFO_MODE << BIT_SHIFT_CFGX_UP_FIFO_MODE))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_UP_PROTCTL 2
|
||||||
|
#define BIT_MASK_CFGX_UP_PROTCTL 0x7
|
||||||
|
#define BIT_CFGX_UP_PROTCTL(x)(((x) & BIT_MASK_CFGX_UP_PROTCTL) << BIT_SHIFT_CFGX_UP_PROTCTL)
|
||||||
|
#define BIT_INVC_CFGX_UP_PROTCTL (~(BIT_MASK_CFGX_UP_PROTCTL << BIT_SHIFT_CFGX_UP_PROTCTL))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_UP_DS_UPD_EN 5
|
||||||
|
#define BIT_MASK_CFGX_UP_DS_UPD_EN 0x1
|
||||||
|
#define BIT_CFGX_UP_DS_UPD_EN(x)(((x) & BIT_MASK_CFGX_UP_DS_UPD_EN) << BIT_SHIFT_CFGX_UP_DS_UPD_EN)
|
||||||
|
#define BIT_INVC_CFGX_UP_DS_UPD_EN (~(BIT_MASK_CFGX_UP_DS_UPD_EN << BIT_SHIFT_CFGX_UP_DS_UPD_EN))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_UP_SS_UPD_EN 6
|
||||||
|
#define BIT_MASK_CFGX_UP_SS_UPD_EN 0x1
|
||||||
|
#define BIT_CFGX_UP_SS_UPD_EN(x)(((x) & BIT_MASK_CFGX_UP_SS_UPD_EN) << BIT_SHIFT_CFGX_UP_SS_UPD_EN)
|
||||||
|
#define BIT_INVC_CFGX_UP_SS_UPD_EN (~(BIT_MASK_CFGX_UP_SS_UPD_EN << BIT_SHIFT_CFGX_UP_SS_UPD_EN))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_UP_SRC_PER 7
|
||||||
|
#define BIT_MASK_CFGX_UP_SRC_PER 0xF
|
||||||
|
#define BIT_CFGX_UP_SRC_PER(x)(((x) & BIT_MASK_CFGX_UP_SRC_PER) << BIT_SHIFT_CFGX_UP_SRC_PER)
|
||||||
|
#define BIT_INVC_CFGX_UP_SRC_PER (~(BIT_MASK_CFGX_UP_SRC_PER << BIT_SHIFT_CFGX_UP_SRC_PER))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CFGX_UP_DEST_PER 11
|
||||||
|
#define BIT_MASK_CFGX_UP_DEST_PER 0xF
|
||||||
|
#define BIT_CFGX_UP_DEST_PER(x)(((x) & BIT_MASK_CFGX_UP_DEST_PER) << BIT_SHIFT_CFGX_UP_DEST_PER)
|
||||||
|
#define BIT_INVC_CFGX_UP_DEST_PER (~(BIT_MASK_CFGX_UP_DEST_PER << BIT_SHIFT_CFGX_UP_DEST_PER))
|
||||||
|
|
||||||
|
typedef enum _GDMA_CHANNEL_NUM_ {
|
||||||
|
GdmaNoCh = 0x0000,
|
||||||
|
GdmaCh0 = 0x0101,
|
||||||
|
GdmaCh1 = 0x0202,
|
||||||
|
GdmaCh2 = 0x0404,
|
||||||
|
GdmaCh3 = 0x0808,
|
||||||
|
GdmaCh4 = 0x1010,
|
||||||
|
GdmaCh5 = 0x2020,
|
||||||
|
GdmaCh6 = 0x4040,
|
||||||
|
GdmaCh7 = 0x8080,
|
||||||
|
GdmaAllCh = 0xffff
|
||||||
|
}GDMA_CHANNEL_NUM, *PGDMA_CHANNEL_NUM;
|
||||||
|
|
||||||
|
|
||||||
|
//3 CTL register struct
|
||||||
|
|
||||||
|
typedef enum _GDMA_CTL_TT_FC_TYPE_ {
|
||||||
|
TTFCMemToMem = 0x00,
|
||||||
|
TTFCMemToPeri = 0x01,
|
||||||
|
TTFCPeriToMem = 0x02
|
||||||
|
}GDMA_CTL_TT_FC_TYPE, *PGDMA_CTL_TT_FC_TYPE;
|
||||||
|
|
||||||
|
//Max type = Bus Width
|
||||||
|
typedef enum _GDMA_CTL_TR_WIDTH_ {
|
||||||
|
TrWidthOneByte = 0x00,
|
||||||
|
TrWidthTwoBytes = 0x01,
|
||||||
|
TrWidthFourBytes = 0x02
|
||||||
|
}GDMA_CTL_TR_WIDTH, *PGDMA_CTL_TR_WIDTH;
|
||||||
|
|
||||||
|
typedef enum _GDMA_CTL_MSIZE_ {
|
||||||
|
MsizeOne = 0x00,
|
||||||
|
MsizeFour = 0x01,
|
||||||
|
MsizeEight = 0x02
|
||||||
|
}GDMA_CTL_MSIZE, *PGDMA_CTL_MSIZE;
|
||||||
|
|
||||||
|
typedef enum _GDMA_INC_TYPE_ {
|
||||||
|
IncType = 0x00,
|
||||||
|
DecType = 0x01,
|
||||||
|
NoChange = 0x02
|
||||||
|
}GDMA_INC_TYPE, *PGDMA_INC_TYPE;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _GDMA_CTL_REG_ {
|
||||||
|
GDMA_CTL_TT_FC_TYPE TtFc;
|
||||||
|
GDMA_CTL_TR_WIDTH DstTrWidth;
|
||||||
|
GDMA_CTL_TR_WIDTH SrcTrWidth;
|
||||||
|
GDMA_INC_TYPE Dinc;
|
||||||
|
GDMA_INC_TYPE Sinc;
|
||||||
|
GDMA_CTL_MSIZE DestMsize;
|
||||||
|
GDMA_CTL_MSIZE SrcMsize;
|
||||||
|
|
||||||
|
u8 IntEn :1; // Bit 0
|
||||||
|
u8 SrcGatherEn :1; // Bit 1
|
||||||
|
u8 DstScatterEn :1; // Bit 2
|
||||||
|
u8 LlpDstEn :1; // Bit 3
|
||||||
|
u8 LlpSrcEn :1; // Bit 4
|
||||||
|
u8 Done :1; // Bit 5
|
||||||
|
u8 Rsvd6To7 :2; //Bit 6 -7
|
||||||
|
u16 BlockSize;
|
||||||
|
|
||||||
|
}GDMA_CTL_REG, *PGDMA_CTL_REG;
|
||||||
|
|
||||||
|
|
||||||
|
//3 CFG Register Structure
|
||||||
|
|
||||||
|
typedef enum _GDMA_CH_PRIORITY_ {
|
||||||
|
Prior0 = 0,
|
||||||
|
Prior1 = 1,
|
||||||
|
Prior2 = 2,
|
||||||
|
Prior3 = 3,
|
||||||
|
Prior4 = 4,
|
||||||
|
Prior5 = 5,
|
||||||
|
Prior6 = 6,
|
||||||
|
Prior7 = 7
|
||||||
|
}GDMA_CH_PRIORITY, *PGDMA_CH_PRIORITY;
|
||||||
|
|
||||||
|
typedef enum _GDMA_LOCK_LEVEL_ {
|
||||||
|
OverComplDmaTransfer = 0x00,
|
||||||
|
OverComplDmaBlockTransfer = 0x01,
|
||||||
|
OverComplDmaTransation = 0x02
|
||||||
|
}GDMA_LOCK_LEVEL, *PGDMA_LOCK_LEVEL;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _GDMA_CFG_REG_ {
|
||||||
|
GDMA_CH_PRIORITY ChPrior;
|
||||||
|
GDMA_LOCK_LEVEL LockBL;
|
||||||
|
GDMA_LOCK_LEVEL LockChL;
|
||||||
|
u16 MaxAbrst;
|
||||||
|
u8 SrcPer;
|
||||||
|
u8 DestPer;
|
||||||
|
u16 ChSusp :1; //Bit 0
|
||||||
|
u16 FifoEmpty :1; //Bit 1
|
||||||
|
u16 HsSelDst :1; //Bit 2
|
||||||
|
u16 HsSelSrc :1; //Bit 3
|
||||||
|
u16 LockCh :1; //Bit 4
|
||||||
|
u16 LockB :1; //Bit 5
|
||||||
|
u16 DstHsPol :1; //Bit 6
|
||||||
|
u16 SrcHsPol :1; //Bit 7
|
||||||
|
u16 ReloadSrc :1; //Bit 8
|
||||||
|
u16 ReloadDst :1; //Bit 9
|
||||||
|
u16 FifoMode :1; //Bit 10
|
||||||
|
u16 DsUpdEn :1; //Bit 11
|
||||||
|
u16 SsUpdEn :1; //Bit 12
|
||||||
|
u16 Rsvd13To15 :3;
|
||||||
|
}GDMA_CFG_REG, *PGDMA_CFG_REG;
|
||||||
|
|
||||||
|
typedef enum _GDMA_ISR_TYPE_ {
|
||||||
|
TransferType = 0x1,
|
||||||
|
BlockType = 0x2,
|
||||||
|
SrcTransferType = 0x4,
|
||||||
|
DstTransferType = 0x8,
|
||||||
|
ErrType = 0x10
|
||||||
|
}GDMA_ISR_TYPE, *PGDMA_ISR_TYPE;
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalGdmaOnOffRtl8195a (
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
HalGdamChInitRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
HalGdmaChSetingRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
HalGdmaChBlockSetingRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalGdmaChDisRtl8195a (
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalGdmaChEnRtl8195a (
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalGdmaChIsrEnAndDisRtl8195a (
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
u8
|
||||||
|
HalGdmaChIsrCleanRtl8195a (
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalGdmaChCleanAutoSrcRtl8195a (
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalGdmaChCleanAutoDstRtl8195a (
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
u32
|
||||||
|
HalGdmaQueryDArRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
u32
|
||||||
|
HalGdmaQuerySArRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
HalGdmaQueryChEnRtl8195a (
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
#ifdef CONFIG_CHIP_E_CUT
|
||||||
|
_LONG_CALL_ BOOL
|
||||||
|
HalGdmaChBlockSetingRtl8195a_V04(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ u32
|
||||||
|
HalGdmaQueryDArRtl8195a_V04(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ u32
|
||||||
|
HalGdmaQuerySArRtl8195a_V04(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ BOOL
|
||||||
|
HalGdmaQueryChEnRtl8195a_V04 (
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif // #ifdef CONFIG_CHIP_E_CUT
|
||||||
|
|
||||||
|
#endif
|
352
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_gpio.h
Normal file
352
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_gpio.h
Normal file
|
@ -0,0 +1,352 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _RTL8195A_GPIO_H_
|
||||||
|
#define _RTL8195A_GPIO_H_
|
||||||
|
|
||||||
|
#include "hal_api.h"
|
||||||
|
#include "hal_gpio.h"
|
||||||
|
|
||||||
|
#define GPIO_PORTA_DR 0x00 // data register
|
||||||
|
#define GPIO_PORTA_DDR 0x04 // data direction
|
||||||
|
#define GPIO_PORTA_CTRL 0x08 // data source control, we should keep it as default: data source from software
|
||||||
|
|
||||||
|
#define GPIO_PORTB_DR 0x0c // data register
|
||||||
|
#define GPIO_PORTB_DDR 0x10 // data direction
|
||||||
|
#define GPIO_PORTB_CTRL 0x14 // data source control, we should keep it as default: data source from software
|
||||||
|
|
||||||
|
#define GPIO_PORTC_DR 0x18 // data register
|
||||||
|
#define GPIO_PORTC_DDR 0x1c // data direction
|
||||||
|
#define GPIO_PORTC_CTRL 0x20 // data source control, we should keep it as default: data source from software
|
||||||
|
|
||||||
|
//1 Only the PORTA can be configured to generate interrupts
|
||||||
|
#define GPIO_INT_EN 0x30 // Interrupt enable register
|
||||||
|
#define GPIO_INT_MASK 0x34 // Interrupt mask
|
||||||
|
#define GPIO_INT_TYPE 0x38 // Interrupt type(level/edge) register
|
||||||
|
#define GPIO_INT_POLARITY 0x3C // Interrupt polarity(Active low/high) register
|
||||||
|
#define GPIO_INT_STATUS 0x40 // Interrupt status
|
||||||
|
#define GPIO_INT_RAWSTATUS 0x44 // Interrupt status without mask
|
||||||
|
#define GPIO_DEBOUNCE 0x48 // Interrupt signal debounce
|
||||||
|
#define GPIO_PORTA_EOI 0x4c // Clear interrupt
|
||||||
|
|
||||||
|
#define GPIO_EXT_PORTA 0x50 // GPIO IN read or OUT read back
|
||||||
|
#define GPIO_EXT_PORTB 0x54 // GPIO IN read or OUT read back
|
||||||
|
#define GPIO_EXT_PORTC 0x58 // GPIO IN read or OUT read back
|
||||||
|
|
||||||
|
#define GPIO_INT_SYNC 0x60 // Is level-sensitive interrupt being sync sith PCLK
|
||||||
|
|
||||||
|
enum {
|
||||||
|
HAL_GPIO_HIGHZ = 0,
|
||||||
|
HAL_GPIO_PULL_LOW = 1,
|
||||||
|
HAL_GPIO_PULL_HIGH = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
//======================================================
|
||||||
|
// ROM Function prototype
|
||||||
|
extern PHAL_GPIO_ADAPTER _pHAL_Gpio_Adapter;
|
||||||
|
|
||||||
|
static __inline HAL_Status
|
||||||
|
GPIO_Lock (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HAL_Status Status;
|
||||||
|
|
||||||
|
if (_pHAL_Gpio_Adapter->EnterCritical) {
|
||||||
|
_pHAL_Gpio_Adapter->EnterCritical();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_pHAL_Gpio_Adapter->Locked) {
|
||||||
|
Status = HAL_BUSY;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_pHAL_Gpio_Adapter->Locked = 1;
|
||||||
|
Status = HAL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_pHAL_Gpio_Adapter->ExitCritical) {
|
||||||
|
_pHAL_Gpio_Adapter->ExitCritical();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static __inline VOID
|
||||||
|
GPIO_UnLock (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (_pHAL_Gpio_Adapter->EnterCritical) {
|
||||||
|
_pHAL_Gpio_Adapter->EnterCritical();
|
||||||
|
}
|
||||||
|
|
||||||
|
_pHAL_Gpio_Adapter->Locked = 0;
|
||||||
|
|
||||||
|
if (_pHAL_Gpio_Adapter->ExitCritical) {
|
||||||
|
_pHAL_Gpio_Adapter->ExitCritical();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_LONG_CALL_ extern u32
|
||||||
|
HAL_GPIO_IrqHandler_8195a(
|
||||||
|
IN VOID *pData
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ extern u32
|
||||||
|
HAL_GPIO_MbedIrqHandler_8195a(
|
||||||
|
IN VOID *pData
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HAL_GPIO_IntCtrl_8195a(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin,
|
||||||
|
u32 En
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HAL_GPIO_Init_8195a(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HAL_GPIO_DeInit_8195a(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_GPIO_PIN_STATE
|
||||||
|
HAL_GPIO_ReadPin_8195a(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HAL_GPIO_WritePin_8195a(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin,
|
||||||
|
HAL_GPIO_PIN_STATE Pin_State
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HAL_GPIO_RegIrq_8195a(
|
||||||
|
IN PIRQ_HANDLE pIrqHandle
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HAL_GPIO_UnRegIrq_8195a(
|
||||||
|
IN PIRQ_HANDLE pIrqHandle
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HAL_GPIO_UserRegIrq_8195a(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin,
|
||||||
|
VOID *IrqHandler,
|
||||||
|
VOID *IrqData
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HAL_GPIO_UserUnRegIrq_8195a(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HAL_GPIO_MaskIrq_8195a(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HAL_GPIO_UnMaskIrq_8195a(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HAL_GPIO_IntDebounce_8195a(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin,
|
||||||
|
u8 Enable
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ u32
|
||||||
|
HAL_GPIO_GetIPPinName_8195a(
|
||||||
|
u32 chip_pin
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HAL_GPIO_PullCtrl_8195a(
|
||||||
|
u32 chip_pin,
|
||||||
|
u8 pull_type
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ u32
|
||||||
|
GPIO_GetChipPinName_8195a(
|
||||||
|
u32 port,
|
||||||
|
u32 pin
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ VOID
|
||||||
|
GPIO_PullCtrl_8195a(
|
||||||
|
u32 chip_pin,
|
||||||
|
u8 pull_type
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ VOID
|
||||||
|
GPIO_Int_SetType_8195a(
|
||||||
|
u8 pin_num,
|
||||||
|
u8 int_mode
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status HAL_GPIO_IntCtrl_8195aV02(HAL_GPIO_PIN *GPIO_Pin, u32 En);
|
||||||
|
_LONG_CALL_ u32 GPIO_Int_Clear_8195aV02(u32 irq_clr);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
HAL_GPIO_ClearISR_8195a(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/********** HAL In-Line Functions **********/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief De-Initializes a GPIO Pin, reset it as default setting.
|
||||||
|
*
|
||||||
|
* @param GPIO_Pin: The data structer which contains the parameters for the GPIO Pin.
|
||||||
|
*
|
||||||
|
* @retval HAL_Status
|
||||||
|
*/
|
||||||
|
static __inline VOID
|
||||||
|
HAL_GPIO_DeInit(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HAL_GPIO_DeInit_8195a(GPIO_Pin);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reads the specified input port pin.
|
||||||
|
*
|
||||||
|
* @param GPIO_Pin: The data structer which contains the parameters for the GPIO Pin.
|
||||||
|
*
|
||||||
|
* @retval The input port pin current status(High or Low).
|
||||||
|
*/
|
||||||
|
static __inline s32
|
||||||
|
HAL_GPIO_ReadPin(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return (s32)HAL_GPIO_ReadPin_8195a(GPIO_Pin);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Write the specified output port pin.
|
||||||
|
*
|
||||||
|
* @param GPIO_Pin: The data structer which contains the parameters for the GPIO Pin.
|
||||||
|
*
|
||||||
|
* @param Pin_State: The state going to be set to the assigned GPIO pin.
|
||||||
|
*
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
static __inline VOID
|
||||||
|
HAL_GPIO_WritePin(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin,
|
||||||
|
u32 Value
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HAL_GPIO_WritePin_8195a(GPIO_Pin, (HAL_GPIO_PIN_STATE)Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief To register a user interrupt handler for a specified pin
|
||||||
|
*
|
||||||
|
* @param GPIO_Pin: The data structer which contains the parameters for the GPIO Pin.
|
||||||
|
*
|
||||||
|
* @param IrqHandler: The IRQ handler to be assigned to the specified pin
|
||||||
|
*
|
||||||
|
* @param IrqData: The pointer will be pass the the IRQ handler
|
||||||
|
*
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
static __inline VOID
|
||||||
|
HAL_GPIO_UserRegIrq(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin,
|
||||||
|
VOID *IrqHandler,
|
||||||
|
VOID *IrqData
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HAL_GPIO_UserRegIrq_8195a(GPIO_Pin, IrqHandler, IrqData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief To un-register a user interrupt handler for a specified pin
|
||||||
|
*
|
||||||
|
* @param GPIO_Pin: The data structer which contains the parameters for the GPIO Pin.
|
||||||
|
*
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
static __inline VOID
|
||||||
|
HAL_GPIO_UserUnRegIrq(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HAL_GPIO_UserUnRegIrq_8195a(GPIO_Pin);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable/Disable GPIO interrupt
|
||||||
|
*
|
||||||
|
* @param GPIO_Pin: The data structer which contains the parameters for the GPIO Pin initialization.
|
||||||
|
*
|
||||||
|
* @param En: Enable (1) or Disable (0)
|
||||||
|
*
|
||||||
|
* @retval HAL_Status
|
||||||
|
*/
|
||||||
|
static __inline VOID
|
||||||
|
HAL_GPIO_IntCtrl(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin,
|
||||||
|
u32 En
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HAL_GPIO_IntCtrl_8195a(GPIO_Pin, En);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Mask the interrupt of a specified pin
|
||||||
|
*
|
||||||
|
* @param GPIO_Pin: The data structer which contains the parameters for the GPIO Pin.
|
||||||
|
*
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
static __inline VOID
|
||||||
|
HAL_GPIO_MaskIrq(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HAL_GPIO_MaskIrq_8195a(GPIO_Pin);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief UnMask the interrupt of a specified pin
|
||||||
|
*
|
||||||
|
* @param GPIO_Pin: The data structer which contains the parameters for the GPIO Pin.
|
||||||
|
*
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
static __inline VOID
|
||||||
|
HAL_GPIO_UnMaskIrq(
|
||||||
|
HAL_GPIO_PIN *GPIO_Pin
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HAL_GPIO_ClearISR_8195a(GPIO_Pin);
|
||||||
|
HAL_GPIO_UnMaskIrq_8195a(GPIO_Pin);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // end of "#define _RTL8195A_GPIO_H_"
|
||||||
|
|
851
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_i2c.h
Normal file
851
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_i2c.h
Normal file
|
@ -0,0 +1,851 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _RTL8195A_I2C_H_
|
||||||
|
#define _RTL8195A_I2C_H_
|
||||||
|
|
||||||
|
#include "hal_api.h"
|
||||||
|
|
||||||
|
//================ Register Bit Field ==================
|
||||||
|
//2 REG_DW_I2C_IC_CON
|
||||||
|
#define BIT_IC_CON_IC_SLAVE_DISABLE BIT(6)
|
||||||
|
#define BIT_SHIFT_IC_CON_IC_SLAVE_DISABLE 6
|
||||||
|
#define BIT_MASK_IC_CON_IC_SLAVE_DISABLE 0x1
|
||||||
|
#define BIT_CTRL_IC_CON_IC_SLAVE_DISABLE(x) (((x) & BIT_MASK_IC_CON_IC_SLAVE_DISABLE) << BIT_SHIFT_IC_CON_IC_SLAVE_DISABLE)
|
||||||
|
|
||||||
|
#define BIT_IC_CON_IC_RESTART_EN BIT(5)
|
||||||
|
#define BIT_SHIFT_IC_CON_IC_RESTART_EN 5
|
||||||
|
#define BIT_MASK_IC_CON_IC_RESTART_EN 0x1
|
||||||
|
#define BIT_CTRL_IC_CON_IC_RESTART_EN(x) (((x) & BIT_MASK_IC_CON_IC_RESTART_EN) << BIT_SHIFT_IC_CON_IC_RESTART_EN)
|
||||||
|
|
||||||
|
#define BIT_IC_CON_IC_10BITADDR_MASTER BIT(4)
|
||||||
|
#define BIT_SHIFT_IC_CON_IC_10BITADDR_MASTER 4
|
||||||
|
#define BIT_MASK_IC_CON_IC_10BITADDR_MASTER 0x1
|
||||||
|
#define BIT_CTRL_IC_CON_IC_10BITADDR_MASTER(x) (((x) & BIT_MASK_IC_CON_IC_10BITADDR_MASTER) << BIT_SHIFT_IC_CON_IC_10BITADDR_MASTER)
|
||||||
|
|
||||||
|
#define BIT_IC_CON_IC_10BITADDR_SLAVE BIT(3)
|
||||||
|
#define BIT_SHIFT_IC_CON_IC_10BITADDR_SLAVE 3
|
||||||
|
#define BIT_MASK_IC_CON_IC_10BITADDR_SLAVE 0x1
|
||||||
|
#define BIT_CTRL_IC_CON_IC_10BITADDR_SLAVE(x) (((x) & BIT_MASK_IC_CON_IC_10BITADDR_SLAVE) << BIT_SHIFT_IC_CON_IC_10BITADDR_SLAVE)
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_CON_SPEED 1
|
||||||
|
#define BIT_MASK_IC_CON_SPEED 0x3
|
||||||
|
#define BIT_IC_CON_SPEED(x) (((x) & BIT_MASK_IC_CON_SPEED) << BIT_SHIFT_IC_CON_SPEED)
|
||||||
|
#define BIT_CTRL_IC_CON_SPEED(x) (((x) & BIT_MASK_IC_CON_SPEED) << BIT_SHIFT_IC_CON_SPEED)
|
||||||
|
#define BIT_GET_IC_CON_SPEED(x) (((x) >> BIT_SHIFT_IC_CON_SPEED) & BIT_MASK_IC_CON_SPEED)
|
||||||
|
|
||||||
|
#define BIT_IC_CON_MASTER_MODE BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_CON_MASTER_MODE 0
|
||||||
|
#define BIT_MASK_IC_CON_MASTER_MODE 0x1
|
||||||
|
#define BIT_CTRL_IC_CON_MASTER_MODE(x) (((x) & BIT_MASK_IC_CON_MASTER_MODE) << BIT_SHIFT_IC_CON_MASTER_MODE)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_TAR
|
||||||
|
#define BIT_IC_TAR_IC_10BITADDR_MASTER BIT(12)
|
||||||
|
#define BIT_SHIFT_IC_TAR_IC_10BITADDR_MASTER 12
|
||||||
|
#define BIT_MASK_IC_TAR_IC_10BITADDR_MASTER 0x1
|
||||||
|
#define BIT_CTRL_IC_TAR_IC_10BITADDR_MASTER(x) (((x) & BIT_MASK_IC_TAR_IC_10BITADDR_MASTER) << BIT_SHIFT_IC_TAR_IC_10BITADDR_MASTER)
|
||||||
|
|
||||||
|
#define BIT_IC_TAR_SPECIAL BIT(11)
|
||||||
|
#define BIT_SHIFT_IC_TAR_SPECIAL 11
|
||||||
|
#define BIT_MASK_IC_TAR_SPECIAL 0x1
|
||||||
|
#define BIT_CTRL_IC_TAR_SPECIAL(x) (((x) & BIT_MASK_IC_TAR_SPECIAL) << BIT_SHIFT_IC_TAR_SPECIAL)
|
||||||
|
|
||||||
|
#define BIT_IC_TAR_GC_OR_START BIT(10)
|
||||||
|
#define BIT_SHIFT_IC_TAR_GC_OR_START 10
|
||||||
|
#define BIT_MASK_IC_TAR_GC_OR_START 0x1
|
||||||
|
#define BIT_CTRL_IC_TAR_GC_OR_START(x) (((x) & BIT_MASK_IC_TAR_GC_OR_START) << BIT_SHIFT_IC_TAR_GC_OR_START)
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_TAR 0
|
||||||
|
#define BIT_MASK_IC_TAR 0x3ff
|
||||||
|
#define BIT_IC_TAR(x) (((x) & BIT_MASK_IC_TAR) << BIT_SHIFT_IC_TAR)
|
||||||
|
#define BIT_CTRL_IC_TAR(x) (((x) & BIT_MASK_IC_TAR) << BIT_SHIFT_IC_TAR)
|
||||||
|
#define BIT_GET_IC_TAR(x) (((x) >> BIT_SHIFT_IC_TAR) & BIT_MASK_IC_TAR)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_SAR
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_SAR 0
|
||||||
|
#define BIT_MASK_IC_SAR 0x3ff
|
||||||
|
#define BIT_IC_SAR(x) (((x) & BIT_MASK_IC_SAR) << BIT_SHIFT_IC_SAR)
|
||||||
|
#define BIT_CTRL_IC_SAR(x) (((x) & BIT_MASK_IC_SAR) << BIT_SHIFT_IC_SAR)
|
||||||
|
#define BIT_GET_IC_SAR(x) (((x) >> BIT_SHIFT_IC_SAR) & BIT_MASK_IC_SAR)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_HS_MADDR
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_HS_MADDR 0
|
||||||
|
#define BIT_MASK_IC_HS_MADDR 0x7
|
||||||
|
#define BIT_IC_HS_MADDR(x) (((x) & BIT_MASK_IC_HS_MADDR) << BIT_SHIFT_IC_HS_MADDR)
|
||||||
|
#define BIT_CTRL_IC_HS_MADDR(x) (((x) & BIT_MASK_IC_HS_MADDR) << BIT_SHIFT_IC_HS_MADDR)
|
||||||
|
#define BIT_GET_IC_HS_MADDR(x) (((x) >> BIT_SHIFT_IC_HS_MADDR) & BIT_MASK_IC_HS_MADDR)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_DATA_CMD
|
||||||
|
#define BIT_IC_DATA_CMD_RESTART BIT(10)
|
||||||
|
#define BIT_SHIFT_IC_DATA_CMD_RESTART 10
|
||||||
|
#define BIT_MASK_IC_DATA_CMD_RESTART 0x1
|
||||||
|
#define BIT_CTRL_IC_DATA_CMD_RESTART(x) (((x) & BIT_MASK_IC_DATA_CMD_RESTART) << BIT_SHIFT_IC_DATA_CMD_RESTART)
|
||||||
|
|
||||||
|
#define BIT_IC_DATA_CMD_STOP BIT(9)
|
||||||
|
#define BIT_SHIFT_IC_DATA_CMD_STOP 9
|
||||||
|
#define BIT_MASK_IC_DATA_CMD_STOP 0x1
|
||||||
|
#define BIT_CTRL_IC_DATA_CMD_STOP(x) (((x) & BIT_MASK_IC_DATA_CMD_STOP) << BIT_SHIFT_IC_DATA_CMD_STOP)
|
||||||
|
|
||||||
|
#define BIT_IC_DATA_CMD_CMD BIT(8)
|
||||||
|
#define BIT_SHIFT_IC_DATA_CMD_CMD 8
|
||||||
|
#define BIT_MASK_IC_DATA_CMD_CMD 0x1
|
||||||
|
#define BIT_CTRL_IC_DATA_CMD_CMD(x) (((x) & BIT_MASK_IC_DATA_CMD_CMD) << BIT_SHIFT_IC_DATA_CMD_CMD)
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_DATA_CMD_DAT 0
|
||||||
|
#define BIT_MASK_IC_DATA_CMD_DAT 0xff
|
||||||
|
#define BIT_IC_DATA_CMD_DAT(x) (((x) & BIT_MASK_IC_DATA_CMD_DAT) << BIT_SHIFT_IC_DATA_CMD_DAT)
|
||||||
|
#define BIT_CTRL_IC_DATA_CMD_DAT(x) (((x) & BIT_MASK_IC_DATA_CMD_DAT) << BIT_SHIFT_IC_DATA_CMD_DAT)
|
||||||
|
#define BIT_GET_IC_DATA_CMD_DAT(x) (((x) >> BIT_SHIFT_IC_DATA_CMD_DAT) & BIT_MASK_IC_DATA_CMD_DAT)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_SS_SCL_HCNT
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_SS_SCL_HCNT 0
|
||||||
|
#define BIT_MASK_IC_SS_SCL_HCNT 0xffff
|
||||||
|
#define BIT_IC_SS_SCL_HCNT(x) (((x) & BIT_MASK_IC_SS_SCL_HCNT) << BIT_SHIFT_IC_SS_SCL_HCNT)
|
||||||
|
#define BIT_CTRL_IC_SS_SCL_HCNT(x) (((x) & BIT_MASK_IC_SS_SCL_HCNT) << BIT_SHIFT_IC_SS_SCL_HCNT)
|
||||||
|
#define BIT_GET_IC_SS_SCL_HCNT(x) (((x) >> BIT_SHIFT_IC_SS_SCL_HCNT) & BIT_MASK_IC_SS_SCL_HCNT)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_SS_SCL_LCNT
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_SS_SCL_LCNT 0
|
||||||
|
#define BIT_MASK_IC_SS_SCL_LCNT 0xffff
|
||||||
|
#define BIT_IC_SS_SCL_LCNT(x) (((x) & BIT_MASK_IC_SS_SCL_LCNT) << BIT_SHIFT_IC_SS_SCL_LCNT)
|
||||||
|
#define BIT_CTRL_IC_SS_SCL_LCNT(x) (((x) & BIT_MASK_IC_SS_SCL_LCNT) << BIT_SHIFT_IC_SS_SCL_LCNT)
|
||||||
|
#define BIT_GET_IC_SS_SCL_LCNT(x) (((x) >> BIT_SHIFT_IC_SS_SCL_LCNT) & BIT_MASK_IC_SS_SCL_LCNT)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_FS_SCL_HCNT
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_FS_SCL_HCNT 0
|
||||||
|
#define BIT_MASK_IC_FS_SCL_HCNT 0xffff
|
||||||
|
#define BIT_IC_FS_SCL_HCNT(x) (((x) & BIT_MASK_IC_FS_SCL_HCNT) << BIT_SHIFT_IC_FS_SCL_HCNT)
|
||||||
|
#define BIT_CTRL_IC_FS_SCL_HCNT(x) (((x) & BIT_MASK_IC_FS_SCL_HCNT) << BIT_SHIFT_IC_FS_SCL_HCNT)
|
||||||
|
#define BIT_GET_IC_FS_SCL_HCNT(x) (((x) >> BIT_SHIFT_IC_FS_SCL_HCNT) & BIT_MASK_IC_FS_SCL_HCNT)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_FS_SCL_LCNT
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_FS_SCL_LCNT 0
|
||||||
|
#define BIT_MASK_IC_FS_SCL_LCNT 0xffff
|
||||||
|
#define BIT_IC_FS_SCL_LCNT(x) (((x) & BIT_MASK_IC_FS_SCL_LCNT) << BIT_SHIFT_IC_FS_SCL_LCNT)
|
||||||
|
#define BIT_CTRL_IC_FS_SCL_LCNT(x) (((x) & BIT_MASK_IC_FS_SCL_LCNT) << BIT_SHIFT_IC_FS_SCL_LCNT)
|
||||||
|
#define BIT_GET_IC_FS_SCL_LCNT(x) (((x) >> BIT_SHIFT_IC_FS_SCL_LCNT) & BIT_MASK_IC_FS_SCL_LCNT)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_HS_SCL_HCNT
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_HS_SCL_HCNT 0
|
||||||
|
#define BIT_MASK_IC_HS_SCL_HCNT 0xffff
|
||||||
|
#define BIT_IC_HS_SCL_HCNT(x) (((x) & BIT_MASK_IC_HS_SCL_HCNT) << BIT_SHIFT_IC_HS_SCL_HCNT)
|
||||||
|
#define BIT_CTRL_IC_HS_SCL_HCNT(x) (((x) & BIT_MASK_IC_HS_SCL_HCNT) << BIT_SHIFT_IC_HS_SCL_HCNT)
|
||||||
|
#define BIT_GET_IC_HS_SCL_HCNT(x) (((x) >> BIT_SHIFT_IC_HS_SCL_HCNT) & BIT_MASK_IC_HS_SCL_HCNT)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_HS_SCL_LCNT
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_HS_SCL_LCNT 0
|
||||||
|
#define BIT_MASK_IC_HS_SCL_LCNT 0xffff
|
||||||
|
#define BIT_IC_HS_SCL_LCNT(x) (((x) & BIT_MASK_IC_HS_SCL_LCNT) << BIT_SHIFT_IC_HS_SCL_LCNT)
|
||||||
|
#define BIT_CTRL_IC_HS_SCL_LCNT(x) (((x) & BIT_MASK_IC_HS_SCL_LCNT) << BIT_SHIFT_IC_HS_SCL_LCNT)
|
||||||
|
#define BIT_GET_IC_HS_SCL_LCNT(x) (((x) >> BIT_SHIFT_IC_HS_SCL_LCNT) & BIT_MASK_IC_HS_SCL_LCNT)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_INTR_STAT
|
||||||
|
#define BIT_IC_INTR_STAT_R_GEN_CALL BIT(11)
|
||||||
|
#define BIT_SHIFT_IC_INTR_STAT_R_GEN_CALL 11
|
||||||
|
#define BIT_MASK_IC_INTR_STAT_R_GEN_CALL 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_STAT_R_GEN_CALL(x) (((x) & BIT_MASK_IC_INTR_STAT_R_GEN_CALL) << BIT_SHIFT_IC_INTR_STAT_R_GEN_CALL)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_STAT_R_START_DET BIT(10)
|
||||||
|
#define BIT_SHIFT_IC_INTR_STAT_R_START_DET 10
|
||||||
|
#define BIT_MASK_IC_INTR_STAT_R_START_DET 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_STAT_R_START_DET(x) (((x) & BIT_MASK_IC_INTR_STAT_R_START_DET) << BIT_SHIFT_IC_INTR_STAT_R_START_DET)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_STAT_R_STOP_DET BIT(9)
|
||||||
|
#define BIT_SHIFT_IC_INTR_STAT_R_STOP_DET 9
|
||||||
|
#define BIT_MASK_IC_INTR_STAT_R_STOP_DET 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_STAT_R_STOP_DET(x) (((x) & BIT_MASK_IC_INTR_STAT_R_STOP_DET) << BIT_SHIFT_IC_INTR_STAT_R_STOP_DET)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_STAT_R_ACTIVITY BIT(8)
|
||||||
|
#define BIT_SHIFT_IC_INTR_STAT_R_ACTIVITY 8
|
||||||
|
#define BIT_MASK_IC_INTR_STAT_R_ACTIVITY 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_STAT_R_ACTIVITY(x) (((x) & BIT_MASK_IC_INTR_STAT_R_ACTIVITY) << BIT_SHIFT_IC_INTR_STAT_R_ACTIVITY)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_STAT_R_RX_DONE BIT(7)
|
||||||
|
#define BIT_SHIFT_IC_INTR_STAT_R_RX_DONE 7
|
||||||
|
#define BIT_MASK_IC_INTR_STAT_R_RX_DONE 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_STAT_R_RX_DONE(x) (((x) & BIT_MASK_IC_INTR_STAT_R_RX_DONE) << BIT_SHIFT_IC_INTR_STAT_R_RX_DONE)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_STAT_R_TX_ABRT BIT(6)
|
||||||
|
#define BIT_SHIFT_IC_INTR_STAT_R_TX_ABRT 6
|
||||||
|
#define BIT_MASK_IC_INTR_STAT_R_TX_ABRT 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_STAT_R_TX_ABRT(x) (((x) & BIT_MASK_IC_INTR_STAT_R_TX_ABRT) << BIT_SHIFT_IC_INTR_STAT_R_TX_ABRT)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_STAT_R_RD_REQ BIT(5)
|
||||||
|
#define BIT_SHIFT_IC_INTR_STAT_R_RD_REQ 5
|
||||||
|
#define BIT_MASK_IC_INTR_STAT_R_RD_REQ 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_STAT_R_RD_REQ(x) (((x) & BIT_MASK_IC_INTR_STAT_R_RD_REQ) << BIT_SHIFT_IC_INTR_STAT_R_RD_REQ)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_STAT_R_TX_EMPTY BIT(4)
|
||||||
|
#define BIT_SHIFT_IC_INTR_STAT_R_TX_EMPTY 4
|
||||||
|
#define BIT_MASK_IC_INTR_STAT_R_TX_EMPTY 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_STAT_R_TX_EMPTY(x) (((x) & BIT_MASK_IC_INTR_STAT_R_TX_EMPTY) << BIT_SHIFT_IC_INTR_STAT_R_TX_EMPTY)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_STAT_R_TX_OVER BIT(3)
|
||||||
|
#define BIT_SHIFT_IC_INTR_STAT_R_TX_OVER 3
|
||||||
|
#define BIT_MASK_IC_INTR_STAT_R_TX_OVER 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_STAT_R_TX_OVER(x) (((x) & BIT_MASK_IC_INTR_STAT_R_TX_OVER) << BIT_SHIFT_IC_INTR_STAT_R_TX_OVER)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_STAT_R_RX_FULL BIT(2)
|
||||||
|
#define BIT_SHIFT_IC_INTR_STAT_R_RX_FULL 2
|
||||||
|
#define BIT_MASK_IC_INTR_STAT_R_RX_FULL 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_STAT_R_RX_FULL(x) (((x) & BIT_MASK_IC_INTR_STAT_R_RX_FULL) << BIT_SHIFT_IC_INTR_STAT_R_RX_FULL)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_STAT_R_RX_OVER BIT(1)
|
||||||
|
#define BIT_SHIFT_IC_INTR_STAT_R_RX_OVER 1
|
||||||
|
#define BIT_MASK_IC_INTR_STAT_R_RX_OVER 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_STAT_R_RX_OVER(x) (((x) & BIT_MASK_IC_INTR_STAT_R_RX_OVER) << BIT_SHIFT_IC_INTR_STAT_R_RX_OVER)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_STAT_R_RX_UNDER BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_INTR_STAT_R_RX_UNDER 0
|
||||||
|
#define BIT_MASK_IC_INTR_STAT_R_RX_UNDER 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_STAT_R_RX_UNDER(x) (((x) & BIT_MASK_IC_INTR_STAT_R_RX_UNDER) << BIT_SHIFT_IC_INTR_STAT_R_RX_UNDER)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_INTR_MASK
|
||||||
|
#define BIT_IC_INTR_MASK_M_GEN_CALL BIT(11)
|
||||||
|
#define BIT_SHIFT_IC_INTR_MASK_M_GEN_CALL 11
|
||||||
|
#define BIT_MASK_IC_INTR_MASK_M_GEN_CALL 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_MASK_M_GEN_CALL(x) (((x) & BIT_MASK_IC_INTR_MASK_M_GEN_CALL) << BIT_SHIFT_IC_INTR_MASK_M_GEN_CALL)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_MASK_M_START_DET BIT(10)
|
||||||
|
#define BIT_SHIFT_IC_INTR_MASK_M_START_DET 10
|
||||||
|
#define BIT_MASK_IC_INTR_MASK_M_START_DET 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_MASK_M_START_DET(x) (((x) & BIT_MASK_IC_INTR_MASK_M_START_DET) << BIT_SHIFT_IC_INTR_MASK_M_START_DET)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_MASK_M_STOP_DET BIT(9)
|
||||||
|
#define BIT_SHIFT_IC_INTR_MASK_M_STOP_DET 9
|
||||||
|
#define BIT_MASK_IC_INTR_MASK_M_STOP_DET 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_MASK_M_STOP_DET(x) (((x) & BIT_MASK_IC_INTR_MASK_M_STOP_DET) << BIT_SHIFT_IC_INTR_MASK_M_STOP_DET)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_MASK_M_ACTIVITY BIT(8)
|
||||||
|
#define BIT_SHIFT_IC_INTR_MASK_M_ACTIVITY 8
|
||||||
|
#define BIT_MASK_IC_INTR_MASK_M_ACTIVITY 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_MASK_M_ACTIVITY(x) (((x) & BIT_MASK_IC_INTR_MASK_M_ACTIVITY) << BIT_SHIFT_IC_INTR_MASK_M_ACTIVITY)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_MASK_M_RX_DONE BIT(7)
|
||||||
|
#define BIT_SHIFT_IC_INTR_MASK_M_RX_DONE 7
|
||||||
|
#define BIT_MASK_IC_INTR_MASK_M_RX_DONE 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_MASK_M_RX_DONE(x) (((x) & BIT_MASK_IC_INTR_MASK_M_RX_DONE) << BIT_SHIFT_IC_INTR_MASK_M_RX_DONE)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_MASK_M_TX_ABRT BIT(6)
|
||||||
|
#define BIT_SHIFT_IC_INTR_MASK_M_TX_ABRT 6
|
||||||
|
#define BIT_MASK_IC_INTR_MASK_M_TX_ABRT 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_MASK_M_TX_ABRT(x) (((x) & BIT_MASK_IC_INTR_MASK_M_TX_ABRT) << BIT_SHIFT_IC_INTR_MASK_M_TX_ABRT)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_MASK_M_RD_REQ BIT(5)
|
||||||
|
#define BIT_SHIFT_IC_INTR_MASK_M_RD_REQ 5
|
||||||
|
#define BIT_MASK_IC_INTR_MASK_M_RD_REQ 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_MASK_M_RD_REQ(x) (((x) & BIT_MASK_IC_INTR_MASK_M_RD_REQ) << BIT_SHIFT_IC_INTR_MASK_M_RD_REQ)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_MASK_M_TX_EMPTY BIT(4)
|
||||||
|
#define BIT_SHIFT_IC_INTR_MASK_M_TX_EMPTY 4
|
||||||
|
#define BIT_MASK_IC_INTR_MASK_M_TX_EMPTY 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_MASK_M_TX_EMPTY(x) (((x) & BIT_MASK_IC_INTR_MASK_M_TX_EMPTY) << BIT_SHIFT_IC_INTR_MASK_M_TX_EMPTY)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_MASK_M_TX_OVER BIT(3)
|
||||||
|
#define BIT_SHIFT_IC_INTR_MASK_M_TX_OVER 3
|
||||||
|
#define BIT_MASK_IC_INTR_MASK_M_TX_OVER 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_MASK_M_TX_OVER(x) (((x) & BIT_MASK_IC_INTR_MASK_M_TX_OVER) << BIT_SHIFT_IC_INTR_MASK_M_TX_OVER)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_MASK_M_RX_FULL BIT(2)
|
||||||
|
#define BIT_SHIFT_IC_INTR_MASK_M_RX_FULL 2
|
||||||
|
#define BIT_MASK_IC_INTR_MASK_M_RX_FULL 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_MASK_M_RX_FULL(x) (((x) & BIT_MASK_IC_INTR_MASK_M_RX_FULL) << BIT_SHIFT_IC_INTR_MASK_M_RX_FULL)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_MASK_M_RX_OVER BIT(1)
|
||||||
|
#define BIT_SHIFT_IC_INTR_MASK_M_RX_OVER 1
|
||||||
|
#define BIT_MASK_IC_INTR_MASK_M_RX_OVER 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_MASK_M_RX_OVER(x) (((x) & BIT_MASK_IC_INTR_MASK_M_RX_OVER) << BIT_SHIFT_IC_INTR_MASK_M_RX_OVER)
|
||||||
|
|
||||||
|
#define BIT_IC_INTR_MASK_M_RX_UNDER BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_INTR_MASK_M_RX_UNDER 0
|
||||||
|
#define BIT_MASK_IC_INTR_MASK_M_RX_UNDER 0x1
|
||||||
|
#define BIT_CTRL_IC_INTR_MASK_M_RX_UNDER(x) (((x) & BIT_MASK_IC_INTR_MASK_M_RX_UNDER) << BIT_SHIFT_IC_INTR_MASK_M_RX_UNDER)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_RAW_INTR_STAT
|
||||||
|
#define BIT_IC_RAW_INTR_STAT_GEN_CALL BIT(11)
|
||||||
|
#define BIT_SHIFT_IC_RAW_INTR_STAT_GEN_CALL 11
|
||||||
|
#define BIT_MASK_IC_RAW_INTR_STAT_GEN_CALL 0x1
|
||||||
|
#define BIT_CTRL_IC_RAW_INTR_STAT_GEN_CALL(x) (((x) & BIT_MASK_IC_RAW_INTR_STAT_GEN_CALL) << BIT_SHIFT_IC_RAW_INTR_STAT_GEN_CALL)
|
||||||
|
|
||||||
|
#define BIT_IC_RAW_INTR_STAT_START_DET BIT(10)
|
||||||
|
#define BIT_SHIFT_IC_RAW_INTR_STAT_START_DET 10
|
||||||
|
#define BIT_MASK_IC_RAW_INTR_STAT_START_DET 0x1
|
||||||
|
#define BIT_CTRL_IC_RAW_INTR_STAT_START_DET(x) (((x) & BIT_MASK_IC_RAW_INTR_STAT_START_DET) << BIT_SHIFT_IC_RAW_INTR_STAT_START_DET)
|
||||||
|
|
||||||
|
#define BIT_IC_RAW_INTR_STAT_STOP_DET BIT(9)
|
||||||
|
#define BIT_SHIFT_IC_RAW_INTR_STAT_STOP_DET 9
|
||||||
|
#define BIT_MASK_IC_RAW_INTR_STAT_STOP_DET 0x1
|
||||||
|
#define BIT_CTRL_IC_RAW_INTR_STAT_STOP_DET(x) (((x) & BIT_MASK_IC_RAW_INTR_STAT_STOP_DET) << BIT_SHIFT_IC_RAW_INTR_STAT_STOP_DET)
|
||||||
|
|
||||||
|
#define BIT_IC_RAW_INTR_STAT_ACTIVITY BIT(8)
|
||||||
|
#define BIT_SHIFT_IC_RAW_INTR_STAT_ACTIVITY 8
|
||||||
|
#define BIT_MASK_IC_RAW_INTR_STAT_ACTIVITY 0x1
|
||||||
|
#define BIT_CTRL_IC_RAW_INTR_STAT_ACTIVITY(x) (((x) & BIT_MASK_IC_RAW_INTR_STAT_ACTIVITY) << BIT_SHIFT_IC_RAW_INTR_STAT_ACTIVITY)
|
||||||
|
|
||||||
|
#define BIT_IC_RAW_INTR_STAT_RX_DONE BIT(7)
|
||||||
|
#define BIT_SHIFT_IC_RAW_INTR_STAT_RX_DONE 7
|
||||||
|
#define BIT_MASK_IC_RAW_INTR_STAT_RX_DONE 0x1
|
||||||
|
#define BIT_CTRL_IC_RAW_INTR_STAT_RX_DONE(x) (((x) & BIT_MASK_IC_RAW_INTR_STAT_RX_DONE) << BIT_SHIFT_IC_RAW_INTR_STAT_RX_DONE)
|
||||||
|
|
||||||
|
#define BIT_IC_RAW_INTR_STAT_TX_ABRT BIT(6)
|
||||||
|
#define BIT_SHIFT_IC_RAW_INTR_STAT_TX_ABRT 6
|
||||||
|
#define BIT_MASK_IC_RAW_INTR_STAT_TX_ABRT 0x1
|
||||||
|
#define BIT_CTRL_IC_RAW_INTR_STAT_TX_ABRT(x) (((x) & BIT_MASK_IC_RAW_INTR_STAT_TX_ABRT) << BIT_SHIFT_IC_RAW_INTR_STAT_TX_ABRT)
|
||||||
|
|
||||||
|
#define BIT_IC_RAW_INTR_STAT_RD_REQ BIT(5)
|
||||||
|
#define BIT_SHIFT_IC_RAW_INTR_STAT_RD_REQ 5
|
||||||
|
#define BIT_MASK_IC_RAW_INTR_STAT_RD_REQ 0x1
|
||||||
|
#define BIT_CTRL_IC_RAW_INTR_STAT_RD_REQ(x) (((x) & BIT_MASK_IC_RAW_INTR_STAT_RD_REQ) << BIT_SHIFT_IC_RAW_INTR_STAT_RD_REQ)
|
||||||
|
|
||||||
|
#define BIT_IC_RAW_INTR_STAT_TX_EMPTY BIT(4)
|
||||||
|
#define BIT_SHIFT_IC_RAW_INTR_STAT_TX_EMPTY 4
|
||||||
|
#define BIT_MASK_IC_RAW_INTR_STAT_TX_EMPTY 0x1
|
||||||
|
#define BIT_CTRL_IC_RAW_INTR_STAT_TX_EMPTY(x) (((x) & BIT_MASK_IC_RAW_INTR_STAT_TX_EMPTY) << BIT_SHIFT_IC_RAW_INTR_STAT_TX_EMPTY)
|
||||||
|
|
||||||
|
#define BIT_IC_RAW_INTR_STAT_TX_OVER BIT(3)
|
||||||
|
#define BIT_SHIFT_IC_RAW_INTR_STAT_TX_OVER 3
|
||||||
|
#define BIT_MASK_IC_RAW_INTR_STAT_TX_OVER 0x1
|
||||||
|
#define BIT_CTRL_IC_RAW_INTR_STAT_TX_OVER(x) (((x) & BIT_MASK_IC_RAW_INTR_STAT_TX_OVER) << BIT_SHIFT_IC_RAW_INTR_STAT_TX_OVER)
|
||||||
|
|
||||||
|
#define BIT_IC_RAW_INTR_STAT_RX_FULL BIT(2)
|
||||||
|
#define BIT_SHIFT_IC_RAW_INTR_STAT_RX_FULL 2
|
||||||
|
#define BIT_MASK_IC_RAW_INTR_STAT_RX_FULL 0x1
|
||||||
|
#define BIT_CTRL_IC_RAW_INTR_STAT_RX_FULL(x) (((x) & BIT_MASK_IC_RAW_INTR_STAT_RX_FULL) << BIT_SHIFT_IC_RAW_INTR_STAT_RX_FULL)
|
||||||
|
|
||||||
|
#define BIT_IC_RAW_INTR_STAT_RX_OVER BIT(1)
|
||||||
|
#define BIT_SHIFT_IC_RAW_INTR_STAT_RX_OVER 1
|
||||||
|
#define BIT_MASK_IC_RAW_INTR_STAT_RX_OVER 0x1
|
||||||
|
#define BIT_CTRL_IC_RAW_INTR_STAT_RX_OVER(x) (((x) & BIT_MASK_IC_RAW_INTR_STAT_RX_OVER) << BIT_SHIFT_IC_RAW_INTR_STAT_RX_OVER)
|
||||||
|
|
||||||
|
#define BIT_IC_RAW_INTR_STAT_RX_UNDER BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_RAW_INTR_STAT_RX_UNDER 0
|
||||||
|
#define BIT_MASK_IC_RAW_INTR_STAT_RX_UNDER 0x1
|
||||||
|
#define BIT_CTRL_IC_RAW_INTR_STAT_RX_UNDER(x) (((x) & BIT_MASK_IC_RAW_INTR_STAT_RX_UNDER) << BIT_SHIFT_IC_RAW_INTR_STAT_RX_UNDER)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_RX_TL
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_RX_TL 0
|
||||||
|
#define BIT_MASK_IC_RX_TL 0xff
|
||||||
|
#define BIT_IC_RX_TL(x) (((x) & BIT_MASK_IC_RX_TL) << BIT_SHIFT_IC_RX_TL)
|
||||||
|
#define BIT_CTRL_IC_RX_TL(x) (((x) & BIT_MASK_IC_RX_TL) << BIT_SHIFT_IC_RX_TL)
|
||||||
|
#define BIT_GET_IC_RX_TL(x) (((x) >> BIT_SHIFT_IC_RX_TL) & BIT_MASK_IC_RX_TL)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_TX_TL
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_TX_TL 0
|
||||||
|
#define BIT_MASK_IC_TX_TL 0xff
|
||||||
|
#define BIT_IC_TX_TL(x) (((x) & BIT_MASK_IC_TX_TL) << BIT_SHIFT_IC_TX_TL)
|
||||||
|
#define BIT_CTRL_IC_TX_TL(x) (((x) & BIT_MASK_IC_TX_TL) << BIT_SHIFT_IC_TX_TL)
|
||||||
|
#define BIT_GET_IC_TX_TL(x) (((x) >> BIT_SHIFT_IC_TX_TL) & BIT_MASK_IC_TX_TL)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_CLR_INTR
|
||||||
|
#define BIT_IC_CLR_INTR BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_CLR_INTR 0
|
||||||
|
#define BIT_MASK_IC_CLR_INTR 0x1
|
||||||
|
#define BIT_CTRL_IC_CLR_INTR(x) (((x) & BIT_MASK_IC_CLR_INTR) << BIT_SHIFT_IC_CLR_INTR)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_CLR_RX_UNDER
|
||||||
|
#define BIT_IC_CLR_RX_UNDER BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_CLR_RX_UNDER 0
|
||||||
|
#define BIT_MASK_IC_CLR_RX_UNDER 0x1
|
||||||
|
#define BIT_CTRL_IC_CLR_RX_UNDER(x) (((x) & BIT_MASK_IC_CLR_RX_UNDER) << BIT_SHIFT_IC_CLR_RX_UNDER)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_CLR_RX_OVER
|
||||||
|
#define BIT_IC_CLR_RX_OVER BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_CLR_RX_OVER 0
|
||||||
|
#define BIT_MASK_IC_CLR_RX_OVER 0x1
|
||||||
|
#define BIT_CTRL_IC_CLR_RX_OVER(x) (((x) & BIT_MASK_IC_CLR_RX_OVER) << BIT_SHIFT_IC_CLR_RX_OVER)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_CLR_TX_OVER
|
||||||
|
#define BIT_IC_CLR_TX_OVER BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_CLR_TX_OVER 0
|
||||||
|
#define BIT_MASK_IC_CLR_TX_OVER 0x1
|
||||||
|
#define BIT_CTRL_IC_CLR_TX_OVER(x) (((x) & BIT_MASK_IC_CLR_TX_OVER) << BIT_SHIFT_IC_CLR_TX_OVER)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_CLR_RD_REQ
|
||||||
|
#define BIT_IC_CLR_RD_REQ BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_CLR_RD_REQ 0
|
||||||
|
#define BIT_MASK_IC_CLR_RD_REQ 0x1
|
||||||
|
#define BIT_CTRL_IC_CLR_RD_REQ(x) (((x) & BIT_MASK_IC_CLR_RD_REQ) << BIT_SHIFT_IC_CLR_RD_REQ)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_CLR_TX_ABRT
|
||||||
|
#define BIT_CLR_RD_REQ BIT(0)
|
||||||
|
#define BIT_SHIFT_CLR_RD_REQ 0
|
||||||
|
#define BIT_MASK_CLR_RD_REQ 0x1
|
||||||
|
#define BIT_CTRL_CLR_RD_REQ(x) (((x) & BIT_MASK_CLR_RD_REQ) << BIT_SHIFT_CLR_RD_REQ)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_CLR_RX_DONE
|
||||||
|
#define BIT_IC_CLR_RX_DONE BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_CLR_RX_DONE 0
|
||||||
|
#define BIT_MASK_IC_CLR_RX_DONE 0x1
|
||||||
|
#define BIT_CTRL_IC_CLR_RX_DONE(x) (((x) & BIT_MASK_IC_CLR_RX_DONE) << BIT_SHIFT_IC_CLR_RX_DONE)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_CLR_ACTIVITY
|
||||||
|
#define BIT_IC_CLR_ACTIVITY BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_CLR_ACTIVITY 0
|
||||||
|
#define BIT_MASK_IC_CLR_ACTIVITY 0x1
|
||||||
|
#define BIT_CTRL_IC_CLR_ACTIVITY(x) (((x) & BIT_MASK_IC_CLR_ACTIVITY) << BIT_SHIFT_IC_CLR_ACTIVITY)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_CLR_STOP_DET
|
||||||
|
#define BIT_IC_CLR_STOP_DET BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_CLR_STOP_DET 0
|
||||||
|
#define BIT_MASK_IC_CLR_STOP_DET 0x1
|
||||||
|
#define BIT_CTRL_IC_CLR_STOP_DET(x) (((x) & BIT_MASK_IC_CLR_STOP_DET) << BIT_SHIFT_IC_CLR_STOP_DET)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_CLR_START_DET
|
||||||
|
#define BIT_IC_CLR_START_DET BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_CLR_START_DET 0
|
||||||
|
#define BIT_MASK_IC_CLR_START_DET 0x1
|
||||||
|
#define BIT_CTRL_IC_CLR_START_DET(x) (((x) & BIT_MASK_IC_CLR_START_DET) << BIT_SHIFT_IC_CLR_START_DET)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_CLR_GEN_CALL
|
||||||
|
#define BIT_IC_CLR_GEN_CALL BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_CLR_GEN_CALL 0
|
||||||
|
#define BIT_MASK_IC_CLR_GEN_CALL 0x1
|
||||||
|
#define BIT_CTRL_IC_CLR_GEN_CALL(x) (((x) & BIT_MASK_IC_CLR_GEN_CALL) << BIT_SHIFT_IC_CLR_GEN_CALL)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_ENABLE
|
||||||
|
#define BIT_IC_ENABLE BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_ENABLE 0
|
||||||
|
#define BIT_MASK_IC_ENABLE 0x1
|
||||||
|
#define BIT_CTRL_IC_ENABLE(x) (((x) & BIT_MASK_IC_ENABLE) << BIT_SHIFT_IC_ENABLE)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_STATUS
|
||||||
|
#define BIT_IC_STATUS_SLV_ACTIVITY BIT(6)
|
||||||
|
#define BIT_SHIFT_IC_STATUS_SLV_ACTIVITY 6
|
||||||
|
#define BIT_MASK_IC_STATUS_SLV_ACTIVITY 0x1
|
||||||
|
#define BIT_CTRL_IC_STATUS_SLV_ACTIVITY(x) (((x) & BIT_MASK_IC_STATUS_SLV_ACTIVITY) << BIT_SHIFT_IC_STATUS_SLV_ACTIVITY)
|
||||||
|
|
||||||
|
#define BIT_IC_STATUS_MST_ACTIVITY BIT(5)
|
||||||
|
#define BIT_SHIFT_IC_STATUS_MST_ACTIVITY 5
|
||||||
|
#define BIT_MASK_IC_STATUS_MST_ACTIVITY 0x1
|
||||||
|
#define BIT_CTRL_IC_STATUS_MST_ACTIVITY(x) (((x) & BIT_MASK_IC_STATUS_MST_ACTIVITY) << BIT_SHIFT_IC_STATUS_MST_ACTIVITY)
|
||||||
|
|
||||||
|
#define BIT_IC_STATUS_RFF BIT(4)
|
||||||
|
#define BIT_SHIFT_IC_STATUS_RFF 4
|
||||||
|
#define BIT_MASK_IC_STATUS_RFF 0x1
|
||||||
|
#define BIT_CTRL_IC_STATUS_RFF(x) (((x) & BIT_MASK_IC_STATUS_RFF) << BIT_SHIFT_IC_STATUS_RFF)
|
||||||
|
|
||||||
|
#define BIT_IC_STATUS_RFNE BIT(3)
|
||||||
|
#define BIT_SHIFT_IC_STATUS_RFNE 3
|
||||||
|
#define BIT_MASK_IC_STATUS_RFNE 0x1
|
||||||
|
#define BIT_CTRL_IC_STATUS_RFNE(x) (((x) & BIT_MASK_IC_STATUS_RFNE) << BIT_SHIFT_IC_STATUS_RFNE)
|
||||||
|
|
||||||
|
#define BIT_IC_STATUS_TFE BIT(2)
|
||||||
|
#define BIT_SHIFT_IC_STATUS_TFE 2
|
||||||
|
#define BIT_MASK_IC_STATUS_TFE 0x1
|
||||||
|
#define BIT_CTRL_IC_STATUS_TFE(x) (((x) & BIT_MASK_IC_STATUS_TFE) << BIT_SHIFT_IC_STATUS_TFE)
|
||||||
|
|
||||||
|
#define BIT_IC_STATUS_TFNF BIT(1)
|
||||||
|
#define BIT_SHIFT_IC_STATUS_TFNF 1
|
||||||
|
#define BIT_MASK_IC_STATUS_TFNF 0x1
|
||||||
|
#define BIT_CTRL_IC_STATUS_TFNF(x) (((x) & BIT_MASK_IC_STATUS_TFNF) << BIT_SHIFT_IC_STATUS_TFNF)
|
||||||
|
|
||||||
|
#define BIT_IC_STATUS_ACTIVITY BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_STATUS_ACTIVITY 0
|
||||||
|
#define BIT_MASK_IC_STATUS_ACTIVITY 0x1
|
||||||
|
#define BIT_CTRL_IC_STATUS_ACTIVITY(x) (((x) & BIT_MASK_IC_STATUS_ACTIVITY) << BIT_SHIFT_IC_STATUS_ACTIVITY)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_TXFLR
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_TXFLR 0
|
||||||
|
#define BIT_MASK_IC_TXFLR 0x3f
|
||||||
|
#define BIT_IC_TXFLR(x) (((x) & BIT_MASK_IC_TXFLR) << BIT_SHIFT_IC_TXFLR)
|
||||||
|
#define BIT_CTRL_IC_TXFLR(x) (((x) & BIT_MASK_IC_TXFLR) << BIT_SHIFT_IC_TXFLR)
|
||||||
|
#define BIT_GET_IC_TXFLR(x) (((x) >> BIT_SHIFT_IC_TXFLR) & BIT_MASK_IC_TXFLR)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_RXFLR
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_RXFLR 0
|
||||||
|
#define BIT_MASK_IC_RXFLR 0x1f
|
||||||
|
#define BIT_IC_RXFLR(x) (((x) & BIT_MASK_IC_RXFLR) << BIT_SHIFT_IC_RXFLR)
|
||||||
|
#define BIT_CTRL_IC_RXFLR(x) (((x) & BIT_MASK_IC_RXFLR) << BIT_SHIFT_IC_RXFLR)
|
||||||
|
#define BIT_GET_IC_RXFLR(x) (((x) >> BIT_SHIFT_IC_RXFLR) & BIT_MASK_IC_RXFLR)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_SDA_HOLD
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_SDA_HOLD 0
|
||||||
|
#define BIT_MASK_IC_SDA_HOLD 0xffff
|
||||||
|
#define BIT_IC_SDA_HOLD(x) (((x) & BIT_MASK_IC_SDA_HOLD) << BIT_SHIFT_IC_SDA_HOLD)
|
||||||
|
#define BIT_CTRL_IC_SDA_HOLD(x) (((x) & BIT_MASK_IC_SDA_HOLD) << BIT_SHIFT_IC_SDA_HOLD)
|
||||||
|
#define BIT_GET_IC_SDA_HOLD(x) (((x) >> BIT_SHIFT_IC_SDA_HOLD) & BIT_MASK_IC_SDA_HOLD)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_TX_ABRT_SOURCE
|
||||||
|
#define BIT_IC_TX_ABRT_SOURCE_ABRT_SLVRD_INTX BIT(15)
|
||||||
|
#define BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_SLVRD_INTX 15
|
||||||
|
#define BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_SLVRD_INTX 0x1
|
||||||
|
#define BIT_CTRL_IC_TX_ABRT_SOURCE_ABRT_SLVRD_INTX(x) (((x) & BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_SLVRD_INTX) << BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_SLVRD_INTX)
|
||||||
|
|
||||||
|
#define BIT_IC_TX_ABRT_SOURCE_ABRT_SLV_ARBLOST BIT(14)
|
||||||
|
#define BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_SLV_ARBLOST 14
|
||||||
|
#define BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_SLV_ARBLOST 0x1
|
||||||
|
#define BIT_CTRL_IC_TX_ABRT_SOURCE_ABRT_SLV_ARBLOST(x) (((x) & BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_SLV_ARBLOST) << BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_SLV_ARBLOST)
|
||||||
|
|
||||||
|
#define BIT_IC_TX_ABRT_SOURCE_ABRT_SLVFLUSH_TXFIFO BIT(13)
|
||||||
|
#define BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_SLVFLUSH_TXFIFO 13
|
||||||
|
#define BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_SLVFLUSH_TXFIFO 0x1
|
||||||
|
#define BIT_CTRL_IC_TX_ABRT_SOURCE_ABRT_SLVFLUSH_TXFIFO(x) (((x) & BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_SLVFLUSH_TXFIFO) << BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_SLVFLUSH_TXFIFO)
|
||||||
|
|
||||||
|
#define BIT_IC_TX_ABRT_SOURCE_ARB_LOST BIT(12)
|
||||||
|
#define BIT_SHIFT_IC_TX_ABRT_SOURCE_ARB_LOST 12
|
||||||
|
#define BIT_MASK_IC_TX_ABRT_SOURCE_ARB_LOST 0x1
|
||||||
|
#define BIT_CTRL_IC_TX_ABRT_SOURCE_ARB_LOST(x) (((x) & BIT_MASK_IC_TX_ABRT_SOURCE_ARB_LOST) << BIT_SHIFT_IC_TX_ABRT_SOURCE_ARB_LOST)
|
||||||
|
|
||||||
|
#define BIT_IC_TX_ABRT_SOURCE_ABRT_MASTER_DIS BIT(11)
|
||||||
|
#define BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_MASTER_DIS 11
|
||||||
|
#define BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_MASTER_DIS 0x1
|
||||||
|
#define BIT_CTRL_IC_TX_ABRT_SOURCE_ABRT_MASTER_DIS(x) (((x) & BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_MASTER_DIS) << BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_MASTER_DIS)
|
||||||
|
|
||||||
|
#define BIT_IC_TX_ABRT_SOURCE_ABRT_10B_RD_NORSTRT BIT(10)
|
||||||
|
#define BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_10B_RD_NORSTRT 10
|
||||||
|
#define BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_10B_RD_NORSTRT 0x1
|
||||||
|
#define BIT_CTRL_IC_TX_ABRT_SOURCE_ABRT_10B_RD_NORSTRT(x) (((x) & BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_10B_RD_NORSTRT) << BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_10B_RD_NORSTRT)
|
||||||
|
|
||||||
|
#define BIT_IC_TX_ABRT_SOURCE_ABRT_SBYTE_NORSTRT BIT(9)
|
||||||
|
#define BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_SBYTE_NORSTRT 9
|
||||||
|
#define BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_SBYTE_NORSTRT 0x1
|
||||||
|
#define BIT_CTRL_IC_TX_ABRT_SOURCE_ABRT_SBYTE_NORSTRT(x) (((x) & BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_SBYTE_NORSTRT) << BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_SBYTE_NORSTRT)
|
||||||
|
|
||||||
|
#define BIT_IC_TX_ABRT_SOURCE_ABRT_HS_NORSTRT BIT(8)
|
||||||
|
#define BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_HS_NORSTRT 8
|
||||||
|
#define BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_HS_NORSTRT 0x1
|
||||||
|
#define BIT_CTRL_IC_TX_ABRT_SOURCE_ABRT_HS_NORSTRT(x) (((x) & BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_HS_NORSTRT) << BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_HS_NORSTRT)
|
||||||
|
|
||||||
|
#define BIT_IC_TX_ABRT_SOURCE_ABRT_SBYTE_ACKDET BIT(7)
|
||||||
|
#define BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_SBYTE_ACKDET 7
|
||||||
|
#define BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_SBYTE_ACKDET 0x1
|
||||||
|
#define BIT_CTRL_IC_TX_ABRT_SOURCE_ABRT_SBYTE_ACKDET(x) (((x) & BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_SBYTE_ACKDET) << BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_SBYTE_ACKDET)
|
||||||
|
|
||||||
|
#define BIT_IC_TX_ABRT_SOURCE_ABRT_HS_ACKDET BIT(6)
|
||||||
|
#define BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_HS_ACKDET 6
|
||||||
|
#define BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_HS_ACKDET 0x1
|
||||||
|
#define BIT_CTRL_IC_TX_ABRT_SOURCE_ABRT_HS_ACKDET(x) (((x) & BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_HS_ACKDET) << BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_HS_ACKDET)
|
||||||
|
|
||||||
|
#define BIT_IC_TX_ABRT_SOURCE_ABRT_GCALL_READ BIT(5)
|
||||||
|
#define BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_GCALL_READ 5
|
||||||
|
#define BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_GCALL_READ 0x1
|
||||||
|
#define BIT_CTRL_IC_TX_ABRT_SOURCE_ABRT_GCALL_READ(x) (((x) & BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_GCALL_READ) << BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_GCALL_READ)
|
||||||
|
|
||||||
|
#define BIT_IC_TX_ABRT_SOURCE_ABRT_GCALL_NOACK BIT(4)
|
||||||
|
#define BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_GCALL_NOACK 4
|
||||||
|
#define BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_GCALL_NOACK 0x1
|
||||||
|
#define BIT_CTRL_IC_TX_ABRT_SOURCE_ABRT_GCALL_NOACK(x) (((x) & BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_GCALL_NOACK) << BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_GCALL_NOACK)
|
||||||
|
|
||||||
|
#define BIT_IC_TX_ABRT_SOURCE_ABRT_TXDATA_NOACK BIT(3)
|
||||||
|
#define BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_TXDATA_NOACK 3
|
||||||
|
#define BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_TXDATA_NOACK 0x1
|
||||||
|
#define BIT_CTRL_IC_TX_ABRT_SOURCE_ABRT_TXDATA_NOACK(x) (((x) & BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_TXDATA_NOACK) << BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_TXDATA_NOACK)
|
||||||
|
|
||||||
|
#define BIT_IC_TX_ABRT_SOURCE_ABRT_10ADDR2_NOACK BIT(2)
|
||||||
|
#define BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_10ADDR2_NOACK 2
|
||||||
|
#define BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_10ADDR2_NOACK 0x1
|
||||||
|
#define BIT_CTRL_IC_TX_ABRT_SOURCE_ABRT_10ADDR2_NOACK(x) (((x) & BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_10ADDR2_NOACK) << BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_10ADDR2_NOACK)
|
||||||
|
|
||||||
|
#define BIT_IC_TX_ABRT_SOURCE_ABRT_10ADDR1_NOACK BIT(1)
|
||||||
|
#define BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_10ADDR1_NOACK 1
|
||||||
|
#define BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_10ADDR1_NOACK 0x1
|
||||||
|
#define BIT_CTRL_IC_TX_ABRT_SOURCE_ABRT_10ADDR1_NOACK(x) (((x) & BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_10ADDR1_NOACK) << BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_10ADDR1_NOACK)
|
||||||
|
|
||||||
|
#define BIT_IC_TX_ABRT_SOURCE_ABRT_7B_ADDR_NOACK BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_7B_ADDR_NOACK 0
|
||||||
|
#define BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_7B_ADDR_NOACK 0x1
|
||||||
|
#define BIT_CTRL_IC_TX_ABRT_SOURCE_ABRT_7B_ADDR_NOACK(x) (((x) & BIT_MASK_IC_TX_ABRT_SOURCE_ABRT_7B_ADDR_NOACK) << BIT_SHIFT_IC_TX_ABRT_SOURCE_ABRT_7B_ADDR_NOACK)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_SLV_DATA_NACK_ONLY
|
||||||
|
#define BIT_IC_SLV_DATA_NACK_ONLY BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_SLV_DATA_NACK_ONLY 0
|
||||||
|
#define BIT_MASK_IC_SLV_DATA_NACK_ONLY 0x1
|
||||||
|
#define BIT_CTRL_IC_SLV_DATA_NACK_ONLY(x) (((x) & BIT_MASK_IC_SLV_DATA_NACK_ONLY) << BIT_SHIFT_IC_SLV_DATA_NACK_ONLY)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_DMA_CR
|
||||||
|
#define BIT_IC_DMA_CR_TDMAE BIT(1)
|
||||||
|
#define BIT_SHIFT_IC_DMA_CR_TDMAE 1
|
||||||
|
#define BIT_MASK_IC_DMA_CR_TDMAE 0x1
|
||||||
|
#define BIT_CTRL_IC_DMA_CR_TDMAE(x) (((x) & BIT_MASK_IC_DMA_CR_TDMAE) << BIT_SHIFT_IC_DMA_CR_TDMAE)
|
||||||
|
|
||||||
|
#define BIT_IC_DMA_CR_RDMAE BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_DMA_CR_RDMAE 0
|
||||||
|
#define BIT_MASK_IC_DMA_CR_RDMAE 0x1
|
||||||
|
#define BIT_CTRL_IC_DMA_CR_RDMAE(x) (((x) & BIT_MASK_IC_DMA_CR_RDMAE) << BIT_SHIFT_IC_DMA_CR_RDMAE)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_DMA_TDLR
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_DMA_TDLR_DMATDL 0
|
||||||
|
#define BIT_MASK_IC_DMA_TDLR_DMATDL 0x1f
|
||||||
|
#define BIT_IC_DMA_TDLR_DMATDL(x) (((x) & BIT_MASK_IC_DMA_TDLR_DMATDL) << BIT_SHIFT_IC_DMA_TDLR_DMATDL)
|
||||||
|
#define BIT_CTRL_IC_DMA_TDLR_DMATDL(x) (((x) & BIT_MASK_IC_DMA_TDLR_DMATDL) << BIT_SHIFT_IC_DMA_TDLR_DMATDL)
|
||||||
|
#define BIT_GET_IC_DMA_TDLR_DMATDL(x) (((x) >> BIT_SHIFT_IC_DMA_TDLR_DMATDL) & BIT_MASK_IC_DMA_TDLR_DMATDL)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_DMA_RDLR
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_DMA_RDLR_DMARDL 0
|
||||||
|
#define BIT_MASK_IC_DMA_RDLR_DMARDL 0xf
|
||||||
|
#define BIT_IC_DMA_RDLR_DMARDL(x) (((x) & BIT_MASK_IC_DMA_RDLR_DMARDL) << BIT_SHIFT_IC_DMA_RDLR_DMARDL)
|
||||||
|
#define BIT_CTRL_IC_DMA_RDLR_DMARDL(x) (((x) & BIT_MASK_IC_DMA_RDLR_DMARDL) << BIT_SHIFT_IC_DMA_RDLR_DMARDL)
|
||||||
|
#define BIT_GET_IC_DMA_RDLR_DMARDL(x) (((x) >> BIT_SHIFT_IC_DMA_RDLR_DMARDL) & BIT_MASK_IC_DMA_RDLR_DMARDL)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_SDA_SETUP
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_SDA_SETUP 0
|
||||||
|
#define BIT_MASK_IC_SDA_SETUP 0xff
|
||||||
|
#define BIT_IC_SDA_SETUP(x) (((x) & BIT_MASK_IC_SDA_SETUP) << BIT_SHIFT_IC_SDA_SETUP)
|
||||||
|
#define BIT_CTRL_IC_SDA_SETUP(x) (((x) & BIT_MASK_IC_SDA_SETUP) << BIT_SHIFT_IC_SDA_SETUP)
|
||||||
|
#define BIT_GET_IC_SDA_SETUP(x) (((x) >> BIT_SHIFT_IC_SDA_SETUP) & BIT_MASK_IC_SDA_SETUP)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_ACK_GENERAL_CALL
|
||||||
|
#define BIT_IC_ACK_GENERAL_CALL BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_ACK_GENERAL_CALL 0
|
||||||
|
#define BIT_MASK_IC_ACK_GENERAL_CALL 0x1
|
||||||
|
#define BIT_CTRL_IC_ACK_GENERAL_CALL(x) (((x) & BIT_MASK_IC_ACK_GENERAL_CALL) << BIT_SHIFT_IC_ACK_GENERAL_CALL)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_ENABLE_STATUS
|
||||||
|
#define BIT_IC_ENABLE_STATUS_SLV_RX_DATA_LOST BIT(2)
|
||||||
|
#define BIT_SHIFT_IC_ENABLE_STATUS_SLV_RX_DATA_LOST 2
|
||||||
|
#define BIT_MASK_IC_ENABLE_STATUS_SLV_RX_DATA_LOST 0x1
|
||||||
|
#define BIT_CTRL_IC_ENABLE_STATUS_SLV_RX_DATA_LOST(x) (((x) & BIT_MASK_IC_ENABLE_STATUS_SLV_RX_DATA_LOST) << BIT_SHIFT_IC_ENABLE_STATUS_SLV_RX_DATA_LOST)
|
||||||
|
|
||||||
|
#define BIT_IC_ENABLE_STATUS_SLV_DISABLED_WHILE_BUSY BIT(1)
|
||||||
|
#define BIT_SHIFT_IC_ENABLE_STATUS_SLV_DISABLED_WHILE_BUSY 1
|
||||||
|
#define BIT_MASK_IC_ENABLE_STATUS_SLV_DISABLED_WHILE_BUSY 0x1
|
||||||
|
#define BIT_CTRL_IC_ENABLE_STATUS_SLV_DISABLED_WHILE_BUSY(x) (((x) & BIT_MASK_IC_ENABLE_STATUS_SLV_DISABLED_WHILE_BUSY) << BIT_SHIFT_IC_ENABLE_STATUS_SLV_DISABLED_WHILE_BUSY)
|
||||||
|
|
||||||
|
#define BIT_IC_ENABLE_STATUS_IC_EN BIT(0)
|
||||||
|
#define BIT_SHIFT_IC_ENABLE_STATUS_IC_EN 0
|
||||||
|
#define BIT_MASK_IC_ENABLE_STATUS_IC_EN 0x1
|
||||||
|
#define BIT_CTRL_IC_ENABLE_STATUS_IC_EN(x) (((x) & BIT_MASK_IC_ENABLE_STATUS_IC_EN) << BIT_SHIFT_IC_ENABLE_STATUS_IC_EN)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_COMP_PARAM_1
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_COMP_PARAM_1_TX_BUFFER_DEPTH 16
|
||||||
|
#define BIT_MASK_IC_COMP_PARAM_1_TX_BUFFER_DEPTH 0xff
|
||||||
|
#define BIT_IC_COMP_PARAM_1_TX_BUFFER_DEPTH(x) (((x) & BIT_MASK_IC_COMP_PARAM_1_TX_BUFFER_DEPTH) << BIT_SHIFT_IC_COMP_PARAM_1_TX_BUFFER_DEPTH)
|
||||||
|
#define BIT_CTRL_IC_COMP_PARAM_1_TX_BUFFER_DEPTH(x) (((x) & BIT_MASK_IC_COMP_PARAM_1_TX_BUFFER_DEPTH) << BIT_SHIFT_IC_COMP_PARAM_1_TX_BUFFER_DEPTH)
|
||||||
|
#define BIT_GET_IC_COMP_PARAM_1_TX_BUFFER_DEPTH(x) (((x) >> BIT_SHIFT_IC_COMP_PARAM_1_TX_BUFFER_DEPTH) & BIT_MASK_IC_COMP_PARAM_1_TX_BUFFER_DEPTH)
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_COMP_PARAM_1_RX_BUFFER_DEPTH 8
|
||||||
|
#define BIT_MASK_IC_COMP_PARAM_1_RX_BUFFER_DEPTH 0xff
|
||||||
|
#define BIT_IC_COMP_PARAM_1_RX_BUFFER_DEPTH(x) (((x) & BIT_MASK_IC_COMP_PARAM_1_RX_BUFFER_DEPTH) << BIT_SHIFT_IC_COMP_PARAM_1_RX_BUFFER_DEPTH)
|
||||||
|
#define BIT_CTRL_IC_COMP_PARAM_1_RX_BUFFER_DEPTH(x) (((x) & BIT_MASK_IC_COMP_PARAM_1_RX_BUFFER_DEPTH) << BIT_SHIFT_IC_COMP_PARAM_1_RX_BUFFER_DEPTH)
|
||||||
|
#define BIT_GET_IC_COMP_PARAM_1_RX_BUFFER_DEPTH(x) (((x) >> BIT_SHIFT_IC_COMP_PARAM_1_RX_BUFFER_DEPTH) & BIT_MASK_IC_COMP_PARAM_1_RX_BUFFER_DEPTH)
|
||||||
|
|
||||||
|
#define BIT_IC_COMP_PARAM_1_ADD_ENCODED_PARAMS BIT(7)
|
||||||
|
#define BIT_SHIFT_IC_COMP_PARAM_1_ADD_ENCODED_PARAMS 7
|
||||||
|
#define BIT_MASK_IC_COMP_PARAM_1_ADD_ENCODED_PARAMS 0x1
|
||||||
|
#define BIT_CTRL_IC_COMP_PARAM_1_ADD_ENCODED_PARAMS(x) (((x) & BIT_MASK_IC_COMP_PARAM_1_ADD_ENCODED_PARAMS) << BIT_SHIFT_IC_COMP_PARAM_1_ADD_ENCODED_PARAMS)
|
||||||
|
|
||||||
|
#define BIT_IC_COMP_PARAM_1_HAS_DMA BIT(6)
|
||||||
|
#define BIT_SHIFT_IC_COMP_PARAM_1_HAS_DMA 6
|
||||||
|
#define BIT_MASK_IC_COMP_PARAM_1_HAS_DMA 0x1
|
||||||
|
#define BIT_CTRL_IC_COMP_PARAM_1_HAS_DMA(x) (((x) & BIT_MASK_IC_COMP_PARAM_1_HAS_DMA) << BIT_SHIFT_IC_COMP_PARAM_1_HAS_DMA)
|
||||||
|
|
||||||
|
#define BIT_IC_COMP_PARAM_1_INTR_IO BIT(5)
|
||||||
|
#define BIT_SHIFT_IC_COMP_PARAM_1_INTR_IO 5
|
||||||
|
#define BIT_MASK_IC_COMP_PARAM_1_INTR_IO 0x1
|
||||||
|
#define BIT_CTRL_IC_COMP_PARAM_1_INTR_IO(x) (((x) & BIT_MASK_IC_COMP_PARAM_1_INTR_IO) << BIT_SHIFT_IC_COMP_PARAM_1_INTR_IO)
|
||||||
|
|
||||||
|
#define BIT_IC_COMP_PARAM_1_HC_COUNT_VALUES BIT(4)
|
||||||
|
#define BIT_SHIFT_IC_COMP_PARAM_1_HC_COUNT_VALUES 4
|
||||||
|
#define BIT_MASK_IC_COMP_PARAM_1_HC_COUNT_VALUES 0x1
|
||||||
|
#define BIT_CTRL_IC_COMP_PARAM_1_HC_COUNT_VALUES(x) (((x) & BIT_MASK_IC_COMP_PARAM_1_HC_COUNT_VALUES) << BIT_SHIFT_IC_COMP_PARAM_1_HC_COUNT_VALUES)
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_COMP_PARAM_1_MAX_SPEED_MODE 2
|
||||||
|
#define BIT_MASK_IC_COMP_PARAM_1_MAX_SPEED_MODE 0x3
|
||||||
|
#define BIT_IC_COMP_PARAM_1_MAX_SPEED_MODE(x) (((x) & BIT_MASK_IC_COMP_PARAM_1_MAX_SPEED_MODE) << BIT_SHIFT_IC_COMP_PARAM_1_MAX_SPEED_MODE)
|
||||||
|
#define BIT_CTRL_IC_COMP_PARAM_1_MAX_SPEED_MODE(x) (((x) & BIT_MASK_IC_COMP_PARAM_1_MAX_SPEED_MODE) << BIT_SHIFT_IC_COMP_PARAM_1_MAX_SPEED_MODE)
|
||||||
|
#define BIT_GET_IC_COMP_PARAM_1_MAX_SPEED_MODE(x) (((x) >> BIT_SHIFT_IC_COMP_PARAM_1_MAX_SPEED_MODE) & BIT_MASK_IC_COMP_PARAM_1_MAX_SPEED_MODE)
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_COMP_PARAM_1_APB_DATA_WIDTH 0
|
||||||
|
#define BIT_MASK_IC_COMP_PARAM_1_APB_DATA_WIDTH 0x3
|
||||||
|
#define BIT_IC_COMP_PARAM_1_APB_DATA_WIDTH(x) (((x) & BIT_MASK_IC_COMP_PARAM_1_APB_DATA_WIDTH) << BIT_SHIFT_IC_COMP_PARAM_1_APB_DATA_WIDTH)
|
||||||
|
#define BIT_CTRL_IC_COMP_PARAM_1_APB_DATA_WIDTH(x) (((x) & BIT_MASK_IC_COMP_PARAM_1_APB_DATA_WIDTH) << BIT_SHIFT_IC_COMP_PARAM_1_APB_DATA_WIDTH)
|
||||||
|
#define BIT_GET_IC_COMP_PARAM_1_APB_DATA_WIDTH(x) (((x) >> BIT_SHIFT_IC_COMP_PARAM_1_APB_DATA_WIDTH) & BIT_MASK_IC_COMP_PARAM_1_APB_DATA_WIDTH)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_COMP_VERSION
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_COMP_VERSION 0
|
||||||
|
#define BIT_MASK_IC_COMP_VERSION 0xffffffffL
|
||||||
|
#define BIT_IC_COMP_VERSION(x) (((x) & BIT_MASK_IC_COMP_VERSION) << BIT_SHIFT_IC_COMP_VERSION)
|
||||||
|
#define BIT_CTRL_IC_COMP_VERSION(x) (((x) & BIT_MASK_IC_COMP_VERSION) << BIT_SHIFT_IC_COMP_VERSION)
|
||||||
|
#define BIT_GET_IC_COMP_VERSION(x) (((x) >> BIT_SHIFT_IC_COMP_VERSION) & BIT_MASK_IC_COMP_VERSION)
|
||||||
|
|
||||||
|
|
||||||
|
//2 REG_DW_I2C_IC_COMP_TYPE
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IC_COMP_TYPE 0
|
||||||
|
#define BIT_MASK_IC_COMP_TYPE 0xffffffffL
|
||||||
|
#define BIT_IC_COMP_TYPE(x) (((x) & BIT_MASK_IC_COMP_TYPE) << BIT_SHIFT_IC_COMP_TYPE)
|
||||||
|
#define BIT_CTRL_IC_COMP_TYPE(x) (((x) & BIT_MASK_IC_COMP_TYPE) << BIT_SHIFT_IC_COMP_TYPE)
|
||||||
|
#define BIT_GET_IC_COMP_TYPE(x) (((x) >> BIT_SHIFT_IC_COMP_TYPE) & BIT_MASK_IC_COMP_TYPE)
|
||||||
|
|
||||||
|
//======================== Register Address Definition ========================
|
||||||
|
#define REG_DW_I2C_IC_CON 0x0000
|
||||||
|
#define REG_DW_I2C_IC_TAR 0x0004
|
||||||
|
#define REG_DW_I2C_IC_SAR 0x0008
|
||||||
|
#define REG_DW_I2C_IC_HS_MADDR 0x000C
|
||||||
|
#define REG_DW_I2C_IC_DATA_CMD 0x0010
|
||||||
|
#define REG_DW_I2C_IC_SS_SCL_HCNT 0x0014
|
||||||
|
#define REG_DW_I2C_IC_SS_SCL_LCNT 0x0018
|
||||||
|
#define REG_DW_I2C_IC_FS_SCL_HCNT 0x001C
|
||||||
|
#define REG_DW_I2C_IC_FS_SCL_LCNT 0x0020
|
||||||
|
#define REG_DW_I2C_IC_HS_SCL_HCNT 0x0024
|
||||||
|
#define REG_DW_I2C_IC_HS_SCL_LCNT 0x0028
|
||||||
|
#define REG_DW_I2C_IC_INTR_STAT 0x002C
|
||||||
|
#define REG_DW_I2C_IC_INTR_MASK 0x0030
|
||||||
|
#define REG_DW_I2C_IC_RAW_INTR_STAT 0x0034
|
||||||
|
#define REG_DW_I2C_IC_RX_TL 0x0038
|
||||||
|
#define REG_DW_I2C_IC_TX_TL 0x003C
|
||||||
|
#define REG_DW_I2C_IC_CLR_INTR 0x0040
|
||||||
|
#define REG_DW_I2C_IC_CLR_RX_UNDER 0x0044
|
||||||
|
#define REG_DW_I2C_IC_CLR_RX_OVER 0x0048
|
||||||
|
#define REG_DW_I2C_IC_CLR_TX_OVER 0x004C
|
||||||
|
#define REG_DW_I2C_IC_CLR_RD_REQ 0x0050
|
||||||
|
#define REG_DW_I2C_IC_CLR_TX_ABRT 0x0054
|
||||||
|
#define REG_DW_I2C_IC_CLR_RX_DONE 0x0058
|
||||||
|
#define REG_DW_I2C_IC_CLR_ACTIVITY 0x005C
|
||||||
|
#define REG_DW_I2C_IC_CLR_STOP_DET 0x0060
|
||||||
|
#define REG_DW_I2C_IC_CLR_START_DET 0x0064
|
||||||
|
#define REG_DW_I2C_IC_CLR_GEN_CALL 0x0068
|
||||||
|
#define REG_DW_I2C_IC_ENABLE 0x006C
|
||||||
|
#define REG_DW_I2C_IC_STATUS 0x0070
|
||||||
|
#define REG_DW_I2C_IC_TXFLR 0x0074
|
||||||
|
#define REG_DW_I2C_IC_RXFLR 0x0078
|
||||||
|
#define REG_DW_I2C_IC_SDA_HOLD 0x007C
|
||||||
|
#define REG_DW_I2C_IC_TX_ABRT_SOURCE 0x0080
|
||||||
|
#define REG_DW_I2C_IC_SLV_DATA_NACK_ONLY 0x0084
|
||||||
|
#define REG_DW_I2C_IC_DMA_CR 0x0088
|
||||||
|
#define REG_DW_I2C_IC_DMA_TDLR 0x008C
|
||||||
|
#define REG_DW_I2C_IC_DMA_RDLR 0x0090
|
||||||
|
#define REG_DW_I2C_IC_SDA_SETUP 0x0094
|
||||||
|
#define REG_DW_I2C_IC_ACK_GENERAL_CALL 0x0098
|
||||||
|
#define REG_DW_I2C_IC_ENABLE_STATUS 0x009C
|
||||||
|
#define REG_DW_I2C_IC_COMP_PARAM_1 0x00F4
|
||||||
|
#define REG_DW_I2C_IC_COMP_VERSION 0x00F8
|
||||||
|
#define REG_DW_I2C_IC_COMP_TYPE 0x00FC
|
||||||
|
|
||||||
|
//======================================================
|
||||||
|
// I2C related enumeration
|
||||||
|
// I2C Address Mode
|
||||||
|
typedef enum _I2C_ADDR_MODE_ {
|
||||||
|
I2C_ADDR_7BIT = 0,
|
||||||
|
I2C_ADDR_10BIT = 1,
|
||||||
|
}I2C_ADDR_MODE,*PI2C_ADDR_MODE;
|
||||||
|
|
||||||
|
// I2C Speed Mode
|
||||||
|
typedef enum _I2C_SPD_MODE_ {
|
||||||
|
I2C_SS_MODE = 1,
|
||||||
|
I2C_FS_MODE = 2,
|
||||||
|
I2C_HS_MODE = 3,
|
||||||
|
}I2C_SPD_MODE,*PI2C_SPD_MODE;
|
||||||
|
|
||||||
|
//I2C Timing Parameters
|
||||||
|
#define I2C_SS_MIN_SCL_HTIME 4000 //the unit is ns.
|
||||||
|
#define I2C_SS_MIN_SCL_LTIME 4700 //the unit is ns.
|
||||||
|
|
||||||
|
#define I2C_FS_MIN_SCL_HTIME 600 //the unit is ns.
|
||||||
|
#define I2C_FS_MIN_SCL_LTIME 1300 //the unit is ns.
|
||||||
|
|
||||||
|
#define I2C_HS_MIN_SCL_HTIME_100 60 //the unit is ns, with bus loading = 100pf
|
||||||
|
#define I2C_HS_MIN_SCL_LTIME_100 120 //the unit is ns., with bus loading = 100pf
|
||||||
|
|
||||||
|
#define I2C_HS_MIN_SCL_HTIME_400 160 //the unit is ns, with bus loading = 400pf
|
||||||
|
#define I2C_HS_MIN_SCL_LTIME_400 320 //the unit is ns., with bus loading = 400pf
|
||||||
|
|
||||||
|
|
||||||
|
//======================================================
|
||||||
|
//I2C Essential functions and macros
|
||||||
|
_LONG_CALL_ROM_ VOID HalI2CWrite32(IN u8 I2CIdx, IN u8 I2CReg, IN u32 I2CVal);
|
||||||
|
_LONG_CALL_ROM_ u32 HalI2CRead32(IN u8 I2CIdx, IN u8 I2CReg);
|
||||||
|
|
||||||
|
#define HAL_I2C_WRITE32(I2CIdx, addr, value) HalI2CWrite32(I2CIdx,addr,value)
|
||||||
|
#define HAL_I2C_READ32(I2CIdx, addr) HalI2CRead32(I2CIdx,addr)
|
||||||
|
|
||||||
|
// Rtl8195a I2C function prototypes
|
||||||
|
_LONG_CALL_ HAL_Status HalI2CEnableRtl8195a(IN VOID *Data);
|
||||||
|
_LONG_CALL_ HAL_Status HalI2CInit8195a(IN VOID *Data);
|
||||||
|
_LONG_CALL_ HAL_Status HalI2CDeInit8195a(IN VOID *Data);
|
||||||
|
_LONG_CALL_ROM_ HAL_Status HalI2CSetCLKRtl8195a(IN VOID *Data);
|
||||||
|
_LONG_CALL_ HAL_Status HalI2CMassSendRtl8195a(IN VOID *Data);
|
||||||
|
_LONG_CALL_ HAL_Status HalI2CSendRtl8195a(IN VOID *Data);
|
||||||
|
_LONG_CALL_ u8 HalI2CReceiveRtl8195a(IN VOID *Data);
|
||||||
|
_LONG_CALL_ROM_ HAL_Status HalI2CIntrCtrl8195a(IN VOID *Data);
|
||||||
|
_LONG_CALL_ HAL_Status HalI2CClrIntrRtl8195a(IN VOID *Data);
|
||||||
|
_LONG_CALL_ROM_ HAL_Status HalI2CClrAllIntrRtl8195a(IN VOID *Data);
|
||||||
|
_LONG_CALL_ HAL_Status HalI2CDMACtrl8195a(IN VOID *Data);
|
||||||
|
_LONG_CALL_ u32 HalI2CReadRegRtl8195a(IN VOID *Data, IN u8 I2CReg);
|
||||||
|
_LONG_CALL_ HAL_Status HalI2CWriteRegRtl8195a(IN VOID *Data, IN u8 I2CReg, IN u32 RegVal);
|
||||||
|
|
||||||
|
//Rtl8195a I2C V02 function prototype
|
||||||
|
_LONG_CALL_ HAL_Status HalI2CSendRtl8195aV02(IN VOID *Data);
|
||||||
|
#if defined(CONFIG_CHIP_A_CUT) || defined(CONFIG_CHIP_B_CUT) || defined(CONFIG_CHIP_C_CUT)
|
||||||
|
_LONG_CALL_ HAL_Status HalI2CSetCLKRtl8195aV02(IN VOID *Data);
|
||||||
|
#elif defined(CONFIG_CHIP_E_CUT)
|
||||||
|
_LONG_CALL_ROM_ HAL_Status HalI2CSetCLKRtl8195aV02(IN VOID *Data);
|
||||||
|
#endif
|
||||||
|
//Rtl8195a I2C V02 function prototype END
|
||||||
|
|
||||||
|
HAL_Status HalI2CInit8195a_Patch(IN VOID *Data);
|
||||||
|
HAL_Status HalI2CSendRtl8195a_Patch(IN VOID *Data);
|
||||||
|
HAL_Status HalI2CSetCLKRtl8195a_Patch(IN VOID *Data);
|
||||||
|
|
||||||
|
#endif
|
617
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_i2s.h
Normal file
617
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_i2s.h
Normal file
|
@ -0,0 +1,617 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _RTL8195A_I2S_H_
|
||||||
|
#define _RTL8195A_I2S_H_
|
||||||
|
|
||||||
|
|
||||||
|
//=============== Register Bit Field Definition ====================
|
||||||
|
// REG_I2S_CONTROL
|
||||||
|
#define BIT_CTLX_I2S_EN BIT(0)
|
||||||
|
#define BIT_SHIFT_CTLX_I2S_EN 0
|
||||||
|
#define BIT_MASK_CTLX_I2S_EN 0x1
|
||||||
|
#define BIT_CTRL_CTLX_I2S_EN(x) (((x) & BIT_MASK_CTLX_I2S_EN) << BIT_SHIFT_CTLX_I2S_EN)
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_I2S_TRX_ACT 1
|
||||||
|
#define BIT_MASK_CTLX_I2S_TRX_ACT 0x3
|
||||||
|
#define BIT_CTRL_CTLX_I2S_TRX_ACT(x) (((x) & BIT_MASK_CTLX_I2S_TRX_ACT) << BIT_SHIFT_CTLX_I2S_TRX_ACT)
|
||||||
|
#define BIT_GET_CTLX_I2S_TRX_ACT(x) (((x) >> BIT_SHIFT_CTLX_I2S_TRX_ACT) & BIT_MASK_CTLX_I2S_TRX_ACT)
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_I2S_CH_NUM 3
|
||||||
|
#define BIT_MASK_CTLX_I2S_CH_NUM 0x3
|
||||||
|
#define BIT_CTRL_CTLX_I2S_CH_NUM(x) (((x) & BIT_MASK_CTLX_I2S_CH_NUM) << BIT_SHIFT_CTLX_I2S_CH_NUM)
|
||||||
|
#define BIT_GET_CTLX_I2S_CH_NUM(x) (((x) >> BIT_SHIFT_CTLX_I2S_CH_NUM) & BIT_MASK_CTLX_I2S_CH_NUM)
|
||||||
|
|
||||||
|
#define BIT_CTLX_I2S_WL BIT(6)
|
||||||
|
#define BIT_SHIFT_CTLX_I2S_WL 6
|
||||||
|
#define BIT_MASK_CTLX_I2S_WL 0x1
|
||||||
|
#define BIT_CTRL_CTLX_I2S_WL(x) (((x) & BIT_MASK_CTLX_I2S_WL) << BIT_SHIFT_CTLX_I2S_WL)
|
||||||
|
|
||||||
|
#define BIT_CTLX_I2S_LRSWAP BIT(10)
|
||||||
|
#define BIT_SHIFT_CTLX_I2S_LRSWAP 10
|
||||||
|
#define BIT_MASK_CTLX_I2S_LRSWAP 0x1
|
||||||
|
#define BIT_CTRL_CTLX_I2S_LRSWAP(x) (((x) & BIT_MASK_CTLX_I2S_LRSWAP) << BIT_SHIFT_CTLX_I2S_LRSWAP)
|
||||||
|
|
||||||
|
#define BIT_CTLX_I2S_SCK_INV BIT(11)
|
||||||
|
#define BIT_SHIFT_CTLX_I2S_SCK_INV 11
|
||||||
|
#define BIT_MASK_CTLX_I2S_SCK_INV 0x1
|
||||||
|
#define BIT_CTRL_CTLX_I2S_SCK_INV(x) (((x) & BIT_MASK_CTLX_I2S_SCK_INV) << BIT_SHIFT_CTLX_I2S_SCK_INV)
|
||||||
|
|
||||||
|
#define BIT_CTLX_I2S_ENDIAN_SWAP BIT(12)
|
||||||
|
#define BIT_SHIFT_CTLX_I2S_ENDIAN_SWAP 12
|
||||||
|
#define BIT_MASK_CTLX_I2S_ENDIAN_SWAP 0x1
|
||||||
|
#define BIT_CTRL_CTLX_I2S_ENDIAN_SWAP(x) (((x) & BIT_MASK_CTLX_I2S_ENDIAN_SWAP) << BIT_SHIFT_CTLX_I2S_ENDIAN_SWAP)
|
||||||
|
|
||||||
|
#define BIT_CTLX_I2S_SLAVE_MODE BIT(29)
|
||||||
|
#define BIT_SHIFT_CTLX_I2S_SLAVE_MODE 29
|
||||||
|
#define BIT_MASK_CTLX_I2S_SLAVE_MODE 0x1
|
||||||
|
#define BIT_CTRL_CTLX_I2S_SLAVE_MODE(x) (((x) & BIT_MASK_CTLX_I2S_SLAVE_MODE) << BIT_SHIFT_CTLX_I2S_SLAVE_MODE)
|
||||||
|
|
||||||
|
#define BIT_CTLX_I2S_CLK_SRC BIT(30)
|
||||||
|
#define BIT_SHIFT_CTLX_I2S_CLK_SRC 30
|
||||||
|
#define BIT_MASK_CTLX_I2S_CLK_SRC 0x1
|
||||||
|
#define BIT_CTRL_CTLX_I2S_CLK_SRC(x) (((x) & BIT_MASK_CTLX_I2S_CLK_SRC) << BIT_SHIFT_CTLX_I2S_CLK_SRC)
|
||||||
|
|
||||||
|
#define BIT_CTLX_I2S_SW_RSTN BIT(31)
|
||||||
|
#define BIT_SHIFT_CTLX_I2S_SW_RSTN 31
|
||||||
|
#define BIT_MASK_CTLX_I2S_SW_RSTN 0x1
|
||||||
|
#define BIT_CTRL_CTLX_I2S_SW_RSTN(x) (((x) & BIT_MASK_CTLX_I2S_SW_RSTN) << BIT_SHIFT_CTLX_I2S_SW_RSTN)
|
||||||
|
|
||||||
|
// REG_I2S_SETTING
|
||||||
|
#define BIT_SHIFT_SETTING_I2S_PAGE_SZ 0
|
||||||
|
#define BIT_MASK_SETTING_I2S_PAGE_SZ 0xFFF
|
||||||
|
#define BIT_CTRL_SETTING_I2S_PAGE_SZ(x) (((x) & BIT_MASK_SETTING_I2S_PAGE_SZ) << BIT_SHIFT_SETTING_I2S_PAGE_SZ)
|
||||||
|
#define BIT_GET_SETTING_I2S_PAGE_SZ(x) (((x) >> BIT_SHIFT_SETTING_I2S_PAGE_SZ) & BIT_MASK_SETTING_I2S_PAGE_SZ)
|
||||||
|
|
||||||
|
#define BIT_SHIFT_SETTING_I2S_PAGE_NUM 12
|
||||||
|
#define BIT_MASK_SETTING_I2S_PAGE_NUM 0x3
|
||||||
|
#define BIT_CTRL_SETTING_I2S_PAGE_NUM(x) (((x) & BIT_MASK_SETTING_I2S_PAGE_NUM) << BIT_SHIFT_SETTING_I2S_PAGE_NUM)
|
||||||
|
#define BIT_GET_SETTING_I2S_PAGE_NUM(x) (((x) >> BIT_SHIFT_SETTING_I2S_PAGE_NUM) & BIT_MASK_SETTING_I2S_PAGE_NUM)
|
||||||
|
|
||||||
|
#define BIT_SHIFT_SETTING_I2S_SAMPLE_RATE 14
|
||||||
|
#define BIT_MASK_SETTING_I2S_SAMPLE_RATE 0x7
|
||||||
|
#define BIT_CTRL_SETTING_I2S_SAMPLE_RATE(x) (((x) & BIT_MASK_SETTING_I2S_SAMPLE_RATE) << BIT_SHIFT_SETTING_I2S_SAMPLE_RATE)
|
||||||
|
#define BIT_GET_SETTING_I2S_SAMPLE_RATE(x) (((x) >> BIT_SHIFT_SETTING_I2S_SAMPLE_RATE) & BIT_MASK_SETTING_I2S_SAMPLE_RATE)
|
||||||
|
|
||||||
|
// i2s trx page own bit
|
||||||
|
#define BIT_PAGE_I2S_OWN_BIT BIT(31)
|
||||||
|
#define BIT_SHIFT_PAGE_I2S_OWN_BIT 31
|
||||||
|
#define BIT_MASK_PAGE_I2S_OWN_BIT 0x1
|
||||||
|
#define BIT_CTRL_PAGE_I2S_OWN_BIT(x) (((x) & BIT_MASK_PAGE_I2S_OWN_BIT) << BIT_SHIFT_PAGE_I2S_OWN_BIT)
|
||||||
|
|
||||||
|
//=============== Register Address Definition ====================
|
||||||
|
#define REG_I2S_PAGE_OWN_OFF 0x004
|
||||||
|
|
||||||
|
#define REG_I2S_CTL 0x000
|
||||||
|
#define REG_I2S_TX_PAGE_PTR 0x004
|
||||||
|
#define REG_I2S_RX_PAGE_PTR 0x008
|
||||||
|
#define REG_I2S_SETTING 0x00C
|
||||||
|
|
||||||
|
#define REG_I2S_TX_MASK_INT 0x010
|
||||||
|
#define REG_I2S_TX_STATUS_INT 0x014
|
||||||
|
#define REG_I2S_RX_MASK_INT 0x018
|
||||||
|
#define REG_I2S_RX_STATUS_INT 0x01c
|
||||||
|
|
||||||
|
|
||||||
|
#define REG_I2S_TX_PAGE0_OWN 0x020
|
||||||
|
#define REG_I2S_TX_PAGE1_OWN 0x024
|
||||||
|
#define REG_I2S_TX_PAGE2_OWN 0x028
|
||||||
|
#define REG_I2S_TX_PAGE3_OWN 0x02C
|
||||||
|
#define REG_I2S_RX_PAGE0_OWN 0x030
|
||||||
|
#define REG_I2S_RX_PAGE1_OWN 0x034
|
||||||
|
#define REG_I2S_RX_PAGE2_OWN 0x038
|
||||||
|
#define REG_I2S_RX_PAGE3_OWN 0x03C
|
||||||
|
|
||||||
|
/*I2S Essential Functions and Macros*/
|
||||||
|
VOID
|
||||||
|
HalI2SWrite32(
|
||||||
|
IN u8 I2SIdx,
|
||||||
|
IN u8 I2SReg,
|
||||||
|
IN u32 I2SVal
|
||||||
|
);
|
||||||
|
|
||||||
|
u32
|
||||||
|
HalI2SRead32(
|
||||||
|
IN u8 I2SIdx,
|
||||||
|
IN u8 I2SReg
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
#define HAL_I2SX_READ32(I2sIndex, addr) \
|
||||||
|
HAL_READ32(I2S0_REG_BASE+ (I2sIndex*I2S1_REG_OFF), addr)
|
||||||
|
#define HAL_I2SX_WRITE32(I2sIndex, addr, value) \
|
||||||
|
HAL_WRITE32((I2S0_REG_BASE+ (I2sIndex*I2S1_REG_OFF)), addr, value)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define HAL_I2S_WRITE32(I2SIdx, addr, value) HalI2SWrite32(I2SIdx,addr,value)
|
||||||
|
#define HAL_I2S_READ32(I2SIdx, addr) HalI2SRead32(I2SIdx,addr)
|
||||||
|
|
||||||
|
/* I2S debug output*/
|
||||||
|
#define I2S_PREFIX "RTL8195A[i2s]: "
|
||||||
|
#define I2S_PREFIX_LVL " [i2s_DBG]: "
|
||||||
|
|
||||||
|
typedef enum _I2S_DBG_LVL_ {
|
||||||
|
HAL_I2S_LVL = 0x01,
|
||||||
|
SAL_I2S_LVL = 0x02,
|
||||||
|
VERI_I2S_LVL = 0x03,
|
||||||
|
}I2S_DBG_LVL,*PI2S_DBG_LVL;
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_LOG
|
||||||
|
#ifdef CONFIG_DEBUG_LOG_I2S_HAL
|
||||||
|
|
||||||
|
#define DBG_8195A_I2S(...) do{ \
|
||||||
|
_DbgDump("\r"I2S_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
|
||||||
|
#define I2SDBGLVL 0xFF
|
||||||
|
#define DBG_8195A_I2S_LVL(LVL,...) do{\
|
||||||
|
if (LVL&I2SDBGLVL){\
|
||||||
|
_DbgDump("\r"I2S_PREFIX_LVL __VA_ARGS__);\
|
||||||
|
}\
|
||||||
|
}while(0)
|
||||||
|
#else
|
||||||
|
#define DBG_I2S_LOG_PERD 100
|
||||||
|
#define DBG_8195A_I2S(...)
|
||||||
|
#define DBG_8195A_I2S_LVL(...)
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define DBG_I2S_LOG_PERD 100
|
||||||
|
#define DBG_8195A_I2S(...)
|
||||||
|
#define DBG_8195A_I2S_LVL(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
#define REG_I2S_PAGE_OWN_OFF 0x004
|
||||||
|
#define REG_I2S_CTL 0x000
|
||||||
|
#define REG_I2S_TX_PAGE_PTR 0x004
|
||||||
|
#define REG_I2S_RX_PAGE_PTR 0x008
|
||||||
|
#define REG_I2S_SETTING 0x00C
|
||||||
|
|
||||||
|
#define REG_I2S_TX_MASK_INT 0x010
|
||||||
|
#define REG_I2S_TX_STATUS_INT 0x014
|
||||||
|
#define REG_I2S_RX_MASK_INT 0x018
|
||||||
|
#define REG_I2S_RX_STATUS_INT 0x01c
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define REG_I2S_TX_PAGE0_OWN 0x020
|
||||||
|
#define REG_I2S_TX_PAGE1_OWN 0x024
|
||||||
|
#define REG_I2S_TX_PAGE2_OWN 0x028
|
||||||
|
#define REG_I2S_TX_PAGE3_OWN 0x02C
|
||||||
|
#define REG_I2S_RX_PAGE0_OWN 0x030
|
||||||
|
#define REG_I2S_RX_PAGE1_OWN 0x034
|
||||||
|
#define REG_I2S_RX_PAGE2_OWN 0x038
|
||||||
|
#define REG_I2S_RX_PAGE3_OWN 0x03C
|
||||||
|
*/
|
||||||
|
/* template
|
||||||
|
#define BIT_SHIFT_CTLX_ 7
|
||||||
|
#define BIT_MASK_CTLX_ 0x1
|
||||||
|
#define BIT_CTLX_(x) (((x) & BIT_MASK_CTLX_) << BIT_SHIFT_CTLX_)
|
||||||
|
#define BIT_INV_CTLX_ (~(BIT_MASK_CTLX_ << BIT_SHIFT_CTLX_))
|
||||||
|
*//*
|
||||||
|
#define BIT_SHIFT_CTLX_IIS_EN 0
|
||||||
|
#define BIT_MASK_CTLX_IIS_EN 0x1
|
||||||
|
#define BIT_CTLX_IIS_EN(x) (((x) & BIT_MASK_CTLX_IIS_EN) << BIT_SHIFT_CTLX_IIS_EN)
|
||||||
|
#define BIT_INV_CTLX_IIS_EN (~(BIT_MASK_CTLX_IIS_EN << BIT_SHIFT_CTLX_IIS_EN))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_TRX 1
|
||||||
|
#define BIT_MASK_CTLX_TRX 0x3
|
||||||
|
#define BIT_CTLX_TRX(x) (((x) & BIT_MASK_CTLX_TRX) << BIT_SHIFT_CTLX_TRX)
|
||||||
|
#define BIT_INV_CTLX_TRX (~(BIT_MASK_CTLX_TRX << BIT_SHIFT_CTLX_TRX))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_CH_NUM 3
|
||||||
|
#define BIT_MASK_CTLX_CH_NUM 0x3
|
||||||
|
#define BIT_CTLX_CH_NUM(x) (((x) & BIT_MASK_CTLX_CH_NUM) << BIT_SHIFT_CTLX_CH_NUM)
|
||||||
|
#define BIT_INV_CTLX_CH_NUM (~(BIT_MASK_CTLX_CH_NUM << BIT_SHIFT_CTLX_CH_NUM))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_EDGE_SW 5
|
||||||
|
#define BIT_MASK_CTLX_EDGE_SW 0x1
|
||||||
|
#define BIT_CTLX_EDGE_SW(x) (((x) & BIT_MASK_CTLX_EDGE_SW) << BIT_SHIFT_CTLX_EDGE_SW)
|
||||||
|
#define BIT_INV_CTLX_EDGE_SW (~(BIT_MASK_CTLX_EDGE_SW << BIT_SHIFT_CTLX_EDGE_SW))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_WL 6
|
||||||
|
#define BIT_MASK_CTLX_WL 0x1
|
||||||
|
#define BIT_CTLX_WL(x) (((x) & BIT_MASK_CTLX_WL) << BIT_SHIFT_CTLX_WL)
|
||||||
|
#define BIT_INV_CTLX_WL (~(BIT_MASK_CTLX_WL << BIT_SHIFT_CTLX_WL))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_LOOP_BACK 7
|
||||||
|
#define BIT_MASK_CTLX_LOOP_BACK 0x1
|
||||||
|
#define BIT_CTLX_LOOP_BACK(x) (((x) & BIT_MASK_CTLX_LOOP_BACK) << BIT_SHIFT_CTLX_LOOP_BACK)
|
||||||
|
#define BIT_INV_CTLX_LOOP_BACK (~(BIT_MASK_CTLX_LOOP_BACK << BIT_SHIFT_CTLX_LOOP_BACK))
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_FORMAT 8
|
||||||
|
#define BIT_MASK_CTLX_FORMAT 0x3
|
||||||
|
#define BIT_CTLX_FORMAT(x) (((x) & BIT_MASK_CTLX_FORMAT) << BIT_SHIFT_CTLX_FORMAT)
|
||||||
|
#define BIT_INV_CTLX_FORMAT (~(BIT_MASK_CTLX_FORMAT << BIT_SHIFT_CTLX_FORMAT))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_LRSWAP 10
|
||||||
|
#define BIT_MASK_CTLX_LRSWAP 0x1
|
||||||
|
#define BIT_CTLX_LRSWAP(x) (((x) & BIT_MASK_CTLX_LRSWAP) << BIT_SHIFT_CTLX_LRSWAP)
|
||||||
|
#define BIT_INV_CTLX_LRSWAP (~(BIT_MASK_CTLX_LRSWAP << BIT_SHIFT_CTLX_LRSWAP))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_SCK_INV 11
|
||||||
|
#define BIT_MASK_CTLX_SCK_INV 0x1
|
||||||
|
#define BIT_CTLX_SCK_INV(x) (((x) & BIT_MASK_CTLX_SCK_INV) << BIT_SHIFT_CTLX_SCK_INV)
|
||||||
|
#define BIT_INV_CTLX_SCK_INV (~(BIT_MASK_CTLX_SCK_INV << BIT_SHIFT_CTLX_SCK_INV))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_ENDIAN_SWAP 12
|
||||||
|
#define BIT_MASK_CTLX_ENDIAN_SWAP 0x1
|
||||||
|
#define BIT_CTLX_ENDIAN_SWAP(x) (((x) & BIT_MASK_CTLX_ENDIAN_SWAP) << BIT_SHIFT_CTLX_ENDIAN_SWAP)
|
||||||
|
#define BIT_INV_CTLX_ENDIAN_SWAP (~(BIT_MASK_CTLX_ENDIAN_SWAP << BIT_SHIFT_CTLX_ENDIAN_SWAP))
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_DEBUG_SWITCH 15
|
||||||
|
#define BIT_MASK_CTLX_DEBUG_SWITCH 0x3
|
||||||
|
#define BIT_CTLX_DEBUG_SWITCH(x) (((x) & BIT_MASK_CTLX_DEBUG_SWITCH) << BIT_SHIFT_CTLX_DEBUG_SWITCH)
|
||||||
|
#define BIT_INV_CTLX_DEBUG_SWITCH (~(BIT_MASK_CTLX_DEBUG_SWITCH << BIT_SHIFT_CTLX_DEBUG_SWITCH))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_SLAVE_SEL 29
|
||||||
|
#define BIT_MASK_CTLX_SLAVE_SEL 0x1
|
||||||
|
#define BIT_CTLX_SLAVE_SEL(x) (((x) & BIT_MASK_CTLX_SLAVE_SEL) << BIT_SHIFT_CTLX_SLAVE_SEL)
|
||||||
|
#define BIT_INV_CTLX_SLAVE_SEL (~(BIT_MASK_CTLX_SLAVE_SEL << BIT_SHIFT_CTLX_SLAVE_SEL))
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_CLK_SRC 30
|
||||||
|
#define BIT_MASK_CTLX_CLK_SRC 0x1
|
||||||
|
#define BIT_CTLX_CLK_SRC(x) (((x) & BIT_MASK_CTLX_CLK_SRC) << BIT_SHIFT_CTLX_CLK_SRC)
|
||||||
|
#define BIT_INV_CTLX_CLK_SRC (~(BIT_MASK_CTLX_CLK_SRC << BIT_SHIFT_CTLX_CLK_SRC))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTLX_SW_RSTN 31
|
||||||
|
#define BIT_MASK_CTLX_SW_RSTN 0x1
|
||||||
|
#define BIT_CTLX_SW_RSTN(x) (((x) & BIT_MASK_CTLX_SW_RSTN) << BIT_SHIFT_CTLX_SW_RSTN)
|
||||||
|
#define BIT_INV_CTLX_SW_RSTN (~(BIT_MASK_CTLX_SW_RSTN << BIT_SHIFT_CTLX_SW_RSTN))
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_SHIFT_SETTING_PAGE_SZ 0
|
||||||
|
#define BIT_MASK_SETTING_PAGE_SZ 0xFFF
|
||||||
|
#define BIT_SETTING_PAGE_SZ(x) (((x) & BIT_MASK_SETTING_PAGE_SZ) << BIT_SHIFT_SETTING_PAGE_SZ)
|
||||||
|
#define BIT_INV_SETTING_PAGE_SZ (~(BIT_MASK_SETTING_PAGE_SZ << BIT_SHIFT_SETTING_PAGE_SZ))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_SETTING_PAGE_NUM 12
|
||||||
|
#define BIT_MASK_SETTING_PAGE_NUM 0x3
|
||||||
|
#define BIT_SETTING_PAGE_NUM(x) (((x) & BIT_MASK_SETTING_PAGE_NUM) << BIT_SHIFT_SETTING_PAGE_NUM)
|
||||||
|
#define BIT_INV_SETTING_PAGE_NUM (~(BIT_MASK_SETTING_PAGE_NUM << BIT_SHIFT_SETTING_PAGE_NUM))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_SETTING_SAMPLE_RATE 14
|
||||||
|
#define BIT_MASK_SETTING_SAMPLE_RATE 0x7
|
||||||
|
#define BIT_SETTING_SAMPLE_RATE(x) (((x) & BIT_MASK_SETTING_SAMPLE_RATE) << BIT_SHIFT_SETTING_SAMPLE_RATE)
|
||||||
|
#define BIT_INV_SETTING_SAMPLE_RATE (~(BIT_MASK_SETTING_SAMPLE_RATE << BIT_SHIFT_SETTING_SAMPLE_RATE))
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef enum _I2S_CTL_FORMAT {
|
||||||
|
FormatI2s = 0x00,
|
||||||
|
FormatLeftJustified = 0x01,
|
||||||
|
FormatRightJustified = 0x02
|
||||||
|
}I2S_CTL_FORMAT, *PI2S_CTL_FORMAT;
|
||||||
|
|
||||||
|
typedef enum _I2S_CTL_CHNUM {
|
||||||
|
ChannelStereo = 0x00,
|
||||||
|
Channel5p1 = 0x01,
|
||||||
|
ChannelMono = 0x02
|
||||||
|
}I2S_CTL_CHNUM, *PI2S_CTL_CHNUM;
|
||||||
|
|
||||||
|
typedef enum _I2S_CTL_TRX_ACT {
|
||||||
|
RxOnly = 0x00,
|
||||||
|
TxOnly = 0x01,
|
||||||
|
TXRX = 0x02
|
||||||
|
}I2S_CTL_TRX_ACT, *PI2S_CTL_TRX_ACT;
|
||||||
|
/*
|
||||||
|
typedef struct _I2S_CTL_REG_ {
|
||||||
|
I2S_CTL_FORMAT Format;
|
||||||
|
I2S_CTL_CHNUM ChNum;
|
||||||
|
I2S_CTL_TRX_ACT TrxAct;
|
||||||
|
|
||||||
|
u32 I2s_En :1; // Bit 0
|
||||||
|
u32 Rsvd1to4 :4; // Bit 1-4 is TrxAct, ChNum
|
||||||
|
u32 EdgeSw :1; // Bit 5 Edge switch
|
||||||
|
u32 WordLength :1; // Bit 6
|
||||||
|
u32 LoopBack :1; // Bit 7
|
||||||
|
u32 Rsvd8to9 :2; // Bit 8-9 is Format
|
||||||
|
u32 DacLrSwap :1; // Bit 10
|
||||||
|
u32 SckInv :1; // Bit 11
|
||||||
|
u32 EndianSwap :1; // Bit 12
|
||||||
|
u32 Rsvd13to14 :2; // Bit 11-14
|
||||||
|
u32 DebugSwitch :2; // Bit 15-16
|
||||||
|
u32 Rsvd17to28 :12; // Bit 17-28
|
||||||
|
u32 SlaveMode :1; // Bit 29
|
||||||
|
u32 SR44p1KHz :1; // Bit 30
|
||||||
|
u32 SwRstn :1; // Bit 31
|
||||||
|
} I2S_CTL_REG, *PI2S_CTL_REG;
|
||||||
|
*/
|
||||||
|
typedef enum _I2S_SETTING_PAGE_NUM {
|
||||||
|
I2s1Page = 0x00,
|
||||||
|
I2s2Page = 0x01,
|
||||||
|
I2s3Page = 0x02,
|
||||||
|
I2s4Page = 0x03
|
||||||
|
}I2S_SETTING_PAGE_NUM, *PI2S_SETTING_PAGE_NUM;
|
||||||
|
|
||||||
|
//sampling rate
|
||||||
|
typedef enum _I2S_SETTING_SR {
|
||||||
|
I2sSR8K = 0x00,
|
||||||
|
I2sSR16K = 0x01,
|
||||||
|
I2sSR24K = 0x02,
|
||||||
|
I2sSR32K = 0x03,
|
||||||
|
I2sSR48K = 0x05,
|
||||||
|
I2sSR44p1K = 0x15,
|
||||||
|
I2sSR96K = 0x06,
|
||||||
|
I2sSR88p2K = 0x16
|
||||||
|
}I2S_SETTING_SR, *PI2S_SETTING_SR;
|
||||||
|
/*
|
||||||
|
typedef struct _I2S_SETTING_REG_ {
|
||||||
|
I2S_SETTING_PAGE_NUM PageNum;
|
||||||
|
I2S_SETTING_SR SampleRate;
|
||||||
|
|
||||||
|
u32 PageSize:12; // Bit 0-11
|
||||||
|
}I2S_SETTING_REG, *PI2S_SETTING_REG;
|
||||||
|
|
||||||
|
typedef enum _I2S_TX_ISR {
|
||||||
|
I2sTxP0OK = 0x01,
|
||||||
|
I2sTxP1OK = 0x02,
|
||||||
|
I2sTxP2OK = 0x04,
|
||||||
|
I2sTxP3OK = 0x08,
|
||||||
|
I2sTxPageUn = 0x10,
|
||||||
|
I2sTxFifoEmpty = 0x20
|
||||||
|
}I2S_TX_ISR, *PI2S_TX_ISR;
|
||||||
|
|
||||||
|
typedef enum _I2S_RX_ISR {
|
||||||
|
I2sRxP0OK = 0x01,
|
||||||
|
I2sRxP1OK = 0x02,
|
||||||
|
I2sRxP2OK = 0x04,
|
||||||
|
I2sRxP3OK = 0x08,
|
||||||
|
I2sRxPageUn = 0x10,
|
||||||
|
I2sRxFifoFull = 0x20
|
||||||
|
}I2S_RX_ISR, *PI2S_RX_ISR;
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Hal I2S function prototype*/
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SInitRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SInitRtl8195a_Patch(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SDeInitRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2STxRtl8195a(
|
||||||
|
IN VOID *Data,
|
||||||
|
IN u8 *pBuff
|
||||||
|
);
|
||||||
|
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SRxRtl8195a(
|
||||||
|
IN VOID *Data,
|
||||||
|
OUT u8 *pBuff
|
||||||
|
);
|
||||||
|
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SEnableRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SIntrCtrlRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
u32
|
||||||
|
HalI2SReadRegRtl8195a(
|
||||||
|
IN VOID *Data,
|
||||||
|
IN u8 I2SReg
|
||||||
|
);
|
||||||
|
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SSetRateRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SSetWordLenRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SSetChNumRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SSetPageNumRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SSetPageSizeRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SSetDirectionRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SSetDMABufRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SClrIntrRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SClrAllIntrRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SDMACtrlRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
u8
|
||||||
|
HalI2SGetTxPageRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
u8
|
||||||
|
HalI2SGetRxPageRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SPageSendRtl8195a(
|
||||||
|
IN VOID *Data,
|
||||||
|
IN u8 PageIdx
|
||||||
|
);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SPageRecvRtl8195a(
|
||||||
|
IN VOID *Data,
|
||||||
|
IN u8 PageIdx
|
||||||
|
);
|
||||||
|
#else
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SPageRecvRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
RTK_STATUS
|
||||||
|
HalI2SClearAllOwnBitRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// HAL functions Wrapper
|
||||||
|
static __inline VOID
|
||||||
|
HalI2SSetRate(
|
||||||
|
IN VOID *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HalI2SSetRateRtl8195a(Data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline VOID
|
||||||
|
HalI2SSetWordLen(
|
||||||
|
IN VOID *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HalI2SSetWordLenRtl8195a(Data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline VOID
|
||||||
|
HalI2SSetChNum(
|
||||||
|
IN VOID *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HalI2SSetChNumRtl8195a(Data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline VOID
|
||||||
|
HalI2SSetPageNum(
|
||||||
|
IN VOID *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HalI2SSetPageNumRtl8195a(Data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline VOID
|
||||||
|
HalI2SSetPageSize(
|
||||||
|
IN VOID *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HalI2SSetPageSizeRtl8195a(Data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline VOID
|
||||||
|
HalI2SSetDirection(
|
||||||
|
IN VOID *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HalI2SSetDirectionRtl8195a(Data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline VOID
|
||||||
|
HalI2SSetDMABuf(
|
||||||
|
IN VOID *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HalI2SSetDMABufRtl8195a(Data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline u8
|
||||||
|
HalI2SGetTxPage(
|
||||||
|
IN VOID *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return HalI2SGetTxPageRtl8195a(Data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline u8
|
||||||
|
HalI2SGetRxPage(
|
||||||
|
IN VOID *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return HalI2SGetRxPageRtl8195a(Data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline VOID
|
||||||
|
HalI2SPageSend(
|
||||||
|
IN VOID *Data,
|
||||||
|
IN u8 PageIdx
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HalI2SPageSendRtl8195a(Data, PageIdx);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
static __inline VOID
|
||||||
|
HalI2SPageRecv(
|
||||||
|
IN VOID *Data,
|
||||||
|
IN u8 PageIdx
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HalI2SPageRecvRtl8195a(Data, PageIdx);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static __inline VOID
|
||||||
|
HalI2SPageRecv(
|
||||||
|
IN VOID *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HalI2SPageRecvRtl8195a(Data);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static __inline VOID
|
||||||
|
HalI2SClearAllOwnBit(
|
||||||
|
IN VOID *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HalI2SClearAllOwnBitRtl8195a(Data);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _RTL8195A_I2S_H_ */
|
||||||
|
|
||||||
|
|
155
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_nfc.h
Normal file
155
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_nfc.h
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _RTL8195A_NFC_H_
|
||||||
|
#define _RTL8195A_NFC_H_
|
||||||
|
|
||||||
|
#include "hal_api.h"
|
||||||
|
//#include "osdep_api.h"
|
||||||
|
#ifdef CONFIG_NFC_VERIFY
|
||||||
|
#include "../test/nfc/rtl8195a_nfc_test.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_NFC_NORMAL
|
||||||
|
//===================== Register Bit Field Definition =====================
|
||||||
|
// TODO:
|
||||||
|
//===================== Register Address Definition =====================
|
||||||
|
//TODO:
|
||||||
|
//#include "osdep_api.h"
|
||||||
|
#define N2A_Q_LENGTH 10
|
||||||
|
#define N2ARLENGTH 4
|
||||||
|
//#define NFCTAGLENGTH 36 // maximum 36*4=144 bytes
|
||||||
|
#define NFCTAG_BASE 0x7F000
|
||||||
|
#define NFCTAG_PAGESIZE 256
|
||||||
|
#define NFCTAG_MAXPAGEIDX 16//(4*(1024/NFCTAG_PAGESIZE))
|
||||||
|
#define A2NWCLENGTH 4
|
||||||
|
|
||||||
|
#define FLASHAPPLENGTH 31
|
||||||
|
#define FLASHAPP_BASE 0x7E000
|
||||||
|
#define FLASH_PAGESIZE 128
|
||||||
|
#define FLASH_MAXPAGEIDX 32//(4*(1024/FLASH_PAGESIZE))
|
||||||
|
|
||||||
|
typedef struct _A2N_CATCH_W_ {
|
||||||
|
//u8 Vaild;
|
||||||
|
u8 A2NCatchRPage;
|
||||||
|
u32 A2NCatchWData[A2NWCLENGTH];
|
||||||
|
}A2N_CATCH_W_QUEUE, *PA2N_CATCH_W_QUEUE;
|
||||||
|
|
||||||
|
typedef struct _A2N_MAILBOX_Q_ {
|
||||||
|
u8 Length;
|
||||||
|
u8 Response;
|
||||||
|
u32 Content[A2NWCLENGTH+1];
|
||||||
|
}A2N_MAILBOX_Q,*PA2N_MAILBOX_Q;
|
||||||
|
|
||||||
|
typedef struct _N2A_CATCH_R_ {
|
||||||
|
u8 Vaild;
|
||||||
|
u8 N2ACatchRPage;
|
||||||
|
u32 N2ACatchRData[N2ARLENGTH];
|
||||||
|
}N2A_CATCH_R_QUEUE, *PN2A_CATCH_R_QUEUE;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _N2A_R_ {
|
||||||
|
u8 Vaild;
|
||||||
|
u8 N2ARPage;
|
||||||
|
}N2A_R_QUEUE, *PN2A_R_QUEUE;
|
||||||
|
|
||||||
|
typedef struct _N2A_W_ {
|
||||||
|
u8 Vaild;
|
||||||
|
u8 N2AWPage;
|
||||||
|
u32 N2AWData;
|
||||||
|
}N2A_W_QUEUE, *PN2A_W_QUEUE;
|
||||||
|
|
||||||
|
typedef struct _NFC_ADAPTER_ {
|
||||||
|
u8 Function;
|
||||||
|
u32 NFCIsr;
|
||||||
|
u8 N2ABoxOpen;
|
||||||
|
u8 A2NSeq;
|
||||||
|
//u8 NFCTagFlashWIdx;
|
||||||
|
//u8 NFCTagFlashRIdx;
|
||||||
|
// u32 NFCTag[NFCTAGLENGTH];
|
||||||
|
#if !TASK_SCHEDULER_DISABLED
|
||||||
|
void * VeriSema;
|
||||||
|
#else
|
||||||
|
u32 VeriSema;
|
||||||
|
#endif
|
||||||
|
#ifdef PLATFORM_FREERTOS
|
||||||
|
void * NFCTask;
|
||||||
|
#else
|
||||||
|
u32 NFCTask;
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NFC_VERIFY
|
||||||
|
//N2A Write Tag
|
||||||
|
u8 N2AWQRIdx;
|
||||||
|
u8 N2AWQWIdx;
|
||||||
|
N2A_W_QUEUE N2AWQ[N2A_Q_LENGTH];
|
||||||
|
//N2A Read Tag
|
||||||
|
u8 N2ARQRIdx;
|
||||||
|
u8 N2ARQWIdx;
|
||||||
|
N2A_R_QUEUE N2ARQ[N2A_Q_LENGTH];
|
||||||
|
//N2A Read Catch
|
||||||
|
u8 N2ARCRIdx;
|
||||||
|
u8 N2ARCWIdx;
|
||||||
|
N2A_CATCH_R_QUEUE N2ACatchR[N2A_Q_LENGTH];
|
||||||
|
#endif
|
||||||
|
//A2N Write Catch
|
||||||
|
//u8 A2NWCRIdx;
|
||||||
|
//u8 A2NWCWIdx;
|
||||||
|
//A2N_CATCH_W_QUEUE A2NCatchW[N2A_Q_LENGTH];
|
||||||
|
|
||||||
|
//A2N Write mailbox queue
|
||||||
|
u8 A2NWMailBox;
|
||||||
|
u8 A2NWQRIdx;
|
||||||
|
u8 A2NWQWIdx;
|
||||||
|
A2N_MAILBOX_Q A2NMAILQ[N2A_Q_LENGTH];
|
||||||
|
|
||||||
|
u8 TaskStop;
|
||||||
|
void *nfc_obj;
|
||||||
|
}NFC_ADAPTER, *PNFC_ADAPTER;
|
||||||
|
|
||||||
|
typedef enum _N2A_CMD_ {
|
||||||
|
TAG_READ = 0,
|
||||||
|
TAG_WRITE = 1,
|
||||||
|
CATCH_READ_DATA = 2,
|
||||||
|
NFC_R_PRESENT = 4,
|
||||||
|
N2A_MAILBOX_STATE = 5,
|
||||||
|
EXT_CLK_REQ = 6,
|
||||||
|
MAX_N2ACMD
|
||||||
|
} N2A_CMD, *PN2A_CMD;
|
||||||
|
|
||||||
|
typedef enum _A2N_CMD_ {
|
||||||
|
TAG_READ_DATA = 0,
|
||||||
|
CATCH_READ = 2,
|
||||||
|
CATCH_WRITE = 3,
|
||||||
|
A2N_MAILBOX_STATE = 4,
|
||||||
|
CONFIRM_N2A_BOX_STATE = 5,
|
||||||
|
EXT_CLK_RSP = 6,
|
||||||
|
MAX_A2NCMD
|
||||||
|
} A2N_CMD, *PA2N_CMD;
|
||||||
|
|
||||||
|
// Callback event defination
|
||||||
|
typedef enum _NFC_HAL_EVENT_ {
|
||||||
|
NFC_HAL_READER_PRESENT = (1<<0),
|
||||||
|
NFC_HAL_READ = (1<<1),
|
||||||
|
NFC_HAL_WRITE = (1<<2),
|
||||||
|
NFC_HAL_ERR = (1<<3),
|
||||||
|
NFC_HAL_CACHE_RD = (1<<4)
|
||||||
|
}NFC_CB_EVENT, *PNFC_CB_EVENT;
|
||||||
|
|
||||||
|
VOID A2NWriteCatch(IN VOID *pNFCAdapte, IN u8 N2AWPage,
|
||||||
|
IN u8 Length, IN u32 *WData);
|
||||||
|
VOID A2NReadCatch(IN VOID *pNFCAdapte, IN u8 A2NRPage);
|
||||||
|
VOID HalNFCDmemInit(IN u32 *pTagData, IN u32 TagLen);
|
||||||
|
VOID HalNFCInit(PNFC_ADAPTER pNFCAdp);
|
||||||
|
VOID HalNFCDeinit(PNFC_ADAPTER pNFCAdp);
|
||||||
|
VOID HalNFCFwDownload(VOID);
|
||||||
|
u32 HalNFCDbgRead32(IN u32 Addr);
|
||||||
|
VOID HalNFCDbgWrite32(IN u32 Addr, IN u32 Data);
|
||||||
|
#endif //CONFIG_NFC_NORMAL
|
||||||
|
#endif // #ifndef _RTL8195A_NFC_H_
|
1251
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_peri_on.h
Normal file
1251
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_peri_on.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _RTL8195A_PWM_H_
|
||||||
|
#define _RTL8195A_PWM_H_
|
||||||
|
|
||||||
|
extern void
|
||||||
|
HAL_Pwm_SetDuty_8195a(
|
||||||
|
HAL_PWM_ADAPTER *pPwmAdapt,
|
||||||
|
u32 period,
|
||||||
|
u32 pulse_width
|
||||||
|
);
|
||||||
|
|
||||||
|
extern HAL_Status
|
||||||
|
HAL_Pwm_Init_8195a(
|
||||||
|
HAL_PWM_ADAPTER *pPwmAdapt
|
||||||
|
);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
HAL_Pwm_Enable_8195a(
|
||||||
|
HAL_PWM_ADAPTER *pPwmAdapt
|
||||||
|
);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
HAL_Pwm_Disable_8195a(
|
||||||
|
HAL_PWM_ADAPTER *pPwmAdapt
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
498
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_ssi.h
Normal file
498
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_ssi.h
Normal file
|
@ -0,0 +1,498 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _RTL8195A_SSI_H_
|
||||||
|
#define _RTL8195A_SSI_H_
|
||||||
|
|
||||||
|
#define SSI_DUMMY_DATA 0x00 // for master mode, we need to push a Dummy data to TX FIFO for read
|
||||||
|
|
||||||
|
#define SSI_CLK_SPI1 (PLATFORM_CLOCK/2)
|
||||||
|
#define SSI_CLK_SPI0_2 (PLATFORM_CLOCK/4)
|
||||||
|
|
||||||
|
/* Parameters of DW_apb_ssi for RTL8195A */
|
||||||
|
#define SSI_TX_FIFO_DEPTH 64
|
||||||
|
#define TX_ABW 6 // 1-8, log2(SSI_TX_FIFO_DEPTH)
|
||||||
|
#define SSI_RX_FIFO_DEPTH 64
|
||||||
|
#define RX_ABW 6 // 1-8, log2(SSI_RX_FIFO_DEPTH)
|
||||||
|
|
||||||
|
#define SSI0_REG_BASE 0x40042000
|
||||||
|
#define SSI1_REG_BASE 0x40042400
|
||||||
|
#define SSI2_REG_BASE 0x40042800
|
||||||
|
|
||||||
|
/* Memory Map of DW_apb_ssi */
|
||||||
|
#define REG_DW_SSI_CTRLR0 0x00 // 16 bits
|
||||||
|
#define REG_DW_SSI_CTRLR1 0x04 // 16 bits
|
||||||
|
#define REG_DW_SSI_SSIENR 0x08 // 1 bit
|
||||||
|
#define REG_DW_SSI_MWCR 0x0C // 3 bits
|
||||||
|
#define REG_DW_SSI_SER 0x10 //
|
||||||
|
#define REG_DW_SSI_BAUDR 0x14 // 16 bits
|
||||||
|
#define REG_DW_SSI_TXFTLR 0x18 // TX_ABW
|
||||||
|
#define REG_DW_SSI_RXFTLR 0x1C // RX_ABW
|
||||||
|
#define REG_DW_SSI_TXFLR 0x20 //
|
||||||
|
#define REG_DW_SSI_RXFLR 0x24 //
|
||||||
|
#define REG_DW_SSI_SR 0x28 // 7 bits
|
||||||
|
#define REG_DW_SSI_IMR 0x2C //
|
||||||
|
#define REG_DW_SSI_ISR 0x30 // 6 bits
|
||||||
|
#define REG_DW_SSI_RISR 0x34 // 6 bits
|
||||||
|
#define REG_DW_SSI_TXOICR 0x38 // 1 bits
|
||||||
|
#define REG_DW_SSI_RXOICR 0x3C // 1 bits
|
||||||
|
#define REG_DW_SSI_RXUICR 0x40 // 1 bits
|
||||||
|
#define REG_DW_SSI_MSTICR 0x44 // 1 bits
|
||||||
|
#define REG_DW_SSI_ICR 0x48 // 1 bits
|
||||||
|
#define REG_DW_SSI_DMACR 0x4C // 2 bits
|
||||||
|
#define REG_DW_SSI_DMATDLR 0x50 // TX_ABW
|
||||||
|
#define REG_DW_SSI_DMARDLR 0x54 // RX_ABW
|
||||||
|
#define REG_DW_SSI_IDR 0x58 // 32 bits
|
||||||
|
#define REG_DW_SSI_COMP_VERSION 0x5C // 32 bits
|
||||||
|
#define REG_DW_SSI_DR 0x60 // 16 bits 0x60-0xEC
|
||||||
|
#define REG_DW_SSI_RX_SAMPLE_DLY 0xF0 // 8 bits
|
||||||
|
#define REG_DW_SSI_RSVD_0 0xF4 // 32 bits
|
||||||
|
#define REG_DW_SSI_RSVD_1 0xF8 // 32 bits
|
||||||
|
#define REG_DW_SSI_RSVD_2 0xFC // 32 bits
|
||||||
|
|
||||||
|
// CTRLR0 0x00 // 16 bits, 6.2.1
|
||||||
|
// DFS Reset Value: 0x7
|
||||||
|
#define BIT_SHIFT_CTRLR0_DFS 0
|
||||||
|
#define BIT_MASK_CTRLR0_DFS 0xF
|
||||||
|
#define BIT_CTRLR0_DFS(x)(((x) & BIT_MASK_CTRLR0_DFS) << BIT_SHIFT_CTRLR0_DFS)
|
||||||
|
#define BIT_INVC_CTRLR0_DFS (~(BIT_MASK_CTRLR0_DFS << BIT_SHIFT_CTRLR0_DFS))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTRLR0_FRF 4
|
||||||
|
#define BIT_MASK_CTRLR0_FRF 0x3
|
||||||
|
#define BIT_CTRLR0_FRF(x)(((x) & BIT_MASK_CTRLR0_FRF) << BIT_SHIFT_CTRLR0_FRF)
|
||||||
|
#define BIT_INVC_CTRLR0_FRF (~(BIT_MASK_CTRLR0_FRF << BIT_SHIFT_CTRLR0_FRF))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTRLR0_SCPH 6
|
||||||
|
#define BIT_MASK_CTRLR0_SCPH 0x1
|
||||||
|
#define BIT_CTRLR0_SCPH(x)(((x) & BIT_MASK_CTRLR0_SCPH) << BIT_SHIFT_CTRLR0_SCPH)
|
||||||
|
#define BIT_INVC_CTRLR0_SCPH (~(BIT_MASK_CTRLR0_SCPH << BIT_SHIFT_CTRLR0_SCPH))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTRLR0_SCPOL 7
|
||||||
|
#define BIT_MASK_CTRLR0_SCPOL 0x1
|
||||||
|
#define BIT_CTRLR0_SCPOL(x)(((x) & BIT_MASK_CTRLR0_SCPOL) << BIT_SHIFT_CTRLR0_SCPOL)
|
||||||
|
#define BIT_INVC_CTRLR0_SCPOL (~(BIT_MASK_CTRLR0_SCPOL << BIT_SHIFT_CTRLR0_SCPOL))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTRLR0_TMOD 8
|
||||||
|
#define BIT_MASK_CTRLR0_TMOD 0x3
|
||||||
|
#define BIT_CTRLR0_TMOD(x)(((x) & BIT_MASK_CTRLR0_TMOD) << BIT_SHIFT_CTRLR0_TMOD)
|
||||||
|
#define BIT_INVC_CTRLR0_TMOD (~(BIT_MASK_CTRLR0_TMOD << BIT_SHIFT_CTRLR0_TMOD))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTRLR0_SLV_OE 10
|
||||||
|
#define BIT_MASK_CTRLR0_SLV_OE 0x1
|
||||||
|
#define BIT_CTRLR0_SLV_OE(x)(((x) & BIT_MASK_CTRLR0_SLV_OE) << BIT_SHIFT_CTRLR0_SLV_OE)
|
||||||
|
#define BIT_INVC_CTRLR0_SLV_OE (~(BIT_MASK_CTRLR0_SLV_OE << BIT_SHIFT_CTRLR0_SLV_OE))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTRLR0_SRL 11
|
||||||
|
#define BIT_MASK_CTRLR0_SRL 0x1
|
||||||
|
#define BIT_CTRLR0_SRL(x)(((x) & BIT_MASK_CTRLR0_SRL) << BIT_SHIFT_CTRLR0_SRL)
|
||||||
|
#define BIT_INVC_CTRLR0_SRL (~(BIT_MASK_CTRLR0_SRL << BIT_SHIFT_CTRLR0_SRL))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_CTRLR0_CFS 12
|
||||||
|
#define BIT_MASK_CTRLR0_CFS 0xF
|
||||||
|
#define BIT_CTRLR0_CFS(x)(((x) & BIT_MASK_CTRLR0_CFS) << BIT_SHIFT_CTRLR0_CFS)
|
||||||
|
#define BIT_INVC_CTRLR0_CFS (~(BIT_MASK_CTRLR0_CFS << BIT_SHIFT_CTRLR0_CFS))
|
||||||
|
|
||||||
|
// CTRLR1 0x04 // 16 bits
|
||||||
|
#define BIT_SHIFT_CTRLR1_NDF 0
|
||||||
|
#define BIT_MASK_CTRLR1_NDF 0xFFFF
|
||||||
|
#define BIT_CTRLR1_NDF(x)(((x) & BIT_MASK_CTRLR1_NDF) << BIT_SHIFT_CTRLR1_NDF)
|
||||||
|
#define BIT_INVC_CTRLR1_NDF (~(BIT_MASK_CTRLR1_NDF << BIT_SHIFT_CTRLR1_NDF))
|
||||||
|
|
||||||
|
// SSIENR 0x08 // 1 bit
|
||||||
|
#define BIT_SHIFT_SSIENR_SSI_EN 0
|
||||||
|
#define BIT_MASK_SSIENR_SSI_EN 0x1
|
||||||
|
#define BIT_SSIENR_SSI_EN(x)(((x) & BIT_MASK_SSIENR_SSI_EN) << BIT_SHIFT_SSIENR_SSI_EN)
|
||||||
|
#define BIT_INVC_SSIENR_SSI_EN (~(BIT_MASK_SSIENR_SSI_EN << BIT_SHIFT_SSIENR_SSI_EN))
|
||||||
|
|
||||||
|
// MWCR 0x0c // 3 bits
|
||||||
|
#define BIT_SHIFT_MWCR_MWMOD 0
|
||||||
|
#define BIT_MASK_MWCR_MWMOD 0x1
|
||||||
|
#define BIT_MWCR_MWMOD(x)(((x) & BIT_MASK_MWCR_MWMOD) << BIT_SHIFT_MWCR_MWMOD)
|
||||||
|
#define BIT_INVC_MWCR_MWMOD (~(BIT_MASK_MWCR_MWMOD << BIT_SHIFT_MWCR_MWMOD))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_MWCR_MDD 1
|
||||||
|
#define BIT_MASK_MWCR_MDD 0x1
|
||||||
|
#define BIT_MWCR_MDD(x)(((x) & BIT_MASK_MWCR_MDD) << BIT_SHIFT_MWCR_MDD)
|
||||||
|
#define BIT_INVC_MWCR_MDD (~(BIT_MASK_MWCR_MDD << BIT_SHIFT_MWCR_MDD))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_MWCR_MHS 2
|
||||||
|
#define BIT_MASK_MWCR_MHS 0x1
|
||||||
|
#define BIT_MWCR_MHS(x)(((x) & BIT_MASK_MWCR_MHS) << BIT_SHIFT_MWCR_MHS)
|
||||||
|
#define BIT_INVC_MWCR_MHS (~(BIT_MASK_MWCR_MHS << BIT_SHIFT_MWCR_MHS))
|
||||||
|
|
||||||
|
// SER 0x10 // Variable Length
|
||||||
|
#define BIT_SHIFT_SER_SER 0
|
||||||
|
#define BIT_MASK_SER_SER 0xFF
|
||||||
|
#define BIT_SER_SER(x)(((x) & BIT_MASK_SER_SER) << BIT_SHIFT_SER_SER)
|
||||||
|
#define BIT_INVC_SER_SER (~(BIT_MASK_SER_SER << BIT_SHIFT_SER_SER))
|
||||||
|
|
||||||
|
// BAUDR 0x14 // 16 bits
|
||||||
|
#define BIT_SHIFT_BAUDR_SCKDV 0
|
||||||
|
#define BIT_MASK_BAUDR_SCKDV 0xFFFF
|
||||||
|
#define BIT_BAUDR_SCKDV(x)(((x) & BIT_MASK_BAUDR_SCKDV) << BIT_SHIFT_BAUDR_SCKDV)
|
||||||
|
#define BIT_INVC_BAUDR_SCKDV (~(BIT_MASK_BAUDR_SCKDV << BIT_SHIFT_BAUDR_SCKDV))
|
||||||
|
|
||||||
|
// TXFLTR 0x18 // Variable Length
|
||||||
|
#define BIT_SHIFT_TXFTLR_TFT 0
|
||||||
|
#define BIT_MASK_TXFTLR_TFT 0x3F // (TX_ABW-1):0
|
||||||
|
#define BIT_TXFTLR_TFT(x)(((x) & BIT_MASK_TXFTLR_TFT) << BIT_SHIFT_TXFTLR_TFT)
|
||||||
|
#define BIT_INVC_TXFTLR_TFT (~(BIT_MASK_TXFTLR_TFT << BIT_SHIFT_TXFTLR_TFT))
|
||||||
|
|
||||||
|
// RXFLTR 0x1c // Variable Length
|
||||||
|
#define BIT_SHIFT_RXFTLR_RFT 0
|
||||||
|
#define BIT_MASK_RXFTLR_RFT 0x3F // (RX_ABW-1):0
|
||||||
|
#define BIT_RXFTLR_RFT(x)(((x) & BIT_MASK_RXFTLR_RFT) << BIT_SHIFT_RXFTLR_RFT)
|
||||||
|
#define BIT_INVC_RXFTLR_RFT (~(BIT_MASK_RXFTLR_RFT << BIT_SHIFT_RXFTLR_RFT))
|
||||||
|
|
||||||
|
// TXFLR 0x20 // see [READ ONLY]
|
||||||
|
#define BIT_MASK_TXFLR_TXTFL 0x7F // (TX_ABW):0
|
||||||
|
|
||||||
|
// RXFLR 0x24 // see [READ ONLY]
|
||||||
|
#define BIT_MASK_RXFLR_RXTFL 0x7F // (RX_ABW):0
|
||||||
|
|
||||||
|
// SR 0x28 // 7 bits [READ ONLY]
|
||||||
|
#define BIT_SR_BUSY BIT0
|
||||||
|
#define BIT_SR_TFNF BIT1
|
||||||
|
#define BIT_SR_TFE BIT2
|
||||||
|
#define BIT_SR_RFNE BIT3
|
||||||
|
#define BIT_SR_RFF BIT4
|
||||||
|
#define BIT_SR_TXE BIT5
|
||||||
|
#define BIT_SR_DCOL BIT6
|
||||||
|
|
||||||
|
// IMR 0x2c // see
|
||||||
|
#define BIT_SHIFT_IMR_TXEIM 0
|
||||||
|
#define BIT_MASK_IMR_TXEIM 0x1
|
||||||
|
// #define BIT_IMR_TXEIM(x)(((x) & BIT_MASK_IMR_TXEIM) << BIT_SHIFT_IMR_TXEIM)
|
||||||
|
#define BIT_INVC_IMR_TXEIM (~(BIT_MASK_IMR_TXEIM << BIT_SHIFT_IMR_TXEIM))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IMR_TXOIM 1
|
||||||
|
#define BIT_MASK_IMR_TXOIM 0x1
|
||||||
|
// #define BIT_IMR_TXOIM(x)(((x) & BIT_MASK_IMR_TXOIM) << BIT_SHIFT_IMR_TXOIM)
|
||||||
|
#define BIT_INVC_IMR_TXOIM (~(BIT_MASK_IMR_TXOIM << BIT_SHIFT_IMR_TXOIM))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IMR_RXUIM 2
|
||||||
|
#define BIT_MASK_IMR_RXUIM 0x1
|
||||||
|
// #define BIT_IMR_RXUIM(x)(((x) & BIT_MASK_IMR_RXUIM) << BIT_SHIFT_IMR_RXUIM)
|
||||||
|
#define BIT_INVC_IMR_RXUIM (~(BIT_MASK_IMR_RXUIM << BIT_SHIFT_IMR_RXUIM))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IMR_RXOIM 3
|
||||||
|
#define BIT_MASK_IMR_RXOIM 0x1
|
||||||
|
// #define BIT_IMR_RXOIM(x)(((x) & BIT_MASK_IMR_RXOIM) << BIT_SHIFT_IMR_RXOIM)
|
||||||
|
#define BIT_INVC_IMR_RXOIM (~(BIT_MASK_IMR_RXOIM << BIT_SHIFT_IMR_RXOIM))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IMR_RXFIM 4
|
||||||
|
#define BIT_MASK_IMR_RXFIM 0x1
|
||||||
|
// #define BIT_IMR_RXFIM(x)(((x) & BIT_MASK_IMR_RXFIM) << BIT_SHIFT_IMR_RXFIM)
|
||||||
|
#define BIT_INVC_IMR_RXFIM (~(BIT_MASK_IMR_RXFIM << BIT_SHIFT_IMR_RXFIM))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_IMR_MSTIM 5
|
||||||
|
#define BIT_MASK_IMR_MSTIM 0x1
|
||||||
|
// #define BIT_IMR_MSTIM(x)(((x) & BIT_MASK_IMR_MSTIM) << BIT_SHIFT_IMR_MSTIM)
|
||||||
|
#define BIT_INVC_IMR_MSTIM (~(BIT_MASK_IMR_MSTIM << BIT_SHIFT_IMR_MSTIM))
|
||||||
|
|
||||||
|
#define BIT_IMR_TXEIM BIT0
|
||||||
|
#define BIT_IMR_TXOIM BIT1
|
||||||
|
#define BIT_IMR_RXUIM BIT2
|
||||||
|
#define BIT_IMR_RXOIM BIT3
|
||||||
|
#define BIT_IMR_RXFIM BIT4
|
||||||
|
#define BIT_IMR_MSTIM BIT5
|
||||||
|
|
||||||
|
// ISR 0x30 // 6 bits [READ ONLY]
|
||||||
|
#define BIT_ISR_TXEIS BIT0
|
||||||
|
#define BIT_ISR_TXOIS BIT1
|
||||||
|
#define BIT_ISR_RXUIS BIT2
|
||||||
|
#define BIT_ISR_RXOIS BIT3
|
||||||
|
#define BIT_ISR_RXFIS BIT4
|
||||||
|
#define BIT_ISR_MSTIS BIT5
|
||||||
|
|
||||||
|
// RISR 0x34 // 6 bits [READ ONLY]
|
||||||
|
#define BIT_RISR_TXEIR BIT0
|
||||||
|
#define BIT_RISR_TXOIR BIT1
|
||||||
|
#define BIT_RISR_RXUIR BIT2
|
||||||
|
#define BIT_RISR_RXOIR BIT3
|
||||||
|
#define BIT_RISR_RXFIR BIT4
|
||||||
|
#define BIT_RISR_MSTIR BIT5
|
||||||
|
|
||||||
|
// TXOICR 0x38 // 1 bits [READ ONLY]
|
||||||
|
// RXOICR 0x3c // 1 bits [READ ONLY]
|
||||||
|
// RXUICR 0x40 // 1 bits [READ ONLY]
|
||||||
|
// MSTICR 0x44 // 1 bits [READ ONLY]
|
||||||
|
// ICR 0x48 // 1 bits [READ ONLY]
|
||||||
|
|
||||||
|
// DMACR 0x4c // 2 bits
|
||||||
|
#define BIT_SHIFT_DMACR_RDMAE 0
|
||||||
|
#define BIT_MASK_DMACR_RDMAE 0x1
|
||||||
|
#define BIT_DMACR_RDMAE(x)(((x) & BIT_MASK_DMACR_RDMAE) << BIT_SHIFT_DMACR_RDMAE)
|
||||||
|
#define BIT_INVC_DMACR_RDMAE (~(BIT_MASK_DMACR_RDMAE << BIT_SHIFT_DMACR_RDMAE))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_DMACR_TDMAE 1
|
||||||
|
#define BIT_MASK_DMACR_TDMAE 0x1
|
||||||
|
#define BIT_DMACR_TDMAE(x)(((x) & BIT_MASK_DMACR_TDMAE) << BIT_SHIFT_DMACR_TDMAE)
|
||||||
|
#define BIT_INVC_DMACR_TDMAE (~(BIT_MASK_DMACR_TDMAE << BIT_SHIFT_DMACR_TDMAE))
|
||||||
|
|
||||||
|
// DMATDLR 0x50
|
||||||
|
#define BIT_SHIFT_DMATDLR_DMATDL 0
|
||||||
|
#define BIT_MASK_DMATDLR_DMATDL 0x3F // (TX_ABW-1):0
|
||||||
|
#define BIT_DMATDLR_DMATDL(x)(((x) & BIT_MASK_DMATDLR_DMATDL) << BIT_SHIFT_DMATDLR_DMATDL)
|
||||||
|
#define BIT_INVC_DMATDLR_DMATDL (~(BIT_MASK_DMATDLR_DMATDL << BIT_SHIFT_DMATDLR_DMATDL))
|
||||||
|
|
||||||
|
// DMARDLR 0x54
|
||||||
|
#define BIT_SHIFT_DMARDLR_DMARDL 0
|
||||||
|
#define BIT_MASK_DMARDLR_DMARDL 0x3F // (RX_ABW-1):0
|
||||||
|
#define BIT_DMARDLR_DMARDL(x)(((x) & BIT_MASK_DMARDLR_DMARDL) << BIT_SHIFT_DMARDLR_DMARDL)
|
||||||
|
#define BIT_INVC_DMARDLR_DMARDL (~(BIT_MASK_DMARDLR_DMARDL << BIT_SHIFT_DMARDLR_DMARDL))
|
||||||
|
|
||||||
|
// IDR 0x58 // 32 bits [READ ONLY]
|
||||||
|
// COMP_VERSION 0x5c // 32 bits [READ ONLY]
|
||||||
|
|
||||||
|
// DR 0x60 // 16 bits 0x60-0xEC
|
||||||
|
#define BIT_SHIFT_DR_DR 0
|
||||||
|
#define BIT_MASK_DR_DR 0xFFFF
|
||||||
|
#define BIT_DR_DR(x)(((x) & BIT_MASK_DR_DR) << BIT_SHIFT_DR_DR)
|
||||||
|
#define BIT_INVC_DR_DR (~(BIT_MASK_DR_DR << BIT_SHIFT_DR_DR))
|
||||||
|
|
||||||
|
// RX_SAMPLE_DLY 0xF0 // 8 bits
|
||||||
|
#define BIT_SHIFT_RX_SAMPLE_DLY_RSD 0
|
||||||
|
#define BIT_MASK_RX_SAMPLE_DLY_RSD 0xFFFF
|
||||||
|
#define BIT_RX_SAMPLE_DLY_RSD(x)(((x) & BIT_MASK_RX_SAMPLE_DLY_RSD) << BIT_SHIFT_RX_SAMPLE_DLY_RSD)
|
||||||
|
#define BIT_INVC_RX_SAMPLE_DLY_RSD (~(BIT_MASK_RX_SAMPLE_DLY_RSD << BIT_SHIFT_RX_SAMPLE_DLY_RSD))
|
||||||
|
|
||||||
|
// RSVD_0 0xF4 // 32 bits
|
||||||
|
// RSVD_1 0xF8 // 32 bits
|
||||||
|
// RSVD_2 0xFC // 32 bits
|
||||||
|
|
||||||
|
// SSI0 Pinmux
|
||||||
|
#define BIT_SHIFT_SSI0_PIN_EN 0
|
||||||
|
#define BIT_MASK_SSI0_PIN_EN 0x1
|
||||||
|
#define BIT_SSI0_PIN_EN(x)(((x) & BIT_MASK_SSI0_PIN_EN) << BIT_SHIFT_SSI0_PIN_EN)
|
||||||
|
#define BIT_INVC_SSI0_PIN_EN (~(BIT_MASK_SSI0_PIN_EN << BIT_SHIFT_SSI0_PIN_EN))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_SSI0_PIN_SEL 1
|
||||||
|
#define BIT_MASK_SSI0_PIN_SEL 0x7
|
||||||
|
#define BIT_SSI0_PIN_SEL(x)(((x) & BIT_MASK_SSI0_PIN_SEL) << BIT_SHIFT_SSI0_PIN_SEL)
|
||||||
|
#define BIT_INVC_SSI0_PIN_SEL (~(BIT_MASK_SSI0_PIN_SEL << BIT_SHIFT_SSI0_PIN_SEL))
|
||||||
|
|
||||||
|
// SSI1 Pinmux
|
||||||
|
#define BIT_SHIFT_SSI1_PIN_EN 4
|
||||||
|
#define BIT_MASK_SSI1_PIN_EN 0x1
|
||||||
|
#define BIT_SSI1_PIN_EN(x)(((x) & BIT_MASK_SSI1_PIN_EN) << BIT_SHIFT_SSI1_PIN_EN)
|
||||||
|
#define BIT_INVC_SSI1_PIN_EN (~(BIT_MASK_SSI1_PIN_EN << BIT_SHIFT_SSI1_PIN_EN))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_SSI1_PIN_SEL 5
|
||||||
|
#define BIT_MASK_SSI1_PIN_SEL 0x7
|
||||||
|
#define BIT_SSI1_PIN_SEL(x)(((x) & BIT_MASK_SSI1_PIN_SEL) << BIT_SHIFT_SSI1_PIN_SEL)
|
||||||
|
#define BIT_INVC_SSI1_PIN_SEL (~(BIT_MASK_SSI1_PIN_SEL << BIT_SHIFT_SSI1_PIN_SEL))
|
||||||
|
|
||||||
|
// SSI2 Pinmux
|
||||||
|
#define BIT_SHIFT_SSI2_PIN_EN 8
|
||||||
|
#define BIT_MASK_SSI2_PIN_EN 0x1
|
||||||
|
#define BIT_SSI2_PIN_EN(x)(((x) & BIT_MASK_SSI2_PIN_EN) << BIT_SHIFT_SSI2_PIN_EN)
|
||||||
|
#define BIT_INVC_SSI2_PIN_EN (~(BIT_MASK_SSI2_PIN_EN << BIT_SHIFT_SSI2_PIN_EN))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_SSI2_PIN_SEL 9
|
||||||
|
#define BIT_MASK_SSI2_PIN_SEL 0x7
|
||||||
|
#define BIT_SSI2_PIN_SEL(x)(((x) & BIT_MASK_SSI2_PIN_SEL) << BIT_SHIFT_SSI2_PIN_SEL)
|
||||||
|
#define BIT_INVC_SSI2_PIN_SEL (~(BIT_MASK_SSI2_PIN_SEL << BIT_SHIFT_SSI2_PIN_SEL))
|
||||||
|
|
||||||
|
// SSI0 Multiple Chip Selection (Pinmux Select is controlled by BIT_SSI0_PIN_SEL)
|
||||||
|
#define BIT_SHIFT_SSI0_MULTI_CS_EN 28
|
||||||
|
#define BIT_MASK_SSI0_MULTI_CS_EN 0x1
|
||||||
|
#define BIT_SSI0_MULTI_CS_EN(x)(((x) & BIT_MASK_SSI0_MULTI_CS_EN) << BIT_SHIFT_SSI0_MULTI_CS_EN)
|
||||||
|
#define BIT_INVC_SSI0_MULTI_CS_EN (~(BIT_MASK_SSI0_MULTI_CS_EN << BIT_SHIFT_SSI0_MULTI_CS_EN))
|
||||||
|
|
||||||
|
|
||||||
|
#define HAL_SSI_READ32(SsiIndex, addr) \
|
||||||
|
HAL_READ32(SPI0_REG_BASE+ (SsiIndex*SSI_REG_OFF), addr)
|
||||||
|
#define HAL_SSI_WRITE32(SsiIndex, addr, value) \
|
||||||
|
HAL_WRITE32(SPI0_REG_BASE+ (SsiIndex*SSI_REG_OFF), addr, value)
|
||||||
|
#define HAL_SSI_READ16(SsiIndex, addr) \
|
||||||
|
HAL_READ16(SPI0_REG_BASE+ (SsiIndex*SSI_REG_OFF), addr)
|
||||||
|
#define HAL_SSI_WRITE16(SsiIndex, addr, value) \
|
||||||
|
HAL_WRITE16(SPI0_REG_BASE+ (SsiIndex*SSI_REG_OFF), addr, value)
|
||||||
|
#define HAL_SSI_READ8(SsiIndex, addr) \
|
||||||
|
HAL_READ8(SPI0_REG_BASE+ (SsiIndex*SSI_REG_OFF), addr)
|
||||||
|
#define HAL_SSI_WRITE8(SsiIndex, addr, value) \
|
||||||
|
HAL_WRITE8(SPI0_REG_BASE+ (SsiIndex*SSI_REG_OFF), addr, value)
|
||||||
|
|
||||||
|
|
||||||
|
// SSI Pinmux Select
|
||||||
|
typedef enum _SSI0_PINMUX_SELECT_ {
|
||||||
|
SSI0_MUX_TO_GPIOE = S0,
|
||||||
|
SSI0_MUX_TO_GPIOC = S1
|
||||||
|
}SSI0_PINMUX_SELECT, *PSSI0_PINMUX_SELECT;
|
||||||
|
|
||||||
|
typedef enum _SSI1_PINMUX_SELECT_ {
|
||||||
|
SSI1_MUX_TO_GPIOA = S0,
|
||||||
|
SSI1_MUX_TO_GPIOB = S1,
|
||||||
|
SSI1_MUX_TO_GPIOD = S2
|
||||||
|
}SSI1_PINMUX_SELECT, *PSSI1_PINMUX_SELECT;
|
||||||
|
|
||||||
|
typedef enum _SSI2_PINMUX_SELECT_ {
|
||||||
|
SSI2_MUX_TO_GPIOG = S0,
|
||||||
|
SSI2_MUX_TO_GPIOE = S1,
|
||||||
|
SSI2_MUX_TO_GPIOD = S2
|
||||||
|
}SSI2_PINMUX_SELECT, *PSSI2_PINMUX_SELECT;
|
||||||
|
|
||||||
|
typedef enum _SSI0_MULTI_CS_PINMUX_SELECT_ {
|
||||||
|
SSI0_CS_MUX_TO_GPIOE = S0,
|
||||||
|
SSI0_CS_MUX_TO_GPIOC = S1
|
||||||
|
}SSI0_MULTI_CS_PINMUX_SELECT, *PSSI0_MULTI_CS_PINMUX_SELECT;
|
||||||
|
|
||||||
|
typedef enum _SSI_CTRLR0_TMOD_ {
|
||||||
|
TMOD_TR = 0,
|
||||||
|
TMOD_TO = 1,
|
||||||
|
TMOD_RO = 2,
|
||||||
|
TMOD_EEPROM_R = 3
|
||||||
|
}SSI_CTRLR0_TMOD, *PSSI_CTRLR0_TMOD;
|
||||||
|
|
||||||
|
typedef enum _SSI_CTRLR0_SCPOL_ {
|
||||||
|
SCPOL_INACTIVE_IS_LOW = 0,
|
||||||
|
SCPOL_INACTIVE_IS_HIGH = 1
|
||||||
|
}SSI_CTRLR0_SCPOL, *PSSI_CTRLR0_SCPOL;
|
||||||
|
|
||||||
|
typedef enum _SSI_CTRLR0_SCPH_ {
|
||||||
|
SCPH_TOGGLES_IN_MIDDLE = 0,
|
||||||
|
SCPH_TOGGLES_AT_START = 1
|
||||||
|
}SSI_CTRLR0_SCPH, *PSSI_CTRLR0_SCPH;
|
||||||
|
|
||||||
|
typedef enum _SSI_CTRLR0_DFS_ {
|
||||||
|
DFS_4_BITS = 3,
|
||||||
|
DFS_5_BITS = 4,
|
||||||
|
DFS_6_BITS = 5,
|
||||||
|
DFS_7_BITS = 6,
|
||||||
|
DFS_8_BITS = 7,
|
||||||
|
DFS_9_BITS = 8,
|
||||||
|
DFS_10_BITS = 9,
|
||||||
|
DFS_11_BITS = 10,
|
||||||
|
DFS_12_BITS = 11,
|
||||||
|
DFS_13_BITS = 12,
|
||||||
|
DFS_14_BITS = 13,
|
||||||
|
DFS_15_BITS = 14,
|
||||||
|
DFS_16_BITS = 15,
|
||||||
|
}SSI_CTRLR0_DFS, *PSSI_CTRLR0_DFS;
|
||||||
|
|
||||||
|
typedef enum _SSI_CTRLR0_CFS_ {
|
||||||
|
CFS_1_BIT = 0,
|
||||||
|
CFS_2_BITS = 1,
|
||||||
|
CFS_3_BITS = 2,
|
||||||
|
CFS_4_BITS = 3,
|
||||||
|
CFS_5_BITS = 4,
|
||||||
|
CFS_6_BITS = 5,
|
||||||
|
CFS_7_BITS = 6,
|
||||||
|
CFS_8_BITS = 7,
|
||||||
|
CFS_9_BITS = 8,
|
||||||
|
CFS_10_BITS = 9,
|
||||||
|
CFS_11_BITS = 10,
|
||||||
|
CFS_12_BITS = 11,
|
||||||
|
CFS_13_BITS = 12,
|
||||||
|
CFS_14_BITS = 13,
|
||||||
|
CFS_15_BITS = 14,
|
||||||
|
CFS_16_BITS = 15
|
||||||
|
}SSI_CTRLR0_CFS, *PSSI_CTRLR0_CFS;
|
||||||
|
|
||||||
|
typedef enum _SSI_CTRLR0_SLV_OE_ {
|
||||||
|
SLV_TXD_ENABLE = 0,
|
||||||
|
SLV_TXD_DISABLE = 1
|
||||||
|
}SSI_CTRLR0_SLV_OE, *PSSI_CTRLR0_SLV_OE;
|
||||||
|
|
||||||
|
typedef enum _SSI_ROLE_SELECT_ {
|
||||||
|
SSI_SLAVE = 0,
|
||||||
|
SSI_MASTER = 1
|
||||||
|
}SSI_ROLE_SELECT, *PSSI_ROLE_SELECT;
|
||||||
|
|
||||||
|
typedef enum _SSI_FRAME_FORMAT_ {
|
||||||
|
FRF_MOTOROLA_SPI = 0,
|
||||||
|
FRF_TI_SSP = 1,
|
||||||
|
FRF_NS_MICROWIRE = 2,
|
||||||
|
FRF_RSVD = 3
|
||||||
|
}SSI_FRAME_FORMAT, *PSSI_FRAME_FORMAT;
|
||||||
|
|
||||||
|
typedef enum _SSI_DMACR_ENABLE_ {
|
||||||
|
SSI_NODMA = 0,
|
||||||
|
SSI_RXDMA_ENABLE = 1,
|
||||||
|
SSI_TXDMA_ENABLE = 2,
|
||||||
|
SSI_TRDMA_ENABLE = 3
|
||||||
|
}SSI_DMACR_ENABLE, *PSSI_DMACR_ENABLE;
|
||||||
|
|
||||||
|
typedef enum _SSI_MWCR_HANDSHAKE_ {
|
||||||
|
MW_HANDSHAKE_DISABLE = 0,
|
||||||
|
MW_HANDSHAKE_ENABLE = 1
|
||||||
|
}SSI_MWCR_HANDSHAKE, *PSSI_MWCR_HANDSHAKE;
|
||||||
|
|
||||||
|
typedef enum _SSI_MWCR_DIRECTION_ {
|
||||||
|
MW_DIRECTION_SLAVE_TO_MASTER = 0,
|
||||||
|
MW_DIRECTION_MASTER_TO_SLAVE = 1
|
||||||
|
}SSI_MWCR_DIRECTION, *PSSI_MWCR_DIRECTION;
|
||||||
|
|
||||||
|
typedef enum _SSI_MWCR_TMOD_ {
|
||||||
|
MW_TMOD_NONSEQUENTIAL = 0,
|
||||||
|
MW_TMOD_SEQUENTIAL = 1
|
||||||
|
}SSI_MWCR_TMOD, *PSSI_MWCR_TMOD;
|
||||||
|
|
||||||
|
typedef enum _SSI_DATA_TRANSFER_MECHANISM_ {
|
||||||
|
SSI_DTM_BASIC,
|
||||||
|
SSI_DTM_INTERRUPT,
|
||||||
|
SSI_DTM_DMA
|
||||||
|
}SSI_DATA_TRANSFER_MECHANISM, *PSSI_DATA_TRANSFER_MECHANISM;
|
||||||
|
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status HalSsiPinmuxEnableRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ HAL_Status HalSsiEnableRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ HAL_Status HalSsiDisableRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ HAL_Status HalSsiInitRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ HAL_Status HalSsiSetSclkPolarityRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ HAL_Status HalSsiSetSclkPhaseRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ HAL_Status HalSsiWriteRtl8195a(VOID *Adaptor, u32 value);
|
||||||
|
_LONG_CALL_ HAL_Status HalSsiLoadSettingRtl8195a(VOID *Adaptor, VOID *Setting);
|
||||||
|
_LONG_CALL_ HAL_Status HalSsiSetInterruptMaskRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ HAL_Status HalSsiSetDeviceRoleRtl8195a(VOID *Adaptor, u32 Role);
|
||||||
|
_LONG_CALL_ HAL_Status HalSsiInterruptEnableRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ HAL_Status HalSsiInterruptDisableRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ HAL_Status HalSsiReadInterruptRtl8195a(VOID *Adaptor, VOID *RxData, u32 Length);
|
||||||
|
_LONG_CALL_ HAL_Status HalSsiSetRxFifoThresholdLevelRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ HAL_Status HalSsiSetTxFifoThresholdLevelRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ HAL_Status HalSsiWriteInterruptRtl8195a(VOID *Adaptor, VOID *TxData, u32 Length);
|
||||||
|
_LONG_CALL_ HAL_Status HalSsiSetSlaveEnableRegisterRtl8195a(VOID *Adaptor, u32 SlaveIndex);
|
||||||
|
_LONG_CALL_ u32 HalSsiBusyRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ u32 HalSsiWriteableRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ u32 HalSsiReadableRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ u32 HalSsiGetInterruptMaskRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ u32 HalSsiGetRxFifoLevelRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ u32 HalSsiGetTxFifoLevelRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ u32 HalSsiGetStatusRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ u32 HalSsiGetInterruptStatusRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ u32 HalSsiReadRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ u32 HalSsiGetRawInterruptStatusRtl8195a(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ u32 HalSsiGetSlaveEnableRegisterRtl8195a(VOID *Adaptor);
|
||||||
|
|
||||||
|
_LONG_CALL_ VOID _SsiReadInterrupt(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ VOID _SsiWriteInterrupt(VOID *Adaptor);
|
||||||
|
_LONG_CALL_ u32 _SsiIrqHandle(VOID *Adaptor);
|
||||||
|
|
||||||
|
// ROM code patch
|
||||||
|
VOID _SsiReadInterruptRtl8195a(VOID *Adapter);
|
||||||
|
VOID _SsiWriteInterruptRtl8195a(VOID *Adapter);
|
||||||
|
HAL_Status HalSsiInitRtl8195a_Patch(VOID *Adaptor);
|
||||||
|
HAL_Status HalSsiPinmuxEnableRtl8195a_Patch(VOID *Adaptor);
|
||||||
|
HAL_Status HalSsiPinmuxDisableRtl8195a(VOID *Adaptor);
|
||||||
|
HAL_Status HalSsiDeInitRtl8195a(VOID * Adapter);
|
||||||
|
HAL_Status HalSsiClockOffRtl8195a(VOID * Adapter);
|
||||||
|
HAL_Status HalSsiClockOnRtl8195a(VOID * Adapter);
|
||||||
|
VOID HalSsiSetSclkRtl8195a(VOID *Adapter, u32 ClkRate);
|
||||||
|
HAL_Status HalSsiIntReadRtl8195a(VOID *Adapter, VOID *RxData, u32 Length);
|
||||||
|
HAL_Status HalSsiIntWriteRtl8195a(VOID *Adapter, u8 *pTxData, u32 Length);
|
||||||
|
#ifdef CONFIG_GDMA_EN
|
||||||
|
VOID HalSsiTxGdmaLoadDefRtl8195a(VOID *Adapter);
|
||||||
|
VOID HalSsiRxGdmaLoadDefRtl8195a(VOID *Adapter);
|
||||||
|
VOID HalSsiDmaInitRtl8195a(VOID *Adapter);
|
||||||
|
HAL_Status HalSsiDmaSendRtl8195a(VOID *Adapter, u8 *pTxData, u32 Length);
|
||||||
|
HAL_Status HalSsiDmaRecvRtl8195a(VOID *Adapter, u8 *pRxData, u32 Length);
|
||||||
|
#endif // end of "#ifdef CONFIG_GDMA_EN"
|
||||||
|
|
||||||
|
#endif
|
1093
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_sys_on.h
Normal file
1093
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_sys_on.h
Normal file
File diff suppressed because it is too large
Load diff
235
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_timer.h
Normal file
235
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_timer.h
Normal file
|
@ -0,0 +1,235 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _RTL8195A_TIMER_H_
|
||||||
|
#define _RTL8195A_TIMER_H_
|
||||||
|
|
||||||
|
|
||||||
|
#define TIMER_TICK_US 31
|
||||||
|
|
||||||
|
#define TIMER_LOAD_COUNT_OFF 0x00
|
||||||
|
#define TIMER_CURRENT_VAL_OFF 0x04
|
||||||
|
#define TIMER_CTL_REG_OFF 0x08
|
||||||
|
#define TIMER_EOI_OFF 0x0c
|
||||||
|
#define TIMER_INT_STATUS_OFF 0x10
|
||||||
|
#define TIMER_INTERVAL 0x14
|
||||||
|
#define TIMERS_INT_STATUS_OFF 0xa0
|
||||||
|
#define TIMERS_EOI_OFF 0xa4
|
||||||
|
#define TIMERS_RAW_INT_STATUS_OFF 0xa8
|
||||||
|
#define TIMERS_COMP_VER_OFF 0xac
|
||||||
|
|
||||||
|
#define MAX_TIMER_VECTOR_TABLE_NUM 6
|
||||||
|
|
||||||
|
#define HAL_TIMER_READ32(addr) (*((volatile u32*)(TIMER_REG_BASE + addr)))//HAL_READ32(TIMER_REG_BASE, addr)
|
||||||
|
#define HAL_TIMER_WRITE32(addr, value) ((*((volatile u32*)(TIMER_REG_BASE + addr))) = value)//HAL_WRITE32(TIMER_REG_BASE, addr, value)
|
||||||
|
#define HAL_TIMER_READ16(addr) (*((volatile u16*)(TIMER_REG_BASE + addr)))//HAL_READ16(TIMER_REG_BASE, addr)
|
||||||
|
#define HAL_TIMER_WRITE16(addr, value) ((*((volatile u16*)(TIMER_REG_BASE + addr))) = value)//HAL_WRITE16(TIMER_REG_BASE, addr, value)
|
||||||
|
#define HAL_TIMER_READ8(addr) (*((volatile u8*)(TIMER_REG_BASE + addr)))//HAL_READ8(TIMER_REG_BASE, addr)
|
||||||
|
#define HAL_TIMER_WRITE8(addr, value) ((*((volatile u8*)(TIMER_REG_BASE + addr))) = value)//HAL_WRITE8(TIMER_REG_BASE, addr, value)
|
||||||
|
|
||||||
|
_LONG_CALL_ u32
|
||||||
|
HalGetTimerIdRtl8195a(
|
||||||
|
IN u32 *TimerID
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ BOOL
|
||||||
|
HalTimerInitRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ u32
|
||||||
|
HalTimerReadCountRtl8195a(
|
||||||
|
IN u32 TimerId
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ VOID
|
||||||
|
HalTimerIrqClearRtl8195a(
|
||||||
|
IN u32 TimerId
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ VOID
|
||||||
|
HalTimerDisRtl8195a(
|
||||||
|
IN u32 TimerId
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ VOID
|
||||||
|
HalTimerEnRtl8195a(
|
||||||
|
IN u32 TimerId
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ VOID
|
||||||
|
HalTimerDumpRegRtl8195a(
|
||||||
|
IN u32 TimerId
|
||||||
|
);
|
||||||
|
|
||||||
|
// ROM Code patch
|
||||||
|
HAL_Status
|
||||||
|
HalTimerInitRtl8195a_Patch(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
u32
|
||||||
|
HalTimerReadCountRtl8195a_Patch(
|
||||||
|
IN u32 TimerId
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalTimerReLoadRtl8195a_Patch(
|
||||||
|
IN u32 TimerId,
|
||||||
|
IN u32 LoadUs
|
||||||
|
);
|
||||||
|
|
||||||
|
u32
|
||||||
|
HalTimerReadCountRtl8195a_Patch(
|
||||||
|
IN u32 TimerId
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalTimerIrqEnRtl8195a(
|
||||||
|
IN u32 TimerId
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalTimerIrqDisRtl8195a(
|
||||||
|
IN u32 TimerId
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalTimerClearIsrRtl8195a(
|
||||||
|
IN u32 TimerId
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalTimerEnRtl8195a_Patch(
|
||||||
|
IN u32 TimerId
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalTimerDisRtl8195a_Patch(
|
||||||
|
IN u32 TimerId
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalTimerDeInitRtl8195a_Patch(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
#ifdef CONFIG_CHIP_C_CUT
|
||||||
|
|
||||||
|
__weak _LONG_CALL_
|
||||||
|
VOID
|
||||||
|
HalTimerIrq2To7HandleV02(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
__weak _LONG_CALL_
|
||||||
|
HAL_Status
|
||||||
|
HalTimerIrqRegisterRtl8195aV02(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
__weak _LONG_CALL_
|
||||||
|
HAL_Status
|
||||||
|
HalTimerInitRtl8195aV02(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
__weak _LONG_CALL_
|
||||||
|
u32
|
||||||
|
HalTimerReadCountRtl8195aV02(
|
||||||
|
IN u32 TimerId
|
||||||
|
);
|
||||||
|
|
||||||
|
__weak _LONG_CALL_
|
||||||
|
VOID
|
||||||
|
HalTimerReLoadRtl8195aV02(
|
||||||
|
IN u32 TimerId,
|
||||||
|
IN u32 LoadUs
|
||||||
|
);
|
||||||
|
|
||||||
|
__weak _LONG_CALL_
|
||||||
|
HAL_Status
|
||||||
|
HalTimerIrqUnRegisterRtl8195aV02(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
__weak _LONG_CALL_
|
||||||
|
VOID
|
||||||
|
HalTimerDeInitRtl8195aV02(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif // end of "#ifdef CONFIG_CHIP_C_CUT"
|
||||||
|
|
||||||
|
// HAL functions wrapper
|
||||||
|
static __inline HAL_Status
|
||||||
|
HalTimerInit(
|
||||||
|
IN VOID *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return (HalTimerInitRtl8195a_Patch(Data));
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline VOID
|
||||||
|
HalTimerEnable(
|
||||||
|
IN u32 TimerId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HalTimerIrqEnRtl8195a(TimerId);
|
||||||
|
HalTimerEnRtl8195a_Patch(TimerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline VOID
|
||||||
|
HalTimerDisable(
|
||||||
|
IN u32 TimerId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HalTimerDisRtl8195a_Patch(TimerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline VOID
|
||||||
|
HalTimerClearIsr(
|
||||||
|
IN u32 TimerId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HalTimerClearIsrRtl8195a(TimerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline VOID
|
||||||
|
HalTimerReLoad(
|
||||||
|
IN u32 TimerId,
|
||||||
|
IN u32 LoadUs
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HalTimerReLoadRtl8195a_Patch(TimerId, LoadUs);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef CONFIG_CHIP_C_CUT
|
||||||
|
|
||||||
|
static __inline VOID
|
||||||
|
HalTimerDeInit(
|
||||||
|
IN VOID *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HalTimerDeInitRtl8195a_Patch(Data);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
static __inline VOID
|
||||||
|
HalTimerDeInit(
|
||||||
|
IN VOID *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HalTimerDeInitRtl8195aV02(Data);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // end of "#ifndef CONFIG_CHIP_C_CUT"
|
||||||
|
|
||||||
|
#endif //_RTL8195A_TIMER_H_
|
532
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_uart.h
Normal file
532
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_uart.h
Normal file
|
@ -0,0 +1,532 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _RTL8195A_UART_H_
|
||||||
|
#define _RTL8195A_UART_H_
|
||||||
|
|
||||||
|
#define MAX_UART_INDEX 2
|
||||||
|
|
||||||
|
#define RUART_DLL_OFF 0x00
|
||||||
|
#define RUART_DLM_OFF 0x04 //RW, DLAB = 1
|
||||||
|
#define RUART_INTERRUPT_EN_REG_OFF 0x04
|
||||||
|
#define RUART_IER_ERBI 0x01 //BIT0, Enable Received Data Available Interrupt (rx trigger)
|
||||||
|
#define RUART_IER_ETBEI (1<<1) //BIT1, Enable Transmitter FIFO Empty Interrupt (tx fifo empty)
|
||||||
|
#define RUART_IER_ELSI (1<<2) //BIT2, Enable Receiver Line Status Interrupt (receiver line status)
|
||||||
|
#define RUART_IER_EDSSI (1<<3) //BIT3, Enable Modem Status Interrupt (modem status transition)
|
||||||
|
|
||||||
|
#define RUART_INT_ID_REG_OFF 0x08 //[R]
|
||||||
|
#define RUART_IIR_INT_PEND 0x01
|
||||||
|
#define RUART_IIR_INT_ID (0x07<<1) //011(3), 010(2), 110(6), 001(1), 000(0)
|
||||||
|
#define RUART_FIFO_CTL_REG_OFF 0x08 //[W]
|
||||||
|
#define RUART_FIFO_CTL_REG_CLEAR_RXFIFO (1<<1) //BIT1, 0x02, Write 1 clear
|
||||||
|
#define RUART_FIFO_CTL_REG_CLEAR_TXFIFO (1<<2) //BIT2, 0x04, Write 1 clear
|
||||||
|
#define RUART_FIFO_CTL_REG_DMA_ENABLE 0x08 //BIT3
|
||||||
|
|
||||||
|
#define FIFO_CTL_DEFAULT_WITH_FIFO_DMA 0xC9
|
||||||
|
#define FIFO_CTL_DEFAULT_WITH_FIFO 0xC1
|
||||||
|
|
||||||
|
#define RUART_MODEM_CTL_REG_OFF 0x10
|
||||||
|
#define RUART_MCR_RTS BIT1
|
||||||
|
#define RUART_MCL_AUTOFLOW_ENABLE (1<<5) //BIT5, 0x20
|
||||||
|
|
||||||
|
#define RUART_LINE_CTL_REG_OFF 0x0C
|
||||||
|
#define RUART_LINE_CTL_REG_DLAB_ENABLE (1<<7) //BIT7, 0x80
|
||||||
|
|
||||||
|
#define RUART_LINE_STATUS_REG_OFF 0x14
|
||||||
|
#define RUART_LINE_STATUS_REG_DR 0x01 //BIT0, Data Ready indicator
|
||||||
|
#define RUART_LINE_STATUS_ERR_OVERRUN (1<<1) //BIT1, Over Run
|
||||||
|
#define RUART_LINE_STATUS_ERR_PARITY (1<<2) //BIT2, Parity error
|
||||||
|
#define RUART_LINE_STATUS_ERR_FRAMING (1<<3) //BIT3, Framing error
|
||||||
|
#define RUART_LINE_STATUS_ERR_BREAK (1<<4) //BIT4, Break interrupt error
|
||||||
|
#define RUART_LINE_STATUS_REG_THRE (1<<5) //BIT5, 0x20, Transmit Holding Register Empty Interrupt enable
|
||||||
|
#define RUART_LINE_STATUS_REG_TEMT (1<<6) //BIT6, 0x40, Transmitter Empty indicator(bit)
|
||||||
|
#define RUART_LINE_STATUS_ERR_RXFIFO (1<<7) //BIT7, RX FIFO error
|
||||||
|
#define RUART_LINE_STATUS_ERR (RUART_LINE_STATUS_ERR_OVERRUN|RUART_LINE_STATUS_ERR_PARITY| \
|
||||||
|
RUART_LINE_STATUS_ERR_FRAMING|RUART_LINE_STATUS_ERR_BREAK| \
|
||||||
|
RUART_LINE_STATUS_ERR_RXFIFO) //Line status error
|
||||||
|
|
||||||
|
#define RUART_MODEM_STATUS_REG_OFF 0x18 //Modem Status Register
|
||||||
|
#define RUART_SCRATCH_PAD_REG_OFF 0x1C //Scratch Pad Register
|
||||||
|
#define RUART_SP_REG_RXBREAK_INT_STATUS (1<<7) //BIT7, 0x80, Write 1 clear
|
||||||
|
#define RUART_SP_REG_DBG_SEL (0x0F<<8) //[11:8], Debug port selection
|
||||||
|
#define RUART_SP_REG_XFACTOR_ADJ (0x7FF<<16) //[26:16]
|
||||||
|
|
||||||
|
#define RUART_STS_REG_OFF 0x20
|
||||||
|
#define RUART_STS_REG_RESET_RCV (1<<3) //BIT3, 0x08, Reset Uart Receiver
|
||||||
|
#define RUART_STS_REG_XFACTOR 0xF<<4
|
||||||
|
|
||||||
|
#define RUART_REV_BUF_REG_OFF 0x24 //Receiver Buffer Register
|
||||||
|
#define RUART_TRAN_HOLD_REG_OFF 0x24 //Transmitter Holding Register
|
||||||
|
|
||||||
|
#define RUART_MISC_CTL_REG_OFF 0x28
|
||||||
|
#define RUART_TXDMA_BURSTSIZE_MASK 0xF8 //7:3
|
||||||
|
#define RUART_RXDMA_BURSTSIZE_MASK 0x1F00 //12:8
|
||||||
|
|
||||||
|
#define RUART_DEBUG_REG_OFF 0x3C
|
||||||
|
|
||||||
|
// RUART_LINE_CTL_REG_OFF (0x0C)
|
||||||
|
#define BIT_SHIFT_LCR_WLS 0 // word length select: 0: 7 bits, 1: 8bits
|
||||||
|
#define BIT_MASK_LCR_WLS_8BITS 0x1
|
||||||
|
#define BIT_LCR_WLS(x)(((x) & BIT_MASK_LCR_WLS_8BITS) << BIT_SHIFT_LCR_WLS)
|
||||||
|
#define BIT_CLR_LCR_WLS (~(BIT_MASK_LCR_WLS_8BITS << BIT_SHIFT_LCR_WLS))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_LCR_STB 2 // Stop bit select: 0: no stop bit, 1: 1 stop bit
|
||||||
|
#define BIT_MASK_LCR_STB_EN 0x1
|
||||||
|
#define BIT_LCR_STB_EN(x)(((x) & BIT_MASK_LCR_STB_EN) << BIT_SHIFT_LCR_STB)
|
||||||
|
#define BIT_INVC_LCR_STB_EN (~(BIT_MASK_LCR_STB_EN << BIT_SHIFT_LCR_STB))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_LCR_PARITY_EN 3
|
||||||
|
#define BIT_MASK_LCR_PARITY_EN 0x1
|
||||||
|
#define BIT_LCR_PARITY_EN(x)(((x) & BIT_MASK_LCR_PARITY_EN) << BIT_SHIFT_LCR_PARITY_EN)
|
||||||
|
#define BIT_INVC_LCR_PARITY_EN (~(BIT_MASK_LCR_PARITY_EN << BIT_SHIFT_LCR_PARITY_EN))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_LCR_PARITY_TYPE 4
|
||||||
|
#define BIT_MASK_LCR_PARITY_TYPE 0x1
|
||||||
|
#define BIT_LCR_PARITY_TYPE(x)(((x) & BIT_MASK_LCR_PARITY_TYPE) << BIT_SHIFT_LCR_PARITY_TYPE)
|
||||||
|
#define BIT_INVC_LCR_PARITY_TYPE (~(BIT_MASK_LCR_PARITY_TYPE << BIT_SHIFT_LCR_PARITY_TYPE))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_LCR_STICK_PARITY_EN 5
|
||||||
|
#define BIT_MASK_LCR_STICK_PARITY_EN 0x1
|
||||||
|
#define BIT_LCR_STICK_PARITY_EN(x)(((x) & BIT_MASK_LCR_STICK_PARITY_EN) << BIT_SHIFT_LCR_STICK_PARITY_EN)
|
||||||
|
#define BIT_INVC_LCR_STICK_PARITY_EN (~(BIT_MASK_LCR_STICK_PARITY_EN << BIT_SHIFT_LCR_STICK_PARITY_EN))
|
||||||
|
|
||||||
|
#define BIT_SHIFT_LCR_BREAK_CTRL 6
|
||||||
|
#define BIT_MASK_LCR_BREAK_CTRL 0x1
|
||||||
|
#define BIT_UART_LCR_BREAK_CTRL ((BIT_MASK_LCR_BREAK_CTRL) << BIT_SHIFT_LCR_BREAK_CTRL)
|
||||||
|
|
||||||
|
#define RUART_BAUD_RATE_2400 2400
|
||||||
|
#define RUART_BAUD_RATE_4800 4800
|
||||||
|
#define RUART_BAUD_RATE_9600 9600
|
||||||
|
#define RUART_BAUD_RATE_19200 19200
|
||||||
|
#define RUART_BAUD_RATE_38400 38400
|
||||||
|
#define RUART_BAUD_RATE_57600 57600
|
||||||
|
#define RUART_BAUD_RATE_115200 115200
|
||||||
|
#define RUART_BAUD_RATE_921600 921600
|
||||||
|
#define RUART_BAUD_RATE_1152000 1152000
|
||||||
|
|
||||||
|
#define HAL_RUART_READ32(UartIndex, addr) \
|
||||||
|
HAL_READ32(UART0_REG_BASE+ (UartIndex*RUART_REG_OFF), addr)
|
||||||
|
#define HAL_RUART_WRITE32(UartIndex, addr, value) \
|
||||||
|
HAL_WRITE32(UART0_REG_BASE+ (UartIndex*RUART_REG_OFF), addr, value)
|
||||||
|
#define HAL_RUART_READ16(UartIndex, addr) \
|
||||||
|
HAL_READ16(UART0_REG_BASE+ (UartIndex*RUART_REG_OFF), addr)
|
||||||
|
#define HAL_RUART_WRITE16(UartIndex, addr, value) \
|
||||||
|
HAL_WRITE16(UART0_REG_BASE+ (UartIndex*RUART_REG_OFF), addr, value)
|
||||||
|
#define HAL_RUART_READ8(UartIndex, addr) \
|
||||||
|
HAL_READ8(UART0_REG_BASE+ (UartIndex*RUART_REG_OFF), addr)
|
||||||
|
#define HAL_RUART_WRITE8(UartIndex, addr, value) \
|
||||||
|
HAL_WRITE8(UART0_REG_BASE+ (UartIndex*RUART_REG_OFF), addr, value)
|
||||||
|
|
||||||
|
#define UART_OVSR_POOL_MIN 1000
|
||||||
|
#define UART_OVSR_POOL_MAX 2090
|
||||||
|
#define DIVISOR_RESOLUTION 10
|
||||||
|
#define JITTER_LIMIT 100
|
||||||
|
#define UART_SCLK (200000000*5/12)
|
||||||
|
|
||||||
|
typedef struct _RUART_SPEED_SETTING_ {
|
||||||
|
u32 BaudRate;
|
||||||
|
u32 Ovsr;
|
||||||
|
u32 Div;
|
||||||
|
u16 Ovsr_adj;
|
||||||
|
u8 Ovsr_adj_max_bits; // 9: No parity, 10: with Parity
|
||||||
|
u8 Ovsr_adj_bits;
|
||||||
|
u16 *Ovsr_adj_map;
|
||||||
|
u32 max_err; // 10 ~ 100: 30
|
||||||
|
u32 Ovsr_min; // 10 ~ 20: 1000
|
||||||
|
u32 Ovsr_max; // 10 ~ 20: 2000
|
||||||
|
u32 divisor_resolution; // 1 ~ 20: 10
|
||||||
|
u32 jitter_lim; // 50 ~ 100: 100
|
||||||
|
u32 sclk; // 83.33333 MHz
|
||||||
|
}RUART_SPEED_SETTING, *PRUART_SPEED_SETTING;
|
||||||
|
|
||||||
|
typedef enum _UART_RXFIFO_TRIGGER_LEVEL_ {
|
||||||
|
OneByte = 0x00,
|
||||||
|
FourBytes = 0x01,
|
||||||
|
EightBytes = 0x10,
|
||||||
|
FourteenBytes = 0x11
|
||||||
|
}UART_RXFIFO_TRIGGER_LEVEL, *PUART_RXFIFO_TRIGGER_LEVEL;
|
||||||
|
|
||||||
|
typedef enum _RUART0_PINMUX_SELECT_ {
|
||||||
|
RUART0_MUX_TO_GPIOC = S0,
|
||||||
|
RUART0_MUX_TO_GPIOE = S1,
|
||||||
|
RUART0_MUX_TO_GPIOA = S2
|
||||||
|
}RUART0_PINMUX_SELECT, *PRUART0_PINMUX_SELECT;
|
||||||
|
|
||||||
|
typedef enum _RUART1_PINMUX_SELECT_ {
|
||||||
|
RUART1_MUX_TO_GPIOD = S0,
|
||||||
|
RUART1_MUX_TO_GPIOE = S1,
|
||||||
|
RUART1_MUX_TO_GPIOB = S2
|
||||||
|
}RUART1_PINMUX_SELECT, *PRUART1_PINMUX_SELECT;
|
||||||
|
|
||||||
|
typedef enum _RUART2_PINMUX_SELECT_ {
|
||||||
|
RUART2_MUX_TO_GPIOA = S0,
|
||||||
|
RUART2_MUX_TO_GPIOC = S1,
|
||||||
|
RUART2_MUX_TO_GPIOD = S2
|
||||||
|
}RUART2_PINMUX_SELECT, *PRUART2_PINMUX_SELECT;
|
||||||
|
|
||||||
|
typedef enum _RUART_FLOW_CONTROL_ {
|
||||||
|
AUTOFLOW_DISABLE = 0,
|
||||||
|
AUTOFLOW_ENABLE = 1
|
||||||
|
}RUART_FLOW_CONTROL, *PRUART_FLOW_CONTROL;
|
||||||
|
|
||||||
|
typedef enum _RUART_WORD_LEN_SEL_ {
|
||||||
|
RUART_WLS_7BITS = 0,
|
||||||
|
RUART_WLS_8BITS = 1
|
||||||
|
}RUART_WORD_LEN_SEL, *PRUART_WORD_LEN_SEL;
|
||||||
|
|
||||||
|
typedef enum _RUART_STOP_BITS_ {
|
||||||
|
RUART_STOP_BIT_1 = 0,
|
||||||
|
RUART_STOP_BIT_2 = 1
|
||||||
|
}RUART_STOP_BITS, *PRUART_STOP_BITS;
|
||||||
|
|
||||||
|
typedef enum _RUART_PARITY_CONTROL_ {
|
||||||
|
RUART_PARITY_DISABLE = 0,
|
||||||
|
RUART_PARITY_ENABLE = 1
|
||||||
|
}RUART_PARITY_CONTROL, *PRUART_PARITY_CONTROL;
|
||||||
|
|
||||||
|
typedef enum _RUART_PARITY_TYPE_ {
|
||||||
|
RUART_ODD_PARITY = 0,
|
||||||
|
RUART_EVEN_PARITY = 1
|
||||||
|
}RUART_PARITY_TYPE, *PRUART_PARITY_TYPE;
|
||||||
|
|
||||||
|
typedef enum _RUART_STICK_PARITY_CONTROL_ {
|
||||||
|
RUART_STICK_PARITY_DISABLE = 0,
|
||||||
|
RUART_STICK_PARITY_ENABLE = 1
|
||||||
|
}RUART_STICK_PARITY_CONTROL, *PRUART_STICK_PARITY_CONTROL;
|
||||||
|
|
||||||
|
typedef enum _UART_INT_ID_ {
|
||||||
|
ModemStatus = 0,
|
||||||
|
TxFifoEmpty = 1,
|
||||||
|
ReceiverDataAvailable = 2,
|
||||||
|
ReceivLineStatus = 3,
|
||||||
|
TimeoutIndication = 6
|
||||||
|
}UART_INT_ID, *PUART_INT_ID;
|
||||||
|
|
||||||
|
typedef enum _HAL_UART_State_
|
||||||
|
{
|
||||||
|
HAL_UART_STATE_NULL = 0x00, // UART hardware not been initial yet
|
||||||
|
HAL_UART_STATE_READY = 0x10, // UART is initialed, ready to use
|
||||||
|
HAL_UART_STATE_BUSY = 0x20, // UART hardware is busy on configuration
|
||||||
|
HAL_UART_STATE_BUSY_TX = 0x21, // UART is buzy on TX
|
||||||
|
HAL_UART_STATE_BUSY_RX = 0x22, // UART is busy on RX
|
||||||
|
HAL_UART_STATE_BUSY_TX_RX = 0x23, // UART is busy on TX an RX
|
||||||
|
HAL_UART_STATE_TIMEOUT = 0x30, // Transfer timeout
|
||||||
|
HAL_UART_STATE_ERROR = 0x40 // UART Error
|
||||||
|
}HAL_UART_State, *PHAL_UART_State;
|
||||||
|
|
||||||
|
typedef enum _HAL_UART_Status_
|
||||||
|
{
|
||||||
|
HAL_UART_STATUS_OK = 0x00, // Transfer OK
|
||||||
|
HAL_UART_STATUS_TIMEOUT = 0x01, // Transfer Timeout
|
||||||
|
HAL_UART_STATUS_ERR_OVERRUN = 0x02, // RX Over run
|
||||||
|
HAL_UART_STATUS_ERR_PARITY = 0x04, // Parity error
|
||||||
|
HAL_UART_STATUS_ERR_FRAM = 0x08, // Framing Error
|
||||||
|
HAL_UART_STATUS_ERR_BREAK = 0x10, // Break Interrupt
|
||||||
|
HAL_UART_STATUS_ERR_PARA = 0x20, // Parameter error
|
||||||
|
HAL_UART_STATUS_ERR_RXFIFO = 0x80, // RX FIFO error
|
||||||
|
}HAL_UART_Status, *PHAL_UART_Status;
|
||||||
|
|
||||||
|
u32
|
||||||
|
HalRuartGetDebugValueRtl8195a(
|
||||||
|
IN VOID* Data,
|
||||||
|
IN u32 DbgSel
|
||||||
|
);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
u32
|
||||||
|
FindElementIndex(
|
||||||
|
u32 Element,
|
||||||
|
u32* Array
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
VOID
|
||||||
|
RuartResetRxFifoRtl8195a(
|
||||||
|
IN u8 UartIndex
|
||||||
|
);
|
||||||
|
#if 0
|
||||||
|
VOID
|
||||||
|
RuartBusDomainEnableRtl8195a(
|
||||||
|
IN u8 UartIndex
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
HalRuartResetRxFifoRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
HalRuartInitRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalRuartDeInitRtl8195a(
|
||||||
|
IN VOID *Data ///< RUART Adapter
|
||||||
|
);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
HalRuartPutCRtl8195a(
|
||||||
|
IN VOID *Data,
|
||||||
|
IN u8 TxData
|
||||||
|
);
|
||||||
|
|
||||||
|
u32
|
||||||
|
HalRuartSendRtl8195a(
|
||||||
|
IN VOID *Data,
|
||||||
|
IN u8 *pTxData,
|
||||||
|
IN u32 Length,
|
||||||
|
IN u32 Timeout
|
||||||
|
);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
HalRuartIntSendRtl8195a(
|
||||||
|
IN VOID *Data, // PHAL_RUART_ADAPTER
|
||||||
|
IN u8 *pTxData, // the Buffer to be send
|
||||||
|
IN u32 Length // the length of data to be send
|
||||||
|
);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
HalRuartDmaSendRtl8195a(
|
||||||
|
IN VOID *Data, // PHAL_RUART_ADAPTER
|
||||||
|
IN u8 *pTxData, // the Buffer to be send
|
||||||
|
IN u32 Length // the length of data to be send
|
||||||
|
);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
HalRuartStopSendRtl8195a(
|
||||||
|
IN VOID *Data // PHAL_RUART_ADAPTER
|
||||||
|
);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
HalRuartGetCRtl8195a(
|
||||||
|
IN VOID *Data,
|
||||||
|
OUT u8 *pRxByte
|
||||||
|
);
|
||||||
|
|
||||||
|
u32
|
||||||
|
HalRuartRecvRtl8195a(
|
||||||
|
IN VOID *Data,
|
||||||
|
IN u8 *pRxData,
|
||||||
|
IN u32 Length,
|
||||||
|
IN u32 Timeout
|
||||||
|
);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
HalRuartIntRecvRtl8195a(
|
||||||
|
IN VOID *Data, ///< RUART Adapter
|
||||||
|
IN u8 *pRxData, ///< Rx buffer
|
||||||
|
IN u32 Length // buffer length
|
||||||
|
);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
HalRuartDmaRecvRtl8195a(
|
||||||
|
IN VOID *Data, ///< RUART Adapter
|
||||||
|
IN u8 *pRxData, ///< Rx buffer
|
||||||
|
IN u32 Length // buffer length
|
||||||
|
);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
HalRuartStopRecvRtl8195a(
|
||||||
|
IN VOID *Data // PHAL_RUART_ADAPTER
|
||||||
|
);
|
||||||
|
|
||||||
|
u8
|
||||||
|
HalRuartGetIMRRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ VOID
|
||||||
|
HalRuartSetIMRRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalRuartDmaInitRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalRuartRTSCtrlRtl8195a(
|
||||||
|
IN VOID *Data,
|
||||||
|
IN BOOLEAN RtsCtrl
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalRuartRegIrqRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalRuartIntEnableRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalRuartIntDisableRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalRuartAdapterLoadDefRtl8195a(
|
||||||
|
IN VOID *pAdp,
|
||||||
|
IN u8 UartIdx
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalRuartTxGdmaLoadDefRtl8195a(
|
||||||
|
IN VOID *pAdp,
|
||||||
|
IN VOID *pCfg
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalRuartRxGdmaLoadDefRtl8195a(
|
||||||
|
IN VOID *pAdp,
|
||||||
|
IN VOID *pCfg
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status HalRuartIntSendRtl8195aV02(
|
||||||
|
IN VOID *Data, // PHAL_RUART_ADAPTER
|
||||||
|
IN u8 *pTxData, // the Buffer to be send
|
||||||
|
IN u32 Length // the length of data to be send
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HalRuartIntRecvRtl8195aV02(
|
||||||
|
IN VOID *Data, ///< RUART Adapter
|
||||||
|
IN u8 *pRxData, ///< Rx buffer
|
||||||
|
IN u32 Length // buffer length
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ s32
|
||||||
|
FindElementIndex_v02(
|
||||||
|
u32 Element, ///< RUART Baudrate
|
||||||
|
u32* Array, ///< Pre-defined Baudrate Array
|
||||||
|
u32 ElementNo
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status HalRuartInitRtl8195a_v02(IN VOID *Data);
|
||||||
|
|
||||||
|
// New added function 2015/04/20
|
||||||
|
HAL_Status
|
||||||
|
HalRuartResetTxFifoRtl8195a(
|
||||||
|
IN VOID *Data ///< RUART Adapter
|
||||||
|
);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
HalRuartSetBaudRateRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
HalRuartEnableRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
HalRuartDisableRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
HalRuartFlowCtrlRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
HalRuartDmaSendRtl8195a_Patch(
|
||||||
|
IN VOID *Data,
|
||||||
|
IN u8 *pTxData,
|
||||||
|
IN u32 Length
|
||||||
|
);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
RuartIsTimeout (
|
||||||
|
u32 StartCount,
|
||||||
|
u32 TimeoutCnt
|
||||||
|
);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
HalRuartStopRecvRtl8195a_Patch(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
HAL_Status
|
||||||
|
HalRuartStopSendRtl8195a_Patch(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalRuartEnterCriticalRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HalRuartExitCriticalRtl8195a(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
#if CONFIG_CHIP_E_CUT
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HalRuartSetBaudRateRtl8195a_V04(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HalRuartInitRtl8195a_V04(
|
||||||
|
IN VOID *Data ///< RUART Adapter
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HalRuartEnableRtl8195a_V04(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HalRuartDisableRtl8195a_V04(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HalRuartFlowCtrlRtl8195a_V04(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HalRuartDmaSendRtl8195a_V04(
|
||||||
|
IN VOID *Data,
|
||||||
|
IN u8 *pTxData,
|
||||||
|
IN u32 Length
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HalRuartStopRecvRtl8195a_V04(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ HAL_Status
|
||||||
|
HalRuartStopSendRtl8195a_V04(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ VOID
|
||||||
|
HalRuartEnterCriticalRtl8195a_V04(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
_LONG_CALL_ VOID
|
||||||
|
HalRuartExitCriticalRtl8195a_V04(
|
||||||
|
IN VOID *Data
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif // #if CONFIG_CHIP_E_CUT
|
||||||
|
|
||||||
|
#endif
|
111
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_usb.h
Normal file
111
sdk/component/soc/realtek/8195a/fwlib/rtl8195a/rtl8195a_usb.h
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _RTL8195A_USB_H_
|
||||||
|
#define _RTL8195A_USB_H_
|
||||||
|
|
||||||
|
|
||||||
|
// common command for USB
|
||||||
|
#define USB_CMD_TX_ETH 0x83 // request to TX a 802.3 packet
|
||||||
|
#define USB_CMD_TX_WLN 0x81 // request to TX a 802.11 packet
|
||||||
|
#define USB_CMD_H2C 0x11 // H2C(host to device) command packet
|
||||||
|
#define USB_CMD_MEMRD 0x51 // request to read a block of memory data
|
||||||
|
#define USB_CMD_MEMWR 0x53 // request to write a block of memory
|
||||||
|
#define USB_CMD_MEMST 0x55 // request to set a block of memory with a value
|
||||||
|
#define USB_CMD_STARTUP 0x61 // request to jump to the start up function
|
||||||
|
|
||||||
|
#define USB_CMD_RX_ETH 0x82 // indicate a RX 802.3 packet
|
||||||
|
#define USB_CMD_RX_WLN 0x80 // indicate a RX 802.11 packet
|
||||||
|
#define USB_CMD_C2H 0x10 // C2H(device to host) command packet
|
||||||
|
#define USB_CMD_MEMRD_RSP 0x50 // response to memory block read command
|
||||||
|
#define USB_CMD_MEMWR_RSP 0x52 // response to memory write command
|
||||||
|
#define USB_CMD_MEMST_RSP 0x54 // response to memory set command
|
||||||
|
#define USB_CMD_STARTED 0x60 // indicate the program has jumped to the given function
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: This data structer just for test, we should modify it for the normal driver
|
||||||
|
typedef struct _USB_TX_DESC{
|
||||||
|
// u4Byte 0
|
||||||
|
#if (SYSTEM_ENDIAN==PLATFORM_LITTLE_ENDIAN)
|
||||||
|
u32 txpktsize:16; // bit[15:0]
|
||||||
|
u32 offset:8; // bit[23:16], store the sizeof(SDIO_TX_DESC)
|
||||||
|
u32 bus_agg_num:8; // bit[31:24], the bus aggregation number
|
||||||
|
#else
|
||||||
|
u32 bus_agg_num:8; // bit[31:24], the bus aggregation number
|
||||||
|
u32 offset:8; // bit[23:16], store the sizeof(SDIO_TX_DESC)
|
||||||
|
u32 txpktsize:16; // bit[15:0]
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// u4Byte 1
|
||||||
|
#if (SYSTEM_ENDIAN==PLATFORM_LITTLE_ENDIAN)
|
||||||
|
u32 type:8; // bit[7:0], the packet type
|
||||||
|
u32 rsvd0:24;
|
||||||
|
#else
|
||||||
|
u32 rsvd0:24;
|
||||||
|
u32 type:8; // bit[7:0], the packet type
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// u4Byte 2
|
||||||
|
u32 rsvd1;
|
||||||
|
|
||||||
|
// u4Byte 3
|
||||||
|
u32 rsvd2;
|
||||||
|
|
||||||
|
// u4Byte 4
|
||||||
|
u32 rsvd3;
|
||||||
|
|
||||||
|
// u4Byte 5
|
||||||
|
u32 rsvd4;
|
||||||
|
} USB_TX_DESC, *PUSB_TX_DESC;
|
||||||
|
|
||||||
|
#define SIZE_USB_TX_DESC sizeof(USB_TX_DESC)
|
||||||
|
|
||||||
|
// TODO: This data structer just for test, we should modify it for the normal driver
|
||||||
|
typedef struct _USB_RX_DESC{
|
||||||
|
// u4Byte 0
|
||||||
|
#if (SYSTEM_ENDIAN==PLATFORM_LITTLE_ENDIAN)
|
||||||
|
u32 pkt_len:16; // bit[15:0], the packet size
|
||||||
|
u32 offset:8; // bit[23:16], the offset from the packet start to the buf start, also means the size of RX Desc
|
||||||
|
u32 rsvd0:6; // bit[29:24]
|
||||||
|
u32 icv:1; // bit[30], ICV error
|
||||||
|
u32 crc:1; // bit[31], CRC error
|
||||||
|
#else
|
||||||
|
u32 crc:1; // bit[31], CRC error
|
||||||
|
u32 icv:1; // bit[30], ICV error
|
||||||
|
u32 rsvd0:6; // bit[29:24]
|
||||||
|
u32 offset:8; // bit[23:16], the offset from the packet start to the buf start, also means the size of RX Desc
|
||||||
|
u32 pkt_len:16; // bit[15:0], the packet size
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// u4Byte 1
|
||||||
|
#if (SYSTEM_ENDIAN==PLATFORM_LITTLE_ENDIAN)
|
||||||
|
u32 type:8; // bit[7:0], the type of this packet
|
||||||
|
u32 rsvd1:24; // bit[31:8]
|
||||||
|
#else
|
||||||
|
u32 rsvd1:24; // bit[31:8]
|
||||||
|
u32 type:8; // bit[7:0], the type of this packet
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// u4Byte 2
|
||||||
|
u32 rsvd2;
|
||||||
|
|
||||||
|
// u4Byte 3
|
||||||
|
u32 rsvd3;
|
||||||
|
|
||||||
|
// u4Byte 4
|
||||||
|
u32 rsvd4;
|
||||||
|
|
||||||
|
// u4Byte 5
|
||||||
|
u32 rsvd5;
|
||||||
|
} USB_RX_DESC, *PUSB_RX_DESC;
|
||||||
|
|
||||||
|
#define SIZE_USB_RX_DESC sizeof(USB_RX_DESC)
|
||||||
|
|
||||||
|
#endif // #ifndef _RTL8195A_USB_H_
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2014 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _RTL8195A_WDT_H_
|
||||||
|
#define _RTL8195A_WDT_H_
|
||||||
|
|
||||||
|
#define WDGTIMERELY (10*1024) //us
|
||||||
|
|
||||||
|
typedef struct _WDG_REG_ {
|
||||||
|
u16 WdgScalar;
|
||||||
|
u8 WdgEnByte;
|
||||||
|
u8 WdgClear:1;
|
||||||
|
u8 WdgCunLimit:4;
|
||||||
|
u8 Rsvd:1;
|
||||||
|
u8 WdgMode:1;
|
||||||
|
u8 WdgToISR:1;
|
||||||
|
}WDG_REG, *PWDG_REG;
|
||||||
|
|
||||||
|
typedef struct _WDG_ADAPTER_ {
|
||||||
|
|
||||||
|
WDG_REG Ctrl;
|
||||||
|
IRQ_HANDLE IrqHandle;
|
||||||
|
TIMER_ADAPTER WdgGTimer;
|
||||||
|
VOID (*UserCallback)(u32 callback_id); // User callback function
|
||||||
|
u32 callback_id;
|
||||||
|
}WDG_ADAPTER, *PWDG_ADAPTER;
|
||||||
|
|
||||||
|
typedef enum _WDG_CNTLMT_ {
|
||||||
|
CNT1H = 0,
|
||||||
|
CNT3H = 1,
|
||||||
|
CNT7H = 2,
|
||||||
|
CNTFH = 3,
|
||||||
|
CNT1FH = 4,
|
||||||
|
CNT3FH = 5,
|
||||||
|
CNT7FH = 6,
|
||||||
|
CNTFFH = 7,
|
||||||
|
CNT1FFH = 8,
|
||||||
|
CNT3FFH = 9,
|
||||||
|
CNT7FFH = 10,
|
||||||
|
CNTFFFH = 11
|
||||||
|
}WDG_CNTLMT, *PWDG_CNTLMT;
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum _WDG_MODE_ {
|
||||||
|
INT_MODE = 0,
|
||||||
|
RESET_MODE = 1
|
||||||
|
}WDG_MODE, *PWDG_MODE;
|
||||||
|
|
||||||
|
extern VOID
|
||||||
|
WDGInitial(
|
||||||
|
IN u32 Period
|
||||||
|
);
|
||||||
|
|
||||||
|
extern VOID
|
||||||
|
WDGIrqInitial(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
extern VOID
|
||||||
|
WDGIrqInitial(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
extern VOID
|
||||||
|
WDGStop(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
extern VOID
|
||||||
|
WDGRefresh(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
extern VOID
|
||||||
|
WDGIrqCallBackReg(
|
||||||
|
IN VOID *CallBack,
|
||||||
|
IN u32 Id
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif //_RTL8195A_WDT_H_
|
501
sdk/component/soc/realtek/common/bsp/basic_types.h
Normal file
501
sdk/component/soc/realtek/common/bsp/basic_types.h
Normal file
|
@ -0,0 +1,501 @@
|
||||||
|
/******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of version 2 of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||||
|
*
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
#ifndef __BASIC_TYPES_H__
|
||||||
|
#define __BASIC_TYPES_H__
|
||||||
|
|
||||||
|
//#define PLATFORM_FREERTOS
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define PLATFORM_LITTLE_ENDIAN 0
|
||||||
|
#define PLATFORM_BIG_ENDIAN 1
|
||||||
|
|
||||||
|
#define SYSTEM_ENDIAN PLATFORM_LITTLE_ENDIAN
|
||||||
|
|
||||||
|
#define SUCCESS 0
|
||||||
|
#define FAIL (-1)
|
||||||
|
|
||||||
|
#undef _SUCCESS
|
||||||
|
#define _SUCCESS 1
|
||||||
|
|
||||||
|
#undef _FAIL
|
||||||
|
#define _FAIL 0
|
||||||
|
|
||||||
|
#ifndef FALSE
|
||||||
|
#define FALSE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef TRUE
|
||||||
|
#define TRUE (!FALSE)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _TRUE TRUE
|
||||||
|
#define _FALSE FALSE
|
||||||
|
|
||||||
|
#ifndef NULL
|
||||||
|
#define NULL 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define __weak __attribute__((weak))
|
||||||
|
#define likely(x) __builtin_expect ((x), 1)
|
||||||
|
#define unlikely(x) __builtin_expect ((x), 0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef unsigned int uint;
|
||||||
|
typedef signed int sint;
|
||||||
|
|
||||||
|
#ifdef __ICCARM__
|
||||||
|
typedef signed long long __int64_t;
|
||||||
|
typedef unsigned long long __uint64_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define s8 int8_t
|
||||||
|
#define u8 uint8_t
|
||||||
|
#define s16 int16_t
|
||||||
|
#define u16 uint16_t
|
||||||
|
#define s32 int32_t
|
||||||
|
#define u32 uint32_t
|
||||||
|
#define s64 int64_t
|
||||||
|
#define u64 uint64_t
|
||||||
|
|
||||||
|
#ifdef CONFIG_MBED_ENABLED
|
||||||
|
typedef unsigned int BOOL;
|
||||||
|
#else
|
||||||
|
#ifndef BOOL
|
||||||
|
typedef unsigned char BOOL;
|
||||||
|
#endif
|
||||||
|
#ifndef bool
|
||||||
|
#ifndef __cplusplus
|
||||||
|
typedef unsigned char bool;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UCHAR uint8_t
|
||||||
|
#define USHORT uint16_t
|
||||||
|
#define UINT uint32_t
|
||||||
|
#define ULONG uint32_t
|
||||||
|
|
||||||
|
typedef struct { volatile int counter; } atomic_t;
|
||||||
|
|
||||||
|
typedef enum _RTK_STATUS_ {
|
||||||
|
_EXIT_SUCCESS = 0,
|
||||||
|
_EXIT_FAILURE = 1
|
||||||
|
}RTK_STATUS, *PRTK_STATUS;
|
||||||
|
|
||||||
|
#define IN
|
||||||
|
#define OUT
|
||||||
|
#define VOID void
|
||||||
|
#define INOUT
|
||||||
|
#define NDIS_OID uint
|
||||||
|
#define NDIS_STATUS uint
|
||||||
|
|
||||||
|
#ifndef PVOID
|
||||||
|
typedef void * PVOID;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef u32 dma_addr_t;
|
||||||
|
|
||||||
|
typedef void (*proc_t)(void*);
|
||||||
|
|
||||||
|
typedef unsigned int __kernel_size_t;
|
||||||
|
typedef int __kernel_ssize_t;
|
||||||
|
|
||||||
|
typedef __kernel_size_t SIZE_T;
|
||||||
|
typedef __kernel_ssize_t SSIZE_T;
|
||||||
|
#define FIELD_OFFSET(s,field) ((SSIZE_T)&((s*)(0))->field)
|
||||||
|
|
||||||
|
#define MEM_ALIGNMENT_OFFSET (sizeof (SIZE_T))
|
||||||
|
#define MEM_ALIGNMENT_PADDING (sizeof(SIZE_T) - 1)
|
||||||
|
|
||||||
|
#define SIZE_PTR SIZE_T
|
||||||
|
#define SSIZE_PTR SSIZE_T
|
||||||
|
|
||||||
|
#ifndef ON
|
||||||
|
#define ON 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef OFF
|
||||||
|
#define OFF 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENABLE
|
||||||
|
#define ENABLE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DISABLE
|
||||||
|
#define DISABLE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT0 0x0001
|
||||||
|
#define BIT1 0x0002
|
||||||
|
#define BIT2 0x0004
|
||||||
|
#define BIT3 0x0008
|
||||||
|
#define BIT4 0x0010
|
||||||
|
#define BIT5 0x0020
|
||||||
|
#define BIT6 0x0040
|
||||||
|
#define BIT7 0x0080
|
||||||
|
#define BIT8 0x0100
|
||||||
|
#define BIT9 0x0200
|
||||||
|
#define BIT10 0x0400
|
||||||
|
#define BIT11 0x0800
|
||||||
|
#define BIT12 0x1000
|
||||||
|
#define BIT13 0x2000
|
||||||
|
#define BIT14 0x4000
|
||||||
|
#define BIT15 0x8000
|
||||||
|
#define BIT16 0x00010000
|
||||||
|
#define BIT17 0x00020000
|
||||||
|
#define BIT18 0x00040000
|
||||||
|
#define BIT19 0x00080000
|
||||||
|
#define BIT20 0x00100000
|
||||||
|
#define BIT21 0x00200000
|
||||||
|
#define BIT22 0x00400000
|
||||||
|
#define BIT23 0x00800000
|
||||||
|
#define BIT24 0x01000000
|
||||||
|
#define BIT25 0x02000000
|
||||||
|
#define BIT26 0x04000000
|
||||||
|
#define BIT27 0x08000000
|
||||||
|
#define BIT28 0x10000000
|
||||||
|
#define BIT29 0x20000000
|
||||||
|
#define BIT30 0x40000000
|
||||||
|
#define BIT31 0x80000000
|
||||||
|
|
||||||
|
#define BIT_(__n) (1<<(__n))
|
||||||
|
|
||||||
|
#ifndef BIT
|
||||||
|
#define BIT(__n) (1<<(__n))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (__ICCARM__)
|
||||||
|
#define STRINGIFY(s) #s
|
||||||
|
#define SECTION(_name) _Pragma( STRINGIFY(location=_name))
|
||||||
|
#define ALIGNMTO(_bound) _Pragma( STRINGIFY(data_alignment=##_bound##))
|
||||||
|
#define _PACKED_ __packed
|
||||||
|
#define _LONG_CALL_
|
||||||
|
#define _LONG_CALL_ROM_
|
||||||
|
#define _WEAK __weak
|
||||||
|
#else
|
||||||
|
#define SECTION(_name) __attribute__ ((__section__(_name)))
|
||||||
|
#define ALIGNMTO(_bound) __attribute__ ((aligned (_bound)))
|
||||||
|
#define _PACKED_ __attribute__ ((packed))
|
||||||
|
#define _LONG_CALL_ __attribute__ ((long_call))
|
||||||
|
#define _LONG_CALL_ROM_ _LONG_CALL_
|
||||||
|
#define _WEAK __attribute__ ((weak))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//port from fw by thomas
|
||||||
|
// TODO: Belows are Sync from SD7-Driver. It is necessary to check correctness
|
||||||
|
|
||||||
|
#define SWAP32(x) ((u32)( \
|
||||||
|
(((u32)(x) & (u32)0x000000ff) << 24) | \
|
||||||
|
(((u32)(x) & (u32)0x0000ff00) << 8) | \
|
||||||
|
(((u32)(x) & (u32)0x00ff0000) >> 8) | \
|
||||||
|
(((u32)(x) & (u32)0xff000000) >> 24)))
|
||||||
|
|
||||||
|
#define WAP16(x) ((u16)( \
|
||||||
|
(((u16)(x) & (u16)0x00ff) << 8) | \
|
||||||
|
(((u16)(x) & (u16)0xff00) >> 8)))
|
||||||
|
|
||||||
|
#if SYSTEM_ENDIAN == PLATFORM_LITTLE_ENDIAN
|
||||||
|
#ifndef rtk_le16_to_cpu
|
||||||
|
#define rtk_cpu_to_le32(x) ((u32)(x))
|
||||||
|
#define rtk_le32_to_cpu(x) ((u32)(x))
|
||||||
|
#define rtk_cpu_to_le16(x) ((u16)(x))
|
||||||
|
#define rtk_le16_to_cpu(x) ((u16)(x))
|
||||||
|
#define rtk_cpu_to_be32(x) SWAP32((x))
|
||||||
|
#define rtk_be32_to_cpu(x) SWAP32((x))
|
||||||
|
#define rtk_cpu_to_be16(x) WAP16((x))
|
||||||
|
#define rtk_be16_to_cpu(x) WAP16((x))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif SYSTEM_ENDIAN == PLATFORM_BIG_ENDIAN
|
||||||
|
#ifndef rtk_le16_to_cpu
|
||||||
|
#define rtk_cpu_to_le32(x) SWAP32((x))
|
||||||
|
#define rtk_le32_to_cpu(x) SWAP32((x))
|
||||||
|
#define rtk_cpu_to_le16(x) WAP16((x))
|
||||||
|
#define rtk_le16_to_cpu(x) WAP16((x))
|
||||||
|
#define rtk_cpu_to_be32(x) ((__u32)(x))
|
||||||
|
#define rtk_be32_to_cpu(x) ((__u32)(x))
|
||||||
|
#define rtk_cpu_to_be16(x) ((__u16)(x))
|
||||||
|
#define rtk_be16_to_cpu(x) ((__u16)(x))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Call endian free function when
|
||||||
|
* 1. Read/write packet content.
|
||||||
|
* 2. Before write integer to IO.
|
||||||
|
* 3. After read integer from IO.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//
|
||||||
|
// Byte Swapping routine.
|
||||||
|
//
|
||||||
|
#define EF1Byte (u8)
|
||||||
|
#define EF2Byte le16_to_cpu
|
||||||
|
#define EF4Byte le32_to_cpu
|
||||||
|
|
||||||
|
//
|
||||||
|
// Read LE format data from memory
|
||||||
|
//
|
||||||
|
#define ReadEF1Byte(_ptr) EF1Byte(*((u8 *)(_ptr)))
|
||||||
|
#define ReadEF2Byte(_ptr) EF2Byte(*((u16 *)(_ptr)))
|
||||||
|
#define ReadEF4Byte(_ptr) EF4Byte(*((u32 *)(_ptr)))
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write LE data to memory
|
||||||
|
//
|
||||||
|
#define WriteEF1Byte(_ptr, _val) (*((u8 *)(_ptr)))=EF1Byte(_val)
|
||||||
|
#define WriteEF2Byte(_ptr, _val) (*((u16 *)(_ptr)))=EF2Byte(_val)
|
||||||
|
#define WriteEF4Byte(_ptr, _val) (*((u32 *)(_ptr)))=EF4Byte(_val)
|
||||||
|
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
// BIT_LEN_MASK_32(0) => 0x00000000
|
||||||
|
// BIT_LEN_MASK_32(1) => 0x00000001
|
||||||
|
// BIT_LEN_MASK_32(2) => 0x00000003
|
||||||
|
// BIT_LEN_MASK_32(32) => 0xFFFFFFFF
|
||||||
|
//
|
||||||
|
#define BIT_LEN_MASK_32(__BitLen) \
|
||||||
|
(0xFFFFFFFF >> (32 - (__BitLen)))
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
// BIT_OFFSET_LEN_MASK_32(0, 2) => 0x00000003
|
||||||
|
// BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000
|
||||||
|
//
|
||||||
|
#define BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen) \
|
||||||
|
(BIT_LEN_MASK_32(__BitLen) << (__BitOffset))
|
||||||
|
|
||||||
|
//
|
||||||
|
// Description:
|
||||||
|
// Return 4-byte value in host byte ordering from
|
||||||
|
// 4-byte pointer in litten-endian system.
|
||||||
|
//
|
||||||
|
#define LE_P4BYTE_TO_HOST_4BYTE(__pStart) \
|
||||||
|
(EF4Byte(*((u32 *)(__pStart))))
|
||||||
|
|
||||||
|
//
|
||||||
|
// Description:
|
||||||
|
// Translate subfield (continuous bits in little-endian) of 4-byte value in litten byte to
|
||||||
|
// 4-byte value in host byte ordering.
|
||||||
|
//
|
||||||
|
#define LE_BITS_TO_4BYTE(__pStart, __BitOffset, __BitLen) \
|
||||||
|
( \
|
||||||
|
( LE_P4BYTE_TO_HOST_4BYTE(__pStart) >> (__BitOffset) ) \
|
||||||
|
& \
|
||||||
|
BIT_LEN_MASK_32(__BitLen) \
|
||||||
|
)
|
||||||
|
|
||||||
|
//
|
||||||
|
// Description:
|
||||||
|
// Mask subfield (continuous bits in little-endian) of 4-byte value in litten byte oredering
|
||||||
|
// and return the result in 4-byte value in host byte ordering.
|
||||||
|
//
|
||||||
|
#define LE_BITS_CLEARED_TO_4BYTE(__pStart, __BitOffset, __BitLen) \
|
||||||
|
( \
|
||||||
|
LE_P4BYTE_TO_HOST_4BYTE(__pStart) \
|
||||||
|
& \
|
||||||
|
( ~ BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen) ) \
|
||||||
|
)
|
||||||
|
|
||||||
|
//
|
||||||
|
// Description:
|
||||||
|
// Set subfield of little-endian 4-byte value to specified value.
|
||||||
|
//
|
||||||
|
#define SET_BITS_TO_LE_4BYTE(__pStart, __BitOffset, __BitLen, __Value) \
|
||||||
|
*((u32 *)(__pStart)) = \
|
||||||
|
EF4Byte( \
|
||||||
|
LE_BITS_CLEARED_TO_4BYTE(__pStart, __BitOffset, __BitLen) \
|
||||||
|
| \
|
||||||
|
( (((u32)__Value) & BIT_LEN_MASK_32(__BitLen)) << (__BitOffset) ) \
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT_LEN_MASK_16(__BitLen) \
|
||||||
|
(0xFFFF >> (16 - (__BitLen)))
|
||||||
|
|
||||||
|
#define BIT_OFFSET_LEN_MASK_16(__BitOffset, __BitLen) \
|
||||||
|
(BIT_LEN_MASK_16(__BitLen) << (__BitOffset))
|
||||||
|
|
||||||
|
#define LE_P2BYTE_TO_HOST_2BYTE(__pStart) \
|
||||||
|
(EF2Byte(*((u16 *)(__pStart))))
|
||||||
|
|
||||||
|
#define LE_BITS_TO_2BYTE(__pStart, __BitOffset, __BitLen) \
|
||||||
|
( \
|
||||||
|
( LE_P2BYTE_TO_HOST_2BYTE(__pStart) >> (__BitOffset) ) \
|
||||||
|
& \
|
||||||
|
BIT_LEN_MASK_16(__BitLen) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define LE_BITS_CLEARED_TO_2BYTE(__pStart, __BitOffset, __BitLen) \
|
||||||
|
( \
|
||||||
|
LE_P2BYTE_TO_HOST_2BYTE(__pStart) \
|
||||||
|
& \
|
||||||
|
( ~ BIT_OFFSET_LEN_MASK_16(__BitOffset, __BitLen) ) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define SET_BITS_TO_LE_2BYTE(__pStart, __BitOffset, __BitLen, __Value) \
|
||||||
|
*((u16 *)(__pStart)) = \
|
||||||
|
EF2Byte( \
|
||||||
|
LE_BITS_CLEARED_TO_2BYTE(__pStart, __BitOffset, __BitLen) \
|
||||||
|
| \
|
||||||
|
( (((u16)__Value) & BIT_LEN_MASK_16(__BitLen)) << (__BitOffset) ) \
|
||||||
|
);
|
||||||
|
|
||||||
|
#define BIT_LEN_MASK_8(__BitLen) \
|
||||||
|
(0xFF >> (8 - (__BitLen)))
|
||||||
|
|
||||||
|
#define BIT_OFFSET_LEN_MASK_8(__BitOffset, __BitLen) \
|
||||||
|
(BIT_LEN_MASK_8(__BitLen) << (__BitOffset))
|
||||||
|
|
||||||
|
#define LE_P1BYTE_TO_HOST_1BYTE(__pStart) \
|
||||||
|
(EF1Byte(*((u8 *)(__pStart))))
|
||||||
|
|
||||||
|
#define LE_BITS_TO_1BYTE(__pStart, __BitOffset, __BitLen) \
|
||||||
|
( \
|
||||||
|
( LE_P1BYTE_TO_HOST_1BYTE(__pStart) >> (__BitOffset) ) \
|
||||||
|
& \
|
||||||
|
BIT_LEN_MASK_8(__BitLen) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define LE_BITS_CLEARED_TO_1BYTE(__pStart, __BitOffset, __BitLen) \
|
||||||
|
( \
|
||||||
|
LE_P1BYTE_TO_HOST_1BYTE(__pStart) \
|
||||||
|
& \
|
||||||
|
( ~BIT_OFFSET_LEN_MASK_8(__BitOffset, __BitLen) ) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define SET_BITS_TO_LE_1BYTE(__pStart, __BitOffset, __BitLen, __Value) \
|
||||||
|
*((u8 *)(__pStart)) = \
|
||||||
|
EF1Byte( \
|
||||||
|
LE_BITS_CLEARED_TO_1BYTE(__pStart, __BitOffset, __BitLen) \
|
||||||
|
| \
|
||||||
|
( (((u8)__Value) & BIT_LEN_MASK_8(__BitLen)) << (__BitOffset) ) \
|
||||||
|
);
|
||||||
|
|
||||||
|
//pclint
|
||||||
|
#define LE_BITS_CLEARED_TO_1BYTE_8BIT(__pStart, __BitOffset, __BitLen) \
|
||||||
|
( \
|
||||||
|
LE_P1BYTE_TO_HOST_1BYTE(__pStart) \
|
||||||
|
)
|
||||||
|
|
||||||
|
//pclint
|
||||||
|
#define SET_BITS_TO_LE_1BYTE_8BIT(__pStart, __BitOffset, __BitLen, __Value) \
|
||||||
|
{ \
|
||||||
|
*((pu1Byte)(__pStart)) = \
|
||||||
|
EF1Byte( \
|
||||||
|
LE_BITS_CLEARED_TO_1BYTE_8BIT(__pStart, __BitOffset, __BitLen) \
|
||||||
|
| \
|
||||||
|
((u1Byte)__Value) \
|
||||||
|
); \
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the N-bytes aligment offset from the current length
|
||||||
|
#define N_BYTE_ALIGMENT(__Value, __Aligment) ((__Aligment == 1) ? (__Value) : (((__Value + __Aligment - 1) / __Aligment) * __Aligment))
|
||||||
|
|
||||||
|
typedef unsigned char BOOLEAN,*PBOOLEAN;
|
||||||
|
|
||||||
|
#define TEST_FLAG(__Flag,__testFlag) (((__Flag) & (__testFlag)) != 0)
|
||||||
|
#define SET_FLAG(__Flag, __setFlag) ((__Flag) |= __setFlag)
|
||||||
|
#define CLEAR_FLAG(__Flag, __clearFlag) ((__Flag) &= ~(__clearFlag))
|
||||||
|
#define CLEAR_FLAGS(__Flag) ((__Flag) = 0)
|
||||||
|
#define TEST_FLAGS(__Flag, __testFlags) (((__Flag) & (__testFlags)) == (__testFlags))
|
||||||
|
|
||||||
|
/* Define compilor specific symbol */
|
||||||
|
//
|
||||||
|
// inline function
|
||||||
|
//
|
||||||
|
|
||||||
|
#if defined ( __ICCARM__ )
|
||||||
|
#define __inline__ inline
|
||||||
|
#define __inline inline
|
||||||
|
#define __inline_definition //In dialect C99, inline means that a function's definition is provided
|
||||||
|
//only for inlining, and that there is another definition
|
||||||
|
//(without inline) somewhere else in the program.
|
||||||
|
//That means that this program is incomplete, because if
|
||||||
|
//add isn't inlined (for example, when compiling without optimization),
|
||||||
|
//then main will have an unresolved reference to that other definition.
|
||||||
|
|
||||||
|
// Do not inline function is the function body is defined .c file and this
|
||||||
|
// function will be called somewhere else, otherwise there is compile error
|
||||||
|
#elif defined ( __CC_ARM )
|
||||||
|
#define __inline__ __inline //__linine__ is not supported in keil compilor, use __inline instead
|
||||||
|
#define inline __inline
|
||||||
|
#define __inline_definition // for dialect C99
|
||||||
|
#elif defined ( __GNUC__ )
|
||||||
|
#define __inline__ inline
|
||||||
|
#define __inline inline
|
||||||
|
#define __inline_definition inline
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// pack
|
||||||
|
//
|
||||||
|
|
||||||
|
#if defined (__ICCARM__)
|
||||||
|
|
||||||
|
#define RTW_PACK_STRUCT_BEGIN _Pragma( STRINGIFY(pack(1)))
|
||||||
|
#define RTW_PACK_STRUCT_STRUCT
|
||||||
|
#define RTW_PACK_STRUCT_END _Pragma( STRINGIFY(pack()))
|
||||||
|
//#define RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
|
||||||
|
#elif defined (__CC_ARM)
|
||||||
|
|
||||||
|
#define RTW_PACK_STRUCT_BEGIN __packed
|
||||||
|
#define RTW_PACK_STRUCT_STRUCT
|
||||||
|
#define RTW_PACK_STRUCT_END
|
||||||
|
|
||||||
|
#elif defined (__GNUC__)
|
||||||
|
|
||||||
|
#define RTW_PACK_STRUCT_BEGIN
|
||||||
|
#define RTW_PACK_STRUCT_STRUCT __attribute__ ((__packed__))
|
||||||
|
#define RTW_PACK_STRUCT_END
|
||||||
|
|
||||||
|
#elif defined(PLATFORM_WINDOWS)
|
||||||
|
|
||||||
|
#define RTW_PACK_STRUCT_BEGIN
|
||||||
|
#define RTW_PACK_STRUCT_STRUCT
|
||||||
|
#define RTW_PACK_STRUCT_END
|
||||||
|
#define RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// for standard library
|
||||||
|
#ifdef __ICCARM__
|
||||||
|
#define __extension__ /* Ignore */
|
||||||
|
#define __restrict /* Ignore */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct _RAM_START_FUNCTION_ {
|
||||||
|
VOID (*RamStartFun) (VOID);
|
||||||
|
}RAM_START_FUNCTION, *PRAM_START_FUNCTION;
|
||||||
|
|
||||||
|
typedef struct _RAM_FUNCTION_START_TABLE_ {
|
||||||
|
VOID (*RamStartFun) (VOID);
|
||||||
|
VOID (*RamWakeupFun) (VOID);
|
||||||
|
VOID (*RamPatchFun0) (VOID);
|
||||||
|
VOID (*RamPatchFun1) (VOID);
|
||||||
|
VOID (*RamPatchFun2) (VOID);
|
||||||
|
}RAM_FUNCTION_START_TABLE, *PRAM_FUNCTION_START_TABLE;
|
||||||
|
|
||||||
|
#endif// __BASIC_TYPES_H__
|
300
sdk/component/soc/realtek/common/bsp/section_config.h
Normal file
300
sdk/component/soc/realtek/common/bsp/section_config.h
Normal file
|
@ -0,0 +1,300 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SECTION_CONFIG_H_
|
||||||
|
#define _SECTION_CONFIG_H_
|
||||||
|
|
||||||
|
#include "basic_types.h"
|
||||||
|
|
||||||
|
#define RAM_DEDECATED_VECTOR_TABLE_SECTION \
|
||||||
|
SECTION(".ram_dedecated_vector_table")
|
||||||
|
|
||||||
|
#define RAM_USER_IRQ_FUN_TABLE_SECTION \
|
||||||
|
SECTION(".ram_user_define_irq_table")
|
||||||
|
|
||||||
|
#define RAM_USER_IRQ_DATA_TABLE_SECTION \
|
||||||
|
SECTION(".ram_user_define_data_table")
|
||||||
|
|
||||||
|
//3 Timer Section
|
||||||
|
#define SECTION_RAM_TIMER2TO7_VECTOR_TABLE \
|
||||||
|
SECTION(".timer2_7_vector_table.data")
|
||||||
|
|
||||||
|
#define SECTION_RAM_BSS_TIMER_RECORDER_TABLE \
|
||||||
|
SECTION(".timer.ram.data")
|
||||||
|
|
||||||
|
#define TIMER_ROM_TEXT_SECTION \
|
||||||
|
SECTION(".timer.rom.text")
|
||||||
|
|
||||||
|
#define TIMER_ROM_DATA_SECTION \
|
||||||
|
SECTION(".timer.rom.rodata")
|
||||||
|
|
||||||
|
#define TIMER_RAM_TEXT_SECTION \
|
||||||
|
SECTION(".timer.ram.text")
|
||||||
|
|
||||||
|
#define TIMER_RAM_DATA_SECTION \
|
||||||
|
SECTION(".timer.ram.data")
|
||||||
|
|
||||||
|
|
||||||
|
//3 Wifi Section
|
||||||
|
#define WIFI_ROM_TEXT_SECTION \
|
||||||
|
SECTION(".wifi.rom.text")
|
||||||
|
|
||||||
|
#define WIFI_ROM_DATA_SECTION \
|
||||||
|
SECTION(".wifi.rom.rodata")
|
||||||
|
|
||||||
|
#define WIFI_RAM_TEXT_SECTION \
|
||||||
|
SECTION(".wifi.ram.text")
|
||||||
|
|
||||||
|
#define WIFI_RAM_DATA_SECTION \
|
||||||
|
SECTION(".wifi.ram.data")
|
||||||
|
|
||||||
|
//3 Hal Section
|
||||||
|
#define HAL_ROM_TEXT_SECTION \
|
||||||
|
SECTION(".hal.rom.text")
|
||||||
|
|
||||||
|
#define HAL_ROM_DATA_SECTION \
|
||||||
|
SECTION(".hal.rom.rodata")
|
||||||
|
|
||||||
|
#define HAL_RAM_TEXT_SECTION \
|
||||||
|
SECTION(".hal.ram.text")
|
||||||
|
|
||||||
|
#define HAL_FLASH_TEXT_SECTION \
|
||||||
|
SECTION(".hal.flash.text")
|
||||||
|
|
||||||
|
#define HAL_FLASH_DATA_SECTION \
|
||||||
|
SECTION(".hal.flash.data")
|
||||||
|
|
||||||
|
#define HAL_SDRC_TEXT_SECTION \
|
||||||
|
SECTION(".hal.sdrc.text")
|
||||||
|
|
||||||
|
#define HAL_SDRC_DATA_SECTION \
|
||||||
|
SECTION(".hal.sdrc.data")
|
||||||
|
|
||||||
|
#define HAL_CUT_B_RAM_DATA_SECTION \
|
||||||
|
SECTION(".cutb.ram.data")
|
||||||
|
|
||||||
|
#define HAL_CUT_C_RAM_DATA_SECTION \
|
||||||
|
SECTION(".cutc.ram.data")
|
||||||
|
|
||||||
|
#define HAL_RAM_DATA_SECTION \
|
||||||
|
SECTION(".hal.ram.data")
|
||||||
|
|
||||||
|
#define HAL_RAM_BSS_SECTION \
|
||||||
|
SECTION(".hal.ram.bss")
|
||||||
|
|
||||||
|
#define HAL_ROM_OP_SECTION \
|
||||||
|
SECTION(".halop.rom.rodata")
|
||||||
|
|
||||||
|
#define HAL_GPIO_TEXT_SECTION \
|
||||||
|
SECTION(".hal.gpio.text")
|
||||||
|
|
||||||
|
#define HAL_GPIO_DATA_SECTION \
|
||||||
|
SECTION(".hal.gpio.data")
|
||||||
|
|
||||||
|
#define FWU_DATA_SECTION \
|
||||||
|
SECTION(".fwu.data")
|
||||||
|
|
||||||
|
#define FWU_RODATA_SECTION \
|
||||||
|
SECTION(".fwu.rodata")
|
||||||
|
|
||||||
|
#define FWU_TEXT_SECTION \
|
||||||
|
SECTION(".fwu.text")
|
||||||
|
|
||||||
|
//3 C-Cut ROM Patch/New functions location
|
||||||
|
#define C_CUT_ROM_TEXT_SECTION \
|
||||||
|
SECTION(".cutc.rom.text")
|
||||||
|
|
||||||
|
#define C_CUT_ROM_RODATA_SECTION \
|
||||||
|
SECTION(".cutc.rom.rodata")
|
||||||
|
|
||||||
|
#define C_CUT_ROM_DATA_SECTION \
|
||||||
|
SECTION(".cutc.ram.data")
|
||||||
|
//3 No ROM code changed for D_Cut
|
||||||
|
//3 E-Cut ROM Patch/New functions location
|
||||||
|
#define E_CUT_ROM_TEXT_SECTION \
|
||||||
|
SECTION(".cute.rom.text")
|
||||||
|
|
||||||
|
#define E_CUT_ROM_RODATA_SECTION \
|
||||||
|
SECTION(".cute.rom.rodata")
|
||||||
|
|
||||||
|
#define E_CUT_ROM_DATA_SECTION \
|
||||||
|
SECTION(".cute.ram.data")
|
||||||
|
|
||||||
|
//3 Store the Image 1 validate code
|
||||||
|
#define IMAGE1_VALID_PATTEN_SECTION \
|
||||||
|
SECTION(".image1.validate.rodata")
|
||||||
|
|
||||||
|
#define IMAGE2_VALID_PATTEN_SECTION \
|
||||||
|
SECTION(".image2.validate.rodata")
|
||||||
|
|
||||||
|
//3 Infra Section
|
||||||
|
#define INFRA_ROM_TEXT_SECTION \
|
||||||
|
SECTION(".infra.rom.text")
|
||||||
|
|
||||||
|
#define INFRA_ROM_DATA_SECTION \
|
||||||
|
SECTION(".infra.rom.rodata")
|
||||||
|
|
||||||
|
#define INFRA_RAM_TEXT_SECTION \
|
||||||
|
SECTION(".infra.ram.text")
|
||||||
|
|
||||||
|
#define INFRA_RAM_DATA_SECTION \
|
||||||
|
SECTION(".infra.ram.data")
|
||||||
|
|
||||||
|
#define INFRA_RAM_BSS_SECTION \
|
||||||
|
SECTION(".infra.ram.bss")
|
||||||
|
|
||||||
|
#define INFRA_START_SECTION \
|
||||||
|
SECTION(".infra.ram.start")
|
||||||
|
|
||||||
|
|
||||||
|
//3 Pin Mutex Section
|
||||||
|
#define PINMUX_ROM_TEXT_SECTION \
|
||||||
|
SECTION(".hal.rom.text")
|
||||||
|
|
||||||
|
#define PINMUX_ROM_DATA_SECTION \
|
||||||
|
SECTION(".hal.rom.rodata")
|
||||||
|
|
||||||
|
#define PINMUX_RAM_TEXT_SECTION \
|
||||||
|
SECTION(".hal.ram.text")
|
||||||
|
|
||||||
|
#define PINMUX_RAM_DATA_SECTION \
|
||||||
|
SECTION(".hal.ram.data")
|
||||||
|
|
||||||
|
#define PINMUX_RAM_BSS_SECTION \
|
||||||
|
SECTION(".hal.ram.bss")
|
||||||
|
|
||||||
|
|
||||||
|
//3 Monitor App Section
|
||||||
|
#define MON_ROM_TEXT_SECTION \
|
||||||
|
SECTION(".mon.rom.text")
|
||||||
|
|
||||||
|
#define MON_ROM_DATA_SECTION \
|
||||||
|
SECTION(".mon.rom.rodata")
|
||||||
|
|
||||||
|
#define MON_RAM_TEXT_SECTION \
|
||||||
|
SECTION(".mon.ram.text")
|
||||||
|
|
||||||
|
#define MON_RAM_DATA_SECTION \
|
||||||
|
SECTION(".mon.ram.data")
|
||||||
|
|
||||||
|
#define MON_RAM_BSS_SECTION \
|
||||||
|
SECTION(".mon.ram.bss")
|
||||||
|
|
||||||
|
|
||||||
|
//3 SDIO Section
|
||||||
|
#define SECTION_SDIO_RAM
|
||||||
|
#define SECTION_SDIO_ROM
|
||||||
|
#define SDIO_ROM_BSS_SECTION \
|
||||||
|
SECTION(".sdio.rom.bss")
|
||||||
|
#define SDIO_ROM_TEXT_SECTION \
|
||||||
|
SECTION(".sdio.rom.text")
|
||||||
|
|
||||||
|
//3 SRAM Config Section
|
||||||
|
#define SRAM_BD_DATA_SECTION \
|
||||||
|
SECTION(".bdsram.data")
|
||||||
|
|
||||||
|
#define SRAM_BF_DATA_SECTION \
|
||||||
|
SECTION(".bfsram.data")
|
||||||
|
|
||||||
|
|
||||||
|
#define START_RAM_FUN_SECTION \
|
||||||
|
SECTION(".start.ram.data")
|
||||||
|
|
||||||
|
#define START_RAM_FUN_A_SECTION \
|
||||||
|
SECTION(".start.ram.data.a")
|
||||||
|
|
||||||
|
#define START_RAM_FUN_B_SECTION \
|
||||||
|
SECTION(".start.ram.data.b")
|
||||||
|
|
||||||
|
#define START_RAM_FUN_C_SECTION \
|
||||||
|
SECTION(".start.ram.data.c")
|
||||||
|
|
||||||
|
#define START_RAM_FUN_D_SECTION \
|
||||||
|
SECTION(".start.ram.data.d")
|
||||||
|
|
||||||
|
#define START_RAM_FUN_E_SECTION \
|
||||||
|
SECTION(".start.ram.data.e")
|
||||||
|
|
||||||
|
#define SRAM_OS_HEAP_SECTION \
|
||||||
|
SECTION(".ossram.heap")
|
||||||
|
|
||||||
|
//Non-Flash Boot Section
|
||||||
|
#define NON_FLASH_BOOT_DATA_SECTION \
|
||||||
|
SECTION(".nonflash.data")
|
||||||
|
#define NON_FLASH_BOOT_HEAP_SECTION \
|
||||||
|
SECTION(".nonflash.heap")
|
||||||
|
|
||||||
|
// USB OTG Section
|
||||||
|
#define OTG_ROM_BSS_SECTION \
|
||||||
|
SECTION(".otg.rom.bss")
|
||||||
|
|
||||||
|
#define OTG_ROM_TEXT_SECTION \
|
||||||
|
SECTION(".otg.rom.text")
|
||||||
|
|
||||||
|
#define OTG_ROM_DATA_SECTION \
|
||||||
|
SECTION(".otg.rom.rodata")
|
||||||
|
|
||||||
|
#define START_OTG_RAM_FUN_SECTION \
|
||||||
|
SECTION(".ram.otg.data.a")
|
||||||
|
|
||||||
|
#define START_OTG_RAM_DATA_SECTION \
|
||||||
|
SECTION(".ram.otg.data.b")
|
||||||
|
|
||||||
|
#define OTG_RAM_BF_DATA_SECTION \
|
||||||
|
SECTION(".ram.otg.bfdata")
|
||||||
|
|
||||||
|
#define IMAGE2_START_RAM_FUN_SECTION \
|
||||||
|
SECTION(".image2.ram.data")
|
||||||
|
|
||||||
|
// SDRAM Section
|
||||||
|
|
||||||
|
#define SDRAM_DATA_SECTION \
|
||||||
|
SECTION(".sdram.data")
|
||||||
|
|
||||||
|
#define SDRAM_OS_HEAP_SECTION \
|
||||||
|
SECTION(".ossdram.heap")
|
||||||
|
|
||||||
|
//3 Wlan Section
|
||||||
|
#define WLAN_ROM_TEXT_SECTION \
|
||||||
|
SECTION(".wlan.rom.text")
|
||||||
|
|
||||||
|
#define WLAN_ROM_DATA_SECTION \
|
||||||
|
SECTION(".wlan.rom.rodata")
|
||||||
|
|
||||||
|
#define WLAN_RAM_MAP_SECTION \
|
||||||
|
SECTION(".wlan_ram_map")
|
||||||
|
|
||||||
|
//3 Apple Section
|
||||||
|
#define APPLE_ROM_TEXT_SECTION \
|
||||||
|
SECTION(".apple.rom.text")
|
||||||
|
|
||||||
|
#define APPLE_ROM_DATA_SECTION \
|
||||||
|
SECTION(".apple.rom.rodata")
|
||||||
|
|
||||||
|
//3 Libc Section
|
||||||
|
#define LIBC_ROM_TEXT_SECTION \
|
||||||
|
SECTION(".libc.rom.text")
|
||||||
|
|
||||||
|
#define LIBC_ROM_DATA_SECTION \
|
||||||
|
SECTION(".libc.rom.rodata")
|
||||||
|
|
||||||
|
#define LIBC_RAM_BSS_SECTION \
|
||||||
|
SECTION(".libc.ram.bss")
|
||||||
|
|
||||||
|
//3 SSL Section
|
||||||
|
#define SSL_ROM_TEXT_SECTION \
|
||||||
|
SECTION(".ssl.rom.text")
|
||||||
|
|
||||||
|
#define SSL_ROM_DATA_SECTION \
|
||||||
|
SECTION(".ssl.rom.rodata")
|
||||||
|
|
||||||
|
#define SSL_RAM_MAP_SECTION \
|
||||||
|
SECTION(".ssl_ram_map")
|
||||||
|
|
||||||
|
#endif //_SECTION_CONFIG_H_
|
213
sdk/project/realtek_ameba1_va0_example/inc/FreeRTOSConfig.h
Normal file
213
sdk/project/realtek_ameba1_va0_example/inc/FreeRTOSConfig.h
Normal file
|
@ -0,0 +1,213 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.3.0 - Copyright (C) 2012 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
>>>NOTE<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel. FreeRTOS is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
more details. You should have received a copy of the GNU General Public
|
||||||
|
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||||
|
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||||
|
by writing to Richard Barry, contact details for whom are available on the
|
||||||
|
FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, training, latest versions, license
|
||||||
|
and contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool.
|
||||||
|
|
||||||
|
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
|
||||||
|
the code with commercial support, indemnification, and middleware, under
|
||||||
|
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
|
||||||
|
provide a safety engineered and independently SIL3 certified version under
|
||||||
|
the SafeRTOS brand: http://www.SafeRTOS.com.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FREERTOS_CONFIG_H
|
||||||
|
#define FREERTOS_CONFIG_H
|
||||||
|
#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
|
||||||
|
#include <stdint.h>
|
||||||
|
extern uint32_t SystemCoreClock;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------
|
||||||
|
* Application specific definitions.
|
||||||
|
*
|
||||||
|
* These definitions should be adjusted for your particular hardware and
|
||||||
|
* application requirements.
|
||||||
|
*
|
||||||
|
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||||
|
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||||
|
*
|
||||||
|
* See http://www.freertos.org/a00110.html.
|
||||||
|
*----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define configUSE_PREEMPTION 1
|
||||||
|
#define configUSE_IDLE_HOOK 1
|
||||||
|
#define configUSE_TICK_HOOK 0
|
||||||
|
#define configCPU_CLOCK_HZ ( SystemCoreClock )
|
||||||
|
#define configTICK_RATE_HZ ( ( uint32_t ) 1000 )
|
||||||
|
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 )
|
||||||
|
#ifdef CONFIG_UVC
|
||||||
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 110 * 1024 ) ) // use HEAP5
|
||||||
|
#else
|
||||||
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 60 * 1024 ) ) // use HEAP5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ARDUINO_SDK
|
||||||
|
#undef configTOTAL_HEAP_SIZE
|
||||||
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 2 * 1024 ) ) // use HEAP5
|
||||||
|
#define configTOTAL_SDRHEAP_SIZE ( ( size_t ) ( 200 * 1024 ) ) // use HEAP5
|
||||||
|
#define configENLARGE_HEAP_SIZE ( 1 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define configMAX_TASK_NAME_LEN ( 10 )
|
||||||
|
#define configUSE_TRACE_FACILITY 0
|
||||||
|
#define configUSE_16_BIT_TICKS 0
|
||||||
|
#define configIDLE_SHOULD_YIELD 0
|
||||||
|
#define configUSE_CO_ROUTINES 1
|
||||||
|
#define configUSE_MUTEXES 1
|
||||||
|
#define configUSE_TIMERS 1
|
||||||
|
|
||||||
|
#define configMAX_PRIORITIES ( 11 )
|
||||||
|
#define PRIORITIE_OFFSET ( 4 )
|
||||||
|
|
||||||
|
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||||
|
|
||||||
|
#define configUSE_COUNTING_SEMAPHORES 1
|
||||||
|
#define configUSE_ALTERNATIVE_API 0
|
||||||
|
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||||
|
#define configUSE_RECURSIVE_MUTEXES 1
|
||||||
|
#define configQUEUE_REGISTRY_SIZE 0
|
||||||
|
#define configGENERATE_RUN_TIME_STATS 0
|
||||||
|
#if configGENERATE_RUN_TIME_STATS
|
||||||
|
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() //( ulHighFrequencyTimerTicks = 0UL )
|
||||||
|
#define portGET_RUN_TIME_COUNTER_VALUE() xTickCount //ulHighFrequencyTimerTicks
|
||||||
|
#undef configUSE_TRACE_FACILITY
|
||||||
|
#define configUSE_TRACE_FACILITY 1
|
||||||
|
#define portCONFIGURE_STATS_PEROID_VALUE 1000 //unit Ticks
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define configTIMER_TASK_PRIORITY ( 1 )
|
||||||
|
#define configTIMER_QUEUE_LENGTH ( 10 )
|
||||||
|
#define configTIMER_TASK_STACK_DEPTH ( 512 ) // 512*4=2K
|
||||||
|
|
||||||
|
#if (__IASMARM__ != 1)
|
||||||
|
|
||||||
|
extern void freertos_pre_sleep_processing(unsigned int *expected_idle_time);
|
||||||
|
extern void freertos_post_sleep_processing(unsigned int *expected_idle_time);
|
||||||
|
extern int freertos_ready_to_sleep();
|
||||||
|
|
||||||
|
/* Enable tickless power saving. */
|
||||||
|
#define configUSE_TICKLESS_IDLE 1
|
||||||
|
|
||||||
|
/* In wlan usage, this value is suggested to use value less than 80 milliseconds */
|
||||||
|
#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
|
||||||
|
|
||||||
|
/* It's magic trick that let us can use our own sleep function */
|
||||||
|
#define configPRE_SLEEP_PROCESSING( x ) ( freertos_pre_sleep_processing(&x) )
|
||||||
|
|
||||||
|
#define configPOST_SLEEP_PROCESSING( x ) ( freertos_post_sleep_processing(&x) )
|
||||||
|
|
||||||
|
/* It's magic trick that let us can enable/disable tickless dynamically */
|
||||||
|
#define traceLOW_POWER_IDLE_BEGIN(); do { \
|
||||||
|
if (!freertos_ready_to_sleep()) { \
|
||||||
|
mtCOVERAGE_TEST_MARKER(); \
|
||||||
|
break; \
|
||||||
|
}
|
||||||
|
|
||||||
|
// portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime );
|
||||||
|
|
||||||
|
#define traceLOW_POWER_IDLE_END(); } while (0);
|
||||||
|
|
||||||
|
/* It's FreeRTOS related feature but it's not included in FreeRTOS design. */
|
||||||
|
#define configUSE_WAKELOCK_PMU 1
|
||||||
|
|
||||||
|
#endif // #if (__IASMARM__ != 1)
|
||||||
|
|
||||||
|
/* Set the following definitions to 1 to include the API function, or zero
|
||||||
|
to exclude the API function. */
|
||||||
|
#define INCLUDE_vTaskPrioritySet 1
|
||||||
|
#define INCLUDE_uxTaskPriorityGet 1
|
||||||
|
#define INCLUDE_vTaskDelete 1
|
||||||
|
#define INCLUDE_vTaskCleanUpResources 0
|
||||||
|
#define INCLUDE_vTaskSuspend 1
|
||||||
|
#define INCLUDE_vTaskDelayUntil 1
|
||||||
|
#define INCLUDE_vTaskDelay 1
|
||||||
|
#define INCLUDE_pcTaskGetTaskName 1
|
||||||
|
#define INCLUDE_xTimerPendFunctionCall 1
|
||||||
|
|
||||||
|
/* Cortex-M specific definitions. */
|
||||||
|
#ifdef __NVIC_PRIO_BITS
|
||||||
|
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
|
||||||
|
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||||
|
#else
|
||||||
|
#define configPRIO_BITS 4 /* 15 priority levels */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* The lowest interrupt priority that can be used in a call to a "set priority"
|
||||||
|
function. */
|
||||||
|
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x0f
|
||||||
|
|
||||||
|
/* The highest interrupt priority that can be used by any interrupt service
|
||||||
|
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
|
||||||
|
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
|
||||||
|
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
|
||||||
|
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
|
||||||
|
|
||||||
|
|
||||||
|
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
||||||
|
to all Cortex-M ports, and do not rely on any particular library functions. */
|
||||||
|
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||||
|
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
||||||
|
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||||
|
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||||
|
|
||||||
|
//#define RTK_MODE_TIMER
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* FREERTOS_CONFIG_H */
|
6
sdk/project/realtek_ameba1_va0_example/inc/build_info.h
Normal file
6
sdk/project/realtek_ameba1_va0_example/inc/build_info.h
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#define UTS_VERSION "2015/11/16-12:38:57"
|
||||||
|
#define RTL8195AFW_COMPILE_TIME "2015/11/16-12:38:57"
|
||||||
|
#define RTL8195AFW_COMPILE_BY "NA"
|
||||||
|
#define RTL8195AFW_COMPILE_HOST "NA"
|
||||||
|
#define RTL8195AFW_COMPILE_DOMAIN
|
||||||
|
#define RTL195AFW_COMPILER "NA"
|
182
sdk/project/realtek_ameba1_va0_example/inc/platform_autoconf.h
Normal file
182
sdk/project/realtek_ameba1_va0_example/inc/platform_autoconf.h
Normal file
|
@ -0,0 +1,182 @@
|
||||||
|
/*
|
||||||
|
* Automatically generated by make menuconfig: don't edit
|
||||||
|
*/
|
||||||
|
#define AUTOCONF_INCLUDED
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Target Platform Selection
|
||||||
|
*/
|
||||||
|
#define CONFIG_WITHOUT_MONITOR 1
|
||||||
|
#define CONFIG_BOOT_TO_UPGRADE_IMG2 1
|
||||||
|
|
||||||
|
#define CONFIG_RTL8195A 1
|
||||||
|
#undef CONFIG_FPGA
|
||||||
|
#undef CONFIG_RTL_SIM
|
||||||
|
#undef CONFIG_POST_SIM
|
||||||
|
#undef CONFIG_MP
|
||||||
|
#define RTL8195A 1
|
||||||
|
#define CONFIG_CPU_CLK 1
|
||||||
|
#define CONFIG_CPU_166_6MHZ 1
|
||||||
|
#undef CONFIG_CPU_83_3MHZ
|
||||||
|
#undef CONFIG_CPU_41_6MHZ
|
||||||
|
#undef CONFIG_CPU_20_8MHZ
|
||||||
|
#undef CONFIG_CPU_10_4MHZ
|
||||||
|
#undef CONFIG_CPU_4MHZ
|
||||||
|
#undef CONFIG_FPGA_CLK
|
||||||
|
#define PLATFORM_CLOCK (166666666)
|
||||||
|
#define CPU_CLOCK_SEL_VALUE (0)
|
||||||
|
#define CONFIG_SDR_CLK 1
|
||||||
|
#define CONFIG_SDR_100MHZ 1
|
||||||
|
#undef CONFIG_SDR_50MHZ
|
||||||
|
#undef CONFIG_SDR_25MHZ
|
||||||
|
#undef CONFIG_SDR_12_5MHZ
|
||||||
|
#define SDR_CLOCK_SEL_VALUE (0)
|
||||||
|
#define CONFIG_BOOT_PROCEDURE 1
|
||||||
|
#define CONFIG_BOOT_FROM_JTAG 1
|
||||||
|
#undef CONFIG_ALIGNMENT_EXCEPTION_ENABLE
|
||||||
|
#define CONFIG_KERNEL 1
|
||||||
|
#define PLATFORM_FREERTOS 1
|
||||||
|
#undef PLATFORM_UCOSII
|
||||||
|
#undef PLATFORM_ECOS
|
||||||
|
#undef CONFIG_TASK_SCHEDUL_DIS
|
||||||
|
#define TASK_SCHEDULER_DISABLED (0)
|
||||||
|
#define CONFIG_NORMALL_MODE 1
|
||||||
|
#undef CONFIG_MEMORY_VERIFY_MODE
|
||||||
|
#define CONFIG_TIMER_EN 1
|
||||||
|
#define CONFIG_TIMER_NORMAL 1
|
||||||
|
#undef CONFIG_TIMER_TEST
|
||||||
|
#define CONFIG_TIMER_MODULE 1
|
||||||
|
#define CONFIG_WDG 1
|
||||||
|
#undef CONFIG_WDG_NON
|
||||||
|
#define CONFIG_WDG_NORMAL 1
|
||||||
|
#define CONFIG_GDMA_EN 1
|
||||||
|
#define CONFIG_GDMA_NORMAL 1
|
||||||
|
#undef CONFIG_GDMA_TEST
|
||||||
|
#define CONFIG_GDMA_MODULE 1
|
||||||
|
#define CONFIG_WIFI_EN 1
|
||||||
|
#define CONFIG_WIFI_NORMAL 1
|
||||||
|
#undef CONFIG_WIFI_TEST
|
||||||
|
#define CONFIG_WIFI_MODULE 1
|
||||||
|
#define CONFIG_GPIO_EN 1
|
||||||
|
#define CONFIG_GPIO_NORMAL 1
|
||||||
|
#undef CONFIG_GPIO_TEST
|
||||||
|
#define CONFIG_GPIO_MODULE 1
|
||||||
|
#undef CONFIG_SDIO_DEVICE_EN
|
||||||
|
#undef CONFIG_SDIO_HOST_EN
|
||||||
|
#define CONFIG_USB_EN 1
|
||||||
|
#undef CONFIG_USB_NORMAL
|
||||||
|
#define CONFIG_USB_TEST 1
|
||||||
|
#define CONFIG_USB_MODULE 1
|
||||||
|
#define CONFIG_USB_VERIFY 1
|
||||||
|
//#define CONFIG_USB_DBGINFO_EN 1
|
||||||
|
#undef DWC_DEVICE_ONLY
|
||||||
|
#define DWC_HOST_ONLY 1
|
||||||
|
#define CONFIG_USB_HOST_ONLY 1
|
||||||
|
#define CONFIG_SPI_COM_EN 1
|
||||||
|
#define CONFIG_SPI_COM_NORMAL 1
|
||||||
|
#undef CONFIG_SPI_COM_TEST
|
||||||
|
#define CONFIG_SPI_COM_MODULE 1
|
||||||
|
#define CONFIG_UART_EN 1
|
||||||
|
#define CONFIG_UART_NORMAL 1
|
||||||
|
#undef CONFIG_UART_TEST
|
||||||
|
#define CONFIG_UART_MODULE 1
|
||||||
|
#define CONFIG_I2C_EN 1
|
||||||
|
#define CONFIG_I2C_NORMAL 1
|
||||||
|
#undef CONFIG_I2C_TEST
|
||||||
|
#define CONFIG_I2C_MODULE 1
|
||||||
|
#undef CONFIG_DEBUG_LOG_I2C_HAL
|
||||||
|
#undef CONFIG_PCM_EN
|
||||||
|
#define CONFIG_I2S_EN 1
|
||||||
|
#define CONFIG_I2S_NORMAL 1
|
||||||
|
#undef CONFIG_I2S_TEST
|
||||||
|
#define CONFIG_I2S_MODULE 1
|
||||||
|
#undef CONFIG_DEBUG_LOG_I2S_HAL
|
||||||
|
#define CONFIG_NFC_EN 1
|
||||||
|
#define CONFIG_NFC_NORMAL 1
|
||||||
|
#undef CONFIG_NFC_TEST
|
||||||
|
#define CONFIG_NFC_MODULE 1
|
||||||
|
#define CONFIG_SOC_PS_EN 1
|
||||||
|
#define CONFIG_SOC_PS_NORMAL 1
|
||||||
|
#undef CONFIG_SOC_PS_TEST
|
||||||
|
#define CONFIG_SOC_PS_MODULE 1
|
||||||
|
#define CONFIG_CRYPTO_EN 1
|
||||||
|
#define CONFIG_CRYPTO_NORMAL 1
|
||||||
|
#undef CONFIG_CRYPTO_TEST
|
||||||
|
#define CONFIG_CRYPTO_MODULE 1
|
||||||
|
#undef CONFIG_MII_EN
|
||||||
|
#define CONFIG_PWM_EN 1
|
||||||
|
#define CONFIG_PWM_NORMAL 1
|
||||||
|
#undef CONFIG_PWM_TEST
|
||||||
|
#define CONFIG_PWM_MODULE 1
|
||||||
|
#define CONFIG_EFUSE_EN 1
|
||||||
|
#define CONFIG_EFUSE_NORMAL 1
|
||||||
|
#undef CONFIG_EFUSE_TEST
|
||||||
|
#define CONFIG_EFUSE_MODULE 1
|
||||||
|
#define CONFIG_SDR_EN 1
|
||||||
|
#define CONFIG_SDR_NORMAL 1
|
||||||
|
#undef CONFIG_SDR_TEST
|
||||||
|
#define CONFIG_SDR_MODULE 1
|
||||||
|
#define CONFIG_SPIC_EN 1
|
||||||
|
#define CONFIG_SPIC_NORMAL 1
|
||||||
|
#undef CONFIG_SPIC_TEST
|
||||||
|
#define CONFIG_SPIC_MODULE 1
|
||||||
|
#define CONFIG_ADC_EN 1
|
||||||
|
#define CONFIG_DAC_EN 1
|
||||||
|
#define CONFIG_NOR_FLASH 1
|
||||||
|
#undef CONFIG_SPI_FLASH
|
||||||
|
#undef CONFIG_NAND_FLASH
|
||||||
|
#undef CONFIG_NONE_FLASH
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Engineer Mode Config
|
||||||
|
*/
|
||||||
|
#undef CONFIG_JTAG
|
||||||
|
#undef CONFIG_COMPILE_FLASH_DOWNLOAD_CODE
|
||||||
|
#undef CONIFG_COMPILE_EXTERNAL_SRAM_CALIBRATE
|
||||||
|
#undef CONFIG_CMSIS_MATH_LIB_EN
|
||||||
|
|
||||||
|
/*
|
||||||
|
* < Application Config
|
||||||
|
*/
|
||||||
|
#define CONFIG_NETWORK 1
|
||||||
|
#define CONFIG_RTLIB_EN 1
|
||||||
|
#define CONFIG_RTLIB_NORMAL 1
|
||||||
|
#undef CONFIG_RTLIB_TEST
|
||||||
|
#define CONFIG_RTLIB_MODULE 1
|
||||||
|
|
||||||
|
/*
|
||||||
|
* < System Debug Message Config
|
||||||
|
*/
|
||||||
|
#define CONFIG_UART_LOG_HISTORY 1
|
||||||
|
#undef CONFIG_CONSOLE_NORMALL_MODE
|
||||||
|
#define CONFIG_CONSOLE_VERIFY_MODE 1
|
||||||
|
#define CONFIG_DEBUG_LOG 1
|
||||||
|
#define CONFIG_DEBUG_ERR_MSG 1
|
||||||
|
#undef CONFIG_DEBUG_WARN_MSG
|
||||||
|
#undef CONFIG_DEBUG_INFO_MSG
|
||||||
|
|
||||||
|
/*
|
||||||
|
* < SDK Option Config
|
||||||
|
*/
|
||||||
|
#undef CONFIG_MBED_ENABLED
|
||||||
|
#undef CONFIG_APP_DEMO
|
||||||
|
|
||||||
|
/*
|
||||||
|
* < Select Chip Version
|
||||||
|
*/
|
||||||
|
#undef CONFIG_CHIP_A_CUT
|
||||||
|
#define CONFIG_CHIP_B_CUT 1
|
||||||
|
#undef CONFIG_CHIP_C_CUT
|
||||||
|
|
||||||
|
/*
|
||||||
|
* < Build Option
|
||||||
|
*/
|
||||||
|
#define CONFIG_LINK_ROM_LIB 1
|
||||||
|
#undef CONFIG_LINK_ROM_SYMB
|
||||||
|
#undef CONFIG_NORMAL_BUILD
|
||||||
|
#undef CONFIG_RELEASE_BUILD
|
||||||
|
#undef CONFIG_RELEASE_BUILD_LIBRARIES
|
||||||
|
#undef CONFIG_LIB_BUILD_RAM
|
||||||
|
#define CONFIG_RELEASE_BUILD_RAM_ALL 1
|
||||||
|
#undef CONFIG_IMAGE_ALL
|
||||||
|
#define CONFIG_IMAGE_SEPARATE 1
|
Loading…
Reference in a new issue