From NBA.com:
FOULS: FLAGRANT-UNSPORTSMANLIKE
To be unsportsmanlike is to act in a manner unbecoming to the image of professional basketball. It consists of acts of deceit, disrespect of officials and profanity. The penalty for such action is a technical foul. Repeated acts shall result in expulsion from the game and a minimum fine of $1000.
A flagrant foul-penalty (1) is unnecessary contact committed by a player against an opponent.
A flagrant foul-penalty (2) is unnecessary and excessive contact committed by a player against an opponent. It is an unsportsmanlike act and the offender is ejected immediately.
The offender will be subject to a fine not exceeding $35,000 and/or suspension by the Commissioner.
See Rule 12B-Section IV for interpretation and penalties.
AND Rule 12B-Section IV says:
Section IV--Flagrant Foul
a. If contact committed against a player, with or without the ball, is interpreted to be unnecessary, a flagrant foul--penalty (1) will be assessed. A personal foul is charged to the offender and a team foul is charged to the team.
PENALTY: (1) Two free throws shall be attempted and the ball awarded to the offended team on either side of the court at the free throw line extended. (2) If the offended player is injured and unable to attempt his free throws, the opposing coach will select any player from the bench to attempt the free throws. (3) This substitute may not be replaced until the ball is legally touched by a player on the court. (EXCEPTION: Rule 3--Section V--e.) (4) The injured player may not return to the game. (5) A player will be ejected if he commits two flagrant fouls in the same game.
b. If contact committed against a player, with or without the ball, is interpret-ed to be unnecessary and excessive, a flagrant foul--penalty (2) will be assessed. A personal foul is charged to the offender and a team foul is charged to the team.
PENALTY: (1) Two free throws shall be attempted and the ball awarded to the offended team on either side of the court at the free throw line extended. (2) If the offended player is injured and unable to attempt his free throws, his coach will select a substitute and any player from the team is eligible to attempt the free throws. (3) This substitute may not be replaced until the ball is legally touched by a player on the court. EXCEPTION: Rule 3--Section V--e. (4) The injured player may return to the game at any time after the free throws are attempted. (5) This is an unsports-manlike act and the offender is ejected.
c. A flagrant foul may be assessed whether the ball is dead or alive.