initial checkin of gpon_onu_drv-4.5.0

https://github.com/kbridgers/VOLTE4GFAX/raw/master/dl/gpon_onu_drv-4.5.0.tar.gz
This commit is contained in:
Harald Welte 2022-12-23 09:02:40 +01:00
commit 39c6102ba1
197 changed files with 144449 additions and 0 deletions

0
AUTHORS Normal file
View File

0
COPYING Normal file
View File

810
ChangeLog Normal file
View File

@ -0,0 +1,810 @@
NEXT VERSION
v4.5.0 2013.03.08
common:
- GPONSW-1144: OMCI: Counter read and reset
+ fixed the gpe_bridge_port_counter_threshold_get function
- GPONSW-1142: TBM Crawler default settings affected TBM function for
low packet arrival rates.
+ initialize TBM crawler period to 12 on A2x.
+ Change minimum meter rate to from 8 kB/s to 3 bytes/s
- GPONSW-1141: enable hardware support for OMCI downstream channel
- GPONSW-1122: Functions gpe_tagging_filter_set and gpe_ext_vlan_set have been
enhanced to clear those VLAN table/VLAN Rule Table entries which are located
behind the end of the list, but still within the same memory line.
- GPONSW-1102: Option to use only layer 2 for metering
+ SCE constant index=17 initialization added (default 0x0)
+ FIO_GPE_SCE_CONSTANTS_SET/GET ioctl extended with "meter_l2_only_enable" parameter
- GPONSW-1080: add global reset for PM counter
+ added ioctl FIO_ONU_COUNTERS_RESET
- GPONSW-1077: Bridge port counter reset function missing
+ removed ioctl FIO_GPE_BRIDGE_PORT_CNT_GET
+ added ioctls
+ FIO_GPE_BRIDGE_PORT_COUNTER_GET
+ FIO_GPE_BRIDGE_PORT_COUNTER_THRESHOLD_SET
+ FIO_GPE_BRIDGE_PORT_COUNTER_THRESHOLD_GET
+ FIO_GPE_BRIDGE_PORT_TCA_GET
+ FIO_GPE_BRIDGE_PORT_COUNTER_RESET
+ add dedicated events ONU_EVENT_BRIDGE_TCA & ONU_EVENT_BRIDGE_PORT_TCA
+ make the counter 64bit
+ update CLI
- GPONSW-1071: The counter "Transmitted Frames per GEM Port" has
been made accessible and the reset mask has been fixed.
- GPONSW-1070: allow smaller TCONT allocation size
- GPONSW-1055: (related to GPONSYS-199) Exception in case of match with one of 8 Ethertypes
+ FIO_GPE_PARSER_CFG_SET/GET ioctls handling extended to use ONU_GPE_ETHERTYPE_EXCEPTION_TABLE
+ ONU_GPE_CONST_ETHTYPE_SPEC_TAG definition changed to ONU_GPE_CONST_UNUSED0
+ FIO_GPE_SCE_CONSTANTS_SET/GET ioctls parameter "ethertype_spec_tag" renamed to "unused0"
- GPONSW-1053: include MAC_PISR / EIM_ISR in EIM Dump
- GPONSW-1024, GPONSW-1050: Watchdog for traffic stucks
+ upstream stuck detection on TOOLONG bit in MAC (on A22 only)
+ downstream on TXFIFOFULL and EPFILLED
+ restart GPHY link upon US error rates based on SSD and MACERR
- Ploam message dump for enhanced debug information
+ add dump for ploam messages
+ add PLOAM downstream message simulation
- GPONSW-1007: Add missing Sync Time OMCI message handling
+ add sync time supervision
+ onu_sync_time_set() poll condition fixed
+ reset counters in FIO_ONU_SYNC_TIME_SET and start new 15-min interval
bug fix(es):
- GPONSW-1094: GTOP BridgePort counter are not mapped to correct counter address
+ gtop compile warnings fixed
- GPONSW-1091: Meter parameter calculation corrected, as the meter was not working properly
+ Change minimum meter rate to from 8 kB/s to 3 bytes/s
- GPONSW-1068: PHY egress loop and mac loop is not working if link is down.
+ The link status is now forced up by software and link state changes are ignored
as long the loop is switched on.
+ By forcing the link up, the link LED is also on.
+ Disabling the LAN port also resets and deactivates the loop
+ The loop is only working when the LAN port is enabled
- GPONSW-1056: LAN port disable now deactivates GPHY
- GPONSW-1041: Software image download failed
+ do not remove fragmented meta data from the Link FIFO
+ refacture the LINK access code to make it more robust
+ prepare for extended baseline support
+ fix the max buffer size
+ add more debug information
v4.4.1 2012.12.12
common:
- GPONSW-1046: enable OMCI queue by default
The OMCI queue should be enabled by default in the FW Enqueue Table.
Reason: ALU OLT expects SSH channel on OMCI T-cont.
This channel operates via FW and IP Host and therefore needs FW enqueueing.
- GPONSW-1042: Laser Tx needs to be safely shut off in state O7 (also if BERT is enabled)
+ switch on after leaving O7 (any state)
- GPONSW-1041: Software image download failed
+ poll the Link interface longer to avoid fragmented meta data
- GPONSW-1040: PLOAM downstream message - Disable all upstream transmission
through Disable Serial Number
- GPONSW-1037: add BC / MC counter
- GPONSW-1033: The pseudo-random generator is systematically seeded in the same
way after boot up. If several boards boot up simultaneously and are connected
to the same OLT port, it can happen that the random delay of the serial number
response is identical for several boards.
+ replace pseudo random generator values by CPU count
+ this gives us better & faster randomized values
- GPONSW-1027: gtop: replace SCHEDULER by SBIN (scheduler block input)
- GPONSW-1018: FE4 mode doesn't work as expected
- GPONSW-1015: set GPHY in reset before downloading firmware
- GPONSW-1009, GPONSW-1030: Unused egress queues are cleared:
+ Protection has been added for TMU low-level access.
+ Protection has been added for OCTRLC operations.
+ A garbage collection function has been added to drain the remaining contents
from disabled queues, thus freeing up buffer space.
+ The ANI egress ports are not disabled in order to allow for garbage collection.
+ On the UNI side, queues are cleaned up before the egress port is disabled.
- GPONSW-911: Ingress Queue ppstream packet insertion into UNI Ports
bug fix(es):
- GPONSW-1013: Switching LAN modes did not always work as GPHY reboot did not complete.
This has now been fixed.
v4.4.0 2012.11.20
common:
- remove ANI & LAN exception table, replaced by exception table
bug fix(es):
- GPONSW-1008: Disable LAN-side egress queues if not used
- GPONSW-1013: switching lan modes does not always work because GPHY reboot
not yet completed
- GPONSW-978: Exception packets handling adaptation to improved exception header format
+ exception header now consists of 8 instead of 4 bytes
+ received VLAN now included in exception header
+ facilitates IGMP handling
- GPONSW-969: Chip dependend GPHY firmware loading
+ Parse firmware version and don't load it on wrong device;
+ If there is no version information in FW image, load it anyway;
+ If there is no GPHY firmware in /lib/firmware/ or it has wrong version,
try to unconditionally (meaning, don't check version) load firmware from
/lib/firmware/a1x/ or /lib/firmware/a2x/ depending on device.
- GPONSW-1010: OMCI queue buffer reservation
+ add default reservation values for extended OMCI message size
- GPONSW-1009: Clear unused egress queues
+ add protection for tmu low level access
+ note: the read/modify/write routines still not thread safe
+ add protection for octrlc operations
+ add garbage collection thread
- GPONSW-1001: OMCI Tx channel is stuck after TCONT deassignment during traffic
+ remove only normal TCONT's
+ if a TCONT is used by OMCC just delete the REPN value
+ fix TCONT index range checks
- set default crawler period to 10
- set the IQM prescaler to 4
- change the default shaper values - fix the 6.2.13 test case with enabled upstream shaper
- remove OMCI CRC check, the OMCI stack should detect retransmission
- GPONSW-391: PLOAM Message reception for PON ID
+ fixed copy routine kernel to user space
+ fixed alignment of gtc_pon_id structure
+ fixed elements of structure ploam_dn_pon_i
+ update CLI
+ fix array size
- GPONSW-719: Traffic stuck after disabling shaper
Update default values for token bucket shaper
- GPONSW-839: configure exception meters
Add ANI exception meter (A2x)
- GPONSW-868: GTC upstream broken: sending shortened T-CONTS with random data
Instead of diabling the GTC TX framer disable the optical tx interface.
- GPONSW-864: still PLOAM state O1 after reception of two downstream frames.
Poll on regular base in state O1 the SYNC condition.
- GPONSW-865: PLOAM state O0 after power up without fiber
To ensure the safe transition from O0 to O1 state the timer T00 is added.
TO0 state is a dummy state to handle the requirement to start the PLOAM state
machine with state O1 or state O7.
Event was removed, but in this case the ploam_fsm() has to be triggered
- GPONSW-869: COP workaround for hash table full avoidanc
- GPONSW-886: GTC was upstream broken. This fix empties Rx TCONT FIFO before
going to PLOAM State O2
- GPONSW-888: Definitions for exceptions have been changed since FW version 4.43.0.0
to change priorities for DoS prevention
- GPONSW-895 bugtfix for hash deletion and FID treatment for TSE version 1 (a1x)
- GPONSW-897: gtop "GPE DS GEM port": decoding of exception_profile missing
- GPONSW-901: GMII clock activation
- GPONSW-920: Race condition between O6 and Offset re-calculation
- GPONSW-924: LDD Power Save truncates end of burst in extended burst length mode against ALU OLT
- GPONSW-930: FS4 image rebooted by watchdog
- GPONSW-934: gtop update
+ fix fsqm_rcnt dump
+ fix fsqm_llt dump
+ add marker for each page when dumping to a file
+ unification of page names
+ add "Meter Configuration" page (shortcut: t-e)
+ add Meter status as well
+ add GPE counter page
+ add ds_gem_meter_enable / ds_gem_meter_id
- GPONSW-954: fix AllocID 255 handling
delete the TCONT if it was configured before
- GPONSW-968: Do not set Tcont ID to 0xff at delete but set used = 0 and use the original id
+ speed up tcont deletion in octrlg
+ there is no more delay of 5 ms delay between GTC and octrlg deletion
- GPONSW-997: The order of parameters for ictrlg_gem_port_set() and get() and
octrlg_gem_port_set() has been fixed.
v4.3.0 2012.08.10
common:
- update SCE interface to 4.43.0
- PIR/CIR range documentation added to struct gpe_meter_cfg
- GPONSW-842: upstream queues connected to T-CONT directly
+ add new ioctrl() FIO_GPE_TCONT_CREATE to create TCONT related scheduler
+ the related EPN is enabled as well
+ in case that the policy is 0 the policy 1 (strict policy) is forced
bug fix(es):
- GPONSW-173: Remote defect indication (RDI) Software Handling
+ introduce gtc_refresh_rdi() function to set the RDI upstream bit based
on the GTC_DSSTAT_1_SF information
+ remove gtc_clear_ind5() function
- GPONSW-694: FID programming
+ fix the ingress exception handling: use the correct IQM queue #8
for downstream forwarding
+ fixes BBF 6.3.1
+ remove obsolete SW_GPIX
- GPONSW-768: make sure to disable egress-port on link down
+ cleanup and align rxmii_phy_status_update
+ add lan_egress_port_enable() for simpler calling
- GPONSW-772: Token Bucket Configuration of Scheduler ME in Conflict with Priority Queues
+ disable all SBINs, use right masks for SBOT/SBIT
+ set default shaper values during create, the intention is that the shaper is passing all data
- GPONSW-820: ONU crash if CLI commands entered too early
only a subset of commands (ploam_init, gtc_init, gtc_serial_number_set/get,
gtc_cfg_set/get, gtc_power_saving_mode_set/get, lan_gphy_firmware_download,
onu_event_enable_set/get, onu_event_fifo) is now allowed to be
executed prior to GPE init
- GPONSW-833: Introduce selection for extended serial number (SN) response
the function goi_lts_trigger() has to be used now
- GPONSW-837: OMCI messages are dropped in case that TCID is repeated
consider the CRC instead of the TCID - this is more safe
- GPONSW-839: Configure exception meters
added debugging counter
v4.2.0 2012.07.12
API:
- ioctl(s) modified:
+ FIO_GPE_EXT_VLAN_SET: max_vlans parameter added
+ FIO_GPE_ANI_EXCEPTION_CFG_SET/GET: exception_profile parameter replaced with
ds_exception_profile and us_exception_profile
common:
- GPONSW-745: OMCI: Multicast VLAN handling
- GPONSW-762: PCP_DECODING_TABLE default setting
- GPONSW-768: Setting ONU Ethernet Mode from OLT
+ added FIO_LAN_PORT_CAPABILITY_CFG_SET/GET ioctls to allow PHY auto
negotiation capabilities configuration
+ marked EEE feature of FIO_LAN_PORT_CAPABILITY_CFG_SET as not supported
+ added support for lanpe/lanpd
- GPONSW-787: MIPS API ACL table write must be suppressed in A21, but it must
be supported on A12
- GPONSW-801: CLI/gtop: Table access to MAC_FILTER_TABLE
bug fix(es):
- GPONSYS-136: Reset the MAC on link up to avoid traffic stucks
- GPONSW-559: GTC debug support for allocation loss
+ added bits description to 'Loss of allocation'
+ added t-b page with BWM trace details
- GPONSW-625: fixed LAN_LOOP_CFG_SET loop setting.
Phy ingress wrongly set near end loop instead of far end loop. Besides
a new auto negotiated was needed to take the settings effect.
- GPONSW-735: AES encryption enable/disable
+ don't disable the encryption during gem port add called from OMCI network CTP
+ re-use the hardware settings instead
- GPONSW-748: lanpcs CLI-less command fixed
- GPONSW-758: wrong translation of GPE FW abort reason value to abort string
- GPONSW-766: OMCI - Downstream Priority Queue selection by GEM port
+ extending FIO_GPE_EGRESS_QUEUE_PATH_GET ioctrl to return internal configuration values
+ added debugging support for queue_selection_mode / egress_queue_offset fields
of DS GEM PORT table
- GPONSW-773: TMU inverse weight calculation in driver
- GPONSW-788: Range checks missing for gpe_egress_queue_cfg_set
- GPONSW-797: Meter mode GPE_METER_NONE not implemented
- GPONSW-811: Upstream traffic does not trigger Ethernet activity LED
- GPONSW-828: dump fsqm_rcnt from gtop not working
gtop: added printout when number of lines of dumped file exceeds supported
gtop: increased maximum supported lines number for proc files to 25000
(was 10000) to fit in FSQM RCNT
- GPONSW-830: ACL IPv4-SrcAddress filtering does not work
aligned param1_mask argument of FIO_GPE_ACL_TABLE_ENTRY_SET with
FW table (bitwise instead of nibble mask)
v4.1.2 2012.06.27
- GPONSYS-136: Fix downstream traffic stuck after configuring LAN port by
switching the egress port on only after the PHY link is established
v4.1.1 2012.06.22
bug fix(es):
- GPONSW-391: PLOAM Message reception for PON ID, fixed debugging output in onu tool
- GPONSW-757: gtop GPE short forward MAC mismatch in fields
- GPONSW-722: In some cases when switching a LAN port configuration via the driver
API FIO_LAN_PORT_CFG_SET while downstream and upstream traffic is running the
downstream traffic stuck and is was not possible to start it again even when
switching the LAN port off and on. This has been fixed.
common:
- GPONSW-744: Include OFSQ in gtop dump
v4.1.0 2012.06.15
API:
- ioctl(s) added:
+ FIO_GPE_EGRESS_PORT_ENABLE
+ FIO_GPE_EGRESS_PORT_DISABLE
+ FIO_GPE_METER_CREATE
+ FIO_GPE_METER_DELETE
+ FIO_GPE_SHORT_FWD_IPV4_MC_PORT_ADD
+ FIO_GPE_SHORT_FWD_IPV4_MC_PORT_DELETE
+ FIO_GPE_SHORT_FWD_IPV4_MC_PORT_MODIFY
+ FIO_GPE_DEBUG_INIT
- ioctl(s) modified:
+ FIO_GPE_METER_CFG_SET/GET: enable flag removed
+ FIO_GPE_CAPABILITY_GET: return the lowest available value for max_eth_uni
+ FIO_GPE_METER_CFG_SET/GET: discard_red parameter removed
+ FIO_GPE_SCE_CONSTANTS_SET/GET: max_mtu_size parameter removed
+ FIO_GPE_SCE_CONSTANTS_SET/GET: ani_exception_meter_id, ani_exception_enable and
disable_length_check parameters added
+ FIO_GPE_SHORT_FWD_IPV4_MC_PORT_MODIFY: key_code field removed
+ FIO_GPE_SHORT_FWD_MAC_MC_PORT_MODIFY: key_code field removed
- ioctl(s) removed:
+ FIO_GPE_TMU_GLOBAL_CFG_SET
CLI:
- new command(s) added:
+ gpe_egress_port_enable
+ gpe_egress_port_disable
+ gpe_meter_create
+ gpe_meter_delete
+ gpe_debug_init
- command(s) removed:
+ gpetgcs/gpe_tmu_global_cfg_set
common:
- GPONSW-626: Disable Egress Ports by default
- GPONSW-659: GPE initialization for FW debugging
- GPONSW-671: SGMII mode selection error check
- GPONSW-729: Remove ONU_GPE_METER_TABLE access
- GPONSW-736: Disable Ethernet length check in firmware
- Sanity checks added for the SCE Debugger IOCTLs
- file(s) removed:
+ drv_onu_ebu.h
bug fix(es):
- GPONSW-701: Ethernet LEDs different on ports 0/1 vs ports 2/3
- GPONSW-709: Do not remove the support of optional header for PE specific download of firmware
- GPONSW-731: Hierarchical scheduling traffic stuck
- GPONSW-732: tmu_token_bucket_shaper_link_get() fixed
- GPONSW-733: scheduler level tracking added, sanity checks added
- GPONSW-739: lan_port_cfg_get returns incorrect max_frame_size
- GPONSW-735: Allow to set AES encryption enable/disable in FIO_GPE_GEM_POPT_SET. It was always
forced to false
v4.0.3 2012.05.08
API:
- ioctl() interface change:
+ move unaligned array to the end of the structure gpe_mac_mc_port
used by FIO_GPE_SHORT_FWD_MAC_MC_PORT_ADD / FIO_GPE_SHORT_FWD_MAC_MC_PORT_DELETE
+ add FIO_GPE_SHORT_FWD_MAC_MC_PORT_MODIFY to add new port map entries
in case that the MC entry doesn't exist it will be added
common:
- add gtop shortcut: CTRL-B / CTRL-V to toggle between excel and raw mode
bug fix(es):
- add MC entry with FIO_GPE_SHORT_FWD_MAC_MC_PORT_ADD, fix one_port_map_indicator
v4.0.2 2012.04.27
CLI:
- new command(s) added:
+ gpe_short_fwd_mac_mc_port_add
+ gpe_short_fwd_mac_mc_port_delete
API:
- ioctl(s) extended:
+ GTC_COUNTER_GET: allocations_total, allocations_lost added
+ GTC_ALARM_GET: loss_of_allocation added
+ FIO_GPE_LAN_EXCEPTION_CFG_SET/GET: sync handling with the latest firmware
+ FIO_GPE_ANI_EXCEPTION_CFG_SET/GET: sync handling with the latest firmware
+ FIO_GPE_INIT: num_pe field added to "struct gpe_init_data"
+ FIO_GPE_STATUS_GET: num_pe field added to "struct gpe_status"
- ioctl(s) added:
+ FIO_GPE_EXCEPTION_PROFILE_CFG_SET
+ FIO_GPE_EXCEPTION_PROFILE_CFG_GET
+ FIO_GPE_SHORT_FWD_MAC_MC_PORT_ADD
+ FIO_GPE_SHORT_FWD_MAC_MC_PORT_DELETE
common:
- new configuration option(s) added
+ --enable-remote-only-onu
- add link1 interrupt polling for ONU firmware
- GPONSW-559: GTC debug support for allocation loss
- move RPC handling to the GPON RPC
- onu: add gpe_tcont xml/json wrapper (for GPONSW-536)
- GPONSW-649: LAN port muiltiplex mode for single RGMII
- GPONSW-627: Make number of GPE PEs configurable
- GPONSW-653: Simplified FID handling
- GPONSW-646: Improve the GPHY slave training by disabling scaling down power
- MAC&FID forwarding:
+ DS GEM and LAN port tables initialization added
bug fix(es):
- fix DEVIO _IOC defines
- onu_gtc_ds_handle(): clear downstr_gtc_dsistat_1 with respect to
downstr_gtc_dsimask_1
- fix wrong gtop counters with remote ONU
- GPONSW-559: GTC debug support for allocation loss
add 't-a' page for GTC alarms and 't-c' page for GTC counters
- GPONSW-558: API for adapting PLOAM O1/O2 timeout values
- GPONSW-576: No ping possible after change of MAC address
- GPONSW-584: MAC bridge port bridge table data ME returns Age=0
return Age=4095 when aging disabled
return Age=1 + <HW age> otherwise
- GPONSW-602: some PHY settings are only written directly and not updated after
"lan port disable/enable" sequence
- fix return of lan_phy_fe_loop_enable_set()
- lan_phy_mode_control_set(): really write "mode control register" for specific
settings of speed and duplex and fix definition and setting of relevant bits
- only allow real Lantiq-OID to identify Lantiq PHY, not 0xFFFFFC (from an inactive PHY)
- fix endianess issue in phy_oui_get()
- don't accept WOL settings for external PHYs
- FIO_GPE_TABLE_ENTRY_SEARCH ioctl mapping fixed
- GPONSW-497: add vlan information
fix XML/JSON table entries dump for indexes >=256
- GPONSW-620: lan_port_disable/enable could conflict with the backround status polling
- Fixed enabling of GPE meters
- GPONSW-637: Maximum frame size setting breaks link and does not work
v4.0.1 2012.02.10
API:
- ioctl(s) removed:
+ FIO_GPE_ACTIVITY_GET
+ FIO_GPE_NAPT_ADD
+ FIO_GPE_NAPT_DELETE
common:
- GPONSW-515: Add XML GEM port dump wrapper
- GPONSW-466: restore table id & instance when return with
GPE_STATUS_COP_ENTRY_NOT_FOUND
- update SCE interface to 4.7.0
- update SCE interface to 4.12.1
- update SCE interface to 4.13.1
- GPONSW-476: don't print invalid (valid == 0) entries in JSON/XML wrappers
- Automatically convert xls to csv when update SCE with update_sce.py
- GPONSW-501: Decode the packet drop reason from the firmware status
information
- Integrated new PE mailbox sync mechanism via signals
- add link1 interrupt for OMCI message handling
bug fix(es):
- MAC Filter table init fixed
- Workaround for GPHY 1.4: fix "GPHY fails to train up with some link partners
in 1000BASE-T mode"
- send always the extended serial number pattern
- GPONSW-505: Laser shall be off during guard time
- rename api routines to match ioctls
- add endianness handling to GPE tables (not tested)
- onu_iocmd_local: don't print GPE_STATUS_NOT_AVAILABLE errors
from FIO_GPE_GEM_PORT_GET
- fix gtop segmentation fault on proc pages
- GPONSW-524: boot problem - kernel 3.1.10.
fixed early HW access in net_rx_enable()
- detect endian in drv_onu_gpe_tables.h
- fix alignment issues in struct gpe_table; remove __ALIGNED32__ (use union)
v3.0.9 2011.12.20
- Load gphy firmware in lower SBS0RAM (below bar0, no reconfiguration needed)
- gpe_lan_exception_cfg_set/get(): fix for "exception_meter_id" handling
- flush PLOAM FIFO when enter state 7
- don't send serial number PLOAM message in state 7
- send additional serial number message once in state 2 (upstream overhead)
and state 3 (assign ONU ID) (otherwise we're loosing the first bwmap request)
- Updated FWD TSE Micro Program to VERSION: 1.12 (changes from schafran)
- GPONSW-423: fix wrong address on 'onu scess'
- SCE: added lock for global group_serviced
- All unused LL functions placed under INCLUDE_UNUSED_LL_FUNCTIONS
- GPONSW-461: add doxygen header in sce2resource.py; fix doxygen errors
bug fix(es):
- set correct instance for accessing ONU_GPE_METER_TABLE_ID
within gpe_meter_cfg_get/set().
- add more ioctl wrappers for configuration without CLI
- GPONSW-448: buffer_overflow mapping added.
- GPONSW-466: make key mandatory for COP tables in gpetg and return error from
gpe_table_entry_intresp when COP entry is not found
- clear structures on various xxx_get() routines
- GPONSW-466: make key mandatory for COP tables in gpetg and return error from
gpe_table_entry_intresp when COP entry is not found
v3.0.8 2011.11.22
API:
- new ioctl(s) added:
+ FIO_GPE_SCE_MAC_SET
+ FIO_GPE_SCE_MAC_GET
- added extensions for "lct" network interface handling
- Local CPU MAC address handling added for FIO_GPE_SCE_CONSTANTS_GET/SET
- Snooping control added for FIO_GPE_EXCEPTION_QUEUE_CFG_GET/SET
- GPONSW-361: add new fuses format handling
- GPONSW-388: moved cop debugging under INCLUDE_COP_DEBUG,
removed obsolete PE FW simulation, fixed usage of onu_is_initialized,
moved many register access calls to the LL part,
moved sce_pe_table_entry_read/write to gpe_table.c
- GPONSW-402: fix gpe_status output
- gpe_tcont_set(): fix range check for pre_egress_port, 127 is disabled
- gpe_tcont_set(): add range check for reg_egress_port, 127 is disabled
- OMCI: use pre_egress_port for default OMCI data flow
- gtop: add REPN / PEPN values to the alloc-id overview
v3.0.7 2011.11.12
- Added configure support for the debug tool event logger
- Adaptations for FW >= 3.27.x with optimized packet mode switching and
removed SYNC bit
- GPONC-274: Limitation Inconsistency in the microcode of FWD COP
v3.0.6 2011.11.10
- GPONSW-361: remove drv_onu_resource_device_psbXXX.h from interface headers
- fix tof and ton return values on mu_low_power_idle_cfg_get
- CLI: add gpe_pe_table_get/set for specifying a pe instance for FW debugging
bug fix(es):
- GTC counters interval handling fixed
- UINT64_MAX, UINT32_MAX, UINT16_MAX definitions fixed
- GTC BIP counter handling fixed: counter accumulation once per BERR
interval added.
v3.0.5 2011.10.28
- GPONSW-338: fill PCP en/decoding with default configuration
- GPONSW-361: add GPE capability support
v3.0.4 2011.10.21
- Fix in arbiter for traffic stuck at 555 MHZ
- COP low level printouts deactivated
v3.0.3 2011.10.15
API:
- new ioctl(s) added:
+ FIO_GPE_TR181_COUNTER_GET
+ FIO_GTC_LAST_CHANGE_TIME_GET
+ FIO_GPE_SCE_CONSTANTS_SET
+ FIO_GPE_SCE_CONSTANTS_GET
common:
- check __GNUC__ to confirm C99 extension
- add valid (V) indication for EQT entries; filter empty lines in gtop
- GPONSW-310: add FW permeter page
- GPONSW-335: add gpe_port_index_get, fix gpe_egress_port_get
- GPONSW-334: remove use_tcont from gpe_scheduler_get/delete input structure
- GPONSW-337: add support for PHY-less LAN ports
- GPONSW-277: add preliminary egress queue, egress port, scheduler XML/JSON
wrappers
bug fix(es):
- fix returned tod_nano_seconds from gpe_tod_sync_get
- TOD: fix ASC1 support & printouts; use 9600 baud rate for ASC1
v3.0.1 2011.08.31
API:
- "struct gpe_lan_exception_cfg" extended
- "struct lan_port_cfg " extended with "lpi_enable"
common:
- added support for ONU configuration via options (with disabled CLI)
- exception packets handling added
- FIO_GPE_ETHERNET_RECEIVE/SEND ioctls removed
- "--with-procfs" configuration option added (enabled by default)
- "--with-sce-dbg" configuration option added (enabled by default)
- removed printk usage from scebp, scebc, scerp (implemented custom CLI
handlers)
bug fix(es):
- gpe_lan_exception_cfg_set/get(): fixed table index
v3.0.0 2011.08.05
common:
- corrected formulas for tmu_tbs_srm_conversion() and tmu_tbs_rate_conversion()
functions to avoid uint32_t range exceeding while value calculation
- changed interface from meter_set/get to meter_cfg_set/get
- added interface meter_status_get
- Fix in arbiter for traffic stuck at 555 MHZ
- OMCI dump includes message priorities
- reset the laser delay to a pre-defined value
- add LAN_FLOW_CONTROL_MODE_NONE
- if at least one of the 4 lan ports is up - enable the host lan port
bug fix(es):
- GPONSW-243: wrong range check within gpe_token_bucket_shaper_create.
Range check fixed.
- ssb_data_read: fix handling for a spread pdu body
- fixed COP error code mapping
- GPONSW-243: wrong range check within gpe_token_bucket_shaper_create.
Range check fixed.
- fixed tmu_token_bucket_shaper_cfg_get. The parameters pir, pbs and cir,
cbs were written into the wrong registers of the TMU.
- fixed GTC register dump
- add BWmap dump
- if at least one of the 4 lan ports is up - enable the host lan port
- enable the netdev rx interrupt if the PLOAM5 is reached already in open function
- Ethernet Activity LEDs swapped, Activity LED blinking without cable plugged in.
Link state analysis added.
v2.0.1 2011.05.25
CLI:
- command(s) extended:
+ lanpcs/lanpcg: max_frame_size added
common:
- new even(s) added:
+ ONU_EVENT_15MIN_INTERVAL_END
- Added a reboot and initialization of the TMU in gpe_init
- OCTRLG/ICTRLG counters handling fixed
- Common counters wrap-around handling fixed
- max_frame_size parameter added to "struct lan_port_cfg"
- corrected formulas for priority queue fields "Packet drop max_p"
- Aging process trigger added
- FIO_GPE_AGING_TIME_SET/GET calculations fixed
- struct gtc_status:gtc_ds_delay handling added
- multiple PE firmware binaries support added
v2.0.0 2011.04.15
CLI:
- new command(s) added:
+ mmddr/mmddw
common:
- new ioctl(s) added:
+ FIO_MMD_DATA_READ
+ FIO_MMD_DATA_WRITE
- WOL handling extended
- interface for the netdev driver reworked
- new configuration option(s) added
+ --with-lan-raw (to be removed in the FS2)
- Always calibrate tx buffer if gtc_tx_enable is done & during O6 - O5 state change
- Superfluous parameter to the command "onu gpetg".
"gpetg" CLI command handling improved, "data" field now is optional and will
be handled only in case of data_count!=0.
- Added a check for the seq_printf call to reprint the lines on the page
boundaries
- Replace flood_map by uuc_flood_disable in bridge port table
- Auto-negotiation support added for RXMII modes
- "tmu_global_packets_max" field removed from the "struct gpe_shared_buffer_cfg"
- "tmu_egress_queue_table_init()" color settings fixed
v1.0.7 2011.02.25
- Improved COP loader
- fix for unresolved "uevent_sock" in kernel 2.6.35 and add broadcast_uevent for older kernel
- xMII port mapping changed
- GPE_PDU_TYPE_CMD corrected, FIO_GPE_AGE_GET and GPE_SCE_CMD_AGING added
- add i/octrlg_table_dump
v1.0.6 2011.02.19
common:
- new ioctl(s) added:
+ FIO_LAN_GPHY_FIRMWARE_DOWNLOAD
- new configuration option(s) added:
+ "with-cli-dump"/INCLUDE_CLI_DUMP_SUPPORT
- new file(s) added:
+ drv_onu_cli_dump.c
+ drv_onu_cli_dump.h
+ drv_onu_cli_dump_misc.c
+ drv_onu_cli_dump_misc.h
- ONU_EVENT_IOCTL_TRACE event handling added
CLI:
- new command(s) added:
+ "gpeepg/gpe_egress_port_get"
+ "gpeepd/gpe_egress_port_delete"
+ "langfd/lan_gphy_firmware_download"
v1.0.5 2011.01.28
- new ioctl(s) added:
+ FIO_GPE_COP_TRACING_ENABLE_SET
CLI:
- new command(s) added:
+ "gpectes/gpe_cop_tracing_enable_set"
- check for modules initialization before accessing them, avoid early crash
of Ethernet driver
v1.0.4 2011.01.07
CLI:
- new command(s) added:
+ "onuccs/onu_counters_cfg_set"
+ "onuccg/onu_counters_cfg_get"
common:
- ioctl(s) implementation added:
+ FIO_ONU_SYNC_TIME_SET
+ FIO_ONU_SYNC_TIME_GET
+ FIO_ONU_COUNTERS_CFG_SET
+ FIO_ONU_COUNTERS_CFG_GET
- moved ploam initialization from module load to a new
mandatory interface FIO_PLOAM_INIT.
v1.0.3 2010.12.16
- ioctl(s) removed:
+ FIO_LAN_STATUS_GET
+ FIO_GPE_LAN_COUNTER_GET
+ FIO_GPE_LAN_COUNTER_THRESHOLD_SET
+ FIO_GPE_LAN_COUNTER_THRESHOLD_GET
+ FIO_GPE_LAN_TCA_GET
+ FIO_GPE_LAN_COUNTER_RESET
- new ioctl(s) added:
+ FIO_LAN_COUNTER_THRESHOLD_SET
+ FIO_LAN_COUNTER_THRESHOLD_GET
+ FIO_LAN_TCA_GET
- TMU counters handling added
- VUNI EPN numbers fixed
v1.0.2 2010.11.30
- new file(s) added:
+ drv_onu_lan_api_intern.h
- implementation added:
+ mdio_enable()
+ mdio_disable()
+ lan_port_status_get()
+ lan_port_enable()
+ lan_port_disable()
v1.0.1 2010.11.22
common:
- new ioctl(s) added:
+ FIO_GPE_ACTIVITY_GET
+ FIO_GPE_BRIDGE_PORT_CFG_GET
+ FIO_GPE_BRIDGE_PORT_CFG_SET
+ FIO_GPE_EXT_VLAN_GET
+ FIO_GPE_EXT_VLAN_SET
+ FIO_GPE_FID_ADD
+ FIO_GPE_FID_DELETE
+ FIO_GPE_FID_GET
+ FIO_GPE_FID_SET
+ FIO_GPE_FID_READ
+ FIO_GPE_FID_WRITE
+ FIO_GPE_IPV6_MC_ENTRY_ADD
+ FIO_GPE_IPV6_MC_ENTRY_DELETE
+ FIO_GPE_IPV6_MC_ENTRY_GET
+ FIO_GPE_IPV6_MC_ENTRY_SET
+ FIO_GPE_IPV6_MC_ENTRY_READ
+ FIO_GPE_IPV6_MC_ENTRY_WRITE
+ FIO_GPE_IPV6_UC_ENTRY_ADD
+ FIO_GPE_IPV6_UC_ENTRY_DELETE
+ FIO_GPE_IPV6_UC_ENTRY_GET
+ FIO_GPE_IPV6_UC_ENTRY_SET
+ FIO_GPE_IPV6_UC_ENTRY_READ
+ FIO_GPE_IPV6_UC_ENTRY_WRITE
+ FIO_GPE_NAPT_ADD
+ FIO_GPE_NAPT_DELETE
+ FIO_GPE_NAPT_GET
+ FIO_GPE_NAPT_SET
+ FIO_GPE_NAPT_READ
+ FIO_GPE_NAPT_WRITE
+ FIO_GPE_POLICER_GET
+ FIO_GPE_POLICER_SET
+ FIO_GPE_TAGGING_FILTER_GET
+ FIO_GPE_TAGGING_FILTER_SET
+ FIO_GPE_BRIDGE_COUNTER_GET
+ FIO_GPE_BRIDGE_THRESHOLD_SET
+ FIO_GPE_BRIDGE_THRESHOLD_GET
+ FIO_GPE_BRIDGE_TCA_GET
+ FIO_GPE_BRIDGE_COUNTER_RESET
- implementation added:
+ lan_cfg_set()
+ lan_cfg_get()
+ lan_port_cfg_set()
+ lan_port_cfg_get()
+ lan_loop_cfg_set()
+ lan_loop_cfg_get()
- new file(s) added:
+ drv_onu_reg_sxgmii.h
+ drv_onu_gpe_tables_interface.h
+ drv_onu_gpe_tables_api.h
v1.0.0 - 2010.10.29
CLI:
- onuvg -> vig
- vig 'version' argument changed to 'onu_version'
- "nReturn" replaced globally to "errorcode"
- new command(s) added:
+ "gpellme"/"gpe_low_level_modules_enable"
- parameters renaming
+ "gpei"
+ "gpecs"/"gpecg"
- new parameters added for cmd(s):
+ "gpei"
- "gpeor"/"GPE_OMCI_Receive" removed
- Long commands names changed globally after automated renaming
- existing cmd(s) removed:
+ "gpesg"/"gpe_scheduler_get"
+ "gpeepg"/"gpe_egress_port_get"
IOCTL:
- new ioctl(s) added:
+ FIO_GPE_LOW_LEVEL_MODULES_ENABLE
- existing ioctl(s) removed:
+ FIO_GPE_OMCI_RECEIVE
+ FIO_GPE_SCHEDULER_ADD
- renaming:
+ FIO_GPE_EGRESS_QUEUE_ADD -> FIO_GPE_EGRESS_QUEUE_CREATE
+ FIO_GPE_SCHEDULER_ADD -> FIO_GPE_SCHEDULER_CREATE
common:
- force state O0 in case of BWMAP trace trigger
- add token bucket meter
- LL modules activation sequence re-worked, CLKEN/ACT added
- source code re-factoring:
+ IQM module
+ SSB module
+ SYS module
- global renaming of SDMAx to ICTRLx, FDMAx to OCTRLx
- all function names changed to lower case
- refactored onu_top
- several klocwork fixes
- gpe_scheduler_add implementation added
- SCE debug interface implementation integrated from the "gpon-uboot" package
- gpe_egress_port_get() removed
- gpe_egress_port_cfg_get/set() extended
- Falcon SoC interrupt handling added
v0.5.2 - 2010.06.xx
- added TMU init routines
v0.5.1 - 2010.06.11
- implemented GTC_BwmtXXX functions
- GTC trace added
- fixed bDsFecEnable in GTC_StatusGet()
v0.5.0 - 2010.06.09
- RTL 2.1 / FPGA update
- ictrlc handling added

368
LICENSE Normal file
View File

@ -0,0 +1,368 @@
This source code is distributed under a dual license of GPL and BSD (2-clause).
Please choose the appropriate license for your intended usage.
1. BSD license (2-clause BSD license)
Copyright (c) 2009, Lantiq Deutschland GmbH
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.
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 THE COPYRIGHT HOLDER OR 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.
2. GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

74
Makefile.am Normal file
View File

@ -0,0 +1,74 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = foreign 1.7 nostdinc
if ENABLE_LINUX
LINUXDIRS = netdev led-trigger tools/gtop tools/gexdump tools/onu tools/rpc
endif ENABLE_LINUX
SUBDIRS = src $(LINUXDIRS)
DISTCHECK_CONFIGURE_FLAGS=@CONFIGURE_OPTIONS@
drv_onu_docdir = ${prefix}/doc/drv_onu
drv_onu_doc_DATA = \
LICENSE \
README \
AUTHORS \
ChangeLog \
NEWS \
TODO \
doc/doxyconfig \
doc/footer.html \
doc/header.html \
doc/logo.gif \
doc/stylesheet.css
EXTRA_DIST = $(drv_onu_doc_DATA)
clean-local:
rm -Rf .built .built_check .version* .prepared* ipkg/
# Copy all the spec files. Of cource, only one is actually used.
dist-hook:
for specfile in *.spec; do \
if test -f $$specfile; then \
cp -p $$specfile $(distdir); \
fi \
done
lint:
@target=lint; \
list='$(SUBDIRS)'; \
for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done;
# Create self extracting linux distribution
distcheck-hook:
chmod a+w $(distdir)
echo "Checking line ends ...!!!"; \
find $(distdir) -type f -exec file {} \; | grep -e "CRLF" -e "Non-ISO" && exit 1; \
echo "Create installation package ..."; \
makeself.sh --gzip --notemp $(distdir) \
gpon_onu_drv-$(PACKAGE_VERSION).sh "$(PACKAGE_NAME)"
doc:
( cd @top_srcdir@/doc; \
doxygen doxyconfig; )
doc_cli:
( cd @top_srcdir@/doc; \
python @top_srcdir@/scripts/cli_parser.py; \
doxygen @top_srcdir@/doc/doxyconfig_cli; )
.PHONY: lint doc doc_cli

694
Makefile.in Normal file
View File

@ -0,0 +1,694 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \
ChangeLog NEWS TODO build-aux/compile build-aux/depcomp \
build-aux/install-sh build-aux/missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/drv_onu_config.h \
$(top_builddir)/tools/onu/onu_control_config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(drv_onu_docdir)"
drv_onu_docDATA_INSTALL = $(INSTALL_DATA)
DATA = $(drv_onu_doc_DATA)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = src netdev led-trigger tools/gtop tools/gexdump \
tools/onu tools/rpc
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EVENT_LOGGER_INCL_PATH = @EVENT_LOGGER_INCL_PATH@
EXEEXT = @EXEEXT@
GREP = @GREP@
IFXOS_INCLUDE_PATH = @IFXOS_INCLUDE_PATH@
IFXOS_LIBRARY_PATH = @IFXOS_LIBRARY_PATH@
INCLUDE_REMOTE_ONLY_ONU = @INCLUDE_REMOTE_ONLY_ONU@
INCLUDE_REMOTE_ONU = @INCLUDE_REMOTE_ONU@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
KERNEL_ARCH = @KERNEL_ARCH@
KERNEL_BUILD_PATH = @KERNEL_BUILD_PATH@
KERNEL_INCL_PATH = @KERNEL_INCL_PATH@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = foreign 1.7 nostdinc
@ENABLE_LINUX_TRUE@LINUXDIRS = netdev led-trigger tools/gtop tools/gexdump tools/onu tools/rpc
SUBDIRS = src $(LINUXDIRS)
DISTCHECK_CONFIGURE_FLAGS = @CONFIGURE_OPTIONS@
drv_onu_docdir = ${prefix}/doc/drv_onu
drv_onu_doc_DATA = \
LICENSE \
README \
AUTHORS \
ChangeLog \
NEWS \
TODO \
doc/doxyconfig \
doc/footer.html \
doc/header.html \
doc/logo.gif \
doc/stylesheet.css
EXTRA_DIST = $(drv_onu_doc_DATA)
all: all-recursive
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
cd $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
install-drv_onu_docDATA: $(drv_onu_doc_DATA)
@$(NORMAL_INSTALL)
test -z "$(drv_onu_docdir)" || $(MKDIR_P) "$(DESTDIR)$(drv_onu_docdir)"
@list='$(drv_onu_doc_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(drv_onu_docDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(drv_onu_docdir)/$$f'"; \
$(drv_onu_docDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(drv_onu_docdir)/$$f"; \
done
uninstall-drv_onu_docDATA:
@$(NORMAL_UNINSTALL)
@list='$(drv_onu_doc_DATA)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(drv_onu_docdir)/$$f'"; \
rm -f "$(DESTDIR)$(drv_onu_docdir)/$$f"; \
done
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
test -d $(distdir) || mkdir $(distdir)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
am__remove_distdir=: \
am__skip_length_check=: \
distdir) \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-lzma: distdir
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& $(MAKE) $(AM_MAKEFLAGS) distcheck-hook \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile $(DATA)
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(drv_onu_docdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-local mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am: install-drv_onu_docDATA
install-dvi: install-dvi-recursive
install-exec-am:
install-html: install-html-recursive
install-info: install-info-recursive
install-man:
install-pdf: install-pdf-recursive
install-ps: install-ps-recursive
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-drv_onu_docDATA
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
install-strip
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
clean-local ctags ctags-recursive dist dist-all dist-bzip2 \
dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-zip \
distcheck distclean distclean-generic distclean-tags \
distcleancheck distdir distuninstallcheck dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-drv_onu_docDATA install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
tags-recursive uninstall uninstall-am \
uninstall-drv_onu_docDATA
clean-local:
rm -Rf .built .built_check .version* .prepared* ipkg/
# Copy all the spec files. Of cource, only one is actually used.
dist-hook:
for specfile in *.spec; do \
if test -f $$specfile; then \
cp -p $$specfile $(distdir); \
fi \
done
lint:
@target=lint; \
list='$(SUBDIRS)'; \
for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done;
# Create self extracting linux distribution
distcheck-hook:
chmod a+w $(distdir)
echo "Checking line ends ...!!!"; \
find $(distdir) -type f -exec file {} \; | grep -e "CRLF" -e "Non-ISO" && exit 1; \
echo "Create installation package ..."; \
makeself.sh --gzip --notemp $(distdir) \
gpon_onu_drv-$(PACKAGE_VERSION).sh "$(PACKAGE_NAME)"
doc:
( cd @top_srcdir@/doc; \
doxygen doxyconfig; )
doc_cli:
( cd @top_srcdir@/doc; \
python @top_srcdir@/scripts/cli_parser.py; \
doxygen @top_srcdir@/doc/doxyconfig_cli; )
.PHONY: lint doc doc_cli
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

0
NEWS Normal file
View File

0
README Normal file
View File

7
TODO Normal file
View File

@ -0,0 +1,7 @@
- IRQ integration
- dispatch IRQ data to FIFO's of open instance
- disable IRQ during dispatching
- add LED handling (for FPGA)
- more uesfull info to /proc

902
aclocal.m4 vendored Normal file
View File

@ -0,0 +1,902 @@
# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(AC_AUTOCONF_VERSION, [2.62],,
[m4_warning([this file was generated for autoconf 2.62.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.10'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.10.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
# _AM_AUTOCONF_VERSION(VERSION)
# -----------------------------
# aclocal traces this macro to find the Autoconf version.
# This is a private macro too. Using m4_define simplifies
# the logic in aclocal, which can simply ignore this definition.
m4_define([_AM_AUTOCONF_VERSION], [])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.10.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run. This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
# fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
# fails if $ac_aux_dir is absolute,
# fails when called from a subdirectory in a VPATH build with
# a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is `.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
# MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[dnl Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])dnl
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 8
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 9
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "GCJ", or "OBJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
# dependency, and given that the user is not expected to run this macro,
# just rely on AC_PROG_CC.
AC_DEFUN([_AM_DEPENDENCIES],
[AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
[$1], CXX, [depcc="$CXX" am_compiler_list=],
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], UPC, [depcc="$UPC" am_compiler_list=],
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output
# in D'.
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_$1_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
# Solaris 8's {/usr,}/bin/sh.
touch sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
case $depmode in
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
none) break ;;
esac
# We check with `-c' and `-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this.
if depmode=$depmode \
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE(dependency-tracking,
[ --disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])dnl
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#serial 3
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[for mf in $CONFIG_FILES; do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named `Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running `make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
# AM_OUTPUT_DEPENDENCY_COMMANDS
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each `.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 13
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call (pre autoconf-2.50), which is being phased out. PACKAGE
# and VERSION should now be passed to AC_INIT and removed from
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition. After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.60])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
if test "`cd $srcdir && pwd`" != "`pwd`"; then
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
# is not polluted with repeated "-I."
AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
# test to see if srcdir already configured
if test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
AM_PROG_INSTALL_SH
AM_PROG_INSTALL_STRIP
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
[_AM_DEPENDENCIES(OBJC)],
[define([AC_PROG_OBJC],
defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
])
])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
_am_arg=$1
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$_am_arg | $_am_arg:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
@echo done
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# We grep out `Entering directory' and `Leaving directory'
# messages which can occur if `w' ends up in MAKEFLAGS.
# In particular we don't look at `^make:' because GNU make might
# be invoked under some other name (usually "gmake"), in which
# case it prints its new name instead of `make'.
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
am__include=include
am__quote=
_am_result=GNU
fi
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
am__include=.include
am__quote="\""
_am_result=BSD
fi
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 5
# AM_PROG_CC_C_O
# --------------
# Like AC_PROG_CC_C_O, but changed for automake.
AC_DEFUN([AM_PROG_CC_C_O],
[AC_REQUIRE([AC_PROG_CC_C_O])dnl
AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([compile])dnl
# FIXME: we rely on the cache variable name because
# there is no other way.
set dummy $CC
ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
# Losing compiler, so override with the script.
# FIXME: It is wrong to rewrite CC.
# But if we don't then we get into trouble of one sort or another.
# A longer-term fix would be to have automake use am__CC in this case,
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
CC="$am_aux_dir/compile $CC"
fi
dnl Make sure AC_PROG_CC is never called again, or it will override our
dnl setting of CC.
m4_define([AC_PROG_CC],
[m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 5
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it supports --run.
# If it does, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
AC_MSG_WARN([`missing' script is too old or missing])
fi
])
# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_MKDIR_P
# ---------------
# Check for `mkdir -p'.
AC_DEFUN([AM_PROG_MKDIR_P],
[AC_PREREQ([2.60])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
dnl while keeping a definition of mkdir_p for backward compatibility.
dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
dnl Makefile.ins that do not define MKDIR_P, so we do our own
dnl adjustment using top_builddir (which is defined more often than
dnl MKDIR_P).
AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
case $mkdir_p in
[[\\/$]]* | ?:[[\\/]]*) ;;
*/*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
esac
])
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
# ------------------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
# _AM_SET_OPTIONS(OPTIONS)
# ----------------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftest.file
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT(yes)])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in `make install-strip', and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'. However `strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
# This macro is traced by Automake.
AC_DEFUN([_AM_SUBST_NOTMAKE])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# _AM_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
# FORMAT should be one of `v7', `ustar', or `pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
# $tardir.
# tardir=directory && $(am__tar) > result.tar
#
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility.
AM_MISSING_PROG([AMTAR], [tar])
m4_if([$1], [v7],
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
[m4_case([$1], [ustar],, [pax],,
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
# Do not fold the above two line into one, because Tru64 sh and
# Solaris sh will not grok spaces in the rhs of `-'.
for _am_tool in $_am_tools
do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar;
do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
# tar/untar a dummy directory, and stop if the command works
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar <conftest.tar])
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR

142
build-aux/compile Executable file
View File

@ -0,0 +1,142 @@
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
scriptversion=2005-05-14.22
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# 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-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand `-c -o'.
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file `INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
esac
ofile=
cfile=
eat=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as `compile cc -o foo foo.c'.
# So we strip `-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no `-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# `.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
# Create the lock directory.
# Note: use `[/.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

589
build-aux/depcomp Executable file
View File

@ -0,0 +1,589 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2007-03-29.01
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# 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-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

519
build-aux/install-sh Executable file
View File

@ -0,0 +1,519 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2006-12-25.00
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
-*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

367
build-aux/missing Executable file
View File

@ -0,0 +1,367 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2006-05-10.23
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# 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-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
esac
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program).
case $1 in
lex|yacc)
# Not GNU programs, they don't have --version.
;;
tar)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case $1 in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if test ! -f y.tab.h; then
echo >y.tab.h
fi
if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '
/^@setfilename/{
s/.* \([^ ]*\) *$/\1/
p
q
}' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
tar)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case $firstarg in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case $firstarg in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

7677
configure vendored Executable file

File diff suppressed because it is too large Load Diff

548
configure.in Normal file
View File

@ -0,0 +1,548 @@
dnl Process this file with autoconf to produce a configure script.
AC_REVISION($Revision: 1.10 $)
AC_INIT([GPON Optical Network Unit Driver],[4.5.0],[],[gpon_onu_drv])
AC_CONFIG_AUX_DIR([build-aux])
AC_PROG_CC
ifdef([AC_PROG_CC_STDC], [AC_PROG_CC_STDC])
AC_LANG([C])
AC_PROG_RANLIB
AC_CONFIG_SRCDIR(src/drv_onu_common.c)
AM_INIT_AUTOMAKE
AM_PROG_CC_C_O
AC_PROG_CXX
AC_CONFIG_HEADER(src/drv_onu_config.h tools/onu/onu_control_config.h:src/drv_onu_config.h.in)
AH_TOP([
/******************************************************************************
Copyright (c) 2012
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _GPON_ONU_CONFIG_H
#define _GPON_ONU_CONFIG_H])
AH_BOTTOM([
#endif /* _GPON_ONU_CONFIG_H */])
#
# save the configure arguments
#
CONFIGURE_OPTIONS="$ac_configure_args"
AC_SUBST(CONFIGURE_OPTIONS)
AC_CHECK_TYPES([ulong_t])
dnl enable linux kernel 2.6.x support
AM_CONDITIONAL(KERNEL_2_6, true)
AC_ARG_ENABLE(linux-26,
AS_HELP_STRING(--enable-linux-26,Enable support for linux kernel 2.6.x),
[
AM_CONDITIONAL(KERNEL_2_6, true)
if test -z "$ARCH" ; then
[ARCH=`$CC -dumpmachine | sed -e s'/-.*//' \
-e 's/i[3-9]86/i386/' \
-e 's/mipsel/mips/' \
-e 's/powerpc/ppc/' \
-e 's/sh[234]/sh/' \
`]
fi
if test -n "$ARCH" ; then
echo "Set the kernel architecture to $ARCH"
AC_SUBST([KERNEL_ARCH],[$ARCH])
else
AC_MSG_ERROR([Kernel architecture not set!])
fi
]
)
dnl Set kernel include path (Linux, eCos, ...)
DEFAULT_KERNEL_INCL_PATH='.'
AC_ARG_ENABLE(kernelincl,
AS_HELP_STRING([--enable-kernelincl=x],[Set the target kernel include path
]),
[
if test -n $enableval; then
echo Set the kernel include path $enableval
AC_SUBST([KERNEL_INCL_PATH],[$enableval])
else
echo Set the default kernel include path $DEFAULT_KERNEL_INCL_PATH
AC_SUBST([KERNEL_INCL_PATH],[$DEFAULT_KERNEL_INCL_PATH])
fi
],
[
echo Set the default kernel include path $DEFAULT_KERNEL_INCL_PATH
AC_SUBST([KERNEL_INCL_PATH],[$DEFAULT_KERNEL_INCL_PATH])
]
)
dnl Set kernel build path
AC_ARG_ENABLE(kernelbuild,
AS_HELP_STRING(--enable-kernelbuild=x,Set the target kernel build path (only for kernel 2.6.x)),
[
if test -e $enableval/include/linux/autoconf.h -o -e $enableval/include/generated/autoconf.h; then
AC_SUBST([KERNEL_BUILD_PATH],[$enableval])
else
AC_MSG_ERROR([The kernel build directory is not valid or not configured!])
fi
],
[
if test -z $KERNEL_BUILD_PATH; then
# assume kernel was build in source dir...
AC_SUBST([KERNEL_BUILD_PATH],[$KERNEL_INCL_PATH/..])
fi
]
)
dnl set libifxos.a library path
DEFAULT_IFXOS_LIBRARY_PATH='-L.'
AC_ARG_ENABLE(ifxos-library,
AS_HELP_STRING([--enable-ifxos-library=/path/to/your/lib_ifxos/src] , [Set the lib_ifxos library path. In this location the libifxos.a should be found]),
[
if test -n "$enableval"; then
echo Set the libifxos.a library path to $enableval
AC_SUBST([IFXOS_LIBRARY_PATH],[$enableval])
else
echo Set the lib_board_config library path $DEFAULT_IFXOS_LIBRARY_PATH
AC_SUBST([IFXOS_LIBRARY_PATH],[$DEFAULT_IFXOS_LIBRARY_PATH])
fi
],
[
echo Set the libifxos.a library path $DEFAULT_IFXOS_LIBRARY_PATH
AC_SUBST([IFXOS_LIBRARY_PATH],[$DEFAULT_IFXOS_LIBRARY_PATH])
]
)
dnl set lib_ifxos include path
DEFAULT_IFXOS_INCLUDE_PATH='-I.'
AC_ARG_ENABLE(ifxos-include,
AS_HELP_STRING([--enable-ifxos-include=-I/path/to/your/lib_ifxos/src/include],[Set the lib_ifxos include path.]),
[
if test -n "$enableval"; then
echo Set the lib_ifxos include path $enableval
AC_SUBST([IFXOS_INCLUDE_PATH],[$enableval])
else
echo -e Set the default lib_ifxos include path $DEFAULT_IFXOS_INCLUDE_PATH
AC_SUBST([IFXOS_INCLUDE_PATH],[$DEFAULT_IFXOS_INCLUDE_PATH])
fi
],
[
echo -e Set the default lib_ifxos include path $DEFAULT_IFXOS_INCLUDE_PATH
AC_SUBST([IFXOS_INCLUDE_PATH],[$DEFAULT_IFXOS_INCLUDE_PATH])
]
)
dnl set device type
AC_ARG_ENABLE(device,
AS_HELP_STRING(
[--enable-device=type],
[Set the device type. Available options: PSB98010, PSB98020, PSB98030]
),
[
case $enableval in
PSB98010|PSB98020|PSB98030)
AC_DEFINE_UNQUOTED(ONU_DEVICE_PSB980xx,ONU_DEVICE_$enableval,[Selected device type])
echo "Selected device type: $enableval"
;;
*) AC_MSG_ERROR([Device selection invalid: $enableval]);
;;
esac
],
[
echo "Automatically selected device type: PSB98030"
AC_DEFINE(ONU_DEVICE_PSB980xx,ONU_DEVICE_PSB98030,[Selected device type])
]
)
dnl compile for linux kernel
ENABLE_LINUX=true
AC_ARG_ENABLE(linux,
AS_HELP_STRING(
[--enable-linux],
[Enable linux support]
),
[
case $enableval in
0|no)
ENABLE_LINUX=false
;;
1|yes)
;;
*) AC_MSG_ERROR([linux support]);
;;
esac
]
)
dnl Build simulation application
AM_CONDITIONAL(ONU_SIMULATION, false)
AC_ARG_WITH(onu-simulation,
AS_HELP_STRING(
[--with-onu-simulation],
[ONU simulation]
),
[
echo ONU simulation = $withval
case $withval in
0|no)
;;
1|yes)
AC_DEFINE(ONU_SIMULATION,,[ONU simulation])
AM_CONDITIONAL(ONU_SIMULATION, true)
ENABLE_LINUX=false
;;
*) AC_MSG_ERROR([ ONU simulation ]);
;;
esac
],
[
echo ONU simulation disabled
]
)
dnl Build os independend library
AM_CONDITIONAL(ONU_LIBRARY, false)
AC_ARG_WITH(onu-library,
AS_HELP_STRING(
[--with-onu-library],
[ONU library]
),
[
echo ONU library = $withval
case $withval in
0|no)
;;
1|yes)
AC_DEFINE(ONU_LIBRARY,,[ONU library])
AM_CONDITIONAL(ONU_LIBRARY, true)
ENABLE_LINUX=false
;;
*) AC_MSG_ERROR([ ONU library ]);
;;
esac
],
[
echo ONU library disabled
]
)
AM_CONDITIONAL(ENABLE_LINUX, $ENABLE_LINUX)
if test "$ENABLE_LINUX" == "true" ; then
AC_DEFINE(ENABLE_LINUX,,[compile for linux kernel])
fi
dnl Include Command Line Interface
AC_ARG_WITH(cli,
AS_HELP_STRING(
[--with-cli],
[Command Line Interface]
),
[
echo Command Line Interface = $withval
case $withval in
0|no)
;;
1|yes)
AC_DEFINE(INCLUDE_CLI_SUPPORT,,[Command Line Interface])
;;
*) AC_MSG_ERROR([ Command Line Interface ]);
;;
esac
],
[
echo Command Line Interface enabled
AC_DEFINE(INCLUDE_CLI_SUPPORT,,[Command Line Interface])
]
)
dnl Include procfs support
AC_ARG_WITH(procfs,
AS_HELP_STRING(
[--with-procfs],
[proc filesystem]
),
[
echo proc filesystem = $withval
case $withval in
0|no)
;;
1|yes)
AC_DEFINE(INCLUDE_PROCFS_SUPPORT,,[proc filesystem])
;;
*) AC_MSG_ERROR([ proc filesystem ]);
;;
esac
],
[
echo procfs support enabled
AC_DEFINE(INCLUDE_PROCFS_SUPPORT,,[proc filesystem])
]
)
dnl Include SCE debug support
AC_ARG_WITH(sce-dbg,
AS_HELP_STRING(
[--with-sce-dbg],
[SCE debug]
),
[
echo SCE debug = $withval
case $withval in
0|no)
;;
1|yes)
AC_DEFINE(INCLUDE_SCE_DEBUG,,[SCE debug])
;;
*) AC_MSG_ERROR([ SCE debug ]);
;;
esac
],
[
echo SCE debug support enabled
AC_DEFINE(INCLUDE_SCE_DEBUG,,[SCE debug])
]
)
dnl Include COP debug support
AC_ARG_WITH(cop-dbg,
AS_HELP_STRING(
[--with-cop-dbg],
[COP debug]
),
[
echo COP debug = $withval
case $withval in
0|no)
;;
1|yes)
AC_DEFINE(INCLUDE_COP_DEBUG,,[COP debug])
;;
*) AC_MSG_ERROR([ COP debug ]);
;;
esac
],
[
echo COP debug support enabled
AC_DEFINE(INCLUDE_COP_DEBUG,,[COP debug])
]
)
dnl Include Command Line Interface Dump
AC_ARG_WITH(cli-dump,
AS_HELP_STRING(
[--with-cli-dump],
[Command Line Interface Dump]
),
[
echo Command Line Interface Dump = $withval
case $withval in
0|no)
;;
1|yes)
AC_DEFINE(INCLUDE_CLI_DUMP_SUPPORT,,[Command Line Interface Dump])
;;
*) AC_MSG_ERROR([ Command Line Interface Dump ]);
;;
esac
],
[
echo Command Line Interface Dump disabled
]
)
dnl Add debugging information
AC_ARG_WITH(debug-support,
AS_HELP_STRING(
[--with-debug-support],
[Debug Support]
),
[
echo Debug Support = $withval
case $withval in
0|no)
;;
1|yes)
AC_DEFINE(INCLUDE_DEBUG_SUPPORT,,[Debug Support])
;;
*) AC_MSG_ERROR([Debug Support]);
;;
esac
],
[
echo Debug Support enabled
AC_DEFINE(INCLUDE_DEBUG_SUPPORT,,[Debug Support])
]
)
dnl Print TOD output on ASC1
AC_ARG_WITH(tod-asc1,
AS_HELP_STRING(
[--with-tod-asc1],
[Print TOD output on ASC1]
),
[
echo TOD output on ASC1 = $withval
case $withval in
0|no)
;;
1|yes)
AC_DEFINE(ONU_TOD_ASC1,,[TOD output on ASC1])
;;
*) AC_MSG_ERROR([ TOD output on ASC1 ]);
;;
esac
],
[
echo no TOD output
]
)
dnl Export debug symbols
AC_ARG_WITH(dbg-exports,
AS_HELP_STRING(
[--with-dbg-exports],
[Export debug symbols]
),
[
echo Export debug symbols = $withval
case $withval in
0|no)
;;
1|yes)
AC_DEFINE(ONU_DBG_EXPORTS,,[Export debug symbols])
;;
*) AC_MSG_ERROR([ Do not export debug symbols ]);
;;
esac
],
[
echo Do not export debug symbols
]
)
dnl Enable XML & JSON SCE tables wrappers
AM_CONDITIONAL(ONU_SCE_TABLES_WRAPPERS, false)
AC_ARG_WITH(sce-tables-wrappers,
AS_HELP_STRING(
[--with-sce-tables-wrappers],
[Enable XML and JSON SCE tables wrappers]
),
[
echo Enable XML and JSON SCE tables wrappers = $withval
case $withval in
0|no)
;;
1|yes)
AC_DEFINE(ONU_SCE_TABLES_WRAPPERS,,[Enable XML and JSON SCE tables wrappers])
AM_CONDITIONAL(ONU_SCE_TABLES_WRAPPERS, true)
;;
*) AC_MSG_ERROR([ Disable XML and JSON SCE tables wrappers ]);
;;
esac
],
[
echo Disable XML and JSON SCE tables wrappers
]
)
dnl Maximum number of supported LAN ports
DEFAULT_ONU_MAX_ETH_UNI=4
AC_ARG_WITH(max-eth-uni,
AS_HELP_STRING(
[--with-max-eth-uni],
[Maximum number of supported LAN ports]
),
[
if test -n $withval; then
echo Maximum number of supported LAN ports = $withval
AC_DEFINE_UNQUOTED(ONU_MAX_ETH_UNI,[$withval],[Maximum number of supported LAN ports])
else
echo Maximum number of supported LAN ports = $DEFAULT_ONU_MAX_ETH_UNI
AC_DEFINE_UNQUOTED(ONU_MAX_ETH_UNI,$DEFAULT_ONU_MAX_ETH_UNI,[Maximum number of supported LAN ports])
fi
],
[
echo Maximum number of supported LAN ports = $DEFAULT_ONU_MAX_ETH_UNI
AC_DEFINE_UNQUOTED(ONU_MAX_ETH_UNI,$DEFAULT_ONU_MAX_ETH_UNI,[Maximum number of supported LAN ports])
]
)
dnl set Event Logger includes path
AM_CONDITIONAL(EVENT_LOGGER_DEBUG, false)
AC_ARG_WITH(el-incl,
AC_HELP_STRING(
[--with-el-incl@<:@=-IDIR@:>@],
[Event Logger includes path]
),
[
AC_SUBST([EVENT_LOGGER_INCL_PATH],[$withval])
AC_DEFINE([EVENT_LOGGER_DEBUG],[1],[enable event logger debugging])
AM_CONDITIONAL(EVENT_LOGGER_DEBUG, true)
]
)
dnl enable\disable remote ONU
AC_ARG_ENABLE(remote-onu,
AS_HELP_STRING([--enable-remote-onu],
[enable remote ONU]),
[
if test "$enableval" = yes; then
echo Enable remote ONU
AC_DEFINE([INCLUDE_REMOTE_ONU], [1], [Enable remote ONU])
AC_SUBST([INCLUDE_REMOTE_ONU],[$enableval])
AM_CONDITIONAL(INCLUDE_REMOTE_ONU, true)
else
echo Disable remote ONU
AM_CONDITIONAL(INCLUDE_REMOTE_ONU, false)
fi
],
[
echo Enable remote ONU
AC_DEFINE([INCLUDE_REMOTE_ONU], [1], [Enable remote ONU])
AC_SUBST([INCLUDE_REMOTE_ONU],[$enableval])
AM_CONDITIONAL(INCLUDE_REMOTE_ONU, true)
]
)
dnl enable\disable remote-only ONU
AC_ARG_ENABLE(remote-only-onu,
AS_HELP_STRING([--enable-remote-only-onu],
[enable remote-only ONU]),
[
if test "$enableval" = yes; then
echo Enable remote-only ONU
AC_DEFINE([INCLUDE_REMOTE_ONLY_ONU], [1], [Enable remote-only ONU])
AC_SUBST([INCLUDE_REMOTE_ONLY_ONU],[$enableval])
AM_CONDITIONAL(INCLUDE_REMOTE_ONLY_ONU, true)
else
echo Disable remote-only ONU
AM_CONDITIONAL(INCLUDE_REMOTE_ONLY_ONU, false)
fi
],
[
echo Disable remote-only ONU
AM_CONDITIONAL(INCLUDE_REMOTE_ONLY_ONU, false)
]
)
AC_CONFIG_FILES([Makefile netdev/Makefile led-trigger/Makefile src/Makefile tools/gtop/Makefile tools/gexdump/Makefile tools/onu/Makefile tools/rpc/Makefile])
AC_OUTPUT

1629
doc/doxyconfig Normal file

File diff suppressed because it is too large Load Diff

6
doc/footer.html Normal file
View File

@ -0,0 +1,6 @@
<hr>
<img border="0" src="logo.gif" width="160" height="72">
<address style="align: right;"><small>
Generated on $datetime for $projectname by doxygen $doxygenversion</small></address>
</body>
</html>

5
doc/header.html Normal file
View File

@ -0,0 +1,5 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>$title</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css">
</head><body>

BIN
doc/logo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

458
doc/stylesheet.css Normal file
View File

@ -0,0 +1,458 @@
BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV {
font-family: Geneva, Arial, Helvetica, sans-serif;
}
BODY,TD {
font-size: 90%;
}
H1 {
text-align: center;
font-size: 160%;
}
H2 {
font-size: 120%;
}
H3 {
font-size: 100%;
}
CAPTION { font-weight: bold }
DIV.qindex {
width: 100%;
background-color: #e8eef2;
border: 1px solid #84b0c7;
text-align: center;
margin: 2px;
padding: 2px;
line-height: 140%;
}
DIV.nav {
width: 100%;
background-color: #e8eef2;
border: 1px solid #84b0c7;
text-align: center;
margin: 2px;
padding: 2px;
line-height: 140%;
}
DIV.navtab {
background-color: #e8eef2;
border: 1px solid #84b0c7;
text-align: center;
margin: 2px;
margin-right: 15px;
padding: 2px;
}
TD.navtab {
font-size: 70%;
}
A.qindex {
text-decoration: none;
font-weight: bold;
color: #1A419D;
}
A.qindex:visited {
text-decoration: none;
font-weight: bold;
color: #1A419D
}
A.qindex:hover {
text-decoration: none;
background-color: #ddddff;
}
A.qindexHL {
text-decoration: none;
font-weight: bold;
background-color: #6666cc;
color: #ffffff;
border: 1px double #9295C2;
}
A.qindexHL:hover {
text-decoration: none;
background-color: #6666cc;
color: #ffffff;
}
A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff }
A.el { text-decoration: none; font-weight: bold }
A.elRef { font-weight: bold }
A.code:link { text-decoration: none; font-weight: normal; color: #0000FF}
A.code:visited { text-decoration: none; font-weight: normal; color: #0000FF}
A.codeRef:link { font-weight: normal; color: #0000FF}
A.codeRef:visited { font-weight: normal; color: #0000FF}
A:hover { text-decoration: none; background-color: #f2f2ff }
DL.el { margin-left: -1cm }
.fragment {
font-family: monospace, fixed;
font-size: 95%;
}
PRE.fragment {
border: 1px solid #CCCCCC;
background-color: #f5f5f5;
margin-top: 4px;
margin-bottom: 4px;
margin-left: 2px;
margin-right: 8px;
padding-left: 6px;
padding-right: 6px;
padding-top: 4px;
padding-bottom: 4px;
}
DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px }
DIV.groupHeader {
margin-left: 16px;
margin-top: 12px;
margin-bottom: 6px;
font-weight: bold;
}
DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% }
BODY {
background: white;
color: black;
margin-right: 20px;
margin-left: 20px;
}
TD.indexkey {
background-color: #e8eef2;
font-weight: bold;
padding-right : 10px;
padding-top : 2px;
padding-left : 10px;
padding-bottom : 2px;
margin-left : 0px;
margin-right : 0px;
margin-top : 2px;
margin-bottom : 2px;
border: 1px solid #CCCCCC;
}
TD.indexvalue {
background-color: #e8eef2;
font-style: italic;
padding-right : 10px;
padding-top : 2px;
padding-left : 10px;
padding-bottom : 2px;
margin-left : 0px;
margin-right : 0px;
margin-top : 2px;
margin-bottom : 2px;
border: 1px solid #CCCCCC;
}
TR.memlist {
background-color: #f0f0f0;
}
P.formulaDsp { text-align: center; }
IMG.formulaDsp { }
IMG.formulaInl { vertical-align: middle; }
SPAN.keyword { color: #008000 }
SPAN.keywordtype { color: #604020 }
SPAN.keywordflow { color: #e08000 }
SPAN.comment { color: #800000 }
SPAN.preprocessor { color: #806020 }
SPAN.stringliteral { color: #002080 }
SPAN.charliteral { color: #008080 }
.mdescLeft {
padding: 0px 8px 4px 8px;
font-size: 80%;
font-style: italic;
background-color: #FAFAFA;
border-top: 1px none #E0E0E0;
border-right: 1px none #E0E0E0;
border-bottom: 1px none #E0E0E0;
border-left: 1px none #E0E0E0;
margin: 0px;
}
.mdescRight {
padding: 0px 8px 4px 8px;
font-size: 80%;
font-style: italic;
background-color: #FAFAFA;
border-top: 1px none #E0E0E0;
border-right: 1px none #E0E0E0;
border-bottom: 1px none #E0E0E0;
border-left: 1px none #E0E0E0;
margin: 0px;
}
.memItemLeft {
padding: 1px 0px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: solid;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memItemRight {
padding: 1px 8px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: solid;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memTemplItemLeft {
padding: 1px 0px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memTemplItemRight {
padding: 1px 8px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memTemplParams {
padding: 1px 0px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: solid;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
color: #606060;
background-color: #FAFAFA;
font-size: 80%;
}
.search { color: #003399;
font-weight: bold;
}
FORM.search {
margin-bottom: 0px;
margin-top: 0px;
}
INPUT.search { font-size: 75%;
color: #000080;
font-weight: normal;
background-color: #e8eef2;
}
TD.tiny { font-size: 75%;
}
a {
color: #1A41A8;
}
a:visited {
color: #2A3798;
}
.dirtab { padding: 4px;
border-collapse: collapse;
border: 1px solid #84b0c7;
}
TH.dirtab { background: #e8eef2;
font-weight: bold;
}
HR { height: 1px;
border: none;
border-top: 1px solid black;
}
/* Style for detailed member documentation */
.memtemplate {
font-size: 80%;
color: #606060;
font-weight: normal;
}
.memnav {
background-color: #e8eef2;
border: 1px solid #84b0c7;
text-align: center;
margin: 2px;
margin-right: 15px;
padding: 2px;
}
.memitem {
padding: 4px;
background-color: #eef3f5;
border-width: 1px;
border-style: solid;
border-color: #dedeee;
-moz-border-radius: 8px 8px 8px 8px;
}
.memname {
white-space: nowrap;
font-weight: bold;
}
.memdoc{
padding-left: 10px;
}
.memproto {
background-color: #d5e1e8;
width: 100%;
border-width: 1px;
border-style: solid;
border-color: #84b0c7;
font-weight: bold;
-moz-border-radius: 8px 8px 8px 8px;
}
.paramkey {
text-align: right;
}
.paramtype {
white-space: nowrap;
}
.paramname {
color: #602020;
font-style: italic;
}
/* End Styling for detailed member documentation */
/* for the tree view */
.ftvtree {
font-family: sans-serif;
margin:0.5em;
}
.directory { font-size: 9pt; font-weight: bold; }
.directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; }
.directory > h3 { margin-top: 0; }
.directory p { margin: 0px; white-space: nowrap; }
.directory div { display: none; margin: 0px; }
.directory img { vertical-align: -30%; }
DIV.tabs
{
float : left;
width : 100%;
background : url("tab_b.gif") repeat-x bottom;
margin-bottom : 4px;
}
DIV.tabs UL
{
margin : 0px;
padding-left : 10px;
list-style : none;
}
DIV.tabs LI, DIV.tabs FORM
{
display : inline;
margin : 0px;
padding : 0px;
}
DIV.tabs FORM
{
float : right;
}
DIV.tabs A
{
float : left;
background : url("tab_r.gif") no-repeat right top;
border-bottom : 1px solid #84B0C7;
font-size : x-small;
font-weight : bold;
text-decoration : none;
}
DIV.tabs A:hover
{
background-position: 100% -150px;
}
DIV.tabs A:link, DIV.tabs A:visited,
DIV.tabs A:active, DIV.tabs A:hover
{
color: #1A419D;
}
DIV.tabs SPAN
{
float : left;
display : block;
background : url("tab_l.gif") no-repeat left top;
padding : 5px 9px;
white-space : nowrap;
}
DIV.tabs INPUT
{
float : right;
display : inline;
font-size : 1em;
}
DIV.tabs TD
{
font-size : x-small;
font-weight : bold;
text-decoration : none;
}
/* Commented Backslash Hack hides rule from IE5-Mac \*/
DIV.tabs SPAN {float : none;}
/* End IE5-Mac hack */
DIV.tabs A:hover SPAN
{
background-position: 0% -150px;
}
DIV.tabs LI#current A
{
background-position: 100% -150px;
border-width : 0px;
}
DIV.tabs LI#current SPAN
{
background-position: 0% -150px;
padding-bottom : 6px;
}
DIV.nav
{
background : none;
border : none;
border-bottom : 1px solid #84B0C7;
}

4
led-trigger/ChangeLog Normal file
View File

@ -0,0 +1,4 @@
NEXT VERSION
v1.0.0 - 2010.11.18
- initial version

50
led-trigger/Makefile.am Normal file
View File

@ -0,0 +1,50 @@
## Process this file with automake to produce Makefile.in
mod_onu_led_trigger_SOURCES = drv_onu_led_trigger.c
EXTRA_DIST = \
$(mod_onu_led_trigger_SOURCES) \
drv_onu_led_trigger.h
if ONU_SIMULATION
else
bin_PROGRAMS = mod_onu_led_trigger.ko
AM_CFLAGS= -DLINUX
mod_onu_led_trigger_CFLAGS=$(AM_CFLAGS)
clean-generic:
@echo "Cleanup Linux 2.6.x kernel object build"
@- find . -name ".*.cmd" | xargs rm -f
@- find . -name "*.o" | xargs rm -f
@- rm -f Module.symvers Kbuild
@- rm -rf .tmp_versions *.mod.c *.order
# linux 2.6 kernel object
# linux 2.6 kernel object - dummy to force dependencies
mod_onu_led_trigger_ko_SOURCES = ./ChangeLog
mod_onu_led_trigger_ko_OBJS = "$(subst .c,.o,$(filter %.c,$(mod_onu_led_trigger_SOURCES)))"
mod_onu_led_trigger.ko: $(mod_onu_led_trigger_SOURCES)
@echo -e "mod_onu_led_trigger: Making Linux 2.6.x kernel object"
if test ! -e drv_onu_led_trigger.c ; then \
echo "copy source files (as links only!)"; \
for f in $(filter %.c,$(mod_onu_led_trigger_SOURCES)); do \
mkdir -p $(PWD)/`dirname $$f`/ ; \
cp -sf $(addprefix @abs_srcdir@/,$$f) $(PWD)/`dirname $$f`/ ; \
done \
fi
@echo -e "# mod_onu_led_trigger: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild
@echo -e "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild
@echo -e "$(subst .ko,,$@)-y := $(mod_onu_led_trigger_ko_OBJS)" >> $(PWD)/Kbuild
@echo -e "EXTRA_CFLAGS := $(mod_onu_led_trigger_CFLAGS) -DHAVE_CONFIG_H -I@abs_srcdir@ -I@abs_top_srcdir@/src -I@abs_top_srcdir@/src/include" >> $(PWD)/Kbuild
$(MAKE) CONFIG_DEBUG_SECTION_MISMATCH=y ARCH=@KERNEL_ARCH@ -C @KERNEL_BUILD_PATH@ O=@KERNEL_BUILD_PATH@ M=$(PWD) modules
endif

390
led-trigger/Makefile.in Normal file
View File

@ -0,0 +1,390 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
@ONU_SIMULATION_FALSE@bin_PROGRAMS = mod_onu_led_trigger.ko$(EXEEXT)
subdir = led-trigger
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/drv_onu_config.h \
$(top_builddir)/tools/onu/onu_control_config.h
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am__mod_onu_led_trigger_ko_SOURCES_DIST = ./ChangeLog
am_mod_onu_led_trigger_ko_OBJECTS =
mod_onu_led_trigger_ko_OBJECTS = $(am_mod_onu_led_trigger_ko_OBJECTS)
mod_onu_led_trigger_ko_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src -I$(top_builddir)/tools/onu
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(mod_onu_led_trigger_ko_SOURCES)
DIST_SOURCES = $(am__mod_onu_led_trigger_ko_SOURCES_DIST)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EVENT_LOGGER_INCL_PATH = @EVENT_LOGGER_INCL_PATH@
EXEEXT = @EXEEXT@
GREP = @GREP@
IFXOS_INCLUDE_PATH = @IFXOS_INCLUDE_PATH@
IFXOS_LIBRARY_PATH = @IFXOS_LIBRARY_PATH@
INCLUDE_REMOTE_ONLY_ONU = @INCLUDE_REMOTE_ONLY_ONU@
INCLUDE_REMOTE_ONU = @INCLUDE_REMOTE_ONU@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
KERNEL_ARCH = @KERNEL_ARCH@
KERNEL_BUILD_PATH = @KERNEL_BUILD_PATH@
KERNEL_INCL_PATH = @KERNEL_INCL_PATH@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
mod_onu_led_trigger_SOURCES = drv_onu_led_trigger.c
EXTRA_DIST = \
$(mod_onu_led_trigger_SOURCES) \
drv_onu_led_trigger.h
@ONU_SIMULATION_FALSE@AM_CFLAGS = -DLINUX
@ONU_SIMULATION_FALSE@mod_onu_led_trigger_CFLAGS = $(AM_CFLAGS)
# linux 2.6 kernel object
# linux 2.6 kernel object - dummy to force dependencies
@ONU_SIMULATION_FALSE@mod_onu_led_trigger_ko_SOURCES = ./ChangeLog
@ONU_SIMULATION_FALSE@mod_onu_led_trigger_ko_OBJS = "$(subst .c,.o,$(filter %.c,$(mod_onu_led_trigger_SOURCES)))"
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu led-trigger/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu led-trigger/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
@ONU_SIMULATION_TRUE@mod_onu_led_trigger.ko$(EXEEXT): $(mod_onu_led_trigger_ko_OBJECTS) $(mod_onu_led_trigger_ko_DEPENDENCIES)
@ONU_SIMULATION_TRUE@ @rm -f mod_onu_led_trigger.ko$(EXEEXT)
@ONU_SIMULATION_TRUE@ $(LINK) $(mod_onu_led_trigger_ko_OBJECTS) $(mod_onu_led_trigger_ko_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
@ONU_SIMULATION_TRUE@clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-exec-am: install-binPROGRAMS
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-binPROGRAMS \
clean-generic distclean distclean-compile distclean-generic \
distdir dvi dvi-am html html-am info info-am install \
install-am install-binPROGRAMS install-data install-data-am \
install-dvi install-dvi-am install-exec install-exec-am \
install-html install-html-am install-info install-info-am \
install-man install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
ps ps-am uninstall uninstall-am uninstall-binPROGRAMS
@ONU_SIMULATION_FALSE@clean-generic:
@ONU_SIMULATION_FALSE@ @echo "Cleanup Linux 2.6.x kernel object build"
@ONU_SIMULATION_FALSE@ @- find . -name ".*.cmd" | xargs rm -f
@ONU_SIMULATION_FALSE@ @- find . -name "*.o" | xargs rm -f
@ONU_SIMULATION_FALSE@ @- rm -f Module.symvers Kbuild
@ONU_SIMULATION_FALSE@ @- rm -rf .tmp_versions *.mod.c *.order
@ONU_SIMULATION_FALSE@mod_onu_led_trigger.ko: $(mod_onu_led_trigger_SOURCES)
@ONU_SIMULATION_FALSE@ @echo -e "mod_onu_led_trigger: Making Linux 2.6.x kernel object"
@ONU_SIMULATION_FALSE@ if test ! -e drv_onu_led_trigger.c ; then \
@ONU_SIMULATION_FALSE@ echo "copy source files (as links only!)"; \
@ONU_SIMULATION_FALSE@ for f in $(filter %.c,$(mod_onu_led_trigger_SOURCES)); do \
@ONU_SIMULATION_FALSE@ mkdir -p $(PWD)/`dirname $$f`/ ; \
@ONU_SIMULATION_FALSE@ cp -sf $(addprefix @abs_srcdir@/,$$f) $(PWD)/`dirname $$f`/ ; \
@ONU_SIMULATION_FALSE@ done \
@ONU_SIMULATION_FALSE@ fi
@ONU_SIMULATION_FALSE@ @echo -e "# mod_onu_led_trigger: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild
@ONU_SIMULATION_FALSE@ @echo -e "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild
@ONU_SIMULATION_FALSE@ @echo -e "$(subst .ko,,$@)-y := $(mod_onu_led_trigger_ko_OBJS)" >> $(PWD)/Kbuild
@ONU_SIMULATION_FALSE@ @echo -e "EXTRA_CFLAGS := $(mod_onu_led_trigger_CFLAGS) -DHAVE_CONFIG_H -I@abs_srcdir@ -I@abs_top_srcdir@/src -I@abs_top_srcdir@/src/include" >> $(PWD)/Kbuild
@ONU_SIMULATION_FALSE@ $(MAKE) CONFIG_DEBUG_SECTION_MISMATCH=y ARCH=@KERNEL_ARCH@ -C @KERNEL_BUILD_PATH@ O=@KERNEL_BUILD_PATH@ M=$(PWD) modules
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,409 @@
/*
* LED Kernel ONU Trigger
*
* Toggles the LED to reflect the link and traffic state of a named ONU device
*
* Copyright 2007 Oliver Jowett <oliver@opencloud.com>
*
* Derived from ledtrig-timer.c which is:
* Copyright 2005-2006 Openedhand Ltd.
* Author: Richard Purdie <rpurdie@openedhand.com>
*
* This program 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.
*
*/
#if defined(LINUX) && !defined(ONU_SIMULATION)
#include <linux/module.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/device.h>
#include <linux/sysdev.h>
#include <linux/timer.h>
#include <linux/ctype.h>
#include <linux/leds.h>
#include <linux/version.h>
#include <net/net_namespace.h>
#include "drv_onu_notifier.h"
#include "drv_onu_led_trigger.h"
/*
* Configurable sysfs attributes:
*
* device_name - network device name to monitor
*
* interval - duration of LED blink, in milliseconds
*
* mode - either "none" (LED is off) or a space separated list of one or more of:
* link: LED's normal state reflects whether the link is up (has carrier) or not
* tx: LED blinks on transmitted data
* rx: LED blinks on receive data
*
* Some suggestions:
*
* Simple link status LED for first ethernet port:
* $ echo onu >someled/trigger
* $ echo mac0 >someled/device_name
* $ echo link >someled/mode
*
* Ethernet-style link/activity LED for first ethernet port:
* $ echo onu >someled/trigger
* $ echo mac0 >someled/device_name
* $ echo "link tx rx" >someled/mode
*
* Modem-style tx/rx LEDs for GPON uplink:
* $ echo onu >led1/trigger
* $ echo gpon >led1/device_name
* $ echo tx >led1/mode
* $ echo onu >led2/trigger
* $ echo gpon >led2/device_name
* $ echo rx >led2/mode
*
*/
static inline void led_set_brightness(struct led_classdev *led_cdev,
enum led_brightness value)
{
if (value > led_cdev->max_brightness)
value = led_cdev->max_brightness;
led_cdev->brightness = value;
if (!(led_cdev->flags & LED_SUSPENDED))
led_cdev->brightness_set(led_cdev, value);
}
#define MODE_LINK 1
#define MODE_TX 2
#define MODE_RX 4
struct led_onu_data {
rwlock_t lock;
struct timer_list timer;
struct led_classdev *led_cdev;
struct onu_notifier_device *onu_dev;
char device_name[IFNAMSIZ];
unsigned interval;
unsigned mode;
unsigned link_up;
unsigned last_activity;
};
static void set_baseline_state(struct led_onu_data *trigger_data)
{
if ((trigger_data->mode & MODE_LINK) != 0 && trigger_data->link_up)
led_set_brightness(trigger_data->led_cdev, LED_FULL);
else
led_set_brightness(trigger_data->led_cdev, LED_OFF);
mod_timer(&trigger_data->timer, jiffies + trigger_data->interval);
}
static ssize_t led_device_name_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct led_classdev *led_cdev = dev_get_drvdata(dev);
struct led_onu_data *trigger_data = led_cdev->trigger_data;
read_lock(&trigger_data->lock);
sprintf(buf, "%s\n", trigger_data->device_name);
read_unlock(&trigger_data->lock);
return strlen(buf) + 1;
}
static ssize_t led_device_name_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t size)
{
struct led_classdev *led_cdev = dev_get_drvdata(dev);
struct led_onu_data *trigger_data = led_cdev->trigger_data;
if (size < 0 || size >= IFNAMSIZ)
return -EINVAL;
write_lock(&trigger_data->lock);
strcpy(trigger_data->device_name, buf);
if (size > 0 && trigger_data->device_name[size-1] == '\n')
trigger_data->device_name[size-1] = 0;
if (trigger_data->device_name[0] != 0) {
/* check for existing device to update from */
trigger_data->onu_dev = onu_get_by_name(trigger_data->device_name);
if (trigger_data->onu_dev != NULL)
trigger_data->link_up = (onu_get_flags(trigger_data->onu_dev) & ONU_LOWER_UP) != 0;
set_baseline_state(trigger_data); /* updates LEDs, may start timers */
}
write_unlock(&trigger_data->lock);
return size;
}
static DEVICE_ATTR(device_name, 0644, led_device_name_show, led_device_name_store);
static ssize_t led_mode_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct led_classdev *led_cdev = dev_get_drvdata(dev);
struct led_onu_data *trigger_data = led_cdev->trigger_data;
read_lock(&trigger_data->lock);
if (trigger_data->mode == 0) {
strcpy(buf, "none\n");
} else {
if (trigger_data->mode & MODE_LINK)
strcat(buf, "link ");
if (trigger_data->mode & MODE_TX)
strcat(buf, "tx ");
if (trigger_data->mode & MODE_RX)
strcat(buf, "rx ");
strcat(buf, "\n");
}
read_unlock(&trigger_data->lock);
return strlen(buf)+1;
}
static ssize_t led_mode_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t size)
{
struct led_classdev *led_cdev = dev_get_drvdata(dev);
struct led_onu_data *trigger_data = led_cdev->trigger_data;
char copybuf[32];
int new_mode = -1;
char *p, *token;
/* take a copy since we don't want to trash the inbound buffer when using strsep */
strncpy(copybuf, buf, sizeof(copybuf));
copybuf[31] = 0;
p = copybuf;
while ((token = strsep(&p, " \t\n")) != NULL) {
if (!*token)
continue;
if (new_mode == -1)
new_mode = 0;
if (!strcmp(token, "none"))
new_mode = 0;
else if (!strcmp(token, "tx"))
new_mode |= MODE_TX;
else if (!strcmp(token, "rx"))
new_mode |= MODE_RX;
else if (!strcmp(token, "link"))
new_mode |= MODE_LINK;
else
return -EINVAL;
}
if (new_mode == -1)
return -EINVAL;
write_lock(&trigger_data->lock);
trigger_data->mode = new_mode;
set_baseline_state(trigger_data);
write_unlock(&trigger_data->lock);
return size;
}
static DEVICE_ATTR(mode, 0644, led_mode_show, led_mode_store);
static ssize_t led_interval_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct led_classdev *led_cdev = dev_get_drvdata(dev);
struct led_onu_data *trigger_data = led_cdev->trigger_data;
read_lock(&trigger_data->lock);
sprintf(buf, "%u\n", jiffies_to_msecs(trigger_data->interval));
read_unlock(&trigger_data->lock);
return strlen(buf) + 1;
}
static ssize_t led_interval_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t size)
{
struct led_classdev *led_cdev = dev_get_drvdata(dev);
struct led_onu_data *trigger_data = led_cdev->trigger_data;
int ret = -EINVAL;
char *after;
unsigned long value = simple_strtoul(buf, &after, 10);
size_t count = after - buf;
if (*after && isspace(*after))
count++;
/* impose some basic bounds on the timer interval */
if (count == size && value >= 5 && value <= 10000) {
write_lock(&trigger_data->lock);
trigger_data->interval = msecs_to_jiffies(value);
set_baseline_state(trigger_data); // resets timer
write_unlock(&trigger_data->lock);
ret = count;
}
return ret;
}
static DEVICE_ATTR(interval, 0644, led_interval_show, led_interval_store);
/* here's the real work! */
static void onudev_trig_timer(unsigned long arg)
{
struct led_onu_data *trigger_data = (struct led_onu_data *)arg;
const struct onu_notifier_device_stats *dev_stats;
unsigned new_activity;
if (trigger_data->onu_dev == NULL)
return;
write_lock(&trigger_data->lock);
trigger_data->link_up = (onu_get_flags(trigger_data->onu_dev) & ONU_LOWER_UP) != 0;
if (!trigger_data->link_up || (trigger_data->mode & (MODE_TX | MODE_RX)) == 0) {
/* handle link only LED */
led_set_brightness(trigger_data->led_cdev, ((trigger_data->mode & MODE_LINK) != 0 && trigger_data->link_up) ? LED_FULL : LED_OFF);
goto restart;
}
dev_stats = onu_get_stats(trigger_data->onu_dev);
new_activity =
((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) +
((trigger_data->mode & MODE_RX) ? dev_stats->rx_packets : 0);
if (trigger_data->mode & MODE_LINK) {
/* base state is ON (link present) */
/* if there's no link, we don't get this far and the LED is off */
/* OFF -> ON always */
/* ON -> OFF on activity */
if (trigger_data->led_cdev->brightness == LED_OFF) {
led_set_brightness(trigger_data->led_cdev, LED_FULL);
} else if (trigger_data->last_activity != new_activity) {
led_set_brightness(trigger_data->led_cdev, LED_OFF);
}
} else {
/* base state is OFF */
/* ON -> OFF always */
/* OFF -> ON on activity */
if (trigger_data->led_cdev->brightness == LED_FULL) {
led_set_brightness(trigger_data->led_cdev, LED_OFF);
} else if (trigger_data->last_activity != new_activity) {
led_set_brightness(trigger_data->led_cdev, LED_FULL);
}
}
trigger_data->last_activity = new_activity;
restart:
mod_timer(&trigger_data->timer, jiffies + trigger_data->interval);
write_unlock(&trigger_data->lock);
}
static void onudev_trig_activate(struct led_classdev *led_cdev)
{
struct led_onu_data *trigger_data;
int rc;
trigger_data = kzalloc(sizeof(struct led_onu_data), GFP_KERNEL);
if (!trigger_data)
return;
rwlock_init(&trigger_data->lock);
setup_timer(&trigger_data->timer, onudev_trig_timer, (unsigned long) trigger_data);
trigger_data->led_cdev = led_cdev;
trigger_data->onu_dev = NULL;
trigger_data->device_name[0] = 0;
trigger_data->mode = 0;
trigger_data->interval = msecs_to_jiffies(50);
trigger_data->link_up = 0;
trigger_data->last_activity = 0;
led_cdev->trigger_data = trigger_data;
rc = device_create_file(led_cdev->dev, &dev_attr_device_name);
if (rc)
goto err_out;
rc = device_create_file(led_cdev->dev, &dev_attr_mode);
if (rc)
goto err_out_device_name;
rc = device_create_file(led_cdev->dev, &dev_attr_interval);
if (rc)
goto err_out_mode;
return;
err_out_mode:
device_remove_file(led_cdev->dev, &dev_attr_mode);
err_out_device_name:
device_remove_file(led_cdev->dev, &dev_attr_device_name);
err_out:
led_cdev->trigger_data = NULL;
kfree(trigger_data);
}
static void onudev_trig_deactivate(struct led_classdev *led_cdev)
{
struct led_onu_data *trigger_data = led_cdev->trigger_data;
if (trigger_data) {
device_remove_file(led_cdev->dev, &dev_attr_device_name);
device_remove_file(led_cdev->dev, &dev_attr_mode);
device_remove_file(led_cdev->dev, &dev_attr_interval);
write_lock(&trigger_data->lock);
if (trigger_data->onu_dev) {
#if 0
dev_put(trigger_data->onu_dev);
#endif
trigger_data->onu_dev = NULL;
}
write_unlock(&trigger_data->lock);
del_timer_sync(&trigger_data->timer);
kfree(trigger_data);
}
}
static struct led_trigger onudev_led_trigger = {
.name = "onu",
.activate = onudev_trig_activate,
.deactivate = onudev_trig_deactivate,
};
static int __init onudev_trig_init(void)
{
return led_trigger_register(&onudev_led_trigger);
}
static void __exit onudev_trig_exit(void)
{
led_trigger_unregister(&onudev_led_trigger);
}
module_init(onudev_trig_init);
module_exit(onudev_trig_exit);
MODULE_AUTHOR("Ralph Hempel <ralph.hempel@lantiq.com>");
MODULE_DESCRIPTION(ONU_LED_TRIGGER_DESC);
MODULE_LICENSE("GPL");
#endif /* #if defined(LINUX) && !defined(ONU_SIMULATION) */

View File

@ -0,0 +1,16 @@
/*
* ONU LED trigger driver
*
* This program 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.
*
*/
#ifndef _INCLUDE_ONU_LED_TRIGGER_H_
#define _INCLUDE_ONU_LED_TRIGGER_H_
#define ONU_LED_TRIGGER_NAME "onu_led_trigger"
#define ONU_LED_TRIGGER_DESC "FALC(tm) ON LED trigger"
#define ONU_LED_TRIGGER_VERSION "1.0.1"
#endif /* _INCLUDE_ONU_LED_TRIGGER_H_ */

25
netdev/ChangeLog Normal file
View File

@ -0,0 +1,25 @@
NEXT VERSION
v0.7.0 - - 2011.11.xx
- sync with the onu_drv net interface changes
- "exc" interfaces added
- "lan" interface replaced with "lct0..3" interfaces
- onu_netdev_if_set_mac_address() handling added for lct0..3
- probe only available LAN ports for LCT i/f
v0.5.1 - - 2010.12.02
- fix running out of memory, added missing dev_kfree_skb
v0.5.0 - 2010.06.23
- enabled net_device_ops handling for kernel 2.6.30 to avoid warnings
- fixed net_device_ops usage
v0.4.9 - 2010.02.25
- added LAN Rx enable
- netdev is not handeld within the ONU driver / collision with GPON
v0.4.8 - 2010.02.16
- fixed queue offset
v0.4.7 - 2010.01.08
- intial version (dedicated FPGA version)

48
netdev/Makefile.am Normal file
View File

@ -0,0 +1,48 @@
## Process this file with automake to produce Makefile.in
mod_onu_netdev_SOURCES = drv_onu_netdev.c
EXTRA_DIST = \
$(mod_onu_netdev_SOURCES) \
drv_onu_netdev.h
if ONU_SIMULATION
else
bin_PROGRAMS = mod_onu_netdev.ko
AM_CFLAGS= -DLINUX
mod_onu_netdev_CFLAGS=$(AM_CFLAGS)
clean-generic:
@echo "Cleanup Linux 2.6.x kernel object build"
@- find . -name ".*.cmd" | xargs rm -f
@- find . -name "*.o" | xargs rm -f
@- rm -f Module.symvers Kbuild
@- rm -rf .tmp_versions *.mod.c *.order
# linux 2.6 kernel object
# linux 2.6 kernel object - dummy to force dependencies
mod_onu_netdev_ko_SOURCES = ./ChangeLog
mod_onu_netdev_ko_OBJS = "$(subst .c,.o,$(filter %.c,$(mod_onu_netdev_SOURCES)))"
mod_onu_netdev.ko: $(mod_onu_netdev_SOURCES)
@echo -e "mod_onu_netdev: Making Linux 2.6.x kernel object"
if test ! -e drv_onu_netdev.c ; then \
echo "copy source files (as links only!)"; \
for f in $(filter %.c,$(mod_onu_netdev_SOURCES)); do \
mkdir -p $(PWD)/`dirname $$f`/ ; \
cp -sf $(addprefix @abs_srcdir@/,$$f) $(PWD)/`dirname $$f`/ ; \
done \
fi
@echo -e "# mod_onu_netdev: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild
@echo -e "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild
@echo -e "$(subst .ko,,$@)-y := $(mod_onu_netdev_ko_OBJS)" >> $(PWD)/Kbuild
@echo -e "EXTRA_CFLAGS := $(mod_onu_netdev_CFLAGS) -DHAVE_CONFIG_H -I@abs_srcdir@ -I@abs_top_srcdir@/src -I@abs_top_srcdir@/src/include" >> $(PWD)/Kbuild
$(MAKE) CONFIG_DEBUG_SECTION_MISMATCH=y ARCH=@KERNEL_ARCH@ -C @KERNEL_BUILD_PATH@ O=@KERNEL_BUILD_PATH@ M=$(PWD) modules
endif

390
netdev/Makefile.in Normal file
View File

@ -0,0 +1,390 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
@ONU_SIMULATION_FALSE@bin_PROGRAMS = mod_onu_netdev.ko$(EXEEXT)
subdir = netdev
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/drv_onu_config.h \
$(top_builddir)/tools/onu/onu_control_config.h
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am__mod_onu_netdev_ko_SOURCES_DIST = ./ChangeLog
am_mod_onu_netdev_ko_OBJECTS =
mod_onu_netdev_ko_OBJECTS = $(am_mod_onu_netdev_ko_OBJECTS)
mod_onu_netdev_ko_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src -I$(top_builddir)/tools/onu
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(mod_onu_netdev_ko_SOURCES)
DIST_SOURCES = $(am__mod_onu_netdev_ko_SOURCES_DIST)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EVENT_LOGGER_INCL_PATH = @EVENT_LOGGER_INCL_PATH@
EXEEXT = @EXEEXT@
GREP = @GREP@
IFXOS_INCLUDE_PATH = @IFXOS_INCLUDE_PATH@
IFXOS_LIBRARY_PATH = @IFXOS_LIBRARY_PATH@
INCLUDE_REMOTE_ONLY_ONU = @INCLUDE_REMOTE_ONLY_ONU@
INCLUDE_REMOTE_ONU = @INCLUDE_REMOTE_ONU@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
KERNEL_ARCH = @KERNEL_ARCH@
KERNEL_BUILD_PATH = @KERNEL_BUILD_PATH@
KERNEL_INCL_PATH = @KERNEL_INCL_PATH@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
mod_onu_netdev_SOURCES = drv_onu_netdev.c
EXTRA_DIST = \
$(mod_onu_netdev_SOURCES) \
drv_onu_netdev.h
@ONU_SIMULATION_FALSE@AM_CFLAGS = -DLINUX
@ONU_SIMULATION_FALSE@mod_onu_netdev_CFLAGS = $(AM_CFLAGS)
# linux 2.6 kernel object
# linux 2.6 kernel object - dummy to force dependencies
@ONU_SIMULATION_FALSE@mod_onu_netdev_ko_SOURCES = ./ChangeLog
@ONU_SIMULATION_FALSE@mod_onu_netdev_ko_OBJS = "$(subst .c,.o,$(filter %.c,$(mod_onu_netdev_SOURCES)))"
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu netdev/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu netdev/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
@ONU_SIMULATION_TRUE@mod_onu_netdev.ko$(EXEEXT): $(mod_onu_netdev_ko_OBJECTS) $(mod_onu_netdev_ko_DEPENDENCIES)
@ONU_SIMULATION_TRUE@ @rm -f mod_onu_netdev.ko$(EXEEXT)
@ONU_SIMULATION_TRUE@ $(LINK) $(mod_onu_netdev_ko_OBJECTS) $(mod_onu_netdev_ko_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
@ONU_SIMULATION_TRUE@clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-exec-am: install-binPROGRAMS
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-binPROGRAMS \
clean-generic distclean distclean-compile distclean-generic \
distdir dvi dvi-am html html-am info info-am install \
install-am install-binPROGRAMS install-data install-data-am \
install-dvi install-dvi-am install-exec install-exec-am \
install-html install-html-am install-info install-info-am \
install-man install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
ps ps-am uninstall uninstall-am uninstall-binPROGRAMS
@ONU_SIMULATION_FALSE@clean-generic:
@ONU_SIMULATION_FALSE@ @echo "Cleanup Linux 2.6.x kernel object build"
@ONU_SIMULATION_FALSE@ @- find . -name ".*.cmd" | xargs rm -f
@ONU_SIMULATION_FALSE@ @- find . -name "*.o" | xargs rm -f
@ONU_SIMULATION_FALSE@ @- rm -f Module.symvers Kbuild
@ONU_SIMULATION_FALSE@ @- rm -rf .tmp_versions *.mod.c *.order
@ONU_SIMULATION_FALSE@mod_onu_netdev.ko: $(mod_onu_netdev_SOURCES)
@ONU_SIMULATION_FALSE@ @echo -e "mod_onu_netdev: Making Linux 2.6.x kernel object"
@ONU_SIMULATION_FALSE@ if test ! -e drv_onu_netdev.c ; then \
@ONU_SIMULATION_FALSE@ echo "copy source files (as links only!)"; \
@ONU_SIMULATION_FALSE@ for f in $(filter %.c,$(mod_onu_netdev_SOURCES)); do \
@ONU_SIMULATION_FALSE@ mkdir -p $(PWD)/`dirname $$f`/ ; \
@ONU_SIMULATION_FALSE@ cp -sf $(addprefix @abs_srcdir@/,$$f) $(PWD)/`dirname $$f`/ ; \
@ONU_SIMULATION_FALSE@ done \
@ONU_SIMULATION_FALSE@ fi
@ONU_SIMULATION_FALSE@ @echo -e "# mod_onu_netdev: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild
@ONU_SIMULATION_FALSE@ @echo -e "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild
@ONU_SIMULATION_FALSE@ @echo -e "$(subst .ko,,$@)-y := $(mod_onu_netdev_ko_OBJS)" >> $(PWD)/Kbuild
@ONU_SIMULATION_FALSE@ @echo -e "EXTRA_CFLAGS := $(mod_onu_netdev_CFLAGS) -DHAVE_CONFIG_H -I@abs_srcdir@ -I@abs_top_srcdir@/src -I@abs_top_srcdir@/src/include" >> $(PWD)/Kbuild
@ONU_SIMULATION_FALSE@ $(MAKE) CONFIG_DEBUG_SECTION_MISMATCH=y ARCH=@KERNEL_ARCH@ -C @KERNEL_BUILD_PATH@ O=@KERNEL_BUILD_PATH@ M=$(PWD) modules
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

568
netdev/drv_onu_netdev.c Normal file
View File

@ -0,0 +1,568 @@
/*
* ONU ethernet driver
*
* Copyright (C) 2010 Ralph Hempel <ralph.hempel@lantiq.com>
*
* This program 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.
*
*/
#if defined(LINUX) && !defined(ONU_SIMULATION)
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/spinlock.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/version.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include "drv_onu_netdev.h"
#include "drv_onu_debug.h"
#include "drv_onu_types.h"
#include "drv_onu_ll_ssb.h"
#include "drv_onu_lan_api_intern.h"
#include "drv_onu_resource.h"
#include "drv_onu_resource_gpe.h"
static struct platform_device *onu_netdev_device;
static struct net_device *onu_netdev_devs[ONU_NET_MAX_NETDEV_PORT];
static DEFINE_SPINLOCK(tx_lock);
STATIC int onu_netdev_if_open(struct net_device *dev);
STATIC int onu_netdev_if_stop(struct net_device *dev);
STATIC int onu_netdev_if_hard_start_xmit(struct sk_buff *skb,
struct net_device *dev);
STATIC void onu_netdev_if_set_multicast_list(struct net_device *dev);
STATIC int onu_netdev_if_do_ioctl(struct net_device *dev, struct ifreq *rq,
int cmd);
STATIC void onu_netdev_if_tx_timeout(struct net_device *dev);
STATIC int onu_netdev_if_set_mac_address(struct net_device *dev, void *p);
extern u32 onu_gpon_link_status_get(void);
extern u32 onu_mac_link_status_get(const u8 idx);
# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30))
static const struct net_device_ops onu_netdev_ops = {
.ndo_open = onu_netdev_if_open,
.ndo_stop = onu_netdev_if_stop,
.ndo_start_xmit = onu_netdev_if_hard_start_xmit,
.ndo_set_multicast_list = onu_netdev_if_set_multicast_list,
.ndo_do_ioctl = onu_netdev_if_do_ioctl,
.ndo_tx_timeout = onu_netdev_if_tx_timeout,
.ndo_set_mac_address = onu_netdev_if_set_mac_address
};
/** \todo dev->watchdog_timeo = ONU_TX_TIMEOUT;*/
#endif
STATIC int onu_netdev_buf_alloc(const uint32_t len, struct net_buf *buf)
{
struct sk_buff *skb;
if (!len || !buf)
return -1;
skb = dev_alloc_skb(len);
if (skb == NULL)
return -1;
buf->skb = (void*)skb;
buf->data = (uint8_t*)skb->data;
buf->len = len;
return 0;
}
STATIC int onu_netdev_rx(struct net_device *dev, struct net_buf *buf)
{
struct sk_buff *skb;
if (!dev) {
SW_ERR("no dev\n");
return -1;
}
if (!netif_running(dev)) {
SW_ERR("netif not running\n");
return -1;
}
skb = (struct sk_buff *)buf->skb;
if (skb == NULL) {
dev->stats.rx_errors++;
return -3;
}
if (buf->len == 0) {
dev_kfree_skb(skb);
dev->stats.rx_errors++;
dev->stats.rx_length_errors++;
if (0) /** \todo add crc errors */
dev->stats.rx_crc_errors++;
return -5;
}
if (skb) {
skb_put(skb, buf->len);
skb->dev = dev;
skb->protocol = eth_type_trans(skb, dev);
skb->ip_summed = CHECKSUM_NONE;
netif_rx(skb);
dev->last_rx = jiffies;
dev->stats.rx_packets++;
dev->stats.rx_bytes += buf->len;
}
return 0;
}
STATIC int onu_netdev_irq(void *handle, struct net_buf *buf)
{
int ret;
ret = onu_netdev_rx(handle, buf);
return ret;
}
STATIC int onu_netdev_lan_link_status( void *handle, const uint8_t lan_port,
const bool link_up)
{
struct onu_netdev_if_priv *priv =
netdev_priv((struct net_device*)handle);
if (link_up)
priv->lan_port_status_mask |= (1 << lan_port);
else
priv->lan_port_status_mask &= ~(1 << lan_port);
if (priv->lan_port_status_mask &&
!netif_carrier_ok((struct net_device*)handle)) {
SW_DBG("lan%u up\n", lan_port);
net_rx_enable(priv->port_number, true);
netif_carrier_on((struct net_device*)handle);
} else if (!priv->lan_port_status_mask &&
netif_carrier_ok((struct net_device*)handle)){
SW_DBG("lan%u down\n", lan_port);
net_rx_enable(priv->port_number, false);
netif_carrier_off((struct net_device*)handle);
} else {
return 0;
}
return 0;
}
STATIC int onu_netdev_wan_link_status(void *handle, const bool link_up)
{
struct onu_netdev_if_priv *priv =
netdev_priv((struct net_device*)handle);
if (link_up && !netif_carrier_ok((struct net_device*)handle)) {
SW_DBG("wan up\n");
net_rx_enable(priv->port_number, true);
netif_carrier_on((struct net_device*)handle);
} else if (!link_up && netif_carrier_ok((struct net_device*)handle)){
SW_DBG("wan down\n");
net_rx_enable(priv->port_number, false);
netif_carrier_off((struct net_device*)handle);
} else {
return 0;
}
return 0;
}
STATIC int onu_netdev_exc_link_status(void *handle, const bool link_up)
{
struct onu_netdev_if_priv *priv =
netdev_priv((struct net_device*)handle);
if (link_up && !netif_carrier_ok((struct net_device*)handle)) {
SW_DBG("exc up\n");
net_rx_enable(priv->port_number, true);
netif_carrier_on((struct net_device*)handle);
} else if (!link_up && netif_carrier_ok((struct net_device*)handle)){
SW_DBG("exc down\n");
net_rx_enable(priv->port_number, false);
netif_carrier_off((struct net_device*)handle);
} else {
return 0;
}
return 0;
}
STATIC int onu_netdev_if_open(struct net_device *dev)
{
struct onu_netdev_if_priv *priv = netdev_priv(dev);
struct net_cb cb_list = {
NULL,
{ onu_netdev_irq,
onu_netdev_lan_link_status,
onu_netdev_wan_link_status
}
};
SW_DBG("open %p on %s\n", dev, dev->name);
cb_list.net_dev = dev;
switch (priv->port_number) {
case ONU_NET_NETDEV_WAN_PORT:
onu_netdev_wan_link_status(dev,
(bool)onu_gpon_link_status_get());
cb_list.cb[NET_CB_LAN_STATUS] = NULL;
break;
case ONU_NET_NETDEV_LAN0_PORT:
case ONU_NET_NETDEV_LAN1_PORT:
case ONU_NET_NETDEV_LAN2_PORT:
case ONU_NET_NETDEV_LAN3_PORT:
onu_netdev_lan_link_status(
dev, net_uni_get(priv->port_number),
(bool)onu_mac_link_status_get(
net_uni_get(priv->port_number)));
cb_list.cb[NET_CB_WAN_STATUS] = NULL;
break;
case ONU_NET_NETDEV_EXC_PORT:
onu_netdev_exc_link_status(dev, true);
cb_list.cb[NET_CB_LAN_STATUS] = NULL;
cb_list.cb[NET_CB_WAN_STATUS] = NULL;
break;
}
if (net_cb_list_register((uint8_t)priv->port_number, &cb_list) < 0)
return -1;
netif_start_queue(dev);
return 0;
}
STATIC int onu_netdev_if_stop(struct net_device *dev)
{
struct onu_netdev_if_priv *priv = netdev_priv(dev);
struct net_cb cb_list = {0};
int uni;
SW_DBG("stop on %s\n", dev->name);
netif_stop_queue(dev);
uni = net_uni_get(priv->port_number);
if (uni < 0) {
net_rx_enable((uint8_t)priv->port_number, false);
} else {
priv->lan_port_status_mask &= ~(1 << uni);
if (!priv->lan_port_status_mask)
net_rx_enable((uint8_t)priv->port_number, false);
}
netif_carrier_off(dev);
net_cb_list_register((uint8_t)priv->port_number, &cb_list);
return 0;
}
STATIC int onu_netdev_if_hard_start_xmit(struct sk_buff *skb,
struct net_device *dev)
{
struct onu_netdev_if_priv *priv = netdev_priv(dev);
int ret;
spin_lock_irq(&tx_lock);
SW_DBG("xmit on %s\n", dev->name);
ret = net_pdu_write((uint8_t)priv->port_number, skb->len, skb->data);
if (ret != 0) {
SW_DBG("%s unable to transmit, packet dropped\n", dev->name);
dev->stats.tx_dropped++;
} else {
dev->trans_start = jiffies;
dev->stats.tx_packets++;
dev->stats.tx_bytes += skb->len;
}
dev_kfree_skb(skb);
spin_unlock_irq(&tx_lock);
return 0;
}
STATIC void onu_netdev_if_tx_timeout(struct net_device *dev)
{
SW_DBG("TX timeout on %s\n", dev->name);
}
STATIC void onu_netdev_if_set_multicast_list(struct net_device *dev)
{
struct onu_netdev_if_priv *priv = netdev_priv(dev);
(void)priv;
SW_DBG("set multicast list on %s\n", dev->name);
if (dev->flags & IFF_PROMISC) {
/* enable unknown packets */
SW_DBG("enable promisc mode on %s\n", dev->name);
} else {
/* disable unknown packets */
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
if (dev->flags & IFF_PROMISC || dev->flags & IFF_ALLMULTI ||
dev->mc_count) {
/* enable multicast packets */
} else {
/* disable multicast packets */
}
#endif
}
STATIC int onu_netdev_if_set_mac_address(struct net_device *dev, void *p)
{
struct onu_netdev_if_priv *priv = netdev_priv(dev);
struct sockaddr *addr = p;
SW_DBG("set mac address\n");
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
switch (priv->port_number) {
case ONU_NET_NETDEV_LAN0_PORT:
case ONU_NET_NETDEV_LAN1_PORT:
case ONU_NET_NETDEV_LAN2_PORT:
case ONU_NET_NETDEV_LAN3_PORT:
if (net_lan_mac_set(addr->sa_data) != 0)
return -1;
break;
default:
break;
}
return 0;
}
STATIC int onu_netdev_if_do_ioctl(struct net_device *dev, struct ifreq *rq,
int cmd)
{
struct onu_netdev_if_priv *priv = netdev_priv(dev);
(void)priv;
SW_DBG("ioctl on %s\n", dev->name);
switch (cmd) {
default:
return -EOPNOTSUPP;
}
return 0;
}
STATIC struct net_device *onu_netdev_if_alloc(void)
{
struct net_device *dev;
struct onu_netdev_if_priv *priv;
SW_DBG("alloc\n");
dev = alloc_etherdev(sizeof(*priv));
if (!dev)
return NULL;
priv = netdev_priv(dev);
priv->dev = dev;
# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30))
/** \todo crosscheck irq
*/
/* dev->irq = 42; */
dev->open = onu_netdev_if_open;
dev->hard_start_xmit = onu_netdev_if_hard_start_xmit;
dev->stop = onu_netdev_if_stop;
dev->set_multicast_list = onu_netdev_if_set_multicast_list;
dev->do_ioctl = onu_netdev_if_do_ioctl;
dev->tx_timeout = onu_netdev_if_tx_timeout;
dev->watchdog_timeo = ONU_TX_TIMEOUT;
dev->set_mac_address = onu_netdev_if_set_mac_address;
# else
dev->netdev_ops = &onu_netdev_ops;
# endif
return dev;
}
STATIC void onu_netdev_cleanup(void)
{
int i;
SW_DBG("cleanup\n");
for (i = 0; i < ONU_NET_MAX_NETDEV_PORT; i++) {
struct net_device *dev = onu_netdev_devs[i];
if (dev) {
unregister_netdev(dev);
free_netdev(dev);
}
onu_netdev_devs[i] = NULL;
}
}
STATIC int onu_netdev_probe(struct platform_device *pdev)
{
int i, err;
uint8_t max_lan_port;
/* get available LAN ports number */
max_lan_port = net_lan_max_port_get();
for (i = 0; i < ONU_NET_MAX_NETDEV_PORT; i++) {
struct net_device *dev;
struct onu_netdev_if_priv *priv;
/* skip unavailable LAN ports */
if ((i == ONU_NET_NETDEV_LAN0_PORT && max_lan_port < 1) ||
(i == ONU_NET_NETDEV_LAN1_PORT && max_lan_port < 2) ||
(i == ONU_NET_NETDEV_LAN2_PORT && max_lan_port < 3) ||
(i == ONU_NET_NETDEV_LAN3_PORT && max_lan_port < 4))
continue;
dev = onu_netdev_if_alloc();
if (!dev) {
err = -ENOMEM;
goto err;
}
onu_netdev_devs[i] = dev;
priv = netdev_priv(dev);
switch (i) {
case ONU_NET_NETDEV_WAN_PORT:
strcpy(dev->name, ONU_NETDEV_NAME_WAN);
break;
case ONU_NET_NETDEV_LAN0_PORT:
case ONU_NET_NETDEV_LAN1_PORT:
case ONU_NET_NETDEV_LAN2_PORT:
case ONU_NET_NETDEV_LAN3_PORT:
sprintf(dev->name, "%s%u", ONU_NETDEV_NAME_LAN,
net_uni_get(i));
break;
case ONU_NET_NETDEV_EXC_PORT:
strcpy(dev->name, ONU_NETDEV_NAME_EXC);
break;
default:
err = -1;
goto err;
}
priv->port_number = i;
priv->lan_port_status_mask = 0;
err = register_netdev(dev);
if (err) {
SW_INFO("%s register failed, error=%d\n",
dev->name, err);
goto err;
}
netif_carrier_off(dev);
}
return 0;
err:
onu_netdev_cleanup();
SW_ERR("init failed\n");
return err;
}
STATIC int onu_netdev_remove(struct platform_device *dev)
{
SW_DBG("remove %s\n", dev->name);
onu_netdev_cleanup();
return 0;
}
static struct platform_driver onu_netdev_driver = {
.probe = onu_netdev_probe,
.remove = onu_netdev_remove,
.driver = {
.name = ONU_NETDEV_NAME,
},
};
STATIC int __init onu_netdev_mod_init(void)
{
int ret;
struct net_dev dev = { onu_netdev_buf_alloc };
pr_info(ONU_NETDEV_DESC ", Version " ONU_NETDEV_VERSION
" (c) Copyright 2011, Lantiq Deutschland GmbH\n");
ret = platform_driver_register(&onu_netdev_driver);
if (ret) {
printk(KERN_ERR ONU_NETDEV_DESC
"Error registering platfom driver\n");
}
onu_netdev_device = platform_device_alloc("onu_netdev", -1);
if (!onu_netdev_device) {
printk(KERN_ERR ONU_NETDEV_DESC
"Error allocating platfom driver\n");
ret = -ENOMEM;
goto err_unregister_driver;
}
ret = platform_device_add(onu_netdev_device);
if (ret) {
printk(KERN_ERR ONU_NETDEV_DESC
"Error adding platfom driver\n");
goto err_free_device;
}
ret = net_dev_register(&dev);
if (ret != 0) {
printk(KERN_ERR ONU_NETDEV_DESC
"Error registering platfom driver\n");
goto err_free_device;
}
return 0;
err_free_device:
platform_device_put(onu_netdev_device);
err_unregister_driver:
platform_driver_unregister(&onu_netdev_driver);
return ret;
}
STATIC void __exit onu_netdev_mod_exit(void)
{
SW_DBG("exit\n");
platform_device_unregister(onu_netdev_device);
platform_driver_unregister(&onu_netdev_driver);
}
module_init(onu_netdev_mod_init);
module_exit(onu_netdev_mod_exit);
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Ralph Hempel <ralph.hempel@lantiq.com>");
MODULE_DESCRIPTION(ONU_NETDEV_DESC);
MODULE_VERSION(ONU_NETDEV_VERSION);
#endif /* defined(LINUX) && !defined(ONU_SIMULATION) */

40
netdev/drv_onu_netdev.h Normal file
View File

@ -0,0 +1,40 @@
/*
* ONU ethernet driver
*
* Copyright (C) 2010 Ralph Hempel <ralph.hempel@lantiq.com>
*
* This program 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.
*
*/
#ifndef _INCLUDE_ONU_NETDEV_H_
#define _INCLUDE_ONU_NETDEV_H_
#define ONU_NETDEV_NAME "onu_netdev"
#define ONU_NETDEV_DESC "FALC(tm) ON Ethernet Driver"
#define ONU_NETDEV_VERSION "0.7.0"
#undef CONFIG_ONU_NETDEV_DEBUG
#ifdef CONFIG_ONU_NETDEV_DEBUG
#define SW_DBG(f, a...) printk(KERN_INFO "[%s] " f, ONU_NETDEV_NAME , ## a)
#else
#define SW_DBG(f, a...) do {} while (0)
#endif
#define SW_ERR(f, a...) printk(KERN_ERR "[%s] " f, ONU_NETDEV_NAME , ## a)
#define SW_INFO(f, a...) printk(KERN_INFO "[%s] " f, ONU_NETDEV_NAME , ## a)
#define ONU_TX_TIMEOUT HZ*400
#define ONU_NETDEV_NAME_WAN "wan"
#define ONU_NETDEV_NAME_LAN "lct"
#define ONU_NETDEV_NAME_EXC "exc"
struct onu_netdev_if_priv {
struct net_device *dev;
unsigned int port_number;
unsigned int lan_port_status_mask;
};
#endif /* _INCLUDE_ONU_NETDEV_H_ */

210
src/Makefile.am Normal file
View File

@ -0,0 +1,210 @@
## Process this file with automake to produce Makefile.in
libonu_sources= \
drv_onu_base.c \
drv_onu_cli.c \
drv_onu_cli_core.c \
drv_onu_cli_dump.c \
drv_onu_cli_dump_misc.c \
drv_onu_cli_misc.c \
drv_onu_common.c \
drv_onu_devio.c \
drv_onu_gpe.c \
drv_onu_gpe_tables.c \
drv_onu_gtc.c \
drv_onu_lan.c \
drv_onu_linux.c \
drv_onu_ll_cop.c \
drv_onu_ll_eim.c \
drv_onu_ll_fsqm.c \
drv_onu_ll_gpearb.c \
drv_onu_ll_gtc.c \
drv_onu_ll_ictrlg.c \
drv_onu_ll_ictrll.c \
drv_onu_ll_iqm.c \
drv_onu_ll_octrlg.c \
drv_onu_ll_octrll.c \
drv_onu_ll_sce.c \
drv_onu_ll_ssb.c \
drv_onu_ll_sys.c \
drv_onu_ll_tbm.c \
drv_onu_ll_tmu.c \
drv_onu_ll_tod.c \
drv_onu_ll_tod_asc.c \
drv_onu_notifier.c \
drv_onu_ploam.c \
drv_onu_simulator.c \
drv_onu_tse_config.c \
drv_onu_tse.c
libonu_interface_headers= \
include/drv_onu_devio.h \
include/drv_onu_default.h \
include/drv_onu_error.h \
include/drv_onu_std_defs.h \
include/drv_onu_types.h \
include/drv_onu_gpe_tables.h \
include/drv_onu_common_interface.h \
include/drv_onu_event_interface.h \
include/drv_onu_ethertypes.h \
include/drv_onu_gpe_interface.h \
include/drv_onu_gpe_tables_interface.h \
include/drv_onu_gtc_interface.h \
include/drv_onu_interface.h \
include/drv_onu_lan_interface.h \
include/drv_onu_ploam_interface.h \
include/drv_onu_resource.h \
include/drv_onu_resource_gpe_tables.h \
include/drv_onu_resource_gpe.h
libonu_extra_headers= \
drv_onu_api.h \
drv_onu_cli_core.h \
drv_onu_cli_dump.h \
drv_onu_cli_dump_misc.h \
drv_onu_debug.h \
drv_onu_event_api.h \
drv_onu_gpe_api.h \
drv_onu_gpe_tables_api.h \
drv_onu_gpe_tables.c \
drv_onu_gtc_api.h \
drv_onu_lan_api.h \
drv_onu_lan_api_intern.h \
drv_onu_ll_cop.h \
drv_onu_ll_eim.h \
drv_onu_ll_fsqm.h \
drv_onu_ll_gpearb.h \
drv_onu_ll_gtc.h \
drv_onu_ll_ictrlg.h \
drv_onu_ll_ictrll.h \
drv_onu_ll_iqm.h \
drv_onu_ll_octrlg.h \
drv_onu_ll_octrll.h \
drv_onu_ll_sce.h \
drv_onu_ll_ssb.h \
drv_onu_ll_sys.h \
drv_onu_ll_tbm.h \
drv_onu_ll_tmu.h \
drv_onu_ll_tod.h \
drv_onu_ll_tod_asc.h \
drv_onu_notifier.h \
drv_onu_ploam_api.h \
drv_onu_reg_base.h \
drv_onu_reg_coplink_cop.h \
drv_onu_reg_disp.h \
drv_onu_reg_eim.h \
drv_onu_reg_sgmii.h \
drv_onu_reg_sxgmii.h \
drv_onu_reg_fsqm.h \
drv_onu_reg_gpearb.h \
drv_onu_reg_gtc.h \
drv_onu_reg_ictrlc.h \
drv_onu_reg_ictrlg.h \
drv_onu_reg_ictrll.h \
drv_onu_reg_iqm.h \
drv_onu_reg_link.h \
drv_onu_reg_merge.h \
drv_onu_reg_octrlc.h \
drv_onu_reg_octrlg.h \
drv_onu_reg_octrll.h \
drv_onu_reg_pctrl.h \
drv_onu_reg_pe.h \
drv_onu_reg_sbs0ctrl.h \
drv_onu_reg_status.h \
drv_onu_reg_sys_eth.h \
drv_onu_reg_sys_gpe.h \
drv_onu_reg_sys1.h \
drv_onu_reg_tbm.h \
drv_onu_reg_tmu.h \
drv_onu_register.h \
drv_onu_resource_device_psb98010.h \
drv_onu_resource_device_psb98020.h \
drv_onu_resource_device_psb98030.h \
drv_onu_timer.h \
drv_onu_reg_tod.h \
drv_onu_tse_config.h \
drv_onu_tse.h
AM_CFLAGS=
EXTRA_DIST = \
$(libonu_sources) \
$(libonu_interface_headers) \
$(libonu_extra_headers)
if ENABLE_LINUX
if !INCLUDE_REMOTE_ONLY_ONU
bin_PROGRAMS = mod_onu.ko
endif
mod_onu_kodir = /include
mod_onu_ko_HEADERS = \
$(libonu_interface_headers)
else !ENABLE_LINUX
AM_CFLAGS+= -Wall -Wno-unused-parameter -Wno-unused-variable -Os \
-ffunction-sections -fdata-sections -funit-at-a-time
lib_LIBRARIES = libonu.a
libonu_a_SOURCES = $(libonu_sources)
endif !ENABLE_LINUX
if !ONU_LIBRARY
AM_CFLAGS+= -DLINUX
endif
AM_CPPFLAGS = -Wall -Wextra \
-I@srcdir@ \
-I@srcdir@/include \
-I@top_srcdir@/.. \
@IFXOS_INCLUDE_PATH@
if EVENT_LOGGER_DEBUG
AM_CFLAGS += @EVENT_LOGGER_INCL_PATH@
endif
libonu_a_CFLAGS=$(AM_CFLAGS)
if ENABLE_LINUX
clean-generic:
@echo "Cleanup Linux 2.6.x kernel object build"
@- find . -name ".*.cmd" | xargs rm -f
@- find . -name "*.o" | xargs rm -f
@- rm -f Module.symvers Kbuild
@- rm -rf .tmp_versions *.mod.c *.order
# linux 2.6 kernel object
# linux 2.6 kernel object - dummy to force dependencies
mod_onu_ko_SOURCES = ../ChangeLog
mod_onu_ko_OBJS = "$(subst .c,.o,$(filter %.c,$(libonu_sources)))"
mod_onu.ko: $(libonu_sources)
@echo -e "mod_onu: Making Linux 2.6.x kernel object"
if test ! -e drv_onu_common.c ; then \
echo "copy source files (as links only!)"; \
for f in $(filter %.c,$(libonu_sources)); do \
mkdir -p $(PWD)/`dirname $$f`/ ; \
cp -sf $(addprefix @abs_srcdir@/,$$f) $(PWD)/`dirname $$f`/ ; \
done \
fi
@echo -e "# mod_onu: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild
@echo -e "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild
@echo -e "$(subst .ko,,$@)-y := $(mod_onu_ko_OBJS)" >> $(PWD)/Kbuild
@echo -e "EXTRA_CFLAGS := $(libonu_a_CFLAGS) -DHAVE_CONFIG_H -I@abs_srcdir@ -I@abs_srcdir@/include $(IFXOS_INCLUDE_PATH)" >> $(PWD)/Kbuild
$(MAKE) CONFIG_DEBUG_SECTION_MISMATCH=y ARCH=@KERNEL_ARCH@ -C @KERNEL_BUILD_PATH@ O=@KERNEL_BUILD_PATH@ M=$(PWD) modules
endif ENABLE_LINUX
lint:
@flint -b -vm -cgnu \
+libdir\(@KERNEL_INCL_PATH@/*\) \
-i$(shell dirname `$(CC) -print-file-name=include`)/include \
+libdir\($(shell dirname `$(CC) -print-file-name=include`)\) \
-i /usr/include +libdir\(/usr/include\) \
$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
-i@top_srcdir@ std_generic.lnt \
$(filter %.c,$(libonu_sources))

1285
src/Makefile.in Normal file

File diff suppressed because it is too large Load Diff

1049
src/drv_onu_api.h Normal file

File diff suppressed because it is too large Load Diff

981
src/drv_onu_base.c Normal file
View File

@ -0,0 +1,981 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
/** \addtogroup ONU_MAPI_REFERENCE_INTERNAL
@{
*/
/** \defgroup ONU_SIMULATION_INTERNAL Simulation Specific Implementation
This chapter describes the internal interface of the ONU simulation.
@{
*/
#ifdef HAVE_CONFIG_H
#include "drv_onu_config.h"
#endif
#if defined(ONU_LIBRARY)
#include <stdlib.h>
#include <sys_tickedtimer.h>
#include "drv_onu_api.h"
#include "kernel.h"
#include "device_io.h"
#include "ifxos_memory_alloc.h"
#include "ifxos_time.h"
#include "drv_onu_cli_core.h"
#include "drv_onu_gtc_api.h"
#include "drv_onu_gpe_api.h"
#include "drv_onu_gpe_tables_api.h"
#include "drv_onu_lan_api.h"
#include "drv_onu_ploam_api.h"
#include "drv_onu_event_interface.h"
#include "drv_onu_event_api.h"
#include "drv_onu_timer.h"
#include "drv_onu_register.h"
#include "drv_onu_ll_gpearb.h"
#include "drv_onu_ll_eim.h"
#include "drv_onu_ll_sys.h"
#include "drv_onu_ll_fsqm.h"
#include "drv_onu_ll_iqm.h"
#include "drv_onu_ll_octrlg.h"
#include "drv_onu_ll_octrll.h"
#include "drv_onu_ll_ictrlg.h"
#include "drv_onu_ll_ictrll.h"
#include "drv_onu_ll_ssb.h"
#include "drv_onu_ll_sce.h"
#include "drv_onu_ll_gtc.h"
#include "drv_onu_ll_tmu.h"
#include "drv_onu_reg_ictrlc.h"
#include "drv_onu_reg_sbs0ctrl.h"
#include "drv_onu_ll_cop.h"
#include "drv_onu_ll_tbm.h"
#include "drv_onu_ll_tod.h"
/** common callbacks used by ioctl() */
extern const struct onu_entry common_function_table[];
extern const unsigned int common_function_table_size;
extern const struct onu_entry ploam_function_table[];
extern const unsigned int ploam_function_table_size;
#define IFXOS_BlockAlloc IFXOS_MemAlloc
#define IFXOS_BlockFree IFXOS_MemFree
long onu_open(void *device, const char *appendix);
int onu_release(void *pprivate);
int onu_ioctl(void *pprivate, unsigned int cmd, ulong_t argument);
struct timer_list onu_timer[ONU_MAX_TIMER];
STATIC unsigned int major_number;
onu_lock_t mailbox_lock;
onu_lock_t cop_lock;
onu_lock_t ictrlc_lock;
onu_lock_t octrlc_lock;
onu_lock_t link_lock;
onu_lock_t sce_lock;
onu_lock_t meter_lock;
onu_lock_t tmu_lock;
onu_lock_t enqueue_lock;
#ifdef INCLUDE_DEBUG_SUPPORT
enum onu_debug_level onu_debug_lvl = ONU_DBG_OFF;
#endif
STATIC void onu_proc_version_get(struct seq_file *s);
STATIC void onu_proc_status_get(struct seq_file *s);
STATIC void onu_proc_ls(struct seq_file *s);
struct onu_reg_gtc *gtc = (struct onu_reg_gtc *)ONU_GTC_BASE;
struct onu_reg_gpearb *gpearb = (struct onu_reg_gpearb *)ONU_GPEARB_BASE;
union onu_reg_eim *eim = (union onu_reg_eim *)ONU_EIM_BASE;
struct onu_reg_sxgmii *sxgmii = (struct onu_reg_sxgmii *)ONU_SXGMII_BASE;
struct onu_reg_iqm *iqm = (struct onu_reg_iqm *)ONU_IQM_BASE;
struct onu_reg_fsqm *fsqm = (struct onu_reg_fsqm *)ONU_FSQM_BASE;
struct onu_reg_ictrlc *ictrlc = (struct onu_reg_ictrlc *)ONU_ICTRLC0_BASE;
struct onu_reg_octrlc *octrlc = (struct onu_reg_octrlc *)ONU_OCTRLC_BASE;
struct onu_reg_ictrll *ictrll = (struct onu_reg_ictrll *)ONU_ICTRLL0_BASE;
struct onu_reg_ictrlg *ictrlg = (struct onu_reg_ictrlg *)ONU_ICTRLG_BASE;
struct onu_reg_octrll *octrll = (struct onu_reg_octrll *)ONU_OCTRLL0_BASE;
struct onu_reg_octrlg *octrlg = (struct onu_reg_octrlg *)ONU_OCTRLG_BASE;
struct onu_reg_sys_eth *sys_eth = (struct onu_reg_sys_eth *)ONU_SYS_ETH_BASE;
struct onu_reg_sys_gpe *sys_gpe = (struct onu_reg_sys_gpe *)ONU_SYS_GPE_BASE;
struct onu_reg_tmu *tmu = (struct onu_reg_tmu *)ONU_TMU_BASE;
struct onu_reg_tbm *tbm = (struct onu_reg_tbm *)ONU_TBM_BASE;
struct onu_reg_sbs0ctrl *sbs0ctrl = (struct onu_reg_sbs0ctrl *)ONU_SBS0CTRL_BASE;
struct onu_reg_merge *merge = (struct onu_reg_merge *)ONU_MERGE_BASE;
struct onu_reg_disp *disp = (struct onu_reg_disp *)ONU_DISP_BASE;
struct onu_reg_pe *pe = (struct onu_reg_pe *)ONU_PE0_BASE;
struct onu_reg_pctrl *pctrl = (struct onu_reg_pctrl *)ONU_PCTRL_BASE;
struct onu_reg_link *link = (struct onu_reg_link *)ONU_LINK0_BASE;
struct onu_reg_tod *tod = (struct onu_reg_tod *)ONU_TOD_BASE;
/*struct onu_reg_status *status = (struct onu_reg_status *)ONU_STATUS_BASE;*/
struct onu_reg_sys1 *sys1 = (struct onu_sys1_tod *)ONU_SYS1_BASE;
/** ONU related data */
struct ploam_context ploam_ctx;
static struct onu_device onu_device;
/**
Open the device.
At the first time:
- allocating internal memory for each new device
- initialize the device
\return
- 0 - if error,
- device context - if success
*/
long onu_open(void *ctrl, const char *appendix)
{
struct onu_device *p_dev = &onu_device;
(void)appendix;
if (gpe_chip_version == GPE_CHIP_UNKNOWN)
gpe_chip_version = onu_chip_get();
if (onu_device_open((struct onu_control *)ctrl, p_dev) !=
ONU_STATUS_OK) {
ONU_DEBUG_ERR("Init failed");
goto open_error;
}
return (long)p_dev;
open_error:
onu_device_close(p_dev);
return 0;
}
/**
Release the device.
\param inode pointer to the inode
\param filp pointer to the file descriptor
\return
- 0 - on success
- otherwise error code
*/
int onu_release(void *pprivate)
{
struct onu_device *p_dev = (struct onu_device *)pprivate;
if (p_dev == NULL)
return -1;
onu_device_close(p_dev);
return 0;
}
/**
Quick check if the notification FIFO is filled.
\return
- 1 - data available
- 0 - no data available
*/
int onu_poll(void)
{
if (IFX_Var_Fifo_isEmpty(&onu_control[0].nfc_fifo.data) == 0)
/* data available */
return 1;
return 0;
}
STATIC int onu_table_check(const char *name,
const struct onu_entry *tbl,
const uint32_t num)
{
uint32_t i;
int ret = 0;
for(i=0; i<num; i++) {
if(_IOC_NR(tbl[i].id) == 0)
continue;
if(tbl[i].p_entry0 == NULL &&
tbl[i].p_entry1 == NULL &&
tbl[i].p_entry2 == NULL )
continue;
if(_IOC_NR(tbl[i].id) != i) {
ONU_DEBUG_ERR("%s[%02d] %s - cmd 0x%08x - "
"id not in ascending order",
name, i, tbl[i].name, tbl[i].id);
ret = -1;
}
if (_IOC_DIR(tbl[i].id) & _IOC_READ && tbl[i].size_out == 0) {
ONU_DEBUG_ERR("%s[%02d] %s - cmd 0x%08x - read size 0",
name, i, tbl[i].name, tbl[i].id);
ret = -1;
}
if (_IOC_DIR(tbl[i].id) & _IOC_WRITE && tbl[i].size_in == 0) {
ONU_DEBUG_ERR("%s[%02d] %s - cmd 0x%08x - write size 0",
name, i, tbl[i].name, tbl[i].id);
ret = -1;
}
if ((_IOC_DIR(tbl[i].id) & _IOC_READ) == 0 && tbl[i].size_out) {
ONU_DEBUG_ERR("%s[%02d] %s - cmd 0x%08x - "
"read size %d but _IOC_READ not set",
name, i, tbl[i].name, tbl[i].id,
tbl[i].size_out);
ret = -1;
}
if ((_IOC_DIR(tbl[i].id) & _IOC_WRITE) == 0 && tbl[i].size_in) {
ONU_DEBUG_ERR("%s[%02d] %s - cmd 0x%08x - "
"write size %d but _IOC_WRITE not set",
name, i, tbl[i].name, tbl[i].id,
tbl[i].size_out);
ret = -1;
}
}
return ret;
}
static void cp(struct onu_device *p_dev, const struct onu_entry *table,
struct fio_exchange *exchange, uint32_t nr, uint8_t *buf)
{
if (_IOC_DIR(table[nr].id) & _IOC_WRITE)
memcpy(buf, exchange->p_data, table[nr].size_in);
if (table[nr].p_entry0)
exchange->error = table[nr].p_entry0(p_dev);
else if (table[nr].p_entry1)
exchange->error = table[nr].p_entry1(p_dev, p_dev->io_buf);
else if (table[nr].p_entry2)
exchange->error =
table[nr].p_entry2(p_dev, p_dev->io_buf, p_dev->io_buf);
if (_IOC_DIR(table[nr].id) & _IOC_READ) {
memcpy(exchange->p_data, buf, table[nr].size_out);
exchange->length = table[nr].size_out;
} else {
exchange->length = 0;
}
}
/**
Configuration and control interface of the device.
\param inode pointer to the inode
\param filp pointer to the file descriptor
\param cmd function id's
\param arg optional argument
\return
- 0 and positive values - success,
- negative value - ioctl failed
*/
int onu_ioctl(void *pprivate, unsigned int cmd, ulong_t arg)
{
int32_t ret = -1;
struct onu_device *p_dev = (struct onu_device *)pprivate;
uint8_t *buf;
struct fio_exchange *exchange = (struct fio_exchange *) arg;
uint32_t type = _IOC_TYPE(cmd);
uint32_t nr = _IOC_NR(cmd);
#ifndef ONU_SIMULATION
uint32_t size = _IOC_SIZE(cmd);
#endif
uint32_t dir = _IOC_DIR(cmd);
(void)dir;
buf = &p_dev->io_buf[0];
#ifndef ONU_SIMULATION
if (size >= ONU_IO_BUF_SIZE)
return ret;
#endif
if ((type == ONU_MAGIC) && (nr < common_function_table_size)
&& (nr == _IOC_NR(common_function_table[nr].id))) {
cp(p_dev, common_function_table, exchange, nr, buf);
} else if ((type == PLOAM_MAGIC) && (nr < ploam_function_table_size)
&& (nr == _IOC_NR(ploam_function_table[nr].id))) {
cp(p_dev, ploam_function_table, exchange, nr, buf);
} else if ((type == GTC_MAGIC) && (nr < gtc_func_tbl_size)
&& (nr == _IOC_NR(gtc_func_tbl[nr].id))) {
cp(p_dev, gtc_func_tbl, exchange, nr, buf);
} else if ((type == GPE_MAGIC) && (nr < gpe_function_table_size)
&& (nr == _IOC_NR(gpe_function_table[nr].id))) {
cp(p_dev, gpe_function_table, exchange, nr, buf);
} else if ((type == GPE_TABLE_MAGIC) && (nr < gpe_table_function_table_size)
&& (nr == _IOC_NR(gpe_table_function_table[nr].id))) {
cp(p_dev, gpe_table_function_table, exchange, nr, buf);
} else if ((type == LAN_MAGIC) && (nr < lan_function_table_size)
&& (nr == _IOC_NR(lan_function_table[nr].id))) {
cp(p_dev, lan_function_table, exchange, nr, buf);
} else if ((type == _IOC_TYPE(FIO_ONU_EVENT_FIFO))
&& (nr == _IOC_NR(FIO_ONU_EVENT_FIFO))) {
uint32_t len = 0;
struct onu_fifo_header *p_data =
(struct onu_fifo_header *) IFX_Var_Fifo_peekElement(
&onu_control[0].nfc_fifo.data, &len);
if (p_data) {
memcpy(exchange->p_data, p_data, len);
exchange->length = len;
if (onu_control[0].nfc_fifo.overflow) {
exchange->error = 1;
} else {
exchange->error = 0;
}
onu_fifo_read(&onu_control[0].nfc_fifo, NULL, &len);
} else {
exchange->length = 0;
exchange->error = -1;
}
} else if ((type == _IOC_TYPE(FIO_ONU_EVENT_ENABLE_SET))
&& (nr == _IOC_NR(FIO_ONU_EVENT_ENABLE_SET))) {
onu_event_enable_set(p_dev,
(struct onu_event_mask *)
exchange->p_data);
} else if ((type == _IOC_TYPE(FIO_ONU_EVENT_ENABLE_GET))
&& (nr == _IOC_NR(FIO_ONU_EVENT_ENABLE_GET))) {
onu_event_enable_get(p_dev,
(struct onu_event_mask *)
exchange->p_data);
} else {
return ret;
}
return 0;
}
/**
Start ONU timer
\param timer_no Timer Index
\param timeout Timeout in mseconds.
*/
void onu_timer_start(const uint32_t timer_no, uint32_t timeout)
{
if (onu_timer[timer_no].running) {
printf("timer %d is pending" ONU_CRLF, timer_no);
} else {
timer_start (&onu_timer[timer_no], timeout, 0);
}
}
/**
Stop Timer
\param timer_no Timer Index
*/
void onu_timer_stop(const uint32_t timer_no)
{
tick_timer_stop (&onu_timer[timer_no]);
}
/** Timer Handler
\param timer_no Indicates the timer index
*/
STATIC void onu_timer_handler(unsigned long timer_no)
{
#if (MAX_ONU_INSTANCES == 1)
onu_timer_exec(&onu_control[0], timer_no);
#else
uint32_t num = timer_no & 0xFFFF;
struct onu_control *ctrl = &onu_control[timer_no >> 16];
onu_timer_exec(ctrl, num);
#endif
}
/**
Retrieve pseudo random number within a specified range
\param range_min lowest value
\param range_max highest value
*/
uint32_t onu_random_get(const uint32_t range_min, const uint32_t range_max)
{
return (uint32_t)(((double)rand() / (double)RAND_MAX) * range_max +
range_min);
}
void onu_led_set(const uint32_t idx, const uint32_t state)
{
(void)idx;
(void)state;
}
void onu_irq_enable(struct onu_control *ctrl, uint32_t mask)
{
(void)ctrl;
(void)mask;
}
void onu_irq_add(struct onu_control *ctrl, uint32_t mask)
{
(void)ctrl;
(void)mask;
}
void onu_irq_remove(struct onu_control *ctrl, uint32_t mask)
{
(void)ctrl;
(void)mask;
}
void onu_udelay(uint32_t u_sec)
{
udelay(u_sec);
}
void onu_hot_plug_state(const enum ploam_state state,
const enum ploam_state old_state)
{
(void)state;
(void)old_state;
printf("%d", state);
}
void onu_irq_poll(void)
{
uint32_t irnicr;
static const uint32_t link_port[3] = {
0,
ONU_LINK0_SIZE / 4,
(2 * ONU_LINK0_SIZE) / 4
};
onu_gtc_ds_handle(&onu_control[0], ONU_MAX_TIMER);
gtc_us_handle(&onu_control[0]);
irnicr = tmu_r32(irnicr);
onu_gpe_egress_cpu_port_handle(&onu_control[0], irnicr);
irnicr = link_r32_table(irnicr, link_port[1]);
if (irnicr & LINK_IRNICR_RXR) {
onu_gpe_omci_handle(&onu_control[0]);
}
}
int onu_pe_fw_load(const char *name, struct onu_fw *pe_fw)
{
int ret = 0;
const struct firmware *fw;
if (strlen(name) > ONU_PE_FIRMWARE_NAME_MAX - 1) {
ONU_DEBUG_ERR(" Error loading firmware (fw name is too long)");
return -5;
}
if (request_firmware(&fw, name)) {
if (!pe_fw->bin || !pe_fw->len) {
return -3;
} else {
/* use the provided firmware*/
return 0;
}
} else {
onu_fw_release(pe_fw);
}
if (fw->size <= PE_FW_HEADER_SIZE) {
ONU_DEBUG_ERR("Error loading firmware (invalid firmware binary)");
return -4;
}
pe_fw->len = fw->size;
pe_fw->bin = (uint8_t *)fw->data; /* cast away the const qualifier */
strncpy(pe_fw->fw_name, name, ONU_PE_FIRMWARE_NAME_MAX);
release_firmware(fw);
return ret;
}
void onu_fw_release(struct onu_fw *pe_fw)
{
(void) pe_fw;
}
int onu_pe_fw_info_load(const struct onu_fw *pe_fw, struct pe_fw_info *info)
{
uint32_t opt_hdr_len;
#if 0
uint8_t *opt_hdr;
unsigned long flags = 0;
#endif
if (info->opt_hdr)
return -1;
strncpy(info->fw_name, pe_fw->fw_name, ONU_PE_FIRMWARE_NAME_MAX);
info->flags[0] = ((uint32_t*)pe_fw->bin)[PE_FW_FLAG0_OFFSET_WORD];
info->flags[1] = ((uint32_t*)pe_fw->bin)[PE_FW_FLAG1_OFFSET_WORD];
opt_hdr_len = info->flags[0] & PE_FW_FLAG0_OPT_HEADER_MASK ?
((uint32_t*)pe_fw->bin)[PE_FW_OPT_HDR_LEN_OFFSET_WORD] : 0;
memcpy(&info->ver.major, pe_fw->bin, 4);
if (!opt_hdr_len)
return 0;
if (info->opt_hdr_len % sizeof(uint32_t))
return -1;
#if 0
opt_hdr = vmalloc(info->opt_hdr_len);
if (!opt_hdr) {
printk(KERN_ERR DEBUG_PREFIX
" Error alloc opt header (allocate %d bytes)\n",
info->opt_hdr_len);
return -2;
} else {
onu_spin_lock_get(&mailbox_lock, &flags);
info->opt_hdr_len = opt_hdr_len;
info->opt_hdr = opt_hdr;
memcpy(info->opt_hdr, pe_fw->bin + PE_FW_HEADER_SIZE,
info->opt_hdr_len);
onu_spin_lock_release(&mailbox_lock, flags);
}
#endif
return 0;
}
void onu_pe_fw_info_release(struct pe_fw_info *info)
{
(void) info;
}
int onu_microcode_load(struct onu_control *ctrl, const char *name)
{
const struct firmware *fw;
if (request_firmware(&fw, name)) {
ONU_DEBUG_ERR("Error loading microcode (microcode not available)");
return -3;
}
if (fw->size < 32 || fw->size >= ONU_MAX_COP_SIZE) {
ONU_DEBUG_ERR("Error loading microcode (invalid microcode binary)");
return -4;
}
memcpy(ctrl->cop_microcode_bin, fw->data, fw->size);
ctrl->cop_microcode_len = fw->size;
release_firmware(fw);
return 0;
}
int onu_gphy_firmware_download(struct onu_control *ctrl, const char *name)
{
const char *error_cause = NULL;
const struct firmware *fw;
uint32_t load_offset = (16 << 10); /* gphy needs 16k alignment */
if (ctrl->lan_gphy_fw_ram_addr) {
error_cause = "already loaded";
goto error_out;
}
if (request_firmware(&fw, name)) {
error_cause = "no firmware";
goto error_out;
}
if (fw->size < 8) {
error_cause = "invalid binary";
goto error_release;
}
if (fw->size > (48 << 10)) {
error_cause = "invalid binary size (too big)";
goto error_release;
}
/* copy firmware data*/
memcpy((void*)(ONU_SBS0RAM_BASE | load_offset), fw->data, fw->size);
ctrl->lan_gphy_fw_ram_addr = (ONU_SBS0RAM_BASE | load_offset);
ONU_DEBUG_ERR("GPHY Firmware loaded (%s)", name);
error_release:
release_firmware(fw);
error_out:
if (error_cause) {
ONU_DEBUG_ERR(" Error loading GPHY firmware (%s)", error_cause);
return -1;
}
return 0;
}
void onu_time_to_tm(uint32_t totalsecs, int offset, struct onu_tm *result)
{
memset(result, 0, sizeof(*result));
}
unsigned long onu_elapsed_time_sec_get(unsigned long ref)
{
return ref;
}
/**
Clean up the module if unloaded.
\remarks
Called by the kernel.
*/
void onu_exit(void)
{
int i;
DEVIO_driver_remove(major_number, 1);
for (i = 0; i < MAX_ONU_INSTANCES; i++) {
ploam_context_free(&onu_control[i]);
}
ONU_DEBUG_MSG("cleanup successful");
}
/**
Initialize the driver module.
\return
- 0 on success
- Error code
\remarks
Called by the kernel.
*/
int onu_init(void)
{
char buf[64];
uint32_t i;
int res;
#ifdef INCLUDE_DEBUG_SUPPORT
onu_debug_lvl = ONU_DBG_MSG;
#endif
ONU_DEBUG_MSG("%s", &onu_whatversion[4]);
#ifdef INCLUDE_DEBUG_SUPPORT
onu_debug_lvl = ONU_DBG_WRN;
#endif
res = onu_table_check( "common", &common_function_table[0],
common_function_table_size);
if (res)
return -1;
res = onu_table_check( "gtc", &gtc_func_tbl[0],
gtc_func_tbl_size);
if (res)
return -1;
res = onu_table_check( "ploam", &ploam_function_table[0],
ploam_function_table_size);
if (res)
return -1;
res = onu_table_check( "gpe", &gpe_function_table[0],
gpe_function_table_size);
if (res)
return -1;
res = onu_table_check( "gpe_table", &gpe_table_function_table[0],
gpe_table_function_table_size);
if (res)
return -1;
res = onu_table_check( "lan", &lan_function_table[0],
lan_function_table_size);
if (res)
return -1;
major_number = DEVIO_driver_install(onu_open,
onu_release,
NULL,
NULL, onu_ioctl, NULL);
if (major_number == (unsigned)-1) {
ONU_DEBUG_ERR("can't get major %d", major_number);
return -1;
}
for (i = 0; i < ONU_MAX_TIMER; i++) {
timer_init (&onu_timer[i], onu_timer_handler, i);
}
memset(onu_control, 0x00, sizeof(onu_control));
for (i = 0; i < MAX_ONU_INSTANCES; i++) {
/*sprintf(buf, "/dev/%s%d", ONU_NAME, i);*/
strcpy(buf, "/dev/onu0");
memset(&onu_control[i], 0, sizeof(struct onu_control));
if ((signed)
DEVIO_device_add(&onu_control[i], &buf[0],
major_number) == IFX_ERROR) {
ONU_DEBUG_ERR("unable to create device.");
goto ONU_INIT_ERROR;
}
if (ploam_context_init(&onu_control[i]) != ONU_STATUS_OK) {
ONU_DEBUG_ERR("can't init PLOAM context %d", i);
continue;
}
}
return 0;
ONU_INIT_ERROR:
onu_exit();
return -1;
}
void event_queue_init(struct onu_control *ctrl)
{
}
int event_queue_wait(struct onu_control *ctrl)
{
return 0;
}
void event_queue_wakeup(struct onu_control *ctrl)
{
}
uint32_t onu_gpon_link_status_get(void)
{
return 0;
}
uint32_t onu_mac_link_status_get(const uint8_t idx)
{
return 1;
}
uint32_t onu_gpon_packet_count_get(const uint8_t rx)
{
return 0;
}
uint32_t onu_mac_packet_count_get(const uint8_t idx, const uint8_t rx)
{
return 0;
}
#if defined(INCLUDE_DUMP)
typedef void (*proc_single_callback_t)(struct seq_file *);
typedef int (*proc_callback_t)(struct seq_file *, int);
typedef int (*proc_init_callback_t)(void);
struct proc_entry {
char const *name;
proc_single_callback_t single_callback;
proc_callback_t callback;
proc_init_callback_t init_callback;
};
static struct proc_entry proc_entries[] = {
{"ls", onu_proc_ls, NULL, NULL},
{"version", onu_proc_version_get, NULL, NULL},
{"status", onu_proc_status_get, NULL, NULL},
{"eim", eim_dump, NULL, NULL},
{"sys", sys_dump, NULL, NULL},
{"octrlg", octrlg_dump, NULL, NULL},
{"octrlg_table", octrlg_table_dump, NULL, NULL},
{"octrll", octrll_dump, NULL, NULL},
{"ictrlg", ictrlg_dump, NULL, NULL},
{"ictrlg_table", ictrlg_table_dump, NULL, NULL},
{"ictrll", ictrll_dump, NULL, NULL},
{"fsqm", fsqm_dump, NULL, NULL},
{"fsqm_llt", NULL, fsqm_llt, NULL},
{"fsqm_rcnt", NULL, fsqm_rcnt, NULL},
{"iqm", iqm_dump, NULL, NULL},
{"ssb", ssb_dump, NULL, NULL},
{"gpearb", gpearb_dump, NULL, NULL},
{"sce", sce_dump, NULL, NULL},
{"merge", merge_dump, NULL, NULL},
{"tmu", tmu_dump, NULL, NULL},
{"tmu_eqt", tmu_eqt_dump, NULL, NULL},
{"tmu_ept", tmu_ept_dump, NULL, NULL},
{"tmu_sbit", tmu_sbit_dump, NULL, NULL},
{"tmu_sbot", tmu_sbot_dump, NULL, NULL},
{"tmu_tbst", tmu_tbst_dump, NULL, NULL},
{"tmu_ppt", NULL, tmu_ppt_dump, tmu_ppt_dump_start},
{"tbm", tbm_dump, NULL, NULL},
{"gpe_table", gpe_table_dump, NULL, NULL},
{"gpe_dsgem", gpe_table_dsgem, NULL, NULL},
{"gpe_usgem", gpe_table_usgem, NULL, NULL},
{"gpe_fidhash", gpe_table_fidhash, NULL, NULL},
{"gpe_fidass", gpe_table_fidass, NULL, NULL},
{"gpe_tagg", gpe_table_tagg, NULL, NULL},
{"gpe_vlan", gpe_table_vlan, NULL, NULL},
{"gpe_extvlan", gpe_table_extvlan, NULL, NULL},
{"gpe_vlanrule", gpe_table_vlanrule, NULL, NULL},
{"gpe_vlantreatment", gpe_table_vlantreatment,NULL, NULL},
{"gpe_shortfwdhash", gpe_table_shortfwdhash, NULL, NULL},
{"gpe_shortfwdmac", gpe_table_shortfwdmac, NULL, NULL},
{"gpe_shortfwdmacmc", gpe_table_shortfwdmacmc, NULL, NULL},
{"gpe_shortfwdipv4", gpe_table_shortfwdipv4, NULL, NULL},
{"gpe_shortfwdipv4mc", gpe_table_shortfwdipv4mc, NULL, NULL},
{"gpe_longfwdhash", gpe_table_longfwdhash, NULL, NULL},
{"gpe_longfwipv6", gpe_table_longfwdipv6, NULL, NULL},
{"gpe_longfwipv6mc", gpe_table_longfwdipv6mc, NULL, NULL},
{"gpe_dsmcipv4", gpe_table_dsmcipv4, NULL, NULL},
{"gpe_dsmcipv6", gpe_table_dsmcipv6, NULL, NULL},
{"gpe_learnlim", gpe_table_learnlim, NULL, NULL},
{"gpe_exp", gpe_table_exp, NULL, NULL},
{"gpe_macfilter", gpe_table_macfilter, NULL, NULL},
{"gpe_copcounter", gpe_table_counter, NULL, NULL},
{"gpe_bridgeport", gpe_table_bridgeport, NULL, NULL},
{"gpe_pmapper", gpe_table_pmapper, NULL, NULL},
{"gpe_lanport", gpe_table_lanport, NULL, NULL},
{"gpe_pcpdec", gpe_table_pcpdec, NULL, NULL},
{"gpe_dscpdec", gpe_table_dscpdec, NULL, NULL},
{"gpe_pcpenc", gpe_table_pcpenc, NULL, NULL},
{"gpe_dscpenc", gpe_table_dscpenc, NULL, NULL},
{"gpe_redir", gpe_table_redir, NULL, NULL},
{"gpe_aclfilt", gpe_table_aclfilt, NULL, NULL},
{"gpe_bridge", gpe_table_bridge, NULL, NULL},
{"gpe_const", gpe_table_const, NULL, NULL},
{"gpe_status", gpe_table_status, NULL, NULL},
{"gpe_ethfilter", gpe_table_ethertype_filter, NULL, NULL},
{"gtc", gtc_dump, NULL, NULL}
};
STATIC void onu_proc_version_get(struct seq_file *s)
{
seq_printf(s, "%s" ONU_CRLF, &onu_whatversion[4]);
seq_printf(s, "Compiled on %s, %s for base kernel" ONU_CRLF,
__DATE__, __TIME__);
}
STATIC void onu_proc_status_get(struct seq_file *s)
{
unsigned int i, k;
struct onu_device *p_dev;
uint32_t *ptr, l, m, prev, idx;
uint8_t *ptr8;
for (i = 0; i < MAX_ONU_INSTANCES; i++) {
seq_printf(s, "PLOAM[%d]" ONU_CRLF, i);
seq_printf(s, "current state = %d" ONU_CRLF,
onu_control[i].ploam_ctx.curr_state);
seq_printf(s, "previous state = %d" ONU_CRLF,
onu_control[i].ploam_ctx.previous_state);
seq_printf(s, "NFC FIFO mask = 0x%x" ONU_CRLF,
onu_control[i].nfc_fifo.mask);
seq_printf(s, "NFC FIFO avail = %d" ONU_CRLF,
IFX_Var_Fifo_getCount(&onu_control[i].nfc_fifo.
data));
seq_printf(s, "NFC FIFO lost = %d" ONU_CRLF,
onu_control[i].nfc_fifo.lost);
seq_printf(s, "OMCI downstream = %d" ONU_CRLF,
onu_control[i].omci_downstream);
seq_printf(s, "OMCI dropped downstream = %d" ONU_CRLF,
onu_control[i].omci_downstream_dropped);
seq_printf(s, "OMCI upstream = %d" ONU_CRLF,
onu_control[i].omci_upstream);
#if 0
if (IFXOS_MutexGet(&onu_control[i].list_lock) == IFX_SUCCESS) {
p_dev = onu_control[i].p_dev_head;
k = 0;
while (p_dev) {
seq_printf(s, "Device[%d][%d]" ONU_CRLF, i, k);
seq_printf(s, "NFC FIFO mask = 0x%x" ONU_CRLF,
p_dev->nfc_fifo.mask);
seq_printf(s, "NFC FIFO avail = %d" ONU_CRLF,
IFX_Var_Fifo_getCount(
&p_dev->nfc_fifo.data));
seq_printf(s, "NFC FIFO lost = %d" ONU_CRLF,
p_dev->nfc_fifo.lost);
p_dev = p_dev->p_next;
k++;
}
IFXOS_MutexRelease(&onu_control[i].list_lock);
}
#endif
}
}
STATIC void onu_proc_ls(struct seq_file *s)
{
struct proc_entry *p = &proc_entries[0];
unsigned int i;
for(i=0; i<sizeof(proc_entries)/sizeof(proc_entries[0]); i++, p++) {
seq_printf(s, "%s\n", p->name);
}
}
void proc_show(const char *name, char *buf, const uint32_t max_size)
{
unsigned int i, ret;
struct proc_entry *p = &proc_entries[0];
struct seq_file s;
for(i=0; i<sizeof(proc_entries)/sizeof(proc_entries[0]); i++, p++) {
ret = strcmp(name, p->name);
if(ret == 0)
break;
}
if(i == sizeof(proc_entries)/sizeof(proc_entries[0]))
return;
s.pos = 0;
s.buf = buf;
buf[0] = 0;
s.max_size = max_size;
if(p->init_callback)
s.pos = p->init_callback();
if(p->single_callback)
p->single_callback(&s);
if(p->callback)
p->callback(&s, s.pos);
}
int seq_printf(struct seq_file *s, const char *fmt, ...)
{
va_list ap;
int ret = 0;
int remaining = (s->max_size - 1) - s->pos;
va_start(ap, fmt);
ret = vsprintf(NULL, fmt, ap);
if(ret > 0) {
if(ret < remaining)
ret = vsprintf(s->buf + s->pos, fmt, ap);
else
ret = 0;
}
va_end(ap);
if(ret > 0) {
s->pos += ret;
s->buf[s->pos] = 0;
}
return ret;
}
#endif
#endif /* ONU_LIBRARY */
/*! @} */
/*! @} */

10752
src/drv_onu_cli.c Normal file

File diff suppressed because it is too large Load Diff

1085
src/drv_onu_cli_core.c Normal file

File diff suppressed because it is too large Load Diff

122
src/drv_onu_cli_core.h Normal file
View File

@ -0,0 +1,122 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
/**
\file drv_onu_cli_core.h
Device Driver, Command Line Interface
*/
#ifndef _onu_cli_h
#define _onu_cli_h
#include "drv_onu_std_defs.h"
EXTERN_C_BEGIN
#ifdef INCLUDE_CLI_SUPPORT
#if defined(LINUX) && defined(__KERNEL__)
long onu_strtol(const char *cp, char **endp, unsigned int base);
long long onu_strtoll(const char *cp, char **endp, unsigned int base);
unsigned long onu_strtoul(const char *cp, char **endp, unsigned int base);
unsigned long long onu_strtoull(const char *cp, char **endp, unsigned int base);
#else
#ifdef WIN32
#if _MSC_VER < 1300
#define strtoll(p, e, b) ((*(e) = (char*)(p) + (((b) == 10) ? strspn((p), "0123456789") : 0)), _atoi64(p))
#else
#define strtoll(p, e, b) _strtoi64(p, e, b)
#define strtoull(p, e, b) _strtoui64(p, e, b)
#endif
#endif
#define onu_strtol strtol
#define onu_strtoll strtoll
#define onu_strtoul strtoul
#define onu_strtoull strtoull
#endif
/** @defgroup CLI_INTERFACE Command Line Interface
* This file contains the informations to access the device driver.
* @{
*/
/** empty command name */
#define CLI_EMPTY_CMD " "
/** help for empry command */
#define CLI_EMPTY_CMD_HELP "n/a"
/**
Initialize the command line interface.
\return
- 0 on success
- -1 on failure
*/
int onu_cli_init(void);
/**
Clean command list.
\return
- 0 successful operation
*/
int onu_cli_shutdown(void);
typedef int (*onu_cli_entry_t) (struct onu_device *, const char *commands,
const uint32_t max_buf_size, char *out);
/**
Add a command to the list.
\param short_name short command name
\param long_name long command name
\param func command entry point
\return
- -1 no more space left in command table
- 0 command added to the command table
*/
int onu_cli_command_add(char const *short_name, char const *long_name,
onu_cli_entry_t cliEntry);
/**
Execute CLI command.
\param dev_ctx device context
\param buffer command string buffer (in & out)
\param size maximum size of the buffer
\return
- number of bytes in return buffer on success
- -1 on failure
*/
int onu_cli_command_execute(struct onu_device *dev_ctx, char *buffer,
const uint32_t size);
/**
Register the generated commands.
*/
void onu_cli_autogen_register(void);
/**
Register the misc commands.
*/
void onu_cli_misc_register(void);
/**
sscanf implementation with uint8 support.
*/
int32_t onu_cli_sscanf(const char *buf, char const *fmt, ...);
/** @} */
#endif /* INCLUDE_CLI_SUPPORT */
EXTERN_C_END
#endif /* _onu_cli_h */

1663
src/drv_onu_cli_dump.c Normal file

File diff suppressed because it is too large Load Diff

227
src/drv_onu_cli_dump.h Normal file
View File

@ -0,0 +1,227 @@
/* attention, this file was automatically generated by swig and Perl scripts */
#ifndef _drv_onu_cli_dump_h
#define _drv_onu_cli_dump_h
/** \addtogroup ONU_CLI_DUMP_COMMANDS
@{
*/
int dump_gtc_init(char *p_out, const void *p_data_in);
int dump_gtc_cfg_set(char *p_out, const void *p_data_in);
int dump_gtc_cfg_get(char *p_out, const void *p_data_in);
int dump_gtc_counter_threshold_set(char *p_out, const void *p_data_in);
int dump_gtc_counter_threshold_get(char *p_out, const void *p_data_in);
int dump_gtc_tca_get(char *p_out, const void *p_data_in);
int dump_gtc_us_header_cfg_get(char *p_out, const void *p_data_in);
int dump_gtc_counter_get(char *p_out, const void *p_data_in);
int dump_gtc_counter_reset(char *p_out, const void *p_data_in);
int dump_gtc_status_get(char *p_out, const void *p_data_in);
int dump_gtc_alarm_get(char *p_out, const void *p_data_in);
int dump_gtc_ranging_get(char *p_out, const void *p_data_in);
int dump_gtc_dying_gasp_cfg_set(char *p_out, const void *p_data_in);
int dump_gtc_dying_gasp_cfg_get(char *p_out, const void *p_data_in);
int dump_gtc_no_message_cfg_set(char *p_out, const void *p_data_in);
int dump_gtc_no_message_cfg_get(char *p_out, const void *p_data_in);
int dump_gtc_power_saving_mode_set(char *p_out, const void *p_data_in);
int dump_gtc_power_saving_mode_get(char *p_out, const void *p_data_in);
int dump_gtc_ploam_send(char *p_out, const void *p_data_in);
int dump_gtc_ploam_receive(char *p_out, const void *p_data_in);
int dump_gtc_serial_number_set(char *p_out, const void *p_data_in);
int dump_gtc_serial_number_get(char *p_out, const void *p_data_in);
int dump_gtc_password_set(char *p_out, const void *p_data_in);
int dump_gtc_password_get(char *p_out, const void *p_data_in);
int dump_gtc_forced_alloc_set(char *p_out, const void *p_data_in);
int dump_gtc_forced_alloc_get(char *p_out, const void *p_data_in);
int dump_gtc_bwmt_cfg_set(char *p_out, const void *p_data_in);
int dump_gtc_bwmt_cfg_get(char *p_out, const void *p_data_in);
int dump_gtc_bwmt_next(char *p_out, const void *p_data_in);
int dump_gtc_bwmt_status_get(char *p_out, const void *p_data_in);
int dump_gtc_last_change_time_get(char *p_out, const void *p_data_in);
int dump_gtc_pon_id_get(char *p_out, const void *p_data_in);
int dump_gpe_init(char *p_out, const void *p_data_in);
int dump_gpe_debug_init(char *p_out, const void *p_data_in);
int dump_gpe_low_level_modules_enable(char *p_out, const void *p_data_in);
int dump_gpe_cfg_set(char *p_out, const void *p_data_in);
int dump_gpe_cfg_get(char *p_out, const void *p_data_in);
int dump_gpe_status_get(char *p_out, const void *p_data_in);
int dump_gpe_gem_port_add(char *p_out, const void *p_data_in);
int dump_gpe_gem_port_delete(char *p_out, const void *p_data_in);
int dump_gpe_gem_port_get(char *p_out, const void *p_data_in);
int dump_gpe_gem_port_set(char *p_out, const void *p_data_in);
int dump_gpe_tcont_create(char *p_out, const void *p_data_in);
int dump_gpe_tcont_set(char *p_out, const void *p_data_in);
int dump_gpe_tcont_get(char *p_out, const void *p_data_in);
int dump_gpe_tcont_delete(char *p_out, const void *p_data_in);
int dump_gpe_egress_port_create(char *p_out, const void *p_data_in);
int dump_gpe_egress_port_get(char *p_out, const void *p_data_in);
int dump_gpe_port_index_get(char *p_out, const void *p_data_in);
int dump_gpe_egress_port_delete(char *p_out, const void *p_data_in);
int dump_gpe_egress_port_cfg_set(char *p_out, const void *p_data_in);
int dump_gpe_egress_port_cfg_get(char *p_out, const void *p_data_in);
int dump_gpe_egress_port_status_get(char *p_out, const void *p_data_in);
int dump_gpe_backpressure_cfg_set(char *p_out, const void *p_data_in);
int dump_gpe_backpressure_cfg_get(char *p_out, const void *p_data_in);
int dump_gpe_ingress_queue_cfg_set(char *p_out, const void *p_data_in);
int dump_gpe_ingress_queue_cfg_get(char *p_out, const void *p_data_in);
int dump_gpe_ingress_queue_status_get(char *p_out, const void *p_data_in);
int dump_gpe_egress_queue_create(char *p_out, const void *p_data_in);
int dump_gpe_egress_queue_delete(char *p_out, const void *p_data_in);
int dump_gpe_egress_queue_get(char *p_out, const void *p_data_in);
int dump_gpe_egress_queue_cfg_set(char *p_out, const void *p_data_in);
int dump_gpe_egress_queue_cfg_get(char *p_out, const void *p_data_in);
int dump_gpe_egress_queue_status_get(char *p_out, const void *p_data_in);
int dump_gpe_egress_queue_path_get(char *p_out, const void *p_data_in);
int dump_gpe_scheduler_create(char *p_out, const void *p_data_in);
int dump_gpe_scheduler_delete(char *p_out, const void *p_data_in);
int dump_gpe_scheduler_get(char *p_out, const void *p_data_in);
int dump_gpe_scheduler_cfg_set(char *p_out, const void *p_data_in);
int dump_gpe_scheduler_cfg_get(char *p_out, const void *p_data_in);
int dump_gpe_scheduler_status_get(char *p_out, const void *p_data_in);
int dump_gpe_token_bucket_shaper_create(char *p_out, const void *p_data_in);
int dump_gpe_token_bucket_shaper_delete(char *p_out, const void *p_data_in);
int dump_gpe_token_bucket_shaper_get(char *p_out, const void *p_data_in);
int dump_gpe_token_bucket_shaper_cfg_set(char *p_out, const void *p_data_in);
int dump_gpe_token_bucket_shaper_cfg_get(char *p_out, const void *p_data_in);
int dump_gpe_token_bucket_shaper_status_get(char *p_out, const void *p_data_in);
int dump_gpe_meter_create(char *p_out, const void *p_data_in);
int dump_gpe_meter_delete(char *p_out, const void *p_data_in);
int dump_gpe_meter_cfg_set(char *p_out, const void *p_data_in);
int dump_gpe_meter_cfg_get(char *p_out, const void *p_data_in);
int dump_gpe_meter_status_get(char *p_out, const void *p_data_in);
int dump_gpe_shared_buffer_cfg_set(char *p_out, const void *p_data_in);
int dump_gpe_shared_buffer_cfg_get(char *p_out, const void *p_data_in);
int dump_gpe_bridge_counter_get(char *p_out, const void *p_data_in);
int dump_gpe_bridge_port_counter_get(char *p_out, const void *p_data_in);
int dump_gpe_bridge_counter_threshold_set(char *p_out, const void *p_data_in);
int dump_gpe_bridge_port_counter_threshold_set(char *p_out, const void *p_data_in);
int dump_gpe_bridge_counter_threshold_get(char *p_out, const void *p_data_in);
int dump_gpe_bridge_port_counter_threshold_get(char *p_out, const void *p_data_in);
int dump_gpe_bridge_tca_get(char *p_out, const void *p_data_in);
int dump_gpe_bridge_port_tca_get(char *p_out, const void *p_data_in);
int dump_gpe_bridge_counter_reset(char *p_out, const void *p_data_in);
int dump_gpe_bridge_port_counter_reset(char *p_out, const void *p_data_in);
int dump_gpe_parser_cfg_set(char *p_out, const void *p_data_in);
int dump_gpe_parser_cfg_get(char *p_out, const void *p_data_in);
int dump_gpe_ethertype_filter_cfg_set(char *p_out, const void *p_data_in);
int dump_gpe_ethertype_filter_cfg_get(char *p_out, const void *p_data_in);
int dump_gpe_omci_send(char *p_out, const void *p_data_in);
int dump_gpe_tod_init(char *p_out, const void *p_data_in);
int dump_gpe_tod_sync_set(char *p_out, const void *p_data_in);
int dump_gpe_tod_get(char *p_out, const void *p_data_in);
int dump_gpe_tod_sync_get(char *p_out, const void *p_data_in);
int dump_gpe_iqm_global_cfg_set(char *p_out, const void *p_data_in);
int dump_gpe_iqm_global_cfg_get(char *p_out, const void *p_data_in);
int dump_gpe_iqm_global_status_get(char *p_out, const void *p_data_in);
int dump_gpe_tmu_global_cfg_get(char *p_out, const void *p_data_in);
int dump_gpe_tmu_global_status_get(char *p_out, const void *p_data_in);
int dump_gpe_tmu_counter_get(char *p_out, const void *p_data_in);
int dump_gpe_tmu_counter_reset(char *p_out, const void *p_data_in);
int dump_gpe_sce_counter_get(char *p_out, const void *p_data_in);
int dump_gpe_sce_counter_reset(char *p_out, const void *p_data_in);
int dump_gpe_gem_counter_get(char *p_out, const void *p_data_in);
int dump_gpe_gem_counter_threshold_set(char *p_out, const void *p_data_in);
int dump_gpe_gem_counter_threshold_get(char *p_out, const void *p_data_in);
int dump_gpe_gem_tca_get(char *p_out, const void *p_data_in);
int dump_gpe_gem_counter_reset(char *p_out, const void *p_data_in);
int dump_sce_break_set(char *p_out, const void *p_data_in);
int dump_sce_break_autocheck_enable(char *p_out, const void *p_data_in);
int dump_sce_break_get(char *p_out, const void *p_data_in);
int dump_sce_break_remove(char *p_out, const void *p_data_in);
int dump_sce_break(char *p_out, const void *p_data_in);
int dump_sce_single_step(char *p_out, const void *p_data_in);
int dump_sce_run(char *p_out, const void *p_data_in);
int dump_sce_restart_vm(char *p_out, const void *p_data_in);
int dump_sce_run_mask(char *p_out, const void *p_data_in);
int dump_sce_break_mask(char *p_out, const void *p_data_in);
int dump_sce_status_get(char *p_out, const void *p_data_in);
int dump_sce_reg_set(char *p_out, const void *p_data_in);
int dump_sce_reg_get(char *p_out, const void *p_data_in);
int dump_sce_mem_set(char *p_out, const void *p_data_in);
int dump_sce_mem_get(char *p_out, const void *p_data_in);
int dump_gpe_sce_download(char *p_out, const void *p_data_in);
int dump_gpe_sce_version_get(char *p_out, const void *p_data_in);
int dump_gpe_flat_egress_path_create(char *p_out, const void *p_data_in);
int dump_gpe_fsqm_check(char *p_out, const void *p_data_in);
int dump_gpe_cop_download(char *p_out, const void *p_data_in);
int dump_gpe_lan_exception_cfg_set(char *p_out, const void *p_data_in);
int dump_gpe_lan_exception_cfg_get(char *p_out, const void *p_data_in);
int dump_gpe_ani_exception_cfg_set(char *p_out, const void *p_data_in);
int dump_gpe_ani_exception_cfg_get(char *p_out, const void *p_data_in);
int dump_gpe_exception_queue_cfg_set(char *p_out, const void *p_data_in);
int dump_gpe_exception_queue_cfg_get(char *p_out, const void *p_data_in);
int dump_gpe_capability_get(char *p_out, const void *p_data_in);
int dump_gpe_exception_profile_cfg_set(char *p_out, const void *p_data_in);
int dump_gpe_exception_profile_cfg_get(char *p_out, const void *p_data_in);
int dump_gpe_egress_port_enable(char *p_out, const void *p_data_in);
int dump_gpe_egress_port_disable(char *p_out, const void *p_data_in);
int dump_gpe_short_fwd_mac_mc_port_add(char *p_out, const void *p_data_in);
int dump_gpe_short_fwd_mac_mc_port_delete(char *p_out, const void *p_data_in);
int dump_gpe_short_fwd_mac_mc_port_modify(char *p_out, const void *p_data_in);
int dump_gpe_short_fwd_ipv4_mc_port_add(char *p_out, const void *p_data_in);
int dump_gpe_short_fwd_ipv4_mc_port_delete(char *p_out, const void *p_data_in);
int dump_gpe_short_fwd_ipv4_mc_port_modify(char *p_out, const void *p_data_in);
int dump_gpe_aging_time_set(char *p_out, const void *p_data_in);
int dump_gpe_aging_time_get(char *p_out, const void *p_data_in);
int dump_gpe_aging_time_set_debug(char *p_out, const void *p_data_in);
int dump_gpe_sce_constants_get(char *p_out, const void *p_data_in);
int dump_gpe_sce_constants_set(char *p_out, const void *p_data_in);
int dump_gpe_sce_mac_get(char *p_out, const void *p_data_in);
int dump_gpe_sce_mac_set(char *p_out, const void *p_data_in);
int dump_gpe_vlan_fid_add(char *p_out, const void *p_data_in);
int dump_gpe_vlan_fid_get(char *p_out, const void *p_data_in);
int dump_gpe_vlan_fid_delete(char *p_out, const void *p_data_in);
int dump_gpe_bridge_port_cfg_get(char *p_out, const void *p_data_in);
int dump_gpe_cop_debug_set(char *p_out, const void *p_data_in);
int dump_gpe_cop_debug_server(char *p_out, const void *p_data_in);
int dump_gpe_acl_table_entry_set(char *p_out, const void *p_data_in);
int dump_gpe_acl_table_entry_get(char *p_out, const void *p_data_in);
int dump_gpe_acl_table_entry_delete(char *p_out, const void *p_data_in);
int dump_lan_gphy_firmware_download(char *p_out, const void *p_data_in);
int dump_lan_init(char *p_out, const void *p_data_in);
int dump_lan_cfg_set(char *p_out, const void *p_data_in);
int dump_lan_cfg_get(char *p_out, const void *p_data_in);
int dump_lan_port_cfg_set(char *p_out, const void *p_data_in);
int dump_lan_port_cfg_get(char *p_out, const void *p_data_in);
int dump_lan_port_enable(char *p_out, const void *p_data_in);
int dump_lan_port_disable(char *p_out, const void *p_data_in);
int dump_lan_loop_cfg_set(char *p_out, const void *p_data_in);
int dump_lan_loop_cfg_get(char *p_out, const void *p_data_in);
int dump_lan_port_status_get(char *p_out, const void *p_data_in);
int dump_lan_counter_get(char *p_out, const void *p_data_in);
int dump_lan_counter_reset(char *p_out, const void *p_data_in);
int dump_lan_counter_threshold_set(char *p_out, const void *p_data_in);
int dump_lan_counter_threshold_get(char *p_out, const void *p_data_in);
int dump_lan_tca_get(char *p_out, const void *p_data_in);
int dump_wol_cfg_set(char *p_out, const void *p_data_in);
int dump_wol_cfg_get(char *p_out, const void *p_data_in);
int dump_wol_status_get(char *p_out, const void *p_data_in);
int dump_mdio_data_read(char *p_out, const void *p_data_in);
int dump_mdio_data_write(char *p_out, const void *p_data_in);
int dump_mdio_enable(char *p_out, const void *p_data_in);
int dump_mdio_disable(char *p_out, const void *p_data_in);
int dump_mmd_data_read(char *p_out, const void *p_data_in);
int dump_mmd_data_write(char *p_out, const void *p_data_in);
int dump_lan_port_capability_cfg_set(char *p_out, const void *p_data_in);
int dump_lan_port_capability_cfg_get(char *p_out, const void *p_data_in);
int dump_ploam_init(char *p_out, const void *p_data_in);
int dump_ploam_state_get(char *p_out, const void *p_data_in);
int dump_ploam_state_set(char *p_out, const void *p_data_in);
int dump_onu_event_enable_set(char *p_out, const void *p_data_in);
int dump_onu_event_enable_get(char *p_out, const void *p_data_in);
int dump_onu_debug_level_set(char *p_out, const void *p_data_in);
int dump_onu_debug_level_get(char *p_out, const void *p_data_in);
int dump_onu_version_get(char *p_out, const void *p_data_in);
int dump_onu_register_set(char *p_out, const void *p_data_in);
int dump_onu_register_get(char *p_out, const void *p_data_in);
int dump_onu_test_mode_set(char *p_out, const void *p_data_in);
int dump_onu_line_enable_set(char *p_out, const void *p_data_in);
int dump_onu_line_enable_get(char *p_out, const void *p_data_in);
int dump_onu_sync_time_set(char *p_out, const void *p_data_in);
int dump_onu_sync_time_get(char *p_out, const void *p_data_in);
int dump_onu_counters_cfg_set(char *p_out, const void *p_data_in);
int dump_onu_counters_cfg_get(char *p_out, const void *p_data_in);
int dump_onu_counters_reset(char *p_out, const void *p_data_in);
/*! @} */
#endif

304
src/drv_onu_cli_dump_misc.c Normal file
View File

@ -0,0 +1,304 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#include "drv_onu_std_defs.h"
#include "drv_onu_api.h"
#ifdef INCLUDE_CLI_DUMP_SUPPORT
/** \addtogroup ONU_CLI_DUMP_COMMANDS
@{
*/
int dump_NULL(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_onu_reset(char *p_out, const void *p_data_in)
{
(void)p_data_in;
return sprintf(p_out, "onu_reset" ONU_CRLF);
}
static int dump_gpe_table_entry(char *p_out, const void *p_data_in,
const char *cmd)
{
int cnt;
uint32_t i, *data;
struct gpe_table *param;
param = (struct gpe_table *)p_data_in;
data = (uint32_t*)&param->data;
cnt = sprintf( p_out, "%s %u %u %u ",
cmd, param->id, param->index,
(unsigned int)sizeof(union gpe_table_data)/4);
/** all tables are 32-bit aligned*/
for (i = 0; i < sizeof(union gpe_table_data)/4; i++)
cnt += sprintf(p_out + cnt, "0x%08x ", data[i]);
cnt += sprintf(p_out + cnt, "%s", ONU_CRLF);
return cnt;
}
int dump_gpe_table_reinit(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_gpe_table_entry_set(char *p_out, const void *p_data_in)
{
return dump_gpe_table_entry(p_out, p_data_in,"gpe_table_set");
}
int dump_gpe_table_entry_get(char *p_out, const void *p_data_in)
{
return dump_gpe_table_entry(p_out, p_data_in,"gpe_table_get");
}
int dump_gpe_table_entry_add(char *p_out, const void *p_data_in)
{
return dump_gpe_table_entry(p_out, p_data_in,
"gpe_table_add");
}
int dump_gpe_table_entry_delete(char *p_out, const void *p_data_in)
{
return dump_gpe_table_entry(p_out, p_data_in,
"gpe_table_delete");
}
int dump_gpe_table_entry_search(char *p_out, const void *p_data_in)
{
return dump_gpe_table_entry(p_out, p_data_in,
"gpe_table_entry_search");
}
int dump_gpe_table_entry_read(char *p_out, const void *p_data_in)
{
struct gpe_table *param;
const char *cmd = "gpe_table_read";
param = (struct gpe_table *)p_data_in;
return sprintf( p_out, "%s %u %u" ONU_CRLF,
cmd, param->id, param->index);
}
int dump_gpe_table_entry_write(char *p_out, const void *p_data_in)
{
return dump_gpe_table_entry(p_out, p_data_in,
"gpe_table_write");
}
int dump_gpe_bridge_port_cfg_set(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_gpe_ext_vlan_get(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_gpe_ext_vlan_set(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_gpe_ext_vlan_do(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_gpe_fid_add(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_gpe_fid_delete(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_gpe_long_fwd_forward(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_gpe_long_fwd_add(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_gpe_long_fwd_delete(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_gpe_tagging_filter_get(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_gpe_tagging_filter_set(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_gpe_tagging_filter_do(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_gpe_cop_table0_read(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_gpe_short_fwd_add(char *p_out, const void *p_data_in)
{
return dump_gpe_table_entry(p_out, p_data_in,
"gpe_short_fwd_add");
}
int dump_gpe_short_fwd_delete(char *p_out, const void *p_data_in)
{
return dump_gpe_table_entry(p_out, p_data_in,
"gpe_short_fwd_delete");
}
int dump_gpe_short_fwd_relearn(char *p_out, const void *p_data_in)
{
return dump_gpe_table_entry(p_out, p_data_in,
"gpe_short_fwd_relearn");
}
int dump_gpe_short_fwd_forward(char *p_out, const void *p_data_in)
{
return dump_gpe_table_entry(p_out, p_data_in,
"gpe_short_fwd_forward");
}
int dump_gpe_age_get(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_gpe_age(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;;
}
int dump_gpe_ext_vlan_custom_set(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_gpe_ext_vlan_custom_get(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_ploam_ds_insert(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_ploam_ds_extract(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_ploam_us_insert(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_ploam_us_extract(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_gpe_activity_get(char *p_out, const void *p_data_in)
{
(void)p_out;
(void)p_data_in;
return 0;
}
int dump_gpe_iqueue_write_debug(char *p_out, const void *p_data_in)
{
(void)p_data_in;
return sprintf(p_out, "dump_ssb_iqueue_write" ONU_CRLF);
}
int dump_gpe_tr181_counter_get(char *p_out, const void *p_data_in)
{
(void)p_data_in;
return sprintf(p_out, "gpe_tr181_counter_get" ONU_CRLF);
}
/*! @} */
#endif

View File

@ -0,0 +1,58 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file "LICENSE" in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_cli_dump_misc_h
#define _drv_onu_cli_dump_misc_h
/** \addtogroup ONU_CLI_DUMP_COMMANDS
@{
*/
int dump_NULL(char *p_out, const void *p_data_in);
int dump_onu_reset(char *p_out, const void *p_data_in);
int dump_gpe_table_reinit(char *p_out, const void *p_data_in);
int dump_gpe_table_entry_set(char *p_out, const void *p_data_in);
int dump_gpe_table_entry_get(char *p_out, const void *p_data_in);
int dump_gpe_table_entry_add(char *p_out, const void *p_data_in);
int dump_gpe_table_entry_delete(char *p_out, const void *p_data_in);
int dump_gpe_table_entry_search(char *p_out, const void *p_data_in);
int dump_gpe_table_entry_read(char *p_out, const void *p_data_in);
int dump_gpe_table_entry_write(char *p_out, const void *p_data_in);
int dump_gpe_bridge_port_cfg_set(char *p_out, const void *p_data_in);
int dump_gpe_ext_vlan_get(char *p_out, const void *p_data_in);
int dump_gpe_ext_vlan_set(char *p_out, const void *p_data_in);
int dump_gpe_ext_vlan_do(char *p_out, const void *p_data_in);
int dump_gpe_fid_add(char *p_out, const void *p_data_in);
int dump_gpe_fid_delete(char *p_out, const void *p_data_in);
int dump_gpe_long_fwd_add(char *p_out, const void *p_data_in);
int dump_gpe_long_fwd_delete(char *p_out, const void *p_data_in);
int dump_gpe_long_fwd_forward(char *p_out, const void *p_data_in);
int dump_gpe_tagging_filter_get(char *p_out, const void *p_data_in);
int dump_gpe_tagging_filter_set(char *p_out, const void *p_data_in);
int dump_gpe_tagging_filter_do(char *p_out, const void *p_data_in);
int dump_gpe_cop_table0_read(char *p_out, const void *p_data_in);
int dump_gpe_short_fwd_add(char *p_out, const void *p_data_in);
int dump_gpe_short_fwd_delete(char *p_out, const void *p_data_in);
int dump_gpe_short_fwd_relearn(char *p_out, const void *p_data_in);
int dump_gpe_short_fwd_forward(char *p_out, const void *p_data_in);
int dump_gpe_ext_vlan_custom_set(char *p_out, const void *p_data_in);
int dump_gpe_ext_vlan_custom_get(char *p_out, const void *p_data_in);
int dump_ploam_ds_insert(char *p_out, const void *p_data_in);
int dump_ploam_ds_extract(char *p_out, const void *p_data_in);
int dump_ploam_us_insert(char *p_out, const void *p_data_in);
int dump_ploam_us_extract(char *p_out, const void *p_data_in);
int dump_gpe_age_get(char *p_out, const void *p_data_in);
int dump_gpe_age(char *p_out, const void *p_data_in);
int dump_gpe_activity_get(char *p_out, const void *p_data_in);
int dump_gpe_iqueue_write_debug(char *p_out, const void *p_data_in);
int dump_gpe_tr181_counter_get(char *p_out, const void *p_data_in);
/*! @} */
#endif

1405
src/drv_onu_cli_misc.c Normal file

File diff suppressed because it is too large Load Diff

1347
src/drv_onu_common.c Normal file

File diff suppressed because it is too large Load Diff

125
src/drv_onu_config.h.in Normal file
View File

@ -0,0 +1,125 @@
/* src/drv_onu_config.h.in. Generated from configure.in by autoheader. */
/******************************************************************************
Copyright (c) 2012
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _GPON_ONU_CONFIG_H
#define _GPON_ONU_CONFIG_H
/* compile for linux kernel */
#undef ENABLE_LINUX
/* enable event logger debugging */
#undef EVENT_LOGGER_DEBUG
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if the system has the type `ulong_t'. */
#undef HAVE_ULONG_T
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Command Line Interface Dump */
#undef INCLUDE_CLI_DUMP_SUPPORT
/* Command Line Interface */
#undef INCLUDE_CLI_SUPPORT
/* COP debug */
#undef INCLUDE_COP_DEBUG
/* Debug Support */
#undef INCLUDE_DEBUG_SUPPORT
/* proc filesystem */
#undef INCLUDE_PROCFS_SUPPORT
/* Enable remote-only ONU */
#undef INCLUDE_REMOTE_ONLY_ONU
/* Enable remote ONU */
#undef INCLUDE_REMOTE_ONU
/* SCE debug */
#undef INCLUDE_SCE_DEBUG
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Export debug symbols */
#undef ONU_DBG_EXPORTS
/* Selected device type */
#undef ONU_DEVICE_PSB980xx
/* ONU library */
#undef ONU_LIBRARY
/* Maximum number of supported LAN ports */
#undef ONU_MAX_ETH_UNI
/* Enable XML and JSON SCE tables wrappers */
#undef ONU_SCE_TABLES_WRAPPERS
/* ONU simulation */
#undef ONU_SIMULATION
/* TOD output on ASC1 */
#undef ONU_TOD_ASC1
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
#endif /* _GPON_ONU_CONFIG_H */

130
src/drv_onu_debug.h Normal file
View File

@ -0,0 +1,130 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_debug_h
#define _drv_onu_debug_h
/** \addtogroup ONU_MAPI_REFERENCE_INTERNAL
@{
*/
/** \defgroup ONU_DEBUG_INTERNAL Debug Interface
This chapter describes the internal debug interface.
@{
*/
#ifdef EVENT_LOGGER_DEBUG
#define IFXOS_LIBRARY_USED
#include <el_log_macros.h>
#endif /* EVENT_LOGGER_DEBUG */
#if defined(WIN32)
# define ONU_CRLF "\r\n"
#else
# define ONU_CRLF "\n"
#endif
#undef IFXOS_CRLF
#define IFXOS_CRLF ONU_CRLF
#if defined(_DEBUG)
/** enable debug printouts */
# define INCLUDE_DEBUG_SUPPORT
#endif
/** ONU Debug Levels */
enum onu_debug_level {
/** Message */
ONU_DBG_MSG,
/** Warning */
ONU_DBG_WRN,
/** Error */
ONU_DBG_ERR,
/** Off */
ONU_DBG_OFF
};
/** Debug message prefix */
# define DEBUG_PREFIX "[onu]"
#ifdef INCLUDE_DEBUG_SUPPORT
extern enum onu_debug_level onu_debug_lvl;
# if defined(__GNUC__)
int onu_debug_print(const enum onu_debug_level level, const char *format, ...);
# else
# ifndef SWIG
int onu_debug_print_err(const char *format, ...);
int onu_debug_print_wrn(const char *format, ...);
int onu_debug_print_msg(const char *format, ...);
# endif
# endif
# define DEBUG_ENABLE_ERR
# define DEBUG_ENABLE_WRN
# define DEBUG_ENABLE_MSG
# ifdef __GNUC__
# define ONU_DEBUG_ERR(fmt, args...) \
onu_debug_print(ONU_DBG_ERR, fmt, ##args)
# define ONU_DEBUG_WRN(fmt, args...) \
onu_debug_print(ONU_DBG_WRN, fmt, ##args)
# define ONU_DEBUG_MSG(fmt, args...) \
onu_debug_print(ONU_DBG_MSG, fmt, ##args)
# else /* __GNUC__ */
# ifdef DEBUG_ENABLE_ERR
# define ONU_DEBUG_ERR onu_debug_print_err
# endif /* DEBUG_ENABLE_ERR */
# ifdef DEBUG_ENABLE_WRN
# define ONU_DEBUG_WRN onu_debug_print_wrn
# endif /* DEBUG_ENABLE_WRN */
# ifdef DEBUG_ENABLE_MSG
# define ONU_DEBUG_MSG onu_debug_print_msg
# endif /* DEBUG_ENABLE_MSG */
# endif /* __GNUC__ */
#endif /* INCLUDE_DEBUG_SUPPORT */
#ifndef STATIC
#if 1
#define STATIC static
#else
#define STATIC /**/
#endif
#endif
#ifndef ONU_DEBUG_ERR
# if defined(__GNUC__)
# define ONU_DEBUG_ERR(fmt, args...) while(0){}
# else
# define ONU_DEBUG_ERR {}
# endif
#endif
#ifndef ONU_DEBUG_WRN
# if defined(__GNUC__)
# define ONU_DEBUG_WRN(fmt, args...) while(0){}
# else
# define ONU_DEBUG_WRN {}
# endif
#endif
#ifndef ONU_DEBUG_MSG
# if defined(__GNUC__)
# define ONU_DEBUG_MSG(fmt, args...) while(0){}
# else
# define ONU_DEBUG_MSG {}
# endif
#endif
/*! @} */
/*! @} */
#endif

697
src/drv_onu_devio.c Normal file
View File

@ -0,0 +1,697 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
/** \addtogroup ONU_MAPI_REFERENCE_INTERNAL
@{
*/
/** \defgroup ONU_SIMULATION_INTERNAL Simulation Specific Implementation
This chapter describes the internal interface of the ONU simulation.
@{
*/
#ifdef HAVE_CONFIG_H
#include "drv_onu_config.h"
#endif
#ifdef ONU_SIMULATION
#include <stdlib.h>
#include "drv_onu_api.h"
#include "ifxos_device_io.h"
#include "ifxos_memory_alloc.h"
#include "ifxos_time.h"
#include "drv_onu_cli_core.h"
#include "drv_onu_gtc_api.h"
#include "drv_onu_gpe_api.h"
#include "drv_onu_gpe_tables_api.h"
#include "drv_onu_lan_api.h"
#include "drv_onu_ploam_api.h"
#include "drv_onu_event_interface.h"
#include "drv_onu_event_api.h"
#include "drv_onu_timer.h"
#include "drv_onu_register.h"
/** common callbacks used by ioctl() */
extern const struct onu_entry common_function_table[];
extern const unsigned int common_function_table_size;
extern const struct onu_entry ploam_function_table[];
extern const unsigned int ploam_function_table_size;
#define IFXOS_BlockAlloc IFXOS_MemAlloc
#define IFXOS_BlockFree IFXOS_MemFree
long onu_open(void *device, const char *appendix);
int onu_release(void *pprivate);
int onu_write(void *pprivate, const char *src, const int length);
int onu_read(void *pprivate, char *dest, const int length);
int onu_ioctl(void *pprivate, unsigned int cmd, ulong_t argument);
int onu_poll(void *pprivate);
void onu_irq_handler(void *dev_id);
STATIC unsigned int major_number;
onu_lock_t mailbox_lock;
onu_lock_t cop_lock;
onu_lock_t ictrlc_lock;
onu_lock_t octrlc_lock;
onu_lock_t link_lock;
onu_lock_t sce_lock;
onu_lock_t meter_lock;
onu_lock_t tmu_lock;
onu_lock_t enqueue_lock;
#ifdef INCLUDE_DEBUG_SUPPORT
enum onu_debug_level onu_debug_lvl = ONU_DBG_OFF;
#endif
struct onu_reg_gtc g_gtc;
struct onu_reg_gtc *gtc = &g_gtc;
struct onu_reg_gpearb g_gpearb;
struct onu_reg_gpearb *gpearb = &g_gpearb;
union onu_reg_eim g_eim;
union onu_reg_eim *eim = &g_eim;
struct onu_reg_sxgmii g_sxgmii;
struct onu_reg_sxgmii *sxgmii = &g_sxgmii;
struct onu_reg_iqm g_iqm;
struct onu_reg_iqm *iqm = &g_iqm;
struct onu_reg_fsqm g_fsqm;
struct onu_reg_fsqm *fsqm = &g_fsqm;
struct onu_reg_ictrlc g_ictrlc;
struct onu_reg_ictrlc *ictrlc = &g_ictrlc;
struct onu_reg_octrlc g_octrlc;
struct onu_reg_octrlc *octrlc = &g_octrlc;
struct onu_reg_ictrll g_ictrll;
struct onu_reg_ictrll *ictrll = &g_ictrll;
struct onu_reg_ictrlg g_ictrlg;
struct onu_reg_ictrlg *ictrlg = &g_ictrlg;
struct onu_reg_octrll g_octrll;
struct onu_reg_octrll *octrll = &g_octrll;
struct onu_reg_octrlg g_octrlg;
struct onu_reg_octrlg *octrlg = &g_octrlg;
struct onu_reg_sys_eth g_sys_eth;
struct onu_reg_sys_eth *sys_eth = &g_sys_eth;
struct onu_reg_sys_gpe g_sys_gpe;
struct onu_reg_sys_gpe *sys_gpe = &g_sys_gpe;
struct onu_reg_tmu g_tmu;
struct onu_reg_tmu *tmu = &g_tmu;
struct onu_reg_tbm g_tbm;
struct onu_reg_tbm *tbm = &g_tbm;
struct onu_reg_sbs0ctrl g_sbs0ctrl;
struct onu_reg_sbs0ctrl *sbs0ctrl = &g_sbs0ctrl;
struct onu_reg_merge g_merge;
struct onu_reg_merge *merge = &g_merge;
struct onu_reg_disp g_disp;
struct onu_reg_disp *disp = &g_disp;
struct onu_reg_pe g_pe;
struct onu_reg_pe *pe = &g_pe;
struct onu_reg_pctrl g_pctrl;
struct onu_reg_pctrl *pctrl = &g_pctrl;
struct onu_reg_link g_link;
struct onu_reg_link *link = &g_link;
struct onu_reg_tod g_tod;
struct onu_reg_tod *tod = &g_tod;
struct onu_reg_status g_status;
struct onu_reg_status *status;
/** ONU related data */
struct ploam_context ploam_ctx;
/**
Open the device.
At the first time:
- allocating internal memory for each new device
- initialize the device
\return
- 0 - if error,
- device context - if success
*/
long onu_open(void *ctrl, const char *appendix)
{
struct onu_device *p_dev =
(struct onu_device *)IFXOS_MemAlloc(sizeof(struct onu_device));
(void)appendix;
if (onu_device_open((struct onu_control *)ctrl, p_dev) !=
ONU_STATUS_OK) {
ONU_DEBUG_ERR("Init failed");
goto open_error;
}
return (long)p_dev;
open_error:
onu_device_close(p_dev);
return 0;
}
/**
Release the device.
\param inode pointer to the inode
\param filp pointer to the file descriptor
\return
- 0 - on success
- otherwise error code
*/
int onu_release(void *pprivate)
{
struct onu_device *p_dev = (struct onu_device *)pprivate;
if (p_dev == NULL)
return -1;
if (onu_device_list_delete(p_dev->ctrl, p_dev) == ONU_STATUS_ERR)
return -1;
onu_device_close(p_dev);
return 0;
}
/**
Writes data to the device.
\param filp pointer to the file descriptor
\param buf source buffer
\param count data length
\param ppos unused
\return
length or a negative error code
*/
int onu_write(void *pprivate, const char *src, const int length)
{
int total = 0;
struct onu_device *p_dev = (struct onu_device *)pprivate;
(void)p_dev;
(void)src;
(void)length;
return total;
}
/**
Reads data from the device.
\param filp pointer to the file descriptor
\param buf destination buffer
\param count max size of data to read
\param ppos unused
\return
len - data length
*/
int onu_read(void *pprivate, char *dest, const int length)
{
int len = 0;
struct onu_device *p_dev = (struct onu_device *)pprivate;
(void)p_dev;
(void)dest;
(void)length;
return len;
}
/**
The select function of the driver.
A user space program may sleep until the driver it wakes up.
\param
filp - pointer to the file descriptor
\param
wait - wait table
\return
- POLLIN - data available
- 0 - no data
- POLLERR - device pointer is zero
*/
int onu_poll(void *pprivate)
{
struct onu_device *p_dev = (struct onu_device *)pprivate;
if (IFX_Var_Fifo_isEmpty(&p_dev->nfc_fifo.data) == 0)
/* data available */
return 1;
else
p_dev->nfc_need_wake_up = true;
return 0;
}
static void cp(struct onu_device *p_dev, const struct onu_entry *table,
struct fio_exchange *exchange, uint32_t nr, uint8_t *buf)
{
if (_IOC_DIR(table[nr].id) & _IOC_WRITE)
memcpy(buf, exchange->p_data, table[nr].size_in);
if (table[nr].p_entry0)
exchange->error = table[nr].p_entry0(p_dev);
else if (table[nr].p_entry1)
exchange->error = table[nr].p_entry1(p_dev, p_dev->io_buf);
else if (table[nr].p_entry2)
exchange->error =
table[nr].p_entry2(p_dev, p_dev->io_buf, p_dev->io_buf);
if (_IOC_DIR(table[nr].id) & _IOC_READ) {
memcpy(exchange->p_data, buf, table[nr].size_out);
exchange->length = table[nr].size_out;
} else {
exchange->length = 0;
}
}
/**
Configuration and control interface of the device.
\param inode pointer to the inode
\param filp pointer to the file descriptor
\param cmd function id's
\param arg optional argument
\return
- 0 and positive values - success,
- negative value - ioctl failed
*/
int onu_ioctl(void *pprivate, unsigned int cmd, ulong_t arg)
{
int32_t ret = -1, i;
struct onu_device *p_dev = (struct onu_device *)pprivate;
uint8_t *buf;
struct fio_exchange *exchange = (struct fio_exchange *) arg;
uint32_t type = _IOC_TYPE(cmd);
uint32_t nr = _IOC_NR(cmd);
#ifndef ONU_SIMULATION
uint32_t size = _IOC_SIZE(cmd);
#endif
uint32_t dir = _IOC_DIR(cmd);
(void)dir;
buf = &p_dev->io_buf[0];
#ifndef ONU_SIMULATION
if (size >= ONU_IO_BUF_SIZE)
return ret;
#endif
if ((type == ONU_MAGIC) && (nr < common_function_table_size)
&& (nr == _IOC_NR(common_function_table[nr].id))) {
cp(p_dev, common_function_table, exchange, nr, buf);
} else if ((type == PLOAM_MAGIC) && (nr < ploam_function_table_size)
&& (nr == _IOC_NR(ploam_function_table[nr].id))) {
cp(p_dev, ploam_function_table, exchange, nr, buf);
} else if ((type == GTC_MAGIC) && (nr < gtc_func_tbl_size)
&& (nr == _IOC_NR(gtc_func_tbl[nr].id))) {
cp(p_dev, gtc_func_tbl, exchange, nr, buf);
} else if ((type == GPE_MAGIC) && (nr < gpe_function_table_size)
&& (nr == _IOC_NR(gpe_function_table[nr].id))) {
cp(p_dev, gpe_function_table, exchange, nr, buf);
} else if ((type == GPE_TABLE_MAGIC) && (nr < gpe_table_function_table_size)
&& (nr == _IOC_NR(gpe_table_function_table[nr].id))) {
cp(p_dev, gpe_table_function_table, exchange, nr, buf);
} else if ((type == LAN_MAGIC) && (nr < lan_function_table_size)
&& (nr == _IOC_NR(lan_function_table[nr].id))) {
cp(p_dev, lan_function_table, exchange, nr, buf);
#ifdef INCLUDE_CLI_SUPPORT
} else if ((type == _IOC_TYPE(FIO_ONU_CLI))
&& (nr == _IOC_NR(FIO_ONU_CLI))) {
if (exchange->length < (ONU_IO_BUF_SIZE - 1)) {
memcpy(buf, exchange->p_data, exchange->length + 1);
i = onu_cli(p_dev, (char *)buf);
if (i >= 0 && i < (ONU_IO_BUF_SIZE - 1)) {
memcpy(exchange->p_data, buf, i + 1);
exchange->length = i + 1;
exchange->error = 0;
} else {
exchange->length = 0;
exchange->error = -1;
}
}
#endif
} else if ((type == _IOC_TYPE(FIO_ONU_EVENT_FIFO))
&& (nr == _IOC_NR(FIO_ONU_EVENT_FIFO))) {
uint32_t len = 0;
struct onu_fifo_header *p_data =
(struct onu_fifo_header *) IFX_Var_Fifo_peekElement(
&p_dev->nfc_fifo.data, &len);
if (p_data) {
memcpy(exchange->p_data, p_data, len);
exchange->length = len;
if (p_dev->nfc_fifo.overflow) {
exchange->error = 1;
} else {
exchange->error = 0;
}
onu_fifo_read(&p_dev->nfc_fifo, IFX_NULL, &len);
} else {
exchange->length = 0;
exchange->error = -1;
}
} else if ((type == _IOC_TYPE(FIO_ONU_EVENT_ENABLE_SET))
&& (nr == _IOC_NR(FIO_ONU_EVENT_ENABLE_SET))) {
onu_event_enable_set(p_dev,
(struct onu_event_mask *)
exchange->p_data);
} else if ((type == _IOC_TYPE(FIO_ONU_EVENT_ENABLE_GET))
&& (nr == _IOC_NR(FIO_ONU_EVENT_ENABLE_GET))) {
onu_event_enable_get(p_dev,
(struct onu_event_mask *)
exchange->p_data);
} else {
return ret;
}
return 0;
}
/**
Start ONU timer
\param timer_no Timer Index
\param timeout Timeout in mseconds.
*/
void onu_timer_start(const uint32_t timer_no, uint32_t timeout)
{
(void)timer_no;
(void)timeout;
}
/**
Stop Timer
\param timer_no Timer Index
*/
void onu_timer_stop(const uint32_t timer_no)
{
(void)timer_no;
}
/**
Retrieve pseudo random number within a specified range
\param range_min lowest value
\param range_max highest value
*/
uint32_t onu_random_get(const uint32_t range_min, const uint32_t range_max)
{
return (uint32_t)(((double)rand() / (double)RAND_MAX) * range_max +
range_min);
}
void onu_led_set(const uint32_t idx, const uint32_t state)
{
(void)idx;
(void)state;
}
void onu_irq_enable(struct onu_control *ctrl, uint32_t mask)
{
(void)ctrl;
(void)mask;
}
void onu_irq_add(struct onu_control *ctrl, uint32_t mask)
{
(void)ctrl;
(void)mask;
}
void onu_irq_remove(struct onu_control *ctrl, uint32_t mask)
{
(void)ctrl;
(void)mask;
}
void onu_udelay(uint32_t u_sec)
{
(void)u_sec;
}
void onu_hot_plug_state(const enum ploam_state state,
const enum ploam_state old_state)
{
(void)state;
(void)old_state;
}
int onu_pe_fw_load(const char *name, struct onu_fw *pe_fw)
{
(void) name;
(void) pe_fw;
return 0;
}
void onu_fw_release(struct onu_fw *pe_fw)
{
(void) pe_fw;
}
int onu_pe_fw_info_load(const struct onu_fw *pe_fw, struct pe_fw_info *info)
{
(void) pe_fw;
(void) info;
return 0;
}
void onu_pe_fw_info_release(struct pe_fw_info *info)
{
(void) info;
}
int onu_microcode_load(struct onu_control *ctrl, const char *name)
{
(void) ctrl;
(void) name;
return 0;
}
int onu_gphy_firmware_download(struct onu_control *ctrl, const char *name)
{
(void) ctrl;
(void) name;
return 0;
}
int32_t onu_spin_lock_init(onu_lock_t * id, const char *p_name)
{
if (IFXOS_MutexInit(id) != IFX_SUCCESS) {
ONU_DEBUG_ERR("Can't initialize %s mutex.", p_name);
return -1;
}
return 0;
}
int32_t onu_spin_lock_delete(onu_lock_t *id)
{
return IFXOS_MutexDelete(id);
}
int32_t onu_spin_lock_get(onu_lock_t *id, ulong_t *flags)
{
IFXOS_MutexGet(id);
(void)flags;
return 0;
}
int32_t onu_spin_lock_release(onu_lock_t *id, ulong_t c)
{
IFXOS_MutexRelease(id);
(void)c;
return 0;
}
void onu_time_to_tm(uint32_t totalsecs, int offset, struct onu_tm *result)
{
memset(result, 0, sizeof(*result));
}
unsigned long onu_elapsed_time_sec_get(unsigned long ref)
{
return ref;
}
#ifdef INCLUDE_CLI_SUPPORT
char *onu_strsep(char **stringp, const char *delim)
{
(void)stringp;
(void)delim;
return NULL;
}
#endif
/**
Initialize the driver module.
\return
- 0 on success
- Error code
\remarks
Called by the kernel.
*/
int onu_init(void)
{
char buf[64];
uint32_t i;
#ifdef INCLUDE_DEBUG_SUPPORT
onu_debug_lvl = (enum onu_debug_level) 0;
#endif
ONU_DEBUG_MSG("%s", &onu_whatversion[4]);
major_number = DEVIO_driver_install(onu_open,
onu_release,
onu_read,
onu_write, onu_ioctl, onu_poll);
if (major_number == (unsigned)-1) {
ONU_DEBUG_ERR("can't get major %d", major_number);
return -1;
}
memset(&g_gtc, 0x00, sizeof(g_gtc));
for (i = 0; i < ONU_MAX_TIMER; i++) {
/*init_timer(&onu_timer[i]);
onu_timer[i].data = i;
onu_timer[i].function = onu_timer_exec; */
}
memset(onu_control, 0x00, sizeof(onu_control));
for (i = 0; i < MAX_ONU_INSTANCES; i++) {
sprintf(buf, "/dev/%s%d", ONU_NAME, i);
memset(&onu_control[i], 0, sizeof(struct onu_control));
if ((signed)
DEVIO_device_add(&onu_control[i], &buf[0],
major_number) == IFX_ERROR) {
ONU_DEBUG_ERR("unable to create device.");
goto ONU_INIT_ERROR;
}
if (IFXOS_MutexInit(&onu_control[i].list_lock) != IFX_SUCCESS) {
ONU_DEBUG_ERR("can't init list_lock mutex %d", i);
continue;
}
if (ploam_context_init(&onu_control[i]) != ONU_STATUS_OK) {
ONU_DEBUG_ERR("can't init PLOAM context %d", i);
continue;
}
onu_control[i].run_worker = true;
if (IFXOS_ThreadInit(&onu_control[i].worker_ctx,
"onu",
onu_worker_thread,
ONU_WORKER_THREAD_STACK_SIZE,
ONU_WORKER_THREAD_PRIO,
(ulong_t) & onu_control[i],
0) != IFX_SUCCESS) {
ONU_DEBUG_ERR("can't start worker thread %d", i);
continue;
}
onu_timer_start(i << 16 | ONU_TIMER_TO1, 10);
}
#ifdef INCLUDE_CLI_SUPPORT
onu_cli_init();
#endif
return 0;
ONU_INIT_ERROR:
onu_exit();
return -1;
}
/**
Clean up the module if unloaded.
\remarks
Called by the kernel.
*/
void onu_exit(void)
{
int i;
struct onu_device *p_dev, *pDelete;
DEVIO_driver_remove(major_number, 1);
for (i = 0; i < MAX_ONU_INSTANCES; i++)
onu_control[i].run_worker = false;
for (i = 0; i < MAX_ONU_INSTANCES; i++) {
IFXOS_ThreadDelete(&onu_control[i].worker_ctx, 2000);
if (IFXOS_MutexGet(&onu_control[i].list_lock) == IFX_SUCCESS) {
p_dev = onu_control[i].p_dev_head;
while (p_dev) {
pDelete = p_dev;
p_dev = p_dev->p_next;
onu_device_close(pDelete);
}
IFXOS_MutexRelease(&onu_control[i].list_lock);
}
IFXOS_MutexDelete(&onu_control[i].list_lock);
ploam_context_free(&onu_control[i]);
}
ONU_DEBUG_MSG("cleanup successful");
}
void event_queue_init(struct onu_control *ctrl)
{
}
int event_queue_wait(struct onu_control *ctrl)
{
if (IFX_Var_Fifo_isEmpty(&ctrl->nfc_fifo.data))
IFXOS_MSecSleep(10);
return 0;
}
void event_queue_wakeup(struct onu_control *ctrl)
{
}
uint32_t onu_gpon_link_status_get(void)
{
return 0;
}
uint32_t onu_mac_link_status_get(const uint8_t idx)
{
return 0;
}
uint32_t onu_gpon_packet_count_get(const uint8_t rx)
{
return 0;
}
uint32_t onu_mac_packet_count_get(const uint8_t idx, const uint8_t rx)
{
return 0;
}
#endif /* ONU_SIMULATION */
/*! @} */
/*! @} */

33
src/drv_onu_event_api.h Normal file
View File

@ -0,0 +1,33 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_event_api_h
#define _drv_onu_event_api_h
#include "drv_onu_event_interface.h"
/** \defgroup MAPI_REFERENCE_INTERNAL Management API Reference - Internals
@{
*/
/** \defgroup ONU_EVENT_API_INTERNAL Internal Event Interface
@{
*/
enum onu_errorcode onu_event_enable_set(struct onu_device *p_dev,
const struct onu_event_mask *param);
enum onu_errorcode onu_event_enable_get(struct onu_device *p_dev,
struct onu_event_mask *param);
/*! @} */
/*! @} */
EXTERN_C_END
#endif

6217
src/drv_onu_gpe.c Normal file

File diff suppressed because it is too large Load Diff

520
src/drv_onu_gpe_api.h Normal file
View File

@ -0,0 +1,520 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
/**
\file drv_onu_gpe_api.h
Device Driver, GPON Packer Engine
*/
#ifndef _drv_onu_gpe_api_h
#define _drv_onu_gpe_api_h
#include "drv_onu_std_defs.h"
#include "drv_onu_gpe_interface.h"
#include "drv_onu_gpe_tables.h"
#include "drv_onu_types.h"
EXTERN_C_BEGIN
/** \addtogroup ONU_MAPI_REFERENCE_INTERNAL
@{
*/
/** \defgroup ONU_GPE_INTERNAL Packet Engine - Internal
This chapter describes the software interface to access and configure the
GPON Packet Engine (GPE).
@{
*/
extern const struct onu_entry gpe_function_table[];
extern const unsigned int gpe_function_table_size;
#ifndef SWIG
/** Firmware header size in bytes */
#define PE_FW_HEADER_SIZE 16
#define PE_FW_FLAG0_OFFSET_WORD 1
#define PE_FW_FLAG1_OFFSET_WORD 2
#define PE_FW_OPT_HDR_LEN_OFFSET_WORD 3
#define PE_FW_FLAG0_OPT_HEADER_MASK 0x80000000
#endif
enum onu_errorcode gpe_init(struct onu_device *p_dev,
const struct gpe_init_data *param);
enum onu_errorcode gpe_debug_init(struct onu_device *p_dev,
const struct gpe_init_data *param);
enum onu_errorcode
gpe_low_level_modules_enable(struct onu_device *p_dev,
const struct gpe_ll_mod_sel *param);
enum onu_errorcode gpe_cfg_set(struct onu_device *p_dev,
const struct gpe_cfg *param);
enum onu_errorcode gpe_cfg_get(struct onu_device *p_dev, struct gpe_cfg *param);
enum onu_errorcode gpe_status_get(struct onu_device *p_dev,
struct gpe_status *param);
#ifndef SWIG
enum onu_errorcode gpe_arbiter_get(struct onu_device *p_dev,
struct gpe_arbiter *param);
enum onu_errorcode gpe_arbiter_set(struct onu_device *p_dev,
const struct gpe_arbiter *param);
#endif
enum onu_errorcode gpe_gem_port_add(struct onu_device *p_dev,
const struct gpe_gem_port *in,
struct gpe_gem_port *out);
enum onu_errorcode gpe_gem_port_delete(struct onu_device *p_dev,
const struct gem_port_id *param);
enum onu_errorcode gpe_gem_port_get(struct onu_device *p_dev,
const struct gem_port_id *in,
struct gpe_gem_port *out);
enum onu_errorcode gpe_gem_port_set(struct onu_device *p_dev,
const struct gpe_gem_port *in);
enum onu_errorcode gpe_tcont_create(struct onu_device *p_dev,
const struct gpe_tcont_cfg *param);
enum onu_errorcode gpe_tcont_set(struct onu_device *p_dev,
const struct gpe_tcont *param);
enum onu_errorcode gpe_tcont_get(struct onu_device *p_dev,
const struct tcont_index *in,
struct gpe_tcont *out);
enum onu_errorcode gpe_tcont_delete(struct onu_device *p_dev,
const struct tcont_index *param);
enum onu_errorcode gpe_egress_port_create(struct onu_device *p_dev,
const struct gpe_eport_create *param);
enum onu_errorcode gpe_egress_port_get(struct onu_device *p_dev,
const struct gpe_epn *in,
struct gpe_eport_create *out);
enum onu_errorcode gpe_port_index_get(struct onu_device *p_dev,
const struct gpe_egress_port *in,
struct gpe_eport_create *out);
enum onu_errorcode gpe_egress_port_delete(struct onu_device *p_dev,
const struct gpe_egress_port *param);
enum onu_errorcode
gpe_egress_port_cfg_set(struct onu_device *p_dev,
const struct gpe_egress_port_cfg *param);
enum onu_errorcode gpe_egress_port_cfg_get(struct onu_device *p_dev,
const struct gpe_epn *in,
struct gpe_egress_port_cfg *out);
enum onu_errorcode
gpe_egress_port_status_get(struct onu_device *p_dev,
const struct gpe_epn *in,
struct gpe_egress_port_status *param);
enum onu_errorcode
gpe_backpressure_cfg_set(struct onu_device *p_dev,
const struct gpe_backpressure_cfg *param);
enum onu_errorcode gpe_backpressure_cfg_get(struct onu_device *p_dev,
struct gpe_backpressure_cfg *param);
enum onu_errorcode
gpe_ingress_queue_cfg_set(struct onu_device *p_dev,
const struct gpe_iqueue_cfg *param);
enum onu_errorcode gpe_ingress_queue_cfg_get(struct onu_device *p_dev,
const struct gpe_iqueue *in,
struct gpe_iqueue_cfg *out);
enum onu_errorcode gpe_ingress_queue_status_get(struct onu_device *p_dev,
const struct gpe_iqueue *in,
struct gpe_iqueue_status *out);
enum onu_errorcode
gpe_egress_queue_create(struct onu_device *p_dev,
const struct gpe_equeue_create *param);
enum onu_errorcode gpe_egress_queue_delete(struct onu_device *p_dev,
const struct gpe_equeue *param);
enum onu_errorcode gpe_egress_queue_get(struct onu_device *p_dev,
const struct gpe_equeue *in,
struct gpe_equeue_create *out);
enum onu_errorcode
gpe_egress_queue_cfg_set(struct onu_device *p_dev,
const struct gpe_equeue_cfg *param);
enum onu_errorcode gpe_egress_queue_cfg_get(struct onu_device *p_dev,
const struct gpe_equeue *in,
struct gpe_equeue_cfg *out);
enum onu_errorcode gpe_egress_queue_status_get(struct onu_device *p_dev,
const struct gpe_equeue *in,
struct gpe_equeue_status *out);
enum onu_errorcode gpe_egress_queue_path_get(struct onu_device *p_dev,
const struct gpe_equeue *in,
struct gpe_equeue_path *out);
enum onu_errorcode gpe_scheduler_create(struct onu_device *p_dev,
const struct gpe_sched_create *param);
enum onu_errorcode gpe_scheduler_delete(struct onu_device *p_dev,
const struct gpe_scheduler_idx *param);
enum onu_errorcode gpe_scheduler_get(struct onu_device *p_dev,
const struct gpe_scheduler_idx *in,
struct gpe_sched_create *out);
enum onu_errorcode gpe_scheduler_cfg_set(struct onu_device *p_dev,
const struct gpe_scheduler_cfg *param);
enum onu_errorcode gpe_scheduler_cfg_get(struct onu_device *p_dev,
const struct gpe_scheduler_idx *in,
struct gpe_scheduler_cfg *out);
enum onu_errorcode gpe_scheduler_status_get(struct onu_device *p_dev,
const struct gpe_scheduler_idx *in,
struct gpe_scheduler_status *out);
enum onu_errorcode
gpe_token_bucket_shaper_create(struct onu_device *p_dev,
const struct gpe_token_bucket_shaper *param);
enum onu_errorcode
gpe_token_bucket_shaper_delete(struct onu_device *p_dev,
const struct gpe_token_bucket_shaper *param);
enum onu_errorcode
gpe_token_bucket_shaper_get(struct onu_device *p_dev,
const struct gpe_token_bucket_shaper_idx *in,
struct gpe_token_bucket_shaper *out);
enum onu_errorcode
gpe_token_bucket_shaper_cfg_set(struct onu_device *p_dev,
const struct gpe_token_bucket_shaper_cfg *param);
enum onu_errorcode
gpe_token_bucket_shaper_cfg_get(struct onu_device *p_dev,
const struct gpe_token_bucket_shaper_idx *in,
struct gpe_token_bucket_shaper_cfg *out);
enum onu_errorcode
gpe_token_bucket_shaper_status_get(struct onu_device *p_dev,
const struct gpe_token_bucket_shaper_idx *in,
struct gpe_token_bucket_shaper_status *out);
enum onu_errorcode gpe_meter_create(struct onu_device *p_dev,
struct gpe_meter *param);
enum onu_errorcode gpe_meter_delete(struct onu_device *p_dev,
const struct gpe_meter *param);
enum onu_errorcode gpe_meter_cfg_set(struct onu_device *p_dev,
const struct gpe_meter_cfg *param);
enum onu_errorcode gpe_meter_cfg_get(struct onu_device *p_dev,
const struct gpe_meter *in,
struct gpe_meter_cfg *out);
enum onu_errorcode gpe_meter_status_get(struct onu_device *p_dev,
const struct gpe_meter *in,
struct gpe_meter_status *out);
enum onu_errorcode
gpe_shared_buffer_cfg_set(struct onu_device *p_dev,
const struct gpe_shared_buffer_cfg *param);
enum onu_errorcode gpe_shared_buffer_cfg_get(struct onu_device *p_dev,
struct gpe_shared_buffer_cfg *out);
enum onu_errorcode
gpe_bridge_counter_get(struct onu_device *p_dev,
const struct gpe_bridge_cnt_interval *in,
struct gpe_bridge_counter *out);
enum onu_errorcode
gpe_bridge_port_counter_get(struct onu_device *p_dev,
const struct gpe_bridge_port_cnt_interval *in,
struct gpe_bridge_port_counter *out);
enum onu_errorcode
gpe_bridge_counter_threshold_set(struct onu_device *p_dev,
const struct gpe_cnt_bridge_threshold *param);
enum onu_errorcode
gpe_bridge_port_counter_threshold_set(struct onu_device *p_dev,
const struct gpe_cnt_bridge_port_threshold *param);
enum onu_errorcode
gpe_bridge_counter_threshold_get(struct onu_device *p_dev,
const struct gpe_bridge *in,
struct gpe_cnt_bridge_threshold *out);
enum onu_errorcode
gpe_bridge_port_counter_threshold_get(struct onu_device *p_dev,
const struct gpe_bridge_port_index *in,
struct gpe_cnt_bridge_port_threshold *out);
enum onu_errorcode
gpe_bridge_tca_get(struct onu_device *p_dev,
const struct gpe_bridge *in,
struct gpe_cnt_bridge_threshold *out);
enum onu_errorcode
gpe_bridge_port_tca_get(struct onu_device *p_dev,
const struct gpe_bridge_port_index *in,
struct gpe_cnt_bridge_port_threshold *out);
enum onu_errorcode
gpe_bridge_counter_reset(struct onu_device *p_dev,
const struct gpe_bridge_cnt_interval *param);
enum onu_errorcode
gpe_bridge_port_counter_reset(struct onu_device *p_dev,
const struct gpe_bridge_port_cnt_interval *param);
#ifndef SWIG
bool
gpe_bridge_port_valid(struct onu_control *ctrl,
const uint32_t index);
enum onu_errorcode sce_lan_cnt_get(struct onu_control *ctrl,
const uint8_t uni_idx,
struct sce_lan_counter *cnt);
#endif
enum onu_errorcode gpe_parser_cfg_set(struct onu_device *p_dev,
const struct gpe_parser_cfg *param);
enum onu_errorcode gpe_parser_cfg_get(struct onu_device *p_dev,
struct gpe_parser_cfg *out);
enum onu_errorcode
gpe_ethertype_filter_cfg_set(struct onu_device *p_dev,
const struct gpe_ethertype_filter_cfg *param);
enum onu_errorcode
gpe_ethertype_filter_cfg_get(struct onu_device *p_dev,
const struct gpe_ethertype_filter_index *in,
struct gpe_ethertype_filter_cfg *out);
enum onu_errorcode gpe_omci_send(struct onu_device *p_dev,
const struct gpe_omci_msg *param);
enum onu_errorcode gpe_tod_init(struct onu_device *p_dev,
const struct gpe_tod_init_data *param);
enum onu_errorcode gpe_tod_sync_set(struct onu_device *p_dev,
const struct gpe_tod_sync *param);
enum onu_errorcode gpe_tod_get(struct onu_device *p_dev, struct gpe_tod *param);
enum onu_errorcode gpe_tod_sync_get(struct onu_device *p_dev,
struct gpe_tod_sync *param);
enum onu_errorcode
gpe_iqm_global_cfg_set(struct onu_device *p_dev,
const struct gpe_iqm_global_cfg *param);
enum onu_errorcode gpe_iqm_global_cfg_get(struct onu_device *p_dev,
struct gpe_iqm_global_cfg *param);
enum onu_errorcode
gpe_iqm_global_status_get(struct onu_device *p_dev,
struct gpe_iqm_global_status *param);
enum onu_errorcode gpe_tmu_global_cfg_get(struct onu_device *p_dev,
struct gpe_tmu_global_cfg *param);
enum onu_errorcode
gpe_tmu_global_status_get(struct onu_device *p_dev,
struct gpe_tmu_global_status *param);
enum onu_errorcode gpe_tmu_counter_get(struct onu_device *p_dev,
const struct gpe_cnt_tmu_sel *in,
struct gpe_cnt_tmu_val *out);
enum onu_errorcode gpe_tmu_counter_reset(struct onu_device *p_dev,
const struct gpe_cnt_tmu_reset *param);
enum onu_errorcode gpe_sce_counter_get(struct onu_device *p_dev,
const struct gpe_cnt_sce_sel *in,
struct gpe_cnt_sce_val *out);
enum onu_errorcode gpe_sce_counter_reset(struct onu_device *p_dev,
const struct gpe_cnt_sce_reset *param);
enum onu_errorcode gpe_gem_counter_get(struct onu_device *p_dev,
const struct gpe_gem_cnt_interval *in,
struct gpe_gem_counter *out);
enum onu_errorcode
gpe_gem_counter_threshold_set(struct onu_device *p_dev,
const struct gpe_cnt_gem_threshold *param);
enum onu_errorcode
gpe_gem_counter_threshold_get(struct onu_device *p_dev,
const struct gem_port_index *in,
struct gpe_cnt_gem_val *out);
enum onu_errorcode gpe_gem_tca_get(struct onu_device *p_dev,
const struct gem_port_index *in,
struct gpe_gem_tca_val *out);
enum onu_errorcode
gpe_gem_counter_reset(struct onu_device *p_dev,
const struct gpe_gem_cnt_interval *param);
#if defined(INCLUDE_SCE_DEBUG)
enum onu_errorcode sce_break_set(struct onu_device *p_dev,
const struct sce_break_point *param);
enum onu_errorcode sce_break_autocheck_enable(struct onu_device *p_dev,
const bool enable);
enum onu_errorcode sce_break_get(struct onu_device *p_dev,
const struct sce_break_index *in,
struct sce_break_point *out);
enum onu_errorcode sce_break_remove(struct onu_device *p_dev,
const struct sce_break_point *param);
enum onu_errorcode sce_break(struct onu_device *p_dev,
const struct sce_thread *in,
struct sce_break_info *out);
enum onu_errorcode sce_single_step(struct onu_device *p_dev,
const struct sce_thread *in,
struct sce_break_info *out);
enum onu_errorcode sce_run(struct onu_device *p_dev,
const struct sce_thread *param);
enum onu_errorcode sce_restart_vm(struct onu_device *p_dev,
const struct sce_restart_cfg *param);
enum onu_errorcode sce_run_mask(struct onu_device *p_dev,
const struct sce_thread_mask *param);
enum onu_errorcode sce_break_mask(struct onu_device *p_dev,
const struct sce_thread_mask *param);
enum onu_errorcode sce_status_get(struct onu_device *p_dev,
struct sce_status *param);
enum onu_errorcode sce_reg_set(struct onu_device *p_dev,
const struct sce_register_val *param);
enum onu_errorcode sce_reg_get(struct onu_device *p_dev,
const struct sce_register *in,
struct sce_register_val *out);
enum onu_errorcode sce_mem_set(struct onu_device *p_dev,
const struct sce_memory_val *param);
enum onu_errorcode sce_mem_get(struct onu_device *p_dev,
const struct sce_memory *in,
struct sce_memory_val *out);
#ifndef SWIG
enum onu_errorcode sce_break_check(struct onu_device *p_dev,
struct sce_thread_mask *out);
#endif
#endif /* defined(INCLUDE_SCE_DEBUG)*/
enum onu_errorcode gpe_sce_download(struct onu_device *p_dev,
const struct sce_download_cfg *param);
#ifndef SWIG
enum onu_errorcode gpe_sce_selected_download(struct onu_device *p_dev,
const char *name,
const uint8_t num_pe);
#endif
enum onu_errorcode gpe_sce_version_get(struct onu_device *p_dev,
const struct sce_pe_index *in,
struct sce_version *out);
enum onu_errorcode
gpe_flat_egress_path_create(struct onu_device *p_dev,
const struct gpe_flat_egress_path *param);
enum onu_errorcode gpe_fsqm_check(struct onu_device *p_dev, uint16_t len);
enum onu_errorcode gpe_cop_download(struct onu_device *p_dev,
const struct cop_download_cfg *param);
#ifndef SWIG
enum onu_errorcode gpe_iqueue_write_debug(struct onu_device *p_dev,
const struct ictrlc_write *param);
enum onu_errorcode onu_gpe_omci_handle(struct onu_control *ctrl);
int onu_gpe_egress_cpu_port_handle(struct onu_control *ctrl,
const uint32_t irnicr);
enum onu_errorcode gpe_gem_cnt_update( struct onu_control *ctrl,
const uint16_t index,
const uint64_t reset_mask,
const bool curr,
void *p_data);
enum onu_errorcode gpe_bridge_cnt_update(struct onu_control *ctrl,
const uint16_t index,
const uint64_t reset_mask,
const bool curr,
void *p_data);
enum onu_errorcode gpe_bridge_port_cnt_update(struct onu_control *ctrl,
const uint16_t index,
const uint64_t reset_mask,
const bool curr,
void *p_data);
int onu_cop_version_get(struct onu_control *ctrl,
int cop_id,
char *cop_name,
int *major,
int *minor);
#endif
enum onu_errorcode
gpe_lan_exception_cfg_set(struct onu_device *p_dev,
const struct gpe_lan_exception_cfg *param);
enum onu_errorcode
gpe_lan_exception_cfg_get(struct onu_device *p_dev,
const struct gpe_lan_exception_idx *in,
struct gpe_lan_exception_cfg *out);
enum onu_errorcode
gpe_ani_exception_cfg_set(struct onu_device *p_dev,
const struct gpe_ani_exception_cfg *param);
enum onu_errorcode
gpe_ani_exception_cfg_get(struct onu_device *p_dev,
const struct gpe_ani_exception_idx *in,
struct gpe_ani_exception_cfg *out);
enum onu_errorcode
gpe_exception_queue_cfg_set(struct onu_device *p_dev,
const struct gpe_exception_queue_cfg *param);
enum onu_errorcode
gpe_exception_queue_cfg_get(struct onu_device *p_dev,
const struct gpe_exception_queue_idx *in,
struct gpe_exception_queue_cfg *out);
#ifndef SWIG
enum onu_errorcode
gpe_tr181_counter_get(struct onu_device *p_dev,
const struct gpe_tr181_counters_cfg *in,
struct gpe_tr181_counters *out);
#endif
#ifdef INCLUDE_CLI_SUPPORT
struct gpe_lan_port_acl {
uint16_t port_index;
bool acl_filter_enable;
uint8_t acl_filter_index;
bool acl_filter_mode_whitelist;
};
struct gpe_lan_port_acl_index {
uint16_t port_index;
};
enum onu_errorcode gpe_lan_port_acl_set(struct onu_device *p_dev,
const struct gpe_lan_port_acl *in);
enum onu_errorcode gpe_lan_port_acl_get(struct onu_device *p_dev,
const struct gpe_lan_port_acl_index *in,
struct gpe_lan_port_acl *out);
#endif
#ifndef SWIG
enum onu_errorcode gpe_device_capability_get(struct gpe_capability *cap);
#endif
enum onu_errorcode gpe_capability_get(struct onu_device *p_dev,
struct gpe_capability *param);
enum onu_errorcode
gpe_exception_profile_cfg_set(struct onu_device *p_dev,
const struct gpe_exception_profile_cfg *param);
enum onu_errorcode
gpe_exception_profile_cfg_get(struct onu_device *p_dev,
const struct gpe_exception_profile_idx *in,
struct gpe_exception_profile_cfg *out);
enum onu_errorcode gpe_egress_port_enable(struct onu_device *p_dev,
const struct gpe_epn *param);
enum onu_errorcode gpe_egress_port_disable(struct onu_device *p_dev,
const struct gpe_epn *param);
#ifndef SWIG
/**
Enable the connected egress queues based on given egress port value.
All connected scheduler will be evaluated for connected queues.
\param ctrl device control context
\param epn egress port
\param ena enable/disable
*/
void gpe_enqueue_enable(struct onu_control *ctrl, const uint32_t epn, const bool ena);
/**
Flush all packets stored in the connected queues.
The egress queues should be disabled first using gpe_enqueue_enable() .
\param ctrl device control context
\param epn egress port
*/
uint32_t gpe_enqueue_flush(struct onu_control *ctrl, const uint16_t epn);
void gpe_enqueue_modify(struct onu_control *ctrl, const uint16_t qid, const bool ena);
#endif
/*! @} */
/*! @} */
EXTERN_C_END
#endif

6331
src/drv_onu_gpe_tables.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,367 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
/**
\file drv_onu_gpe_tables_api.h
Device Driver, GPON Packer Engine
*/
#ifndef _drv_onu_gpe_tables_api_h
#define _drv_onu_gpe_tables_api_h
#include "drv_onu_std_defs.h"
#include "drv_onu_gpe_interface.h"
#include "drv_onu_gpe_tables.h"
#include "drv_onu_gpe_tables_interface.h"
#include "drv_onu_types.h"
#include "drv_onu_ll_tbm.h"
EXTERN_C_BEGIN
/** \addtogroup ONU_GPE_INTERNAL
@{
*/
#ifndef SWIG
/* Counters based on bridge port number */
#define COP_COUNT_BASE_IBP_GOOD 0x0000
#define COP_COUNT_BASE_IBP_DISCARD 0x0080
#define COP_COUNT_BASE_LIM 0x0100
#define COP_COUNT_BASE_EBP_GOOD 0x0180
#define COP_COUNT_BASE_EBP_DISCARD 0x0200
/* Counters based on IQN port number */
#define COP_COUNT_BASE_UC 0x0280
#define COP_COUNT_BASE_MC 0x0289
#define COP_COUNT_BASE_BC 0x0292
#define COP_COUNT_BASE_IPN_DISCARD 0x029B
/* Counters based on UNI port number 0-7 */
#define COP_COUNT_BASE_PPPOE 0x02A4
/* Counters based on UNI port number 0-3 */
#define COP_COUNT_BASE_MC_EGRESS 0x02AC
#define COP_COUNT_BASE_BC_EGRESS 0x02B0
/* Policer thresholds based on UNI port number 0-4 */
#define COP_COUNT_BASE_LAN_POLICER 0x02B4
/* simple Policer thresholds used for exceptions */
#define COP_COUNT_BASE_ANI_EXCEPTION_POLICER 0x02B9
#define COP_COUNT_BASE_EXCEPTION_POLICER 0x02BA
#define COP_COUNT_BASE_IGMP_EXCEPTION_POLICER 0x02BB
/* Unused space */
#define COP_COUNT_BASE_UNUSED1 0x02BC
#define COP_COUNT_BASE_UNUSED2 0x02BD
#define COP_COUNT_BASE_UNUSED3 0x02BE
/* global statistic count of lost exceptions due to policing */
#define COP_COUNT_BASE_EXCEPTIONS_LOST 0x02BF
#define TABLE_GET(ctrl, p_table_entry) \
gpe_table_entry_intresp(ctrl, p_table_entry, ONU_GPE_COP_GET)
#define TABLE_READ(ctrl, p_table_entry) \
gpe_table_entry_intresp(ctrl, p_table_entry, ONU_GPE_COP_READ)
enum sce_process_mode {
SCE_MODE_PACKET = 0,
SCE_MODE_COMMAND = 1
};
struct sce_cnt_get_helper {
enum gpe_sce_cnt_type type;
uint16_t cop_base;
uint16_t offset_max;
};
/** Structure to find a LAN port for a multicast flow.
*/
struct gpe_mc_match {
/** Matching bridge port for requested MAC address */
uint32_t port_map_index;
/** Bridge index field used for key completion of short FWD table */
uint32_t bridge_index;
};
/** Union to specify MC forwarding address (MAC or IP)*/
union gpe_mc_addr {
/** MC MAC address*/
uint8_t mc_mac[6];
/** MC IP address */
uint8_t mc_ip[4];
};
extern const struct onu_entry gpe_table_function_table[];
extern const unsigned int gpe_table_function_table_size;
enum onu_errorcode
gpe_table_reinit(struct onu_device *p_dev,
const struct gpe_reinit_table *reinit_table);
/**
Table access function which writes a specific table entry.
This function calls the base function N times (where N is number of PE,
which should receive table data)
\param fw_info Firmware information
\param num_pe NUmber of PEs
\param entry Table entry structure
*/
enum onu_errorcode
sce_pe_table_entry_write(const struct pe_fw_info *fw_info,
const uint8_t num_pe,
const struct gpe_table_entry *entry);
/**
Table access function which reads a specific table entry.
\param fw_info Firmware information
\param num_pe Number of PEs
\param entry Table data structure
*/
enum onu_errorcode sce_pe_table_entry_read(const struct pe_fw_info *fw_info,
const uint8_t num_pe,
struct gpe_table_entry *entry);
enum onu_errorcode gpe_table_entry_set(struct onu_device *p_dev,
struct gpe_table_entry *param);
enum onu_errorcode gpe_table_entry_get(struct onu_device *p_dev,
const struct gpe_table *in,
struct gpe_table_entry *out);
enum onu_errorcode gpe_table_entry_add(struct onu_device *p_dev,
struct gpe_table_entry *param);
enum onu_errorcode gpe_table_entry_nil_add(struct onu_device *p_dev,
struct gpe_table_entry *param,
const bool);
enum onu_errorcode gpe_table_entry_delete(struct onu_device *p_dev,
struct gpe_table_entry *param);
enum onu_errorcode gpe_table_entry_search(struct onu_device *p_dev,
struct gpe_table_entry *param);
enum onu_errorcode gpe_table_entry_do(struct onu_device *p_dev,
struct gpe_table_entry *param,
uint32_t instruction_id);
enum onu_errorcode gpe_table_entry_read(struct onu_device *p_dev,
const struct gpe_table *in,
struct gpe_table_entry *out);
enum onu_errorcode gpe_table_entry_write(struct onu_device *p_dev,
struct gpe_table_entry *param);
enum onu_errorcode gpe_table_entry_intresp(struct onu_control *ctrl,
struct gpe_table_entry *param,
uint32_t cmd);
enum onu_errorcode gpe_table_entry_intcmd(struct onu_control *ctrl,
struct gpe_table_entry *param,
uint32_t cmd);
enum onu_errorcode sce_cnt_get(struct onu_control *ctrl,
struct gpe_table_entry *entry,
uint32_t idx);
enum onu_errorcode gpe_sce_constant_mac_set(struct onu_control *ctrl,
const uint8_t mac[6]);
enum onu_errorcode gpe_sce_constant_set(struct onu_control *ctrl,
const uint32_t idx,
const uint32_t val);
enum onu_errorcode gpe_sce_constant_get(struct onu_control *ctrl,
const uint32_t idx,
uint32_t *val);
enum onu_errorcode gpe_sce_process_mode_set(struct onu_control *ctrl,
enum sce_process_mode mode);
enum onu_errorcode gpe_sce_pe_init(struct onu_control *ctrl);
#endif
#ifndef SWIG
enum onu_errorcode gpe_bridge_port_cfg_set(struct onu_device *p_dev,
const struct gpe_bridge_port *param);
enum onu_errorcode gpe_ext_vlan_set(struct onu_device *p_dev,
const struct gpe_ext_vlan *param);
enum onu_errorcode gpe_ext_vlan_get(struct onu_device *p_dev,
const struct gpe_ext_vlan_index *in,
struct gpe_ext_vlan *out);
enum onu_errorcode gpe_ext_vlan_do(struct onu_device *p_dev,
const struct gpe_table_entry *in,
struct gpe_table_entry *out);
enum onu_errorcode gpe_ext_vlan_custom_set(struct onu_device *p_dev,
const struct gpe_ext_vlan_custom *in);
enum onu_errorcode gpe_ext_vlan_custom_get(struct onu_device *p_dev,
struct gpe_ext_vlan_custom *out);
enum onu_errorcode gpe_fid_add( struct onu_device *p_dev,
const struct gpe_table_entry *in);
enum onu_errorcode gpe_fid_delete(struct onu_device *p_dev,
const struct gpe_table_entry *in);
enum onu_errorcode gpe_fid_get(struct onu_device *p_dev,
const struct gpe_table_entry *in,
struct gpe_table_entry *out);
enum onu_errorcode gpe_long_fwd_add(struct onu_device *p_dev,
const struct gpe_table_entry *in);
enum onu_errorcode gpe_long_fwd_delete( struct onu_device *p_dev,
const struct gpe_table_entry *param);
enum onu_errorcode gpe_long_fwd_forward(struct onu_device *p_dev,
struct gpe_table_entry *in);
enum onu_errorcode gpe_tagging_filter_do(struct onu_device *p_dev,
const struct gpe_tagg_filter *in,
struct gpe_tagg_filter *out);
enum onu_errorcode gpe_tagging_filter_get(struct onu_device *p_dev,
const struct gpe_tagging_index *in,
struct gpe_tagging *out);
enum onu_errorcode gpe_tagging_filter_set(struct onu_device *p_dev,
const struct gpe_tagging *param);
enum onu_errorcode gpe_cop_table0_read(struct onu_device *p_dev,
struct gpe_table_entry *entry);
enum onu_errorcode gpe_short_fwd_add(struct onu_device *p_dev,
struct gpe_table_entry *in);
enum onu_errorcode gpe_short_fwd_delete(struct onu_device *p_dev,
struct gpe_table_entry *in);
enum onu_errorcode gpe_short_fwd_relearn(struct onu_device *p_dev,
struct gpe_table_entry *in);
enum onu_errorcode gpe_short_fwd_forward(struct onu_device *p_dev,
struct gpe_table_entry *in);
enum onu_errorcode gpe_aging_trigger_set(struct onu_control *ctrl);
enum onu_errorcode gpe_age_get( struct onu_device *p_dev,
struct gpe_table_entry *in,
struct sce_mac_entry_age *out);
enum onu_errorcode gpe_age(struct onu_device *p_dev,
struct gpe_table_entry *in);
#endif
enum onu_errorcode
gpe_short_fwd_mac_mc_port_add(struct onu_device *p_dev,
const struct gpe_mac_mc_port *in);
enum onu_errorcode
gpe_short_fwd_mac_mc_port_delete(struct onu_device *p_dev,
const struct gpe_mac_mc_port *in);
enum onu_errorcode
gpe_short_fwd_mac_mc_port_modify(struct onu_device *p_dev,
const struct gpe_mac_mc_port_modify *in);
enum onu_errorcode
gpe_short_fwd_ipv4_mc_port_add(struct onu_device *p_dev,
const struct gpe_ipv4_mc_port *in);
enum onu_errorcode
gpe_short_fwd_ipv4_mc_port_delete(struct onu_device *p_dev,
const struct gpe_ipv4_mc_port *in);
enum onu_errorcode
gpe_short_fwd_ipv4_mc_port_modify(struct onu_device *p_dev,
const struct gpe_ipv4_mc_port_modify *in);
enum onu_errorcode gpe_aging_time_set(struct onu_device *p_dev,
const struct sce_aging_time *in);
enum onu_errorcode gpe_aging_time_get(struct onu_device *p_dev,
struct sce_aging_time *out);
enum onu_errorcode gpe_aging_time_set_debug( struct onu_device *p_dev,
const struct sce_aging_time *in);
enum onu_errorcode gpe_sce_constants_get(struct onu_device *p_dev,
struct gpe_sce_constants *param);
enum onu_errorcode gpe_sce_constants_set(struct onu_device *p_dev,
const struct gpe_sce_constants *param);
enum onu_errorcode gpe_sce_mac_get(struct onu_device *p_dev,
struct gpe_sce_mac *param);
enum onu_errorcode gpe_sce_mac_set(struct onu_device *p_dev,
const struct gpe_sce_mac *param);
enum onu_errorcode gpe_vlan_fid_add(struct onu_device *p_dev,
const struct gpe_vlan_fid_in *in,
struct gpe_vlan_fid_out *out);
enum onu_errorcode gpe_vlan_fid_get(struct onu_device *p_dev,
const struct gpe_vlan_fid_in *in,
struct gpe_vlan_fid_out *out);
enum onu_errorcode gpe_vlan_fid_delete(struct onu_device *p_dev,
const struct gpe_vlan_fid_in *in);
#ifndef SWIG
enum onu_errorcode gpe_bridge_cnt_get(struct onu_control *ctrl,
const uint32_t bridge_index,
struct gpe_cnt_bridge_val *counter);
enum onu_errorcode
gpe_bridge_port_cnt_get( struct onu_control *ctrl,
const uint32_t index,
struct gpe_cnt_bridge_port_val *counter);
#endif
#ifndef SWIG
enum onu_errorcode
gpe_bridge_port_config_get(struct onu_control *ctrl,
const struct gpe_bridge_port_index *in,
struct gpe_bridge_port *out);
#endif
enum onu_errorcode
gpe_bridge_port_cfg_get(struct onu_device *p_dev,
const struct gpe_bridge_port_index *in,
struct gpe_bridge_port *out);
enum onu_errorcode gpe_cop_debug_set(struct onu_device *p_dev,
const struct gpe_cop_tracing *in);
enum onu_errorcode gpe_cop_debug_server(struct onu_device *p_dev,
const struct gpe_cop_debug *in);
enum onu_errorcode
gpe_acl_table_entry_set(struct onu_device *p_dev,
const struct gpe_acl_table_entry *param);
enum onu_errorcode
gpe_acl_table_entry_get(struct onu_device *p_dev,
const struct gpe_acl_table_entry_idx *in,
struct gpe_acl_table_entry *out);
enum onu_errorcode
gpe_acl_table_entry_delete(struct onu_device *p_dev,
const struct gpe_acl_table_entry_idx *param);
#if defined(INCLUDE_DUMP)
/**
Dump the gpe tables.
*/
void gpe_table_dump(struct seq_file *s);
void gpe_table_dsgem(struct seq_file *s);
void gpe_table_usgem(struct seq_file *s);
void gpe_table_fidhash(struct seq_file *s);
void gpe_table_fidass(struct seq_file *s);
void gpe_table_tagg(struct seq_file *s);
void gpe_table_vlan(struct seq_file *s);
void gpe_table_extvlan(struct seq_file *s);
void gpe_table_vlanrule(struct seq_file *s);
void gpe_table_vlantreatment(struct seq_file *s);
void gpe_table_shortfwdhash(struct seq_file *s);
void gpe_table_shortfwdmac(struct seq_file *s);
void gpe_table_shortfwdmacmc(struct seq_file *s);
void gpe_table_shortfwdipv4(struct seq_file *s);
void gpe_table_shortfwdipv4mc(struct seq_file *s);
void gpe_table_longfwdhash(struct seq_file *s);
void gpe_table_longfwdipv6(struct seq_file *s);
void gpe_table_longfwdipv6mc(struct seq_file *s);
void gpe_table_dsmcipv4(struct seq_file *s);
void gpe_table_dsmcipv6(struct seq_file *s);
void gpe_table_learnlim(struct seq_file *s);
void gpe_table_exp(struct seq_file *s);
void gpe_table_macfilter(struct seq_file *s);
void gpe_table_counter(struct seq_file *s);
void gpe_table_bridgeport(struct seq_file *s);
void gpe_table_pmapper(struct seq_file *s);
void gpe_table_lanport(struct seq_file *s);
void gpe_table_pcpdec(struct seq_file *s);
void gpe_table_dscpdec(struct seq_file *s);
void gpe_table_pcpenc(struct seq_file *s);
void gpe_table_dscpenc(struct seq_file *s);
void gpe_table_redir(struct seq_file *s);
void gpe_table_aclfilt(struct seq_file *s);
void gpe_table_bridge(struct seq_file *s);
void gpe_table_const(struct seq_file *s);
void gpe_table_status(struct seq_file *s);
void gpe_table_ethertype_filter(struct seq_file *s);
void gpe_table_enqueue(struct seq_file *s);
#endif
/*! @} */
EXTERN_C_END
#endif

1121
src/drv_onu_gtc.c Normal file

File diff suppressed because it is too large Load Diff

144
src/drv_onu_gtc_api.h Normal file
View File

@ -0,0 +1,144 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
/**
\file drv_onu_gtc_api.h
*/
#ifndef _drv_onu_gtc_api_h
#define _drv_onu_gtc_api_h
#include "drv_onu_std_defs.h"
#include "drv_onu_gtc_interface.h"
EXTERN_C_BEGIN
/** \addtogroup ONU_MAPI_REFERENCE_INTERNAL
@{
*/
/** \defgroup ONU_GTC_INTERNAL Transmission Convergence Layer
@{
*/
extern const struct onu_entry gtc_func_tbl[];
extern const unsigned int gtc_func_tbl_size;
enum onu_errorcode gtc_init(struct onu_device *p_dev,
const struct gtc_init_data *param);
enum onu_errorcode gtc_cfg_set(struct onu_device *p_dev,
const struct gtc_cfg *param);
enum onu_errorcode gtc_cfg_get(struct onu_device *p_dev, struct gtc_cfg *param);
enum onu_errorcode gtc_counter_threshold_set(struct onu_device *p_dev,
const struct gtc_cnt_value *param);
enum onu_errorcode gtc_counter_threshold_get(struct onu_device *p_dev,
struct gtc_cnt_value *param);
enum onu_errorcode gtc_tca_get(struct onu_device *p_dev,
struct gtc_cnt_value *param);
enum onu_errorcode gtc_us_header_cfg_get(struct onu_device *p_dev,
struct gtc_us_header_cfg *param);
enum onu_errorcode gtc_counter_get(struct onu_device *p_dev,
const struct gtc_cnt_interval *in,
struct gtc_counters *out);
enum onu_errorcode gtc_counter_reset(struct onu_device *p_dev,
const struct gtc_cnt_interval *param);
enum onu_errorcode gtc_status_get(struct onu_device *p_dev,
struct gtc_status *param);
enum onu_errorcode gtc_alarm_get(struct onu_device *p_dev,
struct gtc_alarm *param);
enum onu_errorcode gtc_ranging_get(struct onu_device *p_dev,
struct gtc_ranging_val *param);
enum onu_errorcode gtc_dying_gasp_cfg_set(struct onu_device *p_dev,
const struct gtc_dgasp_msg *param);
enum onu_errorcode gtc_dying_gasp_cfg_get(struct onu_device *p_dev,
struct gtc_dgasp_msg *param);
enum onu_errorcode gtc_no_message_cfg_set(struct onu_device *p_dev,
const struct gtc_no_msg_msg *param);
enum onu_errorcode gtc_no_message_cfg_get(struct onu_device *p_dev,
struct gtc_no_msg_msg *param);
enum onu_errorcode gtc_power_saving_mode_set(struct onu_device *p_dev,
const struct gtc_op_mode *param);
enum onu_errorcode gtc_power_saving_mode_get(struct onu_device *p_dev,
struct gtc_op_mode *param);
enum onu_errorcode gtc_ploam_send(struct onu_device *p_dev,
const struct gtc_ploamu *param);
enum onu_errorcode gtc_ploam_receive(struct onu_device *p_dev,
struct gtc_ploamd *param);
enum onu_errorcode gtc_serial_number_set(struct onu_device *p_dev,
const struct gtc_serial_num *param);
enum onu_errorcode gtc_serial_number_get(struct onu_device *p_dev,
struct gtc_serial_num *param);
enum onu_errorcode gtc_password_set(struct onu_device *p_dev,
const struct gtc_password *param);
enum onu_errorcode gtc_password_get(struct onu_device *p_dev,
struct gtc_password *param);
enum onu_errorcode gtc_forced_alloc_set(struct onu_device *p_dev,
const struct gtc_forced_alloc *param);
enum onu_errorcode gtc_forced_alloc_get(struct onu_device *p_dev,
struct gtc_forced_alloc *param);
enum onu_errorcode gtc_bwmt_cfg_set(struct onu_device *p_dev,
const struct gtc_bwmt_cfg *param);
enum onu_errorcode gtc_bwmt_cfg_get(struct onu_device *p_dev,
struct gtc_bwmt_cfg *param);
enum onu_errorcode gtc_bwmt_next(struct onu_device *p_dev,
const struct gtc_bwmt_next_data *param);
enum onu_errorcode gtc_bwmt_status_get(struct onu_device *p_dev,
struct gtc_bwmt_status *param);
enum onu_errorcode gtc_last_change_time_get(struct onu_device *p_dev,
struct gtc_last_change_time *param);
enum onu_errorcode gtc_pon_id_get(struct onu_device *p_dev,
struct gtc_pon_id *param);
#ifndef SWIG
/** Update Total BERR counter
*/
void gtc_total_berr_update(struct onu_control *ctrl);
/** Get Total BERR counter
*/
uint64_t gtc_total_berr_get(struct onu_control *ctrl);
enum onu_errorcode gtc_counter_update(struct onu_control *ctrl,
const uint64_t reset_mask,
const bool curr,
void *data);
#endif
/*! @} */
/*! @} */
EXTERN_C_END
#endif

3326
src/drv_onu_lan.c Normal file

File diff suppressed because it is too large Load Diff

411
src/drv_onu_lan_api.h Normal file
View File

@ -0,0 +1,411 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
/**
\file drv_onu_lan_api.h
*/
#ifndef _drv_onu_drv_lan_api_h
#define _drv_onu_drv_lan_api_h
#include "drv_onu_std_defs.h"
#include "drv_onu_lan_interface.h"
EXTERN_C_BEGIN
/** \addtogroup ONU_MAPI_REFERENCE_INTERNAL
@{
*/
/** \defgroup ONU_LAN_INTERNAL Ethernet Interface
@{
*/
extern const struct onu_entry lan_function_table[];
extern const unsigned int lan_function_table_size;
enum onu_errorcode lan_gphy_firmware_download(struct onu_device *p_dev,
const struct lan_gphy_fw *param);
enum onu_errorcode lan_init(struct onu_device *p_dev);
enum onu_errorcode lan_cfg_set(struct onu_device *p_dev,
const struct lan_cfg *param);
enum onu_errorcode lan_cfg_get(struct onu_device *p_dev, struct lan_cfg *param);
enum onu_errorcode lan_port_cfg_set(struct onu_device *p_dev,
const struct lan_port_cfg *param);
enum onu_errorcode lan_port_cfg_get(struct onu_device *p_dev,
const struct lan_port_index *in,
struct lan_port_cfg *out);
enum onu_errorcode lan_port_enable(struct onu_device *p_dev,
const struct lan_port_index *param);
enum onu_errorcode lan_port_disable(struct onu_device *p_dev,
const struct lan_port_index *param);
enum onu_errorcode lan_loop_cfg_set(struct onu_device *p_dev,
const struct lan_loop_cfg *param);
enum onu_errorcode lan_loop_cfg_get(struct onu_device *p_dev,
const struct lan_port_index *in,
struct lan_loop_cfg *out);
enum onu_errorcode lan_port_status_get(struct onu_device *p_dev,
const struct lan_port_index *in,
struct lan_port_status *out);
enum onu_errorcode lan_counter_get(struct onu_device *p_dev,
const struct lan_cnt_interval *in,
struct lan_counters *out);
enum onu_errorcode lan_counter_reset(struct onu_device *p_dev,
const struct lan_cnt_interval *param);
enum onu_errorcode
lan_counter_threshold_set(struct onu_device *p_dev,
const struct lan_cnt_threshold *param);
enum onu_errorcode lan_counter_threshold_get(struct onu_device *p_dev,
const struct lan_port_index *in,
struct lan_cnt_threshold *out);
enum onu_errorcode lan_tca_get(struct onu_device *p_dev,
const struct uni_port_id *in,
struct lan_cnt_val *out);
enum onu_errorcode wol_cfg_set(struct onu_device *p_dev,
const struct wol_cfg *param);
enum onu_errorcode wol_cfg_get(struct onu_device *p_dev,
const struct lan_port_index *in,
struct wol_cfg *out);
enum onu_errorcode wol_status_get(struct onu_device *p_dev,
const struct lan_port_index *in,
struct wol_status *out);
enum onu_errorcode mdio_data_read(struct onu_device *p_dev,
const struct mdio *in,
struct mdio_read *out);
enum onu_errorcode mdio_data_write(struct onu_device *p_dev,
const struct mdio_write *param);
enum onu_errorcode mdio_enable(struct onu_device *p_dev,
const struct mdio_en *param);
enum onu_errorcode mdio_disable(struct onu_device *p_dev,
const struct mdio_dis *param);
enum onu_errorcode mmd_data_read(struct onu_device *p_dev,
const struct mmd *in,
struct mmd_read *out);
enum onu_errorcode mmd_data_write(struct onu_device *p_dev,
const struct mmd_write *param);
#ifndef SWIG
/**
IEEE802.3 Standard Registers
*/
/** MDIO Control register address*/
#define MDIO_PHY_MODE_CTRL (0)
/** MDIO Status register address*/
#define MDIO_PHY_STATUS (1)
/** MDIO PHY Identifier 1 register address*/
#define MDIO_PHY_PHYID1 (2)
/** MDIO PHY Identifier 2 register address*/
#define MDIO_PHY_PHYID2 (3)
/** MDIO Auto-Negotiation Advertisement register address*/
#define MDIO_PHY_AN_ADV (4)
/** MDIO Auto-Negotiation Link-Partner Ability register address*/
#define MDIO_PHY_AN_LPA (5)
/** MDIO gigabit control register address*/
#define MDIO_PHY_MODE_GCTRL (9)
/** MDIO MMD Control register*/
#define MDIO_PHY_MMD_CTRL (13)
/** MDIO MMD Address/Data register*/
#define MDIO_PHY_MMD_DATA (14)
/** MDIO Physical Layer Control 1 register address*/
#define MDIO_PHY_CTL1 (19)
/** MDIO Physical Layer Control 2 register address*/
#define MDIO_PHY_CTL2 (20)
/** Error counter register */
#define MDIO_PHY_ERRCNT (21)
/** MDIO Interrupt Mask register address*/
#define MDIO_IMASK (25)
/** MDIO Interrupt Status register address*/
#define MDIO_ISTAT (26)
/** MDIO Firmware Version register address*/
#define MDIO_FWV (30)
/** MDIO Gigabit Status register address*/
#define MDIO_PHY_GSTAT (10)
#define MDIO_PHY_MODE_CTRL_LOOPBACK (0x4000)
#define MDIO_PHY_MODE_CTRL_LOOPBACK_ENABLE (0x4000)
#define MDIO_PHY_MODE_CONTROL_SPEED (0x2040)
#define MDIO_PHY_MODE_CONTROL_SPEED_10MBPS (0x0)
#define MDIO_PHY_MODE_CONTROL_SPEED_100MBPS (0x2000)
#define MDIO_PHY_MODE_CONTROL_SPEED_1000MBPS (0x40)
#define MDIO_PHY_MODE_CONTROL_AUTONEG_RESTART (1 << 9)
#define MDIO_PHY_MODE_CONTROL_AUTONEG (0x1000)
#define MDIO_PHY_MODE_CONTROL_AUTONEG_ENABLE (1 << 12)
#define MDIO_PHY_MODE_CONTROL_AUTONEG_DISABLE (0x0)
#define MDIO_PHY_MODE_CONTROL_PWR_DOWN (0x800)
#define MDIO_PHY_MODE_CONTROL_PWR_DOWN_ENABLE (0x800)
#define MDIO_PHY_MODE_CONTROL_PWR_DOWN_DISABLE (0x0)
#define MDIO_PHY_MODE_CONTROL_DUPLEX (0x100)
#define MDIO_PHY_MODE_CONTROL_DUPLEX_FULL (0x100)
#define MDIO_PHY_MODE_CONTROL_DUPLEX_HALF (0x0)
#define MDIO_PHY_PHYID1_OUI (0xFFFF)
#define MDIO_PHY_PHYID1_OUI_OFFSET (0)
#define MDIO_PHY_PHYID2_OUI (0xFC00)
#define MDIO_PHY_PHYID2_OUI_OFFSET (10)
#define MDIO_PHY_LTQ_OUI (0x969AAC)
/** MDIO Status register LINK field*/
#define MDIO_PHY_STATUS_LS (1 << 2)
#define MDIO_PHY_STATUS_ANOK (1 << 5)
#define MDIO_PHY_CTL1_TLOOP_MASK (0xE000)
#define MDIO_PHY_CTL1_TLOOP_FETL (0x4000)
#define MDIO_PHY_CTL1_TLOOP_NETL (0x2000)
#define MDIO_IMASK_WOL (0x8000)
#define MDIO_GSTAT_MBTHD (1 << 10)
#define MDIO_GSTAT_MBTFD (1 << 11)
#define MDIO_PHY_AN_LPA_XBT_HDX (0x1 << 5)
#define MDIO_PHY_AN_LPA_XBT_FDX (0x2 << 5)
#define MDIO_PHY_AN_LPA_DBT_HDX (0x4 << 5)
#define MDIO_PHY_AN_LPA_DBT_FDX (0x8 << 5)
#define MDIO_PHY_AN_ADV_XBT_HDX (0x1 << 5)
#define MDIO_PHY_AN_ADV_XBT_FDX (0x2 << 5)
#define MDIO_PHY_AN_ADV_DBT_HDX (0x4 << 5)
#define MDIO_PHY_AN_ADV_DBT_FDX (0x8 << 5)
#define MDIO_PHY_AN_ADV_PS_ASYM (0x20 << 5)
#define MDIO_PHY_AN_ADV_PS_SYM (0x40 << 5)
#define MDIO_PHY_AN_ADV_TAF_MASK (0xFF << 5)
#define MDIO_PHY_MODE_GCTRL_MBTHD (0x1 << 8)
#define MDIO_PHY_MODE_GCTRL_MBTFD (0x2 << 8)
/**
FALCON GPHY Specific MMD Registers
*/
/** MMD EEE Control Register 1 address*/
#define MMD_EEE_CTRL1 (0x0000)
/** MMD EEE Auto-Negotiation Advertisement Register address*/
#define MMD_EEE_AN_ADV (0x003C)
/** MMD LED common configuration register address, (high part)*/
#define MMD_LEDC_HIGH (0x01E0)
/** MMD LED common configuration register address, (low part)*/
#define MMD_LEDC_LOW (0x01E1)
/** MMD LED0 configuration register address, (high part)*/
#define MMD_LED0_HIGH (0x01E2)
/** MMD LED0 configuration register address, (low part)*/
#define MMD_LED0_LOW (0x01E3)
/** MMD LED1 configuration register address, (high part)*/
#define MMD_LED1_HIGH (0x01E4)
/** MMD LED1 configuration register address, (low part)*/
#define MMD_LED1_LOW (0x01E5)
/** MMD LED2 configuration register address, (high part)*/
#define MMD_LED2_HIGH (0x01E6)
/** MMD LED2 configuration register address, (low part)*/
#define MMD_LED2_LOW (0x01E7)
/** MMD LED3 configuration register address, (high part)*/
#define MMD_LED3_HIGH (0x01E8)
/** MMD LED3 configuration register address, (low part)*/
#define MMD_LED3_LOW (0x01E9)
/** MMD Wake-On-LAN control register address*/
#define MMD_ADDR_WOLCTRL (0x077B)
/** MMD Wake-On-LAN Address Byte 0 register address*/
#define MMD_ADDR_WOLAD0 (0x077D)
/** MMD Wake-On-LAN Address Byte 1 register address*/
#define MMD_ADDR_WOLAD1 (0x077E)
/** MMD Wake-On-LAN Address Byte 2 register address*/
#define MMD_ADDR_WOLAD2 (0x077F)
/** MMD Wake-On-LAN Address Byte 3 register address*/
#define MMD_ADDR_WOLAD3 (0x0780)
/** MMD Wake-On-LAN Address Byte 4 register address*/
#define MMD_ADDR_WOLAD4 (0x0781)
/** MMD Wake-On-LAN Address Byte 5 register address*/
#define MMD_ADDR_WOLAD5 (0x0782)
/** MMD Wake-On-LAN SecureON Password Byte 0 register address*/
#define MMD_WOLPW0 (0x0783)
/** MMD Wake-On-LAN SecureON Password Byte 1 register address*/
#define MMD_WOLPW1 (0x0784)
/** MMD Wake-On-LAN SecureON Password Byte 2 register address*/
#define MMD_WOLPW2 (0x0785)
/** MMD Wake-On-LAN SecureON Password Byte 3 register address*/
#define MMD_WOLPW3 (0x0786)
/** MMD Wake-On-LAN SecureON Password Byte 4 register address*/
#define MMD_WOLPW4 (0x0787)
/** MMD Wake-On-LAN SecureON Password Byte 5 register address*/
#define MMD_WOLPW5 (0x0788)
/** MMD Device selection to access WOL registers*/
#define MMD_WOL_SEL (0x1F)
/** MMD Device selection to access EEE registers*/
#define MMD_EEE_SEL (0x03)
/** MMD Device selection to access ANEG registers*/
#define MMD_ANEG_SEL (0x07)
/** MMD Device selection to access LED registers*/
#define MMD_LED_SEL (0x1F)
/** MMD EEE Control Register 1 bits*/
#define MMD_EEE_CTRL1_RXCKST_EN (1 << 10)
/** MMD LED common configuration register bits*/
#define MMD_LEDC_HIGH_NACS_NONE (0 << 0)
#define MMD_LEDC_HIGH_NACS_LINK (1 << 0)
#define MMD_LEDC_HIGH_SBF_F02HZ (0 << 4)
#define MMD_LEDC_HIGH_SBF_F04HZ (1 << 4)
#define MMD_LEDC_HIGH_FBF_F02HZ (0 << 6)
#define MMD_LEDC_HIGH_FBF_F04HZ (1 << 6)
#define MMD_LEDC_HIGH_FBF_F08HZ (2 << 6)
#define MMD_LEDC_HIGH_FBF_F16HZ (3 << 6)
#define MMD_LEDC_LOW_CBLINK_NONE (0 << 0)
#define MMD_LEDC_LOW_CBLINK_LINK (1 << 0)
#define MMD_LEDC_LOW_SCAN_NONE (0 << 4)
#define MMD_LEDC_LOW_SCAN_LINK (1 << 4)
/** MMD LED pin specific configuration register bits*/
#define MMD_LEDX_HIGH_BLINKF_NONE (0 << 0)
#define MMD_LEDX_HIGH_BLINKF_LINK10 (1 << 0)
#define MMD_LEDX_HIGH_BLINKF_LINK100 (2 << 0)
#define MMD_LEDX_HIGH_CON_NONE (0 << 4)
#define MMD_LEDX_HIGH_CON_LINK10 (1 << 4)
#define MMD_LEDX_HIGH_CON_LINK100 (2 << 4)
#define MMD_LEDX_HIGH_CON_LINK10X (3 << 4)
#define MMD_LEDX_HIGH_CON_LINK1000 (4 << 4)
#define MMD_LEDX_HIGH_CON_LINK10_0 (5 << 4)
#define MMD_LEDX_HIGH_CON_LINK100X (6 << 4)
#define MMD_LEDX_HIGH_CON_LINK10XX (7 << 4)
#define MMD_LEDX_LOW_PULSE_NONE (0 << 0)
#define MMD_LEDX_LOW_PULSE_TXACT (1 << 0)
#define MMD_LEDX_LOW_PULSE_RXACT (2 << 0)
#define MMD_LEDX_LOW_PULSE_COL (4 << 0)
#define MMD_LEDX_LOW_BLINKS_NONE (0 << 4)
#define MMD_LEDX_LOW_BLINKS_LINK10 (1 << 4)
#define MMD_LEDX_LOW_BLINKS_LINK100 (2 << 4)
#define MMD_LEDX_LOW_BLINKS_LINK10X (3 << 4)
#define MMD_LEDX_LOW_BLINKS_LINK1000 (4 << 4)
#define MMD_LEDX_LOW_BLINKS_LINK10_0 (5 << 4)
#define MMD_LEDX_LOW_BLINKS_LINK100X (6 << 4)
#define MMD_LEDX_LOW_BLINKS_LINK10XX (7 << 4)
/** MMD Wake-On-LAN control register bits*/
#define MMD_WOLCTRL_EN (1 << 0)
#define MMD_WOLCTRL_SPWD_EN (1 << 2)
/** MMD EEE Auto-Negotiation Advertisement register bits*/
#define MMD_EEE_AN_ADV_MASK (0x7E)
#define MMD_EEE_AN_ADV_EEE_100BTX (0x1 << 1)
#define MMD_EEE_AN_ADV_EEE_1000BT (0x2 << 1)
#define GPHY_FW_MAJOR_NUM_WOL_SUPPORT (0x3)
#define GPHY_FW_MAJOR_NUM_LED_SUPPORT (0x3)
/** GPHY 11G firmware base ROM address*/
#define GPHY_11G_FIRMWARE_A11_ROM_ADDR (0xBF020000)
#define GPHY_11G_FIRMWARE_A12_ROM_ADDR (0xBF018000)
/** GPHY 22F firmware base ROM address*/
#define GPHY_22F_FIRMWARE_A11_ROM_ADDR (0xBF028000)
#define GPHY_22F_FIRMWARE_A12_ROM_ADDR (0xBF024000)
/** Structure to identify GPHY firmware version.
\remark
Please note that this part of the code is endianess-aware.
Switching to a little-endian operation system or to a different
processor core or compiler needs adaptation of the bit definitions.*/
struct gphy_fw_version {
/**
Indicates either a test or a release version.
Constants
0 - TEST Indicates a test version
1 - RELEASE Indicates a released version*/
uint16_t release : 1;
/**
Specifies the verison release number of the Firmware.*/
uint16_t major : 7;
/**
Specifies the subversion release number of the MAJOR Firmware
release.*/
uint16_t minor : 8;
};
/** Structure to specify GPHY LED register init
*/
struct gphy_led_reg_init {
/** LED register address */
uint16_t reg_addr;
/** LED register data */
uint16_t reg_data;
};
enum onu_errorcode lan_cnt_update(struct onu_control *ctrl,
const uint8_t index,
const uint64_t reset_mask,
const bool curr,
void *p_data);
/** MDIO read/write access function*/
enum onu_errorcode lan_mdio_access(struct onu_control *ctrl,
const int8_t a_dev,
const uint8_t a_reg,
uint16_t mask_clear,
uint16_t mask_set,
uint16_t *data);
enum onu_errorcode lan_mmd_access(struct onu_control *ctrl,
const int8_t a_dev,
const uint8_t mmd_sel,
const uint16_t mmd_addr,
uint16_t mask_clear,
uint16_t mask_set,
uint16_t *data);
enum onu_errorcode lan_phy_interrupt_enable_set(struct onu_control *ctrl,
const uint8_t port_num,
const uint16_t clear,
const uint16_t set);
enum onu_errorcode lan_traffic_watchdog (struct onu_control *ctrl);
#endif /* #ifndef SWIG*/
enum onu_errorcode lan_port_capability_cfg_set(struct onu_device *p_dev,
const struct
lan_port_capability_cfg *param);
enum onu_errorcode lan_port_capability_cfg_get(struct onu_device *p_dev,
const struct lan_port_index *in,
struct
lan_port_capability_cfg *out);
/*! @} */
/*! @} */
EXTERN_C_END
#endif

View File

@ -0,0 +1,182 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
/**
\file drv_onu_lan_api_intern.h
*/
#ifndef _drv_onu_drv_lan_api_intern_h
#define _drv_onu_drv_lan_api_intern_h
#include "drv_onu_std_defs.h"
EXTERN_C_BEGIN
#ifndef SWIG
/** \addtogroup ONU_MAPI_REFERENCE_INTERNAL
@{
*/
/** \defgroup ONU_LAN_INTERNAL Ethernet Interface
@{
*/
/** WAN Port Number*/
#define ONU_NET_NETDEV_WAN_PORT 0
/** LAN Port#0 Number*/
#define ONU_NET_NETDEV_LAN0_PORT 1
/** LAN Port#1 Number*/
#define ONU_NET_NETDEV_LAN1_PORT 2
/** LAN Port#2 Number*/
#define ONU_NET_NETDEV_LAN2_PORT 3
/** LAN Port#3 Number*/
#define ONU_NET_NETDEV_LAN3_PORT 4
/** WAN/LAN Exception Port Number*/
#define ONU_NET_NETDEV_EXC_PORT 5
/** Maximum netdev ports*/
#define ONU_NET_MAX_NETDEV_PORT 6
enum net_cb_type {
NET_CB_NA = -1,
/**
Rx Callback*/
NET_CB_RX = 0,
/**
LAN Link Status Callback*/
NET_CB_LAN_STATUS = 1,
/**
WAN Link Status Callback*/
NET_CB_WAN_STATUS = 2,
/**
Delimeter only*/
NET_CB_MAX
};
#define ONU_NET_MAX_CB_NUM NET_CB_MAX
struct net_cb {
void *net_dev;
void *cb[ONU_NET_MAX_CB_NUM];
};
struct net_buf {
void *skb;
uint8_t *data;
uint32_t len;
};
typedef int (*onu_net_rx_cb_t) (void *handle, struct net_buf *buf);
typedef int (*onu_wan_status_cb_t) (void *handle, const bool link_up);
typedef int (*onu_lan_status_cb_t) (void *handle, const uint8_t lan_port,
const bool link_up);
typedef int (*onu_net_buf_alloc_t) (const uint32_t len, struct net_buf *buf);
struct net_dev {
onu_net_buf_alloc_t onu_net_buf_alloc;
};
/**
Register a callback list for the specified Netdev port number.
\note The callback will be called in interrupt context.
\param netdev_port Netdev port number
\param list Callback list.
\return
- -1 error
- 0 success
*/
int net_cb_list_register(const uint8_t netdev_port, struct net_cb *list);
/** \todo add description
*/
int net_dev_register(struct net_dev *dev);
/** \todo add description
*/
int net_lan_mac_set(const uint8_t *mac);
/** \todo add description
*/
uint8_t net_lan_max_port_get(void);
/** \todo add description
*/
int net_egress_cpu_port_get(const uint8_t netdev_port);
/** \todo add description
*/
int net_port_get(const uint8_t uni);
/** \todo add description
*/
int net_uni_get(const uint8_t netdev_port);
/**
Enable Rx interrupt for the specified Netdev port number.
\param netdev_port Netdev port number
\param enable If true the RX interrupt will be enabled.
\return
- -1 error
- 0 success
*/
int net_rx_enable(const uint8_t netdev_port, const bool enable);
/**
Retrieve received Ethernet PDU information.
\param cpu_egress_port CPU egress port number
\param info PDU info
\return
- -1 error
- 0 success
*/
int net_pdu_info_get(const uint8_t cpu_egress_port, struct onu_pdu_info *info);
/**
Write an Ethernet frame to the specified Netdev port. This function use
the packet engine.
\param netdev_port Netdev port number
\param plen data length
\param data Ethernet frame (not padded, no FCS)
\return
- -1 error
- 0 success
*/
int net_pdu_write(const uint8_t netdev_port, const uint32_t plen,
const uint8_t *data);
/**
Read an Ethernet frame. This function use the packet engine.
\param info PDU info
\param data Ethernet frame (not padded, no FCS)
\return
- -1 error
- 0 success
*/
int net_pdu_read(const struct onu_pdu_info *info, uint8_t *data);
/*! @} */
/*! @} */
#endif /* SWIG */
EXTERN_C_END
#endif

2114
src/drv_onu_linux.c Normal file

File diff suppressed because it is too large Load Diff

2234
src/drv_onu_ll_cop.c Normal file

File diff suppressed because it is too large Load Diff

459
src/drv_onu_ll_cop.h Normal file
View File

@ -0,0 +1,459 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_ll_cop_h
#define _drv_onu_ll_cop_h
struct onu_device;
/** \addtogroup ONU_LL_REFERENCE GPON Low-level Functions
The following chapters describe the low-level functions that are used to
access the GPON-related hardware modules of the device.
@{
*/
/** \addtogroup ONU_LL_COP Hardware Coprocessor Low-level Functions
Low-level functions to access the hardware coprocessors within the GPON
Packet Engine (GPE) hardware module.
@{
*/
#include "drv_onu_gpe_tables.h"
#define ONU_COP_BUGFIX
/* #define ONU_COP_USE_COP_LOADER_RAM_INIT */
/* #define ONU_COP_FLIP_DUMPS */
/* LINKC1 command request protocol definitions */
#define LINKC1_HEADER_SIZE 1
#define LINKC1_INDEX_OFFSET 0
#define LINKC1_INDEX_MSK 0x3FF
#define LINKC1_OFF_OFFSET 10
#define LINKC1_OFF_MSK 0x3
#define LINKC1_NIL_OFFSET 11
#define LINKC1_NIL_MSK 0x1
#define LINKC1_TABLE_OFFSET 12
#define LINKC1_CMD_OFFSET 16
#define LINKC1_TID_OFFSET 20
#define LINKC1_COPID_OFFSET 27
#define LINKC1_LEN_OFFSET 0
/* LINKC1 command request/response timeout */
#define LINK_TIMEOUT 1000
/* LINKC1 request protocol commands */
#define LINKC1_READ 0x0
#define LINKC1_CLEAR 0x1
#define LINKC1_WRITE 0x2
#define LINKC1_COUNT 0x3
#define LINKC1_SEARCHR 0x1
#define LINKC1_SEARCH 0x8
#define LINKC1_REMOVE 0x9
#define LINKC1_ADD 0xA
#define LINKC1_SEARCHW 0xB
#define LINKC1_EXEC 0xC
/* LINKC2 command response protocol definitions */
#define LINKC2_HEADER_SIZE 2
#define LINKC2_ERR_OFFSET 16
#define LINKC2_ERR_MASK 0x70000
#define LINKC2_TIMESTAMP_OFFSET 24
#define LINKC2_TIMESTAMP_MASK 0xFF
#define LINKC2_RES_MASK 0x80000
/* Local used thread IDs for LINK communication */
#define TID_CPU33 0x7F
#define TID_CPU32 0x7E
#define TID_CPU31 0x7D
/* COP Table type definitions */
#define ONU_GPE_COP_ARRAY 0
#define ONU_GPE_COP_VARRAY 1
#define ONU_GPE_COP_LIST 2
#define ONU_GPE_COP_LLIST 3
#define ONU_GPE_COP_HASH 4
#define ONU_GPE_COP_BITVECT 6
#define ONU_GPE_COP_STRUCT 7
#define ONU_GPE_COP_UNDEF 15
/* API level commands */
#define ONU_GPE_COP_DC -1 /* don't care, used for PE */
#define ONU_GPE_COP_SET 0
#define ONU_GPE_COP_ADD 1
#define ONU_GPE_COP_DELETE 2
#define ONU_GPE_COP_READ 3
#define ONU_GPE_COP_WRITE 4
#define ONU_GPE_COP_GET 5
#define ONU_GPE_COP_SEARCH 8
#define ONU_GPE_COP_TABLE0W 0x14
#define ONU_GPE_COP_TABLE0R 0x13
#define ONU_GPE_COP_EXEC 0xC
/* Logical COP microcode label IDs, based on COP loader toolchain */
#define IF_NONE 0
#define IF_FWD_AGE 1
#define IF_FWD_FORWARD 2
#define IF_FWD_RELEARN 3
#define IF_FWD_ADD 4
#define IF_FWD_REMOVE 5
#define IF_TAG_FILTER 6
#define IF_IPV6_FORWARD 7
#define IF_IPV4_SEARCH 8
#define IF_VLAN_TRANSLATE 9
#define IF_FID_LOOKUP 10
#define IF_FID_SEARCH 11
#define IF_UPGEM_SEARCHR 12
#define IF_FID_GET_PREVIOUS 13
#define IF_FID_REMOVE 14
#define IF_IPV6HASH_SEARCHR 15
#define IF_FIDHASH_SEARCHR 16
#define IF_IPV4_SEARCHW 17
#define IF_ETHFILT_SEARCHW 18
#define IF_LABEL_MAX 19
/* LINKC1 request protocol commands for table type control fields */
#define ONU_GPE_COP_VALID_POS 31
#define ONU_GPE_COP_VALID_MSK 0x1
#define ONU_GPE_COP_END_POS 30
#define ONU_GPE_COP_END_MSK 0x1
#define ONU_GPE_COP_NEXT_POS 16
#define ONU_GPE_COP_NEXT_MSK 0x3FFF
/* LINKC1 request protocol commands for debugging messages */
#define ONU_GPE_COP_DBGPC_POS 0
#define ONU_GPE_COP_DBGPC_MSK 0x7F
#define ONU_GPE_COP_DBGNEXT_POS 8
#define ONU_GPE_COP_DBGNEXT_MSK 0x3FF
#define ONU_GPE_COP_DBGPREV_POS 18
#define ONU_GPE_COP_DBGPREV_MSK 0x3FF
#define ONU_GPE_COP_DBGERR_POS 28
#define ONU_GPE_COP_DBGERR_MSK 0x7
#define ONU_GPE_COP_DBGRES2_POS 31
#define ONU_GPE_COP_DBGRES2_MSK 0x1
#define ONU_GPE_COP_DBGOFF_POS 10
#define ONU_GPE_COP_DBGOFF_MSK 0x3
#define ONU_GPE_COP_COPID_POS LINKC1_COPID_OFFSET
#define ONU_GPE_COP_COPID_MSK 0x1F
#define ONU_GPE_COP_TID_POS LINKC1_TID_OFFSET
#define ONU_GPE_COP_TID_MSK 0x7F
#define ONU_GPE_COP_TABLE_POS LINKC1_TABLE_OFFSET
#define ONU_GPE_COP_TABLE_MSK 0xF
#define ONU_GPE_COP_INDEX_POS LINKC1_INDEX_OFFSET
#define ONU_GPE_COP_INDEX_MSK LINKC1_INDEX_MSK
#define ONU_GPE_COP_NIL_POS LINKC1_NIL_OFFSET
#define ONU_GPE_COP_NIL_MSK 0x1
#define ONU_GPE_COP_ERR_POS LINKC2_ERR_OFFSET
#define ONU_GPE_COP_ERR_MSK 0x7
#define ONU_GPE_COP_RESULT_POS 19
#define ONU_GPE_COP_RESULT_MSK 0x1
#define ONU_GPE_COP_CMD_POS LINKC1_CMD_OFFSET
#define ONU_GPE_COP_CMD_MSK 0xF
/* COP message protocol definitions */
#define ONU_GPE_COP_DATASIZE_MAX 10
#define ONU_GPE_COP_CMDSIZE_MAX 2
/* Maximum number of labels at one COP, based on COP loader toolchain */
#define ONU_GPE_COP_LABEL_MAX 10
/* Maximum number of ALL labels togehter */
#define ONU_GPE_ALL_COP_LABEL_MAX 25
/* Maximum string size for one COP label */
#define ONU_GPE_COP_LABEL_STR_SIZE_MAX 32
/* Shift factor handling for LIST Mgmt A21 */
#define ONU_GPE_LIST_NIL_SHIFTFACTOR 5
#define ONU_GPE_LIST_NIL_WORDSIZE (1 << ONU_GPE_LIST_NIL_SHIFTFACTOR)
/* Defines used for table entry age calculation */
#define ONU_GPE_COP_AGE_MAX 56160
#define ONU_GPE_COP_PSCALE_FAC_SET 298
#define ONU_GPE_COP_PSCALE_FAC_GET 110
#define ONU_GPE_COP_PSCALE_DIV_SET 256
#define ONU_GPE_COP_PSCALE_DIV_GET 128
/* Local strings for dump routines */
#define LINK2 "[LNK2] "
#define COP "[COP ] "
extern uint32_t onu_gpe_cop_entrysize[4];
extern uint32_t onu_gpe_cop_keysize[8];
/** Hardware coprocessor label mapping.
* Used to map logical IDs to physical function address pointers.
*/
typedef struct {
/** COP id of the microcode label */
uint32_t cop_id;
/** Physical function address pointer */
uint32_t func_addr;
/** Label name for debugging purposes */
char label_name[32];
} labelmapping_t;
/** Hardware coprocessor operation status */
enum cop_errorcode {
/** No error and no result */
COP_STATUS_OK = 0,
/** INDEX points beyond table size or was invalid,
e.g. after INDEX = AUX */
COP_STATUS_INVALID_INDEX = 1,
/** A sequential search has hit the end of table without having
found a match */
COP_STATUS_END_OF_TABLE = 2,
/** An ADD command to an LLIST failed because the free list was
empty (invalid AUX pointer) */
COP_STATUS_OUT_OF_MEMORY = 3,
/** An ADD command with OV=0 to a LIST or LLIST failed because there
is already an entry with the same key */
COP_STATUS_ENTRY_EXISTS = 4,
/** Controlled by External_0 */
COP_STATUS_ERROR_DISCARD_FRAME = 5,
/** Controlled by Microcode */
COP_STATUS_SOFT_ERR_1 = 6,
/** Controlled by Microcode */
COP_STATUS_SOFT_ERR_2 = 7,
/** A COP result was found */
COP_STATUS_SUCCESS = 8,
/* Any kind of generic error */
COP_STATUS_ERR = 16,
/* No response during a COP read command */
COP_STATUS_TIMEOUT = 32,
/* a receive flush error */
COP_STATUS_ERR_FLUSH = 64,
/* an initialization error */
COP_INIT_ERR = 128
};
/** Hardware coprocessor communication protocol formats
*/
enum format {
/** command: ADD, SEARCHW, etc */
COP_FRM_FORMAT1 = 0,
/** command: WRTIE */
COP_FRM_FORMAT2 = 1
};
/** Data to be sent to or received from a hardware coprocessor.
*/
struct cop_message {
/** Data length in 32-bit units */
uint8_t request_length;
/** Data length, in 32-bit units */
uint8_t response_length;
/** Data, maximum size of data is 8x32 (256bit data) + header */
uint32_t data[ONU_GPE_COP_DATASIZE_MAX];
/** Command fields */
uint32_t command[ONU_GPE_COP_CMDSIZE_MAX];
/** Command format */
enum format format;
};
#ifdef INCLUDE_COP_DEBUG
/**
Debug function which activates the trace mode at a hardware coprocessor.
\param cop_id The coprocessor ID
\param trace_enable The trace mode
*/
enum cop_errorcode cop_debug_set(const uint8_t cop_id,
const uint32_t trace_enable);
#endif
#ifdef INCLUDE_COP_DEBUG
/**
Debug function which delivers the trace mode at a hardware coprocessor.
\param cop_id The coprocessor ID
\return The trace mode
*/
uint32_t cop_debug_get(const uint8_t cop_id);
#endif
#ifdef INCLUDE_COP_DEBUG
/**
Debug function which send a single step during activated trace mode.
\param cop_id The coprocessor ID
*/
void cop_debug_step(const uint32_t cop_id);
#endif
#ifdef INCLUDE_COP_DEBUG
/**
Debug function which prints trace messages to console as long as trace mode
is activated.
\param stepcnt The amount of steps the server should perform on the
traced function
\param cop_mask Defines from which COP trace messages shall be printed
*/
void cop_debug_server(const uint32_t stepcnt, const uint32_t cop_mask);
#endif
#ifdef INCLUDE_COP_DEBUG
/**
Debug function which receives a trace message.
\param temp0 First data word of trace message
\param temp1 Second data word of trace message
*/
enum cop_errorcode cop_debug_receive(uint32_t temp0, uint32_t temp1);
#endif
#ifdef INCLUDE_COP_DEBUG
/**
Debug function which prints the disassembled microcode during hardware
coprocessor table dumps.
\param instr Instruction to be disassembled
\param opcode Disassembled opcode string of instruction
\param len Length of opcode string buffer
*/
void cop_debug_disassembly(uint16_t instr, char *opcode, uint32_t len);
#endif
/**
Debug function to read out TABLE0 registers settings
\param entry Table entry
*/
enum cop_errorcode cop_table0_read(struct gpe_table_entry *entry);
/**
Initialize the hardware coprocessor microcode
Load the code and data memories of all COP elements.
*/
enum cop_errorcode cop_init(struct onu_device *p_dev);
/**
Initialize the hardware coprocessor tables
*/
enum cop_errorcode cop_table_init(uint32_t from_table_id, uint32_t to_table_id);
/**
Initial preparation of hardware coprocessor CRAM.
*/
enum cop_errorcode cop_code_set(struct onu_device *p_dev);
/**
Initial preparation of hardware coprocessor DRAM.
*/
enum cop_errorcode cop_cfg_set(void);
/**
Handle send and receive message during COP communication.
\param message A hardware coprocessor message handle
*/
enum cop_errorcode cop_message(struct cop_message *message);
/**
Send a message to a hardware coprocessor.
\param message A hardware coprocessor message handle
*/
enum cop_errorcode cop_message_send(const struct cop_message *message);
/**
Receive a message from a hardware coprocessor.
\param message A hardware coprocessor message handle
*/
enum cop_errorcode cop_message_receive(struct cop_message *message);
/**
Table access function which writes a specific hardware coprocessor
table entry.
\param table_data Table entry data
\param cmd COP command (WRITE, SEARCHW, etc.)
*/
enum cop_errorcode cop_table_entry_write(struct gpe_table_entry *table_data,
uint32_t cmd);
/**
Table access function which reads a specific table entry.
\param table_data Table entry data
\param cmd COP command (WRITE, SEARCHW, etc.)
*/
enum cop_errorcode cop_table_entry_read(struct gpe_table_entry *table_data,
uint32_t cmd);
/**
Table access function which adds a specific table entry.
\param table_data Table entry data
\param key_len Key length in amount of 32-bit words
*/
enum cop_errorcode cop_table_entry_add(struct gpe_table_entry *table_data,
const uint32_t key_len,
const bool nil);
/**
Table access function which deletes a specific table entry.
\param table_data Table entry data
\param key_len Key length in amount of 32-bit words
*/
enum cop_errorcode cop_table_entry_delete(struct gpe_table_entry *table_data,
const uint32_t key_len);
/**
Table access function which searches a specific table entry.
\param table_data Table entry data
\param key_len Key length in amount of 32-bit words
*/
enum cop_errorcode cop_table_entry_searchw(struct gpe_table_entry *table_data,
const uint32_t key_len);
/**
Table access function which searches a specific table entry and
deliver its content.
\param table_data Table entry data
\param key_len Key length in amount of 32-bit words
*/
enum cop_errorcode cop_table_entry_searchr(struct gpe_table_entry *table_data,
const uint32_t key_len);
/**
Table access function which searches a specific table entry and
deliver its index only.
\param table_data Table entry data
\param key_len Key length in amount of 32-bit words
*/
enum cop_errorcode cop_table_entry_search(struct gpe_table_entry *table_data,
const uint32_t key_len);
/**
Table access function which execute microcode on a table.
\param entry Table entry data
\param key_len Key length in amount of 32-bit words
\param instruction Microcode label for instruction
*/
enum cop_errorcode cop_table_entry_exec(struct gpe_table_entry *entry,
const uint32_t key_len,
const uint32_t instruction);
/** Get COP table size in bytes
\param cop_id The coprocessor ID
\param table_id The table ID
\return Table entry size in amount of 32-bit words
*/
uint32_t cop_table_size_get(uint32_t cop_id, uint32_t table_id);
extern char mc_version_string[ONU_GPE_NUMBER_OF_COP][256];
/*! @} */
/*! @} */
#endif

773
src/drv_onu_ll_eim.c Normal file
View File

@ -0,0 +1,773 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#include "drv_onu_api.h"
#include "drv_onu_lan_api.h"
#include "drv_onu_register.h"
#include "drv_onu_lan_interface.h"
#include "drv_onu_ll_eim.h"
/* time to wait for disabling phy auto-polling */
#define AUTOPOLL_DISABLE_TIME 20
/* The eim_mdio_data_read function provides read access to an external or
internal Ethernet PHY.
*/
/** Hardware Programming Details
Parameter list:
- addr_dev: selected device address
- addr_reg: selected register address
- data : read data
Trigger a read access by writing to the MDIO control register (MAC_HEADER):
MAC_HEADER.TA = 00
MAC_HEADER.REGADR = addr_dev
MAC_HEADER.PHYAD = addr_reg
MAC_HEADER.OP = 10 - this is a read access
MAC_HEADER.ST = 01 - always the same
MAC_HEADER.RW = 1 - this is a read access
MAC_HEADER.START_TX = 1 - start the access
Wait until the data word is available:
while(ISTAT.INT_MAC == 0) {};
Read the received 16-bit data word:
data = MAC_DATA.DATA[15:0]
*/
int eim_mdio_data_read(const uint8_t addr_dev, const uint8_t addr_reg,
uint16_t *data)
{
uint32_t cnt;
if (is_falcon_chip_a1x()) {
uint32_t cfg = EIM_MAC_HEADER_RW_READ | EIM_MAC_HEADER_START_TX;
uint32_t val;
set_val(cfg, 1, EIM_MAC_HEADER_ST_MASK, EIM_MAC_HEADER_ST_OFFSET);
set_val(cfg, 2, EIM_MAC_HEADER_OP_MASK, EIM_MAC_HEADER_OP_OFFSET);
set_val(cfg, addr_dev, EIM_MAC_HEADER_PHYAD_MASK,
EIM_MAC_HEADER_PHYAD_OFFSET);
set_val(cfg, addr_reg, EIM_MAC_HEADER_REGAD_MASK,
EIM_MAC_HEADER_REGAD_OFFSET);
cnt = 100;
eim_a1x_w32(EIM_ISTAT_INT_MAC, mdio_mac_pdi.istat);
while (cnt
&& ((eim_a1x_r32(mdio_mac_pdi.istat) & EIM_ISTAT_INT_MAC) ==
EIM_ISTAT_INT_MAC)) {
cnt--;
onu_udelay(10);
}
if (cnt == 0)
return -1;
cnt = 100;
eim_a1x_w32(cfg, mdio_mac_pdi.mac_header);
while (cnt && ((eim_a1x_r32(mdio_mac_pdi.istat) &
EIM_ISTAT_INT_MAC) == 0)) {
cnt--;
onu_udelay(10);
}
if (cnt == 0)
return -2;
/* *data = (eim_a1x_r32(mdio_mac_pdi.mac_data) & EIM_MAC_DATA_DATA_MASK); */
val = eim_a1x_r32(mdio_mac_pdi.startup);
if ((addr_dev != get_val(val, EIM_STARTUP_PRTAD_MASK,
EIM_STARTUP_PRTAD_OFFSET)) ||
(addr_reg != get_val(val, EIM_STARTUP_DEVAD_MASK,
EIM_STARTUP_DEVAD_OFFSET)) ) {
ONU_DEBUG_ERR("MDIO Bus Error: sent %X/%X, read %X/%X",
addr_dev, addr_reg,
get_val(val, EIM_STARTUP_PRTAD_MASK,
EIM_STARTUP_PRTAD_OFFSET),
get_val(val, EIM_STARTUP_DEVAD_MASK,
EIM_STARTUP_DEVAD_OFFSET) );
}
*data = get_val(val, EIM_STARTUP_DATA_MASK, EIM_STARTUP_DATA_OFFSET);
} else if (is_falcon_chip_a2x()) {
cnt = 100;
while (cnt && eim_a2x_r32(mdio_pdi.mdio_ctrl) & EIM_MDIO_CTRL_MBUSY) {
cnt--;
onu_udelay(10);
}
if (cnt == 0)
return -1;
eim_a2x_w32(EIM_MDIO_CTRL_OP_RD | EIM_MDIO_CTRL_MBUSY_BUSY |
((addr_dev << EIM_MDIO_CTRL_PHYAD_OFFSET) & EIM_MDIO_CTRL_PHYAD_MASK) |
((addr_reg << EIM_MDIO_CTRL_REGAD_OFFSET) & EIM_MDIO_CTRL_REGAD_MASK),
mdio_pdi.mdio_ctrl);
cnt = 100;
while (cnt && eim_a2x_r32(mdio_pdi.mdio_ctrl) & EIM_MDIO_CTRL_MBUSY) {
cnt--;
onu_udelay(10);
}
if (cnt == 0)
return -1;
*data = eim_a2x_r32(mdio_pdi.mdio_read) & EIM_MDIO_READ_RDATA_MASK;
} else
return -1;
return 0;
}
/**
Write MDIO register.
*/
int eim_mdio_data_write(const uint8_t addr_dev, const uint8_t addr_reg,
const uint16_t data)
{
uint32_t cnt;
if (is_falcon_chip_a1x()) {
uint32_t cfg = EIM_MAC_HEADER_START_TX;
uint32_t val;
set_val(cfg, 1, EIM_MAC_HEADER_ST_MASK, EIM_MAC_HEADER_ST_OFFSET);
set_val(cfg, 1, EIM_MAC_HEADER_OP_MASK, EIM_MAC_HEADER_OP_OFFSET);
set_val(cfg, addr_dev, EIM_MAC_HEADER_PHYAD_MASK,
EIM_MAC_HEADER_PHYAD_OFFSET);
set_val(cfg, addr_reg, EIM_MAC_HEADER_REGAD_MASK,
EIM_MAC_HEADER_REGAD_OFFSET);
eim_a1x_w32(data, mdio_mac_pdi.mac_data);
/*eim_a1x_w32(data, mdio_mac_pdi.startup); */
cnt = 100;
eim_a1x_w32(EIM_ISTAT_INT_MAC, mdio_mac_pdi.istat);
while (cnt
&& ((eim_a1x_r32(mdio_mac_pdi.istat) & EIM_ISTAT_INT_MAC) ==
EIM_ISTAT_INT_MAC)) {
cnt--;
onu_udelay(10);
}
if (cnt == 0)
return -1;
eim_a1x_w32(cfg, mdio_mac_pdi.mac_header);
while (cnt && ((eim_a1x_r32(mdio_mac_pdi.istat) &
EIM_ISTAT_INT_MAC) == 0)) {
cnt--;
onu_udelay(10);
}
if (cnt == 0)
return -2;
val = eim_a1x_r32(mdio_mac_pdi.startup);
if ((addr_dev != get_val(val, EIM_STARTUP_PRTAD_MASK,
EIM_STARTUP_PRTAD_OFFSET)) ||
(addr_reg != get_val(val, EIM_STARTUP_DEVAD_MASK,
EIM_STARTUP_DEVAD_OFFSET)) ) {
ONU_DEBUG_ERR("MDIO Bus Error: sent %X/%X, read %X/%X",
addr_dev, addr_reg,
get_val(val, EIM_STARTUP_PRTAD_MASK,
EIM_STARTUP_PRTAD_OFFSET),
get_val(val, EIM_STARTUP_DEVAD_MASK,
EIM_STARTUP_DEVAD_OFFSET) );
}
} else if (is_falcon_chip_a2x()) {
cnt = 100;
while (cnt && eim_a2x_r32(mdio_pdi.mdio_ctrl) & EIM_MDIO_CTRL_MBUSY) {
cnt--;
onu_udelay(10);
}
if (cnt == 0)
return -1;
eim_a2x_w32(data & EIM_MDIO_WRITE_WDATA_MASK, mdio_pdi.mdio_write);
eim_a2x_w32(EIM_MDIO_CTRL_OP_WR | EIM_MDIO_CTRL_MBUSY_BUSY |
((addr_dev << EIM_MDIO_CTRL_PHYAD_OFFSET) & EIM_MDIO_CTRL_PHYAD_MASK) |
((addr_reg << EIM_MDIO_CTRL_REGAD_OFFSET) & EIM_MDIO_CTRL_REGAD_MASK),
mdio_pdi.mdio_ctrl);
cnt = 100;
while (cnt && eim_a2x_r32(mdio_pdi.mdio_ctrl) & EIM_MDIO_CTRL_MBUSY) {
cnt--;
onu_udelay(10);
}
if (cnt == 0)
return -1;
} else
return -1;
return 0;
}
/* the phy_id is matching the first 4 gmac_mux_mode values! */
void eim_gphy_cfg_addr_set(const uint8_t phy_id, const uint8_t phy_addr)
{
static const uint32_t mask[] = {EIM_GPHY_CFG_ADDR_PHYADR1_MASK,
EIM_GPHY_CFG_ADDR_PHYADR2_MASK,
EIM_GPHY_CFG_ADDR_PHYADR1_MASK,
EIM_GPHY_CFG_ADDR_PHYADR2_MASK};
static const uint8_t offset[] = {EIM_GPHY_CFG_ADDR_PHYADR1_OFFSET,
EIM_GPHY_CFG_ADDR_PHYADR2_OFFSET,
EIM_GPHY_CFG_ADDR_PHYADR1_OFFSET,
EIM_GPHY_CFG_ADDR_PHYADR2_OFFSET};
if (phy_id >= 4)
return;
eim_w32_mask (mask[phy_id],
phy_addr << offset[phy_id],
top_pdi.gphy_cfg_addr[phy_id >> 1]);
}
uint8_t eim_gphy_cfg_addr_get(const uint8_t phy_id)
{
static const uint8_t offset[] = {EIM_GPHY_CFG_ADDR_PHYADR1_OFFSET,
EIM_GPHY_CFG_ADDR_PHYADR2_OFFSET,
EIM_GPHY_CFG_ADDR_PHYADR1_OFFSET,
EIM_GPHY_CFG_ADDR_PHYADR2_OFFSET};
if (phy_id >= 4)
return (uint8_t)ONU_LAN_MDIO_ADDR_NULL;
return (uint8_t)((eim_r32(top_pdi.gphy_cfg_addr[phy_id >> 1]) >>
offset[phy_id]) & EIM_GPHY_CFG_ADDR_PHYADR1_MASK);
}
void eim_phy_addr_set(const uint8_t uni_port_id, const uint8_t phy_addr)
{
#ifdef CONFIG_WITH_FALCON_A2X
if (is_falcon_chip_a2x()) {
eim_a2x_w32_mask(EIM_PHY_ADDR_ADDR_MASK, phy_addr,
mdio_pdi.phy_addr[uni_port_id]);
}
#endif
}
int eim_phy_autopoll_enable_set(const uint8_t uni_port_id, const bool enable)
{
#ifdef CONFIG_WITH_FALCON_A2X
uint32_t cfg;
if (uni_port_id >= ONU_GPE_MAX_ETH_UNI)
return -1;
if (is_falcon_chip_a2x()) {
cfg = EIM_MDC_CFG_0_PEN_0 << uni_port_id;
eim_a2x_w32_mask(cfg, enable ? cfg : 0, mdio_pdi.mdc_cfg_0);
}
#endif
return 0;
}
int eim_phy_autopoll_enable_get(const uint8_t uni_port_id, bool *enable)
{
#ifdef CONFIG_WITH_FALCON_A2X
if (uni_port_id >= ONU_GPE_MAX_ETH_UNI)
return -1;
if (is_falcon_chip_a2x()) {
*enable = eim_a2x_r32(mdio_pdi.mdc_cfg_0) &
(EIM_MDC_CFG_0_PEN_0<< uni_port_id) ? true : false;
return 0;
} else
return -1;
#else
return -1;
#endif
}
#ifdef CONFIG_WITH_FALCON_A2X
int eim_phy_autopoll_force_current(const uint8_t phy_addr, uint8_t *port_id,
uint32_t *restore)
{
uint8_t id;
uint32_t mdio_stat_reg, phy_addr_reg;
if (!is_falcon_chip_a2x() || !port_id || !restore)
return -1;
for (id=0; id < ONU_GPE_MAX_ETH_UNI; id++) {
/* check if polling is active */
if (!(eim_a2x_r32(mdio_pdi.mdc_cfg_0) & (EIM_MDC_CFG_0_PEN_0 << id)))
continue;
phy_addr_reg = eim_a2x_r32(mdio_pdi.phy_addr[id]);
/* check for address to be polled */
if ((phy_addr_reg & EIM_PHY_ADDR_ADDR_MASK) != phy_addr)
continue;
*port_id = id;
*restore = phy_addr_reg;
mdio_stat_reg = eim_a2x_r32(mdio_pdi.mdio_stat[id]);
/* PHY active Status */
if ( (mdio_stat_reg & EIM_MDIO_STAT_PACT) ==
EIM_MDIO_STAT_PACT_ACTIVE) {
unsigned temp=0;
/* Link Status */
if ( (mdio_stat_reg & EIM_MDIO_STAT_LSTAT) ==
EIM_MDIO_STAT_LSTAT_UP) {
phy_addr_reg &= EIM_PHY_ADDR_ADDR_MASK;
phy_addr_reg |= EIM_PHY_ADDR_LNKST_UP;
temp = ( (mdio_stat_reg & EIM_MDIO_STAT_SPEED_MASK)
>> EIM_MDIO_STAT_SPEED_OFFSET);
phy_addr_reg |= (temp << EIM_PHY_ADDR_SPEED_OFFSET)
& EIM_PHY_ADDR_SPEED_MASK;
if ((mdio_stat_reg & EIM_MDIO_STAT_FDUP) ==
EIM_MDIO_STAT_FDUP_FULL)
phy_addr_reg |= EIM_PHY_ADDR_FDUP_EN;
else
phy_addr_reg |= EIM_PHY_ADDR_FDUP_DIS;
if ((mdio_stat_reg & EIM_MDIO_STAT_RXPAUEN) ==
EIM_MDIO_STAT_RXPAUEN_EN)
phy_addr_reg |= EIM_PHY_ADDR_FCONRX_EN;
else
phy_addr_reg |= EIM_PHY_ADDR_FCONRX_DIS;
if ((mdio_stat_reg & EIM_MDIO_STAT_TXPAUEN) ==
EIM_MDIO_STAT_TXPAUEN_EN)
phy_addr_reg |= EIM_PHY_ADDR_FCONTX_EN;
else
phy_addr_reg |= EIM_PHY_ADDR_FCONTX_DIS;
eim_a2x_w32(phy_addr_reg, mdio_pdi.phy_addr[id]);
}
}
/* disable auto-polling */
eim_a2x_w32_mask(EIM_MDC_CFG_0_PEN_0 << id, 0, mdio_pdi.mdc_cfg_0);
onu_udelay(AUTOPOLL_DISABLE_TIME);
return 0;
}
return -1;
}
void eim_phy_autopoll_restore_settings(uint8_t port_id, uint32_t restore)
{
if (is_falcon_chip_a2x()) {
/* enable auto-polling */
eim_a2x_w32_mask(0, EIM_MDC_CFG_0_PEN_0 << port_id,
mdio_pdi.mdc_cfg_0);
eim_a2x_w32(restore, mdio_pdi.phy_addr[port_id]);
}
}
int eim_phy_autopoll_status_get(uint8_t port_id, uint32_t *mdio_stat)
{
if (port_id >= ONU_GPE_MAX_ETH_UNI || !mdio_stat)
return -1;
*mdio_stat = eim_a2x_r32(mdio_pdi.mdio_stat[port_id]);
return 0;
}
#endif /* CONFIG_WITH_FALCON_A2X */
int eim_short_preamble_enable_set(const uint8_t uni_port_id, const bool enable)
{
if (uni_port_id >= ONU_GPE_MAX_ETH_UNI)
return -1;
eim_w32_mask(EIM_MAC_CTRL_1_SHORTPRE,
enable ? 1 : 0,
mac_pdi[uni_port_id].ctrl_1);
return 0;
}
int eim_short_preamble_enable_get(const uint8_t uni_port_id, bool *enable)
{
if (uni_port_id >= ONU_GPE_MAX_ETH_UNI)
return -1;
*enable = eim_r32(mac_pdi[uni_port_id].ctrl_1) &
EIM_MAC_CTRL_1_SHORTPRE ? true : false;
return 0;
}
int eim_flow_ctrl_set(const uint8_t port_id,
const enum lan_mode_flow_control mode)
{
uint32_t cfg;
if (port_id >= ONU_GPE_MAX_ETH_UNI)
return -1;
if (is_falcon_chip_a1x()) {
switch (mode) {
case LAN_FLOW_CONTROL_MODE_AUTO:
cfg = EIM_MAC_CTRL_0_FCON_AUTO;
break;
case LAN_FLOW_CONTROL_MODE_RX:
cfg = EIM_MAC_CTRL_0_FCON_RX;
break;
case LAN_FLOW_CONTROL_MODE_TX:
cfg = EIM_MAC_CTRL_0_FCON_TX;
break;
case LAN_FLOW_CONTROL_MODE_RXTX:
cfg = EIM_MAC_CTRL_0_FCON_RXTX;
break;
case LAN_FLOW_CONTROL_MODE_NONE:
cfg = EIM_MAC_CTRL_0_FCON_NONE;
break;
default:
return -1;
}
eim_w32_mask(EIM_MAC_CTRL_0_FCON_MASK, cfg, mac_pdi[port_id].ctrl_0);
}
if (is_falcon_chip_a2x()) {
switch (mode) {
case LAN_FLOW_CONTROL_MODE_AUTO:
cfg = EIM_PHY_ADDR_FCONTX_AUTO | EIM_PHY_ADDR_FCONRX_AUTO;
break;
case LAN_FLOW_CONTROL_MODE_RX:
cfg = EIM_PHY_ADDR_FCONTX_DIS | EIM_PHY_ADDR_FCONRX_EN;
break;
case LAN_FLOW_CONTROL_MODE_TX:
cfg = EIM_PHY_ADDR_FCONTX_EN | EIM_PHY_ADDR_FCONRX_DIS;
break;
case LAN_FLOW_CONTROL_MODE_RXTX:
cfg = EIM_PHY_ADDR_FCONTX_EN | EIM_PHY_ADDR_FCONRX_EN;
break;
case LAN_FLOW_CONTROL_MODE_NONE:
cfg = EIM_PHY_ADDR_FCONTX_DIS | EIM_PHY_ADDR_FCONRX_DIS;
break;
default:
return -1;
}
eim_a2x_w32_mask(EIM_PHY_ADDR_FCONTX_MASK |
EIM_PHY_ADDR_FCONRX_MASK,
cfg,
mdio_pdi.phy_addr[port_id]);
}
return 0;
}
int eim_duplex_mode_set(const uint8_t port_id, const enum lan_mode_duplex mode)
{
uint32_t cfg;
if (port_id >= ONU_GPE_MAX_ETH_UNI)
return -1;
if (is_falcon_chip_a1x()) {
switch (mode) {
case LAN_PHY_MODE_DUPLEX_AUTO:
cfg = EIM_MAC_CTRL_0_FDUP_AUTO;
break;
case LAN_PHY_MODE_DUPLEX_FULL:
cfg = EIM_MAC_CTRL_0_FDUP_EN;
break;
case LAN_PHY_MODE_DUPLEX_HALF:
cfg = EIM_MAC_CTRL_0_FDUP_DIS;
break;
default:
return -1;
}
eim_w32_mask(EIM_MAC_CTRL_0_FDUP_MASK, cfg, mac_pdi[port_id].ctrl_0);
}
if (is_falcon_chip_a2x()) {
switch (mode) {
case LAN_PHY_MODE_DUPLEX_AUTO:
cfg = EIM_PHY_ADDR_FDUP_AUTO;
break;
case LAN_PHY_MODE_DUPLEX_FULL:
cfg = EIM_PHY_ADDR_FDUP_EN;
break;
case LAN_PHY_MODE_DUPLEX_HALF:
cfg = EIM_PHY_ADDR_FDUP_DIS;
break;
default:
return -1;
}
eim_a2x_w32_mask(EIM_PHY_ADDR_FDUP_MASK, cfg,
mdio_pdi.phy_addr[port_id]);
}
return 0;
}
void eim_duplex_mode_get(const uint8_t port_id, enum lan_mode_duplex *mode)
{
uint32_t reg;
reg = eim_r32(mac_pdi[port_id & 0x3].pstat);
*mode = reg & EIM_MAC_PSTAT_FDUP_FULL ? LAN_PHY_MODE_DUPLEX_FULL:
LAN_PHY_MODE_DUPLEX_HALF;
}
int eim_speed_mode_set(const uint8_t port_id, const enum lan_mode_speed mode)
{
uint32_t cfg;
if (port_id >= ONU_GPE_MAX_ETH_UNI)
return -1;
if (is_falcon_chip_a2x()) {
switch (mode) {
case LAN_MODE_SPEED_AUTO:
cfg = EIM_PHY_ADDR_SPEED_AUTO;
break;
case LAN_MODE_SPEED_10:
cfg = EIM_PHY_ADDR_SPEED_M10;
break;
case LAN_MODE_SPEED_100:
cfg = EIM_PHY_ADDR_SPEED_M100;
break;
case LAN_MODE_SPEED_1000:
cfg = EIM_PHY_ADDR_SPEED_G1;
break;
case LAN_MODE_SPEED_200:
case LAN_MODE_SPEED_2500:
/* ignore without non-error */
return 0;
default:
return -1;
}
eim_a2x_w32_mask(EIM_PHY_ADDR_SPEED_MASK, cfg,
mdio_pdi.phy_addr[port_id]);
}
return 0;
}
int eim_fcs_enable(const uint8_t port_id, const bool enable)
{
if (port_id >= ONU_GPE_MAX_ETH_UNI)
return -1;
eim_w32_mask(EIM_MAC_CTRL_0_FCS,
enable ? EIM_MAC_CTRL_0_FCS_EN : 0,
mac_pdi[port_id].ctrl_0);
return 0;
}
int eim_gmii_mode_set(const uint8_t port_id, const enum eim_gmii_mode mode)
{
uint32_t val = 0;
if (port_id >= ONU_GPE_MAX_ETH_UNI)
return -1;
set_val(val, (uint32_t)mode,
EIM_MAC_CTRL_0_GMII_MASK, EIM_MAC_CTRL_0_GMII_OFFSET);
eim_w32_mask(EIM_MAC_CTRL_0_GMII_MASK, val, mac_pdi[port_id].ctrl_0);
return 0;
}
int eim_gmii_mode_get(const uint8_t port_id, enum eim_gmii_mode *mode)
{
uint32_t val = 0;
if (port_id >= ONU_GPE_MAX_ETH_UNI)
return -1;
val = eim_r32(mac_pdi[port_id].ctrl_0);
val = ((val >> EIM_MAC_CTRL_0_GMII_OFFSET) & EIM_MAC_CTRL_0_GMII_MASK);
*mode = (enum eim_gmii_mode)val;
return 0;
}
void eim_xmii_enable(const uint8_t xmii_idx, const bool enable)
{
eim_w32_mask(EIM_MII_CFG_EN, enable ? EIM_MII_CFG_EN : 0,
mii_pdi[xmii_idx & 0x1].mii_cfg);
}
void eim_xmii_reset(const uint8_t xmii_idx, const bool on)
{
eim_w32_mask(EIM_MII_CFG_RES, on ? EIM_MII_CFG_RES_ON : 0,
mii_pdi[xmii_idx & 0x1].mii_cfg);
}
void eim_xmii_mode_set(const uint8_t xmii_idx, const enum eim_xmii_mode mode)
{
eim_w32_mask(EIM_MII_CFG_MIIMODE_MASK, (uint32_t)mode,
mii_pdi[xmii_idx & 0x1].mii_cfg);
}
void eim_xmii_jitter_buf_enable(const uint8_t xmii_idx, const bool rxb,
const bool txb)
{
eim_w32_mask(EIM_BUFF_RXB_EN, rxb ? EIM_BUFF_RXB_EN : 0,
mii_pdi[xmii_idx & 0x1].buff);
eim_w32_mask(EIM_BUFF_TXB_EN, txb ? EIM_BUFF_TXB_EN : 0,
mii_pdi[xmii_idx & 0x1].buff);
}
void eim_xmii_clk_rate_set(const uint8_t xmii_idx,
const enum eim_xmii_clk_rate val)
{
eim_w32_mask(EIM_MII_CFG_MIIRATE_MASK,
(uint32_t)(val << EIM_MII_CFG_MIIRATE_OFFSET),
mii_pdi[xmii_idx & 0x1].mii_cfg);
}
void eim_xmii_clk_dly_set(const uint8_t xmii_idx, const uint8_t tx_dly,
const uint8_t rx_dly)
{
eim_w32_mask(EIM_PCDU_TXDLY_MASK,
(tx_dly << EIM_PCDU_TXDLY_OFFSET) & EIM_PCDU_TXDLY_MASK,
mii_pdi[xmii_idx & 0x1].pcdu);
eim_w32_mask(EIM_PCDU_RXDLY_MASK,
(rx_dly << EIM_PCDU_RXDLY_OFFSET) & EIM_PCDU_RXDLY_MASK,
mii_pdi[xmii_idx & 0x1].pcdu);
}
void eim_mac_loop_enable(const uint8_t port_id, const bool en)
{
eim_w32_mask(EIM_MAC_TESTEN_LOOP, en ? EIM_MAC_TESTEN_LOOP_EN : 0,
mac_pdi[port_id & 0x3].testen);
}
void eim_mii_loop_enable(const uint8_t xmii_idx, const bool en)
{
eim_w32_mask(EIM_MII_CFG_LPBK, en ? EIM_MII_CFG_LPBK_EN: 0,
mii_pdi[xmii_idx & 0x1].mii_cfg);
}
void eim_sgmii_loop_enable(const bool en)
{
sxgmii_w32_mask(CFG_LPB, en ? CFG_LPB_LOOP : 0, s_sgmii_pcs_pdi_cfg);
}
void eim_central_interrupt_enable_set(const uint32_t clear, const uint32_t set)
{
eim_w32_mask(clear, set, top_pdi.eim_ier);
}
uint32_t eim_central_interrupt_enable_get(void)
{
return eim_r32(top_pdi.eim_ier);
}
void eim_mac_cnt_get(const uint8_t idx, struct mac_counter *cnt)
{
const uint8_t port = idx & 0x3;
memset(cnt, 0x0, sizeof(struct mac_counter));
cnt->rx_fcs_err = (uint64_t)eim_r32(top_pdi.eim_mib_fcser[port]);
cnt->tx_jabber_frames = (uint64_t)eim_r32(top_pdi.eim_mib_ovsz[port]);
cnt->algn_err = (uint64_t)eim_r32(top_pdi.eim_mib_algn[port]);
cnt->late_col = (uint64_t)eim_r32(top_pdi.eim_mib_late_col[port]);
cnt->exc_col = (uint64_t)eim_r32(top_pdi.eim_mib_exc_col[port]);
cnt->sgl_col = (uint64_t)eim_r32(top_pdi.eim_mib_sgl_col[port]);
cnt->mul_col = (uint64_t)eim_r32(top_pdi.eim_mib_mul_col[port]);
cnt->def_trans = (uint64_t)eim_r32(top_pdi.eim_mib_def_trans[port]);
}
void eim_mac_lpi_enable(const uint8_t port_id, const bool en)
{
eim_w32_mask(EIM_MAC_CTRL_4_LPIEN, en ? EIM_MAC_CTRL_4_LPIEN : 0,
mac_pdi[port_id & 0x3].ctrl_4);
}
void eim_mac_frame_length_set(const uint16_t val)
{
eim_w32(val & EIM_MAC_FLEN_LEN_MASK, macs_top_pdi.mac_flen);
}
uint16_t eim_mac_frame_length_get(void)
{
return eim_r32(macs_top_pdi.mac_flen) & EIM_MAC_FLEN_LEN_MASK;
}
void eim_mac_err_status_get(const uint8_t port_id, bool *toolong, bool *ig_ovfl)
{
*toolong = (eim_r32(mac_pdi[port_id].pisr) & EIM_MAC_PISR_TOOLONG) == 0 ? false : true;
if (is_falcon_chip_a1x())
*ig_ovfl = (eim_r32(top_pdi.eim_isr) &
(EIM_EIM_IER_A1X_LAN_IG_OVFL_0 << port_id)) == 0 ?
false : true;
else
*ig_ovfl = (eim_r32(top_pdi.eim_isr) &
(EIM_EIM_IER_A2X_LAN_IG_OVFL_0 << port_id)) == 0 ?
false : true;
eim_w32_mask (EIM_MAC_PISR_TOOLONG, 0, mac_pdi[port_id].pisr);
eim_w32_mask ((EIM_EIM_IER_A2X_LAN_IG_OVFL_0 << port_id), 0, top_pdi.eim_isr);
}
#if defined(INCLUDE_DUMP)
const char *vsc8201_mdio_reg_name[32] = {
/* 00 */ "Mode Control",
/* 01 */ "Mode Status",
/* 02 */ "Ident 1",
/* 03 */ "Ident 2",
/* 04 */ "Autonegotiation Advertisement",
/* 05 */ "Autonegotiation Link Partner Availibility",
/* 06 */ "Autonegotiation Expansion",
/* 07 */ "Autonegotiation Next-Page Transmit",
/* 08 */ "Autonegotiation Link Partner Next Page",
/* 09 */ "1000BASE-T Control",
/* 0A */ "1000BASE-T Status",
/* 0B */ "",
/* 0C */ "",
/* 0D */ "MMD Access Control Register",
/* 0E */ "MMD Access Data Register",
/* 0F */ "1000BASE-T Status Extension #1",
/* 10 */ "Physical Layer Performance Status",
/* 11 */ "Physical Layer Status 1",
/* 12 */ "Physical Layer Status 2",
/* 13 */ "Physical Layer Control 1",
/* 14 */ "Physical Layer Control 2",
/* 15 */ "Error Counter",
/* 16 */ "EEPROM Control Register",
/* 17 */ "Media-Independent Interface Control",
/* 18 */ "Media-Independent Interface Status",
/* 19 */ "Interrupt Mask",
/* 1A */ "Interrupt Status",
/* 1B */ "Parallel LED Control",
/* 1C */ "Test-Packet Generator Control",
/* 1D */ "Test-Packet Generator Data",
/* 1E */ "Firmware Version Register",
/* 1F */ ""
};
void eim_dump(struct seq_file *s)
{
uint32_t i, m;
uint16_t data;
seq_printf(s, " ier, isr\n");
seq_printf(s, "%08x,", eim_r32(top_pdi.eim_ier));
seq_printf(s, "%08x\n", eim_r32(top_pdi.eim_isr));
seq_printf(s, " mac, pstat, pisr, ctrl0, ctrl1"
", ctrl2, ctrl3, ctrl4, ctrl5%s\n",
is_falcon_chip_a1x()?", ctrl6":"");
for (i = 0; i < ONU_GPE_MAX_ETH_UNI; i++) {
seq_printf(s, "%08x,", i);
seq_printf(s, "%08x,",
(unsigned int)(is_falcon_chip_a1x() ?
&eim->a1x.mac_pdi[i].pstat:
&eim->a2x.mac_pdi[i].pstat));
seq_printf(s, "%08x,",
(unsigned int)(is_falcon_chip_a1x() ?
&eim->a1x.mac_pdi[i].pisr:
&eim->a2x.mac_pdi[i].pisr));
seq_printf(s, "%08x,", eim_r32(mac_pdi[i].ctrl_0));
seq_printf(s, "%08x,", eim_r32(mac_pdi[i].ctrl_1));
seq_printf(s, "%08x,", eim_r32(mac_pdi[i].ctrl_2));
seq_printf(s, "%08x,", eim_r32(mac_pdi[i].ctrl_3));
seq_printf(s, "%08x,", eim_r32(mac_pdi[i].ctrl_4));
seq_printf(s, "%08x,", eim_r32(mac_pdi[i].ctrl_5));
if (is_falcon_chip_a1x())
seq_printf(s, "%08x", eim_a1x_r32(mac_pdi[i].ctrl_6));
seq_printf(s, "\n");
}
for (m = 0; m <= 31; m++) {
if (eim_mdio_data_read(m, i, &data) != 0)
continue;
if (data == 0xffff)
continue;
seq_printf(s, "MDIO device %d\n", m);
for (i = 0; i <= 31; i++) {
if (vsc8201_mdio_reg_name[i][0] == 0)
continue;
if (eim_mdio_data_read(m, i, &data) != 0)
continue;
seq_printf(s, "%02X: %04x - %s\n", i, data,
vsc8201_mdio_reg_name[i]);
}
}
}
#endif

360
src/drv_onu_ll_eim.h Normal file
View File

@ -0,0 +1,360 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_ll_eim_h
#define _drv_onu_ll_eim_h
/** \addtogroup ONU_LL_REFERENCE GPON Low-level Functions
@{
*/
/** \addtogroup ONU_LL_EIM Ethernet Interface Module Low-level Functions
Low-level functions to access the Ethernet interface hardware module (EIM).
@{
*/
#define EIM_RGMII_CLK_DELAY_MAX (7)
#define EIM_GMII_XMII_IDX (0)
enum eim_gmii_mode {
/**
mode detected by autonegotiation */
EIM_GMII_MODE_AUTO = 0,
/**
MII/RMII interface mode at 10, 100, or 200 Mbit/s*/
EIM_GMII_MODE_MII = 1,
/**
GMII/RGMII interface mode at 1000 Mbit/s*/
EIM_GMII_MODE_GMII = 2
};
enum eim_xmii_mode {
/**
(G)MII PHY mode, connected to external MAC*/
EIM_XMII_MODE_MIIP = 0,
/**
(G)MII MAC mode, connected to external PHY*/
EIM_XMII_MODE_MIIM = 1,
/**
RMII PHY mode, connected to external MAC*/
EIM_XMII_MODE_RMIIP = 2,
/**
RMII MAC mode, connected to external PHY*/
EIM_XMII_MODE_RMIIM = 3,
/**
RGMII MAC mode, connected to external PHY*/
EIM_XMII_MODE_RGMII = 4
};
/**
Selects the data and clock rate for the xMII interface.
This setting is used for MII, TMII PHY, and for RGMII tx_clk.
IN RMII mode, 50 MHz must always be selected.
Autopolling should not be selected for XMII TMII Phy Mode.*/
enum eim_xmii_clk_rate {
/**
2.5 MHz*/
EIM_XMII_CLK_RATE_2P5MHZ = 0,
/**
25 MHz*/
EIM_XMII_CLK_RATE_25MHZ = 1,
/**
125 MHz*/
EIM_XMII_CLK_RATE_125MHZ = 2,
/**
50 MHz*/
EIM_XMII_CLK_RATE_50MHZ = 3,
/**
Speed used from Autopolling*/
EIM_XMII_CLK_RATE_AUTO = 4
};
/**
Read MDIO register.
*/
int eim_mdio_data_read(const uint8_t addr_dev, const uint8_t addr_reg,
uint16_t *data);
/**
Write MDIO register.
*/
int eim_mdio_data_write(const uint8_t addr_dev, const uint8_t addr_reg,
const uint16_t data);
/**
Set address for internal PHY
*/
void eim_gphy_cfg_addr_set(const uint8_t phy_id, const uint8_t phy_addr);
/**
Get address for internal PHY
*/
uint8_t eim_gphy_cfg_addr_get(const uint8_t phy_id);
/**
Set address for automatic PHY status polling
*/
void eim_phy_addr_set(const uint8_t uni_port_id, const uint8_t phy_addr);
/**
Set automatic PHY status polling
\param uni_port_id port number
\param enable enable/disable
*/
int eim_phy_autopoll_enable_set(const uint8_t uni_port_id, const bool enable);
/**
Get automatic PHY status polling
\param uni_port_id port number
\param enable enable/disable
*/
int eim_phy_autopoll_enable_get(const uint8_t uni_port_id, bool *enable);
#ifdef CONFIG_WITH_FALCON_A2X
/**
Force settings for temporary disabling of auto-polling
\param phy_addr phy address for which
\param port_id pointer to return port number for later restore
\param restore pointer to return register value for later restore
\return 0 for all cases, where settings must be restored,
!0 for all other cases
*/
int eim_phy_autopoll_force_current(const uint8_t phy_addr, uint8_t *port_id,
uint32_t *restore);
/**
Restore settings for auto-polling
\param port_id port number
\param restore register value to restore
*/
void eim_phy_autopoll_restore_settings(uint8_t port_id, uint32_t restore);
/**
Get status register from auto-polling
*/
int eim_phy_autopoll_status_get(uint8_t port_id, uint32_t *mdio_stat);
#endif
/**
Set short preamble mode
\param uni_port_id port number
\param enable enable/disable
*/
int eim_short_preamble_enable_set(const uint8_t uni_port_id, const bool enable);
/**
Get short preamble mode
\param uni_port_id port number
\param enable enable/disable
*/
int eim_short_preamble_enable_get(const uint8_t uni_port_id, bool *enable);
/**
Set flow control mode
\param port_id port number
\param mode flow control mode
*/
int eim_flow_ctrl_set(const uint8_t port_id,
const enum lan_mode_flow_control mode);
/**
Set duplex mode
\param port_id port number
\param mode duplex mode
*/
int eim_duplex_mode_set(const uint8_t port_id, const enum lan_mode_duplex mode);
/**
Get duplex mode
\param port_id port number
\param mode duplex mode
*/
void eim_duplex_mode_get(const uint8_t port_id, enum lan_mode_duplex *mode);
/**
Set speed mode mode
\param port_id port number
\param mode speed mode
*/
int eim_speed_mode_set(const uint8_t port_id, const enum lan_mode_speed mode);
/**
Enable/disable Frame checksum generation
\param port_id port number
\param enable enable/disable
*/
int eim_fcs_enable(const uint8_t port_id, const bool enable);
/**
Set GMII mode
\param port_id port number
\param mode GMII mode
*/
int eim_gmii_mode_set(const uint8_t port_id, const enum eim_gmii_mode mode);
/**
Get GMII mode
\param port_id port number
\param mode GMII mode
*/
int eim_gmii_mode_get(const uint8_t port_id, enum eim_gmii_mode *mode);
/**
Enable xMII interface
\param xmii_idx xMII index (0 or 1)
\param enable enable/disable
*/
void eim_xmii_enable(const uint8_t xmii_idx, const bool enable);
/**
Reset xMII interface
\param xmii_idx xMII index (0 or 1)
\param on enable/disable
*/
void eim_xmii_reset(const uint8_t xmii_idx, const bool on);
/**
Set xMII mode
\param xmii_idx xMII index (0 or 1)
\param mode xMII mode
*/
void eim_xmii_mode_set(const uint8_t xmii_idx, const enum eim_xmii_mode mode);
/**
Enable xMII jitter buffers
\param xmii_idx xMII index (0 or 1)
\param rxb RX buffer enable/disable
\param txb RX buffer enable/disable
*/
void eim_xmii_jitter_buf_enable(const uint8_t xmii_idx, const bool rxb,
const bool txb);
/**
Set xMII clock rate
\param xmii_idx xMII index (0 or 1)
\param val xMII clock rate value
*/
void eim_xmii_clk_rate_set(const uint8_t xmii_idx,
const enum eim_xmii_clk_rate val);
/**
Set xMII clock delays
\param xmii_idx xMII index (0 or 1)
\param tx_dly TX clock delay
\param rx_dly RX clock delay
*/
void eim_xmii_clk_dly_set(const uint8_t xmii_idx, const uint8_t tx_dly,
const uint8_t rx_dly);
/**
Enable MAC Loop
\param port_id port number
\param en enable/disable
*/
void eim_mac_loop_enable(const uint8_t port_id, const bool en);
/**
Enable xMII Loop
\param xmii_idx xMII index (0 or 1)
\param en enable/disable
*/
void eim_mii_loop_enable(const uint8_t xmii_idx, const bool en);
/**
Enable SGMII Loop
\param en enable/disable
*/
void eim_sgmii_loop_enable(const bool en);
/**
Central EIM Interrupt Enable Set
\param clear interrupt mask to clear
\param set interrupt mask to set
*/
void eim_central_interrupt_enable_set(const uint32_t clear, const uint32_t set);
/**
Central EIM Interrupt Enable Get
*/
uint32_t eim_central_interrupt_enable_get(void);
/**
EIM counters get
\param idx port number
\param cnt counters
*/
void eim_mac_cnt_get(const uint8_t idx, struct mac_counter *cnt);
/**
Enable/disable MAC LPI mode
\param port_id port number
\param en enable/disable
*/
void eim_mac_lpi_enable(const uint8_t port_id, const bool en);
/**
Set MAC Frame Length
\param val MAC Frame Length, bits 0..13 valid
*/
void eim_mac_frame_length_set(const uint16_t val);
/**
Get MAC Frame Length
\return
MAC Frame Length, bits 0..13 valid
*/
uint16_t eim_mac_frame_length_get(void);
void eim_mac_err_status_get(const uint8_t port_id, bool *toolong, bool *ig_ovfl);
#if defined(INCLUDE_DUMP)
/**
Dump the OCTRLG register block.
*/
void eim_dump(struct seq_file *s);
#endif
/*! @} */
/*! @} */
#endif

663
src/drv_onu_ll_fsqm.c Normal file
View File

@ -0,0 +1,663 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#include "drv_onu_api.h"
#include "drv_onu_register.h"
#include "drv_onu_ll_sys.h"
#include "drv_onu_ll_fsqm.h"
#include "drv_onu_resource_gpe.h" /* ONU_GPE_LLT_NIL */
#define HEAD_TAIL_SUPERVISION
#ifdef HEAD_TAIL_SUPERVISION
static uint16_t initial_tail;
static uint16_t initial_head;
#endif
static bool fsqm_init_done=0;
STATIC void fsqm_basic_init(void);
STATIC void fsqm_llt_init(struct fsq *p_fsq);
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void fsqm_ifsq_read(struct fsq *fsq)
{
uint32_t reg = 0;
if (is_falcon_chip_a1x())
reg = fsqm_r32(ifsq_a1x);
fsq->head = (reg & FSQM_IFSQ_A1X_HEAD_MASK) >> FSQM_IFSQ_A1X_HEAD_OFFSET;
fsq->tail = (reg & FSQM_IFSQ_A1X_TAIL_MASK) >> FSQM_IFSQ_A1X_TAIL_OFFSET;
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
void fsqm_ofsq_read(struct fsq *fsq)
{
uint32_t reg;
reg = fsqm_r32(ofsq);
fsq->head = (reg & FSQM_OFSQ_HEAD_MASK) >> FSQM_OFSQ_HEAD_OFFSET;
fsq->tail = (reg & FSQM_OFSQ_TAIL_MASK) >> FSQM_OFSQ_TAIL_OFFSET;
#ifdef HEAD_TAIL_SUPERVISION
if (fsq->head > initial_tail) {
ONU_DEBUG_ERR( "fsqm_ofsq_read: head %x exceeds "
"(initial head %x)", fsq->head, initial_tail);
}
if (fsq->tail < initial_head) {
ONU_DEBUG_ERR( "fsqm_ofsq_read: tail %x underrun "
"(initial tail %x)", fsq->tail, initial_head);
}
#endif
}
void fsqm_enable(bool act)
{
fsqm_w32_mask(FSQM_CTRL_ACT_EN, act ? FSQM_CTRL_ACT_EN : 0, ctrl);
}
bool fsqm_is_enabled(void)
{
if (fsqm_init_done == 0)
return false;
if (sys_gpe_hw_is_activated(SYS_GPE_ACT_FSQM_SET) == 0)
return false;
return fsqm_r32(ctrl) & FSQM_CTRL_ACT_EN ? true : false;
}
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void fsqm_reset_set(bool res)
{
fsqm_w32_mask(FSQM_CTRL_RES, res ? FSQM_CTRL_RES : 0, ctrl);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void fsqm_reset_get(bool *res)
{
*res = fsqm_r32(ctrl) & FSQM_CTRL_RES ? true : false;
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void fsqm_prio_set(struct fsqm_prio * prio)
{
uint32_t reg_val;
if (is_falcon_chip_a1x()) {
/* Get PRIO register */
reg_val = fsqm_r32(prio_a1x);
/* Set Priority number for CPU */
set_val(reg_val, prio->pcpu, FSQM_PRIO_A1X_PCPU_MASK,
FSQM_PRIO_A1X_PCPU_OFFSET);
/* Set Priority number for ICTRL (GPE_IN) */
set_val(reg_val, prio->pictrl, FSQM_PRIO_A1X_PICTRL_MASK,
FSQM_PRIO_A1X_PICTRL_OFFSET);
/* Set Priority number for PCTRL (GPE_KERNEL) */
set_val(reg_val, prio->ppctrl, FSQM_PRIO_A1X_PPCTRL_MASK,
FSQM_PRIO_A1X_PPCTRL_OFFSET);
/* Set Priority number for OCTRL (GPE_OUT) */
set_val(reg_val, prio->poctrl, FSQM_PRIO_A1X_POCTRL_MASK,
FSQM_PRIO_A1X_POCTRL_OFFSET);
/* Set Priority number for IQM (GPE_KERNEL) */
set_val(reg_val, prio->piqm, FSQM_PRIO_A1X_PIQM_MASK,
FSQM_PRIO_A1X_PIQM_OFFSET);
/* Enable/disable round-robin of priorities */
reg_val |= prio->rr ? FSQM_PRIO_A1X_RR_EN : 0;
/* Set PRIO register */
fsqm_w32(reg_val, prio_a1x);
}
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void fsqm_prio_get(struct fsqm_prio * prio)
{
uint32_t reg_val;
/* Get PRIO register */
if (is_falcon_chip_a1x())
reg_val = fsqm_r32(prio_a1x);
else
reg_val = 0;
prio->pcpu = get_val(reg_val, FSQM_PRIO_A1X_PCPU_MASK,
FSQM_PRIO_A1X_PCPU_OFFSET);
prio->pictrl = get_val(reg_val, FSQM_PRIO_A1X_PICTRL_MASK,
FSQM_PRIO_A1X_PICTRL_OFFSET);
prio->ppctrl = get_val(reg_val, FSQM_PRIO_A1X_PPCTRL_MASK,
FSQM_PRIO_A1X_PPCTRL_OFFSET);
prio->poctrl = get_val(reg_val, FSQM_PRIO_A1X_POCTRL_MASK,
FSQM_PRIO_A1X_POCTRL_OFFSET);
prio->piqm = get_val(reg_val, FSQM_PRIO_A1X_PIQM_MASK,
FSQM_PRIO_A1X_PIQM_OFFSET);
prio->rr = reg_val & FSQM_PRIO_A1X_RR ? 1 : 0;
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
/**
Init FSQM
*/
void fsqm_init(struct fsq *p_fsq)
{
uint32_t tail_max;
tail_max = (ONU_SBS0RAM_SIZE / ONU_GPE_BUFFER_SEGMENT_SIZE);
tail_max -= (sbs0ctrl_r32(bar1) & SBS0CTRL_BAR1_BA1V_MASK) /
ONU_GPE_BUFFER_SEGMENT_SIZE;
if (p_fsq->tail > tail_max)
p_fsq->tail = tail_max;
if (p_fsq->head == 0 && p_fsq->tail == 0) {
ONU_DEBUG_MSG("fsqm_init: Max. values used");
p_fsq->head = 0;
p_fsq->tail = tail_max;
} else {
ONU_DEBUG_MSG( "fsqm_init: User values used "
"(head=0x%04x, tail=0x%04x)",
p_fsq->head, p_fsq->tail);
}
/*
Enable module clock, release reset. This is mandatory before
accessing module's registers.
*/
sys_gpe_hw_activate_or_reboot(SYS_GPE_ACT_FSQM_SET);
if ((p_fsq->tail > ONU_GPE_LLT_MAX) || (p_fsq->tail > tail_max)) {
p_fsq->tail = tail_max;
ONU_DEBUG_WRN("fsqm_init: tail reduced to max val (0x%04x)",
p_fsq->tail);
}
/* point to the last usable entry */
p_fsq->tail--;
/*
- SW reset brings module into defined HW state
- initializes all registers
- builds linked list
- and then activates FSQM
*/
fsqm_w32_mask(0, FSQM_CTRL_RES_EN, ctrl);
fsqm_w32_mask(FSQM_CTRL_RES_EN, 0, ctrl);
fsqm_basic_init();
fsqm_llt_init(p_fsq);
fsqm_w32_mask(0, 0x0, io_buf_rd);
fsqm_w32_mask(0, 0x0, io_buf_wr);
/*fsqm_w32_mask(0, FSQM_CTRL_ACT_EN, ctrl);*/
fsqm_init_done = true;
}
/*
- FSQM deactivated
- IO buffer disabled
- all pause thresholds deasserted
- all interrupts disabled
- same prio for all masters, except CPU (highest prio)
- enable round robin
*/
STATIC void fsqm_basic_init(void)
{
fsqm_w32(0, ctrl);
if (is_falcon_chip_a1x()) {
uint32_t reg;
reg = 0x0;
reg |= FSQM_PRIO_A1X_RR_EN;
reg |= (4 << FSQM_PRIO_A1X_PIQM_OFFSET);
reg |= (3 << FSQM_PRIO_A1X_POCTRL_OFFSET);
reg |= (2 << FSQM_PRIO_A1X_PPCTRL_OFFSET);
reg |= (1 << FSQM_PRIO_A1X_PICTRL_OFFSET);
reg |= (5 << FSQM_PRIO_A1X_PCPU_OFFSET);
fsqm_w32(reg, prio_a1x);
fsqm_w32(0, imq_a1x);
fsqm_w32(0, ifsc_a1x);
}
/* Disable all interrupts */
fsqm_w32(0, irncr);
fsqm_w32(0, irnicr);
fsqm_w32(0, irnen);
fsqm_w32(0, ofsc);
fsqm_w32(0, fsqt0);
fsqm_w32(0, fsqt1);
fsqm_w32(0, fsqt2);
fsqm_w32(0, fsqt3);
fsqm_w32(0, fsqt4);
fsqm_w32(0, omq);
}
/*
\param nb_of_elements Number of memory elements that will be put into
the initial Free Segment Queue (FSQ).
A Linked List Table (LLT) will be built up starting
from first_element to last_element.
*/
STATIC void fsqm_llt_init(struct fsq *p_fsq)
{
uint32_t i = p_fsq->head;
int wdata;
while (i < (p_fsq->tail)) {
wdata = i + 1;
fsqm_w32(wdata, ram[i]);
fsqm_w32(RCNT_INIT, rcnt[i]);
i++;
}
fsqm_w32(ONU_GPE_LLT_NIL, ram[i]);
fsqm_w32(RCNT_INIT, rcnt[i]);
/* ofsq - is used */
/* init in queue head & tail */
wdata = p_fsq->head << FSQM_OFSQ_HEAD_OFFSET;
wdata |= p_fsq->tail << FSQM_OFSQ_TAIL_OFFSET;
fsqm_w32(wdata, ofsq);
/* init in queue counter */
fsqm_w32((p_fsq->tail - p_fsq->head) + 1, ofsc);
if (is_falcon_chip_a1x()) {
/* ifsq - is not used */
/* init out queue head & tail */
wdata = ONU_GPE_LLT_NIL << FSQM_IFSQ_A1X_HEAD_OFFSET;
wdata |= ONU_GPE_LLT_NIL << FSQM_IFSQ_A1X_TAIL_OFFSET;
fsqm_w32(wdata, ifsq_a1x);
/* init out queue counter */
fsqm_w32(0, ifsc_a1x);
}
#ifdef HEAD_TAIL_SUPERVISION
i = fsqm_r32(ofsq);
initial_head = (i & FSQM_OFSQ_HEAD_MASK) >> FSQM_OFSQ_HEAD_OFFSET;
initial_tail = (i & FSQM_OFSQ_TAIL_MASK) >> FSQM_OFSQ_TAIL_OFFSET;
#endif
}
uint16_t fsqm_llt_read(const uint16_t idx)
{
return fsqm_r32(ram[idx]);
}
void fsqm_llt_write(const uint16_t idx, const uint32_t val)
{
fsqm_w32(val, ram[idx]);
}
void fsqm_free_segment_threshold_set(const uint32_t threshold[5])
{
fsqm_w32(threshold[0] & FSQM_FSQT0_FSQT_MASK, fsqt0);
fsqm_w32(threshold[1] & FSQM_FSQT1_FSQT_MASK, fsqt1);
fsqm_w32(threshold[2] & FSQM_FSQT2_FSQT_MASK, fsqt2);
fsqm_w32(threshold[3] & FSQM_FSQT3_FSQT_MASK, fsqt3);
fsqm_w32(threshold[4] & FSQM_FSQT4_FSQT_MASK, fsqt4);
}
void fsqm_free_segment_threshold_get(uint32_t threshold[5])
{
threshold[0] = fsqm_r32(fsqt0);
threshold[1] = fsqm_r32(fsqt1);
threshold[2] = fsqm_r32(fsqt2);
threshold[3] = fsqm_r32(fsqt3);
threshold[4] = fsqm_r32(fsqt4);
}
uint16_t fsqm_segment_alloc(void)
{
uint16_t hlsa;
hlsa = (fsqm_r32(omq[0]) >> FSQM_OMQ_HLSA_OFFSET)
& FSQM_OMQ_HLSA_MASK;
if (hlsa == ONU_GPE_LLT_NIL) {
ONU_DEBUG_ERR("ooops, can't get enough segments");
return hlsa;
}
#ifdef HEAD_TAIL_SUPERVISION
if (hlsa > initial_tail) {
ONU_DEBUG_ERR( "fsqm_segment_alloc: head %x exceeds "
"(initial tail %x)", hlsa, initial_tail);
}
#endif
fsqm_w32(1, rcnt[hlsa]);
return hlsa;
}
void fsqm_segment_free(const uint16_t tlsa, const uint16_t hlsa,
const uint16_t seg_len, const uint16_t hdr_seg_len)
{
uint16_t header_tlsa = ONU_GPE_LLT_NIL;
uint16_t body_hlsa = ONU_GPE_LLT_NIL;
uint16_t body_seg_len = seg_len - hdr_seg_len;
uint16_t cnt;
if (tlsa == ONU_GPE_LLT_NIL || hlsa == ONU_GPE_LLT_NIL ||
seg_len == 0 || body_seg_len == 0)
return;
#ifdef HEAD_TAIL_SUPERVISION
if (hlsa > initial_tail) {
ONU_DEBUG_ERR( "fsqm_segment_free: head %x exceeds "
"(initial tail %x)", hlsa, initial_tail);
}
if (tlsa > initial_tail) {
ONU_DEBUG_ERR( "fsqm_segment_free: tail %x exceeds "
"(initial tail %x)", tlsa, initial_tail);
}
#endif
switch (hdr_seg_len) {
case 0:
break;
case 1:
header_tlsa = hlsa;
break;
case 2:
header_tlsa = fsqm_llt_read(hlsa);
break;
default:
break;
}
if (header_tlsa != ONU_GPE_LLT_NIL) {
body_hlsa = fsqm_llt_read(header_tlsa);
if (body_hlsa != ONU_GPE_LLT_NIL) {
cnt = fsqm_r32(rcnt_incdec[body_hlsa]) & 0x7;
if(cnt == 1) {
fsqm_w32((tlsa << FSQM_OMQ_TLSA_OFFSET) | body_hlsa, omq[body_seg_len]);
}
}
fsqm_w32((header_tlsa << FSQM_OMQ_TLSA_OFFSET) | hlsa, omq[hdr_seg_len]);
} else {
fsqm_w32((tlsa << FSQM_OMQ_TLSA_OFFSET) | hlsa, omq[seg_len]);
}
}
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void fsqm_interrupt_enable_set(const uint32_t mask)
{
fsqm_w32(mask, irnen);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void fsqm_interrupt_enable_get(uint32_t *mask)
{
*mask = fsqm_r32(irnen);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void fsqm_interrupt_control_set(const uint32_t ctrl)
{
fsqm_w32(ctrl, irnicr);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void fsqm_interrupt_control_get(uint32_t *ctrl)
{
*ctrl = fsqm_r32(irnicr);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void fsqm_fsqm_interrupt_capture_set(const uint32_t capt)
{
fsqm_w32(capt, irncr);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void fsqm_fsqm_interrupt_capture_get(uint32_t *capt)
{
*capt = fsqm_r32(irncr);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#if !defined(ONU_LIBRARY)
static bool touched[ONU_GPE_LLT_MAX];
bool fsqm_check(uint16_t len)
{
bool pass;
uint16_t reg;
uint16_t cnt;
struct fsq fsq;
uint16_t head, tail, next;
pass = true;
memset(&touched[0], 0x00, sizeof(touched));
/* check: free segment queue is back at its original length */
reg = fsqm_r32(ofsc);
if (reg == len) {
ONU_DEBUG_WRN("pass: OFSC is back at its expected value");
} else {
ONU_DEBUG_WRN( "error: OFSC is NOT back "
"at its original length = %d", reg);
pass = false;
}
/* check: free segment queue is not corrupt
step through the free segment queue, starting from the head LSA,
and follow the next pointers until the tail LSA is reached.
In an array, mark all LSAs which were touched while stepping through.
If the FSQ touches the same LSA twice, the FSQ is corrupt. */
for (cnt = 0; cnt < ONU_GPE_LLT_MAX; cnt++)
touched[cnt] = false;
fsqm_ofsq_read(&fsq); /* get head LSA */
head = fsq.head;
tail = fsq.tail;
ONU_DEBUG_WRN("start with head: 0x%x tail: 0x%x", head, tail);
touched[head] = true;
for (cnt = 0; cnt < (len-1); cnt++) {
next = fsqm_llt_read(head);
ONU_DEBUG_WRN("[%5d] llt addr: 0x%04x llt data: 0x%04x",
cnt, head, next);
/* ONU_DEBUG_MSG("info: cnt: %d", cnt); */
if (next == ONU_GPE_LLT_NIL) {
ONU_DEBUG_WRN( "warning: LLT end received too early "
"(NIL value detected)");
head = next;
pass = false;
cnt++;
break;
}
if (next == tail && cnt != (len-2)) {
ONU_DEBUG_WRN( "warning: TAIL received (too early) "
"(tail = 0x%04x)", next);
head = next;
pass = false;
cnt++;
break;
}
if (next >= ONU_GPE_LLT_MAX) {
ONU_DEBUG_WRN( "warning: LLT next pointer out of "
"range 0x0..0x47ff is 0x04%x", next);
head = next;
pass = false;
cnt++;
break;
}
if (touched[next] == false) {
/*ONU_DEBUG_WRN("pass: FSQ check next LSA: 0x%x", next);*/
touched[next] = true;
} else {
ONU_DEBUG_WRN("error: FSQ touches the same LSA twice, "
"the FSQ is corrupt");
pass = false;
}
head = next;
}
next = fsqm_llt_read(head);
ONU_DEBUG_WRN("[%5d] llt addr: 0x%04x llt data: 0x%04x", cnt, head,
next);
tail = fsq.tail;
if (tail == head) {
ONU_DEBUG_WRN("pass: FSQ tail LSA is equal to last next LSA!");
} else {
ONU_DEBUG_WRN("error: FSQ tail LSA: 0x%x does not match last "
"next LSA: 0x%x", tail, head);
pass =false;
}
return pass;
}
#endif /* ONU_LIBRARY */
#if defined(INCLUDE_DUMP)
void fsqm_dump(struct seq_file *s)
{
uint32_t llt_max;
llt_max = (ONU_SBS0RAM_SIZE / ONU_GPE_BUFFER_SEGMENT_SIZE) -
((sbs0ctrl_r32(bar1) & SBS0CTRL_BAR1_BA1V_MASK) /
ONU_GPE_BUFFER_SEGMENT_SIZE);
if (sys_gpe_hw_is_activated(SYS_GPE_ACT_FSQM_SET) == 0) {
seq_printf(s, "fsqm not activated\n");
return;
}
#define dump_reg(reg) \
seq_printf(s, "%-14s = 0x%08x\n", # reg, fsqm_r32(reg))
dump_reg(ctrl);
seq_printf(s, "%-14s = 0x%08x\n", "llt_max", llt_max);
if (is_falcon_chip_a1x()) {
dump_reg(prio_a1x);
}
dump_reg(ofsq);
dump_reg(ofsc);
dump_reg(fsqt0);
dump_reg(fsqt1);
dump_reg(fsqt2);
dump_reg(fsqt3);
dump_reg(fsqt4);
dump_reg(irnicr);
#undef dump_reg
}
int fsqm_llt(struct seq_file *s, int pos)
{
uint32_t llt_max;
int ret;
llt_max = (ONU_SBS0RAM_SIZE / ONU_GPE_BUFFER_SEGMENT_SIZE) -
((sbs0ctrl_r32(bar1) & SBS0CTRL_BAR1_BA1V_MASK) /
ONU_GPE_BUFFER_SEGMENT_SIZE);
if (sys_gpe_hw_is_activated(SYS_GPE_ACT_FSQM_SET) == 0) {
seq_printf(s, "fsqm not activated\n");
return -1;
}
ret = seq_printf(s, "0x%08x : "
"0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x "
"0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x "
"0x%08x 0x%08x\n",
(unsigned int)&fsqm->ram[pos],
fsqm_r32(ram[pos + 0]),
fsqm_r32(ram[pos + 1]),
fsqm_r32(ram[pos + 2]),
fsqm_r32(ram[pos + 3]),
fsqm_r32(ram[pos + 4]),
fsqm_r32(ram[pos + 5]),
fsqm_r32(ram[pos + 6]),
fsqm_r32(ram[pos + 7]),
fsqm_r32(ram[pos + 8]),
fsqm_r32(ram[pos + 9]),
fsqm_r32(ram[pos + 10]),
fsqm_r32(ram[pos + 11]),
fsqm_r32(ram[pos + 12]),
fsqm_r32(ram[pos + 13]),
fsqm_r32(ram[pos + 14]),
fsqm_r32(ram[pos + 15]));
if (ret != 0)
return pos;
if (pos + 16 >= (int)llt_max)
return -1;
else
return pos + 16;
}
int fsqm_rcnt(struct seq_file *s, int pos)
{
uint32_t llt_max;
int ret;
llt_max = (ONU_SBS0RAM_SIZE / ONU_GPE_BUFFER_SEGMENT_SIZE) -
((sbs0ctrl_r32(bar1) & SBS0CTRL_BAR1_BA1V_MASK) /
ONU_GPE_BUFFER_SEGMENT_SIZE);
if (sys_gpe_hw_is_activated(SYS_GPE_ACT_FSQM_SET) == 0) {
seq_printf(s, "fsqm not activated\n");
return -1;
}
ret = seq_printf(s, "0x%08x : "
"0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x "
"0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x "
"0x%08x 0x%08x\n",
(unsigned int)&fsqm->rcnt[pos],
fsqm_r32(rcnt[pos + 0]),
fsqm_r32(rcnt[pos + 1]),
fsqm_r32(rcnt[pos + 2]),
fsqm_r32(rcnt[pos + 3]),
fsqm_r32(rcnt[pos + 4]),
fsqm_r32(rcnt[pos + 5]),
fsqm_r32(rcnt[pos + 6]),
fsqm_r32(rcnt[pos + 7]),
fsqm_r32(rcnt[pos + 8]),
fsqm_r32(rcnt[pos + 9]),
fsqm_r32(rcnt[pos + 10]),
fsqm_r32(rcnt[pos + 11]),
fsqm_r32(rcnt[pos + 12]),
fsqm_r32(rcnt[pos + 13]),
fsqm_r32(rcnt[pos + 14]),
fsqm_r32(rcnt[pos + 15]));
if (ret != 0)
return pos;
if (pos + 16 >= (int)llt_max)
return -1;
else
return pos + 16;
}
#endif

139
src/drv_onu_ll_fsqm.h Normal file
View File

@ -0,0 +1,139 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_fsqm_h
#define _drv_onu_fsqm_h
/** \addtogroup ONU_LL_REFERENCE GPON Low-level Functions
@{
*/
/** \addtogroup ONU_LL_FSQM Free Segment Queue Manager Low-level Functions
Low-level functions to access the Free Segment Queue Manager (FSQM).
@{
*/
/**
This structure is used to hold the priority control attributes.
*/
struct fsqm_prio {
uint8_t pcpu;
uint8_t pictrl;
uint8_t ppctrl;
uint8_t poctrl;
uint8_t piqm;
uint8_t rr;
};
struct fsq {
uint16_t head;
uint16_t tail;
uint16_t init_status;
};
/**
Set Activate / Deactivate switch for FSQM state machines.
*/
void fsqm_enable(bool act);
/**
Get Activate / Deactivate switch of FSQM state machines.
*/
bool fsqm_is_enabled(void);
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set Soft Reset switch for FSQM state machines.
*/
void fsqm_reset_set(bool res);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get Soft Reset switch of FSQM state machines.
*/
void fsqm_reset_get(bool *res);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set Priority Control for FSQM arbiter.
*/
void fsqm_prio_set(struct fsqm_prio * prio);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get Priority Control for FSQM arbiter.
*/
void fsqm_prio_get(struct fsqm_prio * prio);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
/**
Initialize the FSQM block.
*/
void fsqm_init(struct fsq *p_fsq);
void fsqm_free_segment_threshold_set(const uint32_t threshold[5]);
void fsqm_free_segment_threshold_get(uint32_t threshold[5]);
uint16_t fsqm_segment_alloc(void);
void fsqm_segment_free(const uint16_t tlsa,
const uint16_t hlsa, const uint16_t seg_len, const uint16_t hdr_seg_len);
uint16_t fsqm_llt_read(const uint16_t idx);
void fsqm_llt_write(const uint16_t idx, const uint32_t val);
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void fsqm_interrupt_enable_set(const uint32_t mask);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void fsqm_interrupt_enable_get(uint32_t *mask);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void fsqm_interrupt_control_set(const uint32_t ctrl);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void fsqm_interrupt_control_get(uint32_t *ctrl);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void fsqm_fsqm_interrupt_capture_set(const uint32_t capt);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void fsqm_fsqm_interrupt_capture_get(uint32_t *capt);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
bool fsqm_check(uint16_t len);
#if defined(INCLUDE_DUMP)
/**
Dump the FSQM register block.
*/
void fsqm_dump(struct seq_file *s);
int fsqm_llt(struct seq_file *s, int pos);
int fsqm_rcnt(struct seq_file *s, int pos);
#endif
/*! @} */
/*! @} */
#endif

103
src/drv_onu_ll_gpearb.c Normal file
View File

@ -0,0 +1,103 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#include "drv_onu_api.h"
#include "drv_onu_register.h"
#include "drv_onu_ll_sys.h"
#include "drv_onu_ll_gpearb.h"
enum gpe_arb_mode arbiter_mode = ARB_MODE_NA;
enum gpe_arb_mode gpearb_mode_get(void)
{
return arbiter_mode;
}
void gpearb_init(enum gpe_arb_mode arb_mode)
{
uint8_t i;
static const uint32_t data_25g[16] = {
0x05000b0a,
0x07060907,
0x090b0a04,
0x0b060201,
0x0a040900,
0x0904050b,
0x06090b0a,
0x000b0a07,
0x0b0a0905,
0x07040906,
0x0105090b,
0x0509000a,
0x0b090a06,
0x090a0502,
0x0a00070b,
0x05040b09
};
static const uint32_t data_default[16] = {
0x05000b0a,
0x07060907,
0x090b0a08,
0x07060201,
0x0a040300,
0x0908050b,
0x06080b0a,
0x000b0a07,
0x0b0a0905,
0x0a080506,
0x01050c0b,
0x050b000a,
0x0b070a06,
0x080a0502,
0x0a00090b,
0x05040b03
};
/*
Enable module clock, release reset. This is mandatory before
accessing module's registers.
*/
if (arb_mode == ARB_MODE_GIG2_5 || arb_mode == ARB_MODE_DEFAULT)
sys_gpe_hw_activate_or_reboot(SYS_GPE_ACT_ARB_SET);
if (arb_mode == ARB_MODE_GIG2_5) {
gpearb_w32(63, cntr);
for (i = 0; i < 16; i++)
gpearb_w32(data_25g[i], pid[i]);
} else if (arb_mode == ARB_MODE_DEFAULT){ /* DEFAULT */
gpearb_w32(63, cntr);
for (i = 0; i < 16; i++)
gpearb_w32(data_default[i], pid[i]);
}
arbiter_mode = arb_mode;
}
#if defined(INCLUDE_DUMP)
void gpearb_dump(struct seq_file *s)
{
uint8_t i;
if (sys_gpe_hw_is_activated(SYS_GPE_ACT_ARB_SET) == 0) {
seq_printf(s, "gpearb not activated\n");
return;
}
seq_printf(s, " cntr");
for (i = 0; i < 16; i++)
seq_printf(s, ", pid%02d", i);
seq_printf(s, "\n");
seq_printf(s, "%08x", gpearb_r32(cntr));
for (i = 0; i < 16; i++)
seq_printf(s, ",%08x", gpearb_r32(pid[i]));
seq_printf(s, "\n");
}
#endif

49
src/drv_onu_ll_gpearb.h Normal file
View File

@ -0,0 +1,49 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_gpearb_h
#define _drv_onu_gpearb_h
/** \addtogroup ONU_LL_REFERENCE GPON Low-level Functions
@{
*/
/** \addtogroup ONU_LL_GPEARB GPE Arbiter Low-level Functions
Low-level functions to access the GPE arbiter module.
@{
*/
#include "drv_onu_gpe_interface.h"
/**
Get GPEARB block mode.
*/
enum gpe_arb_mode gpearb_mode_get(void);
/**
Initialize the GPEARB block.
*/
void gpearb_init(enum gpe_arb_mode arb_mode);
#if defined(INCLUDE_DUMP)
/**
Dump the GPEARB register block.
*/
void gpearb_dump(struct seq_file *s);
#endif
/*! @} */
/*! @} */
#endif

1541
src/drv_onu_ll_gtc.c Normal file

File diff suppressed because it is too large Load Diff

530
src/drv_onu_ll_gtc.h Normal file
View File

@ -0,0 +1,530 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_ll_gtc_h
#define _drv_onu_ll_gtc_h
/** \addtogroup ONU_LL_REFERENCE GPON Low-level Functions
@{
*/
/** \addtogroup ONU_LL_GTC GPON TC Layer Low-level Functions
Low-level functions to access the GPON TC layer (GTC) hardware module.
@{
*/
/**
Initialize the PLOAM hardware
\param ploam_ctx The PLOAM context pointer.
\param param GTC initialization data
\return
- 0 Initialization successfully
- -1 Error occurred during initialization
*/
int gtc_ll_init(struct ploam_context *ploam_ctx,
const struct gtc_init_data *param);
/** Flush message FIFO
\return -1 In case of error
\return 0 If message FIFO was flushed
*/
int gtc_ploam_flush(void);
/** Read PLOAMd message from the device PLOAMd FIFO
Returns filtered messages (with 0 < msg_id < 21) that directed to us or
broadcast!
\param msg_curr Pointer to ploam_msg where received message
will be placed
\param msg_prev Pointer to ploam_msg of the previous received message
\param ds_repeat_count will contain how often this message was repeated
\return -1 If no message (or all messages in FIFO were incorrect)
\return 0 If message was read
*/
int gtc_ploam_rd(struct ploam_msg *msg_curr, struct ploam_msg *msg_prev,
uint8_t *ds_repeat_count);
/** Send PLOAMu message repeat_factor times
\param msg Pointer to message to send
\param repeat_factor Number of messages to send (should equal to 1 or 3)
\return -1 If repeat_factor is incorrect
\return 0 If message was sent
*/
int gtc_ploam_wr(union ploam_up_msg *msg, uint8_t repeat_factor);
/** Set the No Message content
\param msg Pointer to message to the message content
\return 0 If message was set
*/
int gtc_no_message_set(union ploam_up_msg *msg);
/** Set the Dying Gasp message content
\param msg Pointer to message to the message content
\return 0 If message was set
*/
int gtc_dying_gasp_message_set(const struct gtc_dgasp_msg *msg);
/** Set device's ONU-ID
\param onu_id ONU-ID to set
\return -1 If onu_id > PLOAM_ID_VALUE_ASSIGNABLE
\return 0 If ONU-ID was set
*/
int gtc_onu_id_set(const uint32_t onu_id);
/**
Set Alloc-ID for a given TCONT index.
\param tcont_idx TCONT index
\param alloc_id Alloc-ID to be written
\return -2 alloc_id >= ONU_GPE_MAX_ALLOCATION_ID
\return -1 tcont_idx >= ONU_GPE_MAX_TCONT
\return 0 If Alloc-ID was set
*/
int gtc_tcont_set(const uint32_t tcont_idx, const uint32_t alloc_id);
/**
Add Alloc-ID to the first free TCONT.
\param alloc_id Alloc-ID to be written
\param tcont Used T-CONT index
\return -2 no free TCONT found
\return -1 alloc_id >= ONU_GPE_MAX_ALLOCATION_ID
\return 0 If Alloc-ID was set
*/
int gtc_tcont_alloc_id_add(const uint32_t alloc_id, uint32_t *tcont);
/**
Find the first free TCONT.
\param tcont Used T-CONT index
\return -1 no free TCONT found
\return 0 free TCONT found was set
*/
int gtc_tcont_alloc_id_find(uint32_t *tcont);
/**
Remove Alloc-ID.
\param alloc_id Alloc-ID to be removed
\return -2 Allocid not found
\return -1 alloc_id >= ONU_GPE_MAX_ALLOCATION_ID
\return positive value which is equal to the TCONT index
*/
int gtc_tcont_alloc_id_remove(const uint32_t alloc_id);
/**
Get alloc_id for a given TCONT index.
\param tcont_idx TCONT index
\param alloc_id Pointer to the alloc_id
\param used TCONT validity
\return -1 If tcont_idx not in use
\return 0 on success
*/
int gtc_tcont_get(const uint32_t tcont_idx, uint32_t *alloc_id, bool *used);
/**
Delete TCONT with given Allocation ID.
\param tcont_idx Remove the allocation ID used by the specified TCONT.
\return -1 If no TCONT within ONU_GPE_MAX_TCONT
\return 0 on success
*/
int gtc_tcont_delete(const uint32_t tcont_idx);
/**
Delete all AllocIDs from TCONT table.
*/
void gtc_tcont_clean(void);
/** Set device's random delay
\param delay Random Delay to set
\return 0
*/
int gtc_random_delay_set(const uint32_t delay);
/** Get device's Random Delay
\return Random delay
*/
uint32_t gtc_random_delay_get(void);
/** Set device's ranged delay
\param delay Ranged Delay to set
\return 0
*/
int gtc_ranged_delay_set(const uint32_t delay);
/** Get device's ranged delay
\return Ranged Delay
*/
uint32_t gtc_ranged_delay_get(void);
/** Get device's psync delay
\return PSYNC Delay
*/
uint8_t gtc_psync_delay_get(void);
/** Enable ranged delay
\return 0
*/
int gtc_ranged_delay_enable(const uint32_t enable);
/** Request upstream mode
\return true If ranged delay is enabled
\return false If ranged delay is disabled
*/
int gtc_ranged_delay_is_enable(void);
/** Set device's pre-assigned delay
\param delay pre-assigned delay to set
\return 0
*/
int gtc_preassigned_delay_set(const uint32_t delay);
/** Get device's pre-assigned delay
\return pre-assigned delay
*/
uint32_t gtc_preassigned_delay_get(void);
/** Get device's Upstream header Length
\return Upstream header length (bytes)
*/
uint8_t gtc_upstream_header_len_get(void);
/** Create device's Upstream Header
\param guard_bits Number of guard bits
\param t1_bits Number of type 1 preamble bits
\param t2_bits Number of type 2 preamble bits
\param t3_bits Number of type 3 preamble bits
\param t3_pattern Pattern to be used for type 3 preamble bits
\param delimiter Data to be programmed in delimiter(0x00xxxxxx)
\return -1 If Upstream header was not created (because of errors
in the arguments)
\return 0 If header was created
*/
int gtc_upstream_header_create(const uint32_t guard_bits,
const uint32_t t1_bits,
const uint32_t t2_bits,
const uint32_t t3_bits,
const uint8_t t3_pattern,
const uint8_t delimiter[3]);
/** Fix the frame offset
*/
void gtc_offset_set(const uint16_t hdrlength, const uint16_t sstart_min,
uint16_t *offset_max);
/** Enable upstream transmission
\return 0
*/
int gtc_tx_enable(const uint32_t enable);
/** Request upstream mode
\return true If upstream is enabled
\return false If upstream is disabled
*/
int gtc_tx_is_enable(void);
/** Enable dozing mode
\return 0
*/
int gtc_dozing_enable(const uint32_t enable);
/** Request dozing mode
\return true If dozing is enabled
\return false If dozing is disabled
*/
int gtc_dozing_is_enable(void);
/** Retrieve existing Port ID information.
\param port_id Port ID to operate on
\param valid
- true - if Port ID enabled
- false - if Port ID disabled
\param decryption_en
- true - encryption enable
- false - encryption disable
\return -1 If port_id > 0xfff
\return 0 If Port ID was modified
*/
int gtc_port_id_get(const uint16_t port_id, uint32_t *valid,
uint32_t *decryption_en);
/** Activate/Deactivate given Port ID
\param port_id Port ID to operate on
\param act
- true - activate Port ID
- false - deactivate Port ID
\return -1 If port_id > 0xfff
\return 0 If Port ID was (de)activated
*/
int gtc_port_id_enable(const uint16_t port_id, const uint32_t act);
/** Check if given Port ID is active
\param port_id Port ID to check
\param valid true if enabled
\return 0 if successful
\return -1 if Port ID is not valid
*/
int gtc_port_id_is_active(const uint16_t port_id, uint32_t *valid);
/** Set Port ID frame type
\param port_id Port ID to operate on
\param type PORTID_TYPE_
\return 0 if Port ID was set
\return -1 otherwise
*/
int gtc_port_id_type_set(const uint16_t port_id, const uint8_t type);
/** Encrypt/Decrypt given Port ID
\param port_id Port ID to operate on
\param bEncrypt
- true - encrypt Port ID
- false - decrypt Port ID
\return -1 If port_id > 0xfff
\return 0 If Port ID was encrypted/decrypted
*/
int gtc_port_id_encryption_set(const uint16_t port_id,
const uint32_t decryption_en);
/** Set switching time value
\return 0
*/
int gtc_switching_time_set(const uint32_t frame_cnt);
/** Set AES keys
\return 0
*/
int gtc_key_set(const uint32_t key1, const uint32_t key2,
const uint32_t key3, const uint32_t key4);
/** Set BER interval
\return 0
\return -1 if the interval was out of range
*/
int gtc_bip_interval_set(const uint32_t err_interval);
/** Set threshold values
\return 0
\return -1 if the threshold value out of range
*/
int gtc_threshold_set(const uint8_t sf_thrhld, const uint8_t sd_thrhld);
/** Get GTC status
\return 0
*/
void gtc_ll_status_get(struct gtc_status *param);
/** Enable only PLOAM requests
- true during pre-05
- false during 05
\return 0
*/
void gtc_ploam_request_only_enable(const uint32_t enable);
/** Get BIP value
\return BIP value
*/
uint32_t gtc_bip_value_get(void);
/** Enable / disable downstream GTC interrupts
*/
void gtc_downstream_imask_set(const uint32_t dsimask);
/** Return true if the BW-Map Trace is enabled */
uint32_t gtc_trace_enabled(void);
/** adjust the delay in the transmission path */
void gtc_delay_adjust(uint32_t reset);
/** Get GEM Receive Byte Counter
\return GEM Receive Byte Counter value
*/
uint32_t gtc_gem_rxbcnt_get(void);
/** Get GEM Receive Frame Counter
\return GEM Receive Frame Counter value
*/
uint32_t gtc_gem_rxfcnt_get(void);
/** Get FEC Uncorrectable Error Counter
\return FEC Uncorrectable Error Counter value
*/
uint32_t gtc_gem_fuerrcnt_get(void);
/** refresh RDI indication */
void gtc_refresh_rdi(void);
/** Get GTC counters
\param gem_herr_1 GEM HEC error counter 1
\param gem_herr_2 GEM HEC error counter 2
\param gem_bwmcerr GEM bandwidth map correctable error counter
\param gem_bwmuerr GEM bandwidth map uncorrectable error counter
\param gtc_frcbcnt FEC receive corrected byte counter
\param gtc_fcerrcnt FEC correctable error counter
\param gtc_fuerrcnt FEC uncorrectable error counter
\param gtc_frcnt FEC receive block counter
\param gem_rxfcnt GEM receive frame counter
\param alloc_total GTC All TCONT Counter
\param alloc_lost GTC Rejected TCONT Counter
*/
void gtc_cnt_get(uint32_t *gem_herr_1,
uint32_t *gem_herr_2,
uint32_t *gem_bwmcerr,
uint32_t *gem_bwmuerr,
uint32_t *gtc_frcbcnt,
uint32_t *gtc_fcerrcnt,
uint32_t *gtc_fuerrcnt,
uint32_t *gtc_frcnt,
uint32_t *gem_rxfcnt,
uint32_t *alloc_total,
uint32_t *alloc_lost);
/** Get US header pattern
\param data US pattern data
\return US header length
*/
uint8_t gtc_ll_us_header_cfg_get(uint32_t data[32]);
/** Get low level GTC layer alarm information
\param dsstat GTC downstream status
\param dsistat GTC downstream interrupts status
\param usstat GTC upstream status
\param usistat GTC upstream interrupts status
*/
void gtc_ll_alarm_get(uint32_t *dsstat, uint32_t *dsistat,
uint32_t *usstat, uint32_t *usistat);
/** Set low level GTC DS interrupt status register
\param val GTC downstream interrupt status register content to set
*/
void gtc_ll_dsistat_set(uint32_t val);
/** Set low level GTC US interrupt status register
\param val GTC upstream interrupt status register content to set
*/
void gtc_ll_usistat_set(uint32_t val);
/** Get GTC BW-Map Interrupt Status Register
*/
uint32_t gtc_ll_bwmstat_get(void);
/** Set GTC BW-Map Interrupt Status Register
\param val GTC BW-Map Interrupt Status Register content to set
*/
void gtc_ll_bwmstat_set(uint32_t val);
/** The gtc_cfg_get function is used to read back the basic configuration of
the GTC hardware module.
*/
/** Get low level GTC configuration
\param berrintv GTC BIP error interval
\param rtime GTC ranging time
*/
void gtc_ll_cfg_get(uint32_t *berrintv, uint32_t *rtime);
/** Set the rogue parameter to shut off the transmit laser through reception
of a dedicated PLOAMd message.
\param msg_id PLOAMd rogue ONU message identifier.
\param msg_rpt PLOAMd rogue ONU message required repeat count.
\param msg_enable PLOAMd rogue ONU message reception enable.
\return 0
*/
void gtc_rogue_set(const uint32_t msg_id, const uint32_t msg_rpt,
const uint32_t msg_enable);
/** Retrieve the rogue settings.
\param msg_id PLOAMd rogue ONU message identifier.
\param msg_rpt PLOAMd rogue ONU message required repeat count.
\param msg_enable PLOAMd rogue ONU message reception enable.
\return 0
*/
void gtc_rogue_get(uint32_t *msg_id, uint32_t *msg_rpt,
uint32_t *msg_enable);
#if defined(INCLUDE_DUMP)
/**
Dump the GTC register block.
*/
void gtc_dump(struct seq_file *s);
#endif
/*! @} */
/*! @} */
#endif

513
src/drv_onu_ll_ictrlg.c Normal file
View File

@ -0,0 +1,513 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#include "drv_onu_api.h"
#include "drv_onu_register.h"
#include "drv_onu_ll_sys.h"
#include "drv_onu_ll_ictrlg.h"
//#include "drv_onu_ll_octrlg.h"
#include "drv_onu_resource_gpe.h"
#include "drv_onu_types.h"
static void ictrlg_basic_init(void);
static void ictrlg_gpt_init(void);
static uint16_t free_gpix[ONU_GPE_MAX_GPIX];
void ictrlg_init(void)
{
uint32_t i;
/*
Enable module clock, release reset. This is mandatory before
accessing module's registers.
*/
sys_gpe_hw_activate_or_reboot(SYS_GPE_ACT_GPONI_SET);
/* initializes all registers and tables */
ictrlg_basic_init();
for (i = 0; i < ONU_GPE_MAX_GPIX; i++) {
free_gpix[i] = 0;
ictrlg_w32(0, gpix_cfg[i]);
/* Received and accepted frames counter = 0 */
ictrlg_w32(0, gpix_rxfcnt[i]);
/* Received good bytes counter (upper half) = 0 */
ictrlg_w32(0, gpix_rxbcnth[i]);
/* Received good bytes counter (lower half) = 0 */
ictrlg_w32(0, gpix_rxbcntl[i]);
}
/* reserved for OMCI */
free_gpix[OMCI_GPIX] = 3;
ictrlg_gpt_init();
/* activate the module after all static settings */
/*ictrlg_enable(true);*/
}
int ictrlg_gpix_config_set(const uint32_t gpix, const uint32_t iqn,
const enum gpe_pdu_type pdu_type)
{
uint32_t cfg;
static const uint8_t map[] = { 0, 0, 0, 0, 0, 0, 1, 2 };
if (iqn < 5 || iqn > 7)
return -1;
cfg = 0x0;
/* IQN = 5 for all GPIX, set the two bits = 01 (MSB always 1) */
set_val(cfg, map[iqn], ICTRLG_GPIX_CFG_IQN_MASK,
ICTRLG_GPIX_CFG_IQN_OFFSET);
/* PDU Type = Ethernet for all GPIX */
set_val(cfg, pdu_type, ICTRLG_GPIX_CFG_PDUT_MASK,
ICTRLG_GPIX_CFG_PDUT_OFFSET);
ictrlg_w32(cfg, gpix_cfg[gpix]);
return 0;
}
void ictrlg_gpix_config_get(const uint32_t gpix, uint8_t *iqn,
enum gpe_pdu_type *pdu_type)
{
uint32_t cfg = ictrlg_r32(gpix_cfg[gpix]);
static const uint8_t map[] = { 5, 6, 7, 7 };
*iqn =
map[(cfg & ICTRLG_GPIX_CFG_IQN_MASK) >> ICTRLG_GPIX_CFG_IQN_OFFSET];
*pdu_type =
(enum gpe_pdu_type) (cfg & ICTRLG_GPIX_CFG_PDUT_MASK) >>
ICTRLG_GPIX_CFG_PDUT_OFFSET;
}
/*
pdu_sz_max[8]: configure in ICTRLG, ICTRLG.MAXSIZE[n], n = 0...7
*/
void ictrlg_pdu_size_set(const uint32_t pdu_sz_max[8])
{
int i;
for (i = 0; i < 8; i++)
ictrlg_w32(pdu_sz_max[i] & ICTRLG_MAXSIZE0_SIZE_MASK,
maxsize[i]);
}
void ictrlg_pdu_size_get(uint32_t pdu_sz_max[8])
{
int i;
for (i = 0; i < 8; i++)
pdu_sz_max[i] = ictrlg_r32(maxsize[i]) &
ICTRLG_MAXSIZE0_SIZE_MASK;
}
/** Hardware Programming Details
These are the counters that are provided by the ICTRLG block of the ICTRLG
module. The counters wrap around an need to be checked regularly.
gpix: defines the GEM Port Index (0..ONU_GPE_MAX_GPIX - 1)
nCntDrop: GTC.GEM_HERR_2 + ICTRLG.UNDSIZE + ICGTRLG.OVRSIZE +
ICTRLG.FCSERR + ICTRLG.REASSERR
This is a value that is not related to a specific GEM Port ID and
delivered always, regardless of the selected gem_port_id.
*/
int ictrlg_gem_counter_get(const uint32_t gpix,
struct gpe_cnt_ictrlg_gem_val *counter)
{
uint32_t l, h;
if (gpix >= ONU_GPE_MAX_GPIX)
return -1;
counter->rx_frames = (uint64_t)ictrlg_r32(gpix_rxfcnt[gpix]);
/* First the Low and then the High Part has to be read. No overflow
checks are needed since the HW stores the high part on the low
part read access*/
l = ictrlg_r32(gpix_rxbcntl[gpix]);
h = ictrlg_r32(gpix_rxbcnth[gpix]);
counter->rx_bytes = ((uint64_t)h << 32) | l;
return 0;
}
int ictrlg_counter_get(struct gpe_cnt_ictrlg_val *counter)
{
if (ictrlg_is_enabled()) {
counter->fcserror = ictrlg_r32(fcserr);
counter->undersize_error = ictrlg_r32(undsize);
counter->rx_gem_frames_total = ictrlg_r32(rxtpcnt);
counter->rx_oversized_frames = ictrlg_r32(ovrsize);
counter->omci_drop = ictrlg_r32(badomci);
counter->drop = gtc_r32(downstr_gem_herr_2) +
counter->rx_oversized_frames +
ictrlg_r32(fcserr) + ictrlg_r32(reasserr);
} else {
memset(counter, 0x00, sizeof(struct gpe_cnt_ictrlg_val));
}
return 0;
}
int ictrlg_gpix_get(const uint32_t gem_port_id, uint16_t *gem_port_index)
{
*gem_port_index = ictrlg_r32(gpt[gem_port_id]);
if (*gem_port_index & ICTRLG_GPT_VALID) {
*gem_port_index &= ICTRLG_GPT_GPIX_MASK;
if(*gem_port_index >= ONU_GPE_MAX_GPIX)
return -2;
return 0;
}
return -1;
}
/** Hardware Programming Details
For a given gem_port_id, the following information is returned:
The followig data is returned:
- gem_port_index : read from SDMA/ICTRLG.GPT
- nGEM_PortIngressQueue : read from SDMA/ICTRLG.GPIX_CFG.IQN
- eGEM_PortEnable : read from SDMA/ICTRLG.GPT
- tcont_idx :
- data_direction - downstream GTC, upstream GPE
If eGEM_PortEnable == false, gem_port_index and nGEM_PortIngressQueue are
invalid and shall be ignored (set to 0).
*/
int ictrlg_gem_port_get(const uint32_t gem_port_id,
uint32_t *gem_port_enable, uint32_t *gem_port_is_omci,
uint32_t *gem_port_is_mc, uint32_t *gem_port_index,
enum gpe_direction *data_direction)
{
enum gpe_pdu_type pdu_type;
uint8_t iqn;
uint16_t gpix;
*gem_port_index = 0;
*gem_port_is_mc = false;
*gem_port_is_omci = false;
*data_direction = 0;
*gem_port_enable = false;
if (ictrlg_gpix_get(gem_port_id, &gpix) != 0)
return -1;
*gem_port_enable = true;
*gem_port_index = gpix;
*data_direction = free_gpix[gpix];
ictrlg_gpix_config_get(gpix, &iqn, &pdu_type);
if (pdu_type == GPE_PDU_TYPE_IP || pdu_type == GPE_PDU_TYPE_OMCI) {
*gem_port_is_omci = true;
} else {
if (iqn == ONU_GPE_INGRESS_QUEUE_GEM_MC)
*gem_port_is_mc = true;
}
return 0;
}
int ictrlg_gem_port_set(const uint32_t gem_port_id,
const uint32_t gem_port_is_omci,
const uint32_t gem_port_is_mc,
const uint32_t gem_port_index,
const enum gpe_direction data_direction)
{
free_gpix[gem_port_index] = (uint16_t)data_direction;
if (((uint8_t)data_direction &
(uint8_t)GPE_DIRECTION_DOWNSTREAM) == 0)
/* the entry in gpt is essential for delete & get operation */
return -1;
if ((uint8_t)data_direction & (uint8_t)GPE_DIRECTION_DOWNSTREAM) {
if (gem_port_is_omci == true) {
if(is_falcon_chip_a2x()) {
ictrlg_gpix_config_set( gem_port_index,
ONU_GPE_INGRESS_QUEUE_OMCI,
GPE_PDU_TYPE_OMCI);
} else {
ictrlg_gpix_config_set( gem_port_index,
ONU_GPE_INGRESS_QUEUE_OMCI,
GPE_PDU_TYPE_IP);
}
} else {
ictrlg_gpix_config_set(gem_port_index,
gem_port_is_mc == true ?
ONU_GPE_INGRESS_QUEUE_GEM_MC :
ONU_GPE_INGRESS_QUEUE_GEM_UC,
GPE_PDU_TYPE_ETH);
}
/* the entry in gpt is essential for
delete & get operation */
ictrlg_w32(gem_port_index | ICTRLG_GPT_VALID,
gpt[gem_port_id]);
}
return 0;
}
/*
Mark the GEM Port ID invalid in the GEM Port table (ICTRLG.GPT.VALID)
Set the GEM Port ID to 0 in the GPIX table (OCTRLG.GPIXTABLE[n].GPID[n])
*/
int ictrlg_gem_port_delete(const uint32_t gem_port_id)
{
uint16_t gpix = 0;
if (ictrlg_gpix_get(gem_port_id, &gpix) != 0)
return -1;
if (gpix >= ONU_GPE_MAX_GPIX)
return -1;
ictrlg_w32_mask(ICTRLG_GPT_VALID, 0, gpt[gem_port_id]);
/** \todo the OCTRLG should be deleted at correct place not here */
free_gpix[gpix] = 0;
return 0;
}
/*
ICTRLG.MAXSIZE0 = ONU_GPE_MAX_ETHERNET_FRAME_LENGTH
ICTRLG.MAXSIZE1 = ONU_GPE_MAX_IP_FRAME_LENGTH
ICTRLG.MAXSIZE2 = ONU_GPE_MAX_MPLS_FRAME_LENGTH
ICTRLG.MAXSIZE3 = 1984
ICTRLG.MAXSIZE4 = 0 (reserved)
ICTRLG.MAXSIZE5 = 0 (reserved)
ICTRLG.MAXSIZE6 = 0 (reserved)
ICTRLG.MAXSIZE7 = 0 (reserved)
ICTRLG.GPT.VALID[0..4096] = 0b0
ICTRLG.GPT.GPIX[0..4096] = 0x00
ICTRLG.TIMEOUT.LIMIT = ONU_GPE_DEFAULT_REASSEMBLY_TIMEOUT_VALUE
*/
STATIC void ictrlg_basic_init(void)
{
uint32_t cfg;
const uint32_t pdu_size_max[8] = { ONU_GPE_MAX_ETHERNET_FRAME_LENGTH,
ONU_GPE_MAX_IP_FRAME_LENGTH,
ONU_GPE_MAX_MPLS_FRAME_LENGTH,
1984,
0, 0, 0, 0
};
/*
- RAW mode disabled
- CRC enabled
- Soft reset disabled
- ICTRLG block disabled
*/
ictrlg_w32(ICTRLG_CTRL_CRC_EN, ctrl);
/*
- Queue for Alloc commands = 1
- Queue for Free commands = 1
*/
cfg = ICTRLG_DMAW_CFG_ALLOCQ | ICTRLG_DMAW_CFG_FREEQ;
/* 32 wait cycles */
set_val(cfg, 0x20, ICTRLG_DMAW_CFG_LSARLMT_MASK,
ICTRLG_DMAW_CFG_LSARLMT_OFFSET);
ictrlg_w32(cfg, dmaw_cfg);
/* Reassembly Timeout = 10ms */
cfg = 0;
set_val(cfg, 0x2F9B80, ICTRLG_TIMEOUT_LIMIT_MASK,
ICTRLG_TIMEOUT_LIMIT_OFFSET);
ictrlg_w32(cfg, timeout);
ictrlg_pdu_size_set(&pdu_size_max[0]);
/* Upper Half of Received Bytes Counter = 0 */
ictrlg_w32(0, rxbcnth);
/* Lower Half of Received Bytes Counter = 0 */
ictrlg_w32(0, rxbcntl);
/* Number of oversized PDUs = 0 */
ictrlg_w32(0, ovrsize);
/* Number of errors from DMAW = 0 */
ictrlg_w32(0, dmawerr);
/* Number of discarded OMCI messages = 0 */
ictrlg_w32(0, badomci);
/* Number of FCS errors = 0 */
ictrlg_w32(0, fcserr);
/* Number of reassembly errors = 0 */
ictrlg_w32(0, reasserr);
/* Disable all interrupts */
ictrlg_w32(0, irncr);
ictrlg_w32(0, irnicr);
ictrlg_w32(0, irnen);
}
STATIC void ictrlg_gpt_init(void)
{
uint32_t i;
for (i = 0; i < GPT_LEN; i++)
ictrlg_w32(0, gpt[i]);
}
uint16_t ictrlg_gpix_free_get(void)
{
uint32_t i;
for (i = 0; i < ONU_GPE_MAX_GPIX; i++)
if (free_gpix[i] == 0)
return i;
return ONU_GPE_MAX_GPIX;
}
void ictrlg_enable(const uint32_t act)
{
/* enable/disable the module */
ictrlg_w32_mask(ICTRLG_CTRL_ACT_EN, act ? ICTRLG_CTRL_ACT_EN : 0, ctrl);
}
uint32_t ictrlg_is_enabled(void)
{
return (ictrlg_r32(ctrl) & ICTRLG_CTRL_ACT_EN) ? true : false;
}
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void ictrlg_debug_mode_set(const uint32_t act)
{
ictrlg_w32_mask(act, ICTRLG_CTRL_DBG_EN, ctrl);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void ictrlg_debug_mode_get(uint32_t *act)
{
*act = (ictrlg_r32(ctrl) & ICTRLG_CTRL_DBG_EN) ? true : false;
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void ictrlg_crc_check_set(const uint32_t act)
{
ictrlg_w32_mask(act, ICTRLG_CTRL_CRC_EN, ctrl);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void ictrlg_crc_check_get(uint32_t *act)
{
*act = (ictrlg_r32(ctrl) & ICTRLG_CTRL_CRC_EN) ? true : false;
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void ictrlg_interrupt_mask_set(const uint32_t mask)
{
ictrlg_w32(mask, irnen);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void ictrlg_interrupt_set(const uint32_t val)
{
ictrlg_w32(val, irnicr);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void ictrlg_interrupt_get(uint32_t *val)
{
*val = ictrlg_r32(irncr);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#if defined(INCLUDE_DUMP)
void ictrlg_dump(struct seq_file *s)
{
if (sys_gpe_hw_is_activated(SYS_GPE_ACT_GPONI_SET) == 0) {
seq_printf(s, "ictrlg not activated\n");
return;
}
#define dump_reg(reg) \
seq_printf(s, "%-14s = 0x%08x\n", # reg, ictrlg_r32(reg))
dump_reg(ctrl);
dump_reg(dmaw_cfg);
dump_reg(timeout);
dump_reg(ovrsize);
dump_reg(dmawerr);
dump_reg(badomci);
dump_reg(fcserr);
dump_reg(reasserr);
dump_reg(undsize);
dump_reg(pdc);
dump_reg(rxtpcnt);
dump_reg(irnicr);
#undef dump_reg
}
void ictrlg_table_dump(struct seq_file *s)
{
uint32_t i, k;
if (sys_gpe_hw_is_activated(SYS_GPE_ACT_GPONI_SET) == 0) {
seq_printf(s, "ictrlg not activated\n");
return;
}
seq_printf(s, "max_size table\n");
for (i = 0; i < 8;) {
seq_printf(s, "%08x: ", (unsigned int)&ictrlg->maxsize[i]);
for (k = 0; k < 16 && i < 8; k++, i++)
seq_printf(s, "%08x ", ictrlg_r32(maxsize[i]));
seq_printf(s, "\n");
}
seq_printf(s, "gpt table\n");
for (i = 0; i < GPT_LEN;) {
seq_printf(s, "%08x: ", (unsigned int)&ictrlg->gpt[i]);
for (k = 0; k < 16 && i < GPT_LEN; k++, i++)
seq_printf(s, "%08x ", ictrlg_r32(gpt[i]));
seq_printf(s, "\n");
}
seq_printf(s, "gpix_cfg table\n");
for (i = 0; i < ONU_GPE_MAX_GPIX;) {
seq_printf(s, "%08x: ", (unsigned int)&ictrlg->gpix_cfg[i]);
for (k = 0; k < 16 && i < ONU_GPE_MAX_GPIX; k++, i++)
seq_printf(s, "%08x ", ictrlg_r32(gpix_cfg[i]));
seq_printf(s, "\n");
}
seq_printf(s, "gpix_rxfcnt table\n");
for (i = 0; i < ONU_GPE_MAX_GPIX;) {
seq_printf(s, "%08x: ", (unsigned int)&ictrlg->gpix_rxfcnt[i]);
for (k = 0; k < 16 && i < ONU_GPE_MAX_GPIX; k++, i++)
seq_printf(s, "%08x ", ictrlg_r32(gpix_rxfcnt[i]));
seq_printf(s, "\n");
}
seq_printf(s, "free_gpix table\n");
for (i = 0; i < ONU_GPE_MAX_GPIX;) {
for (k = 0; k < 16 && i < ONU_GPE_MAX_GPIX; k++, i++)
seq_printf(s, "%01x ", free_gpix[i]);
seq_printf(s, "\n");
}
}
#endif

213
src/drv_onu_ll_ictrlg.h Normal file
View File

@ -0,0 +1,213 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_ictrlg_h
#define _drv_onu_ictrlg_h
/** \addtogroup ONU_LL_REFERENCE GPON Low-level Functions
@{
*/
/** \addtogroup ONU_LL_ICTRLG GPON Input Control Low-level Functions
Low-level functions to access the GPON input control unit (ICTRLG).
@{
*/
#define GPT_LEN 4096
/**
Initialize the ICTRLG block (ictrlg).
*/
void ictrlg_init(void);
/** Retrieve a free GPIX entry */
uint16_t ictrlg_gpix_free_get(void);
/**
Set Maximum PDU size in downstream direction.
\param pdu_sz_max Maximum PDU size in downstream direction
*/
void ictrlg_pdu_size_set(const uint32_t pdu_sz_max[8]);
/**
Get Maximum PDU size in downstream direction.
\param pdu_sz_max Maximum PDU size in downstream direction
*/
void ictrlg_pdu_size_get(uint32_t pdu_sz_max[8]);
/**
Set configuration for the GPIX table.
\param gem_port_index GEM port index (0-255)
\param iqn Ingress queue number (5-7)
\param pdu_type PDU type, base Protocol for each GEM port
*/
int ictrlg_gpix_config_set(const uint32_t gem_port_index, const uint32_t iqn,
const enum gpe_pdu_type pdu_type);
/**
Retrieve the GEM port index (0-255) using the GEM port ID (0-4095).
\param gem_port_id GEM port ID (0-4095)
\param gem_port_index point to GPIX number
\return
- -1 on error
- 0 on success
*/
int ictrlg_gpix_get(const uint32_t gem_port_id, uint16_t *gem_port_index);
/**
Get GEM port table entry.
\param gem_port_id GEM port ID (0-4095)
\param gem_port_enable Get value of port enable bit
\param gem_port_is_omci Get value of PDU type information
\param gem_port_is_mc Get value of Ingress Queue number
(IQN: 5= Unicast, 6=Multicast, 7=OMCI)
\param gem_port_index Returned GPIX
\param data_direction Get value of data direction
*/
int ictrlg_gem_port_get(const uint32_t gem_port_id, uint32_t *gem_port_enable,
uint32_t *gem_port_is_omci, uint32_t *gem_port_is_mc,
uint32_t *gem_port_index,
enum gpe_direction * data_direction);
/**
Set GEM port table entry.
\param gem_port_id GEM port ID (0-4095)
\param gem_port_is_omci PDU type information
\param gem_port_is_mc Ingress Queue number information
(IQN: 5= Unicast, 6=Multicast, 7=OMCI)
\param gem_port_index GEM port index (0-255)
\param data_direction Data direction of GEM port
*/
int ictrlg_gem_port_set(const uint32_t gem_port_id,
const uint32_t gem_port_is_omci,
const uint32_t gem_port_is_mc,
const uint32_t gem_port_index,
const enum gpe_direction data_direction);
/**
Remove a new GEM port table entry.
\param gem_port_id GEM port ID (0-4095)
*/
int ictrlg_gem_port_delete(const uint32_t gem_port_id);
/**
Read GEM port related hardware counter.
\param gpix GEM port index
\param counter Get value of GEM port counter
*/
int ictrlg_gem_counter_get(const uint32_t gpix,
struct gpe_cnt_ictrlg_gem_val *counter);
/**
Read global GEM hardware counter.
\param counter Get value of GEM global counter
*/
int ictrlg_counter_get(struct gpe_cnt_ictrlg_val *counter);
/**
Set ICTRLG enable bit.
Use this function to enable or disable the ICTRLG.
\param act Set value
*/
void ictrlg_enable(const uint32_t act);
/**
Get ICTRLG enable bit.
Use this function to get status of the ICTRLG enable bit.
*/
uint32_t ictrlg_is_enabled(void);
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set ICTRLG debug mode bit.
If this bit is set, ICTRL will always write out data to IQM, regardless if
IQM FIFO is ready or not.
\param act Set value
*/
void ictrlg_debug_mode_set(const uint32_t act);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get ICTRLG debug mode bit.
\param act Get value
*/
void ictrlg_debug_mode_get(uint32_t *act);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set GEM port CRC check enable bit.
If set, this bit enables the CRC checking for OMCI and Ethernet frames.
\param act Set value
*/
void ictrlg_crc_check_set(const uint32_t act);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get GEM port CRC check enable bit.
\param act Get value
*/
void ictrlg_crc_check_get(uint32_t *act);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set specified interrupt mask.
Disabled interrupts are not visible in the IRNCR register and are not
signalled via the interrupt line towards the controller.
\param mask Set value
*/
void ictrlg_interrupt_mask_set(const uint32_t mask);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set an specified interrupt.
A write operation directly effects the interrupts.
This can be used to trigger events under software control for testing
purposes.
\param val Set value
*/
void ictrlg_interrupt_set(const uint32_t val);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get currently active interrupt events masked with the corresponding enable
bits of the IRNEN register.
The interrupts can be acknowledged by a write operation.
\param val Get value
*/
void ictrlg_interrupt_get(uint32_t *val);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#if defined(INCLUDE_DUMP)
/**
Dump the ICTRLL register block.
*/
void ictrlg_dump(struct seq_file *s);
/**
Dump the ICTRLL table block.
*/
void ictrlg_table_dump(struct seq_file *s);
#endif
/*! @} */
/*! @} */
#endif

294
src/drv_onu_ll_ictrll.c Normal file
View File

@ -0,0 +1,294 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#include "drv_onu_api.h"
#include "drv_onu_gpe_api.h"
#include "drv_onu_register.h"
#include "drv_onu_ll_sys.h"
#include "drv_onu_ll_ictrll.h"
STATIC void ictrll_basic_init(const uint32_t uni_port_id);
static const uint32_t port_offset[4] = { 0, 128, 256, 384 };
void ictrll_init(const uint16_t port_id)
{
static const uint32_t lan_act_en[4] = {SYS_GPE_ACT_LAN0_SET,
SYS_GPE_ACT_LAN1_SET,
SYS_GPE_ACT_LAN2_SET,
SYS_GPE_ACT_LAN3_SET};
/*
Enable module clock, release reset. This is mandatory before
accessing module's registers.
*/
sys_gpe_hw_activate_or_reboot(lan_act_en[port_id]);
/* initialize all registers */
ictrll_basic_init(port_id);
}
uint32_t ictrll_pcnt_get(const uint8_t uni_port_id)
{
return ictrll_r32_table(rxpcnt, port_offset[uni_port_id]);
}
uint32_t ictrll_pdc_get(const uint8_t uni_port_id)
{
return ictrll_r32_table(pdc, port_offset[uni_port_id]);
}
/**
Read hardware counter.
*/
/** Hardware Programming Details
These are the counters that are provided by the ICTRL blocks of the SDMA
modules. The counters wrap around an need to be checked regularly.
*/
int ictrll_counter_get(const uint8_t uni_port_id,
struct ictrll_counter *counter)
{
if (uni_port_id >= ONU_GPE_MAX_ETH_UNI)
return -1;
counter->rx_bytes =
(uint64_t)ictrll_r32_table(rxbcntl,
port_offset[uni_port_id]);
counter->rx_bytes |=
(((uint64_t)ictrll_r32_table(rxbcnth,
port_offset[uni_port_id])) << 32);
counter->rx_oversized_frames =
(uint64_t)ictrll_r32_table(ovrsize,
port_offset[uni_port_id]);
counter->rx_frames =
(uint64_t)ictrll_r32_table(rxpcnt,
port_offset[uni_port_id]);
counter->rx64 = (uint64_t)ictrll_r32_table(rxp64cnt,
port_offset[uni_port_id]);
counter->rx65 = (uint64_t)ictrll_r32_table(rxp65cnt,
port_offset[uni_port_id]);
counter->rx128 = (uint64_t)ictrll_r32_table(rxp128cnt,
port_offset[uni_port_id]);
counter->rx256 = (uint64_t)ictrll_r32_table(rxp256cnt,
port_offset[uni_port_id]);
counter->rx512 = (uint64_t)ictrll_r32_table(rxp512cnt,
port_offset[uni_port_id]);
counter->rx1024 = (uint64_t)ictrll_r32_table(rxp1024cnt,
port_offset[uni_port_id]);
counter->rx1519 = (uint64_t)ictrll_r32_table(rxp1519cnt,
port_offset[uni_port_id]);
counter->rx_undersized_frames =
(uint64_t)ictrll_r32_table(undsize,
port_offset[uni_port_id]);
counter->dma_write_error =
(uint64_t)ictrll_r32_table(dmawerr,
port_offset[uni_port_id]);
counter->mac_error =
(uint64_t)ictrll_r32_table(macerr,
port_offset[uni_port_id]);
return 0;
}
int ictrll_macerr_get(const uint8_t uni_port_id,
uint32_t *mac_error)
{
if (uni_port_id >= ONU_GPE_MAX_ETH_UNI)
return -1;
*mac_error = ictrll_r32_table(macerr, port_offset[uni_port_id]);
return 0;
}
/*
ICTRL0.MAXSIZE0 = ONU_GPE_MAX_ETHERNET_FRAME_LENGTH
ICTRL1.MAXSIZE0 = ONU_GPE_MAX_ETHERNET_FRAME_LENGTH
ICTRL2.MAXSIZE0 = ONU_GPE_MAX_ETHERNET_FRAME_LENGTH
ICTRL3.MAXSIZE0 = ONU_GPE_MAX_ETHERNET_FRAME_LENGTH
*/
STATIC void ictrll_basic_init(const uint32_t i)
{
uint32_t cfg;
/*
Register CTRL
- RAW mode disabled
- Broadcast Filter for Raw Mode disabled
- Debug Mode disabled
- ICTRL disabled
*/
ictrll_w32_table(0, ctrl, port_offset[i]);
/*
Register DMAW_CFG
- Queue for Alloc commands = 1
- Queue for Free commands = 1
- 32 wait cycles
*/
cfg = ICTRLL_DMAW_CFG_ALLOCQ | ICTRLL_DMAW_CFG_FREEQ;
set_val(cfg, 0x20, ICTRLL_DMAW_CFG_LSARLMT_MASK,
ICTRLL_DMAW_CFG_LSARLMT_OFFSET);
ictrll_w32_table(cfg, dmaw_cfg, port_offset[i]);
/* Ethernet DA (high adr) = 0 */
ictrll_w32_table(0, rawda1, port_offset[i]);
/* Ethernet DA (low adr) = 0 */
ictrll_w32_table(0, rawda0, port_offset[i]);
/* max size for Ethernet: ONU_GPE_MAX_ETHERNET_FRAME_LENGTH */
ictrll_w32_table(ONU_GPE_MAX_ETHERNET_FRAME_LENGTH, maxsize,
port_offset[i]);
/* Initialize all counters = 0 */
ictrll_w32_table(0, rxbcnth, port_offset[i]);
ictrll_w32_table(0, rxbcntl, port_offset[i]);
ictrll_w32_table(0, ovrsize, port_offset[i]);
ictrll_w32_table(0, dmawerr, port_offset[i]);
ictrll_w32_table(0, macerr, port_offset[i]);
ictrll_w32_table(0, rxpcnt, port_offset[i]);
ictrll_w32_table(0, rxp64cnt, port_offset[i]);
ictrll_w32_table(0, rxp65cnt, port_offset[i]);
ictrll_w32_table(0, rxp128cnt, port_offset[i]);
ictrll_w32_table(0, rxp256cnt, port_offset[i]);
ictrll_w32_table(0, rxp512cnt, port_offset[i]);
ictrll_w32_table(0, rxp1024cnt, port_offset[i]);
ictrll_w32_table(0, rxp1519cnt, port_offset[i]);
ictrll_w32_table(0, undsize, port_offset[i]);
/* Disable all interrupts */
ictrll_w32_table(0, irncr, port_offset[i]);
ictrll_w32_table(0, irnicr, port_offset[i]);
ictrll_w32_table(0, irnen, port_offset[i]);
}
void ictrll_enable(const uint16_t port_id, const bool value)
{
ictrll_w32_table_mask( ICTRLL_CTRL_ACT_EN,
value ? ICTRLL_CTRL_ACT_EN : 0,
ctrl, port_offset[port_id]);
}
bool ictrll_is_enabled(const uint16_t port_id)
{
return (ictrll_r32_table(ctrl,
port_offset[port_id]) & ICTRLL_CTRL_ACT_EN) ?
true : false;
}
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void ictrll_debug_mode_set(const uint16_t port_id, const bool value)
{
ictrll_w32_table_mask(ICTRLL_CTRL_DBG_EN,
value ? ICTRLL_CTRL_DBG_EN : 0, ctrl,
port_offset[port_id]);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void ictrll_debug_mode_get(const uint16_t port_id, bool *value)
{
*value = (ictrll_r32_table(ctrl, port_offset[port_id]) &
ICTRLL_CTRL_DBG_EN) ? true : false;
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void ictrll_bc_mode_set(const uint16_t port_id, const bool value)
{
ictrll_w32_table_mask(ICTRLL_CTRL_BC_EN,
value ? ICTRLL_CTRL_BC_EN : 0, ctrl,
port_offset[port_id]);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void ictrll_bc_mode_get(const uint16_t port_id, bool *value)
{
*value = (ictrll_r32_table(ctrl, port_offset[port_id]) &
ICTRLL_CTRL_BC_EN) ? true : false;
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
void ictrll_max_size_pdu_type0_set(const uint16_t port_id, const uint16_t value)
{
ictrll_w32_table(value, maxsize, port_offset[port_id]);
}
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void ictrll_max_size_pdu_type0_get(const uint16_t port_id, uint16_t *value)
{
*value =
(ictrll_r32_table(maxsize, port_offset[port_id]) &
ICTRLL_MAXSIZE0_SIZE_MASK) >> ICTRLL_MAXSIZE0_SIZE_OFFSET;
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void ictrll_interrupt_mask_set(const uint16_t port_id, const uint32_t value)
{
ictrll_w32_table(value, irnen, port_offset[port_id]);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void ictrll_interrupt_set(const uint16_t port_id, const uint32_t value)
{
ictrll_w32_table(value, irnicr, port_offset[port_id]);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void ictrll_interrupt_get(const uint16_t port_id, uint32_t *value)
{
*value = ictrll_r32_table(irncr, port_offset[port_id]);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#if defined(INCLUDE_DUMP)
void ictrll_dump(struct seq_file *s)
{
uint32_t i;
seq_printf(s, " ictrll, ctrl,dmaw_cfg, rxpcnt, maxsize, "
"ovrsize, undsize, dmawerr, macerr, pdc, "
"rxpcnt, irnicr\n");
for (i = 0; i < ONU_GPE_MAX_ETH_UNI; i++) {
if (sys_gpe_hw_is_activated(SYS_GPE_ACT_LAN0_SET << i) == 0) {
seq_printf(s, "ictrll%d not activated\n", i);
continue;
}
seq_printf(s, "%08x,", ictrll_adr_table(ctrl, port_offset[i]));
seq_printf(s, "%08x,", ictrll_r32_table(ctrl, port_offset[i]));
seq_printf(s, "%08x,",
ictrll_r32_table(dmaw_cfg, port_offset[i]));
seq_printf(s, "%08x,",
ictrll_r32_table(rxpcnt, port_offset[i]));
seq_printf(s, "%08x,",
ictrll_r32_table(maxsize, port_offset[i]));
seq_printf(s, "%08x,",
ictrll_r32_table(ovrsize, port_offset[i]));
seq_printf(s, "%08x,",
ictrll_r32_table(undsize, port_offset[i]));
seq_printf(s, "%08x,",
ictrll_r32_table(dmawerr, port_offset[i]));
seq_printf(s, "%08x,",
ictrll_r32_table(macerr, port_offset[i]));
seq_printf(s, "%08x,",
ictrll_r32_table(pdc, port_offset[i]));
seq_printf(s, "%08x,",
ictrll_r32_table(rxpcnt, port_offset[i]));
seq_printf(s, "%08x\n",
ictrll_r32_table(irnicr, port_offset[i]));
}
}
#endif

175
src/drv_onu_ll_ictrll.h Normal file
View File

@ -0,0 +1,175 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_ictrll_h
#define _drv_onu_ictrll_h
#include "drv_onu_types.h"
/** \addtogroup ONU_LL_REFERENCE GPON Low-level Functions
@{
*/
/** \addtogroup ONU_LL_ICTRLL LAN Input Control Low-level Functions
Low-level functions to access the LAN input control unit (ICTRLL).
@{
*/
/**
Initialize the ICTRLL block (ictrll).
\param port_id LAN port ID
*/
void ictrll_init(const uint16_t port_id);
/**
Read RX packets counter.
\param uni_port_id The LAN port ID
*/
uint32_t ictrll_pcnt_get(const uint8_t uni_port_id);
/**
Read Packet Discard Counter.
\param uni_port_id The LAN port ID
\return Packet Discard Counter value
*/
uint32_t ictrll_pdc_get(const uint8_t uni_port_id);
/**
Read hardware counter.
\param uni_port_id The LAN port ID
\param counter Get value of LAN port counter
*/
int ictrll_counter_get(const uint8_t uni_port_id,
struct ictrll_counter *counter);
int ictrll_macerr_get(const uint8_t uni_port_id,
uint32_t *mac_error);
/**
Set LAN port enable bit.
Use this function to enable or disable a LAN port.
\param port_id The LAN port ID
\param value Set value
*/
void ictrll_enable(const uint16_t port_id, const bool value);
/**
Get LAN port enable bit.
Use this function to get status of a LAN port enable bit.
\param port_id The LAN port ID
*/
bool ictrll_is_enabled(const uint16_t port_id);
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set LAN port debug mode bit.
If this bit is set, ICTRL will always write out data to IQM, regardless
if IQM FIFO is ready or not.
\param port_id The LAN port ID
\param value Set value
*/
void ictrll_debug_mode_set(const uint16_t port_id, const bool value);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get LAN port debug mode bit.
\param port_id The LAN port ID
\param value Get value
*/
void ictrll_debug_mode_get(const uint16_t port_id, bool *value);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set LAN port broadcast filter for RAW mode bit.
If this bit is set, all packets with destination address 0xFFFF_FFFF_FFFF
are accepted.
\param port_id The LAN port ID
\param value Set value
*/
void ictrll_bc_mode_set(const uint16_t port_id, const bool value);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get LAN port broadcast filter for RAW mode bit.
\param port_id The LAN port ID
\param value Get value
*/
void ictrll_bc_mode_get(const uint16_t port_id, bool *value);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
/**
Set maximum allowed PDU size for PDU type 0 (Ethernet mode).
\param port_id The LAN port ID
\param value Set value
*/
void ictrll_max_size_pdu_type0_set(const uint16_t port_id,
const uint16_t value);
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get maximum allowed PDU size for PDU type 0 (Ethernet mode).
\param port_id The LAN port ID
\param value Get value
*/
void ictrll_max_size_pdu_type0_get(const uint16_t port_id, uint16_t *value);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set specified interrupt mask.
Disabled interrupts are not visible in the IRNCR register and are not
signalled via the interrupt line towards the controller.
\param port_id The LAN port ID
\param value Set value
*/
void ictrll_interrupt_mask_set(const uint16_t port_id, const uint32_t value);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set an specified interrupt.
A write operation directly effects the interrupts.
This can be used to trigger events under software control for testing
purposes.
\param port_id The LAN port ID
\param value Set value
*/
void ictrll_interrupt_set(const uint16_t port_id, const uint32_t value);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get currently active interrupt events masked with the corresponding enable
bits of the IRNEN register.
The interrupts can be acknowledged by a write operation.
\param port_id The LAN port ID
\param value Get value
*/
void ictrll_interrupt_get(const uint16_t port_id, uint32_t *value);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#if defined(INCLUDE_DUMP)
/**
Dump the ICTRLL register block.
*/
void ictrll_dump(struct seq_file *s);
#endif
/*! @} */
/*! @} */
#endif

581
src/drv_onu_ll_iqm.c Normal file
View File

@ -0,0 +1,581 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#include "drv_onu_api.h"
#include "drv_onu_register.h"
#include "drv_onu_resource_gpe.h"
#include "drv_onu_ll_sys.h"
#include "drv_onu_ll_iqm.h"
#define IQM_SSB_SIZE 0x400
#define MAX_QUEUE 9
/** \addtogroup ONU_MAPI_REFERENCE_INTERNAL
@{
*/
/** \defgroup ONU_IQM_INTERNAL GPE - IQM Interface
@{
*/
/** Number of Ingress Packet Pointers */
#define NUM_IPP 3072
STATIC void iqm_iqt_write(const uint16_t queue_idx,
const struct iqm_iqt_entry *entry)
{
uint32_t iqtr;
iqtr = 0;
if (entry->qe)
iqtr |= IQM_IQT00_QE;
set_val(iqtr, entry->qrth, IQM_IQT00_QRTH_MASK, IQM_IQT00_QRTH_OFFSET);
set_val(iqtr, entry->qdth, IQM_IQT00_QDTH_MASK, IQM_IQT00_QDTH_OFFSET);
iqm_w32(iqtr, iqt[queue_idx].iqt0);
iqtr = 0;
if (entry->qb)
iqtr |= IQM_IQT01_QB;
set_val(iqtr, entry->qbth, IQM_IQT01_QBTH_MASK, IQM_IQT01_QBTH_OFFSET);
set_val(iqtr, entry->qbtl, IQM_IQT01_QBTL_MASK, IQM_IQT01_QBTL_OFFSET);
iqm_w32(iqtr, iqt[queue_idx].iqt1);
iqtr = 0;
if (entry->qf)
iqtr |= IQM_IQT02_QF;
if (entry->bp)
iqtr |= IQM_IQT02_BP;
set_val(iqtr, entry->pocc, IQM_IQT02_POCC_MASK, IQM_IQT02_POCC_OFFSET);
set_val(iqtr, entry->qocc, IQM_IQT02_QOCC_MASK, IQM_IQT02_QOCC_OFFSET);
iqm_w32(iqtr, iqt[queue_idx].iqt2);
iqtr = 0;
set_val(iqtr, entry->qdc, IQM_IQT03_QDC_MASK, IQM_IQT03_QDC_OFFSET);
iqm_w32(iqtr, iqt[queue_idx].iqt3);
iqm_w32(entry->tmask, iqt[queue_idx].iqt5);
}
void iqm_enable(bool act)
{
iqm_w32_mask(IQM_CTRL_ACT_EN, act ? IQM_CTRL_ACT_EN : 0, ctrl);
}
bool iqm_is_enabled(void)
{
return (iqm_r32(ctrl) & IQM_CTRL_ACT_EN) ? true : false;
}
/**
- Disable and clear all ingress queues
IQM.IQT[n]0.QE = EN, [n] = 0 ... number of ingress queues - 1
IQM.IQT[n]1.QB = EN, [n] = 0 ... number of ingress queues - 1
\todo to be clarified if ingress queues must be cleared during operation.
SW concept yet missing
*/
void iqm_init(void)
{
/* initialization such that all queues are enabled and blocked
all discard thresholds set to max, no reservation
all 36 WRR slots allocated
all queues can transmit to all threads
*/
int i;
uint16_t queue_idx;
struct iqm_iqt_entry iqt_entry;
static const uint32_t qid[5] = {
0x76543210,
0x65432108,
0x54321087,
0x43210876,
0x32108765,
};
/*
Enable module clock, release reset. This is mandatory before
accessing module's registers.
*/
sys_gpe_hw_activate_or_reboot(SYS_GPE_ACT_IQM_SET | SYS_GPE_ACT_CPUI);
iqm_w32(0, irncr);
iqm_w32(0, irnicr);
iqm_w32(IQM_CTRL_FRZ, ctrl);
iqm_w32(IQM_IRNCR_QF7, irnen);
/* for all ingress queues write default start table entry */
iqt_entry.qe = 1; /* queue enable */
/* queue discard threshold (2304 lowest value such that queue
occupies complete SSB) */
iqt_entry.qdth = 0x30;
iqt_entry.qrth = 0; /* queue reservation threshold */
iqt_entry.qb = 1; /* queue blocked */
/* queue backpressure threshold high (no backpressure) */
iqt_entry.qbth = 0x30;
/* queue backpressure threshold low (no backpressure) */
iqt_entry.qbtl = 0;
iqt_entry.qf = 0; /* status bit set to 0 */
iqt_entry.bp = 0; /* status bit set to 0 */
iqt_entry.pocc = 0; /* PDU occupancy counter */
iqt_entry.qocc = 0; /* queue occupancy counter */
iqt_entry.qdc = 0; /* queue PDU discard counter */
iqt_entry.tmask = 0;
for (queue_idx = 0; queue_idx < MAX_QUEUE; queue_idx++) {
switch (queue_idx) {
case ONU_GPE_INGRESS_QUEUE_LAN_0:
case ONU_GPE_INGRESS_QUEUE_CPU_DS:
case ONU_GPE_INGRESS_QUEUE_CPU_US:
case ONU_GPE_INGRESS_QUEUE_GEM_UC:
/* enable all FW threads */
iqt_entry.tmask = 0x3ffff;
/* forward to hardware/SCI */
iqt_entry.qb = 0;
break;
case ONU_GPE_INGRESS_QUEUE_LAN_1:
case ONU_GPE_INGRESS_QUEUE_LAN_2:
case ONU_GPE_INGRESS_QUEUE_LAN_3:
case ONU_GPE_INGRESS_QUEUE_GEM_MC:
/* enable all FW threads */
iqt_entry.tmask = 0x3ffff;
iqt_entry.qb = 0;
break;
case ONU_GPE_INGRESS_QUEUE_OMCI:
/* enable link1 */
iqt_entry.tmask = (1 << 19);
iqt_entry.qb = 0;
iqt_entry.qdth = 0x30;
break;
default:
break;
}
iqm_iqt_write(queue_idx, &iqt_entry);
}
iqm_w32(NUM_IPP, fpcr);
iqm_w32(0, gocc);
iqm_w32(0, gpdc);
iqm_w32(0, ts);
/* total SSB capacity in Segments (=4096) */
iqm_w32(IQM_SSB_SIZE, goth);
iqm_w32(36, wrrc); /* 36 slots in WRR used */
for (i = 0; i < 5; i++)
/* all queues treated equally */
iqm_w32(qid[i], wrrq[i]);
/* sfreeX shouldn't be initialized */
iqm_w32(0, drc);
iqm_w32_mask(IQM_CTRL_FRZ, 0, ctrl);
/* Set the timestamp prescaler to (module clock) / (2**4) */
iqm_w32_mask(IQM_CTRL_TSPRESCALE_MASK, 4 << IQM_CTRL_TSPRESCALE_OFFSET, ctrl);
}
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void iqm_global_occupancy_set(uint32_t gocc)
{
iqm_w32(gocc & IQM_GOCC_GOCC_MASK, gocc);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
void iqm_global_occupancy_get(uint32_t *gocc)
{
*gocc = iqm_r32(gocc);
}
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void iqm_global_discard_counter_set(uint32_t gpdc)
{
iqm_w32(gpdc & IQM_GPDC_GPDC_MASK, gocc);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
void iqm_global_discard_counter_get(uint32_t *gpdc)
{
*gpdc = iqm_r32(gpdc);
}
void iqm_global_tail_drop_thr_set(uint32_t goth)
{
iqm_w32(goth & IQM_GOTH_GOTH_MASK, goth);
}
void iqm_global_tail_drop_thr_get(uint32_t *goth)
{
*goth = iqm_r32(goth);
}
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void iqm_timestamp_get(uint32_t *ts)
{
*ts = iqm_r32(ts);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
void iqm_wrr_sched_cfg_set(struct iqm_wrr_cfg *cfg)
{
uint32_t wrrq, i, k=0;
iqm_w32(cfg->per & IQM_WRRC_PER_MASK, wrrc);
for (i = 0; i < 4; i++) {
wrrq = 0;
set_val(wrrq, cfg->wrrq[k++], IQM_WRRQ0_WRRQ0_MASK,
IQM_WRRQ0_WRRQ0_OFFSET);
set_val(wrrq, cfg->wrrq[k++], IQM_WRRQ0_WRRQ1_MASK,
IQM_WRRQ0_WRRQ1_OFFSET);
set_val(wrrq, cfg->wrrq[k++], IQM_WRRQ0_WRRQ2_MASK,
IQM_WRRQ0_WRRQ2_OFFSET);
set_val(wrrq, cfg->wrrq[k++], IQM_WRRQ0_WRRQ3_MASK,
IQM_WRRQ0_WRRQ3_OFFSET);
set_val(wrrq, cfg->wrrq[k++], IQM_WRRQ0_WRRQ4_MASK,
IQM_WRRQ0_WRRQ4_OFFSET);
set_val(wrrq, cfg->wrrq[k++], IQM_WRRQ0_WRRQ5_MASK,
IQM_WRRQ0_WRRQ5_OFFSET);
set_val(wrrq, cfg->wrrq[k++], IQM_WRRQ0_WRRQ6_MASK,
IQM_WRRQ0_WRRQ6_OFFSET);
set_val(wrrq, cfg->wrrq[k++], IQM_WRRQ0_WRRQ7_MASK,
IQM_WRRQ0_WRRQ7_OFFSET);
iqm_w32(wrrq, wrrq[i]);
}
wrrq = 0;
set_val(wrrq, cfg->wrrq[k++], IQM_WRRQ4_WRRQ32_MASK,
IQM_WRRQ4_WRRQ32_OFFSET);
set_val(wrrq, cfg->wrrq[k++], IQM_WRRQ4_WRRQ33_MASK,
IQM_WRRQ4_WRRQ33_OFFSET);
set_val(wrrq, cfg->wrrq[k++], IQM_WRRQ4_WRRQ34_MASK,
IQM_WRRQ4_WRRQ34_OFFSET);
set_val(wrrq, cfg->wrrq[k++], IQM_WRRQ4_WRRQ35_MASK,
IQM_WRRQ4_WRRQ35_OFFSET);
iqm_w32(wrrq, wrrq[i]);
}
void iqm_wrr_sched_cfg_get(struct iqm_wrr_cfg *cfg)
{
uint32_t wrrq, i, k=0;
cfg->per = iqm_r32(wrrc);
for (i = 0; i < 4; i++) {
wrrq = iqm_r32(wrrq[i]);
cfg->wrrq[k++] = get_val(wrrq, IQM_WRRQ0_WRRQ0_MASK,
IQM_WRRQ0_WRRQ0_OFFSET);
cfg->wrrq[k++] = get_val(wrrq, IQM_WRRQ0_WRRQ1_MASK,
IQM_WRRQ0_WRRQ1_OFFSET);
cfg->wrrq[k++] = get_val(wrrq, IQM_WRRQ0_WRRQ2_MASK,
IQM_WRRQ0_WRRQ2_OFFSET);
cfg->wrrq[k++] = get_val(wrrq, IQM_WRRQ0_WRRQ3_MASK,
IQM_WRRQ0_WRRQ3_OFFSET);
cfg->wrrq[k++] = get_val(wrrq, IQM_WRRQ0_WRRQ4_MASK,
IQM_WRRQ0_WRRQ4_OFFSET);
cfg->wrrq[k++] = get_val(wrrq, IQM_WRRQ0_WRRQ5_MASK,
IQM_WRRQ0_WRRQ5_OFFSET);
cfg->wrrq[k++] = get_val(wrrq, IQM_WRRQ0_WRRQ6_MASK,
IQM_WRRQ0_WRRQ6_OFFSET);
cfg->wrrq[k++] = get_val(wrrq, IQM_WRRQ0_WRRQ7_MASK,
IQM_WRRQ0_WRRQ7_OFFSET);
}
wrrq = iqm_r32(wrrq[i]);
cfg->wrrq[k++] = get_val(wrrq, IQM_WRRQ4_WRRQ32_MASK,
IQM_WRRQ4_WRRQ32_OFFSET);
cfg->wrrq[k++] = get_val(wrrq, IQM_WRRQ4_WRRQ33_MASK,
IQM_WRRQ4_WRRQ33_OFFSET);
cfg->wrrq[k++] = get_val(wrrq, IQM_WRRQ4_WRRQ34_MASK,
IQM_WRRQ4_WRRQ34_OFFSET);
cfg->wrrq[k++] = get_val(wrrq, IQM_WRRQ4_WRRQ35_MASK,
IQM_WRRQ4_WRRQ35_OFFSET);
}
void iqm_sfree_get(uint32_t * sfree0, uint32_t * sfree1)
{
*sfree0 = iqm_r32(sfree0);
*sfree1 = iqm_r32(sfree1);
}
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void iqm_dequeue_respond_get(struct iqm_dequeue_res *resp)
{
uint32_t drp;
drp = iqm_r32(drp0);
resp->ts = get_val(drp, IQM_DRP0_TS_MASK, IQM_DRP0_TS_OFFSET);
drp = iqm_r32(drp1);
resp->nlsa = get_val(drp, IQM_DRP1_NLSA_MASK, IQM_DRP1_NLSA_OFFSET);
resp->pdut = get_val(drp, IQM_DRP1_PDUT_MASK, IQM_DRP1_PDUT_OFFSET);
resp->ipn = get_val(drp, IQM_DRP1_IPN_MASK, IQM_DRP1_IPN_OFFSET);
resp->tick = get_val(drp, IQM_DRP1_TICK_MASK, IQM_DRP1_TICK_OFFSET);
drp = iqm_r32(drp2);
resp->gpix = get_val(drp, IQM_DRP2_GPIX_MASK, IQM_DRP2_GPIX_OFFSET);
resp->plen = get_val(drp, IQM_DRP2_PLEN_MASK, IQM_DRP2_PLEN_OFFSET);
drp = iqm_r32(drp3);
resp->tlsa = get_val(drp, IQM_DRP3_TLSA_MASK, IQM_DRP3_TLSA_OFFSET);
resp->hlsa = get_val(drp, IQM_DRP3_HLSA_MASK, IQM_DRP3_HLSA_OFFSET);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void iqm_interrupt_enable_set(const uint32_t mask)
{
iqm_w32(mask, irnen);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void iqm_interrupt_enable_get(uint32_t *mask)
{
*mask = iqm_r32(irnen);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void iqm_interrupt_control_set(const uint32_t ctrl)
{
iqm_w32(ctrl, irnicr);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void iqm_interrupt_control_get(uint32_t *ctrl)
{
*ctrl = iqm_r32(irnicr);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void iqm_interrupt_capture_set(const uint32_t capt)
{
iqm_w32(capt, irncr);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void iqm_interrupt_capture_get(uint32_t *capt)
{
*capt = iqm_r32(irncr);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void iqm_iqueue_enable_set(const uint32_t qid, bool ena)
{
/*
separate write of field QE
*/
iqm_w32_mask(IQM_IQT00_QE_EN, ena ? IQM_IQT00_QE_EN : 0, iqt[qid].iqt0);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void iqm_iqueue_enable_get(const uint32_t qid, bool *ena)
{
/*
separate read of field QE
*/
*ena = (iqm_r32(iqt[qid].iqt0) & IQM_IQT00_QE_EN) ? true : false;
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void iqm_iqueue_blk_set(const uint32_t qid, bool block)
{
/*
separate write of field QB
*/
iqm_w32_mask(IQM_IQT01_QB_BL, block ? IQM_IQT01_QB_BL : 0, iqt[qid].iqt1);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void iqm_iqueue_blk_get(const uint32_t qid, bool *block)
{
/*
separate read of field QB
*/
*block = (iqm_r32(iqt[qid].iqt1) & IQM_IQT01_QB_BL) ? true : false;
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
void iqm_iqueue_cfg_set(const uint32_t qid, struct iqm_iqt_entry *cfg)
{
/*
write of all 7 configuration fields of iqm_iqt_entry:
IQT[qid][0].QE = cfg->qe;
IQT[qid][0].QDTH = cfg->qdth;
IQT[qid][0].QRTH = cfg->qrth;
IQT[qid][1].QB = cfg->qb;
IQT[qid][1].QBTH = cfg->qbth;
IQT[qid][1].QBTL = cfg->qbtl;
IQT[qid][5].TMASK= cfg->tmask;
*/
uint32_t iqt;
iqt = 0;
iqt |= (cfg->qe) ? IQM_IQT00_QE_EN : 0;
set_val(iqt, cfg->qdth, IQM_IQT00_QDTH_MASK, IQM_IQT00_QDTH_OFFSET);
set_val(iqt, cfg->qrth, IQM_IQT00_QRTH_MASK, IQM_IQT00_QRTH_OFFSET);
iqm_w32(iqt, iqt[qid].iqt0);
iqt = 0;
iqt |= (cfg->qb) ? IQM_IQT01_QB_BL : 0;
set_val(iqt, cfg->qbth, IQM_IQT01_QBTH_MASK, IQM_IQT01_QBTH_OFFSET);
set_val(iqt, cfg->qbtl, IQM_IQT01_QBTL_MASK, IQM_IQT01_QBTL_OFFSET);
iqm_w32(iqt, iqt[qid].iqt1);
iqt = cfg->tmask;
iqm_w32(iqt, iqt[qid].iqt5);
}
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void iqm_iqueue_discard_counter_set(uint32_t qid, uint32_t qdc)
{
/*
IQT[qid][3].QDC = qdc;
*/
uint32_t val = 0;
set_val(val, qdc, IQM_IQT03_QDC_MASK, IQM_IQT03_QDC_OFFSET);
iqm_w32_mask(IQM_IQT03_QDC_MASK, val, iqt[qid].iqt3);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
uint32_t iqm_iqueue_discard_counter_get(uint32_t qid)
{
/*
qdc = IQT[qid][3].QDC;
*/
uint32_t iqt03;
iqt03 = iqm_r32(iqt[qid].iqt3);
return get_val(iqt03, IQM_IQT03_QDC_MASK, IQM_IQT03_QDC_OFFSET);
}
void iqm_iqueue_cfg_get(const uint32_t qid, struct iqm_iqt_entry *cfg)
{
/*
read of all 7 configuration fields of iqm_iqt_entry:
cfg->qe = IQT[qid][0].QE;
cfg->qdth = IQT[qid][0].QDTH;
cfg->qrth = IQT[qid][0].QRTH;
cfg->qb = IQT[qid][1].QB;
cfg->qbth = IQT[qid][1].QBTH;
cfg->qbtl = IQT[qid][1].QBTL;
cfg->tmask= IQT[qid][5].TMASK;
*/
uint32_t iqt;
iqt = iqm_r32(iqt[qid].iqt0);
cfg->qe = (iqt & IQM_IQT00_QE_EN) ? 1 : 0;
cfg->qdth = get_val(iqt, IQM_IQT00_QDTH_MASK, IQM_IQT00_QDTH_OFFSET);
cfg->qrth = get_val(iqt, IQM_IQT00_QRTH_MASK, IQM_IQT00_QRTH_OFFSET);
iqt = iqm_r32(iqt[qid].iqt1);
cfg->qb = (iqt & IQM_IQT01_QB_BL) ? 1 : 0;
cfg->qbth = get_val(iqt, IQM_IQT01_QBTH_MASK, IQM_IQT01_QBTH_OFFSET);
cfg->qbtl = get_val(iqt, IQM_IQT01_QBTL_MASK, IQM_IQT01_QBTL_OFFSET);
iqt = iqm_r32(iqt[qid].iqt5);
cfg->tmask = iqt;
}
void iqm_iqueue_status_get(const uint32_t qid, struct iqm_iqt_entry *cfg)
{
/*
read of all 7 status fields of iqm_iqt_entry:
cfg->qf = IQT[qid][2].QF;
cfg->bp = IQT[qid][2].BP;
cfg->qpsf = IQT[qid][2].QPSF;
cfg->pocc = IQT[qid][2].POCC;
cfg->qocc = IQT[qid][2].QOCC;
cfg->qdc = IQT[qid][3].QDC;
cfg->tick = IQT[qid][4].TICK;
*/
uint32_t iqt;
iqt = iqm_r32(iqt[qid].iqt2);
cfg->qf = (iqt & IQM_IQT02_QF) ? 1 : 0;
cfg->bp = (iqt & IQM_IQT02_BP) ? 1 : 0;
cfg->pocc = get_val(iqt, IQM_IQT02_POCC_MASK, IQM_IQT02_POCC_OFFSET);
cfg->qocc = get_val(iqt, IQM_IQT02_QOCC_MASK, IQM_IQT02_QOCC_OFFSET);
iqt = iqm_r32(iqt[qid].iqt3);
cfg->qdc = get_val(iqt, IQM_IQT03_QDC_MASK, IQM_IQT03_QDC_OFFSET);
iqt = iqm_r32(iqt[qid].iqt4);
cfg->tick = get_val(iqt, IQM_IQT04_TICK_MASK, IQM_IQT04_TICK_OFFSET);
}
bool iqm_is_backpressure_asserted(const uint8_t qid)
{
return iqm_r32(iqt[qid].iqt2) & IQM_IQT02_BP ? true : false;
}
#if defined(INCLUDE_DUMP)
void iqm_dump(struct seq_file *s)
{
uint32_t i, k;
if (sys_gpe_hw_is_activated(SYS_GPE_ACT_IQM_SET) == 0) {
seq_printf(s, "iqm not activated\n");
return;
}
seq_printf(s, " ctrl, fpcr, gocc, gpdc,"
" ts, goth, wrrc, drc, irnicr\n");
seq_printf(s, "%08x,", iqm_r32(ctrl));
seq_printf(s, "%08x,", iqm_r32(fpcr));
seq_printf(s, "%08x,", iqm_r32(gocc));
seq_printf(s, "%08x,", iqm_r32(gpdc));
seq_printf(s, "%08x,", iqm_r32(ts));
seq_printf(s, "%08x,", iqm_r32(goth));
seq_printf(s, "%08x,", iqm_r32(wrrc));
seq_printf(s, "%08x,", iqm_r32(drc));
seq_printf(s, "%08x\n", iqm_r32(irnicr));
seq_printf(s, "wrrq table\n");
for (i = 0; i < 5;) {
seq_printf(s, "%08x: ", (unsigned int)&iqm->wrrq[i]);
for (k = 0; k < 16 && i < 5; k++, i++)
seq_printf(s, "%08x ", iqm_r32(wrrq[i]));
seq_printf(s, "\n");
}
seq_printf(s, "iqt table\n");
for (i = 0; i < MAX_QUEUE; i++) {
seq_printf(s, "%08x: ", (unsigned int)&iqm->iqt[i].iqt0);
seq_printf(s, "%08x %08x %08x ", iqm_r32(iqt[i].iqt0),
iqm_r32(iqt[i].iqt1),
iqm_r32(iqt[i].iqt2));
seq_printf(s, "%08x %08x %08x ", iqm_r32(iqt[i].iqt3),
iqm_r32(iqt[i].iqt4),
iqm_r32(iqt[i].iqt5));
seq_printf(s, "\n");
}
}
#endif
/*! @} */
/*! @} */

520
src/drv_onu_ll_iqm.h Normal file
View File

@ -0,0 +1,520 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_iqm_h
#define _drv_onu_iqm_h
/** \addtogroup ONU_LL_REFERENCE GPON Low-level Functions
@{
*/
/** \addtogroup ONU_LL_IQM Ingress Queue Manager Low-level Functions
Low-level functions to access the Ingress Queue Manager (IQM).
@{
*/
/**
IQM configuration data structure.
*/
struct iqm_iqt_entry {
uint16_t qe;
uint16_t qdth;
uint16_t qrth;
uint16_t qb;
uint16_t qbth;
uint16_t qbtl;
bool qf;
bool bp;
uint16_t pocc;
uint16_t qocc;
uint32_t qdc;
uint8_t tick;
uint32_t tmask; /* bit mask t0...t17, link0, link1 */
};
/**
This structure is used to hold the configuration parameters of the
WRR scheduler.
*/
struct iqm_wrr_cfg {
/** This field defines the scheduler period for the IQM module and thus
the number of slots in the wrrq[] registers which are used. */
uint8_t per;
/** This array holds the QIDs to be selected for each WRR slot */
uint8_t wrrq[36];
};
/**
This structure is used to hold dequeue respond values.
*/
struct iqm_dequeue_res {
/** timestamp */
uint32_t ts;
/** ticket */
uint32_t tick;
/** ingress port number */
uint32_t ipn;
/** PDU type */
uint32_t pdut;
/** Next LSA */
uint32_t nlsa;
/** PDU length */
uint32_t plen;
/** GEM Port Index */
uint32_t gpix;
/** Head LSA */
uint32_t hlsa;
/** Tail LSA */
uint32_t tlsa;
};
/* ***************************************************************************/
/**
Set Activate/Deactivate switch for IQM state machines.
*/
void iqm_enable(bool act);
/**
Get Activate/Deactivate switch of IQM state machines.
*/
bool iqm_is_enabled(void);
/**
Initialize the IQM block.
*/
void iqm_init(void);
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set global SSB occupancy counters for IQM
\param gocc The occupancy status of the SSB portion shared in the IQM
in units of segments.
\remarks For debug only !
\remarks Must not be used after activation of the state machine.
*/
void iqm_global_occupancy_set(uint32_t gocc);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
/**
Get global SSB occupancy counters for IQM
\param gocc the occupancy status of the SSB portion shared in the IQM
in units of segments
*/
void iqm_global_occupancy_get(uint32_t *gocc);
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set global discard counters
\param gpdc discard counter
*/
void iqm_global_discard_counter_set(uint32_t gpdc);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
/**
Set global discard counters
\param gpdc discard counters
*/
void iqm_global_discard_counter_get(uint32_t *gpdc);
/**
Set global Tail Drop Threshold for IQM
\param goth global threshold provided in units of segments
*/
void iqm_global_tail_drop_thr_set(uint32_t goth);
/**
Get global Tail Drop Threshold for IQM
\param goth global threshold provided in units of segments
*/
void iqm_global_tail_drop_thr_get(uint32_t *goth);
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get timestamp value
\param ts timestamp
\remarks initialized and started by HW, read only by SW
*/
void iqm_timestamp_get(uint32_t *ts);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
/**
Set WRR scheduler configuration registers
\param cfg \ref iqm_wrr_cfg
*/
void iqm_wrr_sched_cfg_set(struct iqm_wrr_cfg *cfg);
/**
Get WRR scheduler configuration registers
\param cfg \ref iqm_wrr_cfg
*/
void iqm_wrr_sched_cfg_get(struct iqm_wrr_cfg *cfg);
/**
Get free segment map
\param sfree0 has 32 valid bits
\param sfree1 has 16 valid bits
\remarks initialized and started by HW, read only by SW
*/
void iqm_sfree_get(uint32_t * sfree0, uint32_t * sfree1);
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get Dequeue Response
\param resp \ref iqm_dequeue_res
*/
void iqm_dequeue_respond_get(struct iqm_dequeue_res *resp);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Enable / Disable specific IQM interrupts
\param mask bitmap according to the fields below
- 2 DR Dequeue Ready
- 3 CER Command Error
- 4 IF IQM Full
- 8 QF0 IQM Queue 0 filled
- 9 QF0 IQM Queue 1 filled
- 10 QF0 IQM Queue 2 filled
- 11 QF0 IQM Queue 3 filled
- 12 QF0 IQM Queue 4 filled
- 13 QF0 IQM Queue 5 filled
- 14 QF0 IQM Queue 6 filled
- 15 QF0 IQM Queue 7 filled
- 16 QF0 IQM Queue 8 filled
- 20 BP0 IQM Queue 0 Back Pressure
- 21 BP1 IQM Queue 1 Back Pressure
- 22 BP2 IQM Queue 2 Back Pressure
- 23 BP3 IQM Queue 3 Back Pressure
- 24 BP4 IQM Queue 4 Back Pressure
- 25 BP5 IQM Queue 5 Back Pressure
- 26 BP6 IQM Queue 6 Back Pressure
- 27 BP7 IQM Queue 7 Back Pressure
- 28 BP8 IQM Queue 8 Back Pressure
*/
void iqm_interrupt_enable_set(const uint32_t mask);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get IQM interrupt mask
\param mask bitmap according to the fields below
- 2 DR Dequeue Ready
- 3 CER Command Error
- 4 IF IQM Full
- 8 QF0 IQM Queue 0 filled
- 9 QF0 IQM Queue 1 filled
- 10 QF0 IQM Queue 2 filled
- 11 QF0 IQM Queue 3 filled
- 12 QF0 IQM Queue 4 filled
- 13 QF0 IQM Queue 5 filled
- 14 QF0 IQM Queue 6 filled
- 15 QF0 IQM Queue 7 filled
- 16 QF0 IQM Queue 8 filled
- 20 BP0 IQM Queue 0 Back Pressure
- 21 BP1 IQM Queue 1 Back Pressure
- 22 BP2 IQM Queue 2 Back Pressure
- 23 BP3 IQM Queue 3 Back Pressure
- 24 BP4 IQM Queue 4 Back Pressure
- 25 BP5 IQM Queue 5 Back Pressure
- 26 BP6 IQM Queue 6 Back Pressure
- 27 BP7 IQM Queue 7 Back Pressure
- 28 BP8 IQM Queue 8 Back Pressure
*/
void iqm_interrupt_enable_get(uint32_t *mask);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Enable or disable specific IQM interrupts.
\param ctrl bitmap according to the fields below
- 2 DR Dequeue Ready
- 3 CER Command Error
- 4 IF IQM Full
- 8 QF0 IQM Queue 0 filled
- 9 QF0 IQM Queue 1 filled
- 10 QF0 IQM Queue 2 filled
- 11 QF0 IQM Queue 3 filled
- 12 QF0 IQM Queue 4 filled
- 13 QF0 IQM Queue 5 filled
- 14 QF0 IQM Queue 6 filled
- 15 QF0 IQM Queue 7 filled
- 16 QF0 IQM Queue 8 filled
- 20 BP0 IQM Queue 0 Back Pressure
- 21 BP1 IQM Queue 1 Back Pressure
- 22 BP2 IQM Queue 2 Back Pressure
- 23 BP3 IQM Queue 3 Back Pressure
- 24 BP4 IQM Queue 4 Back Pressure
- 25 BP5 IQM Queue 5 Back Pressure
- 26 BP6 IQM Queue 6 Back Pressure
- 27 BP7 IQM Queue 7 Back Pressure
- 28 BP8 IQM Queue 8 Back Pressure
*/
void iqm_interrupt_control_set(const uint32_t ctrl);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get IQM interrupt mask
\param ctrl bitmap according to the fields below
- 2 DR Dequeue Ready
- 3 CER Command Error
- 4 IF IQM Full
- 8 QF0 IQM Queue 0 filled
- 9 QF0 IQM Queue 1 filled
- 10 QF0 IQM Queue 2 filled
- 11 QF0 IQM Queue 3 filled
- 12 QF0 IQM Queue 4 filled
- 13 QF0 IQM Queue 5 filled
- 14 QF0 IQM Queue 6 filled
- 15 QF0 IQM Queue 7 filled
- 16 QF0 IQM Queue 8 filled
- 20 BP0 IQM Queue 0 Back Pressure
- 21 BP1 IQM Queue 1 Back Pressure
- 22 BP2 IQM Queue 2 Back Pressure
- 23 BP3 IQM Queue 3 Back Pressure
- 24 BP4 IQM Queue 4 Back Pressure
- 25 BP5 IQM Queue 5 Back Pressure
- 26 BP6 IQM Queue 6 Back Pressure
- 27 BP7 IQM Queue 7 Back Pressure
- 28 BP8 IQM Queue 8 Back Pressure
*/
void iqm_interrupt_control_get(uint32_t *ctrl);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Enable or disable specific IQM interrupts.
\param capt bitmap according to the fields below
- 2 DR Dequeue Ready
- 3 CER Command Error
- 4 IF IQM Full
- 8 QF0 IQM Queue 0 filled
- 9 QF0 IQM Queue 1 filled
- 10 QF0 IQM Queue 2 filled
- 11 QF0 IQM Queue 3 filled
- 12 QF0 IQM Queue 4 filled
- 13 QF0 IQM Queue 5 filled
- 14 QF0 IQM Queue 6 filled
- 15 QF0 IQM Queue 7 filled
- 16 QF0 IQM Queue 8 filled
- 20 BP0 IQM Queue 0 Back Pressure
- 21 BP1 IQM Queue 1 Back Pressure
- 22 BP2 IQM Queue 2 Back Pressure
- 23 BP3 IQM Queue 3 Back Pressure
- 24 BP4 IQM Queue 4 Back Pressure
- 25 BP5 IQM Queue 5 Back Pressure
- 26 BP6 IQM Queue 6 Back Pressure
- 27 BP7 IQM Queue 7 Back Pressure
- 28 BP8 IQM Queue 8 Back Pressure
*/
void iqm_interrupt_capture_set(const uint32_t capt);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get IQM interrupt mask
\param capt bitmap according to the fields below
- 2 DR Dequeue Ready
- 3 CER Command Error
- 4 IF IQM Full
- 8 QF0 IQM Queue 0 filled
- 9 QF0 IQM Queue 1 filled
- 10 QF0 IQM Queue 2 filled
- 11 QF0 IQM Queue 3 filled
- 12 QF0 IQM Queue 4 filled
- 13 QF0 IQM Queue 5 filled
- 14 QF0 IQM Queue 6 filled
- 15 QF0 IQM Queue 7 filled
- 16 QF0 IQM Queue 8 filled
- 20 BP0 IQM Queue 0 Back Pressure
- 21 BP1 IQM Queue 1 Back Pressure
- 22 BP2 IQM Queue 2 Back Pressure
- 23 BP3 IQM Queue 3 Back Pressure
- 24 BP4 IQM Queue 4 Back Pressure
- 25 BP5 IQM Queue 5 Back Pressure
- 26 BP6 IQM Queue 6 Back Pressure
- 27 BP7 IQM Queue 7 Back Pressure
- 28 BP8 IQM Queue 8 Back Pressure
*/
void iqm_interrupt_capture_get(uint32_t *capt);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set Enable / Disable of an ingress queue.
\param qid ingress queue identifier of ingress queue to be disabled
\param ena enable = true, disable = false
*/
void iqm_iqueue_enable_set(const uint32_t qid, bool ena);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get Enable or disable of an ingress queue.
\param qid ingress queue identifier of ingress queue to be disabled
\param ena enable = true, disable = false
*/
void iqm_iqueue_enable_get(const uint32_t qid, bool *ena);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set blocking mode of an ingress queue.
\param qid ingress queue identifier of ingress queue to be disabled
\param block block = 1, unblock = 0
*/
void iqm_iqueue_blk_set(const uint32_t qid, bool block);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get blocking mode of an ingress queue.
\param qid ingress queue identifier of ingress queue to be disabled
\param block block = 1, unblock = 0
*/
void iqm_iqueue_blk_get(const uint32_t qid, bool *block);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
/**
Set all configuration parameters of an ingress queue.
\param qid ingress queue identifier
\param cfg first 6 values of \ref iqm_iqt_entry
*/
void iqm_iqueue_cfg_set(const uint32_t qid, struct iqm_iqt_entry *cfg);
/**
Get all configuration parameters of an ingress queue.
\param qid ingress queue identifier
\param cfg first 6 values of \ref iqm_iqt_entry
*/
void iqm_iqueue_cfg_get(const uint32_t qid, struct iqm_iqt_entry *cfg);
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set ingress queue discard counter
\param qid ingress queue identifier of ingress queue to be read
\param qdc the discard counter
\remarks discards are counted in units of packets
*/
void iqm_iqueue_discard_counter_set(uint32_t qid, uint32_t qdc);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
/**
Get ingress queue discard counter
\param qid ingress queue identifier of ingress queue to be read
\return the discard counter
\remarks discards are counted in units of packets
*/
uint32_t iqm_iqueue_discard_counter_get(uint32_t qid);
/**
Get all status variables of an ingress queue.
\param qid ingress queue identifier
\param cfg last 7 values of \ref iqm_iqt_entry
\remarks ingress queue status is initialized by HW and read only for SW
*/
void iqm_iqueue_status_get(const uint32_t qid, struct iqm_iqt_entry *cfg);
/**
Returns ingress queue backpressure assertion status.
\param qid ingress queue identifier
*/
bool iqm_is_backpressure_asserted(const uint8_t qid);
#if defined(INCLUDE_DUMP)
/**
Dump the IQM register block.
*/
void iqm_dump(struct seq_file *s);
#endif
/*! @} */
/*! @} */
#endif

650
src/drv_onu_ll_octrlg.c Normal file
View File

@ -0,0 +1,650 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#include "drv_onu_api.h"
#include "drv_onu_register.h"
#include "drv_onu_ll_sys.h"
#include "drv_onu_ll_octrlg.h"
STATIC int octrlg_basic_init(void);
STATIC void octrlg_tcont_map_init(void);
STATIC void octrlg_tcont_table_init(void);
STATIC void octrlg_gpix_table_init(void);
int octrlg_init(void)
{
uint32_t i;
/*
Enable module clock, release reset. This is mandatory before
accessing module's registers.
*/
sys_gpe_hw_activate_or_reboot(SYS_GPE_ACT_GPONE_SET);
if (octrlg_basic_init() != 0)
return -1;
/*
OCTRLG.TCMAP[0..1023] = 0x0000 0000
OCTRLG.TCTABLE[0..15] = 0xFFFF FFFF
OCTRLG.GPIXTABLE[0..127] = 0x0000 0000
*/
octrlg_tcont_map_init();
octrlg_tcont_table_init();
octrlg_gpix_table_init();
/* Initialization of counter memories */
for (i = 0; i < GPIXTABLE_LEN; i++) {
octrlg_w32(0, txpcnt[i]);
octrlg_w32(0, txbcntl[i]);
}
return 0;
}
/*
nGemBlockLength: configure in OCTRLG, OCTRLG.CFG0.IBS = 2^15/gem_block_len
gem_payload_sz_max: configure in OCTRLG, OCTRLG.CFG1.GEMPLSIZE
*/
int octrlg_config_set(const uint32_t gem_block_len,
const uint32_t gem_payload_sz_max)
{
if (gem_block_len == 0)
return -1;
octrlg_w32_mask(OCTRLG_CFG0_IBS_MASK,
(((1 << 15) / gem_block_len) & OCTRLG_CFG0_IBS_MASK),
cfg0);
octrlg_w32_mask(OCTRLG_CFG1_GEMPLSIZE_MASK,
((gem_payload_sz_max << OCTRLG_CFG1_GEMPLSIZE_OFFSET) &
OCTRLG_CFG1_GEMPLSIZE_MASK), cfg1);
return 0;
}
int octrlg_config_get(uint32_t *gem_block_len, uint32_t *gem_payload_sz_max)
{
if (octrlg_r32(cfg0) & OCTRLG_CFG0_IBS_MASK)
*gem_block_len =
(1 << 15) / (octrlg_r32(cfg0) & OCTRLG_CFG0_IBS_MASK);
*gem_payload_sz_max =
(octrlg_r32(cfg1) & OCTRLG_CFG1_GEMPLSIZE_MASK) >>
OCTRLG_CFG1_GEMPLSIZE_OFFSET;
return 0;
}
void octrlg_dbru_mode_dbg_set(const uint32_t act)
{
octrlg_w32_mask(OCTRLG_CFG1_DBRUDBG_EN,
act ? OCTRLG_CFG1_DBRUDBG_EN : 0, cfg1);
}
void octrlg_dbru_mode_dbg_get(uint32_t *act)
{
*act = (octrlg_r32(cfg1) & OCTRLG_CFG1_DBRUDBG_EN) ? true : false;
}
void octrlg_dbru_debug_set(const uint32_t mode2y,
const uint32_t mode2g,
const uint32_t mode1)
{
octrlg_w32_mask(OCTRLG_DBRUDBG_DBRU2Y_MASK |
OCTRLG_DBRUDBG_DBRU2G_MASK |
OCTRLG_DBRUDBG_DBRU1_MASK,
(mode2y << OCTRLG_DBRUDBG_DBRU2Y_OFFSET) |
(mode2g << OCTRLG_DBRUDBG_DBRU2G_OFFSET) |
(mode1 << OCTRLG_DBRUDBG_DBRU1_OFFSET),
dbrudbg);
}
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void octrlg_dbru_debug_get(uint32_t *mode2y, uint32_t *mode2g, uint32_t *mode1)
{
uint32_t reg;
reg = octrlg_r32(dbrudbg);
*mode2y = (reg & OCTRLG_DBRUDBG_DBRU2Y_MASK) >>
OCTRLG_DBRUDBG_DBRU2Y_OFFSET;
*mode2g = (reg & OCTRLG_DBRUDBG_DBRU2G_MASK) >>
OCTRLG_DBRUDBG_DBRU2G_OFFSET;
*mode1 = (reg & OCTRLG_DBRUDBG_DBRU1_MASK) >>
OCTRLG_DBRUDBG_DBRU1_OFFSET;
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
void octrlg_dbru_mode_get(uint32_t *mode)
{
*mode = (octrlg_r32(tcreq) & OCTRLG_TCREQ_DBRU_MASK) >>
OCTRLG_TCREQ_DBRU_OFFSET;
}
/**
OCTRLG.TCTABLE[n].REPN[n] = egress_port_idx, with n = tcont_idx
*/
int octrlg_epn_set(const uint32_t tcont_idx, const uint32_t egress_port_idx,
const uint32_t prempted_epn_idx)
{
if (tcont_idx >= ONU_GPE_MAX_TCONT)
return -1;
octrlg_w32_mask(OCTRLG_TCTABLE0_REPN0_MASK,
((egress_port_idx << OCTRLG_TCTABLE0_REPN0_OFFSET) &
OCTRLG_TCTABLE0_REPN0_MASK),
tctable[tcont_idx]);
octrlg_w32_mask(OCTRLG_TCTABLE0_PEPN0_MASK,
((prempted_epn_idx << OCTRLG_TCTABLE0_PEPN0_OFFSET) &
OCTRLG_TCTABLE0_PEPN0_MASK),
tctable[tcont_idx]);
return 0;
}
int octrlg_epn_get(const uint32_t tcont_idx, uint32_t *egress_port_idx,
uint32_t *prempted_epn_idx)
{
if (tcont_idx >= ONU_GPE_MAX_TCONT) {
*egress_port_idx = 0;
*prempted_epn_idx = 0;
return -1;
}
*egress_port_idx =
(octrlg_r32(tctable[tcont_idx]) & OCTRLG_TCTABLE0_REPN0_MASK)
>> OCTRLG_TCTABLE0_REPN0_OFFSET;
*prempted_epn_idx =
(octrlg_r32(tctable[tcont_idx]) & OCTRLG_TCTABLE0_PEPN0_MASK)
>> OCTRLG_TCTABLE0_PEPN0_OFFSET;
return 0;
}
/** Hardware Programming Details
The following hardware functions must be configured:
- tcont_idx: selects the table entry
- alloc_id : Allocation ID of the T-CONT
- valid : true indicates that the Alloc Id has been assigned and is
valid.
The T-CONT Table is addressed by the 12-bit alloc_id value, the
tcont_idx is written as the data value to the selected table location,
together with the valid indication being set (0b1).
OCTRLG(OCTRLG), TCMAP[n].TCIX[n]: write a free T-CONT index value
(tcont_idx)
into the location that is defined by
n = alloc_id.
OCTRLG(OCTRLG), TCMAP[n].V[n] : enable T-CONT index value
at the location that is defined by
n = alloc_id, by setting the related valid
bit.
*/
int octrlg_tcont_set(const uint32_t tcont_idx, const uint32_t alloc_id)
{
octrlg_w32((tcont_idx & OCTRLG_TCMAP0_TCIX0_MASK) |
OCTRLG_TCMAP0_V0, tcmap[alloc_id]);
return 0;
}
/** Hardware Programming Details
The following hardware functions must be handled:
The T-CONT mapping table is read at the location given by the Allocation ID.
If the valid flag is set, the index value is returned with valid = true.
If the valid is not set, the index value is returned with valid = false.
The hardware table is located in OCTRLG (TCMAP),
TCMAP[n].TCIX[n], n = Allocation ID
TCMAP[n].V[n], n = Allocation ID
*/
int octrlg_tcont_get(const uint32_t tcont_idx, uint32_t *alloc_id)
{
uint32_t i, val;
for (i = 0; i < TCMAP_LEN; i++) {
val = octrlg_r32(tcmap[i]);
if ((val & OCTRLG_TCMAP0_V0) == 0)
continue;
if (tcont_idx == (val & OCTRLG_TCMAP0_TCIX0_MASK)) {
*alloc_id = i;
return 0;
}
}
*alloc_id = 0;
return -1;
}
/** Hardware Programming Details
The following hardware functions must be handled:
The T-CONT mapping table is searched for an entry that matches the
tcont_idx with the valid bit being set. If the given tcont_idx value is
out of range (>= ONU_GPE_MAX_TCONT), an error code is returned
(GPE_STATUS_VALUE_RANGE_ERR).
If found, the table entry is set to "invalid".
If no match is found within the table (the table address range (Allocation
ID value range) is from ONU_GPE_MIN_ALLOCATION_ID to
ONU_GPE_MAX_ALLOCATION_ID), the return status is set
to GPE_STATUS_NOT_AVAILABLE.
The hardware table to be searched and modified is located in
OCTRLG, TCMAP[n].V[n] = 0b0 (n = Allocation ID).
*/
int octrlg_tcont_delete(const uint32_t tcont_idx)
{
uint32_t i, val;
for (i = 0; i < TCMAP_LEN; i++) {
val = octrlg_r32(tcmap[i]);
if ((val & OCTRLG_TCMAP0_V0) == 0)
continue;
if (tcont_idx == (val & OCTRLG_TCMAP0_TCIX0_MASK)) {
octrlg_w32(0, tcmap[i]);
return 0;
}
}
return -1;
}
/** Direct deletion of an entry in TCMAP table by TCONT ID
- alloc_id: TCONT ID is an index of an entry to be deleted
*/
int octrlg_tcont_alloc_id_delete(const uint32_t alloc_id)
{
if (alloc_id >= TCMAP_LEN)
return -1;
octrlg_w32(0, tcmap[alloc_id]);
return 0;
}
int octrlg_tcont_alloc_id_get(const uint32_t alloc_id, uint32_t *tcont_idx)
{
uint32_t val;
val = octrlg_r32(tcmap[alloc_id]);
if ((val & OCTRLG_TCMAP0_V0) == 0)
return -1;
*tcont_idx = val & OCTRLG_TCMAP0_TCIX0_MASK;
return 0;
}
/**
Read hardware counter.
- gpix: selects the GEM port index (0..ONU_GPE_MAX_GPIX - 1)
- tx_frames: OCTRLG.TXPCNT(gem_port_index)
- tx_bytes: OCTRLG.TXBCNTH(gem_port_index)*2^32 +
OCTRLG.TXBCNTL(gem_port_index)
Hardware Programming Details
These are the counters that are provided by the OCTRLG blocks of the OCTRLG
module. The counters wrap around an need to be checked regularly.
*/
int octrlg_gem_counter_get(const uint32_t gpix,
struct gpe_cnt_octrlg_gem_val *counter)
{
uint32_t l, h;
if (gpix >= ONU_GPE_MAX_GPIX)
return -1;
counter->tx_frames = (uint64_t)octrlg_r32(txpcnt[gpix]);
/* First the Low and then the High Part has to be read. No overflow
checks are needed since the HW stores the high part on the low
part read access*/
l = octrlg_r32(txbcntl[gpix]);
h = octrlg_r32(txbcnth[gpix]);
counter->tx_bytes = ((uint64_t)h << 32) | l;
return 0;
}
/**
Read hardware counters from OCTRLG:
- tx_gem_idle_frames_total: OCTRLG.TXTICNT
- tx_gem_frames_total: OCTRLG.TXTPCNT
- tx_gem_bytes_total: OCTRLG.TXCNT
- tx_tcont_total: OCTRLG.TXTTCNT
Hardware Programming Details
These are the counters that are provided by the OCTRLG block of the OCTRLG
module. The counters wrap around an need to be checked regularly.
*/
int octrlg_counter_get(struct gpe_cnt_octrlg_val *counter)
{
uint32_t l, h;
if (octrlg_is_enabled()) {
counter->tx_gem_idle_frames_total = octrlg_r32(txticnt);
counter->tx_gem_frames_total = octrlg_r32(txtpcnt);
counter->tx_gem_bytes_total = octrlg_r32(txtcnt);
counter->tx_tcont_total = octrlg_r32(txttcnt);
/* First the Low and then the High Part has to be read. No
overflow checks are needed since the HW stores the high part
on the low part read access*/
l = octrlg_r32(txtbcntl);
h = octrlg_r32(txtbcnth);
counter->tx_gem_pdu_bytes_total = ((uint64_t)h << 32) | l;
} else {
memset(counter, 0x00, sizeof(struct gpe_cnt_octrlg_val));
}
return 0;
}
int octrlg_gem_port_set(const uint32_t gem_port_id,
const uint32_t gem_port_index,
const enum gpe_direction data_direction)
{
if ((uint32_t)data_direction & (uint32_t)GPE_DIRECTION_UPSTREAM)
octrlg_w32(gem_port_id, gpixtable[gem_port_index]);
return 0;
}
int octrlg_gpix_get(const uint32_t gem_port_id, uint32_t *gem_port_index)
{
uint32_t i;
for (i = 0; i < GPIXTABLE_LEN; i++) {
if (octrlg_r32(gpixtable[i]) == gem_port_id) {
*gem_port_index = i;
return 0;
}
}
return -1;
}
int octrlg_gem_port_delete(const uint32_t gem_port_index)
{
octrlg_w32(0x0, gpixtable[gem_port_index]);
return 0;
}
/*
OCTRLG.CFG0.IDLELEN = 4
OCTRLG.CFG1.GEMPLSIZE = 0x0FFF
OCTRLG.IDLEFRAME0.IFB0 = 0xB6
OCTRLG.IDLEFRAME0.IFB1 = 0xAB
OCTRLG.IDLEFRAME0.IFB2 = 0x31
OCTRLG.IDLEFRAME0.IFB3 = 0xE0
OCTRLG.IDLEFRAME1.IFB4 = 0x55
*/
STATIC int octrlg_basic_init(void)
{
uint32_t cfg;
octrlg_w32(0, ctrl);
cfg = 0x0;
/* set FIFO watermarks
* Set value of 4 - this results in the ability to serve single
T-Cont Requests down to 16 bytes.
*/
set_val(cfg, 4, OCTRLG_CFG0_GTCFIFOTHRES_MASK,
OCTRLG_CFG0_GTCFIFOTHRES_OFFSET);
set_val(cfg, 4, OCTRLG_CFG0_IDLELEN_MASK, OCTRLG_CFG0_IDLELEN_OFFSET);
octrlg_w32(cfg, cfg0);
if (octrlg_config_set(48, 4095) != 0)
return -1;
octrlg_w32(OCTRLG_DCTRL_FQ_Q1, dctrl);
/* Registers IDLEFRAME0...15 are left in reset state, which
is the standardized idle frame header followed by all zeroes.
*/
/* Make OCTRLG counter count per packet, not per GEM frame */
octrlg_w32(OCTRLG_CFG1_GEMPLSIZE_MASK, cfg1);
/* reset register-based counters */
octrlg_w32(0, txtpcnt);
octrlg_w32(0, txtbcnth);
octrlg_w32(0, txtbcntl);
octrlg_w32(0, txticnt);
octrlg_w32(0, txtcnt);
octrlg_w32(0, txttcnt);
return 0;
}
/*
tcmap[alloc_id] = tcont_index | valid bit
*/
STATIC void octrlg_tcont_map_init(void)
{
/* All T-Cont IDs invalid */
uint32_t i;
for (i = 0; i < TCMAP_LEN; i++)
octrlg_w32(0x0, tcmap[i]);
}
/*
tctable[tcont_index] = epn
*/
STATIC void octrlg_tcont_table_init(void)
{
uint32_t i;
for (i = 0; i < ONU_GPE_MAX_TCONT; i++)
octrlg_w32(0xFFFFFFFF, tctable[i]);
octrlg_epn_set(OMCI_TCIX, 127, ONU_GPE_OMCI_EGRESS_PORT);
}
/*
gpixtable[gpix] = gpid
*/
STATIC void octrlg_gpix_table_init(void)
{
/* all GPIXs translate into GPID=0 */
uint32_t i;
for (i = 0; i < GPIXTABLE_LEN; i++)
octrlg_w32(0x0, gpixtable[i]);
}
void octrlg_enable(const uint32_t act)
{
/* enable/disable the module */
octrlg_w32_mask(OCTRLG_CTRL_ACT_EN, act ? OCTRLG_CTRL_ACT_EN : 0, ctrl);
}
uint32_t octrlg_is_enabled(void)
{
return (octrlg_r32(ctrl) & OCTRLG_CTRL_ACT_EN) ? true : false;
}
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void octrlg_gtc_fifo_threshold_set(const uint32_t value)
{
octrlg_w32_mask(value, OCTRLG_CFG0_GTCFIFOTHRES_MASK, cfg0);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void octrlg_gtc_fifo_threshold_get(uint32_t *value)
{
*value = (octrlg_r32(cfg0) & OCTRLG_CFG0_GTCFIFOTHRES_MASK)
>> OCTRLG_CFG0_GTCFIFOTHRES_OFFSET;
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
int octrlg_idle_len_set(const uint32_t value)
{
uint32_t reg = 0, val;
if (value == 0)
return -1;
val = (uint32_t)(value - 1);
set_val(reg, val, OCTRLG_CFG0_IDLELEN_MASK, OCTRLG_CFG0_IDLELEN_OFFSET);
octrlg_w32_mask(value, OCTRLG_CFG0_IDLELEN_MASK, cfg0);
return 0;
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
uint32_t octrlg_idle_len_get(void)
{
uint32_t val;
val = (octrlg_r32(cfg0) & OCTRLG_CFG0_IDLELEN_MASK)
>> OCTRLG_CFG0_IDLELEN_OFFSET;
return (uint32_t)(val + 1);
}
#ifdef ONU_LIBRARY
/** Reads total transmitted bytes counter and recalculate
laser life time.
\remarks This function is used by optic library and
is called at least each 27 seconds
*/
void octrlg_laser_ageupdate ( uint32_t *seconds )
{
uint32_t reg, diff;
static uint32_t reg_old = 0;
static uint32_t last = 0;
reg = octrlg_r32 (txtcnt);
if (reg > reg_old)
diff = reg - reg_old;
else
diff = 0xFFFFFFFF - reg_old + reg + 1;
/* not clear on read */
reg_old = reg;
/* counter = 19440 in 125 us */
*seconds = diff / (0x9450C00);
last += (diff % (0x9450C00));
if (last > 0x9450C00) {
(*seconds) ++;
last -= 0x9450C00;
}
}
#endif
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void octrlg_interrupt_mask_set(const uint32_t value)
{
octrlg_w32(value, irnen);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void octrlg_interrupt_set(const uint32_t value)
{
octrlg_w32(value, irnicr);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void octrlg_interrupt_get(uint32_t *value)
{
*value = octrlg_r32(irncr);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#if defined(INCLUDE_DUMP)
void octrlg_dump(struct seq_file *s)
{
if (sys_gpe_hw_is_activated(SYS_GPE_ACT_GPONE_SET) == 0) {
seq_printf(s, "octrlg not activated\n");
return;
}
#define dump_reg(reg) \
seq_printf(s, "%-14s = 0x%08x\n", # reg, octrlg_r32(reg))
dump_reg(ctrl);
dump_reg(cfg0);
dump_reg(cfg1);
dump_reg(dctrl);
dump_reg(txtpcnt);
dump_reg(txttcnt);
dump_reg(txticnt);
dump_reg(txtcnt);
dump_reg(txtbcntl);
dump_reg(txtbcnth);
dump_reg(txbcntl);
dump_reg(tcreq);
dump_reg(tcstate);
dump_reg(irnicr);
#undef dump_reg
}
void octrlg_table_dump(struct seq_file *s)
{
uint32_t i, k;
if (sys_gpe_hw_is_activated(SYS_GPE_ACT_GPONE_SET) == 0) {
seq_printf(s, "octrlg not activated\n");
return;
}
seq_printf(s, "tcmap table\n");
for (i = 0; i < TCMAP_LEN;) {
seq_printf(s, "%08x: ", octrlg_adr_table(tcmap, i));
for (k = 0; k < 16 && i < TCMAP_LEN; k++, i++)
seq_printf(s, "%08x ", octrlg_r32(tcmap[i]));
seq_printf(s, "\n");
}
seq_printf(s, "tcont table\n");
for (i = 0; i < ONU_GPE_MAX_TCONT;) {
seq_printf(s, "%08x: ", octrlg_adr_table(tctable, i));
for (k = 0; k < 16 && i < ONU_GPE_MAX_TCONT; k++, i++)
seq_printf(s, "%08x ", octrlg_r32(tctable[i]));
seq_printf(s, "\n");
}
seq_printf(s, "gpix table\n");
for (i = 0; i < GPIXTABLE_LEN;) {
seq_printf(s, "%08x: ", octrlg_adr_table(gpixtable, i));
for (k = 0; k < 16 && i < GPIXTABLE_LEN; k++, i++)
seq_printf(s, "%08x ", octrlg_r32(gpixtable[i]));
seq_printf(s, "\n");
}
seq_printf(s, "txpcnt table\n");
for (i = 0; i < GPIXTABLE_LEN;) {
seq_printf(s, "%08x: ", octrlg_adr_table(txpcnt, i));
for (k = 0; k < 16 && i < GPIXTABLE_LEN; k++, i++)
seq_printf(s, "%08x ", octrlg_r32(txpcnt[i]));
seq_printf(s, "\n");
}
seq_printf(s, "dptr table\n");
for (i = 0; i < DPTRTABLE_LEN;) {
seq_printf(s, "%08x: ", octrlg_adr_table(dptr, i));
for (k = 0; k < 16 && i < GPIXTABLE_LEN; k++, i++)
seq_printf(s, "%08x ", octrlg_r32(dptr[i]));
seq_printf(s, "\n");
}
seq_printf(s, "dcontext table\n");
for (i = 0; i < DPTRTABLE_LEN;) {
seq_printf(s, "%08x: ", octrlg_adr_table(dcontext, i));
for (k = 0; k < 16 && i < GPIXTABLE_LEN; k++, i++)
seq_printf(s, "%08x ", octrlg_r32(dcontext[i]));
seq_printf(s, "\n");
}
}
#endif

284
src/drv_onu_ll_octrlg.h Normal file
View File

@ -0,0 +1,284 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_octrlg_h
#define _drv_onu_octrlg_h
/** \addtogroup ONU_LL_REFERENCE GPON Low-level Functions
@{
*/
/** \addtogroup ONU_LL_OCTRLG GPON Output Control Low-level Functions
Low-level functions to access the GPON output control unit (OCTRLG).
@{
*/
#define TCMAP_LEN 4096
#define GPIXTABLE_LEN 256
#define TCTABLE_LEN 32
#define DPTRTABLE_LEN 64
/**
Initialize the OCTRLG block (octrlg).
*/
int octrlg_init(void);
/**
Set OCTRLG configuration.
\param gem_block_len GEM block size, used to calculate block-related
values. Given in number of bytes, the default is 48
\param gem_payload_sz_max Maximum GEM payload size in upstream direction
*/
int octrlg_config_set(const uint32_t gem_block_len,
const uint32_t gem_payload_sz_max);
/**
Get OCTRLG configuration.
\param gem_block_len Get GEM block size, used to calculate block-related
values. Given in number of bytes.
\param gem_payload_sz_max Get Maximum GEM payload size in upstream direction
*/
int octrlg_config_get(uint32_t *gem_block_len, uint32_t *gem_payload_sz_max);
/**
Set OCTRLG EPN.
\param tcont_idx Tcont index number
\param egress_port_idx EPN which should be mapped to TCONT index
\param prempted_epn_idx Preempted EPN which should be mapped to TCONT index
*/
int octrlg_epn_set(const uint32_t tcont_idx, const uint32_t egress_port_idx,
const uint32_t prempted_epn_idx);
/**
Get OCTRLG EPN.
\param tcont_idx Tcont index number
\param egress_port_idx Get EPN of mapped to TCONT index
\param prempted_epn_idx Get Preempted EPN which should be mapped to
TCONT index
*/
int octrlg_epn_get(const uint32_t tcont_idx, uint32_t *egress_port_idx,
uint32_t *prempted_epn_idx);
/**
Set OCTRLG TCONT mapping table.
\param tcont_idx Tcont index number
\param alloc_id Tcont ID of incoming request
*/
int octrlg_tcont_set(const uint32_t tcont_idx, const uint32_t alloc_id);
/**
Get OCTRLG TCONT mapping table.
\param tcont_idx Tcont index number
\param alloc_id Get Tcont ID of incoming request
*/
int octrlg_tcont_get(const uint32_t tcont_idx, uint32_t *alloc_id);
/**
Delete an entry in TCMAP table by TCONT index number
\param tcont_idx Tcont index number
*/
int octrlg_tcont_delete(const uint32_t tcont_idx);
/**
Delete an entry in TCMAP table by Allocation ID
\param alloc_id Allocation ID
*/
int octrlg_tcont_alloc_id_delete(const uint32_t alloc_id);
/**
Retrieve a TCONT index value based on given Allocation ID.
\param alloc_id Allocation ID
\param tcont_idx Tcont index number
*/
int octrlg_tcont_alloc_id_get(const uint32_t alloc_id, uint32_t *tcont_idx);
/**
Set GEM port table entry.
\param gem_port_id GEM port ID (0-4095)
\param gem_port_index GEM port index (0-255)
\param data_direction Data direction of GEM port
*/
int octrlg_gem_port_set(const uint32_t gem_port_id,
const uint32_t gem_port_index,
const enum gpe_direction data_direction);
/**
Get GEM port Index.
\param gem_port_id GEM port ID (0-255)
\param gem_port_index GEM port index
*/
int octrlg_gpix_get(const uint32_t gem_port_id, uint32_t *gem_port_index);
/**
Remove a new GEM port table entry.
\param gem_port_index GEM port index (0-255
*/
int octrlg_gem_port_delete(const uint32_t gem_port_index);
/**
Read GEM port related hardware counter.
\param gpix GEM port index
\param counter Get value of GEM port counter
*/
int octrlg_gem_counter_get(const uint32_t gpix,
struct gpe_cnt_octrlg_gem_val *counter);
/**
Read global GEM hardware counter.
\param counter Get value of GEM global counter
*/
int octrlg_counter_get(struct gpe_cnt_octrlg_val *counter);
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set Upstream GTC Fifo Threshold
Filling Level below or equal this threshold will cause Idle Frame
insertion. The granularity is 1 Fifo entry, i.e. 4 Bytes.
The IRN*.GTCFIFOTHRES interrupt can be used for reporting.
\param value Set value
*/
void octrlg_gtc_fifo_threshold_set(const uint32_t value);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get Upstream GTC Fifo Threshold
Filling Level below or equal this threshold will cause Idle Frame
insertion. The granularity is 1 Fifo entry, i.e. 4 Bytes.
The IRN*.GTCFIFOTHRES interrupt can be used for reporting.
\param value Get value
*/
void octrlg_gtc_fifo_threshold_get(uint32_t *value);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set Idle Frame Length
Max number of Idle Frame Bytes used.
\param value Set value
*/
int octrlg_idle_len_set(const uint32_t value);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
/**
Get Idle Frame Length
\return value Get value
*/
uint32_t octrlg_idle_len_get(void);
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set specified interrupt mask.
Disabled interrupts are not visible in the IRNCR register and are not
signalled via the interrupt line towards the controller.
\param value Set value
*/
void octrlg_interrupt_mask_set(const uint32_t value);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set an specified interrupt.
A write operation directly effects the interrupts.
This can be used to trigger events under software control for testing
purposes.
\param value Set value
*/
void octrlg_interrupt_set(const uint32_t value);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get currently active interrupt events masked with the corresponding enable
bits of the IRNEN register.
The interrupts can be acknowledged by a write operation.
\param value Get value
*/
void octrlg_interrupt_get(uint32_t *value);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
/**
Set OCTRLG enable bit.
Use this function to enable or disable the OCTRLG
\param act Activation status, true = active
*/
void octrlg_enable(const uint32_t act);
/**
Get OCTRLG enable bit.
Use this function to get status of the OCTRLG enable bit.
*/
uint32_t octrlg_is_enabled(void);
/**
Set OCTRLG DBRu debug bit.
Use this function to enable or disable the OCTRLG DBRu debug mode
\param act Activation status, true = active
*/
void octrlg_dbru_mode_dbg_set(const uint32_t act);
/**
Get OCTRLG DBRu debug bit.
Use this function to get status of the OCTRLG DBRu debug mode bit.
*/
void octrlg_dbru_mode_dbg_get(uint32_t *act);
/**
Set OCTRLG DBRu debug register.
Use this function to set DBRu mode 2 green, yellow or DBRu mode1 debug value
\param mode2y yellow value for DBRu mode2
\param mode2g green value for DBRu mode2
\param mode1 value for DBRu mode1
*/
void octrlg_dbru_debug_set(const uint32_t mode2y,
const uint32_t mode2g,
const uint32_t mode1);
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get OCTRLG DBRu debug register.
Use this function to get DBRu mode 2 green, yellow or DBRu mode1 debug value
\param mode2y yellow value for DBRu mode2
\param mode2g green value for DBRu mode2
\param mode1 value for DBRu mode1
*/
void octrlg_dbru_debug_get(uint32_t *mode2y, uint32_t *mode2g, uint32_t *mode1);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
/**
Get OCTRLG DBRu mode
\param mode value for DBRu mode
*/
void octrlg_dbru_mode_get(uint32_t *mode);
void octrlg_laser_ageupdate (uint32_t *seconds);
#if defined(INCLUDE_DUMP)
/**
Dump the OCTRLG register block.
*/
void octrlg_dump(struct seq_file *s);
/**
Dump the OCTRLG table block.
*/
void octrlg_table_dump(struct seq_file *s);
#endif
/*! @} */
/*! @} */
#endif

309
src/drv_onu_ll_octrll.c Normal file
View File

@ -0,0 +1,309 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#include "drv_onu_api.h"
#include "drv_onu_register.h"
#include "drv_onu_ll_sys.h"
#include "drv_onu_ll_octrll.h"
static const uint32_t port_offset[4] = { 0, 64, 128, 192 };
void octrll_init(const uint32_t port_id)
{
/*
- assigned EPN: 0, 1, 2, 3
- timeout enabled: 1s
- FSQM queue 1 selected (LSA freeing)
- all counters set = 0
- module OCTRLL activated
*/
static const uint32_t lan_act_en[4] = {SYS_GPE_ACT_LAN0_SET,
SYS_GPE_ACT_LAN1_SET,
SYS_GPE_ACT_LAN2_SET,
SYS_GPE_ACT_LAN3_SET};
/*
Enable module clock, release reset. This is mandatory before
accessing module's registers.
*/
sys_gpe_hw_activate_or_reboot(lan_act_en[port_id]);
/* timeout 1 s */
octrll_w32_table(0x6d, toutcfg, port_offset[port_id]);
/* Egress port (0...71) but fixed 64...67 LAN (UNI) */
octrll_w32_table(64 + port_id, cfg, port_offset[port_id]);
/* register RAWCTRL: Cmd bit only, no init */
/* registers RAWCFG0, 1: Cmd metadata, no init */
octrll_w32_table(OCTRLL_DCTRL_FQ_Q1, dctrl, port_offset[port_id]);
/* reset counter */
octrll_w32_table(0, txbcntl, port_offset[port_id]);
octrll_w32_table(0, txbcnth, port_offset[port_id]);
octrll_w32_table(0, txpcnt, port_offset[port_id]);
octrll_w32_table(0, txp64cnt, port_offset[port_id]);
octrll_w32_table(0, txp65cnt, port_offset[port_id]);
octrll_w32_table(0, txp128cnt, port_offset[port_id]);
octrll_w32_table(0, txp256cnt, port_offset[port_id]);
octrll_w32_table(0, txp512cnt, port_offset[port_id]);
octrll_w32_table(0, txp1024cnt, port_offset[port_id]);
octrll_w32_table(0, txp1519cnt, port_offset[port_id]);
/* Registers DPTR and DCONTEXT: Read-only for debugging
purposes, no init */
/* Activation should be the last step because setting of Egress
Port Number
Note: Modify only when CTRL.ACT is disabled!
*/
octrll_w32_table_mask(OCTRLL_CTRL_ACT_EN, OCTRLL_CTRL_TOUTEN_EN,
ctrl, port_offset[port_id]);
}
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/*
lan_port_timeout: configure in OCTRLL(n),OCTRLL(n).TOUTCFG.TOUTVALUE
(same value for n=0...3), 0xFFFF = 10 min)
lan_port_timeout_en[4]: configure in OCTRLL(n),OCTRLL(n).CTRL.TOUTEN
*/
void octrll_port_timeout_set(const uint32_t lan_port_timeout,
const bool lan_port_timeout_en[4])
{
uint32_t i;
for (i = 0; i < ONU_GPE_MAX_ETH_UNI; i++) {
octrll_w32_table(lan_port_timeout, toutcfg,
port_offset[i]);
octrll_w32_table_mask(OCTRLL_CTRL_TOUTEN_EN,
lan_port_timeout_en[i] ?
OCTRLL_CTRL_TOUTEN_EN : 0,
ctrl, port_offset[i]);
}
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void octrll_port_timeout_get(uint32_t *lan_port_timeout,
bool lan_port_timeout_en[4])
{
uint32_t i;
*lan_port_timeout = octrll_r32_table(toutcfg, port_offset[0]);
for (i = 0; i < ONU_GPE_MAX_ETH_UNI; i++)
lan_port_timeout_en[i] =
(octrll_r32_table(ctrl, port_offset[0]) &
OCTRLL_CTRL_TOUTEN_EN) ? true : false;
for (; i < 4; i++)
lan_port_timeout_en[i] = false;
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
/*
OCTRLL[n].CFG.EPN = eport_idx, with n = nUNI_PortIndex
Note: Modify only when CTRL.ACT is disabled! This is a static configuration.
*/
int octrll_port_set(const uint32_t uni_port_id, const uint32_t eport_idx)
{
if (uni_port_id >= ONU_GPE_MAX_ETH_UNI)
return -1;
octrll_w32_table_mask(OCTRLL_CFG_EPN_MASK,
(eport_idx & OCTRLL_CFG_EPN_MASK), cfg,
port_offset[uni_port_id]);
return 0;
}
int octrll_port_get(const uint32_t uni_port_id, uint32_t *eport_idx)
{
if (uni_port_id >= ONU_GPE_MAX_ETH_UNI) {
*eport_idx = 0;
return -1;
}
*eport_idx =
octrll_r32_table(cfg,
port_offset[uni_port_id]) & OCTRLL_CFG_EPN_MASK;
return 0;
}
int octrll_write(const uint32_t uni_port_id, const uint32_t max_len,
const uint32_t hlsa, const uint32_t tlsa)
{
uint32_t hdrl, bdyl, cfg;
(void)tlsa;
if (uni_port_id >= ONU_GPE_MAX_ETH_UNI)
return -1;
if (max_len > ONU_GPE_BUFFER_SEGMENT_SIZE) {
hdrl = ONU_GPE_BUFFER_SEGMENT_SIZE;
bdyl = max_len - ONU_GPE_BUFFER_SEGMENT_SIZE;
} else {
hdrl = max_len;
bdyl = 0;
}
octrll_w32_table(hlsa, rawcfg0, port_offset[uni_port_id]);
cfg = 0;
cfg |= (hdrl << OCTRLL_RAWCFG1_HDRL_OFFSET) & OCTRLL_RAWCFG1_HDRL_MASK;
cfg |= (bdyl << OCTRLL_RAWCFG1_BDYL_OFFSET) & OCTRLL_RAWCFG1_BDYL_MASK;
octrll_w32_table(cfg, rawcfg1, port_offset[uni_port_id]);
octrll_w32_table(OCTRLL_RAWCTRL_RAWTX, rawctrl,
port_offset[uni_port_id]);
return 0;
}
uint32_t octrll_pcnt_get(const uint32_t uni_port_id)
{
return octrll_r32_table(txpcnt, port_offset[uni_port_id]);
}
/**
Read hardware counter.
*/
/** Hardware Programming Details
These are the counters that are provided by the OCTRLL blocks of the OCTRLL
module. The counters wrap around an need to be checked regularly.
*/
int octrll_counter_get(const uint32_t uni_port_id,
struct octrll_counter *counter)
{
if (uni_port_id >= ONU_GPE_MAX_ETH_UNI)
return -1;
counter->tx_bytes =
(uint64_t) octrll_r32_table(txbcntl, port_offset[uni_port_id]);
counter->tx_bytes |=
((uint64_t) (octrll_r32_table(txbcnth,
port_offset[uni_port_id])) << 32);
counter->tx_frames =
(uint64_t) octrll_r32_table(txpcnt,
port_offset[uni_port_id]);
counter->tx64 = (uint64_t) octrll_r32_table(txp64cnt,
port_offset[uni_port_id]);
counter->tx65 = (uint64_t) octrll_r32_table(txp65cnt,
port_offset[uni_port_id]);
counter->tx128 = (uint64_t) octrll_r32_table(txp128cnt,
port_offset[uni_port_id]);
counter->tx256 = (uint64_t) octrll_r32_table(txp256cnt,
port_offset[uni_port_id]);
counter->tx512 = (uint64_t) octrll_r32_table(txp512cnt,
port_offset[uni_port_id]);
counter->tx1024 = (uint64_t) octrll_r32_table(txp1024cnt,
port_offset[uni_port_id]);
counter->tx1519 = (uint64_t) octrll_r32_table(txp1519cnt,
port_offset[uni_port_id]);
return 0;
}
/*
"SyncFifo full" (OCTRLLx.STATE.TXFIFOFULL=1) AND
indicates that there are packets to send (OCTRLLx.STATE.EPFILLED=1)AND
Tx Packet counter does not increase (OCTRLLx.TXPCNT).
*/
void octrll_state_get (const uint32_t uni_port_id,
uint32_t* state, uint32_t* txpcnt)
{
*txpcnt = octrll_r32_table(txpcnt, port_offset[uni_port_id]);
*state = octrll_r32_table(state, port_offset[uni_port_id]);
}
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void octrll_interrupt_mask_set(const uint32_t port_id, const uint32_t value)
{
octrll_w32_table(value, irnen, port_offset[port_id]);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void octrll_interrupt_set(const uint32_t port_id, const uint32_t value)
{
octrll_w32_table(value, irnicr, port_offset[port_id]);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
void octrll_interrupt_get(const uint32_t port_id, uint32_t *value)
{
*value = octrll_r32_table(irncr, port_offset[port_id]);
}
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
void octrll_enable(const uint32_t port_id, const bool value)
{
octrll_w32_table_mask( OCTRLL_CTRL_ACT_EN,
value ? OCTRLL_CTRL_ACT_EN : 0, ctrl,
port_offset[port_id]);
}
bool octrll_is_enabled(const uint32_t port_id)
{
return (octrll_r32_table(ctrl,
port_offset[port_id]) & OCTRLL_CTRL_ACT_EN) ?
true : false;
}
#if defined(INCLUDE_DUMP)
void octrll_dump(struct seq_file *s)
{
uint32_t i;
seq_printf(s, " octrll, ctrl, dctrl, toutcfg, "
"cfg,txp64cnt,"
"txp65cnt,txp128cnt,txp256cnt,txp512cnt,"
"txp1024cnt,txp1519cnt, txpcnt, irnicr, "
"dptr,dcontext\n");
for (i = 0; i < ONU_GPE_MAX_ETH_UNI; i++) {
if (sys_gpe_hw_is_activated(SYS_GPE_ACT_LAN0_SET << i) == 0) {
seq_printf(s, "octrll%d not activated\n", i);
continue;
}
seq_printf(s, "%08x,", octrll_adr_table(ctrl, port_offset[i]));
seq_printf(s, "%08x,", octrll_r32_table(ctrl, port_offset[i]));
seq_printf(s, "%08x,", octrll_r32_table(dctrl, port_offset[i]));
seq_printf(s, "%08x,",
octrll_r32_table(toutcfg, port_offset[i]));
seq_printf(s, "%08x,", octrll_r32_table(cfg, port_offset[i]));
seq_printf(s, "%08x,",
octrll_r32_table(txp64cnt, port_offset[i]));
seq_printf(s, "%08x,",
octrll_r32_table(txp65cnt, port_offset[i]));
seq_printf(s, " %08x,",
octrll_r32_table(txp128cnt, port_offset[i]));
seq_printf(s, " %08x,",
octrll_r32_table(txp256cnt, port_offset[i]));
seq_printf(s, " %08x,",
octrll_r32_table(txp512cnt, port_offset[i]));
seq_printf(s, " %08x,",
octrll_r32_table(txp1024cnt, port_offset[i]));
seq_printf(s, " %08x,",
octrll_r32_table(txp1519cnt, port_offset[i]));
seq_printf(s, "%08x,",
octrll_r32_table(txpcnt, port_offset[i]));
seq_printf(s, "%08x,",
octrll_r32_table(irnicr, port_offset[i]));
seq_printf(s, "%08x,",
octrll_r32_table(dptr, port_offset[i]));
seq_printf(s, "%08x\n",
octrll_r32_table(dcontext, port_offset[i]));
}
}
#endif

159
src/drv_onu_ll_octrll.h Normal file
View File

@ -0,0 +1,159 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_octrll_h
#define _drv_onu_octrll_h
/** \addtogroup ONU_LL_REFERENCE GPON Low-level Functions
@{
*/
/** \addtogroup ONU_LL_OCTRLL LAN Output Control Low-level Functions
Low-level functions to access the LAN output control unit (OCTRLL).
@{
*/
/**
Initialize the OCTRLL block (octrl).
\param port_id LAN port ID
*/
void octrll_init(const uint32_t port_id);
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Configure LAN port queue timeout.
\param lan_port_timeout LAN port timeout value, given in 1-s units, single
value for all port's
\param lan_port_timeout_en LAN queue timeout enable.
*/
void octrll_port_timeout_set(const uint32_t lan_port_timeout,
const bool lan_port_timeout_en[4]);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Read the LAN port queue timeout.
\param lan_port_timeout LAN port timeout value, given in 1-s units, single
value for all port's
\param lan_port_timeout_en LAN queue timeout enable.
*/
void octrll_port_timeout_get(uint32_t *lan_port_timeout,
bool lan_port_timeout_en[4]);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
/**
Set EPN for LAN port
\param uni_port_id LAN port ID
\param eport_idx Egress Port Number
\remarks Modify only when CTRL.ACT is disabled!
*/
int octrll_port_set(const uint32_t uni_port_id, const uint32_t eport_idx);
/**
Get EPN for LAN port
\param uni_port_id LAN port ID
\param eport_idx Get Egress Port Number
*/
int octrll_port_get(const uint32_t uni_port_id, uint32_t *eport_idx);
/**
Write RAW configuration for LAN port
\param uni_port_id LAN port ID
\param max_len Maximum PDU length
\param hlsa Head LSA
\param tlsa Tail LSA
\remarks Modify only when RAWCTRL.RAWTX is disabled!
*/
int octrll_write(const uint32_t uni_port_id, const uint32_t max_len,
const uint32_t hlsa, const uint32_t tlsa);
/**
Read TX packets counter.
\param uni_port_id LAN port ID
*/
uint32_t octrll_pcnt_get(const uint32_t uni_port_id);
/**
Read hardware counter.
\param uni_port_id LAN port ID
\param counter Get counter Value
*/
int octrll_counter_get(const uint32_t uni_port_id,
struct octrll_counter *counter);
void octrll_state_get (const uint32_t uni_port_id,
uint32_t* state, uint32_t* txpcnt);
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set specified interrupt mask.
Disabled interrupts are not visible in the IRNCR register and are not
signalled via the interrupt line towards the controller.
\param port_id The LAN port ID
\param value Set value
*/
void octrll_interrupt_mask_set(const uint32_t port_id, const uint32_t value);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Set an specified interrupt.
A write operation directly effects the interrupts.
This can be used to trigger events under software control for testing
purposes.
\param port_id The LAN port ID
\param value Set value
*/
void octrll_interrupt_set(const uint32_t port_id, const uint32_t value);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
#ifdef INCLUDE_UNUSED_LL_FUNCTIONS
/**
Get currently active interrupt events masked with the corresponding enable
bits of the IRNEN register.
The interrupts can be acknowledged by a write operation.
\param port_id The LAN port ID
\param value Get value
*/
void octrll_interrupt_get(const uint32_t port_id, uint32_t *value);
#endif /* #ifdef INCLUDE_UNUSED_LL_FUNCTIONS*/
/**
Set LAN port enable bit.
Use this function to enable or disable a LAN port.
\param port_id The LAN port ID
\param value Set value
*/
void octrll_enable(const uint32_t port_id, const bool value);
/**
Get LAN port enable bit.
Use this function to get status of a LAN port enable bit.
\param port_id The LAN port ID
*/
bool octrll_is_enabled(const uint32_t port_id);
#if defined(INCLUDE_DUMP)
/**
Dump the OCTRLG register block.
*/
void octrll_dump(struct seq_file *s);
#endif
/*! @} */
/*! @} */
#endif

1344
src/drv_onu_ll_sce.c Normal file

File diff suppressed because it is too large Load Diff

368
src/drv_onu_ll_sce.h Normal file
View File

@ -0,0 +1,368 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_ll_sce_h
#define _drv_onu_ll_sce_h
/** \addtogroup ONU_LL_REFERENCE GPON Low-level Functions
@{
*/
/** \addtogroup ONU_LL_SCE Shared Classification Engine Low-level Functions
Low-level functions to access the functions of the Shared Classification
Engine (SCE).
@{
*/
#include "drv_onu_gpe_tables.h"
#define SCE_MAX_BREAKPOINTS 32
#define CMD_ERR (1<<0)
#define CMD_RVAL (1<<30)
#define CMD_NOTHING (0x00)
#define CMD_SET_ADDR (0x01)
#define CMD_MEM (0x02)
#define CMD_R0H (0x03)
#define CMD_R0L (0x04)
#define CMD_R11H (0x19)
#define CMD_R11L (0x1A)
#define CMD_RFPH (0x1B)
#define CMD_RFPL (0x1C)
#define CMD_RGPH (0x1D)
#define CMD_RGPL (0x1E)
#define CMD_R15H (0x1F)
#define CMD_RPC (0x20)
#define CMD_IRQ_REASON (0x21)
#define CMD_STOP (0xFF)
#define CMD_REG_PREPARE (0x3FF)
/* defines for MIPS-PE protocol */
#define CMD_W_OFFSET 31
#define CMD_RVAL_OFFSET 30
#define CMD_T_NUM_OFFSET 25
#define CMD_LENGTH_OFFSET 21
#define CMD_BYTE_OFFSET 2
#define CMD_ERR_OFFSET 0
/**
Virtual Machine Management
*/
/** a virtual machine identifier
*/
enum vm {
VM00 = (4*0+0),
VM01 = (4*0+1),
VM02 = (4*0+2),
VM10 = (4*1+0),
VM11 = (4*1+1),
VM12 = (4*1+2),
VM20 = (4*2+0),
VM21 = (4*2+1),
VM22 = (4*2+2),
VM30 = (4*3+0),
VM31 = (4*3+1),
VM32 = (4*3+2),
VM40 = (4*4+0),
VM41 = (4*4+1),
VM42 = (4*4+2),
VM50 = (4*5+0),
VM51 = (4*5+1),
VM52 = (4*5+2)
};
/** PE operation status */
enum pe_errorcode {
/** No error and no result */
PE_STATUS_OK = 0,
/** PE operation timeout error */
PE_STATUS_TIMEOUT = 1,
/** Generic or unknown error occurred */
PE_STATUS_ERR = 2
};
/**
Virtual Machine Management
*/
/** SCE Registers
FIXME: add prefix?
*/
enum sce_reg {
REG_R0,
REG_R1,
REG_R2,
REG_R3,
REG_R4,
REG_R5,
REG_R6,
REG_R7,
REG_R8,
REG_R9,
REG_R10,
REG_R11,
REG_R12,
REG_R13,
REG_R14,
#define REG_FP REG_R14
REG_R15,
#define REG_ST REG_R15
REG_GP, /**<< 16, virtual register (identical to r15) */
REG_T, /**<< 17, virtual register */
REG_PC, /**<< 18, virtual register */
REG_L0, /**<< 19, virtual register */
REG_L1, /**<< 20, virtual register */
REG_L2, /**<< 21, virtual register */
REG_L3, /**<< 22, virtual register */
REG_L4, /**<< 23, virtual resister */
REG_L5, /**<< 24, virtual register */
REG_L6, /**<< 25, virtual register */
REG_L7, /**<< 26, virtual register */
REG_SP /**<< 27, virtual register */
};
/** Processing Element Firmware Data.
*/
struct sce_fw_data {
/** Processing Element selector */
uint8_t pe_index;
/** Firmware pointer. */
uint32_t *data;
/** Firmware length. */
uint16_t len;
};
/** Processing Element firmware code and data pointer definition.
Used by \ref sce_fw_init.
*/
struct sce_fw_init {
/** Firmware code. */
struct sce_fw_data code;
/** Firmware data. */
struct sce_fw_data data;
};
/** SCE configuration.
Used by \ref sce_fw_cfg_set and \ref sce_fw_cfg_get.
*/
struct sce_fw_cfg {
/** Processing Element enable. */
bool thread_enable[ONU_GPE_NUMBER_OF_THREADS];
};
/** Data to be sent to or received from a PE.
Used by \ref sce_pe_table_entry_read,
and \ref sce_pe_table_init.
*/
struct sce_fw_pe_message {
/** Processing Element selector */
uint8_t pe_index;
/** Table ID */
uint8_t table_id;
/** Table Idx */
uint8_t table_idx;
/** Table width in 32-bit units */
uint8_t entry_width;
/** Data */
uint32_t message[16];
};
/**
Initialize the SCE firmware
Load the code and data memories of all Firmware processing Elements.
The number of Processing Elements is given by \ref ONU_GPE_NUMBER_OF_PE_MAX.
\param param Firmware initialization information.
\param num_pe Number of PEs
\return
- 0 Initialization successful
- -1 Error occurred during initialization
*/
int sce_fw_init(const struct sce_fw_init *param, const uint8_t num_pe);
/**
Activates the PE, MRG and DISP modules.
\param num_pe Number of PEs
\return
- 0 Initialization successful
- -1 Error occurred during initialization
*/
int sce_init(const uint8_t num_pe);
/**
Starts initialization sequence of merge module.
\return
- 0 Initialization successful
- -1 Error occurred during initialization
*/
int sce_merge_init(void);
/**
Set Activate / Deactivate switch for merge state machines.
*/
void sce_merge_enable(bool act);
/**
Get Activate / Deactivate switch of merge state machines.
*/
bool sce_merge_is_enabled(void);
/**
Set Activate / Deactivate switch for dispatcher state machines.
*/
void sce_dispatcher_enable(bool act);
/**
Get Activate / Deactivate switch of dispatcher state machines.
*/
bool sce_dispatcher_is_enabled(void);
/**
Read back the SCE firmware code memory from a selected Processing Element.
\param param Firmware code memory.
\return
- 0 Initialization successful
- -1 Error occurred during initialization
*/
int sce_fw_code_read(struct sce_fw_data *param);
/**
Read back the SCE firmware data memory from a selected Processing Element.
\param param Firmware data memory.
\return
- 0 Initialization successful
- -1 Error occurred during initialization
*/
int sce_fw_data_read(struct sce_fw_data *param);
/**
Configure the SCE firmware.
\param param Firmware Configuration.
\return
- 0 Initialization successful
- -1 Error occurred during initialization
*/
int sce_fw_cfg_set(const struct sce_fw_cfg *param);
/**
Read back the SCE firmware configuration.
\param param Firmware Configuration.
\return
- 0 Initialization successful
- -1 Error occurred during initialization
*/
int sce_fw_cfg_get(struct sce_fw_cfg *param);
/**
Read the status of a the SCE.
\param tstat Firmware tstat register.
\param terr Firmware terr register.
\param tctrl Firmware tctrl register.
\param tdebug Firmware tdebug register.
\param bctrl Firmware bctrl register.
\param bstat Firmware bstat register.
\param bdis Firmware bdis register.
\return
- 0 Initialization successful
- -1 Error occurred during initialization
*/
int sce_fw_status_get(uint32_t *tstat, uint32_t *terr,
uint32_t *tctrl, uint32_t *tdebug,
uint32_t *bctrl, uint32_t *bstat,
uint32_t *bdis);
/**
Send a message to one of the PEs.
\param param PE message.
*/
enum pe_errorcode sce_fw_pe_message_send(const struct sce_fw_pe_message *param);
/**
Receive a message from one of the PEs.
\param param PE message.
*/
enum pe_errorcode sce_fw_pe_message_receive(struct sce_fw_pe_message *param);
/** Check whether PE table is supported
\param pe_idx PE index
\param info PE FW info structure pointer
\param id PE table id
\return
- true: Supported
- false: Not supported
*/
bool is_pe_table_supported(const uint8_t pe_idx,
const struct pe_fw_info *info,
const uint32_t id);
#if defined(INCLUDE_SCE_DEBUG)
int sce_fw_breakpoint_set(const enum vm vm, const uint32_t addr);
int sce_fw_breakpoint_get(const enum vm vm, const uint32_t idx, uint32_t *addr);
int sce_fw_breakpoint_remove(const enum vm vm, const uint32_t addr);
int sce_fw_pe_reg_set(const enum vm vm, enum sce_reg reg, uint32_t val);
int sce_fw_pe_reg_get(const enum vm vm, enum sce_reg reg, uint32_t *val);
int sce_fw_pe_memset(const enum vm vm, const uint32_t addr, uint32_t val);
int sce_fw_pe_memget(const enum vm vm, const uint32_t addr, uint32_t *val);
int sce_fw_pe_break(const uint32_t vm_group);
int sce_fw_pe_break_check(uint32_t *vm_group);
int sce_fw_pe_restart(const enum vm vm);
int sce_fw_pe_single_step(const enum vm vm);
int sce_fw_pe_pc_set(const enum vm vm, const uint32_t pc);
int sce_fw_pe_pc_get(const enum vm vm, uint32_t *pc);
#endif /* defined(INCLUDE_SCE_DEBUG)*/
void sce_fw_pe_run(const uint32_t vm_group);
#if defined(INCLUDE_DUMP)
/**
Dump the SCE register block.
*/
void sce_dump(struct seq_file *s);
/**
Dump the MERGE register block.
*/
void merge_dump(struct seq_file *s);
#endif
/*! @} */
/*! @} */
#endif

953
src/drv_onu_ll_ssb.c Normal file
View File

@ -0,0 +1,953 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#include "drv_onu_api.h"
#include "drv_onu_register.h"
#include "drv_onu_ll_ssb.h"
#include "drv_onu_ll_fsqm.h"
#include "drv_onu_ll_octrll.h"
#include "drv_onu_resource_gpe.h" /* ONU_GPE_LLT_NIL */
#include "drv_onu_ll_sys.h"
#include "drv_onu_ll_iqm.h"
extern onu_lock_t ictrlc_lock;
extern onu_lock_t octrlc_lock;
extern onu_lock_t link_lock;
#define ONU_RAM_PACKET_BUFFER_OFFSET \
(sbs0ctrl_r32(bar1) & SBS0CTRL_BAR1_BA1V_MASK)
#define MAX_LENGTH_CHECK 256
static const uint32_t link_port[3] = { 0,
ONU_LINK0_SIZE/4,
(2*ONU_LINK0_SIZE)/4
};
static const uint32_t ictrlc_port[2] = {0, ONU_ICTRLC0_SIZE/4};
/* Fields of "Enqueue Request 0 Parameter Register 1" */
/** Tail LSA
The logical SSB address of the second PDU segment */
#define NLSA_MASK 0x7FFF0000
/** field offset */
#define NLSA_OFFSET 16
/** PDU Type
The PDU type is provided by SDMAx as a basic HW classification */
#define PDUT_MASK 0x00007000
/** field offset */
#define PDUT_OFFSET 12
/* Fields of "Enqueue Request 0 Parameter Register 2" */
/** GEM Port Index
The GEM Port Index is mapped from the GEM Port Identifier in ICTRLG */
#define GPIX_MASK 0x00FF0000
/** field offset */
#define GPIX_OFFSET 16
/** PDU Length
The PDU Length in Bytes */
#define PLEN_MASK 0x0000FFFF
/** field offset */
#define PLEN_OFFSET 0
/* Fields of "Enqueue Request 0 Parameter Register 3" */
/** Tail LSA
The logical SSB address of the stored PDU tail */
#define TLSA_MASK 0x7FFF0000
/** field offset */
#define TLSA_OFFSET 16
/** Head LSA
The logical SSB address of the stored PDU head */
#define HLSA_MASK 0x00007FFF
/** field offset */
#define HLSA_OFFSET 0
/* Fields of Deliver Request Parameter */
/** QOSL
The logical SSB address of the stored PDU tail */
#define QOSL_MASK 0x7FFF0000
/** field offset */
#define QOSL_OFFSET 16
/** IPN
Ingress Port Number */
#define IPN_MASK 0x00000F00
/** field offset */
#define IPN_OFFSET 8
/** COL
Color code */
#define COL_MASK 0x03000000
/** field offset */
#define COL_OFFSET 24
/** CMD
Command code to the TMU */
#define CMD_MASK 0x0C000000
/** field offset */
#define CMD_OFFSET 26
/** QID
Defines the target egress queue */
#define QID_MASK 0x00FF0000
/** field offset */
#define QID_OFFSET 16
/* Fields of Schedule Request 0 Parameter Register 1*/
/** Egress Port Number
*/
#define SRQST_EPN_MASK 0x0000007F
/** field offset */
#define SRQST_EPN_OFFSET 0
/** Command Code
Identifies the command to be performed.
0x0 ER Enqueue Request (do nor use)
0x1 SR Schedule Request (use this)
0x2 BR Backlog Request (do not use)
0x3 NOP reserved (do not use)
*/
/* Fields of Schedule Request 0 Parameter Register 2*/
#define SRQST_CMD_MASK 0x000C0000
/** field offset */
#define SRQST_CMD_OFFSET 18
/** Source Identifier
Identifies the OCTRLC as the source of the command.
53 OCTRLC send the request command from the OCTRLC
*/
#define SRQST_SRC_MASK 0x03F00000
/** field offset */
#define SRQST_SRC_OFFSET 20
/** Destination Identifier
Identifies the TMU as the destination.
57 TMU send the request command to the TMU
*/
#define SRQST_DST_MASK 0xFC000000
/** field offset */
#define SRQST_DST_OFFSET 26
/* Fields of Schedule Respond 0 Parameter Register 1*/
/** Segment Count
Given in number of SSB segments.
*/
#define SRSND_SEGL_MASK 0x000003FF
/** field offset */
#define SRSND_SEGL_OFFSET 0
/** PDU Type
Defines the type of data packet:
0x0 ETH Ethernet
0x1 IP Internet Protocol
0x2 MPLS MPLS
0x3 OMCI OMCI
0x4 RES4 Reserved
0x5 RES5 Reserved
0x6 RES6 Reserved
0x7 CMD Command
*/
#define SRSND_PDUT_MASK 0x0000E000
/** field offset */
#define SRSND_PDUT_OFFSET 13
/* Fields of Schedule Respond 0 Parameter Register 2*/
/** Header Length
Given in number of bytes.
*/
#define SRSND_HDRL_MASK 0x000000FF
/** field offset */
#define SRSND_HDRL_OFFSET 0
/** Offset Value
Given in number of bytes.
*/
#define SRSND_OFFS_MASK 0x0000FF00
/** field offset */
#define SRSND_OFFS_OFFSET 8
/* Fields of Schedule Respond 0 Parameter Register 3*/
/** Head Logical Segment Address
LSA of the first segment that is used to hold the packet data.
*/
#define SRSND_HLSA_MASK 0x00007FFF
/** field offset */
#define SRSND_HLSA_OFFSET 0
/** Tail Logical Segment Address
LSA of the last segment that is used to hold the packet data.
*/
#define SRSND_TLSA_MASK 0x7FFF0000
/** field offset */
#define SRSND_TLSA_OFFSET 16
/* Fields of Schedule Respond 0 Parameter Register 4*/
/** Body Length
Given in number of bytes.
*/
#define SRSND_BDYL_MASK 0x0000FFFF
/** field offset */
#define SRSND_BDYL_OFFSET 0
#define REQ_C (1 << 29)
#define RVAL(val, name) (((val) << name##_OFFSET) & name##_MASK)
STATIC int ssb_octrlc_write(const uint32_t *data);
void ssb_init(void)
{
link_w32_table(LINK_CTRL_RSR, ctrl, link_port[0]);
link_w32_table(LINK_CTRL_RSR, ctrl, link_port[1]);
link_w32_table(LINK_IRNEN_RXR, irnen, link_port[0]);
link_w32_table(LINK_IRNEN_RXR, irnen, link_port[1]);
octrlc_w32(OCTRLC_CTRL_RSR | OCTRLC_CTRL_RSX | OCTRLC_CTRL_BMX, ctrl);
}
int ssb_egress_info_read(const uint8_t epn, struct onu_pdu_info *info)
{
int ret = 0;
uint8_t cmd = 1, src = 53, dst = 57;
uint32_t tmp[4] = {0}, cnt = 0, reg;
unsigned long flags = 0;
/* reset info values */
info->len = 0;
info->segments = 0;
info->seg_offset = 0;
info->hlsa = ONU_GPE_LLT_NIL;
info->tlsa = ONU_GPE_LLT_NIL;
tmp[0] |= RVAL(epn, SRQST_EPN);
tmp[1] |= RVAL(cmd, SRQST_CMD);
tmp[1] |= RVAL(src, SRQST_SRC);
tmp[1] |= RVAL(dst, SRQST_DST);
onu_spin_lock_get(&octrlc_lock, &flags);
/* send SCHEDULE_REQUEST */
ret = ssb_octrlc_write(tmp);
if (ret != 0)
goto SSB_EGRESS_INFO_READ_ERROR;
/* wait SCHEDULE_RESPOND */
reg = octrlc_r32(len);
while (((reg & OCTRLC_LEN_PACR_MASK) == 0) && (cnt++ < 3000))
reg = octrlc_r32(len);
if (cnt >= 3000) {
ret = -2;
goto SSB_EGRESS_INFO_READ_ERROR;
}
/* check for SOP */
if ((octrlc_r32(irnicr) & OCTRLC_IRNEN_SOP) == 0) {
ONU_DEBUG_ERR("no SOP in equeue");
ret = -3;
goto SSB_EGRESS_INFO_READ_ERROR;
}
/* read SCHEDULE_RESPOND */
cnt = 0;
tmp[cnt++] = octrlc_r32(data0);
tmp[cnt++] = octrlc_r32(data1);
/* check for EOP */
if ((octrlc_r32(irnicr) & OCTRLC_IRNEN_EOP) == 0) {
ONU_DEBUG_ERR("no EOP in equeue");
ret = -3;
goto SSB_EGRESS_INFO_READ_ERROR;
}
tmp[cnt++] = octrlc_r32(data0);
tmp[cnt++] = octrlc_r32(data1);
onu_spin_lock_release(&octrlc_lock, flags);
/* fill pdu info*/
info->pdu_type = (enum gpe_pdu_type)
((tmp[0] & SRSND_PDUT_MASK) >> SRSND_PDUT_OFFSET);
info->segments = (tmp[0] & SRSND_SEGL_MASK) >> SRSND_SEGL_OFFSET;
info->hdr_len = (tmp[1] & SRSND_HDRL_MASK) >> SRSND_HDRL_OFFSET;
info->bdy_offset = (tmp[1] & SRSND_OFFS_MASK) >> SRSND_OFFS_OFFSET;
info->hlsa = (tmp[2] & SRSND_HLSA_MASK) >> SRSND_HLSA_OFFSET;
info->tlsa = (tmp[2] & SRSND_TLSA_MASK) >> SRSND_TLSA_OFFSET;
info->bdy_len = (tmp[3] & SRSND_BDYL_MASK) >> SRSND_BDYL_OFFSET;
info->len = info->hdr_len + info->bdy_len;
info->seg_offset = info->hdr_len ? SBB_SEG_GET(info->hdr_len) : 1;
if (info->bdy_len && info->segments == 0) {
info->segments = info->seg_offset +
SBB_SEG_GET(info->bdy_len + info->bdy_offset);
}
return ret;
SSB_EGRESS_INFO_READ_ERROR:
onu_spin_lock_release(&octrlc_lock, flags);
return ret;
}
STATIC int link_length_read(const uint8_t idx)
{
uint32_t reg;
reg = link_r32_table(len, link_port[idx]);
return (reg & LINK_LEN_LENR_MASK) >> LINK_LEN_LENR_OFFSET;
}
STATIC void link_data_read(const uint8_t idx, uint32_t *data)
{
data[0] = link_r32_table(data0, link_port[idx]);
data[1] = link_r32_table(data1, link_port[idx]);
}
STATIC int link_sop(const uint8_t idx)
{
return link_r32_table(ctrl, link_port[idx]) & LINK_CTRL_SOP;
}
STATIC int link_eop(const uint8_t idx)
{
return link_r32_table(ctrl, link_port[idx]) & LINK_CTRL_EOP;
}
void link_data_request(const uint8_t idx)
{
uint32_t reg;
if (link_length_read(idx))
return;
reg = link_r32_table(ctrl, link_port[idx]);
link_w32_table(reg | LINK_CTRL_REQ, ctrl, link_port[idx]);
}
int link_fifo_read(const uint8_t idx, uint32_t *pos, const uint32_t max_size, uint32_t *data)
{
uint32_t i, len, off;
int ret = -1;
if(is_falcon_chip_a2x())
off = 18;
else
off = 14;
len = link_length_read(idx);
if (len == 0)
return ret;
for (i=0;i<(len-1);i++) {
if (link_sop(idx) || *pos >= max_size)
*pos = 0;
if (link_eop(idx))
break;
link_data_read(idx, &data[*pos]);
*pos += 2;
}
if (link_sop(idx) || *pos >= max_size)
*pos = 0;
if (link_eop(idx)) {
/* to support extended baseline
change (off + 2) to the range of (off + 2) till 36 */
if (*pos == off) {
ret = 0;
} else if (*pos > off && *pos < 36) {
/* extended baseline */
ONU_DEBUG_ERR("extended baseline not supported yet (%d)\n", *pos);
ret = -2;
} else {
ONU_DEBUG_ERR("EOP at wrong position %d\n", *pos);
ret = -3;
}
}
link_data_read(idx, &data[*pos]);
*pos += 2;
return ret;
}
void link_info_read(const uint32_t *data, struct onu_pdu_info *info)
{
memset(info, 0x00, sizeof(struct onu_pdu_info));
info->len = (data[3] & IQM_DRP2_PLEN_MASK) >> IQM_DRP2_PLEN_OFFSET;
info->segments = SBB_SEG_GET(info->len);
info->hlsa = (data[2] & IQM_DRP3_HLSA_MASK) >> IQM_DRP3_HLSA_OFFSET;
info->tlsa = (data[2] & IQM_DRP3_TLSA_MASK) >> IQM_DRP3_TLSA_OFFSET;
}
int ssb_ingress_data_read(const struct onu_pdu_info *info, uint8_t *data)
{
int ret = 0;
uint32_t lsa, len = info->len, to_copy, i;
uint8_t *ptr;
unsigned long psa;
if (data == NULL || info->segments == 0 || info->tlsa == ONU_GPE_LLT_NIL
|| info->hlsa == ONU_GPE_LLT_NIL || info->len == 0) {
ret = -1;
goto err;
}
ptr = data;
lsa = info->hlsa;
do {
if (len > ONU_GPE_BUFFER_SEGMENT_SIZE)
to_copy = ONU_GPE_BUFFER_SEGMENT_SIZE;
else
to_copy = len;
psa =
ONU_SBS0RAM_BASE + ONU_RAM_PACKET_BUFFER_OFFSET +
(lsa * ONU_GPE_BUFFER_SEGMENT_SIZE);
/* use uint8_t for ptr to allow unaligned buffers */
for (i = 0; i < to_copy;) {
uint32_t val;
val = reg_r32((void *)psa);
*ptr++ = (val >> 24) & 0xFF;
*ptr++ = (val >> 16) & 0xFF;
*ptr++ = (val >> 8) & 0xFF;
*ptr++ = val & 0xFF;
psa += 4;
i += 4;
}
len -= to_copy;
if (len)
lsa = fsqm_llt_read(lsa);
} while (len);
if (lsa != info->tlsa)
ONU_DEBUG_ERR("tlsa & lsa not equal");
err:
fsqm_segment_free(info->tlsa, info->hlsa, info->segments, info->seg_offset);
return ret;
}
STATIC int ssb_data_read(const uint32_t max_len, uint8_t *data,
const uint32_t hlsa, const uint32_t byte_offset,
const uint32_t seg_offset)
{
uint32_t lsa, len = max_len, to_copy, i;
uint8_t *ptr;
unsigned long psa;
uint32_t val = 0;
ptr = data;
lsa = hlsa;
/* skip offset segments*/
for (i = 0; i < seg_offset; i++)
lsa = fsqm_llt_read(lsa);
to_copy = (len > ONU_GPE_BUFFER_SEGMENT_SIZE) ||
(ONU_GPE_BUFFER_SEGMENT_SIZE - byte_offset) < len ?
ONU_GPE_BUFFER_SEGMENT_SIZE - byte_offset : len;
psa = ONU_SBS0RAM_BASE + ONU_RAM_PACKET_BUFFER_OFFSET +
(lsa * ONU_GPE_BUFFER_SEGMENT_SIZE) + byte_offset;
while (len) {
if ((psa & 3) == 0) {
/* source (psa) is aligned */
for (i = 0; i < to_copy; i++) {
if (i % 4 == 0) {
val = reg_r32((void *)psa);
psa += 4;
}
*ptr++ = (val >> ((3-(i%4))*8)) & 0xFF;
}
} else {
for (i = 0; i < to_copy; i++) {
*ptr++ = *(uint8_t *)psa;
psa += 1;
}
}
len -= to_copy;
to_copy = len > ONU_GPE_BUFFER_SEGMENT_SIZE ?
ONU_GPE_BUFFER_SEGMENT_SIZE : len;
if (len)
lsa = fsqm_llt_read(lsa);
psa = ONU_SBS0RAM_BASE + ONU_RAM_PACKET_BUFFER_OFFSET +
(lsa * ONU_GPE_BUFFER_SEGMENT_SIZE);
}
return 0;
}
int ssb_egress_data_read(const struct onu_pdu_info *info, uint8_t *data)
{
int ret = 0;
if(info->tlsa == ONU_GPE_LLT_NIL || info->hlsa == ONU_GPE_LLT_NIL)
return -1;
if (data == NULL || info->segments == 0 ||
info->len == 0 || info->pdu_type != GPE_PDU_TYPE_ETH ||
info->hdr_len + info->bdy_offset + info->bdy_len >
info->segments * ONU_GPE_BUFFER_SEGMENT_SIZE ||
info->bdy_offset > ONU_GPE_BUFFER_SEGMENT_SIZE ||
info->seg_offset > info->segments) {
ret = -1;
goto err;
}
/* read Ethernet packet header*/
ssb_data_read(info->hdr_len, data, info->hlsa, 0, 0);
/* read Ethernet packet body*/
ssb_data_read(info->bdy_len, &data[info->hdr_len], info->hlsa,
info->bdy_offset, info->seg_offset);
err:
fsqm_segment_free(info->tlsa, info->hlsa, info->segments, info->seg_offset);
return ret;
}
STATIC int ssb_segm_write(const uint16_t lsa, const uint32_t len,
const uint8_t *data)
{
uint32_t i;
const uint8_t *ptr;
unsigned long psa;
if (len > ONU_GPE_BUFFER_SEGMENT_SIZE || lsa == ONU_GPE_LLT_NIL || !data)
return -1;
psa = ONU_SBS0RAM_BASE + ONU_RAM_PACKET_BUFFER_OFFSET +
(uint32_t)(lsa * ONU_GPE_BUFFER_SEGMENT_SIZE);
ptr = data;
if (((ulong_t) ptr & (sizeof(ulong_t) - 1)) == 0) {
/* source (ptr) is aligned */
for (i = 0; i < len;) {
reg_w32(*((uint32_t *)ptr), (void *)psa);
ptr += 4;
psa += 4;
i += 4;
}
} else {
for (i = 0; i < len;) {
uint32_t val;
val =
((ptr[0]) << 24) + ((ptr[1]) << 16) +
((ptr[2]) << 8) + (ptr[3]);
reg_w32(val, (void *)psa);
ptr += 4;
psa += 4;
i += 4;
}
}
return 0;
}
int ssb_data_write(const uint32_t max_len, const uint8_t *data,
uint32_t *hlsa, uint32_t *tlsa)
{
int ret = 0;
uint32_t i, to_copy, len, segments;
const uint8_t *ptr;
ptr = data;
len = max_len;
segments = SBB_SEG_GET(max_len);
*hlsa = *tlsa = fsqm_segment_alloc();
if (*tlsa == ONU_GPE_LLT_NIL) {
ONU_DEBUG_ERR("ooops, can't get enough segments");
return -1;
}
do {
to_copy = (len > ONU_GPE_BUFFER_SEGMENT_SIZE) ?
ONU_GPE_BUFFER_SEGMENT_SIZE : len;
ssb_segm_write((uint16_t)*tlsa, to_copy, ptr);
ptr += to_copy;
len -= to_copy;
if (len) {
i = *tlsa;
*tlsa = fsqm_segment_alloc();
if (*tlsa == ONU_GPE_LLT_NIL) {
ONU_DEBUG_ERR
("ooops, can't get enough segments");
fsqm_segment_free(*hlsa, i, segments, 0);
return -1;
}
fsqm_llt_write(i, *tlsa);
} else {
fsqm_llt_write(*tlsa, ONU_GPE_LLT_NIL);
}
} while (len);
return ret;
}
int ssb_link_write(const uint32_t idx, const uint32_t len, const uint32_t *data)
{
int ret = 0;
uint32_t tmp, i, cnt;
unsigned long flags = 0;
onu_spin_lock_get(&link_lock, &flags);
for (i = 0; i < len;) {
cnt = 0;
do {
tmp = link_r32_table(len, link_port[idx]) &
LINK_LEN_LENX_MASK;
cnt++;
} while (tmp == 0 && cnt < 1000);
if (cnt == 1000) {
ONU_DEBUG_ERR("[link%d] no free TX link element", idx);
ret = -1;
break;
}
if (i == 0) {
tmp = link_r32_table(ctrl, link_port[idx]);
link_w32_table(tmp | LINK_CTRL_SOP, ctrl,
link_port[idx]);
}
if (i == len - 2) {
tmp = link_r32_table(ctrl, link_port[idx]);
link_w32_table(tmp | LINK_CTRL_EOP, ctrl,
link_port[idx]);
}
link_w32_table(data[i++], data0, link_port[idx]);
link_w32_table(data[i++], data1, link_port[idx]);
}
onu_spin_lock_release(&link_lock, flags);
return ret;
}
STATIC int ssb_ictrlc_write(const uint8_t idx, const uint32_t len,
const uint32_t *data)
{
int ret = 0;
uint32_t tmp, i, cnt;
unsigned long flags = 0;
if (idx > 1 || len < 2 || len % 2)
return -1;
onu_spin_lock_get(&ictrlc_lock, &flags);
for (i = 0; i < len;) {
cnt = 0;
do {
tmp = ictrlc_r32_table(len, ictrlc_port[idx]) &
ICTRLC_LEN_LENX_MASK;
cnt++;
} while (tmp == 0 && cnt < 1000);
if (cnt == 1000) {
ONU_DEBUG_ERR( "[ictrlc%d] no free TX link element",
idx);
ret = -1;
break;
}
if (i == 0)
ictrlc_w32_table_mask( 0, ICTRLC_CTRL_SOP, ctrl,
ictrlc_port[idx]);
if (i == len - 2)
ictrlc_w32_table_mask( 0, ICTRLC_CTRL_EOP, ctrl,
ictrlc_port[idx]);
ictrlc_w32_table(data[i++], data0, ictrlc_port[idx]);
ictrlc_w32_table(data[i++], data1, ictrlc_port[idx]);
}
onu_spin_lock_release(&ictrlc_lock, flags);
return ret;
}
STATIC int ssb_octrlc_write(const uint32_t *data)
{
uint32_t tmp, cnt;
octrlc_w32(OCTRLC_CTRL_RSR | OCTRLC_CTRL_RSX | OCTRLC_CTRL_BMX, ctrl);
cnt = 0;
do {
tmp = octrlc_r32(len) & OCTRLC_LEN_LENX_MASK;
cnt++;
} while (tmp == 0 && cnt < 1000);
if (cnt == 1000) {
ONU_DEBUG_ERR("[octrlc] no free TX link element");
return -1;
}
octrlc_w32_mask(0, OCTRLC_CTRL_SOP | OCTRLC_CTRL_EOP, ctrl);
octrlc_w32(data[0], data0);
octrlc_w32(data[1], data1);
octrlc_w32(0, ctrl);
return 0;
}
/* OMCI data is sent by writing the data into a segment of the shared buffer
(SSB). The buffer segment address is then handed over to the Egress Queue
Manager (TMU).
The egress queue number is defined by
n = ONU_GPE_EGRESS_QUEUE_OMCI if only a single queue is used or by
n = ONU_GPE_EGRESS_QUEUE_OMCI_LOW and n = ONU_GPE_EGRESS_QUEUE_OMCI_HIGH
if separate queues are used for high and low priority OMCI messages.
Hardware Programming Details
- Get a free segment of the SSB from the FSQM
Logical Segment Address = FSQM.OMQ.LSA
- Write the OMCI data to the SSB segment
- Send an enqueue command to the TMU
*/
/*
QOSL = 48D
(OMCI payload length, including CRC field)
PDUT = 1 (OMCI)
IPN = 7 (ingress port number is dont care)
TICK = 0 (no ticketing is performed on the OMCI traffic)
R = 0 (no re-sequencing)
U = 0 (no calendar update)
C = 1 (send command to TMU)
CMD = 1 (unicast)
COL = 1 (green)
PLEN = 44D (OMCI data length in SSB for short OMCI, not including the CRC;
in case of longer OMCI messages according to the actual length)
TLSA = logical segment number of the last OMCI data segment in the SSB
HLSA = logical segment number of the first OMCI data segment in the SSB
(for short OMCI messages TLSA and HLSA are equal)
This message is then sent to the Link 1 Interface according
*/
int ssb_equeue_write(const uint32_t qid, const uint32_t gem_port_index,
const uint32_t pdu_type,
const uint32_t plen, const uint8_t *data)
{
int ret = 0;
uint32_t hlsa, tlsa;
uint32_t tmp[4] = {0,0,0,0};
const uint32_t qosl = plen + 4;
const uint32_t ipn = 7;
const uint32_t col = 1;
const uint32_t cmd = 1;
const uint32_t gpix = (uint32_t)gem_port_index;
ret = ssb_data_write(plen, data, &hlsa, &tlsa);
if (ret != 0)
return ret;
ONU_DEBUG_MSG("ssb_equeue_write: hlsa %x tlsa %x", hlsa, tlsa);
tmp[0] |= RVAL(ipn, IPN);
tmp[0] |= RVAL(pdu_type, PDUT);
tmp[0] |= RVAL(qosl, QOSL);
tmp[1] |= RVAL(qid, QID);
tmp[2] |= RVAL(hlsa, HLSA);
tmp[2] |= RVAL(tlsa, TLSA);
tmp[3] |= RVAL(plen, PLEN);
tmp[3] |= RVAL(gpix, GPIX);
tmp[3] |= RVAL(col, COL);
tmp[3] |= RVAL(cmd, CMD);
tmp[3] |= REQ_C;
return ssb_link_write(0, 4, tmp);
}
/**
QID
- Ingress queue of CPU for data in upstream direction (to the OLT)
ONU_GPE_INGRESS_QUEUE_CPU_US (4)
- Ingress queue of CPU for data in downstream direction (to the LAN
ports) ONU_GPE_INGRESS_QUEUE_CPU_DS (8)
*/
int ssb_iqueue_write(const uint32_t qid, const uint32_t gem_port_index,
const uint32_t pdu_type,
const uint32_t plen, const uint8_t *data)
{
int ret = 0;
uint8_t ictrlc_idx;
uint32_t hlsa, tlsa;
uint32_t gpix = gem_port_index;
uint32_t tmp[4] = {0};
if (pdu_type != GPE_PDU_TYPE_ETH)
return -1;
if (qid == ONU_GPE_INGRESS_QUEUE_CPU_US) {
ictrlc_idx = 0;
} else if (qid == ONU_GPE_INGRESS_QUEUE_CPU_DS) {
ictrlc_idx = 1;
} else {
return -1;
}
if (iqm_is_backpressure_asserted(qid)) {
ONU_DEBUG_ERR( "ssb_iqueue_write: can't write ingress queue "
"BP asserted");
return -1;
}
ret = ssb_data_write(plen, data, &hlsa, &tlsa);
if (ret != 0)
return ret;
ONU_DEBUG_MSG("ssb_iqueue_write: hlsa %x tlsa %x", hlsa, tlsa);
tmp[0] |= RVAL(pdu_type, PDUT);
/* Set Head and Tail, NLSA field set to 0 by default*/
tmp[2] |= RVAL(hlsa, HLSA);
tmp[2] |= RVAL(tlsa, TLSA);
tmp[3] |= RVAL(plen, PLEN);
tmp[3] |= RVAL(gpix, GPIX);
/* Send ENQUEUE_REQUEST message*/
ret = ssb_ictrlc_write(ictrlc_idx, 4, tmp);
if (ret != 0) {
fsqm_segment_free((uint16_t)tlsa, (uint16_t)hlsa,
SBB_SEG_GET(plen), 0);
return ret;
}
return 0;
}
int ssb_cmd_write(const uint16_t lsa, const uint32_t len, const uint8_t *cmd)
{
int ret = 0;
uint32_t tmp[4] = {0};
if (len > ONU_GPE_BUFFER_SEGMENT_SIZE || lsa == ONU_GPE_LLT_NIL || !cmd)
return -1;
if (iqm_is_backpressure_asserted(ONU_GPE_INGRESS_QUEUE_CPU_DS)) {
ONU_DEBUG_ERR( "ssb_iqueue_write: can't write ingress queue "
"BP asserted");
return -1;
}
ret = ssb_segm_write(lsa, len, cmd);
if (ret != 0)
return ret;
tmp[0] |= RVAL(GPE_PDU_TYPE_CMD, PDUT);
tmp[2] |= RVAL((uint32_t)lsa, HLSA);
tmp[2] |= RVAL((uint32_t)lsa, TLSA);
tmp[3] |= RVAL(len, PLEN);
tmp[3] |= RVAL(0xFF, GPIX);
/* Send ENQUEUE_REQUEST message*/
ret = ssb_ictrlc_write(1, 4, tmp);
if (ret != 0)
return ret;
return ret;
}
/** The OMCI messages can be received either directly from the OMCI ingress
queue (before SCE processing) or from one or two egress queues (one per
OMCI priority, after SCE processing).
The first revision of this function supports only default-size OMCI messages
(48 byte).
\todo larger OMCI message support shall be added later if needed
Note: The raw data format is different in ingress and egress queues.
Hardware Programming Details - Read from Egress Queue
- Send a "schedule request" command to the TMU, with the given egress
port number, either
- ONU_GPE_EGRESS_QUEUE_OMCI or
- ONU_GPE_EGRESS_QUEUE_OMCI_LOW or
- ONU_GPE_EGRESS_QUEUE_OMCI_HIGH
The "request identifier" is set to "CPU", the coprocessor identifier is
set to "TMU", the command code is "schedule request".
- Read the corresponding "schedule response"
The response request delivers
- SEGL: number of 64-byte data segments; shall be 2 for 48-byte OMCI
(1 header segment and one tail segment), else return an error code.
- HLSA: Logical segment address of the header segment; this is a pointer
to a segment within the SSB (Shared Segment Buffer).
- TLSA: Logical segment address of the tail segment
- HDRL: Header length; we need to distinguish if HDRL =< 64 (then we have
a single header segment) or if HDRL > 64 (then we have multiple header
segments.
- OFFS: Offset; this defines the number of bytes that must be skipped in
the segment that follows the (last) header segment. We need a case check
here, if OFFS > 64 we have more than one segment to skip.
- PDUT: PDU type, must be OMCI, else return an error code
Other return values are of no interest here and shall be ignored.
- Read the data segments from the SSB.
- Free the data segments by writing to
FSQM.IMQ.TLSA = TLSA
FSQM.IMQ.HLSA = HLSA
t.b.d. = SEGL
- Reassemble the data segments and return the message in nOMCI_Message[]
according to the description in chapter
"OMCI Data Reception Default Size" of the UMPR.
*/
#if 0
int ssb_equeue_read(const uint8_t qid, const uint32_t max_len, uint8_t *data,
uint32_t *ret_len)
{
int ret = -1;
(void)qid;
memset(data, 0, max_len);
*ret_len = 0;
return ret;
}
#endif
#if defined(INCLUDE_DUMP)
extern int g_p;
void ssb_dump(struct seq_file *s)
{
uint32_t i, k, psa;
/*g_p = 1; */
seq_printf(s, "link\n");
seq_printf(s, "ctrl: ");
for (i = 0; i < 3; i++) {
seq_printf(s, "%08x ", link_r32_table(ctrl, link_port[i]));
}
seq_printf(s, "\nirnen: ");
for (i = 0; i < 3; i++) {
seq_printf(s, "%08x ", link_r32_table(irnen, link_port[i]));
}
seq_printf(s, "\nirnicr: ");
for (i = 0; i < 3; i++) {
seq_printf(s, "%08x ", link_r32_table(irnicr, link_port[i]));
}
seq_printf(s, "\nirncr: ");
for (i = 0; i < 3; i++) {
seq_printf(s, "%08x ", link_r32_table(irncr, link_port[i]));
}
seq_printf(s, "\nlen: ");
for (i = 0; i < 3; i++) {
seq_printf(s, "%08x ", link_r32_table(len, link_port[i]));
}
seq_printf(s, "\nlsa table\n");
for (i = 0; i < 128; i++) {
psa =
ONU_SBS0RAM_BASE + ONU_RAM_PACKET_BUFFER_OFFSET +
(i * ONU_GPE_BUFFER_SEGMENT_SIZE);
seq_printf(s, "%08x: ", psa);
for (k = 0; k < 16 && i < 128; k++, i++) {
psa =
ONU_SBS0RAM_BASE + ONU_RAM_PACKET_BUFFER_OFFSET +
(i * ONU_GPE_BUFFER_SEGMENT_SIZE);
seq_printf(s, "%08x ", reg_r32((void *)psa));
}
seq_printf(s, "\n");
}
}
#endif

160
src/drv_onu_ll_ssb.h Normal file
View File

@ -0,0 +1,160 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_ssb_h
#define _drv_onu_ssb_h
/** \addtogroup ONU_LL_REFERENCE GPON Low-level Functions
@{
*/
/** \addtogroup ONU_LL_SSB Shared Segment Buffer Low-level Functions
Low-level functions to control the Shared Segment Buffer (SSB).
@{
*/
/** Aging command max size [bytes]*/
#define SSB_CMD_AGING_SIZE 48
#define SBB_SEG_GET(len_bytes) \
((len_bytes) ? ((len_bytes)-1)/ONU_GPE_BUFFER_SEGMENT_SIZE + 1 : 0)
typedef int (*ssb_write_t) (const uint32_t qid, const uint32_t gem_port_index,
const uint32_t pdu_type,
const uint32_t plen, const uint8_t *data);
/**
Initialize the SSB block (ssb0).
*/
void ssb_init(void);
/**
Write data to the SSB.
\param max_len Data length
\param data Data to write
\param hlsa Returned Head LSA
\param tlsa Returned Tail LSA
*/
int ssb_data_write(const uint32_t max_len, const uint8_t *data,
uint32_t *hlsa, uint32_t *tlsa);
/**
Read the PDU information from the hardware Egress Queue.
This information will be used to read the PDU data afterwards.
The data read process is splitted into tow functions to allow the calling
process to allocate the destination data memory.
\param epn Egress Port NUmber
\param info PDU information retrieved from queue
for simple network access. Used for testing purposes
*/
int ssb_egress_info_read(const uint8_t epn, struct onu_pdu_info *info);
/**
Convert the link data buffer
\param data Link data buffer
\param info PDU information retrieved from queue
*/
void link_info_read(const uint32_t *data, struct onu_pdu_info *info);
/**
Execute a read request.
\param idx Link Interface Index
*/
void link_data_request(const uint8_t idx);
/**
Read Link FIFO data.
\param idx Link Interface Index
\param pos Data buffer position
\param max_size Data buffer size (in 32 bit words)
\param data Data buffer
*/
int link_fifo_read(const uint8_t idx, uint32_t *pos, const uint32_t max_size, uint32_t *data);
/**
Read the PDU data from the hardware.
In case that the data pointer is zero the PDU will be freed.
\param info PDU information to be used
\param data PDU data retrieved from queue
*/
int ssb_ingress_data_read(const struct onu_pdu_info *info, uint8_t *data);
/**
Read the PDU data from the hardware.
In case that the data pointer is zero the PDU will be freed.
\param info PDU information to be used
\param data PDU data retrieved from queue
*/
int ssb_egress_data_read(const struct onu_pdu_info *info, uint8_t *data);
/** Write data to free segments
\param qid Queue ID
\param gem_port_index GEM Port Index
\param pdu_type \ref GPE_PDU_TYPE_ETH for downstream or
\ref GPE_PDU_TYPE_OMCI for upstream direction
\param plen data length
\param data OMCI PDU or Ethernet frame (not padded, no fcs)
\return
- -2 inserting of segment failed
- -1 out of memory, can not allocate free segment
- 0 success
*/
int ssb_iqueue_write(const uint32_t qid, const uint32_t gem_port_index,
const uint32_t pdu_type,
const uint32_t plen, const uint8_t *data);
/** Write SCE command to the ingress queue \ref ONU_GPE_INGRESS_QUEUE_CPU_DS
\param lsa LSA
\param len command length
\param cmd command data
\return
- -2 inserting of segment failed
- -1 out of memory, can not allocate free segment
- 0 success
*/
int ssb_cmd_write(const uint16_t lsa, const uint32_t len, const uint8_t *cmd);
int ssb_equeue_write(const uint32_t qid, const uint32_t gem_port_index,
const uint32_t pdu_type,
const uint32_t plen, const uint8_t *data);
int ssb_equeue_read(const uint32_t qid, const uint32_t max_len,
uint8_t *data, uint32_t *len);
#if defined(INCLUDE_DUMP)
/**
Dump the SSB memory.
*/
void ssb_dump(struct seq_file *s);
#endif
/*! @} */
/*! @} */
#endif

424
src/drv_onu_ll_sys.c Normal file
View File

@ -0,0 +1,424 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#include "drv_onu_api.h"
#include "drv_onu_register.h"
#include "drv_onu_ll_sys.h"
#include "drv_onu_reg_sys_eth.h"
#include "drv_onu_reg_sys_gpe.h"
#include "drv_onu_reg_sys1.h"
void sys_eth_ext_phy(bool enable, uint16_t clock)
{
uint32_t val = clock & 0x7;
if (enable)
val |= SYS_ETH_EXTPHYC_CLKEN;
sys_eth_w32(val, extphyc);
}
int sys_eth_mdio_clock_rate_set(enum mdio_mode_speed val)
{
uint32_t set;
/* only on A1x chip */
if (is_falcon_chip_a1x()) {
switch (val) {
case MDIO_MODE_SPEED_2M5:
set = SYS_ETH_DRC_MDC_F2M44;
break;
case MDIO_MODE_SPEED_5M:
set = SYS_ETH_DRC_MDC_F4M88;
break;
case MDIO_MODE_SPEED_10M:
set = SYS_ETH_DRC_MDC_F9M77;
break;
case MDIO_MODE_SPEED_20M:
set = SYS_ETH_DRC_MDC_F19M5;
break;
default:
return -1;
}
sys_eth_w32_mask(SYS_ETH_DRC_MDC_MASK, set, drc);
}
return 0;
}
int sys_eth_xmii_data_rate_set(const uint8_t xmii_idx,
const enum lan_mode_speed speed)
{
uint32_t set;
uint8_t idx = xmii_idx & 0x1;
switch (speed) {
case LAN_MODE_SPEED_10:
set = SYS_ETH_DRC_xMII0_DR10;
break;
case LAN_MODE_SPEED_100:
set = idx ? SYS_ETH_DRC_xMII1_DR100:
SYS_ETH_DRC_xMII0_DR100;
break;
case LAN_MODE_SPEED_200:
set = idx ? SYS_ETH_DRC_xMII1_DR200 :
SYS_ETH_DRC_xMII0_DR200;
break;
case LAN_MODE_SPEED_1000:
set = idx ? SYS_ETH_DRC_xMII1_DR1000 :
SYS_ETH_DRC_xMII0_DR1000;
break;
default:
return -1;
}
sys_eth_w32_mask(idx ? SYS_ETH_DRC_xMII1_MASK : SYS_ETH_DRC_xMII0_MASK,
set, drc);
return 0;
}
int sys_eth_gphy_data_rate_set(const uint8_t gphy_idx,
const enum lan_mode_speed speed)
{
uint32_t set;
uint8_t idx = gphy_idx & 0x1;
switch (speed) {
case LAN_MODE_SPEED_10:
set = SYS_ETH_DRC_GPHY0_GMII_DR10;
break;
case LAN_MODE_SPEED_100:
set = idx ? SYS_ETH_DRC_GPHY1_GMII_DR100:
SYS_ETH_DRC_GPHY0_GMII_DR100;
break;
case LAN_MODE_SPEED_1000:
set = idx ? SYS_ETH_DRC_GPHY1_GMII_DR1000 :
SYS_ETH_DRC_GPHY0_GMII_DR1000;
break;
default:
return -1;
}
sys_eth_w32_mask(idx ? SYS_ETH_DRC_GPHY1_GMII_MASK :
SYS_ETH_DRC_GPHY0_GMII_MASK,
set, drc);
return 0;
}
int sys_eth_sgmii_data_rate_set(const enum lan_mode_speed speed)
{
uint32_t set;
switch (speed) {
case LAN_MODE_SPEED_10:
set = SYS_ETH_DRC_SGMII_DR10;
break;
case LAN_MODE_SPEED_100:
set = SYS_ETH_DRC_SGMII_DR100;
break;
case LAN_MODE_SPEED_1000:
set = SYS_ETH_DRC_SGMII_DR1000;
break;
case LAN_MODE_SPEED_2500:
set = SYS_ETH_DRC_SGMII_DR2500;
break;
default:
return -1;
}
sys_eth_w32_mask(SYS_ETH_DRC_SGMII_MASK, set, drc);
return 0;
}
enum mdio_mode_speed sys_eth_mdio_clock_rate_get(void)
{
uint32_t drc;
/* only on A1x chip */
if (is_falcon_chip_a1x()) {
drc = sys_eth_r32(drc) & SYS_ETH_DRC_MDC_MASK;
switch(drc) {
case SYS_ETH_DRC_MDC_F2M44:
return MDIO_MODE_SPEED_2M5;
case SYS_ETH_DRC_MDC_F4M88:
return MDIO_MODE_SPEED_5M;
case SYS_ETH_DRC_MDC_F9M77:
return MDIO_MODE_SPEED_10M;
case SYS_ETH_DRC_MDC_F19M5:
return MDIO_MODE_SPEED_20M;
}
}
return MDIO_MODE_SPEED_UNDEFINED;
}
bool sys_eth_mdio_is_active(void)
{
return (sys_eth_r32(acts) & SYS_ETH_ACTS_MDIO) ? true : false;
}
int sys_eth_gmac_mux_set(uint8_t num, enum gmac_mux_mode mux_mode)
{
uint32_t mask[GMAC_MAX_NUM] = {SYS_ETH_GMUXC_GMAC0_MASK,
SYS_ETH_GMUXC_GMAC1_MASK,
SYS_ETH_GMUXC_GMAC2_MASK,
SYS_ETH_GMUXC_GMAC3_MASK};
uint8_t offset[GMAC_MAX_NUM] = {SYS_ETH_GMUXC_GMAC0_OFFSET,
SYS_ETH_GMUXC_GMAC1_OFFSET,
SYS_ETH_GMUXC_GMAC2_OFFSET,
SYS_ETH_GMUXC_GMAC3_OFFSET};
if (num >= GMAC_MAX_NUM)
return -1;
sys_eth_w32_mask(mask[num], mux_mode << offset[num], gmuxc);
return 0;
}
int sys_eth_gmac_mux_get(uint8_t num, enum gmac_mux_mode *mux_mode)
{
uint8_t offset[GMAC_MAX_NUM] = {SYS_ETH_GMUXC_GMAC0_OFFSET,
SYS_ETH_GMUXC_GMAC1_OFFSET,
SYS_ETH_GMUXC_GMAC2_OFFSET,
SYS_ETH_GMUXC_GMAC3_OFFSET};
if (num >= GMAC_MAX_NUM)
return -1;
*mux_mode = (enum gmac_mux_mode)((sys_eth_r32(gmuxc) >> offset[num]) &
SYS_ETH_GMUXC_GMAC0_MASK);
return 0;
}
void sys_eth_gphy_reboot(uint8_t phyno)
{
uint32_t ier, isr;
if (phyno == 0) {
if (is_falcon_chip_a1x()) {
ier = EIM_EIM_IER_A1X_GPHY0_IEN_EN;
isr = EIM_EIM_ISR_A1X_GPHY0_IRQ;
} else {
ier = EIM_EIM_IER_A2X_GPHY0_IEN_EN;
isr = EIM_EIM_ISR_A2X_GPHY0_IRQ;
}
} else {
if (is_falcon_chip_a1x()) {
ier = EIM_EIM_IER_A1X_GPHY1_IEN_EN;
isr = EIM_EIM_ISR_A1X_GPHY1_IRQ;
} else {
ier = EIM_EIM_IER_A2X_GPHY1_IEN_EN;
isr = EIM_EIM_ISR_A2X_GPHY1_IRQ;
}
}
sys_eth_hw_activate_or_reboot((phyno == 0) ? SYS_ETH_ACT_GPHY0 :
SYS_ETH_ACT_GPHY1);
/* enable the interrupt for gphy */
eim_w32_mask(0, ier, top_pdi.eim_ier);
sys_eth_w32((phyno == 0) ? SYS_ETH_RBT_GPHY0_TRIG :
SYS_ETH_RBT_GPHY1_TRIG, rbt);
/* wait for interrupt */
while ((eim_r32(top_pdi.eim_isr) & isr) == 0)
{};
/* disable interrupt */
eim_w32_mask(ier, 0, top_pdi.eim_ier);
/* acknowledge interrupt */
eim_w32_mask(isr, 0, top_pdi.eim_isr);
}
void sys_eth_gphy_boot_addr_set(uint8_t phyno, uint32_t gphy_fw_addr)
{
if (phyno == 0)
sbs0ctrl_w32(gphy_fw_addr & SBS0CTRL_GPHY0IMG_ADDRV_MASK,
gphy0img);
else
sbs0ctrl_w32(gphy_fw_addr & SBS0CTRL_GPHY1IMG_ADDRV_MASK,
gphy1img);
}
void sys_gpe_merger_reboot(void)
{
sys_gpe_w32(SYS_GPE_RBT_MRG_TRIG, rbt);
}
int sys_eth_gmac_data_rate_get(uint8_t num, enum lan_mode_speed *speed)
{
uint32_t reg;
enum lan_mode_speed speed_map[] = {
LAN_MODE_SPEED_10,
LAN_MODE_SPEED_100,
LAN_MODE_SPEED_1000,
LAN_MODE_SPEED_AUTO, /* just to indicate an unhandled value*/
LAN_MODE_SPEED_2500,
LAN_MODE_SPEED_200
};
reg = sys_eth_r32(drs) >> ((num & 0x3)*SYS_ETH_DRS_GMAC1_OFFSET);
reg &= SYS_ETH_DRS_GMAC0_MASK;
*speed = speed_map[reg];
return *speed != LAN_MODE_SPEED_AUTO ? 0 : -1;
}
void status_chipid_get(uint32_t *chipid, uint32_t *config)
{
*chipid = status_r32(chipid);
*config = status_r32(config);
}
void status_fuses_get(uint32_t *analog, uint32_t *fuse0)
{
*analog = status_r32(analog);
*fuse0 = status_r32(fuse0);
}
void sys_gpe_tmu_reboot(void)
{
sys_gpe_w32(SYS_GPE_RBT_TMU_TRIG, rbt);
}
void sys_gpe_sleep_cfg_set(uint32_t sscfg, uint32_t sdset)
{
sys_gpe_w32(sscfg, sscfg);
sys_gpe_w32(sdset, sdset);
}
void sys1_clko_enable(bool enable)
{
sys1_w32_mask(CLKOC_OEN, enable ? CLKOC_OEN : 0, clkoc);
}
/**
* Retrieve activation status of the selected hardware module(s)
*
* \param[in] mask bitmask of module(s), as for registers SYS_ETH.RBT
* \return int 1 - if hardware module(s) is activated (including clock)
*/
int sys_eth_hw_is_activated(uint32_t mask)
{
if ((sys_eth_r32(clks) & mask) != mask)
return 0;
return ((sys_gpe_r32(acts) & mask) == mask);
}
#if defined(INCLUDE_DUMP)
const char *sys_eth_names[32] = {
"GMAC0", "GMAC1", "GMAC2", "GMAC3",
NULL, NULL, NULL, "MDIO",
"GPHY0", "GPHY1", "SGMII", "xMII",
NULL, NULL, NULL, NULL,
"GPIO0", "GPIO2", NULL, NULL,
"PAD0", "PAD2", NULL, NULL,
"GPHY0MII2", "GPHY1MII2", NULL, NULL,
NULL, NULL, NULL, NULL
};
const char *sys_gpe_names[32] = {
"LAN0", "LAN1", "LAN2", "LAN3",
"GPONI", "GPONE", "CPUI", "CPUE",
"IQM", "DISP", "MRG", "TMU",
"FSQM", "ARB", NULL, NULL,
"PE0", "PE1", "PE2", "PE3",
"PE4", "PE5", NULL, NULL,
"COP0", "COP1", "COP2", "COP3",
"COP4", "COP5", "COP6", "COP7"
};
const char *sys_gpe_sscfg_names[32] = {
"LAN0I", "LAN1I", "LAN2I", "LAN3I",
"GPONI", NULL, NULL, NULL,
"LAN0E", "LAN1E", "LAN2E", "LAN3E",
"GPONE", "GPONT", NULL, "FSQM",
NULL, "CPU", NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL
};
void sys_dump(struct seq_file *s)
{
uint32_t clks, acts, sds, sscfg, sdset;
static const char *space=" ";
int i;
acts = sys_eth_r32(acts);
clks = sys_eth_r32(clks);
seq_printf(s, "sys_eth\t");
for (i=0; i<32; i++)
if (sys_eth_names[i] != NULL)
seq_printf(s, "%s ", sys_eth_names[i]);
seq_printf(s, "\nacts\t ");
for (i=0; i<32; i++)
if (sys_eth_names[i] != NULL)
seq_printf(s, "%c%s", (acts & 1<<i) ? 'X':' ',
(space+(10-strlen(sys_eth_names[i]))));
seq_printf(s, "\nclks\t ");
for (i=0; i<32; i++)
if (sys_eth_names[i] != NULL)
seq_printf(s, "%c%s", (clks & 1<<i) ? 'X':' ',
(space+(10-strlen(sys_eth_names[i]))));
if (sys_gpe_hw_is_activated(0)) {
acts = sys_gpe_r32(acts);
clks = sys_gpe_r32(clks);
sds = sys_gpe_r32(sds);
sscfg = sys_gpe_r32(sscfg);
sdset = sys_gpe_r32(sdset);
seq_printf(s, "\nsys_gpe\t");
for (i=0; i<32; i++)
if (sys_gpe_names[i] != NULL)
seq_printf(s, "%s ", sys_gpe_names[i]);
seq_printf(s, "\nacts\t ");
for (i=0; i<32; i++)
if (sys_gpe_names[i] != NULL)
seq_printf(s, "%c%s", (acts & 1<<i) ? 'X':' ',
(space+(10-strlen(sys_gpe_names[i]))));
seq_printf(s, "\nclks\t ");
for (i=0; i<32; i++)
if (sys_gpe_names[i] != NULL)
seq_printf(s, "%c%s", (clks & 1<<i) ? 'X':' ',
(space+(10-strlen(sys_gpe_names[i]))));
seq_printf(s, "\nsds\t ");
for (i=0; i<32; i++)
if (sys_gpe_names[i] != NULL)
seq_printf(s, "%c%s", (sds & 1<<i) ? 'X':' ',
(space+(10-strlen(sys_gpe_names[i]))));
seq_printf(s, "\nsdset\t ");
for (i=0; i<32; i++)
if (sys_gpe_names[i] != NULL)
seq_printf(s, "%c%s", (sdset & 1<<i) ? 'X':' ',
(space+(10-strlen(sys_gpe_names[i]))));
seq_printf(s, "\nsys_gpe_sscfg\t");
for (i=0; i<32; i++)
if (sys_gpe_sscfg_names[i] != NULL)
seq_printf(s, "%s ", sys_gpe_sscfg_names[i]);
seq_printf(s, "\nsscfg\t ");
for (i=0; i<32; i++)
if (sys_gpe_sscfg_names[i] != NULL)
seq_printf(
s, "%c%s", (sscfg & 1<<i) ? 'X':' ',
(space + (10 -
strlen(sys_gpe_sscfg_names[i]))));
}
seq_printf(s, "\n");
}
#endif

222
src/drv_onu_ll_sys.h Normal file
View File

@ -0,0 +1,222 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_sys_h
#define _drv_onu_sys_h
/** \addtogroup ONU_LL_REFERENCE GPON Low-level Functions
@{
*/
/** \addtogroup ONU_LL_SYS System Control Low-level Functions
Low-level functions to access system control settings.
@{
*/
#if defined(ONU_LIBRARY)
#include <sysctrl.h>
#else
#if defined(LINUX) && defined(__KERNEL__)
#include <falcon/sysctrl.h>
#else
static inline void sys1_hw_activate(uint32_t mask) { (void) mask; }
static inline void sys1_hw_deactivate(uint32_t mask) { (void) mask; }
static inline void sys1_hw_clk_enable(uint32_t mask) { (void) mask; }
static inline void sys1_hw_clk_disable(uint32_t mask) { (void) mask; }
static inline void sys1_hw_activate_or_reboot(uint32_t mask) { (void) mask; }
static inline void sys_eth_hw_activate(uint32_t mask) { (void) mask; }
static inline void sys_eth_hw_deactivate(uint32_t mask) { (void) mask; }
static inline void sys_eth_hw_clk_enable(uint32_t mask) { (void) mask; }
static inline void sys_eth_hw_clk_disable(uint32_t mask) { (void) mask; }
static inline void sys_eth_hw_activate_or_reboot(uint32_t mask) { (void) mask; }
static inline void sys_gpe_hw_activate(uint32_t mask) {(void) mask; }
static inline void sys_gpe_hw_deactivate(uint32_t mask) { (void) mask; }
static inline void sys_gpe_hw_clk_enable(uint32_t mask) { (void) mask; }
static inline void sys_gpe_hw_clk_disable(uint32_t mask) { (void) mask; }
static inline void sys_gpe_hw_activate_or_reboot(uint32_t mask) { (void) mask; }
static inline int sys_gpe_hw_is_activated(uint32_t mask) { (void) mask; return 0; }
#endif
#endif
/** clock defines for \ref sys_eth_ext_phy() */
#define F25 1 /**< 25 MHz */
#define F50 5 /**< 50 MHz */
#define F125 2 /**< 125 MHz */
#define GMAC_MAX_NUM 4
enum gmac_mux_mode {
/** GMAC connects to GPHY0_GMII interface */
GMAC_GPHY0_GMII = 0,
/** GMAC connects to GPHY0_MII2 interface */
GMAC_GPHY0_MII2 = 1,
/** GMAC connects to GPHY1_GMII interface */
GMAC_GPHY1_GMII = 2,
/** GMAC connects to GPHY1_MII2 interface */
GMAC_GPHY1_MII2 = 3,
/** GMAC connects to SGMII interface */
GMAC_SGMII = 4,
/** GMAC connects to xMII0 interface */
GMAC_xMII0 = 5,
/** GMAC connects to xMII1 interface */
GMAC_xMII1 = 6
};
/**
Configure the ETH output driver
\param enable Enables the output driver of the PHY_CLKO pin.
\param clock Selects the frequency of the PHY_CLKO pin.
*/
void sys_eth_ext_phy(bool enable, uint16_t clock);
/**
Set MDIO clock rate
\param val Selects the frequency of the MDIO interface.
*/
int sys_eth_mdio_clock_rate_set(enum mdio_mode_speed val);
/**
Get MDIO clock rate
*/
enum mdio_mode_speed sys_eth_mdio_clock_rate_get(void);
/**
Get MDIO activation status
*/
bool sys_eth_mdio_is_active(void);
/**
Set GMAC Multiplexer Mode
\param num GMAC number.
\param mux_mode GMAC Multiplexer Mode.
*/
int sys_eth_gmac_mux_set(uint8_t num, enum gmac_mux_mode mux_mode);
/**
Get GMAC Multiplexer Mode
\param num GMAC number.
\param mux_mode GMAC Multiplexer Mode.
*/
int sys_eth_gmac_mux_get(uint8_t num, enum gmac_mux_mode *mux_mode);
/**
Set xMII interface datarate
\param xmii_idx GMAC number.
\param speed xMII speed.
*/
int sys_eth_xmii_data_rate_set(const uint8_t xmii_idx,
const enum lan_mode_speed speed);
/**
Set GPHYx interface datarate
\param gphy_idx GMAC number.
\param speed xMII speed.
*/
int sys_eth_gphy_data_rate_set(const uint8_t gphy_idx,
const enum lan_mode_speed speed);
/**
Set SGMII interface datarate
\param speed SGMII speed
*/
int sys_eth_sgmii_data_rate_set(const enum lan_mode_speed speed);
/**
Reboot GPHYx module
\param phyno GPHY number (0 or 1)
*/
void sys_eth_gphy_reboot(uint8_t phyno);
/**
Set boot address for GPHYx module
\param phyno GPHY number (0 or 1)
\param gphy_fw_addr Address of GPHY FW
*/
void sys_eth_gphy_boot_addr_set(uint8_t phyno, uint32_t gphy_fw_addr);
/**
Reboot MERGER module
*/
void sys_gpe_merger_reboot(void);
/**
Get GMACx Data Rate Status
\param num GMAC number (0..3)
\param speed GMAC data rate status
*/
int sys_eth_gmac_data_rate_get(uint8_t num, enum lan_mode_speed *speed);
/**
Get CHIP ID
\param chipid Chip identification
\param config Configuration fuses
*/
void status_chipid_get(uint32_t *chipid, uint32_t *config);
/** Get fuses configuration
\param analog Fuses for analog modules
\param fuse0 SPARE fuse register 0
*/
void status_fuses_get(uint32_t *analog, uint32_t *fuse0);
/**
Set sleep mode configuration
\param sscfg SSCFG register
\param sdset SDSET register
*/
void sys_gpe_sleep_cfg_set(uint32_t sscfg, uint32_t sdset);
/**
Reboot TMU module
*/
void sys_gpe_tmu_reboot(void);
/**
Enables/disables the output driver of the CLKO pad
\param enable Enable/Disable the output driver of the CLKO pad
*/
void sys1_clko_enable(bool enable);
/**
* Retrieve activation status of the selected hardware module(s)
*
* \param[in] mask bitmask of module(s), as for registers SYS_ETH.RBT
* \return int 1 - if hardware module(s) is activated (including clock)
*/
int sys_eth_hw_is_activated(uint32_t mask);
#if defined(INCLUDE_DUMP)
/**
Dump the SYS information.
*/
void sys_dump(struct seq_file *s);
#endif
/*! @} */
/*! @} */
#endif

332
src/drv_onu_ll_tbm.c Normal file
View File

@ -0,0 +1,332 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#include "drv_onu_api.h"
#include "drv_onu_register.h"
#include "drv_onu_resource_gpe.h"
#include "drv_onu_ll_tbm.h"
STATIC void tbm_mrm_conversion(uint32_t tsprescale, uint32_t byterate,
struct tbm_tbmt_entry * tbmt);
STATIC void tbm_rate_conversion(struct tbm_tbmt_entry * tbmt,
uint32_t * byterate);
#define TBMCLOCK_HZ 625000000
/* A21 The coreclock fractional part for TS */
#define TS_SCALING 4
#define TBM_MRE_INIT 22
#define TBM_MRM_MAX 4095
#define TBM_MRE_MAX 31
/** set the default crawler period on A22 */
#define TBM_CPERIOD 12
/** \addtogroup ONU_MAPI_REFERENCE_INTERNAL
@{
*/
/** \defgroup ONU_TBM_INTERNAL GPE - TBM Interface
@{
*/
/** Convert byterate into MRM and MRE parameter
\param tsprescale must be aligned as follows:
- if tbmt.tss = 0 tsprescale = IQM.CTRL.TSPRESCALE,
which is a new basic init parameter in the IQM CTRL register.
- if tbmt.tss = 1 tsprescale = TBM.CTRL.TSPRESCALE,
which is a new basic init parameter in the TBM CTRL register.
\param byterate byterate in [byte / s] as
defined in the OMCI standards. byterate ranges from
1000 till 125000000 which must be checked by the calling
function
\param tbmt returned \ref tbm_tbmt_entry
*/
STATIC void tbm_mrm_conversion(uint32_t tsprescale,
uint32_t byterate, struct tbm_tbmt_entry *tbmt)
{
uint32_t mre_temp;
uint64_t mrm_temp;
mre_temp = 26;
mrm_temp = (uint64_t)byterate << (tsprescale + TS_SCALING + mre_temp);
#ifdef __KERNEL__
do_div(mrm_temp, TBMCLOCK_HZ);
#else
mrm_temp = mrm_temp / TBMCLOCK_HZ;
#endif
/* scaling down mrm_temp to fit into 12-bit MRM field */
while (mrm_temp >= 4096) {
mrm_temp = mrm_temp>>1;
mre_temp = mre_temp-1;
}
tbmt->mrm = (uint16_t)mrm_temp;
tbmt->mre = (uint16_t)mre_temp;
}
STATIC void tbm_rate_conversion(struct tbm_tbmt_entry *tbmt, uint32_t *byterate)
{
uint64_t rate_temp;
/* replace hard value of 5 with tsprescale parameter, similar to function tbm_mrm_conversion */
rate_temp = ((uint64_t)tbmt->mrm * TBMCLOCK_HZ) >> (tbmt->mre + TS_SCALING + 5);
*byterate = (uint32_t)rate_temp;
}
void tbm_enable(bool act)
{
tbm_w32_mask(TBM_CTRL_ACT_EN, act ? TBM_CTRL_ACT_EN : 0, ctrl);
}
bool tbm_is_enabled(void)
{
return tbm_r32(ctrl) & TBM_CTRL_ACT_EN ? true : false;
}
void tbm_init(void)
{
uint32_t data;
struct tbm_tbmt_entry tbmt;
uint32_t tbid;
/* No act and clken registers available for this module in SYS_GPE.*/
/* todo add TBMT.TSE field initialization. Default = 4 */
if (is_falcon_chip_a1x()) {
tbm_w32(TBM_CTRL_A1X_INITSTART, ctrl);
data = tbm_r32(ctrl); /* \todo add timeout value */
do {
data = tbm_r32(ctrl);
} while ((data & TBM_CTRL_A1X_INITDONE) != TBM_CTRL_A1X_INITDONE);
}
else
/* on A2x, initialize TBM.CTRL.CPERIOD to 12 */
tbm_w32_mask (TBM_CTRL_CPERIOD_MASK, TBM_CPERIOD, ctrl);
tbmt.tbe = 0;
tbmt.mod = 0;
tbmt.mrm = 0;
tbmt.mre = 0;
tbmt.mbs = 0xFFFFFF; /* max value */
tbmt.tbc = 0xFFFFFF; /* max value */
tbmt.lts = 0;
tbmt.ets = 0;
tbmt.vts = 0;
if (is_falcon_chip_a1x())
tbmt.tss = 0;
else
tbmt.tss = 1;
for (tbid = 0; tbid < ONU_GPE_MAX_TBM; tbid++) {
tbmt.tbid = tbid;
tbm_meter_set(&tbmt);
}
}
void tbm_meter_register_set(const struct tbm_tbmt_entry *tbmt)
{
uint32_t w_tbmtr0, w_tbmtr1, w_tbmtr2, w_tbmtr3;
w_tbmtr0 = (tbmt->tbe) ? TBM_TBMTR0_TBE_EN : 0;
w_tbmtr0 |= (tbmt->mod << TBM_TBMTR0_MOD_OFFSET);
if (is_falcon_chip_a1x())
w_tbmtr0 |= (tbmt->mrm << TBM_TBMTR0_A1X_MRM_OFFSET);
else
w_tbmtr0 |= (tbmt->mrm << TBM_TBMTR0_A2X_MRM_OFFSET);
if(tbmt->tss) w_tbmtr0 |= TBM_TBMTR0_TSS;
w_tbmtr0 |= tbmt->mre;
tbm_w32(w_tbmtr0, tbmtr0);
if (is_falcon_chip_a1x())
w_tbmtr1 = (tbmt->mbs << TBM_TBMTR1_A1X_MBS_OFFSET) & TBM_TBMTR1_A1X_MBS_MASK;
else
w_tbmtr1 = (tbmt->mbs << TBM_TBMTR1_A2X_MBS_OFFSET) & TBM_TBMTR1_A2X_MBS_MASK;
tbm_w32(w_tbmtr1, tbmtr1);
w_tbmtr2 = tbmt->tbc;
tbm_w32(w_tbmtr2, tbmtr2);
w_tbmtr3 = (tbmt->vts) ? TBM_TBMTR3_VTS : 0;
w_tbmtr3 |= (tbmt->ets << TBM_TBMTR3_ETS_OFFSET);
w_tbmtr3 |= tbmt->lts;
tbm_w32(w_tbmtr3, tbmtr3);
}
void tbm_meter_register_get(struct tbm_tbmt_entry *tbmt)
{
uint32_t r_tbmtr0, r_tbmtr1, r_tbmtr2, r_tbmtr3;
r_tbmtr0 = tbm_r32(tbmtr0);
tbmt->tbe = ((r_tbmtr0 & TBM_TBMTR0_TBE) == TBM_TBMTR0_TBE_EN);
tbmt->mod = (r_tbmtr0 & TBM_TBMTR0_MOD_MASK ) >> TBM_TBMTR0_MOD_OFFSET;
if (is_falcon_chip_a1x()) {
tbmt->mrm = (r_tbmtr0 & TBM_TBMTR0_A1X_MRM_MASK) >> TBM_TBMTR0_A1X_MRM_OFFSET;
tbmt->mre = (r_tbmtr0 & TBM_TBMTR0_A1X_MRE_MASK) >> TBM_TBMTR0_MRE_OFFSET;
} else {
tbmt->mrm = (r_tbmtr0 & TBM_TBMTR0_A2X_MRM_MASK) >> TBM_TBMTR0_A2X_MRM_OFFSET;
tbmt->mre = (r_tbmtr0 & TBM_TBMTR0_A2X_MRE_MASK) >> TBM_TBMTR0_MRE_OFFSET;
tbmt->tss = (r_tbmtr0 & TBM_TBMTR0_TSS) ? 1 : 0;
}
r_tbmtr1 = tbm_r32(tbmtr1);
if (is_falcon_chip_a1x())
tbmt->mbs = (r_tbmtr1 & TBM_TBMTR1_A1X_MBS_MASK) >> TBM_TBMTR1_A1X_MBS_OFFSET;
else
tbmt->mbs = (r_tbmtr1 & TBM_TBMTR1_A2X_MBS_MASK) >> TBM_TBMTR1_A2X_MBS_OFFSET;
r_tbmtr2 = tbm_r32(tbmtr2);
tbmt->tbc = (r_tbmtr2 & TBM_TBMTR2_TBC_MASK) >> TBM_TBMTR2_TBC_OFFSET;
r_tbmtr3 = tbm_r32(tbmtr3);
tbmt->vts = ((r_tbmtr3 & TBM_TBMTR3_VTS) == TBM_TBMTR3_VTS);
tbmt->ets = (r_tbmtr3 & TBM_TBMTR3_ETS_MASK) >> TBM_TBMTR3_ETS_OFFSET;
tbmt->lts = (r_tbmtr3 & TBM_TBMTR3_LTS_MASK) >> TBM_TBMTR3_LTS_OFFSET;
}
void tbm_meter_set(const struct tbm_tbmt_entry *tbmt)
{
uint32_t w_tbmtc;
tbm_meter_register_set(tbmt);
w_tbmtc = TBM_TBMTC_SEL_SELALL;
w_tbmtc |= TBM_TBMTC_RW;
w_tbmtc |= tbmt->tbid;
tbm_w32(w_tbmtc, tbmtc);
}
void tbm_meter_get(struct tbm_tbmt_entry *tbmt)
{
uint32_t w_tbmtc;
ONU_DEBUG_MSG("tbid %i", tbmt->tbid);
w_tbmtc = TBM_TBMTC_SEL_SELALL;
w_tbmtc |= tbmt->tbid;
tbm_w32(w_tbmtc, tbmtc);
tbm_meter_register_get(tbmt);
}
void tbm_meter_cfg_set(const struct tbm_token_bucket_meter_params *tbmt)
{
uint32_t w_tbmtc;
struct tbm_tbmt_entry tbmtr;
w_tbmtc = tbmt->tbid;
tbm_w32(w_tbmtc, tbmtc);
tbm_meter_register_get(&tbmtr);
tbmtr.mod = tbmt->mod;
tbmtr.tbe = tbmt->tbe;
tbmtr.mbs = tbmt->mbs;
if (is_falcon_chip_a1x())
tbmtr.tss = 0; /* unused */
else
tbmtr.tss = 1; /* Use TBM internal timestamping */
/**\todo Once the register definitions are available for A21
replace 5 by
IQM.CTRL.TSPRESCALE if tbmt->tss = 0
TBM.CTRL.TSPRESCALE if tbmt->tss = 1 */
tbm_mrm_conversion(5, tbmt->rate, &tbmtr);
tbm_meter_register_set(&tbmtr);
w_tbmtc = TBM_TBMTC_SEL_SELALL;
w_tbmtc |= TBM_TBMTC_RW;
w_tbmtc |= tbmt->tbid;
tbm_w32(w_tbmtc, tbmtc);
}
void tbm_meter_cfg_get(struct tbm_token_bucket_meter_params *tbmt)
{
uint32_t w_tbmtc;
struct tbm_tbmt_entry tbmtr;
ONU_DEBUG_MSG("tbid %i", tbmt->tbid);
w_tbmtc = tbmt->tbid;
tbm_w32(w_tbmtc, tbmtc);
tbm_meter_register_get(&tbmtr);
tbm_rate_conversion(&tbmtr, &(tbmt->rate));
tbmt->mbs = tbmtr.mbs;
tbmt->mod = tbmtr.mod;
tbmt->tbe = tbmtr.tbe;
}
int16_t find_meter_mode(const struct gpe_meter_cfg *param)
{
if (param->mode == GPE_METER_RFC4115 &&
param->color_aware == false)
return 0;
if (param->mode == GPE_METER_RFC4115 &&
param->color_aware == true)
return 1;
if (param->mode == GPE_METER_RFC2698 &&
param->color_aware == false)
return 2;
if (param->mode == GPE_METER_RFC2698 &&
param->color_aware == true)
return 3;
if (param->mode == GPE_METER_NONE &&
param->color_aware == false)
return 2;
if (param->mode == GPE_METER_NONE &&
param->color_aware == true)
return 3;
return -1;
}
#if defined(INCLUDE_DUMP)
void tbm_dump(struct seq_file *s)
{
struct tbm_tbmt_entry tbmt;
uint32_t tbid;
for (tbid = 0; tbid < ONU_GPE_MAX_TBM; tbid++) {
tbmt.tbid = tbid;
tbm_meter_get(&tbmt);
seq_printf(s, "[%03d] %d %d %d %d %d %d %d %d %d\n", tbid,
tbmt.tbe,
tbmt.mod,
tbmt.mrm,
tbmt.mre,
tbmt.mbs,
tbmt.tbc,
tbmt.lts,
tbmt.ets,
tbmt.vts);
}
}
#endif
/*! @} */
/*! @} */

155
src/drv_onu_ll_tbm.h Normal file
View File

@ -0,0 +1,155 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_tbm_h
#define _drv_onu_tbm_h
#define TBM_CORECLOCK 625
/* exclude some parts from SWIG generation */
#ifndef SWIG
/** \addtogroup ONU_LL_REFERENCE GPON Low-level Functions
@{
*/
/**
This structure is used to set the parameters of a token bucket meter.
\remarks The rate parameter is given in bytes/sec.
\remarks The burst size parameter is given in bytes.
*/
struct tbm_token_bucket_meter_params {
/**
This field selects the TBM identifier.
*/
uint16_t tbid;
/**
This field indicates the TBM operating mode.
- 0H: MOD_0, RFC 4115 color blind.
- 1H: MOD_1, RFC 4115 color aware.
- 0H: MOD_2, RFC 2698 color blind.
- 2H: MOD_3, RFC 2698 color aware.
*/
uint16_t mod;
/**
This bit indicates if the meter bucket is enabled.
- 0H: DIS, Disable.
- 1H: EN, Enable.
*/
uint16_t tbe;
/**
Information Rate in bytes/s.
Supported range is 8,000 ... 125,000,000 bytes/s
*/
uint32_t rate;
/**
Maximum Burst Size in bytes.
*/
uint32_t mbs;
};
/**
This structure is used to hold the attributes of a complete TBM entry.
*/
struct tbm_tbmt_entry {
uint32_t mbs;
uint32_t tbc;
uint32_t lts;
uint16_t tbe;
uint16_t mod;
uint16_t cf;
uint16_t tss;
uint16_t mrm;
uint16_t mre;
uint16_t ets;
uint16_t vts;
uint16_t tbid;
};
/** \addtogroup ONU_LL_TBM Token Bucket Meter Low-level Functions
Low-level functions to control the Dual Token Bucket Meter (TBM).
@{
*/
/* ***************************************************************************/
/**
Set Activate / Deactivate switch for TBM state machines.
*/
void tbm_enable(const bool act);
/**
Get Activate / Deactivate switch of TBM state machines.
*/
bool tbm_is_enabled(void);
/**
Initialize the IQM block.
*/
void tbm_init(void);
/**
Set configuration parameters of a tbm meter entry
*/
void tbm_meter_cfg_set(const struct tbm_token_bucket_meter_params *tbmt);
/**
get configuration parameters of a tbm meter entry
*/
void tbm_meter_cfg_get(struct tbm_token_bucket_meter_params *tbmt);
/**
Set a tbm meter entry
*/
void tbm_meter_set(const struct tbm_tbmt_entry *tbmt);
/**
Get a tbm meter entry
*/
void tbm_meter_get(struct tbm_tbmt_entry *tbmt);
/**
Set tbm meter registers
*/
void tbm_meter_register_set(const struct tbm_tbmt_entry *tbmt);
/**
Get tbm meter registers
*/
void tbm_meter_register_get(struct tbm_tbmt_entry *tbmt);
/**
Identify the correct mod field for the register
*/
int16_t find_meter_mode(const struct gpe_meter_cfg *param);
#if defined(INCLUDE_DUMP)
/**
Dump the TBM register block.
*/
void tbm_dump(struct seq_file *s);
#endif
/*! @} */
/*! @} */
#endif /* #ifndef SWIG*/
#endif

2721
src/drv_onu_ll_tmu.c Normal file

File diff suppressed because it is too large Load Diff

1571
src/drv_onu_ll_tmu.h Normal file

File diff suppressed because it is too large Load Diff

209
src/drv_onu_ll_tod.c Normal file
View File

@ -0,0 +1,209 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#include "drv_onu_api.h"
#include "drv_onu_register.h"
#include "drv_onu_resource_gpe.h"
#include "drv_onu_ll_tod.h"
#include "drv_onu_ll_tod_asc.h"
/** \addtogroup ONU_MAPI_REFERENCE_INTERNAL
@{
*/
/** \defgroup ONU_TOD_INTERNAL GPE - TOD Interface
@{
*/
void tod_init(const uint16_t intdel, const uint16_t pw)
{
uint32_t reg = 0;
set_val(reg, intdel, TOD_CFG_INTDEL_MASK, TOD_CFG_INTDEL_OFFSET);
set_val(reg, pw, TOD_CFG_PW_MASK, TOD_CFG_PW_OFFSET);
tod_w32(reg, cfg);
/* Enable delayed PPS interrupt */
tod_interrupt_enable_set(TOD_IRNEN_PPS | TOD_IRNEN_PPSDEL,
TOD_IRNEN_PPSDEL);
if (onu_asc1_init())
ONU_DEBUG_ERR("can't initialize ASC1");
}
void tod_frm_enable(const bool enable)
{
tod_w32_mask(TOD_CFG_FRM_EN, enable ? TOD_CFG_FRM_EN : 0, cfg);
}
void tod_sfcc_set(const uint32_t val)
{
tod_w32(val, sfcc);
}
uint32_t tod_sfcc_get(void)
{
return tod_r32(sfcc);
}
void tod_rlds_set(const uint32_t val)
{
tod_w32(val, rlds);
}
uint32_t tod_rlds_get(void)
{
return tod_r32(rlds);
}
void tod_rldns_set(const uint16_t high, const uint16_t low)
{
tod_w32((((uint32_t)high << TOD_RLDNS_RLDNSHI_OFFSET) | (uint32_t)low),
rldns);
}
uint32_t tod_rldns_get(void)
{
return tod_r32(rldns);
}
uint32_t tod_rldns2nsec(const uint32_t rldns)
{
uint32_t h, l;
/* maximum value of h = 0x3fff (14 bits) */
h = (rldns & TOD_RLDNS_RLDNSHI_MASK) >> TOD_RLDNS_RLDNSHI_OFFSET;
/* maximum value of l = 0x7fff (15 bits) */
l = (rldns & TOD_RLDNS_RLDNSLO_MASK) >> TOD_RLDNS_RLDNSLO_OFFSET;
return h * TOD_RLDNS_HI_STEP + (l * TOD_RLDNS_LO_FREQ_SCALE) /
TOD_RLDNS_LO_FREQ;
}
void tod_reload_get(const uint32_t sec, const uint32_t nsec,
const struct tod_corr *corr, struct tod_reload *rld)
{
uint32_t sec_val, nsec_val = nsec, nsec_l_val, nsec_h_val, nsec_corr;
nsec_corr = onu_round_div((uint32_t)((31 - corr->gtc_ds_delay) *
TOD_GTC_DS_DEL_SCALE),
TOD_GTC_DS_DEL_DIV);
nsec_val += nsec_corr;
sec_val = sec + nsec_val/TOD_NSEC;
nsec_val %= TOD_NSEC;
nsec_h_val = nsec_val / TOD_RLDNS_HI_STEP;
nsec_l_val = nsec_val % TOD_RLDNS_HI_STEP;
nsec_l_val = onu_round_div((uint32_t)(nsec_l_val * TOD_RLDNS_LO_FREQ),
TOD_RLDNS_LO_FREQ_SCALE);
rld->sec = sec_val;
rld->nsec_high = nsec_h_val;
rld->nsec_low = nsec_l_val;
}
uint32_t tod_pps_get(void)
{
return tod_r32(ppssec);
}
void tod_interrupt_enable_set(const uint32_t clear, const uint32_t set)
{
tod_w32_mask(clear, set, irnen);
}
#define SEC_PER_DAY (60 * 60 * 24)
#define SEC_PER_WEEK (SEC_PER_DAY * 7)
static int is_leap(unsigned long year)
{
return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
}
static unsigned long sec_per_year(unsigned long year)
{
return (is_leap(year) ? 366 : 365) * SEC_PER_DAY;
}
static unsigned long to_gps_sec(unsigned long tai_sec)
{
return tai_sec -
sec_per_year(1970) -
sec_per_year(1971) -
sec_per_year(1972) -
sec_per_year(1973) -
sec_per_year(1974) -
sec_per_year(1975) -
sec_per_year(1976) -
sec_per_year(1977) -
sec_per_year(1978) -
sec_per_year(1979) -
SEC_PER_DAY * 5 +
19;
}
void tod_isr_handle(void)
{
char buf[50];
/* TAI: number of seconds since 1 Jan 1970 00:00:00 */
unsigned long tai_sec;
/* GPS: number of seconds since 6 Jan 1980 00:00:00 */
unsigned long gps_sec;
/* Number of GPS weeks */
unsigned long gps_week;
/* Number of seconds since last GPS week */
unsigned long gps_week_sec;
tai_sec = tod_pps_get();
gps_sec = to_gps_sec(tai_sec);
gps_week = gps_sec / SEC_PER_WEEK;
gps_week_sec = gps_sec % SEC_PER_WEEK;
#if defined(LINUX) && defined(__KERNEL__)
snprintf(buf, sizeof(buf), "jiffies_sec = %lu\n", jiffies / HZ);
onu_asc1_puts(buf);
snprintf(buf, sizeof(buf), "jiffies = %lu\n", jiffies);
onu_asc1_puts(buf);
#endif
onu_snprintf(buf, sizeof(buf), "tai_sec = %lu\n", tai_sec);
onu_asc1_puts(buf);
onu_snprintf(buf, sizeof(buf), "gps_sec = %lu\n", gps_sec);
onu_asc1_puts(buf);
onu_snprintf(buf, sizeof(buf), "gps_week = %lu\n", gps_week);
onu_asc1_puts(buf);
onu_snprintf(buf, sizeof(buf), "gps_week_sec = %lu\n", gps_week_sec);
onu_asc1_puts(buf);
}
#if defined(LINUX) && defined(__KERNEL__)
void tod_dump(struct seq_file *s)
{
seq_printf(s, "TOD Init Version 1.0\n");
}
#endif
/*! @} */
/*! @} */

158
src/drv_onu_ll_tod.h Normal file
View File

@ -0,0 +1,158 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_tod_h
#define _drv_onu_tod_h
/** \addtogroup ONU_LL_REFERENCE GPON Low-level Functions
@{
*/
/** \addtogroup ONU_LL_TOD Time Of Dat Low-level Functions
Low-level functions to control the Time Of Day (TOD).
@{
*/
/* ***************************************************************************/
#define TOD_RLDNS_LO_FREQ (31104UL) /* 10kHz*/
#define TOD_RLDNS_LO_FREQ_SCALE (100000UL)
#define TOD_RLDNS_HI_STEP (100000UL) /* ns*/
#define TOD_NSEC (1000000000UL) /* ns*/
#define TOD_USEC (1000000UL) /* us*/
#define TOD_MSEC (1000UL) /* ms*/
#define TOD_GTC_DS_DEL_SCALE (100000UL)
#define TOD_GTC_DS_DEL_DIV (248832UL)
/** Structure for the TOD reload
*/
struct tod_reload {
/** Reload seconds */
uint32_t sec;
/** Reload nseconds High part */
uint16_t nsec_high;
/** Reload nseconds Low part */
uint16_t nsec_low;
};
/** Stricture to specify TOD correction values
*/
struct tod_corr {
/** Variable downstream synchronization delay.
Contains the PSYNC Delay in range from 0 to 31.
This value represents the Delay of the MSB Bit of the PSYNC Word in
the 32 Bit Data In Word. */
uint8_t gtc_ds_delay;
};
/** Initialize TOD (write CFG register)
\param intdel Selects the delay of the delayable interrupt with
respect to the rising edge of the pps signal in
multiples of 100us.
\param pw Selects the pulsewidth of the pps-signal in multiples
of 100us.
*/
void tod_init(const uint16_t intdel, const uint16_t pw);
/** Enable/disable the Free Running mode
\param enable enable/disable Free Running Mode
*/
void tod_frm_enable(const bool enable);
/** Set the Superframe Counter Compare register
\param val counter value
*/
void tod_sfcc_set(const uint32_t val);
/** Get the Superframe Counter Compare register
\return counter value
*/
uint32_t tod_sfcc_get(void);
/** Set Seconds Reload Register
\param val reload value
*/
void tod_rlds_set(const uint32_t val);
/** Get Seconds Reload Register
\return reload value
*/
uint32_t tod_rlds_get(void);
/** Set Nanoseconds Reload Register
\param high high part value, bits 29:16
\param low high part value, bits 14:0
*/
void tod_rldns_set(const uint16_t high, const uint16_t low);
/** Get Nanoseconds Reload Register
\return Nanoseconds Reload Register
*/
uint32_t tod_rldns_get(void);
/** Convert Nanoseconds Reload Register to Nanoseconds
\param rldns RLDNS register value
\return Nanoseconds
*/
uint32_t tod_rldns2nsec(const uint32_t rldns);
/** Get Reload structure
\param sec input seconds
\param nsec input nseconds
\param corr nseconds correction
\param rld pointer to the reload data to fill
*/
void tod_reload_get(const uint32_t sec, const uint32_t nsec,
const struct tod_corr *corr, struct tod_reload *rld);
/** Get the seconds part of the ToD counter
\return seconds part of the ToD counter
*/
uint32_t tod_pps_get(void);
/** Control the IRNEN register
\param clear interupt clear mask
\param set interrupt set mask
*/
void tod_interrupt_enable_set(const uint32_t clear, const uint32_t set);
/** ToD ISR
*/
void tod_isr_handle(void);
#if defined(INCLUDE_DUMP)
/**
Dump the TOD register block.
*/
void tod_dump(struct seq_file *s);
#endif
/*! @} */
/*! @} */
#endif

287
src/drv_onu_ll_tod_asc.c Normal file
View File

@ -0,0 +1,287 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifdef HAVE_CONFIG_H
# include "drv_onu_config.h"
#endif
#if defined(ONU_TOD_ASC1) && defined(LINUX) && defined(__KERNEL__)
#include <linux/io.h>
#include <linux/ioport.h>
#include <asm/mach-lantiq/falcon/lantiq_soc.h>
#include "drv_onu_api.h"
#include "drv_onu_register.h"
#include "drv_onu_ll_sys.h"
#define ONU_ASC1_BASE 0x1E100B00
#define ONU_ASC1_SIZE 0x00000100
#define ONU_PADCTRL1_BASE 0x1E800400
#define ONU_PADCTRL1_SIZE 0x00000100
/* ASC input select (0 or 1) */
#define CONSOLE_TTY 0
#define ASC_TXFIFO_FL 1
#define ASC_RXFIFO_FL 1
/* CLC register's bits and bitfields */
#define ASCCLC_DISS 0x00000002
#define ASCCLC_RMCMASK 0x0000FF00
#define ASCCLC_RMCOFFSET 8
/* CON register's bits and bitfields */
#define ASCCON_M_8ASYNC 0x0
#define ASCCON_FDE 0x00000200
#define ASCCON_R 0x00008000
#define ASCCON_FEN 0x00020000
#define ASCCON_ROEN 0x00080000
#define ASCCON_TOEN 0x00100000
/* STATE register's bits and bitfields */
#define ASCSTATE_TOE 0x00100000
/* WHBSTATE register's bits and bitfields */
#define ASCWHBSTATE_SETREN 0x00000002
#define ASCWHBSTATE_CLRTOE 0x00000040
/* FDV register mask, offset and bitfields*/
#define ASCFDV_VALUE_MASK 0x000001FF
/* TXFCON register's bits and bitfields */
#define ASCTXFCON_TXFEN 0x0001
#define ASCTXFCON_TXFITLMASK 0x3F00
#define ASCTXFCON_TXFITLOFF 8
/* RXFCON register's bits and bitfields */
#define ASCRXFCON_RXFEN 0x0001
#define ASCRXFCON_RXFITLMASK 0x3F00
#define ASCRXFCON_RXFITLOFF 8
/* FSTAT register's bits and bitfields */
#define ASCFSTAT_TXFREEMASK 0x3F000000
#define ASCFSTAT_TXFREEOFF 24
#define asc_readl(reg) reg_r32(&asc->reg)
#define asc_writel(reg, value) reg_w32((value), &asc->reg)
#define SET_BIT(reg, mask) asc_writel(reg, asc_readl(reg) | (mask))
#define CLEAR_BIT(reg, mask) asc_writel(reg, asc_readl(reg) & (~mask))
#define SET_BITFIELD(reg, mask, off, val) asc_writel(reg, (asc_readl(reg) & (~mask)) | (val << off) )
struct onu_reg_asc {
unsigned long asc_clc; /*0x0000*/
unsigned long asc_pisel; /*0x0004*/
unsigned long asc_id; /*0x0008*/
unsigned long asc_rsvd1[1]; /* for mapping */ /*0x000C*/
unsigned long asc_con; /*0x0010*/
unsigned long asc_state; /*0x0014*/
unsigned long asc_whbstate; /*0x0018*/
unsigned long asc_rsvd2[1]; /* for mapping */ /*0x001C*/
unsigned long asc_tbuf; /*0x0020*/
unsigned long asc_rbuf; /*0x0024*/
unsigned long asc_rsvd3[2]; /* for mapping */ /*0x0028*/
unsigned long asc_abcon; /*0x0030*/
unsigned long asc_abstat; /* not used */ /*0x0034*/
unsigned long asc_whbabcon; /*0x0038*/
unsigned long asc_whbabstat; /* not used */ /*0x003C*/
unsigned long asc_rxfcon; /*0x0040*/
unsigned long asc_txfcon; /*0x0044*/
unsigned long asc_fstat; /*0x0048*/
unsigned long asc_rsvd4[1]; /* for mapping */ /*0x004C*/
unsigned long asc_bg; /*0x0050*/
unsigned long asc_bg_timer; /*0x0054*/
unsigned long asc_fdv; /*0x0058*/
unsigned long asc_pmw; /*0x005C*/
unsigned long asc_modcon; /*0x0060*/
unsigned long asc_modstat; /*0x0064*/
unsigned long asc_rsvd5[2]; /* for mapping */ /*0x0068*/
unsigned long asc_sfcc; /*0x0070*/
unsigned long asc_rsvd6[3]; /* for mapping */ /*0x0074*/
unsigned long asc_eomcon; /*0x0080*/
unsigned long asc_rsvd7[26]; /* for mapping */ /*0x0084*/
unsigned long asc_dmacon; /*0x00EC*/
unsigned long asc_rsvd8[1]; /* for mapping */ /*0x00F0*/
unsigned long asc_irnen; /*0x00F4*/
unsigned long asc_irnicr; /*0x00F8*/
unsigned long asc_irncr; /*0x00FC*/
};
static struct onu_reg_asc *asc;
/*
* FDV fASC
* BaudRate = ----- * --------------------
* 512 16 * (ReloadValue+1)
*/
/*
* FDV fASC
* ReloadValue = ( ----- * --------------- ) - 1
* 512 16 * BaudRate
*/
static void serial_divs(u32 baudrate, u32 fasc, u32 *pfdv, u32 *preload)
{
u32 clock = fasc / 16;
u32 fdv; /* best fdv */
u32 reload = 0; /* best reload */
u32 diff; /* smallest diff */
u32 idiff; /* current diff */
u32 ireload; /* current reload */
u32 i; /* current fdv */
u32 result; /* current resulting baudrate */
if (clock > 0x7FFFFF)
clock /= 512;
else
baudrate *= 512;
fdv = 512; /* start with 1:1 fraction */
diff = baudrate; /* highest possible */
/* i is the test fdv value -- start with the largest possible */
for (i = 512; i > 0; i--) {
ireload = (clock * i) / baudrate;
if (ireload < 1)
break; /* already invalid */
result = (clock * i) / ireload;
idiff = (result > baudrate) ? (result - baudrate) :
(baudrate - result);
if (idiff == 0) {
fdv = i;
reload = ireload;
break; /* can't do better */
} else if (idiff < diff) {
fdv = i; /* best so far */
reload = ireload;
diff = idiff; /* update lowest diff*/
}
}
*pfdv = (fdv == 512) ? 0 : fdv;
*preload = reload - 1;
}
static void serial_setbrg(void)
{
static const u32 baudrate = 9600;
static const u32 ebu_speed = 100000000;
u32 ReloadValue, fdv;
serial_divs(baudrate, ebu_speed, &fdv, &ReloadValue);
/* Disable Baud Rate Generator; BG should only be written when R=0 */
CLEAR_BIT(asc_con, ASCCON_R);
/* Enable Fractional Divider */
SET_BIT(asc_con, ASCCON_FDE); /* FDE = 1 */
/* Set fractional divider value */
asc_writel(asc_fdv, fdv & ASCFDV_VALUE_MASK);
/* Set reload value in BG */
asc_writel(asc_bg, ReloadValue);
/* Enable Baud Rate Generator */
SET_BIT(asc_con, ASCCON_R); /* R = 1 */
}
#define MUXC_SIF_RX_PIN (100 + 12)
#define MUXC_SIF_TX_PIN (100 + 13)
int onu_asc1_init(void)
{
sys1_hw_activate_or_reboot(1 << 11);
if (ltq_gpio_request(MUXC_SIF_RX_PIN, 1, 1, 0, "asc1-rx"))
return -1;
if (ltq_gpio_request(MUXC_SIF_TX_PIN, 1, 1, 1, "asc1-tx"))
return -1;
asc = ioremap_nocache(ONU_ASC1_BASE, ONU_ASC1_SIZE);
if (!asc) {
release_mem_region(ONU_PADCTRL1_BASE, ONU_PADCTRL1_SIZE);
return -1;
}
/* and we have to set CLC register*/
CLEAR_BIT(asc_clc, ASCCLC_DISS);
SET_BITFIELD(asc_clc, ASCCLC_RMCMASK, ASCCLC_RMCOFFSET, 0x0001);
/* initialy we are in async mode */
asc_writel(asc_con, ASCCON_M_8ASYNC);
/* select input port */
asc_writel(asc_pisel, CONSOLE_TTY & 0x1);
/* TXFIFO's filling level */
SET_BITFIELD(asc_txfcon, ASCTXFCON_TXFITLMASK,
ASCTXFCON_TXFITLOFF, ASC_TXFIFO_FL);
/* enable TXFIFO */
SET_BIT(asc_txfcon, ASCTXFCON_TXFEN);
/* RXFIFO's filling level */
SET_BITFIELD(asc_txfcon, ASCRXFCON_RXFITLMASK,
ASCRXFCON_RXFITLOFF, ASC_RXFIFO_FL);
/* enable RXFIFO */
SET_BIT(asc_rxfcon, ASCRXFCON_RXFEN);
/* set baud rate */
serial_setbrg();
/* Set FIFO to single byte forward mode */
asc_writel(asc_eomcon, 0x00010300);
/* enable error signals & Receiver enable */
SET_BIT(asc_whbstate,
ASCWHBSTATE_SETREN | ASCCON_FEN | ASCCON_TOEN | ASCCON_ROEN);
return 0;
}
static void onu_asc1_putc(const char c)
{
u32 txFl = 0;
#ifdef __BIG_ENDIAN
u8 * tbuf8 = ((u8 *)(&asc->asc_tbuf)) + 3;
#else
u8 * tbuf8 = ((u8 *)(&asc->asc_tbuf));
#endif
if (c == '\n')
onu_asc1_putc ('\r');
/* check do we have a free space in the TX FIFO */
/* get current free level */
do {
txFl = ( asc_readl(asc_fstat) & ASCFSTAT_TXFREEMASK ) >>
ASCFSTAT_TXFREEOFF;
}
while ( txFl == 0 );
/* write char to Transmit Buffer Register */
__raw_writeb(c, tbuf8);
/* check for errors */
if ( asc_readl(asc_state) & ASCSTATE_TOE ) {
SET_BIT(asc_whbstate, ASCWHBSTATE_CLRTOE);
return;
}
}
void onu_asc1_puts(const char *s)
{
while (*s)
onu_asc1_putc (*s++);
}
#endif

26
src/drv_onu_ll_tod_asc.h Normal file
View File

@ -0,0 +1,26 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#if defined(ONU_TOD_ASC1) && defined(LINUX) && defined(__KERNEL__)
/** Initialize ASC1
\note SLIC functionality should be disabled beforehand!
*/
int onu_asc1_init(void);
/** Print string to ASC1
\param[in] s String to print
*/
void onu_asc1_puts(const char *s);
#else
static inline int onu_asc1_init(void) { return 0; }
static inline void onu_asc1_puts(const char *s) { };
#endif

122
src/drv_onu_notifier.c Normal file
View File

@ -0,0 +1,122 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifdef HAVE_CONFIG_H
#include "drv_onu_config.h"
#endif
#if defined(LINUX) && !defined(ONU_SIMULATION)
#include <linux/module.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/device.h>
#include <linux/sysdev.h>
#include <linux/netdevice.h>
#include <linux/timer.h>
#include <linux/ctype.h>
#include <linux/leds.h>
#include <linux/version.h>
#include <linux/if.h>
#include "drv_onu_notifier.h"
extern u32 onu_gpon_link_status_get(void);
extern u32 onu_gpon_packet_count_get(const u8 rx);
extern u32 onu_mac_link_status_get(const u8 idx);
extern u32 onu_mac_packet_count_get(const u8 idx, const u8 rx);
#define MAX_ONU_NOTIFIER_DEVICE 5
static struct onu_notifier_device onu_nfc_device[MAX_ONU_NOTIFIER_DEVICE] =
{
{"mac0", MAC0_IDX},
{"mac1", MAC1_IDX},
{"mac2", MAC2_IDX},
{"mac3", MAC3_IDX},
{"gpon", GPON_IDX}
};
static struct onu_notifier_device_stats onu_nfc_stats[MAX_ONU_NOTIFIER_DEVICE];
struct onu_notifier_device *onu_get_by_name(const char *name)
{
int i;
if (name == NULL)
return NULL;
for (i=0;i<MAX_ONU_NOTIFIER_DEVICE;i++) {
if (onu_nfc_device[i].name == NULL)
continue;
if (strcmp(name, onu_nfc_device[i].name) == 0) {
return &onu_nfc_device[i];
}
}
return NULL;
}
u32 onu_get_flags(struct onu_notifier_device *dev)
{
switch (dev->idx) {
case MAC0_IDX:
case MAC1_IDX:
case MAC2_IDX:
case MAC3_IDX:
return onu_mac_link_status_get(dev->idx) ? ONU_LOWER_UP : 0;
case GPON_IDX:
return onu_gpon_link_status_get() ? ONU_LOWER_UP : 0;
}
return 0;
}
u32 onu_carrier_ok(struct onu_notifier_device *dev)
{
switch (dev->idx) {
case MAC0_IDX:
case MAC1_IDX:
case MAC2_IDX:
case MAC3_IDX:
return onu_mac_link_status_get(dev->idx) ? ONU_LOWER_UP : 0;
case GPON_IDX:
return onu_gpon_link_status_get();
}
return 0;
}
struct onu_notifier_device_stats *onu_get_stats(struct onu_notifier_device *dev)
{
switch (dev->idx) {
case MAC1_IDX:
case MAC0_IDX:
case MAC2_IDX:
case MAC3_IDX:
onu_nfc_stats[dev->idx].rx_packets = onu_mac_packet_count_get(dev->idx, 1);
onu_nfc_stats[dev->idx].tx_packets = onu_mac_packet_count_get(dev->idx, 0);
return &onu_nfc_stats[dev->idx];
case GPON_IDX:
onu_nfc_stats[dev->idx].rx_packets = onu_gpon_packet_count_get(1);
onu_nfc_stats[dev->idx].tx_packets = onu_gpon_packet_count_get(0);
return &onu_nfc_stats[dev->idx];
}
return NULL;
}
EXPORT_SYMBOL(onu_get_flags);
EXPORT_SYMBOL(onu_carrier_ok);
EXPORT_SYMBOL(onu_get_stats);
EXPORT_SYMBOL(onu_get_by_name);
#endif /* #if defined(LINUX) && !defined(ONU_SIMULATION) */

43
src/drv_onu_notifier.h Normal file
View File

@ -0,0 +1,43 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_notifier_h
#define _drv_onu_notifier_h
struct onu_notifier_device {
char name[IFNAMSIZ];
u8 idx;
};
struct onu_notifier_device_stats {
u32 tx_packets;
u32 rx_packets;
};
struct onu_notifier_device *onu_get_by_name(const char *name);
u32 onu_get_flags(struct onu_notifier_device *);
u32 onu_carrier_ok(struct onu_notifier_device *);
struct onu_notifier_device_stats *onu_get_stats(struct onu_notifier_device *);
#define ONU_LOWER_UP 0x01
#define ONU_DEV_UP 0x01
#define ONU_DEV_DOWN 0x02
#define ONU_DEV_CHANGE 0x04
#define ONU_DEV_REGISTER 0x08
#define ONU_DEV_UNREGISTER 0x10
#define ONU_NOTIFY_DONE 0x00
#define MAC0_IDX 0
#define MAC1_IDX 1
#define MAC2_IDX 2
#define MAC3_IDX 3
#define GPON_IDX 4
#endif

2086
src/drv_onu_ploam.c Normal file

File diff suppressed because it is too large Load Diff

181
src/drv_onu_ploam_api.h Normal file
View File

@ -0,0 +1,181 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_ploam_api_h
#define _drv_onu_ploam_api_h
#include "drv_onu_types.h"
/* exclude some parts from SWIG generation */
#ifndef SWIG
/** \addtogroup ONU_MAPI_REFERENCE_INTERNAL
@{
*/
/** \defgroup PLOAM_API_INTERNAL Physical Layer Messaging Channel (PLOAM)
@{
*/
/**
\todo
- implement PLOAM allocation messages \see 5.5.3
- Additional Alloc-IDs are assigned to the ONU explicitly by means of the
Assign_Alloc-ID PLOAM message with Alloc-ID Type 1. Such an assignment
can be explicitly reversed by means of Assign_Alloc-ID PLOAM message
with Alloc-ID Type 255.
- All Alloc-ID assignments, including the Default Alloc-ID assignment,
shall be lost upon ONU deactivation. - mapping between T-CONT and
allocation ID's \see 5.5.4
- The GEM Port-ID assignment to the OMCC logical connection is performed
by means of Configure_Port-ID PLOAM message. \see 5.5.5
- ONU registration,
- configured serial number method
- discovered serial number method
- PSync, detected by Interrupt or Polling
*/
/** Threshold for Serial_Number_request events */
#define PLOAM_SN_REQUEST_THRESHOLD 10
/** PSync Synchronization */
#define PLOAM_GTC_FRAME_SYNC 0x0001
/** ONU received a ranging request */
#define PLOAM_RANGING_REQUEST 0x0002
/** Timer TO0 expires */
#define PLOAM_TO0_EXPIRED 0x0004
/** Timer TO1 expires */
#define PLOAM_TO1_EXPIRED 0x0008
/** Timer TO2 expires */
#define PLOAM_TO2_EXPIRED 0x0010
/** LOS detected */
#define PLOAM_LOS 0x0020
/** LOF detected */
#define PLOAM_LOF 0x0040
/** ONU received PLOAMd message */
#define PLOAM_MSG_RECEIVED 0x0080
/** The ONU received a Serial Number request
(BW Allocation structure with Alloc-ID = 254 PLOAMu = "1") */
#define PLOAM_SN_REQUEST 0x0100
/** ONU should send ack */
#define PLOAM_ACK_SEND 0x0200
/** ONU should REI message */
#define PLOAM_BER_EXPIRED 0x0400
/**
ONU-ID value, assignable.
Assigned by OLT at ONU activation. Used to identify the sender
of an upstream burst or a PLOAMu and to address PLOAMd.
*/
#define PLOAM_ID_VALUE_ASSIGNABLE 0xFD
/**
ONU-ID value, reserved.
Reserved, should not be assigned, as it conflict with the Alloc-ID usage
*/
#define PLOAM_ID_VALUE_RESERVED 0xFE
/**
ONU-ID value, broadcast.
- broadcast address in downstream messages
- unassigned in upstream messages
*/
#define ONU_ID_VALUE_BROADCAST 0xFF
/** FSM - error */
#define PLOAM_FSM_ERROR (-1)
/** FSM - error */
#define PLOAM_FSM_ERROR_EVENT_NOT_HANDLED 0x0100
/** FSM - state changed */
#define PLOAM_FSM_STATE_CHANGED 0x0001
/** FSM - PLOAM message received */
#define PLOAM_FSM_PLOAM_RECEIVED 0x0002
/*#define ONU_GET_MSG_ID(_msg_) (_msg_->msg_id)*/
/**
Initialize the ONU context.
\param onu_ctrl The control context pointer.
\return
- 0 Initialization successfully
- -1 Error occurred during initialization
*/
int ploam_context_init(void *onu_ctrl);
/**
Free the ONU context.
\param onu_ctrl The control context pointer.
\return
- 0 Operation successfully
- -1 Error occurred
*/
int ploam_context_free(void *onu_ctrl);
/**
PLOAM Finite State Machine
\param ploam_ctx The PLOAM context pointer.
\return
- 0 Success, but no state switch
- PLOAM_FSM_ERROR Error occurred.
\return
Following additional flags maybe set
- PLOAM_FSM_STATE_CHANGED State switch done successfully
- PLOAM_FSM_ERROR_EVENT_NOT_HANDLED Is
*/
int ploam_fsm(struct ploam_context *ploam_ctx);
const char *ploam_msgid2string(uint8_t msg_id);
enum onu_errorcode ploam_ds_extract(struct onu_device *p_dev,
struct ploam_message *param);
enum onu_errorcode ploam_us_insert(struct onu_device *p_dev,
const struct ploam_message *param);
enum onu_errorcode ploam_us_extract(struct onu_device *p_dev,
struct ploam_message *param);
int onu_serial_number_send(struct ploam_context *ploam_ctx,
const uint8_t repeat);
void onu_ploam_log(const uint32_t id, void *data, const uint16_t size);
#endif /* SWIG */
/**
Simulate a downstream PLOAM message. The PLOAM message will be written to the
register bank if the ONU ID is matching (or if it's a broadcast).
*/
enum onu_errorcode ploam_ds_insert(struct onu_device *p_dev,
const struct ploam_message *param);
enum onu_errorcode ploam_init(struct onu_device *p_dev);
enum onu_errorcode ploam_state_get(struct onu_device *p_dev,
struct ploam_state_data_get *param);
enum onu_errorcode ploam_state_set(struct onu_device *p_dev,
const struct ploam_state_data_set *param);
/*! @} */
/*! @} */
/*! @} */
/*! @} */
#endif

233
src/drv_onu_reg_base.h Normal file
View File

@ -0,0 +1,233 @@
/******************************************************************************
Copyright (c) 2011
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_reg_base_h
#define _drv_onu_reg_base_h
/** \addtogroup ONU_BASE
@{
*/
#ifndef KSEG1
#define KSEG1 0xA0000000
#endif
/** address range for gpearb
0x1D400100--0x1D4001FF */
#define ONU_GPEARB_BASE (KSEG1 | 0x1D400100)
#define ONU_GPEARB_END (KSEG1 | 0x1D4001FF)
#define ONU_GPEARB_SIZE 0x00000100
/** address range for tmu
0x1D404000--0x1D404FFF */
#define ONU_TMU_BASE (KSEG1 | 0x1D404000)
#define ONU_TMU_END (KSEG1 | 0x1D404FFF)
#define ONU_TMU_SIZE 0x00001000
/** address range for iqm
0x1D410000--0x1D41FFFF */
#define ONU_IQM_BASE (KSEG1 | 0x1D410000)
#define ONU_IQM_END (KSEG1 | 0x1D41FFFF)
#define ONU_IQM_SIZE 0x00010000
/** address range for octrlg
0x1D420000--0x1D42FFFF */
#define ONU_OCTRLG_BASE (KSEG1 | 0x1D420000)
#define ONU_OCTRLG_END (KSEG1 | 0x1D42FFFF)
#define ONU_OCTRLG_SIZE 0x00010000
/** address range for octrll0
0x1D440000--0x1D4400FF */
#define ONU_OCTRLL0_BASE (KSEG1 | 0x1D440000)
#define ONU_OCTRLL0_END (KSEG1 | 0x1D4400FF)
#define ONU_OCTRLL0_SIZE 0x00000100
/** address range for octrll1
0x1D440100--0x1D4401FF */
#define ONU_OCTRLL1_BASE (KSEG1 | 0x1D440100)
#define ONU_OCTRLL1_END (KSEG1 | 0x1D4401FF)
#define ONU_OCTRLL1_SIZE 0x00000100
/** address range for octrll2
0x1D440200--0x1D4402FF */
#define ONU_OCTRLL2_BASE (KSEG1 | 0x1D440200)
#define ONU_OCTRLL2_END (KSEG1 | 0x1D4402FF)
#define ONU_OCTRLL2_SIZE 0x00000100
/** address range for octrll3
0x1D440300--0x1D4403FF */
#define ONU_OCTRLL3_BASE (KSEG1 | 0x1D440300)
#define ONU_OCTRLL3_END (KSEG1 | 0x1D4403FF)
#define ONU_OCTRLL3_SIZE 0x00000100
/** address range for octrlc
0x1D441000--0x1D4410FF */
#define ONU_OCTRLC_BASE (KSEG1 | 0x1D441000)
#define ONU_OCTRLC_END (KSEG1 | 0x1D4410FF)
#define ONU_OCTRLC_SIZE 0x00000100
/** address range for ictrlg
0x1D450000--0x1D45FFFF */
#define ONU_ICTRLG_BASE (KSEG1 | 0x1D450000)
#define ONU_ICTRLG_END (KSEG1 | 0x1D45FFFF)
#define ONU_ICTRLG_SIZE 0x00010000
/** address range for ictrll0
0x1D460000--0x1D4601FF */
#define ONU_ICTRLL0_BASE (KSEG1 | 0x1D460000)
#define ONU_ICTRLL0_END (KSEG1 | 0x1D4601FF)
#define ONU_ICTRLL0_SIZE 0x00000200
/** address range for ictrll1
0x1D460200--0x1D4603FF */
#define ONU_ICTRLL1_BASE (KSEG1 | 0x1D460200)
#define ONU_ICTRLL1_END (KSEG1 | 0x1D4603FF)
#define ONU_ICTRLL1_SIZE 0x00000200
/** address range for ictrll2
0x1D460400--0x1D4605FF */
#define ONU_ICTRLL2_BASE (KSEG1 | 0x1D460400)
#define ONU_ICTRLL2_END (KSEG1 | 0x1D4605FF)
#define ONU_ICTRLL2_SIZE 0x00000200
/** address range for ictrll3
0x1D460600--0x1D4607FF */
#define ONU_ICTRLL3_BASE (KSEG1 | 0x1D460600)
#define ONU_ICTRLL3_END (KSEG1 | 0x1D4607FF)
#define ONU_ICTRLL3_SIZE 0x00000200
/** address range for ictrlc0
0x1D461000--0x1D4610FF */
#define ONU_ICTRLC0_BASE (KSEG1 | 0x1D461000)
#define ONU_ICTRLC0_END (KSEG1 | 0x1D4610FF)
#define ONU_ICTRLC0_SIZE 0x00000100
/** address range for ictrlc1
0x1D461100--0x1D4611FF */
#define ONU_ICTRLC1_BASE (KSEG1 | 0x1D461100)
#define ONU_ICTRLC1_END (KSEG1 | 0x1D4611FF)
#define ONU_ICTRLC1_SIZE 0x00000100
/** address range for fsqm
0x1D500000--0x1D5FFFFF */
#define ONU_FSQM_BASE (KSEG1 | 0x1D500000)
#define ONU_FSQM_END (KSEG1 | 0x1D5FFFFF)
#define ONU_FSQM_SIZE 0x00100000
/** address range for pctrl
0x1D600000--0x1D6001FF */
#define ONU_PCTRL_BASE (KSEG1 | 0x1D600000)
#define ONU_PCTRL_END (KSEG1 | 0x1D6001FF)
#define ONU_PCTRL_SIZE 0x00000200
/** address range for link0
0x1D600200--0x1D6002FF */
#define ONU_LINK0_BASE (KSEG1 | 0x1D600200)
#define ONU_LINK0_END (KSEG1 | 0x1D6002FF)
#define ONU_LINK0_SIZE 0x00000100
/** address range for link1
0x1D600300--0x1D6003FF */
#define ONU_LINK1_BASE (KSEG1 | 0x1D600300)
#define ONU_LINK1_END (KSEG1 | 0x1D6003FF)
#define ONU_LINK1_SIZE 0x00000100
/** address range for link2
0x1D600400--0x1D6004FF */
#define ONU_LINK2_BASE (KSEG1 | 0x1D600400)
#define ONU_LINK2_END (KSEG1 | 0x1D6004FF)
#define ONU_LINK2_SIZE 0x00000100
/** address range for disp
0x1D600500--0x1D6005FF */
#define ONU_DISP_BASE (KSEG1 | 0x1D600500)
#define ONU_DISP_END (KSEG1 | 0x1D6005FF)
#define ONU_DISP_SIZE 0x00000100
/** address range for merge
0x1D600600--0x1D6006FF */
#define ONU_MERGE_BASE (KSEG1 | 0x1D600600)
#define ONU_MERGE_END (KSEG1 | 0x1D6006FF)
#define ONU_MERGE_SIZE 0x00000100
/** address range for tbm
0x1D600700--0x1D6007FF */
#define ONU_TBM_BASE (KSEG1 | 0x1D600700)
#define ONU_TBM_END (KSEG1 | 0x1D6007FF)
#define ONU_TBM_SIZE 0x00000100
/** address range for pe0
0x1D610000--0x1D61FFFF */
#define ONU_PE0_BASE (KSEG1 | 0x1D610000)
#define ONU_PE0_END (KSEG1 | 0x1D61FFFF)
#define ONU_PE0_SIZE 0x00010000
/** address range for pe1
0x1D620000--0x1D62FFFF */
#define ONU_PE1_BASE (KSEG1 | 0x1D620000)
#define ONU_PE1_END (KSEG1 | 0x1D62FFFF)
#define ONU_PE1_SIZE 0x00010000
/** address range for pe2
0x1D630000--0x1D63FFFF */
#define ONU_PE2_BASE (KSEG1 | 0x1D630000)
#define ONU_PE2_END (KSEG1 | 0x1D63FFFF)
#define ONU_PE2_SIZE 0x00010000
/** address range for pe3
0x1D640000--0x1D64FFFF */
#define ONU_PE3_BASE (KSEG1 | 0x1D640000)
#define ONU_PE3_END (KSEG1 | 0x1D64FFFF)
#define ONU_PE3_SIZE 0x00010000
/** address range for pe4
0x1D650000--0x1D65FFFF */
#define ONU_PE4_BASE (KSEG1 | 0x1D650000)
#define ONU_PE4_END (KSEG1 | 0x1D65FFFF)
#define ONU_PE4_SIZE 0x00010000
/** address range for pe5
0x1D660000--0x1D66FFFF */
#define ONU_PE5_BASE (KSEG1 | 0x1D660000)
#define ONU_PE5_END (KSEG1 | 0x1D66FFFF)
#define ONU_PE5_SIZE 0x00010000
/** address range for sys_gpe
0x1D700000--0x1D7000FF */
#define ONU_SYS_GPE_BASE (KSEG1 | 0x1D700000)
#define ONU_SYS_GPE_END (KSEG1 | 0x1D7000FF)
#define ONU_SYS_GPE_SIZE 0x00000100
/** address range for eim
0x1D800000--0x1D800FFF */
#define ONU_EIM_BASE (KSEG1 | 0x1D800000)
#define ONU_EIM_END (KSEG1 | 0x1D800FFF)
#define ONU_EIM_SIZE 0x00001000
/** address range for sxgmii
0x1D808800--0x1D8088FF */
#define ONU_SXGMII_BASE (KSEG1 | 0x1D808800)
#define ONU_SXGMII_END (KSEG1 | 0x1D8088FF)
#define ONU_SXGMII_SIZE 0x00000100
/** address range for sgmii
0x1D808C00--0x1D808CFF */
#define ONU_SGMII_BASE (KSEG1 | 0x1D808C00)
#define ONU_SGMII_END (KSEG1 | 0x1D808CFF)
#define ONU_SGMII_SIZE 0x00000100
/** address range for sys_eth
0x1DB00000--0x1DB000FF */
#define ONU_SYS_ETH_BASE (KSEG1 | 0x1DB00000)
#define ONU_SYS_ETH_END (KSEG1 | 0x1DB000FF)
#define ONU_SYS_ETH_SIZE 0x00000100
/** address range for gtc
0x1DC05000--0x1DC052D4 */
#define ONU_GTC_BASE (KSEG1 | 0x1DC00000)
#define ONU_GTC_END (KSEG1 | 0x1DC002D4)
#define ONU_GTC_SIZE 0x000002D5
/** address range for tod
0x1DEFFE00--0x1DEFFEFC */
#define ONU_TOD_BASE (KSEG1 | 0x1DEFFE00)
#define ONU_TOD_END (KSEG1 | 0x1DEFFEFF)
#define ONU_TOD_SIZE 0x00000100
/** address range for sbs0ctrl
0x1F080000--0x1F0801FF */
#define ONU_SBS0CTRL_BASE (KSEG1 | 0x1F080000)
#define ONU_SBS0CTRL_END (KSEG1 | 0x1F0801FF)
#define ONU_SBS0CTRL_SIZE 0x00000200
/** address range for sbs0ram
0x1F200000--0x1F32FFFF */
#define ONU_SBS0RAM_BASE (KSEG1 | 0x1F200000)
#define ONU_SBS0RAM_END (KSEG1 | 0x1F32FFFF)
#define ONU_SBS0RAM_SIZE 0x00130000
/** address range for status
0x1E802000--0x1E80207F */
#define ONU_STATUS_BASE (KSEG1 | 0x1E802000)
#define ONU_STATUS_END (KSEG1 | 0x1E80207F)
#define ONU_STATUS_SIZE 0x00000080
/** address range for sys1
0x1EF00000--0x1EF000FF */
#define ONU_SYS1_BASE (KSEG1 | 0x1EF00000)
#define ONU_SYS1_END (KSEG1 | 0x1EF000FF)
#define ONU_SYS1_SIZE 0x00000100
/*! @} */ /* ONU_BASE */
#endif /* _drv_onu_reg_base_h */

View File

@ -0,0 +1,644 @@
/******************************************************************************
Copyright (c) 2012
Lantiq Deutschland GmbH
For licensing information, see the file 'LICENSE' in the root folder of
this software module.
******************************************************************************/
#ifndef _drv_onu_reg_coplink_cop_h
#define _drv_onu_reg_coplink_cop_h
/** \addtogroup COP_REGISTER
@{
*/
#define COPLINK_COP_TABLE10 (COPLINK_COP_BASE + 0x04)
#define COPLINK_COP_TABLE11 (COPLINK_COP_BASE + 0x05)
#define COPLINK_COP_TABLE12 (COPLINK_COP_BASE + 0x06)
#define COPLINK_COP_TABLE20 (COPLINK_COP_BASE + 0x08)
#define COPLINK_COP_TABLE21 (COPLINK_COP_BASE + 0x09)
#define COPLINK_COP_TABLE22 (COPLINK_COP_BASE + 0x0A)
#define COPLINK_COP_TABLE30 (COPLINK_COP_BASE + 0x0C)
#define COPLINK_COP_TABLE31 (COPLINK_COP_BASE + 0x0D)
#define COPLINK_COP_TABLE32 (COPLINK_COP_BASE + 0x0E)
#define COPLINK_COP_TABLE40 (COPLINK_COP_BASE + 0x10)
#define COPLINK_COP_TABLE41 (COPLINK_COP_BASE + 0x11)
#define COPLINK_COP_TABLE42 (COPLINK_COP_BASE + 0x12)
#define COPLINK_COP_TABLE50 (COPLINK_COP_BASE + 0x14)
#define COPLINK_COP_TABLE51 (COPLINK_COP_BASE + 0x15)
#define COPLINK_COP_TABLE52 (COPLINK_COP_BASE + 0x16)
#define COPLINK_COP_TABLE60 (COPLINK_COP_BASE + 0x18)
#define COPLINK_COP_TABLE61 (COPLINK_COP_BASE + 0x19)
#define COPLINK_COP_TABLE62 (COPLINK_COP_BASE + 0x1A)
#define COPLINK_COP_TABLE70 (COPLINK_COP_BASE + 0x1C)
#define COPLINK_COP_TABLE71 (COPLINK_COP_BASE + 0x1D)
#define COPLINK_COP_TABLE72 (COPLINK_COP_BASE + 0x1E)
#define COPLINK_COP_GLOBAL0 (COPLINK_COP_BASE + 0x100)
#define COPLINK_COP_GLOBAL1 (COPLINK_COP_BASE + 0x101)
#define COPLINK_COP_GLOBAL2 (COPLINK_COP_BASE + 0x102)
#define COPLINK_COP_GLOBAL3 (COPLINK_COP_BASE + 0x103)
#define COPLINK_COP_GLOBAL4 (COPLINK_COP_BASE + 0x104)
#define COPLINK_COP_GLOBAL5 (COPLINK_COP_BASE + 0x105)
#define COPLINK_COP_CRAM (COPLINK_COP_BASE + 0x200)
#define COPLINK_COP_CUSTOM0 (COPLINK_COP_BASE + 0x300)
#define COPLINK_COP_CUSTOM1 (COPLINK_COP_BASE + 0x301)
#define COPLINK_COP_CUSTOM2 (COPLINK_COP_BASE + 0x302)
#define COPLINK_COP_CUSTOM3 (COPLINK_COP_BASE + 0x303)
#define COPLINK_COP_CUSTOM4 (COPLINK_COP_BASE + 0x304)
#define COPLINK_COP_CUSTOM5 (COPLINK_COP_BASE + 0x305)
#define COPLINK_COP_CUSTOM6 (COPLINK_COP_BASE + 0x306)
#define COPLINK_COP_CUSTOM7 (COPLINK_COP_BASE + 0x307)
/* Fields of "Table 1 config register 0" */
/** Table data mask
Specifies the table data mask : each bit masks 16bit in one 256 entry */
#define COP_TABLE10_DATA_MASK_MASK 0xFFFF0000
/** field offset */
#define COP_TABLE10_DATA_MASK_OFFSET 16
/** Table key size
Specifies the table key size : 0:0, 1:16, 2:32, 3:64, 4:96, 5:128, 6:144, 7:160 bits */
#define COP_TABLE10_KEY_SIZE_MASK 0x00000700
/** field offset */
#define COP_TABLE10_KEY_SIZE_OFFSET 8
/** Table entry size
Specifies the table entry size : 0:32, 1:64, 2:128, 3:256 */
#define COP_TABLE10_ENTRY_SIZE_MASK 0x000000C0
/** field offset */
#define COP_TABLE10_ENTRY_SIZE_OFFSET 6
/** Table function
Specifies the table function : 0: GENERIC, 1: CUSTOM (don't care for array and hash), 2: TERNARY */
#define COP_TABLE10_FUNCTION_MASK 0x00000038
/** field offset */
#define COP_TABLE10_FUNCTION_OFFSET 3
/** Table type
Specifies the table type : 0:ARRAY, 1:VARRAY, 2:LIST, 3:LLIST, 4:HASH (, 5:TREE) */
#define COP_TABLE10_TYPE_MASK 0x00000007
/** field offset */
#define COP_TABLE10_TYPE_OFFSET 0
/* Fields of "Table 1 config register 1" */
/** Table size
Specifies the table size in number of entries */
#define COP_TABLE11_SIZE_MASK 0xFFFF0000
/** field offset */
#define COP_TABLE11_SIZE_OFFSET 16
/** Table base address
Specifies the table base address (granularity 32bit words) */
#define COP_TABLE11_BASE_MASK 0x0000FFFF
/** field offset */
#define COP_TABLE11_BASE_OFFSET 0
/* Fields of "Table 1 config register 2" */
/** Address Valid
Defines whether aux address is valid or not. */
#define COP_TABLE12_AUX_V 0x80000000
/** Table entry counter
Counts up if an entry created with CMD_ADD, counts down if an entry is removed with CMD_REMOVE */
#define COP_TABLE12_ENTRY_COUNTER_MASK 0x03FF0000
/** field offset */
#define COP_TABLE12_ENTRY_COUNTER_OFFSET 16
/** Table aux pointer
LinkList only : Pointer to next element of free list */
#define COP_TABLE12_AUX_MASK 0x0000FFFF
/** field offset */
#define COP_TABLE12_AUX_OFFSET 0
/* Fields of "Table 2 config register 0" */
/** Table data mask
Specifies the table data mask : each bit masks 16bit in one 256 entry */
#define COP_TABLE20_DATA_MASK_MASK 0xFFFF0000
/** field offset */
#define COP_TABLE20_DATA_MASK_OFFSET 16
/** Table key size
Specifies the table key size : 0:0, 1:16, 2:32, 3:64, 4:96, 5:128, 6:144, 7:160 bits */
#define COP_TABLE20_KEY_SIZE_MASK 0x00000700
/** field offset */
#define COP_TABLE20_KEY_SIZE_OFFSET 8
/** Table entry size
Specifies the table entry size : 0:32, 1:64, 2:128, 3:256 */
#define COP_TABLE20_ENTRY_SIZE_MASK 0x000000C0
/** field offset */
#define COP_TABLE20_ENTRY_SIZE_OFFSET 6
/** Table function
Specifies the table function : 0: GENERIC, 1: CUSTOM (don't care for array and hash), 2: TERNARY */
#define COP_TABLE20_FUNCTION_MASK 0x00000038
/** field offset */
#define COP_TABLE20_FUNCTION_OFFSET 3
/** Table type
Specifies the table type : 0:ARRAY, 1:VARRAY, 2:LIST, 3:LLIST, 4:HASH (, 5:TREE) */
#define COP_TABLE20_TYPE_MASK 0x00000007
/** field offset */
#define COP_TABLE20_TYPE_OFFSET 0
/* Fields of "Table 2 config register 1" */
/** Table size
Specifies the table size in number of entries */
#define COP_TABLE21_SIZE_MASK 0xFFFF0000
/** field offset */
#define COP_TABLE21_SIZE_OFFSET 16
/** Table base address
Specifies the table base address (granularity 32bit words) */
#define COP_TABLE21_BASE_MASK 0x0000FFFF
/** field offset */
#define COP_TABLE21_BASE_OFFSET 0
/* Fields of "Table 2 config register 2" */
/** Address Valid
Defines whether aux address is valid or not. */
#define COP_TABLE22_AUX_V 0x80000000
/** Table entry counter
Counts up if an entry created with CMD_ADD, counts down if an entry is removed with CMD_REMOVE */
#define COP_TABLE22_ENTRY_COUNTER_MASK 0x03FF0000
/** field offset */
#define COP_TABLE22_ENTRY_COUNTER_OFFSET 16
/** Table aux pointer
LinkList only : Pointer to next element of free list */
#define COP_TABLE22_AUX_MASK 0x0000FFFF
/** field offset */
#define COP_TABLE22_AUX_OFFSET 0
/* Fields of "Table 3 config register 0" */
/** Table data mask
Specifies the table data mask : each bit masks 16bit in one 256 entry */
#define COP_TABLE30_DATA_MASK_MASK 0xFFFF0000
/** field offset */
#define COP_TABLE30_DATA_MASK_OFFSET 16
/** Table key size
Specifies the table key size : 0:0, 1:16, 2:32, 3:64, 4:96, 5:128, 6:144, 7:160 bits */
#define COP_TABLE30_KEY_SIZE_MASK 0x00000700
/** field offset */
#define COP_TABLE30_KEY_SIZE_OFFSET 8
/** Table entry size
Specifies the table entry size : 0:32, 1:64, 2:128, 3:256 */
#define COP_TABLE30_ENTRY_SIZE_MASK 0x000000C0
/** field offset */
#define COP_TABLE30_ENTRY_SIZE_OFFSET 6
/** Table function
Specifies the table function : 0: GENERIC, 1: CUSTOM (don't care for array and hash), 2: TERNARY */
#define COP_TABLE30_FUNCTION_MASK 0x00000038
/** field offset */
#define COP_TABLE30_FUNCTION_OFFSET 3
/** Table type
Specifies the table type : 0:ARRAY, 1:VARRAY, 2:LIST, 3:LLIST, 4:HASH (, 5:TREE) */
#define COP_TABLE30_TYPE_MASK 0x00000007
/** field offset */
#define COP_TABLE30_TYPE_OFFSET 0
/* Fields of "Table 3 config register 1" */
/** Table size
Specifies the table size in number of entries */
#define COP_TABLE31_SIZE_MASK 0xFFFF0000
/** field offset */
#define COP_TABLE31_SIZE_OFFSET 16
/** Table base address
Specifies the table base address (granularity 32bit words) */
#define COP_TABLE31_BASE_MASK 0x0000FFFF
/** field offset */
#define COP_TABLE31_BASE_OFFSET 0
/* Fields of "Table 3 config register 2" */
/** Address Valid
Defines whether aux address is valid or not. */
#define COP_TABLE32_AUX_V 0x80000000
/** Table entry counter
Counts up if an entry created with CMD_ADD, counts down if an entry is removed with CMD_REMOVE */
#define COP_TABLE32_ENTRY_COUNTER_MASK 0x03FF0000
/** field offset */
#define COP_TABLE32_ENTRY_COUNTER_OFFSET 16
/** Table aux pointer
LinkList only : Pointer to next element of free list */
#define COP_TABLE32_AUX_MASK 0x0000FFFF
/** field offset */
#define COP_TABLE32_AUX_OFFSET 0
/* Fields of "Table 4 config register 0" */
/** Table data mask
Specifies the table data mask : each bit masks 16bit in one 256 entry */
#define COP_TABLE40_DATA_MASK_MASK 0xFFFF0000
/** field offset */
#define COP_TABLE40_DATA_MASK_OFFSET 16
/** Table key size
Specifies the table key size : 0:0, 1:16, 2:32, 3:64, 4:96, 5:128, 6:144, 7:160 bits */
#define COP_TABLE40_KEY_SIZE_MASK 0x00000700
/** field offset */
#define COP_TABLE40_KEY_SIZE_OFFSET 8
/** Table entry size
Specifies the table entry size : 0:32, 1:64, 2:128, 3:256 */
#define COP_TABLE40_ENTRY_SIZE_MASK 0x000000C0
/** field offset */
#define COP_TABLE40_ENTRY_SIZE_OFFSET 6
/** Table function
Specifies the table function : 0: GENERIC, 1: CUSTOM (don't care for array and hash), 2: TERNARY */
#define COP_TABLE40_FUNCTION_MASK 0x00000038
/** field offset */
#define COP_TABLE40_FUNCTION_OFFSET 3
/** Table type
Specifies the table type : 0:ARRAY, 1:VARRAY, 2:LIST, 3:LLIST, 4:HASH (, 5:TREE) */
#define COP_TABLE40_TYPE_MASK 0x00000007
/** field offset */
#define COP_TABLE40_TYPE_OFFSET 0
/* Fields of "Table 4 config register 1" */
/** Table size
Specifies the table size in number of entries */
#define COP_TABLE41_SIZE_MASK 0xFFFF0000
/** field offset */
#define COP_TABLE41_SIZE_OFFSET 16
/** Table base address
Specifies the table base address (granularity 32bit words) */
#define COP_TABLE41_BASE_MASK 0x0000FFFF
/** field offset */
#define COP_TABLE41_BASE_OFFSET 0
/* Fields of "Table 4 config register 2" */
/** Address Valid
Defines whether aux address is valid or not. */
#define COP_TABLE42_AUX_V 0x80000000
/** Table entry counter
Counts up if an entry created with CMD_ADD, counts down if an entry is removed with CMD_REMOVE */
#define COP_TABLE42_ENTRY_COUNTER_MASK 0x03FF0000
/** field offset */
#define COP_TABLE42_ENTRY_COUNTER_OFFSET 16
/** Table aux pointer
LinkList only : Pointer to next element of free list */
#define COP_TABLE42_AUX_MASK 0x0000FFFF
/** field offset */
#define COP_TABLE42_AUX_OFFSET 0
/* Fields of "Table 5 config register 0" */
/** Table data mask
Specifies the table data mask : each bit masks 16bit in one 256 entry */
#define COP_TABLE50_DATA_MASK_MASK 0xFFFF0000
/** field offset */
#define COP_TABLE50_DATA_MASK_OFFSET 16
/** Table key size
Specifies the table key size : 0:0, 1:16, 2:32, 3:64, 4:96, 5:128, 6:144, 7:160 bits */
#define COP_TABLE50_KEY_SIZE_MASK 0x00000700
/** field offset */
#define COP_TABLE50_KEY_SIZE_OFFSET 8
/** Table entry size
Specifies the table entry size : 0:32, 1:64, 2:128, 3:256 */
#define COP_TABLE50_ENTRY_SIZE_MASK 0x000000C0
/** field offset */
#define COP_TABLE50_ENTRY_SIZE_OFFSET 6
/** Table function
Specifies the table function : 0: GENERIC, 1: CUSTOM (don't care for array and hash), 2: TERNARY */
#define COP_TABLE50_FUNCTION_MASK 0x00000038
/** field offset */
#define COP_TABLE50_FUNCTION_OFFSET 3
/** Table type
Specifies the table type : 0:ARRAY, 1:VARRAY, 2:LIST, 3:LLIST, 4:HASH (, 5:TREE) */
#define COP_TABLE50_TYPE_MASK 0x00000007
/** field offset */
#define COP_TABLE50_TYPE_OFFSET 0
/* Fields of "Table 5 config register 1" */
/** Table size
Specifies the table size in number of entries */
#define COP_TABLE51_SIZE_MASK 0xFFFF0000
/** field offset */
#define COP_TABLE51_SIZE_OFFSET 16
/** Table base address
Specifies the table base address (granularity 32bit words) */
#define COP_TABLE51_BASE_MASK 0x0000FFFF
/** field offset */
#define COP_TABLE51_BASE_OFFSET 0
/* Fields of "Table 5 config register 2" */
/** Address Valid
Defines whether aux address is valid or not. */
#define COP_TABLE52_AUX_V 0x80000000
/** Table entry counter
Counts up if an entry created with CMD_ADD, counts down if an entry is removed with CMD_REMOVE */
#define COP_TABLE52_ENTRY_COUNTER_MASK 0x03FF0000
/** field offset */
#define COP_TABLE52_ENTRY_COUNTER_OFFSET 16
/** Table aux pointer
LinkList only : Pointer to next element of free list */
#define COP_TABLE52_AUX_MASK 0x0000FFFF
/** field offset */
#define COP_TABLE52_AUX_OFFSET 0
/* Fields of "Table 6 config register 0" */
/** Table data mask
Specifies the table data mask : each bit masks 16bit in one 256 entry */
#define COP_TABLE60_DATA_MASK_MASK 0xFFFF0000
/** field offset */
#define COP_TABLE60_DATA_MASK_OFFSET 16
/** Table key size
Specifies the table key size : 0:0, 1:16, 2:32, 3:64, 4:96, 5:128, 6:144, 7:160 bits */
#define COP_TABLE60_KEY_SIZE_MASK 0x00000700
/** field offset */
#define COP_TABLE60_KEY_SIZE_OFFSET 8
/** Table entry size
Specifies the table entry size : 0:32, 1:64, 2:128, 3:256 */
#define COP_TABLE60_ENTRY_SIZE_MASK 0x000000C0
/** field offset */
#define COP_TABLE60_ENTRY_SIZE_OFFSET 6
/** Table function
Specifies the table function : 0: GENERIC, 1: CUSTOM (don't care for array and hash), 2: TERNARY */
#define COP_TABLE60_FUNCTION_MASK 0x00000038
/** field offset */
#define COP_TABLE60_FUNCTION_OFFSET 3
/** Table type
Specifies the table type : 0:ARRAY, 1:VARRAY, 2:LIST, 3:LLIST, 4:HASH (, 5:TREE) */
#define COP_TABLE60_TYPE_MASK 0x00000007
/** field offset */
#define COP_TABLE60_TYPE_OFFSET 0
/* Fields of "Table 6 config register 1" */
/** Table size
Specifies the table size in number of entries */
#define COP_TABLE61_SIZE_MASK 0xFFFF0000
/** field offset */
#define COP_TABLE61_SIZE_OFFSET 16
/** Table base address
Specifies the table base address (granularity 32bit words) */
#define COP_TABLE61_BASE_MASK 0x0000FFFF
/** field offset */
#define COP_TABLE61_BASE_OFFSET 0
/* Fields of "Table 6 config register 2" */
/** Address Valid
Defines whether aux address is valid or not. */
#define COP_TABLE62_AUX_V 0x80000000
/** Table entry counter
Counts up if an entry created with CMD_ADD, counts down if an entry is removed with CMD_REMOVE */
#define COP_TABLE62_ENTRY_COUNTER_MASK 0x03FF0000
/** field offset */
#define COP_TABLE62_ENTRY_COUNTER_OFFSET 16
/** Table aux pointer
LinkList only : Pointer to next element of free list */
#define COP_TABLE62_AUX_MASK 0x0000FFFF
/** field offset */
#define COP_TABLE62_AUX_OFFSET 0
/* Fields of "Table 7 config register 0" */
/** Table data mask
Specifies the table data mask : each bit masks 16bit in one 256 entry */
#define COP_TABLE70_DATA_MASK_MASK 0xFFFF0000
/** field offset */
#define COP_TABLE70_DATA_MASK_OFFSET 16
/** Table key size
Specifies the table key size : 0:0, 1:16, 2:32, 3:64, 4:96, 5:128, 6:144, 7:160 bits */
#define COP_TABLE70_KEY_SIZE_MASK 0x00000700
/** field offset */
#define COP_TABLE70_KEY_SIZE_OFFSET 8
/** Table entry size
Specifies the table entry size : 0:32, 1:64, 2:128, 3:256 */
#define COP_TABLE70_ENTRY_SIZE_MASK 0x000000C0
/** field offset */
#define COP_TABLE70_ENTRY_SIZE_OFFSET 6
/** Table function
Specifies the table function : 0: GENERIC, 1: CUSTOM (don't care for array and hash), 2: TERNARY */
#define COP_TABLE70_FUNCTION_MASK 0x00000038
/** field offset */
#define COP_TABLE70_FUNCTION_OFFSET 3
/** Table type
Specifies the table type : 0:ARRAY, 1:VARRAY, 2:LIST, 3:LLIST, 4:HASH (, 5:TREE) */
#define COP_TABLE70_TYPE_MASK 0x00000007
/** field offset */
#define COP_TABLE70_TYPE_OFFSET 0
/* Fields of "Table 7 config register 1" */
/** Table size
Specifies the table size in number of entries */
#define COP_TABLE71_SIZE_MASK 0xFFFF0000
/** field offset */
#define COP_TABLE71_SIZE_OFFSET 16
/** Table base address
Specifies the table base address (granularity 32bit words) */
#define COP_TABLE71_BASE_MASK 0x0000FFFF
/** field offset */
#define COP_TABLE71_BASE_OFFSET 0
/* Fields of "Table 7 config register 2" */
/** Address Valid
Defines whether aux address is valid or not. */
#define COP_TABLE72_AUX_V 0x80000000
/** Table entry counter
Counts up if an entry created with CMD_ADD, counts down if an entry is removed with CMD_REMOVE */
#define COP_TABLE72_ENTRY_COUNTER_MASK 0x03FF0000
/** field offset */
#define COP_TABLE72_ENTRY_COUNTER_OFFSET 16
/** Table aux pointer
LinkList only : Pointer to next element of free list */
#define COP_TABLE72_AUX_MASK 0x0000FFFF
/** field offset */
#define COP_TABLE72_AUX_OFFSET 0
/* Fields of "Global config register 0" */
/** Match function support
Specifies what kind of match functions are supported by this cop */
#define COP_GLOBAL0_FUNCTION_MASK 0x00070000
/** field offset */
#define COP_GLOBAL0_FUNCTION_OFFSET 16
/** Ternary match */
#define COP_GLOBAL0_FUNCTION_Bit2 0x00010000
/** Custom match */
#define COP_GLOBAL0_FUNCTION_Bit1 0x00010000
/** Generic match */
#define COP_GLOBAL0_FUNCTION_Bit0 0x00010000
/** Types supported
Specifies what kind of table type are supported by this cop */
#define COP_GLOBAL0_TYPE_MASK 0x0000FFFF
/** field offset */
#define COP_GLOBAL0_TYPE_OFFSET 0
/** HASH */
#define COP_GLOBAL0_TYPE_Bit4 0x00000001
/** LINKLIST */
#define COP_GLOBAL0_TYPE_Bit3 0x00000001
/** LIST */
#define COP_GLOBAL0_TYPE_Bit2 0x00000001
/** VARRAY */
#define COP_GLOBAL0_TYPE_Bit1 0x00000001
/** ARRAY */
#define COP_GLOBAL0_TYPE_Bit0 0x00000001
/* Fields of "Global config register 2" */
/** COP Version
Specifies the cop version number */
#define COP_GLOBAL1_VERSION_MASK 0xF0000000
/** field offset */
#define COP_GLOBAL1_VERSION_OFFSET 28
/** COP tables
Specifies the number of supported tables */
#define COP_GLOBAL1_TABLES_MASK 0x0F000000
/** field offset */
#define COP_GLOBAL1_TABLES_OFFSET 24
/** COP cram size
Specifies the number of supported cram entries */
#define COP_GLOBAL1_CRAM_SIZE_MASK 0x00FF0000
/** field offset */
#define COP_GLOBAL1_CRAM_SIZE_OFFSET 16
/** COP dram size
Specifies the size of the memory connected to this cop */
#define COP_GLOBAL1_DRAM_SIZE_MASK 0x0000FFFF
/** field offset */
#define COP_GLOBAL1_DRAM_SIZE_OFFSET 0
/* Fields of "Global config register 2" */
/** Destination TraceID
Specifies the destination TraceID for the trace response */
#define COP_GLOBAL2_TRACE_ID_MASK 0x007F0000
/** field offset */
#define COP_GLOBAL2_TRACE_ID_OFFSET 16
/** Performance cntr enable. (A2X)
This bit enables the performance cntr for each command.This bit not modified by hardware. Only for debugging ! */
#define COP_GLOBAL2_PERF 0x00000002
/** Disable */
#define COP_GLOBAL2_PERF_DIS 0x00000000
/** Enable */
#define COP_GLOBAL2_PERF_EN 0x00000002
/** Trace mode enable.
This bit enables the trace mode while executing a command.This bit not modified by hardware. Only for debugging !Single commands generates two responses (normal and trace)Execute command generates one response after each executed micro code */
#define COP_GLOBAL2_TRACE 0x00000001
/** Disable */
#define COP_GLOBAL2_TRACE_DIS 0x00000000
/** Enable */
#define COP_GLOBAL2_TRACE_EN 0x00000001
/* Fields of "Global config register 3" */
/** Timestamp prescaler
Specifies the prescaler for the timestamp counter */
#define COP_GLOBAL3_PRESCALE_MASK 0x0000FFFF
/** field offset */
#define COP_GLOBAL3_PRESCALE_OFFSET 0
/* Fields of "Global config register 4" (A2X) */
/** Performance counter
If PERF = 1 (GLOBAL2), this register shows the last command process cycle count */
#define COP_GLOBAL4_PERFORMANCE_CNTR_MASK 0xFFFFFFFF
/** field offset */
#define COP_GLOBAL4_PERFORMANCE_CNTR_OFFSET 0
/* Fields of "Global 5 hidden feature register" (A2X) */
/** Hidden write enable code
The hidden register can only written, if this mask has the value 0xF1 */
#define COP_GLOBAL5_WRITE_ENABLE_CODE_MASK 0xFF000000
/** field offset */
#define COP_GLOBAL5_WRITE_ENABLE_CODE_OFFSET 24
/** ADD on empty list (NIL = 0)
ADD inserts also an element on an empty list (NIL = 0).This bit not modified by hardware. */
#define COP_GLOBAL5_ADD_FORCE_TOUCH 0x00000004
/** Disable */
#define COP_GLOBAL5_ADD_FORCE_TOUCH_DIS 0x00000000
/** Enable */
#define COP_GLOBAL5_ADD_FORCE_TOUCH_EN 0x00000004
/** SEARCHW with masked key field
This bit enables the masking of the key field if the entry is written by a SEARCHW command.This bit not modified by hardware. */
#define COP_GLOBAL5_MASKED_SEARCHW 0x00000002
/** Disable */
#define COP_GLOBAL5_MASKED_SEARCHW_DIS 0x00000000
/** Enable */
#define COP_GLOBAL5_MASKED_SEARCHW_EN 0x00000002
/** SEARCHW with ADD protocol
This bit enables the performance cntr for each command.This bit not modified by hardware. */
#define COP_GLOBAL5_NEW_SEARCHW 0x00000001
/** Disable */
#define COP_GLOBAL5_NEW_SEARCHW_DIS 0x00000000
/** Enable */
#define COP_GLOBAL5_NEW_SEARCHW_EN 0x00000001
/* Fields of "Code RAM" */
/** COMMAND to execute
TBD see ip_parser.vsd */
#define COP_CRAM_COMMAND_MASK 0x0000FFFF
/** field offset */
#define COP_CRAM_COMMAND_OFFSET 0
/* Fields of "Custom blocks config register 0" */
/** FID value (A1X)
This register provides the FID value for the custom match function */
#define COP_CUSTOM0_A1X_FID_MASK 0xFFFF0000
/** field offset */
#define COP_CUSTOM0_A1X_FID_OFFSET 16
/** TPID value (A2X)
This register provides the TPID value for the custom match function */
#define COP_CUSTOM0_A2X_TPID_MASK 0xFFFF0000
/** field offset */
#define COP_CUSTOM0_A2X_TPID_OFFSET 16
/** X is true
This bit set the X-condition always true */
#define COP_CUSTOM0_XTRUE 0x00000002
/** Disable */
#define COP_CUSTOM0_XTRUE_DIS 0x00000000
/** Enable */
#define COP_CUSTOM0_XTRUE_EN 0x00000002
/** Activate X
This bit activates the default rule in the custom match function */
#define COP_CUSTOM0_DEFRULE 0x00000001
/** Disable */
#define COP_CUSTOM0_DEFRULE_DIS 0x00000000
/** Enable */
#define COP_CUSTOM0_DEFRULE_EN 0x00000001
/* Fields of "Custom blocks config register 1" */
/** Ethernet type
This register provides the ethernet type register for the custom match function */
#define COP_CUSTOM1_ETY1_MASK 0x0000FFFF
/** field offset */
#define COP_CUSTOM1_ETY1_OFFSET 0
/* Fields of "Custom blocks config register 2" */
/** Ethernet type
This register provides the ethernet type register for the custom match function */
#define COP_CUSTOM2_ETY2_MASK 0x0000FFFF
/** field offset */
#define COP_CUSTOM2_ETY2_OFFSET 0
/* Fields of "Custom blocks config register 3" */
/** Ethernet type
This register provides the ethernet type register for the custom match function */
#define COP_CUSTOM3_ETY3_MASK 0x0000FFFF
/** field offset */
#define COP_CUSTOM3_ETY3_OFFSET 0
/* Fields of "Custom blocks config register 4" */
/** Ethernet type
This register provides the ethernet type register for the custom match function */
#define COP_CUSTOM4_ETY4_MASK 0x0000FFFF
/** field offset */
#define COP_CUSTOM4_ETY4_OFFSET 0
/* Fields of "Custom blocks config register 5" */
/** Ethernet type mask
This register provides the ethernet type mask register for the custom match function */
#define COP_CUSTOM5_ETY_MASK_MASK 0xFFFF0000
/** field offset */
#define COP_CUSTOM5_ETY_MASK_OFFSET 16
/** Ethernet type
This register provides the ethernet type register for the custom match function */
#define COP_CUSTOM5_ETY5_MASK 0x0000FFFF
/** field offset */
#define COP_CUSTOM5_ETY5_OFFSET 0
/* Fields of "Custom blocks config register 6" */
/** Spare1 mask reg
This register provides a future used register for the custom match function */
#define COP_CUSTOM6_SPARE1_MASK_MASK 0xFFFF0000
/** field offset */
#define COP_CUSTOM6_SPARE1_MASK_OFFSET 16
/** Spare1 reg
This register provides a future used register for the custom match function */
#define COP_CUSTOM6_SPARE1_MASK 0x0000FFFF
/** field offset */
#define COP_CUSTOM6_SPARE1_OFFSET 0
/* Fields of "Custom blocks config register 7" */
/** Spare2 mask reg
This register provides a future used register for the custom match function */
#define COP_CUSTOM7_SPARE2_MASK_MASK 0xFFFF0000
/** field offset */
#define COP_CUSTOM7_SPARE2_MASK_OFFSET 16
/** Spare2 reg
This register provides a future used register for the custom match function */
#define COP_CUSTOM7_SPARE2_MASK 0x0000FFFF
/** field offset */
#define COP_CUSTOM7_SPARE2_OFFSET 0
/*! @} */ /* COP_REGISTER */
#endif /* _drv_onu_reg_coplink_cop_h */

1102
src/drv_onu_reg_disp.h Normal file

File diff suppressed because it is too large Load Diff

2035
src/drv_onu_reg_eim.h Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More