#include <semLib.h>
#include <intLib.h>
#include <errno.h>
#include <objLib.h>
#include <iv.h>
#include "BBC/BUG.h"
#include "BBC/INT.ih"
#include "BTU/TEM_ids.h"
#include "BTU/TEM_temInt.h"
#include "BFU/BFM.h"
#include "BFU/BFI.h"
Data Structures | |
| struct | _BFI_gsc |
| Group service context. More... | |
| struct | _BFI_gscList |
| Collection of all group service contexts. More... | |
| struct | _BFI_ssc |
| System Service Context. More... | |
Defines | |
| #define | BFI_M_TEM_INT_ALLOC_MSK (BFI_M_INT_SRC_TEMS << (32 - BFI_K_INT_SRC_TEMS)) |
| A left justified global interrupt mask is defined which contains a value representing interrupts from all the tems, arranged a nibble / TEM. | |
| #define | BIT(_l32, _n) ((_l32 >> _n) & 1) |
| Returns the value of n th bit of 32 bit word _l. | |
| #define | BITC(_l32, _n) (((_l32 >> _n) & 1) ^ 1) |
| Returns the value of the complement n th bit of 32 bit word _l. | |
| #define | BITS(_l32, _r, _w) ((_l32 >> _r) & _w) |
| Returns the right justified value of bit field. More... | |
| #define | BFI_S_ICW_TEMID 4 |
| Size of the TEM id field. | |
| #define | BFI_S_ICW_IRPTS 4 |
| Size of the interrupt source mask field. | |
| #define | BFI_S_ICW_GRPS 24 |
| Size of the service group mask field. | |
| #define | BFI_V_ICW_TEMID 0 |
| Right shift needed to extract tem id. | |
| #define | BFI_V_ICW_IRPTS (BFI_V_ICW_TEMID + BFI_S_ICW_TEMID) |
| Right shift needed to extract source mask. | |
| #define | BFI_V_ICW_GRPS (BFI_V_ICW_IRPTS + BFI_S_ICW_IRPTS) |
| Right shift needed to extract group mask. | |
| #define | BFI_N_ICW_TEMID ((1<<BFI_S_ICW_TEMID)-1) |
| Left justified mask to extract tem id. | |
| #define | BFI_N_ICW_IRPTS ((1<<BFI_S_ICW_IRPTS)-1) |
| Left justified mask to extract source mask. | |
| #define | BFI_N_ICW_GRPS ((1<<BFI_S_ICW_GRPS )-1) |
| Left justified mask to extract group mask. | |
| #define | BFI_M_ICW_TEMID (BFI_N_ICW_TEMID << BFI_V_ICW_TEMID) |
| In place mask to extract tem id. | |
| #define | BFI_M_ICW_IRPTS (BFI_N_ICW_IRPTS << BFI_V_ICW_IRPTS) |
| In place mask to extract source mask. | |
| #define | BFI_M_ICW_GRPS (BFI_N_ICW_GRPS << BFI_V_ICW_GRPS) |
| In place mask to extract group mask. | |
| #define | extractGrps(_icw) ((_icw >> BFI_V_ICW_GRPS ) & BFI_N_ICW_GRPS) |
| Macro to extract the group mask field. | |
| #define | extractIrpts(_icw) ((_icw >> BFI_V_ICW_IRPTS) & BFI_N_ICW_IRPTS) |
| Macro to extract the source mask field. | |
| #define | extractTemid(_icw) ((_icw >> BFI_V_ICW_TEMID) & BFI_N_ICW_TEMID) |
| Macro to extract the tem id field. | |
| #define | insertGrps(_grps) ((_grps & BFI_N_ICW_GRPS )<<BFI_V_ICW_GRPS ) |
| Macro to insert the group mask field. | |
| #define | insertIrpts(_irpts) ((_irpts & BFI_N_ICW_IRPTS)<<BFI_V_ICW_IRPTS) |
| Macro to insert the source mask field. | |
| #define | insertTemid(_temid) ((_temid & BFI_N_ICW_TEMID)<<BFI_V_ICW_TEMID) |
| Macro to insert the tem id field. | |
| #define | BFI_K_INT_MAX (BFI_K_INT_SRC_TEMS) |
| Maximum number of interrupt sources. More... | |
Typedefs | |
| typedef _BFI_gsc | BFI_gsc |
| Typedef for struct _BFI_gsc. More... | |
| typedef _BFI_gscList | BFI_gscList |
| Typedef for struct _BFI_gscList. More... | |
| typedef _BFI_ssc | BFI_ssc |
| Typedef for struct _BFI_ssc. More... | |
| typedef unsigned int | BFI_icw |
| Interrrupt context word. | |
Functions | |
| void | BFI_service (BFI_icw icw) |
| The VME interrupt service routine. More... | |
| int | FFS (unsigned int mask) |
| Provides a straightforward interface to the CNTLZW machine instruction. More... | |
| int | allocate (unsigned int *mask) |
| Allocates the first available group service context block. More... | |
| unsigned int | connect (const struct _TEM_tem *tems, enum _TEM_temId temId, const BFI_gsc *gsc, int groups) |
| Connects all interrupts associated with the specified TEM. More... | |
| int | BFI_connect (void) |
| Connects all interrupts to their specified handlers. More... | |
| unsigned int | BFI_evtThresholdsSet (unsigned int temList, const unsigned int *thresholds) |
| Sets the event threshold for the specified set of TEMS. More... | |
| int | BFI_groupAdd (unsigned int irpts) |
| Defines a group to consist of the specified list of interrupts to service. More... | |
| unsigned int | BFI_groupDisable (BFI_group grpId, unsigned int disable) |
| Disables the specified list of interrupts for the specified group. More... | |
| unsigned int | BFI_groupEnable (BFI_group gscId, unsigned int enable) |
| Disables the specified list of interrupts for the specified group. More... | |
| unsigned int | BFI_groupPend (BFI_group groupId, int timeout) |
| Waits for the firing of any interrupt associated with the specified synchronization group. More... | |
| int | BFI_groupSignal (BFI_group groupId, unsigned int irpts) |
| Allows one to set a soft interrupt on the specified synchronization group. More... | |
| unsigned int | BFI_init (const struct _BFM_dsc *bfm, unsigned int temList, const unsigned int *levels, const unsigned int *base) |
| Initializes the system service context. Each active TEM has an interrupt level and a base vector assigned to it. More... | |
| unsigned int | BFI_errorsGather (unsigned int irpts) |
| Returns a 32 bit mask with the reason for the error interrupts decoded. More... | |
| unsigned int | BFI_masterDisable (unsigned int temList) |
| Disables the master interrupt enable for the specified list of TEMs. More... | |
| unsigned int | BFI_masterEnable (unsigned int temList) |
| Enables the master interrupt enable for the specified list of TEMs. More... | |
| unsigned int | BFI_masterReset (unsigned int temList) |
| Reset the master interrupt enable for the specified list of TEMs. This effectively clears all pending interrupts. More... | |
| int | BFI_minEventsGet (unsigned int temList, unsigned int *nevts) |
| Returns the minimum number of events pending from the specified list of tems, ie temList. More... | |
| unsigned int | BFI_trim (unsigned int temList, unsigned int intList) |
| Convenience routine to trim the interrupt sources associated with unused TEMs from the list. More... | |
| unsigned int | BFI_vmeDisable (unsigned int temList) |
| Disables the VME interrupt for the specified list of TEMs. More... | |
| unsigned int | BFI_vmeEnable (unsigned int temList) |
| Enables the VME interrupt for the specified list of TEMs. More... | |
Variables | |
| BFI_ssc | Bfi_Ssc |
| Global to an instance of this system servicing context block. | |
|
|
Maximum number of interrupt sources.
Since an interrrupt can be associated with only one group, this number determines the maximum number of possible groups. Because a group may service more than one interrupt, the number of groups actually used may be smaller than this number, even in a system with all interrupts active. |
|
|
Returns the right justified value of bit field.
|
|
|
Typedef for struct _BFI_gsc.
Contains all the information needed to define and control an interrupt group. An interrupt group can be associated with multiple interrupt sources, but it always delivers its response to one listener. This allows multiple interrupts to be handle within a single context. For example, all L1T interrupts from each TEM could be enabled and associated with a single group. If any L1T interrupt becomes active, then the context responsible for handling this group will be notified with a wake up call and a parameter indicating which sources are active. |
|
|
Typedef for struct _BFI_gscList.
The current implementation supports 24 distinct groups. This data structure services as a pool for BFI_gsc context blocks needed to define a group service context. Blocks are allocated for this pool.
The |
|
|
Typedef for struct _BFI_ssc.
Gathers together all the information needed to define and control the interrupts. |
|
|
Allocates the first available group service context block.
|
|
|
Connects all interrupts to their specified handlers.
1. The ID of the TEM to service.
2. The bit mask of interrupts that need servicing
3. The bit mask of group ids that perform the servicing.
All active interrupts must have one and only one group associated with them.
NOTE |
|
|
Returns a 32 bit mask with the reason for the error interrupts decoded.
|
|
||||||||||||
|
Sets the event threshold for the specified set of TEMS.
|
|
|
Defines a group to consist of the specified list of interrupts to service.
|
|
||||||||||||
|
Disables the specified list of interrupts for the specified group.
|
|
||||||||||||
|
Disables the specified list of interrupts for the specified group.
|
|
||||||||||||
|
Waits for the firing of any interrupt associated with the specified synchronization group.
|
|
||||||||||||
|
Allows one to set a soft interrupt on the specified synchronization group.
One could have implemented a different scheme where a software interrupt was associated with one and only one group, but there seemed to be no real advantage and it was more complicated. The only advantage I could think of was if the same soft interrupt was associated with multiple groups, allowing a kind of broadcast wake-up capability. This was an interesting idea, but did not mirror the usage of hard interrupts being constrained to be connected with only one group. Currently the only failure mode is if the semGive fails. If one specifies interrupts other than soft interrupts, they are quietly pitched on the ground, that is only the soft interrupts in the irpts will be signalled, any other bits are ignored. |
|
||||||||||||||||||||
|
Initializes the system service context. Each active TEM has an interrupt level and a base vector assigned to it.
|
|
|
Disables the master interrupt enable for the specified list of TEMs.
|
|
|
Enables the master interrupt enable for the specified list of TEMs.
|
|
|
Reset the master interrupt enable for the specified list of TEMs. This effectively clears all pending interrupts.
|
|
||||||||||||
|
Returns the minimum number of events pending from the specified list of tems, ie temList.
|
|
|
The VME interrupt service routine.
This routine is meant to service all interrupts possibilities that a single TEM may produce. When multiple interrupts are present, it may be that more than one group needs to be tickled (ie have its semaphore given).
---------------- Perhaps a good optimization would be to isolate the set of interrupt vectors that service one and only one group to a specific routine. That would save the looping structure and the code that goes with it. |
|
||||||||||||
|
Convenience routine to trim the interrupt sources associated with unused TEMs from the list.
|
|
|
Disables the VME interrupt for the specified list of TEMs.
|
|
|
Enables the VME interrupt for the specified list of TEMs.
|
|
||||||||||||||||||||
|
Connects all interrupts associated with the specified TEM.
|
|
|
Provides a straightforward interface to the CNTLZW machine instruction.
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002